Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] ada testsuite: False FAILs with gcc debug info
@ 2011-03-28  8:06 Jan Kratochvil
  2011-03-28 18:05 ` Joel Brobecker
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2011-03-28  8:06 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

Hi Joel,

with installed and matching debug infos there flip some gdb.ada/ testsuite
results PASS->FAIL:

 print first
-$2 = 98 'b'
-(gdb) PASS: gdb.ada/arrayparam.exp: print first after function call
+Multiple matches for first
+[0] cancel
+[1] gnat.awk.field_table.first at g-dyntab.ads:146
+[2] gnat.awk.file_table.first at g-dyntab.ads:146
+[3] gnat.awk.pattern_action_table.first at g-dyntab.ads:146
+[4] gnat.cgi.cookie.cookie_table.first at g-table.ads:159
+[5] gnat.cgi.cookie.key_value_table.first at g-table.ads:159
+[6] gnat.cgi.key_value_table.first at g-table.ads:159
+[7] gnat.perfect_hash_generators.it.first at g-table.ads:159
+[8] gnat.perfect_hash_generators.wt.first at g-table.ads:159
+[9] pck.first at .../gdb/testsuite/gdb.ada/arrayparam/pck.ads:18
+> FAIL: gdb.ada/arrayparam.exp: print first after function call (timeout)

It affects `first' and `last' the same way.


 (gdb) print String_Var (1 .. 3) = "Hel"
-$1 = true
-(gdb) PASS: gdb.ada/str_ref_cmp.exp: print String_Var (1 .. 3) = "Hel"
+$1 = false
+(gdb) FAIL: gdb.ada/str_ref_cmp.exp: print String_Var (1 .. 3) = "Hel"
as even just
(gdb) print "a"="a"
starts giving `false' with debug info installed, the BINOP_EQUAL operator
resolves to: ada__strings__maps__Oeq (Ada.Strings.Maps) as its type matches in
ada_resolve_function.  I do not understand the Ada scoping to fix it, filed PR
for KFAIL.


 (gdb) print i
 Multiple matches for i
 [0] cancel
-[1] pck.first.i at .../gdb/testsuite/gdb.ada/sym_print_name/pck.ads:18
-[2] pck.second.i at .../gdb/testsuite/gdb.ada/sym_print_name/pck.ads:22
-> PASS: gdb.ada/sym_print_name.exp: multiple matches for symbol i
+[1] ada.numerics.complex_types.i at a-ngcoty.ads:139
+[2] ada.numerics.long_complex_types.i at a-ngcoty.ads:139
+[3] ada.numerics.long_long_complex_types.i at a-ngcoty.ads:139
+[4] ada.numerics.short_complex_types.i at a-ngcoty.ads:139
+[5] gnat.secure_hashes.md5.i at g-sehamd.adb:199
+[6] interfaces.fortran.double_precision_complex_types.i at a-ngcoty.ads:139
+[7] interfaces.fortran.i at i-fortra.ads:46
+[8] interfaces.fortran.single_precision_complex_types.i at a-ngcoty.ads:139
+[9] pck.first.i at .../gdb/testsuite/gdb.ada/sym_print_name/pck.ads:18
+[10] pck.second.i at .../gdb/testsuite/gdb.ada/sym_print_name/pck.ads:22
+> FAIL: gdb.ada/sym_print_name.exp: multiple matches for symbol i
 1
-$1 = 48
-(gdb) PASS: gdb.ada/sym_print_name.exp: select first choice from multiple-choice menu
+$1 = 1.0
+(gdb) FAIL: gdb.ada/sym_print_name.exp: select first choice from multiple-choice menu


Tested on x86_64-fedora15-linux-gnu after `debuginfo-install gcc' (in fact many
debug infos installed but this one is the culprit I guess).


Thanks,
Jan


gdb/testsuite/
2011-03-27  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.ada/arrayparam.exp (print first after function call): Use
	explicit package name.  Add a comment
	(print lasta after function call): Rename ...
	(print last after function call): ... it and use explicit package
	name.
	(print length after function call): Use explicit package name.
	* gdb.ada/str_ref_cmp.exp (operator = works for strings): New test.
	* gdb.ada/sym_print_name.exp: Change `i' to `integervar'.
	(multiple matches for symbol i): Rename ...
	(multiple matches for symbol integervar): ... it.
	* gdb.ada/sym_print_name/foo.adb (Foo): Change `I' to `IntegerVar'.
	* gdb.ada/sym_print_name/pck.ads (Pck): Likewise.

--- a/gdb/testsuite/gdb.ada/arrayparam.exp
+++ b/gdb/testsuite/gdb.ada/arrayparam.exp
@@ -42,17 +42,18 @@ gdb_test "print call_me (\"bonjour\")" \
          "print call_me (\"bonjour\")"
 
 # Verify that the array was passed properly by checking the global
-# variables that Call_Me sets as side-effects.
+# variables that Call_Me sets as side-effects.  Use the package name to avoid
+# name clash with debug info of system libraries.
 
-gdb_test "print first" \
+gdb_test "print pck.first" \
          "= 98 'b'" \
          "print first after function call"
 
-gdb_test "print last" \
+gdb_test "print pck.last" \
          "= 114 'r'" \
-         "print lasta after function call"
+         "print last after function call"
 
-gdb_test "print length" \
+gdb_test "print pck.length" \
          "= 7" \
          "print length after function call"
 
--- a/gdb/testsuite/gdb.ada/str_ref_cmp.exp
+++ b/gdb/testsuite/gdb.ada/str_ref_cmp.exp
@@ -34,6 +34,19 @@ clean_restart ${testfile}
 set bp_location [gdb_get_line_number "START" ${testdir}/foo.adb]
 runto "foo.adb:$bp_location"
 
+# BINOP_EQUAL incorrectly resolves with system debug info to Ada.Strings.Maps.
+set test "operator = works for strings"
+gdb_test_multiple {print "a" = "a"} $test {
+    -re " = false\r\n$gdb_prompt $" {
+	kfail ada/12607 $test
+	untested ${testdir}.exp
+	return 0
+    }
+    -re " = true\r\n$gdb_prompt $" {
+	pass $test
+    }
+}
+
 # Verify that we can compare a string slice with another string.
 
 gdb_test "print String_Var (1 .. 3) = \"Hel\"" \
--- a/gdb/testsuite/gdb.ada/sym_print_name.exp
+++ b/gdb/testsuite/gdb.ada/sym_print_name.exp
@@ -45,14 +45,14 @@ clean_restart ${testfile}
 set bp_location [gdb_get_line_number "STOP" ${testdir}/foo.adb]
 runto "foo.adb:$bp_location"
 
-set menu [multi_line "Multiple matches for i" \
+set menu [multi_line "Multiple matches for integervar" \
                      "\\\[0\\\] cancel" \
-                     "\\\[1\\\] pck\\.first\\.i.*" \
-                     "\\\[2\\\] pck\\.second\\.i.*" \
+                     "\\\[1\\\] pck\\.first\\.integervar.*" \
+                     "\\\[2\\\] pck\\.second\\.integervar.*" \
                      "> $" ]
 
-set test_name "multiple matches for symbol i"
-gdb_test_multiple "print i" "$test_name" \
+set test_name "multiple matches for symbol integervar"
+gdb_test_multiple "print integervar" "$test_name" \
 {
       -re "$menu" {
           pass "$test_name"
--- a/gdb/testsuite/gdb.ada/sym_print_name/foo.adb
+++ b/gdb/testsuite/gdb.ada/sym_print_name/foo.adb
@@ -17,6 +17,6 @@ with Pck; use Pck;
 
 procedure Foo is
 begin
-   Do_Nothing (First.I);  -- STOP
-   Do_Nothing (Second.I);
+   Do_Nothing (First.IntegerVar);  -- STOP
+   Do_Nothing (Second.IntegerVar);
 end Foo;
--- a/gdb/testsuite/gdb.ada/sym_print_name/pck.ads
+++ b/gdb/testsuite/gdb.ada/sym_print_name/pck.ads
@@ -15,11 +15,11 @@
 
 package Pck is
    package First is
-      I : Integer := 48;
+      IntegerVar : Integer := 48;
    end First;
 
    package Second is
-      I : Integer := 74;
+      IntegerVar : Integer := 74;
    end Second;
 
    procedure Do_Nothing (Val : in out Integer);


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

* Re: [patch] ada testsuite: False FAILs with gcc debug info
  2011-03-28  8:06 [patch] ada testsuite: False FAILs with gcc debug info Jan Kratochvil
@ 2011-03-28 18:05 ` Joel Brobecker
  2011-03-28 18:46   ` Tom Tromey
  2011-03-28 20:21   ` Jan Kratochvil
  0 siblings, 2 replies; 5+ messages in thread
From: Joel Brobecker @ 2011-03-28 18:05 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

> with installed and matching debug infos there flip some gdb.ada/ testsuite
> results PASS->FAIL:

Yeah - I wasn't expecting anyone to run the testsuite using a runtime
that has debugging info.  It introduces other issues as well (we worked
around some of these issues for the sake of people working on the
compiler). It's not easy for you to flip runtimes, so we can try
accomodating...

Just a thought: Perhaps it might be easier to flip runtimes if you
provide the runtime with debug info as a second runtime.  There is
a way to do this, and then the user controls which one he wants using
--RTS=<rts-name> (only when the default one is not the one he wants).

>  (gdb) print String_Var (1 .. 3) = "Hel"
> -$1 = true
> -(gdb) PASS: gdb.ada/str_ref_cmp.exp: print String_Var (1 .. 3) = "Hel"
> +$1 = false
> +(gdb) FAIL: gdb.ada/str_ref_cmp.exp: print String_Var (1 .. 3) = "Hel"
> as even just
> (gdb) print "a"="a"
> starts giving `false' with debug info installed, the BINOP_EQUAL
> operator resolves to: ada__strings__maps__Oeq (Ada.Strings.Maps) as
> its type matches in ada_resolve_function.  I do not understand the Ada
> scoping to fix it, filed PR for KFAIL.

This is incorrect, but I cannot reproduce (we should be able to get
the same behavior by recompiling the program with "-f -a", which tells
gnatmake to recompile everything, including runtime files).

In this case, the lookup is "wild", because the entity name is not
qualified using the package name.  Regardless of that, the scoping
rules we use to match is:
  - If there is a local symbol, use that and disregard any global
    symbol that might have matched otherwise;
  - If no match, then we move to file-static, I think;
  - And finally, we look for globals;

The match is incorrect as far as I can tell, because the only "="
function defined in this package is the one for type Character_Set:

   function "="   (Left, Right : Character_Set) return Boolean;

And type Character_Set does not match type String:

   type Character_Set_Internal is array (Character) of Boolean;
   pragma Pack (Character_Set_Internal);
   type Character_Set is new Character_Set_Internal;

Type string is implicitly defined as:

   type String is array (Positive range <>) of Character;
   pragma Pack (String);

I think the debugging info must be incorrect.

That being said, we noticed a side-effect of this kind a while ago,
except I can't find it in my notes anymore. It was valid matching
at the time, except that the user-define "=" did not have the usual
semantics, and thus was yielding surprising results.

> gdb/testsuite/
> 2011-03-27  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 
> 	* gdb.ada/arrayparam.exp (print first after function call): Use
> 	explicit package name.  Add a comment
> 	(print lasta after function call): Rename ...
> 	(print last after function call): ... it and use explicit package
> 	name.
> 	(print length after function call): Use explicit package name.
> 	* gdb.ada/str_ref_cmp.exp (operator = works for strings): New test.
> 	* gdb.ada/sym_print_name.exp: Change `i' to `integervar'.
> 	(multiple matches for symbol i): Rename ...
> 	(multiple matches for symbol integervar): ... it.
> 	* gdb.ada/sym_print_name/foo.adb (Foo): Change `I' to `IntegerVar'.
> 	* gdb.ada/sym_print_name/pck.ads (Pck): Likewise.

This is OK.

Just one minor comment: `IntegerVar' is not very Ada-ish. Normally,
one would use `Integer_Var' instead.  However, thinking about it,
I think it's good, because it reduces further the chances of this
entity name being used in the compiler runtime, thus causing an
extra unexpected match. So, let's keep it that way.

-- 
Joel


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

* Re: [patch] ada testsuite: False FAILs with gcc debug info
  2011-03-28 18:05 ` Joel Brobecker
@ 2011-03-28 18:46   ` Tom Tromey
  2011-03-28 20:21   ` Jan Kratochvil
  1 sibling, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2011-03-28 18:46 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Jan Kratochvil, gdb-patches

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> Yeah - I wasn't expecting anyone to run the testsuite using a runtime
Joel> that has debugging info.  It introduces other issues as well (we worked
Joel> around some of these issues for the sake of people working on the
Joel> compiler). It's not easy for you to flip runtimes, so we can try
Joel> accomodating...

On Fedora (I don't know about other distros), there is a single
debuginfo file for a source package.  So, if you want to do tests with
some GCC debuginfo installed, you end up with all of it.  Of course you
can work around this in various ways, but it is more convenient if we
add harmless workarounds to the GDB test suite when clashes show up.  I
think in the past this has mostly meant renaming the odd variable or
two.

Tom


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

* Re: [patch] ada testsuite: False FAILs with gcc debug info
  2011-03-28 18:05 ` Joel Brobecker
  2011-03-28 18:46   ` Tom Tromey
@ 2011-03-28 20:21   ` Jan Kratochvil
  2011-03-28 21:27     ` Joel Brobecker
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2011-03-28 20:21 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On Mon, 28 Mar 2011 18:50:22 +0200, Joel Brobecker wrote:
> Just a thought: Perhaps it might be easier to flip runtimes if you
> provide the runtime with debug info as a second runtime.  There is
> a way to do this, and then the user controls which one he wants using
> --RTS=<rts-name> (only when the default one is not the one he wants).

I do not understand this much.  I have the single system only compiler, which
also provides debug info for all its parts.  While I can have some special GCC
builds still with the default system compiler the GDB testsuite should work.


> This is incorrect, but I cannot reproduce (we should be able to get
> the same behavior by recompiling the program with "-f -a", which tells
> gnatmake to recompile everything, including runtime files).

`gnatmake -f -a -g foo' works but it gives the same results for me.


> And type Character_Set does not match type String:

It does match:

(gdb) set language c
(gdb) ptype ada__strings__maps__Oeq
type = boolean (ada__strings__maps__character_set___XP1 &, ada__strings__maps__character_set___XP1 &)
(gdb) set language auto
(gdb) ptype ada.strings.maps.character_set
type = array (character) of boolean <packed: 1-bit elements>
(gdb) ptype "a"
type = array (1 .. 1) of character

and ada_type_match for TYPE_CODE_ARRAY returns 1 without checking whether the
array's target type matches.  And both these types are arrays.  Why
Character_Set should not match String with this ada_type_match implementation?


> I think the debugging info must be incorrect.

So far it seems to me ada_type_match has a bug, does not it?


> > gdb/testsuite/
> > 2011-03-27  Jan Kratochvil  <jan.kratochvil@redhat.com>
> > 
> > 	* gdb.ada/arrayparam.exp (print first after function call): Use
> > 	explicit package name.  Add a comment
> > 	(print lasta after function call): Rename ...
> > 	(print last after function call): ... it and use explicit package
> > 	name.
> > 	(print length after function call): Use explicit package name.
> > 	* gdb.ada/str_ref_cmp.exp (operator = works for strings): New test.
> > 	* gdb.ada/sym_print_name.exp: Change `i' to `integervar'.
> > 	(multiple matches for symbol i): Rename ...
> > 	(multiple matches for symbol integervar): ... it.
> > 	* gdb.ada/sym_print_name/foo.adb (Foo): Change `I' to `IntegerVar'.
> > 	* gdb.ada/sym_print_name/pck.ads (Pck): Likewise.
> 
> This is OK.

Therefore checked in so that it no longer occasionally gives false
regressions.
	http://sourceware.org/ml/gdb-cvs/2011-03/msg00308.html


Thanks,
Jan


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

* Re: [patch] ada testsuite: False FAILs with gcc debug info
  2011-03-28 20:21   ` Jan Kratochvil
@ 2011-03-28 21:27     ` Joel Brobecker
  0 siblings, 0 replies; 5+ messages in thread
From: Joel Brobecker @ 2011-03-28 21:27 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

> I do not understand this much.  I have the single system only
> compiler, which also provides debug info for all its parts.  While I
> can have some special GCC builds still with the default system
> compiler the GDB testsuite should work.

That's the thing, as far as I know, you need to change something
in order to be able to build the runtime with debugging information.
It's been a long time since I worked on that part of the compiler,
but, by default, we do not produce a runtime with debugging info.
For those of us that need to debug the runtime, we usually using
"gnatmake -f -a".

> (gdb) ptype ada.strings.maps.character_set
> type = array (character) of boolean <packed: 1-bit elements>
> (gdb) ptype "a"
> type = array (1 .. 1) of character
> 
> and ada_type_match for TYPE_CODE_ARRAY returns 1 without checking
> whether the array's target type matches.  And both these types are
> arrays.  Why Character_Set should not match String with this
> ada_type_match implementation?
>
> So far it seems to me ada_type_match has a bug, does not it?

Yeah, that looks like a hole in the implementation indeed.
I think I wasn't seeing the problem with `gnatmake -f -a'
because ada.strings.maps simply wasn't used at all.

You can assign the PR to me. It might be delicate to solve,
because the matching rules are complex (at least to me).

-- 
Joel


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

end of thread, other threads:[~2011-03-28 20:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-28  8:06 [patch] ada testsuite: False FAILs with gcc debug info Jan Kratochvil
2011-03-28 18:05 ` Joel Brobecker
2011-03-28 18:46   ` Tom Tromey
2011-03-28 20:21   ` Jan Kratochvil
2011-03-28 21:27     ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox