Recent

Author Topic: F8 step-over sometimes goes into assembly code  (Read 4114 times)

Eugene Loza

  • Hero Member
  • *****
  • Posts: 729
    • My games in Pascal
Re: F8 step-over sometimes goes into assembly code
« Reply #15 on: March 24, 2024, 06:42:20 pm »
Sorry for the delay with this - was going to get back to the issue in a couple of hours... And huge thank you!
« Last Edit: March 24, 2024, 06:44:34 pm by Eugene Loza »
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

Eugene Loza

  • Hero Member
  • *****
  • Posts: 729
    • My games in Pascal
Re: F8 step-over sometimes goes into assembly code
« Reply #16 on: June 17, 2024, 06:16:49 pm »
One more potential issue (unless it's a special case of the previous one):

Code: Pascal  [Select][+][-]
  1. program Project1;
  2. uses
  3.   Classes, SysUtils;
  4. begin
  5.   try
  6.     WriteLn(TObject(nil).ClassName);
  7.   except
  8.   end;
  9. end.

1. Run the program
2. Get Access Violation
3. Press F8
4. The file "Seh64.inc" was not found (attachment 1)
5. No.
6. Assembler window pops up (attachment 2)
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

Thaddy

  • Hero Member
  • *****
  • Posts: 16145
  • Censorship about opinions does not belong here.
Re: F8 step-over sometimes goes into assembly code
« Reply #17 on: June 18, 2024, 10:36:28 am »
Are you "eating" exceptions?
e.g.: do you do this:
Code: Pascal  [Select][+][-]
  1. try
  2.   something that can cause an exception
  3. except // with no code until end; empty block.
  4. end;//without handling it properly?
Then you get what you showed.
SEH becomes useless then.
Beginners mistake. It is very hard to debug such code and it is wrong, very wrong.
« Last Edit: June 18, 2024, 10:40:10 am by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

Eugene Loza

  • Hero Member
  • *****
  • Posts: 729
    • My games in Pascal
Re: F8 step-over sometimes goes into assembly code
« Reply #18 on: June 18, 2024, 10:46:06 am »
Quote
Are you "eating" exceptions?
No, I'm making the most minimal reproduction of the issue that is nagging me in a big project, where the exceptions are (hopefully) properly treated, though F8 "resurfaces" only in "try..except" statement, going through not very useful Assembly before that and often very little information on what exactly went wrong - only a consequence in form of an exception. Often "Call Stack" helps to debug those. But the example above shows only one thing (as the caption of this topic) : Pressing F8 goes into Assembly window instead of showing something meaningful.

Adding WriteLn('Exception!') in the except block doesn't seem to change the issue. The Seh64.inc is still not found and Assembly window is displayed instead but it's one more line of code :)
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

Thaddy

  • Hero Member
  • *****
  • Posts: 16145
  • Censorship about opinions does not belong here.
Re: F8 step-over sometimes goes into assembly code
« Reply #19 on: June 18, 2024, 10:48:13 am »
If you are sure, use the call-stack to debug it. It will narrow down to where the exception occurs.
If I smell bad code it usually is bad code and that includes my own code.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10546
  • Debugger - SynEdit - and more
    • wiki
Re: F8 step-over sometimes goes into assembly code
« Reply #20 on: June 20, 2024, 04:25:29 pm »
The seh file not found may or may not be the same. Needs to be re-tested when that is fixed.

But the debugger also doesn't find the exception block in this case.  That causes stepping to fail, because there isn't a next line (the CPU is in the exception throwing code...)

https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40993

Afraid, that may be a while until it gets attention.

Thaddy

  • Hero Member
  • *****
  • Posts: 16145
  • Censorship about opinions does not belong here.
Re: F8 step-over sometimes goes into assembly code
« Reply #21 on: June 20, 2024, 05:59:43 pm »
A writeln in the except block is not enough. Needs sysutils to have fully functional SEH it seems.
« Last Edit: June 20, 2024, 06:03:09 pm by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10546
  • Debugger - SynEdit - and more
    • wiki
Re: F8 step-over sometimes goes into assembly code
« Reply #22 on: June 20, 2024, 06:04:34 pm »
A writeln in the except block is not enough. Needs sysutils to have fully functional SEH.

You are referring to this post?
One more potential issue (unless it's a special case of the previous one):

Code: Pascal  [Select][+][-]
  1. program Project1;
  2. uses
  3.   Classes, SysUtils;
  4. begin
  5.   try
  6.     WriteLn(TObject(nil).ClassName);
  7.   except
  8.   end;
  9. end.

And the copy of the code that is shown on https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40993 ?

Because, to me it looks like it does have it?

Eugene Loza

  • Hero Member
  • *****
  • Posts: 729
    • My games in Pascal
Re: F8 step-over sometimes goes into assembly code
« Reply #23 on: June 20, 2024, 06:41:40 pm »
Afraid, that may be a while until it gets attention.
Thank you! No rush with this one, just a small inconvenience. Eventually I've learned to use StackTrace and sometimes can even quickly figure out where it could go wrong :D
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

 

TinyPortal © 2005-2018