From: Joel Brobecker <brobecker@adacore.com>
To: Siddhesh Poyarekar <siddhesh@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [commit][obv] Use TYPE_LENGTH directly where possible
Date: Thu, 27 Sep 2012 09:59:00 -0000 [thread overview]
Message-ID: <20120927095917.GA9624@adacore.com> (raw)
In-Reply-To: <20120926132621.5f45acb7@spoyarek>
Hi Siddhesh,
> [1] http://sourceware.org/ml/gdb-cvs/2012-09/msg00147.html
> [2] http://sourceware.org/ml/gdb-patches/2012-08/msg00144.html
>
> * amd64-tdep.c (amd64_return_value): Use TYPE_LENGTH directly.
> * bfin-tdep.c (bfin_extract_return_value): Likewise.
> (bfin_store_return_value): Likewise.
> * cris-tdep.c (cris_store_return_value): Likewise.
> (cris_extract_return_value): Likewise.
> * h8300-tdep.c (h8300_extract_return_value): Likewise.
> * hppa-tdep.c (hppa64_return_value): Likewise.
> * lm32-tdep.c (lm32_store_return_value): Likewise.
> * microblaze-tdep.c (microblaze_store_return_value): Likewise.
> * spu-tdep.c (spu_value_from_register): Likewise.
> * vax-tdep.c (vax_return_value): Likewise.
Following the discussion that started at:
http://www.sourceware.org/ml/gdb-patches/2012-09/msg00570.html
Here is what I suggest we do:
> Index: gdb/amd64-tdep.c
[...]
> gdb_assert (class[1] != AMD64_MEMORY);
> - gdb_assert (len <= 16);
> + gdb_assert (TYPE_LENGTH (type) <= 16);
Add a comment here to warn us against replacing the expression
with asserting on len, with an explanation as to why. This needs
to be done at every location where this trick is used.
Do you think it's better to do things this way rather than declare
len with the correct type?
> Index: gdb/cris-tdep.c
> Index: gdb/h8300-tdep.c
> Index: gdb/hppa-tdep.c
> Index: gdb/lm32-tdep.c
> Index: gdb/microblaze-tdep.c
> Index: gdb/spu-tdep.c
> Index: gdb/vax-tdep.c
Revert changes in those files, and declare the associated variable
with the correct type.
Thank you,
--
Joel
next prev parent reply other threads:[~2012-09-27 9:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-26 7:57 Siddhesh Poyarekar
2012-09-26 9:42 ` Joel Brobecker
2012-09-26 9:58 ` Siddhesh Poyarekar
2012-09-26 10:52 ` Joel Brobecker
2012-09-26 14:59 ` Pedro Alves
2012-09-26 15:09 ` Siddhesh Poyarekar
2012-09-26 15:07 ` Tom Tromey
2012-09-28 4:00 ` Mark Kettenis
2012-09-28 8:11 ` Jan Kratochvil
2012-09-27 9:59 ` Joel Brobecker [this message]
2012-09-27 10:13 ` Siddhesh Poyarekar
2012-09-27 10:19 ` Joel Brobecker
2012-09-27 10:42 ` Siddhesh Poyarekar
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=20120927095917.GA9624@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=siddhesh@redhat.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