Setting up the system
1. Install gdbstub.sis
on your phone.
This file is installed by default by the Nokia SDK in the following directory:
C:\Symbian\6.1\Series60\Epoc32\Release\armi\urel\
2. Still on the phone, start FExplorer or your favorite file manager application and create a directory c:\gdbstub. Upload a gdbstub.ini file with the following contents in the created directory :
[COMMSERV]
PDD=EUART%d
LDD=ECOMM
CSY=IRCOMM
PORT=0
RATE=115200
3. On your PC, create some directory c:\yyy and put the c:\yyy\gdb.ini in it with the following contents:
symbol-file //c/symbian/6.1/series60/epoc32/release/armi/udeb/xxx.sym
epoc-exec-file c:\system\apps\xxx\xxx.app
target epoc com2
break NewApplication
source //c/symbian/6.1/shared/epoc32/gcc/share/epoc-des.ini
Replace xxx and yyy with the appropriate values. Replace com2 with your IrDA’s com port. You may need to install some IrDA to COM mapper on your win32 machine
(e.g. IrCOMM2k by Jan Kiszka).
Compilation
The application to debug shall be built using armi udeb target:
abld build armi udeb
If the linker fails because it cannot find libs for udeb (this will be probably the case at your first try), just copy everything from epoc32/release/armi/urel to epoc32/release/armi/udeb.
Pacakge and install the appliction on the phone.
Launching the debugger
Start FExplorer and run c:\system\programs\gdbstub.exe. The IrDA indicator should blink now. Note that you don’t need to use connection/IrDA/activate prior to this, because the gdbstub will open itself the IrDA connection.
Put your phone and your PC IrDA adapter in sight. Then, from your PC, open the a DOS shell, move to c:\yyy and run
gdb.exe -nw
The following message should appear:
GNU gdb 4.17-psion-98r2
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This version of GDB has been modified by Symbian Ltd. to add EPOC support.
Type "show epoc-version" to see the EPOC-specific version number.
This GDB was configured as "--host=i686-pc-cygwin32 --target=arm-epoc-pe".
Breakpoint 1 at 0x(some adress): file <your source file that contains
NewApplication>
(gdb) *prompt*
The IrDA connection shall be established (the phone IrDA icon shall not blink anymore and be persisently
visible now).
Enter "run" on the (gdb) prompt. The following should appear:
Starting program:
warning: Application started but no document specified.
The application may panic at some point if it is document based and if there is no existing default document.
Breakpoint 1 0x(some adress): file <your source file that contains
NewApplication>
Breakpoint 1, NewApplication ()
at file <your source file that contains NewApplication>
<some sourcecode>
Current language: auto; currently c++
If your gdb writes "Starting program:", but nothing happens within a second, you’ve failed! I’ve got this sometimes and I just restart my phone (and
sometimes my PC) to get rid of it. If this doesn’t help, then you have to check that your IrDA stuff works [1]
That’s it! Now you can run, step or whatever...
Open questions
How to catch panics at the place they occur?
How to set breakpoints in other threads than the main one?
[1] Start "PC Suite". Right click on the
"connector"-symbol on the tray; properties; check-on your IrDA-COM. Restart
your phone in case you did execute gdbstub to get a clean phone.On your
phone connection/IrDA/activate and point to your win32. Now "connected" or something similar should appear. If this is fine be sure that you uncheck IrDA-COM and restart your phone before trying to gdb again!!!
|