From: Nick Roberts <nickrob@snap.net.nz>
To: gdb-patches@sources.redhat.com
Subject: PATCH: Start Fortran support for variable objects.
Date: Wed, 29 Jun 2005 21:28:00 -0000 [thread overview]
Message-ID: <17091.4780.953681.620094@farnswood.snap.net.nz> (raw)
[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 1455 bytes --]
This patch adjusts the offset from 0 to 1 to allow the display of arrays
in Fortran using variable objects.
Currently given:
DIMENSION I(4)
DATA I/1,2,3,4/
(gdb)
-var-create - * I
^done,name="var1",numchild="4",type="integer (4)"
(gdb)
-var-list-children var1
&"warning: array or string index out of range\n"
^done,numchild="4",children={child={name="var1.0",exp="0",numchild="0",type="integer"},child={name="var1.1",exp="1",numchild="0",type="integer"},child={name="var1.2",exp="2",numchild="0",type="integer"},child={name="var1.3",exp="3",numchild="0",type="integer"}}
(gdb)
This patch changes the output to:
(gdb)
-var-create - * I
^done,name="var1",numchild="4",type="integer (4)"
(gdb)
-var-list-children var1
^done,numchild="4",children=[child={name="var1.1",exp="1",numchild="0",type="integer"},child={name="var1.2",exp="2",numchild="0",type="integer"},child={name="var1.3",exp="3",numchild="0",type="integer"},child={name="var1.4",exp="4",numchild="0",type="integer"}]
(gdb)
It doesn't add any new methods for finding values in Fortran but allows for
this to be done later (hopefully someone else will pick this up).
It should be safe to apply as it doesn't change behaviour for existing
languages.
In addition to the patch below, I attach the watch windows from my mode
(gdb-ui.el) in Emacs 22.0.50 (in CVS) for Fortran and C to show the different
offsets. gdb-mi.el in the GDB repository would work similarly.
Nick
[-- Attachment #2: Fortran watch window --]
[-- Type: image/png, Size: 3205 bytes --]
[-- Attachment #3: C watch window --]
[-- Type: image/png, Size: 3573 bytes --]
[-- Attachment #4: message body text --]
[-- Type: text/plain, Size: 3481 bytes --]
2005-06-30 Nick Roberts <nickrob@snap.net.nz>
* varobj.h: Add Fortran to list of supported languages.
* varobj.c (varobj_language_string, variable_language): Add Fortran.
(languages) Add Fortran. Use c methods.
(varobj_list_children): Adjust offset for Fortran.
*** varobj.h.~1.4.~ 2001-08-18 06:56:49.000000000 +1200
--- varobj.h 2005-06-29 15:43:31.000000000 +1200
***************
*** 45,51 ****
/* Languages supported by this variable objects system. */
enum varobj_languages
{
! vlang_unknown = 0, vlang_c, vlang_cplus, vlang_java, vlang_end
};
/* String representations of gdb's known languages (defined in varobj.c) */
--- 45,52 ----
/* Languages supported by this variable objects system. */
enum varobj_languages
{
! vlang_unknown = 0, vlang_c, vlang_cplus, vlang_java, vlang_fortran,
! vlang_end
};
/* String representations of gdb's known languages (defined in varobj.c) */
*** varobj.c.~1.54.~ 2005-06-29 00:28:57.000000000 +1200
--- varobj.c 2005-06-29 17:35:34.000000000 +1200
***************
*** 46,52 ****
{ "natural", "binary", "decimal", "hexadecimal", "octal" };
/* String representations of gdb's known languages */
! char *varobj_language_string[] = { "unknown", "C", "C++", "Java" };
/* Data structures */
--- 46,52 ----
{ "natural", "binary", "decimal", "hexadecimal", "octal" };
/* String representations of gdb's known languages */
! char *varobj_language_string[] = { "unknown", "C", "C++", "Java", "Fortran" };
/* Data structures */
***************
*** 372,377 ****
--- 372,389 ----
java_type_of_child,
java_variable_editable,
java_value_of_variable}
+ ,
+ /* Fortran */
+ {
+ vlang_fortran,
+ c_number_of_children,
+ c_name_of_variable,
+ c_name_of_child,
+ c_value_of_root,
+ c_value_of_child,
+ c_type_of_child,
+ c_variable_editable,
+ c_value_of_variable}
};
/* A little convenience enum for dealing with C++/Java */
***************
*** 696,702 ****
{
struct varobj *child;
char *name;
! int i;
/* sanity check: have we been passed a pointer? */
if (childlist == NULL)
--- 708,714 ----
{
struct varobj *child;
char *name;
! int i, j;
/* sanity check: have we been passed a pointer? */
if (childlist == NULL)
***************
*** 715,725 ****
/* Mark as the end in case we bail out */
*((*childlist) + i) = NULL;
/* check if child exists, if not create */
! name = name_of_child (var, i);
child = child_exists (var, name);
if (child == NULL)
! child = create_child (var, i, name);
*((*childlist) + i) = child;
}
--- 727,742 ----
/* Mark as the end in case we bail out */
*((*childlist) + i) = NULL;
+ if (variable_language (var) == vlang_fortran)
+ j = i + 1;
+ else
+ j = i;
+
/* check if child exists, if not create */
! name = name_of_child (var, j);
child = child_exists (var, name);
if (child == NULL)
! child = create_child (var, j, name);
*((*childlist) + i) = child;
}
***************
*** 1564,1570 ****
case language_java:
lang = vlang_java;
break;
! }
return lang;
}
--- 1581,1590 ----
case language_java:
lang = vlang_java;
break;
! case language_fortran:
! lang = vlang_fortran;
! break;
! }
return lang;
}
next reply other threads:[~2005-06-29 21:28 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-29 21:28 Nick Roberts [this message]
2005-06-30 2:53 ` Daniel Jacobowitz
2005-06-30 9:28 ` Nick Roberts
2005-06-30 13:15 ` Daniel Jacobowitz
2005-06-30 22:21 ` Nick Roberts
2005-06-30 22:23 ` Daniel Jacobowitz
2005-06-30 13:18 ` Daniel Jacobowitz
2005-06-30 22:21 ` Nick Roberts
2005-07-01 3:35 ` Wu Zhou
2005-07-01 5:04 ` Nick Roberts
2005-07-01 12:00 ` Wu Zhou
2005-07-03 16:17 ` Daniel Jacobowitz
2005-07-03 23:40 ` Nick Roberts
2005-07-03 23:47 ` Daniel Jacobowitz
2005-07-04 1:42 ` Nick Roberts
2005-07-04 3:49 ` Daniel Jacobowitz
2005-07-04 7:35 ` Nick Roberts
2005-07-05 3:43 ` Nick Roberts
2006-03-13 14:08 ` Nick Roberts
2006-03-24 22:58 ` Daniel Jacobowitz
2006-03-27 1:25 ` Nick Roberts
2006-03-27 4:04 ` Daniel Jacobowitz
2006-03-27 4:24 ` Nick Roberts
2006-03-27 11:32 ` Daniel Jacobowitz
2005-07-06 8:31 ` Wu Zhou
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=17091.4780.953681.620094@farnswood.snap.net.nz \
--to=nickrob@snap.net.nz \
--cc=gdb-patches@sources.redhat.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