Sign in Join

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

Mailing lists / fpc-pascal / 2014-12

Which gdb version to use?

9 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

Martin Schreiber

Hi,

Since some versions gdb crashes with FPC programs if the "print" command is called with a query of pointer to not existing record fields for example, it triggers an assertion error. That makes gdb completely useless for use in IDE watch windows.
In gdb current git master (7.8.50.20141218-cvs) this problem is fixed but class fields are not known to gdb anymore, "print ftag" in a tcomponent descendant returns "Type TMAINFO has no component named ftag." with -g and -gw, with -gw3 it returns "No symbol "ftag" in current context." (FPC fixes_2_6, i386-linux).

Suggestions?

Thanks, Martin

Reply by email

Pierre Free Pascal
to Martin Schreiber

Hi Martin,

it would be useful to have a
simple source code which allows to reproduce your problem, together with a list of the operations that lead to the assertion.

I am afraid that current trunk is not really usable with FP IDE, because there has be a lot of changes in C structs used that might disrupt gdbint.pp code.

But maybe I understood wrong and you are talking about the Lazarus IDE...

Pierre Muller

Show quoted text 30 lines
-----Message d'origine----- De : [mailto:fpc-pascal- De la part de Martin Schreiber Envoyé : jeudi 18 décembre 2014 11:32 À : FPC-Pascal discussions Objet : [fpc-pascal] Which gdb version to use? Hi, Since some versions gdb crashes with FPC programs if the "print" command is called with a query of pointer to not existing record fields for example, it triggers an assertion error. That makes gdb completely useless for use in IDE watch windows. In gdb current git master (7.8.50.20141218-cvs) this problem is fixed but class fields are not known to gdb anymore, "print ftag" in a tcomponent descendant returns "Type TMAINFO has no component named ftag." with -g and -gw, with -gw3 it returns "No symbol "ftag" in current context." (FPC fixes_2_6, i386-linux). Suggestions? Thanks, Martin _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email

Martin Schreiber
to Pierre Free Pascal
Pierre Free Pascal wrote 13 lines
Hi Martin, it would be useful to have a simple source code which allows to reproduce your problem, together with a list of the operations that lead to the assertion. I am afraid that current trunk is not really usable with FP IDE, because there has be a lot of changes in C structs used that might disrupt gdbint.pp code. But maybe I understood wrong and you are talking about the Lazarus IDE...

I talk about MSEide. ;-)
The assertion errors are already fixed in current gdb git master version, the problem with gdb git master is that it can not print FPC class fields.

If you like to reproduce the assertion in gdb release versions load the program:
https://gitorious.org/mseuniverse/mseuniverse/source/testcase/gdb/assertioncrash/invalidvar.pas

in gdb and enter the commands:
"
gdb ./invalidvar
GNU gdb (GDB; openSUSE 13.1) 7.6.50.20130731-cvs
[...]
(gdb) break main
Breakpoint 1 at 0x8049b78: file invalidvar.pas, line 17. (gdb) run
Starting program: /home/mse/proj/msegui/testcase/mse/gdb/invalidvar/invalidvar [...]
Breakpoint 1, main () at invalidvar.pas:17
17 po1:= @r1;
(gdb) print po1^.c
../../gdb/parse.c:592: internal-error: mark_struct_expression: Assertion `parse_completion && expout_tag_completion_type == TYPE_CODE_UNDEF' failed. A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) y
../../gdb/parse.c:592: internal-error: mark_struct_expression: Assertion `parse_completion && expout_tag_completion_type == TYPE_CODE_UNDEF' failed. A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) n

"

Martin

Reply by email

Pierre Free Pascal
to Martin Schreiber

Hi Martin,

I happen to have the whole series of official
GDB releases compiled for i386-linux
from 6.1a up to 7.8.1.
I found only 7.6, 7.6.1 and 7.6.2 that show your
problem.
With 7.7, 7.7.1, 7.8 and 7.8.1
I do get
Type RECTY has no component named C.

Did you try to use 7.7 or later release?

Pierre

Show quoted text 66 lines
-----Message d'origine----- De : [mailto:fpc-pascal- De la part de Martin Schreiber Envoyé : jeudi 18 décembre 2014 14:14 À : Objet : Re: [fpc-pascal] Which gdb version to use? On Thursday 18 December 2014 13:42:25 Pierre Free Pascal wrote: > Hi Martin, > > it would be useful to have a > simple source code which allows to reproduce your problem, > together with a list of the operations that lead to the assertion. > > I am afraid that current trunk is not really usable with FP IDE, > because there has be a lot of changes in C structs used > that might disrupt gdbint.pp code. > > But maybe I understood wrong and you are talking about > the Lazarus IDE... > I talk about MSEide. ;-) The assertion errors are already fixed in current gdb git master version, the problem with gdb git master is that it can not print FPC class fields. If you like to reproduce the assertion in gdb release versions load the program: https://gitorious.org/mseuniverse/mseuniverse/source/testcase/gdb/asser tioncrash/invalidvar.pas in gdb and enter the commands: " gdb ./invalidvar GNU gdb (GDB; openSUSE 13.1) 7.6.50.20130731-cvs [...] (gdb) break main Breakpoint 1 at 0x8049b78: file invalidvar.pas, line 17. (gdb) run Starting program: /home/mse/proj/msegui/testcase/mse/gdb/invalidvar/invalidvar [...] Breakpoint 1, main () at invalidvar.pas:17 17 po1:= @r1; (gdb) print po1^.c ../../gdb/parse.c:592: internal-error: mark_struct_expression: Assertion `parse_completion && expout_tag_completion_type == TYPE_CODE_UNDEF' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) y ../../gdb/parse.c:592: internal-error: mark_struct_expression: Assertion `parse_completion && expout_tag_completion_type == TYPE_CODE_UNDEF' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Create a core file of GDB? (y or n) n > " Martin _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email

Martin Schreiber
to Pierre Free Pascal
Pierre Free Pascal wrote 13 lines
Hi Martin, I happen to have the whole series of official GDB releases compiled for i386-linux from 6.1a up to 7.8.1. I found only 7.6, 7.6.1 and 7.6.2 that show your problem. With 7.7, 7.7.1, 7.8 and 7.8.1 I do get Type RECTY has no component named C. Did you try to use 7.7 or later release?

I'll try to compile this versions, thanks.

Martin

Reply by email

Tony Whyman
to Martin Schreiber

See also http://bugs.freepascal.org/view.php?id=27136

Tony

Martin Schreiber wrote 20 lines
On Thursday 18 December 2014 14:43:42 Pierre Free Pascal wrote: > Hi Martin, > > I happen to have the whole series of official > GDB releases compiled for i386-linux > from 6.1a up to 7.8.1. > I found only 7.6, 7.6.1 and 7.6.2 that show your > problem. > With 7.7, 7.7.1, 7.8 and 7.8.1 > I do get > Type RECTY has no component named C. > > Did you try to use 7.7 or later release? > I'll try to compile this versions, thanks. Martin _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email

Martin Schreiber
to Martin Schreiber
Martin Schreiber wrote 5 lines
On Thursday 18 December 2014 14:43:42 Pierre Free Pascal wrote: > Did you try to use 7.7 or later release? gdb compiled from git gdb-7.8-branch 84aa7422f440868fea3359fde953c8375ca3409c works, thanks.

No, it is not OK. FPC fixes_2_6 i386-linux -gl -O-:

With the MSEgui demo program
https://gitorious.org/mseide-msegui/mseide-msegui/source/apps/demo

gdb-7.8-branch (7.8.1):
"
[...]
Reading symbols from ./demo...done.
(gdb) break main.pas:25
Breakpoint 1 at 0x8099a5f: file main.pas, line 25. (gdb) run
Starting program: /home/mse/packs/standard/git/mseide-msegui/apps/demo/demo warning: Could not load shared library symbols for linux-gate.so.1. Do you need "set solib-search-path" or "set sysroot"? [Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".

Breakpoint 1, TMAINFO__EXITONEXECUTE (SENDER=0xb7a6a000, this=<error reading variable>) at main.pas:25
25 application.terminated:= true;
(gdb) print ftag
Type TMAINFO has no component named ftag.
(gdb) print self.ftag
warning: can't find linker symbol for virtual table for `TMAINFO' value $1 = 0
(gdb)
"

gdb-7.7-branch (7.7.1):
"
Reading symbols from ./demo...done.
(gdb) break main.pas:25
Breakpoint 1 at 0x8099a5f: file main.pas, line 25. (gdb) run
Starting program: /home/mse/packs/standard/git/mseide-msegui/apps/demo/demo warning: Could not load shared library symbols for linux-gate.so.1. Do you need "set solib-search-path" or "set sysroot"? [Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".

Breakpoint 1, TMAINFO__EXITONEXECUTE (SENDER=0xb7a6a000, this=<error reading variable>) at main.pas:25
25 application.terminated:= true;
(gdb) print ftag
Type TMAINFO has no component named ftag.
(gdb) print self.ftag
warning: can't find linker symbol for virtual table for `TMAINFO' value $1 = 0
(gdb)
"

gdb_7_6-branch (7.6.2):
"
Reading symbols
from /home/mse/packs/standard/git/mseide-msegui/apps/demo/demo...done. (gdb) break main.pas:25
Breakpoint 1 at 0x8099a5f: file main.pas, line 25. (gdb) run
Starting program: /home/mse/packs/standard/git/mseide-msegui/apps/demo/./demo warning: Could not load shared library symbols for linux-gate.so.1. Do you need "set solib-search-path" or "set sysroot"? [Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".

Python Exception <type 'exceptions.AttributeError'> 'gdb.Type' object has no attribute 'name':
Breakpoint 1, TMAINFO__EXITONEXECUTE (SENDER=0xb7a6a000, this=<error reading variable>) at main.pas:25
25 application.terminated:= true;
(gdb) print ftag
warning: can't find linker symbol for virtual table for `TMAINFO' value Python Exception <type 'exceptions.AttributeError'> 'gdb.Type' object has no attribute 'name':
Python Exception <type 'exceptions.AttributeError'> 'gdb.Type' object has no attribute 'name':
$1 = 0
(gdb) print self.ftag
warning: can't find linker symbol for virtual table for `TMAINFO' value Python Exception <type 'exceptions.AttributeError'> 'gdb.Type' object has no attribute 'name':
Python Exception <type 'exceptions.AttributeError'> 'gdb.Type' object has no attribute 'name':
$2 = 0
(gdb)
"

gdb_7_5-branch (7.5.1):
"
Reading symbols
from /home/mse/packs/standard/git/mseide-msegui/apps/demo/demo...done. (gdb) break main.pas:25
Breakpoint 1 at 0x8099a5f: file main.pas, line 25. (gdb) run
Starting program: /home/mse/packs/standard/git/mseide-msegui/apps/demo/demo warning: Could not load shared library symbols for linux-gate.so.1. Do you need "set solib-search-path" or "set sysroot"? [Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".

Breakpoint 1, TMAINFO__EXITONEXECUTE (SENDER=0xb7a6a000, this=<error reading variable>) at main.pas:25
25 application.terminated:= true;
(gdb) print ftag
$1 = 0
(gdb) print self.ftag
$2 = 0
(gdb)
"

With the "assertion crash" program
https://gitorious.org/mseuniverse/mseuniverse/source/testcase/gdb/assertioncrash/invalidvar.pas

gdb-7.8-branch (7.8.1):
"
Reading symbols from ./invalidvar...Reading symbols from /home/mse/packs/standard/git/mseuniverse/testcase/gdb/assertioncrash/invalidvar.dbg...done. done.
(gdb) print po1^.c
Type RECTY has no component named c.
(gdb)
"

gdb-7.7-branch (7.7.1):
"
Reading symbols from ./invalidvar...Reading symbols from /home/mse/packs/standard/git/mseuniverse/testcase/gdb/assertioncrash/invalidvar.dbg...done. done.
(gdb) print po1^.c
Type RECTY has no component named c.
(gdb)
"

gdb_7_6-branch (7.6.2):
"
Reading symbols
from /home/mse/packs/standard/git/mseuniverse/testcase/gdb/assertioncrash/invalidvar...Reading symbols
from /home/mse/packs/standard/git/mseuniverse/testcase/gdb/assertioncrash/invalidvar.dbg...done. done.
(gdb) print po1^.c
parse.c:588: internal-error: mark_struct_expression: Assertion `parse_completion && expout_tag_completion_type == TYPE_CODE_UNDEF' failed. A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)
"

gdb_7_5-branch (7.5.1):
"
Reading symbols
from /home/mse/packs/standard/git/mseuniverse/testcase/gdb/assertioncrash/invalidvar...Reading symbols
from /home/mse/packs/standard/git/mseuniverse/testcase/gdb/assertioncrash/invalidvar.dbg...done. done.
(gdb) print po1^.c
Type RECTY has no component named c.
(gdb)
"

So the last working gdb with FPC is 7.5.1.

Martin

Reply by email

Martin Schreiber
to Martin Schreiber
Martin Schreiber wrote 9 lines
On Thursday 18 December 2014 18:19:06 Martin Schreiber wrote: > On Thursday 18 December 2014 14:43:42 Pierre Free Pascal wrote: > > Did you try to use 7.7 or later release? > > gdb compiled from git gdb-7.8-branch > 84aa7422f440868fea3359fde953c8375ca3409c works, thanks. No, it is not OK. FPC fixes_2_6 i386-linux -gl -O-:

Bug report:
http://bugs.freepascal.org/view.php?id=27188
I know that real Pascal programmers don't use a debugger, they use writeln(). ;-)

Martin

Reply by email