Difference between revisions of "Compile without debug information"

From Free Pascal wiki
Jump to navigationJump to search
(Created page with "Q: I can't find the option to compile without debug information. How can I compile without debug information? A-1, from forum user ''howardpc'': User "Project -> Project Opt...")
 
m (Categorise page)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
Q: I can't find the option to compile without debug information. How can I compile without debug information?
 
Q: I can't find the option to compile without debug information. How can I compile without debug information?
 +
 +
----
  
 
A-1, from forum user ''howardpc'':
 
A-1, from forum user ''howardpc'':
Line 5: Line 7:
 
User "Project -> Project Options...". In the "Options for Project: xxx" dialog click the "Debugging" node under "Compiler Options" in the tree-view on the left.
 
User "Project -> Project Options...". In the "Options for Project: xxx" dialog click the "Debugging" node under "Compiler Options" in the tree-view on the left.
 
Then uncheck the "Generate info for the debugger (slower / increases exe-size)" checkbox.
 
Then uncheck the "Generate info for the debugger (slower / increases exe-size)" checkbox.
 +
 +
----
  
 
A-2, from forum user ''Martin_fr'':
 
A-2, from forum user ''Martin_fr'':
Line 11: Line 15:
 
And many package also mix in the "Configure build IDE" options.
 
And many package also mix in the "Configure build IDE" options.
  
You can use "Additions and overwrites" (in the "Project Options") to make changes.
+
You can use "Additions and Overrides" in the "Project Options" to make changes.
 
This also allows to re-compile packages with more/less optimization and/or with/without range/stack/overflow-checks etc.
 
This also allows to re-compile packages with more/less optimization and/or with/without range/stack/overflow-checks etc.
  
Line 19: Line 23:
  
 
On top of that, note that your app always carries RTTI (well almost always...). So if you use a hex viewer you will still find some names from your source code. But that is not debug info.
 
On top of that, note that your app always carries RTTI (well almost always...). So if you use a hex viewer you will still find some names from your source code. But that is not debug info.
 +
 +
----
 +
 +
A-3, from forum user ''Soner'':
 +
 +
You can also create external debug file, then you have debug information if you need it and to have a small application file. Look at the picture, screenshot is from IDE menu "Project > Project Options".
 +
 +
[[File:ide_external_debug_info.jpg]]
 +
 +
 +
[[Category:FPC]]
 +
[[Category:Lazarus]]
 +
[[Category:Debugging]]

Latest revision as of 13:29, 28 May 2022

Q: I can't find the option to compile without debug information. How can I compile without debug information?


A-1, from forum user howardpc:

User "Project -> Project Options...". In the "Options for Project: xxx" dialog click the "Debugging" node under "Compiler Options" in the tree-view on the left. Then uncheck the "Generate info for the debugger (slower / increases exe-size)" checkbox.


A-2, from forum user Martin_fr:

This affects only your project. If packages (LCL or other) are compiled with debug info, then that does not change => each package has it's own setting. And many package also mix in the "Configure build IDE" options.

You can use "Additions and Overrides" in the "Project Options" to make changes. This also allows to re-compile packages with more/less optimization and/or with/without range/stack/overflow-checks etc.

Note: The RTL (and FCL) are pre-build. The installers that come with Lazarus usually does install them without debug info. The IDE has no method to rebuild them. To change those (well you do likely not need, since they should match your requirements) you would need to rebuild them from the command line. See buildfaq.

Some function names may be left in the exe, even if debug info is switched off (IIRC that happens while linking, but not sure) => just use "strip.exe" on the your compiled exe.

On top of that, note that your app always carries RTTI (well almost always...). So if you use a hex viewer you will still find some names from your source code. But that is not debug info.


A-3, from forum user Soner:

You can also create external debug file, then you have debug information if you need it and to have a small application file. Look at the picture, screenshot is from IDE menu "Project > Project Options".

ide external debug info.jpg