Re: why can't one walk through the unwinder?
Re: why can't one walk through the unwinder?
- Subject: Re: why can't one walk through the unwinder?
- From: Jim Ingham <email@hidden>
- Date: Mon, 30 Nov 2009 10:45:49 -0800
On Linux, you see to have debug information for the library containing _Unwind_RaiseException, and you don't on darwin. The gdb "step" command is a source-level step, and so it doesn't step through assembly. This isn't a Darwin gdb thing, gdb has always behaved that way.
If you want/need to step through assembly code, use the "stepi" and "nexti" commands.
Jim
On Nov 28, 2009, at 11:22 AM, Jack Howarth wrote:
> I am trying to debug an issue with the unwinder in FSF gcc's
> gcj at the request of the libjava developers. So far I have been
> able to find a permutation of gdb use which allows a walk through
> the unwinder as is possible under linux. For example, the sample
> code...
>
> #include <stdio.h>
>
> void
> func ()
> {
> throw 42;
> }
>
> int
> main()
> {
> setbuf (stdout, NULL);
>
> try
> {
> func (); /* line 16 */
> puts ("passed"); /* line 17 */
> }
> catch (...)
> {
> puts ("caught");
> }
> return 0;
> }
>
> when compiled with 'g++ -g test.cc' can be walked through
> under linux...
>
> gdb ./a.out
> GNU gdb Fedora (6.8-32.fc10)
> Copyright (C) 2008 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-redhat-linux-gnu"...
> (gdb) break _Unwind_RaiseException
> Function "_Unwind_RaiseException" not defined.
> Make breakpoint pending on future shared library load? (y or [n]) y
> Breakpoint 1 (_Unwind_RaiseException) pending.
> (gdb) r
> Starting program: /home/howarth/a.out
>
> Breakpoint 1, _Unwind_RaiseException (exc=0x601060) at ../../../gcc/unwind.inc:93
> 93 uw_init_context (&this_context);
> Current language: auto; currently c
> (gdb) s
> 88 {
> (gdb) s
> 93 uw_init_context (&this_context);
> (gdb) s
> 88 {
> (gdb) s
> 93 uw_init_context (&this_context);
> (gdb) s
> 88 {
> (gdb) s
> 94 cur_context = this_context;
> (gdb) s
> 88 {
> (gdb) s
> 93 uw_init_context (&this_context);
> (gdb) s
> 88 {
> (gdb) s
> 93 uw_init_context (&this_context);
> (gdb) s
> uw_init_context_1 (context=0x7fffffffe140, outer_cfa=0x7fffffffe290, outer_ra=0x35f96c3ded) at ../../../gcc/unwind-dw2.c:1431
> 1431 memset (context, 0, sizeof (struct _Unwind_Context));
> (gdb) s
> 1425 {
> (gdb) s
> 1431 memset (context, 0, sizeof (struct _Unwind_Context));
> (gdb) s
> 1435 code = uw_frame_state_for (context, &fs);
> (gdb) s
> 1425 {
> (gdb) quit
>
> without issue. Under darwin10, however one gets...
>
> gdb ./a.out
> GNU gdb 6.3.50-20050815 (Apple version gdb-1346) (Fri Sep 18 20:40:51 UTC 2009)
> 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 "x86_64-apple-darwin"...Reading symbols for shared libraries ... done
>
> (gdb) break _Unwind_RaiseException
> Breakpoint 1 at 0x3126e978bf49a2
> (gdb) r
> Starting program: /Users/howarth/a.out
> Reading symbols for shared libraries ++. done
>
> Breakpoint 1, 0x00007fff843eb9a2 in _Unwind_RaiseException ()
> (gdb) s
> Single stepping until exit from function _Unwind_RaiseException,
> which has no line number information.
> caught
>
> Program exited normally.
> (gdb) quit
>
> regardless if 'setenv DYLD_IMAGE_SUFFIX _debug' is set or not. Am I missing
> something here or is it just impossible to walk through the unwinder under
> darwin10?
> Jack
> ps The purpose here is to be able to examine which frame is causing the unwinder
> to crash under gcj so I do need to be able to walk the unwinder to get this
> information. Thanks in advance for any insights.
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden