Recent

Author Topic: How can I step into every line of source code available?  (Read 3379 times)

df171422

  • Newbie
  • Posts: 2
How can I step into every line of source code available?
« on: December 19, 2015, 10:39:32 pm »
I don't care if the source code belongs to fpc, lazarus, a third-party, or me.  I'd like to be able to step over it if want to, or step into it if I want or need to.  This is a dev box so I don't really care how fat any .exe is on it.

Win 7 x64, fpc 3.0.0 bootstrap, fpc 3.1.1 and lazarus 1.7 trunks 2015-12-19

I have a great script I got from the forums that gets the trunks from svn and builds fpc and lazarus from source.  For good measure before I run it I recursively delete the fpc, lazarus, and appdata/local folders so there's no residue.  I've tried so many things good or bad, but right now for fpc it boils down to:

Code: Pascal  [Select][+][-]
  1. make all OPT="-O1 -gl -g"

and for lazarus it's:

Code: Pascal  [Select][+][-]
  1. make bigide OPT="-O1 -gl -g"
.

From within the IDE I've tried compiling and installing every package I can find like this:

http://imageshack.com/a/img910/2553/Qetqi3.png
http://imageshack.com/a/img905/228/YSIVGK.png

And for an example, I'm trying to step into TSQLQuery.FieldByName().AsString:

Code: Pascal  [Select][+][-]
  1. TMainForm = class(TForm)
  2.   Button1: TButton;
  3.   Query: TSQLQuery;
  4.  
  5. ...
  6.  
  7. procedure TMainForm.Button1Click(Sender: TObject);
  8. var
  9.   vName: string;
  10. begin
  11.   vName:=Query.FieldByName('Name').AsString;
  12.   ShowMessage(vName);
  13. end;
  14.  

I put the ShowMessage() there just to make sure vName isn't getting optimized out, eliminating the need for the ...AsString line altogether.  Alt+Up Arrow brings be to the code I'm interested in stepping into, but for the life of me I can't figure out how to get the debugger there.

Can anyone help me out with this?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12345
  • Debugger - SynEdit - and more
    • wiki
Re: How can I step into every line of source code available?
« Reply #1 on: December 20, 2015, 01:13:56 am »
for fpc I use (dwarf), some may not be needed
Code: Pascal  [Select][+][-]
  1. make.exe all LINKSMART=1  CREATESMART=1  DEBUG=1 OPTIMIZE=0  OPT="-gl -gw -godwarfsets -O-1"

Lazarus IDE I build from within.
"Tools" / "Configure build lazarus"
Options "-gl -gw -godwarfsets -O-1"

Also open package FCL (nearly all packages depend an it), and edit its options:
"Package Options" / "Usage", in memo "Custom" add $(IDEBuildOptions)

"Usage" means: any package that uses (direct or inderect) this package, gets those options.


df171422

  • Newbie
  • Posts: 2
Re: How can I step into every line of source code available?
« Reply #2 on: December 31, 2015, 12:00:04 am »
Thanks a bunch.  I have this working consistently now.  I implemented the changes you suggested with these tweaks:

- In the OPT= parameter I think you meant -O1.  This is what I'm using.
- I'm using your basic make all for FPC and make bigide for Lazarus in the script.

I also noticed that Lazarus found and used FPC source code in a subfolder in my downloads folder.  I unzipped this just to look at it and really meant to delete the folder.  Here I pointed it to the correct folder:

http://imageshack.com/a/img903/6935/85uuBT.png

I have no idea which of these changes made the IDE work like I wanted, maybe several or all of them.

I hope this helps anyone who is trying to step through the code like me.

 

TinyPortal © 2005-2018