Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Ross Morley <ross@tensilica.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Program Breakpoints
Date: Thu, 30 Apr 2009 19:14:00 -0000	[thread overview]
Message-ID: <49F9F86E.9040308@tensilica.com> (raw)
In-Reply-To: <200904301930.13526.pedro@codesourcery.com>


Pedro Alves wrote:

>Before looking at the code, I'd like to see the interaction of
>program breakpoints with decr_pc_after_break adjustment formalized.
>I did a quick skim and couldn't find it handled.
>  
>
>E.g, if you were to implement support for this on x86 gdbserver,
>assuming int3 traps, it appears to me that the only option is
>for the target to always rewind the pc before reporting to GDB, and
>for GDB to never adjust it itself, even for regular breakpoint hits,
>otherwise, e.g., consecutive breakpoints will be mishandled.  This
>also suggests that there has to be prior negotiation (qSupported) to
>enable the support.  Has this been considered?
>  
>
I have thought about this. I understand decr_pc_after_break is for archs
that have already incremented the PC after hitting a trap, so GDB needs
to decrement it back to the trap in order to replace it with the original
code to step over it.

No special handling is needed for program breakpoints because:

- decr_pc_after_break only applies to breakpoints inserted by GDB
  and therefore known to GDB (adjust_pc_after_break in infrun.c
  appears to only adjust the PC if it hit a software break known
  to GDB). Program breakpoints are by definition not those, and
  their special handling is not applied to those. If a target were
  to adjust the PC for a program breakpoint, it would then have to
  report a non-zero size in STOPPED_BY_TRAP_INSTRUCTION (see next
  bullet), but that would not be the normal handling for such archs.

- decr_pc_after_break archs report size==0 in their implementation
  of STOPPED_BY_TRAP_INSTRUCTION(&size). That means the PC does not
  need adjustment to step over a program breakpoint. GDB will report
  it stopped for a program breakpoint (if it wasn't in the breakpoint
  table) but will not do anything special on resume. Perhaps I should
  make that clearer in the comment in target.h on that macro, by
  explicit reference to decr_pc_after_break.

>(A small request: please include the -p switch in your `cvs diff'
>commands, or add it to .cvsrc.  I use -Nurp myself.)
>
>  
>
OK.

Thanks,
Ross


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

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-30 18:05 Ross Morley
2009-04-30 18:30 ` Pedro Alves
2009-04-30 19:14   ` Ross Morley [this message]
2009-05-04 22:49     ` Ross Morley
2009-05-04 23:14       ` Pedro Alves
2009-05-04 23:17         ` Ross Morley
2009-05-13  4:24           ` Ross Morley
  -- strict thread matches above, loose matches on Subject: below --
2009-05-19 17:30 [Fwd: Re: [PATCH] Program Breakpoints] Ross Morley
2009-05-19 18:58 ` Pedro Alves
2009-05-27  1:49   ` [PATCH] Program Breakpoints Ross Morley
2009-04-18  1:51 [Fwd: [PATCH] Program Breakpoints] Ross Morley
2009-04-22  1:22 ` [PATCH] Program Breakpoints Ross Morley
2009-04-22  3:12   ` Eli Zaretskii
2009-04-27  7:07     ` Ross Morley
2009-04-18  1:33 Ross Morley
2009-04-18  6:21 ` Eli Zaretskii
2009-04-18  6:30   ` Eli Zaretskii
2009-04-18  7:58   ` Ross Morley

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=49F9F86E.9040308@tensilica.com \
    --to=ross@tensilica.com \
    --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