From: Pedro Alves <pedro@codesourcery.com>
To: gdb@sourceware.org
Cc: Aleksandar Ristovski <aristovski@qnx.com>
Subject: Re: [RFC] stepping over permanent breakpoint
Date: Mon, 16 Mar 2009 19:38:00 -0000 [thread overview]
Message-ID: <200903161938.13219.pedro@codesourcery.com> (raw)
In-Reply-To: <gpm7av$8fa$1@ger.gmane.org>
On Monday 16 March 2009 18:55:27, Aleksandar Ristovski wrote:
> Pedro Alves wrote:
> > On Monday 16 March 2009 17:40:49, Aleksandar Ristovski wrote:
> >> However, on systems that do not need pc adjustment after
> >> break (like QNX) gdb will not be able to step over that
> >> breakpoint (...)
> >
> >> (...) unless user explicitly sets a breakpoint on top
> >> of it.
> >
> > Which I think your patch breaks? :-)
>
> No, it doesn't, it will behave as before. Observe where is
> the code I added, it is inside
> if (gdbarch_decr_pc_after_break (gdbarch) == 0)
> so for linux, it won't even be executed.
Not all architectures that run linux need PC adjustment. You're
thinking x86-linux. Anyway, I meant that you're breaking setting
a user breakpoint on top of a permanent breakpoint. Try
setting a breakpoint with "break *int3_addr", on top
of that int3, and running to it. When it is hit, you're moving
the PC passed it, so later calls to bpstat_stop_status like:
/* See if there is a breakpoint at the current PC. */
ecs->event_thread->stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid);
... will not see the permanent breakpoint, right?
> I have tried path similar to what you suggest. It seems more
> correct, but I would think that in addition to what you are
> doing, it would also need a change in adjust_pc_after_break
> to still decrement PC (to point to just-hit hardcoded
> breakpoint). Normally, adjust_pc_after_break will (on linux)
> miss this case and leave pc to point to instruction
> following breakpoint instruction.
Yeah, I considered that, but I think that it is legitimate to
want to pass SIGTRAPs to the inferior, and have a SIGTRAP handler
see whatever it would see if GDB wasn't there. This may be
useful for debugging programs that embed a gdb stub in process,
for example. So, on decr_pc_after_break != 0 targets, I'd leave
things as they are.
Mark's point about considering a trap instruction as a normal
instruction is valid, so I'm not sure if we'd want to do this
skipping by default or not. I'll let you guys fight
over it. :-)
--
Pedro Alves
next prev parent reply other threads:[~2009-03-16 19:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-16 17:41 Aleksandar Ristovski
2009-03-16 18:22 ` Pedro Alves
2009-03-16 18:55 ` Aleksandar Ristovski
2009-03-16 19:38 ` Pedro Alves [this message]
2009-03-16 20:37 ` Aleksandar Ristovski
2009-03-16 18:50 ` Mark Kettenis
2009-03-16 19:04 ` Aleksandar Ristovski
2009-03-23 16:50 ` RFC: Program Breakpoints (was: [RFC] stepping over permanent breakpoint) Ross Morley
2009-03-24 16:57 ` Daniel Jacobowitz
2009-03-24 20:33 ` RFC: Program Breakpoints Ross Morley
2009-03-24 20:40 ` Daniel Jacobowitz
2009-03-24 23:48 ` Pedro Alves
2009-03-25 7:58 ` Mark Kettenis
2009-03-25 13:17 ` Pedro Alves
2009-03-24 23:59 ` Ross Morley
2009-03-31 0:44 ` Ross Morley
2009-03-31 3:17 ` Daniel Jacobowitz
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=200903161938.13219.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=aristovski@qnx.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