From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27306 invoked by alias); 17 Dec 2012 18:32:28 -0000 Received: (qmail 27297 invoked by uid 22791); 17 Dec 2012 18:32:27 -0000 X-SWARE-Spam-Status: No, hits=-5.4 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_BT,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 17 Dec 2012 18:32:23 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBHIWKw9019109 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 17 Dec 2012 13:32:20 -0500 Received: from host2.jankratochvil.net (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qBHIWEVv019345 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 17 Dec 2012 13:32:17 -0500 Date: Mon, 17 Dec 2012 18:32:00 -0000 From: Jan Kratochvil To: markus.t.metzger@intel.com Cc: palves@redhat.com, tromey@redhat.com, kettenis@gnu.org, gdb-patches@sourceware.org, markus.t.metzger@gmail.com Subject: Re: [patch v6 02/12] cli, btrace: add btrace cli Message-ID: <20121217183214.GA14232@host2.jankratochvil.net> References: <1355760101-26237-1-git-send-email-markus.t.metzger@intel.com> <1355760101-26237-3-git-send-email-markus.t.metzger@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1355760101-26237-3-git-send-email-markus.t.metzger@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 X-SW-Source: 2012-12/txt/msg00583.txt.bz2 On Mon, 17 Dec 2012 17:01:31 +0100, markus.t.metzger@intel.com wrote: [...] > --- a/gdb/btrace.c > +++ b/gdb/btrace.c [...] > @@ -166,3 +188,581 @@ next_btrace (struct thread_info *tp) > > return VEC_index (btrace_block_s, btp->btrace, btp->iterator); > } > + > +/* Enable branch tracing. Turn errors into warnings. */ > + > +static void > +warn_enable_btrace (struct thread_info *tp) > +{ > + volatile struct gdb_exception error; > + > + TRY_CATCH (error, RETURN_MASK_ERROR) > + enable_btrace (tp); > + > + if (error.message != NULL) > + warning (_("%s"), error.message); "%s" does not need localization. > +} > + > +/* Disable branch tracing. Turn errors into warnings. */ > + > +static void > +warn_disable_btrace (struct thread_info *tp) > +{ > + volatile struct gdb_exception error; > + > + TRY_CATCH (error, RETURN_MASK_ERROR) > + disable_btrace (tp); > + > + if (error.message != NULL) > + warning (_("%s"), error.message); "%s" does not need localization. > +} [...] > +static void > +cmd_btrace_disable (char *args, int from_tty) > +{ > + struct thread_info *tp; > + > + if (args != NULL && *args != 0) > + { > + ALL_THREADS (tp) > + if (number_is_in_list (args, tp->num)) > + warn_enable_btrace (tp); Here should be warn_disable_btrace. > + } > + else > + { > + tp = find_thread_ptid (inferior_ptid); > + if (tp == NULL) > + error (_("Couldn't disable branch tracing: no inferior thread.")); > + > + disable_btrace (tp); > + } > +} [...] > +static void > +do_btrace_list_function (struct btrace_block *trace) > +{ > + struct minimal_symbol *msymbol; > + struct symbol *symbol; > + const char* func; GDB is using 'const char *' style. > + > + func = "??"; > + symbol = find_pc_function (trace->begin); > + if (symbol != NULL) > + func = SYMBOL_PRINT_NAME (symbol); [...] > +static void > +do_btrace_list_item (struct btrace_block *trace, enum btrace_list_flags flags) > +{ > + if (flags & BTR_LIST_ADDRESS) if ((flags & BTR_LIST_ADDRESS) != 0) > + do_btrace_list_address (trace); > + > + if (flags & BTR_LIST_FUNCTION) dtto > + do_btrace_list_function (trace); > + > + if (flags & BTR_LIST_LINE) dtto > + do_btrace_list_line (trace); > +} [...] > +/* The "btrace list" command. */ > + > +static void > +cmd_btrace_list (char *args, int from_tty) [...] > + if (flags & BTR_LIST_TOTAL) if ((flags & BTR_LIST_TOTAL) != 0) > + { [...] > +/* Print the disassembly of a btrace block. */ > + > +static void > +do_btrace (struct btrace_block *trace, int flags) > +{ > + struct gdbarch *gdbarch = target_gdbarch (); > + > + if (trace == NULL) > + error (_("No trace.")); > + > + if (trace->end < trace->begin) > + warning (_("Bad trace: %s - %s"), paddress (gdbarch, trace->begin), > + paddress (gdbarch, trace->end)); Shouldn't this be rather gdb_assert? How to create such case? > + > + gdb_disassembly (gdbarch, current_uiout, 0, flags, -1, > + trace->begin, trace->end + 1); > +} [...] No need for a repost wrt the changes above. Thanks, Jan