This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH RFC] Problem with pascal objects.
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: Re: [PATCH RFC] Problem with pascal objects.
- From: Pierre Muller <muller at cerbere dot u-strasbg dot fr>
- Date: Fri, 01 Dec 2000 14:06:08 +0100
>--- origdb/valops.c Sun Apr 9 15:02:10 2000
>+++ gdb/valops.c Fri Dec 1 10:30:30 2000
>@@ -515,8 +515,13 @@
> {
> CORE_ADDR addr = VALUE_ADDRESS (val) + VALUE_OFFSET (val);
> int length = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (val));
>-
> struct type *type = VALUE_TYPE (val);
>+ /* In some case the enclosing type end up smaller as the
>+ type at least for pascal */
>+ int blength = TYPE_LENGTH (type);
>+ if (blength > length)
>+ length = blength;
>+
> if (GDB_TARGET_IS_D10V
> && TYPE_CODE (type) == TYPE_CODE_PTR
> && TYPE_TARGET_TYPE (type)
The patch is wrong because the allocated size is only length
and thus if blength is greater than length we write past the allocated memory
which is of course bad.
This means that I should reallocate a bigger memory part aready in
value_ind
function.
Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller@ics.u-strasbg.fr
Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99