From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: backtracing from within the code Date: Fri, 24 Jun 2016 10:46:07 -0700 Message-ID: <20160624104607.3648e62f@samsung9> References: <3EB4FA525960D640B5BDFFD6A3D8912647A0C78F@IRSMSX108.ger.corp.intel.com> <1678929.kjLRgJKAHP@xps13> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Catalin Vasile , dev@dpdk.org, "Dumitrescu, Cristian" To: Thomas Monjalon Return-path: Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by dpdk.org (Postfix) with ESMTP id 715E9C5B8 for ; Fri, 24 Jun 2016 19:46:11 +0200 (CEST) Received: by mail-pa0-f42.google.com with SMTP id bz2so39400168pad.1 for ; Fri, 24 Jun 2016 10:46:11 -0700 (PDT) In-Reply-To: <1678929.kjLRgJKAHP@xps13> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, 24 Jun 2016 12:05:26 +0200 Thomas Monjalon wrote: > 2016-06-24 09:25, Dumitrescu, Cristian: > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Catalin Vasile > > > I'm trying to add a feature to DPDK and I'm having a hard time printing a > > > backtrace. > > > I tried using this[1] functions for printing, but it does not print more than one > > > function. Maybe it lacks the symbols it needs. > [...] > > It eventually calls rte_dump_stack() in file lib/lirte_eal/linuxapp/eal/eal_debug.c, which calls backtrace(), which is probably what you are looking for. > > Example: > 5: [build/app/testpmd(_start+0x29) [0x416f69]] > 4: [/usr/lib/libc.so.6(__libc_start_main+0xf0) [0x7eff3b757610]] > 3: [build/app/testpmd(main+0x2ff) [0x416b3f]] > 2: [build/app/testpmd(init_port_config+0x88) [0x419a78]] > 1: [build/lib/librte_eal.so.2.1(rte_dump_stack+0x18) [0x7eff3c126488]] > > Please tell us if you have some cases where rte_dump_stack() does not work. > I do not remember what are the constraints to have it working. > Your binary is not stripped? The GCC backtrace doesn't work well because it can't find static functions. I ended up using libunwind to get a better back trace.