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] |
| Other format: | [Raw text] | |
This patch adds some stuff to gdbtypes.h, parse.c, parser-defs.h and
valarith.c to support the ada-* files, and provide the infrastructure
needed for some of the more intrusive changes that are needed.
ChangeLog:
* gdbtypes.h (TYPE_FLAG_FIXED_INSTANCE, TYPE_FIXED_INSTANCE) New
definitions.
(base_type): Declare.
* parser-defs.h (add_name_string_cleanup): Declare.
* parse.c (name_list): New type.
(temp_name_list): New variable.
(add_name_string_cleanup): New function.
* valarith.c (base_type): New function.
Patch:
Index: gdbtypes.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.h,v
retrieving revision 1.36
diff -u -r1.36 gdbtypes.h
--- gdbtypes.h 14 Sep 2002 02:09:39 -0000 1.36
+++ gdbtypes.h 26 Sep 2002 02:35:55 -0000
@@ -197,7 +197,6 @@
#define TYPE_FLAG_VOLATILE (1 << 6)
#define TYPE_VOLATILE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_VOLATILE)
-
/* This is a function type which appears to have a prototype. We need this
for function calls in order to tell us if it's necessary to coerce the args,
or to just do the standard conversions. This is used with a short field. */
@@ -253,6 +252,13 @@
#define TYPE_FLAG_VECTOR (1 << 12)
#define TYPE_VECTOR(t) (TYPE_FLAGS (t) & TYPE_FLAG_VECTOR)
+/* Marks a type that has been created from a template for a
+ dynamically sized type (e.g., GNAT arrays whose bounds are runtime
+ quantities). Optionally marks an ordinary, fixed-size GDB type. */
+
+#define TYPE_FLAG_FIXED_INSTANCE (1 << 13)
+#define TYPE_FIXED_INSTANCE(t) (TYPE_FLAGS (t) & TYPE_FLAG_FIXED_INSTANCE)
+
struct main_type
{
/* Code for kind of type */
@@ -335,6 +341,9 @@
For a function or method type, describes the type of the return value.
For a range type, describes the type of the full range.
For a complex type, describes the type of each coordinate.
+ For a special record or union type encoding a dynamic-sized type
+ in GNAT, a memoized pointer to a corresponding static version of
+ the type.
Unused otherwise. */
struct type *target_type;
@@ -394,7 +403,10 @@
says how many bytes the field occupies.
A value of -1 or -2 indicates a static field; -1 means the location
is specified by the label loc.physname; -2 means that loc.physaddr
- specifies the actual address. */
+ specifies the actual address.
+ If non-zero in an array type, indicates the element size in
+ bits (used only in Ada at the moment).
+ */
int bitsize;
@@ -1249,5 +1261,8 @@
extern int is_integral_type (struct type *);
extern void maintenance_print_type (char *, int);
+/* valarith.c */
+
+extern struct type* base_type (struct type*);
#endif /* GDBTYPES_H */
Index: parse.c
===================================================================
RCS file: /cvs/src/src/gdb/parse.c,v
retrieving revision 1.28
diff -u -r1.28 parse.c
--- parse.c 25 Sep 2002 20:30:37 -0000 1.28
+++ parse.c 26 Sep 2002 02:35:58 -0000
@@ -105,6 +105,15 @@
static struct funcall *funcall_chain;
+/* List of strings. */
+
+struct name_list {
+ struct name_list* next;
+ char* name;
+};
+
+static struct name_list *temp_name_list;
+
/* Begin counting arguments for a function call,
saving the data about any containing call. */
@@ -396,6 +405,20 @@
write_exp_elt_opcode (UNOP_MEMVAL);
}
+
+/* Add S to the list of strings that will eventually have to be
+ released after parsing and must also be released on error. */
+void
+add_name_string_cleanup (char *s)
+{
+ struct name_list* elt =
+ (struct name_list*) xmalloc (sizeof (struct name_list));
+
+ elt -> name = s;
+ elt -> next = temp_name_list;
+ temp_name_list = elt;
+}
+
/* Recognize tokens that start with '$'. These include:
$regname A native register name or a "standard
Index: parser-defs.h
===================================================================
RCS file: /cvs/src/src/gdb/parser-defs.h,v
retrieving revision 1.14
diff -u -r1.14 parser-defs.h
--- parser-defs.h 25 Sep 2002 20:30:37 -0000 1.14
+++ parser-defs.h 26 Sep 2002 02:35:58 -0000
@@ -101,6 +101,8 @@
extern union type_stack_elt *type_stack;
extern int type_stack_depth, type_stack_size;
+extern void add_name_string_cleanup (char*);
+
extern void write_exp_elt (union exp_element);
extern void write_exp_elt_opcode (enum exp_opcode);
Index: valarith.c
===================================================================
RCS file: /cvs/src/src/gdb/valarith.c,v
retrieving revision 1.16
diff -u -r1.16 valarith.c
--- valarith.c 1 Aug 2002 17:18:33 -0000 1.16
+++ valarith.c 26 Sep 2002 02:36:00 -0000
@@ -1162,6 +1162,22 @@
return val;
}
+/* The identity on non-range types. For range types, the underlying */
+/* non-range scalar type. */
+
+struct type*
+base_type (struct type* type)
+{
+ while (type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE)
+ {
+ if (type == TYPE_TARGET_TYPE (type)
+ || TYPE_TARGET_TYPE (type) == NULL)
+ return type;
+ type = TYPE_TARGET_TYPE (type);
+ }
+ return type;
+}
+
/* Simulate the C operator ! -- return 1 if ARG1 contains zero. */
int
- Aidan
--
aidan@velvet.net http://www.velvet.net/~aidan/ aim:aidans42
http://www.livejournal.com/users/aidan_skinner/
finger for pgp key: 01AA 1594 2DB0 09E3 B850 C2D0 9A2C 4CC9 3EC4 75E1
Attachment:
msg00630/pgp00000.pgp
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |