[RFA] Fix some gdb.ada tests failures due to naming conflict.
Commit Message
Fix these by using names that have more chances to be unique.
assign_arr.exp
--------------
The test assign_arr fails (timeout) due to conflict between var 'input' and s-ststop.adb 'input'.
(gdb) print input.u2 := (0.25,0.5,0.75)
Multiple matches for input
[0] cancel
[1] system.strings.stream_ops.storage_array_ops.input (access ada.streams.root_stream_type; system.strings.stream_ops.io_kind; natural) return system.storage_elements.storage_array at s-ststop.adb:127
[2] system.strings.stream_ops.stream_element_array_ops.input (access ada.streams.root_stream_type; system.strings.stream_ops.io_kind; natural) return ada.streams.stream_element_array at s-ststop.adb:127
[3] system.strings.stream_ops.string_ops.input (access ada.streams.root_stream_type; system.strings.stream_ops.io_kind; natural) return string at s-ststop.adb:127
[4] system.strings.stream_ops.wide_string_ops.input (access ada.streams.root_stream_type; system.strings.stream_ops.io_kind; natural) return wide_string at s-ststop.adb:127
[5] system.strings.stream_ops.wide_wide_string_ops.input (access ada.streams.root_stream_type; system.strings.stream_ops.io_kind; natural) return wide_wide_string at s-ststop.adb:127
[6] target_wrapper.input at /bd/home/philippe/gdb/git/info_t/gdb/testsuite/gdb.ada/assign_arr/target_wrapper.ads:24
> FAIL: gdb.ada/assign_arr.exp: print input.u2 := (0.25,0.5,0.75) (timeout)
fun_renaming.exp
----------------
The test fun_renaming fails due to conflict between var 'next' and s-pooloc.adb next:
(gdb) print next(1)
Multiple matches for next
[0] cancel
[1] pack.next (integer) return integer at /bd/home/philippe/gdb/git/binutils-gdb/gdb/testsuite/gdb.ada/fun_renaming/pack.adb:19
[2] system.pool_local.next (system.address) return system.pool_local.acc_address at s-pooloc.adb:151
> FAIL: gdb.ada/fun_renaming.exp: print next(1) (timeout)
Fix by making the names and renamings more unique.
packed_array_assign.exp
-----------------------
The test gdb.ada/packed_array_assign fails due to conflict between component 'w'
and system.dim.mks.w:
(gdb) print pra := ((x => 2, y => 0, w => 17), pr, (x => 7, y => 1, w => 23))
Unknown component name: system.dim.mks.w.
(gdb) FAIL: gdb.ada/packed_array_assign.exp: print pra := ((x => 2, y => 0, w => 17), pr, (x => 7, y => 1, w => 23))
Also, the test expected (wrongly as far as I can see) to have the
components printed in the order (w, x, y), while the code defines them
in the order (x, y, w), and the compiler (GNATMAKE 6.3.0,
gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516) respects this order:
for Packed_Rec use record
Packed_Array_Assign_X at 0 range 0 .. 2;
Packed_Array_Assign_Y at 0 range 3 .. 5;
Packed_Array_Assign_W at 0 range 6 .. 37;
end record;
So, update to test the new (more unique) names in the source order.
rename_subscript_param.exp
--------------------------
The test rename_subscript_param.exp fails due to conflict between boolean 'b'
and some 'b' in atnat.h.
(gdb) print b
Multiple matches for b
[0] cancel
[1] b at ../sysdeps/ieee754/dbl-64/atnat.h:106
[2] b at ../sysdeps/ieee754/dbl-64/atnat.h:106
[3] b at ../sysdeps/ieee754/dbl-64/atnat.h:106
> FAIL: gdb.ada/rename_subscript_param.exp: print b before changing its value (timeout)
Fix by renaming 'b' to 'rename_subscript_param_b.
Also, change 'before' to 'after' in the gdb_test message that prints
the value after changing it.
The test however still fails for me, probably because the Debian stable
Ada compiler is too old, and does not properly generate debug info for
this renaming:
(gdb) print rename_subscript_param_b
No definition of "rename_subscript_param_b" in current context.
(gdb) FAIL: gdb.ada/rename_subscript_param.exp: print rename_subscript_param_b before changing its value
2018-12-24 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.ada/assign_arr/target_wrapper.ads (Input): Rename to
Assign_Arr_Input.
main_p324_051.adb: Update accordingly.
gdb.ada/assign_arr.exp: Likewise.
* gdb.ada/fun_renaming/pack.ads (Next): Rename to Fun_Rename_Test_Next.
(Renamed_Next): Rename to Renamed_Fun_Rename_Test_Next.
gdb.ada/fun_renaming/pack.adb (Next): Rename to Fun_Rename_Test_Next.
gdb.ada/fun_renaming/fun_renaming.adb (N): Rename to Fun_Rename_Test_N.
gdb.ada/fun_renaming.exp: Update accordingly.
* gdb.ada/packed_array_assign/aggregates.ads (Packed_Rec):
Rename components to Packed_Array_Assign_[X|Y|W].
gdb.ada/packed_array_assign.exp: Update accordingly. Use source
order for checking the component order.
* gdb.ada/rename_subscript_param/pkg.adb (B): Rename to
Rename_Subscript_Param_B.
* gdb.ada/rename_subscript_param.exp: Update accordingly.
---
gdb/testsuite/gdb.ada/assign_arr.exp | 2 +-
gdb/testsuite/gdb.ada/assign_arr/main_p324_051.adb | 2 +-
.../gdb.ada/assign_arr/target_wrapper.ads | 2 +-
gdb/testsuite/gdb.ada/fun_renaming.exp | 14 +++++++-------
.../gdb.ada/fun_renaming/fun_renaming.adb | 7 ++++---
gdb/testsuite/gdb.ada/fun_renaming/pack.adb | 4 ++--
gdb/testsuite/gdb.ada/fun_renaming/pack.ads | 5 +++--
gdb/testsuite/gdb.ada/packed_array_assign.exp | 4 ++--
.../gdb.ada/packed_array_assign/aggregates.ads | 8 +++++---
gdb/testsuite/gdb.ada/rename_subscript_param.exp | 8 ++++----
.../gdb.ada/rename_subscript_param/pkg.adb | 4 ++--
11 files changed, 32 insertions(+), 28 deletions(-)
Comments
>>>>> "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
>> FAIL: gdb.ada/rename_subscript_param.exp: print b before changing its value (timeout)
Note that this particular one is PR ada/23381, so that should be
mentioned in the ChangeLog.
Tom
> Fix these by using names that have more chances to be unique.
Thanks for doing that, Philippe. I believe this is because you are
using a version of the compiler where the entire runtime has debugging
information, which is not AdaCore's normal mode.
Would you mind terribly splitting this commit into a series of coomits,
with one commit per tescase? If you are unsure how to do that with git,
take a look at git reset (and prob. google as well ;-)).
>
> packed_array_assign.exp
> -----------------------
> The test gdb.ada/packed_array_assign fails due to conflict between component 'w'
> and system.dim.mks.w:
>
> (gdb) print pra := ((x => 2, y => 0, w => 17), pr, (x => 7, y => 1, w => 23))
> Unknown component name: system.dim.mks.w.
> (gdb) FAIL: gdb.ada/packed_array_assign.exp: print pra := ((x => 2, y => 0, w => 17), pr, (x => 7, y => 1, w => 23))
>
> Also, the test expected (wrongly as far as I can see) to have the
> components printed in the order (w, x, y), while the code defines them
> in the order (x, y, w), and the compiler (GNATMAKE 6.3.0,
> gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516) respects this order:
> for Packed_Rec use record
> Packed_Array_Assign_X at 0 range 0 .. 2;
> Packed_Array_Assign_Y at 0 range 3 .. 5;
> Packed_Array_Assign_W at 0 range 6 .. 37;
> end record;
>
> So, update to test the new (more unique) names in the source order.
We have to te be careful about the component order. AdaCore implemented
a change last year where components can be automatically re-ordered
if it makes the code more efficient. One way we can handle this is by
accepting both orders. However, looking at the record, and the purpuse
of the testcase, I think we achieve the same goals by just reordering
the fields in Packed_Rec. That way, the component order chosen by
the compiler remains the same regardless of the compiler.
> rename_subscript_param.exp
> --------------------------
> The test rename_subscript_param.exp fails due to conflict between boolean 'b'
> and some 'b' in atnat.h.
>
> (gdb) print b
> Multiple matches for b
> [0] cancel
> [1] b at ../sysdeps/ieee754/dbl-64/atnat.h:106
> [2] b at ../sysdeps/ieee754/dbl-64/atnat.h:106
> [3] b at ../sysdeps/ieee754/dbl-64/atnat.h:106
> > FAIL: gdb.ada/rename_subscript_param.exp: print b before changing its value (timeout)
>
> Fix by renaming 'b' to 'rename_subscript_param_b.
> Also, change 'before' to 'after' in the gdb_test message that prints
> the value after changing it.
> The test however still fails for me, probably because the Debian stable
> Ada compiler is too old, and does not properly generate debug info for
> this renaming:
> (gdb) print rename_subscript_param_b
> No definition of "rename_subscript_param_b" in current context.
> (gdb) FAIL: gdb.ada/rename_subscript_param.exp: print rename_subscript_param_b before changing its value
This renaming is unnecessary. What is probably happening as you guessed
is that the compiler failed to generate the renaming. As a result,
GDB failed to find "B" in the current scope. That's when it started
searching in the static then global scope. The wider search does not
happen if some symbols were found in the current scope, so the
ambiguity you are seeing is only because of the inability to find "B".
You can still rename "B" if you would like, but the only advantage
I can see for doing that is that you get the second error message
(no definition of...) instead of the multiple choice menu in
situations like yours where the compiler failed to generate
the necessary debug info.
> 2018-12-24 Philippe Waroquiers <philippe.waroquiers@skynet.be>
>
> * gdb.ada/assign_arr/target_wrapper.ads (Input): Rename to
> Assign_Arr_Input.
> main_p324_051.adb: Update accordingly.
It is already written up, and it is fine as is, so no need to
waste more time on more Changelog writing; but for the future,
you can saveyourself a bit of time by saying...
* gdb.ada/assign_arr/target_wrapper.ads (Input): Rename to
Assign_Arr_Input. All users updated.
... and that's it!
> gdb.ada/assign_arr.exp: Likewise.
> * gdb.ada/fun_renaming/pack.ads (Next): Rename to Fun_Rename_Test_Next.
> (Renamed_Next): Rename to Renamed_Fun_Rename_Test_Next.
> gdb.ada/fun_renaming/pack.adb (Next): Rename to Fun_Rename_Test_Next.
> gdb.ada/fun_renaming/fun_renaming.adb (N): Rename to Fun_Rename_Test_N.
> gdb.ada/fun_renaming.exp: Update accordingly.
> * gdb.ada/packed_array_assign/aggregates.ads (Packed_Rec):
> Rename components to Packed_Array_Assign_[X|Y|W].
> gdb.ada/packed_array_assign.exp: Update accordingly. Use source
> order for checking the component order.
> * gdb.ada/rename_subscript_param/pkg.adb (B): Rename to
> Rename_Subscript_Param_B.
> * gdb.ada/rename_subscript_param.exp: Update accordingly.
Hello Joel,
Thanks for the review comments.
I just submitted an RFAv2 that should handle all below comments.
On Wed, 2018-12-26 at 08:56 +0400, Joel Brobecker wrote:
> > Fix these by using names that have more chances to be unique.
>
> Thanks for doing that, Philippe. I believe this is because you are
> using a version of the compiler where the entire runtime has debugging
> information, which is not AdaCore's normal mode.
>
> Would you mind terribly splitting this commit into a series of coomits,
> with one commit per tescase? If you are unsure how to do that with git,
> take a look at git reset (and prob. google as well ;-)).
RFAv2 has now one commit per testcase.
>
> >
> > packed_array_assign.exp
> > So, update to test the new (more unique) names in the source order.
>
> We have to te be careful about the component order. AdaCore implemented
> a change last year where components can be automatically re-ordered
> if it makes the code more efficient. One way we can handle this is by
> accepting both orders. However, looking at the record, and the purpuse
> of the testcase, I think we achieve the same goals by just reordering
> the fields in Packed_Rec. That way, the component order chosen by
> the compiler remains the same regardless of the compiler.
Effectively, gcc 6.3.0 and a recent gnat pro behaved differently.
I have updated the test so that both compilers are giving the same
component order.
>
> > rename_subscript_param.exp
> > Fix by renaming 'b' to 'rename_subscript_param_b.
...
> This renaming is unnecessary. What is probably happening as you guessed
> is that the compiler failed to generate the renaming. As a result,
> GDB failed to find "B" in the current scope. That's when it started
> searching in the static then global scope. The wider search does not
> happen if some symbols were found in the current scope, so the
> ambiguity you are seeing is only because of the inability to find "B".
>
> You can still rename "B" if you would like, but the only advantage
> I can see for doing that is that you get the second error message
> (no definition of...) instead of the multiple choice menu in
> situations like yours where the compiler failed to generate
> the necessary debug info.
I have kept the renaming, as this ensures the test fails directly
rather than with a timeout.
>
> > 2018-12-24 Philippe Waroquiers <philippe.waroquiers@skynet.be>
> >
> > * gdb.ada/assign_arr/target_wrapper.ads (Input): Rename to
> > Assign_Arr_Input.
> > main_p324_051.adb: Update accordingly.
>
> It is already written up, and it is fine as is, so no need to
> waste more time on more Changelog writing; but for the future,
> you can saveyourself a bit of time by saying...
>
> * gdb.ada/assign_arr/target_wrapper.ads (Input): Rename to
> Assign_Arr_Input. All users updated.
>
> ... and that's it!
Any hint making writing ChangeLog less frustrating is good to know :).
Thanks
Philippe
On Mon, 2018-12-24 at 13:58 -0700, Tom Tromey wrote:
> > > > > > "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
> > > FAIL: gdb.ada/rename_subscript_param.exp: print b before changing its value (timeout)
>
> Note that this particular one is PR ada/23381, so that should be
> mentioned in the ChangeLog.
Ouch, I forgot to add this in the RFAv2 ChangeLog.
I will add this before pushing.
Philippe
On Wed, 2018-12-26 at 15:13 +0100, Philippe Waroquiers wrote:
> On Mon, 2018-12-24 at 13:58 -0700, Tom Tromey wrote:
> > > > > > > "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
> > > >
> > > > FAIL: gdb.ada/rename_subscript_param.exp: print b before changing its value (timeout)
> >
> > Note that this particular one is PR ada/23381, so that should be
> > mentioned in the ChangeLog.
>
> Ouch, I forgot to add this in the RFAv2 ChangeLog.
> I will add this before pushing.
Here is the updated ChangeLog:
2018-12-26 Philippe Waroquiers <philippe.waroquiers@skynet.be>
PR ada/23381
* gdb.ada/rename_subscript_param/pkg.adb (B): Rename to
Rename_Subscript_Param_B. All users updated.
gdb.ada/rename_subscript_param.exp: Test names made unique.
Note that PR ada/23381 is only fully fixed when using a recent
compiler.
@@ -26,5 +26,5 @@ clean_restart ${testfile}
set bp_location [gdb_get_line_number "STOP" ${testdir}/main_p324_051.adb]
runto "main_p324_051.adb:$bp_location"
-gdb_test "print input.u2 := (0.25,0.5,0.75)" \
+gdb_test "print assign_arr_input.u2 := (0.25,0.5,0.75)" \
" = \\(0\\.25, 0\\.5, 0\\.75\\)"
@@ -17,5 +17,5 @@ with target_wrapper; use target_wrapper;
procedure Main_P324_051 is
begin
- input.u2 := (0.2,0.3,0.4); -- STOP
+ Assign_Arr_Input.u2 := (0.2,0.3,0.4); -- STOP
end Main_P324_051;
@@ -21,6 +21,6 @@ package target_wrapper is
u2 : Float_Array_3;
end record;
- input : parameters;
+ Assign_Arr_Input : parameters;
end target_wrapper;
@@ -27,18 +27,18 @@ set bp_location [gdb_get_line_number "BREAK" ${testdir}/fun_renaming.adb]
runto "fun_renaming.adb:$bp_location"
# Sanity check: make sure we can call a regular global function.
-gdb_test "print next(1)" " = 2"
+gdb_test "print fun_rename_test_next(1)" " = 2"
# Starting with GCC 6, renamed subprograms are materialized in the debugging
# information: make sure we can call the regular global function using its
# multiple names.
-set test "print n(1)"
+set test "print fun_rename_test_n(1)"
gdb_test_multiple $test $test {
-re " = 2\..*$gdb_prompt $" {
pass $test
}
- -re "No definition of \"n\" in current context\..*$gdb_prompt $" {
+ -re "No definition of \"fun_rename_test_n\" in current context\..*$gdb_prompt $" {
if {[test_compiler_info {gcc-6*}]} {
fail $test
} else {
@@ -47,12 +47,12 @@ gdb_test_multiple $test $test {
}
}
-set test "print renamed_next(1)"
+set test "print renamed_fun_rename_test_next(1)"
gdb_test_multiple $test $test {
-re " = 2\..*$gdb_prompt $" {
pass $test
}
- -re "No definition of \"renamed_next\" in current context\..*$gdb_prompt $" {
+ -re "No definition of \"renamed_fun_rename_test_next\" in current context\..*$gdb_prompt $" {
if {[test_compiler_info {gcc-6*}]} {
fail $test
} else {
@@ -61,12 +61,12 @@ gdb_test_multiple $test $test {
}
}
-set test "print pack.renamed_next(1)"
+set test "print pack.renamed_fun_rename_test_next(1)"
gdb_test_multiple $test $test {
-re " = 2\..*$gdb_prompt $" {
pass $test
}
- -re "No definition of \"pack\.renamed_next\" in current context\..*$gdb_prompt $" {
+ -re "No definition of \"pack\.renamed_fun_rename_test_next\" in current context\..*$gdb_prompt $" {
if {[test_compiler_info {gcc-6*}]} {
fail $test
} else {
@@ -16,8 +16,9 @@
with Pack;
procedure Fun_Renaming is
- function N (I : Integer) return Integer renames Pack.Next;
+ function Fun_Rename_Test_N (I : Integer) return Integer
+ renames Pack.Fun_Rename_Test_Next;
begin
- Pack.Discard (N (1)); -- BREAK
- Pack.Discard (Pack.Renamed_Next (1)); -- BREAK
+ Pack.Discard (Fun_Rename_Test_N (1)); -- BREAK
+ Pack.Discard (Pack.Renamed_Fun_Rename_Test_Next (1)); -- BREAK
end Fun_Renaming;
@@ -14,10 +14,10 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package body Pack is
- function Next (I : Integer) return Integer is
+ function Fun_Rename_Test_Next (I : Integer) return Integer is
begin
return I + 1;
- end Next;
+ end Fun_Rename_Test_Next;
procedure Discard (I : Integer) is
begin
@@ -15,8 +15,9 @@
package Pack is
- function Next (I : Integer) return Integer;
- function Renamed_Next (I : Integer) return Integer renames Next;
+ function Fun_Rename_Test_Next (I : Integer) return Integer;
+ function Renamed_Fun_Rename_Test_Next (I : Integer) return Integer
+ renames Fun_Rename_Test_Next;
procedure Discard (I : Integer);
end Pack;
@@ -26,5 +26,5 @@ clean_restart ${testfile}
runto "aggregates.run_test"
gdb_test \
- "print pra := ((x => 2, y => 0, w => 17), pr, (x => 7, y => 1, w => 23))" \
- " = \\(\\(w => 17, x => 2, y => 0\\), \\(w => 104, x => 2, y => 3\\), \\(w => 23, x => 7, y => 1\\)\\)"
+ "print pra := ((packed_array_assign_x => 2, packed_array_assign_y => 0, packed_array_assign_w => 17), pr, (packed_array_assign_x => 7, packed_array_assign_y => 1, packed_array_assign_w => 23))" \
+ " = \\(\\(packed_array_assign_x => 2, packed_array_assign_y => 0, packed_array_assign_w => 17\\), \\(packed_array_assign_x => 2, packed_array_assign_y => 3, packed_array_assign_w => 104\\), \\(packed_array_assign_x => 7, packed_array_assign_y => 1, packed_array_assign_w => 23\\)\\)"
@@ -17,8 +17,8 @@ package Aggregates is
subtype Int is Integer range 0 .. 7;
type Packed_Rec is record
- X, Y : Int;
- W : Integer;
+ Packed_Array_Assign_X, Packed_Array_Assign_Y : Int;
+ Packed_Array_Assign_W : Integer;
end record;
pragma Pack (Packed_Rec);
@@ -28,6 +28,8 @@ package Aggregates is
procedure Run_Test;
private
- PR : Packed_Rec := (y => 3, w => 104, x => 2);
+ PR : Packed_Rec := (Packed_Array_Assign_Y => 3,
+ Packed_Array_Assign_W => 104,
+ Packed_Array_Assign_X => 2);
PRA : Packed_RecArr (1 .. 3);
end Aggregates;
@@ -26,9 +26,9 @@ clean_restart ${testfile}
set bp_location [gdb_get_line_number "BREAK" ${testdir}/pkg.adb]
runto "pkg.adb:$bp_location"
-gdb_test "print b" \
+gdb_test "print rename_subscript_param_b" \
" = false" \
- "print b before changing its value"
+ "print rename_subscript_param_b before changing its value"
set bp_location [gdb_get_line_number "Do_Nothing" ${testdir}/pkg.adb]
gdb_test "break pkg.adb:$bp_location" \
@@ -39,6 +39,6 @@ gdb_test "cont" \
"Breakpoint \[0-9\]+, pkg.flip \\(.*" \
"Continuing to breakpoint on call to Do_Nothing"
-gdb_test "print b" \
+gdb_test "print rename_subscript_param_b" \
" = true" \
- "print b before changing its value"
+ "print rename_subscript_param_b after changing its value"
@@ -21,9 +21,9 @@ package body Pkg is
-- Create a new scope to check that the scope match algorithm is fine in
-- the front-end.
declare
- B : Boolean renames Bits (I);
+ Rename_Subscript_Param_B : Boolean renames Bits (I);
begin
- B := not B; -- BREAK
+ Rename_Subscript_Param_B := not Rename_Subscript_Param_B; -- BREAK
Do_Nothing (Bits'Address);
end;
end Flip;