Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: Doug Evans <dje@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Only try to load libthread_db when we load libpthread.
Date: Mon, 10 Oct 2011 18:23:00 -0000	[thread overview]
Message-ID: <201110101922.54265.pedro@codesourcery.com> (raw)
In-Reply-To: <CADPb22R8Czx79tGM1QLNQBrPOmg+dCwjRp5PPn4yi_J6pfW4Mw@mail.gmail.com>

On Monday 10 October 2011 06:01:00, Doug Evans wrote:
> On Fri, Oct 7, 2011 at 4:09 AM, Pedro Alves <pedro@codesourcery.com> wrote:
> > Well, at least things should work the same as before, which IMO
> > is good thing as it makes this change an optimization only.
> 
> That's the intent.
> 
> > Still breaks activating thread_db when debugging cores of
> > static executables.

> It turns out things work today accidentally.
> At least I doubt it's by design. :-)

Yeah.  :-)

> My previous patch didn't work because it skipped calling
> check_for_thread_db when the new_objfile observer was called for
> vsyscall (which incidentally is called by the inferior_created
> observer for vsyscall, heh).
> [Which explains why it didn't surprise me when my before-test failed,
> that's a pretty unexpected way to load libthread_db.]
> 
> How about this.

This version goes back to breaking the "file right_executable" core
or attach cases (with static binaries) that the previous patch
fixed.  :-)  You need _both_ the observer, and the OBJF_MAINLINE thing.
The observer handles the case of loading the static executable into gdb before
loading the core or attaching to a process (gdb exec -c core), and
the OBJF_MAINLINE thing handles the opposite scenario (gdb -c core; file exec).

> +/* This function is called via the inferior_created observer.
> +   This handles the case of debugging statically linked executables.  */

As mentioned before, !cores are handled by:

static void
linux_child_post_attach (int pid)
{
  linux_enable_event_reporting (pid_to_ptid (pid));
  check_for_thread_db ();
  linux_enable_tracesysgood (pid_to_ptid (pid));
}

static void
linux_child_post_startup_inferior (ptid_t ptid)
{
  linux_enable_event_reporting (ptid);
  check_for_thread_db ();
  linux_enable_tracesysgood (ptid);
}

So this handles the case of debugging _cores_ of statically
linked executables, as those don't use linux-nat.c.  With this
new observer, we could even remove those two check_for_thread_db
calls above.

> +
> +static void
> +thread_db_inferior_created (struct target_ops *target, int from_tty)

This is okay with me with the OBJF_MAINLINE changes merged back in,
and the comment mentioned above adjusted.

Thanks.

-- 
Pedro Alves


  reply	other threads:[~2011-10-10 18:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-05 18:27 Doug Evans
2011-10-06 11:22 ` Pedro Alves
2011-10-06 19:56   ` Pedro Alves
2011-10-06 20:08     ` Doug Evans
2011-10-06 20:26       ` Pedro Alves
2011-10-06 21:56         ` Doug Evans
2011-10-06 22:06           ` Doug Evans
2011-10-07 11:09             ` Pedro Alves
2011-10-10  5:01               ` Doug Evans
2011-10-10 18:23                 ` Pedro Alves [this message]
2011-10-11  3:38                   ` Doug Evans

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=201110101922.54265.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=dje@google.com \
    --cc=gdb-patches@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