0

I am loading a core file into GDB inside a docker container with alpine linux. Initially my gdb complained about binary not found, then i followed this discussion gdb During startup program exited with code 127 and installed libc6-compat, even though I have a 64-bit linux and my interpreter for the binary is 64-bit [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]

That actually worked but now i get the same error for the .so files. I can see that .so files are in the path set on solib-search-path but gdb did not load any of the libraries and complains No such file or directory.

binary runs on a production host where the libraries are in the path I am running the binary on a development host by setting the solib-search-path

ldd binary says libraries not found which is expected since this is a development host

PMat
  • 2,039
  • 2
  • 29
  • 46
  • 1
    You are missing a lot of details. Does the binary run outside of GDB? Where are the libraries? What is the output from `readelf -d a.out`? From `ldd a.out`? – Employed Russian Sep 26 '17 at 23:26

1 Answers1

0

binary runs on a production host where the libraries are in the path I am running the binary on a development host by setting the solib-search-path

There is your problem right here.

The solib-search-path is the path where GDB will look for libraries.

In no way does that setting affect the binary itself, which uses either standard system library path, compiled-in DT_RPATH, or LD_LIBRARY_PATH environment variable to search for shared libraries.

Usually, solib-search-path should only be set when you are analyzing a core dump that came from some other host (GDB needs access to the exact libraries that were used when the core dump was generated). Setting solib-search-path while running a local binary should never be ncessary -- GDB can automatically deduce where the libraries are by asking the runtime loader where they are.

ldd binary says libraries not found which is expected since this is a development host

If ldd says that, then of course you will not be able to run the binary (inside of outside GDB).

valiano
  • 16,433
  • 7
  • 64
  • 79
Employed Russian
  • 199,314
  • 34
  • 295
  • 362
  • I have set the solib-search-path and loading a core file even now gdb shows `No shared libraries loaded at this time`. – PMat Sep 27 '17 at 02:03
  • @PMat A) You seem to be asking a totally different question yet again, and B) you are not providing nearly enough details while doing so. I don't see how anyone can help you given the info you have provided. – Employed Russian Sep 27 '17 at 02:44
  • 1
    Actually, re-reading your question, I *think* it's a duplicate of this one: https://stackoverflow.com/a/10629444/50617 – Employed Russian Sep 27 '17 at 02:53