On Sat, Oct 10, 2009 at 2:05 PM, Glynn Clements
<glynn@xxxxxxxxxxxxxxxxxx> wrote:
>
> Holger Kiehl wrote:
>
>> How can I find which register is fsa_pos?
>
> fsa_pos is a parameter, and doesn't appear to be changed within the
> function, so I would expect "print fsa_pos" to give the correct value.
>
> AFAICT, the following portion of the disassembly:
>
> 0x0000000000404b49 <start_process+121>: movslq 0x24(%rsp),%rax
> 0x0000000000404b4e <start_process+126>: imul $0x8f8,%rax,%r14
> 0x0000000000404b55 <start_process+133>: mov %r14,%rax
> 0x0000000000404b58 <start_process+136>: add 0x225441(%rip),%rax # 0x629fa0 <fsa>
> 0x0000000000404b5f <start_process+143>: mov 0xec(%rax),%edx
> 0x0000000000404b65 <start_process+149>: test $0x1,%dl
>
> corresponds to the expression
>
> fsa[fsa_pos].host_status & DO_NOT_DELETE_DATA
>
> 0x24(%rsp) is fsa_pos, $0x8f8 (2296) is the size of each element of
> fsa[], 0x225441(%rip) is fsa, 0xec is the offset of the host_status
> field.
>
> So:
>
> movslq 0x24(%rsp),%rax # %rax = fsa_pos
> imul $0x8f8,%rax,%r14 # %r14 = fsa_pos * sizeof(fsa[i]) = &fsa[fsa_pos] - &fsa[0]
> mov %r14,%rax # %rax = &fsa[fsa_pos] - &fsa[0]
> add 0x225441(%rip),%rax # %rax = &fsa[fsa_pos]
> mov 0xec(%rax),%edx # %edx = fsa[fsa_pos].host_status
>
> Based upon this, %r14 should contain fsa_pos * 2296, so:
>
>> (gdb) info registers
>> r14 0xfffffffffffff708 -2296
>
> Which suggests that fsa_pos is -1.
Excellent Glynn .... thanks :-) . I was having trouble deciphering it .
>
> --
> Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx>
>
--
Thanks -
Manish
==================================
[$\*.^ -- I miss being one of them
==================================
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Linux Assembler]
[Git]
[Kernel List]
[Fedora Development]
[Fedora Announce]
[Autoconf]
[Yosemite Campsites]
[Yosemite News]
[GCC Help]