Recent

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

chrgra

  • Jr. Member
  • **
  • Posts: 69
Re: Lazarus+FPC application bad crash on WinCE
« Reply #45 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

chrgra

  • Jr. Member
  • **
  • Posts: 69
Re: Lazarus+FPC application bad crash on WinCE
« Reply #46 on: March 07, 2010, 12:15:04 am »
zaher,

just a little test application

Al Berto

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

felipemdc

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

chrgra

  • Jr. Member
  • **
  • Posts: 69
Re: Lazarus+FPC application bad crash on WinCE
« Reply #49 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

Zaher

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

chrgra

  • Jr. Member
  • **
  • Posts: 69
Re: Lazarus+FPC application bad crash on WinCE
« Reply #51 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

felipemdc

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

Al Berto

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

felipemdc

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

Al Berto

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

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2582
Re: Lazarus+FPC application bad crash on WinCE
« Reply #56 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 ()
//--
{$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: Lazarus+FPC application bad crash on WinCE
« Reply #57 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

felipemdc

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

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2582
Re: Lazarus+FPC application bad crash on WinCE
« Reply #59 on: March 11, 2010, 01:18:36 pm »
Or some stack gets overwritten, so it returns "execution" to these variable locations
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

 

TinyPortal © 2005-2018