* * *

Author Topic: Why is Lazarus showing the Assembler window when debugging?  (Read 4096 times)

ricardo_sdl

  • New member
  • *
  • Posts: 19
Why is Lazarus showing the Assembler window when debugging?
« on: August 16, 2018, 07:37:01 pm »
I usually press F8 to start a debug session on lazarus. I'm used to the debugger starting right at the first command after the begin in the program unit. But I don't know why, now Lazarus shows the Assembler window at the _mainCRTStartup symbol (image attached). Is this some configuration?
Thanks!

ps: Forgot my setup:
Lazarus 1.8.0 r56594 FPC 3.0.4 x86_64-win64-win32/win64

taazz

  • Hero Member
  • *****
  • Posts: 5337
Re: Why is Lazarus showing the Assembler window when debugging?
« Reply #1 on: August 16, 2018, 07:40:49 pm »
os? compilation target? in short, if you are on windows looks like you might have by accident or over-site disabled the win32 gui application option creating a console application instead.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

ricardo_sdl

  • New member
  • *
  • Posts: 19
Re: Why is Lazarus showing the Assembler window when debugging?
« Reply #2 on: August 16, 2018, 07:44:20 pm »
It's a command line application.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4810
    • wiki
Re: Why is Lazarus showing the Assembler window when debugging?
« Reply #3 on: August 16, 2018, 09:13:32 pm »
Can you test with an "empty" app?
Code: Pascal  [Select]
  1. program Project1;
  2. {$mode objfpc}{$H+}
  3. begin
  4.   writeln(1);
  5.   readln;
  6. end.
  7.  

Also test with stabs and Dwarf (debug info type / project options)

This works for me (tested with Lazarus from SVN, but I think it should be the same with 1.8.4.

I know this was not always working. But I am not sure when it was fixed.

You can play around with the setting "InternalStartBreak" found in the property grid under Tools > Option > Debugger > General.
Though for me it made no difference. (except MainAddr stops at the "begin" instead of the "writeln")

---
If it works for the above empty app, but not for your app, then please supply a log file http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session


ricardo_sdl

  • New member
  • *
  • Posts: 19
Re: Why is Lazarus showing the Assembler window when debugging?
« Reply #4 on: August 17, 2018, 03:22:21 am »
Can you test with an "empty" app?
Code: Pascal  [Select]
  1. program Project1;
  2. {$mode objfpc}{$H+}
  3. begin
  4.   writeln(1);
  5.   readln;
  6. end.
  7.  

Also test with stabs and Dwarf (debug info type / project options)

This works for me (tested with Lazarus from SVN, but I think it should be the same with 1.8.4.

I know this was not always working. But I am not sure when it was fixed.

You can play around with the setting "InternalStartBreak" found in the property grid under Tools > Option > Debugger > General.
Though for me it made no difference. (except MainAddr stops at the "begin" instead of the "writeln")

---
If it works for the above empty app, but not for your app, then please supply a log file http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session

That's strange. I tried your example of "empty app" and using F8 worked as I expected. Then I reloaded my project and the F8 worked fine, the break point was right at the begin keyword. I haven't changed anything. Anyway, here is the log file as suggested (https://pastebin.com/BXSHFpC9).

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4810
    • wiki
Re: Why is Lazarus showing the Assembler window when debugging?
« Reply #5 on: August 17, 2018, 04:24:07 am »
The logfile is only of interest when it does not work.

The problem could be caused by a library that is loaded in your app. (maybe only conditionally / E.g., in GUI apps (not your case) the openfile dialog loads lots of dll)

The debugger relies on debug info, and does not parse your sources to find the first line. So it needs to find the unit and line in a different way.
It looks for the symbol "main" which fpc places in your exe.
However sometimes libraries also define this. Then the debugger may not be able to tell for sure.
IIRC the debugger may remember dll from the previous run (not sure though). If it does a conditionally loaded dll could cause that (but would not on the first run).

If the problem re-occurs, after recording the log, try resetting the debugger (there is an option to do that after each run).

Thaddy

  • Hero Member
  • *****
  • Posts: 6904
Re: Why is Lazarus showing the Assembler window when debugging?
« Reply #6 on: August 17, 2018, 11:11:52 am »
If the asm window shows, you are usually in a mode with higher optimization settings. (above -O2) There is no way around that.
During debugging, make sure optimizations are turned off or at most -O2. Also include line info and use heaptrace (-glh).
In Lazarus all these options can be set under the compiler options.
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

ricardo_sdl

  • New member
  • *
  • Posts: 19
Re: Why is Lazarus showing the Assembler window when debugging?
« Reply #7 on: August 17, 2018, 06:52:35 pm »
If the asm window shows, you are usually in a mode with higher optimization settings. (above -O2) There is no way around that.
During debugging, make sure optimizations are turned off or at most -O2. Also include line info and use heaptrace (-glh).
In Lazarus all these options can be set under the compiler options.

My configuration is set to -O1.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus