goldenmean
goldenmean

Reputation: 19026

Does gcov give code coverage analysis for assembly language code

I have an application which i build using gcc on linux host for ARM target processor. This generated arm executable i execute on a ARM development board i have. I want to do some code coverage analysis:

  1. Will gcov show code coverage if i have ARM assembly source files in my build environment?
  2. If my build environment has some X86 assembly source files, then will gcov show code coverage data?

Thank you. -AD.

Upvotes: 2

Views: 1818

Answers (1)

Ira Baxter
Ira Baxter

Reputation: 95410

AFAIK, gcov works by preprocessing your C or C++ source code. If you have pure assembly language files, I don't think gcov ever sees them.

If it does, I'd be suprised if it understand how to safely insert code in arbitrary-target assembly code, with ARM being common enough so there's a faint chance. The problem with instrumentating assembly code is the test coverage probe code itself may require registers, and there isn't a safe way to know, for an arbitrary piece of assemblers, a) what registers are available, and b) if there's an inserted instruction, will some other instruction break because of the extra space (e.g., a hardwired jump relative across the inserted instruction).

Upvotes: 2

Related Questions