Re: graceful unwind termination when we'd need unavailable/uncollect memory or registers to unwind further

Jan Kratochvil
2011-02-28T15:41:51Z

On Tue, 22 Feb 2011 19:34:42 +0100, Pedro Alves wrote:
> This teaches GDB about terminating unwinding gracefully if
> unwind further we would need registers/memory that haven't
> been collected.
>
> Here's the result:
>
> (gdb) bt
> #0 begin (a=<unavailable>) at ../../../src/gdb/testsuite/gdb.trace/unavailable.cc:182
> #1 0x00000000004008ad in main (argc=1, argv=0x7fff0e22cf28, envp=0x7fff0e22cf38)
> at ../../../src/gdb/testsuite/gdb.trace/unavailable.cc:210
> #2 <unavailable> in ?? ()
> Backtrace stopped: Not enough registers or memory available to unwind further

In my case:

(gdb) tfind 0
Found trace frame 0, tracepoint 2
#0 f () at 1.c:11
11 v++;
(gdb) bt
#0 f () at 1.c:11
Backtrace stopped: Not enough registers or memory available to unwind further
(gdb)

That is without that <unavailable>. I think it is a bug.

Thanks,
Jan

$ ./gdb -nx -x ~/.gdbinit -ex 'target remote localhost:1234' ./gdbserver/1 -ex 'tb main' -ex c
GNU gdb (GDB) 7.2.50.20110228-cvs
Copyright (C) 2011 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-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/jkratoch/redhat/gdb-clean/gdb/gdbserver/1...done.
Remote debugging using localhost:1234
Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from /usr/lib/debug/lib64/ld-2.13.90.so.debug...done.
done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
0x00007fcc89596600 in _start () from /lib64/ld-linux-x86-64.so.2
Temporary breakpoint 1 at 0x4004aa: file 1.c, line 18.
Continuing.

Temporary breakpoint 1, main () at 1.c:18
18 f ();
(gdb) trace 11
Tracepoint 2 at 0x400480: file 1.c, line 11.
(gdb) actions
Enter actions for tracepoint 2, one per line.
End with a line saying just "end".
>collect v
>end
(gdb) tstart
(gdb) b b
Breakpoint 3 at 0x400478: file 1.c, line 6.
(gdb) c
Continuing.

Breakpoint 3, b () at 1.c:6
6 }
(gdb) tstop
(gdb) tstatus
Trace stopped by a tstop command.
Collected 9 trace frames.
Trace buffer has 5242691 bytes of 5242880 bytes free (0% full).
Trace will stop if GDB disconnects.
Not looking at any trace frame.
(gdb) tfind 0
Found trace frame 0, tracepoint 2
#0 f () at 1.c:11
11 v++;
(gdb) bt
#0 f () at 1.c:11
Backtrace stopped: Not enough registers or memory available to unwind further
(gdb)

$ ./gdbserver :1234 ./1
Process ./1 created; pid = 20703
Listening on port 1234
Remote debugging from host 127.0.0.1

1:int v = 1;
2:int q = 1;
3:void
4:b (void)
5:{
6:}
7:int
8:f (void)
9:{
10: while (v < 10)
11: v++;
12: b ();
13: return 5;
14:}
15:int
16:main (void)
17:{
18: f ();
19: return 0;
20:}