This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Expand bitpos to LONGEST to allow access to large offsets within a struct
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Siddhesh Poyarekar <siddhesh at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 21 Feb 2012 22:02:35 +0100
- Subject: Re: [PATCH] Expand bitpos to LONGEST to allow access to large offsets within a struct
- References: <20120220132724.GB4753@spoyarek.pnq.redhat.com>
On Mon, 20 Feb 2012 14:28:24 +0100, Siddhesh Poyarekar wrote:
> @@ -1318,13 +1318,13 @@ gen_bitfield_ref (struct expression *exp, struct agent_expr *ax,
>
> /* The first and one-after-last bits in the field, but rounded down
> and up to byte boundaries. */
> - int bound_start = (start / TARGET_CHAR_BIT) * TARGET_CHAR_BIT;
> - int bound_end = (((end + TARGET_CHAR_BIT - 1)
> + LONGEST bound_start = (start / TARGET_CHAR_BIT) * TARGET_CHAR_BIT;
> + LONGEST bound_end = (((end + TARGET_CHAR_BIT - 1)
> / TARGET_CHAR_BIT)
> * TARGET_CHAR_BIT);
In these cases one needs to also reindent the two TARGET_CHAR_BIT lines to
properly match their columns.
On top of Tom's comments - have you verified you caught all the cases?
In these cases I use some
typedef struct { LONGEST x; } LONGESTT;
which is compatible for assignment only with itself catching all the cases.
Unfortunately one needs to adjust by hand all the arithmetic operations just
for the purpose of this verification.
I guess there exist better static analysis tools for that.
Thanks,
Jan