Unbreaking gdb's catch throw
Hi, gdb's command 'catch throw' is broken on FreeBSD head. While it does set a breakpoint on __cxa_throw, the function seems to be never entered when an exception is thrown. Does someone know how to fix this? It used to work a couple of months ago. Stefan ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org
Re: Unbreaking gdb's catch throw
Is this on 9.1? In -CURRENT and 9.1, libstdc++ is a filter library, and libsupc++ or or libcxxrt are the filtee. This means that the __cxa_throw symbol appears to be in libstdc++ (for symbol versioning purposes), but is actually in the ABI library. If you tell gdb to put the breakpoint on __cxa_throw itself, then it should tell you that there are multiple definitions and ask which one you want (if it doesn't, it's a gdb bug). David On 4 Jan 2013, at 12:34, Stefan Farfeleder wrote: Hi, gdb's command 'catch throw' is broken on FreeBSD head. While it does set a breakpoint on __cxa_throw, the function seems to be never entered when an exception is thrown. Does someone know how to fix this? It used to work a couple of months ago. Stefan ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org
Re: Unbreaking gdb's catch throw
Stefan Farfeleder stef...@freebsd.org wrote: gdb's command 'catch throw' is broken on FreeBSD head. While it does set a breakpoint on __cxa_throw, the function seems to be never entered when an exception is thrown. Does someone know how to fix this? It used to work a couple of months ago. My impression is that gdb from base is pretty useless in general when compiling with a modern compiler like clang or a more recent version of gcc. gdb751 from the ports seems to suck a lot less. Obviously I'm not saying that it wouldn't be nice if gdb from base worked better, though. Fabian signature.asc Description: PGP signature
Re: Unbreaking gdb's catch throw
On Fri, Jan 04, 2013 at 12:38:44PM +, David Chisnall wrote: Is this on 9.1? In -CURRENT and 9.1, libstdc++ is a filter library, and libsupc++ or or libcxxrt are the filtee. This means that the __cxa_throw symbol appears to be in libstdc++ (for symbol versioning purposes), but is actually in the ABI library. If you tell gdb to put the breakpoint on __cxa_throw itself, then it should tell you that there are multiple definitions and ask which one you want (if it doesn't, it's a gdb bug). This is on 10.0-CURRENT r244738 amd64. The commands 'b __cxa_throw' and 'catch throw' seemd to be identical, and gdb does not ask about multiple versions of __cxa_throw. To be honest, I don't care exactly whose bug it is, I want it to work again :D $ cat throw.cc int main(void) { throw 1; } $ c++ -g throw.cc $ gdb a.out GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type show copying to see the conditions. There is absolutely no warranty for GDB. Type show warranty for details. This GDB was configured as amd64-marcel-freebsd... (gdb) b main Breakpoint 1 at 0x4007f9: file throw.cc, line 3. (gdb) r Starting program: /usr/home/stefan/scratch/a.out Breakpoint 1, main () at throw.cc:3 3 throw 1; (gdb) b __cxa_throw Breakpoint 2 at 0x800898d34 (gdb) c Continuing. terminate called after throwing an instance of 'int' Program received signal SIGABRT, Aborted. 0x000800e52fca in kill () from /lib/libc.so.7 Stefan ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org
Re: Unbreaking gdb's catch throw
On 4 Jan 2013, at 12:49, Stefan Farfeleder wrote: On Fri, Jan 04, 2013 at 12:38:44PM +, David Chisnall wrote: Is this on 9.1? In -CURRENT and 9.1, libstdc++ is a filter library, and libsupc++ or or libcxxrt are the filtee. This means that the __cxa_throw symbol appears to be in libstdc++ (for symbol versioning purposes), but is actually in the ABI library. If you tell gdb to put the breakpoint on __cxa_throw itself, then it should tell you that there are multiple definitions and ask which one you want (if it doesn't, it's a gdb bug). This is on 10.0-CURRENT r244738 amd64. The commands 'b __cxa_throw' and 'catch throw' seemd to be identical, and gdb does not ask about multiple versions of __cxa_throw. To be honest, I don't care exactly whose bug it is, I want it to work again :D As a work-around, you can put the breakpoint on _Unwind_RaiseException instead. This will work for any language, not just C++ (e.g. it will notice Objective-C or gcj-compiled Java exceptions). David ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org
Re: Unbreaking gdb's catch throw
On Fri, Jan 04, 2013 at 12:54:03PM +, David Chisnall wrote: As a work-around, you can put the breakpoint on _Unwind_RaiseException instead. This will work for any language, not just C++ (e.g. it will notice Objective-C or gcj-compiled Java exceptions). Thank you, that works for me. Stefan ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org
Re: Unbreaking gdb's catch throw
On 2013-01-04 14:02, Stefan Farfeleder wrote: On Fri, Jan 04, 2013 at 12:54:03PM +, David Chisnall wrote: As a work-around, you can put the breakpoint on _Unwind_RaiseException instead. This will work for any language, not just C++ (e.g. it will notice Objective-C or gcj-compiled Java exceptions). Thank you, that works for me. Alternatively, install the gdb port, which seems to work just fine: $ /usr/local/bin/gdb ./throw GNU gdb (GDB) 7.5 [GDB v7.5 for FreeBSD] Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type show copying and show warranty for details. This GDB was configured as x86_64-portbld-freebsd10.0. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/... Reading symbols from /tmp/throw...done. (gdb) break __cxa_throw Breakpoint 1 at 0x400604 (gdb) run Starting program: /tmp/throw Breakpoint 1, __cxxabiv1::__cxa_throw (obj=0x801c060f0, tinfo=0x600c00 _ZTIi@@CXXABI_1.3, dest=0x0) at /usr/src/gnu/lib/libsupc++/../../../contrib/libstdc++/libsupc++/eh_throw.cc:60 60__cxa_exception *header = __get_exception_header_from_obj (obj); ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org