You are not logged in.
Alf,
With latest trunk for FPC + mORMot + LAMW all mORMot apps are terminated at startup:
ESynException: Unregistered ptCustom for TJSONRecordTextDefinition.AddItem(Line: TINTEGERDYNARRAY)
To reproduce:
1. Create a new App with LAMW ( ARMV7A + VFPv3)
2. Add to uses : SynCommons, mORMot, mORMotHttpClient
3. Run the app
4. Dump with Logcat to see the error
Last edited by Leslie7 (2018-06-25 13:21:51)
Offline
I can only see this in the logcat dump:
E/libcontrols.so( 7235): ESynException: Unregistered ptCustom for TJSONRecordTextDefinition.AddItem(Line: TINTEGERDYNARRAY)
Even a freshly created LAMW GUI project with the 3 mentioned units added to uses terminates with the same error.
Last edited by Leslie7 (2018-06-24 18:43:53)
Offline
I have installed NewPascal with fpcupdeluxe but the problem is the same.
Offline
This is probably not a new issue, I have pulled a version from 2018.01 and it does not work either.
Last edited by Leslie7 (2018-06-24 21:44:30)
Offline
This is really strange. After pulling an older version for FPC, Lazarus, LAMW, mORMot from a date when it worked for me, the problem remains the same.
Offline
I have no idea which component (Fpc, ...) causes the issue, but after travelling back in time to 2017.08 it finally works.
I will try to pinpoint at what point it goes wrong.
Offline
With latest FPC, mORMot, LAMW, I experience exactly the same error !!
Edit:
With latest FPC, mORMot, LAMW, on arm linux (RPI3) , all goes well !!
So, no alignment issue as it seems.
Last edited by AOG (2018-06-25 09:47:42)
Offline
AOG,
is the problem solved or it just does not appear on an other machine?
Offline
Unfortunately on Windows 7 with the latest trunks the problem remains.
But the good news is that I have located the mORMot commit which introduced the problem.
It is probably a compiler issue in the first place, but maybe the changes committed here can be made more friendly to the current FPC trunk and help to create a well pointed bug report for the FPC team.
Revision: c5ad9b1d1f57177a8fe686271370cb12fc29d3d9
Author: Arnaud Bouchez <fakeaddress@synopse.info>
Date: 2018.02.01. 13:34:44
Message:
low-level refactoring, mainly for 64-bit FPC performance
----
Modified: SynCommons.pas
Modified: SynMongoDB.pas
Modified: SynopseCommit.inc
Offline
Still debugging. But perhaps Ab can help at this stage !
This function (inside TJSONCustomParserRTTI.CreateFromTypeName):
ndx := GlobalJSONCustomParsers.RecordSearch(aCustomRecordTypeName);
For a TINTEGERDYNARRAY, ndx is -1 !
So, the whole function (CreateFromTypeName) returns nil !!
Edit:
Just saw the new post. Perhaps the reports are related !?
Last edited by AOG (2018-06-25 11:57:49)
Offline
AOG,
Seems you are close.
I am curious, how do you debug an android app?
Is there a way to prevent android from terminating the the app when there is an issue? With the usual Try Except many times it is stopped before reaching the exception handling part.
Last edited by Leslie7 (2018-06-25 12:11:39)
Offline
The (very) hard way ... ;-)
E.g.:
ndx := GlobalJSONCustomParsers.RecordSearch(aCustomRecordTypeName);
__android_log_write(ANDROID_LOG_DEBUG,'mORMot CreateFromTypeName ndx: ',PChar(InttoString(ndx)));
So, adding lines that are visible in ADB.
Normally, I make a custom ShowError function that directs this inserted debug-info to a place where I can easily study it.
Than, I am able to easily compare CPU-OS systems. So, I compare expected output on working systems with non-working systems.
As I said, the hard way ... especially on Android !
Offline
Well, that was the only way I could find as well. Very time consuming.
I have seen somewhere (maybe in the Lazarus or NewPascal commits ) that there is an effort which seems to be aiming at debugging IOS apps.
Do you see a possible way to do the same for Android?
You have probably missed this later addition to my previous post:
Is there a way to prevent android from terminating the the app when there is an issue? With the usual Try Except many times it is stopped before reaching the exception handling part.
Last edited by Leslie7 (2018-06-25 12:34:58)
Offline
Is there way to have Android include a stack trace with the names of the Pascal calls into the crash report? That would be very useful as well.
Offline
First part of problem found: IdemPropNameUSameLen
Thanks to your research !
If reverted, first part of my Android app works again !
Is there a way to prevent android from terminating the the app
Nope. Android 8 is even worse: no permission = failure without warning.
Offline
Excellent!
Can you give me what to change in the code to get it working?
Offline
Just replace the code inside the function with this code (the old code):
function IdemPropNameUSameLen(P1,P2: PUTF8Char; P1P2Len: PtrInt): boolean;
{$ifdef PUREPASCAL}
var i,j: integer;
begin
result := false;
j := 0;
for i := 1 to P1P2Len shr 2 do
if (PCardinal(PtrInt(P1)+j)^ xor PCardinal(@P2[j])^) and $dfdfdfdf<>0 then
exit else
inc(j,4);
for i := j to P1P2Len-1 do
if (PByteArray(P1)^[i] xor ord(P2[i])) and $df<>0 then
exit;
result := true;
end;
Works for me 100%. I hope also for you !
Offline
Yes it does! Thank you!
Offline
Please try https://synopse.info/fossil/info/5068ddbe77
I don't understand what was wrong with the previous code....
Offline
Hi Ab,
Your new code does not work either.
But the good news is ... I found out whats wrong : its a compiler error !
The inlining of this function does not work on Android.
If inlining is disabled, both the old code (from yesterday) as well as the new code works.
Strange aspect: the really old code (see post above, from 4 month go) does work with inlining ?!
Offline
Yes, really strange!
I hope https://synopse.info/fossil/info/1c8350e285 will work better to circumvent the problem...
Offline
Your latest commit works out-of-the-box on Android.
Thanks !
Offline