Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753005AbbKXHg7 (ORCPT ); Tue, 24 Nov 2015 02:36:59 -0500 Received: from LGEAMRELO13.lge.com ([156.147.23.53]:41730 "EHLO lgeamrelo13.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752937AbbKXHg4 (ORCPT ); Tue, 24 Nov 2015 02:36:56 -0500 X-Original-SENDERIP: 156.147.1.151 X-Original-MAILFROM: namhyung@kernel.org X-Original-SENDERIP: 165.244.98.150 X-Original-MAILFROM: namhyung@kernel.org X-Original-SENDERIP: 10.177.227.17 X-Original-MAILFROM: namhyung@kernel.org Date: Tue, 24 Nov 2015 16:36:03 +0900 From: Namhyung Kim To: Jiri Olsa CC: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , LKML , David Ahern , Frederic Weisbecker , Masami Hiramatsu Subject: Re: [RFC/PATCH] perf tools: Introduce perf_thread for backtrace Message-ID: <20151124073603.GE2636@sejong> References: <1447999383-15456-1-git-send-email-namhyung@kernel.org> <20151120092948.GB897@krava.brq.redhat.com> MIME-Version: 1.0 In-Reply-To: <20151120092948.GB897@krava.brq.redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-MIMETrack: Itemize by SMTP Server on LGEKRMHUB04/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2015/11/24 16:36:07, Serialize by Router on LGEKRMHUB04/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2015/11/24 16:36:07, Serialize complete at 2015/11/24 16:36:07 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2470 Lines: 78 Hi Jiri, On Fri, Nov 20, 2015 at 10:29:48AM +0100, Jiri Olsa wrote: > On Fri, Nov 20, 2015 at 03:03:03PM +0900, Namhyung Kim wrote: > > Backtrace is a crucial info for debugging. And upcoming refcnt > > tracking facility also wants to use it. > > > > So instead of relying on glibc's backtrace_symbols[_fd] which misses > > some (static) functions , use our own symbol searching mechanism. To > > do that, add perf_thread global variable to keep its maps and symbols. > > > > The backtrace output from TUI is changed like below. (I made a key > > action to generate a segfault for testing): > > > > Before: > > perf: Segmentation fault > > -------- backtrace -------- > > perf[0x544a8b] > > /usr/lib/libc.so.6(+0x33680)[0x7fc46420b680] > > perf[0x54041b] > > perf(perf_evlist__tui_browse_hists+0x91)[0x5432e1] > > perf(cmd_report+0x1d20)[0x43cb10] > > perf[0x487073] > > perf(main+0x62f)[0x42cb1f] > > /usr/lib/libc.so.6(__libc_start_main+0xf0)[0x7fc4641f8610] > > perf(_start+0x29)[0x42cc39] > > [0x0] > > > > After: > > perf: Segmentation fault > > -------- backtrace -------- > > perf_evsel__hists_browse(+0x43b) in perf [0x54066b] > > perf_evlist__tui_browse_hists(+0x91) in perf [0x543531] > > cmd_report(+0x1d20) in perf [0x43cb50] > > run_builtin(+0x53) in perf [0x4870b3] > > main(+0x634) in perf [0x42cb54] > > __libc_start_main(+0xf0) in libc-2.22.so [0x7fea3577c610] > > _start(+0x29) in perf [0x42cc79] > > [0x0] > > nice idea! > > SNIP > > > + > > +void create_perf_thread(void) > > +{ > > + struct perf_tool tool = { > > + .comm = perf_event__process_comm, > > + .mmap = perf_event__process_mmap, > > + .mmap2 = perf_event__process_mmap2, > > + }; > > + struct thread_map *tm; > > + struct machine *machine; > > + int pid = getpid(); > > + > > + machine = machine__new_host(); > > + if (machine == NULL) > > + return; > > + > > + tm = thread_map__new_dummy(); > > + if (tm == NULL) { > > + machine__delete(machine); > > + return; > > + } > > I think we could treat errors the usual way in here.. > if fail to alloc this early, something is terribly wrong anyway OK, I'll change it to return error code and let perf fail with it. Thanks, Namhyung -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/