Re: Question about core files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 10 Oct 2009, Glynn Clements 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.

Unfortunately not:

   (gdb)
   #4  0x0000000000404b5f in start_process ()
   (gdb) print fsa_pos
   No symbol "fsa_pos" in current context.

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.

Many thanks for this very detailed explanation and confirming that
fsa_pos was indeed -1. I would never have thought that one could find
so much information of a core from an optimized binary without debug
information.

Thanks to you and Manish Katiyar for this valuable help!

Regards,
Holger
--
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

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux