Menu

bochs + GDB help

Help
Anonymous
2010-04-29
2012-10-15
  • Anonymous

    Anonymous - 2010-04-29

    I'm trying to debug a kernel using bochs (2.4.5) + gdb (7.0.1).

    As soon as I connect, I am not at the reset vector as I expect, and pretty
    much
    all gdb commands don't do anything useful except continue.

    I get that breakpoints won't work because my code isn't loaded yet, but
    hardware breakpoints should work. I can't even do anything when I connect.

    Am I doing something wrong? I can provide more info if this isn't something
    obvious

    (gdb) target remote localhost:1234
    Remote debugging using localhost:1234
    0x00000000 in ?? ()
    (gdb) si
    0x00000000 in ?? ()
    (gdb) si
    0x00000000 in ?? ()
    (gdb) si
    0x00000000 in ?? ()
    (gdb) hbreak *0x7c00
    Hardware assisted breakpoint 1 at 0x7c00
    (gdb) c
    Continuing.

    Program received signal SIGTRAP, Trace/breakpoint trap.
    0x000e0000 in ?? ()
    (gdb) si
    0x000e0000 in ?? ()
    (gdb) info reg
    eax 0xaa55 43605
    ecx 0x0 0
    edx 0x0 0
    ebx 0x0 0
    esp 0x0 0x0
    ebp 0x0 0x0
    esi 0x80 128
    edi 0x0 0
    eip 0xe0000 0xe0000
    eflags 0x0
    cs 0xffac 65452
    ss 0x0 0
    ds 0x0 0
    es 0x0 0
    fs 0xffd6 65494
    gs 0x0 0
    (gdb)

     
  • Anonymous

    Anonymous - 2010-05-08

    I've done some more digging and I think I understand the problem (or at least
    part of it). I'm just not sure how to fix it and would love some ideas.

    I have my bochs configured for 64bit, but I am debugging from a 32bit
    machine/GDB. When GDB sends the 'g' remote command, it appears to be expecting
    32 bit registers in the return packet.

    As an example, below demonstrates the connection - adding some prints into
    bochs, it seems that rdx is actually 0xf20.

    (gdb) set arch i386:x86-64
    warning: A handler for the OS ABI "GNU/Linux" is not built into this
    configuration
    of GDB. Attempting to continue with the default i386:x86-64 settings.

    The target architecture is assumed to be i386:x86-64
    (gdb) target remote localhost:1234
    Remote debugging using localhost:1234
    0x00000000 in ?? ()
    (gdb) info reg
    eax 0x0 //RAX
    ecx 0x0 //RAX
    edx 0x0 //???
    ebx 0x0 //???
    esp 0x0 //???
    ebp 0x0 //???
    esi 0xf20 //RDX
    edi 0x0 //RDX
    eip 0x0 //???
    eflags 0x0 //???
    cs 0x0 //???
    ss 0x0 //???
    ds 0x0 //???
    es 0x0 //???
    fs 0x0 //???
    gs 0x0 //???

     
  • Anonymous

    Anonymous - 2010-05-09

    I resolved this by using cross-debug build of gdb. I consider this to have
    been an issue with gdb 7.0 and 7.1.

     

Log in to post a comment.