Recent

Author Topic: Help on how to use WinCE debuger  (Read 35396 times)

epergola

  • Full Member
  • ***
  • Posts: 157
Help on how to use WinCE debuger
« on: July 17, 2009, 01:16:17 am »
Hi
Of course, yes I have read the wicki.
Luckly for me, I have a WM 6.1 up and running since some time.
The shared folder is C:\EMULATORS
When I build a prokject in Lazarus I simply do
xcopy c:\lazarus\my.exe c:\emulaotrs, and run it (on the (cradled emulator).
Now I want to use a debugger, becaus Access Viol and other errors
(on WinCE but not on the Win32 version) do not help me much.
So I read on wichi
"Copy that file with File Explorer program in your emulator to \gdb directory.If it is your first time running emulator you have to create a gdb directory in 'My Pocket PC' folder which is your root(\) folder.(To make things even faster for your each build,with file explorer go to your shared folder,press ctrl+c in your exe file,go to \gdb folder and each time before you try to debug your application just press ctrl+v) "
Beside the fact that 'that file' is quite a guess (which file?), I cannot use the ctrl+v method since my forms ar full screen and hide everything else, once the apps tarts.
So i created c:\emulators\gdb\
In it i put :  arm-wince-pe-stub.exe
                 test.exe  (my WINCE program )
                 gdb.exe 
In Lazarus I have Debugger Options:
                  C:\emulators\gdb\gdb.exe
whe ni try
   gdb --tui test.exe
I get a No Source Avalaibe error.
Could someone help explaining the steps and the commands I should run to use debugger, given the setup I have shown above?
Also, I have NO IDEA of how the gdb console would interact with
the emulator. gdb seems to be a DOS window, so what will I do? run the emulator GUI program or what else?  or wouldthe debugger be in the background and when I get an error in the emulator, i can check where (and what ) happened? If so, how ton synchronize the launching of the program in the emulator with the lanching of the
gdb?
I would really appreciate some help, as I am lost in the woods.


epergola

  • Full Member
  • ***
  • Posts: 157
I think I solved it..and if true this may help others
« Reply #1 on: July 17, 2009, 05:11:33 am »
ok
It looks as if I am out of the woods (well... of this wood).
I post this to help others newbies (to lazarus, not to programming).
Hope actual examples and brevity help more than lengthy if/where/depending explanation.
I have this setup
1. The emulator is cradled and works: uses activesync to connect
    Mine is a WM 6.1 classic
    In File -> Configure -> Share Folders i have:
                C:\EMULATORS\GDB
2. In   C:\EMULATORS\GDB I have
           arm-wince-pe-stub.exe
           gdb.exe
    I unzipped them directly from my desktop to C:\EMULATORS\GDB
   (from the zip file downloaded from ftp://ftp.freepascal.org/pub/fpc
/contrib/cross/gdb-6.4-win32-arm-wince.zip)
3. In my Lazarus project  (C:\LAZARUS\CF\TEST.LPR) I set
    Environment -> Options -> Debugger -> General
    C:\emulators\gdb\gdb.exe (second line below 'Debugger type and
    path')
4. I do Build All, then Run (from the Lazarus IDE), and the program
    runs (well.. until it crashes, BUT for some error in MY code)
    in the cradled and runnig emulator.
If some (real) expert sees something wrong in this, please advice.
In either case  I hope others may benefit


lyh1

  • New Member
  • *
  • Posts: 19
Re: Help on how to use WinCE debuger
« Reply #2 on: July 23, 2009, 06:11:54 pm »
To Debug your project, put GDB Debugger(arm-wince-pe-stub.exe and    gdb.exe) along with your source code.

Run "gdb --tui YourExec.exe" in your project directory(I prefer run it in a bat file) then a console come up and show your project source.

you can type some command in the GDB command pormpt.
Connect your wm device to ActiveSync then type "r" in console, gdb will start upload the execute and execute.

you will need to set break point before run, use "br unit.pas:LineNumber".

use "p" to check variables.

Here is online document of gdb that can help you.
http://sourceware.org/gdb/current/onlinedocs/gdb_10.html#SEC66

If someone that can integrate the debug process in IDE, it will more attractive to mobile developer. >:D

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Help on how to use WinCE debuger
« Reply #3 on: August 16, 2009, 11:58:34 pm »
The wince interface can be compiled for desktop windows (just dont set the target OS and target architecture in the Configure build lazarus dialog and your compiler options dialog, but select the wince interface). This way you can debug your apps in the desktop, which is quicker.

It's not 100% the same as running on the PDA, but it can be very useful if you debuging programming logic or something else which doesnt matter the platform. I implemented this to speed up debugging the wince interface for those bugs which are reproducible in the desktop version of wince interface. So far it helped me a lot

abrito

  • Jr. Member
  • **
  • Posts: 69
Re: Help on how to use WinCE debuger
« Reply #4 on: August 28, 2009, 01:51:20 pm »
I debug from Lazarus IDE with windows emulator, no problem eith that.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2615
Re: Help on how to use WinCE debuger
« Reply #5 on: August 28, 2009, 08:26:37 pm »
For others reading this thread, the following (running gdb --tui) is not needed, having arm-wince-pe-stub.exe and gdb.exe in the same dir and gdb.exe as debugger in lazarus is enough.

To Debug your project, put GDB Debugger(arm-wince-pe-stub.exe and    gdb.exe) along with your source code.

Run "gdb --tui YourExec.exe" in your project directory(I prefer run it in a bat file) then a console come up and show your project source.
.
.
.
If someone that can integrate the debug process in IDE, it will more attractive to mobile developer. >:D
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Help on how to use WinCE debuger
« Reply #6 on: October 20, 2009, 04:48:33 pm »
Another debugging solution is creating a log file in the same dir as the executable. This can be done with:

Code: [Select]
uses LCLProc, SysUtils;

DbgAppendToFile(ExtractFilePath(ParamStr(0)) + '1.log', 'My log message');

It substitutes WriteLn style of debugging.

 

TinyPortal © 2005-2018