Unexpected highlighted line. lazarus / 12-Debugger ---------------------------------------------------------------------- 440bx · 2025-05-21 08:44 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. ---------------------------------------------------------------------- Martin_fr · 2025-05-21 09:21 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 · 2025-05-21 09:27 Quote from: Martin_fr on May 21, 2025, 11:21:27 amSignature 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. Quote from: Martin_fr on May 21, 2025, 11:21:27 amI 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. ---------------------------------------------------------------------- Thaddy · 2025-05-21 09:30 You noughty D2 user.....