From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18489 invoked by alias); 5 Mar 2013 20:12:12 -0000 Received: (qmail 18462 invoked by uid 22791); 5 Mar 2013 20:12:07 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS 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; Tue, 05 Mar 2013 20:12:03 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r25KC0D8012122 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 5 Mar 2013 15:12:00 -0500 Received: from host2.jankratochvil.net (ovpn-116-50.ams2.redhat.com [10.36.116.50]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r25KBr71005647 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 5 Mar 2013 15:11:56 -0500 Date: Tue, 05 Mar 2013 20:12:00 -0000 From: Jan Kratochvil To: Markus Metzger Cc: gdb-patches@sourceware.org, markus.t.metzger@gmail.com, Eli Zaretskii Subject: Re: [patch v9 18/23] record: add "record function-call-history" command Message-ID: <20130305201153.GR2386@host2.jankratochvil.net> References: <1362416770-19750-1-git-send-email-markus.t.metzger@intel.com> <1362416770-19750-19-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: <1362416770-19750-19-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: 2013-03/txt/msg00181.txt.bz2 On Mon, 04 Mar 2013 18:06:05 +0100, Markus Metzger wrote: > Add command to print the function names from recorded instructions. > > The command supports iterating over the execution log similar to the "list" > command. > > This command provides a quick high-level overview over the recorded execution > log at function granularity without having to reverse-step. > > CC: Eli Zaretskii > > 2013-03-04 Markus Metzger > > * target.c (target_call_history, target_call_history_from, > target_call_history_range): New. > * target.h (target_ops) to_call_history_range>: New fields. > (target_call_history, target_call_history_from, > target_call_history_range): New declaration. > * record.c (get_call_history_modifiers, cmd_record_call_history, > record_call_history_size): New. > (_initialize_record): Add the "record function-call-history" command. > Add "set/show record function-call-history-size" commands. > * record.h (record_print_flag): New. [...] > --- a/gdb/record.c > +++ b/gdb/record.c [...] > +/* The "record function-call-history" command. */ > + > +static void > +cmd_record_call_history (char *arg, int from_tty) > +{ > + int flags, size; > + > + require_record_target (); > + > + flags = get_call_history_modifiers (&arg); > + size = (int) record_call_history_size; > + if (size < 0) > + size = INT_MAX; Again please comment, I do not understand off-hand what is the goal of this code. > + > + if (arg == NULL || *arg == 0 || strcmp (arg, "+") == 0) > + target_call_history (size, flags); > + else if (strcmp (arg, "-") == 0) > + target_call_history (- size, flags); Just '-size', no space there. > + else > + { > + ULONGEST begin, end; > + > + begin = get_insn_number (&arg); > + > + if (*arg == ',') > + { > + arg = skip_spaces (++arg); > + > + if (*arg == '+') > + { > + arg += 1; > + size = get_context_size (&arg); > + > + no_chunk (arg); > + > + target_call_history_from (begin, size, flags); > + } > + else if (*arg == '-') > + { > + arg += 1; > + size = get_context_size (&arg); > + > + no_chunk (arg); > + > + target_call_history_from (begin, -size, flags); > + } > + else > + { > + end = get_insn_number (&arg); > + > + no_chunk (arg); > + > + target_call_history_range (begin, end, flags); > + } > + } > + else > + { > + no_chunk (arg); > + > + target_call_history_from (begin, size, flags); > + } > + > + dont_repeat (); > + } > +} [...] > --- a/gdb/target.h > +++ b/gdb/target.h > @@ -908,6 +908,16 @@ struct target_ops > /* Disassemble a section of the recorded execution trace. */ > void (*to_insn_history_range) (ULONGEST begin, ULONGEST end, int flags); > > + /* Print a function trace of the recorded execution trace. */ > + void (*to_call_history) (int size, int flags); Please comment the rules which range will be printed depending on SIZE. > + > + /* Print a function trace of the recorded execution trace starting > + at instruction FROM. */ > + void (*to_call_history_from) (ULONGEST begin, int size, int flags); Please comment the meaning/relationship of BEGIN and SIZE. > + > + /* Print a function trace of an execution trace section. */ Comment whether END is inclusive or exclusive. > + void (*to_call_history_range) (ULONGEST begin, ULONGEST end, int flags); > + > int to_magic; > /* Need sub-structure for target machine related rather than comm related? > */ > @@ -2003,4 +2013,13 @@ extern void target_insn_history_from (ULONGEST from, int size, int flags); > /* See to_insn_history_range. */ > extern void target_insn_history_range (ULONGEST begin, ULONGEST end, int flags); > > +/* See to_call_history. */ > +extern void target_call_history (int size, int flags); > + > +/* See to_call_history_from. */ > +extern void target_call_history_from (ULONGEST begin, int size, int flags); > + > +/* See to_call_history_range. */ > +extern void target_call_history_range (ULONGEST begin, ULONGEST end, int flags); > + > #endif /* !defined (TARGET_H) */ > -- > 1.7.1 OK with the comments. Thanks, Jan