* 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>
* osabi.c (gdbarch_init_osabi): Don't complain about an unknown

File diff suppressed because it is too large Load diff

View file

@ -32,13 +32,14 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Chain of cleanups for arguments of OP_UNRESOLVED_VALUE names. Created in
yyparse and freed in ada_resolve. */
extern struct cleanup* unresolved_names;
extern struct cleanup *unresolved_names;
/* Corresponding mangled/demangled names and opcodes for Ada user-definable
operators. */
struct ada_opname_map {
const char* mangled;
const char* demangled;
struct ada_opname_map
{
const char *mangled;
const char *demangled;
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.
*/
enum ada_attribute {
enum ada_attribute
{
/* Invalid attribute for error checking. */
ATR_INVALID,
@ -74,7 +76,8 @@ enum ada_attribute {
ATR_END
};
enum task_states {
enum task_states
{
Unactivated,
Runnable,
Terminated,
@ -89,14 +92,18 @@ enum task_states {
extern char *ada_task_states[];
typedef struct {
typedef struct
{
char *P_ARRAY;
int *P_BOUNDS;
} fat_string;
}
fat_string;
typedef struct entry_call {
typedef struct entry_call
{
void *self;
} *entry_call_link;
}
*entry_call_link;
struct task_fields
{
@ -126,7 +133,7 @@ struct task_fields
#if (defined (VXWORKS_TARGET) && defined (M68K_TARGET))
__attribute__ ((packed))
#endif
;
;
struct task_entry
{
@ -139,17 +146,17 @@ struct task_entry
int stack_per;
};
extern struct type* builtin_type_ada_int;
extern struct type* builtin_type_ada_short;
extern struct type* builtin_type_ada_long;
extern struct type* builtin_type_ada_long_long;
extern struct type* builtin_type_ada_char;
extern struct type* builtin_type_ada_float;
extern struct type* builtin_type_ada_double;
extern struct type* builtin_type_ada_long_double;
extern struct type* builtin_type_ada_natural;
extern struct type* builtin_type_ada_positive;
extern struct type* builtin_type_ada_system_address;
extern struct type *builtin_type_ada_int;
extern struct type *builtin_type_ada_short;
extern struct type *builtin_type_ada_long;
extern struct type *builtin_type_ada_long_long;
extern struct type *builtin_type_ada_char;
extern struct type *builtin_type_ada_float;
extern struct type *builtin_type_ada_double;
extern struct type *builtin_type_ada_long_double;
extern struct type *builtin_type_ada_natural;
extern struct type *builtin_type_ada_positive;
extern struct type *builtin_type_ada_system_address;
/* Assuming V points to an array of S objects, make sure that it contains at
least M objects, updating V and S as necessary. */
@ -157,189 +164,205 @@ extern struct type* builtin_type_ada_system_address;
#define GROW_VECT(v, s, m) \
if ((s) < (m)) grow_vect ((void**) &(v), &(s), (m), sizeof(*(v)));
extern void grow_vect (void**, size_t*, size_t, int);
extern void grow_vect (void **, size_t *, size_t, int);
extern int ada_parse (void); /* Defined in ada-exp.y */
extern void ada_error (char *); /* Defined in ada-exp.y */
/* 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,
struct ui_file*, int, int, int, enum val_prettyprint);
extern int ada_val_print (struct type *, char *, int, CORE_ADDR,
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);
/* 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_printchar (int, struct ui_file*);
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);
extern int ada_array_arity (struct type*);
extern int ada_array_arity (struct type *);
struct type* ada_type_of_array (struct value*, int);
struct type *ada_type_of_array (struct value *, int);
extern struct value* ada_coerce_to_simple_array (struct value*);
extern struct value *ada_coerce_to_simple_array (struct value *);
extern struct value* ada_coerce_to_simple_array_ptr (struct value*);
extern struct value *ada_coerce_to_simple_array_ptr (struct value *);
extern int ada_is_simple_array (struct type*);
extern int ada_is_simple_array (struct type *);
extern int ada_is_array_descriptor (struct type*);
extern int ada_is_array_descriptor (struct type *);
extern int ada_is_bogus_array_descriptor (struct type*);
extern int ada_is_bogus_array_descriptor (struct type *);
extern struct type* ada_index_type (struct type*, int);
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,
struct symbol***, struct block***);
extern int ada_lookup_symbol_list (const char *, 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,
struct value**, int, const char*, struct type*);
extern int ada_resolve_function (struct symbol **, struct block **, int,
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 *);
extern int user_select_syms (struct symbol**, struct block**, int, int);
extern int user_select_syms (struct symbol **, struct block **, int, int);
extern int get_selections (int*, int, int, int, char*);
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 *);
extern struct type* ada_parent_type (struct type*);
extern struct type *ada_parent_type (struct type *);
extern int ada_is_ignored_field (struct type*, int);
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,
int, struct type*);
extern struct value *ada_value_primitive_packed_val (struct value *, char *,
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 *);
extern int ada_is_character_type (struct type*);
extern int ada_is_character_type (struct type *);
extern int ada_is_string_type (struct type*);
extern int ada_is_string_type (struct type *);
extern int ada_is_tagged_type (struct type*);
extern int ada_is_tagged_type (struct type *);
extern struct type* ada_tag_type (struct value*);
extern struct type *ada_tag_type (struct value *);
extern struct value* ada_value_tag (struct value*);
extern struct value *ada_value_tag (struct value *);
extern int ada_is_parent_field (struct type*, int);
extern int ada_is_parent_field (struct type *, int);
extern int ada_is_wrapper_field (struct type*, int);
extern int ada_is_wrapper_field (struct type *, int);
extern int ada_is_variant_part (struct type*, int);
extern int ada_is_variant_part (struct type *, int);
extern struct type* ada_variant_discrim_type (struct type*, struct type*);
extern struct type *ada_variant_discrim_type (struct type *, struct type *);
extern int ada_is_others_clause (struct type*, int);
extern int ada_is_others_clause (struct type *, int);
extern int ada_in_variant (LONGEST, struct type*, int);
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 *);
extern struct type* ada_aligned_type (struct type*);
extern struct type *ada_aligned_type (struct type *);
extern char* ada_aligned_value_addr (struct type*, char*);
extern char *ada_aligned_value_addr (struct type *, char *);
extern const char* ada_attribute_name (int);
extern const char *ada_attribute_name (int);
extern int ada_is_fixed_point_type (struct type*);
extern int ada_is_fixed_point_type (struct type *);
extern DOUBLEST ada_delta (struct type*);
extern DOUBLEST ada_delta (struct type *);
extern DOUBLEST ada_fixed_to_float (struct type *, LONGEST);
extern LONGEST ada_float_to_fixed (struct type*, DOUBLEST);
extern LONGEST ada_float_to_fixed (struct type *, DOUBLEST);
extern int ada_is_vax_floating_type (struct type*);
extern int ada_is_vax_floating_type (struct type *);
extern int ada_vax_float_type_suffix (struct type*);
extern int ada_vax_float_type_suffix (struct type *);
extern struct value* ada_vax_float_print_function (struct type*);
extern struct value *ada_vax_float_print_function (struct type *);
extern struct type* ada_system_address_type (void);
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 *);
extern struct type* ada_find_any_type (const char *name);
extern struct type *ada_find_any_type (const char *name);
extern int ada_prefer_type (struct type*, struct type*);
extern int ada_prefer_type (struct type *, struct type *);
extern struct type* ada_get_base_type (struct type*);
extern struct type *ada_get_base_type (struct type *);
extern struct type* ada_completed_type (struct type*);
extern struct type *ada_completed_type (struct type *);
extern char* ada_mangle (const char*);
extern char *ada_mangle (const char *);
extern const char* ada_enum_name (const char*);
extern const char *ada_enum_name (const char *);
extern int ada_is_modular_type (struct type*);
extern int ada_is_modular_type (struct type *);
extern LONGEST ada_modulus (struct type*);
extern LONGEST ada_modulus (struct type *);
extern struct value* ada_value_ind (struct value*);
extern struct value *ada_value_ind (struct value *);
extern void ada_print_scalar (struct type*, LONGEST, struct ui_file*);
extern void ada_print_scalar (struct type *, LONGEST, struct ui_file *);
extern int ada_is_range_type_name (const char*);
extern int ada_is_range_type_name (const char *);
extern const char* ada_renaming_type (struct type*);
extern const char *ada_renaming_type (struct type *);
extern int ada_is_object_renaming (struct symbol*);
extern int ada_is_object_renaming (struct symbol *);
extern const char* ada_simple_renamed_entity (struct symbol*);
extern const char *ada_simple_renamed_entity (struct symbol *);
extern char* ada_breakpoint_rewrite (char*, int*);
extern char *ada_breakpoint_rewrite (char *, int *);
/* Tasking-related: ada-tasks.c */
@ -349,17 +372,17 @@ extern int get_current_task (void);
extern void init_task_list (void);
extern void* get_self_id (void);
extern void *get_self_id (void);
extern int get_current_task (void);
extern int get_entry_number (void*);
extern int get_entry_number (void *);
extern void ada_report_exception_break (struct breakpoint *);
extern int ada_maybe_exception_partial_symbol (struct partial_symbol* sym);
extern int ada_maybe_exception_partial_symbol (struct partial_symbol *sym);
extern int ada_is_exception_sym (struct symbol* sym);
extern int ada_is_exception_sym (struct symbol *sym);
#endif

View file

@ -71,10 +71,10 @@ extern int dec_thread_get_registers (gdb_gregset_t *, gdb_fpregset_t *);
#elif defined (sun) && defined (__SVR4)
#define GET_CURRENT_THREAD solaris_thread_get_current_thread
#define THREAD_FETCH_REGISTERS() (-1)
extern void *GET_CURRENT_THREAD();
extern void *GET_CURRENT_THREAD ();
#elif defined (_AIX) || (defined(__alpha__) && defined(__osf__))
extern void *GET_CURRENT_THREAD();
extern void *GET_CURRENT_THREAD ();
#elif defined (__WIN32__) || defined (hpux)
#define GET_CURRENT_THREAD() (inferior_pid)
@ -90,7 +90,7 @@ extern void *GET_CURRENT_THREAD();
#define READ_MEMORY(addr, var) read_memory (addr, (char*) &var, sizeof (var))
/* external declarations */
extern struct value* find_function_in_inferior (char *);
extern struct value *find_function_in_inferior (char *);
/* Global visible variables */
@ -110,8 +110,7 @@ const int MAX_NUMBER_OF_KNOWN_TASKS = 1000;
int current_task = -1, current_task_id = -1, current_task_index;
void *current_thread, *current_lwp;
char *ada_task_states[] =
{
char *ada_task_states[] = {
"Unactivated",
"Runnable",
"Terminated",
@ -131,8 +130,7 @@ char *ada_task_states[] =
/* Global internal types */
static char *ada_long_task_states[] =
{
static char *ada_long_task_states[] = {
"Unactivated",
"Runnable",
"Terminated",
@ -176,7 +174,8 @@ add_task_entry (void *p_task_id, int index)
pt->next_task = new_task_entry;
pt->stack_per = 0;
}
else task_list = new_task_entry;
else
task_list = new_task_entry;
return new_task_entry->task_num;
}
@ -250,7 +249,7 @@ valid_task_id (int task)
void *
get_self_id (void)
{
struct value* val;
struct value *val;
void *self_id;
int result;
struct task_entry *ent;
@ -270,7 +269,8 @@ get_self_id (void)
return NULL;
}
int get_current_task ()
int
get_current_task ()
{
int result;
@ -293,8 +293,8 @@ info_task (char *arg, int from_tty)
void *self_id, *caller;
struct task_fields atcb, atcb2;
struct entry_call call;
int bounds [2];
char image [256];
int bounds[2];
char image[256];
int num;
/* FIXME: language_ada should be defined in defs.h */
@ -320,14 +320,16 @@ info_task (char *arg, int from_tty)
printf_filtered ("Ada Task: %p\n", temp_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);
bounds [1] = EXTRACT_INT (bounds [1]);
bounds[1] = EXTRACT_INT (bounds[1]);
read_memory ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_ARRAY),
(char*) &image, bounds [1]);
printf_filtered ("Name: %.*s\n", bounds [1], image);
(char *) &image, bounds[1]);
printf_filtered ("Name: %.*s\n", bounds[1], image);
}
else printf_filtered ("<no name>\n");
else
printf_filtered ("<no name>\n");
/* print the thread id */
@ -353,13 +355,14 @@ info_task (char *arg, int from_tty)
READ_MEMORY ((CORE_ADDR) pt2->task_id, atcb2);
/* 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),
bounds);
bounds [1] = EXTRACT_INT (bounds [1]);
bounds[1] = EXTRACT_INT (bounds[1]);
read_memory ((CORE_ADDR) EXTRACT_ADDRESS (atcb2.image.P_ARRAY),
(char*) &image, bounds [1]);
printf_filtered (" (%.*s)\n", bounds [1], image);
(char *) &image, bounds[1]);
printf_filtered (" (%.*s)\n", bounds[1], image);
}
else
printf_filtered ("\n");
@ -375,7 +378,8 @@ info_task (char *arg, int from_tty)
/* check if this task is accepting a rendezvous */
if (atcb.call == NULL)
caller = NULL;
else {
else
{
READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.call), call);
caller = EXTRACT_ADDRESS (call.self);
}
@ -391,13 +395,14 @@ info_task (char *arg, int from_tty)
READ_MEMORY ((CORE_ADDR) pt2->task_id, atcb2);
/* 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),
bounds);
bounds [1] = EXTRACT_INT (bounds [1]);
bounds[1] = EXTRACT_INT (bounds[1]);
read_memory ((CORE_ADDR) EXTRACT_ADDRESS (atcb2.image.P_ARRAY),
(char*) &image, bounds [1]);
printf_filtered (" (%.*s)\n", bounds [1], image);
(char *) &image, bounds[1]);
printf_filtered (" (%.*s)\n", bounds[1], image);
}
else
printf_filtered ("\n");
@ -406,7 +411,7 @@ info_task (char *arg, int from_tty)
printf_filtered ("\n");
}
else
printf_filtered ("State: %s\n", ada_long_task_states [atcb.state]);
printf_filtered ("State: %s\n", ada_long_task_states[atcb.state]);
}
#if 0
@ -430,15 +435,24 @@ print_align (void)
void *tf_lwp = &(tf.lwp);
printf_filtered ("\n");
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.state at %3d (0x%x)\n", tf_state - tf_base, tf_state);
printf_filtered ("task_fields.parent at %3d (0x%x)\n", tf_parent - tf_base, tf_parent);
printf_filtered ("task_fields.priority at %3d (0x%x)\n", tf_priority - tf_base, tf_priority);
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 ("task_fields.entry_num at %3d (0x%x)\n",
tf_entry_num - tf_base, tf_entry_num);
printf_filtered ("task_fields.state at %3d (0x%x)\n",
tf_state - tf_base, tf_state);
printf_filtered ("task_fields.parent at %3d (0x%x)\n",
tf_parent - tf_base, tf_parent);
printf_filtered ("task_fields.priority at %3d (0x%x)\n",
tf_priority - tf_base, tf_priority);
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");
}
#endif
@ -448,15 +462,15 @@ print_align (void)
static void
info_tasks (char *arg, int from_tty)
{
struct value* val;
struct value *val;
int i, task_number, state;
void *temp_task, *temp_tasks [MAX_NUMBER_OF_KNOWN_TASKS];
void *temp_task, *temp_tasks[MAX_NUMBER_OF_KNOWN_TASKS];
struct task_entry *pt;
void *self_id, *caller, *thread_id=NULL;
void *self_id, *caller, *thread_id = NULL;
struct task_fields atcb;
struct entry_call call;
int bounds [2];
char image [256];
int bounds[2];
char image[256];
int size;
char car;
@ -474,7 +488,7 @@ info_tasks (char *arg, int from_tty)
task_number = 0;
if (PIDGET(inferior_ptid) == 0)
if (PIDGET (inferior_ptid) == 0)
{
printf_filtered ("The program is not being run under gdb. ");
printf_filtered ("Use 'run' or 'attach' first.\n");
@ -519,7 +533,7 @@ info_tasks (char *arg, int from_tty)
READ_MEMORY ((CORE_ADDR) known_tasks_addr, temp_tasks);
for (i=0; i<MAX_NUMBER_OF_KNOWN_TASKS; i++)
for (i = 0; i < MAX_NUMBER_OF_KNOWN_TASKS; i++)
{
temp_task = EXTRACT_ADDRESS (temp_tasks[i]);
@ -534,7 +548,8 @@ info_tasks (char *arg, int from_tty)
/* Return without printing anything if this function was called in
order to init GDBTK tasking. */
if (init_only) return;
if (init_only)
return;
/* print the header */
@ -579,9 +594,9 @@ info_tasks (char *arg, int from_tty)
printf_filtered (" %9lx", (long) temp_task);
#else
#ifdef TARGET_64
printf_filtered (" %#9lx", (unsigned long)pt->thread & 0x3ffffffffff);
printf_filtered (" %#9lx", (unsigned long) pt->thread & 0x3ffffffffff);
#else
printf_filtered (" %#9lx", (long)pt->thread);
printf_filtered (" %#9lx", (long) pt->thread);
#endif
#endif
@ -599,24 +614,26 @@ info_tasks (char *arg, int from_tty)
goto next;
}
read_memory ((CORE_ADDR)atcb.thread, &thr, sizeof (thr));
read_memory ((CORE_ADDR) atcb.thread, &thr, sizeof (thr));
current_thread = atcb.thread;
regs.regs [SP_REGNUM] = 0;
if (dec_thread_get_registers (&regs, NULL) == 0) {
pt->stack_per = (100 * ((long)thr.__stack_base -
regs.regs [SP_REGNUM])) / thr.__stack_size;
regs.regs[SP_REGNUM] = 0;
if (dec_thread_get_registers (&regs, NULL) == 0)
{
pt->stack_per = (100 * ((long) thr.__stack_base -
regs.regs[SP_REGNUM])) / thr.__stack_size;
/* if the thread is terminated but still there, the
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 */
if (thr.__stack_size < 1024*1024)
if (thr.__stack_size < 1024 * 1024)
{
size = thr.__stack_size / 1024;
car = 'K';
}
else if (thr.__stack_size < 1024*1024*1024)
else if (thr.__stack_size < 1024 * 1024 * 1024)
{
size = thr.__stack_size / 1024 / 1024;
car = 'M';
@ -627,7 +644,7 @@ info_tasks (char *arg, int from_tty)
car = 'G';
}
printf_filtered (" %4d%c %2d", size, car, pt->stack_per);
next:
next:
#endif
/* print the current state of the task */
@ -635,13 +652,15 @@ next:
/* check if this task is accepting a rendezvous */
if (atcb.call == NULL)
caller = NULL;
else {
else
{
READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.call), call);
caller = EXTRACT_ADDRESS (call.self);
}
if (caller != NULL)
printf_filtered (" Accepting RV with %-4d", get_entry_number (caller));
printf_filtered (" Accepting RV with %-4d",
get_entry_number (caller));
else
{
state = atcb.state;
@ -653,18 +672,21 @@ next:
/* Replace "Runnable" by "Running" if this is the current task */
printf_filtered (" %-22s", "Running");
else
printf_filtered (" %-22s", ada_task_states [state]);
printf_filtered (" %-22s", ada_task_states[state]);
}
/* finally, print the name of the task */
if (atcb.image.P_ARRAY != NULL) {
READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_BOUNDS), bounds);
bounds [1] = EXTRACT_INT (bounds [1]);
if (atcb.image.P_ARRAY != NULL)
{
READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_BOUNDS),
bounds);
bounds[1] = EXTRACT_INT (bounds[1]);
read_memory ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_ARRAY),
(char*)&image, bounds [1]);
printf_filtered (" %.*s\n", bounds [1], image);
(char *) &image, bounds[1]);
printf_filtered (" %.*s\n", bounds[1], image);
}
else printf_filtered (" <no name>\n");
else
printf_filtered (" <no name>\n");
pt = pt->next_task;
}
@ -730,7 +752,8 @@ task_switch (void *tid, void *lwpid)
#endif
}
if (res == 0) stop_pc = read_pc();
if (res == 0)
stop_pc = read_pc ();
select_frame (get_current_frame ());
return res;
}
@ -772,9 +795,10 @@ task_command (char *tidstr, int from_tty)
{
/* FIXME: find_printable_frame should be defined in frame.h, and
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);
print_stack_frame (selected_frame, frame_relative_level (selected_frame), 1);
print_stack_frame (selected_frame,
frame_relative_level (selected_frame), 1);
}
else
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;
extern struct cmd_list_element *cmdlist;
add_info (
"tasks", info_tasks_command,
add_info ("tasks", info_tasks_command,
"Without argument: list all known Ada tasks, with status information.\n"
"info tasks n: print detailed information of task n.\n");
add_prefix_cmd ("task", class_run, task_command,
"Use this command to switch between tasks.\n\
The new task ID must be currently known.", &task_cmd_list, "task ", 1,
&cmdlist);
The new task ID must be currently known.", &task_cmd_list, "task ", 1, &cmdlist);
}

View file

@ -41,36 +41,38 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static int print_record_field_types (struct type *, struct type *,
struct ui_file *, int, int);
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
print_dynamic_range_bound (struct type*, const char*, int,
const char*, struct ui_file*);
static void print_range_type_named (char*, struct ui_file*);
print_dynamic_range_bound (struct type *, const char *, int,
const 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;
/* The (demangled) Ada name of TYPE. This value persists until the
next call. */
static char*
static char *
demangled_type_name (struct type *type)
{
if (ada_type_name (type) == NULL)
return NULL;
else
{
char* raw_name = ada_type_name (type);
char *raw_name = ada_type_name (type);
char *s, *q;
if (name_buffer == NULL || name_buffer_len <= strlen (raw_name))
@ -80,7 +82,7 @@ demangled_type_name (struct type *type)
}
strcpy (name_buffer, raw_name);
s = (char*) strstr (name_buffer, "___");
s = (char *) strstr (name_buffer, "___");
if (s != NULL)
*s = '\0';
@ -91,18 +93,20 @@ demangled_type_name (struct type *type)
if (s == name_buffer)
return name_buffer;
if (! islower (s[1]))
if (!islower (s[1]))
return NULL;
for (s = q = name_buffer; *s != '\0'; q += 1)
{
if (s[0] == '_' && s[1] == '_')
{
*q = '.'; s += 2;
*q = '.';
s += 2;
}
else
{
*q = *s; s += 1;
*q = *s;
s += 1;
}
}
*q = '\0';
@ -116,20 +120,21 @@ demangled_type_name (struct type *type)
NEW is the new name for a type TYPE. */
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 ",
ada_name_prefix_len (SYMBOL_SOURCE_NAME(new)),
SYMBOL_SOURCE_NAME(new));
ada_name_prefix_len (SYMBOL_SOURCE_NAME (new)),
SYMBOL_SOURCE_NAME (new));
type_print (type, "", stream, 1);
}
/* Print range type TYPE on STREAM. */
static void
print_range (struct type* type, struct ui_file* stream)
print_range (struct type *type, struct ui_file *stream)
{
struct type* target_type;
struct type *target_type;
target_type = TYPE_TARGET_TYPE (type);
if (target_type == NULL)
target_type = type;
@ -165,7 +170,7 @@ print_range (struct type* type, struct ui_file* stream)
and the last element of the type->fields array */
const LONGEST lower_bound = (LONGEST) TYPE_LOW_BOUND (type);
const LONGEST upper_bound =
(LONGEST) TYPE_FIELD_BITPOS (type, TYPE_NFIELDS (type) -1);
(LONGEST) TYPE_FIELD_BITPOS (type, TYPE_NFIELDS (type) - 1);
ada_print_scalar (target_type, lower_bound, stream);
fprintf_filtered (stream, " .. ");
@ -177,7 +182,8 @@ print_range (struct type* type, struct ui_file* stream)
set *N past the bound and its delimiter, if any. */
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;
if (ada_scan_number (bounds, *n, &B, n))
@ -189,8 +195,8 @@ print_range_bound (struct type* type, char* bounds, int* n, struct ui_file* stre
else
{
int bound_len;
char* bound = bounds + *n;
char* pend;
char *bound = bounds + *n;
char *pend;
pend = strstr (bound, "__");
if (pend == NULL)
@ -209,7 +215,8 @@ print_range_bound (struct type* type, char* bounds, int* n, struct ui_file* stre
"___U") according to the ___XD conventions. */
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 size_t name_buf_len = 0;
@ -230,12 +237,12 @@ print_dynamic_range_bound (struct type* type, const char* name, int name_len, co
/* Print the range type named NAME. */
static void
print_range_type_named (char* name, struct ui_file* stream)
print_range_type_named (char *name, struct ui_file *stream)
{
struct type *raw_type = ada_find_any_type (name);
struct type *base_type;
LONGEST low, high;
char* subtype_info;
char *subtype_info;
if (raw_type == NULL)
base_type = builtin_type_int;
@ -265,14 +272,16 @@ print_range_type_named (char* name, struct ui_file* stream)
subtype_info += 1;
}
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, " .. ");
if (*subtype_info == 'U')
print_range_bound (raw_type, bounds_str, &n, stream);
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++)
{
QUIT;
if (i) fprintf_filtered (stream, ", ");
if (i)
fprintf_filtered (stream, ", ");
wrap_here (" ");
fputs_filtered (ada_enum_name (TYPE_FIELD_NAME (type, i)), stream);
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). */
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 n_indices;
@ -354,9 +365,9 @@ print_array_type (struct type *type, struct ui_file *stream, int show, int level
type = ada_coerce_to_simple_array_type (type);
if (ada_is_simple_array (type))
{
struct type* range_desc_type =
struct type *range_desc_type =
ada_find_parallel_type (type, "___XA");
struct type* arr_type;
struct type *arr_type;
bitsize = 0;
if (range_desc_type == NULL)
@ -381,8 +392,8 @@ print_array_type (struct type *type, struct ui_file *stream, int show, int level
{
if (k > 0)
fprintf_filtered (stream, ", ");
print_range_type_named (TYPE_FIELD_NAME (range_desc_type, k),
stream);
print_range_type_named (TYPE_FIELD_NAME
(range_desc_type, k), stream);
if (TYPE_FIELD_BITSIZE (arr_type, 0) > 0)
bitsize = TYPE_FIELD_BITSIZE (arr_type, 0);
}
@ -399,7 +410,7 @@ print_array_type (struct type *type, struct ui_file *stream, int show, int level
fprintf_filtered (stream, ") of ");
wrap_here ("");
ada_print_type (ada_array_element_type (type, n_indices), "", stream,
show == 0 ? 0 : show-1, level+1);
show == 0 ? 0 : show - 1, level + 1);
if (bitsize > 0)
fprintf_filtered (stream, " <packed: %d-bit elements>", bitsize);
}
@ -408,18 +419,19 @@ 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. */
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 p;
const char* name = TYPE_FIELD_NAME (type, field_num);
const char *name = TYPE_FIELD_NAME (type, field_num);
have_output = 0;
/* Skip over leading 'V': NOTE soon to be obsolete. */
if (name[0] == 'V')
{
if (! ada_scan_number (name, 1, NULL, &p))
if (!ada_scan_number (name, 1, NULL, &p))
goto Huh;
}
else
@ -445,7 +457,7 @@ print_choices (struct type *type, int field_num, struct ui_file *stream, struct
case 'S':
{
LONGEST W;
if (! ada_scan_number (name, p + 1, &W, &p))
if (!ada_scan_number (name, p + 1, &W, &p))
goto Huh;
ada_print_scalar (val_type, W, stream);
break;
@ -453,9 +465,8 @@ print_choices (struct type *type, int field_num, struct ui_file *stream, struct
case 'R':
{
LONGEST L, U;
if (! ada_scan_number (name, p + 1, &L, &p)
|| name[p] != 'T'
|| ! ada_scan_number (name, p + 1, &U, &p))
if (!ada_scan_number (name, p + 1, &L, &p)
|| name[p] != 'T' || !ada_scan_number (name, p + 1, &U, &p))
goto Huh;
ada_print_scalar (val_type, L, stream);
fprintf_filtered (stream, " .. ");
@ -512,7 +523,7 @@ print_variant_clauses (struct type *type, int field_num,
print_choices (var_type, i, stream, discr_type);
fprintf_filtered (stream, " =>");
if (print_record_field_types (TYPE_FIELD_TYPE (var_type, i),
outer_type, stream, show, level+4) <= 0)
outer_type, stream, show, level + 4) <= 0)
fprintf_filtered (stream, " null;");
}
}
@ -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, "",
ada_variant_discrim_name
(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, "");
}
@ -561,8 +573,7 @@ print_record_field_types (struct type *type, struct type *outer_type,
{
QUIT;
if (ada_is_parent_field (type, i)
|| ada_is_ignored_field (type, i))
if (ada_is_parent_field (type, i) || ada_is_ignored_field (type, i))
;
else if (ada_is_wrapper_field (type, i))
flds += print_record_field_types (TYPE_FIELD_TYPE (type, i), type,
@ -591,15 +602,16 @@ print_record_field_types (struct type *type, struct type *outer_type,
the number of levels of internal structure to show (see ada_print_type). */
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* type;
struct type *parent_type;
struct type *type;
type = type0;
if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
{
struct type* type1 = ada_find_parallel_type (type, "___XVE");
struct type *type1 = ada_find_parallel_type (type, "___XVE");
if (type1 != NULL)
type = type1;
}
@ -639,7 +651,7 @@ print_record_type (struct type* type0, struct ui_file* stream, int show, int lev
in case the element type itself has nested structure, and SHOW is the
number of levels of internal structure to show (see ada_print_type). */
static void
print_unchecked_union_type (struct type* type, struct ui_file* stream,
print_unchecked_union_type (struct type *type, struct ui_file *stream,
int show, int level)
{
fprintf_filtered (stream, "record (?) is");
@ -652,13 +664,12 @@ print_unchecked_union_type (struct type* type, struct ui_file* stream,
{
int i;
fprintf_filtered (stream, "\n%*scase ? is",
level+4, "");
fprintf_filtered (stream, "\n%*scase ? is", level + 4, "");
for (i = 0; i < TYPE_NFIELDS (type); i += 1)
{
fprintf_filtered (stream, "\n%*swhen ? =>\n%*s", level+8, "",
level+12, "");
fprintf_filtered (stream, "\n%*swhen ? =>\n%*s", level + 8, "",
level + 12, "");
ada_print_type (TYPE_FIELD_TYPE (type, i),
TYPE_FIELD_NAME (type, i),
stream, show - 1, level + 12);
@ -666,7 +677,7 @@ print_unchecked_union_type (struct type* type, struct ui_file* stream,
}
fprintf_filtered (stream, "\n%*send case;\n%*send record",
level+4, "", level, "");
level + 4, "", level, "");
}
}
@ -676,7 +687,7 @@ print_unchecked_union_type (struct type* type, struct ui_file* stream,
for function or procedure NAME if NAME is not null. */
static void
print_func_type (struct type *type, struct ui_file *stream, char* name)
print_func_type (struct type *type, struct ui_file *stream, char *name)
{
int i, len = TYPE_NFIELDS (type);
@ -698,7 +709,7 @@ print_func_type (struct type *type, struct ui_file *stream, char* name)
fputs_filtered ("; ", stream);
wrap_here (" ");
}
fprintf_filtered (stream, "a%d: ", i+1);
fprintf_filtered (stream, "a%d: ", i + 1);
ada_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0);
}
fprintf_filtered (stream, ")");
@ -726,21 +737,20 @@ print_func_type (struct type *type, struct ui_file *stream, char* name)
LEVEL indicates level of recursion (for nested definitions). */
void
ada_print_type (struct type* type0, char* varstring, struct ui_file* stream,
ada_print_type (struct type *type0, char *varstring, struct ui_file *stream,
int show, int level)
{
enum type_code code;
int demangled_args;
struct type* type = ada_completed_type (ada_get_base_type (type0));
char* type_name = demangled_type_name (type);
struct type *type = ada_completed_type (ada_get_base_type (type0));
char *type_name = demangled_type_name (type);
int is_var_decl = (varstring != NULL && varstring[0] != '\0');
if (type == NULL)
{
if (is_var_decl)
fprintf_filtered (stream, "%.*s: ",
ada_name_prefix_len(varstring),
varstring);
ada_name_prefix_len (varstring), varstring);
fprintf_filtered (stream, "<null type?>");
return;
}
@ -773,13 +783,11 @@ ada_print_type (struct type* type0, char* varstring, struct ui_file* stream,
break;
case TYPE_CODE_PTR:
fprintf_filtered (stream, "access ");
ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show,
level);
ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level);
break;
case TYPE_CODE_REF:
fprintf_filtered (stream, "<ref> ");
ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show,
level);
ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level);
break;
case TYPE_CODE_ARRAY:
print_array_type (type, stream, show, level);
@ -791,9 +799,10 @@ ada_print_type (struct type* type0, char* varstring, struct ui_file* stream,
print_vax_floating_point_type (type, stream);
else
{
char* name = ada_type_name (type);
if (! ada_is_range_type_name (name))
fprintf_filtered (stream, "<%d-byte integer>", TYPE_LENGTH (type));
char *name = ada_type_name (type);
if (!ada_is_range_type_name (name))
fprintf_filtered (stream, "<%d-byte integer>",
TYPE_LENGTH (type));
else
{
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))
print_array_type (type, stream, show, level);
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
print_record_type (type, stream, show, level);
break;

View file

@ -32,9 +32,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "c-lang.h"
/* Encapsulates arguments to ada_val_print. */
struct ada_val_print_args {
struct type* type;
char* valaddr0;
struct ada_val_print_args
{
struct type *type;
char *valaddr0;
int embedded_offset;
CORE_ADDR address;
struct ui_file *stream;
@ -47,33 +48,35 @@ struct ada_val_print_args {
extern int inspect_it;
extern unsigned int repeat_count_threshold;
static void print_record (struct type*, char*, struct ui_file*, int,
static void print_record (struct type *, char *, struct ui_file *, int,
int, enum val_prettyprint);
static int print_field_values (struct type*, char*, struct ui_file*,
static int print_field_values (struct type *, char *, struct ui_file *,
int, int, enum val_prettyprint,
int, struct type*, char*);
int, struct type *, char *);
static int print_variant_part (struct type*, int, char*,
struct ui_file*, int, int, enum val_prettyprint,
int, struct type*, 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,
static void val_print_packed_array_elements (struct type *, char *valaddr,
int, struct ui_file *, int, int,
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_1 (struct type*, char*, int, CORE_ADDR, struct ui_file*,
int, int, int, enum val_prettyprint);
static int ada_val_print_1 (struct type *, char *, int, CORE_ADDR,
struct ui_file *, int, int, int,
enum val_prettyprint);
/* Make TYPE unsigned if its range of values includes no negatives. */
static void
adjust_type_signedness (type)
struct type* type;
struct type *type;
{
if (type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE
&& TYPE_LOW_BOUND (type) >= 0)
@ -104,7 +107,8 @@ print_optional_low_bound (struct ui_file *stream, struct type *type)
else
return 0;
switch (TYPE_CODE (index_type)) {
switch (TYPE_CODE (index_type))
{
case TYPE_CODE_ENUM:
if (low_bound == TYPE_FIELD_BITPOS (index_type, 0))
return 0;
@ -147,7 +151,7 @@ val_print_packed_array_elements (struct type *type, char *valaddr,
/* Number of repetitions we have detected so far. */
unsigned int reps;
unsigned long bitsize = TYPE_FIELD_BITSIZE (type, 0);
struct value* mark = value_mark ();
struct value *mark = value_mark ();
elttype = TYPE_TARGET_TYPE (type);
eltlen = TYPE_LENGTH (check_typedef (elttype));
@ -196,8 +200,7 @@ val_print_packed_array_elements (struct type *type, char *valaddr,
(i * bitsize) / HOST_CHAR_BIT,
(i * bitsize) % HOST_CHAR_BIT,
bitsize, elttype);
if (memcmp (VALUE_CONTENTS (v0), VALUE_CONTENTS (v1), eltlen)
!= 0)
if (memcmp (VALUE_CONTENTS (v0), VALUE_CONTENTS (v1), eltlen) != 0)
break;
}
@ -244,8 +247,8 @@ val_print_packed_array_elements (struct type *type, char *valaddr,
value_free_to_mark (mark);
}
static struct type*
printable_val_type (struct type* type, char* valaddr)
static struct type *
printable_val_type (struct type *type, char *valaddr)
{
return ada_to_fixed_type (ada_aligned_type (type), valaddr, 0, NULL);
}
@ -270,19 +273,19 @@ ada_emit_char (int c, struct ui_file *stream, int quoter, int type_len)
fprintf_filtered (stream, "%c", c);
}
else
fprintf_filtered (stream, "[\"%0*x\"]", type_len*2, c);
fprintf_filtered (stream, "[\"%0*x\"]", type_len * 2, c);
}
/* Character #I of STRING, given that TYPE_LEN is the size in bytes (1
or 2) of a character. */
static int
char_at (char* string, int i, int type_len)
char_at (char *string, int i, int type_len)
{
if (type_len == 1)
return string[i];
else
return (int) extract_unsigned_integer (string + 2*i, 2);
return (int) extract_unsigned_integer (string + 2 * i, 2);
}
void
@ -406,7 +409,8 @@ printstr (struct ui_file *stream, char *string, unsigned int length,
rep1 = i + 1;
reps = 1;
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;
reps += 1;
@ -423,7 +427,8 @@ printstr (struct ui_file *stream, char *string, unsigned int length,
in_quotes = 0;
}
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);
fprintf_filtered (stream, " <repeats %u times>", reps);
i = rep1 - 1;
@ -487,12 +492,13 @@ ada_printstr (struct ui_file *stream, char *string, unsigned int length,
arrays.) */
int
ada_val_print (struct type* type, char* valaddr0, int embedded_offset,
ada_val_print (struct type *type, char *valaddr0, int embedded_offset,
CORE_ADDR address, struct ui_file *stream, int format,
int deref_ref, int recurse, enum val_prettyprint pretty)
{
struct ada_val_print_args args;
args.type = type; args.valaddr0 = valaddr0;
args.type = type;
args.valaddr0 = valaddr0;
args.embedded_offset = embedded_offset;
args.address = address;
args.stream = stream;
@ -509,18 +515,18 @@ ada_val_print (struct type* type, char* valaddr0, int embedded_offset,
static int
ada_val_print_stub (PTR 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,
argsp->address, argsp->stream, argsp->format,
argsp->deref_ref, argsp->recurse,
argsp->pretty);
struct ada_val_print_args *argsp = (struct ada_val_print_args *) args0;
return ada_val_print_1 (argsp->type, argsp->valaddr0,
argsp->embedded_offset, argsp->address,
argsp->stream, argsp->format, argsp->deref_ref,
argsp->recurse, argsp->pretty);
}
/* See the comment on ada_val_print. This function differs in that it
* does not catch evaluation errors (leaving that to ada_val_print). */
static int
ada_val_print_1 (struct type* type, char* valaddr0, int embedded_offset,
ada_val_print_1 (struct type *type, char *valaddr0, int embedded_offset,
CORE_ADDR address, struct ui_file *stream, int format,
int deref_ref, int recurse, enum val_prettyprint pretty)
{
@ -530,15 +536,15 @@ ada_val_print_1 (struct type* type, char* valaddr0, int embedded_offset,
unsigned int eltlen;
LONGEST val;
CORE_ADDR addr;
char* valaddr = valaddr0 + embedded_offset;
char *valaddr = valaddr0 + embedded_offset;
CHECK_TYPEDEF (type);
if (ada_is_array_descriptor (type) || ada_is_packed_array_type (type))
{
int retn;
struct value* mark = value_mark ();
struct value* val;
struct value *mark = value_mark ();
struct value *val;
val = value_from_contents_and_address (type, valaddr, address);
val = ada_coerce_to_simple_array_ptr (val);
if (val == NULL)
@ -577,25 +583,25 @@ ada_val_print_1 (struct type* type, char* valaddr0, int embedded_offset,
}
else if (ada_is_vax_floating_type (type))
{
struct value* val =
struct value *val =
value_from_contents_and_address (type, valaddr, address);
struct value* func = ada_vax_float_print_function (type);
struct value *func = ada_vax_float_print_function (type);
if (func != 0)
{
static struct type* parray_of_char = NULL;
struct value* printable_val;
static struct type *parray_of_char = NULL;
struct value *printable_val;
if (parray_of_char == NULL)
parray_of_char =
make_pointer_type
(create_array_type
(NULL, builtin_type_char,
create_range_type (NULL, builtin_type_int, 0, 32)),
NULL);
create_range_type (NULL, builtin_type_int, 0, 32)), NULL);
printable_val =
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));
return 0;
@ -604,16 +610,16 @@ ada_val_print_1 (struct type* type, char* valaddr0, int embedded_offset,
}
else if (TYPE_CODE (type) == TYPE_CODE_RANGE)
{
struct type* target_type = TYPE_TARGET_TYPE (type);
struct type *target_type = TYPE_TARGET_TYPE (type);
if (TYPE_LENGTH (type) != TYPE_LENGTH (target_type))
{
/* Obscure case of range type that has different length from
its base type. Perform a conversion, or we will get a
nonsense value. Actually, we could use the same
code regardless of lengths; I'm just avoiding a cast. */
struct value* v =
value_cast (target_type,
value_from_contents_and_address (type, valaddr, 0));
struct value *v = value_cast (target_type,
value_from_contents_and_address
(type, valaddr, 0));
return ada_val_print_1 (target_type, VALUE_CONTENTS (v), 0, 0,
stream, format, 0, recurse + 1, pretty);
}
@ -661,7 +667,7 @@ ada_val_print_1 (struct type* type, char* valaddr0, int embedded_offset,
}
if (i < len)
{
const char* name = ada_enum_name (TYPE_FIELD_NAME (type, i));
const char *name = ada_enum_name (TYPE_FIELD_NAME (type, i));
if (name[0] == '\'')
fprintf_filtered (stream, "%ld %s", (long) val, name);
else
@ -682,8 +688,7 @@ ada_val_print_1 (struct type* type, char* valaddr0, int embedded_offset,
}
else
{
print_record (type, valaddr, stream, format,
recurse, pretty);
print_record (type, valaddr, stream, format, recurse, pretty);
return 0;
}
@ -695,8 +700,7 @@ ada_val_print_1 (struct type* type, char* valaddr0, int embedded_offset,
len = TYPE_LENGTH (type) / eltlen;
/* For an array of chars, print with string syntax. */
if (ada_is_string_type (type)
&& (format == 0 || format == 's'))
if (ada_is_string_type (type) && (format == 0 || format == 's'))
{
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);
if (TYPE_FIELD_BITSIZE (type, 0) > 0)
val_print_packed_array_elements (type, valaddr, 0, stream,
format, recurse,
pretty);
format, recurse, pretty);
else
val_print_array_elements (type, valaddr, address, stream,
format, deref_ref, recurse,
@ -758,7 +761,7 @@ ada_val_print_1 (struct type* type, char* valaddr0, int embedded_offset,
valaddr);
if (deref_val_int != 0)
{
struct value* deref_val =
struct value *deref_val =
ada_value_ind (value_from_longest
(lookup_pointer_type (elttype),
deref_val_int));
@ -785,8 +788,7 @@ print_variant_part (struct type *type, int field_num, char *valaddr,
struct type *outer_type, char *outer_valaddr)
{
struct type *var_type = TYPE_FIELD_TYPE (type, field_num);
int which =
ada_which_variant_applies (var_type, outer_type, outer_valaddr);
int which = ada_which_variant_applies (var_type, outer_type, outer_valaddr);
if (which < 0)
return 0;
@ -800,23 +802,23 @@ print_variant_part (struct type *type, int field_num, char *valaddr,
}
int
ada_value_print (struct value* val0, struct ui_file *stream, int format,
ada_value_print (struct value *val0, struct ui_file *stream, int format,
enum val_prettyprint pretty)
{
char* valaddr = VALUE_CONTENTS (val0);
char *valaddr = VALUE_CONTENTS (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);
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 (TYPE_CODE (type) == TYPE_CODE_PTR ||
TYPE_CODE (type) == TYPE_CODE_REF)
if (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_CODE (type) == TYPE_CODE_REF)
{
/* Hack: remove (char *) for char strings. Their
type is indicated by the quoted string anyway. */
if (TYPE_CODE (type) == TYPE_CODE_PTR &&
TYPE_LENGTH (TYPE_TARGET_TYPE (type)) == sizeof(char) &&
TYPE_LENGTH (TYPE_TARGET_TYPE (type)) == sizeof (char) &&
TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_INT &&
!TYPE_UNSIGNED (TYPE_TARGET_TYPE (type)))
{
@ -855,8 +857,7 @@ print_record (struct type *type, char *valaddr, struct ui_file *stream,
fprintf_filtered (stream, "(");
if (print_field_values (type, valaddr, stream, format, recurse, pretty,
0, type, valaddr) != 0
&& pretty)
0, type, valaddr) != 0 && pretty)
{
fprintf_filtered (stream, "\n");
print_spaces_filtered (2 * recurse, stream);
@ -952,7 +953,7 @@ print_field_values (struct type *type, char *valaddr, struct ui_file *stream,
if (TYPE_FIELD_PACKED (type, i))
{
struct value* v;
struct value *v;
/* Bitfields require special handling, especially due to byte
order problems. */
@ -972,7 +973,7 @@ print_field_values (struct type *type, char *valaddr, struct ui_file *stream,
bit_pos % HOST_CHAR_BIT,
bit_size,
TYPE_FIELD_TYPE (type, i));
val_print (TYPE_FIELD_TYPE(type, i), VALUE_CONTENTS (v), 0, 0,
val_print (TYPE_FIELD_TYPE (type, i), VALUE_CONTENTS (v), 0, 0,
stream, format, 0, recurse + 1, pretty);
}
}