Forum > Debugger
Lazarus crash trying this simple code
(1/1)
kaedusoft:
This simple code makes Lazarus Debugger crash:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program project1; function readNumber(): boolean;var c: char; text: string[60]; begin write('Type a value: '); readln(text); if text= '' then begin result:= false; exit; end; for c in text do begin if (c < '0') or (c > '9') then begin result:= false; exit; end; end; result:= true;end; begin while not readNumber() do begin write('ERROR: '); end; readln; end.
I attach a screencapture.
The code compiles well and the exe file runs correctly.
This is a 64 bits Lazarus version on Win10 64 bits.
I don't know what is the problem.
Martin_fr:
The error message means the debugger has problems to start up.
There are various reasons why that may be...
But before that, Lazarus comes with 2 debuggers:
- the older gdb based (that you are using)
- the newer "FpDebug", that you could set in menu: Tools > Options: Debugger > Debugger Backend
Anyway with the gdb based debugger
1) In Project > Project Options: check under Compiler > Debug, that you have "generate debug info" enabled, and set to "dwarf 2 with sets"
When using GDB, do not use "Dwarf 3"
2) Have you saved the project? Does the full path (all containing folders/dirs and the project name) contain spaces or chars other than a-z,0-9,_ ? GDB can get confused.
If you need gdb, then you can also try to download an alternative version of gdb
https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2064%20bits/Alternative%20GDB/
Unfortunately there is no single good gdb. Each can have diff issues, or work real good.
In any case, most likely you will be best off if you switch to FpDebug (and then you can use Dwarf3, but other Dwarf are fine too)
Bogen85:
--- Quote from: kaedusoft on February 16, 2023, 09:56:18 pm ---This simple code makes Lazarus Debugger crash: <snip, the code seems fine>
I attach a screencapture.
The code compiles well and the exe file runs correctly.
This is a 64 bits Lazarus version on Win10 64 bits.
I don't know what is the problem.
--- End quote ---
Are you able to debug other programs in Lazarus with GDB? I executed all paths of your program (not in GDB), including lines < 60 characters and lines > 60 characters (they get clipped at 60), it seems fine.
kaedusoft:
--- Quote from: Martin_fr on February 16, 2023, 10:29:44 pm ---The error message means the debugger has problems to start up.
There are various reasons why that may be...
But before that, Lazarus comes with 2 debuggers:
- the older gdb based (that you are using)
- the newer "FpDebug", that you could set in menu: Tools > Options: Debugger > Debugger Backend
Anyway with the gdb based debugger
1) In Project > Project Options: check under Compiler > Debug, that you have "generate debug info" enabled, and set to "dwarf 2 with sets"
When using GDB, do not use "Dwarf 3"
2) Have you saved the project? Does the full path (all containing folders/dirs and the project name) contain spaces or chars other than a-z,0-9,_ ? GDB can get confused.
If you need gdb, then you can also try to download an alternative version of gdb
https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2064%20bits/Alternative%20GDB/
Unfortunately there is no single good gdb. Each can have diff issues, or work real good.
In any case, most likely you will be best off if you switch to FpDebug (and then you can use Dwarf3, but other Dwarf are fine too)
--- End quote ---
Thanks, I changed to fpDebug and works fine.
Navigation
[0] Message Index