https://bugs.kde.org/show_bug.cgi?id=418795

            Bug ID: 418795
           Summary: command line to inform valgrind of symbols for code
                    that is loaded outside of the normal flow
           Product: valgrind
           Version: 3.15 SVN
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: wishlist
          Priority: NOR
         Component: general
          Assignee: jsew...@acm.org
          Reporter: jeffersoncarpent...@gmail.com
  Target Milestone: ---

SUMMARY

gdb has an "add-symbol-file" command to inform the debugger of the symbols to
use for code loaded into a certain address.  It would be nice if Valgrind had
this feature too.  In addition to giving more complete stack traces for errors
that occur in dynamically loaded code, this can be used in conjunction with
suppression files to suppress errors in such code.

Use case: Debugging windows executables under wine, the subroutine `chkstk` is
called, and part of the correct behavior for that function is to read past the
end of the stack.  These executables are loaded outside of the normal dlopen
flow, and so valgrind does not have symbol information.  The chkstk errors can
be suppressed using --ignore-range-below-sp, but this could prevent valgrind
from picking up real errors.


STEPS TO REPRODUCE (Desired behavior):

1. valgrind --suppressions=chkstk.supp --add-symbol-file=./main.exe@0x0040100
--trace-children-yes wine main.exe

No desire on the specific command line syntax for adding symbol info.


OBSERVED RESULT (Desired result):

With a suitable suppressions file, valgrind ignores errors that occur in
__chkstk_ms.

Without the suppressions file, trace includes:

    Invalid read of size 4
       at 0x402424: __chkstk_ms (cygwin.S:158)

Instead of:

    Invalid read of size 4
       at 0x402424: ???


ADDITIONAL INFORMATION:

I asked about this feature in this email thread
https://sourceforge.net/p/valgrind/mailman/message/36810610/

Julian did suggest using --ignore-range-below-sp but did not say the feature
was a bad idea, so I am posting it here.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to