[fedora-arm] Understanding gdb disassembly output

Jon Masters jcm at redhat.com
Tue May 1 21:31:09 UTC 2012


On 05/01/2012 05:10 PM, Daniel Drake wrote:

> Specifically this bit looks of interest:
> 
>    0x499fe5d4:	ldr	r8, [pc, #31461008]	; 0x499fea44
>    0x499fe5d8:	blx	r8
> 
> So the first instruction here says "take the data at address
> pc+31461008 and save it in r8".
> pc is always 8 bytes on from the address of the current instruction,
> so at the moment pc = 0x499fe5d4 + 8 = 0x499fe5dc

I failed to spell out on IRC that the value you want for the offset is
the one in the comment (value_in_comment). The raw #31461008 contains
non-addressing bits taken from the ARM encoding. So actually, it's
saying to load r8 with the value at 0x499fea44.

The gory details are in print_arm_address in gdb, which is also where
we'll add 8 to the value of the pc in the offset so you don't need to.

Perhaps sometime someone might document gdb on ARM a little more...

Jon.


More information about the arm mailing list