From: Pedro Alves <palves@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix buffer overflow in ada-lang.c:move_bits
Date: Wed, 14 Nov 2018 17:23:00 -0000 [thread overview]
Message-ID: <7628ab26-ad93-726c-f1d4-d5c60492115c@redhat.com> (raw)
In-Reply-To: <20181114171116.GA6074@adacore.com>
On 11/14/2018 05:11 PM, Joel Brobecker wrote:
> Hello,
>
>>>> I was going to suggest that this would benefit from unit tests in
>>>> the style of dwarf2read.c:copy_bitwise's, but, actually, isn't this
>>>> exactly the same as copy_bitwise? Can we get rid of ada-lang.c:move_bits?
>>>> (And maybe move copy_bitwise elsewhere?)
>>> I meant to say dwarf2loc.c instead of dwarf2read.c.
>> It does look exactly the same, doesn't it? I'll see if we can just
>> re-use dwarf2loc's copy_bitwise. Thanks for the suggestion!
> How about the attached? I ran it through AdaCore's testsuite on
> all the platforms we support as well as the official testsuite on
> x86_64-linux. No regression.
>
> gdb/ChangeLog:
>
> * ada-lang.c (move_bits): Delete. Update all callers to use
> copy_bitwise instead.
> * dwarf2loc.c (copy_bitwise, bits_to_str::bits_to_str)
> (selftests::check_copy_bitwise, selftests::copy_bitwise_tests):
> Move from here to utils.c.
> (_initialize_dwarf2loc): Remove call to register copy_bitwise
> selftests.
> * utils.h (copy_bitwise): Add declaration.
> * utils.c (copy_bitwise, bits_to_str::bits_to_str)
> (selftests::check_copy_bitwise, selftests::copy_bitwise_tests):
> Moved here from dwarf2loc.c.
> (_initialize_utils): Register copy_bitwise selftests.
>
> Thank you!
> -- Joel
>
>
Great, thanks!
Nit, since the function is now public, I'd consider moving the unit
tests to under gdb/unittests/ instead, like, to a new
copy_bitwise-selftests.c file. (I'm mildly thinking that'd be a better
filename than utils-selftest.c because the function may well
move again in the future. Notice how gdb_realpath's unit tests
were left behind in gdb/utils.c even though gdb_realpath moved to
common/pathstuff.c.)
If you do that, you can drop the
'#if GDB_SELF_TEST' around the tests, since files in that
directory are not compiled if unit tests are disabled.
Regardless, LGTM.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2018-11-14 17:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-24 16:21 Tom Tromey
2018-11-01 15:35 ` Joel Brobecker
2018-11-01 22:16 ` Tom Tromey
2018-11-08 19:11 ` Pedro Alves
2018-11-08 19:12 ` Pedro Alves
2018-11-09 17:16 ` Joel Brobecker
2018-11-14 17:11 ` Joel Brobecker
2018-11-14 17:23 ` Pedro Alves [this message]
2018-11-14 23:17 ` Joel Brobecker
2018-11-15 0:02 ` [RFA] Move copy_bitwise unittests to own unittest file (was: "Re: [PATCH] Fix buffer overflow in ada-lang.c:move_bits") Joel Brobecker
2018-11-15 10:59 ` [RFA] Move copy_bitwise unittests to own unittest file Pedro Alves
2018-11-15 15:56 ` pushed: " Joel Brobecker
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=7628ab26-ad93-726c-f1d4-d5c60492115c@redhat.com \
--to=palves@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/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