Recent

Author Topic: Unexpected highlighted line.  (Read 313 times)

440bx

  • Hero Member
  • *****
  • Posts: 5477
Unexpected highlighted line.
« on: May 21, 2025, 10:44:13 am »
Hello,

Please refer to the attachment.

In the attachment, line 273 is highlighted but, it shouldn't be because LpiHandle is NOT equal to INVALID_HANDLE_VALUE.  The line that should have been highlighted is line 278 (which is highlighted after single stepping.)

Attached is the project which exhibits the behavior.  To make it reach that line, drag and drop any .lpr file onto the window (not .lpi nor .lps, it must be a .lpr), execution will break automatically at line 265, after which, single stepping will cause line 267 to be executed and single stepping again should highlight line 278 instead of line 273.



(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11361
  • Debugger - SynEdit - and more
    • wiki
Re: Unexpected highlighted line.
« Reply #1 on: May 21, 2025, 11:21:27 am »
Signature still correct? Using fpc 3.0.4?

I currently can't test, but this is highly likely the compiler writing the line info incorrect.

You may try -O- (optimization 0). But depending on what causes it, it may even happen with that.

You can use the asm window to get the address at which the debugger paused.
Then using objdump --dwarf=decodedline yourexe.exe  you can check where the address points to.



If -O- fixes it, then it is likely the peephole optimizer. Then maybe, just maybe, with fpc fixes -O1 will do better....


440bx

  • Hero Member
  • *****
  • Posts: 5477
Re: Unexpected highlighted line.
« Reply #2 on: May 21, 2025, 11:27:05 am »
Signature still correct? Using fpc 3.0.4?
Yes, the signature is still correct but, I am much more often using Lazarus v4.0RC3 and FPC v3.2.2 than 3.04 and the older Lazarus.

I should probably remove the 3.0.4 since I don't use it all that often anymore.

I currently can't test, but this is highly likely the compiler writing the line info incorrect.

You may try -O- (optimization 0). But depending on what causes it, it may even happen with that.
Setting (optimization 0) fixed it.  It looks like the "debugger friendly" setting isn't always friendly. ;)

Thank you for your help Martin. 
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 17198
  • Ceterum censeo Trump esse delendam
Re: Unexpected highlighted line.
« Reply #3 on: May 21, 2025, 11:30:15 am »
You noughty D2 user..... :o
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

 

TinyPortal © 2005-2018