public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Breaking exceptions before stack unwind
@ 2004-11-16 21:10 Chris Stankevitz
  2004-11-17 23:23 ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Chris Stankevitz @ 2004-11-16 21:10 UTC (permalink / raw)
  To: gdb


According to the GDB documentation, you can tell gdb to break on all 
exceptions with this command:
  break __raise_exception

This does not work for me (not defined).  Others suggested this:
  break __cp_push_exception

That doesn't work for me either (not defined).

I have two questions:

1. Why don't either of those two options work for me?

2. What can I use to break on exceptions before the stack is unwound?

Thanks so much!

Chris

PS:

[chris@c4isr temp]$ nm a.out
080497a0 A __bss_start
0804846c t call_gmon_start
080497a0 b completed.1
0804976c d __CTOR_END__
08049768 d __CTOR_LIST__
          U __cxa_begin_catch@@CXXABI_1.2
          U __cxa_end_catch@@CXXABI_1.2
          U __cxa_rethrow@@CXXABI_1.2
0804967c D __data_start
0804967c W data_start
080485c8 t __do_global_ctors_aux
08048490 t __do_global_dtors_aux
08049680 D __dso_handle
08049774 d __DTOR_END__
08049770 d __DTOR_LIST__
08049688 D _DYNAMIC
080497a0 A _edata
080497a4 A _end
080485ec T _fini
0804967c A __fini_array_end
0804967c A __fini_array_start
08048608 R _fp_hw
080484cc t frame_dummy
08048664 r __FRAME_END__
0804977c D _GLOBAL_OFFSET_TABLE_
          w __gmon_start__
          U __gxx_personality_v0@@CXXABI_1.2
080483d0 T _init
0804967c A __init_array_end
0804967c A __init_array_start
0804860c R _IO_stdin_used
08049778 d __JCR_END__
08049778 d __JCR_LIST__
          w _Jv_RegisterClasses
08048584 T __libc_csu_fini
0804853c T __libc_csu_init
          U __libc_start_main@@GLIBC_2.0
080484f8 T main
08049684 d p.0
0804967c A __preinit_array_end
0804967c A __preinit_array_start
08048448 T _start
          U _Unwind_Resume@@GCC_3.0

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

* Re: Breaking exceptions before stack unwind
  2004-11-16 21:10 Breaking exceptions before stack unwind Chris Stankevitz
@ 2004-11-17 23:23 ` Daniel Jacobowitz
  2004-11-18  9:25   ` Chris Stankevitz
  2004-11-23 16:24   ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Daniel Jacobowitz @ 2004-11-17 23:23 UTC (permalink / raw)
  To: Chris Stankevitz; +Cc: gdb

On Tue, Nov 16, 2004 at 12:09:21PM -0800, Chris Stankevitz wrote:
> 
> According to the GDB documentation, you can tell gdb to break on all 
> exceptions with this command:
>  break __raise_exception
> 
> This does not work for me (not defined).  Others suggested this:
>  break __cp_push_exception
> 
> That doesn't work for me either (not defined).
> 
> I have two questions:
> 
> 1. Why don't either of those two options work for me?

Obsolete documentation.

> 2. What can I use to break on exceptions before the stack is unwound?

You didn't say what your target is, or what your compiler is, or what
your version of GDB is.  From this:

>          U __cxa_begin_catch@@CXXABI_1.2

I recommend you try the GDB command "catch throw".

-- 
Daniel Jacobowitz

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

* Re: Breaking exceptions before stack unwind
  2004-11-17 23:23 ` Daniel Jacobowitz
@ 2004-11-18  9:25   ` Chris Stankevitz
  2004-11-19  3:13     ` Daniel Jacobowitz
  2004-11-23 16:24   ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Chris Stankevitz @ 2004-11-18  9:25 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb


Hi Daniel, thanks for your help.

> You didn't say what your target is, or what your compiler is, or what
> your version of GDB is.

i686 athlon
g++ (GCC) 3.3.2 20031022 (Red Hat Linux 3.3.2-1)
GNU gdb Red Hat Linux (5.3.90-0.20030710.41rh)

>>         U __cxa_begin_catch@@CXXABI_1.2
> 
> I recommend you try the GDB command "catch throw".

Hmph...

(gdb) catch throw
Function "__cxa_throw" not defined.

Thanks again,

Chris



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

* Re: Breaking exceptions before stack unwind
  2004-11-18  9:25   ` Chris Stankevitz
@ 2004-11-19  3:13     ` Daniel Jacobowitz
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Jacobowitz @ 2004-11-19  3:13 UTC (permalink / raw)
  To: Chris Stankevitz; +Cc: gdb

On Wed, Nov 17, 2004 at 03:22:38PM -0800, Chris Stankevitz wrote:
> 
> Hi Daniel, thanks for your help.
> 
> >You didn't say what your target is, or what your compiler is, or what
> >your version of GDB is.
> 
> i686 athlon
> g++ (GCC) 3.3.2 20031022 (Red Hat Linux 3.3.2-1)
> GNU gdb Red Hat Linux (5.3.90-0.20030710.41rh)
> 
> >>        U __cxa_begin_catch@@CXXABI_1.2
> >
> >I recommend you try the GDB command "catch throw".
> 
> Hmph...
> 
> (gdb) catch throw
> Function "__cxa_throw" not defined.

It's in libstdc++; with your old version of GDB, you can't set
breakpoints in shared libraries until they've been loaded.  Try a newer
version, or do it after "set stop-on-solib-events 1; run".

-- 
Daniel Jacobowitz

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

* Re: Breaking exceptions before stack unwind
  2004-11-17 23:23 ` Daniel Jacobowitz
  2004-11-18  9:25   ` Chris Stankevitz
@ 2004-11-23 16:24   ` Eli Zaretskii
  2004-11-24  4:47     ` Daniel Jacobowitz
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2004-11-23 16:24 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

> Date: Wed, 17 Nov 2004 18:08:03 -0500
> From: Daniel Jacobowitz <drow@false.org>
> Cc: gdb@sources.redhat.com
> 
> On Tue, Nov 16, 2004 at 12:09:21PM -0800, Chris Stankevitz wrote:
> > 
> > According to the GDB documentation, you can tell gdb to break on all 
> > exceptions with this command:
> >  break __raise_exception
> > 
> > This does not work for me (not defined).  Others suggested this:
> >  break __cp_push_exception
> > 
> > That doesn't work for me either (not defined).
> > 
> > I have two questions:
> > 
> > 1. Why don't either of those two options work for me?
> 
> Obsolete documentation.

The obsolete advice is still in the manual.  What should we do to
un-obsolete it?  Are there any alternative library functions to try?
Should we perhaps delete the whole paragraph, and instead tell users
how to work around problems with shared library loading with the trick
you cited later in this thread ("set stop-on-solib-events 1; run")?

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

* Re: Breaking exceptions before stack unwind
  2004-11-23 16:24   ` Eli Zaretskii
@ 2004-11-24  4:47     ` Daniel Jacobowitz
  2004-11-24  6:53       ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2004-11-24  4:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb

On Tue, Nov 23, 2004 at 02:24:57PM +0200, Eli Zaretskii wrote:
> > Date: Wed, 17 Nov 2004 18:08:03 -0500
> > From: Daniel Jacobowitz <drow@false.org>
> > Cc: gdb@sources.redhat.com
> > 
> > On Tue, Nov 16, 2004 at 12:09:21PM -0800, Chris Stankevitz wrote:
> > > 
> > > According to the GDB documentation, you can tell gdb to break on all 
> > > exceptions with this command:
> > >  break __raise_exception
> > > 
> > > This does not work for me (not defined).  Others suggested this:
> > >  break __cp_push_exception
> > > 
> > > That doesn't work for me either (not defined).
> > > 
> > > I have two questions:
> > > 
> > > 1. Why don't either of those two options work for me?
> > 
> > Obsolete documentation.
> 
> The obsolete advice is still in the manual.  What should we do to
> un-obsolete it?  Are there any alternative library functions to try?
> Should we perhaps delete the whole paragraph, and instead tell users
> how to work around problems with shared library loading with the trick
> you cited later in this thread ("set stop-on-solib-events 1; run")?

The workaround is only necessary because he was using GDB 5.3 - Jeff's
pending breakpoints implementation is even better.

Yes, the documentation does need to be fixed.  I can't do it right now,
but the right thing to do is to document 'catch catch' and 'catch
throw'.  They're pretty limited right now, but they do work.

-- 
Daniel Jacobowitz

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

* Re: Breaking exceptions before stack unwind
  2004-11-24  4:47     ` Daniel Jacobowitz
@ 2004-11-24  6:53       ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2004-11-24  6:53 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

> Date: Tue, 23 Nov 2004 23:02:37 -0500
> From: Daniel Jacobowitz <drow@false.org>
> Cc: gdb@sources.redhat.com
> 
> the right thing to do is to document 'catch catch' and 'catch
> throw'.

They are already documented.  The obsolete advice that the OP was
citing is at the end of the node which describes them.  That advice is
for the case where one wants to stop the program _before_ the
exception handler is called.  See the node "Set Catchpoints" in the
manual.

Given this, what would be the best way to fix the manual?

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

end of thread, other threads:[~2004-11-24  6:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-16 21:10 Breaking exceptions before stack unwind Chris Stankevitz
2004-11-17 23:23 ` Daniel Jacobowitz
2004-11-18  9:25   ` Chris Stankevitz
2004-11-19  3:13     ` Daniel Jacobowitz
2004-11-23 16:24   ` Eli Zaretskii
2004-11-24  4:47     ` Daniel Jacobowitz
2004-11-24  6:53       ` Eli Zaretskii

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).