Recent

Author Topic: Can't debug with READLN & WRITELN ???  (Read 14597 times)

xaero

  • New member
  • *
  • Posts: 9
Can't debug with READLN & WRITELN ???
« on: May 26, 2010, 09:20:52 am »
Quote
program demo;
var
    i,n:integer;
begin
    readln(n);
    for i:=1 to n do
        writeln(i);
    readln;
end.

when I press F8 (RUN menu --> step over) ,Lazarus display a “assmbler” window!(SEE THE gif blew)
how to step over "READLN(n) and debug it"?
windows xp sp3 + lazarus 0.9.28.2 with all default settings
« Last Edit: May 26, 2010, 09:23:41 am by xaero »

Troodon

  • Sr. Member
  • ****
  • Posts: 484
Re: Can't debug with READLN & WRITELN ???
« Reply #1 on: May 26, 2010, 10:05:29 am »
Is that a console application? You cannot write in program in traditional Pascal, it has to be a Lazarus/FPC console application.
« Last Edit: May 26, 2010, 10:07:18 am by Troodon »
Lazarus/FPC on Linux

xaero

  • New member
  • *
  • Posts: 9
Re: Can't debug with READLN & WRITELN ???
« Reply #2 on: May 27, 2010, 01:12:01 am »
Yes ,it is a console application

what's your mean?


bobo

  • Full Member
  • ***
  • Posts: 171
Re: Can't debug with READLN & WRITELN ???
« Reply #3 on: May 27, 2010, 02:02:38 am »
You should download gdb (7.0+) and set it up in Lazarus (Environment -> Options -> Debugger .

xaero

  • New member
  • *
  • Posts: 9
Re: Can't debug with READLN & WRITELN ???
« Reply #4 on: May 27, 2010, 04:16:20 am »
You should download gdb (7.0+) and set it up in Lazarus (Environment -> Options -> Debugger .

with gdb 7.1 ~~ still got the problem!

Leledumbo

  • Hero Member
  • *****
  • Posts: 8831
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Can't debug with READLN & WRITELN ???
« Reply #5 on: May 27, 2010, 05:45:30 am »
@Troodon:
I don't think it would have any effect either you choose pure program or lazarus console application.

@Xaero:
Are you sure you're stepping over instead of stepping in? Well, I never use lazarus to debug console apps, but this shouldn't happen.

xaero

  • New member
  • *
  • Posts: 9
Re: Can't debug with READLN & WRITELN ???
« Reply #6 on: May 27, 2010, 07:28:17 pm »
I'm sure i press F8, not F7!

Here's my steps:
1. PROJECT menu --> New Project
2. choose "custom program"
3. enter the following code, and save the project as demo.lpi:
Code: [Select]
program demo;
var
    i,n:integer;
begin
    readln(n);
    for i:=1 to n do
        writeln(i);
    readln;
end.

4. press f8, lazarus set a gray line under the "begin" (see gif blew), then I continue to press f8, lazarus got the error as the above mentioned.
« Last Edit: May 27, 2010, 07:31:53 pm by xaero »

DSav

  • Newbie
  • Posts: 1
Re: Can't debug with READLN & WRITELN ???
« Reply #7 on: June 03, 2010, 12:30:59 pm »
Have got absolutely the same problem.
lazarus-0.9.28-fpc-2.2.4-win32

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2663
Re: Can't debug with READLN & WRITELN ???
« Reply #8 on: June 06, 2010, 09:59:19 am »
The lazarus debugger currently doesn't support cmdline applications
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

ryanhaynes

  • Newbie
  • Posts: 1
Re: Can't debug with READLN & WRITELN ???
« Reply #9 on: September 12, 2010, 03:23:22 am »
I don't know if this thread is closed since it is several months back but I am having the same issue with console-app debugging Lazarus. I should note that the program written above can be debugged if the lines readln; and writeln(''); are added to the top of the console application (there may be another fix but this is what I tried). When debugging the original program (without the fix) in gdb it works fine. So this has to be a simple bug in the Lazarus IDE right? Why can't Lazarus debug a console app if gdb can? Please let me know if I'm missing something.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4632
  • I like bugs.
Re: Can't debug with READLN & WRITELN ???
« Reply #10 on: September 12, 2010, 09:04:30 am »
With Lazarus trunk 0.9.29, on Linux, I can debug console apps without problems.
Lazarus should be started from command line itself so that writeln() output goes to the same window.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018