From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75767 invoked by alias); 14 Aug 2015 17:02:36 -0000 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 Received: (qmail 75754 invoked by uid 89); 14 Aug 2015 17:02:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-io0-f181.google.com Received: from mail-io0-f181.google.com (HELO mail-io0-f181.google.com) (209.85.223.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 14 Aug 2015 17:02:34 +0000 Received: by iodt126 with SMTP id t126so91376693iod.2 for ; Fri, 14 Aug 2015 10:02:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=XMkjs6ZJzwxCz5RlzyBqyAs8u+sunRLc7pyJUXO9yQA=; b=liljSlOI60E+PWgsfnrZIXhrh5YoEzAzqjHSd+jcquHKXo1CUh8RyhU3cLBXvfskYt 7gkce3cpOZP188b3y4/dcdDGU2baRn0OQC+afyX3kdw2PBZed1FUAqKTs0962UYfbFrB 4UfE0nNZHvyGn3IqTOYFyyTsNZhV/N7fKcm117zh+gAczp2uugTslqiuZo/wdButif9Z 1wZxLv0pRGGnA+5w6/IqvLMRWT6yToXmEEnGYKUsixuyyVZxDA0DXLpCrieUGFEv+pgz eWSYLGxdf7cMXT3d2xkfTnPHiFJ18TOOphySd4+h8l2BixzGlacAebA30/DQa054dgd6 a/Ww== X-Gm-Message-State: ALoCoQnx3gXc5lK70ZLzePwMkdCjdzjyr6p359XWR0DRi+ipThqnf00GnWbuSwUgWNEwkUISNLzp X-Received: by 10.107.6.230 with SMTP id f99mr4185464ioi.61.1439571751690; Fri, 14 Aug 2015 10:02:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.19.130 with HTTP; Fri, 14 Aug 2015 10:01:51 -0700 (PDT) In-Reply-To: <1439552272-6256-1-git-send-email-markus.t.metzger@intel.com> References: <1439552272-6256-1-git-send-email-markus.t.metzger@intel.com> From: Doug Evans Date: Fri, 14 Aug 2015 17:02:00 -0000 Message-ID: Subject: Re: [rfc] btrace: change record instruction-history /m To: Markus Metzger Cc: Pedro Alves , gdb-patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg00383.txt.bz2 On Fri, Aug 14, 2015 at 4:37 AM, Markus Metzger wrote: > The /m modifier interleaves source lines with the disassembly of recorded > instructions. This calls disasm.c's do_mixed_source_and_assembly once for > each recorded instruction to be printed. > > The latter really does a source print with intermixed disassembly. To that > purpose, it may reorder instructions to better match the source. This is > nice for disassembling an entire function, but it doesn't work for printing > a single instruction. Even for an entire function "source centric" disassembly can be a pain. If some find it useful, great, but I never do. > Change record instruction-history /m to use its own simple source interleaving > algorithm. The most important part is that instructions are printed in > the order in which they were executed. Before each instruction, we print > a range of source lines that are attributed to the instruction's PC. If the > source line range has already been printed (or skipped) for the previous > instruction, we skip it. > > The algorithm would fill in the missing lines if a PC is attributed to more > than one source line. I have not seen this. There always seems to be at > most one source line per PC. One can imagine such a think happening more often with an LIW ISA. [assuming the compiler cares to provide such info] > I don't think that there is an MI consumer of "record instruction-history" > and I have no idea if and how this might affect MI. Good question. Dunno either. > Alternatively, we could extend Doug Evan's new algorithm > https://sourceware.org/ml/gdb-patches/2015-08/msg00335.html to take a vector > of PCs. > > 2015-08-14 Markus Metzger > > gdb/ > * record-btrace.c (struct btrace_line_range): New. > (btrace_mk_line_range, btrace_line_range_add) > (btrace_line_range_is_empty, btrace_line_range_contains_range) > (btrace_find_line_range, btrace_print_lines): New. > (btrace_insn_history): Add source interleaving algorithm. Yeah, I'd like to avoid having multiple copies of code doing basically the same thing. Plus, no one is going to look in record-btrace.c for "smart disassembly support". disasm.c should be providing the necessary API that the rest of gdb an use.