Author Topic: Cross-debugging applications on the Dingoo...  (Read 4512 times)

Elta (OP)

  • Posts: 21
Cross-debugging applications on the Dingoo...
« on: December 17, 2009, 05:26:29 am »
There are times when a simple 'printf' is not enough to debug an application :(
Fortunately for us, Booboo included all the necessary tools in the toolchain and rootfs.
We just had to figure how to use them :)

For this I use KDbg (ubuntu package: KDbg) as I'm not fond of using the command line GDB :P

For this I'm going to assume 2 things:
  • Toolchain installed in /opt/mipsel-linux-uclibc
  • Application in /usr/local/apps/myapp

It works like this, basically:
KDbg ----> mipsel-linux-gdb ----- TCP/IP port 2222----> gdbserver ----> myapp

Start KDbg and go to Settings -> Global options. 'How to invoke GDB' should look like:
gdb --fullname --nx
Change it to:
/opt/mipsel-linux-uclibc/usr/bin/mipsel-linux-gdb --fullname --nx
To interface KDbg with the MIPS version of KDbg included with the toolchain.

We add a menu entry to DMenu to start gdbserver on the dingoo :
MenuItem MyAppDebug
Icon = "res/apps.png"
Name = " MyApp (Debug)"
Executable = "gdbserver ./myapp"
WorkDir = "/usr/local/apps/myapp"

  • Compile your application in debug mode.
    This usually mean:
    • Adding the '-g' option.
    • Disabling optimizations '-O0'.
    • Removing '-fomit-frame-pointer' as it interferes with debugging.
    • Not stripping the resulting executable. (No '-s' in the LDFLAGS).
  • Transfer the executable to the Dingoo. (See here:
  • Start gdbserver from DMenu. You should see something like this on the Dingoo :
    Process ./myapp created; pid = <number>
    Listening on port 2222
  • Start KDbg, telling it to connect to gdbserver:
    kdbg -r myapp
    You will see something like this on the Dingoo:
    Remote debugging from host
  • Last step: Load the source code! File->Open source or CTRL+O.
    You can now set breakpoints, execute the code step by step and look at all the variables.
    Try not to step into library functions (like SDL_*) hangs the debugger for me. :(

Sample debug compiled app for lazy people : :)