* ada-lang.c: run through gdb_indent.sh

* ada-lang.h: run through gdb_indent.sh
        * ada-tasks.c: run through gdb_indent.sh
        * ada-typeprint.c: run through gdb_indent.sh
        * ada-valprint.c: run through gdb_indent.sh
This commit is contained in:
Aidan Skinner 2002-08-18 18:11:12 +00:00
parent 01fc4e33eb
commit d2e4a39e32
6 changed files with 3279 additions and 3167 deletions

View file

@ -1,3 +1,11 @@
2002-08-18 Aidan Skinner <aidan@velvet.net>
* ada-lang.c: run through gdb_indent.sh
* ada-lang.h: run through gdb_indent.sh
* ada-tasks.c: run through gdb_indent.sh
* ada-typeprint.c: run through gdb_indent.sh
* ada-valprint.c: run through gdb_indent.sh
2002-08-18 Andrew Cagney <ac131313@redhat.com> 2002-08-18 Andrew Cagney <ac131313@redhat.com>
* osabi.c (gdbarch_init_osabi): Don't complain about an unknown * osabi.c (gdbarch_init_osabi): Don't complain about an unknown

File diff suppressed because it is too large Load diff

View file

@ -36,7 +36,8 @@ extern struct cleanup* unresolved_names;
/* Corresponding mangled/demangled names and opcodes for Ada user-definable /* Corresponding mangled/demangled names and opcodes for Ada user-definable
operators. */ operators. */
struct ada_opname_map { struct ada_opname_map
{
const char *mangled; const char *mangled;
const char *demangled; const char *demangled;
enum exp_opcode op; enum exp_opcode op;
@ -53,7 +54,8 @@ extern const int MAX_NUMBER_OF_KNOWN_TASKS;
to update the table attribute_names in ada-lang.c whenever you change this. to update the table attribute_names in ada-lang.c whenever you change this.
*/ */
enum ada_attribute { enum ada_attribute
{
/* Invalid attribute for error checking. */ /* Invalid attribute for error checking. */
ATR_INVALID, ATR_INVALID,
@ -74,7 +76,8 @@ enum ada_attribute {
ATR_END ATR_END
}; };
enum task_states { enum task_states
{
Unactivated, Unactivated,
Runnable, Runnable,
Terminated, Terminated,
@ -89,14 +92,18 @@ enum task_states {
extern char *ada_task_states[]; extern char *ada_task_states[];
typedef struct { typedef struct
{
char *P_ARRAY; char *P_ARRAY;
int *P_BOUNDS; int *P_BOUNDS;
} fat_string; }
fat_string;
typedef struct entry_call { typedef struct entry_call
{
void *self; void *self;
} *entry_call_link; }
*entry_call_link;
struct task_fields struct task_fields
{ {
@ -164,17 +171,20 @@ extern int ada_parse (void); /* Defined in ada-exp.y */
extern void ada_error (char *); /* Defined in ada-exp.y */ extern void ada_error (char *); /* Defined in ada-exp.y */
/* Defined in ada-typeprint.c */ /* Defined in ada-typeprint.c */
extern void ada_print_type (struct type*, char*, struct ui_file*, int, int); extern void ada_print_type (struct type *, char *, struct ui_file *, int,
int);
extern int ada_val_print (struct type *, char *, int, CORE_ADDR, extern int ada_val_print (struct type *, char *, int, CORE_ADDR,
struct ui_file*, int, int, int, enum val_prettyprint); struct ui_file *, int, int, int,
enum val_prettyprint);
extern int ada_value_print (struct value *, struct ui_file *, int, extern int ada_value_print (struct value *, struct ui_file *, int,
enum val_prettyprint); enum val_prettyprint);
/* Defined in ada-lang.c */ /* Defined in ada-lang.c */
extern struct value* value_from_contents_and_address (struct type*, char*, CORE_ADDR); extern struct value *value_from_contents_and_address (struct type *, char *,
CORE_ADDR);
extern void ada_emit_char (int, struct ui_file *, int, int); extern void ada_emit_char (int, struct ui_file *, int, int);
@ -182,9 +192,11 @@ extern void ada_printchar (int, struct ui_file*);
extern void ada_printstr (struct ui_file *, char *, unsigned int, int, int); extern void ada_printstr (struct ui_file *, char *, unsigned int, int, int);
extern void ada_convert_actuals (struct value*, int, struct value**, CORE_ADDR*); extern void ada_convert_actuals (struct value *, int, struct value **,
CORE_ADDR *);
extern struct value* ada_value_subscript (struct value*, int, struct value**); extern struct value *ada_value_subscript (struct value *, int,
struct value **);
extern struct type *ada_array_element_type (struct type *, int); extern struct type *ada_array_element_type (struct type *, int);
@ -206,19 +218,22 @@ extern struct type* ada_index_type (struct type*, int);
extern struct value *ada_array_bound (struct value *, int, int); extern struct value *ada_array_bound (struct value *, int, int);
extern int ada_lookup_symbol_list (const char*, struct block*, namespace_enum, extern int ada_lookup_symbol_list (const char *, struct block *,
struct symbol***, struct block***); namespace_enum, struct symbol ***,
struct block ***);
extern char *ada_fold_name (const char *); extern char *ada_fold_name (const char *);
extern struct symbol* ada_lookup_symbol (const char*, struct block*, namespace_enum); extern struct symbol *ada_lookup_symbol (const char *, struct block *,
namespace_enum);
extern struct minimal_symbol *ada_lookup_minimal_symbol (const char *); extern struct minimal_symbol *ada_lookup_minimal_symbol (const char *);
extern void ada_resolve (struct expression **, struct type *); extern void ada_resolve (struct expression **, struct type *);
extern int ada_resolve_function (struct symbol **, struct block **, int, extern int ada_resolve_function (struct symbol **, struct block **, int,
struct value**, int, const char*, struct type*); struct value **, int, const char *,
struct type *);
extern void ada_fill_in_ada_prototype (struct symbol *); extern void ada_fill_in_ada_prototype (struct symbol *);
@ -228,7 +243,9 @@ extern int get_selections (int*, int, int, int, char*);
extern char *ada_start_decode_line_1 (char *); extern char *ada_start_decode_line_1 (char *);
extern struct symtabs_and_lines ada_finish_decode_line_1 (char**, struct symtab*, int, char***); extern struct symtabs_and_lines ada_finish_decode_line_1 (char **,
struct symtab *,
int, char ***);
extern int ada_scan_number (const char *, int, LONGEST *, int *); extern int ada_scan_number (const char *, int, LONGEST *, int *);
@ -238,8 +255,9 @@ extern int ada_is_ignored_field (struct type*, int);
extern int ada_is_packed_array_type (struct type *); extern int ada_is_packed_array_type (struct type *);
extern struct value* ada_value_primitive_packed_val (struct value*, char*, long, int, extern struct value *ada_value_primitive_packed_val (struct value *, char *,
int, struct type*); long, int, int,
struct type *);
extern struct type *ada_coerce_to_simple_array_type (struct type *); extern struct type *ada_coerce_to_simple_array_type (struct type *);
@ -267,11 +285,13 @@ extern int ada_in_variant (LONGEST, struct type*, int);
extern char *ada_variant_discrim_name (struct type *); extern char *ada_variant_discrim_name (struct type *);
extern struct type* ada_lookup_struct_elt_type (struct type*, char*, int, int*); extern struct type *ada_lookup_struct_elt_type (struct type *, char *, int,
int *);
extern struct value *ada_value_struct_elt (struct value *, char *, char *); extern struct value *ada_value_struct_elt (struct value *, char *, char *);
extern struct value* ada_search_struct_field (char*, struct value*, int, struct type*); extern struct value *ada_search_struct_field (char *, struct value *, int,
struct type *);
extern int ada_is_aligner_type (struct type *); extern int ada_is_aligner_type (struct type *);
@ -299,15 +319,18 @@ extern struct type* ada_system_address_type (void);
extern int ada_which_variant_applies (struct type *, struct type *, char *); extern int ada_which_variant_applies (struct type *, struct type *, char *);
extern struct value* ada_to_fixed_value (struct type*, char*, CORE_ADDR, struct value*); extern struct value *ada_to_fixed_value (struct type *, char *, CORE_ADDR,
struct value *);
extern struct type* ada_to_fixed_type (struct type*, char*, CORE_ADDR, struct value*); extern struct type *ada_to_fixed_type (struct type *, char *, CORE_ADDR,
struct value *);
extern int ada_name_prefix_len (const char *); extern int ada_name_prefix_len (const char *);
extern char *ada_type_name (struct type *); extern char *ada_type_name (struct type *);
extern struct type* ada_find_parallel_type (struct type*, const char *suffix); extern struct type *ada_find_parallel_type (struct type *,
const char *suffix);
extern LONGEST get_int_var_value (char *, char *, int *); extern LONGEST get_int_var_value (char *, char *, int *);

View file

@ -110,8 +110,7 @@ const int MAX_NUMBER_OF_KNOWN_TASKS = 1000;
int current_task = -1, current_task_id = -1, current_task_index; int current_task = -1, current_task_id = -1, current_task_index;
void *current_thread, *current_lwp; void *current_thread, *current_lwp;
char *ada_task_states[] = char *ada_task_states[] = {
{
"Unactivated", "Unactivated",
"Runnable", "Runnable",
"Terminated", "Terminated",
@ -131,8 +130,7 @@ char *ada_task_states[] =
/* Global internal types */ /* Global internal types */
static char *ada_long_task_states[] = static char *ada_long_task_states[] = {
{
"Unactivated", "Unactivated",
"Runnable", "Runnable",
"Terminated", "Terminated",
@ -176,7 +174,8 @@ add_task_entry (void *p_task_id, int index)
pt->next_task = new_task_entry; pt->next_task = new_task_entry;
pt->stack_per = 0; pt->stack_per = 0;
} }
else task_list = new_task_entry; else
task_list = new_task_entry;
return new_task_entry->task_num; return new_task_entry->task_num;
} }
@ -270,7 +269,8 @@ get_self_id (void)
return NULL; return NULL;
} }
int get_current_task () int
get_current_task ()
{ {
int result; int result;
@ -320,14 +320,16 @@ info_task (char *arg, int from_tty)
printf_filtered ("Ada Task: %p\n", temp_task); printf_filtered ("Ada Task: %p\n", temp_task);
/* print the name of the task */ /* print the name of the task */
if (atcb.image.P_ARRAY != NULL) { if (atcb.image.P_ARRAY != NULL)
{
READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_BOUNDS), bounds); READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_BOUNDS), bounds);
bounds[1] = EXTRACT_INT (bounds[1]); bounds[1] = EXTRACT_INT (bounds[1]);
read_memory ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_ARRAY), read_memory ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_ARRAY),
(char *) &image, bounds[1]); (char *) &image, bounds[1]);
printf_filtered ("Name: %.*s\n", bounds[1], image); printf_filtered ("Name: %.*s\n", bounds[1], image);
} }
else printf_filtered ("<no name>\n"); else
printf_filtered ("<no name>\n");
/* print the thread id */ /* print the thread id */
@ -353,7 +355,8 @@ info_task (char *arg, int from_tty)
READ_MEMORY ((CORE_ADDR) pt2->task_id, atcb2); READ_MEMORY ((CORE_ADDR) pt2->task_id, atcb2);
/* print the name of the task */ /* print the name of the task */
if (atcb2.image.P_ARRAY != NULL) { if (atcb2.image.P_ARRAY != NULL)
{
READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb2.image.P_BOUNDS), READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb2.image.P_BOUNDS),
bounds); bounds);
bounds[1] = EXTRACT_INT (bounds[1]); bounds[1] = EXTRACT_INT (bounds[1]);
@ -375,7 +378,8 @@ info_task (char *arg, int from_tty)
/* check if this task is accepting a rendezvous */ /* check if this task is accepting a rendezvous */
if (atcb.call == NULL) if (atcb.call == NULL)
caller = NULL; caller = NULL;
else { else
{
READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.call), call); READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.call), call);
caller = EXTRACT_ADDRESS (call.self); caller = EXTRACT_ADDRESS (call.self);
} }
@ -391,7 +395,8 @@ info_task (char *arg, int from_tty)
READ_MEMORY ((CORE_ADDR) pt2->task_id, atcb2); READ_MEMORY ((CORE_ADDR) pt2->task_id, atcb2);
/* print the name of the task */ /* print the name of the task */
if (atcb2.image.P_ARRAY != NULL) { if (atcb2.image.P_ARRAY != NULL)
{
READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb2.image.P_BOUNDS), READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb2.image.P_BOUNDS),
bounds); bounds);
bounds[1] = EXTRACT_INT (bounds[1]); bounds[1] = EXTRACT_INT (bounds[1]);
@ -430,15 +435,24 @@ print_align (void)
void *tf_lwp = &(tf.lwp); void *tf_lwp = &(tf.lwp);
printf_filtered ("\n"); printf_filtered ("\n");
printf_filtered ("(tf_base = 0x%x)\n", tf_base); printf_filtered ("(tf_base = 0x%x)\n", tf_base);
printf_filtered ("task_fields.entry_num at %3d (0x%x)\n", tf_entry_num - tf_base, tf_entry_num); printf_filtered ("task_fields.entry_num at %3d (0x%x)\n",
printf_filtered ("task_fields.state at %3d (0x%x)\n", tf_state - tf_base, tf_state); tf_entry_num - tf_base, tf_entry_num);
printf_filtered ("task_fields.parent at %3d (0x%x)\n", tf_parent - tf_base, tf_parent); printf_filtered ("task_fields.state at %3d (0x%x)\n",
printf_filtered ("task_fields.priority at %3d (0x%x)\n", tf_priority - tf_base, tf_priority); tf_state - tf_base, tf_state);
printf_filtered ("task_fields.current_priority at %3d (0x%x)\n", tf_current_priority - tf_base, tf_current_priority); printf_filtered ("task_fields.parent at %3d (0x%x)\n",
printf_filtered ("task_fields.image at %3d (0x%x)\n", tf_image - tf_base, tf_image); tf_parent - tf_base, tf_parent);
printf_filtered ("task_fields.call at %3d (0x%x)\n", tf_call - tf_base, tf_call); printf_filtered ("task_fields.priority at %3d (0x%x)\n",
printf_filtered ("task_fields.thread at %3d (0x%x)\n", tf_thread - tf_base, tf_thread); tf_priority - tf_base, tf_priority);
printf_filtered ("task_fields.lwp at %3d (0x%x)\n", tf_lwp - tf_base, tf_lwp); printf_filtered ("task_fields.current_priority at %3d (0x%x)\n",
tf_current_priority - tf_base, tf_current_priority);
printf_filtered ("task_fields.image at %3d (0x%x)\n",
tf_image - tf_base, tf_image);
printf_filtered ("task_fields.call at %3d (0x%x)\n",
tf_call - tf_base, tf_call);
printf_filtered ("task_fields.thread at %3d (0x%x)\n",
tf_thread - tf_base, tf_thread);
printf_filtered ("task_fields.lwp at %3d (0x%x)\n",
tf_lwp - tf_base, tf_lwp);
printf_filtered ("\n"); printf_filtered ("\n");
} }
#endif #endif
@ -534,7 +548,8 @@ info_tasks (char *arg, int from_tty)
/* Return without printing anything if this function was called in /* Return without printing anything if this function was called in
order to init GDBTK tasking. */ order to init GDBTK tasking. */
if (init_only) return; if (init_only)
return;
/* print the header */ /* print the header */
@ -602,12 +617,14 @@ info_tasks (char *arg, int from_tty)
read_memory ((CORE_ADDR) atcb.thread, &thr, sizeof (thr)); read_memory ((CORE_ADDR) atcb.thread, &thr, sizeof (thr));
current_thread = atcb.thread; current_thread = atcb.thread;
regs.regs[SP_REGNUM] = 0; regs.regs[SP_REGNUM] = 0;
if (dec_thread_get_registers (&regs, NULL) == 0) { if (dec_thread_get_registers (&regs, NULL) == 0)
{
pt->stack_per = (100 * ((long) thr.__stack_base - pt->stack_per = (100 * ((long) thr.__stack_base -
regs.regs[SP_REGNUM])) / thr.__stack_size; regs.regs[SP_REGNUM])) / thr.__stack_size;
/* if the thread is terminated but still there, the /* if the thread is terminated but still there, the
stack_base/size values are erroneous. Try to patch it */ stack_base/size values are erroneous. Try to patch it */
if (pt->stack_per < 0 || pt->stack_per > 100) pt->stack_per = 0; if (pt->stack_per < 0 || pt->stack_per > 100)
pt->stack_per = 0;
} }
/* print information about stack space used in the thread */ /* print information about stack space used in the thread */
@ -635,13 +652,15 @@ next:
/* check if this task is accepting a rendezvous */ /* check if this task is accepting a rendezvous */
if (atcb.call == NULL) if (atcb.call == NULL)
caller = NULL; caller = NULL;
else { else
{
READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.call), call); READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.call), call);
caller = EXTRACT_ADDRESS (call.self); caller = EXTRACT_ADDRESS (call.self);
} }
if (caller != NULL) if (caller != NULL)
printf_filtered (" Accepting RV with %-4d", get_entry_number (caller)); printf_filtered (" Accepting RV with %-4d",
get_entry_number (caller));
else else
{ {
state = atcb.state; state = atcb.state;
@ -657,14 +676,17 @@ next:
} }
/* finally, print the name of the task */ /* finally, print the name of the task */
if (atcb.image.P_ARRAY != NULL) { if (atcb.image.P_ARRAY != NULL)
READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_BOUNDS), bounds); {
READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_BOUNDS),
bounds);
bounds[1] = EXTRACT_INT (bounds[1]); bounds[1] = EXTRACT_INT (bounds[1]);
read_memory ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_ARRAY), read_memory ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_ARRAY),
(char *) &image, bounds[1]); (char *) &image, bounds[1]);
printf_filtered (" %.*s\n", bounds[1], image); printf_filtered (" %.*s\n", bounds[1], image);
} }
else printf_filtered (" <no name>\n"); else
printf_filtered (" <no name>\n");
pt = pt->next_task; pt = pt->next_task;
} }
@ -730,7 +752,8 @@ task_switch (void *tid, void *lwpid)
#endif #endif
} }
if (res == 0) stop_pc = read_pc(); if (res == 0)
stop_pc = read_pc ();
select_frame (get_current_frame ()); select_frame (get_current_frame ());
return res; return res;
} }
@ -774,7 +797,8 @@ task_command (char *tidstr, int from_tty)
implemented in ada-lang.c */ implemented in ada-lang.c */
/* find_printable_frame (selected_frame, frame_relative_level (selected_frame)); */ /* find_printable_frame (selected_frame, frame_relative_level (selected_frame)); */
printf_filtered ("[Switching to task %d]\n", num); printf_filtered ("[Switching to task %d]\n", num);
print_stack_frame (selected_frame, frame_relative_level (selected_frame), 1); print_stack_frame (selected_frame,
frame_relative_level (selected_frame), 1);
} }
else else
printf_filtered ("Unable to switch to task %d\n", num); printf_filtered ("Unable to switch to task %d\n", num);
@ -786,13 +810,11 @@ _initialize_tasks (void)
static struct cmd_list_element *task_cmd_list = NULL; static struct cmd_list_element *task_cmd_list = NULL;
extern struct cmd_list_element *cmdlist; extern struct cmd_list_element *cmdlist;
add_info ( add_info ("tasks", info_tasks_command,
"tasks", info_tasks_command,
"Without argument: list all known Ada tasks, with status information.\n" "Without argument: list all known Ada tasks, with status information.\n"
"info tasks n: print detailed information of task n.\n"); "info tasks n: print detailed information of task n.\n");
add_prefix_cmd ("task", class_run, task_command, add_prefix_cmd ("task", class_run, task_command,
"Use this command to switch between tasks.\n\ "Use this command to switch between tasks.\n\
The new task ID must be currently known.", &task_cmd_list, "task ", 1, The new task ID must be currently known.", &task_cmd_list, "task ", 1, &cmdlist);
&cmdlist);
} }

View file

@ -43,20 +43,22 @@ static int print_record_field_types (struct type *, struct type *,
static void print_array_type (struct type *, struct ui_file *, int, int); static void print_array_type (struct type *, struct ui_file *, int, int);
static void print_choices (struct type*, int, struct ui_file*, struct type*); static void print_choices (struct type *, int, struct ui_file *,
struct type *);
static void print_range (struct type *, struct ui_file *); static void print_range (struct type *, struct ui_file *);
static void print_range_bound (struct type*, char*, int*, struct ui_file*); static void print_range_bound (struct type *, char *, int *,
struct ui_file *);
static void static void
print_dynamic_range_bound (struct type *, const char *, int, print_dynamic_range_bound (struct type *, const char *, int,
const char *, struct ui_file *); const char *, struct ui_file *);
static void print_range_type_named (char *, struct ui_file *); static void print_range_type_named (char *, struct ui_file *);
static char *name_buffer; static char *name_buffer;
static int name_buffer_len; static int name_buffer_len;
@ -98,11 +100,13 @@ demangled_type_name (struct type *type)
{ {
if (s[0] == '_' && s[1] == '_') if (s[0] == '_' && s[1] == '_')
{ {
*q = '.'; s += 2; *q = '.';
s += 2;
} }
else else
{ {
*q = *s; s += 1; *q = *s;
s += 1;
} }
} }
*q = '\0'; *q = '\0';
@ -116,7 +120,8 @@ demangled_type_name (struct type *type)
NEW is the new name for a type TYPE. */ NEW is the new name for a type TYPE. */
void void
ada_typedef_print (struct type *type, struct symbol *new, struct ui_file *stream) ada_typedef_print (struct type *type, struct symbol *new,
struct ui_file *stream)
{ {
fprintf_filtered (stream, "type %.*s is ", fprintf_filtered (stream, "type %.*s is ",
ada_name_prefix_len (SYMBOL_SOURCE_NAME (new)), ada_name_prefix_len (SYMBOL_SOURCE_NAME (new)),
@ -177,7 +182,8 @@ print_range (struct type* type, struct ui_file* stream)
set *N past the bound and its delimiter, if any. */ set *N past the bound and its delimiter, if any. */
static void static void
print_range_bound (struct type* type, char* bounds, int* n, struct ui_file* stream) print_range_bound (struct type *type, char *bounds, int *n,
struct ui_file *stream)
{ {
LONGEST B; LONGEST B;
if (ada_scan_number (bounds, *n, &B, n)) if (ada_scan_number (bounds, *n, &B, n))
@ -209,7 +215,8 @@ print_range_bound (struct type* type, char* bounds, int* n, struct ui_file* stre
"___U") according to the ___XD conventions. */ "___U") according to the ___XD conventions. */
static void static void
print_dynamic_range_bound (struct type* type, const char* name, int name_len, const char* suffix, struct ui_file* stream) print_dynamic_range_bound (struct type *type, const char *name, int name_len,
const char *suffix, struct ui_file *stream)
{ {
static char *name_buf = NULL; static char *name_buf = NULL;
static size_t name_buf_len = 0; static size_t name_buf_len = 0;
@ -265,14 +272,16 @@ print_range_type_named (char* name, struct ui_file* stream)
subtype_info += 1; subtype_info += 1;
} }
else else
print_dynamic_range_bound (raw_type, name, prefix_len, "___L", stream); print_dynamic_range_bound (raw_type, name, prefix_len, "___L",
stream);
fprintf_filtered (stream, " .. "); fprintf_filtered (stream, " .. ");
if (*subtype_info == 'U') if (*subtype_info == 'U')
print_range_bound (raw_type, bounds_str, &n, stream); print_range_bound (raw_type, bounds_str, &n, stream);
else else
print_dynamic_range_bound (raw_type, name, prefix_len, "___U", stream); print_dynamic_range_bound (raw_type, name, prefix_len, "___U",
stream);
} }
} }
@ -291,7 +300,8 @@ print_enum_type (struct type *type, struct ui_file *stream)
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
{ {
QUIT; QUIT;
if (i) fprintf_filtered (stream, ", "); if (i)
fprintf_filtered (stream, ", ");
wrap_here (" "); wrap_here (" ");
fputs_filtered (ada_enum_name (TYPE_FIELD_NAME (type, i)), stream); fputs_filtered (ada_enum_name (TYPE_FIELD_NAME (type, i)), stream);
if (lastval != TYPE_FIELD_BITPOS (type, i)) if (lastval != TYPE_FIELD_BITPOS (type, i))
@ -337,7 +347,8 @@ print_vax_floating_point_type (struct type *type, struct ui_file *stream)
structure to show (see ada_print_type). */ structure to show (see ada_print_type). */
static void static void
print_array_type (struct type *type, struct ui_file *stream, int show, int level) print_array_type (struct type *type, struct ui_file *stream, int show,
int level)
{ {
int bitsize; int bitsize;
int n_indices; int n_indices;
@ -381,8 +392,8 @@ print_array_type (struct type *type, struct ui_file *stream, int show, int level
{ {
if (k > 0) if (k > 0)
fprintf_filtered (stream, ", "); fprintf_filtered (stream, ", ");
print_range_type_named (TYPE_FIELD_NAME (range_desc_type, k), print_range_type_named (TYPE_FIELD_NAME
stream); (range_desc_type, k), stream);
if (TYPE_FIELD_BITSIZE (arr_type, 0) > 0) if (TYPE_FIELD_BITSIZE (arr_type, 0) > 0)
bitsize = TYPE_FIELD_BITSIZE (arr_type, 0); bitsize = TYPE_FIELD_BITSIZE (arr_type, 0);
} }
@ -408,7 +419,8 @@ print_array_type (struct type *type, struct ui_file *stream, int show, int level
STREAM, assuming the VAL_TYPE is the type of the values. */ STREAM, assuming the VAL_TYPE is the type of the values. */
static void static void
print_choices (struct type *type, int field_num, struct ui_file *stream, struct type *val_type) print_choices (struct type *type, int field_num, struct ui_file *stream,
struct type *val_type)
{ {
int have_output; int have_output;
int p; int p;
@ -454,8 +466,7 @@ print_choices (struct type *type, int field_num, struct ui_file *stream, struct
{ {
LONGEST L, U; LONGEST L, U;
if (!ada_scan_number (name, p + 1, &L, &p) if (!ada_scan_number (name, p + 1, &L, &p)
|| name[p] != 'T' || name[p] != 'T' || !ada_scan_number (name, p + 1, &U, &p))
|| ! ada_scan_number (name, p + 1, &U, &p))
goto Huh; goto Huh;
ada_print_scalar (val_type, L, stream); ada_print_scalar (val_type, L, stream);
fprintf_filtered (stream, " .. "); fprintf_filtered (stream, " .. ");
@ -532,7 +543,8 @@ print_variant_part (struct type *type, int field_num, struct type *outer_type,
fprintf_filtered (stream, "\n%*scase %s is", level + 4, "", fprintf_filtered (stream, "\n%*scase %s is", level + 4, "",
ada_variant_discrim_name ada_variant_discrim_name
(TYPE_FIELD_TYPE (type, field_num))); (TYPE_FIELD_TYPE (type, field_num)));
print_variant_clauses (type, field_num, outer_type, stream, show, level + 4); print_variant_clauses (type, field_num, outer_type, stream, show,
level + 4);
fprintf_filtered (stream, "\n%*send case;", level + 4, ""); fprintf_filtered (stream, "\n%*send case;", level + 4, "");
} }
@ -561,8 +573,7 @@ print_record_field_types (struct type *type, struct type *outer_type,
{ {
QUIT; QUIT;
if (ada_is_parent_field (type, i) if (ada_is_parent_field (type, i) || ada_is_ignored_field (type, i))
|| ada_is_ignored_field (type, i))
; ;
else if (ada_is_wrapper_field (type, i)) else if (ada_is_wrapper_field (type, i))
flds += print_record_field_types (TYPE_FIELD_TYPE (type, i), type, flds += print_record_field_types (TYPE_FIELD_TYPE (type, i), type,
@ -591,7 +602,8 @@ print_record_field_types (struct type *type, struct type *outer_type,
the number of levels of internal structure to show (see ada_print_type). */ the number of levels of internal structure to show (see ada_print_type). */
static void static void
print_record_type (struct type* type0, struct ui_file* stream, int show, int level) print_record_type (struct type *type0, struct ui_file *stream, int show,
int level)
{ {
struct type *parent_type; struct type *parent_type;
struct type *type; struct type *type;
@ -652,8 +664,7 @@ print_unchecked_union_type (struct type* type, struct ui_file* stream,
{ {
int i; int i;
fprintf_filtered (stream, "\n%*scase ? is", fprintf_filtered (stream, "\n%*scase ? is", level + 4, "");
level+4, "");
for (i = 0; i < TYPE_NFIELDS (type); i += 1) for (i = 0; i < TYPE_NFIELDS (type); i += 1)
{ {
@ -739,8 +750,7 @@ ada_print_type (struct type* type0, char* varstring, struct ui_file* stream,
{ {
if (is_var_decl) if (is_var_decl)
fprintf_filtered (stream, "%.*s: ", fprintf_filtered (stream, "%.*s: ",
ada_name_prefix_len(varstring), ada_name_prefix_len (varstring), varstring);
varstring);
fprintf_filtered (stream, "<null type?>"); fprintf_filtered (stream, "<null type?>");
return; return;
} }
@ -773,13 +783,11 @@ ada_print_type (struct type* type0, char* varstring, struct ui_file* stream,
break; break;
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
fprintf_filtered (stream, "access "); fprintf_filtered (stream, "access ");
ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show, ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level);
level);
break; break;
case TYPE_CODE_REF: case TYPE_CODE_REF:
fprintf_filtered (stream, "<ref> "); fprintf_filtered (stream, "<ref> ");
ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show, ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level);
level);
break; break;
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:
print_array_type (type, stream, show, level); print_array_type (type, stream, show, level);
@ -793,7 +801,8 @@ ada_print_type (struct type* type0, char* varstring, struct ui_file* stream,
{ {
char *name = ada_type_name (type); char *name = ada_type_name (type);
if (!ada_is_range_type_name (name)) if (!ada_is_range_type_name (name))
fprintf_filtered (stream, "<%d-byte integer>", TYPE_LENGTH (type)); fprintf_filtered (stream, "<%d-byte integer>",
TYPE_LENGTH (type));
else else
{ {
fprintf_filtered (stream, "range "); fprintf_filtered (stream, "range ");
@ -827,7 +836,8 @@ ada_print_type (struct type* type0, char* varstring, struct ui_file* stream,
if (ada_is_array_descriptor (type)) if (ada_is_array_descriptor (type))
print_array_type (type, stream, show, level); print_array_type (type, stream, show, level);
else if (ada_is_bogus_array_descriptor (type)) else if (ada_is_bogus_array_descriptor (type))
fprintf_filtered (stream, "array (?) of ? (<mal-formed descriptor>)"); fprintf_filtered (stream,
"array (?) of ? (<mal-formed descriptor>)");
else else
print_record_type (type, stream, show, level); print_record_type (type, stream, show, level);
break; break;

View file

@ -32,7 +32,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "c-lang.h" #include "c-lang.h"
/* Encapsulates arguments to ada_val_print. */ /* Encapsulates arguments to ada_val_print. */
struct ada_val_print_args { struct ada_val_print_args
{
struct type *type; struct type *type;
char *valaddr0; char *valaddr0;
int embedded_offset; int embedded_offset;
@ -55,19 +56,21 @@ static int print_field_values (struct type*, char*, struct ui_file*,
int, struct type *, char *); int, struct type *, char *);
static int print_variant_part (struct type *, int, char *, static int print_variant_part (struct type *, int, char *,
struct ui_file*, int, int, enum val_prettyprint,
int, struct type*, char*);
static void val_print_packed_array_elements (struct type*, char *valaddr, int,
struct ui_file *, int, int, struct ui_file *, int, int,
enum val_prettyprint, int, struct type *,
char *);
static void val_print_packed_array_elements (struct type *, char *valaddr,
int, struct ui_file *, int, int,
enum val_prettyprint); enum val_prettyprint);
static void adjust_type_signedness (struct type *); static void adjust_type_signedness (struct type *);
static int ada_val_print_stub (PTR args0); static int ada_val_print_stub (PTR args0);
static int ada_val_print_1 (struct type*, char*, int, CORE_ADDR, struct ui_file*, static int ada_val_print_1 (struct type *, char *, int, CORE_ADDR,
int, int, int, enum val_prettyprint); struct ui_file *, int, int, int,
enum val_prettyprint);
/* Make TYPE unsigned if its range of values includes no negatives. */ /* Make TYPE unsigned if its range of values includes no negatives. */
@ -104,7 +107,8 @@ print_optional_low_bound (struct ui_file *stream, struct type *type)
else else
return 0; return 0;
switch (TYPE_CODE (index_type)) { switch (TYPE_CODE (index_type))
{
case TYPE_CODE_ENUM: case TYPE_CODE_ENUM:
if (low_bound == TYPE_FIELD_BITPOS (index_type, 0)) if (low_bound == TYPE_FIELD_BITPOS (index_type, 0))
return 0; return 0;
@ -196,8 +200,7 @@ val_print_packed_array_elements (struct type *type, char *valaddr,
(i * bitsize) / HOST_CHAR_BIT, (i * bitsize) / HOST_CHAR_BIT,
(i * bitsize) % HOST_CHAR_BIT, (i * bitsize) % HOST_CHAR_BIT,
bitsize, elttype); bitsize, elttype);
if (memcmp (VALUE_CONTENTS (v0), VALUE_CONTENTS (v1), eltlen) if (memcmp (VALUE_CONTENTS (v0), VALUE_CONTENTS (v1), eltlen) != 0)
!= 0)
break; break;
} }
@ -406,7 +409,8 @@ printstr (struct ui_file *stream, char *string, unsigned int length,
rep1 = i + 1; rep1 = i + 1;
reps = 1; reps = 1;
while (rep1 < length && while (rep1 < length &&
char_at(string, rep1, type_len) == char_at (string, i, type_len)) char_at (string, rep1, type_len) == char_at (string, i,
type_len))
{ {
rep1 += 1; rep1 += 1;
reps += 1; reps += 1;
@ -423,7 +427,8 @@ printstr (struct ui_file *stream, char *string, unsigned int length,
in_quotes = 0; in_quotes = 0;
} }
fputs_filtered ("'", stream); fputs_filtered ("'", stream);
ada_emit_char (char_at (string, i, type_len), stream, '\'', type_len); ada_emit_char (char_at (string, i, type_len), stream, '\'',
type_len);
fputs_filtered ("'", stream); fputs_filtered ("'", stream);
fprintf_filtered (stream, " <repeats %u times>", reps); fprintf_filtered (stream, " <repeats %u times>", reps);
i = rep1 - 1; i = rep1 - 1;
@ -492,7 +497,8 @@ ada_val_print (struct type* type, char* valaddr0, int embedded_offset,
int deref_ref, int recurse, enum val_prettyprint pretty) int deref_ref, int recurse, enum val_prettyprint pretty)
{ {
struct ada_val_print_args args; struct ada_val_print_args args;
args.type = type; args.valaddr0 = valaddr0; args.type = type;
args.valaddr0 = valaddr0;
args.embedded_offset = embedded_offset; args.embedded_offset = embedded_offset;
args.address = address; args.address = address;
args.stream = stream; args.stream = stream;
@ -510,10 +516,10 @@ static int
ada_val_print_stub (PTR args0) ada_val_print_stub (PTR args0)
{ {
struct ada_val_print_args *argsp = (struct ada_val_print_args *) args0; struct ada_val_print_args *argsp = (struct ada_val_print_args *) args0;
return ada_val_print_1 (argsp->type, argsp->valaddr0, argsp->embedded_offset, return ada_val_print_1 (argsp->type, argsp->valaddr0,
argsp->address, argsp->stream, argsp->format, argsp->embedded_offset, argsp->address,
argsp->deref_ref, argsp->recurse, argsp->stream, argsp->format, argsp->deref_ref,
argsp->pretty); argsp->recurse, argsp->pretty);
} }
/* See the comment on ada_val_print. This function differs in that it /* See the comment on ada_val_print. This function differs in that it
@ -590,12 +596,12 @@ ada_val_print_1 (struct type* type, char* valaddr0, int embedded_offset,
make_pointer_type make_pointer_type
(create_array_type (create_array_type
(NULL, builtin_type_char, (NULL, builtin_type_char,
create_range_type (NULL, builtin_type_int, 0, 32)), create_range_type (NULL, builtin_type_int, 0, 32)), NULL);
NULL);
printable_val = printable_val =
value_ind (value_cast (parray_of_char, value_ind (value_cast (parray_of_char,
call_function_by_hand (func, 1, &val))); call_function_by_hand (func, 1,
&val)));
fprintf_filtered (stream, "%s", VALUE_CONTENTS (printable_val)); fprintf_filtered (stream, "%s", VALUE_CONTENTS (printable_val));
return 0; return 0;
@ -611,9 +617,9 @@ ada_val_print_1 (struct type* type, char* valaddr0, int embedded_offset,
its base type. Perform a conversion, or we will get a its base type. Perform a conversion, or we will get a
nonsense value. Actually, we could use the same nonsense value. Actually, we could use the same
code regardless of lengths; I'm just avoiding a cast. */ code regardless of lengths; I'm just avoiding a cast. */
struct value* v = struct value *v = value_cast (target_type,
value_cast (target_type, value_from_contents_and_address
value_from_contents_and_address (type, valaddr, 0)); (type, valaddr, 0));
return ada_val_print_1 (target_type, VALUE_CONTENTS (v), 0, 0, return ada_val_print_1 (target_type, VALUE_CONTENTS (v), 0, 0,
stream, format, 0, recurse + 1, pretty); stream, format, 0, recurse + 1, pretty);
} }
@ -682,8 +688,7 @@ ada_val_print_1 (struct type* type, char* valaddr0, int embedded_offset,
} }
else else
{ {
print_record (type, valaddr, stream, format, print_record (type, valaddr, stream, format, recurse, pretty);
recurse, pretty);
return 0; return 0;
} }
@ -695,8 +700,7 @@ ada_val_print_1 (struct type* type, char* valaddr0, int embedded_offset,
len = TYPE_LENGTH (type) / eltlen; len = TYPE_LENGTH (type) / eltlen;
/* For an array of chars, print with string syntax. */ /* For an array of chars, print with string syntax. */
if (ada_is_string_type (type) if (ada_is_string_type (type) && (format == 0 || format == 's'))
&& (format == 0 || format == 's'))
{ {
if (prettyprint_arrays) if (prettyprint_arrays)
{ {
@ -725,8 +729,7 @@ ada_val_print_1 (struct type* type, char* valaddr0, int embedded_offset,
print_optional_low_bound (stream, type); print_optional_low_bound (stream, type);
if (TYPE_FIELD_BITSIZE (type, 0) > 0) if (TYPE_FIELD_BITSIZE (type, 0) > 0)
val_print_packed_array_elements (type, valaddr, 0, stream, val_print_packed_array_elements (type, valaddr, 0, stream,
format, recurse, format, recurse, pretty);
pretty);
else else
val_print_array_elements (type, valaddr, address, stream, val_print_array_elements (type, valaddr, address, stream,
format, deref_ref, recurse, format, deref_ref, recurse,
@ -785,8 +788,7 @@ print_variant_part (struct type *type, int field_num, char *valaddr,
struct type *outer_type, char *outer_valaddr) struct type *outer_type, char *outer_valaddr)
{ {
struct type *var_type = TYPE_FIELD_TYPE (type, field_num); struct type *var_type = TYPE_FIELD_TYPE (type, field_num);
int which = int which = ada_which_variant_applies (var_type, outer_type, outer_valaddr);
ada_which_variant_applies (var_type, outer_type, outer_valaddr);
if (which < 0) if (which < 0)
return 0; return 0;
@ -807,11 +809,11 @@ ada_value_print (struct value* val0, struct ui_file *stream, int format,
CORE_ADDR address = VALUE_ADDRESS (val0) + VALUE_OFFSET (val0); CORE_ADDR address = VALUE_ADDRESS (val0) + VALUE_OFFSET (val0);
struct type *type = struct type *type =
ada_to_fixed_type (VALUE_TYPE (val0), valaddr, address, NULL); ada_to_fixed_type (VALUE_TYPE (val0), valaddr, address, NULL);
struct value* val = value_from_contents_and_address (type, valaddr, address); struct value *val =
value_from_contents_and_address (type, valaddr, address);
/* If it is a pointer, indicate what it points to. */ /* If it is a pointer, indicate what it points to. */
if (TYPE_CODE (type) == TYPE_CODE_PTR || if (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_CODE (type) == TYPE_CODE_REF)
TYPE_CODE (type) == TYPE_CODE_REF)
{ {
/* Hack: remove (char *) for char strings. Their /* Hack: remove (char *) for char strings. Their
type is indicated by the quoted string anyway. */ type is indicated by the quoted string anyway. */
@ -855,8 +857,7 @@ print_record (struct type *type, char *valaddr, struct ui_file *stream,
fprintf_filtered (stream, "("); fprintf_filtered (stream, "(");
if (print_field_values (type, valaddr, stream, format, recurse, pretty, if (print_field_values (type, valaddr, stream, format, recurse, pretty,
0, type, valaddr) != 0 0, type, valaddr) != 0 && pretty)
&& pretty)
{ {
fprintf_filtered (stream, "\n"); fprintf_filtered (stream, "\n");
print_spaces_filtered (2 * recurse, stream); print_spaces_filtered (2 * recurse, stream);