public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/9593] "next" command in a function that throws a C++ exception causes GDB to lose control of the inferior
       [not found] <bug-9593-4717@http.sourceware.org/bugzilla/>
  2010-12-09 16:12 ` [Bug c++/9593] "next" command in a function that throws a C++ exception causes GDB to lose control of the inferior cvs-commit at gcc dot gnu.org
@ 2010-12-09 16:12 ` tromey at redhat dot com
  2010-12-10 13:06 ` tromey at redhat dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: tromey at redhat dot com @ 2010-12-09 16:12 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at redhat dot com

--- Comment #4 from Tom Tromey <tromey at redhat dot com> 2010-12-09 16:11:56 UTC ---
*** Bug 8519 has been marked as a duplicate of this bug. ***

-- 
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] 12+ messages in thread

* [Bug c++/9593] "next" command in a function that throws a C++ exception causes GDB to lose control of the inferior
       [not found] <bug-9593-4717@http.sourceware.org/bugzilla/>
@ 2010-12-09 16:12 ` cvs-commit at gcc dot gnu.org
  2010-12-09 16:12 ` tromey at redhat dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2010-12-09 16:12 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> 2010-12-09 16:10:01 UTC ---
CVSROOT:    /cvs/src
Module name:    src
Changes by:    tromey@sourceware.org    2010-12-09 16:09:55

Modified files:
    gdb            : ChangeLog breakpoint.c breakpoint.h gdbthread.h 
                     infcmd.c inferior.h infrun.c thread.c 
    gdb/testsuite  : ChangeLog 
Added files:
    gdb/testsuite/gdb.cp: nextoverthrow.cc nextoverthrow.exp 
    gdb/testsuite/gdb.java: jnpe.exp jnpe.java 

Log message:
    gdb
    PR c++/9593:
    * thread.c (clear_thread_inferior_resources): Call
    delete_longjmp_breakpoint.
    * infrun.c (handle_inferior_event): Handle exception breakpoints.
    (handle_inferior_event): Likewise.
    (insert_exception_resume_breakpoint): New function.
    (check_exception_resume): Likewise.
    * inferior.h (delete_longjmp_breakpoint_cleanup): Declare.
    * infcmd.c (delete_longjmp_breakpoint_cleanup): No longer static.
    (step_1): Set thread's initiating frame.
    (until_next_continuation): New function.
    (until_next_command): Support exception breakpoints.
    (finish_command_continuation): Delete longjmp breakpoint.
    (finish_forward): Support exception breakpoints.
    * gdbthread.h (struct thread_info) <initiating_frame>: New field.
    * breakpoint.h (enum bptype) <bp_exception, bp_exception_resume,
    bp_exception_master>: New constants.
    (struct bpstat_what) <is_longjmp>: New field.
    (set_longjmp_breakpoint): Update.
    * breakpoint.c (create_exception_master_breakpoint): New function.
    (update_breakpoints_after_exec): Handle bp_exception_master.  Call
    create_exception_master_breakpoint.
    (print_it_typical): Handle bp_exception_master, bp_exception.
    (bpstat_stop_status): Handle bp_exception_master.
    (bpstat_what): Handle bp_exception_master, bp_exception,
    bp_exception_resume.
    (bptype_string): Likewise.
    (print_one_breakpoint_location): Likewise.
    (allocate_bp_location): Likewise.
    (set_longjmp_breakpoint): Handle exception breakpoints.  Change
    interface.
    (delete_longjmp_breakpoint): Handle exception breakpoints.
    (mention): Likewise.
    (struct until_break_command_continuation_args) <thread_num>: New
    field.
    (until_break_command_continuation): Call
    delete_longjmp_breakpoint.
    (until_break_command): Support exception breakpoints.
    (delete_command): Likewise.
    (breakpoint_re_set_one): Likewise.
    (breakpoint_re_set): Likewise.
    gdb/testuite
    * gdb.java/jnpe.java: New file.
    * gdb.java/jnpe.exp: New file.
    * gdb.cp/nextoverthrow.exp: New file.
    * gdb.cp/nextoverthrow.cc: New file.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.12367&r2=1.12368
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/breakpoint.c.diff?cvsroot=src&r1=1.518&r2=1.519
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/breakpoint.h.diff?cvsroot=src&r1=1.127&r2=1.128
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbthread.h.diff?cvsroot=src&r1=1.58&r2=1.59
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/infcmd.c.diff?cvsroot=src&r1=1.270&r2=1.271
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/inferior.h.diff?cvsroot=src&r1=1.146&r2=1.147
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/infrun.c.diff?cvsroot=src&r1=1.460&r2=1.461
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/thread.c.diff?cvsroot=src&r1=1.124&r2=1.125
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.2525&r2=1.2526
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.cp/nextoverthrow.cc.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.cp/nextoverthrow.exp.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.java/jnpe.exp.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.java/jnpe.java.diff?cvsroot=src&r1=NONE&r2=1.1

-- 
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] 12+ messages in thread

* [Bug c++/9593] "next" command in a function that throws a C++ exception causes GDB to lose control of the inferior
       [not found] <bug-9593-4717@http.sourceware.org/bugzilla/>
  2010-12-09 16:12 ` [Bug c++/9593] "next" command in a function that throws a C++ exception causes GDB to lose control of the inferior cvs-commit at gcc dot gnu.org
  2010-12-09 16:12 ` tromey at redhat dot com
@ 2010-12-10 13:06 ` tromey at redhat dot com
  2011-11-14  7:38 ` zy1st2009 at hotmail dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: tromey at redhat dot com @ 2010-12-10 13:06 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |7.3

--- Comment #5 from Tom Tromey <tromey at redhat dot com> 2010-12-09 16:14:29 UTC ---
Fixed in cvs.

-- 
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] 12+ messages in thread

* [Bug c++/9593] "next" command in a function that throws a C++ exception causes GDB to lose control of the inferior
       [not found] <bug-9593-4717@http.sourceware.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2010-12-10 13:06 ` tromey at redhat dot com
@ 2011-11-14  7:38 ` zy1st2009 at hotmail dot com
  2011-11-14  7:44 ` zy1st2009 at hotmail dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: zy1st2009 at hotmail dot com @ 2011-11-14  7:38 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #6 from George <zy1st2009 at hotmail dot com> 2011-11-14 07:38:35 UTC ---
Created attachment 6056
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6056
testcase includes 3 c++ files

The attachmnent contains a CDivide class ,which simpley implements a method
a/b. However,if b equals zero ,an exception is thrown . This class is compiled
as a dynamic linked library. And main.cpp loads the library to use its methods.
When debugging main.cpp,if step to "pCd->doDivide()", then run "next" command
,gdb will lose control of the inferor and the program will exit.

-- 
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] 12+ messages in thread

* [Bug c++/9593] "next" command in a function that throws a C++ exception causes GDB to lose control of the inferior
       [not found] <bug-9593-4717@http.sourceware.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2011-11-14  7:38 ` zy1st2009 at hotmail dot com
@ 2011-11-14  7:44 ` zy1st2009 at hotmail dot com
  2011-11-14 14:26 ` tromey at redhat dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: zy1st2009 at hotmail dot com @ 2011-11-14  7:44 UTC (permalink / raw)
  To: gdb-prs

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

George <zy1st2009 at hotmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |zy1st2009 at hotmail dot
                   |                            |com
            Version|unknown                     |7.3
         Resolution|FIXED                       |

--- Comment #7 from George <zy1st2009 at hotmail dot com> 2011-11-14 07:43:39 UTC ---
I am afraid this bug has not been fixed completely. 
GDB now do have a better performance for "next" command when exceptions are
thrown, but not for all the cases. If an exception is throw from a dynamic
loaded library, GDB doesn't behave any better ,GDB will still lose control of
inferior and  display more error information. 

How-To-Repeat:
The test case included in attachment shows the behavior. Step to
"pCd->doDivide()", then run "next" command. The program will exit.  

Environment:
GDB 7.3 accompany with GCC 4.6.1
OS: Ubuntu 11.10

-- 
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] 12+ messages in thread

* [Bug c++/9593] "next" command in a function that throws a C++ exception causes GDB to lose control of the inferior
       [not found] <bug-9593-4717@http.sourceware.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2011-11-14  7:44 ` zy1st2009 at hotmail dot com
@ 2011-11-14 14:26 ` tromey at redhat dot com
  2011-11-15  2:26 ` zy1st2009 at hotmail dot com
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: tromey at redhat dot com @ 2011-11-14 14:26 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |WAITING

--- Comment #8 from Tom Tromey <tromey at redhat dot com> 2011-11-14 14:25:57 UTC ---
I had to modify your program to get it to compile and link.
It might help if you posted the exact commands you used to do this;
maybe as a Makefile.

Meanwhile, the feature still works for me, even with the modified
program:

Breakpoint 1, main () at main.cpp:27
27          if((errMsg=dlerror())!=NULL)
(gdb) n
33          result = FuncCreator(10, 0);
(gdb) n
0x0000000000400950    35        catch(int)
(gdb) n
37            printf("Catch an exception\n");

In my modified version, the call to FuncCreator throws.

I'm using Fedora 15.  It is possible that the problem is a system
problem, as this feature relies on a system feature in order to
work.  However, if it works for you in other cases, then it is not
too likely that this is the problem.

-- 
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] 12+ messages in thread

* [Bug c++/9593] "next" command in a function that throws a C++ exception causes GDB to lose control of the inferior
       [not found] <bug-9593-4717@http.sourceware.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2011-11-14 14:26 ` tromey at redhat dot com
@ 2011-11-15  2:26 ` zy1st2009 at hotmail dot com
  2011-11-15 14:13 ` tromey at redhat dot com
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: zy1st2009 at hotmail dot com @ 2011-11-15  2:26 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #9 from George <zy1st2009 at hotmail dot com> 2011-11-15 02:26:35 UTC ---
Thanks Tom very much.

Compile commands that I use are(g++ 4.6.1):
g++ -g -shared -fpic -o libDiv.so Divide.h Divide.cpp
g++ -g -o main main.cpp Divide.h -lDiv -ldl

And a snap sort of the debugging is as below:

32        if ( pCd == NULL )
(gdb) n
38        int result=0;
(gdb) n
41            result=pCd->doDivide();
(gdb) n
Catch an exception
result=0
[Inferior 1 (process 2040) exited normally]
warning: Error removing breakpoint 0
warning: Error removing breakpoint 0
warning: Error removing breakpoint 0


And as with the test case(simplest_next_fail.cxx ) provided by Phil Muldoon,the
debugging process is something like:
(compile command is:  g++ -g -o sp simplest_next_fail.cxx)

(gdb) r
Starting program: /home/george/sp
Breakpoint 1, main () at simplest_next_fail.cxx :17
17          func1();
(gdb) n
Should regain control of inferior here.
27      cout << "Exiting the program." << endl;
(gdb) n
Exiting the program.
28      return 0;
(gdb) 

I think gdb should regain control of inferior at line:
23 cout << "Should regain control of inferior here." << endl;

However, as a matter of fact gdb regains control at line:
27 cout << "Exiting the program." << endl;

I don't know if that is normal. But at least gdb does not lose control this
time.

-- 
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] 12+ messages in thread

* [Bug c++/9593] "next" command in a function that throws a C++ exception causes GDB to lose control of the inferior
       [not found] <bug-9593-4717@http.sourceware.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2011-11-15  2:26 ` zy1st2009 at hotmail dot com
@ 2011-11-15 14:13 ` tromey at redhat dot com
  2011-11-16 14:26 ` zy1st2009 at hotmail dot com
  2011-11-16 20:06 ` tromey at redhat dot com
  9 siblings, 0 replies; 12+ messages in thread
From: tromey at redhat dot com @ 2011-11-15 14:13 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #10 from Tom Tromey <tromey at redhat dot com> 2011-11-15 14:12:51 UTC ---
I tried your test case, using gdb 7.3, and it worked fine here.
I am beginning to suspect a system problem.
Do you have debuginfo installed for libgcc.so?

-- 
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] 12+ messages in thread

* [Bug c++/9593] "next" command in a function that throws a C++ exception causes GDB to lose control of the inferior
       [not found] <bug-9593-4717@http.sourceware.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2011-11-15 14:13 ` tromey at redhat dot com
@ 2011-11-16 14:26 ` zy1st2009 at hotmail dot com
  2011-11-16 20:06 ` tromey at redhat dot com
  9 siblings, 0 replies; 12+ messages in thread
From: zy1st2009 at hotmail dot com @ 2011-11-16 14:26 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #11 from George <zy1st2009 at hotmail dot com> 2011-11-16 14:26:10 UTC ---
Yes,I have.

Our project is something about auto debugging using gdb. Now, I have transfered
the project to Fedora 15,and it works well on Fedora.

Thanks for your time and effort.

-- 
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] 12+ messages in thread

* [Bug c++/9593] "next" command in a function that throws a C++ exception causes GDB to lose control of the inferior
       [not found] <bug-9593-4717@http.sourceware.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2011-11-16 14:26 ` zy1st2009 at hotmail dot com
@ 2011-11-16 20:06 ` tromey at redhat dot com
  9 siblings, 0 replies; 12+ messages in thread
From: tromey at redhat dot com @ 2011-11-16 20:06 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |WORKSFORME

--- Comment #12 from Tom Tromey <tromey at redhat dot com> 2011-11-16 20:05:53 UTC ---
Sounds like a distro bug then.

-- 
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] 12+ messages in thread

* [Bug c++/9593] "next" command in a function that throws a C++ exception causes GDB to lose control of the inferior
       [not found] <20080801151802.9593.pmuldoon@redhat.com>
  2009-03-05  0:25 ` tromey at redhat dot com
@ 2010-07-28 20:52 ` tromey at redhat dot com
  1 sibling, 0 replies; 12+ messages in thread
From: tromey at redhat dot com @ 2010-07-28 20:52 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From tromey at redhat dot com  2010-07-28 20:52 -------
For the record, this bug is fixed on archer-pmuldoon-next-over-throw2.
It is waiting for some longjmp patches before submitting to gdb.

-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug c++/9593] "next" command in a function that throws a C++ exception causes GDB to lose control of the inferior
       [not found] <20080801151802.9593.pmuldoon@redhat.com>
@ 2009-03-05  0:25 ` tromey at redhat dot com
  2010-07-28 20:52 ` tromey at redhat dot com
  1 sibling, 0 replies; 12+ messages in thread
From: tromey at redhat dot com @ 2009-03-05  0:25 UTC (permalink / raw)
  To: gdb-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at sourceware dot|tromey at redhat dot com
                   |org                         |


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

end of thread, other threads:[~2011-11-16 20:06 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-9593-4717@http.sourceware.org/bugzilla/>
2010-12-09 16:12 ` [Bug c++/9593] "next" command in a function that throws a C++ exception causes GDB to lose control of the inferior cvs-commit at gcc dot gnu.org
2010-12-09 16:12 ` tromey at redhat dot com
2010-12-10 13:06 ` tromey at redhat dot com
2011-11-14  7:38 ` zy1st2009 at hotmail dot com
2011-11-14  7:44 ` zy1st2009 at hotmail dot com
2011-11-14 14:26 ` tromey at redhat dot com
2011-11-15  2:26 ` zy1st2009 at hotmail dot com
2011-11-15 14:13 ` tromey at redhat dot com
2011-11-16 14:26 ` zy1st2009 at hotmail dot com
2011-11-16 20:06 ` tromey at redhat dot com
     [not found] <20080801151802.9593.pmuldoon@redhat.com>
2009-03-05  0:25 ` tromey at redhat dot com
2010-07-28 20:52 ` tromey at redhat 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).