This is the mail archive of the gdb-patches@sources.redhat.com 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]

Re: [PATCH RFC] Problem with pascal objects.



>--- 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

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