qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Gdb support for Debugging Arm M profile with Xilinx Qemu


From: sanjana gogte
Subject: Gdb support for Debugging Arm M profile with Xilinx Qemu
Date: Thu, 28 Mar 2024 15:28:12 +0530


Greetings,

I am currently engaged in a project that involves emulating the LM3S811EVB ( M3 Core ) board using Xilinx QEMU (version 7.1.0) . While the emulation process is successful, I am encountering difficulties in attaching GNU Debugger (GDB) or GDB-multiarch to the ELF file being executed on the emulated board. Interestingly, this issue does not arise when utilizing the standard QEMU (version 8.1.5), where I am able to attach GDB and step through the ELF file without any hindrances.


To address this issue, I have experimented with different versions of GDB, specifically:

GNU gdb (Arm GNU Toolchain 13.2.rel1 (Build arm-13.7)) ( arm-none-eabi)
GNU gdb (Linaro_GDB-2019.12) 8.3.1.20191204-git
Error I am facing :
Remote debugging using localhost:1234
Remote 'g' packet reply is too long (expected 68 bytes, got 92 bytes): 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028100020ffffffff0800000000000041000000000000000000000000000000000000000000000000
(gdb) b main
Breakpoint 1 at 0xc6: file main2.c, line 69.
(gdb) continue
The program is not being run.
(gdb) run
Don't know how to run. Try "help target".

With Gdb-multiarch (12.1)
gef➤ set architecture armv7
The target architecture is set to "armv7".
gef➤ target remote:1234
Remote debugging using :1234
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
Remote 'g' packet reply is too long (expected 68 bytes, got 92 bytes): 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028100020ffffffff0800000000000041000000000000000000000000000000000000000000000000
gef➤ file kernel2.elf
Reading symbols from kernel2.elf...
gef➤ b main
Breakpoint 1 at 0xc6: file main2.c, line 69.
gef➤ continue
The program is not being run.
gef➤ run
Starting program: /mnt/c/Users/Gogte/Desktop/sanjana_intern_project/Qemu_test/test3/LinkerM3/kernel2.elf
/bin/bash: line 1: /mnt/c/Users/Gogte/Desktop/sanjana_intern_project/Qemu_test/test3/LinkerM3/kernel2.elf: cannot execute binary file: Exec format error
/bin/bash: line 1: /mnt/c/Users/Gogte/Desktop/sanjana_intern_project/Qemu_test/test3/LinkerM3/kernel2.elf: Success
During startup program exited with code 126.

If I do the same with Standard qemu binary the gdb works:
Remote debugging using localhost:1234
start () at startup.s:10
--Type <RET> for more, q to quit, c to continue without paging--c
10 ldr r1, =main
(gdb) b main
Breakpoint 1 at 0xc6: file main2.c, line 69.
(gdb) continue
Continuing.

Breakpoint 1, main () at main2.c:69
69 uart_print("Inside main function");
(gdb)


My project necessitates the use of the Xilinx QEMU binary, specifically to leverage the remote port functionality it offers.

Therefore, I am seeking guidance on which version of GDB should be used, or any specific configurations that might enable successful GDB attachment to the ELF file running on Xilinx QEMU.


Regards,
Sanjana





reply via email to

[Prev in Thread] Current Thread [Next in Thread]