Recent

Author Topic: [SOLVED] Lazarus 4.0 and INT3 gets skipped over  (Read 664 times)

What I can do

  • Full Member
  • ***
  • Posts: 167
[SOLVED] Lazarus 4.0 and INT3 gets skipped over
« on: May 22, 2025, 05:37:24 am »
fpc 3.2.2 Lazarus 4.0
I was trying to get the INT3 to trigger a IDE break point, but so far it always gets skipped over.
Code: Pascal  [Select][+][-]
  1. procedure TForm1.MainTimer(Sender: TObject);
  2. begin
  3.   Main.Enabled:= false;
  4.   FActivated:= TRUE;
  5.   if ShowMSG('SRD Test is alive',[mbOK,mbCancel],false)
  6.   then
  7.    begin
  8.     DebugBreak;            //will not pause or trigger any break
  9.     asm int3 end;          // will not trigger any break
  10.     showMSG('Skiped'); //runs as normal
  11.    end;
  12. end;
« Last Edit: May 22, 2025, 02:44:51 pm by What I can do »

440bx

  • Hero Member
  • *****
  • Posts: 5479
Re: Lazarus 4.0 and INT3 gets skipped over
« Reply #1 on: May 22, 2025, 06:00:11 am »
The reason is because the debugger has been told to ignore int3 instructions it has not placed itself.

Refer to the attachment.

Ensure that HandleDebugBreakInstruction IS NOT set to dboIgnoreAll.  After that your int3s will break into the  debugger.

However, note that other int3s will break into the debugger too.  for instance, when debugging 32bit programs under Windows, ntdll has an int3 before giving control to the program being debugged.  When it breaks there, you'll need to press F9.  HOWEVER, because of the annoying int3 in ntdll, if you press F9 and you don't have a breakpoint set at the beginning of your code, execution won't stop at the program's entry point.  The solution is to either manually place a breakpoint at the entry point or put a statement such as "if IsDebuggerPresent() then asm int3 end;" (note that IsDebuggerPresent() is a Windows only function, if you are using a different O/S, find out what the equivalent is.)

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

What I can do

  • Full Member
  • ***
  • Posts: 167
Re: Lazarus 4.0 and INT3 gets skipped over
« Reply #2 on: May 22, 2025, 06:21:54 am »
Thanks for the reply 440bx (440bx is that referred to Radio Shack head phones)
I made the changes but still just skips over the INT3. I was using Lazarus 3.8 last week but just upgraded to 4.0. Does this new version support INT3

Khrys

  • Full Member
  • ***
  • Posts: 243
Re: Lazarus 4.0 and INT3 gets skipped over
« Reply #3 on: May 22, 2025, 06:52:19 am »
You could also switch to the GDB backend (Tools → Options → Debugger → Debugger backend → Drop-down at the top → Gdb [GNU debugger (gdb)]).
FpDebug  has only recently replaced GDB as the default backend; it's written in Pascal and provides better language support, but apart from that GDB still works just fine.

440bx

  • Hero Member
  • *****
  • Posts: 5479
Re: Lazarus 4.0 and INT3 gets skipped over
« Reply #4 on: May 22, 2025, 07:08:44 am »
Thanks for the reply 440bx (440bx is that referred to Radio Shack head phones)
I made the changes but still just skips over the INT3. I was using Lazarus 3.8 last week but just upgraded to 4.0. Does this new version support INT3
It certainly does.  I use it all the time.  (440bx is an intel chipset that was my favorite for a very long time, it was a really good chipset.)

Post a screenshot of your debugger backend screen.  Refer to the attachment, that's the window I want you to post a screenshot of.



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

What I can do

  • Full Member
  • ***
  • Posts: 167
Re: Lazarus 4.0 and INT3 gets skipped over
« Reply #5 on: May 22, 2025, 07:30:39 am »
Thanks 440bx,
I don't know how to paste an image in here.
none of the icons paste an image and ctrl+V doesn't work.
let me attach as a file...
its a open office word file.
nope sorry can upload that type of file
lets try a jpg
« Last Edit: May 22, 2025, 07:36:26 am by What I can do »

440bx

  • Hero Member
  • *****
  • Posts: 5479
Re: Lazarus 4.0 and INT3 gets skipped over
« Reply #6 on: May 22, 2025, 07:35:27 am »
below the box where you type the text you see "Attachments and other options", click on that then, click on the "Choose File" button to choose a file. 


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

What I can do

  • Full Member
  • ***
  • Posts: 167
Re: Lazarus 4.0 and INT3 gets skipped over
« Reply #7 on: May 22, 2025, 07:40:15 am »
I don't know it the matters but I have been trying all kinds of stuff..

440bx

  • Hero Member
  • *****
  • Posts: 5479
Re: Lazarus 4.0 and INT3 gets skipped over
« Reply #8 on: May 22, 2025, 08:19:28 am »
I'll make this very simple for you:

1. get rid of all the stuff you've tried.  Put Lazarus' configuration exactly as it was "out of the box"
2. Post the screenshot I asked for.

When those 2 steps are done, the solution will be at hand.
(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: Lazarus 4.0 and INT3 gets skipped over
« Reply #9 on: May 22, 2025, 08:51:48 am »
There is no (intentional) change between 3.n and 4.0 regarding int3.

Mind that it only works with int3, but not "int 3" (no space allowed). But then your post shows the correct int3 (and DebugBreak also has int3).

Unlikely, but make sure in "project options" that you haven't chosen a project specific debugger backend. If you have then the global settings have no effect. (There is a debugger page in the upper half of the "project options" dialog). It should say in red "using IDE settings" or similar)



int3 should always break (if enabled by HandleDebugBreakInstruction). Even if you compile with optimization or forgot debug info.

Well, not if you run in "release build mode", because then the app is not started under a debugger.

Make sure the run menu has the entries
- run
- run without debugger

then the first one will run in the debugger.

If the 2nd is missing, or the 2nd says "run with debugger" then the normal "run" might not start the debugger.

You can also check by setting a normal breakpoint and make sure that it works.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8437
Re: Lazarus 4.0 and INT3 gets skipped over
« Reply #10 on: May 22, 2025, 09:18:40 am »
fpc 3.2.2 Lazarus 4.0
I was trying to get the INT3 to trigger a IDE break point, but so far it always gets skipped over.

Xref to https://forum.lazarus.freepascal.org/index.php/topic,71124.msg554753.html#msg554753

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

What I can do

  • Full Member
  • ***
  • Posts: 167
Re: Lazarus 4.0 and INT3 gets skipped over
« Reply #11 on: May 22, 2025, 02:44:26 pm »
yes, "[dboIgnoreAll]" worked
thank you
440bx, Martin_fr, MarkMLl

 

TinyPortal © 2005-2018