Sign in Join

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

Mailing lists / fpc-devel / 2008-04

Debugging FPC

13 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

Никита Баль

Hello.
When i try to run on the steps pp.pas, i get the following error
1) under Linux - "Project pp raised exception class 'Unknown'"
2) under Windows - "Project raised exception class 'External: SIGSEGV'". How to debug fpc?

Bal Nikita.

Reply by email

Jonas Maebe
to Никита Баль
Никита Баль wrote 5 lines
When i try to run on the steps pp.pas, i get the following error 1) under Linux - "Project pp raised exception class 'Unknown'" 2) under Windows - "Project raised exception class 'External: SIGSEGV'". How to debug fpc?

How are you trying to debug it? With gdb, lazarus, fp, ...? And what are the exact steps you are following?

Jonas

Reply by email

Никита Баль
to Jonas Maebe
Show quoted text 5 lines
How are you trying to debug it? With gdb, lazarus, fp, ...? And what are the exact steps you are following? Jonas

I compile fpc under Lazarus(+gdb) with following keys: -di386 -Fu../rtl/units/i386-win32 -FE. -FUi386/units/i386-win32 -dGDB -dBROWSERLOG _________________

("pp.pas")
...
begin
  oldexit:=exitproc;
  ;
{$ifdef extheaptrc}
  keepreleased:=true;
{$endif extheaptrc}

Halt(compiler.Compile('')); <- on this line i get exception. and i can't step into compiler.Compile('')
end.

Reply by email

Jonas Maebe
to Никита Баль
Никита Баль wrote 21 lines
> How are you trying to debug it? With gdb, lazarus, fp, ...? And what > are the exact steps you are following? > I compile fpc under Lazarus(+gdb) with following keys: -di386 -Fu../rtl/units/i386-win32 -FE. -FUi386/units/i386-win32 - dGDB -dBROWSERLOG _________________ ("pp.pas") ... begin oldexit:=exitproc; ; {$ifdef extheaptrc} keepreleased:=true; {$endif extheaptrc} Halt(compiler.Compile('')); <- on this line i get exception. and i can't step into compiler.Compile('')

With which version of gdb? Which version of FPC did you compile, and with which version of FPC did you compile it? And with which command line options (the ones you show above don't include any debug generation information, so there must be more)?

Jonas

Reply by email

Никита Баль
to Jonas Maebe
Show quoted text 7 lines
With which version of gdb? Which version of FPC did you compile, and with which version of FPC did you compile it? And with which command line options (the ones you show above don't include any debug generation information, so there must be more)? Jonas

Lazarus version - 0.9.24 beta
FPC compiler version - 2.2.0 [2007/11/14] for i386 GDB version - 6.6
FPC sourse version - 2.2.0

When i changed command line
From:
-Fui386 -Fusystems -Fu../rtl/units/i386-win32 -Fii386 -FE. -FUi386/units/i386-win32 -di386 -dGDB -dBROWSERLOG -Fux86

To:
-di386 -Fu../rtl/units/i386-win32 -FE. -FUi386/units/i386-win32 -dGDB -dBROWSERLOG -gc -gd -gh -gl -gp -gt -gv -gw

error changed too.
new error: "Project pp raised exception class 'Unknown'"

P.S. Sorry for my english.

Reply by email

Jonas Maebe
to Никита Баль
Никита Баль wrote 22 lines
> With which version of gdb? Which version of FPC did you compile, and > with which version of FPC did you compile it? And with which command > line options (the ones you show above don't include any debug > generation information, so there must be more)? > Lazarus version - 0.9.24 beta FPC compiler version - 2.2.0 [2007/11/14] for i386 GDB version - 6.6 FPC sourse version - 2.2.0 When i changed command line From: -Fui386 -Fusystems -Fu../rtl/units/i386-win32 -Fii386 -FE. -FUi386/ units/i386-win32 -di386 -dGDB -dBROWSERLOG -Fux86 To: -di386 -Fu../rtl/units/i386-win32 -FE. -FUi386/units/i386-win32 - dGDB -dBROWSERLOG -gc -gd -gh -gl -gp -gt -gv -gw error changed too. new error: "Project pp raised exception class 'Unknown'"

That command line does not make sense. The compiler can only generate one kind of debug info at a time, while you are specifying three (-gd, -gv and -gw). Further, -gv does not generate info which is usable for debugging, but only for use with valgrind. You should use either -g or -gw (and not -gd; that switch has been removed from the current compiler versions).

See the manual or the compiler help pages for what the other switches mean. I don't know how well -gc and -gp work nowadays, so I'd leave those out as well.

Jonas

Reply by email

Jonas Maebe
to Никита Баль
Никита Баль wrote
with one only parameter -g, i also get this error.

I'm afraid I can't help you in that case. It works fine for me (under Linux and Mac OS X; I don't have access to Windows):

Starting program: /home/jmaebe/private/bin/ppn59 tw9766 -g -al

Breakpoint 1, 0x08048213 in main () at pp.pas:202
202 begin
(gdb) n
203 oldexit:=exitproc;
(gdb)
204 ;
(gdb)
209 Halt(compiler.Compile(''));
(gdb) s
COMPILE (CMD='') at compiler.pas:216
216 begin
(gdb) n
217 try

Jonas

Reply by email

Jonas Maebe
to Никита Баль
Никита Баль wrote
Thank you, i'll try under Linux. Can you tell me all list of command to gdb, which you call?

gdb ppn59 --directory=~/fpc/compiler/
GNU gdb Red Hat Linux (6.6-45.fc8rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"... Using host libthread_db library "/lib/libthread_db.so.1". (gdb) b PASCALMAIN
Breakpoint 1 at 0x8048213: file pp.pas, line 202.
(gdb) r
Starting program: /home/jmaebe/private/bin/ppn59

Breakpoint 1, 0x08048213 in main () at pp.pas:202
202 begin
(gdb) n
203 oldexit:=exitproc;
(gdb)
204 ;
(gdb)
209 Halt(compiler.Compile(''));
(gdb) s
COMPILE (CMD='') at compiler.pas:216
216 begin
(gdb)

(ppn59 is the name of my current development binary). "n" is a shortcut for "next", "s" for "step" (into), "b" for "break"

Jonas

Reply by email

Никита Баль
Did you try the predefined lazarus project coming with fpc?

Yes, i tried it. And i got a same result.
I can't enter (with debugger) to procedure compiler.Compile().

Reply by email

Martin Schreiber
to Никита Баль
Никита Баль wrote
Does anybody tryed to debug fpc under Lazarus? How?

This is for MSEide i386 and FPC 2.3.1:
http://sourceforge.net/project/showfiles.php?group_id=165409

- 'Project'-'New'-'From Program'.
- Select "compiler/pp.pas" from your FPC SVN checkout.
- Accept "pp.prj".
- 'Project'-'Options'-'Make'-'Make options', add "-di386" (without quotes) to the first row of 'Command line options'.
- 'Project'-'Options'-'Make'-'Directories', add a row, select "compiler/i386/"
- Add a row with "/compiler/x86/".
- Add a row with "/compiler/systems/".
- Set the commandline parameters for the target in 'Target'-'Environment'.
- Press F9.

You should possibly change the unit output directory to be consistent with the make file.

Martin

Reply by email