qemu-x86_64: debugging after relocation: breakpoints not working

Matwey V. Kornilov matwey.kornilov at gmail.com
Sun Aug 1 19:41:37 CEST 2021


вс, 1 авг. 2021 г. в 18:49, Matwey V. Kornilov <matwey.kornilov at gmail.com>:
>
> Hi,
>
> I failed to find the correct answer in this list. I am trying to debug
> u-boot from the master running inside of QEMU 5.2.0:
>
> I start QEMU as the following:
>
> > qemu-system-x86_64 -bios u-boot.rom -serial stdio -hda sda -net none -S -s
>
> And then attach to it using gdb 10.1:
>
> > target remote 127.0.0.1:1234
> > add-symbol-file /build/u-boot 0x06f49000

I figured out that the 0x06f49f78 offset works fine, breakpoints work fine now.
But how should I figure out this 0xf78 in advance?

> > break board_init_r
> > info break
> Num     Type           Disp Enb Address            What
> 1       breakpoint     keep y   0x0000000006f5adfa in board_init_r at
> /home/matwey/lab/u-boot/common/board_r.c:807
> > cont
>
> U-boot is running, however the breakpoint has never been triggered. I
> also tried to use hardware assisted break instead of regular.
> Breaking before the relocation works fine, so I suppose I am doing
> something wrong with relocation addresses.
>
> Address 0x06f49000 is taken from `bdinfo` output:
>
> => bdinfo
> boot_params = 0x0000000000000000
> DRAM bank   = 0x0000000000000000
> -> start    = 0x0000000000000000
> -> size     = 0x0000000008000000
> flashstart  = 0x0000000000000000
> flashsize   = 0x0000000000000000
> flashoffset = 0x0000000000000000
> baudrate    = 115200 bps
> relocaddr   = 0x0000000006f49000
> reloc off   = 0x0000000005e39000
> Build       = 64-bit
> current eth = unknown
> ethaddr     = (not set)
> IP addr     = <NULL>
> fdt_blob    = 0x0000000006d07e30
> new_fdt     = 0x0000000006d07e30
> fdt_size    = 0x0000000000000bc0
> Video       = vesa_video inactive
> lmb_dump_all:
>  memory.cnt  = 0x1
>  memory[0]      [0x0-0x7ffffff], 0x08000000 bytes flags: 0
>  reserved.cnt  = 0x0
>
> Could somebody please point out to me what I do wrong? Thank you in advance.
>
>
> --
> With best regards,
> Matwey V. Kornilov



-- 
With best regards,
Matwey V. Kornilov


More information about the U-Boot mailing list