opengrok icon indicating copy to clipboard operation
opengrok copied to clipboard

Find Entry and Exit API functions in source code repository

Open ppguru opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe.

I frequently come across large code base. Would like to identify the Entry functions in the source code repository. Also, find exit functions. Entry functions are usually the ones called to invoke the source code. Exit functions are typically the calls OS or base code has to support. Given opengrok is parsing and indexing the file. Finding the call flow and Entry/Exit functions for a folder should be easy.

Describe the solution you'd like

Opengrok should identify the Entry functions (typically the ones which does not have caller) in the given code base. Opengrok should identify the Exit functions (typically functions that are not defined in the code base. Or defined outside the current folder.)

We should be able to goto each folder and find the entry and exit functions for the folder.

Describe alternatives you've considered

Not able to find any alternate solution. Any suggestions welcome.

ppguru avatar Nov 10 '21 08:11 ppguru

Which language/ecosystem do you have in mind ?

OpenGrok is not a compiler (or static analyzer) so it is not able to tell which functions belong to which part of the stack, let alone provide reachability insight directly. Therefore features like caller/callee identification are out of reach, at least without pairing the indexer with an external component that would provide the insight.

Also, the notion of entry points would have to be refined. If a function is defined in a project but has no caller, it could be a case of dead code, not an entry point per se.

Maybe the indexer could ingest a set of externally prepared symbol names (for given project) and treat them in a special way. Then the question is how to represent this in the web app.

vladak avatar Nov 10 '21 09:11 vladak

Hi Vladimir, I am looking for C language support. Identifying dead code as separate entry point is also fine. We can display Entry/Exit points in the "navigate window" of opengrok. Currently "navigate window" is shown only for files. Navigate window can be shown for folder with these additional details.

ppguru avatar Nov 10 '21 12:11 ppguru

I think this is out of scope of what OpenGrok can provide, closing.

vladak avatar Apr 17 '23 12:04 vladak