HBehrens / puncover

Analyses C/C++ build output for code size, static variables, and stack usage
MIT License
431 stars 94 forks source link

Add support for 64-bit addresses #51

Open dredfern-zoox opened 2 years ago

dredfern-zoox commented 2 years ago

The regex in collector.py currently assumes that the memory addresses output by nm are 8-characters wide (e.g. 32-bit addresses). Update the regex to accept any number of characters between 8 and 16 (to support 64-bit addresses).

Minimal test example using a 64-bit host machine and toolchain (shows no symbols on current master, but finds symbols on this commit):

echo "int main() { return 0; }" > test.cpp
g++ test.cpp   # uses host gcc tools (64-bit Linux) but same result for AARCH64 compilers
puncover --gcc_tools_base /usr/bin/ --elf ./a.out --src_root . --build_dir .

I'm not sure whether the regexes to parse assembly lines will also need updating in the future; the platform I'm working on does not have any disassembly wider than 9 characters. I did update the assembly addresses, though, and also added test cases for both address types.