HBehrens / puncover

Analyses C/C++ build output for code size, static variables, and stack usage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nothing in stack column

ali-rostami opened this issue · comments

Hi there,
Recently I came across Puncover. It is a very nice and useful tool.
But unfortunately, it doesn’t show me anything in the stack column. Folders are also unknown!
image
So would you please help me with this?

commented

I had the same issue.

  1. Make sure you compile with -fstack-usage
  2. Point --build-dir to the build dir with the newly created .su files
  3. My compiler's objdump doesn't contain filenames, which puncover is looking for, so no symbols match. Check with
    $CROSS_COMPILE-objdump -dslw file.elf
    If you don't see filenames with the function names, this is a problem. Maybe there's a compile option to include it, but I didn't go this route.
    Instead, I modified the code to just match by function name and ignore filename and line

collector.py:

-        basename_symbols = [s for s in self.symbols.values() if s.get(BASE_FILE, None) == base_file_name]    
+        basename_symbols = [s for s in self.symbols.values() ]
-            if symbol.get(LINE, None) == line or self.display_names_match(symbol_name, symbol.get(DISPLAY_NAME, None)):
+            if self.display_names_match(symbol_name, symbol.get(DISPLAY_NAME, None)):

Hi @lawm , thank you so much for your response. 🙂🙏
when I add --build-dir like this:

python runner.py --elf_file ../myProject/prj/stm32-build/build/myProject-debug.elf --build_dir ../myProject/prj/stm32-build/build/

it gives me so many warnings like this:

WARNING:  Couldn't find symbol for stm32g4xx_hal_pcd.c:2047:HAL_PCD_EP_DB_Transmit

I also tried your modification(3) unfortunately it didn't help.
It seems to me I should focus on the warnings. Do you have any idea about it?

commented

no, you'll have to debug it