Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Mathieu Lacage <mathieu.lacage@gmail.com>
To: Mathieu Lacage <mathieu.lacage@gmail.com>, gdb@sourceware.org
Subject: Re: _r_debug_state getting screwed on x86_64 ?
Date: Mon, 20 Jul 2009 14:43:00 -0000	[thread overview]
Message-ID: <74fef6df0907200743x51c18b2cva6dc22d493265a45@mail.gmail.com> (raw)
In-Reply-To: <20090720120323.GA27912@caradoc.them.org>

On Mon, Jul 20, 2009 at 2:03 PM, Daniel Jacobowitz<drow@false.org> wrote:
>> (gdb) si
>> warning: Temporarily disabling breakpoints for unloaded shared library "../ldso"
>> Stopped due to shared library event
>
> This is your problem.  You're supposed to have ldso in the list
> already.

ha, I see: thanks for putting me on the right track.

1) gdb initializes its linkmap from the inferior's PT_INTERP (coming
from its auxv)
2) when the dynamic loader calls _r_debug_state for the first time,
gdb iterates over the linkmap and assumes that any item which is
present in its own linkmap and which is not present in the inferior's
linkmap has been unloaded.

In my case, the filename of the ldso entry in the inferior's linkmap
did not match _exactly_ the inferior's main PT_INTERP so, gdb wrongly
assumed it was unloaded. Then, it disabled the breakpoint from the
inferior's _r_debug_state, hence, leaving around the int3 I observed
below.

>
>> ------------ and, yes, we can see the gdb int3 instruction in the
>> function. -------------
>
> And that's not a feature.  You should never be able to observe gdb's
> software breakpoints by reading memory with GDB; if you do, it means
> something has already gone wrong.

I just had to adjust the filename field of my inferior's ldso entry in
the linkmap, and, gone were the crashes :)

Mathieu
-- 
Mathieu Lacage <mathieu.lacage@gmail.com>


      reply	other threads:[~2009-07-20 14:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-20 11:18 Mathieu Lacage
2009-07-20 12:03 ` Daniel Jacobowitz
2009-07-20 14:43   ` Mathieu Lacage [this message]

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=74fef6df0907200743x51c18b2cva6dc22d493265a45@mail.gmail.com \
    --to=mathieu.lacage@gmail.com \
    --cc=gdb@sourceware.org \
    /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