|
From: | Dmitry Gutov |
Subject: | Re: Exploring a code base? |
Date: | Tue, 27 Oct 2020 22:56:12 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
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 <calls> function”, “function <accepts> type”, “function <returns> type”, “type <derives from> type”, “type <aggregates> 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.
[Prev in Thread] | Current Thread | [Next in Thread] |