This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/2488: "next" command in a function that throws a C++ exception causes GDB to lose control of the inferior


>Number:         2488
>Category:       c++
>Synopsis:       "next" command in a function that throws a C++ exception causes GDB to lose control of the inferior
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 01 15:18:02 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     pmuldoon@redht.com
>Release:        6..8
>Organization:
>Environment:
Linux
>Description:
Run the next command in a function that throws a C++ exception. The inferior is not stopped as described in next command help. The inferior continues until program exit, or an unrelated breakpoint triggers. Expectation is that the inferior should either stop in the first local variable destructor  (if there is one) or in the matching catch exception handler (if there is one).

>How-To-Repeat:
The included test-case shows the behaviour. Step to func1, then run "next" from that function. The program will exit. It should stop in the the catch exception handler in this case.
>Fix:
Looking at next_command() it installed four momentary breakpoints (longjmp/siglongjmp/_longjnp/_siglongjmp) and resumes the inferior. C++ Exception handling does not use this method, but instead relies on dwarf register annotations and unwinding the stack and type-checking exception handlers. next command needs to account for methods other than longjmp. 
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-c++src; name="simplest_next_fail.cxx"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="simplest_next_fail.cxx"

I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBmdW5jMSgpIAp7
CiAgLy8gYnJlYWsgc29tZXdoZXJlIGFuZCBzdGVwIGhlcmUuCiAgLy8gUnVuIG5leHQgb3IgZmlu
aXNoIGZyb20gaGVyZS4gCiAgLy8gQ29udHJvbCBvZiB0aGUgaW5mZXJpb3Igc2hvdWxkIGJlIHJl
Z2FpbmVkCiAgLy8gaW4gdGhlIGNhdGNoICguLi4pIGluIG1haW4uCiAgdGhyb3cgMjA7Cn0KCmlu
dCBtYWluICgpIHsKICB0cnkgCiAgICB7CiAgICAgIGZ1bmMxKCk7CiAgICB9CiAgY2F0Y2ggKC4u
LikgCiAgICB7CiAgICAgIC8vIENhdGNoIHRoZSB0aHJvdyBpbiBmdW5jMS4gbmV4dCBvciBmaW5p
c2ggc2hvdWxkIHJldHVybgogICAgICAvLyBjb250cm9sIGhlcmUuCiAgICAgIGNvdXQgPDwgIlNo
b3VsZCByZWdhaW4gY29udHJvbCBvZiBpbmZlcmlvciBoZXJlLiIgPDwgZW5kbDsKICAgIH0KCiAg
Ly8gQnV0IGl0IGRvZXNuJ3QsIGl0IGtlZXBzIG9uIGdvaW5nIC4uLi4KICBjb3V0IDw8ICJFeGl0
aW5nIHRoZSBwcm9ncmFtLiIgPDwgZW5kbDsKICByZXR1cm4gMDsKfQo=


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]