This is a quick'n'dirty HowTo for cross-debugging on your iPAQ/Zaurus: Requirements: ------------- 1) You need the same binary of the program being debugged on the handheld and on the desktop machine. 2) The binary for the handheld can be stripped (!!) 3) The binary for the desktop must have been compiled with -g 3) The same applies to shared libraries (but this is only needed if you want to step into libraries or if you want the backtrace to show the right function names for libraries) Setup: ------ 1) install the gdbserver.ipk on the handheld. 2) put the arm-linux-gdb binary somewhere in your $PATH (I would suggest /opt/Embedix/tools/arm-linux/bin) 3) copy the sample.arm-gdbinit to your $HOME directory and rename it to .arm-gdbinit 4) edit ~/.arm-gdbinit: "solib-search-path" is the path, where gdb searches for shared libraries "rtX" are some aliases to speed up debugging -- you can rename them, or remove them (see below for the "target ... " syntax) Sample session: debugging the launcher -------------------------------------- 1) Login on the handheld, kill Opie and execute: # gdbserver foo:2345 /opt/QtPalmtop/bin/qpe This starts the program qpe in debug mode, and the gdbserver stub now listens on port 2345 for an incoming connection from the real gdb. (foo should be name of the desktop machine, but it is ignored) 2) On the desktop, change to the $OPIEDIR containing the arm binaries # cd $OPIEDIR # cd core/launcher # arm-linux-gdb ../../bin/qpe or # ddd --debugger arm-linux-gdb ../../bin/qpe 3) You should get an "(arm-gdb)" prompt. Now do (arm-gdb) target remote zaurus:2345 You have to change zaurus to the hostname or ip-address of your handheld. This should produce: Remote debugging using zaurus:2345 0x40002a80 in ?? () (arm-gdb) break main (arm-gdb) cont And gdb should stop in 'main'. If gdb complains about unknown symbol 'main', you forgot to compile the application in debug mode. This is where the rtFOO macros come in handy: just type rtX and you are connected to machine BAR. 4) You can debug/step your application, as you would with a native gdb from here on. Please note that single stepping in a cross-debugger can be VERY SLOW sometimes !! Robert 'sandman' Griebl, 17.11.2002