[OpenBIOS] Ppc guest debugging?

Jd Lyons lyons_dj at yahoo.com
Sat Oct 13 12:45:24 CEST 2018



> On Oct 12, 2018, at 6:43 PM, Programmingkid <programmingkidx at gmail.com> wrote:
> 
>> 
>> On Oct 12, 2018, at 7:02 AM, Jd Lyons <lyons_dj at yahoo.com> wrote:
>> 
>> 
>> 
>>> On Oct 11, 2018, at 12:57 PM, Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk> wrote:
>>> 
>>> On 11/10/2018 12:12, Jd Lyons via OpenBIOS wrote:
>>> 
>>>>>>> I installed gdb-multiarch and started qemu with:
>>>>>>> 
>>>>>>> Qemu-system-ppc -s -S
>>>>>>> 
>>>>>>> The launched gdb-multiarch and connected  to port 1234.
>>>>>>> 
>>>>>>> Is this the correct toolchain for debugging PPC code on an X86 host, or do I need to do something else?
>>> 
>>> I actually build gdb from source for the architectures I need (sparc32, sparc64 and
>>> ppc), so I can't really comment on how multi-arch works.
>> 
>> Can I build gdb for debugging ppc code on x86?
>> 
>> Any instructions on how to do that?
>> 
>> Or should I be using a PPC host for this?
> 
> Mac OS X running in qemu-system-ppc should work just as well as a real PowerPC Mac would. It would probably mean running two instances of qemu-system-ppc on your host. 
> 
> 
> -- 
> OpenBIOS                 http://openbios.org/
> Mailinglist:  http://lists.openbios.org/mailman/listinfo
> Free your System - May the Forth be with you

I just didn’t know if powerpc-linux-gdb would run to debug a running ppc target in qemu on an x86 host, but I figured it out, seems to run fine.

For reference, he’s how to build gdb on an x86 host for debugging powerpc code:




To build gdb-powerpc-linux on Linux, you'll need normal build tools such as gcc installed, I'll assume people know how to install that stuff with apt or their other package manager. Anything you don't have you need installed to build, it will likely let you know when you try to configure.

Download the GDB source code, I had trouble with the latest release, so likely people will want to use v7.9.

http://ftp.gnu.org/gnu/gdb/gdb-7.9.tar.gz

Unpack it and cd into the dir, then just:

./configure -target=powerpc-linux --enable-sim-powerpc
make && sudo make install

After that, all you need to do is launch qemu-system-ppc(64) with -s and -S, it will pause and listen on port 1234 for GDB.

Then in another terminal launch gdb:

gdb-powerpc-linux
target remote localhost:1234
continue

You'll likely want to set prom-env "auto-boot?=false" --nographic for Qemu.

Set your breakpoint in GDB, I.E.

break *0x20dccc


Then type boot in the Qemu terminal.



More information about the OpenBIOS mailing list