Jump to content
dummzeuch

Filter Exceptions expert and IOS / Android apps

Recommended Posts

Apparently the new experimental Filter Exception expert does not work when debugging IOS or Android apps (and probably also not for Linux programs).

 

There is a bug report on the Embarcadero Quality Portal on crashes when debugging IOS apps. Uninstalling GExperts or disabling the Filter Exception expert solves that issue.

 

Does anybody have similar experiences with other platforms?

 

I had a look at the code again and figured that the problem might be that it hooks/calls TNativeDebugger methods in win32debugide*.bpl. Maybe it should instead call one of the other *debugide* packages:

  • gdbdebugide (Linux)?
  • ios32debugide
  • ios64debugide

But on the other hand I don't really care because I don't do any development for anything but Win32 (and possibly Win64 in the future).

 

So I am thinking about disabling the expert when a project for non windows platforms is active instead. It should definitely not crash the IDE.

Share this post


Link to post
46 minutes ago, Mahdi Safsafi said:

Please Thomas, check your Gexperts tickets.

Thanks, this could solve the problem, but as I said: I cannot test it.
 

I need some volunteers to test this. Any takers?

 

It's just a matter of creating a simple Android, Linux, OSX or IOS application respectively that raises an exception and see what happens. If Mahdi's fix works this will simply display the filter exception dialog, if not, it will crash the IDE. That's simple to distinguish. 😉

 

I just tried to create a simple Android app to run in the emulator, only to discover that apparently the emulator is no longer supported for debugging.

So, that leaves me with trying to install all the stuff necessary to debug on a real device or not give a damn.

Share this post


Link to post

Hi. I can test it if you like. I've experienced the AV debugging both Android and Linux applications. I can test MacOS and iOS too.

 

What do you need me to do?

  • Like 1

Share this post


Link to post
8 hours ago, Roland Skinner said:

Hi. I can test it if you like. I've experienced the AV debugging both Android and Linux applications. I can test MacOS and iOS too.

 

What do you need me to do?

Thanks a lot for volunteering.

 

Ijust made a release, the code to be tested is included in that. So in order to test it, simply install the release, enable the "Filter Exceptions" expert and debug code that raises exceptions. If the fix worked, you will get the new filter dialog for non-Windows projects. If it didn't, strange things (most likely AVs in the IDE) will happen. In the latter case, disable the "Filter Exceptions" expert and try again. The normal IDE dialog should appear and no AVs or other strange things should happen.

  • Like 1

Share this post


Link to post
5 minutes ago, dummzeuch said:

Thanks a lot for volunteering.

 

Ijust made a release, the code to be tested is included in that. So in order to test it, simply install the release, enable the "Filter Exceptions" expert and debug code that raises exceptions. If the fix worked, you will get the new filter dialog for non-Windows projects. If it didn't, strange things (most likely AVs in the IDE) will happen. In the latter case, disable the "Filter Exceptions" expert and try again. The normal IDE dialog should appear and no AVs or other strange things should happen.

My expectation is a failure because in the last commit I saw, GetVmtOffset didn't implement offset(vmtParent, vmtClassName) for iOS/Android. 

function GetVmtOffset(Process: IOTAProcess; Offset: TVmtOffset): Int64;
begin
{$IFDEF IS_WIN32_ONLY}
  Result := GetVmtOffsetWin32(Offset);
{$ELSE}
  { Each platform should have corresponding constant value. }
  case Process.GetProcessType of
    optWin32:
      Result := GetVmtOffsetWin32(Offset);
    optWin64:
      Result := GetVmtOffsetWin64(Offset);
    // implement others...
  else
    raise Exception.Create('Please implement me.');
  end;
{$ENDIF}
end;

 

Share this post


Link to post
On 10/27/2020 at 10:44 AM, dummzeuch said:

Thanks a lot for volunteering.

 

Ijust made a release, the code to be tested is included in that. So in order to test it, simply install the release, enable the "Filter Exceptions" expert and debug code that raises exceptions. If the fix worked, you will get the new filter dialog for non-Windows projects. If it didn't, strange things (most likely AVs in the IDE) will happen. In the latter case, disable the "Filter Exceptions" expert and try again. The normal IDE dialog should appear and no AVs or other strange things should happen.

Hi.

 

Ok, fixed in Linux (tested with Ubuntu 20.04.2).

 

Get this exception message for Linux in Delphi, which should have had message "Error Message" (this could be a Delphi error; I noticed it also after disabling the exception expert the other day):

 

image.thumb.png.1cd6153780d4a8ca59f8e6876d63e600.png

 

MacOS (10.15.7) all good:

 

image.thumb.png.1c1168b17857956f043bf053b7d22be7.png

 

iOS (13.7) working, but same issue as Linux:

 

image.thumb.png.41572d8b028e33242b4470c1145035fb.png

 

Android (10 - 64-bit) still fails:

 

image.thumb.png.d5493641654ba55756b88e0fd6168174.png

 

I trust this helps...

 

 

 

 

 

 

  • Thanks 2

Share this post


Link to post

Hi again.

 

Just realized I could test Android 32-bit for you too. Same device (Android 10 64-bit). It works:

 

image.thumb.png.0cfa0a032a157940bbfb1a0e0cb3ece0.png

 

And working on a 32-bit device (Android 7 - 32-bit):

 

image.thumb.png.1d6c24ca561ceccc0b22ac2278cb213d.png

 

Looks like it is just 64-bit Android now.

 

  • Thanks 1

Share this post


Link to post

Thanks a lot for testing this. It's good to see that it works for most platforms.

7 hours ago, Roland Skinner said:

Get this exception message for Linux in Delphi, which should have had message "Error Message" (this could be a Delphi error; I noticed it also after disabling the exception expert the other day):

Could you please double check this again? Also for IOS?

 

If it is a Delphi issue, you should probably file a bug report with Embarcadero (in this case, make sure to disable GExperts completely (not just the Filter Exception expert) to ensure that it doesn't interfere with the debugging in any other way.)

If it turns out to only happen in the Filter Exceptions expert, I'd like to know that.

 

There are other tests which I would like you to try, if you like:

  1. Raise a different exception (so I can see whether the name is determined correctly.
  2. Raise an OS exception, e.g. division by zero or access violation.

 

Share this post


Link to post
On 10/27/2020 at 9:58 AM, Mahdi Safsafi said:

My expectation is a failure because in the last commit I saw, GetVmtOffset didn't implement offset(vmtParent, vmtClassName) for iOS/Android. 


function GetVmtOffset(Process: IOTAProcess; Offset: TVmtOffset): Int64;
begin
{$IFDEF IS_WIN32_ONLY}
  Result := GetVmtOffsetWin32(Offset);
{$ELSE}
  { Each platform should have corresponding constant value. }
  case Process.GetProcessType of
    optWin32:
      Result := GetVmtOffsetWin32(Offset);
    optWin64:
      Result := GetVmtOffsetWin64(Offset);
    // implement others...
  else
    raise Exception.Create('Please implement me.');
  end;
{$ENDIF}
end;

 

Hm, yes, there is that. Very odd that it works at all. This function is only used in the testing code but that code is always enabled, so it should raise that exception....

Unless GetExceptionObject returns 0.

Share this post


Link to post
7 hours ago, dummzeuch said:

Hm, yes, there is that. Very odd that it works at all. This function is only used in the testing code but that code is always enabled, so it should raise that exception....

Unless GetExceptionObject returns 0.

I now read those vmt offset values from the debugger using IOTAThread.Evaluate. Works fine for Win32 and Win64. Can't test other targets.

Share this post


Link to post
19 minutes ago, dummzeuch said:

I now read those vmt offset values from the debugger using IOTAThread.Evaluate. Works fine for Win32 and Win64. Can't test other targets.

Fluent Thomas how you used IOTAThread.Evaluate. I've one question (off-topic) : is Evaluate aware about others constants too ? For example can I use it to evaluate other System constants ?

Share this post


Link to post
1 minute ago, Mahdi Safsafi said:

Fluent Thomas how you used IOTAThread.Evaluate. I've one question (off-topic) : is Evaluate aware about others constants too ? For example can I use it to evaluate other System constants ?

Yes, if they are in the current context. That should be no problem with constants declared in the system unit, but for other constants that might not be the case.

 

Hm, thinking about it: I wonder whether this is still true for parts of the IDE that are not written in Delphi...

  • Thanks 1

Share this post


Link to post
11 hours ago, dummzeuch said:

Thanks a lot for testing this. It's good to see that it works for most platforms.

Could you please double check this again? Also for IOS?

 

If it is a Delphi issue, you should probably file a bug report with Embarcadero (in this case, make sure to disable GExperts completely (not just the Filter Exception expert) to ensure that it doesn't interfere with the debugging in any other way.)

If it turns out to only happen in the Filter Exceptions expert, I'd like to know that.

 

There are other tests which I would like you to try, if you like:

  1. Raise a different exception (so I can see whether the name is determined correctly.
  2. Raise an OS exception, e.g. division by zero or access violation.

 

Hi. No problem assisting. I've been using GExperts for probably 20 years; glad I can help out.

 

This is Linux, with GExperts uninstalled:

 

"Error Message":

 

image.thumb.png.63969ea0298c447d3e726c089cfda264.png

 

Division by Zero:

 

image.thumb.png.178915380dfee5880ac9814b28cf5a46.png

 

Accessing Nil-pointer (calling ClassName on TObject variable):

 

image.thumb.png.4377a3742b1fe9daf02ae501fb264051.png

 

Now with GExperts installed and exception-expert enabled:

 

Division by Zero:

 

image.thumb.png.37d1667989db13bddb2c1849d731724e.png

 

Accessing Nil-pointer:

 

image.thumb.png.b3ce80e6ef97bfe1b69b6d0e8618df20.png

 

Then, in iOS (GExperts installed and expert enabled):

 

Division by Zero:

 

image.thumb.png.2070a08e849fefe02b617db5f89e002c.png

 

Accessing Nil-pointer:

 

image.thumb.png.8d3c292e5c85fa67b373e51f9bb17eff.png

 

I'll report the errors with the message to Embarcadero. I actually came here looking about issues I have with the Linux debugger, to see if anyone else had experienced the problems I've noticed. I'll report these too. (For example, objects are displayed as pointer-addresses only, yet you can see their member-values in a popup-inspector.)

 

 

  • Thanks 2

Share this post


Link to post

@Roland Skinner Thanks a lot man ! That's a great news knowing that it works mostly on all architectures. Just wondering what was wrong with Android 64-bit.

Quote

 Get this exception message for Linux in Delphi, which should have had message "Error Message" (this could be a Delphi error; I noticed it also after disabling the exception expert the other day):

Possibly from Delphi ... @Kas Ob have reported similar thing.

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×