Debug qemu with gdb

2020-06-19 05:56发布

问题:

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

回答1:

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.



回答2:

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.