1

Given a set of public headers, and various test code that makes use of these headers, I need to generate a list of used/unused API calls.

I am working with a platform that can not easily have traditional code coverage at runtime, but my requirements are a bit simpler hopefully.

I only need this to occur statically, and it seems as if this should be an easily accomplished thing (Most IDE's show all available function calls). I haven't found an appropriate tool for this though. The closest I found was Facebook Infer, but that seems to be a bit different than what I want.

Can anyone recommend one? Or point me to the specific term for what I am looking for?

1

Depending on your platform you may go the route of using the link interface.

a) Your tests will import symbols. That's the used API.

b) Your software will export symbols. Substract a) to get unused API.

A tool simple as simple as nm would do the job then. Using the OpenSSL library on an ELF system as an example: this invocation gives you the imported symbols:

nm -D --undefined-only /usr/bin/openssl

The total list of provided symbols becomes visible like this

nm -D --defined-only /usr/lib/x86_64-linux-gnu/libssl.so

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.