From: Fernando Nasser <fnasser@cygnus.com>
To: gdb-patches@sourceware.cygnus.com, insight@sourceware.cygnus.com
Subject: [PATCH]: Fix varobj.c array element handling.
Date: Thu, 30 Mar 2000 11:47:00 -0000 [thread overview]
Message-ID: <38E3AF5C.F2A5A364@cygnus.com> (raw)
As soon as Michael Snyder gets his change to wrapper.c in I will check an adjusted version of the following patch.
This updates the code that handles array elements. The old code works for arrays that reside in memory but breaks for
arrays that live in registers.
--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@cygnus.com
2323 Yonge Street, Suite #300 Tel: 416-482-2661 ext. 311
Toronto, Ontario M4P 2C9 Fax: 416-482-6299
Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.2
diff -c -p -r1.2 varobj.c
*** varobj.c 2000/03/13 21:51:45 1.2
--- varobj.c 2000/03/30 19:44:23
*************** c_value_of_child (parent, index)
*** 1954,1960 ****
struct varobj *parent;
int index;
{
! value_ptr value, temp;
struct type *type, *target;
char *name;
--- 1954,1960 ----
struct varobj *parent;
int index;
{
! value_ptr value, temp, indval;
struct type *type, *target;
char *name;
*************** c_value_of_child (parent, index)
*** 1969,1977 ****
--- 1969,1983 ----
switch (TYPE_CODE (type))
{
case TYPE_CODE_ARRAY:
+ #if 0
+ /* This breaks if the array lives in a (vector) register. */
value = value_slice (temp, index, 1);
temp = value_coerce_array (value);
gdb_value_ind (temp, &value);
+ #else
+ indval = value_from_longest (builtin_type_int, (LONGEST) index);
+ gdb_value_subscript (temp, indval, &value);
+ #endif
break;
case TYPE_CODE_STRUCT:
Index: wrapper.c
===================================================================
RCS file: /cvs/src/src/gdb/wrapper.c,v
retrieving revision 1.2
diff -c -p -r1.2 wrapper.c
*** wrapper.c 2000/03/13 21:51:45 1.2
--- wrapper.c 2000/03/30 19:44:23
*************** int wrap_value_fetch_lazy PARAMS ((char
*** 46,51 ****
--- 46,54 ----
int gdb_value_equal PARAMS ((value_ptr, value_ptr, int *));
int wrap_value_equal PARAMS ((char *));
+ int gdb_value_subscript PARAMS ((value_ptr, value_ptr, value_ptr * rval));
+ int wrap_value_subscript PARAMS ((char *));
+
int gdb_value_ind PARAMS ((value_ptr val, value_ptr * rval));
int wrap_value_ind PARAMS ((char *opaque_arg));
*************** wrap_value_equal (a)
*** 169,174 ****
--- 172,213 ----
val2 = (value_ptr) (args)->args[1];
(args)->result = (char *) value_equal (val1, val2);
+ return 1;
+ }
+
+ int
+ gdb_value_subscript (val1, val2, rval)
+ value_ptr val1;
+ value_ptr val2;
+ value_ptr * rval;
+ {
+ struct gdb_wrapper_arguments args;
+
+ args.args[0] = (char *) val1;
+ args.args[1] = (char *) val2;
+
+ if (!catch_errors ((catch_errors_ftype *) wrap_value_subscript, &args,
+ "", RETURN_MASK_ERROR))
+ {
+ /* An error occurred */
+ return 0;
+ }
+
+ *rval = (value_ptr) args.result;
+ return 1;
+ }
+
+ int
+ wrap_value_subscript (a)
+ char *a;
+ {
+ struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) a;
+ value_ptr val1, val2;
+
+ val1 = (value_ptr) (args)->args[0];
+ val2 = (value_ptr) (args)->args[1];
+
+ (args)->result = (char *) value_subscript (val1, val2);
return 1;
}
reply other threads:[~2000-03-30 11:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=38E3AF5C.F2A5A364@cygnus.com \
--to=fnasser@cygnus.com \
--cc=gdb-patches@sourceware.cygnus.com \
--cc=insight@sourceware.cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).