I am running Ubuntu 20.04 32-bit server on a Raspberry Pi4 (armv7l
architecture with Cortex-A72). I have a simple program, return.s
as follows:
.section .text
.global _start
_start: mov r0, #1
mov r7, #1
swi 0
I can assemble, run, and debug the program locally if libc
is excluded:
as -g return.s -o return.o
ld return.o -o return
./return; echo $? # result is "1"
gdb return
start # breaks at first line
But if I include libc
as a dynamic-linked library, then the debugging hangs:
ld return.o -o return -lc-2.31 \
-dynamic-linker=/usr/lib/arm-linux-gnueabihf/ld-linux-armhf.so.3
./return; echo $? # result is "1"
gdb return
start # hangs
If I interrupt the debugger with Ctrl-C, then I see the following backtrace:
#0 0xb6fe12fe in ?? () from /usr/lib/arm-linux-gnueabihf/ld-linux-armhf.so.3
#1 0xb6fd81e4 in ?? () from /usr/lib/arm-linux-gnueabihf/ld-linux-armhf.so.3
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
Any idea what is happening? Is it possible to debug programs with linked libraries? If not, is there a static library available?