From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20028 invoked by alias); 17 Sep 2013 14:28:09 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 20016 invoked by uid 89); 17 Sep 2013 14:28:09 -0000 Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 17 Sep 2013 14:28:09 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_50,KHOP_THREADED,RDNS_NONE,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: mga09.intel.com Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 17 Sep 2013 07:25:02 -0700 X-ExtLoop1: 1 Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by orsmga001.jf.intel.com with ESMTP; 17 Sep 2013 07:28:04 -0700 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.69]) by IRSMSX103.ger.corp.intel.com ([163.33.3.157]) with mapi id 14.03.0123.003; Tue, 17 Sep 2013 15:28:03 +0100 From: "Metzger, Markus T" To: Jan Kratochvil CC: "gdb-patches@sourceware.org" Subject: RE: [patch v4 24/24] record-btrace: skip tail calls in back trace Date: Tue, 17 Sep 2013 14:28:00 -0000 Message-ID: References: <1372842874-28951-1-git-send-email-markus.t.metzger@intel.com> <1372842874-28951-25-git-send-email-markus.t.metzger@intel.com> <20130818190949.GS24153@host2.jankratochvil.net> In-Reply-To: <20130818190949.GS24153@host2.jankratochvil.net> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00516.txt.bz2 > -----Original Message----- > From: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] On Behalf Of Jan Kratochvil > > The branch trace represents the caller/callee relationship of tail > > calls. The caller of a tail call is shown in the back trace and in > > the function-call history. > > > > This is not consistent with GDB's normal behavior, where the tail > > caller is not shown in the back trace. >=20 > This depends on the compiler and its options. With recent GCCs and -O2 -g > compilation tail calls are shown. They are even tested for (full) reverse > execution: > Running ./gdb.reverse/amd64-tailcall-reverse.exp ... > Running ./gdb.arch/amd64-tailcall-ret.exp ... > Running ./gdb.arch/amd64-tailcall-cxx.exp ... > Running ./gdb.arch/amd64-tailcall-noret.exp ... >=20 > In the -O0 -g mode they are not shown just because of the lack of debug > info. > AFAIK it is too expensive for GCC to produce it while -O0 -g compilation > should be fast. >=20 > Surprisingly this gives in some cases -O2 -g compilation better debugging > experience than -O0 -g compilation. >From this perspective, this would actually be a feature that we have tail calls available also in the call stack for reverse/replay even if we did not have them for live debugging due to limited debug information. > Still when I revert this GDB code patch then gdb.btrace/rn-dl-bind.exp do= es > not reverse-next properly - what is the reason? >=20 > reverse-next^M > __GI_____strtoul_l_internal (nptr=3D, endptr=3D, > base=3D, group=3D, loc=3D) 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=3D, endptr=3D, > base=3D, group=3D, loc=3D) at > ../stdlib/strtol_l.c:531^M > #1 0x00007ffff7228f8d in __GI_strtoul (nptr=3D Registers are not available in btrace record history>, endptr=3D variable: Registers are not available in btrace record history>, base=3D<= 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. At some point, get_frame_func () returns 0, which is then used for the code in the BTRACE_FRAME id. This doesn't look OK at first glance. > > It further causes the finish command to fail for tail calls. > > > > This patch skips tail calls when computing the back trace during > > replay. The finish command now works also for tail calls. There were also some fails around finish. I did not investigate those after I realized that stepping behaves differently for live debugging and replay. The fails went away once I skipped tail calls. 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