This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Fix some gdb.ada tests failures due to naming conflict.


> 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.

-- 
Joel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]