Discussion:
gdb and qemu-system-aarch64 setup - breakpoint not reached
(too old to reply)
Raghunath Lolur
2014-08-07 20:12:10 UTC
Permalink
Raw Message
Dear All,

This is my first post to gdb mailing list. If this is off topic,
kindly excuse me and direct me to the right mailing list.

I am using qemu-system emulator (qemu-system-aarch64) and gdb
(aarch64-linux-gnu-gdb) to debug a c program, both running on the same
system, i686-pc-linux-gnu on Ubuntu 12.04 LTS. However, with the gdb,
if I set a breakpoint and issue 'continue' command, it shows
continuing....and never reaches the breakpoint set.

I am requesting help towards understanding the problem and resolving
it. Thanks in advance.

The steps I followed to set up debugging aarch64 program in qemu-system are:

Terminal 1
==========
$ cd /home/user1/qemu-aarch64/qemu.git

/home/user1/qemu-aarch64/qemu.git$
./aarch64-softmmu/qemu-system-aarch64 -machine virt -cpu cortex-a57
-machine type=virt -nographic -smp 1 -m 2047 -kernel
../linux.git/arch/arm64/boot/Image -s -S

Now, the execution freezes and I presume qemu along with gdbserver is
listening on port 1234

Terminal 2
==========

$ export PATH=/home/user1/aarch64-crossbuild-gcc4.9.1/install/bin:$PATH

$ aarch64-linux-gnu-gcc adds2.c -g --save-temps -o adds2-output

The source file adds2.c (available at
https://github.com/gcc-mirror/gcc/blob/master/gcc/testsuite/gcc.target/aarch64/adds2.c)

code snippet of adds2.c
-----------------------------------
85
86 int main ()
87 {
88 int x;
89 s64 y;
90
91 x = adds_si_test1 (29, 4, 5);
92 if (x != 42)
93 abort ();
94
95 x = adds_si_test1 (5, 2, 20);

---------------------------------------

#Invoking cross gdb

$ aarch64-linux-gnu-gdb
... some intro and copyright messages .....

This GDB was configured as "--host=i686-pc-linux-gnu --target=aarch64-linux-gnu"
......

(gdb) set sysroot /home/user1/aarch64-crossbuild-gcc4.9.1/sysroot

(gdb) set solib-absolute-prefix /home/user1/aarch64-crossbuild-gcc4.9.1/sysroot

(gdb) file ./adds2-output
Reading symbols from ./adds2-output...done.

(gdb) target remote localhost:1234
Remote debugging using localhost:1234
Reading symbols from
/home/user1/aarch64-crossbuild-gcc4.9.1/sysroot/lib/ld-linux-aarch64.so.1...done.
Loaded symbols for
/home/user1/aarch64-crossbuild-gcc4.9.1/sysroot/lib/ld-linux-aarch64.so.1
0x0000000040000000 in _start ()
from /home/user1/aarch64-crossbuild-gcc4.9.1/sysroot/lib/ld-linux-aarch64.so.1

(gdb) b adds2.c:92
Breakpoint 1 at 0x400700: file adds2.c, line 91.

(gdb) info registers
x0 0x0 0
x1 0x0 0
........x2..x29...are set to 0
x30 0x0 0
sp 0x0 0x0
pc 0x40000000 0x40000000 <_start>
cpsr 0x400003c5 1073742789
fpsr 0x0 0
fpcr 0x0 0

(gdb) c
Continuing.

After waiting for ~approx 20 mins, I pressed <ctrl+c>
^C
Program received signal SIGINT, Interrupt.
0xffffffc000092a88 in ?? ()

In case, if more info is needed, I will be happy to provide it.


Thanks & Best Regards,
Raghunath Lolur.

Loading...