This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
breakpoints/2457: Incorrect handling of erroneous breakpoint conditions
- From: fchouinard at gmail dot com
- To: gdb-gnats at sources dot redhat dot com
- Date: 13 May 2008 21:54:23 -0000
- Subject: breakpoints/2457: Incorrect handling of erroneous breakpoint conditions
- Reply-to: fchouinard at gmail dot com
>Number: 2457
>Category: breakpoints
>Synopsis: Incorrect handling of erroneous breakpoint conditions
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue May 13 21:58:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator: Francois Chouinard
>Release: GNU gdb 6.8-debian
>Organization:
>Environment:
Ubuntu 8.04 (Hardy Heron)
>Description:
When setting a condition on an existing breakpoint, GDB performs essentially the following steps (I skip the multi-location handling):
- Clear any existing condition
- Attach the new condition on the breakpoint
- Validate the condition (in context) using the parser
The problem occurs when the condition fails the validation: an exception is thrown and the subsequent longjmp() unrolls the stack beyond condition_command(). This prevents the caller from recovering from the error and leaves the breakpoint in an undesirable state (IMHO).
See the attached trace for an example.
>How-To-Repeat:
Follow the steps in the attached file.
>Fix:
Ideally, the exception should be caught and handled properly but this is a real pain in C.
There is a very simple solution (2 lines of code!) which I could provide if you want.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="bp_cond.problem"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bp_cond.problem"
ZnJhbmNvaXNAc3VzaGk6fi9UZXN0cyQgL3Vzci9iaW4vZ2RiIEhlbGxvCkdOVSBnZGIgNi44LWRl
YmlhbgpDb3B5cmlnaHQgKEMpIDIwMDggRnJlZSBTb2Z0d2FyZSBGb3VuZGF0aW9uLCBJbmMuCkxp
Y2Vuc2UgR1BMdjMrOiBHTlUgR1BMIHZlcnNpb24gMyBvciBsYXRlciA8aHR0cDovL2dudS5vcmcv
bGljZW5zZXMvZ3B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