summaryrefslogtreecommitdiff
path: root/gdb/linux-tdep.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2009-07-02 12:55:30 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2009-07-02 12:55:30 +0000
commitf139ea31f3fc9b82f94e6478abd6d94869576ef8 (patch)
treedd11b36f41466f12059521c71a9f56a1c963040f /gdb/linux-tdep.c
parent9c1bf21b22cf4e5ce09c1cee4e3ea4393c777282 (diff)
downloadgdb-f139ea31f3fc9b82f94e6478abd6d94869576ef8.tar.gz
* gdbtypes.h (TYPE_OBJFILE_OWNED, TYPE_OWNER): New macros.
(TYPE_OBJFILE, TYPE_ALLOC, TYPE_ZALLOC): Reimplement. (alloc_type_arch): Add prototype. (alloc_type_copy): Likewise. (get_type_arch): Likewise. (arch_type): Likewise. (arch_integer_type): Likewise. (arch_character_type): Likewise. (arch_boolean_type): Likewise. (init_float_type): Remove, replace by ... (arch_float_type): ... this. (init_complex_type): Remove, replace by ... (arch_complex_type): ... this. (init_flags_type): Remove, replace by ... (arch_flags_type): ... this. (init_composite_type): Remove, replace by ... (arch_composite_type): ... this. * gdbtypes.c (alloc_type): No longer support NULL objfile. (init_type): Likewise. (alloc_type_arch): New function. (alloc_type_copy): New function. (get_type_arch): New function. (smash_type): Preserve type ownership information. (make_pointer_type, make_reference_type, make_function_type, smash_to_memberptr_type, smash_to_method_type): No longer preserve OBJFILE across smash_type calls. (make_pointer_type, make_reference_type, make_function_type, lookup_memberptr_type, lookup_methodptr_type, allocate_stub_method, create_range_type, create_array_type, create_set_type, copy_type): Use alloc_type_copy when allocating types. (check_typedef): Use alloc_type_arch. (copy_type_recursive): Likewise. Preserve type ownership data after copying type. (recursive_dump_type): Dump type ownership data. (alloc_type_instance): Update type ownership check. (copy_type, copy_type_recursive): Likewise. (arch_type): New function. (arch_integer_type): Likewise. (arch_character_type): Likewise. (arch_boolean_type): Likewise. (init_float_type): Remove, replace by ... (arch_float_type): ... this. (init_complex_type): Remove, replace by ... (arch_complex_type): ... this. (init_flags_type): Remove, replace by ... (arch_flags_type): ... this. (append_flags_type_flag): Move down. (init_composite_type): Remove, replace by ... (arch_composite_type): ... this. (append_composite_type_field_aligned, append_composite_type_field): Move down. * gdbarch.c (gdbtypes_post_init): Allocate all types using per-architecture routines. * ada-lang.c (ada_language_arch_info): Likewise. * f-lang.c (build_fortran_types): Likewise. * jv-lang.c (build_java_types): Likewise. * m2-lang.c (build_m2_types): Likewise. * scm-lang.c (build_scm_types): Likewise. * ada-lang.c (ada_type_of_array): Use alloc_type_copy. (packed_array_type): Likewise. (ada_template_to_fixed_record_type_1): Likewise. (template_to_static_fixed_type): Likewise. (to_record_with_fixed_variant_part): Likewise. (to_fixed_variant_branch_type): Likewise. (to_fixed_array_type): Likewise. (to_fixed_range_type): Likewise. (empty_record): Use type instead of objfile argument. Use alloc_type_copy. (to_fixed_variant_branch_type): Update call to empty_record. * jv-lang.c (type_from_class): Use alloc_type_arch. * arm-tdep.c (arm_ext_type): Allocate per-architecture type. * i386-tdep.c (i386_eflags_type, i386_mxcsr_type, i387_ext_type, i386_mmx_type, i386_sse_type): Likewise. * ia64-tdep.c (ia64_ext_type): Likewise. * m32c-tdep.c (make_types): Likewise. * m68k-tdep.c (m68k_ps_type, m68881_ext_type): Likewise. * rs6000-tdep.c (rs6000_builtin_type_vec64, rs6000_builtin_type_vec128): Likewise. * sparc-tdep.c (sparc_psr_type, sparc_fsr_type): Likewise. * sparc64-tdep.c (sparc64_pstate_type, sparc64_fsr_type, sparc64_fprs_type): Likewise. * spu-tdep.c (spu_builtin_type_vec128): Likewise. * xtensa-tdep.c (xtensa_register_type): Likewise. * linux-tdep.c (linux_get_siginfo_type): Likewise. * target-descriptions.c (tdesc_gdb_type): Likewise. * gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
Diffstat (limited to 'gdb/linux-tdep.c')
-rw-r--r--gdb/linux-tdep.c51
1 files changed, 24 insertions, 27 deletions
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index e18e134ed36..37770f5f5b9 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -33,43 +33,40 @@ linux_get_siginfo_type (struct gdbarch *gdbarch)
struct type *siginfo_type, *sifields_type;
struct type *type;
- int_type = init_type (TYPE_CODE_INT,
- gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT,
- 0, "int", NULL);
- uint_type = init_type (TYPE_CODE_INT,
- gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT,
- 0, "unsigned int", NULL);
- long_type = init_type (TYPE_CODE_INT,
- gdbarch_long_bit (gdbarch) / HOST_CHAR_BIT,
- 0, "long", NULL);
+ int_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
+ 0, "int");
+ uint_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
+ 1, "unsigned int");
+ long_type = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
+ 0, "long");
void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void);
/* sival_t */
- sigval_type = init_composite_type (NULL, TYPE_CODE_UNION);
+ sigval_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
TYPE_NAME (sigval_type) = xstrdup ("sigval_t");
append_composite_type_field (sigval_type, "sival_int", int_type);
append_composite_type_field (sigval_type, "sival_ptr", void_ptr_type);
/* __pid_t */
- pid_type = init_type (TYPE_CODE_TYPEDEF, TYPE_LENGTH (int_type),
- TYPE_FLAG_TARGET_STUB, NULL, NULL);
- TYPE_NAME (pid_type) = xstrdup ("__pid_t");
+ pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (int_type),
+ xstrdup ("__pid_t"));
TYPE_TARGET_TYPE (pid_type) = int_type;
+ TYPE_TARGET_STUB (pid_type) = 1;
/* __uid_t */
- uid_type = init_type (TYPE_CODE_TYPEDEF, TYPE_LENGTH (uint_type),
- TYPE_FLAG_TARGET_STUB, NULL, NULL);
- TYPE_NAME (uid_type) = xstrdup ("__uid_t");
+ uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (uint_type),
+ xstrdup ("__uid_t"));
TYPE_TARGET_TYPE (uid_type) = uint_type;
+ TYPE_TARGET_STUB (uid_type) = 1;
/* __clock_t */
- clock_type = init_type (TYPE_CODE_TYPEDEF, TYPE_LENGTH (long_type),
- TYPE_FLAG_TARGET_STUB, NULL, NULL);
- TYPE_NAME (clock_type) = xstrdup ("__clock_t");
+ clock_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (long_type),
+ xstrdup ("__clock_t"));
TYPE_TARGET_TYPE (clock_type) = long_type;
+ TYPE_TARGET_STUB (clock_type) = 1;
/* _sifields */
- sifields_type = init_composite_type (NULL, TYPE_CODE_UNION);
+ sifields_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
{
const int si_max_size = 128;
@@ -86,27 +83,27 @@ linux_get_siginfo_type (struct gdbarch *gdbarch)
}
/* _kill */
- type = init_composite_type (NULL, TYPE_CODE_STRUCT);
+ type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
append_composite_type_field (type, "si_pid", pid_type);
append_composite_type_field (type, "si_uid", uid_type);
append_composite_type_field (sifields_type, "_kill", type);
/* _timer */
- type = init_composite_type (NULL, TYPE_CODE_STRUCT);
+ type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
append_composite_type_field (type, "si_tid", int_type);
append_composite_type_field (type, "si_overrun", int_type);
append_composite_type_field (type, "si_sigval", sigval_type);
append_composite_type_field (sifields_type, "_timer", type);
/* _rt */
- type = init_composite_type (NULL, TYPE_CODE_STRUCT);
+ type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
append_composite_type_field (type, "si_pid", pid_type);
append_composite_type_field (type, "si_uid", uid_type);
append_composite_type_field (type, "si_sigval", sigval_type);
append_composite_type_field (sifields_type, "_rt", type);
/* _sigchld */
- type = init_composite_type (NULL, TYPE_CODE_STRUCT);
+ type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
append_composite_type_field (type, "si_pid", pid_type);
append_composite_type_field (type, "si_uid", uid_type);
append_composite_type_field (type, "si_status", int_type);
@@ -115,18 +112,18 @@ linux_get_siginfo_type (struct gdbarch *gdbarch)
append_composite_type_field (sifields_type, "_sigchld", type);
/* _sigfault */
- type = init_composite_type (NULL, TYPE_CODE_STRUCT);
+ type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
append_composite_type_field (type, "si_addr", void_ptr_type);
append_composite_type_field (sifields_type, "_sigfault", type);
/* _sigpoll */
- type = init_composite_type (NULL, TYPE_CODE_STRUCT);
+ type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
append_composite_type_field (type, "si_band", long_type);
append_composite_type_field (type, "si_fd", int_type);
append_composite_type_field (sifields_type, "_sigpoll", type);
/* struct siginfo */
- siginfo_type = init_composite_type (NULL, TYPE_CODE_STRUCT);
+ siginfo_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
TYPE_NAME (siginfo_type) = xstrdup ("siginfo");
append_composite_type_field (siginfo_type, "si_signo", int_type);
append_composite_type_field (siginfo_type, "si_errno", int_type);