From: Pedro Alves <palves@redhat.com>
To: Andreas Arnez <arnez@linux.vnet.ibm.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 2/3] Fix copy_bitwise()
Date: Tue, 15 Nov 2016 19:42:00 -0000 [thread overview]
Message-ID: <6032efa2-828d-7423-4720-6925a9b4ea4b@redhat.com> (raw)
In-Reply-To: <1479135786-31150-3-git-send-email-arnez@linux.vnet.ibm.com>
On 11/14/2016 03:02 PM, Andreas Arnez wrote:
> Written in binary, the wrong result above looks like this:
>
> 01111111011111111111111
>
> Which means that two zero bits have sneaked into the copy of the
> original all-one bit pattern. The test uses this simple all-one value
> in order to avoid another GDB bug that causes the DWARF piece of a
> DW_OP_stack_value to be taken from the wrong end on big-endian
> architectures.
Looks like the sort of function that should be possible to
cover all sorts of inputs/outputs with unit tests. Aligned, misaligned,
big/little endian, etc., that sort of thing. That'd help
a lot with ensuring rewrites behave as intended. Would you feel like
including some?
The unit testing framework is trivial to use, since it's baked inside
gdb. All you need to do is write a function that throws some corner case
inputs at copy_bitwise, checking expected outputs and calling SELF_CHECK.
You register that function in the selftests frameworks with "register_self_test".
Then to trigger the tests, just do: gdb -ex "maintenance selftest".
testsuite/gdb.gdb/unittest.exp does that too.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2016-11-15 19:42 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-14 15:03 [PATCH 0/3] Support DW_AT_data_bit_offset Andreas Arnez
2016-11-14 15:04 ` [PATCH 1/3] Fix PR12616 - gdb does not implement DW_AT_data_bit_offset Andreas Arnez
2016-11-14 15:38 ` Luis Machado
2016-11-14 15:04 ` [PATCH 2/3] Fix copy_bitwise() Andreas Arnez
2016-11-14 15:38 ` Luis Machado
2016-11-14 17:54 ` Andreas Arnez
2016-11-14 17:58 ` Luis Machado
2016-11-15 18:58 ` Andreas Arnez
2016-11-15 19:42 ` Pedro Alves [this message]
2016-11-17 19:36 ` Andreas Arnez
2016-11-17 20:30 ` Pedro Alves
2016-11-18 15:06 ` Andreas Arnez
2016-11-22 23:18 ` Pedro Alves
2016-11-24 16:15 ` Andreas Arnez
2016-11-24 16:32 ` Pedro Alves
2016-11-24 16:55 ` Andreas Arnez
2016-11-14 15:05 ` [PATCH 3/3] Optimize byte-aligned copies in copy_bitwise() Andreas Arnez
2016-11-14 15:38 ` Luis Machado
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=6032efa2-828d-7423-4720-6925a9b4ea4b@redhat.com \
--to=palves@redhat.com \
--cc=arnez@linux.vnet.ibm.com \
--cc=gdb-patches@sourceware.org \
/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