public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* Re: [RFA] Fix pascal behavior for class fields
       [not found] <54ae4586.01e3440a.7b06.fffff844SMTPIN_ADDED_BROKEN@mx.google.com>
@ 2015-01-08 10:48 ` Pedro Alves
  2015-01-08 13:01   ` Pierre Muller
       [not found]   ` <54ae7f9f.c323460a.36ed.ffffff30SMTPIN_ADDED_BROKEN@mx.google.com>
  0 siblings, 2 replies; 29+ messages in thread
From: Pedro Alves @ 2015-01-08 10:48 UTC (permalink / raw)
  To: Pierre Muller, 'gdb-patches'

On 01/08/2015 08:53 AM, Pierre Muller wrote:
>   This is the problem that triggered my previous RFA,
> as I discovered it while debugging this problem.
> 
>   In the pascal parser, there is special code
> that will try to emulate case-insensivity despite the
> fact that pascal is not registered as a 'case-insensitive' language.
> 
>   This code does not work as expected for fields of a class,
> for which exact casing is currently required.
> 
> See:
> https://sourceware.org/bugzilla/show_bug.cgi?id=17815
> for source code:
> 
> # Compile attached source code, using Free Pascal compiler
> 
> fpc -gs -Mobjfpc test-class-pascal.pas
> 
> # Debug it
> gdb ./test-class-pascal
> .......
> (gdb) b TA__CHECK
> Breakpoint 1 at 0x40154c: file test-class-pascal.pas, line 23.
> (gdb) r
> Starting program: E:\pas\test\test-class-pascal.exe
> [New Thread 6700.0x1ae0]
> 
> Breakpoint 1, TA__CHECK (B=0x1572ee0, this=<error reading variable>)
>     at test-class-pascal.pas:23
> 23        check:=(x < b.x);
> (gdb) p this
> $1 = (TA) 0x1572ed0
> (gdb) p this^
> warning: can't find linker symbol for virtual table for `TA' value
> $2 = {<TOBJECT> = {_vptr$ = {0x408014, 0x43}}, X = 67, Y = 33}
> (gdb) p X
> warning: can't find linker symbol for virtual table for `TA' value
> $3 = 67
> (gdb) p B.X
> warning: can't find linker symbol for virtual table for `TA' value
> $4 = -1
> (gdb) p b.x
> warning: can't find linker symbol for virtual table for `TA' value
> $5 = -1
> (gdb) p x
> Type TA has no component named x.
> (gdb)

How about adding this to the test suite?

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 29+ messages in thread

* RE: [RFA] Fix pascal behavior for class fields
  2015-01-08 10:48 ` [RFA] Fix pascal behavior for class fields Pedro Alves
@ 2015-01-08 13:01   ` Pierre Muller
       [not found]   ` <54ae7f9f.c323460a.36ed.ffffff30SMTPIN_ADDED_BROKEN@mx.google.com>
  1 sibling, 0 replies; 29+ messages in thread
From: Pierre Muller @ 2015-01-08 13:01 UTC (permalink / raw)
  To: 'Pedro Alves', 'gdb-patches'

> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : jeudi 8 janvier 2015 11:48
> À : Pierre Muller; 'gdb-patches'
> Objet : Re: [RFA] Fix pascal behavior for class fields
> > (gdb) p b.x
> > warning: can't find linker symbol for virtual table for `TA' value
> > $5 = -1
> > (gdb) p x
> > Type TA has no component named x.
> > (gdb)
> 
> How about adding this to the test suite?


  The whole testsuite/gpc.pascal is almost empty,
I never invested time to develop it :(

  At the time I started it, GPC (the GNU pascal compiler)
was still active, but development apparently
stopped since quite some time.

  I am unable to install GPC, which means that I cannot test it.
Would a testsuite that supports only Free Pascal be acceptable?

Pierre Muller
as GDB pascal language maintainer

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [RFA] Fix pascal behavior for class fields
       [not found]   ` <54ae7f9f.c323460a.36ed.ffffff30SMTPIN_ADDED_BROKEN@mx.google.com>
@ 2015-01-08 13:41     ` Pedro Alves
  2015-01-08 14:15       ` gdb-patches RFA: " Pierre Muller
       [not found]       ` <54ae911b.85e3440a.1d96.5ffdSMTPIN_ADDED_BROKEN@mx.google.com>
  0 siblings, 2 replies; 29+ messages in thread
From: Pedro Alves @ 2015-01-08 13:41 UTC (permalink / raw)
  To: Pierre Muller, 'gdb-patches'

On 01/08/2015 01:00 PM, Pierre Muller wrote:
>> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
>> owner@sourceware.org] De la part de Pedro Alves
>> Envoyé : jeudi 8 janvier 2015 11:48
>> À : Pierre Muller; 'gdb-patches'
>> Objet : Re: [RFA] Fix pascal behavior for class fields
>>> (gdb) p b.x
>>> warning: can't find linker symbol for virtual table for `TA' value
>>> $5 = -1
>>> (gdb) p x
>>> Type TA has no component named x.
>>> (gdb)
>>
>> How about adding this to the test suite?
> 
> 
>   The whole testsuite/gpc.pascal is almost empty,
> I never invested time to develop it :(
> 
>   At the time I started it, GPC (the GNU pascal compiler)
> was still active, but development apparently
> stopped since quite some time.
> 
>   I am unable to install GPC, which means that I cannot test it.
> Would a testsuite that supports only Free Pascal be acceptable?

Do you actually mean, whether it's ok for a new
test (not test suite) to go in untested on GPC?  It certainly is.
Better test on FPC than nowhere.  :-)

AFAICS, the tests themselves don't really care which compiler
is in use other than for marking xfails; you just call gdb_compile_pascal,
and that works with either.  That's my impression from quickly
skimming testsuite/lib/pascal.exp.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 29+ messages in thread

* gdb-patches RFA: Fix pascal behavior for class fields
  2015-01-08 13:41     ` Pedro Alves
@ 2015-01-08 14:15       ` Pierre Muller
       [not found]       ` <54ae911b.85e3440a.1d96.5ffdSMTPIN_ADDED_BROKEN@mx.google.com>
  1 sibling, 0 replies; 29+ messages in thread
From: Pierre Muller @ 2015-01-08 14:15 UTC (permalink / raw)
  To: 'Pedro Alves', 'gdb-patches'; +Cc: gpc

For gpc mailing list:
this email comes as a follow-up of this bug report
https://sourceware.org/bugzilla/show_bug.cgi?id=17815

The start of the thread can be found at:
https://sourceware.org/ml/gdb-patches/2015-01/msg00164.html

Pedro asked:
> >> How about adding this to the test suite?
> >
> >
> >   The whole testsuite/gdb.pascal is almost empty,
> > I never invested time to develop it :(
> >
> >   At the time I started it, GPC (the GNU pascal compiler)
> > was still active, but development apparently
> > stopped since quite some time.
> >
> >   I am unable to install GPC, which means that I cannot test it.
> > Would a testsuite that supports only Free Pascal be acceptable?
> 
> Do you actually mean, whether it's ok for a new
> test (not test suite) to go in untested on GPC?  It certainly is.
> Better test on FPC than nowhere.  :-)
  That is indeed what I meant.
 
> AFAICS, the tests themselves don't really care which compiler
> is in use other than for marking xfails; you just call
> gdb_compile_pascal,
> and that works with either.  That's my impression from quickly
> skimming testsuite/lib/pascal.exp.

  The problem is that GPC and Free Pascal support several
pascal 'dialects'. But this requires command line options.

  The -Mobjfpc option is required for Free Pascal compiler
to understand class type definition, but is rejected in default mode.

  I expect GNU GPC to also reject class in 'normal' mode...
Maybe someone on the gpc mailing list knows if classes are supported
by GPC and if it requires a special compiler option.

Pierre Muller

FYI: Here is the example code that is included in the bug report.

$ cat ~/pas/test/test-class-pascal.pas

type
  TA = class
  public
  x, y : integer;
  constructor Create;
  function check(b : TA) : boolean;
  destructor Done; virtual;
end;

constructor TA.Create;
begin
  x:=-1;
  y:=-1;
end;

destructor TA.Done;
begin
end;

function TA.check (b : TA) : boolean;
begin
  check:=(x < b.x);
end;



var
  a, b : TA;

begin
  a:=TA.Create;
  b:=TA.Create;
  a.x := 67;
  a.y := 33;
  a.check (b);
end.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: gdb-patches RFA: Fix pascal behavior for class fields
       [not found]       ` <54ae911b.85e3440a.1d96.5ffdSMTPIN_ADDED_BROKEN@mx.google.com>
@ 2015-01-09 10:52         ` Pedro Alves
  2015-01-09 10:55           ` Pedro Alves
                             ` (5 more replies)
  0 siblings, 6 replies; 29+ messages in thread
From: Pedro Alves @ 2015-01-09 10:52 UTC (permalink / raw)
  To: Pierre Muller, 'gdb-patches'; +Cc: gpc

On 01/08/2015 02:15 PM, Pierre Muller wrote:
> For gpc mailing list:
> this email comes as a follow-up of this bug report
> https://sourceware.org/bugzilla/show_bug.cgi?id=17815
> 
> The start of the thread can be found at:
> https://sourceware.org/ml/gdb-patches/2015-01/msg00164.html
> 
> Pedro asked:
>>>> How about adding this to the test suite?
>>>
>>>
>>>   The whole testsuite/gdb.pascal is almost empty,
>>> I never invested time to develop it :(
>>>
>>>   At the time I started it, GPC (the GNU pascal compiler)
>>> was still active, but development apparently
>>> stopped since quite some time.
>>>
>>>   I am unable to install GPC, which means that I cannot test it.
>>> Would a testsuite that supports only Free Pascal be acceptable?
>>
>> Do you actually mean, whether it's ok for a new
>> test (not test suite) to go in untested on GPC?  It certainly is.
>> Better test on FPC than nowhere.  :-)
>   That is indeed what I meant.
>  
>> AFAICS, the tests themselves don't really care which compiler
>> is in use other than for marking xfails; you just call
>> gdb_compile_pascal,
>> and that works with either.  That's my impression from quickly
>> skimming testsuite/lib/pascal.exp.
> 
>   The problem is that GPC and Free Pascal support several
> pascal 'dialects'. But this requires command line options.
> 
>   The -Mobjfpc option is required for Free Pascal compiler
> to understand class type definition, but is rejected in default mode.
> 
>   I expect GNU GPC to also reject class in 'normal' mode...
> Maybe someone on the gpc mailing list knows if classes are supported
> by GPC and if it requires a special compiler option.

I'd suggest adding support for a new option to
gdb_compile_pascal, like "objfpc", so you'd compile
the test with:

 if {[gdb_compile_pascal ... executable [list debug objfpc]] != "" } {
     untested $testfile.exp
     return -1
 }

You'd teach fpc_compile about the new option:

proc fpc_compile {source dest type options} {
...
    foreach i $options {
...
        } elseif { $i == "objfpc" } {
           append add_flags " -Mobjfpc"
        }
...
    }


Someone that cares about testing with GNU GPC would then
do the equivalent to gpc_compile, if anything is necessary.
If gpc simply fails to compile the test, it's no biggie,
as gdb_compile_pascal returns false, and the test is
skipped with "untested".

There may be a more generic and common name for the mode,
like "obj-pascal" or something, but I wouldn't know.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: gdb-patches RFA: Fix pascal behavior for class fields
  2015-01-09 10:52         ` Pedro Alves
@ 2015-01-09 10:55           ` Pedro Alves
  2015-01-09 16:16           ` [RFA PATCH 1/3] Remember the case pattern that allowed finding a field of this Pierre Muller
                             ` (4 subsequent siblings)
  5 siblings, 0 replies; 29+ messages in thread
From: Pedro Alves @ 2015-01-09 10:55 UTC (permalink / raw)
  To: Pierre Muller, 'gdb-patches'; +Cc: gpc

On 01/09/2015 10:52 AM, Pedro Alves wrote:

> There may be a more generic and common name for the mode,
> like "obj-pascal" or something, but I wouldn't know.

To clarify, I meant, it is my impression that objfpc is a
dialect of Object Pascal:

  http://en.wikipedia.org/wiki/Object_Pascal

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [RFA PATCH 1/3] Remember the case pattern that allowed finding a field of this.
  2015-01-09 10:52         ` Pedro Alves
  2015-01-09 10:55           ` Pedro Alves
@ 2015-01-09 16:16           ` Pierre Muller
  2015-01-23  7:30             ` [RFA PATCH 1/3 V3] " Pierre Muller
  2015-01-09 16:16           ` [RFA 0/3] Fix pascal behavior for class fields with testcase Pierre Muller
                             ` (3 subsequent siblings)
  5 siblings, 1 reply; 29+ messages in thread
From: Pierre Muller @ 2015-01-09 16:16 UTC (permalink / raw)
  To: 'Pedro Alves'; +Cc: 'gdb-patches'


  In the pascal parser, there is special code
that will try to emulate case-insensivity despite the
fact that pascal is not registered as a 'case-insensitive' language.

  This code does not work as expected for fields of a class,
for which exact casing is currently required.
  The patch below fixes this problem.

Pierre Muller

gdb/ChangeLog entry:

2015-01-07  Pierre Muller  <muller@sourceware.org>

       PR pascal/17815
       * p-exp.y (yylex): Remember the case pattern that allowed finding
       a field of this.

---
 gdb/p-exp.y | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index a1c78bf..3a4905a 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -1598,7 +1598,7 @@ yylex (void)
 			      VAR_DOMAIN, &is_a_field_of_this);
       }
 
-    if (is_a_field)
+    if (is_a_field || (is_a_field_of_this.type != NULL))
       {
 	tempbuf = (char *) realloc (tempbuf, namelen + 1);
 	strncpy (tempbuf, tmp, namelen);
@@ -1606,7 +1606,11 @@ yylex (void)
 	yylval.sval.ptr = tempbuf;
 	yylval.sval.length = namelen;
 	free (uptokstart);
-	return FIELDNAME;
+        yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
+	if (is_a_field)
+	  return FIELDNAME;
+	else
+	  return NAME;
       }
     /* Call lookup_symtab, not lookup_partial_symtab, in case there are
        no psymtabs (coff, xcoff, or some future change to blow away the
@@ -1739,7 +1743,6 @@ yylex (void)
     free(uptokstart);
     /* Any other kind of symbol.  */
     yylval.ssym.sym = sym;
-    yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
     return NAME;
   }
 }
-- 
2.1.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [RFA 0/3] Fix pascal behavior for class fields with testcase
  2015-01-09 10:52         ` Pedro Alves
  2015-01-09 10:55           ` Pedro Alves
  2015-01-09 16:16           ` [RFA PATCH 1/3] Remember the case pattern that allowed finding a field of this Pierre Muller
@ 2015-01-09 16:16           ` Pierre Muller
  2015-01-09 16:18             ` [RFA PATCH 2/3] Add debug-stabs debug-dwarf and class option for pascal compiler Pierre Muller
  2015-02-04 23:37             ` [RFA 0/3 V4] Fix pascal behavior for class fields with testcase Pierre Muller
  2015-01-09 16:18           ` [RFA PATCH 3/3] Testcase for pascal/17815 Pierre Muller
                             ` (2 subsequent siblings)
  5 siblings, 2 replies; 29+ messages in thread
From: Pierre Muller @ 2015-01-09 16:16 UTC (permalink / raw)
  To: 'Pedro Alves'; +Cc: 'gdb-patches'

 I finally started to try git format-patch.

  The three patch emails that will follow contain:

1) The fix in p-exp.y to cope correctly with this fields

2) New options for pascal compilation in the testsuite

3) A testcase for PR pascal/17815

I hope this is correct...
but there are surely some formatting and
name conventions that I do not follow correctly...


Pierre Muller

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : vendredi 9 janvier 2015 11:52
> À : Pierre Muller; 'gdb-patches'
> Cc : gpc@gnu.de
> Objet : Re: gdb-patches RFA: Fix pascal behavior for class fields
> 
> On 01/08/2015 02:15 PM, Pierre Muller wrote:
> > For gpc mailing list:
> > this email comes as a follow-up of this bug report
> > https://sourceware.org/bugzilla/show_bug.cgi?id=17815
> >
> > The start of the thread can be found at:
> > https://sourceware.org/ml/gdb-patches/2015-01/msg00164.html
> >
> > Pedro asked:
> >>>> How about adding this to the test suite?
> >>>
> >>>
> >>>   The whole testsuite/gdb.pascal is almost empty,
> >>> I never invested time to develop it :(
> >>>
> >>>   At the time I started it, GPC (the GNU pascal compiler)
> >>> was still active, but development apparently
> >>> stopped since quite some time.
> >>>
> >>>   I am unable to install GPC, which means that I cannot test it.
> >>> Would a testsuite that supports only Free Pascal be acceptable?
> >>
> >> Do you actually mean, whether it's ok for a new
> >> test (not test suite) to go in untested on GPC?  It certainly is.
> >> Better test on FPC than nowhere.  :-)
> >   That is indeed what I meant.
> >
> >> AFAICS, the tests themselves don't really care which compiler
> >> is in use other than for marking xfails; you just call
> >> gdb_compile_pascal,
> >> and that works with either.  That's my impression from quickly
> >> skimming testsuite/lib/pascal.exp.
> >
> >   The problem is that GPC and Free Pascal support several
> > pascal 'dialects'. But this requires command line options.
> >
> >   The -Mobjfpc option is required for Free Pascal compiler
> > to understand class type definition, but is rejected in default mode.
> >
> >   I expect GNU GPC to also reject class in 'normal' mode...
> > Maybe someone on the gpc mailing list knows if classes are supported
> > by GPC and if it requires a special compiler option.
> 
> I'd suggest adding support for a new option to
> gdb_compile_pascal, like "objfpc", so you'd compile
> the test with:
> 
>  if {[gdb_compile_pascal ... executable [list debug objfpc]] != "" } {
>      untested $testfile.exp
>      return -1
>  }
> 
> You'd teach fpc_compile about the new option:
> 
> proc fpc_compile {source dest type options} {
> ...
>     foreach i $options {
> ...
>         } elseif { $i == "objfpc" } {
>            append add_flags " -Mobjfpc"
>         }
> ...
>     }
> 
> 
> Someone that cares about testing with GNU GPC would then
> do the equivalent to gpc_compile, if anything is necessary.
> If gpc simply fails to compile the test, it's no biggie,
> as gdb_compile_pascal returns false, and the test is
> skipped with "untested".
> 
> There may be a more generic and common name for the mode,
> like "obj-pascal" or something, but I wouldn't know.
> 
> Thanks,
> Pedro Alves

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [RFA PATCH 2/3] Add debug-stabs debug-dwarf and class option for pascal compiler
  2015-01-09 16:16           ` [RFA 0/3] Fix pascal behavior for class fields with testcase Pierre Muller
@ 2015-01-09 16:18             ` Pierre Muller
  2015-02-04 23:37             ` [RFA 0/3 V4] Fix pascal behavior for class fields with testcase Pierre Muller
  1 sibling, 0 replies; 29+ messages in thread
From: Pierre Muller @ 2015-01-09 16:18 UTC (permalink / raw)
  To: 'Pedro Alves'; +Cc: 'gdb-patches'

  This part adds support for
pascal specific compilation option:
  - "debug-stabs" to force use of stabs debugging format.
  - "debug-dwarf" to force use of dwarf debugging format.
  - "class" to enable pascal "class" types.

gdb/testsuite/Changelog entry :

2015-01-09  Pierre Muller  <muller@sourceware.org>

	* lib/pascal.exp (gpc_compile): Handle new options:
	"debug-stabs", "debug-dwarf" and "class".
	(fpc_compile): Likewise.
---
 gdb/testsuite/lib/pascal.exp | 42
++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp
index 994e3da..587352c 100644
--- a/gdb/testsuite/lib/pascal.exp
+++ b/gdb/testsuite/lib/pascal.exp
@@ -91,6 +91,27 @@ proc gpc_compile {source dest type options} {
 		append add_flags " -g"
 	    }
 	}
+	if { $i == "debug-stabs" } {
+	    if [board_info $dest exists debug_stabs_flags] {
+		append add_flags " [board_info $dest debug_stabs_flags]"
+	    } else {
+		append add_flags " -gstabs"
+	    }
+	}
+	if { $i == "debug-dwarf" } {
+	    if [board_info $dest exists debug_dwarf_flags] {
+		append add_flags " [board_info $dest debug_dwarf_flags]"
+	    } else {
+		append add_flags " -gdwarf-2"
+	    }
+	}
+	if { $i == "class" } {
+	    if [board_info $dest exists pascal_class_flags] {
+		append add_flags " [board_info $dest pscal_class_flags]"
+	    } else {
+		append add_flags " --extended-syntax"
+	    }
+	}
     }
 
     set result [remote_exec host $gpc_compiler "-o $dest --automake
$add_flags $source"]
@@ -120,6 +141,27 @@ proc fpc_compile {source dest type options} {
 		append add_flags " -g"
 	    }
 	}
+	if { $i == "debug-stabs" } {
+	    if [board_info $dest exists debug_stabs_flags] {
+		append add_flags " [board_info $dest debug_stabs_flags]"
+	    } else {
+		append add_flags " -gs"
+	    }
+	}
+	if { $i == "debug-dwarf" } {
+	    if [board_info $dest exists debug_dwarf_flags] {
+		append add_flags " [board_info $dest debug_dwarf_flags]"
+	    } else {
+		append add_flags " -gw"
+	    }
+	}
+	if { $i == "class" } {
+	    if [board_info $dest exists pascal_class_flags] {
+		append add_flags " [board_info $dest pscal_class_flags]"
+	    } else {
+		append add_flags " -Mobjfpc"
+	    }
+	}
     }
 
     set result [remote_exec host $fpc_compiler "-o$dest $add_flags
$source"]
-- 
2.1.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [RFA PATCH 3/3] Testcase for pascal/17815
  2015-01-09 10:52         ` Pedro Alves
                             ` (2 preceding siblings ...)
  2015-01-09 16:16           ` [RFA 0/3] Fix pascal behavior for class fields with testcase Pierre Muller
@ 2015-01-09 16:18           ` Pierre Muller
       [not found]           ` <54afff61.6790420a.0fa7.4f63SMTPIN_ADDED_BROKEN@mx.google.com>
       [not found]           ` <54afff6b.ee8d440a.16ee.ffffb424SMTPIN_ADDED_BROKEN@mx.google.com>
  5 siblings, 0 replies; 29+ messages in thread
From: Pierre Muller @ 2015-01-09 16:18 UTC (permalink / raw)
  To: 'Pedro Alves'; +Cc: 'gdb-patches'

  This adds the testcase for pascal/17815 bug report.


gdb/testsuite/Changelog entry:

2015-01-09  Pierre Muller  <muller@sourceware.org>

	gdb.pascal/gdb17815.pas: New file.
	gdb.pascal/gdb17815.exp: New file.
---
 gdb/testsuite/gdb.pascal/gdb17815.exp | 64
+++++++++++++++++++++++++++++++++++
 gdb/testsuite/gdb.pascal/gdb17815.pas | 61
+++++++++++++++++++++++++++++++++
 2 files changed, 125 insertions(+)
 create mode 100644 gdb/testsuite/gdb.pascal/gdb17815.exp
 create mode 100644 gdb/testsuite/gdb.pascal/gdb17815.pas

diff --git a/gdb/testsuite/gdb.pascal/gdb17815.exp
b/gdb/testsuite/gdb.pascal/gdb17815.exp
new file mode 100644
index 0000000..bd93c50
--- /dev/null
+++ b/gdb/testsuite/gdb.pascal/gdb17815.exp
@@ -0,0 +1,64 @@
+# Copyright 2010-2015 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+load_lib "pascal.exp"
+
+standard_testfile .pas
+
+if {[gdb_compile_pascal "${srcdir}/${subdir}/${srcfile}" "${binfile}"
executable [list debug class]] != "" } {
+    untested $testfile.exp
+    return -1
+}
+
+clean_restart ${testfile}
+set bp_location [gdb_get_line_number "set breakpoint here"]
+
+if { [gdb_breakpoint ${srcfile}:${bp_location}] } {
+    pass "setting breakpoint"
+}
+
+# Verify that "start" lands inside the right procedure.
+if { [gdb_start_cmd] < 0 } {
+    untested start
+    return -1
+}
+
+gdb_test "" ".* at .*${srcfile}.*" "start"
+gdb_test "continue" ""
+# We are now inside CHECK method
+gdb_test "p X" " = 67"
+gdb_test "p B.X" " = -1"
+# As A is global, we can also check it global value
+gdb_test "p A.X" " = 67"
+gdb_test "p Y" " = 33"
+gdb_test "p Y" " = 33"
+gdb_test "p B.Y" " = -1"
+gdb_test "p A.Y" " = 33"
+# Now test lowercase
+gdb_test "p x" " = 67"
+gdb_test "p B.x" " = -1"
+# As A is global, we can also check it global value
+gdb_test "p A.x" " = 67"
+gdb_test "p y" " = 33"
+gdb_test "p B.y" " = -1"
+gdb_test "p A.y" " = 33"
+# Lowercase class names
+gdb_test "p b.X" " = -1"
+gdb_test "p b.x" " = -1"
+gdb_test "p a.Y" " = 33"
+gdb_test "p a.y" " = 33"
+
+gdb_exit
+
diff --git a/gdb/testsuite/gdb.pascal/gdb17815.pas
b/gdb/testsuite/gdb.pascal/gdb17815.pas
new file mode 100644
index 0000000..6600b62
--- /dev/null
+++ b/gdb/testsuite/gdb.pascal/gdb17815.pas
@@ -0,0 +1,61 @@
+{
+ Copyright 2010-2015 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+}
+
+
+program test_gdb_17815;
+
+
+type
+  TA = class
+  public
+  x, y : integer;
+  constructor Create;
+  function check(b : TA) : boolean;
+  destructor Done; virtual;
+end;
+
+constructor TA.Create;
+begin
+  x:=-1;
+  y:=-1;
+end;
+
+destructor TA.Done;
+begin
+end;
+
+function TA.check (b : TA) : boolean;
+begin
+  check:=(x < b.x); { set breakpoint here }
+end;
+
+
+
+var
+  a, b : TA;
+
+begin
+  a:=TA.Create;
+  b:=TA.Create;
+  a.x := 67;
+  a.y := 33;
+  if a.check (b) then
+    writeln('Error in check')
+  else
+    writeln('check OK');
+end.
+
-- 
2.1.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [RFA PATCH 2/3] Add debug-stabs debug-dwarf and class option for pascal compiler
       [not found]           ` <54afff61.6790420a.0fa7.4f63SMTPIN_ADDED_BROKEN@mx.google.com>
@ 2015-01-10  0:45             ` Doug Evans
  2015-01-10  0:55               ` Pierre Muller
       [not found]               ` <54b07891.01b3c20a.2a7b.ffff9f96SMTPIN_ADDED_BROKEN@mx.google.com>
  0 siblings, 2 replies; 29+ messages in thread
From: Doug Evans @ 2015-01-10  0:45 UTC (permalink / raw)
  To: Pierre Muller; +Cc: Pedro Alves, gdb-patches

On Fri, Jan 9, 2015 at 8:18 AM, Pierre Muller
<pierre.muller@ics-cnrs.unistra.fr> wrote:
>   This part adds support for
> pascal specific compilation option:
>   - "debug-stabs" to force use of stabs debugging format.
>   - "debug-dwarf" to force use of dwarf debugging format.
>   - "class" to enable pascal "class" types.
>
> gdb/testsuite/Changelog entry :
>
> 2015-01-09  Pierre Muller  <muller@sourceware.org>
>
>         * lib/pascal.exp (gpc_compile): Handle new options:
>         "debug-stabs", "debug-dwarf" and "class".
>         (fpc_compile): Likewise.
> ---
>  gdb/testsuite/lib/pascal.exp | 42
> ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 42 insertions(+)
>
> diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp
> index 994e3da..587352c 100644
> --- a/gdb/testsuite/lib/pascal.exp
> +++ b/gdb/testsuite/lib/pascal.exp
> @@ -91,6 +91,27 @@ proc gpc_compile {source dest type options} {
>                 append add_flags " -g"
>             }
>         }
> +       if { $i == "debug-stabs" } {
> +           if [board_info $dest exists debug_stabs_flags] {
> +               append add_flags " [board_info $dest debug_stabs_flags]"
> +           } else {
> +               append add_flags " -gstabs"
> +           }
> +       }
> +       if { $i == "debug-dwarf" } {
> +           if [board_info $dest exists debug_dwarf_flags] {
> +               append add_flags " [board_info $dest debug_dwarf_flags]"
> +           } else {
> +               append add_flags " -gdwarf-2"
> +           }
> +       }
> +       if { $i == "class" } {
> +           if [board_info $dest exists pascal_class_flags] {
> +               append add_flags " [board_info $dest pscal_class_flags]"
> +           } else {
> +               append add_flags " --extended-syntax"
> +           }
> +       }
>      }
>
>      set result [remote_exec host $gpc_compiler "-o $dest --automake
> $add_flags $source"]
> @@ -120,6 +141,27 @@ proc fpc_compile {source dest type options} {
>                 append add_flags " -g"
>             }
>         }
> +       if { $i == "debug-stabs" } {
> +           if [board_info $dest exists debug_stabs_flags] {
> +               append add_flags " [board_info $dest debug_stabs_flags]"
> +           } else {
> +               append add_flags " -gs"
> +           }
> +       }
> +       if { $i == "debug-dwarf" } {
> +           if [board_info $dest exists debug_dwarf_flags] {
> +               append add_flags " [board_info $dest debug_dwarf_flags]"
> +           } else {
> +               append add_flags " -gw"
> +           }
> +       }
> +       if { $i == "class" } {
> +           if [board_info $dest exists pascal_class_flags] {
> +               append add_flags " [board_info $dest pscal_class_flags]"
> +           } else {
> +               append add_flags " -Mobjfpc"
> +           }
> +       }
>      }
>
>      set result [remote_exec host $fpc_compiler "-o$dest $add_flags
> $source"]
> --
> 2.1.1

Hi.
This patch makes me uncomfortable.
It's to a pascal specific file, so at least the discomfort is contained :-),
but I wouldn't want this spreading.

How to select debug information should be
orthogonal to compilation language,
and there are a myriad of ways to select what kind of dwarf debug info
to get (with/without type units, with/without .gdb_index, with/without
dwz, and so on).  I have board files to help me drive the various
combinations I'm interested in.  This won't work if gdb.pascal/*
starts hardcoding debug info into the test.

Maybe there's a good reason to do it this way for pascal,
but I need more data.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* RE: [RFA PATCH 2/3] Add debug-stabs debug-dwarf and class option for pascal compiler
  2015-01-10  0:45             ` [RFA PATCH 2/3] Add debug-stabs debug-dwarf and class option for pascal compiler Doug Evans
@ 2015-01-10  0:55               ` Pierre Muller
       [not found]               ` <54b07891.01b3c20a.2a7b.ffff9f96SMTPIN_ADDED_BROKEN@mx.google.com>
  1 sibling, 0 replies; 29+ messages in thread
From: Pierre Muller @ 2015-01-10  0:55 UTC (permalink / raw)
  To: 'Doug Evans'; +Cc: 'Pedro Alves', 'gdb-patches'

> Hi.
> This patch makes me uncomfortable.
> It's to a pascal specific file, so at least the discomfort is contained
> :-),
> but I wouldn't want this spreading.
> 
> How to select debug information should be
> orthogonal to compilation language,
> and there are a myriad of ways to select what kind of dwarf debug info
> to get (with/without type units, with/without .gdb_index, with/without
> dwz, and so on).  I have board files to help me drive the various
> combinations I'm interested in.  This won't work if gdb.pascal/*
> starts hardcoding debug info into the test.
> 
> Maybe there's a good reason to do it this way for pascal,
> but I need more data.

 Hi Doug, the reasons of this patch are:

1) the particular problem that the series fixes is strictly limited
to stabs debugging information.

  Thus to really test that this bug has been fixed, I need to compile
the test code using stabs debugging format (which I now realize
I did not do in the third part of the patch series).

2) the pascal language support tries to support both
GNU pascal compiler (aka GPC) and Free Pascal Compiler (aka FPC).

  These two compilers have very different options,
so the submitted patch purpose is to unify the selection of stabs versus dwarf
debug format independently from the used pascal compiler.

 For other pascal tests, only debug is used, which results in the default
format according to the target architecture and operating system.

I hope that the explanations above are sufficient to ease your discomfort.


Pierre Muller 

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [RFA PATCH 2/3] Add debug-stabs debug-dwarf and class option for pascal compiler
       [not found]               ` <54b07891.01b3c20a.2a7b.ffff9f96SMTPIN_ADDED_BROKEN@mx.google.com>
@ 2015-01-10 21:23                 ` Doug Evans
  2015-01-14 15:04                   ` [RFA PATCH 2/3 V2] Add "class" " Pierre Muller
       [not found]                   ` <54b6858f.a287440a.5b61.ffff9ef0SMTPIN_ADDED_BROKEN@mx.google.com>
  0 siblings, 2 replies; 29+ messages in thread
From: Doug Evans @ 2015-01-10 21:23 UTC (permalink / raw)
  To: Pierre Muller; +Cc: Pedro Alves, gdb-patches

On Fri, Jan 9, 2015 at 4:55 PM, Pierre Muller
<pierre.muller@ics-cnrs.unistra.fr> wrote:
>> Hi.
>> This patch makes me uncomfortable.
>> It's to a pascal specific file, so at least the discomfort is contained
>> :-),
>> but I wouldn't want this spreading.
>>
>> How to select debug information should be
>> orthogonal to compilation language,
>> and there are a myriad of ways to select what kind of dwarf debug info
>> to get (with/without type units, with/without .gdb_index, with/without
>> dwz, and so on).  I have board files to help me drive the various
>> combinations I'm interested in.  This won't work if gdb.pascal/*
>> starts hardcoding debug info into the test.
>>
>> Maybe there's a good reason to do it this way for pascal,
>> but I need more data.
>
>  Hi Doug, the reasons of this patch are:
>
> 1) the particular problem that the series fixes is strictly limited
> to stabs debugging information.
>
>   Thus to really test that this bug has been fixed, I need to compile
> the test code using stabs debugging format (which I now realize
> I did not do in the third part of the patch series).
>
> 2) the pascal language support tries to support both
> GNU pascal compiler (aka GPC) and Free Pascal Compiler (aka FPC).
>
>   These two compilers have very different options,
> so the submitted patch purpose is to unify the selection of stabs versus dwarf
> debug format independently from the used pascal compiler.
>
>  For other pascal tests, only debug is used, which results in the default
> format according to the target architecture and operating system.
>
> I hope that the explanations above are sufficient to ease your discomfort.

Yeah, I figured those are the reasons, but I dunno.
We're inventing something new here when existing mechanisms
can already handle this.

One *could* have the test be debug-format agnostic,
and to test with stabs just do
make check RUNTESTFLAGS=--target_board=stabs

If you're using stabs you'll want to run the whole testsuite with stabs anyway.

Plus if a compiler has a different spelling for -gstabs, one could
have another board file for that compiler: you'll want to run the
whole testsuite
with that compiler anyway.

make check RUNTESTFLAGS="gdb.pascal/*.exp --target_board=fpc-stabs"

or some such.

Obviously, by "whole testsuite" I mean the pascal parts.
So that raises a question that may help guide the discussion.
When testing with fpc, how do you run the testsuite?
Do you just run the pascal subset, gdb.pascal/*.exp?
Or do you run the WHOLE testsuite (i.e., gdb.*/*.exp),
e.g., just a plain "make check"
and expect the test harness to pick up fpc and DTRT.
How do other languages handle this I wonder.

I'm not totally opposed to this (I don't like to say "No."),
but I'm still uncomfortable with the patch.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [RFA PATCH 2/3 V2] Add "class" option for pascal compiler
  2015-01-10 21:23                 ` Doug Evans
@ 2015-01-14 15:04                   ` Pierre Muller
       [not found]                   ` <54b6858f.a287440a.5b61.ffff9ef0SMTPIN_ADDED_BROKEN@mx.google.com>
  1 sibling, 0 replies; 29+ messages in thread
From: Pierre Muller @ 2015-01-14 15:04 UTC (permalink / raw)
  To: 'Doug Evans'; +Cc: 'Pedro Alves', 'gdb-patches'



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Doug Evans
> Envoyé : samedi 10 janvier 2015 22:23
> À : Pierre Muller
> Cc : Pedro Alves; gdb-patches
> Objet : Re: [RFA PATCH 2/3] Add debug-stabs debug-dwarf and class
> option for pascal compiler
> 
> On Fri, Jan 9, 2015 at 4:55 PM, Pierre Muller
> <pierre.muller@ics-cnrs.unistra.fr> wrote:
> >> Hi.
> >> This patch makes me uncomfortable.
> >> It's to a pascal specific file, so at least the discomfort is
> contained
> >> :-),
> >> but I wouldn't want this spreading.
> >>
> >> How to select debug information should be
> >> orthogonal to compilation language,
> >> and there are a myriad of ways to select what kind of dwarf debug
> info
> >> to get (with/without type units, with/without .gdb_index,
> with/without
> >> dwz, and so on).  I have board files to help me drive the various
> >> combinations I'm interested in.  This won't work if gdb.pascal/*
> >> starts hardcoding debug info into the test.
> >>
> >> Maybe there's a good reason to do it this way for pascal,
> >> but I need more data.
> >
> >  Hi Doug, the reasons of this patch are:
> >
> > 1) the particular problem that the series fixes is strictly limited
> > to stabs debugging information.
> >
> >   Thus to really test that this bug has been fixed, I need to compile
> > the test code using stabs debugging format (which I now realize
> > I did not do in the third part of the patch series).
> >
> > 2) the pascal language support tries to support both
> > GNU pascal compiler (aka GPC) and Free Pascal Compiler (aka FPC).
> >
> >   These two compilers have very different options,
> > so the submitted patch purpose is to unify the selection of stabs
> versus dwarf
> > debug format independently from the used pascal compiler.
> >
> >  For other pascal tests, only debug is used, which results in the
> default
> > format according to the target architecture and operating system.
> >
> > I hope that the explanations above are sufficient to ease your
> discomfort.
> 
> Yeah, I figured those are the reasons, but I dunno.
> We're inventing something new here when existing mechanisms
> can already handle this.
> 
> One *could* have the test be debug-format agnostic,
> and to test with stabs just do
> make check RUNTESTFLAGS=--target_board=stabs
> 
> If you're using stabs you'll want to run the whole testsuite with stabs
> anyway.
> 
> Plus if a compiler has a different spelling for -gstabs, one could
> have another board file for that compiler: you'll want to run the
> whole testsuite
> with that compiler anyway.
> 
> make check RUNTESTFLAGS="gdb.pascal/*.exp --target_board=fpc-stabs"
> 
> or some such.
> 
> Obviously, by "whole testsuite" I mean the pascal parts.
> So that raises a question that may help guide the discussion.
> When testing with fpc, how do you run the testsuite?
> Do you just run the pascal subset, gdb.pascal/*.exp?
> Or do you run the WHOLE testsuite (i.e., gdb.*/*.exp),
> e.g., just a plain "make check"
> and expect the test harness to pick up fpc and DTRT.
> How do other languages handle this I wonder.
> 
> I'm not totally opposed to this (I don't like to say "No."),
> but I'm still uncomfortable with the patch.

  OK, 

so let's do it that way:
I removed the part you are uncomfortable with
and simplify the part 2 to only add the new "class" option,
see updated patch below.

  I can always resubmit this later
if I really feel that it is useful,
but I admit that your point about the default 
debug mode is valid.

  Is the modified patch series
OK for you?

Pierre Muller
as pascal language maintainer



gdb/testsuite ChangeLog entry:

2015-01-14  Pierre Muller  <muller@soureware.org>

	* lib/pascal.exp (gpc_compile): Add new option "class".
	(fpc_compile): Likewise.
---
 gdb/testsuite/lib/pascal.exp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp
index 994e3da..7b8b0e0 100644
--- a/gdb/testsuite/lib/pascal.exp
+++ b/gdb/testsuite/lib/pascal.exp
@@ -91,6 +91,13 @@ proc gpc_compile {source dest type options} {
 		append add_flags " -g"
 	    }
 	}
+	if { $i == "class" } {
+	    if [board_info $dest exists pascal_class_flags] {
+		append add_flags " [board_info $dest pscal_class_flags]"
+	    } else {
+		append add_flags " --extended-syntax"
+	    }
+	}
     }
 
     set result [remote_exec host $gpc_compiler "-o $dest --automake $add_flags $source"]
@@ -120,6 +127,13 @@ proc fpc_compile {source dest type options} {
 		append add_flags " -g"
 	    }
 	}
+	if { $i == "class" } {
+	    if [board_info $dest exists pascal_class_flags] {
+		append add_flags " [board_info $dest pscal_class_flags]"
+	    } else {
+		append add_flags " -Mobjfpc"
+	    }
+	}
     }
 
     set result [remote_exec host $fpc_compiler "-o$dest $add_flags $source"]
-- 
2.1.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [RFA PATCH 3/3] Testcase for pascal/17815
       [not found]           ` <54afff6b.ee8d440a.16ee.ffffb424SMTPIN_ADDED_BROKEN@mx.google.com>
@ 2015-01-22 12:46             ` Pedro Alves
  2015-01-23  7:16               ` [RFA PATCH 3/3 V3] " Pierre Muller
  0 siblings, 1 reply; 29+ messages in thread
From: Pedro Alves @ 2015-01-22 12:46 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'gdb-patches'

Thanks for adding the test case.

On 01/09/2015 04:18 PM, Pierre Muller wrote:
>   This adds the testcase for pascal/17815 bug report.
> 
> 
> gdb/testsuite/Changelog entry:
> 
> 2015-01-09  Pierre Muller  <muller@sourceware.org>
> 
> 	gdb.pascal/gdb17815.pas: New file.
> 	gdb.pascal/gdb17815.exp: New file.

Missing '*'.

Can you please pick a more descriptive name for the file?
One that suggests what's being tested, rather than a bug
number is ideal.  E.g., gdb.pascal/case-insensitive.{exp|pas}.

> +load_lib "pascal.exp"
> +
> +standard_testfile .pas
> +
> +if {[gdb_compile_pascal "${srcdir}/${subdir}/${srcfile}" "${binfile}"
> executable [list debug class]] != "" } {
> +    untested $testfile.exp
> +    return -1
> +}
> +
> +clean_restart ${testfile}
> +set bp_location [gdb_get_line_number "set breakpoint here"]
> +
> +if { [gdb_breakpoint ${srcfile}:${bp_location}] } {
> +    pass "setting breakpoint"
> +}
> +
> +# Verify that "start" lands inside the right procedure.
> +if { [gdb_start_cmd] < 0 } {
> +    untested start
> +    return -1
> +}
> +
> +gdb_test "" ".* at .*${srcfile}.*" "start"
> +gdb_test "continue" ""

I won't object to this, given that it seems like all
pascal tests do it, but I'll note that it's best to avoid
gdb_start_cmd unless we're really testing the "start" command,
as otherwise the test won't run against gdbserver
(try --target_board=native-gdbserver).  Doesn't runto_main
work?

> +# We are now inside CHECK method

Could you add a period at end of sentences?  Here and throughout.

> +gdb_test "p X" " = 67"
> +gdb_test "p B.X" " = -1"
> +# As A is global, we can also check it global value
                                       ^^
Should be "its".

Or, "check its value"?  What's a _global_ value?

> +gdb_test "p A.X" " = 67"
> +gdb_test "p Y" " = 33"
> +gdb_test "p Y" " = 33"

Duplicate test here.  Please try the recipe at:

 https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Make_sure_test_messages_are_unique

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [RFA PATCH 2/3 V2] Add "class" option for pascal compiler
       [not found]                   ` <54b6858f.a287440a.5b61.ffff9ef0SMTPIN_ADDED_BROKEN@mx.google.com>
@ 2015-01-22 12:49                     ` Pedro Alves
  2015-01-23  5:21                       ` [RFA PATCH 2/3 V3] " Pierre Muller
  0 siblings, 1 reply; 29+ messages in thread
From: Pedro Alves @ 2015-01-22 12:49 UTC (permalink / raw)
  To: Pierre Muller, 'Doug Evans'; +Cc: 'gdb-patches'

On 01/14/2015 03:04 PM, Pierre Muller wrote:

>      set result [remote_exec host $gpc_compiler "-o $dest --automake $add_flags $source"]
> @@ -120,6 +127,13 @@ proc fpc_compile {source dest type options} {
>  		append add_flags " -g"
>  	    }
>  	}
> +	if { $i == "class" } {
> +	    if [board_info $dest exists pascal_class_flags] {
> +		append add_flags " [board_info $dest pscal_class_flags]"

It'd be good to try setting this in a board file to make sure it
works.  I've spotted a typo here (same in the gpc branch): "pscal_class_flags".

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [RFA PATCH 2/3 V3] Add "class" option for pascal compiler
  2015-01-22 12:49                     ` Pedro Alves
@ 2015-01-23  5:21                       ` Pierre Muller
  2015-01-23 11:55                         ` Pedro Alves
  0 siblings, 1 reply; 29+ messages in thread
From: Pierre Muller @ 2015-01-23  5:21 UTC (permalink / raw)
  To: 'Pedro Alves', 'Doug Evans'; +Cc: 'gdb-patches'


> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : jeudi 22 janvier 2015 13:50
> À : Pierre Muller; 'Doug Evans'
> Cc : 'gdb-patches'
> Objet : Re: [RFA PATCH 2/3 V2] Add "class" option for pascal compiler
> 
> On 01/14/2015 03:04 PM, Pierre Muller wrote:
> 
> >      set result [remote_exec host $gpc_compiler "-o $dest --automake
> $add_flags $source"]
> > @@ -120,6 +127,13 @@ proc fpc_compile {source dest type options} {
> >  		append add_flags " -g"
> >  	    }
> >  	}
> > +	if { $i == "class" } {
> > +	    if [board_info $dest exists pascal_class_flags] {
> > +		append add_flags " [board_info $dest pscal_class_flags]"
> 
> It'd be good to try setting this in a board file to make sure it
> works.  I've spotted a typo here (same in the gpc branch):
> "pscal_class_flags".

  I corrected the error below,
but I never worked with boardinfo files,
so I am not really sure how this works.
 
> Thanks,
> Pedro Alves

  Corrected patch below,

Pierre

gdb/ChangeLog entry:

2015-01-23  Pierre Muller  <muller@sourceware.org>

	* lib/pascal.exp (gpc_compile): Add new option "class".
	(fpc_compile): Likewise.
---
 gdb/testsuite/lib/pascal.exp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp
index 994e3da..0a2aa75 100644
--- a/gdb/testsuite/lib/pascal.exp
+++ b/gdb/testsuite/lib/pascal.exp
@@ -91,6 +91,13 @@ proc gpc_compile {source dest type options} {
 		append add_flags " -g"
 	    }
 	}
+	if { $i == "class" } {
+	    if [board_info $dest exists pascal_class_flags] {
+		append add_flags " [board_info $dest pascal_class_flags]"
+	    } else {
+		append add_flags " --extended-syntax"
+	    }
+	}
     }
 
     set result [remote_exec host $gpc_compiler "-o $dest --automake $add_flags $source"]
@@ -120,6 +127,13 @@ proc fpc_compile {source dest type options} {
 		append add_flags " -g"
 	    }
 	}
+	if { $i == "class" } {
+	    if [board_info $dest exists pascal_class_flags] {
+		append add_flags " [board_info $dest pascal_class_flags]"
+	    } else {
+		append add_flags " -Mobjfpc"
+	    }
+	}
     }

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [RFA PATCH 3/3 V3] Testcase for pascal/17815
  2015-01-22 12:46             ` [RFA PATCH 3/3] Testcase for pascal/17815 Pedro Alves
@ 2015-01-23  7:16               ` Pierre Muller
  2015-01-23 12:29                 ` Pedro Alves
  0 siblings, 1 reply; 29+ messages in thread
From: Pierre Muller @ 2015-01-23  7:16 UTC (permalink / raw)
  To: 'Pedro Alves'; +Cc: 'gdb-patches'

Hi Pedro,

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : jeudi 22 janvier 2015 13:46
> À : Pierre Muller
> Cc : 'gdb-patches'
> Objet : Re: [RFA PATCH 3/3] Testcase for pascal/17815
> 
> Thanks for adding the test case.
> 
> On 01/09/2015 04:18 PM, Pierre Muller wrote:
> >   This adds the testcase for pascal/17815 bug report.
> >
> >
> > gdb/testsuite/Changelog entry:
> >
> > 2015-01-09  Pierre Muller  <muller@sourceware.org>
> >
> > 	gdb.pascal/gdb17815.pas: New file.
> > 	gdb.pascal/gdb17815.exp: New file.
> 
> Missing '*'. 
  Fixed below.

> Can you please pick a more descriptive name for the file?
> One that suggests what's being tested, rather than a bug
> number is ideal.  E.g., gdb.pascal/case-insensitive.{exp|pas}.
 
  I used your suggestion, but this is not
really a general case insensitiveness test...
 
> > +load_lib "pascal.exp"
> > +
> > +standard_testfile .pas
> > +
> > +if {[gdb_compile_pascal "${srcdir}/${subdir}/${srcfile}"
> "${binfile}"
> > executable [list debug class]] != "" } {
> > +    untested $testfile.exp
> > +    return -1
> > +}
> > +
> > +clean_restart ${testfile}
> > +set bp_location [gdb_get_line_number "set breakpoint here"]
> > +
> > +if { [gdb_breakpoint ${srcfile}:${bp_location}] } {
> > +    pass "setting breakpoint"
> > +}
> > +
> > +# Verify that "start" lands inside the right procedure.
> > +if { [gdb_start_cmd] < 0 } {
> > +    untested start
> > +    return -1
> > +}
> > +
> > +gdb_test "" ".* at .*${srcfile}.*" "start"
> > +gdb_test "continue" ""
> 
> I won't object to this, given that it seems like all
> pascal tests do it, but I'll note that it's best to avoid
> gdb_start_cmd unless we're really testing the "start" command,
> as otherwise the test won't run against gdbserver
> (try --target_board=native-gdbserver).  Doesn't runto_main
> work?

  No, I tried and using runto_main,
I got only failures, because it apparently did not stop
at all on the breakpoint set earlier...
Is there some code inside runto_main that
deleted previously installed breakpoints?
Why is that so?
  I kept gdb_start_cmd for now.
> > +# We are now inside CHECK method
> 
> Could you add a period at end of sentences?  Here and throughout.
 Tried to do it below.
> > +gdb_test "p X" " = 67"
> > +gdb_test "p B.X" " = -1"
> > +# As A is global, we can also check it global value
>                                        ^^
> Should be "its".
> 
> Or, "check its value"?  What's a _global_ value?
 Comment adapted. 
> > +gdb_test "p A.X" " = 67"
> > +gdb_test "p Y" " = 33"
> > +gdb_test "p Y" " = 33"
> 
> Duplicate test here.  Please try the recipe at:
> https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Make_sure_test_mess
> ages_are_unique
I used this, and got no duplicate in the new version below.
> Thanks,
Thank you for the review,
here is an updated RFA.

Pierre Muller

gdb/testsuite/ChangeLog entry:

2015-01-23  Pierre Muller  <muller@sourceware.org>

	PR pascal/17815
	* gdb.pascal/case-insensitive.pas: New file.
	* gdb.pascal/case-insensitive.exp: New file.

---
 gdb/testsuite/gdb.pascal/case-insensitive.exp | 62
+++++++++++++++++++++++++++
 gdb/testsuite/gdb.pascal/case-insensitive.pas | 61
++++++++++++++++++++++++++
 2 files changed, 123 insertions(+)
 create mode 100644 gdb/testsuite/gdb.pascal/case-insensitive.exp
 create mode 100644 gdb/testsuite/gdb.pascal/case-insensitive.pas

diff --git a/gdb/testsuite/gdb.pascal/case-insensitive.exp
b/gdb/testsuite/gdb.pascal/case-insensitive.exp
new file mode 100644
index 0000000..cbeae90
--- /dev/null
+++ b/gdb/testsuite/gdb.pascal/case-insensitive.exp
@@ -0,0 +1,62 @@
+# Copyright 2015 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+load_lib "pascal.exp"
+
+standard_testfile .pas
+
+if {[gdb_compile_pascal "${srcdir}/${subdir}/${srcfile}" "${binfile}"
executable [list debug class]] != "" } {
+    untested $testfile.exp
+    return -1
+}
+
+clean_restart ${testfile}
+set bp_location [gdb_get_line_number "set breakpoint here"]
+
+if { [gdb_breakpoint ${srcfile}:${bp_location}] } {
+    pass "setting breakpoint"
+}
+
+# Verify that "start" lands inside the right procedure.
+if { [gdb_start_cmd] < 0 } {
+    untested start
+    return -1
+}
+
+gdb_test "continue" ""
+# We are now inside CHECK method.
+gdb_test "p X" " = 67"
+gdb_test "p B.X" " = -1"
+# As A is global, we can also check its value.
+gdb_test "p A.X" " = 67"
+gdb_test "p Y" " = 33"
+gdb_test "p B.Y" " = -1"
+gdb_test "p A.Y" " = 33"
+# Now test lowercase version.
+gdb_test "p x" " = 67"
+gdb_test "p B.x" " = -1"
+# As A is global, we can also check its value, with lowercase.
+gdb_test "p A.x" " = 67"
+gdb_test "p y" " = 33"
+gdb_test "p B.y" " = -1"
+gdb_test "p A.y" " = 33"
+# Also test lowercase class names.
+gdb_test "p b.X" " = -1"
+gdb_test "p b.x" " = -1"
+gdb_test "p a.Y" " = 33"
+gdb_test "p a.y" " = 33"
+
+gdb_exit
+
diff --git a/gdb/testsuite/gdb.pascal/case-insensitive.pas
b/gdb/testsuite/gdb.pascal/case-insensitive.pas
new file mode 100644
index 0000000..870bd34
--- /dev/null
+++ b/gdb/testsuite/gdb.pascal/case-insensitive.pas
@@ -0,0 +1,61 @@
+{
+ Copyright 2015 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+}
+
+
+program test_gdb_17815;
+
+
+type
+  TA = class
+  public
+  x, y : integer;
+  constructor Create;
+  function check(b : TA) : boolean;
+  destructor Done; virtual;
+end;
+
+constructor TA.Create;
+begin
+  x:=-1;
+  y:=-1;
+end;
+
+destructor TA.Done;
+begin
+end;
+
+function TA.check (b : TA) : boolean;
+begin
+  check:=(x < b.x); { set breakpoint here }
+end;
+
+
+
+var
+  a, b : TA;
+
+begin
+  a:=TA.Create;
+  b:=TA.Create;
+  a.x := 67;
+  a.y := 33;
+  if a.check (b) then
+    writeln('Error in check')
+  else
+    writeln('check OK');
+end.
+
-- 
2.1.4

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [RFA PATCH 1/3 V3] Remember the case pattern that allowed finding a field of this.
  2015-01-09 16:16           ` [RFA PATCH 1/3] Remember the case pattern that allowed finding a field of this Pierre Muller
@ 2015-01-23  7:30             ` Pierre Muller
  2015-02-04 23:37               ` [RFA PATCH 1/3 V4] " Pierre Muller
  0 siblings, 1 reply; 29+ messages in thread
From: Pierre Muller @ 2015-01-23  7:30 UTC (permalink / raw)
  To: 'Pierre Muller', 'Pedro Alves'; +Cc: 'gdb-patches'

For this one also,
an update is necessary:
I realized that I got wrong output
for some field of this variables,
and it turned out to be due to missing
initialization of some local variables.

gdb/ChangeLog entry:
 
2015-01-22  Pierre Muller  <muller@sourceware.org>

       PR pascal/17815
       * p-exp.y (yylex): Remember the case pattern that allowed finding
       a field of this.

---
 gdb/p-exp.y | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index a1c78bf..101de09 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -1551,7 +1551,7 @@ yylex (void)
     int is_a_field = 0;
     int hextype;
 
-
+    is_a_field_of_this.type = NULL;
     if (search_field && current_type)
       is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
     if (is_a_field)
@@ -1598,15 +1598,20 @@ yylex (void)
 			      VAR_DOMAIN, &is_a_field_of_this);
       }
 
-    if (is_a_field)
+    if (is_a_field || (is_a_field_of_this.type != NULL))
       {
 	tempbuf = (char *) realloc (tempbuf, namelen + 1);
 	strncpy (tempbuf, tmp, namelen);
 	tempbuf [namelen] = 0;
 	yylval.sval.ptr = tempbuf;
 	yylval.sval.length = namelen;
+	yylval.ssym.sym = NULL;
 	free (uptokstart);
-	return FIELDNAME;
+        yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
+	if (is_a_field)
+	  return FIELDNAME;
+	else
+	  return NAME;
       }
     /* Call lookup_symtab, not lookup_partial_symtab, in case there are
        no psymtabs (coff, xcoff, or some future change to blow away the
@@ -1739,7 +1744,6 @@ yylex (void)
     free(uptokstart);
     /* Any other kind of symbol.  */
     yylval.ssym.sym = sym;
-    yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
     return NAME;
   }
 }
-- 
2.1.4

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [RFA PATCH 2/3 V3] Add "class" option for pascal compiler
  2015-01-23  5:21                       ` [RFA PATCH 2/3 V3] " Pierre Muller
@ 2015-01-23 11:55                         ` Pedro Alves
  2015-02-04 23:37                           ` [RFA PATCH 2/3 V4] " Pierre Muller
  0 siblings, 1 reply; 29+ messages in thread
From: Pedro Alves @ 2015-01-23 11:55 UTC (permalink / raw)
  To: Pierre Muller, 'Doug Evans'; +Cc: 'gdb-patches'

On 01/23/2015 12:13 AM, Pierre Muller wrote:
>> Pedro Alves wrote:
>>> +	if { $i == "class" } {
>>> +	    if [board_info $dest exists pascal_class_flags] {
>>> +		append add_flags " [board_info $dest pscal_class_flags]"
>>
>> It'd be good to try setting this in a board file to make sure it
>> works.  I've spotted a typo here (same in the gpc branch):
>> "pscal_class_flags".
> 
>   I corrected the error below,
> but I never worked with boardinfo files,
> so I am not really sure how this works.

Should be something around this:

Create an empty ~/etc/site.exp file.  Point the
DEJAGNU environment variable to it, like:

  export DEJAGNU=/home/pedro/etc/site.exp

Create a ~/etc/boards/ directory, and create
a ~/etc/boards/fpc.exp file with this:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
unset_board_info isremote
set_board_info isremote 0
load_generic_config "unix"

set_board_info compiler "[find_gcc]"

set_board_info pascal_class_flags "-Mobjfpc"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Run the pascal tests with

make check RUNTESTFLAGS="--target_board=fpc --directory=gdb.pascal"

Play with $pascal_class_flags, and make sure it does have the
effect intended.

The patch looks good to me.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [RFA PATCH 3/3 V3] Testcase for pascal/17815
  2015-01-23  7:16               ` [RFA PATCH 3/3 V3] " Pierre Muller
@ 2015-01-23 12:29                 ` Pedro Alves
  2015-02-04 23:37                   ` [RFA PATCH 3/3 V4] " Pierre Muller
  0 siblings, 1 reply; 29+ messages in thread
From: Pedro Alves @ 2015-01-23 12:29 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'gdb-patches'

On 01/23/2015 12:20 AM, Pierre Muller wrote:
> Hi Pedro,
> 
>> -----Message d'origine-----
>> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
>> owner@sourceware.org] De la part de Pedro Alves
>> Envoyé : jeudi 22 janvier 2015 13:46
>> À : Pierre Muller
>> Cc : 'gdb-patches'
>> Objet : Re: [RFA PATCH 3/3] Testcase for pascal/17815
>>
>> Thanks for adding the test case.
>>
>> On 01/09/2015 04:18 PM, Pierre Muller wrote:
>>>   This adds the testcase for pascal/17815 bug report.
>>>
>>>
>>> gdb/testsuite/Changelog entry:
>>>
>>> 2015-01-09  Pierre Muller  <muller@sourceware.org>
>>>
>>> 	gdb.pascal/gdb17815.pas: New file.
>>> 	gdb.pascal/gdb17815.exp: New file.
>>
>> Missing '*'. 
>   Fixed below.
> 
>> Can you please pick a more descriptive name for the file?
>> One that suggests what's being tested, rather than a bug
>> number is ideal.  E.g., gdb.pascal/case-insensitive.{exp|pas}.
>  
>   I used your suggestion, but this is not
> really a general case insensitiveness test...

You mean, it's just for symbols, rather than filesystems, etc?
gdb.pascal/case-insensitive-symbols.{exp|pas} would be my
suggestion then.  But these are just suggestions.  Feel free to
pick something else.

> 
>   No, I tried and using runto_main,
> I got only failures, because it apparently did not stop
> at all on the breakpoint set earlier...
> Is there some code inside runto_main that
> deleted previously installed breakpoints?

Yes, it's the first thing runto_main -> runto does.

Why not just set the breakpoints after reaching main?

Or simpler still, use "runto $foo" directly, like:

set bp_location [gdb_get_line_number "set breakpoint here"]
if { ![runto ${srcfile}:${bp_location}] } {
    return 0
}

Or simpler still, just:

if { ![runto "check"] } {
    return 0
}

Assuming that to set a breakpoint on the "check" function,
you'd do "break check" in GDB.  If not, replace "check" with
whatever linespec would be used instead.

The patch looks good to me.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [RFA PATCH 1/3 V4] Remember the case pattern that allowed finding a field of this.
  2015-01-23  7:30             ` [RFA PATCH 1/3 V3] " Pierre Muller
@ 2015-02-04 23:37               ` Pierre Muller
  0 siblings, 0 replies; 29+ messages in thread
From: Pierre Muller @ 2015-02-04 23:37 UTC (permalink / raw)
  To: 'Pierre Muller', 'Pedro Alves'; +Cc: 'gdb-patches'

  This is the fix in the pascal parser (p-exp.y),
to avoid the error that GDB does find normal variables
case insensitively, but not fields of this,
inside a class or object method.

gdb/ChangeLog entry:

2015-02-04  Pierre Muller  <muller@sourceware.org>
        * p-exp.y (yylex): Reorganize code to return the matched pattern
        for a field of this.
---
 gdb/p-exp.y | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index a1c78bf..101de09 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -1551,7 +1551,7 @@ yylex (void)
     int is_a_field = 0;
     int hextype;
 
-
+    is_a_field_of_this.type = NULL;
     if (search_field && current_type)
       is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
     if (is_a_field)
@@ -1598,15 +1598,20 @@ yylex (void)
 			      VAR_DOMAIN, &is_a_field_of_this);
       }
 
-    if (is_a_field)
+    if (is_a_field || (is_a_field_of_this.type != NULL))
       {
 	tempbuf = (char *) realloc (tempbuf, namelen + 1);
 	strncpy (tempbuf, tmp, namelen);
 	tempbuf [namelen] = 0;
 	yylval.sval.ptr = tempbuf;
 	yylval.sval.length = namelen;
+	yylval.ssym.sym = NULL;
 	free (uptokstart);
-	return FIELDNAME;
+        yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
+	if (is_a_field)
+	  return FIELDNAME;
+	else
+	  return NAME;
       }
     /* Call lookup_symtab, not lookup_partial_symtab, in case there are
        no psymtabs (coff, xcoff, or some future change to blow away the
@@ -1739,7 +1744,6 @@ yylex (void)
     free(uptokstart);
     /* Any other kind of symbol.  */
     yylval.ssym.sym = sym;
-    yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
     return NAME;
   }
 }
-- 
2.1.4

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [RFA 0/3 V4] Fix pascal behavior for class fields with testcase
  2015-01-09 16:16           ` [RFA 0/3] Fix pascal behavior for class fields with testcase Pierre Muller
  2015-01-09 16:18             ` [RFA PATCH 2/3] Add debug-stabs debug-dwarf and class option for pascal compiler Pierre Muller
@ 2015-02-04 23:37             ` Pierre Muller
  2015-02-15  6:59               ` PING " Pierre Muller
       [not found]               ` <54e043b2.626ec20a.0c59.ffffaeacSMTPIN_ADDED_BROKEN@mx.google.com>
  1 sibling, 2 replies; 29+ messages in thread
From: Pierre Muller @ 2015-02-04 23:37 UTC (permalink / raw)
  To: 'Pedro Alves', 'Doug Evans'; +Cc: 'gdb-patches'

  Hi all,

this is a new round of my patch series to 
treat fields of this like any other variable
in the pascal parser.


  Pierre Muller
as pascal language maintainer.

PS: I got problem to test my series because I get an
internal-error with stabs generated debug information:

Doug, I suspect this is due to the series you committed 
Re: [PATCH 0/5] Remove struct main_type.vptr_{fieldno,basetype}


$ ../gdb --args ../gdb ./gdb.pascal/case-insensitive-symbols
.........
(top-gdb) run
Breakpoint 1, internal_error (file=0x7f5fcc
<NS_INTEGER_POINTER_CONVERSION_BADNESS+204>
"../../../binutils-gdb/gdb/gdbtypes.c", line=1204,
    fmt=0x7f5f9e <NS_INTEGER_POINTER_CONVERSION_BADNESS+158> "%s: Assertion
`%s' failed.") at ../../../binutils-gdb/gdb/common/errors.c:54
54        va_start (ap, fmt);
(top-gdb) bt
#0  internal_error (file=0x7f5fcc
<NS_INTEGER_POINTER_CONVERSION_BADNESS+204>
"../../../binutils-gdb/gdb/gdbtypes.c", line=1204,
    fmt=0x7f5f9e <NS_INTEGER_POINTER_CONVERSION_BADNESS+158> "%s: Assertion
`%s' failed.") at ../../../binutils-gdb/gdb/common/errors.c:54
#1  0x00570b43 in internal_type_self_type (type=0x801b1628) at
../../../binutils-gdb/gdb/gdbtypes.c:1204
#2  0x005e31a3 in read_member_functions (fip=0x2c2a354, pp=0x2c2a4c0,
type=0x801b1540, objfile=0x8014baa0) at
../../../binutils-gdb/gdb/stabsread.c:2389
#3  0x005e5c1d in read_struct_type (pp=0x2c2a4c0, type=0x801b1540,
type_code=TYPE_CODE_STRUCT, objfile=0x8014baa0) at
../../../binutils-gdb/gdb/stabsread.c:3555
#4  0x005e23c7 in read_type (pp=0x2c2a4c0, objfile=0x8014baa0) at
../../../binutils-gdb/gdb/stabsread.c:2006
#5  0x005e0b16 in define_symbol (valu=0,
    string=0x801a6ebc
"TOBJECT:Tt15=s4$vf15:14,0;CREATE::17=##16;:__ct__7TOBJECT7POINTER;2A.;DESTR
OY::18=##3;:__dt__7TOBJECT7POINTER;2A*0;15;;NEWINSTANCE::19=##16;:11unnamedt
ype;2A*1;15;;FREEINSTANCE::20=##3;:7TOBJECT;2A*2;"..., desc=0, type=128,
objfile=0x8014baa0) at ../../../binutils-gdb/gdb/stabsread.c:1316
#6  0x005ac0f6 in process_one_symbol (type=128, desc=0, valu=0,
    name=0x801a6ebc
"TOBJECT:Tt15=s4$vf15:14,0;CREATE::17=##16;:__ct__7TOBJECT7POINTER;2A.;DESTR
OY::18=##3;:__dt__7TOBJECT7POINTER;2A*0;15;;NEWINSTANCE::19=##16;:11unnamedt
ype;2A*1;15;;FREEINSTANCE::20=##3;:7TOBJECT;2A*2;"...,
section_offsets=0x8015ba88, objfile=0x8014baa0) at
../../../binutils-gdb/gdb/dbxread.c:3217
#7  0x005ab00d in read_ofile_symtab (objfile=0x8014baa0, pst=0x801a7c00) at
../../../binutils-gdb/gdb/dbxread.c:2601
#8  0x005aaa85 in dbx_psymtab_to_symtab_1 (objfile=0x8014baa0,
pst=0x801a7c00) at ../../../binutils-gdb/gdb/dbxread.c:2418
#9  0x005aabbc in dbx_read_symtab (self=0x801a7c00, objfile=0x8014baa0) at
../../../binutils-gdb/gdb/dbxread.c:2471
#10 0x0051fb16 in psymtab_to_symtab (objfile=0x8014baa0, pst=0x801a7c00) at
../../../binutils-gdb/gdb/psymtab.c:788
#11 0x0051f3a3 in psym_lookup_symbol (objfile=0x8014baa0, block_index=0,
name=0x8003ba88 "main", domain=VAR_DOMAIN) at
../../../binutils-gdb/gdb/psymtab.c:520
#12 0x00518210 in lookup_symbol_via_quick_fns (objfile=0x8014baa0,
block_index=0, name=0x8003ba88 "main", domain=VAR_DOMAIN) at
../../../binutils-gdb/gdb/symtab.c:2436
#13 0x00518558 in lookup_symbol_in_objfile (objfile=0x8014baa0,
block_index=0, name=0x8003ba88 "main", domain=VAR_DOMAIN) at
../../../binutils-gdb/gdb/symtab.c:2604
#14 0x0051872f in lookup_symbol_global_iterator_cb (objfile=0x8014baa0,
cb_data=0x2c2a888) at ../../../binutils-gdb/gdb/symtab.c:2685
#15 0x0041bda5 in windows_iterate_over_objfiles_in_search_order
(gdbarch=0x8014a3a8, cb=0x5186bf <lookup_symbol_global_iterator_cb>,
cb_data=0x2c2a888, current_objfile=0x0)
    at ../../../binutils-gdb/gdb/windows-tdep.c:452
#16 0x0056c62c in gdbarch_iterate_over_objfiles_in_search_order
(gdbarch=0x8014a3a8, cb=0x5186bf <lookup_symbol_global_iterator_cb>,
cb_data=0x2c2a888, current_objfile=0x0)
    at ../../../binutils-gdb/gdb/gdbarch.c:4412
#17 0x00518847 in lookup_global_symbol (name=0x8003ba88 "main", block=0x0,
domain=VAR_DOMAIN) at ../../../binutils-gdb/gdb/symtab.c:2730
#18 0x00518386 in basic_lookup_symbol_nonlocal (langdef=0x81cf80
<c_language_defn>, name=0x8003ba88 "main", block=0x0, domain=VAR_DOMAIN) at
../../../binutils-gdb/gdb/symtab.c:2530
#19 0x00517b46 in lookup_symbol_aux (name=0x8003ba88 "main", block=0x0,
domain=VAR_DOMAIN, language=language_c, is_a_field_of_this=0x0) at
../../../binutils-gdb/gdb/symtab.c:2148
#20 0x00517501 in lookup_symbol_in_language (name=0x8003ba88 "main",
block=0x0, domain=VAR_DOMAIN, lang=language_c, is_a_field_of_this=0x0) at
../../../binutils-gdb/gdb/symtab.c:1944
#21 0x00517546 in lookup_symbol (name=0x8003ba88 "main", block=0x0,
domain=VAR_DOMAIN, is_a_field_of_this=0x0) at
../../../binutils-gdb/gdb/symtab.c:1958
#22 0x00524cee in set_initial_language () at
../../../binutils-gdb/gdb/symfile.c:1698
#23 0x005243bf in symbol_file_add_main_1 (args=0x2c2ac49
"./gdb.pascal/case-insensitive-symbols", from_tty=1, flags=0) at
../../../binutils-gdb/gdb/symfile.c:1327
#24 0x00524360 in symbol_file_add_main (args=0x2c2ac49
"./gdb.pascal/case-insensitive-symbols", from_tty=1) at
../../../binutils-gdb/gdb/symfile.c:1311
#25 0x00556ac9 in catch_command_errors_const (command=0x524340
<symbol_file_add_main>, arg=0x2c2ac49
"./gdb.pascal/case-insensitive-symbols", from_tty=1, mask=RETURN_MASK_ALL)
    at ../../../binutils-gdb/gdb/main.c:396
#26 0x0055799a in captured_main (data=0x2c2abc4) at
../../../binutils-gdb/gdb/main.c:1042
#27 0x00552c81 in catch_errors (func=0x556d1a <captured_main>,
func_args=0x2c2abc4, errstring=0x7eb761 <__PRETTY_FUNCTION__.13998+168> "",
mask=RETURN_MASK_ALL)
    at ../../../binutils-gdb/gdb/exceptions.c:237
#28 0x00557d2f in gdb_main (args=0x2c2abc4) at
../../../binutils-gdb/gdb/main.c:1157
#29 0x0040120c in main (
During symbol reading, incomplete CFI data; DW_CFA_restore unspecified
register ebx (#3) at 0x6100776e.
argc=2, argv=0x2c2abfc) at ../../../binutils-gdb/gdb/gdb.c:32

(top-gdb) f 1
#1  0x00570b43 in internal_type_self_type (type=0x801b1628) at
../../../binutils-gdb/gdb/gdbtypes.c:1204
1204          gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_FUNC);
(top-gdb) p *type.main_type
$1 = {code = TYPE_CODE_METHOD, flag_unsigned = 0, flag_nosign = 0, flag_stub
= 1, flag_target_stub = 0, flag_static = 0, flag_prototyped = 0,
flag_incomplete = 0, flag_varargs = 0,
  flag_vector = 0, flag_stub_supported = 0, flag_gnu_ifunc = 0,
flag_fixed_instance = 0, flag_objfile_owned = 1, flag_declared_class = 0,
flag_flag_enum = 0,
  type_specific_field = TYPE_SPECIFIC_NONE, nfields = 0, name = 0x0,
tag_name = 0x0, owner = {objfile = 0x8014baa0, gdbarch = 0x8014baa0},
target_type = 0x801b15e8, flds_bnds = {fields = 0x0,
    bounds = 0x0}, type_specific = {cplus_stuff = 0x0, gnat_stuff = 0x0,
floatformat = 0x0, func_stuff = 0x0, self_type = 0x0}, data_location = 0x0}

No calls to set_type_self_type up to this error point.

TOBJECT is the fundamental class type for Free Pascal,
and this code had no problems before.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [RFA PATCH 2/3 V4] Add "class" option for pascal compiler
  2015-01-23 11:55                         ` Pedro Alves
@ 2015-02-04 23:37                           ` Pierre Muller
  0 siblings, 0 replies; 29+ messages in thread
From: Pierre Muller @ 2015-02-04 23:37 UTC (permalink / raw)
  To: 'Pedro Alves', 'Doug Evans'; +Cc: 'gdb-patches'

This part of the patch series is unchanged.
It adds class option to pascal compiler
which adds the required command line option to
accept pascal class types.



gdb/testsuite/ChangeLog entry:

2015-02-04  Pierre Muller  <muller@sourceware.org>

	* lib/pascal.exp (gpc_compile): Add new option "class".
	(fpc_compile): Likewise.
---
 gdb/testsuite/lib/pascal.exp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp
index 994e3da..0a2aa75 100644
--- a/gdb/testsuite/lib/pascal.exp
+++ b/gdb/testsuite/lib/pascal.exp
@@ -91,6 +91,13 @@ proc gpc_compile {source dest type options} {
 		append add_flags " -g"
 	    }
 	}
+	if { $i == "class" } {
+	    if [board_info $dest exists pascal_class_flags] {
+		append add_flags " [board_info $dest pascal_class_flags]"
+	    } else {
+		append add_flags " --extended-syntax"
+	    }
+	}
     }
 
     set result [remote_exec host $gpc_compiler "-o $dest --automake $add_flags $source"]
@@ -120,6 +127,13 @@ proc fpc_compile {source dest type options} {
 		append add_flags " -g"
 	    }
 	}
+	if { $i == "class" } {
+	    if [board_info $dest exists pascal_class_flags] {
+		append add_flags " [board_info $dest pascal_class_flags]"
+	    } else {
+		append add_flags " -Mobjfpc"
+	    }
+	}
     }
 
     set result [remote_exec host $fpc_compiler "-o$dest $add_flags $source"]
-- 
2.1.4

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [RFA PATCH 3/3 V4] Testcase for pascal/17815
  2015-01-23 12:29                 ` Pedro Alves
@ 2015-02-04 23:37                   ` Pierre Muller
  0 siblings, 0 replies; 29+ messages in thread
From: Pierre Muller @ 2015-02-04 23:37 UTC (permalink / raw)
  To: 'Pedro Alves'; +Cc: 'gdb-patches'

  Here is an updated version of this test,
using Pedro's suggestions.



gdb/testsuite/ChangeLog entry:

2015-02-04  Pierre Muller  <muller@sourceware.org>

	Test for PR pascal/17815.
	* gdb.pascal/case-insensitive-symbols.pas: New file.
	* gdb.pascal/case-insensitive-symbols.exp: New file.
---
 .../gdb.pascal/case-insensitive-symbols.exp        | 58
++++++++++++++++++++
 .../gdb.pascal/case-insensitive-symbols.pas        | 63
++++++++++++++++++++++
 2 files changed, 121 insertions(+)
 create mode 100644 gdb/testsuite/gdb.pascal/case-insensitive-symbols.exp
 create mode 100644 gdb/testsuite/gdb.pascal/case-insensitive-symbols.pas

diff --git a/gdb/testsuite/gdb.pascal/case-insensitive-symbols.exp
b/gdb/testsuite/gdb.pascal/case-insensitive-symbols.exp
new file mode 100644
index 0000000..4f1d150
--- /dev/null
+++ b/gdb/testsuite/gdb.pascal/case-insensitive-symbols.exp
@@ -0,0 +1,58 @@
+# Copyright 2015 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+load_lib "pascal.exp"
+
+standard_testfile .pas
+
+if {[gdb_compile_pascal "${srcdir}/${subdir}/${srcfile}" "${binfile}"
executable [list debug class]] != "" } {
+    untested $testfile.exp
+    return -1
+}
+
+clean_restart ${testfile}
+set bp_location [gdb_get_line_number "set breakpoint here"]
+
+if { ![runto ${srcfile}:${bp_location}] } {
+    return 0
+}
+
+# We are now inside CHECK method.
+gdb_test "p X" " = 67"
+gdb_test "p B.X" " = 11"
+gdb_test "p Y" " = 33"
+gdb_test "p B.Y" " = 35"
+# As A is global, we can also check its value.
+gdb_test "p A.X" " = 67"
+gdb_test "p A.Y" " = 33"
+# Now test lowercase version.
+gdb_test "p x" " = 67"
+gdb_test "p y" " = 33"
+gdb_test "p B.x" " = 11"
+gdb_test "p B.y" " = 35"
+# As A is global, we can also check its value, with lowercase.
+gdb_test "p A.x" " = 67"
+gdb_test "p A.y" " = 33"
+# Also test lowercase class names.
+gdb_test "p b.X" " = 11"
+gdb_test "p b.x" " = 11"
+gdb_test "p b.Y" " = 35"
+gdb_test "p b.y" " = 35"
+gdb_test "p a.X" " = 67"
+gdb_test "p a.x" " = 67"
+gdb_test "p a.Y" " = 33"
+gdb_test "p a.y" " = 33"
+
+gdb_exit
diff --git a/gdb/testsuite/gdb.pascal/case-insensitive-symbols.pas
b/gdb/testsuite/gdb.pascal/case-insensitive-symbols.pas
new file mode 100644
index 0000000..74abea4
--- /dev/null
+++ b/gdb/testsuite/gdb.pascal/case-insensitive-symbols.pas
@@ -0,0 +1,63 @@
+{
+ Copyright 2015 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+}
+
+
+program test_gdb_17815;
+
+
+type
+  TA = class
+  public
+  x, y : integer;
+  constructor Create;
+  function check(b : TA) : boolean;
+  destructor Done; virtual;
+end;
+
+constructor TA.Create;
+begin
+  x:=-1;
+  y:=-1;
+end;
+
+destructor TA.Done;
+begin
+end;
+
+function TA.check (b : TA) : boolean;
+begin
+  check:=(x < b.x); { set breakpoint here }
+end;
+
+
+
+var
+  a, b : TA;
+
+begin
+  a:=TA.Create;
+  b:=TA.Create;
+  a.x := 67;
+  a.y := 33;
+  b.x := 11;
+  b.y := 35;
+  if a.check (b) then
+    writeln('Error in check')
+  else
+    writeln('check OK');
+end.
+
-- 
2.1.4

^ permalink raw reply	[flat|nested] 29+ messages in thread

* PING [RFA 0/3 V4] Fix pascal behavior for class fields with testcase
  2015-02-04 23:37             ` [RFA 0/3 V4] Fix pascal behavior for class fields with testcase Pierre Muller
@ 2015-02-15  6:59               ` Pierre Muller
  2015-04-07 20:06                 ` PING^2 " Pierre Muller
       [not found]               ` <54e043b2.626ec20a.0c59.ffffaeacSMTPIN_ADDED_BROKEN@mx.google.com>
  1 sibling, 1 reply; 29+ messages in thread
From: Pierre Muller @ 2015-02-15  6:59 UTC (permalink / raw)
  To: 'Pierre Muller', 'Pedro Alves', 'Doug Evans'
  Cc: 'gdb-patches'

   Hi all,

I still got no reply to this new version
of my patch series.

Pierre Muller
as pascal language maintainer

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pierre Muller
> Envoyé : jeudi 5 février 2015 00:37
> À : 'Pedro Alves'; 'Doug Evans'
> Cc : 'gdb-patches'
> Objet : [RFA 0/3 V4] Fix pascal behavior for class fields with testcase
> 
>   Hi all,
> 
> this is a new round of my patch series to
> treat fields of this like any other variable
> in the pascal parser.
> 
> 
>   Pierre Muller
> as pascal language maintainer.
> 
> PS: I got problem to test my series because I get an
> internal-error with stabs generated debug information:
> 
> Doug, I suspect this is due to the series you committed
> Re: [PATCH 0/5] Remove struct main_type.vptr_{fieldno,basetype}
> 
> 
> $ ../gdb --args ../gdb ./gdb.pascal/case-insensitive-symbols
> .........
> (top-gdb) run
> Breakpoint 1, internal_error (file=0x7f5fcc
> <NS_INTEGER_POINTER_CONVERSION_BADNESS+204>
> "../../../binutils-gdb/gdb/gdbtypes.c", line=1204,
>     fmt=0x7f5f9e <NS_INTEGER_POINTER_CONVERSION_BADNESS+158> "%s:
> Assertion
> `%s' failed.") at ../../../binutils-gdb/gdb/common/errors.c:54
> 54        va_start (ap, fmt);
> (top-gdb) bt
> #0  internal_error (file=0x7f5fcc
> <NS_INTEGER_POINTER_CONVERSION_BADNESS+204>
> "../../../binutils-gdb/gdb/gdbtypes.c", line=1204,
>     fmt=0x7f5f9e <NS_INTEGER_POINTER_CONVERSION_BADNESS+158> "%s:
> Assertion
> `%s' failed.") at ../../../binutils-gdb/gdb/common/errors.c:54
> #1  0x00570b43 in internal_type_self_type (type=0x801b1628) at
> ../../../binutils-gdb/gdb/gdbtypes.c:1204
> #2  0x005e31a3 in read_member_functions (fip=0x2c2a354, pp=0x2c2a4c0,
> type=0x801b1540, objfile=0x8014baa0) at
> ../../../binutils-gdb/gdb/stabsread.c:2389
> #3  0x005e5c1d in read_struct_type (pp=0x2c2a4c0, type=0x801b1540,
> type_code=TYPE_CODE_STRUCT, objfile=0x8014baa0) at
> ../../../binutils-gdb/gdb/stabsread.c:3555
> #4  0x005e23c7 in read_type (pp=0x2c2a4c0, objfile=0x8014baa0) at
> ../../../binutils-gdb/gdb/stabsread.c:2006
> #5  0x005e0b16 in define_symbol (valu=0,
>     string=0x801a6ebc
> "TOBJECT:Tt15=s4$vf15:14,0;CREATE::17=##16;:__ct__7TOBJECT7POINTER;2A.;
> DESTR
> OY::18=##3;:__dt__7TOBJECT7POINTER;2A*0;15;;NEWINSTANCE::19=##16;:11unn
> amedt
> ype;2A*1;15;;FREEINSTANCE::20=##3;:7TOBJECT;2A*2;"..., desc=0,
> type=128,
> objfile=0x8014baa0) at ../../../binutils-gdb/gdb/stabsread.c:1316
> #6  0x005ac0f6 in process_one_symbol (type=128, desc=0, valu=0,
>     name=0x801a6ebc
> "TOBJECT:Tt15=s4$vf15:14,0;CREATE::17=##16;:__ct__7TOBJECT7POINTER;2A.;
> DESTR
> OY::18=##3;:__dt__7TOBJECT7POINTER;2A*0;15;;NEWINSTANCE::19=##16;:11unn
> amedt
> ype;2A*1;15;;FREEINSTANCE::20=##3;:7TOBJECT;2A*2;"...,
> section_offsets=0x8015ba88, objfile=0x8014baa0) at
> ../../../binutils-gdb/gdb/dbxread.c:3217
> #7  0x005ab00d in read_ofile_symtab (objfile=0x8014baa0,
> pst=0x801a7c00) at
> ../../../binutils-gdb/gdb/dbxread.c:2601
> #8  0x005aaa85 in dbx_psymtab_to_symtab_1 (objfile=0x8014baa0,
> pst=0x801a7c00) at ../../../binutils-gdb/gdb/dbxread.c:2418
> #9  0x005aabbc in dbx_read_symtab (self=0x801a7c00, objfile=0x8014baa0)
> at
> ../../../binutils-gdb/gdb/dbxread.c:2471
> #10 0x0051fb16 in psymtab_to_symtab (objfile=0x8014baa0,
> pst=0x801a7c00) at
> ../../../binutils-gdb/gdb/psymtab.c:788
> #11 0x0051f3a3 in psym_lookup_symbol (objfile=0x8014baa0,
> block_index=0,
> name=0x8003ba88 "main", domain=VAR_DOMAIN) at
> ../../../binutils-gdb/gdb/psymtab.c:520
> #12 0x00518210 in lookup_symbol_via_quick_fns (objfile=0x8014baa0,
> block_index=0, name=0x8003ba88 "main", domain=VAR_DOMAIN) at
> ../../../binutils-gdb/gdb/symtab.c:2436
> #13 0x00518558 in lookup_symbol_in_objfile (objfile=0x8014baa0,
> block_index=0, name=0x8003ba88 "main", domain=VAR_DOMAIN) at
> ../../../binutils-gdb/gdb/symtab.c:2604
> #14 0x0051872f in lookup_symbol_global_iterator_cb (objfile=0x8014baa0,
> cb_data=0x2c2a888) at ../../../binutils-gdb/gdb/symtab.c:2685
> #15 0x0041bda5 in windows_iterate_over_objfiles_in_search_order
> (gdbarch=0x8014a3a8, cb=0x5186bf <lookup_symbol_global_iterator_cb>,
> cb_data=0x2c2a888, current_objfile=0x0)
>     at ../../../binutils-gdb/gdb/windows-tdep.c:452
> #16 0x0056c62c in gdbarch_iterate_over_objfiles_in_search_order
> (gdbarch=0x8014a3a8, cb=0x5186bf <lookup_symbol_global_iterator_cb>,
> cb_data=0x2c2a888, current_objfile=0x0)
>     at ../../../binutils-gdb/gdb/gdbarch.c:4412
> #17 0x00518847 in lookup_global_symbol (name=0x8003ba88 "main",
> block=0x0,
> domain=VAR_DOMAIN) at ../../../binutils-gdb/gdb/symtab.c:2730
> #18 0x00518386 in basic_lookup_symbol_nonlocal (langdef=0x81cf80
> <c_language_defn>, name=0x8003ba88 "main", block=0x0,
> domain=VAR_DOMAIN) at
> ../../../binutils-gdb/gdb/symtab.c:2530
> #19 0x00517b46 in lookup_symbol_aux (name=0x8003ba88 "main", block=0x0,
> domain=VAR_DOMAIN, language=language_c, is_a_field_of_this=0x0) at
> ../../../binutils-gdb/gdb/symtab.c:2148
> #20 0x00517501 in lookup_symbol_in_language (name=0x8003ba88 "main",
> block=0x0, domain=VAR_DOMAIN, lang=language_c, is_a_field_of_this=0x0)
> at
> ../../../binutils-gdb/gdb/symtab.c:1944
> #21 0x00517546 in lookup_symbol (name=0x8003ba88 "main", block=0x0,
> domain=VAR_DOMAIN, is_a_field_of_this=0x0) at
> ../../../binutils-gdb/gdb/symtab.c:1958
> #22 0x00524cee in set_initial_language () at
> ../../../binutils-gdb/gdb/symfile.c:1698
> #23 0x005243bf in symbol_file_add_main_1 (args=0x2c2ac49
> "./gdb.pascal/case-insensitive-symbols", from_tty=1, flags=0) at
> ../../../binutils-gdb/gdb/symfile.c:1327
> #24 0x00524360 in symbol_file_add_main (args=0x2c2ac49
> "./gdb.pascal/case-insensitive-symbols", from_tty=1) at
> ../../../binutils-gdb/gdb/symfile.c:1311
> #25 0x00556ac9 in catch_command_errors_const (command=0x524340
> <symbol_file_add_main>, arg=0x2c2ac49
> "./gdb.pascal/case-insensitive-symbols", from_tty=1,
> mask=RETURN_MASK_ALL)
>     at ../../../binutils-gdb/gdb/main.c:396
> #26 0x0055799a in captured_main (data=0x2c2abc4) at
> ../../../binutils-gdb/gdb/main.c:1042
> #27 0x00552c81 in catch_errors (func=0x556d1a <captured_main>,
> func_args=0x2c2abc4, errstring=0x7eb761 <__PRETTY_FUNCTION__.13998+168>
> "",
> mask=RETURN_MASK_ALL)
>     at ../../../binutils-gdb/gdb/exceptions.c:237
> #28 0x00557d2f in gdb_main (args=0x2c2abc4) at
> ../../../binutils-gdb/gdb/main.c:1157
> #29 0x0040120c in main (
> During symbol reading, incomplete CFI data; DW_CFA_restore unspecified
> register ebx (#3) at 0x6100776e.
> argc=2, argv=0x2c2abfc) at ../../../binutils-gdb/gdb/gdb.c:32
> 
> (top-gdb) f 1
> #1  0x00570b43 in internal_type_self_type (type=0x801b1628) at
> ../../../binutils-gdb/gdb/gdbtypes.c:1204
> 1204          gdb_assert (TYPE_SPECIFIC_FIELD (type) ==
> TYPE_SPECIFIC_FUNC);
> (top-gdb) p *type.main_type
> $1 = {code = TYPE_CODE_METHOD, flag_unsigned = 0, flag_nosign = 0,
> flag_stub
> = 1, flag_target_stub = 0, flag_static = 0, flag_prototyped = 0,
> flag_incomplete = 0, flag_varargs = 0,
>   flag_vector = 0, flag_stub_supported = 0, flag_gnu_ifunc = 0,
> flag_fixed_instance = 0, flag_objfile_owned = 1, flag_declared_class =
> 0,
> flag_flag_enum = 0,
>   type_specific_field = TYPE_SPECIFIC_NONE, nfields = 0, name = 0x0,
> tag_name = 0x0, owner = {objfile = 0x8014baa0, gdbarch = 0x8014baa0},
> target_type = 0x801b15e8, flds_bnds = {fields = 0x0,
>     bounds = 0x0}, type_specific = {cplus_stuff = 0x0, gnat_stuff =
> 0x0,
> floatformat = 0x0, func_stuff = 0x0, self_type = 0x0}, data_location =
> 0x0}
> 
> No calls to set_type_self_type up to this error point.
> 
> TOBJECT is the fundamental class type for Free Pascal,
> and this code had no problems before.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* PING^2 [RFA 0/3 V4] Fix pascal behavior for class fields with testcase
  2015-02-15  6:59               ` PING " Pierre Muller
@ 2015-04-07 20:06                 ` Pierre Muller
  0 siblings, 0 replies; 29+ messages in thread
From: Pierre Muller @ 2015-04-07 20:06 UTC (permalink / raw)
  To: 'Pierre Muller', 'Pedro Alves', 'Doug Evans'
  Cc: 'gdb-patches'


Version 4 of my patch series
is still waiting for a comment from a
global maintainer ...
https://sourceware.org/ml/gdb-patches/2015-02/msg00110.html

Pierre Muller
as pascal language maintainer 

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pierre Muller
> Envoyé : dimanche 15 février 2015 07:58
> À : 'Pierre Muller'; 'Pedro Alves'; 'Doug Evans'
> Cc : 'gdb-patches'
> Objet : PING [RFA 0/3 V4] Fix pascal behavior for class fields with
> testcase
> 
>    Hi all,
> 
> I still got no reply to this new version
> of my patch series.
> 
> Pierre Muller
> as pascal language maintainer
> 
> > -----Message d'origine-----
> > De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> > owner@sourceware.org] De la part de Pierre Muller
> > Envoyé : jeudi 5 février 2015 00:37
> > À : 'Pedro Alves'; 'Doug Evans'
> > Cc : 'gdb-patches'
> > Objet : [RFA 0/3 V4] Fix pascal behavior for class fields with
> testcase
> >
> >   Hi all,
> >
> > this is a new round of my patch series to
> > treat fields of this like any other variable
> > in the pascal parser.
> >
> >
> >   Pierre Muller
> > as pascal language maintainer.
> >
> > PS: I got problem to test my series because I get an
> > internal-error with stabs generated debug information:
> >
> > Doug, I suspect this is due to the series you committed
> > Re: [PATCH 0/5] Remove struct main_type.vptr_{fieldno,basetype}
> >
> >
> > $ ../gdb --args ../gdb ./gdb.pascal/case-insensitive-symbols
> > .........
> > (top-gdb) run
> > Breakpoint 1, internal_error (file=0x7f5fcc
> > <NS_INTEGER_POINTER_CONVERSION_BADNESS+204>
> > "../../../binutils-gdb/gdb/gdbtypes.c", line=1204,
> >     fmt=0x7f5f9e <NS_INTEGER_POINTER_CONVERSION_BADNESS+158> "%s:
> > Assertion
> > `%s' failed.") at ../../../binutils-gdb/gdb/common/errors.c:54
> > 54        va_start (ap, fmt);
> > (top-gdb) bt
> > #0  internal_error (file=0x7f5fcc
> > <NS_INTEGER_POINTER_CONVERSION_BADNESS+204>
> > "../../../binutils-gdb/gdb/gdbtypes.c", line=1204,
> >     fmt=0x7f5f9e <NS_INTEGER_POINTER_CONVERSION_BADNESS+158> "%s:
> > Assertion
> > `%s' failed.") at ../../../binutils-gdb/gdb/common/errors.c:54
> > #1  0x00570b43 in internal_type_self_type (type=0x801b1628) at
> > ../../../binutils-gdb/gdb/gdbtypes.c:1204
> > #2  0x005e31a3 in read_member_functions (fip=0x2c2a354, pp=0x2c2a4c0,
> > type=0x801b1540, objfile=0x8014baa0) at
> > ../../../binutils-gdb/gdb/stabsread.c:2389
> > #3  0x005e5c1d in read_struct_type (pp=0x2c2a4c0, type=0x801b1540,
> > type_code=TYPE_CODE_STRUCT, objfile=0x8014baa0) at
> > ../../../binutils-gdb/gdb/stabsread.c:3555
> > #4  0x005e23c7 in read_type (pp=0x2c2a4c0, objfile=0x8014baa0) at
> > ../../../binutils-gdb/gdb/stabsread.c:2006
> > #5  0x005e0b16 in define_symbol (valu=0,
> >     string=0x801a6ebc
> >
> "TOBJECT:Tt15=s4$vf15:14,0;CREATE::17=##16;:__ct__7TOBJECT7POINTER;2A.;
> > DESTR
> >
> OY::18=##3;:__dt__7TOBJECT7POINTER;2A*0;15;;NEWINSTANCE::19=##16;:11unn
> > amedt
> > ype;2A*1;15;;FREEINSTANCE::20=##3;:7TOBJECT;2A*2;"..., desc=0,
> > type=128,
> > objfile=0x8014baa0) at ../../../binutils-gdb/gdb/stabsread.c:1316
> > #6  0x005ac0f6 in process_one_symbol (type=128, desc=0, valu=0,
> >     name=0x801a6ebc
> >
> "TOBJECT:Tt15=s4$vf15:14,0;CREATE::17=##16;:__ct__7TOBJECT7POINTER;2A.;
> > DESTR
> >
> OY::18=##3;:__dt__7TOBJECT7POINTER;2A*0;15;;NEWINSTANCE::19=##16;:11unn
> > amedt
> > ype;2A*1;15;;FREEINSTANCE::20=##3;:7TOBJECT;2A*2;"...,
> > section_offsets=0x8015ba88, objfile=0x8014baa0) at
> > ../../../binutils-gdb/gdb/dbxread.c:3217
> > #7  0x005ab00d in read_ofile_symtab (objfile=0x8014baa0,
> > pst=0x801a7c00) at
> > ../../../binutils-gdb/gdb/dbxread.c:2601
> > #8  0x005aaa85 in dbx_psymtab_to_symtab_1 (objfile=0x8014baa0,
> > pst=0x801a7c00) at ../../../binutils-gdb/gdb/dbxread.c:2418
> > #9  0x005aabbc in dbx_read_symtab (self=0x801a7c00,
> objfile=0x8014baa0)
> > at
> > ../../../binutils-gdb/gdb/dbxread.c:2471
> > #10 0x0051fb16 in psymtab_to_symtab (objfile=0x8014baa0,
> > pst=0x801a7c00) at
> > ../../../binutils-gdb/gdb/psymtab.c:788
> > #11 0x0051f3a3 in psym_lookup_symbol (objfile=0x8014baa0,
> > block_index=0,
> > name=0x8003ba88 "main", domain=VAR_DOMAIN) at
> > ../../../binutils-gdb/gdb/psymtab.c:520
> > #12 0x00518210 in lookup_symbol_via_quick_fns (objfile=0x8014baa0,
> > block_index=0, name=0x8003ba88 "main", domain=VAR_DOMAIN) at
> > ../../../binutils-gdb/gdb/symtab.c:2436
> > #13 0x00518558 in lookup_symbol_in_objfile (objfile=0x8014baa0,
> > block_index=0, name=0x8003ba88 "main", domain=VAR_DOMAIN) at
> > ../../../binutils-gdb/gdb/symtab.c:2604
> > #14 0x0051872f in lookup_symbol_global_iterator_cb
> (objfile=0x8014baa0,
> > cb_data=0x2c2a888) at ../../../binutils-gdb/gdb/symtab.c:2685
> > #15 0x0041bda5 in windows_iterate_over_objfiles_in_search_order
> > (gdbarch=0x8014a3a8, cb=0x5186bf <lookup_symbol_global_iterator_cb>,
> > cb_data=0x2c2a888, current_objfile=0x0)
> >     at ../../../binutils-gdb/gdb/windows-tdep.c:452
> > #16 0x0056c62c in gdbarch_iterate_over_objfiles_in_search_order
> > (gdbarch=0x8014a3a8, cb=0x5186bf <lookup_symbol_global_iterator_cb>,
> > cb_data=0x2c2a888, current_objfile=0x0)
> >     at ../../../binutils-gdb/gdb/gdbarch.c:4412
> > #17 0x00518847 in lookup_global_symbol (name=0x8003ba88 "main",
> > block=0x0,
> > domain=VAR_DOMAIN) at ../../../binutils-gdb/gdb/symtab.c:2730
> > #18 0x00518386 in basic_lookup_symbol_nonlocal (langdef=0x81cf80
> > <c_language_defn>, name=0x8003ba88 "main", block=0x0,
> > domain=VAR_DOMAIN) at
> > ../../../binutils-gdb/gdb/symtab.c:2530
> > #19 0x00517b46 in lookup_symbol_aux (name=0x8003ba88 "main",
> block=0x0,
> > domain=VAR_DOMAIN, language=language_c, is_a_field_of_this=0x0) at
> > ../../../binutils-gdb/gdb/symtab.c:2148
> > #20 0x00517501 in lookup_symbol_in_language (name=0x8003ba88 "main",
> > block=0x0, domain=VAR_DOMAIN, lang=language_c,
> is_a_field_of_this=0x0)
> > at
> > ../../../binutils-gdb/gdb/symtab.c:1944
> > #21 0x00517546 in lookup_symbol (name=0x8003ba88 "main", block=0x0,
> > domain=VAR_DOMAIN, is_a_field_of_this=0x0) at
> > ../../../binutils-gdb/gdb/symtab.c:1958
> > #22 0x00524cee in set_initial_language () at
> > ../../../binutils-gdb/gdb/symfile.c:1698
> > #23 0x005243bf in symbol_file_add_main_1 (args=0x2c2ac49
> > "./gdb.pascal/case-insensitive-symbols", from_tty=1, flags=0) at
> > ../../../binutils-gdb/gdb/symfile.c:1327
> > #24 0x00524360 in symbol_file_add_main (args=0x2c2ac49
> > "./gdb.pascal/case-insensitive-symbols", from_tty=1) at
> > ../../../binutils-gdb/gdb/symfile.c:1311
> > #25 0x00556ac9 in catch_command_errors_const (command=0x524340
> > <symbol_file_add_main>, arg=0x2c2ac49
> > "./gdb.pascal/case-insensitive-symbols", from_tty=1,
> > mask=RETURN_MASK_ALL)
> >     at ../../../binutils-gdb/gdb/main.c:396
> > #26 0x0055799a in captured_main (data=0x2c2abc4) at
> > ../../../binutils-gdb/gdb/main.c:1042
> > #27 0x00552c81 in catch_errors (func=0x556d1a <captured_main>,
> > func_args=0x2c2abc4, errstring=0x7eb761
> <__PRETTY_FUNCTION__.13998+168>
> > "",
> > mask=RETURN_MASK_ALL)
> >     at ../../../binutils-gdb/gdb/exceptions.c:237
> > #28 0x00557d2f in gdb_main (args=0x2c2abc4) at
> > ../../../binutils-gdb/gdb/main.c:1157
> > #29 0x0040120c in main (
> > During symbol reading, incomplete CFI data; DW_CFA_restore
> unspecified
> > register ebx (#3) at 0x6100776e.
> > argc=2, argv=0x2c2abfc) at ../../../binutils-gdb/gdb/gdb.c:32
> >
> > (top-gdb) f 1
> > #1  0x00570b43 in internal_type_self_type (type=0x801b1628) at
> > ../../../binutils-gdb/gdb/gdbtypes.c:1204
> > 1204          gdb_assert (TYPE_SPECIFIC_FIELD (type) ==
> > TYPE_SPECIFIC_FUNC);
> > (top-gdb) p *type.main_type
> > $1 = {code = TYPE_CODE_METHOD, flag_unsigned = 0, flag_nosign = 0,
> > flag_stub
> > = 1, flag_target_stub = 0, flag_static = 0, flag_prototyped = 0,
> > flag_incomplete = 0, flag_varargs = 0,
> >   flag_vector = 0, flag_stub_supported = 0, flag_gnu_ifunc = 0,
> > flag_fixed_instance = 0, flag_objfile_owned = 1, flag_declared_class
> =
> > 0,
> > flag_flag_enum = 0,
> >   type_specific_field = TYPE_SPECIFIC_NONE, nfields = 0, name = 0x0,
> > tag_name = 0x0, owner = {objfile = 0x8014baa0, gdbarch = 0x8014baa0},
> > target_type = 0x801b15e8, flds_bnds = {fields = 0x0,
> >     bounds = 0x0}, type_specific = {cplus_stuff = 0x0, gnat_stuff =
> > 0x0,
> > floatformat = 0x0, func_stuff = 0x0, self_type = 0x0}, data_location
> =
> > 0x0}
> >
> > No calls to set_type_self_type up to this error point.
> >
> > TOBJECT is the fundamental class type for Free Pascal,
> > and this code had no problems before.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: PING [RFA 0/3 V4] Fix pascal behavior for class fields with testcase
       [not found]               ` <54e043b2.626ec20a.0c59.ffffaeacSMTPIN_ADDED_BROKEN@mx.google.com>
@ 2015-04-20  6:00                 ` Doug Evans
  2015-04-21 20:33                   ` Pierre Muller
  0 siblings, 1 reply; 29+ messages in thread
From: Doug Evans @ 2015-04-20  6:00 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'Pedro Alves', 'gdb-patches'

"Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr> writes:
>    Hi all,
>
> I still got no reply to this new version
> of my patch series.
>
> Pierre Muller
> as pascal language maintainer

Hi.

I believe V4 of this patch series can go in.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* RE: PING [RFA 0/3 V4] Fix pascal behavior for class fields with testcase
  2015-04-20  6:00                 ` PING " Doug Evans
@ 2015-04-21 20:33                   ` Pierre Muller
  0 siblings, 0 replies; 29+ messages in thread
From: Pierre Muller @ 2015-04-21 20:33 UTC (permalink / raw)
  To: 'Doug Evans'; +Cc: 'Pedro Alves', 'gdb-patches'



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Doug Evans
> Envoyé : lundi 20 avril 2015 08:00
> À : Pierre Muller
> Cc : 'Pedro Alves'; 'gdb-patches'
> Objet : Re: PING [RFA 0/3 V4] Fix pascal behavior for class fields with
> testcase
> 
> "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr> writes:
> >    Hi all,
> >
> > I still got no reply to this new version
> > of my patch series.
> >
> > Pierre Muller
> > as pascal language maintainer
> 
> Hi.
> 
> I believe V4 of this patch series can go in.

Hi,

  thank you for the approval and also to Pedro for
the comments and help for the test.

  Patch checked in,

Pierre Muller

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2015-04-21 20:33 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <54ae4586.01e3440a.7b06.fffff844SMTPIN_ADDED_BROKEN@mx.google.com>
2015-01-08 10:48 ` [RFA] Fix pascal behavior for class fields Pedro Alves
2015-01-08 13:01   ` Pierre Muller
     [not found]   ` <54ae7f9f.c323460a.36ed.ffffff30SMTPIN_ADDED_BROKEN@mx.google.com>
2015-01-08 13:41     ` Pedro Alves
2015-01-08 14:15       ` gdb-patches RFA: " Pierre Muller
     [not found]       ` <54ae911b.85e3440a.1d96.5ffdSMTPIN_ADDED_BROKEN@mx.google.com>
2015-01-09 10:52         ` Pedro Alves
2015-01-09 10:55           ` Pedro Alves
2015-01-09 16:16           ` [RFA PATCH 1/3] Remember the case pattern that allowed finding a field of this Pierre Muller
2015-01-23  7:30             ` [RFA PATCH 1/3 V3] " Pierre Muller
2015-02-04 23:37               ` [RFA PATCH 1/3 V4] " Pierre Muller
2015-01-09 16:16           ` [RFA 0/3] Fix pascal behavior for class fields with testcase Pierre Muller
2015-01-09 16:18             ` [RFA PATCH 2/3] Add debug-stabs debug-dwarf and class option for pascal compiler Pierre Muller
2015-02-04 23:37             ` [RFA 0/3 V4] Fix pascal behavior for class fields with testcase Pierre Muller
2015-02-15  6:59               ` PING " Pierre Muller
2015-04-07 20:06                 ` PING^2 " Pierre Muller
     [not found]               ` <54e043b2.626ec20a.0c59.ffffaeacSMTPIN_ADDED_BROKEN@mx.google.com>
2015-04-20  6:00                 ` PING " Doug Evans
2015-04-21 20:33                   ` Pierre Muller
2015-01-09 16:18           ` [RFA PATCH 3/3] Testcase for pascal/17815 Pierre Muller
     [not found]           ` <54afff61.6790420a.0fa7.4f63SMTPIN_ADDED_BROKEN@mx.google.com>
2015-01-10  0:45             ` [RFA PATCH 2/3] Add debug-stabs debug-dwarf and class option for pascal compiler Doug Evans
2015-01-10  0:55               ` Pierre Muller
     [not found]               ` <54b07891.01b3c20a.2a7b.ffff9f96SMTPIN_ADDED_BROKEN@mx.google.com>
2015-01-10 21:23                 ` Doug Evans
2015-01-14 15:04                   ` [RFA PATCH 2/3 V2] Add "class" " Pierre Muller
     [not found]                   ` <54b6858f.a287440a.5b61.ffff9ef0SMTPIN_ADDED_BROKEN@mx.google.com>
2015-01-22 12:49                     ` Pedro Alves
2015-01-23  5:21                       ` [RFA PATCH 2/3 V3] " Pierre Muller
2015-01-23 11:55                         ` Pedro Alves
2015-02-04 23:37                           ` [RFA PATCH 2/3 V4] " Pierre Muller
     [not found]           ` <54afff6b.ee8d440a.16ee.ffffb424SMTPIN_ADDED_BROKEN@mx.google.com>
2015-01-22 12:46             ` [RFA PATCH 3/3] Testcase for pascal/17815 Pedro Alves
2015-01-23  7:16               ` [RFA PATCH 3/3 V3] " Pierre Muller
2015-01-23 12:29                 ` Pedro Alves
2015-02-04 23:37                   ` [RFA PATCH 3/3 V4] " Pierre Muller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).