Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sourceware.org
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>
Subject: Re: [RFC] Limit attempts to place breakpoints on _start, __start, and main in solib-svr4.c
Date: Wed, 01 Dec 2010 01:06:00 -0000	[thread overview]
Message-ID: <20101130180618.66003c99@mesquite.lan> (raw)
In-Reply-To: <20101130000707.GA26969@host0.dyn.jankratochvil.net>

On Tue, 30 Nov 2010 01:07:07 +0100
Jan Kratochvil <jan.kratochvil@redhat.com> wrote:

> > -enable_break (struct svr4_info *info, int from_tty)
> > +enable_break (struct svr4_info *info, int from_tty, int from_run_command)
> 
> I haven't tried it myself but is there a reason why not to use
> `struct inferior->attach_flag' instead?

Hi Jan,

This appeared to be a very promising suggestion.  One of the things
that I find unfortunate about my patch is that it touches more code
than I'd like.  Therefore, I was excited when you suggested the use
of `attach_flag' because it'd reduce that multi-page patch that I
posted to just a few lines.

My testing shows that use of `! current_inferior ()->attach_flag' as
the test in enable_break() works when attaching to a process started
natively.  I also see the correct behavior (in which a breakpoint is
placed on _start, et al) when the process is started via GDB's
"run" command.

The case that doesn't work - and, unfortunately, it's the case that
really matters to me - is connecting to a remote target via "target
remote".  A cursory glance at remote.c shows that `attach_flag' is set
appropriately in several places, but a somewhat deeper analysis
reveals that post_create_inferior() (which, for svr4 shared libs,
eventually calls enable_break()) is called well in advance of the
code which sets `attach_flag'.  Bummer.

The patch that I've posted does correctly handle the "target remote"
case.  (It correctly handles the native cases too.)

Kevin


  parent reply	other threads:[~2010-12-01  1:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-29 23:02 Kevin Buettner
2010-11-30  0:07 ` Jan Kratochvil
2010-11-30  5:15   ` Kevin Buettner
2010-12-01  1:06   ` Kevin Buettner [this message]
2010-12-01 23:03     ` Jan Kratochvil
2010-12-03 21:04       ` Kevin Buettner
2010-12-05 19:47         ` Mark Kettenis
2010-12-07  7:41         ` Jan Kratochvil
2010-12-13 15:47         ` Kevin Buettner

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=20101130180618.66003c99@mesquite.lan \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.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