[PATCH] arm reversible : <phase_2_complete>

Tom Tromey tromey@redhat.com
Thu Apr 28 19:00:00 GMT 2011


>>>>> "Oza" == paawan oza <paawan1982@yahoo.com> writes:

Tom> It seems to me that extract_typed_address or something similar would be
Tom> better.

Oza> 1)  are suggesting to use something else than unions ? whatever you have 
Oza> described about union is right.

Oza> 2)  why could I use extract_typed_address instead of direct assignment ?

extract_typed_address handles endianess and conversion from "array of
bytes" to "host scalar".

Oza> 3) in my understanding cross debug would not affect endianess
Oza> because all the record saving done on target memory and played back
Oza> in target memory.  they never get fetched to host machine I think.
Oza> please clarify how would it affect host/target endianness issue ?

Here is a snippet from the patch:

+      GET_REG_VAL (reg_cache, ARM_PC_REGNUM, &u_buf.buf[0]);
[...]
+      start_address = u_buf.s_word -  \
+                   (4 * (bit (thumb_insn_r->arm_insn, 8) + register_count)) ;

Here, this fetches the raw register bits from the cache, which, IIUC,
are in target order.  Then it uses the union to turn this into a scalar,
and does math on the scalar value.

So, if the host and target endianness differ, you will get the wrong
result.

Maybe I am missing something here?

Tom



More information about the Gdb mailing list