From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9840 invoked by alias); 6 Mar 2013 21:11:41 -0000 Received: (qmail 9829 invoked by uid 22791); 6 Mar 2013 21:11:40 -0000 X-SWARE-Spam-Status: No, hits=-5.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-ve0-f202.google.com (HELO mail-ve0-f202.google.com) (209.85.128.202) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 06 Mar 2013 21:11:33 +0000 Received: by mail-ve0-f202.google.com with SMTP id m1so916608ves.1 for ; Wed, 06 Mar 2013 13:11:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:date:message-id:from:to:cc:subject:in-reply-to :references:x-mailer:x-gm-message-state; bh=SkPY32UUvWdxEF/flr0kIj26tNYZh9O9BXgK3rZH1+k=; b=BGIxFElUnTtfOoMlQctSb/cQS7fzvGAnzQhL9PYpqBFr8KlYSQc7QA2NVwVN9RrLsJ 8bRBsrZZgzWtwKgjkADKt4gTu6jWlcmthVX73P2A2P4hppgytO4lpRKpmEkMgc+aszRw 93BWN7jtsE+X6LHqdbpuokylpfSkMc1DwxeE49/U2fqpnZDVZi5Icx8TF8afPyqoppw+ Zyeqke/T0vJOyu8YaWW3hfzuAwQViAWT5NcOfLK/a2hYgTRVv1k3L74FSqHI4wDwq3mC ieBOD9N9IGeyeFx0sBk3H7w7Yl9iojfYNBwXfvQJVhqTXKuTuiSwvYlXrAHL7f5aWzQI R+fA== X-Received: by 10.236.116.194 with SMTP id g42mr5094173yhh.29.1362604292896; Wed, 06 Mar 2013 13:11:32 -0800 (PST) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id h26si663399yhf.3.2013.03.06.13.11.32 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Wed, 06 Mar 2013 13:11:32 -0800 (PST) Received: from ruffy2.mtv.corp.google.com (ruffy2.mtv.corp.google.com [172.17.128.107]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 0E2A531C1B6; Wed, 6 Mar 2013 13:11:31 -0800 (PST) Date: Wed, 06 Mar 2013 21:11:00 -0000 Message-Id: From: Doug Evans To: Markus Metzger Cc: jan.kratochvil@redhat.com, gdb-patches@sourceware.org, markus.t.metzger@gmail.com Subject: Re: [patch v9 01/23] thread, btrace: add generic branch trace support In-Reply-To: <1362416770-19750-2-git-send-email-markus.t.metzger@intel.com> References: <1362416770-19750-1-git-send-email-markus.t.metzger@intel.com> <1362416770-19750-2-git-send-email-markus.t.metzger@intel.com> X-Gm-Message-State: ALoCoQnZEKSksqYlHfNXVZkMu9iHlTBEw5ctRkeGWM9QPujrGQ/1n/PjtOmh/vTHXmSnNMoGyFXEs3393sg52WYmiXEf/WdwhL+ezJP5JexTWGCIPHn35/cl62IM7LMJahYfhz6n8FDcFHdc1d7+cIp6QozRF3ErNZSTMdE4fGioc2P3MwvMyvAtR44hp+/rOwYP9T6ire+9/daP4EYwtguqEAUoNw4R4A== 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/msg00230.txt.bz2 Markus Metzger writes: > Add branch trace information to struct thread_info to hold the branch trace > information for that thread. > > Add functions to enable, disable, clear, and fetch a thread's branch trace. > > 2013-03-04 Markus Metzger > > * target.h: Include btrace.h. > (struct target_ops): Add btrace ops. > * target.c (update_current_target): Initialize btrace ops. > (target_supports_btrace): New function. > (target_enable_btrace): New function. > (target_disable_btrace): New function. > (target_read_btrace): New function. > (target_btrace_has_changed): New function. > * btrace.h: New file. > * btrace.c: New file. > * Makefile.in: Add btrace.c. > * gdbthread.h: Include btrace.h. > (struct thread_info): Add btrace field. > * thread.c: Include btrace.h. > (clear_thread_inferior_resources): Call btrace_disable. > * infcmd.c: Include btrace.h. > (detach_command): Call btrace_disconnect. > * common/btrace-common.h: New file. Hi. Just some nits. > +/* Branch trace iteration state for "record function-call-history". */ > +struct btrace_func_iterator > +{ > + /* The function index range [begin; end[ that has been covered last time. Typo: end] > +/* A branch trace block. > + > + This represents a block of sequential control-flow. Adjacent blocks will be > + connected via calls, returns, or jumps. The latter can be direct or > + indirect, conditional or unconditional. Branches can further be > + asynchronous, e.g. interrupts. */ > +struct btrace_block > +{ > + /* The address of the first instruction in the block. */ > + CORE_ADDR begin; > + > + /* The address of the last instruction in the block. */ > + CORE_ADDR end; > +}; Can you elaborate in the docs for "end" what it is? E.g., on an ISA with only 4 byte instructions, and the block contains two instructions, is end == begin+4 or begin+7 or begin+8? I'd guess that it's begin+4, but IWBN if the comment removed all doubt. > +/* See target.h. */ Blank line between function comment and definition. [Here and elsewhere.] > +int > +target_supports_btrace (void) > +{ > + struct target_ops *t; > + > + for (t = current_target.beneath; t != NULL; t = t->beneath) > + if (t->to_supports_btrace != NULL) > + return t->to_supports_btrace (); > + > + return 0; > +}