This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [patch v4 24/24] record-btrace: skip tail calls in back trace
- From: "Metzger, Markus T" <markus dot t dot metzger at intel dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Wed, 18 Sep 2013 08:28:21 +0000
- Subject: RE: [patch v4 24/24] record-btrace: skip tail calls in back trace
- Authentication-results: sourceware.org; auth=none
- References: <1372842874-28951-1-git-send-email-markus dot t dot metzger at intel dot com> <1372842874-28951-25-git-send-email-markus dot t dot metzger at intel dot com> <20130818190949 dot GS24153 at host2 dot jankratochvil dot net> <A78C989F6D9628469189715575E55B230A9CF8EE at IRSMSX104 dot ger dot corp dot intel dot com>
> -----Original Message-----
> From: Metzger, Markus T
> Sent: Tuesday, September 17, 2013 4:28 PM
> > reverse-next^M
> > __GI_____strtoul_l_internal (nptr=<unavailable>, endptr=<unavailable>,
> > base=<optimized out>, group=<optimized out>, loc=<optimized out>) at
> > ../stdlib/strtol_l.c:531^M
> > 531 }^M
> > (gdb) FAIL: gdb.btrace/rn-dl-bind.exp: rn-dl-bind, 2.3 bt^M
> > #0 __GI_____strtoul_l_internal (nptr=<unavailable>,
> > endptr=<unavailable>, base=<optimized out>, group=<optimized out>,
> > loc=<optimized out>) at ../stdlib/strtol_l.c:531^M
> > #1 0x00007ffff7228f8d in __GI_strtoul (nptr=<error reading variable:
> > Registers are not available in btrace record history>, endptr=<error
> > reading
> > variable: Registers are not available in btrace record history>,
> > base=<error reading variable: Registers are not available in btrace
> > record history>) at ../stdlib/strtol.c:108^M
> > #2 _dl_runtime_resolve () at ../sysdeps/x86_64/dl-trampoline.S:56^M
> > #3 0x00000000004004c6 in ?? ()^M
> > #4 0x00000000004004fb in strtoul@plt ()^M
> > #5 0x000000000040060c in test () at ./gdb.btrace/rn-dl-bind.c:26^M
> > #6 0x0000000000400621 in main () at ./gdb.btrace/rn-dl-bind.c:35^M
> > Backtrace stopped: not enough registers or memory available to unwind
> > further^M
>
> I need to investigate this.
If we skip tail calls, GDB recognizes that we reverse-stepped into a
subroutine and keeps stepping.
If we don't skip tail calls, GDB fails to recognize this and stops stepping
due to the absence of line information.
The line information is also missing when we skip tail calls, but the stepped-
into-subroutine check comes before the has-line-info check.
When searching for the caller frame id in infrun.c, GDB skips artificial frames
including normal TAILCALL_FRAMEs. I guess this is why it works for live
stepping and also for record-full.
One way to solve this would be to add a BTRACE_TAILCALL_FRAME and
extend struct target_ops to provide two optional unwinders that are both
tried before any arch unwinder. I'd try this unless you have a better idea.
Regards,
Markus.
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052