From: Joel Brobecker <brobecker@adacore.com>
To: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Fix some gdb.ada tests failures due to naming conflict.
Date: Wed, 26 Dec 2018 04:56:00 -0000 [thread overview]
Message-ID: <20181226045630.GB21851@adacore.com> (raw)
In-Reply-To: <20181224141509.11807-1-philippe.waroquiers@skynet.be>
> 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
next prev parent reply other threads:[~2018-12-26 4:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-24 14:15 Philippe Waroquiers
2018-12-24 20:58 ` Tom Tromey
2018-12-26 14:13 ` Philippe Waroquiers
2018-12-26 14:20 ` Philippe Waroquiers
2018-12-26 4:56 ` Joel Brobecker [this message]
2018-12-26 14:11 ` Philippe Waroquiers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181226045630.GB21851@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=philippe.waroquiers@skynet.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox