VerySleepy / verysleepy

Very Sleepy, a sampling CPU profiler for Windows
http://www.codersnotes.com/sleepy
GNU General Public License v2.0
1.05k stars 103 forks source link

Debug symbols are wrong/mixed up with MinGW/GCC 8.1.0 compiled program. #63

Closed DEF7 closed 5 years ago

DEF7 commented 5 years ago

I've a project that when compiled using MinGW/GCC v3.4.5 with -g1 Very Sleepy works fine profiling it: functions are accurate and clicking one brings up its source code.

However, compiling the exact same project, using MinGW/GCC v8.1.0 it took a bit of wrangling but I finally managed to get Very Sleepy to see the symbols (the whole time it would say that it had loaded DWARF debugging symbols but functions would show up as their addresses). This required -g0 -dwarf- 2 -fno-omit-frame-pointer before I could see symbols.

The problem is that the symbols are wrong! Function names are showing up for functions which definitely are not executing during profiling, I know this to be fact because the functions require a very specific path of user interaction and they are only executed sparingly and never to the point where they would make up a significant portion of the exclusive execution time. I know for a fact the functions named are not the actual ones executing as Very Sleepy very obviously shows the actual functions executing when compiled with GCC v3.4.5. I know that GCC changed some things with debugging symbols since one of the more recent versions, but Very Sleepy seems to be completely unusable with these newer versions of GCC as a direct result. Also, I have not been able to get symbols to work at all when compiling 64-bit, even with the compiler flags that kinda work for the 32-bit version of 8.1.0.

Also, clicking on a function fails to bring up the source file at all, let alone the function's source code - and for the source file path in the status bar it shows the source code filepath as being it's absolute path with a copy of the absolute path appended to that - except with the slashes inverted.

image

I'm super bummed about this, because Very Sleepy was the perfect profiling option for a long time and I only changed compiler versions to keep with the times as my project needed to be able to access more memory and I could only do that by compiling 64-bit with a newer version of MinGW/GCC. I really hope this can be resolved at some point in the near future.

CyberShadow commented 5 years ago

Quality of GCC/MinGW/DWARF debugging information resolution falls within the territory of the DrMinGW project, which Very Sleepy uses.

See if the problem persists with dbghelpdr.dll built from the current git version of Dr. MinGW. If so, you should probably follow up there.

DEF7 commented 5 years ago

Very Sleepy just crashes whenever my MinGW compiled program is running now. I'm just going to find something else that works. Thanks.