[OpenBIOS] static and global variable problem

Programmingkid programmingkidx at gmail.com
Fri Dec 21 15:45:12 CET 2012


On Dec 21, 2012, at 8:14 AM, Mark Cave-Ayland wrote:

> On 21/12/12 13:09, Programmingkid wrote:
> 
>>> No, you've got this the wrong way around. The default CFLAGS for OpenBIOS uses -Os which causes heavy optimisation and confuses gdb causing it to give incorrect output. So if you want to use gdb to debug OpenBIOS, you need to rebuild it with -O0 and use the generated .nostrip unstripped binary.
>> 
>> I have done that and the problem is still there.
> 
> Okay - did you make sure you did a complete rebuild so the flags got picked up by the C compiler?
> 
> rm -rf obj-ppc
> vi Makefile.target
> (change -Os to -O0)
> ./config/scripts/switch-arch ppc
> make
> 
> If you're sure, post a message with detailed instructions to the list so that others can try and reproduce what you are seeing.
> 

How to reproduce the problem:
1. Start QEMU for debugging: qemu-system-ppc -m 128 -bios openbios-qemu.elf.nostrip -cdrom darwin8.iso -s -S

2. Start up gdb to read the firmware file: powerpc-linux-gdb openbios-qemu.elf.nostrip

3. Connect to QEMU using this command inside gdb: target remote localhost:1234

4. Set a breakpoint at this place: b ofmem.c:414

5. Have OpenBIOS start the boot process by entering this in QEMU: boot cd:,\\:tbxi

6. When the breakpoint in tripped, type this in gdb: print &next_grab_slot. 

next_grab_slot will have an address that isn't available to QEMU. The value I see is 0xfffda060. QEMU would have to have over 4 GB of ram in order to access this address. 





More information about the OpenBIOS mailing list