This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
pending/973: [PATCH/RFC] Propagate 'regno' in value_subscript.
- From: Klee Dienes <klee at apple dot com>
- To: gdb-gnats at sources dot redhat dot com
- Date: Sun, 10 Nov 2002 19:28:21 -0500
- Subject: pending/973: [PATCH/RFC] Propagate 'regno' in value_subscript.
>Number: 973
>Category: pending
>Synopsis: [PATCH/RFC] Propagate 'regno' in value_subscript.
>Confidential: yes
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Thu Jan 30 04:08:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:
>Release:
>Organization:
>Environment:
>Description:
--Apple-Mail-4-685242883
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
A side effect of the changes to value_assign is that you can no longer
assign to members of structures that are in arrays.
on i386/linux:
(gdb) print $mm5.v8_int8[0] = 10
/home/klee/source/cygnus.cygnus/gdb/arch-utils.c:448: internal-error:
generic_register_size: Assertion `regnum >= 0 && regnum < NUM_REGS +
NUM_PSEUDO_REGS' failed.
A problem internal to GDB has been detected. Further
debugging may prove unreliable.
Quit this debugging session? (y or n) n
Create a core file of GDB? (y or n) n
I suspect the core problem is that value_subscript doesn't propagate
the value of 'regno' to its result, instead setting it to -1, and we
were getting away with it before because value_assign was just using
write_register_bytes directly. The following patch fixes the problem
on both i386/linux and ppc/darwin.
--Apple-Mail-4-685242883
Content-Disposition: attachment;
filename=reg-structs.txt
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
x-unix-mode=0644;
name="reg-structs.txt"
2002-11-10 Klee Dienes <kdienes@apple.com>
* valarith.c (value_subscripted_rvalue): Set the VALUE_REGNO
field of the new value to that of the type being subscripted.
* value.h (struct value): Update comment.
Index: valarith.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/Darwin/src/live/cygnus/src/gdb/valarith.c,v
retrieving revision 1.12
diff -u -r1.12 valarith.c
--- valarith.c 2002/08/13 20:04:21 1.12
+++ valarith.c 2002/11/10 22:40:08
@@ -276,6 +276,7 @@
VALUE_LVAL (v) =3D VALUE_LVAL (array);
VALUE_ADDRESS (v) =3D VALUE_ADDRESS (array);
VALUE_OFFSET (v) =3D VALUE_OFFSET (array) + elt_offs;
+ VALUE_REGNO (v) =3D VALUE_REGNO (array);
return v;
}
=0C
Index: value.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/Darwin/src/live/cygnus/src/gdb/value.h,v
retrieving revision 1.20
diff -u -r1.20 value.h
--- value.h 2002/10/15 03:32:35 1.20
+++ value.h 2002/11/10 22:40:39
@@ -127,9 +127,7 @@
list. */
struct value *next;
=20
- /* Register number if the value is from a register. Is not kept
- if you take a field of a structure that is stored in a
- register. Shouldn't it be? */
+ /* Register number if the value is from a register. */
short regno;
/* If zero, contents of this value are in the contents field.
If nonzero, contents are in inferior memory at address
--Apple-Mail-4-685242883--
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: