0

massif doesn't show any function names for functions which are in a lib and this lib is closed by dlclose().

If I remove dlclose(), and run the recompile and execute program I can see the symbols. Is there a way to know the function names without changing the source code?

Paul Floyd
  • 5,530
  • 5
  • 29
  • 43
MJM101
  • 3
  • 2
  • Please add the code, so that we can see what the problem might be. – David Baak Oct 15 '18 at 10:59
  • Possible duplicate of [Why doesn't valgrind massif report any function names or code references?](https://stackoverflow.com/questions/15351549/why-doesnt-valgrind-massif-report-any-function-names-or-code-references) – Paul Floyd Oct 15 '18 at 15:56
  • Yes. Similar to the question mentioned by @PaulFloyd. But my issue is here , I can't change and rebuild code. So , is there a way to get the function names even after dlclose(lib). – MJM101 Oct 15 '18 at 16:15

1 Answers1

0

The new version of valgrind (3.14) has an option that instructs valgrind to keep the symbols of dlclose'd libraries :

--keep-debuginfo=no|yes   Keep symbols etc for unloaded code [no]
                          This allows saved stack traces (e.g. memory leaks)
                          to include file/line info for code that has been
                          dlclose'd (or similar)

However, massif does not make use of this information.

You might obtain a usable heap reporting profile by doing:

valgrind --keep-debuginfo=yes --:xtree-leak=yes

and then visualise the heap memory using e.g. kcachegrind.

phd
  • 3,669
  • 1
  • 11
  • 12
  • I tried 3.14 version. I use valgrind --tool=massif --keep-debuginfo=yes and I still can't see any symbols in massif report. "Massif (and more generally the xtree Massif output format) does not make use of archived debug info. Only Memcheck has been (somewhat) tested with --keep-debuginfo=yes, so other tools may have unknown limitations." – MJM101 Oct 16 '18 at 09:49
  • @ManjunathaM : effectively, massif does not make use of this information. I edited the answer to clarify, and suggested to look at the heap profile with memcheck xtree leak report. – phd Oct 17 '18 at 20:13