How do you find a particular piece of functionality in a large codebase? [closed] How do you find a particular piece of functionality in a large codebase? [closed] google-chrome google-chrome

How do you find a particular piece of functionality in a large codebase? [closed]


There is no one size fits all approach to this sort of problem. But for this one I would try these:

  • If there are any unique messages associated with the operation, grep all the source files for that string. A common pitfall of this technique is that messages might be assembled from pieces within the application, so it is often helpful to grep for a unique short phrase—or even a single word—to identify the source of the message. Once the text is found, then finding what references it often requires more text searches.

  • Trace execution from an easy-to-find point, like the command processing and dispatch loop. I'd look for a Tab key case and follow where it leads.

  • Look at source code directory and filenames for hints. Software is often constructed rationally, with good engineers dividing and conquering in a sensible way.


A test coverage tool is a good way to do this. They tell you what part of an applicationis exercised by a test.

Instrument the application to collect test coverage. Execute the functionality you care about. Record what is executed. Execute something similar, but not the same as the functionality you want. Record this. Take the set difference over the coverage. The diff selects code involved in the functionality of interest, excluding code which is common to similar functionality.


Ask the Chromium team. They don't give points or bronze pixels but they're definitely the authority and right people to ask this sort of questions.