Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug qemu with gdb

How can I use gdb to debug qemu? I have been googling but couldn't find anything concrete.

like image 665
renjith Avatar asked Jan 14 '11 08:01

renjith


People also ask

How to use QEMU GDB?

In order to use gdb, launch QEMU with the -s and -S options. The -s option will make QEMU listen for an incoming connection from gdb on TCP port 1234, and -S will make QEMU not start the guest until you tell it to from gdb.

How do I debug with QEMU?

Download and install QEMU on Windows. Configure a target QEMU Virtual Windows Image to launch with the required network and BIOS/UEFI settings for debugging. Start the QEMU environment, using the configured launch script. Start the gdbserver on QEMU.

Can LLDB connect to Gdbserver?

The environment can be prepared further using the platform shell command. When using the “remote-android” platform, the client LLDB forwards two ports, one for connecting to the platform, and another for connecting to the gdbserver.

What is GDB Multiarch?

gdb-multiarch. GDB is a source-level debugger, capable of breaking programs at any specific line, displaying variable values, and determining where errors occurred. Currently, gdb supports C, C++, D, Objective-C, Fortran, Java, OpenCL C, Pascal, assembly, Modula-2, Go, and Ada. A must-have for any serious programmer.


2 Answers

I got an error with GDB 7.5 -> "Error accessing memory address"

It seems there is a problem with "Position Independet Executables" ...so use

./configure --enable-debug --disable-pie

and debug should work.

like image 149
Max Mustermann Avatar answered Nov 15 '22 07:11

Max Mustermann


Try the following:

./configure --enable-debug

By default qemu builds with "CFLAGS = -O2 -g" option which somehow doesn't allow debug symbols to be added. Using --enable-debug option will mean -O2 will not be added.

like image 24
Sukanto Avatar answered Nov 15 '22 08:11

Sukanto