public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/13545] New: Incorrect handling of invalid breakpoints
@ 2011-12-29 15:26 mike_wrighton at mentor dot com
  2011-12-30 17:29 ` [Bug breakpoints/13545] " mike_wrighton at mentor dot com
  0 siblings, 1 reply; 2+ messages in thread
From: mike_wrighton at mentor dot com @ 2011-12-29 15:26 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13545

             Bug #: 13545
           Summary: Incorrect handling of invalid breakpoints
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
        AssignedTo: unassigned@sourceware.org
        ReportedBy: mike_wrighton@mentor.com
    Classification: Unclassified


(Linux x86, MI mode)

If the user inserts an invalid breakpoint (e.g. 0x0) when gdb is suspended,
then continues, gdb first reports the target as running, then shows a warning
and reports that the target has stopped:

^running
*running,thread-id="1"
(gdb)
&"Warning:\n"
&"Cannot insert breakpoint 2.\n"
&"Error accessing memory address 0x0: Input/output error.\n"
&"\n"
~"0x08048422 in main () at
/home/mike/mentor/workspaces/runtime-New_configuration/test/src/test.c:14\n"
~"14\t n = factorial ;\n"
*stopped,frame=
...

This is confusing for IDEs as it appears that the continue command has
completed with no errors. Gdb handles subsequent continue commands correctly
e.g. the command is rejected with '^error'.

After some investigation, what appears to be happening is that gdb replaces and
steps over the current instruction before it attempts to insert the invalid
breakpoint, and in stepping that instruction it reports that the target is
running. When it resumes to insert the invalid breakpoint, it errors, although
the error is just printed and not passed up back to the continue command
function. At this point gdb is in an invalid state - the PC is at the original
location + 1 and subsequent calls to continue fail.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug breakpoints/13545] Incorrect handling of invalid breakpoints
  2011-12-29 15:26 [Bug breakpoints/13545] New: Incorrect handling of invalid breakpoints mike_wrighton at mentor dot com
@ 2011-12-30 17:29 ` mike_wrighton at mentor dot com
  0 siblings, 0 replies; 2+ messages in thread
From: mike_wrighton at mentor dot com @ 2011-12-30 17:29 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13545

--- Comment #1 from Mike <mike_wrighton at mentor dot com> 2011-12-30 17:28:37 UTC ---
Created attachment 6136
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6136
Patch

Added a patch which makes 2 changes to resolve this issue:

1. Only reports the target state as running if it is not in stepping mode in
target_resume().

2. Throws an exception if insert_breakpoints() fails in keep_going(), rather
than printing an error message. This way the continue command will fail
properly.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-30 17:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-29 15:26 [Bug breakpoints/13545] New: Incorrect handling of invalid breakpoints mike_wrighton at mentor dot com
2011-12-30 17:29 ` [Bug breakpoints/13545] " mike_wrighton at mentor dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).