* * *

Author Topic: Lazarus+FPC application bad crash on WinCE  (Read 66871 times)

Al Berto

  • New member
  • *
  • Posts: 16
Lazarus+FPC application bad crash on WinCE
« 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
« Last Edit: February 04, 2010, 11:49:29 am by al9 »

Al Berto

  • New member
  • *
  • Posts: 16
Re: App crash using Lazarus+KOL-CE
« Reply #1 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
« Last Edit: January 28, 2010, 05:49:47 pm by al9 »

Al Berto

  • New member
  • *
  • Posts: 16
Re: Lazarus+FPC application bad crash on WinCE
« Reply #2 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

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3531
Re: Lazarus+FPC application bad crash on WinCE
« Reply #3 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,

Al Berto

  • New member
  • *
  • Posts: 16
Re: Lazarus+FPC application bad crash on WinCE
« Reply #4 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

Zaher

  • Hero Member
  • *****
  • Posts: 524
    • parmaja.com
Re: Lazarus+FPC application bad crash on WinCE
« Reply #5 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.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3531
Re: Lazarus+FPC application bad crash on WinCE
« Reply #6 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,

Al Berto

  • New member
  • *
  • Posts: 16
Re: Lazarus+FPC application bad crash on WinCE
« Reply #7 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

Al Berto

  • New member
  • *
  • Posts: 16
Re: Lazarus+FPC application bad crash on WinCE
« Reply #8 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

Al Berto

  • New member
  • *
  • Posts: 16
Re: Lazarus+FPC application bad crash on WinCE
« Reply #9 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

Zaher

  • Hero Member
  • *****
  • Posts: 524
    • parmaja.com
Re: Lazarus+FPC application bad crash on WinCE
« Reply #10 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

Al Berto

  • New member
  • *
  • Posts: 16
Re: Lazarus+FPC application bad crash on WinCE
« Reply #11 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.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3531
Re: Lazarus+FPC application bad crash on WinCE
« Reply #12 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

Al Berto

  • New member
  • *
  • Posts: 16
Re: Lazarus+FPC application bad crash on WinCE
« Reply #13 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?


felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3531
Re: Lazarus+FPC application bad crash on WinCE
« Reply #14 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.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus