Recent

Author Topic: Unable To Step Into Writeln Using F7  (Read 2909 times)

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2620
Re: Unable To Step Into Writeln Using F7
« Reply #15 on: January 10, 2025, 09:09:45 am »
I asked chatGPT and this was generated. Is this correct:
Code: Pascal  [Select][+][-]
  1. make clean all OPT="-g -dDEBUG"

IIRC it looks ok
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

TRon

  • Hero Member
  • *****
  • Posts: 3750
Re: Unable To Step Into Writeln Using F7
« Reply #16 on: January 10, 2025, 12:42:34 pm »
I asked chatGPT and this was generated. Is this correct:
Code: Pascal  [Select][+][-]
  1. make clean all OPT="-g -dDEBUG"
Sorry, I missed that question.

Yes that is ok.

Note that you need a 3.2.0 bootstrap compiler to build the 3.2.2 compiler (option PP=/path/to/ppcXXX/exe or FPC=/path/to/fpc/exe)
I do not have to remember anything anymore thanks to total-recall.

Aruna

  • Hero Member
  • *****
  • Posts: 568
Re: Unable To Step Into Writeln Using F7
« Reply #17 on: January 10, 2025, 12:55:00 pm »
I asked chatGPT and this was generated. Is this correct:
Code: Pascal  [Select][+][-]
  1. make clean all OPT="-g -dDEBUG"

IIRC it looks ok
Thank you @Marc, I gave it a go and it did not take a long time as you  can see below:
Code: Pascal  [Select][+][-]
  1. aruna@debian:/usr/share/fpcsrc/3.2.2$ time sudo make clean all OPT="-g -dDEBUG" 2>&1 | tee /tmp/output.txt
  2.  
  3. <snip> ...
  4. <snip> // just too much make output info to post here I will attatch a text file
  5. <snip> ...
  6. make[1]: *** [Makefile:2800: compiler_cycle] Error 2
  7. make[1]: Leaving directory '/usr/share/fpcsrc/3.2.2'
  8. make: *** [Makefile:2832: build-stamp.x86_64-linux] Error 2
  9.  
  10. real    2m58.461s
  11. user    2m34.755s
  12. sys     0m13.657s
  13.  
So it took almost 3 minutes which is fine and works for me. Just to be sure then I ran:

sudo make install and that took:
Code: Pascal  [Select][+][-]
  1. make[3]: Leaving directory '/usr/share/fpcsrc/3.2.2/utils'
  2. make[2]: Leaving directory '/usr/share/fpcsrc/3.2.2'
  3. make[1]: Leaving directory '/usr/share/fpcsrc/3.2.2'
  4.  
  5. real    0m16.271s
  6. user    0m0.578s
  7. sys     0m2.185s

Then Just to be sure I ran this:
Code: Pascal  [Select][+][-]
  1. aruna@debian:/usr/share/fpcsrc/3.2.2$ file /usr/bin/fpc
  2. /usr/bin/fpc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, for GNU/Linux 2.4.0, stripped
Which still shows my compiler has debug info/symbols stripped. So I am very confused now :(

I have attached two text files. output.txt contains the make debug version stuff and installoutput.txt has the make install stuff.


Aruna

  • Hero Member
  • *****
  • Posts: 568
Re: Unable To Step Into Writeln Using F7
« Reply #18 on: January 10, 2025, 12:59:16 pm »
I asked chatGPT and this was generated. Is this correct:
Code: Pascal  [Select][+][-]
  1. make clean all OPT="-g -dDEBUG"
Sorry, I missed that question.

Yes that is ok.

Note that you need a 3.2.0 bootstrap compiler to build the 3.2.2 compiler (option PP=/path/to/ppcXXX/exe or FPC=/path/to/fpc/exe)

Hi @TRon, you mean like this:
Code: Pascal  [Select][+][-]
  1. make clean all OPT="-g -dDEBUG"  FPC=/path/to/fpc/exe

TRon

  • Hero Member
  • *****
  • Posts: 3750
Re: Unable To Step Into Writeln Using F7
« Reply #19 on: January 10, 2025, 01:04:25 pm »
Hi @TRon, you mean like this:
Code: Pascal  [Select][+][-]
  1. make clean all OPT="-g -dDEBUG"  FPC=/path/to/fpc/exe
Yes, like that (actually is FPC="/path/and/name/to/fpc/exe"). Though I personally prefer
Code: Pascal  [Select][+][-]
  1. make clean all OPT="-g -dDEBUG"  PP=/path/and/name/to/ppcXX/exe
because the former requires to have a working 3.2.0 setup while the second requires only the ppcXXX executable.

For the purists amongst us reading this: yes I am aware that you can use FPC to point to the PP executable but my OCD prevents me from advertising it  :)
I do not have to remember anything anymore thanks to total-recall.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10651
  • Debugger - SynEdit - and more
    • wiki
Re: Unable To Step Into Writeln Using F7
« Reply #20 on: January 10, 2025, 01:08:11 pm »
If you are an Windows, and using FpDebug in Lazarus you want to use  -gw3

If you use gdb for some reason, you likely want -gw2 -godwarfsets  (though some versions of gdb may be ok with -gw3 especially if you use fpc fixes or trunk)

If you are on Linux, the same applies. However, if you use -gw3 you may be forced to use this for all/any package and project that has debug info, otherwise you may get linker errors, when building your project. Equally on Linux if you use -gw2 then you may need to use that every where else. Actually the  dependency exists in one direction only, and I am not sure which one. (Using just -g is translated by the compiler to either -gw2 or -gw3 / depends...).


Also, write and writeln are compiler intrinsics. They aren't functions You can't step into them, but you will be able to step into some of the functions from which the compiler builds them. However, what you actually want to step in is the "format" function. And that will work.

Thaddy

  • Hero Member
  • *****
  • Posts: 16305
  • Censorship about opinions does not belong here.
Re: Unable To Step Into Writeln Using F7
« Reply #21 on: January 10, 2025, 01:12:01 pm »
Almost:OPT="-glh -dDEBUG" would work, adds line info and heaptrace.
If I smell bad code it usually is bad code and that includes my own code.

TRon

  • Hero Member
  • *****
  • Posts: 3750
Re: Unable To Step Into Writeln Using F7
« Reply #22 on: January 10, 2025, 01:15:22 pm »
Thank you for the additional information Martin_fr because you are ofc. right.

I usually don't consider the debugger used but fpDebug is a very nice upgrade (getting better each release with your additions)
I do not have to remember anything anymore thanks to total-recall.

Aruna

  • Hero Member
  • *****
  • Posts: 568
Re: Unable To Step Into Writeln Using F7
« Reply #23 on: January 10, 2025, 01:29:39 pm »
Hi @TRon, you mean like this:
Code: Pascal  [Select][+][-]
  1. make clean all OPT="-g -dDEBUG"  FPC=/path/to/fpc/exe
Yes, like that (actually is FPC="/path/and/name/to/fpc/exe"). Though I personally prefer
Code: Pascal  [Select][+][-]
  1. make clean all OPT="-g -dDEBUG"  PP=/path/and/name/to/ppcXX/exe
because the former requires to have a working 3.2.0 setup while the second requires only the ppcXXX executable.

For the purists amongst us reading this: yes I am aware that you can use FPC to point to the PP executable but my OCD prevents me from advertising it  :)
@Tron my archtiecture is x86_64 so do I need the ppc stuff? Or ?

Aruna

  • Hero Member
  • *****
  • Posts: 568
Re: Unable To Step Into Writeln Using F7
« Reply #24 on: January 10, 2025, 01:32:44 pm »
If you are an Windows, and using FpDebug in Lazarus you want to use  -gw3

If you use gdb for some reason, you likely want -gw2 -godwarfsets  (though some versions of gdb may be ok with -gw3 especially if you use fpc fixes or trunk)

If you are on Linux, the same applies. However, if you use -gw3 you may be forced to use this for all/any package and project that has debug info, otherwise you may get linker errors, when building your project. Equally on Linux if you use -gw2 then you may need to use that every where else. Actually the  dependency exists in one direction only, and I am not sure which one. (Using just -g is translated by the compiler to either -gw2 or -gw3 / depends...).


Also, write and writeln are compiler intrinsics. They aren't functions You can't step into them, but you will be able to step into some of the functions from which the compiler builds them. However, what you actually want to step in is the "format" function. And that will work.
  Hi @Martin_fr, I am using Linux, Debian and the system is x86_64. Why am I able to compile without errors but nothing changes in my install? My fpc remains stripped. What I am not doing correctly?

Aruna

  • Hero Member
  • *****
  • Posts: 568
Re: Unable To Step Into Writeln Using F7
« Reply #25 on: January 10, 2025, 01:39:57 pm »
Almost:OPT="-glh -dDEBUG" would work, adds line info and heaptrace.
Ah, this is very useful. Thank you @Thaddy ( Aruna wonders where these things are documnted?)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10651
  • Debugger - SynEdit - and more
    • wiki
Re: Unable To Step Into Writeln Using F7
« Reply #26 on: January 10, 2025, 01:45:47 pm »
While you should be able to get an "fpc" and "ppc...." with debug info (after you do "make install INSTALL_PREFIX=..." => it does not matter if you do.

You do not need those 2 files to have debug info.

You do need debug info in the RTL/FCL => those are the *.ppu or *.o files.

After you did "make"  your fpc, you need to install those files somewhere. (ideally using (IIRC) INSTALL_PREFIX).
You then need to create an fpc.cfg for those. There is a tool, but I need to look up the details myself.

And, since you are on linux, you most likely have /etc/fpc.cfg  (or maybe some other in your home dir)
And that will very likely be in the way.



fpcupdeluxe can help

It will create everything you need.

But, there still may be (likely "will be") other global files in the way.

fpcupdeluxe  creates special scripts (foo.sh) for lazarus (if you did build that too / you do NOT need to), and for fpc.

And if you configure the compiler in your lazarus IDE, then you need to point it to that very script. That script will contain additional command line params, making sure that your special fpc does not get confused by any other fpc install on your system).


Sorry for some of that being vague. I don't recall all the detail. I would have to search for them myself.


MarkMLl

  • Hero Member
  • *****
  • Posts: 8082
Re: Unable To Step Into Writeln Using F7
« Reply #27 on: January 10, 2025, 02:12:10 pm »
Almost:OPT="-glh -dDEBUG" would work, adds line info and heaptrace.
Ah, this is very useful. Thank you @Thaddy ( Aruna wonders where these things are documnted?)

In the Programmer's Guide circa https://www.freepascal.org/docs-html/current/prog/progap6.html#x327-343000F , but being able to read the (industry-standard) Makefile and having some minimal knowledge of the other (non-standard) build utilities is valuable.

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

Aruna

  • Hero Member
  • *****
  • Posts: 568
Re: Unable To Step Into Writeln Using F7
« Reply #28 on: January 11, 2025, 04:13:08 am »
Hello Everyone,

I just figured out why everything compiles with zero errors but my /usr/bin/fpc stays stripped. The make install goes and puts the compiler in /usr/local/bin/fpc:
Code: Pascal  [Select][+][-]
  1. aruna@debian:/usr/share/fpcsrc/3.2.2$ file  /usr/local/bin/fpc
  2. /usr/local/bin/fpc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, for GNU/Linux 2.4.0, with debug_info, not stripped

So now how do I get the lazarus IDE to use *this* compiler?

Hi Martin_fr thank you for pointing out there is a /etc/fpc.cfg and @MarkMLI many thanks for the link. It says make cycle? Is this still valid? I haven't tested it yet.  Been a rather long day I am dog tired but wanted to respond to you before grabbing some grub.



TRon

  • Hero Member
  • *****
  • Posts: 3750
Re: Unable To Step Into Writeln Using F7
« Reply #29 on: January 11, 2025, 04:31:08 am »
I just figured out why everything compiles with zero errors but my /usr/bin/fpc stays stripped. The make install goes and puts the compiler in /usr/local/bin/fpc:
A story for another time but wanted to mention that the compiler can be installed anywhere you choose to.

Quote
So now how do I get the lazarus IDE to use *this* compiler?
Lazarus IDE, menu, Tools, options, in tree select "files", at right there are options "compiler executable" and "FPC source directory"

Depending on what debug format chosen you also might want to have a look at tree "Debugger" (f.e. debugger backend etc)
« Last Edit: January 11, 2025, 04:32:40 am by TRon »
I do not have to remember anything anymore thanks to total-recall.

 

TinyPortal © 2005-2018