How to fix hang in gdb in ld-linux.so.2 when runni

2020-03-19 09:44发布

I'm trying to debug a 32-bit executable on a 64-bit Ubuntu system. It runs just fine by itself from the command line, but when I try to use gdb, it hangs in ld-linux.so.2. Also, gdb works for the 64-bit version of the executable. Does anyone have a clue as to what I should try?

I just re-imaged a machine to Ubuntu 18.04.3, and I installed the multilib versions of gcc and g++.

Thanks in advance.

gdb <executable>
GNU gdb ...
This GDB was configured as "x86_64-linux-gnu"
...
Reading symbols from <executable>...done.
(gdb) show archi
The target architecture is set automatically (currently i386)
(gdb) break main
Breakpoint 1 at ...
(gdb) run
Starting program...
warning: Breakpoint address adjusted from 0xf7fd9be0 to 0xfffffffff7fd9be0.
...
(7 of these)
[hangs...]
[In another terminal, ran 'kill -CONT <pid>']
Program received signal SIGCONT, Continued.
0xf7fd9be0 in ?? () from /lib/ld-linux.so.2
(gdb) cont
[hangs again...]

3条回答
够拽才男人
2楼-- · 2020-03-19 10:07

UPDATE: This problem has been fixed for Ubuntu in the gdb package version 8.1-0ubuntu3.2, so just upgrading your packages (sudo apt update && sudo apt upgrade) should help currently.


ORIGINAL ANSWER:

@EmployedRussian suggested in his edit to the question:

By downgrading from gdb=8.1-0ubuntu3.1 to gdb=8.1-0ubuntu3 the debugger started working again for me.

This also worked for me on Ubuntu 18.04.3. You should issue these commands:

sudo apt install gdb=8.1-0ubuntu3  # downgrade GDB to the working version
sudo apt-mark hold gdb  # prevent upgrading (until the repository version is fixed)

I created a bug report for Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gdb/+bug/1848200
You can click Does this bug affect you? if you have an Ubuntu account to get it fixed sooner.

查看更多
Root(大扎)
3楼-- · 2020-03-19 10:09

Probably this gdb bug: https://sourceware.org/bugzilla/show_bug.cgi?id=23210

Try upgrading to the current GDB version (8.3.1). If Ubuntu doesn't offer a package for that, you can try compiling it yourself.

查看更多
做自己的国王
4楼-- · 2020-03-19 10:27

This is now fixed in 8.1-0ubuntu3.2 in bionic-updates: https://launchpad.net/ubuntu/+source/gdb/8.1-0ubuntu3.2

查看更多
登录 后发表回答