From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.help Subject: Re: Exploring a code base? Date: Tue, 27 Oct 2020 22:56:12 +0200 Message-ID: <57dcdf06-3bf4-4281-88d9-0e9c46adc757@yandex.ru> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23619"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 To: Yuri Khan , help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 27 21:56:40 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kXW1I-00060w-EK for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 27 Oct 2020 21:56:40 +0100 Original-Received: from localhost ([::1]:39036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXW1H-0005Lb-GH for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 27 Oct 2020 16:56:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXW0x-0005LS-LQ for help-gnu-emacs@gnu.org; Tue, 27 Oct 2020 16:56:19 -0400 Original-Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]:36241) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kXW0v-0000Mv-3b for help-gnu-emacs@gnu.org; Tue, 27 Oct 2020 16:56:19 -0400 Original-Received: by mail-ed1-x52b.google.com with SMTP id l16so2907840eds.3 for ; Tue, 27 Oct 2020 13:56:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Ixfnl9gJTXWmkjl0NOsb9RtKqu0WkTbiW7pr/tfIRzg=; b=R4mMdz6G8SYtNqBeDbz1n/u9AHRyaBTIsR2nj+9ul5cGIJ6joNCviDPN2rDX1SBfrG v8HlRiBCKvCs4Xbi2l147UHIPjBdDUnTSVD7Bjv3ZveTo0YG6lDGpbHDOY4P3AXr2IiR NhSv/OVlMTQ8H7caX4b4Rw4HNgJ0awld6XtEPjQAtScKnJ9UxrJKp645HVyLs8K0ODiz qnTeqOX1JIqc2ZLladeMSkItkQjADsWuz7ZQ4DkRFPhh5bTwvgzpQKhIHd+6Z8A5cHNn MTAMxUH3qIVxvnQGeTZPnhWedjkOz/gngW6NoHHRSKyfEuUPc8x6PAWh3T06Pl87Lzu7 xHPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Ixfnl9gJTXWmkjl0NOsb9RtKqu0WkTbiW7pr/tfIRzg=; b=hixMlljuXL479TNPP82yenWyu0kiIGQZcwo4RbSQ5xvLxLO7fDHP/Szme2LMsrUlJe KuPALry99D7iSbkOKXeuLNUOjOsglYz9ourabB4ENuj4ToGIfia/ze0ISbXxKA1dY+5i R/nBPXAibmJNKfc50effoaoQy1GEnnDzFC3llHDojwJC9YnFg/tLRa78X8/b+7cpFips +mtdlHmmewc8m+END9l+OMo7UCGd8vOcOh7FPeQ/ZXVqty7bC3sasMEC9rT/YPPP0yrc wRNaFkIR8sJNQ95qplYmvBUQFkfRtVdsy45FxIPf4q8OOpjQPZ1Xew/zoJAvp/2oypA5 rSeQ== X-Gm-Message-State: AOAM533scTMd8pxrlef9NhLZwsx+0bdPKKw7H517m3WdB9BwMbjX1D+c lxNrRljsnIkPvLs98w/RvYcj+/J1Bo165w== X-Google-Smtp-Source: ABdhPJyvNkpHHi3id+cvpSSWOLShvlP9O7tIe8QzQXrFQjGctZyA9JYWw5gVZmG43VC7FZhBSGs4Ew== X-Received: by 2002:a05:6402:143d:: with SMTP id c29mr4128598edx.277.1603832174597; Tue, 27 Oct 2020 13:56:14 -0700 (PDT) Original-Received: from [192.168.0.4] ([66.205.71.3]) by smtp.googlemail.com with ESMTPSA id y3sm1729222ejk.92.2020.10.27.13.56.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 27 Oct 2020 13:56:13 -0700 (PDT) In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=raaahh@gmail.com; helo=mail-ed1-x52b.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -36 X-Spam_score: -3.7 X-Spam_bar: --- X-Spam_report: (-3.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NICE_REPLY_A=-2.167, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:124749 Archived-At: On 27.10.2020 13:38, Yuri Khan wrote: > Basically what I’m doing is traversal of a graph, where nodes are type > and function definitions, and edges are relationships such as > “function function”, “function type”, “function > type”, “type type”, “type type”, > etc. > > When the change I’m doing is not very invasive, the affected subgraph > fits completely in my head. However, when it doesn’t, I find myself > having to record my traversal state. I create an Org buffer and > manually maintain a queue of nodes, marking those I haven’t yet > visited with TODO and those I have with DONE. Then I pick the first > TODO, grep or xref-find-references on it, add any relevant nodes to > the queue, make the necessary changes in the code, and mark the node > DONE. Repeat until no TODO. Speaking of Xref, we could add some new commands: to remove items from the list, to undo removals. And a stacking for searches, so you could go back to the previous search result. Not sure how much that will help. > This is rather tedious. It feels like there should exist a better way, > maybe with a visualization of the graph structure. > > What do you use to explore and map a code base and perform extensive > changes on it? I don't have a solution, personally, and I usually work in a dynamic language where this isn't a very feasible thing to do. But the feature in question sounds intriguing. Here's a couple things for C/C++ I found with a brief search: * https://github.com/beacoder/call-graph uses GNU Global. It has a tree-based Emacs interface. Could be a bit immature/use some help with development, looking at the issues list. * Here's a recipe for a graphical call graph: https://stackoverflow.com/a/5373814/615245 It is probably not exactly what you wanted, but the intermediate created by Clang could serve as a better data source than Global if someone tried to create a new Emacs based UI for this. If you find any of this useful, please share your experience.