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: [commit][obv] Use TYPE_LENGTH directly where possible


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


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