DynamoRIO / dynamorio

Dynamic Instrumentation Tool Platform
Other
2.67k stars 562 forks source link

drcov #1946

Open jcd opened 8 years ago

jcd commented 8 years ago

DrMemory-Windows-1.10.1-3 UnityYAMLMerge.exe 64 bit app Running through drmemory Runs fine using plain commandline

I've run drmemory with -coverage and the put it through drcov2lcov and finally used lcov genhtml to get the following coverage output. Note that line 617 has no hits but 618 does have which cannot really happen. I checked the output from drcov2lcov and the same issue is in that file so I guess it is a bug in drcov/drmemory? Is this a know issue?

     615             : void YAMLMapping::Remove (const YAMLScalar* key)
     616          46 : {
     617           0 :         YAMLNode* n = Steal(key);
     618          46 :         if (n != NULL)
     619          46 :                 n->Free();
     620          46 : }
     621             : 
zhaoqin commented 8 years ago

drcov relies on debug symbols to translate coverage information from machine instructions to source code. So it is often possible that an optimized build may have inaccurate debug symbol. Could you please try:

  1. build the application without optimization and run it with drcov.
  2. build the application with optimization, and use any debugger to see if you can set a breakpoint at line 617. I suspect the compiler may perform some optimization and cause this problem. For example:
  3. optimize away local variable n with a register
  4. inline the function call Steal(key) and use Steal()'s source line location instead of line 617. By doing that, there would be no assignment, so line 617 is ignored in the debug symbols.

If it confirms the debug symbol is correct, could you please provide more information so we can try to reproduce, information include, OS version, Compiler version, build command, running command, etc. Anything that may help us reproduce the problem would be useful.