linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Glynn Clements <glynn@gclements.plus.com>
To: Holger Kiehl <Holger.Kiehl@dwd.de>
Cc: Manish Katiyar <mkatiyar@gmail.com>, linux-c-programming@vger.kernel.org
Subject: Re: Question about core files
Date: Sat, 10 Oct 2009 09:35:08 +0100	[thread overview]
Message-ID: <19152.18236.807486.755513@cerise.gclements.plus.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0910091238000.12677@diagnostix.dwd.de>


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.

-- 
Glynn Clements <glynn@gclements.plus.com>

  reply	other threads:[~2009-10-10  8:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-06 14:04 Question about core files Holger Kiehl
2009-10-06 14:41 ` Manish Katiyar
2009-10-07 13:28   ` Holger Kiehl
2009-10-07 13:54     ` Manish Katiyar
2009-10-07 14:21       ` Holger Kiehl
2009-10-07 17:36         ` Manish Katiyar
2009-10-08 18:47           ` Manish Katiyar
2009-10-09 12:09           ` Holger Kiehl
2009-10-09 12:15             ` Manish Katiyar
2009-10-09 12:43               ` Holger Kiehl
2009-10-10  8:35                 ` Glynn Clements [this message]
2009-10-10  9:08                   ` Manish Katiyar
2009-10-10 16:56                   ` Holger Kiehl
2009-10-07  4:45 ` Glynn Clements
2009-10-07 13:43   ` Holger Kiehl
2009-10-08  0:28     ` Glynn Clements
2009-10-09 12:12       ` Holger Kiehl
2009-10-07  4:58 ` vinit dhatrak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19152.18236.807486.755513@cerise.gclements.plus.com \
    --to=glynn@gclements.plus.com \
    --cc=Holger.Kiehl@dwd.de \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=mkatiyar@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).