Lazarus

Installation => PDAs and Smartphones => Topic started by: Al Berto on January 27, 2010, 01:33:55 pm

Title: Lazarus+FPC application bad crash on WinCE
Post by: Al Berto on January 27, 2010, 01:33:55 pm
Hi all,
my name is Alberto, I'm a programmer from Italy.

I've developed a telephone client application for WinCE using Lazarus(0.9.28.2)+FPC(2.2.4-2.4.0)+KOL/MCK(2.80.3-2.88)
Everything is working good with the beautiful KOL components but... sometimes application crash with SIGILL (using gdb).
No problem with WinCE emulator (Windows Mobile 6 PRO version 5.2.1235, Windows Mobile 6.1 PRO version 5.2.20757)

So I create a smaller program to reproduce it (KOLtest).

I'm testing it on a ASUS P552w Windows Mobile 6.1 PRO version 5.2.19965.
The small KOLtest is a form with a button and an edit box.
Run it thru gdb or directly, it's the same.
1- Click on the KOLtest button
2- click on the network icon, toggle WIFI, exit
3- goto 1
after toggling WIFI on/off  for four-five times, the application crash with no errors, after a little O.S. hanging it just disappear, on gdb I have SIGILL or SIGSEGV at different point.

I tried with FPC 2.2.4 or 2.4.0, KOL/MCK 2.80.3 or SVN trunk 2.88.
Could it be a bug on FPC compiler or KOL/MCK?
I don't know how to fix it...

Any help would be really appreciated, I'm getting (quite) mad about it!
Many thanks
bye

Alberto
Title: Re: App crash using Lazarus+KOL-CE
Post by: Al Berto on January 28, 2010, 05:47:16 pm
Hi all

I did a simple WinCE application, just an empty form, no KOL-CE.

If I launch on my PDA (Asus P552w), then go to Network icon and toggle WIFI, my application crashes with SIGILL.

On compiler options, Widget is Wince, OS is Wince, processor is Arm.
Lazarus 0.9.28.2beta, FPC 2.2.4

I think I misconfigured the compiler or something else, don't know what, it's just a simple new project...

Any ideas?

bye
Alberto
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Al Berto on February 04, 2010, 11:55:20 am
Hi all,

this bad crash on a simple empty form application is not acceptable for me...
As I had no replies at all I'm sure I'm the only one to have these issues, so I would like to discover what am I doing wrong (compiler misconfiguration, device operating system problem...)

Any help would be appreciated.

bye
Alberto
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on February 05, 2010, 02:25:15 am
Hello, Sorry, I was very busy with the Lazarus book ...

Could you create a backtrace with GDB and post it here so that I can see what the problem is? If you don't know how to do this, there are instructions here:

http://wiki.lazarus.freepascal.org/Creating_a_Backtrace_with_GDB

Can you reproduce the crash in an emulator? I tryed in my emulator, but it doesn't crash.

thanks,
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Al Berto on February 08, 2010, 12:27:44 pm
Hi Felipe, thanks for your reply
I recompiled the test program with GDB informations (-g and -gl) and it's about 11 MB, using lazarus 0.9.28.2 beta and FPC 2.2.4.
Testing on Asus P552w Windows Mobile 6.1 PRO (CE 5.2.19965 build 19965.1.2.3)

Loaded DLL...

7ff91000:commctrl.dll.0410.mui
3354000:commctrl.dll
38ae000:aygshell.dll
3138000:ossvcs.dll
7ffe1000:coredll.dll.0410.mui
317c000:oleaut32.dll
31ab000:ole32.dll
3f4d000:coredll.dll
2788000:packageinfoapi.dll
3815000:compime.dll
7ff81000:shellres.dll

Then I click on the WiFi icon, popup showed, click on "Wireless Manager", connection manager form is shown, toggle WiFi, press Exit from this form (sometime just once other times a couple of toggling) after some seconds I got:

Program received signal SIGSEGV, Segmentation fault.
0x001bb284 in U_CLASSES_MAINTHREADID ()
(gdb) bt full
#0  0x001bb284 in U_CLASSES_MAINTHREADID ()
No symbol table info available.
#1  0x00024338 in WINDOWS_MSGWAITFORMULTIPLEOBJECTS$LONGWORD$LPHANDLE$LONGBOOL$LONGWORD$LONGWORD$$LO
NGWORD ()
No symbol table info available.
#2  0x001299bc in TWINCEWIDGETSET__APPPROCESSMESSAGES (this=0x1a148f0) at winceobject.inc:296
        AMESSAGE = {HWND = 2080936096, MESSAGE = 15, WPARAM = 0, LPARAM = 0, TIME = 4254576,
  PT = {X = 16777394, Y = 27333760}}
        ACCELTABLE = 215244
        RETVAL = 203576
        INDEX = 594607056
        PHANDLES = (LPHANDLE) 0x0
#3  0x00033e98 in TAPPLICATION__HANDLEMESSAGE (this=0x1a11480) at application.inc:1135
No locals.
#4  0x000343a0 in TAPPLICATION__RUNLOOP (this=0x1a11480) at application.inc:1269
No locals.
#5  0x0003b378 in TWIDGETSET__APPRUN (ALOOP=0x34350 <TAPPLICATION__RUNLOOP>, this=0x1a148f0)
    at interfacebase.inc:49
No locals.
#6  0x00034344 in TAPPLICATION__RUN (this=0x1a11480) at application.inc:1257
No locals.
#7  0x00011c70 in main () at testpro1.lpr:18
No locals.
-----------------------------------------------

Second run I got:

Program received signal SIGSEGV, Segmentation fault.
0x001bb348 in U_SYSUTILS_OUTOFMEMORY ()
(gdb) bt full
#0  0x001bb348 in U_SYSUTILS_OUTOFMEMORY ()
No symbol table info available.
#1  0x00000000 in ?? ()
No symbol table info available.
-----------------------------------------------

Third run:

Program received signal ?, Unknown signal.
0x001bb284 in U_CLASSES_MAINTHREADID ()
(gdb) bt full
#0  0x001bb284 in U_CLASSES_MAINTHREADID ()
No symbol table info available.
#1  0x00024338 in WINDOWS_MSGWAITFORMULTIPLEOBJECTS$LONGWORD$LPHANDLE$LONGBOOL$LONGWORD$LONGWORD$$LO
NGWORD ()
No symbol table info available.
#2  0x001299bc in TWINCEWIDGETSET__APPPROCESSMESSAGES (this=0x1a148f0) at winceobject.inc:296
        AMESSAGE = {HWND = 2080975456, MESSAGE = 96, WPARAM = 2080975456, LPARAM = 224,
  TIME = 4937893, PT = {X = 16777245, Y = 27333760}}
        ACCELTABLE = 215244
        RETVAL = 203576
        INDEX = 594607056
        PHANDLES = (LPHANDLE) 0x0
#3  0x00033e98 in TAPPLICATION__HANDLEMESSAGE (this=0x1a11480) at application.inc:1135
No locals.
#4  0x000343a0 in TAPPLICATION__RUNLOOP (this=0x1a11480) at application.inc:1269
No locals.
#5  0x0003b378 in TWIDGETSET__APPRUN (ALOOP=0x34350 <TAPPLICATION__RUNLOOP>, this=0x1a148f0)
    at interfacebase.inc:49
No locals.
#6  0x00034344 in TAPPLICATION__RUN (this=0x1a11480) at application.inc:1257
No locals.
#7  0x00011c70 in main () at testpro1.lpr:18
No locals.
-----------------------------------------------

Fourth run:

Program received signal SIGSEGV, Segmentation fault.
0x001bb288 in U_CLASSES_SYNCHRONIZETIMEOUTEVENT ()
(gdb) bt full
#0  0x001bb288 in U_CLASSES_SYNCHRONIZETIMEOUTEVENT ()
No symbol table info available.
#1  0x00024338 in WINDOWS_MSGWAITFORMULTIPLEOBJECTS$LONGWORD$LPHANDLE$LONGBOOL$LONGWORD$LONGWORD$$LO
NGWORD ()
No symbol table info available.
#2  0x001299bc in TWINCEWIDGETSET__APPPROCESSMESSAGES (this=0x1a148f0) at winceobject.inc:296
        AMESSAGE = {HWND = 0, MESSAGE = 96, WPARAM = 0, LPARAM = 0, TIME = 5063558, PT = {X = 1,
    Y = 212664}}
        ACCELTABLE = 215244
        RETVAL = 203576
        INDEX = 594607056
        PHANDLES = (LPHANDLE) 0x0
#3  0x00033e98 in TAPPLICATION__HANDLEMESSAGE (this=0x1a11480) at application.inc:1135
No locals.
#4  0x000343a0 in TAPPLICATION__RUNLOOP (this=0x1a11480) at application.inc:1269
No locals.
#5  0x0003b378 in TWIDGETSET__APPRUN (ALOOP=0x34350 <TAPPLICATION__RUNLOOP>, this=0x1a148f0)
    at interfacebase.inc:49
No locals.
#6  0x00034344 in TAPPLICATION__RUN (this=0x1a11480) at application.inc:1257
No locals.
#7  0x00011c70 in main () at testpro1.lpr:18
No locals.
-----------------------------------------------

Fifth run:

Program received signal SIGSEGV, Segmentation fault.
0x001bb284 in U_CLASSES_MAINTHREADID ()
(gdb) bt full
#0  0x001bb284 in U_CLASSES_MAINTHREADID ()
No symbol table info available.
#1  0x00024338 in WINDOWS_MSGWAITFORMULTIPLEOBJECTS$LONGWORD$LPHANDLE$LONGBOOL$LONGWORD$LONGWORD$$LO
NGWORD ()
No symbol table info available.
#2  0x001299bc in TWINCEWIDGETSET__APPPROCESSMESSAGES (this=0x1a148f0) at winceobject.inc:296
        AMESSAGE = {HWND = 2080975728, MESSAGE = 96, WPARAM = 2080975728, LPARAM = 224,
  TIME = 5210549, PT = {X = 16777288, Y = 27333760}}
        ACCELTABLE = 215244
        RETVAL = 203576
        INDEX = 594607056
        PHANDLES = (LPHANDLE) 0x0
#3  0x00033e98 in TAPPLICATION__HANDLEMESSAGE (this=0x1a11480) at application.inc:1135
No locals.
#4  0x000343a0 in TAPPLICATION__RUNLOOP (this=0x1a11480) at application.inc:1269
No locals.
#5  0x0003b378 in TWIDGETSET__APPRUN (ALOOP=0x34350 <TAPPLICATION__RUNLOOP>, this=0x1a148f0)
    at interfacebase.inc:49
No locals.
#6  0x00034344 in TAPPLICATION__RUN (this=0x1a11480) at application.inc:1257
No locals.
#7  0x00011c70 in main () at testpro1.lpr:18
No locals.
-----------------------------------------------

It looks like each time there are different errors...

After each run the application is still alive on PDA (but not working) until I close GDB, I can't kill it from task manager. Application memory use is about 328KB.

On emulator I can't get it to crash as no "Wireless Manager" form is displayed when I click on the popup message, so I can't reproduce the same operation.

I'm happy to do any other testings, thank you.

bye
Alberto
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Zaher on February 08, 2010, 11:04:17 pm
You can reduce the size of exe file by check "Use external gdb file debug symbols file -Xg", and "Strip Symbols -Xs", the file myapp.gdb generated and stay at your computer to use it with the gdb.

You can check it by your self by compare it with the win32 code
look at #2

#2  0x001299bc in TWINCEWIDGETSET__APPPROCESSMESSAGES (this=0x1a148f0) at winceobject.inc:296

it is function "TWinCEWidgetSet.AppProcessMessages" in winceobject.inc
open it and open the same but in win32object.inc

compare the function and with some luck you will understand.

If you have no answer move this info to the bugtracker.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on February 10, 2010, 06:03:36 pm
Hello, I added more debug info and tryed a fix in rev. 23678

You can either use subversion Lazarus to get it or wait for tomorrows snapshot.

Can you retest with it and tell me if it works?

If it doesn't then please rebuild your LCL using the option -dDEBUG_AppProcessMessages which will add a lot of debug info in this routine. You can rebuild your LCL in the dialog Tools->Configure Build Lazarus, and there you can add this option. After that you should also rebuild your app and run it and make it crash. It will create a file 1.log with the debug info. Please copy the results where I can see it.

It would also be good if you open a bug report to track this issue and maybe even move this whole discussion there.

thanks,
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Al Berto on February 12, 2010, 12:43:56 pm
Hi
I tried to post a new bug but the bugtracker seems down right now with error:
SYSTEM WARNING: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

So, I installed last Lazarus snapshot (Lazarus-0.9.29-23680-fpc-2.4.0-20100212) and rebuild my application. It crashes, this is the bt:

Program received signal SIGSEGV, Segmentation fault.
0x001b4f20 in U_FPIMAGE_IMAGEHANDLERS ()
(gdb) bt full
#0  0x001b4f20 in U_FPIMAGE_IMAGEHANDLERS ()
No symbol table info available.
#1  0x00069398 in WINDOWS_MSGWAITFORMULTIPLEOBJECTS$LONGWORD$LPHANDLE$LONGBOOL$LONGWORD$LONGWORD$$LO
NGWORD ()
No symbol table info available.
#2  0x001251d4 in TWINCEWIDGETSET__APPPROCESSMESSAGES (this=0x1a13410) at winceobject.inc:309
        AMESSAGE = {HWND = 204092, MESSAGE = 96, WPARAM = 2080977856, LPARAM = 224,
  TIME = 251235454, PT = {X = 16777355, Y = 27333664}}
        ACCELTABLE = 192804
        RETVAL = 762379236
        INDEX = 762379304
        PHANDLES = (LPHANDLE) 0x0
#3  0x00031328 in TAPPLICATION__HANDLEMESSAGE (this=0x1a11420) at ./include/application.inc:1195
No locals.
#4  0x00031830 in TAPPLICATION__RUNLOOP (this=0x1a11420) at ./include/application.inc:1329
No locals.
#5  0x00034930 in TWIDGETSET__APPRUN (ALOOP=0x317e0 <TAPPLICATION__RUNLOOP>, this=0x1a13410)
    at ./include/interfacebase.inc:49
No locals.
#6  0x000317d4 in TAPPLICATION__RUN (this=0x1a11420) at ./include/application.inc:1317
No locals.
#7  0x00011ce0 in main () at t3pro.lpr:18
No locals.
#8  0x00020870 in SYSTEM_EXE_ENTRY ()
No symbol table info available.

So I rebuilt LCL for WinCE with option -dDEBUG_AppProcessMessages but no log file is created (to be sure I'm correctly rebuilding the LCL I put some garbage text inside the {$ifdef DEBUG_AppProcessMessages} block in winceobject.inc/TWinCEWidgetSet.AppProcessMessages, and the compiler stops there).

I'll try again to create this log file.

many thanks for the support
bye
Alberto
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Al Berto on February 15, 2010, 03:10:02 pm
I posted this issue on the bugtracker, it was my first bug report so I hope I did it well.

http://mantis.freepascal.org/view.php?id=15773

bye
Alberto
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Al Berto on February 16, 2010, 07:09:17 pm
Compiling and running my application for win32 I see that is run over a dos-like shell, i.e. I see a black background window and my application is over.

Compiling for WinCE, if I put DbgAppendToFile(ExtractFilePath(ParamStr(0)) + '\1.log', 'START') in the project source, before Application.Initialize, log file is correctly written, so I think I don't see the debug entries because my real application is never run due to the previous strange behaviour...

In fact if I put some components on my form they're not shown, even if I change background color it's not changed so I think what I see is not my form.

I'm using SVN version 23707.

Any ideas?

Alberto
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Zaher on February 16, 2010, 09:25:20 pm
Quote
In fact if I put some components on my form they're not shown, even if I change background color it's not changed so I think what I see is not my form.
Try to new way of include lfm and test it.

Quote
Open Options of the project
In Miscellanea checn "FPC Resource"

Open the form unit
after initialization
remove {$I unit1.lrs}
after implementation add
{$R *.lfm}
delete the file .lrs if founded

There also is problem with controls that derived from TGraphicControl like TLabel TShape...

I think there is many mixed bugs.

http://bugs.freepascal.org/view.php?id=15665
http://bugs.freepascal.org/view.php?id=15754
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Al Berto on February 17, 2010, 01:01:55 pm
Quote
Compiling and running my application for win32 I see that is run over a dos-like shell, i.e. I see a black background window and my application is over.

Well... just checking Win32 GUI application (-WG) on linking options I have now a normal single form shown on win32.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on February 26, 2010, 03:31:02 am
So, if you don't use the special new resources (or updates your Lazarus because it seams they are working now) does you form run OK?

Does it still crash with the wireless stuff?

If it still crashes, why can you see my log file? I tested here and for me the log file works ok
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Al Berto on February 26, 2010, 12:49:05 pm
Hi

I downloaded and installed last Lazarus-0.9.28.3-23794-fpc-2.4.0-20100226-win32
then Lazarus-0.9.29-23793-fpc-2.4.0-20100226-cross-arm-wince-win32
but... I don't find your log file mods (DEBUG_AppProcessMessages)

Well... everytime I update Lazarus I fall into hell to make it works again...

bye
Alberto

P.S should I take last SVN version?

Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on February 26, 2010, 01:04:15 pm
I downloaded and installed last Lazarus-0.9.28.3-23794-fpc-2.4.0-20100226-win32
then Lazarus-0.9.29-23793-fpc-2.4.0-20100226-cross-arm-wince-win32

Have you noticed that the versions of your installers don't match?

The source code is in the first one, version 0.9.28.3 which is the stable branch. The compiled WinCE units are in the second one, version 0.9.29 trunk in your case, so your source code doesn't match your compiled WinCE unit.

My modifications are in 0.9.29 so you need to install Lazarus-0.9.29-23793-fpc-2.4.0-20100226-win32.exe

And then the arm-wince installer which was correct.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Al Berto on March 03, 2010, 12:51:29 pm
Sorry for the long delay, I'm full of work here and never found a free moment to test Lazarus.

Ok I downloaded the last Lazarus-0.9.29-23824-fpc-2.4.0-20100303-win32.exe and Lazarus-0.9.29-23824-fpc-2.4.0-20100303-cross-arm-wince-win32.exe and now I see your modifications to winceobject.inc.
I rebuild only the LCL with -dDEBUG_AppProcessMessages, run my application, it still crashes but no log found.
If I put DbgAppendToFile on my project source after inizialization it correctly creates the 1.log file with test information.
Then, just to try, I put a Beep instruction on procedure TWinCEWidgetSet.AppProcessMessages and rebuilt LCL, but I hear no sound (it should be a symphony!) so I suspect the building process is not using the rebuilt LCL. That could be the reason why I can't see your log file.

What am I missing?
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 03, 2010, 05:57:57 pm
How did you rebuild your application? Did you just hit "run" ? I normally use "Build All", that should work.

Do you have multiple Lazarus directories?

One solution might be deleting all LCL compiled files, try deleting the folder lazarus/lcl/units then rebuild your LCL and rebuild your application and try again.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on March 04, 2010, 08:31:28 pm
Hi Al berto and Felippemdc,

I've rewritten an old application (2 years old) And suddenly I had the same issues after testing on a real device. I have been looking for weeks and know I'm convinced that it is not mine bad programming technique, because even a small form in kol, fpgui and 'normal' lazarus will crash on wince.

Now I'm going to install the 09.29 branch, but if it will work with kol....

To be continued

Chris Gradussen

Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on March 04, 2010, 10:07:05 pm
tested with an simple memo application on

   09.29 snapshot and fpc 2.4.1   FAIL >:D
   09.28  with fpc 2.2.4 FAIL >:D
   09.26.2  with fpc 2.2.2 FAIL >:D
   09.26 with fpc 2.2.2 FAIL >:D
   
   09.24 WITH fpc 2.2.0 SUCCEED (but kol-ce with 09.24 is not possible?) O:-)

Now i'm going to test 09.29-23836 snapshot with fpc 2.4.0 FAIL >:D

So it looks like fpc for wince is stable only on version 2.2.0

I hope this wil help to backtrace the issue
Regards Chris Gradussen
   
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Marc on March 04, 2010, 10:09:35 pm
On what point does it fail ?
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Al Berto on March 05, 2010, 09:21:11 am
Hi Felipe

at last I succeded in building LCL in the right way.
What am I missing? In Configure "Build Lazarus" window I have to set the CPU to arm and OS to wince. I have to manually write them in the edit boxes and beware, not WinCE but wince, otherwise LCL building fails.

So at last, this is the 1.log file I get:

:> [AppProcessMessages] WaitHandleCount=0
: MsgWaitForMultipleObjects retval=258
:< [AppProcessMessages]

repeated many times, always the same.

I'm using Lazarus 0.9.29-23836

Hope it helps.

Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on March 05, 2010, 07:27:29 pm
Marc,

Failure means

on a symbol mc70 (mobile 5) or an windows mobile phone (mobile 6.1) a simple application crashes after change of wireless network (enabling or disabling, with a resume you got a reenabling of the network). Not the action is the cause, but the change of network state (disconnected or connected).


With a kol application it takes more time to create/get the error. I think due to the size of te kol application??

Lazarus 09.24 with fpc 2.2.0 works correct. I got the issues after rewriting an old application. That 'old' application worked correct and was written with a snapshot of end 2007. I think it was a snapshot of 09.26 with fpc 2.2.0 but it is just a wild guess.

I hope this can help to get wince usable again.

Regards Chris Gradussen

Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 06, 2010, 02:48:10 am
So at last, this is the 1.log file I get:

:> [AppProcessMessages] WaitHandleCount=0
: MsgWaitForMultipleObjects retval=258
:< [AppProcessMessages]

Please make it crash and post the last lines of the file. If it crashes in the middle of the routine like we expect, it should print only part of this sequence in the last time it prints.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 06, 2010, 03:24:42 am
   09.29 snapshot and fpc 2.4.1   FAIL >:D
   09.28  with fpc 2.2.4 FAIL >:D
   09.26.2  with fpc 2.2.2 FAIL >:D
   09.26 with fpc 2.2.2 FAIL >:D
   
   09.24 WITH fpc 2.2.0 SUCCEED (but kol-ce with 09.24 is not possible?) O:-)

Good job! The bad part here is that this open the door to the problem being in either Lazarus or FPC, but I bet that Lazarus because from 2.2.0 to 2.2.2 was no big changed.

I managed to get a DIFF between how the crashing file was with 0.9.24 and what it is now, there is not much difference and nothing that would make it crash ...

http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/lcl/interfaces/wince/winceobject.inc?root=lazarus&r1=11133&r2=23678&pathrev=23678

So I am betting that the problem is in FPC, or something completely unrelated in Lazarus which causes the crash ...

The best thing would be to test the Latest Lazarus code with FPC 2.2.0, I'll check if it compiles
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 06, 2010, 03:43:26 am
SVN Lazarus doesn't compile with FPC 2.2.0 but you could try to comment out all stuff which doesn't compile and see if works and doesn't crash this way. This would prove the problem is in the compiler.

Another thing to test would be in the file lcl/lresources.pp comment the line that says
{$define UseRes}

maybe this will fix it if it is a resources error.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 06, 2010, 03:55:39 am
Actually too much changed, using latest SVN Lazarus with FPC 2.2.0 is suicide ... a better solution is using an older SVN Lazarus to test this, more specifically LCL between 0.9.24 and 0.9.26 with FPC 2.2.0

Lazarus 0.9.24 is approximately SVN 12750
Lazarus 0.9.26 is approximately SVN 16881

You could test SVN 16881 with FPC 2.2.0

You can install Lazarus 0.9.24 + Lazarus->arm-wince in a separete directory from Source Forge to get the FPC 2.2.0 cross-compiler. Don't use this IDE, just have it for the compiler.

You can then either use a SVN Lazarus in the appropriate version, or use a Lazarus 0.9.26 and use the Environment Options to set your compiler to lazarus0924/fpc/2.2.0/bin/i386-win32/fpc.exe and the same for the make.exe, rebuild your LCL and create a test app.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on March 06, 2010, 08:49:21 am
felipeemdc,

building lazarus 09.26.2 with fpc 2.2.0 is to difficult for me. I have to disable lines in dbgrid . WS32WsControls, Win32WSExtDlgs and therefore i lose te control of what I'm doing and the compiler does not link anymore because  windres.exe cannot exe 'cpp' again. I know it is a c++ file extension, but where I have to look for this error....  But in the real case the above is not interesting, because the target is to get wince stable again :)

Something else interesting to make debug  more simple is using the emulator. The application will not crash, just hang.

Howto
1) start your application, for example with a memo component to see that it does not accept input anymore.
2) Start a suspend. You can do this for example with fdcsoft Taskmanager v3.1. In this taskmanager select menu/actions/suspend
3) wait a few seconds. startup again the emulator (with networking enabled) and you will see that your application does not accept input anymore. If the application is larger or you use by the way a networking function (from winsock or lnet), it will really crash.

I hope this helps!!!

Now I have to go to work....
Regards Chris Gradussen
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 06, 2010, 12:27:27 pm
2) Start a suspend. You can do this for example with fdcsoft Taskmanager v3.1. In this taskmanager select menu/actions/suspend

It would be great! If I can reproduce it, then I can fix it.

By this Taskmanager do you mean installing this software: http://www.dotfred.net/TaskMgr.htm

?
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 06, 2010, 12:41:12 pm
and the compiler does not link anymore because  windres.exe cannot exe 'cpp' again. I know it is a c++ file extension, but where I have to look for this error....  But in the real case the above is not interesting, because the target is to get wince stable again :)

cpp isn't C++, it's the pre-compiler from C/C++ which is also used to pre-compile windows resource files *.rc

Just comment out any reference to resources in your application, usually {$R MyResource.rc} and it should link,
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 06, 2010, 12:58:40 pm
The first time I tried rev12750 the form wouldn't show, and then I started testing multiple versions, then I tested rev12750 again and it worked normally after resuming.

Further, I tested the latest SVN revision and it also works =/

So no, I am not actually capable of reproducing your problem with this Task Manager, it just works in my emulator.

Which emulator version are you using? Maybe this is also a factor.

Or maybe you have more then just a memo in your application.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 06, 2010, 02:49:15 pm
Maybe you need to describe more exactly which steps are necessary to reproduce the bug in the emulator, if necessary using a video from your screen. I found this software to do it:

http://www.wordaddin.com/screenvcr/

For example, I'm not sure what you mean by "with networking on", I am not if my network is on in the same way your network is on and so on ...
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 06, 2010, 03:19:49 pm
I finally managed to reproduce it!!!!!!

It only happens in the WM 6 emulator, that's why I couldn't reproduce. I have always developed with WM 5 emulator ...
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 06, 2010, 03:24:47 pm
There is another bug. Just opening the Task Manager makes my application disappear. If I open a second copy of my application and open the task manager, then it doesn't disappear when I minimize the task manager. Have you noticed that? So I can only reproduce the crash with 2 copies of the app running, one disappeared and one that can't receive input after suspend and will freeze.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 06, 2010, 03:45:27 pm
Can you give me precise instructions to reproduce after a soft reset witout having 2 copies of the app running? It would be good ... I can reproduce with these 2 copies, but this brings more issues in consideration ... and it also takes a long time to load first copy, make it disappear, load second one ...
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 06, 2010, 04:55:02 pm
I managed to reproduce without 2 apps ... you just need to start the taskmanager before opening the LCL App ... otherwise it makes it disappear
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on March 06, 2010, 06:29:55 pm
Felipe,

Can I do something simple to help to solve this issue?
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 06, 2010, 07:27:08 pm
The interresting thing about where it freezes is that it doesn't freeze anywhere specific. Simply adding debug code changes where it freezes, which has made it impossible to determine the exact instruction where it freezes.

As far as I found out, when it comes out from suspend AppProcessMessages runs and somewhere while the messages are being handled it just freezes. I commented out parts of the code and it doesn't make any difference, then it just freezes further down. I bet it would even freeze in a NOP.

I think this is an operational system bug, because the same executable and the same TaskManager worked fine with Windows Mobile 5. IMHO WM 6 introduced this bug and the failure is in Microsoft Code.

Now, I don't know if we are doing something which triggers the WM bug ...
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on March 06, 2010, 07:44:48 pm
Felipe,

In the following circumstances it works correct
-lazarus 09.24 with fpc 2.2.0 (you mentioned earlier you don't think the issue  is fpc 2.2.0, but lazarus)
-lazarus 09.26-09.28 with kol-ce but no external library for example lnet. (lazarus snapshot don't compile well with kol-ce)
-I can run a kol program where lnet has been used, but then I cannot use the part of the application where lnet has been involved.

Thus referering to your previous posts. Could I be in a change between lcl 1.0 to lcl 1.1?


Regards Chris Gradussen
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 06, 2010, 07:45:46 pm
Can I do something simple to help to solve this issue?

For the freeze after suspend, I have run out of ideas. For me it's a Windows bug, you could report it to Microsoft.

But I'm not sure this is actually related to your original problem, which was a Crash, or wasn't it? This one isn't a crash, it's a random Freeze in the app which is caused by nothing in the Lazarus code.

I see no evidence that the problems are related, so I need a new way to reproduce the problem in the emulator. You could provide that.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 06, 2010, 07:59:50 pm
-lazarus 09.26-09.28 with kol-ce but no external library for example lnet. (lazarus snapshot don't compile well with kol-ce)

Maybe it's the application size. LCL even stripped has over 1MB ... you could try adding some libs which are big but do nothing ... maybe lot's of FCL units
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on March 06, 2010, 09:40:41 pm
lazarus 09.28.2 fpc 2.2.4 kol-ce 2.88

186KB just crash >:(


so lazarus 09.24 with fpc 2.2.0 works.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Zaher on March 06, 2010, 09:56:17 pm
Can i get a copy of yours exe to test it in my devices. (i not like to compile it with my current copy)

On i-Mate/WM5 and Opticon/WinCE5/Win4 my application not freeze after suspend/resume also it connected over wifi to make sync the data.
And i have real customer using my application (2 application).
I am not use KOL
I compile my project in lazarus#22551 and FPC 2.4.0

after rev#22551 Lazarus has many bugs for WinCE but i am busy this days to test it and report.

Wait, i noticed some day (in the past) my application freezed, but i found there is a message box in modal mode behind the my form, it make the the form look like freezed, i can press return key to remove it.

Thanks
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 06, 2010, 10:39:25 pm
On i-Mate/WM5 and Opticon/WinCE5/Win4 my application not freeze after suspend/resume also it connected over wifi to make sync the data.

You won't be able to reproduce it I'm afraid, AFAIK the problems are only with Windows Mobile 6

Quote
I compile my project in lazarus#22551 and FPC 2.4.0

For me rev22551 freezes too, no difference.

It surely can be a matter of FPC 2.2.0 vs 2.4.0, but both versions are very different and I don't remember when both were supported in the LCL. And even if we prove that this is the problem, I don't see how this wierd behavior would help FPC developers fix the problem.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 06, 2010, 10:43:23 pm
It would be nice to see a bug tracker from Windows Mobile, but I couldn't find one =( Maybe they don't have a public bug tracker.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Zaher on March 06, 2010, 11:05:28 pm
I have SonyEricsson/WM6.1
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on March 06, 2010, 11:41:29 pm
Felipe,

I also get the crash on a real mobile 5 device,(symbol mc70 with network sd, both windows mobile 5 and 6 drivers) and on a real 6.1 rom.


Zaher,
Where can I find your copy of lazarus and wince lazarus, so I could test if i can reproduce the crash?

Chris
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on March 07, 2010, 12:15:04 am
zaher,

just a little test application
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Al Berto on March 08, 2010, 10:50:13 am
Felipe,

Quote
Please make it crash and post the last lines of the file. If it crashes in the middle of the routine like we expect, it should print only part of this sequence in the last time it prints.

:> [AppProcessMessages] WaitHandleCount=0
: MsgWaitForMultipleObjects retval=258
:< [AppProcessMessages]

these are the last lines of the log so it looks like the procedure correctly exits.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 09, 2010, 06:05:07 pm
these are the last lines of the log so it looks like the procedure correctly exits.

And it crashed? Or did it just freeze? If it crashed can you make a backtrace? I suppose you can use gdb via activesync to get a backtrace.

Strange, because the original crash was in the routine MsgWaitForMultipleObjects ...

I think the Freeze after suspend isn't the same as the original crash, so I have no way to reproduce the original crash.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on March 09, 2010, 06:45:34 pm
> [AppProcessMessages] WaitHandleCount=0
: MsgWaitForMultipleObjects retval=258
:< [AppProcessMessages]

The retval is a WAIT_TIMEOUT (258).
Yesterday evening I was comparing the code of lcl 1.0 an lcl 1.1 in winceobject.inc

I was just comparing and  modifying the code to check if a reverse change in the code will solve this issue. I first had to learn to rebuild the lcl units manually en more of that default stuff. So i didn't kom far.

However I saw one issue what maybe can deal with it.

in winceobject.inc about line 150 there is the following function:

FAppHandle := CreateWindowExW(0, @ClsName,
    UTF8Decode(Application.Title),
    WS_POPUP or WS_CLIPSIBLINGS or WS_CAPTION or WS_SYSMENU or WS_MINIMIZEBOX,
    0, {Windows.GetSystemMetrics(SM_CXSCREEN) div 2,}
    0, {Windows.GetSystemMetrics(SM_CYSCREEN) div 2,}
    0, 0, HWND(nil), HMENU(nil), HInstance, nil);

The UTF8Decode, should that be changed to PWideChar(UTF8Decode(Application.Title)) ? or does that not matter at all?

Regards
Chris Gradussen
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Zaher on March 09, 2010, 07:31:09 pm
Hi,
I tested the example with my mobile WM6.1 (SonyEricsson xperia-x1), i can not make it freeze or crash, i suspended my device, On/Off Wifi, it still work.

Thanks
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on March 09, 2010, 08:59:29 pm
Zaher,

i donwloaded my example and to my regret it still crash.

Dit you type a lot of text in the memo field during network enabling, disabling?

Both of mine test devices have a hardware keyboard. This evening i also tested on mine wifes mobile and... SUCCEED.

Result 2 FAIL 1 SUCCEED, EVEN WITH MINE LARGE LNET APPLICATION

FAIL        Symbol MC 7004 with spected sd Network Card  Windows Mobile                        5.1.478     (Build 15706.3.5.2)
FAIL        HTC WIZA200                                              Windows Mobile 6.1 Professional   5.2.19213 (Build 19212.1.0.3)
SUCCEED  HTC ELF0100                                               Windows Mobile 6 Professional     5.2.1620   (Build 18125.0.4.2)

In mine case 2 devices with hardware keyboard fail,
2 devices without keyboard succeed (chrgra, Zaher)
1 device without keyboard fails  (Al Berto)

Tomorrow I can test on 2 other devices, one without and one with a keyboard.

This means it will be difficult to resolve the issue
1) lazarus 09.24 with lcl 1.0 works correct.
2) lazarus 09.26 or above with lcl 1.1. will work device depending......


Regards Chris Gradussen
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 09, 2010, 09:07:08 pm
> [AppProcessMessages] WaitHandleCount=0
: MsgWaitForMultipleObjects retval=258
:< [AppProcessMessages]

The retval is a WAIT_TIMEOUT (258).

I though that maybe we should pass timeout=infinite, but this doesn't work =) It locks the app until input comes, so I guess immediate timeout is really what is expected.

Quote
Yesterday evening I was comparing the code of lcl 1.0 an lcl 1.1 in winceobject.inc

Which versions are 1.0 and 1.1??? We usually use the Lazarus version for the LCL ... so 0.9.28, etc.

Quote
The UTF8Decode, should that be changed to PWideChar(UTF8Decode(Application.Title)) ? or does that not matter at all?

I highly doubt this makes any difference, but why don't you test it?
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Al Berto on March 10, 2010, 11:19:15 am
Hi Felipe,

application still crashes, log file is the same and this is the backtrace

Code: [Select]
#0  0x001b8bf0 in U_FPIMAGE_IMAGEHANDLERS ()
No symbol table info available.
#1  0x00021830 in SYSTEM_SYSGETMEM$LONGWORD$$POINTER ()
No symbol table info available.
#2  0x0001d51c in SYSTEM_GETMEM$POINTER$LONGWORD ()
No symbol table info available.
#3  0x00016f64 in SYSTEM_NEWANSISTRING$LONGINT$$POINTER ()
No symbol table info available.
#4  0x00017a14 in fpc_ansistr_copy ()
No symbol table info available.
#5  0x000551ec in SYSUTILS_FORMAT$ANSISTRING$array_of_const$TFORMATSETTINGS$$ANSISTRING ()
No symbol table info available.
#6  0x00056ab0 in SYSUTILS_FORMAT$ANSISTRING$array_of_const$$ANSISTRING ()
No symbol table info available.
#7  0x00127440 in TWINCEWIDGETSET__APPPROCESSMESSAGES (this=0x1a13410)
    at winceobject.inc:294
        AMESSAGE = {HWND = 213684, MESSAGE = 26, WPARAM = 0, LPARAM = 0,
  TIME = 602064077, PT = {X = 16777281, Y = 27333664}}
        ACCELTABLE = 202404
        RETVAL = 795933668
        INDEX = 795933736
        PHANDLES = (LPHANDLE) 0x1278ac
#8  0x000338a0 in TAPPLICATION__HANDLEMESSAGE (this=0x1a11420)
    at ./include/application.inc:1195
No locals.
#9  0x00033da8 in TAPPLICATION__RUNLOOP (this=0x1a11420)
    at ./include/application.inc:1329
No locals.
#10 0x00036f30 in TWIDGETSET__APPRUN (ALOOP=0x33d58 <TAPPLICATION__RUNLOOP>,
    this=0x1a13410) at ./include/interfacebase.inc:49
No locals.
#11 0x00033d4c in TAPPLICATION__RUN (this=0x1a11420)
    at ./include/application.inc:1317
No locals.
#12 0x00011cf0 in main () at test1p.lpr:19
No locals.
#13 0x000213e4 in SYSTEM_EXE_ENTRY ()
No symbol table info available.

Hope it helps
Alberto
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 10, 2010, 11:43:30 am
Ha, wierd, it crashes in the log routine! Which indicates an FPC problem.

Could you rebuild your LCL without the debug log and create a new backtrace?

About the claim that it worked fine with Lazarus 0.9.24+fpc2.2.0 but not with Lazarus 0.9.26+fpc2.2.2, then it would be nice if someone who can reproduce the issue could test the following:

Lazarus 0.9.24 + fpc 2.2.2 (install both 0.9.24 and 0.9.26, change the compiler Path in 0.9.24 to indicate the compiler from 0.9.26 and then rebuild the LCL and then rebuild your software).

Also try Lazarus 0.9.26 + fpc 2.2.0 if it compiles

This should bring some light about it being a Compiler issue

thanks,
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Al Berto on March 11, 2010, 08:53:09 am
OK, I rebuilt LCL with no debug messages and that's the new bt full, after crash.
It seems to crash on retVal := Windows.MsgWaitForMultipleObjects ...

Code: [Select]
Program received signal SIGSEGV, Segmentation fault.
0x001b8bf0 in U_FPIMAGE_IMAGEHANDLERS ()
(gdb) bt full
#0  0x001b8bf0 in U_FPIMAGE_IMAGEHANDLERS ()
No symbol table info available.
#1  0x00023948 in WINDOWS_MSGWAITFORMULTIPLEOBJECTS$LONGWORD$LPHANDLE$LONGBOOL$L
ONGWORD$LONGWORD$$LONGWORD ()
No symbol table info available.
#2  0x001271e0 in TWINCEWIDGETSET__APPPROCESSMESSAGES (this=0x1a13410)
    at winceobject.inc:309
        AMESSAGE = {HWND = 213668, MESSAGE = 15, WPARAM = 0, LPARAM = 0,
  TIME = 680165467, PT = {X = 16777373, Y = 27333664}}
        ACCELTABLE = 202388
        RETVAL = 795933668
        INDEX = 795933736
        PHANDLES = (LPHANDLE) 0x0
#3  0x00033890 in TAPPLICATION__HANDLEMESSAGE (this=0x1a11420)
    at ./include/application.inc:1195
No locals.
#4  0x00033d98 in TAPPLICATION__RUNLOOP (this=0x1a11420)
    at ./include/application.inc:1329
No locals.
#5  0x00036e70 in TWIDGETSET__APPRUN (ALOOP=0x33d48 <TAPPLICATION__RUNLOOP>,
    this=0x1a13410) at ./include/interfacebase.inc:49
No locals.
#6  0x00033d3c in TAPPLICATION__RUN (this=0x1a11420)
    at ./include/application.inc:1317
No locals.
#7  0x00011cf0 in main () at test1p.lpr:19
No locals.
#8  0x000213e4 in SYSTEM_EXE_ENTRY ()
No symbol table info available.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Marc on March 11, 2010, 09:44:07 am
OK, I rebuilt LCL with no debug messages and that's the new bt full, after crash.
It seems to crash on retVal := Windows.MsgWaitForMultipleObjects ...

why do you think so ? Your dump says something different:
Code: [Select]
Program received signal SIGSEGV, Segmentation fault.
0x001b8bf0 in U_FPIMAGE_IMAGEHANDLERS ()
(gdb) bt full
#0  0x001b8bf0 in U_FPIMAGE_IMAGEHANDLERS ()
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 11, 2010, 09:47:36 am
The interresting about this is:

1> Right in the beginning of the backtrace comes

#0  0x001b8bf0 in U_FPIMAGE_IMAGEHANDLERS ()
No symbol table info available.

This is a variable in the unit FPImage, this isn't a routine. How come it goes from MsgWaitForm... into a call to a variable thinking it is a method??? It seams the pointer to the next instruction got corrupted?

2> It is virtually impossible to crash at: retVal := Windows.MsgWaitForMultipleObjects ...

There is nothing here, we basically pass almost just zeroes, there is nothing to be missaligned, no strings being passed, etc.

Although on the other hand strictly speaking it doesn't crash here but in a call to a variable, which is understandable.

3> I still need someone to test Lazarus 0.9.24 + FPC 2.2.2 and Lazarus 0.9.26+FPC 2.2.0 =D
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 11, 2010, 09:49:06 am
In the first backtrace we received the beginning was:

#0  0x001bb284 in U_CLASSES_MAINTHREADID ()
No symbol table info available.

So the Next Instruction pointer is being corrupted to a random location, or a location based on something which differs between this 2 devices.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Marc on March 11, 2010, 01:18:36 pm
Or some stack gets overwritten, so it returns "execution" to these variable locations
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 11, 2010, 05:00:02 pm
Or some stack gets overwritten, so it returns "execution" to these variable locations

But what would be the top instruction then? MsgWaitFor with all parameters constant doesn't bring any call except for the operating system.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Marc on March 11, 2010, 05:09:51 pm
You're right.
Maybe the calling convention of the params of MsgWaitFor got changed, but then you should see this more often.

I'm lost.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on March 15, 2010, 10:03:20 pm
Hello,

I cannot test  Lazarus 0.9.26+FPC 2.2.0 for wince, because the lcl needs a least fpc 2.2.1 (according to the sources)
I also did not manage to test Lazarus 09.24 with FPC 2.2.2.

I'm sorry for that.

What I also did (And it did NOT solve te issue)  Backporting the current winceobj.inc  and interfaces.pp to the version used in 09.24.

Someone got any idea?

Regards Chris Gradussen

Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on March 23, 2010, 11:01:54 am
I want to test old snapshots to see where it went wrong between 09.24 and 09.26.

Can any one give me a link for example to the wiki for howto:
1) download the old snapshots from svn
2) build lazarus from the old snapshots

I always used the prebuild snapshots before.

Regards Chris Gradussen
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 24, 2010, 12:31:46 pm
I think the best would be if you use subversion instead. The steps are the following:

1> Install tortoise svn and use it to download the latest lazarus using svn checkout:
http://wiki.lazarus.freepascal.org/Getting_Lazarus#Development_versions_from_SVN
and http://wiki.lazarus.freepascal.org/Getting_Lazarus#Using_TortoiseSVN_for_Windows

This would go for example into C:\Programas\lazarussvn

2> Install Lazarus 0.9.24+wince addon to get the FPC 2.2.0 for WinCE compiler, for example into C:\Programas\lazarus26

3> Install Lazarus 0.9.26+wince addon to get the FPC 2.2.2 for WinCE compiler, for example into C:\Programas\lazarus26

4> Change your Lazarus SVN version to a version that you can compile. For example revision 16881 (=0.9.26) to build Lazarus with FPC 2.2.2

You can check revisions of releases here:
http://svn.freepascal.org/cgi-bin/viewvc.cgi/tags/?root=lazarus

There is a command in TOrtoise SVN "Update to Revision" or something

5> Build your IDE, create a batch script in C:\Programas\lazarussvn like this one and run it to build your IDE:

set path=C:\Programas\lazarus26\fpc\2.2.2\bin\i386-win32
make bigide
pause

Change the path to reflect your path and lazarus and fpc versions

6> Open your SVN IDE, from now on you can build just the LCL for each test you make and build it using the dialog Configure Build Lazarus in the IDE. You can configure which FPC to use in the configuration dialogs of this IDE

7> Test revisions between 12750 and 16881 and with different FPC version. I'm not sure in which revisions which FPC works or when FPC 2.2.0 support was removed, need to check this.

This should give you a start =) Latter I can help more, or ask if you have trouble in any of the steps.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on March 26, 2010, 11:09:08 pm
Pfoe,

That's a pitty. I think I need some help.

What I can
1) Downloading a svn version from lazarus
2) downloading a fpc 'package' for win32
3) building a lazarus svn with a 'compatible' fpc version

What I can't
1) Building fpc to make the wince part (I can download a package, but that is also for the lazarus part and that is not good to find the buggy change)
2) building fpc from source at all  :o

So please give me the right hints.

Regards Chris


Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on March 27, 2010, 01:39:04 pm
Ah ... better skip compiling FPC from source completely for now, what we need is a Lazarus revision between Laz 0.9.24 and 0.9.26 which builds with both FPC 2.2.0 and FPC 2.2.2

With this revision found then we can build it with FPC 2.2.0 and FPC 2.2.2 and if it works with FPC 2.2.0 but not with FPC 2.2.2 we have proved that this is a compiler issue between those 2 exact versions.

Then we can use this revision to test FPC subversion versions, but that's another step, let's first make the first step and latter come to this.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on April 29, 2010, 07:05:42 pm
Hello,

Today I had finally time to install the latest lazarus with fpgui so I could compile some example applications.

This because I think fpgui does not make use of the lcl.

Starting application on my  mobile (with hardware keyboard!!!!). Enabling network and..... application will crash.

Conclusion fpc 2.2.0 for wince is the latest 'stable' release for wince, but fpgui and kolce will not work with it.

I think it has to deal with te buildin keyboard..., but of course I'm not sure of it.

It's a pitty, but I don't have the skills to dig deeper with this issue :'(

Regards Chris Gradussen
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on April 30, 2010, 10:34:16 am
Hello,

Could you also test the latest trunk Lazarus with Free Pascal 2.2.4? You can get this FPC version it by installing Lazarus 0.9.28.2 I think.

I have added support for FPC 2.2.4 in the latest Lazarus trunk, I am also checking the possibility of adding support for FPC 2.2.2 and FPC 2.2.0. That should let us test the same code base with various FPC versions so that we are 100% where the problem is and then we can try to find out what broke this.

thanks,
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on April 30, 2010, 06:00:23 pm
Felipe,

I first installed 0.9.28.2 and the wince part.
Then I installed trunk 0.9.29-25075 (of course te fpc of 0.9.28.2 will  be used aka version 2.2.4)

i tried to build a new project.

Then I got the error  message: "The project uses the new FPC resources, which requires at least fpc 2.4"

any hint?

Regards Chris
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Zaher on April 30, 2010, 06:31:55 pm
As i know, the trunk of Lazarus not work with fpc 2.2 it is need 2.4
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on May 01, 2010, 10:14:54 am
Then I got the error  message: "The project uses the new FPC resources, which requires at least fpc 2.4" any hint?

You can choose if you want to use new FPC resources or not. To use FPC 2.2.x you can't use them. Go to the menu:

Project --> Project Options --> Miscelaneous

Choose the options "LRS Include Files"

I think it doesn't fix the source code. You need to remove the {$R MyForm.lfm} and add in the end:

initialization
  {$I MyForm.lrs}
end.

And try again.

As i know, the trunk of Lazarus not work with fpc 2.2 it is need 2.4

I added support for FPC 2.2.4 some days again, but only for Windows CE.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on May 01, 2010, 10:48:41 am
Now I added support to FPC 2.2.2 and FPC 2.2.0 too. The best would be if you take tomorrows snapshot code base, which has this newer modifications and then test it against:

* FPC 2.2.4 (from Lazarus 0.9.28.2)
* FPC 2.2.2 (from Lazarus 0.9.26.2)
* FPC 2.2.0 (from Lazarus 0.9.24)

This way the exact same code base would be used and we can start checking which modification caused the problem.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on May 02, 2010, 10:01:04 pm
Hi,

I managed to compile a simple form in snapshot 0.9.29-25120 with fpc 2.20, 2.2.2 and 2.41. The other versions of fpc are not of interest because 2.2.0 works ok and 2.2.2 not.

2 remarks from me
1) not activating/deactivating  wirelss causes the crash. But physical connect/disconnect to a wireless network.
2) i believe only pda's /phones with extra hardware (for example a hardware keyboard) are dealing with this issue.

When using older versions of fpc. I get the following annoying error message time after time when changinge/adding something into the designer.

Error reading Form1.LCLVersion: Unknown property: "LCLVersion".

For me the workaround is :
1) Show the lfm source as text
2) Remove het line with  LCLVersion
3) Save the lfm

Do you have a better have a workaround for this?

Regards Chris Gradussen
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: Zaher on May 03, 2010, 04:39:53 am
What you mean "But physical connect/disconnect to a wireless network"
Title: Re: Lazarus+FPC application bad crash on WinCE WORKAROUND!!!!
Post by: chrgra on May 03, 2010, 12:25:55 pm
Ok in my best english 8)

When you enable wireless network on your pda, you see 2 arrows that are moving on the caption bar telling you that your pda is trying to establish a link to the/a wireless network. then there is no problem, even when the arrows are gone (your pda could not make a wireless network connection) . But when the arrows don't move anymore (a link has been established) the lazarus wince application will crash/disappear.

Asking me
It just look a wrong pointer operation.

Regards Chris
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on May 08, 2010, 07:48:08 pm
Felipemdc, Zaher,

do you both have some hints to make progress with this issue?

A think you both also like a stable wince version for al kinds of pda's.

Regards Chris
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on May 08, 2010, 08:34:22 pm
Hello,

Yes, the solution is doing a search to find which modification of the FPC compiler caused the break. The search should test multiple FPC versions until we find which one broke it.

FPC 2.2.0 is trunk revision 8339
between this revision and revision 11490 a number of revisions were merged into FPC 2.2.1 to finally form FPC 2.2.2

The SVN Directory which we should use is: http://svn.freepascal.org/cgi-bin/viewvc.cgi/branches/fixes_2_2/

The first step for you would be installing TortoiseSVN (Google for it) and use it to checkout the fixes_2_2 latest revision: http://svn.freepascal.org/svn/fpc/branches/fixes_2_2

After you have checkedout the latest revision then we can start testing multiple revisions of this branch. We can build a batch file which will create the cross compiler and then you can create executables with it.

Keep a Lazarus snapshot with FPC 2.2.0 installed somewhere, because we need FPC 2.2.0 to build fixes_2_2

The first revisions to test should be 8339 to make sure it works and 11490 to make sure it doesn't work and then we can start further tests.

I'll research about how to create this batch file, but for now you can already download fixes_2_2

thanks,
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on June 08, 2010, 01:50:01 pm
Felipe,

Last month I've been very busy with refactoring my garden :D and selling my sailing yacht :'(t
so I did not have time to do anything.
Did you alread create the batch files, so I can support again to solve this issue?

Regards
Chris gradussen
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: felipemdc on June 10, 2010, 05:55:26 am
Yes, I have found. It is a little tricky, but seams to work:

1> First get the fixes_2_2 in the adequate revision as said before

2> Now edit the file fixes_2_2\packages\Makefile.fpc

Look for the line which start with: dirs_wince=winceunits fcl-web tcl fftw ...

Now edit it to be: dirs_wince=winceunits fcl-web

Also edit the dirst= line to be:

dirs=fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json fcl-process unzip regexpr chm winceunits

This is necessary because some packages will fail to build for WinCE. Althought I am not 100% sure it is needed, maybe my setup has something wrong ...

3> Now recreate all makefiles. Go to the command line cmd.exe, enter the fixes_2_2 directory and issue the command:

PATH=C:\Programas\Lazarus24\fpc\2.2.0\bin\i386-win32\
fpcmake -Tall -r

4> Add the following build.bat batch file to your fixes_2_2 directory, fix the paths to match yours and run it:

Code: [Select]
PATH=C:\Programas\Lazarus24\fpc\2.2.0\bin\i386-win32\
cd compiler
mkdir ..\bin\
mkdir ..\bin\units
make cycle CPU_TARGET=arm OS_TARGET=wince
cd..
make packages CPU_TARGET=arm OS_TARGET=wince PP=C:\Programas\fpc_fixes_2_2\compiler\ppcrossarm.exe OPT="-FUC:\Programas\fpc_fixes_2_2\bin\units"

:: Install
copy compiler\*.exe bin\
copy rtl\units\arm-wince\*.* bin\units\

pause

5> Now you should have a new FPC in the fixes_2_2\bin directory and the units in fixes_2_2\units

6> You can configure this new compiler and rebuilt the LCL for arm-wince with it. You may need to add the path to the units using -FuC:\fixes_2_2\units or something like that.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: crab on November 25, 2010, 11:26:12 pm
I see a crash case in my application.
I think when system busy or an application run with high priority then FreePascal app is crashed.
I tried with 3 type (Application, Program and Console application) and crash still appears.

You can try with simple app

program Project1;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Windows, Classes
  { you can add units after this };

{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}

begin
   repeat
     Sleep(1000);
   utils False;
end.
       
This program is for test only, when it run nothing appear but you can know it is running by try delete program file from storage. If you can not delete it, it means it running other it crash.

After run this program, try turn on, off wifi, run some other program or make incoming call (this will make program crash) you can see FreePascal crashs

I try on HTC HD2, WindowMobile 6, Lazarus-0.9.29-28334-fpc-2.5.1-20101119

I don't know why but I think compiler has problem, not Lazarus.

Please, help me solve this issue.

Hi all,
my name is Alberto, I'm a programmer from Italy.

I've developed a telephone client application for WinCE using Lazarus(0.9.28.2)+FPC(2.2.4-2.4.0)+KOL/MCK(2.80.3-2.88)
Everything is working good with the beautiful KOL components but... sometimes application crash with SIGILL (using gdb).
No problem with WinCE emulator (Windows Mobile 6 PRO version 5.2.1235, Windows Mobile 6.1 PRO version 5.2.20757)

So I create a smaller program to reproduce it (KOLtest).

I'm testing it on a ASUS P552w Windows Mobile 6.1 PRO version 5.2.19965.
The small KOLtest is a form with a button and an edit box.
Run it thru gdb or directly, it's the same.
1- Click on the KOLtest button
2- click on the network icon, toggle WIFI, exit
3- goto 1
after toggling WIFI on/off  for four-five times, the application crash with no errors, after a little O.S. hanging it just disappear, on gdb I have SIGILL or SIGSEGV at different point.

I tried with FPC 2.2.4 or 2.4.0, KOL/MCK 2.80.3 or SVN trunk 2.88.
Could it be a bug on FPC compiler or KOL/MCK?
I don't know how to fix it...

Any help would be really appreciated, I'm getting (quite) mad about it!
Many thanks
bye

Alberto

Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: DirkS on November 26, 2010, 07:23:18 am
Quote
I don't know why but I think compiler has problem,
I think the compiler has a problem if it manages to compile your code without errors...

Code: [Select]
begin
   repeat
     Sleep(1000);
   utils False; // should not compile
end.

Gr.
Dirk.
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: klim on March 06, 2014, 09:45:15 am
Hi all, anybody has got this problem fixed?
We have some Wince (WM) Devices with exactly this kind of problem.

This device hangs with the simplest lazarus program when turning wifi off and on.
Here the test program:
Quote
procedure TForm1.Timer1Timer(Sender: TObject);
begin
  counter := counter+1;
  Label1.Caption:= IntToStr(counter);
end;

Device

Dev environment


The same executable from the test program above is working fine on a MC9090 with WinCE5.

This device is much worse. The same test program crashes without turning wifi off and on, it crashes within a few seconds.

Device

Dev environment


Too bad, that the mantis entry regarding this problem was closed with the comment:  unable to reproduce (http://mantis.freepascal.org/view.php?id=15773)



[/list][/list]
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on March 14, 2014, 11:28:17 pm
Too Sad,

I've 2 mobile mc7094.
I believe one does not crash,
The one at home on this moment still does te same as I stated in 2010.

Maybe I can check tomorrow the differences in the configuration
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: chrgra on March 15, 2014, 09:40:38 am
lazarus 0.924 with fpc version 2.2.0 works fine:)
Title: Re: Lazarus+FPC application bad crash on WinCE
Post by: BigChimp on March 15, 2014, 10:45:18 am
Well, if nobody does a search [1] for the change in FPC that caused the problem, I don't think it's likely the bug will be fixed.

On the other hand, if that old Laz+FPC version work fine for your wince applications... well, I can see why one wouldn't bother ;)

[1] Similar to the one described here
http://forum.lazarus.freepascal.org/index.php/topic,8498.msg45893.html#msg45893
Title: Re: POSSIBLE WORKAROUND!!!!! Lazarus+FPC application bad crash on WinCE
Post by: chrgra on March 15, 2014, 06:28:26 pm
POSSIBLE WORKAROUND!!!

In another post with the same issue (application close/ shutdown).
The poster told that using upx solved the issue.
I tried it on my app for the symbol motorola (which runs on two almost exactly the same devices (i cannot find the difference, but spbackup really told me the roms are different)) and it looks like stable.

Now I will put it in my test environment at work and test further!!!!!

I used upx391w
TinyPortal © 2005-2018