[Qemu-discuss] Unable to debug 2.5.0 qemu-system-ppc64.exe with gdb
From:
trasmussen
Subject:
[Qemu-discuss] Unable to debug 2.5.0 qemu-system-ppc64.exe with gdb
Date:
Fri, 8 Apr 2016 13:50:44 +0200
In order to find out where certain QEMU
functions are called from, using test output is not practical.
Therefore I set out to use gdb to debug
qemu-system-ppc64.exe (the unstripped version):
gdb /cygdrive/c/MinGW/msys/1.0/local/qemu/qemu-system-ppc64
b pci_host_config_write_common
gdb responds with:
Breakpoint 1 at 0x6ecd79: file C:/MinGW/msys/1.0/gnu_dev/qemu-2.5.0/hw/pci/pci_host.c,
line 54.
Next I issue an r-command with the same
options as I need to use:
and everything happens as usually, except
I have not achieved the goal of hitting any breakpoints.
Upon closer examination it appears that
the qemu-system-ppc64.exe that is linked to 0x400000 and up as any other
Windows application, in fact has been moved up higher in the address space
a number of pages, but not always the same number. I have seen 0xb600000
be the bias, and also 0x4c0000 and others. I found out by letting one of
my test output lines print the current EIP-value, as well as the (linked)
address of the function this happens inside. The 2 values were close to
each other as expected, and both were biased.
I must assume that the move of the qemu-system-ppc64.exe
sections means that this executable contains fixup relocations like what
the objdump tool reports:
/cygdrive/c/MinGW/msys/1.0/local/qemu/qemu-system-ppc64.exe:
file format pei-i386
Is there a way to have this work?
Is it important that relocation takes
place, or could it be fixed in the virtual address space as its usual 0x400000
location?
I noticed the building of QEMU has -fPIC
at least for compilation of at least some files, but also --static.
Though I am only building this particular
qemu-system-ppc64 variant, it still takes me almost an hour to experiment
with other compile and link options.