0

I'm debugging a binary with an older libc version than my system's one (I have libc-2.31, I'm running 2.24). I execute gdb with the LD_LIBRARY_PATH and it works like a charm, but I cannot load any symbols.

I downloaded the closest symbols file from http://archive.ubuntu.com/ubuntu/pool/main/g/glibc/libc6-dbg_2.23-0ubuntu11.2_amd64.deb, extracted it and after loading the binary into gdb, I execute:

add-symbol-file <path_to_libc-2.27.so from the deb package>

the file was loaded successfuly, but the addresses are incorrect. For example, trying to stop on a symbol such as 'main_arena' (x/40gx &main_arena) produces the following error:

0x3ebc40 <main_arena>: Cannot access memory at address 0x3ebc40

obviously this address is too low, thus I guess it's only the offset. What is my problem? maybe I need to find the exact debug file that suits my version (2.24)? because I there is no one.

Thanks!

Inter Sys
  • 129
  • 7

1 Answers1

0

I execute gdb with the LD_LIBRARY_PATH and it works like a charm,

It is not supposed to work, and if it happens to work today, it will likely break tomorrow.

The easiest solution is to debug inside a VM or a docker container with the desired version of GLIBC installed.

If you don't want to do that, see this answer on how to properly set things up for multiple GLIBCs on a single host.

Employed Russian
  • 199,314
  • 34
  • 295
  • 362