| Summary: | Track deletions of objects from unloaded shared libraries | ||
|---|---|---|---|
| Product: | [Developer tools] valgrind | Reporter: | Michael Barth <Spirrwell> |
| Component: | memcheck | Assignee: | Julian Seward <jseward> |
| Status: | REPORTED --- | ||
| Severity: | wishlist | CC: | philippe.waroquiers, pjfloyd |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Michael Barth
2022-08-20 23:23:20 UTC
Does --keep-debuginfo=yes make any difference? Also can you provide a small example that reproduces the issue? (In reply to Paul Floyd from comment #1) > Does --keep-debuginfo=yes make any difference? > > Also can you provide a small example that reproduces the issue? This does not make any difference for me. Here is an example repo: https://github.com/Spirrwell/so_unload_delete_demo It is worth noting that when using --leak-check=full, valgrind does pick up on the fact that there's a leak relating to dlclose in this example. But only when these two things are side-by-side in such a small example would I be able to see the relation between the two. While debugging this big old application, I had a giant wall of leaks and I was trying to debug what I THOUGHT was heap corruption, but was simply this shared library unloading issue. So having ANY little extra hint that this kind of problem occurred would be quite useful. Valgrind keeps recently freed blocks in a list that allows to report where it was allocated. If the size of this list (controlled by --freelist-vol parameter) is big enough and you use --keep-debuginfo=yes, then I think valgrind should be able to tell you the stack trace that allocated the referenced freed block. Now, if the segmentation violation happens because the destructor code has been unloaded and this destructor code is not found anymore via a pointer in the dispatch table, then valgrind does not track executable code and/or dispatch table. I do believe it is a result of the destructor being called and not specifically delete or free. Using placement new with malloc'd memory and calling the destructor manually yields the same kind of segmentation fault. In which case, that kinda stinks. Oh well, thank you anyway! |