Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix hang in gdb in ld-linux.so.2 when running a 32-bit executable on a 64-bit Ubuntu (18.04) system?

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...]
like image 946
Christopher Carner Avatar asked Oct 03 '19 19:10

Christopher Carner


1 Answers

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.

like image 123
Melebius Avatar answered Sep 19 '22 02:09

Melebius