#14 Missing breakpoint support. Debugging THUMB code.

open
nobody
None
5
2005-08-19
2005-08-19
Richard Quirk
No

It is not possible to place a breakpoint from with a
debugger and have VisualBoy Advance stop on it. The old
configure.in set the compile flag BKPT_SUPPORT to
compile in this functionality. This flag is missing
from the current configure.in and breakpoint support is
not included.

This patch adds the support for breakpoints when the
--enable-dev flag is passed to configure.

In addition, the embedded application protocol
interface changed for thumb code in a recent version of
GCC. The patch for this, to debugger.cpp, allows thumb
code to be correctly identified when breakpoints are
set on it. Note that this is only for the VBA internal
debugger. GNU GDB and Insight behaviour are not
changed. Code compiled with older compilers and the old
EABI are not affected and continue to work as before.
(tested with devkitARM r8 to r15)

Thanks must go to ribrdb2 on forums.gbadev.org for the
information required to put this patch together.

Discussion

  • Richard Quirk
    Richard Quirk
    2005-08-19

    Patch to add breakpoint support. Updated EABI for built in debugger

     
    Attachments
  • Richard Quirk
    Richard Quirk
    2005-08-19

    Logged In: YES
    user_id=1244226

    I should say that the patch has been made against the CVS
    code. You should do the following from within the top level
    VisualBoyAdvance directory to apply it cleanly:

    patch < debugging.patch
    aclocal && autoconf && automake -a -c
    make clean all

     
  • Dave Murphy
    Dave Murphy
    2005-09-27

    Logged In: YES
    user_id=975053

    It might be better to do this as the symbols are being
    loaded. This way the symbols command lists the proper
    markings for arm and thumb code.

     
  • Dave Murphy
    Dave Murphy
    2005-09-27

    Logged In: YES
    user_id=975053

    can't see a way to add another attachment atm so here's a
    patch that converts symbol types as they're loaded. This
    also gets rid of a couple of warnings about signed/unsigned
    comparisons in debugger.cpp.

    Index: configure.in

    RCS file: /cvsroot/vba/VisualBoyAdvance/configure.in,v
    retrieving revision 1.26
    diff -u -r1.26 configure.in
    --- configure.in 20 Dec 2004 15:02:43 -0000 1.26
    +++ configure.in 26 Sep 2005 08:24:56 -0000
    @@ -155,7 +155,7 @@
    fi

    if test "x$enable_dev" = xyes; then
    - CXXFLAGS="$CXXFLAGS -DDEV_VERSION"
    + CXXFLAGS="$CXXFLAGS -DDEV_VERSION -DBKPT_SUPPORT"
    fi

    if test "x$enable_sdl" != xyes && test "x$enable_gtk" !=
    xyes; then
    Index: src/elf.cpp
    ===================================================================
    RCS file: /cvsroot/vba/VisualBoyAdvance/src/elf.cpp,v
    retrieving revision 1.19
    diff -u -r1.19 elf.cpp
    --- src/elf.cpp 13 Oct 2004 21:07:03 -0000 1.19
    +++ src/elf.cpp 26 Sep 2005 08:41:52 -0000
    @@ -2607,8 +2607,13 @@
    Symbol *sym = &elfSymbols[elfSymbolsCount];
    sym->name = &strtable[READ32LE(&s->name)];
    sym->binding = binding;
    - sym->type = type;
    - sym->value = READ32LE(&s->value);
    + sym->type = type;
    + sym->value = READ32LE(&s->value);
    +
    + if (sym->value & 1) {
    + sym->value &= ~1;
    + sym->type = 0x0d;
    + }
    sym->size = READ32LE(&s->size);
    elfSymbolsCount++;
    }
    @@ -2624,6 +2629,10 @@
    sym->binding = (s->info >> 4);
    sym->type = type;
    sym->value = READ32LE(&s->value);
    + if (sym->value &1) {
    + sym->value &= ~1;
    + sym->type = 0x0d;
    + }
    sym->size = READ32LE(&s->size);
    elfSymbolsCount++;
    }
    Index: src/sdl/debugger.cpp
    ===================================================================
    RCS file: /cvsroot/vba/VisualBoyAdvance/src/sdl/debugger.cpp,v
    retrieving revision 1.7
    diff -u -r1.7 debugger.cpp
    --- src/sdl/debugger.cpp 25 Jun 2005 06:17:52 -0000 1.7
    +++ src/sdl/debugger.cpp 26 Sep 2005 08:30:35 -0000
    @@ -1066,7 +1066,7 @@
    {
    address &= 0x3ffff;
    final &= 0x3ffff;
    - for(int i = address; i < final; i++)
    + for(unsigned int i = address; i < final; i++)
    if(freezeWorkRAM[i] == 1)
    freezeWorkRAM[i] = 0;
    printf("Cleared break on write from %08x to %08x\n",
    @@ -1077,7 +1077,7 @@
    {
    address &= 0x7fff;
    final &= 0x7fff;
    - for(int i = address; i < final; i++)
    + for(unsigned int i = address; i < final; i++)
    if(freezeInternalRAM[i] == 1)
    freezeInternalRAM[i] = 0;
    printf("Cleared break on write from %08x to %08x\n",
    @@ -1166,7 +1166,7 @@
    {
    address &= 0x3ffff;
    final &= 0x3ffff;
    - for(int i = address; i < final; i++)
    + for(unsigned int i = address; i < final; i++)
    if(freezeWorkRAM[i] == 2)
    freezeWorkRAM[i] = 0;
    printf("Cleared break on change from %08x to %08x\n",
    @@ -1177,7 +1177,7 @@
    {
    address &= 0x7fff;
    final &= 0x7fff;
    - for(int i = address; i < final; i++)
    + for(unsigned int i = address; i < final; i++)
    if(freezeInternalRAM[i] == 2)
    freezeInternalRAM[i] = 0;
    printf("Cleared break on change from %08x to %08x\n",