Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: pedro@codesourcery.com (Pedro Alves)
Cc: gdb-patches@sourceware.org, drow@false.org (Daniel Jacobowitz)
Subject: Re: [rfc] Do not call read_pc in startup_inferior
Date: Thu, 30 Apr 2009 14:27:00 -0000	[thread overview]
Message-ID: <200904301425.n3UEPMhk019694@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <200904291407.11541.pedro@codesourcery.com> from "Pedro Alves" at Apr 29, 2009 02:07:11 PM

Pedro Alves wrote:

> Actually, currently it is hard to stop at the entry point
> in most targets.  `proceed' will step over a breakpoint set right
> at the entry point exactly due to this stop_pc == current pc, even
> if it was never hit.  This leads to people using the "set breakpoint
> at `entry point' + 1, instead of `entry point'" trick.
> 
> Maybe we should make run_command_1
> call `proceed (current_pc, TARGET_SIGNAL_0, 0)' instead of
> `proceed (-1, TAR...)'.  This would (partially) fix the bpkt at
> entry issue, while also making sure that `proceed' isn't faced with a
> completely random random stop_pc if we pass it -1.

I see.  It seems "stop_pc" isn't really the proper mechanism for this.
(See also the problems with skipping breakpoints in multi-threaded 
applications that Doug Evans has been working on ...)

What would you think about the following replacement for stop_pc:

- Per thread, maintain a "last stop reason" state that identifies
  *where* and *why* this thread stopped.

- We skip a breakpoint whenever we're about to restart a thread and
  its "last stop reason" is "breakpoint" with an address equal to
  the restart address (and there's still a breakpoint at this location).

- In "info program", display the last stop reason of the current
  thread (or maybe all threads?). 

- In solib-sunos.c, just use regcache_read_pc.

> (I believe there are other problems that make GDB ignore
> breakpoints set at the entry point, e.g., if it happens to
> be the same place we have a BPSTAT_WHAT_CHECK_SHLIBS breakpoint.)

Hmm, if we have two breakpoints at the same address, one that is
supposed to silently restart, and one that is supposed to be
reported to the user, shouldn't the second one always "win"?

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


  reply	other threads:[~2009-04-30 14:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-28 16:37 Ulrich Weigand
2009-04-28 19:28 ` Daniel Jacobowitz
2009-04-29 12:33   ` Ulrich Weigand
2009-04-29 13:07     ` Pedro Alves
2009-04-30 14:27       ` Ulrich Weigand [this message]
2009-04-30 15:55         ` Pedro Alves
2009-05-04 17:40           ` Ulrich Weigand
2009-05-05 21:43             ` Pedro Alves
2009-05-05 13:28 ` Ulrich Weigand

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=200904301425.n3UEPMhk019694@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.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