1

I have below libs in /usr/lib path(stripped) which needs to be replaced with unstripped types.

/usr/lib/libdbus-1.so.3.14.7
/usr/lib/liblog4c.so.3.3.0
/usr/lib/libnetsnmp.so.40.0.0
/lib/ld-2.24.so

As I need to run valgrind for one of my process (say : snmp agent process), having libs with debug symbols will help in identifying file location, function name info.

From /proc/$pid/maps file found that in addition to snmp agent process, there are some other processes also using these listed libraries. So what will happen to these processes when I replace the existing stripped libs with unstripped libraries in the same path.

or

How to run valgrind without disturbing other processes which are using the libs of interest.

  • I'm not sure if dealing with `ld-*.so` may require special handling, but for the others, that sounds more like a job for `LD_PRELOAD` –  Jun 30 '21 at 12:18
  • @Frank - Any example available to use `LD_PRELOAD`. Does any crash occur to other processes upon replacing unstripped libs. – renga_in_stack Jun 30 '21 at 12:22
  • Here's a simple example: https://stackoverflow.com/a/426260/4442671, and no, other processes still use the system's libraries and are unaffected. –  Jun 30 '21 at 12:23
  • @Frank- So I have to place the unstripped libs in a different path and refer it in LD_PRELOAD env variable. Also I have multiple libs, so for this [link](https://stackoverflow.com/questions/8474363/specifying-multiple-files-with-ld-preload) will be appropriate? – renga_in_stack Jun 30 '21 at 12:55

1 Answers1

2

Exactly what operating system are you using?

Normally the way that you should do this is to install the debuginfo packages. Most Linux distributions split out the debuginfo, so that you can install stripped binaries but also optionally install the separate debuginfo. Tools like gdb and Valgrind know where to look for the debuginfo files and will read them when needed.

If you do that then you should not need to install un-stripped binaries.

Paul Floyd
  • 5,530
  • 5
  • 29
  • 43