[fpc-devel] A Compiled file size solution from the GBD mailing-list

Peter Vreman peter at freepascal.org
Wed Jan 16 21:17:18 CET 2008

At 13:17 16-1-2008, you wrote:
>Marco van de Voort wrote:
>>from _EXECUTABLE_ file FILE, iow you still need the unstripped exe.
>Perhaps it doesn't need the .text, .data, .bss etc sections though.

I also posted this on Lazarus mailing list already.

Below are the 2 commands to make it working. In the first command 
only the debug information is kept in lazarus.dbg. And the second is 
the already know way to strip the debug information.

$ objcopy -R .text -R .data lazarus.exe lazarus.dbg
$ strip lazarus.exe

Resulting files:

-rwxr-xr-x 1 peter None 41551141 Jan 16 18:50 lazarus.dbg
-rwxrwxrwx 1 peter None  7610368 Jan 16 18:51 lazarus.exe

And for debugging:

$ gdb lazarus.exe
(gdb) br main
No symbol table is loaded.  Use the "file" command.
(gdb) symbol-file lazarus1.dbg
Reading symbols from /cygdrive/d/lazarus/lazarus.dbg...done.
(gdb) br main
Breakpoint 1 at 0x401bf9: file lazarus.pp, line 77.

There is some remark in the gdb docs that a file with .syms is loaded 
automatically. But i didn't get it working under windows with either 
lazarus.exe.syms or lazarus.syms.

And as a final note: Yes, it is possible to fix fpc to write such a 
.dbg file also.


More information about the fpc-devel mailing list