Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2008-01

A Compiled file size solution from the GBD mailing-list

11 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marco van de Voort
to Fabio Dell'Aria
Show quoted text 9 lines
I have asked to the official GDB mailing list, if is possible debug a program using as debug symbols an external files. The answer is yes (there are two method to do this). You can read the full answer here: http://sourceware.org/ml/gdb/2008-01/msg00119.html I hope this can help we.

Did you test it?

(gdb) help symbol
Load symbol table from executable file FILE.
The `file' command can also load symbol tables, as well as setting the file to execute.
(gdb)

from _EXECUTABLE_ file FILE, iow you still need the unstripped exe.

It's like calling

copy file1.exe file-debug.exe
strip file1.exe

and then pass file-debug.exe to gdb also.

Reply by email

Fabio Dell'Aria
to Marco van de Voort

Hi,

2008/1/16, Marco van de Voort :

Show quoted text 26 lines
> I have asked to the official GDB mailing list, if is possible debug a > program using as debug symbols an external files. > > The answer is yes (there are two method to do this). > > You can read the full answer here: > http://sourceware.org/ml/gdb/2008-01/msg00119.html > > I hope this can help we. Did you test it? (gdb) help symbol Load symbol table from executable file FILE. The `file' command can also load symbol tables, as well as setting the file to execute. (gdb) from _EXECUTABLE_ file FILE, iow you still need the unstripped exe. It's like calling copy file1.exe file-debug.exe strip file1.exe and then pass file-debug.exe to gdb also.

Why not simple add a new FPC option able to store the debug symbols in a separated .dbg file?

Best regards... Fabio Dell'Aria.

Reply by email

Peter Vreman
to Micha Nelissen
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. (gdb)

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.

Peter
Peter

Reply by email

Michael Van Canneyt
to Peter Vreman
Peter Vreman wrote 12 lines
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.

[cut]

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

Didn't we receive a patch from the Morfik people which did exactly this ? I remember that we had an email-conversation about it, and I also seem to remember applying a patch ?

Michael.

Reply by email

Peter Vreman
to Michael Van Canneyt
you wrote 24 lines
On Wed, 16 Jan 2008, Peter Vreman wrote: > 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. > [cut] > > And as a final note: Yes, it is possible to fix fpc to write such a .dbg file > also. Didn't we receive a patch from the Morfik people which did exactly this ? I remember that we had an email-conversation about it, and I also seem to remember applying a patch ?

There was already a quick hack added with the -Xg option to create a separate .dbg file. But the contents of this file is not good for gdb. We need to rewrite this part to be compatible with gdb and other gnu tools.

Peter

Reply by email

Bogusław Brandys
to Michael Van Canneyt: [cut] Didn't we receive a patch from the Morfik people which did exactly this ? I…
Michael Van Canneyt wrote 23 lines
On Wed, 16 Jan 2008, Peter Vreman wrote: > 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. > [cut] > And as a final note: Yes, it is possible to fix fpc to write such a .dbg file > also. Didn't we receive a patch from the Morfik people which did exactly this ? I remember that we had an email-conversation about it, and I also seem to remember applying a patch ? Michael.

Could stack trace generation also have ability to use such .dbg file to create full stack trace instead of addresses only for stripped executable ? It would be similar to the C++ behavior.

Regards
Boguslaw

Reply by email

Peter Vreman
to Bogusław Brandys
you wrote 25 lines
Michael Van Canneyt wrote: >On Wed, 16 Jan 2008, Peter Vreman wrote: > >>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. >[cut] >>And as a final note: Yes, it is possible to fix fpc to write such >>a .dbg file >>also. >Didn't we receive a patch from the Morfik people which did exactly >this ? I remember that we had an email-conversation about it, and I also >seem to remember applying a patch ? >Michael. Could stack trace generation also have ability to use such .dbg file to create full stack trace instead of addresses only for stripped executable ? It would be similar to the C++ behavior.

This can be added and should not be to hard. See rtl/inc/lineinfo.pp and rtl/inc/lnfodwrf.pp.
Patches are welcome :)

Peter

Reply by email

Peter Vreman
to Peter Vreman: There was already a quick hack added with the -Xg option to create a separate .dbg file.…
you wrote 32 lines
At 21:32 16-1-2008, you wrote: >On Wed, 16 Jan 2008, Peter Vreman wrote: > > > 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. > > >[cut] > > > > And as a final note: Yes, it is possible to fix fpc to write > such a .dbg file > > also. > >Didn't we receive a patch from the Morfik people which did exactly this ? >I remember that we had an email-conversation about it, and I also >seem to remember applying a patch ? There was already a quick hack added with the -Xg option to create a separate .dbg file. But the contents of this file is not good for gdb. We need to rewrite this part to be compatible with gdb and other gnu tools.

Support for a separate .dbg file is now available for windows in current svn trunk with the -Xg option. No need anymore for "objcopy --only-keep-debug && objcopy --add-debug-link && strip" under windows. The external linker (e.g. linux) still be updated to support objcopy and strip when -Xg is passed.

Peter

Reply by email

Fabio Dell'Aria
to Peter Vreman

Hi,

2008/1/17, Peter Vreman :

Show quoted text 42 lines
At 22:25 16-1-2008, you wrote: >At 21:32 16-1-2008, you wrote: > > >>On Wed, 16 Jan 2008, Peter Vreman wrote: >> >> > 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. >> > >>[cut] >> > >> > And as a final note: Yes, it is possible to fix fpc to write >> such a .dbg file >> > also. >> >>Didn't we receive a patch from the Morfik people which did exactly this ? >>I remember that we had an email-conversation about it, and I also >>seem to remember applying a patch ? > >There was already a quick hack added with the -Xg option to create a >separate .dbg file. But the contents of this file is not good for >gdb. We need to rewrite this part to be compatible with gdb and >other gnu tools. Support for a separate .dbg file is now available for windows in current svn trunk with the -Xg option. No need anymore for "objcopy --only-keep-debug && objcopy --add-debug-link && strip" under windows. The external linker (e.g. linux) still be updated to support objcopy and strip when -Xg is passed. Peter

I have just try on Windows with objcopy (I have ownloaded it from the mingw binutils binaries) and works like a charm.

The -Xg flag do not works. GDB tell me: "not found symbols".

PS: why do not add objcopy to the FPC bin folder?

Best regards... Fabio Dell'Aria.

Reply by email