News for hackers. Stuff that matters.
Re:On navigating a large codebase by m463 on Sunday February 14, 2021 @02:16AM (#26130347)
I think this is a fantasy (that many of us have).

"I run this magical tool, and voila! a satellite view of the code!

It clearly shows this river runs into this bay, and there's a dam over there! Now I'm miles ahead of everyone!

Lookie, this river runs in circles..."

Ha.

What really happens is you run some tool and what comes out looks and smells like hair you pulled out of your clogged drain.

I've tried this. Anything graphing shows ... well...

It will look like this:

https://upload.wikimedia.org/wikipedia/commons/9/9b/Social_N...

I think the thing is - the code that gets thing done will confound automated visualization tools.

It's basically like expecting decompiler output to be super helpful. It may help your understanding a little bit, but much will be lost. Yes there are heroic decompiler stories, but time is involved.

Also, most code has macros or helper functions or automatic code generation or something that obfuscates what you're really looking for. You will have to develop a system to unblock this organically.

What will help:

Peruse the source code. Try to follow the flow. if you have tools to jump back and forth between a function call and definition use it.

fix some bugs. Follow the stack traces up and down.

ask people how stuff works. put in the time. and the other stuff mentioned in this article. The osmosis method is really how you'll get it.

Re:On navigating a large codebase by kaba0 on Sunday February 14, 2021 @02:59AM (#26130485)
There is no use viewing the whole graph at large. But “zooming” into and seeing the connections going to and from a node is really useful and not at all “magical”. As it is mentioned in the sibling post, sourcetrail can do it really well.
Re:On navigating a large codebase by antpls on Sunday February 14, 2021 @02:50AM (#26130461)
Maybe one could limit the graph to the happy path to begin with.

The output of a run of profile-guided optimisation could be used to discover that graph, and only the touched functions would be drawn. This graph could be useful to start with the codebase, without being too overwhelming with all the edge cases.

Re:On navigating a large codebase by m463 on Sunday February 14, 2021 @04:07AM (#26130768)
I think this depends on what you're graphing. If it's an application, I think it has a better chance of working.

If it's something like a driver or something with a hal or tables of functions or callbacks it might be harder. If your codebase is large... hmm.

Last time I tried something like this was a decade ago so things might have gotten better.