* [10/15] Basic value access routines
@ 2009-06-09 15:20 Ulrich Weigand
2009-06-15 16:35 ` Doug Evans
0 siblings, 1 reply; 19+ messages in thread
From: Ulrich Weigand @ 2009-06-09 15:20 UTC (permalink / raw)
To: gdb-patches
Hello,
a number of core data conversion routines deeply buried in the
call chain implicitly use current_gdbarch to determine the format
of the data (address/pointer conversion, floating point formats).
This patch adds an explicit gdbarch argument to the following
routines to eliminate that use, and updates all call sites:
- unpack_long/unpack_double/unpack_pointer/pack_long
- extract_typed_address/store_typed_address/read_memory_typed_address
- extract_typed_floating/store_typed_floating/convert_typed_floating
- floatformat_from_type
Bye,
Ulrich
ChangeLog:
* value.h (unpack_long): Add GDBARCH parameter.
(unpack_double): Likewise.
(unpack_pointer): Likewise.
(pack_long): Likewise.
* value.c (unpack_long): Add GDBARCH parameter. Pass architecture
to extract_typed_floating, extract_typed_address and recursive call.
(unpack_double): Add GDBARCH parameter. Pass architecture to
unpack_long, extract_typed_floating and floatformat_from_type.
(unpack_pointer): Add GDBARCH parameter. Pass architecture to
unpack_long.
(pack_long): Add GDBARCH parameter. Pass architecture to
store_typed_address.
* defs.h (extract_typed_address): Add GDBARCH parameter.
(store_typed_address): Likewise.
* findvar.c (extract_typed_address): Add GDBARCH parameter.
Use it instead of current_gdbarch.
(store_typed_address): Likewise.
* gdbcore.h (read_memory_typed_address): Add GDBARCH parameter.
* corefile.c (read_memory_typed_address): Add GDBARCH parameter.
Pass architecture to extract_typed_address.
* doublest.h (floatformat_from_type): Add GDBARCH parameter.
(extract_typed_floating): Likewise.
(store_typed_floating): Likewise.
(convert_typed_floating): Likewise.
* doublest.c (floatformat_from_length): Add GDBARCH parameter.
Use it instead of current_gdbarch.
(floatformat_from_type): Likewise. Also, pass architecture to
floatformat_from_length.
(extract_typed_floating): Add GDBARCH parameter, pass architecture
to floatformat_from_type.
(store_typed_floating): Likewise.
(convert_typed_floating): Likewise.
* c-lang.c (emit_numeric_character): Add GDBARCH parameter.
(convert_octal, convert_hex, convert_escape, parse_one_string):
Likewise. Pass architecture to subroutines.
(evaluate_subexp_c): Pass architecture to parse_one_string.
(c_emit_char): Call store_signed_integer instead of pack_long.
Update calls to unpack_pointer, unpack_long, unpack_double, pack_long,
extract_typed_address, store_typed_address, read_memory_typed_address,
floatformat_from_type, extract_typed_floating, store_typed_floating,
and convert_typed_floating to pass in an appropriate architecture:
* ada-lang.c (ada_value_struct_elt): Update.
* ada-tasks.c (read_known_tasks_array): Update.
* ada-valprint.c (ada_val_print_1): Update.
* alpha-tdep.c (alpha_store_return_value): Update.
* amd64-tdep.c (amd64_get_longjmp_target): Update.
* arm-tdep.c (arm_extract_return_value): Update.
(arm_store_return_value): Update.
* c-lang.c (emit_numeric_character, evaluate_subexp_c): Update.
* c-valprint.c (c_val_print): Update.
* dwarf2-frame.c (read_reg): Update.
* findvar.c (read_var_value): Update.
* frame-unwind.c (frame_unwind_got_address): Update.
* f-valprint.c (f_val_print): Update.
* gnu-v2-abi.c (gnuv2_baseclass_offset): Update.
* gnu-v3-abi.c (gnuv3_decode_method_ptr): Update.
* hppa-tdep.c (hppa32_push_dummy_call, hppa64_push_dummy_call,
hppa32_convert_from_func_ptr_addr, hppa_skip_trampoline_code): Update.
* i386-tdep.c (i386_unwind_pc, i386_extract_return_value,
i386_store_return_value): Update.
* i387-tdep.c (i387_register_to_value, i387_value_to_register): Update.
* ia64-tdep.c (ia64_register_to_value, ia64_value_to_register,
ia64_extract_return_value, ia64_store_return_value): Update.
* jv-valprint.c (java_value_print): Update.
* m2-valprint.c (m2_print_unbounded_array, print_variable_at_address,
m2_val_print): Update.
* m68k-tdep.c (m68k_register_to_value, m68k_value_to_register,
m68k_svr4_extract_return_value, m68k_svr4_store_return_value,
m68k_unwind_pc): Update.
* mips-tdep.c (mips_print_fp_register): Update.
* nto-tdep.c (LM_ADDR): Update.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
ppc64_sysv_abi_return_value): Update.
* printcmd.c (print_scalar_formatted, printf_command): Update.
* p-valprint.c (pascal_val_print): Update.
* rs6000-aix-tdep.c (rs6000_return_value): Update.
* rs6000-tdep.c (rs6000_register_to_value,
rs6000_value_to_register): Update.
* sh64-tdep.c (sh64_extract_return_value,
sh64_register_convert_to_virtual, sh64_register_convert_to_raw,
sh64_do_fp_register): Update.
* solib-darwin.c (darwin_load_image_infos, darwin_current_sos):
Update.
* solib-svr4.c (LM_ADDR_FROM_LINK_MAP, LM_DYNAMIC_FROM_LINK_MAP,
LM_NEXT, LM_NAME, IGNORE_FIRST_LINK_MAP_ENTRY, scan_dyntag,
elf_locate_base, solib_svr4_r_map, solib_svr4_r_brk,
solib_svr4_r_ldsomap, open_symbol_file_object): Update.
* spu-tdep.c (spu_integer_to_address): Update.
* stabsread.c (define_symbol): Update.
* valarith.c (value_concat): Update.
* valprint.c (val_print_type_code_int, val_print_type_code_flags,
print_floating): Update.
* value.c (value_as_long, value_as_double, value_as_address,
value_from_longest, value_from_pointer, value_from_double,
coerce_ref): Update.
* xtensa-tdep.c (xtensa_unwind_pc): Update.
* i387-tdep.c (print_i387_value): Add GDBARCH parameter, pass
architecture to extract_typed_floating.
(print_i387_ext): Add GDBARCH parameter, pass to print_i387_value.
(i387_print_float_info): Pass architecture to print_i387_ext.
* sh-tdep.c (sh_register_convert_to_virtual): Add GDBARCH parameter,
pass architecture to store_typed_floating.
(sh_register_convert_to_raw): Add GDBARCH parameter, pass architecture
to extract_typed_floating.
(sh_pseudo_register_read): Pass architecture to
sh_register_convert_to_virtual.
(sh_pseudo_register_write): Pass architecture to
sh_register_convert_to_raw.
* scm-lang.h (scm_unpack): Add GDBARCH parameter.
* scm-lang.c (scm_unpack): Add GDBARCH paramter, pass architecture
to unpack_long.
doc/ChangeLog:
* gdbint.texinfo (Pointers Are Not Always Addresses): Update
signature of extract_typed_address and store_typed_address.
Index: gdb-head/gdb/ada-lang.c
===================================================================
--- gdb-head.orig/gdb/ada-lang.c
+++ gdb-head/gdb/ada-lang.c
@@ -6155,7 +6155,7 @@ ada_value_struct_elt (struct value *arg,
if (TYPE_CODE (t) == TYPE_CODE_PTR)
address = value_as_address (arg);
else
- address = unpack_pointer (t, value_contents (arg));
+ address = unpack_pointer (t, value_arch (arg), value_contents (arg));
t1 = ada_to_fixed_type (ada_get_base_type (t1), value_arch (arg),
NULL, address, NULL, 1);
Index: gdb-head/gdb/ada-tasks.c
===================================================================
--- gdb-head.orig/gdb/ada-tasks.c
+++ gdb-head/gdb/ada-tasks.c
@@ -638,7 +638,7 @@ read_known_tasks_array (void)
builtin_type (target_gdbarch)->builtin_data_ptr;
CORE_ADDR task_id =
extract_typed_address (known_tasks + i * target_ptr_byte,
- data_ptr_type);
+ data_ptr_type, target_gdbarch);
if (task_id != 0)
add_ada_task (task_id);
Index: gdb-head/gdb/ada-valprint.c
===================================================================
--- gdb-head.orig/gdb/ada-valprint.c
+++ gdb-head/gdb/ada-valprint.c
@@ -736,7 +736,7 @@ ada_val_print_1 (struct type *type, stru
case TYPE_CODE_RANGE:
if (ada_is_fixed_point_type (type))
{
- LONGEST v = unpack_long (type, valaddr);
+ LONGEST v = unpack_long (type, gdbarch, valaddr);
int len = TYPE_LENGTH (type);
fprintf_filtered (stream, len < 4 ? "%.11g" : "%.17g",
@@ -803,7 +803,7 @@ ada_val_print_1 (struct type *type, stru
type_print (type, "", stream, -1);
fprintf_filtered (stream, ") ");
fputs_filtered (paddress (extract_typed_address
- (valaddr, ptr_type)),
+ (valaddr, ptr_type, gdbarch)),
stream);
}
else
@@ -812,7 +812,8 @@ ada_val_print_1 (struct type *type, stru
if (ada_is_character_type (type))
{
fputs_filtered (" ", stream);
- ada_printchar ((unsigned char) unpack_long (type, valaddr),
+ ada_printchar ((unsigned char)
+ unpack_long (type, gdbarch, valaddr),
type, stream);
}
}
@@ -827,7 +828,7 @@ ada_val_print_1 (struct type *type, stru
break;
}
len = TYPE_NFIELDS (type);
- val = unpack_long (type, valaddr);
+ val = unpack_long (type, gdbarch, valaddr);
for (i = 0; i < len; i++)
{
QUIT;
@@ -892,7 +893,8 @@ ada_val_print_1 (struct type *type, stru
if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
{
- LONGEST deref_val_int = (LONGEST) unpack_pointer (type, valaddr);
+ LONGEST deref_val_int
+ = (LONGEST) unpack_pointer (type, gdbarch, valaddr);
if (deref_val_int != 0)
{
struct value *deref_val =
Index: gdb-head/gdb/alpha-tdep.c
===================================================================
--- gdb-head.orig/gdb/alpha-tdep.c
+++ gdb-head/gdb/alpha-tdep.c
@@ -498,6 +498,7 @@ static void
alpha_store_return_value (struct type *valtype, struct regcache *regcache,
const gdb_byte *valbuf)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
int length = TYPE_LENGTH (valtype);
gdb_byte raw_buffer[ALPHA_REGISTER_SIZE];
ULONGEST l;
@@ -557,7 +558,7 @@ alpha_store_return_value (struct type *v
even if the base data type is unsigned. */
if (length == 4)
valtype = builtin_type_int32;
- l = unpack_long (valtype, valbuf);
+ l = unpack_long (valtype, gdbarch, valbuf);
regcache_cooked_write_unsigned (regcache, ALPHA_V0_REGNUM, l);
break;
}
Index: gdb-head/gdb/amd64-tdep.c
===================================================================
--- gdb-head.orig/gdb/amd64-tdep.c
+++ gdb-head/gdb/amd64-tdep.c
@@ -1966,11 +1966,12 @@ amd64_get_longjmp_target (struct frame_i
get_frame_register (frame, AMD64_RDI_REGNUM, buf);
jb_addr= extract_typed_address
- (buf, builtin_type (gdbarch)->builtin_data_ptr);
+ (buf, builtin_type (gdbarch)->builtin_data_ptr, gdbarch);
if (target_read_memory (jb_addr + jb_pc_offset, buf, len))
return 0;
- *pc = extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
+ *pc = extract_typed_address
+ (buf, builtin_type (gdbarch)->builtin_func_ptr, gdbarch);
return 1;
}
Index: gdb-head/gdb/arm-tdep.c
===================================================================
--- gdb-head.orig/gdb/arm-tdep.c
+++ gdb-head/gdb/arm-tdep.c
@@ -2308,8 +2308,9 @@ arm_extract_return_value (struct type *t
bfd_byte tmpbuf[FP_REGISTER_SIZE];
regcache_cooked_read (regs, ARM_F0_REGNUM, tmpbuf);
- convert_from_extended (floatformat_from_type (type), tmpbuf,
- valbuf, gdbarch_byte_order (gdbarch));
+ convert_from_extended (floatformat_from_type (type, gdbarch),
+ tmpbuf, valbuf,
+ gdbarch_byte_order (gdbarch));
}
break;
@@ -2493,8 +2494,8 @@ arm_store_return_value (struct type *typ
{
case ARM_FLOAT_FPA:
- convert_to_extended (floatformat_from_type (type), buf, valbuf,
- gdbarch_byte_order (gdbarch));
+ convert_to_extended (floatformat_from_type (type, gdbarch),
+ buf, valbuf, gdbarch_byte_order (gdbarch));
regcache_cooked_write (regs, ARM_F0_REGNUM, buf);
break;
@@ -2525,7 +2526,7 @@ arm_store_return_value (struct type *typ
/* Values of one word or less are zero/sign-extended and
returned in r0. */
bfd_byte tmpbuf[INT_REGISTER_SIZE];
- LONGEST val = unpack_long (type, valbuf);
+ LONGEST val = unpack_long (type, gdbarch, valbuf);
store_signed_integer (tmpbuf, INT_REGISTER_SIZE, val);
regcache_cooked_write (regs, ARM_A1_REGNUM, tmpbuf);
Index: gdb-head/gdb/bsd-uthread.c
===================================================================
--- gdb-head.orig/gdb/bsd-uthread.c
+++ gdb-head/gdb/bsd-uthread.c
@@ -149,7 +149,7 @@ static CORE_ADDR
bsd_uthread_read_memory_address (CORE_ADDR addr)
{
struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
- return read_memory_typed_address (addr, ptr_type);
+ return read_memory_typed_address (addr, ptr_type, target_gdbarch);
}
/* If OBJFILE contains the symbols corresponding to one of the
Index: gdb-head/gdb/corefile.c
===================================================================
--- gdb-head.orig/gdb/corefile.c
+++ gdb-head/gdb/corefile.c
@@ -334,11 +334,12 @@ read_memory_string (CORE_ADDR memaddr, c
}
CORE_ADDR
-read_memory_typed_address (CORE_ADDR addr, struct type *type)
+read_memory_typed_address (CORE_ADDR addr,
+ struct type *type, struct gdbarch *gdbarch)
{
gdb_byte *buf = alloca (TYPE_LENGTH (type));
read_memory (addr, buf, TYPE_LENGTH (type));
- return extract_typed_address (buf, type);
+ return extract_typed_address (buf, type, gdbarch);
}
/* Same as target_write_memory, but report an error if can't write. */
Index: gdb-head/gdb/c-valprint.c
===================================================================
--- gdb-head.orig/gdb/c-valprint.c
+++ gdb-head/gdb/c-valprint.c
@@ -236,7 +236,7 @@ c_val_print (struct type *type, struct g
/* Print vtable entry - we only get here if we ARE using
-fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */
CORE_ADDR addr
- = extract_typed_address (valaddr + embedded_offset, type);
+ = extract_typed_address (valaddr + embedded_offset, type, gdbarch);
print_function_pointer_address (gdbarch, addr, stream,
options->addressprint);
break;
@@ -244,7 +244,7 @@ c_val_print (struct type *type, struct g
unresolved_elttype = TYPE_TARGET_TYPE (type);
elttype = check_typedef (unresolved_elttype);
{
- addr = unpack_pointer (type, valaddr + embedded_offset);
+ addr = unpack_pointer (type, gdbarch, valaddr + embedded_offset);
print_unpacked_pointer:
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
@@ -271,7 +271,8 @@ c_val_print (struct type *type, struct g
else if (cp_is_vtbl_member (type))
{
/* print vtbl's nicely */
- CORE_ADDR vt_address = unpack_pointer (type, valaddr + embedded_offset);
+ CORE_ADDR vt_address
+ = unpack_pointer (type, gdbarch, valaddr + embedded_offset);
struct minimal_symbol *msymbol =
lookup_minimal_symbol_by_pc (vt_address);
@@ -325,7 +326,7 @@ c_val_print (struct type *type, struct g
if (options->addressprint)
{
CORE_ADDR addr
- = extract_typed_address (valaddr + embedded_offset, type);
+ = extract_typed_address (valaddr + embedded_offset, type, gdbarch);
fprintf_filtered (stream, "@");
fputs_filtered (paddress (addr), stream);
if (options->deref_ref)
@@ -339,7 +340,7 @@ c_val_print (struct type *type, struct g
struct value *deref_val =
value_at
(TYPE_TARGET_TYPE (type), gdbarch,
- unpack_pointer (type, valaddr + embedded_offset));
+ unpack_pointer (type, gdbarch, valaddr + embedded_offset));
common_val_print (deref_val, stream, recurse, options,
current_language);
}
@@ -366,7 +367,7 @@ c_val_print (struct type *type, struct g
TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8);
struct type *field_type = TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET);
CORE_ADDR addr
- = extract_typed_address (valaddr + offset, field_type);
+ = extract_typed_address (valaddr + offset, field_type, gdbarch);
print_function_pointer_address (gdbarch, addr, stream,
options->addressprint);
@@ -384,7 +385,7 @@ c_val_print (struct type *type, struct g
break;
}
len = TYPE_NFIELDS (type);
- val = unpack_long (type, valaddr + embedded_offset);
+ val = unpack_long (type, gdbarch, valaddr + embedded_offset);
for (i = 0; i < len; i++)
{
QUIT;
@@ -440,7 +441,7 @@ c_val_print (struct type *type, struct g
}
else
{
- val = unpack_long (type, valaddr + embedded_offset);
+ val = unpack_long (type, gdbarch, valaddr + embedded_offset);
if (val == 0)
fputs_filtered ("false", stream);
else if (val == 1)
@@ -480,7 +481,9 @@ c_val_print (struct type *type, struct g
if (textual_element_type (unresolved_type, options->format))
{
fputs_filtered (" ", stream);
- LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr + embedded_offset),
+ LA_PRINT_CHAR ((unsigned char)
+ unpack_long (type, gdbarch,
+ valaddr + embedded_offset),
unresolved_type, stream);
}
}
@@ -497,7 +500,7 @@ c_val_print (struct type *type, struct g
}
else
{
- val = unpack_long (type, valaddr + embedded_offset);
+ val = unpack_long (type, gdbarch, valaddr + embedded_offset);
if (TYPE_UNSIGNED (type))
fprintf_filtered (stream, "%u", (unsigned int) val);
else
Index: gdb-head/gdb/defs.h
===================================================================
--- gdb-head.orig/gdb/defs.h
+++ gdb-head/gdb/defs.h
@@ -1054,15 +1054,15 @@ extern ULONGEST extract_unsigned_integer
extern int extract_long_unsigned_integer (const gdb_byte *, int, LONGEST *);
-extern CORE_ADDR extract_typed_address (const gdb_byte *buf,
- struct type *type);
+extern CORE_ADDR extract_typed_address (const gdb_byte *buf, struct type *type,
+ struct gdbarch *gdbarch);
extern void store_signed_integer (gdb_byte *, int, LONGEST);
extern void store_unsigned_integer (gdb_byte *, int, ULONGEST);
extern void store_typed_address (gdb_byte *buf, struct type *type,
- CORE_ADDR addr);
+ struct gdbarch *gdbarch, CORE_ADDR addr);
\f
/* From valops.c */
Index: gdb-head/gdb/doublest.c
===================================================================
--- gdb-head.orig/gdb/doublest.c
+++ gdb-head/gdb/doublest.c
@@ -761,27 +761,27 @@ floatformat_from_doublest (const struct
but not passed on by GDB. This should be fixed. */
static const struct floatformat *
-floatformat_from_length (int len)
+floatformat_from_length (int len, struct gdbarch *gdbarch)
{
const struct floatformat *format;
- if (len * TARGET_CHAR_BIT == gdbarch_float_bit (current_gdbarch))
- format = gdbarch_float_format (current_gdbarch)
- [gdbarch_byte_order (current_gdbarch)];
- else if (len * TARGET_CHAR_BIT == gdbarch_double_bit (current_gdbarch))
- format = gdbarch_double_format (current_gdbarch)
- [gdbarch_byte_order (current_gdbarch)];
- else if (len * TARGET_CHAR_BIT == gdbarch_long_double_bit (current_gdbarch))
- format = gdbarch_long_double_format (current_gdbarch)
- [gdbarch_byte_order (current_gdbarch)];
+ if (len * TARGET_CHAR_BIT == gdbarch_float_bit (gdbarch))
+ format = gdbarch_float_format (gdbarch)
+ [gdbarch_byte_order (gdbarch)];
+ else if (len * TARGET_CHAR_BIT == gdbarch_double_bit (gdbarch))
+ format = gdbarch_double_format (gdbarch)
+ [gdbarch_byte_order (gdbarch)];
+ else if (len * TARGET_CHAR_BIT == gdbarch_long_double_bit (gdbarch))
+ format = gdbarch_long_double_format (gdbarch)
+ [gdbarch_byte_order (gdbarch)];
/* On i386 the 'long double' type takes 96 bits,
while the real number of used bits is only 80,
both in processor and in memory.
The code below accepts the real bit size. */
- else if ((gdbarch_long_double_format (current_gdbarch) != NULL)
+ else if ((gdbarch_long_double_format (gdbarch) != NULL)
&& (len * TARGET_CHAR_BIT ==
- gdbarch_long_double_format (current_gdbarch)[0]->totalsize))
- format = gdbarch_long_double_format (current_gdbarch)
- [gdbarch_byte_order (current_gdbarch)];
+ gdbarch_long_double_format (gdbarch)[0]->totalsize))
+ format = gdbarch_long_double_format (gdbarch)
+ [gdbarch_byte_order (gdbarch)];
else
format = NULL;
if (format == NULL)
@@ -791,22 +791,24 @@ floatformat_from_length (int len)
}
const struct floatformat *
-floatformat_from_type (const struct type *type)
+floatformat_from_type (const struct type *type,
+ struct gdbarch *gdbarch)
{
gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
if (TYPE_FLOATFORMAT (type) != NULL)
- return TYPE_FLOATFORMAT (type)[gdbarch_byte_order (current_gdbarch)];
+ return TYPE_FLOATFORMAT (type)[gdbarch_byte_order (gdbarch)];
else
- return floatformat_from_length (TYPE_LENGTH (type));
+ return floatformat_from_length (TYPE_LENGTH (type), gdbarch);
}
/* Extract a floating-point number of type TYPE from a target-order
byte-stream at ADDR. Returns the value as type DOUBLEST. */
DOUBLEST
-extract_typed_floating (const void *addr, const struct type *type)
+extract_typed_floating (const void *addr, const struct type *type,
+ struct gdbarch *gdbarch)
{
- const struct floatformat *fmt = floatformat_from_type (type);
+ const struct floatformat *fmt = floatformat_from_type (type, gdbarch);
DOUBLEST retval;
floatformat_to_doublest (fmt, addr, &retval);
@@ -817,9 +819,10 @@ extract_typed_floating (const void *addr
byte-stream at ADDR. */
void
-store_typed_floating (void *addr, const struct type *type, DOUBLEST val)
+store_typed_floating (void *addr, const struct type *type,
+ struct gdbarch *gdbarch, DOUBLEST val)
{
- const struct floatformat *fmt = floatformat_from_type (type);
+ const struct floatformat *fmt = floatformat_from_type (type, gdbarch);
/* FIXME: kettenis/2001-10-28: It is debatable whether we should
zero out any remaining bytes in the target buffer when TYPE is
@@ -850,10 +853,13 @@ store_typed_floating (void *addr, const
void
convert_typed_floating (const void *from, const struct type *from_type,
- void *to, const struct type *to_type)
+ void *to, const struct type *to_type,
+ struct gdbarch *gdbarch)
{
- const struct floatformat *from_fmt = floatformat_from_type (from_type);
- const struct floatformat *to_fmt = floatformat_from_type (to_type);
+ const struct floatformat *from_fmt
+ = floatformat_from_type (from_type, gdbarch);
+ const struct floatformat *to_fmt
+ = floatformat_from_type (to_type, gdbarch);
if (from_fmt == NULL || to_fmt == NULL)
{
Index: gdb-head/gdb/doublest.h
===================================================================
--- gdb-head.orig/gdb/doublest.h
+++ gdb-head/gdb/doublest.h
@@ -89,14 +89,17 @@ extern const char *floatformat_mantissa
NULL. type_floatformat() detects that and returns a floatformat
based on the type size when FLOATFORMAT is NULL. */
-const struct floatformat *floatformat_from_type (const struct type *type);
+const struct floatformat *floatformat_from_type (const struct type *type,
+ struct gdbarch *gdbarch);
extern DOUBLEST extract_typed_floating (const void *addr,
- const struct type *type);
+ const struct type *type,
+ struct gdbarch *gdbarch);
extern void store_typed_floating (void *addr, const struct type *type,
- DOUBLEST val);
+ struct gdbarch *gdbarch, DOUBLEST val);
extern void convert_typed_floating (const void *from,
const struct type *from_type,
- void *to, const struct type *to_type);
+ void *to, const struct type *to_type,
+ struct gdbarch *gdbarch);
#endif
Index: gdb-head/gdb/dwarf2-frame.c
===================================================================
--- gdb-head.orig/gdb/dwarf2-frame.c
+++ gdb-head/gdb/dwarf2-frame.c
@@ -288,7 +288,7 @@ read_reg (void *baton, int reg)
under the covers, and this makes more sense for non-pointer
registers. Maybe read_reg and the associated interfaces should
deal with "struct value" instead of CORE_ADDR. */
- return unpack_long (register_type (gdbarch, regnum), buf);
+ return unpack_long (register_type (gdbarch, regnum), gdbarch, buf);
}
static void
Index: gdb-head/gdb/findvar.c
===================================================================
--- gdb-head.orig/gdb/findvar.c
+++ gdb-head/gdb/findvar.c
@@ -162,10 +162,11 @@ extract_long_unsigned_integer (const gdb
}
-/* Treat the bytes at BUF as a pointer of type TYPE, and return the
- address it represents. */
+/* Treat the bytes at BUF as a pointer of type TYPE in target format
+ of architecture GDBARCH, and return the address it represents. */
CORE_ADDR
-extract_typed_address (const gdb_byte *buf, struct type *type)
+extract_typed_address (const gdb_byte *buf,
+ struct type *type, struct gdbarch *gdbarch)
{
if (TYPE_CODE (type) != TYPE_CODE_PTR
&& TYPE_CODE (type) != TYPE_CODE_REF)
@@ -173,7 +174,7 @@ extract_typed_address (const gdb_byte *b
_("extract_typed_address: "
"type is not a pointer or reference"));
- return gdbarch_pointer_to_address (current_gdbarch, type, buf);
+ return gdbarch_pointer_to_address (gdbarch, type, buf);
}
@@ -231,10 +232,11 @@ store_unsigned_integer (gdb_byte *addr,
}
}
-/* Store the address ADDR as a pointer of type TYPE at BUF, in target
- form. */
+/* Store the address ADDR as a pointer of type TYPE at BUF,
+ in target format of architecture GDBARCH. */
void
-store_typed_address (gdb_byte *buf, struct type *type, CORE_ADDR addr)
+store_typed_address (gdb_byte *buf, struct type *type,
+ struct gdbarch *gdbarch, CORE_ADDR addr)
{
if (TYPE_CODE (type) != TYPE_CODE_PTR
&& TYPE_CODE (type) != TYPE_CODE_REF)
@@ -242,7 +244,7 @@ store_typed_address (gdb_byte *buf, stru
_("store_typed_address: "
"type is not a pointer or reference"));
- gdbarch_address_to_pointer (current_gdbarch, type, buf, addr);
+ gdbarch_address_to_pointer (gdbarch, type, buf, addr);
}
@@ -427,10 +429,10 @@ read_var_value (struct symbol *var, stru
CORE_ADDR addr
= symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
SYMBOL_OBJ_SECTION (var));
- store_typed_address (value_contents_raw (v), type, addr);
+ store_typed_address (value_contents_raw (v), type, gdbarch, addr);
}
else
- store_typed_address (value_contents_raw (v), type,
+ store_typed_address (value_contents_raw (v), type, gdbarch,
SYMBOL_VALUE_ADDRESS (var));
VALUE_LVAL (v) = not_lval;
return v;
Index: gdb-head/gdb/frame-unwind.c
===================================================================
--- gdb-head.orig/gdb/frame-unwind.c
+++ gdb-head/gdb/frame-unwind.c
@@ -194,7 +194,7 @@ frame_unwind_got_address (struct frame_i
reg_val = value_zero (register_type (gdbarch, regnum), gdbarch, not_lval);
pack_long (value_contents_writeable (reg_val),
- register_type (gdbarch, regnum), addr);
+ register_type (gdbarch, regnum), gdbarch, addr);
return reg_val;
}
Index: gdb-head/gdb/f-valprint.c
===================================================================
--- gdb-head.orig/gdb/f-valprint.c
+++ gdb-head/gdb/f-valprint.c
@@ -278,7 +278,7 @@ f_val_print (struct type *type, struct g
}
else
{
- addr = unpack_pointer (type, valaddr);
+ addr = unpack_pointer (type, gdbarch, valaddr);
elttype = check_typedef (TYPE_TARGET_TYPE (type));
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
@@ -313,7 +313,7 @@ f_val_print (struct type *type, struct g
if (options->addressprint)
{
CORE_ADDR addr
- = extract_typed_address (valaddr + embedded_offset, type);
+ = extract_typed_address (valaddr + embedded_offset, type, gdbarch);
fprintf_filtered (stream, "@");
fputs_filtered (paddress (addr), stream);
if (options->deref_ref)
@@ -327,7 +327,7 @@ f_val_print (struct type *type, struct g
struct value *deref_val =
value_at
(TYPE_TARGET_TYPE (type), gdbarch,
- unpack_pointer (type, valaddr + embedded_offset));
+ unpack_pointer (type, gdbarch, valaddr + embedded_offset));
common_val_print (deref_val, stream, recurse,
options, current_language);
}
@@ -369,7 +369,8 @@ f_val_print (struct type *type, struct g
if (TYPE_LENGTH (type) == 1)
{
fputs_filtered (" ", stream);
- LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr),
+ LA_PRINT_CHAR ((unsigned char)
+ unpack_long (type, gdbarch, valaddr),
type, stream);
}
}
Index: gdb-head/gdb/gdbcore.h
===================================================================
--- gdb-head.orig/gdb/gdbcore.h
+++ gdb-head/gdb/gdbcore.h
@@ -63,10 +63,11 @@ extern ULONGEST read_memory_unsigned_int
extern void read_memory_string (CORE_ADDR, char *, int);
-/* Read the pointer of type TYPE at ADDR, and return the address it
- represents. */
+/* Read the pointer of type TYPE at ADDR in target format of architecture
+ GDBARCH, and return the address it represents. */
-CORE_ADDR read_memory_typed_address (CORE_ADDR addr, struct type *type);
+CORE_ADDR read_memory_typed_address (CORE_ADDR addr, struct type *type,
+ struct gdbarch *gdbarch);
/* This takes a char *, not void *. This is probably right, because
passing in an int * or whatever is wrong with respect to
Index: gdb-head/gdb/gnu-v2-abi.c
===================================================================
--- gdb-head.orig/gdb/gnu-v2-abi.c
+++ gdb-head/gdb/gnu-v2-abi.c
@@ -366,7 +366,7 @@ gnuv2_baseclass_offset (struct type *typ
if (vb_match (type, i, basetype))
{
CORE_ADDR addr
- = unpack_pointer (TYPE_FIELD_TYPE (type, i),
+ = unpack_pointer (TYPE_FIELD_TYPE (type, i), gdbarch,
valaddr + (TYPE_FIELD_BITPOS (type, i) / 8));
return addr - (LONGEST) address;
Index: gdb-head/gdb/gnu-v3-abi.c
===================================================================
--- gdb-head.orig/gdb/gnu-v3-abi.c
+++ gdb-head/gdb/gnu-v3-abi.c
@@ -525,7 +525,7 @@ gnuv3_decode_method_ptr (struct gdbarch
vtable offsets we must handle as integers. At this point, we do not
yet know which case we have, so we extract the value under both
interpretations and choose the right one later on. */
- ptr_value = extract_typed_address (contents, funcptr_type);
+ ptr_value = extract_typed_address (contents, funcptr_type, gdbarch);
voffset = extract_signed_integer (contents, TYPE_LENGTH (funcptr_type));
contents += TYPE_LENGTH (funcptr_type);
adjustment = extract_signed_integer (contents, TYPE_LENGTH (offset_type));
Index: gdb-head/gdb/hppa-tdep.c
===================================================================
--- gdb-head.orig/gdb/hppa-tdep.c
+++ gdb-head/gdb/hppa-tdep.c
@@ -746,7 +746,7 @@ hppa32_push_dummy_call (struct gdbarch *
takes care of any sign-extension problems. */
param_len = align_up (TYPE_LENGTH (type), 4);
store_unsigned_integer (param_val, param_len,
- unpack_long (type,
+ unpack_long (type, value_arch (arg),
value_contents (arg)));
}
else if (TYPE_CODE (type) == TYPE_CODE_FLT)
@@ -1043,7 +1043,7 @@ hppa64_push_dummy_call (struct gdbarch *
{
ULONGEST codeptr, fptr;
- codeptr = unpack_long (type, value_contents (arg));
+ codeptr = unpack_long (type, value_arch (arg), value_contents (arg));
fptr = hppa64_convert_code_addr_to_fptr (codeptr);
store_unsigned_integer (fptrbuf, TYPE_LENGTH (type), fptr);
valbuf = fptrbuf;
@@ -1248,7 +1248,7 @@ hppa32_convert_from_func_ptr_addr (struc
{
struct type *func_ptr_type = builtin_type (gdbarch)->builtin_func_ptr;
CORE_ADDR plabel = addr & ~3;
- return read_memory_typed_address (plabel, func_ptr_type);
+ return read_memory_typed_address (plabel, func_ptr_type, gdbarch);
}
return addr;
@@ -2913,7 +2913,7 @@ hppa_skip_trampoline_code (struct frame_
/* PLABELs have bit 30 set; if it's a PLABEL, then dereference it. */
if (pc & 0x2)
- pc = read_memory_typed_address (pc & ~0x3, func_ptr_type);
+ pc = read_memory_typed_address (pc & ~0x3, func_ptr_type, gdbarch);
return pc;
}
@@ -2934,7 +2934,7 @@ hppa_skip_trampoline_code (struct frame_
if (in_plt_section (pc, NULL))
{
- pc = read_memory_typed_address (pc, func_ptr_type);
+ pc = read_memory_typed_address (pc, func_ptr_type, gdbarch);
/* If the PLT slot has not yet been resolved, the target will be
the PLT stub. */
@@ -2948,7 +2948,7 @@ hppa_skip_trampoline_code (struct frame_
}
/* This should point to the fixup routine. */
- pc = read_memory_typed_address (pc + 8, func_ptr_type);
+ pc = read_memory_typed_address (pc + 8, func_ptr_type, gdbarch);
}
}
Index: gdb-head/gdb/i386-tdep.c
===================================================================
--- gdb-head.orig/gdb/i386-tdep.c
+++ gdb-head/gdb/i386-tdep.c
@@ -1311,7 +1311,8 @@ i386_unwind_pc (struct gdbarch *gdbarch,
gdb_byte buf[8];
frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
- return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
+ return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr,
+ gdbarch);
}
\f
@@ -1787,7 +1788,8 @@ i386_extract_return_value (struct gdbarc
exactly how it would happen on the target itself, but it is
the best we can do. */
regcache_raw_read (regcache, I386_ST0_REGNUM, buf);
- convert_typed_floating (buf, builtin_type_i387_ext, valbuf, type);
+ convert_typed_floating (buf, builtin_type_i387_ext,
+ valbuf, type, gdbarch);
}
else
{
@@ -1841,7 +1843,8 @@ i386_store_return_value (struct gdbarch
floating-point format used by the FPU. This is probably
not exactly how it would happen on the target itself, but
it is the best we can do. */
- convert_typed_floating (valbuf, type, buf, builtin_type_i387_ext);
+ convert_typed_floating (valbuf, type,
+ buf, builtin_type_i387_ext, gdbarch);
regcache_raw_write (regcache, I386_ST0_REGNUM, buf);
/* Set the top of the floating-point register stack to 7. The
Index: gdb-head/gdb/i387-tdep.c
===================================================================
--- gdb-head.orig/gdb/i387-tdep.c
+++ gdb-head/gdb/i387-tdep.c
@@ -37,7 +37,8 @@
/* Print the floating point number specified by RAW. */
static void
-print_i387_value (const gdb_byte *raw, struct ui_file *file)
+print_i387_value (struct gdbarch *gdbarch,
+ const gdb_byte *raw, struct ui_file *file)
{
DOUBLEST value;
@@ -45,7 +46,7 @@ print_i387_value (const gdb_byte *raw, s
of certain numbers such as NaNs, even if GDB is running natively.
This is fine since our caller already detects such special
numbers and we print the hexadecimal representation anyway. */
- value = extract_typed_floating (raw, builtin_type_i387_ext);
+ value = extract_typed_floating (raw, builtin_type_i387_ext, gdbarch);
/* We try to print 19 digits. The last digit may or may not contain
garbage, but we'd better print one too many. We need enough room
@@ -61,7 +62,8 @@ print_i387_value (const gdb_byte *raw, s
/* Print the classification for the register contents RAW. */
static void
-print_i387_ext (const gdb_byte *raw, struct ui_file *file)
+print_i387_ext (struct gdbarch *gdbarch,
+ const gdb_byte *raw, struct ui_file *file)
{
int sign;
int integer;
@@ -92,11 +94,11 @@ print_i387_ext (const gdb_byte *raw, str
}
else if (exponent < 0x7fff && exponent > 0x0000 && integer)
/* Normal. */
- print_i387_value (raw, file);
+ print_i387_value (gdbarch, raw, file);
else if (exponent == 0x0000)
{
/* Denormal or zero. */
- print_i387_value (raw, file);
+ print_i387_value (gdbarch, raw, file);
if (integer)
/* Pseudo-denormal. */
@@ -258,7 +260,7 @@ i387_print_float_info (struct gdbarch *g
fprintf_filtered (file, "%02x", raw[i]);
if (tag != 3)
- print_i387_ext (raw, file);
+ print_i387_ext (gdbarch, raw, file);
fputs_filtered ("\n", file);
}
@@ -306,9 +308,10 @@ void
i387_register_to_value (struct frame_info *frame, int regnum,
struct type *type, gdb_byte *to)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte from[I386_MAX_REGISTER_SIZE];
- gdb_assert (i386_fp_regnum_p (get_frame_arch (frame), regnum));
+ gdb_assert (i386_fp_regnum_p (gdbarch, regnum));
/* We only support floating-point values. */
if (TYPE_CODE (type) != TYPE_CODE_FLT)
@@ -320,7 +323,7 @@ i387_register_to_value (struct frame_inf
/* Convert to TYPE. */
get_frame_register (frame, regnum, from);
- convert_typed_floating (from, builtin_type_i387_ext, to, type);
+ convert_typed_floating (from, builtin_type_i387_ext, to, type, gdbarch);
}
/* Write the contents FROM of a value of type TYPE into register
@@ -330,9 +333,10 @@ void
i387_value_to_register (struct frame_info *frame, int regnum,
struct type *type, const gdb_byte *from)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte to[I386_MAX_REGISTER_SIZE];
- gdb_assert (i386_fp_regnum_p (get_frame_arch (frame), regnum));
+ gdb_assert (i386_fp_regnum_p (gdbarch, regnum));
/* We only support floating-point values. */
if (TYPE_CODE (type) != TYPE_CODE_FLT)
@@ -343,7 +347,7 @@ i387_value_to_register (struct frame_inf
}
/* Convert from TYPE. */
- convert_typed_floating (from, type, to, builtin_type_i387_ext);
+ convert_typed_floating (from, type, to, builtin_type_i387_ext, gdbarch);
put_frame_register (frame, regnum, to);
}
\f
Index: gdb-head/gdb/ia64-tdep.c
===================================================================
--- gdb-head.orig/gdb/ia64-tdep.c
+++ gdb-head/gdb/ia64-tdep.c
@@ -1055,17 +1055,19 @@ static void
ia64_register_to_value (struct frame_info *frame, int regnum,
struct type *valtype, gdb_byte *out)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
char in[MAX_REGISTER_SIZE];
frame_register_read (frame, regnum, in);
- convert_typed_floating (in, builtin_type_ia64_ext, out, valtype);
+ convert_typed_floating (in, builtin_type_ia64_ext, out, valtype, gdbarch);
}
static void
ia64_value_to_register (struct frame_info *frame, int regnum,
struct type *valtype, const gdb_byte *in)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
char out[MAX_REGISTER_SIZE];
- convert_typed_floating (in, valtype, out, builtin_type_ia64_ext);
+ convert_typed_floating (in, valtype, out, builtin_type_ia64_ext, gdbarch);
put_frame_register (frame, regnum, out);
}
@@ -2985,6 +2987,7 @@ static void
ia64_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte *valbuf)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct type *float_elt_type;
float_elt_type = is_float_or_hfa_type (type);
@@ -2999,7 +3002,8 @@ ia64_extract_return_value (struct type *
{
regcache_cooked_read (regcache, regnum, from);
convert_typed_floating (from, builtin_type_ia64_ext,
- (char *)valbuf + offset, float_elt_type);
+ (char *)valbuf + offset, float_elt_type,
+ gdbarch);
offset += TYPE_LENGTH (float_elt_type);
regnum++;
}
@@ -3035,6 +3039,7 @@ static void
ia64_store_return_value (struct type *type, struct regcache *regcache,
const gdb_byte *valbuf)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct type *float_elt_type;
float_elt_type = is_float_or_hfa_type (type);
@@ -3048,7 +3053,7 @@ ia64_store_return_value (struct type *ty
while (n-- > 0)
{
convert_typed_floating ((char *)valbuf + offset, float_elt_type,
- to, builtin_type_ia64_ext);
+ to, builtin_type_ia64_ext, gdbarch);
regcache_cooked_write (regcache, regnum, to);
offset += TYPE_LENGTH (float_elt_type);
regnum++;
@@ -3520,7 +3525,7 @@ ia64_push_dummy_call (struct gdbarch *gd
{
char to[MAX_REGISTER_SIZE];
convert_typed_floating (value_contents (arg) + argoffset, float_elt_type,
- to, builtin_type_ia64_ext);
+ to, builtin_type_ia64_ext, gdbarch);
regcache_cooked_write (regcache, floatreg, (void *)to);
floatreg++;
argoffset += TYPE_LENGTH (float_elt_type);
Index: gdb-head/gdb/jv-valprint.c
===================================================================
--- gdb-head.orig/gdb/jv-valprint.c
+++ gdb-head/gdb/jv-valprint.c
@@ -54,7 +54,7 @@ java_value_print (struct value *val, str
/* Get the run-time type, and cast the object into that */
- obj_addr = unpack_pointer (type, value_contents (val));
+ obj_addr = unpack_pointer (type, gdbarch, value_contents (val));
if (obj_addr != 0)
{
@@ -486,7 +486,7 @@ java_val_print (struct type *type, struc
break;
}
#endif
- addr = unpack_pointer (type, valaddr);
+ addr = unpack_pointer (type, gdbarch, valaddr);
if (addr == 0)
{
fputs_filtered ("null", stream);
@@ -525,7 +525,8 @@ java_val_print (struct type *type, struc
|| (TYPE_CODE (type) == TYPE_CODE_INT
&& TYPE_LENGTH (type) == 2
&& strcmp (TYPE_NAME (type), "char") == 0))
- LA_PRINT_CHAR ((int) unpack_long (type, valaddr), type, stream);
+ LA_PRINT_CHAR ((int) unpack_long (type, gdbarch, valaddr),
+ type, stream);
else
val_print_type_code_int (type, gdbarch, valaddr, stream);
break;
Index: gdb-head/gdb/m2-valprint.c
===================================================================
--- gdb-head.orig/gdb/m2-valprint.c
+++ gdb-head/gdb/m2-valprint.c
@@ -198,7 +198,7 @@ m2_print_unbounded_array (struct type *t
CHECK_TYPEDEF (type);
content_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0));
- addr = unpack_pointer (TYPE_FIELD_TYPE (type, 0),
+ addr = unpack_pointer (TYPE_FIELD_TYPE (type, 0), gdbarch,
(TYPE_FIELD_BITPOS (type, 0) / 8) +
valaddr + embedded_offset);
@@ -254,7 +254,7 @@ print_variable_at_address (struct type *
int recurse,
const struct value_print_options *options)
{
- CORE_ADDR addr = unpack_pointer (type, valaddr);
+ CORE_ADDR addr = unpack_pointer (type, gdbarch, valaddr);
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
fprintf_filtered (stream, "[");
@@ -263,8 +263,9 @@ print_variable_at_address (struct type *
if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
{
- struct value *deref_val = value_at (TYPE_TARGET_TYPE (type), gdbarch,
- unpack_pointer (type, valaddr));
+ struct value *deref_val
+ = value_at (TYPE_TARGET_TYPE (type), gdbarch,
+ unpack_pointer (type, gdbarch, valaddr));
common_val_print (deref_val, stream, recurse, options, current_language);
}
else
@@ -395,7 +396,7 @@ m2_val_print (struct type *type, struct
options, 0, stream);
else
{
- addr = unpack_pointer (type, valaddr + embedded_offset);
+ addr = unpack_pointer (type, gdbarch, valaddr + embedded_offset);
print_unpacked_pointer (type, gdbarch, addr, address,
options, stream);
}
@@ -406,7 +407,7 @@ m2_val_print (struct type *type, struct
if (options->addressprint)
{
CORE_ADDR addr
- = extract_typed_address (valaddr + embedded_offset, type);
+ = extract_typed_address (valaddr + embedded_offset, type, gdbarch);
fprintf_filtered (stream, "@");
fputs_filtered (paddress (addr), stream);
if (options->deref_ref)
@@ -419,7 +420,8 @@ m2_val_print (struct type *type, struct
{
struct value *deref_val =
value_at (TYPE_TARGET_TYPE (type), gdbarch,
- unpack_pointer (type, valaddr + embedded_offset));
+ unpack_pointer (type, gdbarch,
+ valaddr + embedded_offset));
common_val_print (deref_val, stream, recurse, options,
current_language);
}
@@ -455,7 +457,7 @@ m2_val_print (struct type *type, struct
break;
}
len = TYPE_NFIELDS (type);
- val = unpack_long (type, valaddr + embedded_offset);
+ val = unpack_long (type, gdbarch, valaddr + embedded_offset);
for (i = 0; i < len; i++)
{
QUIT;
@@ -501,7 +503,7 @@ m2_val_print (struct type *type, struct
}
else
{
- val = unpack_long (type, valaddr + embedded_offset);
+ val = unpack_long (type, gdbarch, valaddr + embedded_offset);
if (val == 0)
fputs_filtered ("FALSE", stream);
else if (val == 1)
@@ -552,7 +554,7 @@ m2_val_print (struct type *type, struct
}
else
{
- val = unpack_long (type, valaddr + embedded_offset);
+ val = unpack_long (type, gdbarch, valaddr + embedded_offset);
if (TYPE_UNSIGNED (type))
fprintf_filtered (stream, "%u", (unsigned int) val);
else
Index: gdb-head/gdb/m68k-tdep.c
===================================================================
--- gdb-head.orig/gdb/m68k-tdep.c
+++ gdb-head/gdb/m68k-tdep.c
@@ -184,9 +184,9 @@ static void
m68k_register_to_value (struct frame_info *frame, int regnum,
struct type *type, gdb_byte *to)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte from[M68K_MAX_REGISTER_SIZE];
- struct type *fpreg_type = register_type (get_frame_arch (frame),
- M68K_FP0_REGNUM);
+ struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM);
/* We only support floating-point values. */
if (TYPE_CODE (type) != TYPE_CODE_FLT)
@@ -198,7 +198,7 @@ m68k_register_to_value (struct frame_inf
/* Convert to TYPE. */
get_frame_register (frame, regnum, from);
- convert_typed_floating (from, fpreg_type, to, type);
+ convert_typed_floating (from, fpreg_type, to, type, gdbarch);
}
/* Write the contents FROM of a value of type TYPE into register
@@ -208,9 +208,9 @@ static void
m68k_value_to_register (struct frame_info *frame, int regnum,
struct type *type, const gdb_byte *from)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte to[M68K_MAX_REGISTER_SIZE];
- struct type *fpreg_type = register_type (get_frame_arch (frame),
- M68K_FP0_REGNUM);
+ struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM);
/* We only support floating-point values. */
if (TYPE_CODE (type) != TYPE_CODE_FLT)
@@ -221,7 +221,7 @@ m68k_value_to_register (struct frame_inf
}
/* Convert from TYPE. */
- convert_typed_floating (from, type, to, fpreg_type);
+ convert_typed_floating (from, type, to, fpreg_type, gdbarch);
put_frame_register (frame, regnum, to);
}
@@ -294,7 +294,7 @@ m68k_svr4_extract_return_value (struct t
{
struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM);
regcache_raw_read (regcache, M68K_FP0_REGNUM, buf);
- convert_typed_floating (buf, fpreg_type, valbuf, type);
+ convert_typed_floating (buf, fpreg_type, valbuf, type, gdbarch);
}
else if (TYPE_CODE (type) == TYPE_CODE_PTR && len == 4)
regcache_raw_read (regcache, M68K_A0_REGNUM, valbuf);
@@ -335,7 +335,7 @@ m68k_svr4_store_return_value (struct typ
{
struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM);
gdb_byte buf[M68K_MAX_REGISTER_SIZE];
- convert_typed_floating (valbuf, type, buf, fpreg_type);
+ convert_typed_floating (valbuf, type, buf, fpreg_type, gdbarch);
regcache_raw_write (regcache, M68K_FP0_REGNUM, buf);
}
else if (TYPE_CODE (type) == TYPE_CODE_PTR && len == 4)
@@ -833,7 +833,8 @@ m68k_unwind_pc (struct gdbarch *gdbarch,
gdb_byte buf[8];
frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
- return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
+ return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr,
+ gdbarch);
}
\f
/* Normal frames. */
Index: gdb-head/gdb/mips-tdep.c
===================================================================
--- gdb-head.orig/gdb/mips-tdep.c
+++ gdb-head/gdb/mips-tdep.c
@@ -4394,7 +4394,8 @@ mips_print_fp_register (struct ui_file *
/* 4-byte registers: Print hex and floating. Also print even
numbered registers as doubles. */
mips_read_fp_register_single (frame, regnum, raw_buffer);
- flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1);
+ flt1 = unpack_double (mips_float_register_type (), gdbarch,
+ raw_buffer, &inv1);
get_formatted_print_options (&opts, 'x');
print_scalar_formatted (raw_buffer, builtin_type_uint32, gdbarch,
@@ -4409,8 +4410,8 @@ mips_print_fp_register (struct ui_file *
if ((regnum - gdbarch_num_regs (gdbarch)) % 2 == 0)
{
mips_read_fp_register_double (frame, regnum, raw_buffer);
- doub = unpack_double (mips_double_register_type (), raw_buffer,
- &inv2);
+ doub = unpack_double (mips_double_register_type (), gdbarch,
+ raw_buffer, &inv2);
fprintf_filtered (file, " dbl: ");
if (inv2)
@@ -4425,10 +4426,12 @@ mips_print_fp_register (struct ui_file *
/* Eight byte registers: print each one as hex, float and double. */
mips_read_fp_register_single (frame, regnum, raw_buffer);
- flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1);
+ flt1 = unpack_double (mips_float_register_type (), gdbarch,
+ raw_buffer, &inv1);
mips_read_fp_register_double (frame, regnum, raw_buffer);
- doub = unpack_double (mips_double_register_type (), raw_buffer, &inv2);
+ doub = unpack_double (mips_double_register_type (), gdbarch,
+ raw_buffer, &inv2);
get_formatted_print_options (&opts, 'x');
print_scalar_formatted (raw_buffer, builtin_type_uint64, gdbarch,
Index: gdb-head/gdb/nto-tdep.c
===================================================================
--- gdb-head.orig/gdb/nto-tdep.c
+++ gdb-head/gdb/nto-tdep.c
@@ -283,7 +283,8 @@ LM_ADDR (struct so_list *so)
struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
so->lm_info->l_addr =
- extract_typed_address (so->lm_info->lm + lmo->l_addr_offset, ptr_type);
+ extract_typed_address (so->lm_info->lm + lmo->l_addr_offset,
+ ptr_type, target_gdbarch);
}
return so->lm_info->l_addr;
}
Index: gdb-head/gdb/ppc-sysv-tdep.c
===================================================================
--- gdb-head.orig/gdb/ppc-sysv-tdep.c
+++ gdb-head/gdb/ppc-sysv-tdep.c
@@ -120,7 +120,8 @@ ppc_sysv_abi_push_dummy_call (struct gdb
gdb_byte regval[MAX_REGISTER_SIZE];
struct type *regtype
= register_type (gdbarch, tdep->ppc_fp0_regnum + freg);
- convert_typed_floating (val, type, regval, regtype);
+ convert_typed_floating (val, type,
+ regval, regtype, gdbarch);
regcache_cooked_write (regcache,
tdep->ppc_fp0_regnum + freg,
regval);
@@ -405,7 +406,7 @@ ppc_sysv_abi_push_dummy_call (struct gdb
else if (TYPE_CODE (type) == TYPE_CODE_INT)
/* Sign or zero extend the "int" into a "word". */
store_unsigned_integer (word, tdep->wordsize,
- unpack_long (type, val));
+ unpack_long (type, gdbarch, val));
else
/* Always goes in the low address. */
memcpy (word, val, len);
@@ -569,7 +570,7 @@ do_ppc_sysv_return_value (struct gdbarch
struct type *regtype = register_type (gdbarch,
tdep->ppc_fp0_regnum + 1);
regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval);
- convert_typed_floating (regval, regtype, readbuf, type);
+ convert_typed_floating (regval, regtype, readbuf, type, gdbarch);
}
if (writebuf)
{
@@ -577,7 +578,7 @@ do_ppc_sysv_return_value (struct gdbarch
the register's "double" type. */
gdb_byte regval[MAX_REGISTER_SIZE];
struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum);
- convert_typed_floating (writebuf, type, regval, regtype);
+ convert_typed_floating (writebuf, type, regval, regtype, gdbarch);
regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, regval);
}
return RETURN_VALUE_REGISTER_CONVENTION;
@@ -682,7 +683,8 @@ do_ppc_sysv_return_value (struct gdbarch
/* Some sort of integer stored in r3. Use unpack_long since
that should handle any required sign extension. */
regcache_cooked_write_unsigned (regcache, tdep->ppc_gp0_regnum + 3,
- unpack_long (type, writebuf));
+ unpack_long (type, gdbarch,
+ writebuf));
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
@@ -1028,7 +1030,8 @@ ppc64_sysv_abi_push_dummy_call (struct g
struct type *regtype
= register_type (gdbarch, tdep->ppc_fp0_regnum);
- convert_typed_floating (val, type, regval, regtype);
+ convert_typed_floating (val, type,
+ regval, regtype, gdbarch);
regcache_cooked_write (regcache,
tdep->ppc_fp0_regnum + freg,
regval);
@@ -1172,7 +1175,7 @@ ppc64_sysv_abi_push_dummy_call (struct g
if (write_pass)
{
/* Sign extend the value, then store it unsigned. */
- ULONGEST word = unpack_long (type, val);
+ ULONGEST word = unpack_long (type, gdbarch, val);
/* Convert any function code addresses into
descriptors. */
if (TYPE_CODE (type) == TYPE_CODE_PTR
@@ -1265,7 +1268,7 @@ ppc64_sysv_abi_push_dummy_call (struct g
= register_type (gdbarch,
tdep->ppc_fp0_regnum);
convert_typed_floating (val, type, regval,
- regtype);
+ regtype, gdbarch);
regcache_cooked_write (regcache,
(tdep->ppc_fp0_regnum
+ freg),
@@ -1369,13 +1372,13 @@ ppc64_sysv_abi_return_value (struct gdba
struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum);
if (writebuf != NULL)
{
- convert_typed_floating (writebuf, valtype, regval, regtype);
+ convert_typed_floating (writebuf, valtype, regval, regtype, gdbarch);
regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, regval);
}
if (readbuf != NULL)
{
regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval);
- convert_typed_floating (regval, regtype, readbuf, valtype);
+ convert_typed_floating (regval, regtype, readbuf, valtype, gdbarch);
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
@@ -1393,7 +1396,8 @@ ppc64_sysv_abi_return_value (struct gdba
{
/* Be careful to sign extend the value. */
regcache_cooked_write_unsigned (regcache, tdep->ppc_gp0_regnum + 3,
- unpack_long (valtype, writebuf));
+ unpack_long (valtype, gdbarch,
+ writebuf));
}
if (readbuf != NULL)
{
@@ -1482,7 +1486,7 @@ ppc64_sysv_abi_return_value (struct gdba
{
convert_typed_floating ((const bfd_byte *) writebuf +
i * (TYPE_LENGTH (valtype) / 2),
- valtype, regval, regtype);
+ valtype, regval, regtype, gdbarch);
regcache_cooked_write (regcache,
tdep->ppc_fp0_regnum + 1 + i,
regval);
@@ -1495,7 +1499,7 @@ ppc64_sysv_abi_return_value (struct gdba
convert_typed_floating (regval, regtype,
(bfd_byte *) readbuf +
i * (TYPE_LENGTH (valtype) / 2),
- valtype);
+ valtype, gdbarch);
}
}
}
Index: gdb-head/gdb/printcmd.c
===================================================================
--- gdb-head.orig/gdb/printcmd.c
+++ gdb-head/gdb/printcmd.c
@@ -399,7 +399,7 @@ print_scalar_formatted (const void *vala
}
if (options->format != 'f')
- val_long = unpack_long (type, valaddr);
+ val_long = unpack_long (type, gdbarch, valaddr);
/* If the value is a pointer, and pointers and addresses are not the
same, then at this point, the value's length (in target bytes) is
@@ -455,7 +455,7 @@ print_scalar_formatted (const void *vala
case 'a':
{
- CORE_ADDR addr = unpack_pointer (type, valaddr);
+ CORE_ADDR addr = unpack_pointer (type, gdbarch, valaddr);
print_address (addr, stream);
}
break;
@@ -2361,7 +2361,8 @@ printf_command (char *arg, int from_tty)
/* If format string wants a float, unchecked-convert the value
to floating point of the same size. */
type = float_type_from_length (gdbarch, type);
- val = unpack_double (type, value_contents (val_args[i]), &inv);
+ val = unpack_double (type, gdbarch,
+ value_contents (val_args[i]), &inv);
if (inv)
error (_("Invalid floating value found in program."));
@@ -2378,7 +2379,8 @@ printf_command (char *arg, int from_tty)
/* If format string wants a float, unchecked-convert the value
to floating point of the same size. */
type = float_type_from_length (gdbarch, type);
- val = unpack_double (type, value_contents (val_args[i]), &inv);
+ val = unpack_double (type, gdbarch,
+ value_contents (val_args[i]), &inv);
if (inv)
error (_("Invalid floating value found in program."));
Index: gdb-head/gdb/p-valprint.c
===================================================================
--- gdb-head.orig/gdb/p-valprint.c
+++ gdb-head/gdb/p-valprint.c
@@ -149,7 +149,7 @@ pascal_val_print (struct type *type, str
}
elttype = check_typedef (TYPE_TARGET_TYPE (type));
{
- addr = unpack_pointer (type, valaddr + embedded_offset);
+ addr = unpack_pointer (type, gdbarch, valaddr + embedded_offset);
print_unpacked_pointer:
elttype = check_typedef (TYPE_TARGET_TYPE (type));
@@ -201,7 +201,8 @@ pascal_val_print (struct type *type, str
else if (pascal_object_is_vtbl_member (type))
{
/* print vtbl's nicely */
- CORE_ADDR vt_address = unpack_pointer (type, valaddr + embedded_offset);
+ CORE_ADDR vt_address
+ = unpack_pointer (type, gdbarch, valaddr + embedded_offset);
struct minimal_symbol *msymbol =
lookup_minimal_symbol_by_pc (vt_address);
@@ -255,7 +256,7 @@ pascal_val_print (struct type *type, str
if (options->addressprint)
{
CORE_ADDR addr
- = extract_typed_address (valaddr + embedded_offset, type);
+ = extract_typed_address (valaddr + embedded_offset, type, gdbarch);
fprintf_filtered (stream, "@");
fputs_filtered (paddress (addr), stream);
if (options->deref_ref)
@@ -269,7 +270,7 @@ pascal_val_print (struct type *type, str
struct value *deref_val =
value_at
(TYPE_TARGET_TYPE (type), gdbarch,
- unpack_pointer (type, valaddr + embedded_offset));
+ unpack_pointer (type, gdbarch, valaddr + embedded_offset));
common_val_print (deref_val, stream, recurse + 1, options,
current_language);
}
@@ -323,7 +324,7 @@ pascal_val_print (struct type *type, str
break;
}
len = TYPE_NFIELDS (type);
- val = unpack_long (type, valaddr + embedded_offset);
+ val = unpack_long (type, gdbarch, valaddr + embedded_offset);
for (i = 0; i < len; i++)
{
QUIT;
@@ -378,7 +379,7 @@ pascal_val_print (struct type *type, str
}
else
{
- val = unpack_long (type, valaddr + embedded_offset);
+ val = unpack_long (type, gdbarch, valaddr + embedded_offset);
if (val == 0)
fputs_filtered ("false", stream);
else if (val == 1)
@@ -428,7 +429,7 @@ pascal_val_print (struct type *type, str
}
else
{
- val = unpack_long (type, valaddr + embedded_offset);
+ val = unpack_long (type, gdbarch, valaddr + embedded_offset);
if (TYPE_UNSIGNED (type))
fprintf_filtered (stream, "%u", (unsigned int) val);
else
Index: gdb-head/gdb/rs6000-aix-tdep.c
===================================================================
--- gdb-head.orig/gdb/rs6000-aix-tdep.c
+++ gdb-head/gdb/rs6000-aix-tdep.c
@@ -475,11 +475,11 @@ rs6000_return_value (struct gdbarch *gdb
if (readbuf)
{
regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval);
- convert_typed_floating (regval, regtype, readbuf, valtype);
+ convert_typed_floating (regval, regtype, readbuf, valtype, gdbarch);
}
if (writebuf)
{
- convert_typed_floating (writebuf, valtype, regval, regtype);
+ convert_typed_floating (writebuf, valtype, regval, regtype, gdbarch);
regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, regval);
}
@@ -507,7 +507,8 @@ rs6000_return_value (struct gdbarch *gdb
/* For writing, use unpack_long since that should handle any
required sign extension. */
regcache_cooked_write_unsigned (regcache, tdep->ppc_gp0_regnum + 3,
- unpack_long (valtype, writebuf));
+ unpack_long (valtype, gdbarch,
+ writebuf));
}
return RETURN_VALUE_REGISTER_CONVENTION;
Index: gdb-head/gdb/rs6000-tdep.c
===================================================================
--- gdb-head.orig/gdb/rs6000-tdep.c
+++ gdb-head/gdb/rs6000-tdep.c
@@ -2482,7 +2482,7 @@ rs6000_register_to_value (struct frame_i
get_frame_register (frame, regnum, from);
convert_typed_floating (from, builtin_type (gdbarch)->builtin_double,
- to, type);
+ to, type, gdbarch);
}
static void
@@ -2497,7 +2497,7 @@ rs6000_value_to_register (struct frame_i
gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
convert_typed_floating (from, type,
- to, builtin_type (gdbarch)->builtin_double);
+ to, builtin_type (gdbarch)->builtin_double, gdbarch);
put_frame_register (frame, regnum, to);
}
Index: gdb-head/gdb/scm-lang.c
===================================================================
--- gdb-head.orig/gdb/scm-lang.c
+++ gdb-head/gdb/scm-lang.c
@@ -81,7 +81,8 @@ scm_get_field (LONGEST svalue, int index
or Boolean (CONTEXT == TYPE_CODE_BOOL). */
LONGEST
-scm_unpack (struct type *type, const gdb_byte *valaddr, enum type_code context)
+scm_unpack (struct type *type, struct gdbarch *gdbarch,
+ const gdb_byte *valaddr, enum type_code context)
{
if (is_scmvalue_type (type))
{
@@ -120,7 +121,7 @@ scm_unpack (struct type *type, const gdb
}
}
else
- return unpack_long (type, valaddr);
+ return unpack_long (type, gdbarch, valaddr);
}
/* True if we're correctly in Guile's eval.c (the evaluator and apply). */
Index: gdb-head/gdb/scm-lang.h
===================================================================
--- gdb-head.orig/gdb/scm-lang.h
+++ gdb-head/gdb/scm-lang.h
@@ -62,7 +62,8 @@ extern struct value *scm_evaluate_string
extern int scm_parse (void);
-extern LONGEST scm_unpack (struct type *, const gdb_byte *, enum type_code);
+extern LONGEST scm_unpack (struct type *, struct gdbarch *,
+ const gdb_byte *, enum type_code);
/* Scheme types */
Index: gdb-head/gdb/sh64-tdep.c
===================================================================
--- gdb-head.orig/gdb/sh64-tdep.c
+++ gdb-head/gdb/sh64-tdep.c
@@ -1221,7 +1221,7 @@ sh64_extract_return_value (struct type *
else
floatformat_to_doublest (&floatformat_ieee_double_big,
buf, &val);
- store_typed_floating (valbuf, type, val);
+ store_typed_floating (valbuf, type, gdbarch, val);
}
}
else
@@ -1555,7 +1555,7 @@ sh64_register_convert_to_virtual (struct
DOUBLEST val;
floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword,
from, &val);
- store_typed_floating (to, type, val);
+ store_typed_floating (to, type, gdbarch, val);
}
else
error ("sh64_register_convert_to_virtual called with non DR register number");
@@ -1577,7 +1577,7 @@ sh64_register_convert_to_raw (struct gdb
|| (regnum >= DR0_C_REGNUM
&& regnum <= DR_LAST_C_REGNUM))
{
- DOUBLEST val = extract_typed_floating (from, type);
+ DOUBLEST val = extract_typed_floating (from, type, gdbarch);
floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword,
&val, to);
}
@@ -1990,7 +1990,8 @@ sh64_do_fp_register (struct gdbarch *gdb
regnum, gdbarch_register_name (gdbarch, regnum));
/* Get the register as a number */
- flt = unpack_double (builtin_type (gdbarch)->builtin_float, raw_buffer, &inv);
+ flt = unpack_double (builtin_type (gdbarch)->builtin_float, gdbarch,
+ raw_buffer, &inv);
/* Print the name and some spaces. */
fputs_filtered (gdbarch_register_name (gdbarch, regnum), file);
Index: gdb-head/gdb/sh-tdep.c
===================================================================
--- gdb-head.orig/gdb/sh-tdep.c
+++ gdb-head/gdb/sh-tdep.c
@@ -2240,15 +2240,15 @@ sh_register_reggroup_p (struct gdbarch *
because they are stored as 4 individual FP elements. */
static void
-sh_register_convert_to_virtual (int regnum, struct type *type,
- char *from, char *to)
+sh_register_convert_to_virtual (struct gdbarch *gdbarch, int regnum,
+ struct type *type, char *from, char *to)
{
if (regnum >= DR0_REGNUM && regnum <= DR_LAST_REGNUM)
{
DOUBLEST val;
floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword,
from, &val);
- store_typed_floating (to, type, val);
+ store_typed_floating (to, type, gdbarch, val);
}
else
error
@@ -2256,12 +2256,12 @@ sh_register_convert_to_virtual (int regn
}
static void
-sh_register_convert_to_raw (struct type *type, int regnum,
- const void *from, void *to)
+sh_register_convert_to_raw (struct gdbarch *gdbarch, struct type *type,
+ int regnum, const void *from, void *to)
{
if (regnum >= DR0_REGNUM && regnum <= DR_LAST_REGNUM)
{
- DOUBLEST val = extract_typed_floating (from, type);
+ DOUBLEST val = extract_typed_floating (from, type, gdbarch);
floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword,
&val, to);
}
@@ -2313,7 +2313,7 @@ sh_pseudo_register_read (struct gdbarch
+ register_size (gdbarch,
base_regnum) * portion));
/* We must pay attention to the endiannes. */
- sh_register_convert_to_virtual (reg_nr,
+ sh_register_convert_to_virtual (gdbarch, reg_nr,
register_type (gdbarch, reg_nr),
temp_buffer, buffer);
}
@@ -2354,7 +2354,7 @@ sh_pseudo_register_write (struct gdbarch
base_regnum = dr_reg_base_num (gdbarch, reg_nr);
/* We must pay attention to the endiannes. */
- sh_register_convert_to_raw (register_type (gdbarch, reg_nr),
+ sh_register_convert_to_raw (gdbarch, register_type (gdbarch, reg_nr),
reg_nr, buffer, temp_buffer);
/* Write the real regs for which this one is an alias. */
Index: gdb-head/gdb/solib-svr4.c
===================================================================
--- gdb-head.orig/gdb/solib-svr4.c
+++ gdb-head/gdb/solib-svr4.c
@@ -147,7 +147,7 @@ LM_ADDR_FROM_LINK_MAP (struct so_list *s
struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
return extract_typed_address (so->lm_info->lm + lmo->l_addr_offset,
- ptr_type);
+ ptr_type, target_gdbarch);
}
static int
@@ -165,7 +165,7 @@ LM_DYNAMIC_FROM_LINK_MAP (struct so_list
struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
return extract_typed_address (so->lm_info->lm + lmo->l_ld_offset,
- ptr_type);
+ ptr_type, target_gdbarch);
}
static CORE_ADDR
@@ -245,7 +245,7 @@ LM_NEXT (struct so_list *so)
struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
return extract_typed_address (so->lm_info->lm + lmo->l_next_offset,
- ptr_type);
+ ptr_type, target_gdbarch);
}
static CORE_ADDR
@@ -255,7 +255,7 @@ LM_NAME (struct so_list *so)
struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
return extract_typed_address (so->lm_info->lm + lmo->l_name_offset,
- ptr_type);
+ ptr_type, target_gdbarch);
}
static int
@@ -270,7 +270,7 @@ IGNORE_FIRST_LINK_MAP_ENTRY (struct so_l
return 0;
return extract_typed_address (so->lm_info->lm + lmo->l_prev_offset,
- ptr_type) == 0;
+ ptr_type, target_gdbarch) == 0;
}
/* Per-inferior SVR4 specific data. */
@@ -652,7 +652,8 @@ scan_dyntag (int dyntag, bfd *abfd, CORE
ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
ptr_addr = dyn_addr + (buf - bufstart) + arch_size / 8;
if (target_read_memory (ptr_addr, ptr_buf, arch_size / 8) == 0)
- dyn_ptr = extract_typed_address (ptr_buf, ptr_type);
+ dyn_ptr = extract_typed_address (ptr_buf,
+ ptr_type, target_gdbarch);
*ptr = dyn_ptr;
}
return 1;
@@ -760,7 +761,7 @@ elf_locate_base (void)
of the dynamic link structure. */
if (target_read_memory (dyn_ptr, pbuf, pbuf_size))
return 0;
- return extract_typed_address (pbuf, ptr_type);
+ return extract_typed_address (pbuf, ptr_type, target_gdbarch);
}
/* Find DT_DEBUG. */
@@ -847,7 +848,7 @@ solib_svr4_r_map (struct svr4_info *info
struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
return read_memory_typed_address (info->debug_base + lmo->r_map_offset,
- ptr_type);
+ ptr_type, target_gdbarch);
}
/* Find r_brk from the inferior's debug base. */
@@ -859,7 +860,7 @@ solib_svr4_r_brk (struct svr4_info *info
struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
return read_memory_typed_address (info->debug_base + lmo->r_brk_offset,
- ptr_type);
+ ptr_type, target_gdbarch);
}
/* Find the link map for the dynamic linker (if it is not in the
@@ -881,7 +882,7 @@ solib_svr4_r_ldsomap (struct svr4_info *
return 0;
return read_memory_typed_address (info->debug_base + lmo->r_ldsomap_offset,
- ptr_type);
+ ptr_type, target_gdbarch);
}
/*
@@ -938,7 +939,7 @@ open_symbol_file_object (void *from_ttyp
read_memory (lm + lmo->l_name_offset, l_name_buf, l_name_size);
/* Convert the address to host format. */
- l_name = extract_typed_address (l_name_buf, ptr_type);
+ l_name = extract_typed_address (l_name_buf, ptr_type, target_gdbarch);
/* Free l_name_buf. */
do_cleanups (cleanups);
Index: gdb-head/gdb/spu-tdep.c
===================================================================
--- gdb-head.orig/gdb/spu-tdep.c
+++ gdb-head/gdb/spu-tdep.c
@@ -345,7 +345,7 @@ static CORE_ADDR
spu_integer_to_address (struct gdbarch *gdbarch,
struct type *type, const gdb_byte *buf)
{
- ULONGEST addr = unpack_long (type, buf);
+ ULONGEST addr = unpack_long (type, gdbarch, buf);
ULONGEST lslr = SPU_LS_SIZE - 1; /* Hard-wired LS size. */
if (target_has_registers && target_has_stack && target_has_memory)
Index: gdb-head/gdb/stabsread.c
===================================================================
--- gdb-head.orig/gdb/stabsread.c
+++ gdb-head/gdb/stabsread.c
@@ -776,7 +776,7 @@ define_symbol (CORE_ADDR valu, char *str
dbl_valu =
obstack_alloc (&objfile->objfile_obstack,
TYPE_LENGTH (dbl_type));
- store_typed_floating (dbl_valu, dbl_type, d);
+ store_typed_floating (dbl_valu, dbl_type, gdbarch, d);
SYMBOL_TYPE (sym) = dbl_type;
SYMBOL_VALUE_BYTES (sym) = dbl_valu;
Index: gdb-head/gdb/valarith.c
===================================================================
--- gdb-head.orig/gdb/valarith.c
+++ gdb-head/gdb/valarith.c
@@ -664,7 +664,7 @@ value_concat (struct value *arg1, struct
if (TYPE_CODE (type2) == TYPE_CODE_CHAR)
{
char_type = type2;
- inchar = (char) unpack_long (type2,
+ inchar = (char) unpack_long (type2, value_arch (inval2),
value_contents (inval2));
for (idx = 0; idx < count; idx++)
{
@@ -708,7 +708,8 @@ value_concat (struct value *arg1, struct
if (TYPE_CODE (type1) == TYPE_CODE_CHAR)
{
char_type = type1;
- *ptr = (char) unpack_long (type1, value_contents (inval1));
+ *ptr = (char) unpack_long (type1, value_arch (inval1),
+ value_contents (inval1));
}
else
{
@@ -718,7 +719,8 @@ value_concat (struct value *arg1, struct
if (TYPE_CODE (type2) == TYPE_CODE_CHAR)
{
*(ptr + inval1len) =
- (char) unpack_long (type2, value_contents (inval2));
+ (char) unpack_long (type2, value_arch (inval2),
+ value_contents (inval2));
}
else
{
@@ -988,7 +990,8 @@ value_binop (struct value *arg1, struct
result_type = type1, result_arch = value_arch (arg1);
val = allocate_value (result_type, result_arch);
- store_typed_floating (value_contents_raw (val), value_type (val), v);
+ store_typed_floating (value_contents_raw (val),
+ value_type (val), value_arch (val), v);
}
else if (TYPE_CODE (type1) == TYPE_CODE_BOOL
|| TYPE_CODE (type2) == TYPE_CODE_BOOL)
Index: gdb-head/gdb/valprint.c
===================================================================
--- gdb-head.orig/gdb/valprint.c
+++ gdb-head/gdb/valprint.c
@@ -427,7 +427,7 @@ val_print_type_code_int (struct type *ty
else
{
print_longest (stream, TYPE_UNSIGNED (type) ? 'u' : 'd', 0,
- unpack_long (type, valaddr));
+ unpack_long (type, gdbarch, valaddr));
}
}
@@ -435,7 +435,7 @@ void
val_print_type_code_flags (struct type *type, struct gdbarch *gdbarch,
const gdb_byte *valaddr, struct ui_file *stream)
{
- ULONGEST val = unpack_long (type, valaddr);
+ ULONGEST val = unpack_long (type, gdbarch, valaddr);
int bitpos, nfields = TYPE_NFIELDS (type);
fputs_filtered ("[ ", stream);
@@ -541,7 +541,7 @@ print_floating (const gdb_byte *valaddr,
/* If it is a floating-point, check for obvious problems. */
if (TYPE_CODE (type) == TYPE_CODE_FLT)
- fmt = floatformat_from_type (type);
+ fmt = floatformat_from_type (type, gdbarch);
if (fmt != NULL)
{
kind = floatformat_classify (fmt, valaddr);
@@ -573,7 +573,7 @@ print_floating (const gdb_byte *valaddr,
host with 80 bit DOUBLEST but with loss of information on a host
with 64 bit DOUBLEST. */
- doub = unpack_double (type, valaddr, &inv);
+ doub = unpack_double (type, gdbarch, valaddr, &inv);
if (inv)
{
fprintf_filtered (stream, "<invalid float value>");
Index: gdb-head/gdb/value.c
===================================================================
--- gdb-head.orig/gdb/value.c
+++ gdb-head/gdb/value.c
@@ -1414,7 +1414,8 @@ value_as_long (struct value *val)
in disassemble_command). It also dereferences references, which
I suspect is the most logical thing to do. */
val = coerce_array (val);
- return unpack_long (value_type (val), value_contents (val));
+ return unpack_long (value_type (val), value_arch (val),
+ value_contents (val));
}
DOUBLEST
@@ -1423,7 +1424,8 @@ value_as_double (struct value *val)
DOUBLEST foo;
int inv;
- foo = unpack_double (value_type (val), value_contents (val), &inv);
+ foo = unpack_double (value_type (val), value_arch (val),
+ value_contents (val), &inv);
if (inv)
error (_("Invalid floating value found in program."));
return foo;
@@ -1530,7 +1532,8 @@ value_as_address (struct value *val)
return gdbarch_integer_to_address (value_arch (val), value_type (val),
value_contents (val));
- return unpack_long (value_type (val), value_contents (val));
+ return unpack_long (value_type (val), value_arch (val),
+ value_contents (val));
#endif
}
\f
@@ -1549,7 +1552,8 @@ value_as_address (struct value *val)
to an INT (or some size). After all, it is only an offset. */
LONGEST
-unpack_long (struct type *type, const gdb_byte *valaddr)
+unpack_long (struct type *type, struct gdbarch *gdbarch,
+ const gdb_byte *valaddr)
{
enum type_code code = TYPE_CODE (type);
int len = TYPE_LENGTH (type);
@@ -1558,7 +1562,7 @@ unpack_long (struct type *type, const gd
switch (code)
{
case TYPE_CODE_TYPEDEF:
- return unpack_long (check_typedef (type), valaddr);
+ return unpack_long (check_typedef (type), gdbarch, valaddr);
case TYPE_CODE_ENUM:
case TYPE_CODE_FLAGS:
case TYPE_CODE_BOOL:
@@ -1572,7 +1576,7 @@ unpack_long (struct type *type, const gd
return extract_signed_integer (valaddr, len);
case TYPE_CODE_FLT:
- return extract_typed_floating (valaddr, type);
+ return extract_typed_floating (valaddr, type, gdbarch);
case TYPE_CODE_DECFLOAT:
/* libdecnumber has a function to convert from decimal to integer, but
@@ -1583,7 +1587,7 @@ unpack_long (struct type *type, const gd
case TYPE_CODE_REF:
/* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
whether we want this to be true eventually. */
- return extract_typed_address (valaddr, type);
+ return extract_typed_address (valaddr, type, gdbarch);
default:
error (_("Value can't be converted to integer."));
@@ -1598,7 +1602,8 @@ unpack_long (struct type *type, const gd
format, result is in host format. */
DOUBLEST
-unpack_double (struct type *type, const gdb_byte *valaddr, int *invp)
+unpack_double (struct type *type, struct gdbarch *gdbarch,
+ const gdb_byte *valaddr, int *invp)
{
enum type_code code;
int len;
@@ -1628,25 +1633,26 @@ unpack_double (struct type *type, const
Hopefully someone will add both the missing floatformat
definitions and the new cases for floatformat_is_valid (). */
- if (!floatformat_is_valid (floatformat_from_type (type), valaddr))
+ if (!floatformat_is_valid (floatformat_from_type (type, gdbarch),
+ valaddr))
{
*invp = 1;
return 0.0;
}
- return extract_typed_floating (valaddr, type);
+ return extract_typed_floating (valaddr, type, gdbarch);
}
else if (code == TYPE_CODE_DECFLOAT)
return decimal_to_doublest (valaddr, len);
else if (nosign)
{
/* Unsigned -- be sure we compensate for signed LONGEST. */
- return (ULONGEST) unpack_long (type, valaddr);
+ return (ULONGEST) unpack_long (type, gdbarch, valaddr);
}
else
{
/* Signed -- we are OK with unpack_long. */
- return unpack_long (type, valaddr);
+ return unpack_long (type, gdbarch, valaddr);
}
}
@@ -1664,11 +1670,12 @@ unpack_double (struct type *type, const
to an INT (or some size). After all, it is only an offset. */
CORE_ADDR
-unpack_pointer (struct type *type, const gdb_byte *valaddr)
+unpack_pointer (struct type *type, struct gdbarch *gdbarch,
+ const gdb_byte *valaddr)
{
/* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
whether we want this to be true eventually. */
- return unpack_long (type, valaddr);
+ return unpack_long (type, gdbarch, valaddr);
}
\f
@@ -1985,7 +1992,8 @@ modify_field (struct gdbarch *gdbarch, g
/* Pack NUM into BUF using a target format of TYPE. */
void
-pack_long (gdb_byte *buf, struct type *type, LONGEST num)
+pack_long (gdb_byte *buf, struct type *type,
+ struct gdbarch *gdbarch, LONGEST num)
{
int len;
@@ -2006,7 +2014,7 @@ pack_long (gdb_byte *buf, struct type *t
case TYPE_CODE_REF:
case TYPE_CODE_PTR:
- store_typed_address (buf, type, (CORE_ADDR) num);
+ store_typed_address (buf, type, gdbarch, (CORE_ADDR) num);
break;
default:
@@ -2023,7 +2031,7 @@ value_from_longest (struct type *type, s
{
struct value *val = allocate_value (type, gdbarch);
- pack_long (value_contents_raw (val), type, num);
+ pack_long (value_contents_raw (val), type, gdbarch, num);
return val;
}
@@ -2035,7 +2043,7 @@ struct value *
value_from_pointer (struct type *type, struct gdbarch *gdbarch, CORE_ADDR addr)
{
struct value *val = allocate_value (type, gdbarch);
- store_typed_address (value_contents_raw (val), type, addr);
+ store_typed_address (value_contents_raw (val), type, gdbarch, addr);
return val;
}
@@ -2069,9 +2077,7 @@ value_from_double (struct type *type, st
int len = TYPE_LENGTH (base_type);
if (code == TYPE_CODE_FLT)
- {
- store_typed_floating (value_contents_raw (val), base_type, num);
- }
+ store_typed_floating (value_contents_raw (val), base_type, gdbarch, num);
else
error (_("Unexpected type encountered for floating constant."));
@@ -2096,7 +2102,8 @@ coerce_ref (struct value *arg)
if (TYPE_CODE (value_type_arg_tmp) == TYPE_CODE_REF)
arg = value_at_lazy (TYPE_TARGET_TYPE (value_type_arg_tmp),
value_arch (arg),
- unpack_pointer (value_type (arg),
+ unpack_pointer (value_type (arg),
+ value_arch (arg),
value_contents (arg)));
return arg;
}
Index: gdb-head/gdb/value.h
===================================================================
--- gdb-head.orig/gdb/value.h
+++ gdb-head/gdb/value.h
@@ -326,16 +326,19 @@ extern LONGEST value_as_long (struct val
extern DOUBLEST value_as_double (struct value *val);
extern CORE_ADDR value_as_address (struct value *val);
-extern LONGEST unpack_long (struct type *type, const gdb_byte *valaddr);
-extern DOUBLEST unpack_double (struct type *type, const gdb_byte *valaddr,
- int *invp);
-extern CORE_ADDR unpack_pointer (struct type *type, const gdb_byte *valaddr);
+extern LONGEST unpack_long (struct type *type, struct gdbarch *gdbarch,
+ const gdb_byte *valaddr);
+extern DOUBLEST unpack_double (struct type *type, struct gdbarch *gdbarch,
+ const gdb_byte *valaddr, int *invp);
+extern CORE_ADDR unpack_pointer (struct type *type, struct gdbarch *gdbarch,
+ const gdb_byte *valaddr);
extern LONGEST unpack_field_as_long (struct type *type,
struct gdbarch *gdbarch,
const gdb_byte *valaddr,
int fieldno);
-extern void pack_long (gdb_byte *buf, struct type *type, LONGEST num);
+extern void pack_long (gdb_byte *buf, struct type *type,
+ struct gdbarch *gdbarch, LONGEST num);
extern struct value *value_from_longest (struct type *type,
struct gdbarch *gdbarch, LONGEST num);
Index: gdb-head/gdb/xtensa-tdep.c
===================================================================
--- gdb-head.orig/gdb/xtensa-tdep.c
+++ gdb-head/gdb/xtensa-tdep.c
@@ -1022,7 +1022,8 @@ xtensa_unwind_pc (struct gdbarch *gdbarc
host_address_to_string (next_frame));
frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
- pc = extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
+ pc = extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr,
+ gdbarch);
DEBUGINFO ("[xtensa_unwind_pc] pc = 0x%08x\n", (unsigned int) pc);
Index: gdb-head/gdb/c-lang.c
===================================================================
--- gdb-head.orig/gdb/c-lang.c
+++ gdb-head/gdb/c-lang.c
@@ -241,7 +241,7 @@ c_emit_char (int c, struct type *type, s
classify_type (type, &encoding);
buf = alloca (TYPE_LENGTH (type));
- pack_long (buf, type, c);
+ store_signed_integer (buf, TYPE_LENGTH (type), c);
iter = make_wchar_iterator (buf, TYPE_LENGTH (type), encoding,
TYPE_LENGTH (type));
@@ -727,13 +727,13 @@ convert_ucn (char *p, char *limit, const
OUTPUT. TYPE is the target character type. */
static void
-emit_numeric_character (struct type *type, unsigned long value,
- struct obstack *output)
+emit_numeric_character (struct type *type, struct gdbarch *gdbarch,
+ unsigned long value, struct obstack *output)
{
gdb_byte *buffer;
buffer = alloca (TYPE_LENGTH (type));
- pack_long (buffer, type, value);
+ pack_long (buffer, type, gdbarch, value);
obstack_grow (output, buffer, TYPE_LENGTH (type));
}
@@ -743,7 +743,8 @@ emit_numeric_character (struct type *typ
pointer to just after the final digit of the escape sequence. */
static char *
-convert_octal (struct type *type, char *p, char *limit, struct obstack *output)
+convert_octal (struct type *type, struct gdbarch *gdbarch,
+ char *p, char *limit, struct obstack *output)
{
unsigned long value = 0;
@@ -753,7 +754,7 @@ convert_octal (struct type *type, char *
++p;
}
- emit_numeric_character (type, value, output);
+ emit_numeric_character (type, gdbarch, value, output);
return p;
}
@@ -764,7 +765,8 @@ convert_octal (struct type *type, char *
just after the final digit of the escape sequence. */
static char *
-convert_hex (struct type *type, char *p, char *limit, struct obstack *output)
+convert_hex (struct type *type, struct gdbarch *gdbarch,
+ char *p, char *limit, struct obstack *output)
{
unsigned long value = 0;
@@ -774,7 +776,7 @@ convert_hex (struct type *type, char *p,
++p;
}
- emit_numeric_character (type, value, output);
+ emit_numeric_character (type, gdbarch, value, output);
return p;
}
@@ -794,8 +796,9 @@ convert_hex (struct type *type, char *p,
character of the escape sequence. */
static char *
-convert_escape (struct type *type, const char *dest_charset,
- char *p, char *limit, struct obstack *output)
+convert_escape (struct type *type, struct gdbarch *gdbarch,
+ const char *dest_charset, char *p, char *limit,
+ struct obstack *output)
{
/* Skip the backslash. */
ADVANCE;
@@ -811,7 +814,7 @@ convert_escape (struct type *type, const
ADVANCE;
if (!isxdigit (*p))
error (_("\\x used with no following hex digits."));
- p = convert_hex (type, p, limit, output);
+ p = convert_hex (type, gdbarch, p, limit, output);
break;
case '0':
@@ -822,7 +825,7 @@ convert_escape (struct type *type, const
case '5':
case '6':
case '7':
- p = convert_octal (type, p, limit, output);
+ p = convert_octal (type, gdbarch, p, limit, output);
break;
case 'u':
@@ -847,7 +850,8 @@ convert_escape (struct type *type, const
static void
parse_one_string (struct obstack *output, char *data, int len,
- const char *dest_charset, struct type *type)
+ const char *dest_charset, struct type *type,
+ struct gdbarch *gdbarch)
{
char *limit;
@@ -865,7 +869,7 @@ parse_one_string (struct obstack *output
data, p - data, 1, output, translit_none);
/* If we saw an escape, convert it. */
if (p < limit)
- p = convert_escape (type, dest_charset, p, limit, output);
+ p = convert_escape (type, gdbarch, dest_charset, p, limit, output);
data = p;
}
}
@@ -939,7 +943,7 @@ evaluate_subexp_c (struct type *expect_t
++*pos;
if (noside != EVAL_SKIP)
parse_one_string (&output, &exp->elts[*pos].string, len,
- dest_charset, type);
+ dest_charset, type, exp->gdbarch);
*pos += BYTES_TO_EXP_ELEM (len);
}
@@ -963,7 +967,7 @@ evaluate_subexp_c (struct type *expect_t
if (obstack_object_size (&output) != TYPE_LENGTH (type))
error (_("Could not convert character constant to target character set"));
- value = unpack_long (type, obstack_base (&output));
+ value = unpack_long (type, exp->gdbarch, obstack_base (&output));
result = value_from_longest (type, exp->gdbarch, value);
}
else
Index: gdb-head/gdb/solib-darwin.c
===================================================================
--- gdb-head.orig/gdb/solib-darwin.c
+++ gdb-head/gdb/solib-darwin.c
@@ -102,9 +102,10 @@ darwin_load_image_infos (void)
return;
dyld_all_image.count = extract_unsigned_integer (buf + 4, 4);
- dyld_all_image.info = extract_typed_address (buf + 8, ptr_type);
+ dyld_all_image.info = extract_typed_address
+ (buf + 8, ptr_type, target_gdbarch);
dyld_all_image.notifier = extract_typed_address
- (buf + 8 + ptr_type->length, ptr_type);
+ (buf + 8 + ptr_type->length, ptr_type, target_gdbarch);
}
/* Link map info to include in an allocated so_list entry. */
@@ -233,8 +234,9 @@ darwin_current_sos (void)
if (target_read_memory (info, buf, image_info_size))
break;
- load_addr = extract_typed_address (buf, ptr_type);
- path_addr = extract_typed_address (buf + ptr_len, ptr_type);
+ load_addr = extract_typed_address (buf, ptr_type, target_gdbarch);
+ path_addr = extract_typed_address (buf + ptr_len,
+ ptr_type, target_gdbarch);
target_read_string (path_addr, &file_path,
SO_NAME_MAX_PATH_SIZE - 1, &errcode);
Index: gdb-head/gdb/doc/gdbint.texinfo
===================================================================
--- gdb-head.orig/gdb/doc/gdbint.texinfo
+++ gdb-head/gdb/doc/gdbint.texinfo
@@ -3254,34 +3254,34 @@ clean up some architecture-independent c
Here are functions which convert between pointers and addresses:
-@deftypefun CORE_ADDR extract_typed_address (void *@var{buf}, struct type *@var{type})
+@deftypefun CORE_ADDR extract_typed_address (void *@var{buf}, struct type *@var{type}, struct gdbarch *@var{gdbarch})
Treat the bytes at @var{buf} as a pointer or reference of type
@var{type}, and return the address it represents, in a manner
-appropriate for the current architecture. This yields an address
+appropriate for architecture @var{gdbarch}. This yields an address
@value{GDBN} can use to read target memory, disassemble, etc. Note that
@var{buf} refers to a buffer in @value{GDBN}'s memory, not the
inferior's.
-For example, if the current architecture is the Intel x86, this function
-extracts a little-endian integer of the appropriate length from
-@var{buf} and returns it. However, if the current architecture is the
-D10V, this function will return a 16-bit integer extracted from
+For example, if @var{gdbarch} is the Intel x86 architecture, this
+function extracts a little-endian integer of the appropriate length from
+@var{buf} and returns it. However, if @var{gdbarch} is the D10V
+architecture, this function will return a 16-bit integer extracted from
@var{buf}, multiplied by four if @var{type} is a pointer to a function.
If @var{type} is not a pointer or reference type, then this function
will signal an internal error.
@end deftypefun
-@deftypefun CORE_ADDR store_typed_address (void *@var{buf}, struct type *@var{type}, CORE_ADDR @var{addr})
+@deftypefun CORE_ADDR store_typed_address (void *@var{buf}, struct type *@var{type}, struct gdbarch *@var{gdbarch}, CORE_ADDR @var{addr})
Store the address @var{addr} in @var{buf}, in the proper format for a
-pointer of type @var{type} in the current architecture. Note that
+pointer of type @var{type} in architecture @var{gdbarch}. Note that
@var{buf} refers to a buffer in @value{GDBN}'s memory, not the
inferior's.
-For example, if the current architecture is the Intel x86, this function
-stores @var{addr} unmodified as a little-endian integer of the
-appropriate length in @var{buf}. However, if the current architecture
-is the D10V, this function divides @var{addr} by four if @var{type} is
+For example, if @var{gdbarch} is the Intel x86 architecture, this
+function stores @var{addr} unmodified as a little-endian integer of the
+appropriate length in @var{buf}. However, if @var{gdbarch} is the D10V
+architecture, this function divides @var{addr} by four if @var{type} is
a pointer to a function, and then stores it in @var{buf}.
If @var{type} is not a pointer or reference type, then this function
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [10/15] Basic value access routines
2009-06-09 15:20 [10/15] Basic value access routines Ulrich Weigand
@ 2009-06-15 16:35 ` Doug Evans
2009-06-15 16:59 ` Ulrich Weigand
0 siblings, 1 reply; 19+ messages in thread
From: Doug Evans @ 2009-06-15 16:35 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gdb-patches
On Tue, Jun 9, 2009 at 8:19 AM, Ulrich Weigand<uweigand@de.ibm.com> wrote:
> Hello,
>
> a number of core data conversion routines deeply buried in the
> call chain implicitly use current_gdbarch to determine the format
> of the data (address/pointer conversion, floating point formats).
>
> This patch adds an explicit gdbarch argument to the following
> routines to eliminate that use, and updates all call sites:
>
> - unpack_long/unpack_double/unpack_pointer/pack_long
> - extract_typed_address/store_typed_address/read_memory_typed_address
> - extract_typed_floating/store_typed_floating/convert_typed_floating
> - floatformat_from_type
Can a struct type (or struct main_type) ever be associated with more
than one architecture?
[And if they can, is that correct given things like struct
main_type.fields, struct type.length (and a few others)?]
And if a struct type (or struct main_type) can (or should) only be
associated with one architecture can we make it so that we can obtain
the architecture given the type?
That would seem to simplify things.
[I realize there's type->main_type->objfile->gdbarch, but it's not
clear to me that this will always be the correct one to use. Maybe it
is.
I also realize struct main_type is space critical, struct type is not
marked as such but maybe it is too.
I'd still hate to lose the simplicity gained by being able to
determine an arch given just the type.
Maybe there's a way to have both.]
Thoughts?
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [10/15] Basic value access routines
2009-06-15 16:35 ` Doug Evans
@ 2009-06-15 16:59 ` Ulrich Weigand
2009-06-22 20:32 ` Per-type architecture (Re: [10/15] Basic value access routines) Ulrich Weigand
2009-06-24 15:31 ` [10/15] Basic value access routines Tom Tromey
0 siblings, 2 replies; 19+ messages in thread
From: Ulrich Weigand @ 2009-06-15 16:59 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
Doug Evans wrote:
> On Tue, Jun 9, 2009 at 8:19 AM, Ulrich Weigand<uweigand@de.ibm.com> wrote:
> > Hello,
> >
> > a number of core data conversion routines deeply buried in the
> > call chain implicitly use current_gdbarch to determine the format
> > of the data (address/pointer conversion, floating point formats).
> >
> > This patch adds an explicit gdbarch argument to the following
> > routines to eliminate that use, and updates all call sites:
> >
> > - unpack_long/unpack_double/unpack_pointer/pack_long
> > - extract_typed_address/store_typed_address/read_memory_typed_address
> > - extract_typed_floating/store_typed_floating/convert_typed_floating
> > - floatformat_from_type
>
> Can a struct type (or struct main_type) ever be associated with more
> than one architecture?
> [And if they can, is that correct given things like struct
> main_type.fields, struct type.length (and a few others)?]
>
> And if a struct type (or struct main_type) can (or should) only be
> associated with one architecture can we make it so that we can obtain
> the architecture given the type?
> That would seem to simplify things.
That was one of main design questions of this whole effort. The problems
with associating a gdbarch with a type (and subsequently using the arch
of a value's type as the arch of the value) is that:
- We have architecture-independent types (e.g. builtin_type_void,
builtin_type_int32 etc.), and last time we discussed this, the
consensus was that we want to keep this option
- The bulk of types is read in from symbol files -- these could be
associated with the generic objfile arch at this point, but that
is not sufficient as a value arch. For example, the objfile arch
does not contain specific register number associations; those are
only determined by a run-time arch from the target. For values
refering to registers, we need the latter however.
> [I realize there's type->main_type->objfile->gdbarch, but it's not
> clear to me that this will always be the correct one to use. Maybe it
> is.
> I also realize struct main_type is space critical, struct type is not
> marked as such but maybe it is too.
> I'd still hate to lose the simplicity gained by being able to
> determine an arch given just the type.
> Maybe there's a way to have both.]
Those are additional minor issues; the type structures are indeed
space critical, and the main_type->objfile pointer is not always set
(e.g. for builtin types), but we could use a union of a objfile
pointer and a gdbarch pointer. That major problems are the ones
described above -- at the time a type is allocated, we generally
do not know the correct architecture to use for values of this type.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 19+ messages in thread
* Per-type architecture (Re: [10/15] Basic value access routines)
2009-06-15 16:59 ` Ulrich Weigand
@ 2009-06-22 20:32 ` Ulrich Weigand
2009-06-22 20:59 ` Daniel Jacobowitz
2009-06-24 15:31 ` [10/15] Basic value access routines Tom Tromey
1 sibling, 1 reply; 19+ messages in thread
From: Ulrich Weigand @ 2009-06-22 20:32 UTC (permalink / raw)
To: drow; +Cc: Doug Evans, gdb-patches
Hello,
> That was one of main design questions of this whole effort. The problems
> with associating a gdbarch with a type (and subsequently using the arch
> of a value's type as the arch of the value) is that:
>
> - We have architecture-independent types (e.g. builtin_type_void,
> builtin_type_int32 etc.), and last time we discussed this, the
> consensus was that we want to keep this option
>
> - The bulk of types is read in from symbol files -- these could be
> associated with the generic objfile arch at this point, but that
> is not sufficient as a value arch. For example, the objfile arch
> does not contain specific register number associations; those are
> only determined by a run-time arch from the target. For values
> refering to registers, we need the latter however.
[It turns out the second point isn't really applicable as in those
situations where we need register number associations, we have in
fact the related frame ID and its architecture available, and
already use it.]
As to the first point, upon further investigation, it does seem
feasible to ensure every type is related to an architecture, and
this does in fact significantly simplify the rest of the patches.
Dan, one of the reasons you brought up to keep architecture-independent
types -back when I first started attempting to eliminate then- was the
target-descriptions infrastructure. This currently builds up GDB type
structures while parsing the XML file, long before we know the actual
target gdbarch to use.
However, it seems to me it is relatively straightforward to delay
creation of GDB types until we're in tdesc_register_type, where we
know the target gdbarch. This simply requires that while parsing
the XML file, we store the type details into temporary data structures
just like we do with all the other information read from XML.
The following patch does so, using a new "tdesc_type" structure to
hold type information from XML files. Does this look reasonable?
Tested on powerpc64-linux.
Bye,
Ulrich
ChangeLog:
* target-descriptions.h (struct type): Do not declare.
(struct tdesc_type): Declare.
(tdesc_named_type): Change return type to struct tdesc_type *.
(tdesc_record_type): Remove.
(tdesc_create_vector): Add prototype.
(tdesc_create_union): Likewise.
(tdesc_add_field): Likewise.
* target-descriptions.c (struct tdesc_reg): Replace gdb_type
member by tdesc_type member.
(struct tdesc_type_field, tdesc_type_field): Add type and vector def.
(struct tdesc_type, tdesc_type_p): Likewise.
(struct tdesc_arch_reg, tdesc_arch_reg): Likewise.
(struct tdesc_feature): Change type of "types" to VEC(tdesc_type_p).
(struct tdesc_arch_data): Replace registers member by arch_regs.
(tdesc_predefined_types): Change to array of pre-defined
struct tdesc_type structures. Add "code_ptr" and "data_ptr".
(tdesc_named_type): Return struct tdesc_type * instead of GDB type.
(tdesc_gdb_type): New function.
(target_find_description): Update for data structure changes.
(tdesc_data_cleanup): Likewise.
(tdesc_numbered_register): Likewise.
(tdesc_use_registers): Likewise.
(tdesc_create_reg): Likewise.
(tdesc_find_arch_register): New function.
(tdesc_find_register): Use it.
(tdesc_register_type): Use tdesc_gdb_type to generate GDB type from
tdesc_type on demand; cache generated types in tdesc_arch_reg.
(tdesc_free_type): New function.
(tdesc_free_feature): Call it.
(tdesc_create_vector): New function.
(tdesc_create_union): Likewise.
(tdesc_add_field): Likewise.
(tdesc_record_type): Remove.
(tdesc_type_id): Remove.
(maint_print_c_tdesc_cmd): Update for data structure changes. Update
generated code to create tdesc_type structures instead of GDB types.
* xml-tdesc.c: Do not include "gdbtypes.h".
(struct tdesc_parsing_data): Change type of current_union to
struct tdesc_type *.
(tdesc_start_reg): Do not special-case "code_ptr" or "data_ptr".
(tdesc_start_union): Call tdesc_create_union.
(tdesc_start_field): Call tdesc_add_field.
(tdesc_start_vector): Call tdesc_create_vector.
(tdesc_end_union): Remove.
(feature_children): Remove reference to tdesc_end_union.
* features/arm-with-iwmmxt.c: Regenerate.
* features/mips-linux.c: Regenerate.
* features/mips64-linux.c: Regenerate.
* features/rs6000/powerpc-32.c: Regenerate.
* features/rs6000/powerpc-32l.c: Regenerate.
* features/rs6000/powerpc-403.c: Regenerate.
* features/rs6000/powerpc-403gc.c: Regenerate.
* features/rs6000/powerpc-505.c: Regenerate.
* features/rs6000/powerpc-601.c: Regenerate.
* features/rs6000/powerpc-602.c: Regenerate.
* features/rs6000/powerpc-603.c: Regenerate.
* features/rs6000/powerpc-604.c: Regenerate.
* features/rs6000/powerpc-64.c: Regenerate.
* features/rs6000/powerpc-64l.c: Regenerate.
* features/rs6000/powerpc-7400.c: Regenerate.
* features/rs6000/powerpc-750.c: Regenerate.
* features/rs6000/powerpc-860.c: Regenerate.
* features/rs6000/powerpc-altivec32.c: Regenerate.
* features/rs6000/powerpc-altivec32l.c: Regenerate.
* features/rs6000/powerpc-altivec64.c: Regenerate.
* features/rs6000/powerpc-altivec64l.c: Regenerate.
* features/rs6000/powerpc-e500.c: Regenerate.
* features/rs6000/powerpc-e500l.c: Regenerate.
* features/rs6000/powerpc-isa205-32l.c: Regenerate.
* features/rs6000/powerpc-isa205-64l.c: Regenerate.
* features/rs6000/powerpc-isa205-altivec32l.c: Regenerate.
* features/rs6000/powerpc-isa205-altivec64l.c: Regenerate.
* features/rs6000/powerpc-isa205-vsx32l.c: Regenerate.
* features/rs6000/powerpc-isa205-vsx64l.c: Regenerate.
* features/rs6000/powerpc-vsx32.c: Regenerate.
* features/rs6000/powerpc-vsx32l.c: Regenerate.
* features/rs6000/powerpc-vsx64.c: Regenerate.
* features/rs6000/powerpc-vsx64l.c: Regenerate.
* features/rs6000/rs6000.c: Regenerate.
Index: gdb-head/gdb/target-descriptions.c
===================================================================
--- gdb-head.orig/gdb/target-descriptions.c
+++ gdb-head/gdb/target-descriptions.c
@@ -79,13 +79,67 @@ typedef struct tdesc_reg
char *type;
/* The target-described type corresponding to TYPE, if found. */
- struct type *gdb_type;
+ struct tdesc_type *tdesc_type;
} *tdesc_reg_p;
DEF_VEC_P(tdesc_reg_p);
/* A named type from a target description. */
-typedef struct type *type_p;
-DEF_VEC_P(type_p);
+
+typedef struct tdesc_type_field
+{
+ char *name;
+ struct tdesc_type *type;
+} tdesc_type_field;
+DEF_VEC_O(tdesc_type_field);
+
+typedef struct tdesc_type
+{
+ /* The name of this type. */
+ char *name;
+
+ /* Identify the kind of this type. */
+ enum
+ {
+ /* Predefined types. */
+ TDESC_TYPE_INT8,
+ TDESC_TYPE_INT16,
+ TDESC_TYPE_INT32,
+ TDESC_TYPE_INT64,
+ TDESC_TYPE_INT128,
+ TDESC_TYPE_UINT8,
+ TDESC_TYPE_UINT16,
+ TDESC_TYPE_UINT32,
+ TDESC_TYPE_UINT64,
+ TDESC_TYPE_UINT128,
+ TDESC_TYPE_CODE_PTR,
+ TDESC_TYPE_DATA_PTR,
+ TDESC_TYPE_IEEE_SINGLE,
+ TDESC_TYPE_IEEE_DOUBLE,
+ TDESC_TYPE_ARM_FPA_EXT,
+
+ /* Types defined by a target feature. */
+ TDESC_TYPE_VECTOR,
+ TDESC_TYPE_UNION
+ } kind;
+
+ /* Kind-specific data. */
+ union
+ {
+ /* Vector type. */
+ struct
+ {
+ struct tdesc_type *type;
+ int count;
+ } v;
+
+ /* Union type. */
+ struct
+ {
+ VEC(tdesc_type_field) *fields;
+ } u;
+ } u;
+} *tdesc_type_p;
+DEF_VEC_P(tdesc_type_p);
/* A feature from a target description. Each feature is a collection
of other elements, e.g. registers and types. */
@@ -100,7 +154,7 @@ typedef struct tdesc_feature
VEC(tdesc_reg_p) *registers;
/* The types associated with this feature. */
- VEC(type_p) *types;
+ VEC(tdesc_type_p) *types;
} *tdesc_feature_p;
DEF_VEC_P(tdesc_feature_p);
@@ -122,15 +176,22 @@ struct target_desc
target description may be shared by multiple architectures, but
this data is private to one gdbarch. */
+typedef struct tdesc_arch_reg
+{
+ struct tdesc_reg *reg;
+ struct type *type;
+} tdesc_arch_reg;
+DEF_VEC_O(tdesc_arch_reg);
+
struct tdesc_arch_data
{
- /* A list of registers, indexed by GDB's internal register number.
+ /* A list of register/type pairs, indexed by GDB's internal register number.
During initialization of the gdbarch this list is used to store
registers which the architecture assigns a fixed register number.
Registers which are NULL in this array, or off the end, are
treated as zero-sized and nameless (i.e. placeholders in the
numbering). */
- VEC(tdesc_reg_p) *registers;
+ VEC(tdesc_arch_reg) *arch_regs;
/* Functions which report the register name, type, and reggroups for
pseudo-registers. */
@@ -218,7 +279,7 @@ target_find_description (void)
data = gdbarch_data (target_gdbarch, tdesc_data);
if (tdesc_has_registers (current_target_desc)
- && data->registers == NULL)
+ && data->arch_regs == NULL)
warning (_("Target-supplied registers are not supported "
"by the current architecture"));
}
@@ -339,51 +400,145 @@ tdesc_feature_name (const struct tdesc_f
return feature->name;
}
-/* Predefined types. Note that none of these types depend on the
- current architecture; some of the builtin_type_foo variables are
- swapped based on the architecture. */
-static struct
-{
- const char *name;
- struct type **type;
-} tdesc_predefined_types[] =
- {
- { "int8", &builtin_type_int8 },
- { "int16", &builtin_type_int16 },
- { "int32", &builtin_type_int32 },
- { "int64", &builtin_type_int64 },
- { "int128", &builtin_type_int128 },
- { "uint8", &builtin_type_uint8 },
- { "uint16", &builtin_type_uint16 },
- { "uint32", &builtin_type_uint32 },
- { "uint64", &builtin_type_uint64 },
- { "uint128", &builtin_type_uint128 },
- { "ieee_single", &builtin_type_ieee_single },
- { "ieee_double", &builtin_type_ieee_double },
- { "arm_fpa_ext", &builtin_type_arm_ext }
- };
+/* Predefined types. */
+static struct tdesc_type tdesc_predefined_types[] =
+{
+ { "int8", TDESC_TYPE_INT8 },
+ { "int16", TDESC_TYPE_INT16 },
+ { "int32", TDESC_TYPE_INT32 },
+ { "int64", TDESC_TYPE_INT64 },
+ { "int128", TDESC_TYPE_INT128 },
+ { "uint8", TDESC_TYPE_UINT8 },
+ { "uint16", TDESC_TYPE_UINT16 },
+ { "uint32", TDESC_TYPE_UINT32 },
+ { "uint64", TDESC_TYPE_UINT64 },
+ { "uint128", TDESC_TYPE_UINT128 },
+ { "code_ptr", TDESC_TYPE_CODE_PTR },
+ { "data_ptr", TDESC_TYPE_DATA_PTR },
+ { "ieee_single", TDESC_TYPE_IEEE_SINGLE },
+ { "ieee_double", TDESC_TYPE_IEEE_DOUBLE },
+ { "arm_fpa_ext", TDESC_TYPE_ARM_FPA_EXT }
+};
/* Return the type associated with ID in the context of FEATURE, or
NULL if none. */
-struct type *
+struct tdesc_type *
tdesc_named_type (const struct tdesc_feature *feature, const char *id)
{
int ix;
- struct type *gdb_type;
+ struct tdesc_type *type;
/* First try target-defined types. */
- for (ix = 0; VEC_iterate (type_p, feature->types, ix, gdb_type); ix++)
- if (strcmp (TYPE_NAME (gdb_type), id) == 0)
- return gdb_type;
+ for (ix = 0; VEC_iterate (tdesc_type_p, feature->types, ix, type); ix++)
+ if (strcmp (type->name, id) == 0)
+ return type;
/* Next try the predefined types. */
for (ix = 0; ix < ARRAY_SIZE (tdesc_predefined_types); ix++)
if (strcmp (tdesc_predefined_types[ix].name, id) == 0)
- return *tdesc_predefined_types[ix].type;
+ return &tdesc_predefined_types[ix];
return NULL;
}
+
+/* Construct, if necessary, and return the GDB type implementing target
+ type TDESC_TYPE for architecture GDBARCH. */
+
+static struct type *
+tdesc_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *tdesc_type)
+{
+ switch (tdesc_type->kind)
+ {
+ /* Predefined types. */
+ case TDESC_TYPE_INT8:
+ return builtin_type_int8;
+
+ case TDESC_TYPE_INT16:
+ return builtin_type_int16;
+
+ case TDESC_TYPE_INT32:
+ return builtin_type_int32;
+
+ case TDESC_TYPE_INT64:
+ return builtin_type_int64;
+
+ case TDESC_TYPE_INT128:
+ return builtin_type_int128;
+
+ case TDESC_TYPE_UINT8:
+ return builtin_type_uint8;
+
+ case TDESC_TYPE_UINT16:
+ return builtin_type_uint16;
+
+ case TDESC_TYPE_UINT32:
+ return builtin_type_uint32;
+
+ case TDESC_TYPE_UINT64:
+ return builtin_type_uint64;
+
+ case TDESC_TYPE_UINT128:
+ return builtin_type_uint128;
+
+ case TDESC_TYPE_CODE_PTR:
+ return builtin_type (gdbarch)->builtin_func_ptr;
+
+ case TDESC_TYPE_DATA_PTR:
+ return builtin_type (gdbarch)->builtin_data_ptr;
+
+ case TDESC_TYPE_IEEE_SINGLE:
+ return builtin_type_ieee_single;
+
+ case TDESC_TYPE_IEEE_DOUBLE:
+ return builtin_type_ieee_double;
+
+ case TDESC_TYPE_ARM_FPA_EXT:
+ return builtin_type_arm_ext;
+
+ /* Types defined by a target feature. */
+ case TDESC_TYPE_VECTOR:
+ {
+ struct type *type, *field_type;
+
+ field_type = tdesc_gdb_type (gdbarch, tdesc_type->u.v.type);
+ type = init_vector_type (field_type, tdesc_type->u.v.count);
+ TYPE_NAME (type) = xstrdup (tdesc_type->name);
+
+ return type;
+ }
+
+ case TDESC_TYPE_UNION:
+ {
+ struct type *type, *field_type;
+ struct tdesc_type_field *f;
+ int ix;
+
+ type = init_composite_type (NULL, TYPE_CODE_UNION);
+ TYPE_NAME (type) = xstrdup (tdesc_type->name);
+
+ for (ix = 0;
+ VEC_iterate (tdesc_type_field, tdesc_type->u.u.fields, ix, f);
+ ix++)
+ {
+ field_type = tdesc_gdb_type (gdbarch, f->type);
+ append_composite_type_field (type, xstrdup (f->name), field_type);
+
+ /* If any of the children of this union are vectors, flag the
+ union as a vector also. This allows e.g. a union of two
+ vector types to show up automatically in "info vector". */
+ if (TYPE_VECTOR (field_type))
+ TYPE_VECTOR (type) = 1;
+ }
+
+ return type;
+ }
+ }
+
+ internal_error (__FILE__, __LINE__,
+ "Type \"%s\" has an unknown kind %d",
+ tdesc_type->name, tdesc_type->kind);
+}
\f
/* Support for registers from target descriptions. */
@@ -417,7 +572,7 @@ tdesc_data_cleanup (void *data_untyped)
{
struct tdesc_arch_data *data = data_untyped;
- VEC_free (tdesc_reg_p, data->registers);
+ VEC_free (tdesc_arch_reg, data->arch_regs);
xfree (data);
}
@@ -446,15 +601,18 @@ tdesc_numbered_register (const struct td
struct tdesc_arch_data *data,
int regno, const char *name)
{
+ struct tdesc_arch_reg arch_reg = { 0 };
struct tdesc_reg *reg = tdesc_find_register_early (feature, name);
if (reg == NULL)
return 0;
/* Make sure the vector includes a REGNO'th element. */
- while (regno >= VEC_length (tdesc_reg_p, data->registers))
- VEC_safe_push (tdesc_reg_p, data->registers, NULL);
- VEC_replace (tdesc_reg_p, data->registers, regno, reg);
+ while (regno >= VEC_length (tdesc_arch_reg, data->arch_regs))
+ VEC_safe_push (tdesc_arch_reg, data->arch_regs, &arch_reg);
+
+ arch_reg.reg = reg;
+ VEC_replace (tdesc_arch_reg, data->arch_regs, regno, &arch_reg);
return 1;
}
@@ -490,19 +648,26 @@ tdesc_register_size (const struct tdesc_
/* Look up a register by its GDB internal register number. */
-static struct tdesc_reg *
-tdesc_find_register (struct gdbarch *gdbarch, int regno)
+static struct tdesc_arch_reg *
+tdesc_find_arch_register (struct gdbarch *gdbarch, int regno)
{
- struct tdesc_reg *reg;
+ struct tdesc_arch_reg *reg;
struct tdesc_arch_data *data;
data = gdbarch_data (gdbarch, tdesc_data);
- if (regno < VEC_length (tdesc_reg_p, data->registers))
- return VEC_index (tdesc_reg_p, data->registers, regno);
+ if (regno < VEC_length (tdesc_arch_reg, data->arch_regs))
+ return VEC_index (tdesc_arch_reg, data->arch_regs, regno);
else
return NULL;
}
+static struct tdesc_reg *
+tdesc_find_register (struct gdbarch *gdbarch, int regno)
+{
+ struct tdesc_arch_reg *reg = tdesc_find_arch_register (gdbarch, regno);
+ return reg? reg->reg : NULL;
+}
+
/* Return the name of register REGNO, from the target description or
from an architecture-provided pseudo_register_name method. */
@@ -529,7 +694,8 @@ tdesc_register_name (struct gdbarch *gdb
static struct type *
tdesc_register_type (struct gdbarch *gdbarch, int regno)
{
- struct tdesc_reg *reg = tdesc_find_register (gdbarch, regno);
+ struct tdesc_arch_reg *arch_reg = tdesc_find_arch_register (gdbarch, regno);
+ struct tdesc_reg *reg = arch_reg? arch_reg->reg : NULL;
int num_regs = gdbarch_num_regs (gdbarch);
int num_pseudo_regs = gdbarch_num_pseudo_regs (gdbarch);
@@ -544,48 +710,58 @@ tdesc_register_type (struct gdbarch *gdb
/* Return "int0_t", since "void" has a misleading size of one. */
return builtin_type_int0;
- /* First check for a predefined or target defined type. */
- if (reg->gdb_type)
- return reg->gdb_type;
-
- /* Next try size-sensitive type shortcuts. */
- if (strcmp (reg->type, "float") == 0)
- {
- if (reg->bitsize == gdbarch_float_bit (gdbarch))
- return builtin_type (gdbarch)->builtin_float;
- else if (reg->bitsize == gdbarch_double_bit (gdbarch))
- return builtin_type (gdbarch)->builtin_double;
- else if (reg->bitsize == gdbarch_long_double_bit (gdbarch))
- return builtin_type (gdbarch)->builtin_long_double;
- }
- else if (strcmp (reg->type, "int") == 0)
+ if (arch_reg->type == NULL)
{
- if (reg->bitsize == gdbarch_long_bit (gdbarch))
- return builtin_type (gdbarch)->builtin_long;
- else if (reg->bitsize == TARGET_CHAR_BIT)
- return builtin_type (gdbarch)->builtin_char;
- else if (reg->bitsize == gdbarch_short_bit (gdbarch))
- return builtin_type (gdbarch)->builtin_short;
- else if (reg->bitsize == gdbarch_int_bit (gdbarch))
- return builtin_type (gdbarch)->builtin_int;
- else if (reg->bitsize == gdbarch_long_long_bit (gdbarch))
- return builtin_type (gdbarch)->builtin_long_long;
- else if (reg->bitsize == gdbarch_ptr_bit (gdbarch))
- /* A bit desperate by this point... */
- return builtin_type (gdbarch)->builtin_data_ptr;
+ /* First check for a predefined or target defined type. */
+ if (reg->tdesc_type)
+ arch_reg->type = tdesc_gdb_type (gdbarch, reg->tdesc_type);
+
+ /* Next try size-sensitive type shortcuts. */
+ else if (strcmp (reg->type, "float") == 0)
+ {
+ if (reg->bitsize == gdbarch_float_bit (gdbarch))
+ arch_reg->type = builtin_type (gdbarch)->builtin_float;
+ else if (reg->bitsize == gdbarch_double_bit (gdbarch))
+ arch_reg->type = builtin_type (gdbarch)->builtin_double;
+ else if (reg->bitsize == gdbarch_long_double_bit (gdbarch))
+ arch_reg->type = builtin_type (gdbarch)->builtin_long_double;
+ else
+ {
+ warning (_("Register \"%s\" has an unsupported size (%d bits)"),
+ reg->name, reg->bitsize);
+ arch_reg->type = builtin_type (gdbarch)->builtin_double;
+ }
+ }
+ else if (strcmp (reg->type, "int") == 0)
+ {
+ if (reg->bitsize == gdbarch_long_bit (gdbarch))
+ arch_reg->type = builtin_type (gdbarch)->builtin_long;
+ else if (reg->bitsize == TARGET_CHAR_BIT)
+ arch_reg->type = builtin_type (gdbarch)->builtin_char;
+ else if (reg->bitsize == gdbarch_short_bit (gdbarch))
+ arch_reg->type = builtin_type (gdbarch)->builtin_short;
+ else if (reg->bitsize == gdbarch_int_bit (gdbarch))
+ arch_reg->type = builtin_type (gdbarch)->builtin_int;
+ else if (reg->bitsize == gdbarch_long_long_bit (gdbarch))
+ arch_reg->type = builtin_type (gdbarch)->builtin_long_long;
+ else if (reg->bitsize == gdbarch_ptr_bit (gdbarch))
+ /* A bit desperate by this point... */
+ arch_reg->type = builtin_type (gdbarch)->builtin_data_ptr;
+ else
+ {
+ warning (_("Register \"%s\" has an unsupported size (%d bits)"),
+ reg->name, reg->bitsize);
+ arch_reg->type = builtin_type (gdbarch)->builtin_long;
+ }
+ }
+
+ if (arch_reg->type == NULL)
+ internal_error (__FILE__, __LINE__,
+ "Register \"%s\" has an unknown type \"%s\"",
+ reg->name, reg->type);
}
- else if (strcmp (reg->type, "code_ptr") == 0)
- return builtin_type (gdbarch)->builtin_func_ptr;
- else if (strcmp (reg->type, "data_ptr") == 0)
- return builtin_type (gdbarch)->builtin_data_ptr;
- else
- internal_error (__FILE__, __LINE__,
- "Register \"%s\" has an unknown type \"%s\"",
- reg->name, reg->type);
- warning (_("Register \"%s\" has an unsupported size (%d bits)"),
- reg->name, reg->bitsize);
- return builtin_type (gdbarch)->builtin_long;
+ return arch_reg->type;
}
static int
@@ -717,6 +893,7 @@ tdesc_use_registers (struct gdbarch *gdb
struct tdesc_feature *feature;
struct tdesc_reg *reg;
struct tdesc_arch_data *data;
+ struct tdesc_arch_reg *arch_reg, new_arch_reg = { 0 };
htab_t reg_hash;
/* We can't use the description for registers if it doesn't describe
@@ -726,7 +903,7 @@ tdesc_use_registers (struct gdbarch *gdb
gdb_assert (tdesc_has_registers (target_desc));
data = gdbarch_data (gdbarch, tdesc_data);
- data->registers = early_data->registers;
+ data->arch_regs = early_data->arch_regs;
xfree (early_data);
/* Build up a set of all registers, so that we can assign register
@@ -747,18 +924,20 @@ tdesc_use_registers (struct gdbarch *gdb
/* Remove any registers which were assigned numbers by the
architecture. */
- for (ixr = 0; VEC_iterate (tdesc_reg_p, data->registers, ixr, reg); ixr++)
- if (reg)
- htab_remove_elt (reg_hash, reg);
+ for (ixr = 0;
+ VEC_iterate (tdesc_arch_reg, data->arch_regs, ixr, arch_reg);
+ ixr++)
+ if (arch_reg->reg)
+ htab_remove_elt (reg_hash, arch_reg->reg);
/* Assign numbers to the remaining registers and add them to the
list of registers. The new numbers are always above gdbarch_num_regs.
Iterate over the features, not the hash table, so that the order
matches that in the target description. */
- gdb_assert (VEC_length (tdesc_reg_p, data->registers) <= num_regs);
- while (VEC_length (tdesc_reg_p, data->registers) < num_regs)
- VEC_safe_push (tdesc_reg_p, data->registers, NULL);
+ gdb_assert (VEC_length (tdesc_arch_reg, data->arch_regs) <= num_regs);
+ while (VEC_length (tdesc_arch_reg, data->arch_regs) < num_regs)
+ VEC_safe_push (tdesc_arch_reg, data->arch_regs, &new_arch_reg);
for (ixf = 0;
VEC_iterate (tdesc_feature_p, target_desc->features, ixf, feature);
ixf++)
@@ -767,7 +946,8 @@ tdesc_use_registers (struct gdbarch *gdb
ixr++)
if (htab_find (reg_hash, reg) != NULL)
{
- VEC_safe_push (tdesc_reg_p, data->registers, reg);
+ new_arch_reg.reg = reg;
+ VEC_safe_push (tdesc_arch_reg, data->arch_regs, &new_arch_reg);
num_regs++;
}
@@ -810,27 +990,94 @@ tdesc_create_reg (struct tdesc_feature *
/* If the register's type is target-defined, look it up now. We may not
have easy access to the containing feature when we want it later. */
- reg->gdb_type = tdesc_named_type (feature, reg->type);
+ reg->tdesc_type = tdesc_named_type (feature, reg->type);
VEC_safe_push (tdesc_reg_p, feature->registers, reg);
}
static void
+tdesc_free_type (struct tdesc_type *type)
+{
+
+ switch (type->kind)
+ {
+ case TDESC_TYPE_UNION:
+ {
+ struct tdesc_type_field *f;
+ int ix;
+
+ for (ix = 0;
+ VEC_iterate (tdesc_type_field, type->u.u.fields, ix, f);
+ ix++)
+ xfree (f->name);
+
+ VEC_free (tdesc_type_field, type->u.u.fields);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ xfree (type->name);
+ xfree (type);
+}
+
+struct tdesc_type *
+tdesc_create_vector (struct tdesc_feature *feature, const char *name,
+ struct tdesc_type *field_type, int count)
+{
+ struct tdesc_type *type = XZALLOC (struct tdesc_type);
+
+ type->name = xstrdup (name);
+ type->kind = TDESC_TYPE_VECTOR;
+ type->u.v.type = field_type;
+ type->u.v.count = count;
+
+ VEC_safe_push (tdesc_type_p, feature->types, type);
+ return type;
+}
+
+struct tdesc_type *
+tdesc_create_union (struct tdesc_feature *feature, const char *name)
+{
+ struct tdesc_type *type = XZALLOC (struct tdesc_type);
+
+ type->name = xstrdup (name);
+ type->kind = TDESC_TYPE_UNION;
+
+ VEC_safe_push (tdesc_type_p, feature->types, type);
+ return type;
+}
+
+void
+tdesc_add_field (struct tdesc_type *type, const char *field_name,
+ struct tdesc_type *field_type)
+{
+ struct tdesc_type_field f = { 0 };
+
+ gdb_assert (type->kind == TDESC_TYPE_UNION);
+
+ f.name = xstrdup (field_name);
+ f.type = field_type;
+
+ VEC_safe_push (tdesc_type_field, type->u.u.fields, &f);
+}
+
+static void
tdesc_free_feature (struct tdesc_feature *feature)
{
struct tdesc_reg *reg;
+ struct tdesc_type *type;
int ix;
for (ix = 0; VEC_iterate (tdesc_reg_p, feature->registers, ix, reg); ix++)
tdesc_free_reg (reg);
VEC_free (tdesc_reg_p, feature->registers);
- /* There is no easy way to free xmalloc-allocated types, nor is
- there a way to allocate types on an obstack not associated with
- an objfile. Therefore we never free types. Since we only ever
- parse an identical XML document once, this memory leak is mostly
- contained. */
- VEC_free (type_p, feature->types);
+ for (ix = 0; VEC_iterate (tdesc_type_p, feature->types, ix, type); ix++)
+ tdesc_free_type (type);
+ VEC_free (tdesc_type_p, feature->types);
xfree (feature->name);
xfree (feature);
@@ -847,15 +1094,6 @@ tdesc_create_feature (struct target_desc
return new_feature;
}
-void
-tdesc_record_type (struct tdesc_feature *feature, struct type *type)
-{
- /* The type's ID should be used as its TYPE_NAME. */
- gdb_assert (TYPE_NAME (type) != NULL);
-
- VEC_safe_push (type_p, feature->types, type);
-}
-
struct target_desc *
allocate_target_description (void)
{
@@ -976,19 +1214,6 @@ unset_tdesc_filename_cmd (char *args, in
target_find_description ();
}
-static const char *
-tdesc_type_id (struct type *type)
-{
- int ix;
-
- for (ix = 0; ix < ARRAY_SIZE (tdesc_predefined_types); ix++)
- if (TYPE_MAIN_TYPE (*tdesc_predefined_types[ix].type)
- == TYPE_MAIN_TYPE (type))
- return tdesc_predefined_types[ix].name;
-
- return TYPE_NAME (type);
-}
-
static void
maint_print_c_tdesc_cmd (char *args, int from_tty)
{
@@ -998,7 +1223,8 @@ maint_print_c_tdesc_cmd (char *args, int
struct property *prop;
struct tdesc_feature *feature;
struct tdesc_reg *reg;
- struct type *type;
+ struct tdesc_type *type;
+ struct tdesc_type_field *f;
int ix, ix2, ix3;
/* Use the global target-supplied description, not the current
@@ -1027,7 +1253,6 @@ maint_print_c_tdesc_cmd (char *args, int
printf_unfiltered ("/* THIS FILE IS GENERATED. Original: %s */\n\n",
filename);
printf_unfiltered ("#include \"defs.h\"\n");
- printf_unfiltered ("#include \"gdbtypes.h\"\n");
printf_unfiltered ("#include \"target-descriptions.h\"\n");
printf_unfiltered ("\n");
@@ -1038,7 +1263,7 @@ maint_print_c_tdesc_cmd (char *args, int
printf_unfiltered
(" struct target_desc *result = allocate_target_description ();\n");
printf_unfiltered (" struct tdesc_feature *feature;\n");
- printf_unfiltered (" struct type *field_type, *type;\n");
+ printf_unfiltered (" struct tdesc_type *field_type, *type;\n");
printf_unfiltered ("\n");
if (tdesc_architecture (tdesc) != NULL)
@@ -1064,44 +1289,38 @@ maint_print_c_tdesc_cmd (char *args, int
feature->name);
for (ix2 = 0;
- VEC_iterate (type_p, feature->types, ix2, type);
+ VEC_iterate (tdesc_type_p, feature->types, ix2, type);
ix2++)
{
- switch (TYPE_CODE (type))
+ switch (type->kind)
{
- case TYPE_CODE_ARRAY:
+ case TDESC_TYPE_VECTOR:
printf_unfiltered
(" field_type = tdesc_named_type (feature, \"%s\");\n",
- tdesc_type_id (TYPE_TARGET_TYPE (type)));
+ type->u.v.type->name);
printf_unfiltered
- (" type = init_vector_type (field_type, %d);\n",
- TYPE_LENGTH (type) / TYPE_LENGTH (TYPE_TARGET_TYPE (type)));
- printf_unfiltered
- (" TYPE_NAME (type) = xstrdup (\"%s\");\n", TYPE_NAME (type));
+ (" tdesc_create_vector (feature, \"%s\", field_type, %d);\n",
+ type->name, type->u.v.count);
break;
- case TYPE_CODE_UNION:
- printf_unfiltered
- (" type = init_composite_type (NULL, TYPE_CODE_UNION);\n");
+ case TDESC_TYPE_UNION:
printf_unfiltered
- (" TYPE_NAME (type) = xstrdup (\"%s\");\n", TYPE_NAME (type));
- for (ix3 = 0; ix3 < TYPE_NFIELDS (type); ix3++)
+ (" type = tdesc_create_union (feature, \"%s\");\n",
+ type->name);
+ for (ix3 = 0;
+ VEC_iterate (tdesc_type_field, type->u.u.fields, ix3, f);
+ ix3++)
{
printf_unfiltered
(" field_type = tdesc_named_type (feature, \"%s\");\n",
- tdesc_type_id (TYPE_FIELD_TYPE (type, ix3)));
+ f->type->name);
printf_unfiltered
- (" append_composite_type_field (type, "
- "xstrdup (\"%s\"), field_type);\n",
- TYPE_FIELD_NAME (type, ix3));
+ (" tdesc_add_field (type, \"%s\", field_type);\n",
+ f->name);
}
- if (TYPE_VECTOR (type))
- printf_unfiltered
- (" TYPE_VECTOR (type) = 1;\n");
break;
default:
- error (_("C output is not supported type \"%s\"."), TYPE_NAME (type));
+ error (_("C output is not supported type \"%s\"."), type->name);
}
- printf_unfiltered (" tdesc_record_type (feature, type);\n");
printf_unfiltered ("\n");
}
Index: gdb-head/gdb/target-descriptions.h
===================================================================
--- gdb-head.orig/gdb/target-descriptions.h
+++ gdb-head/gdb/target-descriptions.h
@@ -24,10 +24,10 @@
struct tdesc_feature;
struct tdesc_arch_data;
+struct tdesc_type;
struct tdesc_reg;
struct target_desc;
struct target_ops;
-struct type;
/* Fetch the current target's description, and switch the current
architecture to one which incorporates that description. */
@@ -146,8 +146,8 @@ const char *tdesc_feature_name (const st
/* Return the type associated with ID in the context of FEATURE, or
NULL if none. */
-struct type *tdesc_named_type (const struct tdesc_feature *feature,
- const char *id);
+struct tdesc_type *tdesc_named_type (const struct tdesc_feature *feature,
+ const char *id);
/* Return the name of register REGNO, from the target description or
from an architecture-provided pseudo_register_name method. */
@@ -172,8 +172,14 @@ void set_tdesc_property (struct target_d
struct tdesc_feature *tdesc_create_feature (struct target_desc *tdesc,
const char *name);
-void tdesc_record_type (struct tdesc_feature *feature, struct type *type);
-
+struct tdesc_type *tdesc_create_vector (struct tdesc_feature *feature,
+ const char *name,
+ struct tdesc_type *field_type,
+ int count);
+struct tdesc_type *tdesc_create_union (struct tdesc_feature *feature,
+ const char *name);
+void tdesc_add_field (struct tdesc_type *type, const char *field_name,
+ struct tdesc_type *field_type);
void tdesc_create_reg (struct tdesc_feature *feature, const char *name,
int regnum, int save_restore, const char *group,
int bitsize, const char *type);
Index: gdb-head/gdb/xml-tdesc.c
===================================================================
--- gdb-head.orig/gdb/xml-tdesc.c
+++ gdb-head/gdb/xml-tdesc.c
@@ -20,7 +20,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
-#include "gdbtypes.h"
#include "target.h"
#include "target-descriptions.h"
#include "xml-support.h"
@@ -86,7 +85,7 @@ struct tdesc_parsing_data
int next_regnum;
/* The union we are currently parsing, or last parsed. */
- struct type *current_union;
+ struct tdesc_type *current_union;
};
/* Handle the end of an <architecture> element and its value. */
@@ -176,8 +175,6 @@ tdesc_start_reg (struct gdb_xml_parser *
if (strcmp (type, "int") != 0
&& strcmp (type, "float") != 0
- && strcmp (type, "code_ptr") != 0
- && strcmp (type, "data_ptr") != 0
&& tdesc_named_type (data->current_feature, type) == NULL)
gdb_xml_error (parser, _("Register \"%s\" has unknown type \"%s\""),
name, type);
@@ -198,33 +195,8 @@ tdesc_start_union (struct gdb_xml_parser
{
struct tdesc_parsing_data *data = user_data;
char *id = VEC_index (gdb_xml_value_s, attributes, 0)->value;
- struct type *type;
- type = init_composite_type (NULL, TYPE_CODE_UNION);
- TYPE_NAME (type) = xstrdup (id);
- tdesc_record_type (data->current_feature, type);
- data->current_union = type;
-}
-
-/* Handle the end of a <union> element. */
-
-static void
-tdesc_end_union (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, const char *body_text)
-{
- struct tdesc_parsing_data *data = user_data;
- int i;
-
- /* If any of the children of this union are vectors, flag the union
- as a vector also. This allows e.g. a union of two vector types
- to show up automatically in "info vector". */
- for (i = 0; i < TYPE_NFIELDS (data->current_union); i++)
- if (TYPE_VECTOR (TYPE_FIELD_TYPE (data->current_union, i)))
- {
- TYPE_VECTOR (data->current_union) = 1;
- break;
- }
+ data->current_union = tdesc_create_union (data->current_feature, id);
}
/* Handle the start of a <field> element. Attach the field to the
@@ -237,7 +209,7 @@ tdesc_start_field (struct gdb_xml_parser
{
struct tdesc_parsing_data *data = user_data;
struct gdb_xml_value *attrs = VEC_address (gdb_xml_value_s, attributes);
- struct type *type, *field_type;
+ struct tdesc_type *field_type;
char *field_name, *field_type_id;
field_name = attrs[0].value;
@@ -249,8 +221,7 @@ tdesc_start_field (struct gdb_xml_parser
"type \"%s\""),
field_name, field_type_id);
- append_composite_type_field (data->current_union, xstrdup (field_name),
- field_type);
+ tdesc_add_field (data->current_union, field_name, field_type);
}
/* Handle the start of a <vector> element. Initialize the type and
@@ -263,7 +234,7 @@ tdesc_start_vector (struct gdb_xml_parse
{
struct tdesc_parsing_data *data = user_data;
struct gdb_xml_value *attrs = VEC_address (gdb_xml_value_s, attributes);
- struct type *type, *field_type, *range_type;
+ struct tdesc_type *field_type;
char *id, *field_type_id;
int count;
@@ -276,10 +247,7 @@ tdesc_start_vector (struct gdb_xml_parse
gdb_xml_error (parser, _("Vector \"%s\" references undefined type \"%s\""),
id, field_type_id);
- type = init_vector_type (field_type, count);
- TYPE_NAME (type) = xstrdup (id);
-
- tdesc_record_type (data->current_feature, type);
+ tdesc_create_vector (data->current_feature, id, field_type, count);
}
/* The elements and attributes of an XML target description. */
@@ -330,7 +298,7 @@ static const struct gdb_xml_element feat
tdesc_start_reg, NULL },
{ "union", union_attributes, union_children,
GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
- tdesc_start_union, tdesc_end_union },
+ tdesc_start_union, NULL },
{ "vector", vector_attributes, NULL,
GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
tdesc_start_vector, NULL },
Index: gdb-head/gdb/features/arm-with-iwmmxt.c
===================================================================
--- gdb-head.orig/gdb/features/arm-with-iwmmxt.c
+++ gdb-head/gdb/features/arm-with-iwmmxt.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: arm-with-iwmmxt.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_arm_with_iwmmxt;
@@ -10,7 +9,7 @@ initialize_tdesc_arm_with_iwmmxt (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("iwmmxt"));
@@ -35,32 +34,23 @@ initialize_tdesc_arm_with_iwmmxt (void)
feature = tdesc_create_feature (result, "org.gnu.gdb.xscale.iwmmxt");
field_type = tdesc_named_type (feature, "uint8");
- type = init_vector_type (field_type, 8);
- TYPE_NAME (type) = xstrdup ("iwmmxt_v8u8");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "iwmmxt_v8u8", field_type, 8);
field_type = tdesc_named_type (feature, "uint16");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("iwmmxt_v4u16");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "iwmmxt_v4u16", field_type, 4);
field_type = tdesc_named_type (feature, "uint32");
- type = init_vector_type (field_type, 2);
- TYPE_NAME (type) = xstrdup ("iwmmxt_v2u32");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "iwmmxt_v2u32", field_type, 2);
- type = init_composite_type (NULL, TYPE_CODE_UNION);
- TYPE_NAME (type) = xstrdup ("iwmmxt_vec64i");
+ type = tdesc_create_union (feature, "iwmmxt_vec64i");
field_type = tdesc_named_type (feature, "iwmmxt_v8u8");
- append_composite_type_field (type, xstrdup ("u8"), field_type);
+ tdesc_add_field (type, "u8", field_type);
field_type = tdesc_named_type (feature, "iwmmxt_v4u16");
- append_composite_type_field (type, xstrdup ("u16"), field_type);
+ tdesc_add_field (type, "u16", field_type);
field_type = tdesc_named_type (feature, "iwmmxt_v2u32");
- append_composite_type_field (type, xstrdup ("u32"), field_type);
+ tdesc_add_field (type, "u32", field_type);
field_type = tdesc_named_type (feature, "uint64");
- append_composite_type_field (type, xstrdup ("u64"), field_type);
- TYPE_VECTOR (type) = 1;
- tdesc_record_type (feature, type);
+ tdesc_add_field (type, "u64", field_type);
tdesc_create_reg (feature, "wR0", 26, 1, NULL, 64, "iwmmxt_vec64i");
tdesc_create_reg (feature, "wR1", 27, 1, NULL, 64, "iwmmxt_vec64i");
Index: gdb-head/gdb/features/mips-linux.c
===================================================================
--- gdb-head.orig/gdb/features/mips-linux.c
+++ gdb-head/gdb/features/mips-linux.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: mips-linux.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_mips_linux;
@@ -10,7 +9,7 @@ initialize_tdesc_mips_linux (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("mips"));
Index: gdb-head/gdb/features/mips64-linux.c
===================================================================
--- gdb-head.orig/gdb/features/mips64-linux.c
+++ gdb-head/gdb/features/mips64-linux.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: mips64-linux.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_mips64_linux;
@@ -10,7 +9,7 @@ initialize_tdesc_mips64_linux (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("mips"));
Index: gdb-head/gdb/features/rs6000/powerpc-32.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-32.c
+++ gdb-head/gdb/features/rs6000/powerpc-32.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-32.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_32;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_32 (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common"));
Index: gdb-head/gdb/features/rs6000/powerpc-32l.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-32l.c
+++ gdb-head/gdb/features/rs6000/powerpc-32l.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-32l.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_32l;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_32l (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common"));
Index: gdb-head/gdb/features/rs6000/powerpc-403.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-403.c
+++ gdb-head/gdb/features/rs6000/powerpc-403.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-403.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_403;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_403 (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
Index: gdb-head/gdb/features/rs6000/powerpc-403gc.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-403gc.c
+++ gdb-head/gdb/features/rs6000/powerpc-403gc.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-403gc.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_403gc;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_403gc (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
Index: gdb-head/gdb/features/rs6000/powerpc-505.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-505.c
+++ gdb-head/gdb/features/rs6000/powerpc-505.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-505.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_505;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_505 (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
Index: gdb-head/gdb/features/rs6000/powerpc-601.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-601.c
+++ gdb-head/gdb/features/rs6000/powerpc-601.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-601.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_601;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_601 (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
Index: gdb-head/gdb/features/rs6000/powerpc-602.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-602.c
+++ gdb-head/gdb/features/rs6000/powerpc-602.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-602.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_602;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_602 (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
Index: gdb-head/gdb/features/rs6000/powerpc-603.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-603.c
+++ gdb-head/gdb/features/rs6000/powerpc-603.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-603.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_603;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_603 (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
Index: gdb-head/gdb/features/rs6000/powerpc-604.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-604.c
+++ gdb-head/gdb/features/rs6000/powerpc-604.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-604.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_604;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_604 (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
Index: gdb-head/gdb/features/rs6000/powerpc-64.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-64.c
+++ gdb-head/gdb/features/rs6000/powerpc-64.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-64.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_64;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_64 (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common64"));
Index: gdb-head/gdb/features/rs6000/powerpc-64l.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-64l.c
+++ gdb-head/gdb/features/rs6000/powerpc-64l.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-64l.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_64l;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_64l (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common64"));
Index: gdb-head/gdb/features/rs6000/powerpc-7400.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-7400.c
+++ gdb-head/gdb/features/rs6000/powerpc-7400.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-7400.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_7400;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_7400 (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
@@ -139,39 +138,28 @@ initialize_tdesc_powerpc_7400 (void)
feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec");
field_type = tdesc_named_type (feature, "ieee_single");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4f");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4f", field_type, 4);
field_type = tdesc_named_type (feature, "int32");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4i32");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4i32", field_type, 4);
field_type = tdesc_named_type (feature, "int16");
- type = init_vector_type (field_type, 8);
- TYPE_NAME (type) = xstrdup ("v8i16");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v8i16", field_type, 8);
field_type = tdesc_named_type (feature, "int8");
- type = init_vector_type (field_type, 16);
- TYPE_NAME (type) = xstrdup ("v16i8");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v16i8", field_type, 16);
- type = init_composite_type (NULL, TYPE_CODE_UNION);
- TYPE_NAME (type) = xstrdup ("vec128");
+ type = tdesc_create_union (feature, "vec128");
field_type = tdesc_named_type (feature, "uint128");
- append_composite_type_field (type, xstrdup ("uint128"), field_type);
+ tdesc_add_field (type, "uint128", field_type);
field_type = tdesc_named_type (feature, "v4f");
- append_composite_type_field (type, xstrdup ("v4_float"), field_type);
+ tdesc_add_field (type, "v4_float", field_type);
field_type = tdesc_named_type (feature, "v4i32");
- append_composite_type_field (type, xstrdup ("v4_int32"), field_type);
+ tdesc_add_field (type, "v4_int32", field_type);
field_type = tdesc_named_type (feature, "v8i16");
- append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
+ tdesc_add_field (type, "v8_int16", field_type);
field_type = tdesc_named_type (feature, "v16i8");
- append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_VECTOR (type) = 1;
- tdesc_record_type (feature, type);
+ tdesc_add_field (type, "v16_int8", field_type);
tdesc_create_reg (feature, "vr0", 119, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "vr1", 120, 1, NULL, 128, "vec128");
Index: gdb-head/gdb/features/rs6000/powerpc-750.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-750.c
+++ gdb-head/gdb/features/rs6000/powerpc-750.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-750.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_750;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_750 (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
Index: gdb-head/gdb/features/rs6000/powerpc-860.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-860.c
+++ gdb-head/gdb/features/rs6000/powerpc-860.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-860.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_860;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_860 (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
Index: gdb-head/gdb/features/rs6000/powerpc-altivec32.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-altivec32.c
+++ gdb-head/gdb/features/rs6000/powerpc-altivec32.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-altivec32.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_altivec32;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_altivec32 (void
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common"));
@@ -91,39 +90,28 @@ initialize_tdesc_powerpc_altivec32 (void
feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec");
field_type = tdesc_named_type (feature, "ieee_single");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4f");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4f", field_type, 4);
field_type = tdesc_named_type (feature, "int32");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4i32");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4i32", field_type, 4);
field_type = tdesc_named_type (feature, "int16");
- type = init_vector_type (field_type, 8);
- TYPE_NAME (type) = xstrdup ("v8i16");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v8i16", field_type, 8);
field_type = tdesc_named_type (feature, "int8");
- type = init_vector_type (field_type, 16);
- TYPE_NAME (type) = xstrdup ("v16i8");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v16i8", field_type, 16);
- type = init_composite_type (NULL, TYPE_CODE_UNION);
- TYPE_NAME (type) = xstrdup ("vec128");
+ type = tdesc_create_union (feature, "vec128");
field_type = tdesc_named_type (feature, "uint128");
- append_composite_type_field (type, xstrdup ("uint128"), field_type);
+ tdesc_add_field (type, "uint128", field_type);
field_type = tdesc_named_type (feature, "v4f");
- append_composite_type_field (type, xstrdup ("v4_float"), field_type);
+ tdesc_add_field (type, "v4_float", field_type);
field_type = tdesc_named_type (feature, "v4i32");
- append_composite_type_field (type, xstrdup ("v4_int32"), field_type);
+ tdesc_add_field (type, "v4_int32", field_type);
field_type = tdesc_named_type (feature, "v8i16");
- append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
+ tdesc_add_field (type, "v8_int16", field_type);
field_type = tdesc_named_type (feature, "v16i8");
- append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_VECTOR (type) = 1;
- tdesc_record_type (feature, type);
+ tdesc_add_field (type, "v16_int8", field_type);
tdesc_create_reg (feature, "vr0", 71, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "vr1", 72, 1, NULL, 128, "vec128");
Index: gdb-head/gdb/features/rs6000/powerpc-altivec32l.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-altivec32l.c
+++ gdb-head/gdb/features/rs6000/powerpc-altivec32l.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-altivec32l.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_altivec32l;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_altivec32l (voi
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common"));
@@ -95,39 +94,28 @@ initialize_tdesc_powerpc_altivec32l (voi
feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec");
field_type = tdesc_named_type (feature, "ieee_single");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4f");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4f", field_type, 4);
field_type = tdesc_named_type (feature, "int32");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4i32");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4i32", field_type, 4);
field_type = tdesc_named_type (feature, "int16");
- type = init_vector_type (field_type, 8);
- TYPE_NAME (type) = xstrdup ("v8i16");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v8i16", field_type, 8);
field_type = tdesc_named_type (feature, "int8");
- type = init_vector_type (field_type, 16);
- TYPE_NAME (type) = xstrdup ("v16i8");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v16i8", field_type, 16);
- type = init_composite_type (NULL, TYPE_CODE_UNION);
- TYPE_NAME (type) = xstrdup ("vec128");
+ type = tdesc_create_union (feature, "vec128");
field_type = tdesc_named_type (feature, "uint128");
- append_composite_type_field (type, xstrdup ("uint128"), field_type);
+ tdesc_add_field (type, "uint128", field_type);
field_type = tdesc_named_type (feature, "v4f");
- append_composite_type_field (type, xstrdup ("v4_float"), field_type);
+ tdesc_add_field (type, "v4_float", field_type);
field_type = tdesc_named_type (feature, "v4i32");
- append_composite_type_field (type, xstrdup ("v4_int32"), field_type);
+ tdesc_add_field (type, "v4_int32", field_type);
field_type = tdesc_named_type (feature, "v8i16");
- append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
+ tdesc_add_field (type, "v8_int16", field_type);
field_type = tdesc_named_type (feature, "v16i8");
- append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_VECTOR (type) = 1;
- tdesc_record_type (feature, type);
+ tdesc_add_field (type, "v16_int8", field_type);
tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128");
Index: gdb-head/gdb/features/rs6000/powerpc-altivec64.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-altivec64.c
+++ gdb-head/gdb/features/rs6000/powerpc-altivec64.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-altivec64.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_altivec64;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_altivec64 (void
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common64"));
@@ -91,39 +90,28 @@ initialize_tdesc_powerpc_altivec64 (void
feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec");
field_type = tdesc_named_type (feature, "ieee_single");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4f");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4f", field_type, 4);
field_type = tdesc_named_type (feature, "int32");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4i32");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4i32", field_type, 4);
field_type = tdesc_named_type (feature, "int16");
- type = init_vector_type (field_type, 8);
- TYPE_NAME (type) = xstrdup ("v8i16");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v8i16", field_type, 8);
field_type = tdesc_named_type (feature, "int8");
- type = init_vector_type (field_type, 16);
- TYPE_NAME (type) = xstrdup ("v16i8");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v16i8", field_type, 16);
- type = init_composite_type (NULL, TYPE_CODE_UNION);
- TYPE_NAME (type) = xstrdup ("vec128");
+ type = tdesc_create_union (feature, "vec128");
field_type = tdesc_named_type (feature, "uint128");
- append_composite_type_field (type, xstrdup ("uint128"), field_type);
+ tdesc_add_field (type, "uint128", field_type);
field_type = tdesc_named_type (feature, "v4f");
- append_composite_type_field (type, xstrdup ("v4_float"), field_type);
+ tdesc_add_field (type, "v4_float", field_type);
field_type = tdesc_named_type (feature, "v4i32");
- append_composite_type_field (type, xstrdup ("v4_int32"), field_type);
+ tdesc_add_field (type, "v4_int32", field_type);
field_type = tdesc_named_type (feature, "v8i16");
- append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
+ tdesc_add_field (type, "v8_int16", field_type);
field_type = tdesc_named_type (feature, "v16i8");
- append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_VECTOR (type) = 1;
- tdesc_record_type (feature, type);
+ tdesc_add_field (type, "v16_int8", field_type);
tdesc_create_reg (feature, "vr0", 71, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "vr1", 72, 1, NULL, 128, "vec128");
Index: gdb-head/gdb/features/rs6000/powerpc-altivec64l.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-altivec64l.c
+++ gdb-head/gdb/features/rs6000/powerpc-altivec64l.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-altivec64l.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_altivec64l;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_altivec64l (voi
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common64"));
@@ -95,39 +94,28 @@ initialize_tdesc_powerpc_altivec64l (voi
feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec");
field_type = tdesc_named_type (feature, "ieee_single");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4f");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4f", field_type, 4);
field_type = tdesc_named_type (feature, "int32");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4i32");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4i32", field_type, 4);
field_type = tdesc_named_type (feature, "int16");
- type = init_vector_type (field_type, 8);
- TYPE_NAME (type) = xstrdup ("v8i16");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v8i16", field_type, 8);
field_type = tdesc_named_type (feature, "int8");
- type = init_vector_type (field_type, 16);
- TYPE_NAME (type) = xstrdup ("v16i8");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v16i8", field_type, 16);
- type = init_composite_type (NULL, TYPE_CODE_UNION);
- TYPE_NAME (type) = xstrdup ("vec128");
+ type = tdesc_create_union (feature, "vec128");
field_type = tdesc_named_type (feature, "uint128");
- append_composite_type_field (type, xstrdup ("uint128"), field_type);
+ tdesc_add_field (type, "uint128", field_type);
field_type = tdesc_named_type (feature, "v4f");
- append_composite_type_field (type, xstrdup ("v4_float"), field_type);
+ tdesc_add_field (type, "v4_float", field_type);
field_type = tdesc_named_type (feature, "v4i32");
- append_composite_type_field (type, xstrdup ("v4_int32"), field_type);
+ tdesc_add_field (type, "v4_int32", field_type);
field_type = tdesc_named_type (feature, "v8i16");
- append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
+ tdesc_add_field (type, "v8_int16", field_type);
field_type = tdesc_named_type (feature, "v16i8");
- append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_VECTOR (type) = 1;
- tdesc_record_type (feature, type);
+ tdesc_add_field (type, "v16_int8", field_type);
tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128");
Index: gdb-head/gdb/features/rs6000/powerpc-e500.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-e500.c
+++ gdb-head/gdb/features/rs6000/powerpc-e500.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-e500.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_e500;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_e500 (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:e500"));
Index: gdb-head/gdb/features/rs6000/powerpc-e500l.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-e500l.c
+++ gdb-head/gdb/features/rs6000/powerpc-e500l.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-e500l.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_e500l;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_e500l (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:e500"));
Index: gdb-head/gdb/features/rs6000/powerpc-isa205-32l.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-isa205-32l.c
+++ gdb-head/gdb/features/rs6000/powerpc-isa205-32l.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-isa205-32l.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_isa205_32l;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_isa205_32l (voi
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common"));
Index: gdb-head/gdb/features/rs6000/powerpc-isa205-64l.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-isa205-64l.c
+++ gdb-head/gdb/features/rs6000/powerpc-isa205-64l.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-isa205-64l.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_isa205_64l;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_isa205_64l (voi
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common64"));
Index: gdb-head/gdb/features/rs6000/powerpc-isa205-altivec32l.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-isa205-altivec32l.c
+++ gdb-head/gdb/features/rs6000/powerpc-isa205-altivec32l.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-isa205-altivec32l.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_isa205_altivec32l;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_isa205_altivec3
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common"));
@@ -95,39 +94,28 @@ initialize_tdesc_powerpc_isa205_altivec3
feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec");
field_type = tdesc_named_type (feature, "ieee_single");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4f");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4f", field_type, 4);
field_type = tdesc_named_type (feature, "int32");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4i32");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4i32", field_type, 4);
field_type = tdesc_named_type (feature, "int16");
- type = init_vector_type (field_type, 8);
- TYPE_NAME (type) = xstrdup ("v8i16");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v8i16", field_type, 8);
field_type = tdesc_named_type (feature, "int8");
- type = init_vector_type (field_type, 16);
- TYPE_NAME (type) = xstrdup ("v16i8");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v16i8", field_type, 16);
- type = init_composite_type (NULL, TYPE_CODE_UNION);
- TYPE_NAME (type) = xstrdup ("vec128");
+ type = tdesc_create_union (feature, "vec128");
field_type = tdesc_named_type (feature, "uint128");
- append_composite_type_field (type, xstrdup ("uint128"), field_type);
+ tdesc_add_field (type, "uint128", field_type);
field_type = tdesc_named_type (feature, "v4f");
- append_composite_type_field (type, xstrdup ("v4_float"), field_type);
+ tdesc_add_field (type, "v4_float", field_type);
field_type = tdesc_named_type (feature, "v4i32");
- append_composite_type_field (type, xstrdup ("v4_int32"), field_type);
+ tdesc_add_field (type, "v4_int32", field_type);
field_type = tdesc_named_type (feature, "v8i16");
- append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
+ tdesc_add_field (type, "v8_int16", field_type);
field_type = tdesc_named_type (feature, "v16i8");
- append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_VECTOR (type) = 1;
- tdesc_record_type (feature, type);
+ tdesc_add_field (type, "v16_int8", field_type);
tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128");
Index: gdb-head/gdb/features/rs6000/powerpc-isa205-altivec64l.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-isa205-altivec64l.c
+++ gdb-head/gdb/features/rs6000/powerpc-isa205-altivec64l.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-isa205-altivec64l.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_isa205_altivec64l;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_isa205_altivec6
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common64"));
@@ -95,39 +94,28 @@ initialize_tdesc_powerpc_isa205_altivec6
feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec");
field_type = tdesc_named_type (feature, "ieee_single");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4f");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4f", field_type, 4);
field_type = tdesc_named_type (feature, "int32");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4i32");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4i32", field_type, 4);
field_type = tdesc_named_type (feature, "int16");
- type = init_vector_type (field_type, 8);
- TYPE_NAME (type) = xstrdup ("v8i16");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v8i16", field_type, 8);
field_type = tdesc_named_type (feature, "int8");
- type = init_vector_type (field_type, 16);
- TYPE_NAME (type) = xstrdup ("v16i8");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v16i8", field_type, 16);
- type = init_composite_type (NULL, TYPE_CODE_UNION);
- TYPE_NAME (type) = xstrdup ("vec128");
+ type = tdesc_create_union (feature, "vec128");
field_type = tdesc_named_type (feature, "uint128");
- append_composite_type_field (type, xstrdup ("uint128"), field_type);
+ tdesc_add_field (type, "uint128", field_type);
field_type = tdesc_named_type (feature, "v4f");
- append_composite_type_field (type, xstrdup ("v4_float"), field_type);
+ tdesc_add_field (type, "v4_float", field_type);
field_type = tdesc_named_type (feature, "v4i32");
- append_composite_type_field (type, xstrdup ("v4_int32"), field_type);
+ tdesc_add_field (type, "v4_int32", field_type);
field_type = tdesc_named_type (feature, "v8i16");
- append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
+ tdesc_add_field (type, "v8_int16", field_type);
field_type = tdesc_named_type (feature, "v16i8");
- append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_VECTOR (type) = 1;
- tdesc_record_type (feature, type);
+ tdesc_add_field (type, "v16_int8", field_type);
tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128");
Index: gdb-head/gdb/features/rs6000/powerpc-isa205-vsx32l.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-isa205-vsx32l.c
+++ gdb-head/gdb/features/rs6000/powerpc-isa205-vsx32l.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-isa205-vsx32l.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_isa205_vsx32l;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_isa205_vsx32l (
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common"));
@@ -95,39 +94,28 @@ initialize_tdesc_powerpc_isa205_vsx32l (
feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec");
field_type = tdesc_named_type (feature, "ieee_single");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4f");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4f", field_type, 4);
field_type = tdesc_named_type (feature, "int32");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4i32");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4i32", field_type, 4);
field_type = tdesc_named_type (feature, "int16");
- type = init_vector_type (field_type, 8);
- TYPE_NAME (type) = xstrdup ("v8i16");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v8i16", field_type, 8);
field_type = tdesc_named_type (feature, "int8");
- type = init_vector_type (field_type, 16);
- TYPE_NAME (type) = xstrdup ("v16i8");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v16i8", field_type, 16);
- type = init_composite_type (NULL, TYPE_CODE_UNION);
- TYPE_NAME (type) = xstrdup ("vec128");
+ type = tdesc_create_union (feature, "vec128");
field_type = tdesc_named_type (feature, "uint128");
- append_composite_type_field (type, xstrdup ("uint128"), field_type);
+ tdesc_add_field (type, "uint128", field_type);
field_type = tdesc_named_type (feature, "v4f");
- append_composite_type_field (type, xstrdup ("v4_float"), field_type);
+ tdesc_add_field (type, "v4_float", field_type);
field_type = tdesc_named_type (feature, "v4i32");
- append_composite_type_field (type, xstrdup ("v4_int32"), field_type);
+ tdesc_add_field (type, "v4_int32", field_type);
field_type = tdesc_named_type (feature, "v8i16");
- append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
+ tdesc_add_field (type, "v8_int16", field_type);
field_type = tdesc_named_type (feature, "v16i8");
- append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_VECTOR (type) = 1;
- tdesc_record_type (feature, type);
+ tdesc_add_field (type, "v16_int8", field_type);
tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128");
Index: gdb-head/gdb/features/rs6000/powerpc-isa205-vsx64l.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-isa205-vsx64l.c
+++ gdb-head/gdb/features/rs6000/powerpc-isa205-vsx64l.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-isa205-vsx64l.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_isa205_vsx64l;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_isa205_vsx64l (
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common64"));
@@ -95,39 +94,28 @@ initialize_tdesc_powerpc_isa205_vsx64l (
feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec");
field_type = tdesc_named_type (feature, "ieee_single");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4f");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4f", field_type, 4);
field_type = tdesc_named_type (feature, "int32");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4i32");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4i32", field_type, 4);
field_type = tdesc_named_type (feature, "int16");
- type = init_vector_type (field_type, 8);
- TYPE_NAME (type) = xstrdup ("v8i16");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v8i16", field_type, 8);
field_type = tdesc_named_type (feature, "int8");
- type = init_vector_type (field_type, 16);
- TYPE_NAME (type) = xstrdup ("v16i8");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v16i8", field_type, 16);
- type = init_composite_type (NULL, TYPE_CODE_UNION);
- TYPE_NAME (type) = xstrdup ("vec128");
+ type = tdesc_create_union (feature, "vec128");
field_type = tdesc_named_type (feature, "uint128");
- append_composite_type_field (type, xstrdup ("uint128"), field_type);
+ tdesc_add_field (type, "uint128", field_type);
field_type = tdesc_named_type (feature, "v4f");
- append_composite_type_field (type, xstrdup ("v4_float"), field_type);
+ tdesc_add_field (type, "v4_float", field_type);
field_type = tdesc_named_type (feature, "v4i32");
- append_composite_type_field (type, xstrdup ("v4_int32"), field_type);
+ tdesc_add_field (type, "v4_int32", field_type);
field_type = tdesc_named_type (feature, "v8i16");
- append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
+ tdesc_add_field (type, "v8_int16", field_type);
field_type = tdesc_named_type (feature, "v16i8");
- append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_VECTOR (type) = 1;
- tdesc_record_type (feature, type);
+ tdesc_add_field (type, "v16_int8", field_type);
tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128");
Index: gdb-head/gdb/features/rs6000/powerpc-vsx32.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-vsx32.c
+++ gdb-head/gdb/features/rs6000/powerpc-vsx32.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-vsx32.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_vsx32;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_vsx32 (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common"));
@@ -91,39 +90,28 @@ initialize_tdesc_powerpc_vsx32 (void)
feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec");
field_type = tdesc_named_type (feature, "ieee_single");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4f");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4f", field_type, 4);
field_type = tdesc_named_type (feature, "int32");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4i32");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4i32", field_type, 4);
field_type = tdesc_named_type (feature, "int16");
- type = init_vector_type (field_type, 8);
- TYPE_NAME (type) = xstrdup ("v8i16");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v8i16", field_type, 8);
field_type = tdesc_named_type (feature, "int8");
- type = init_vector_type (field_type, 16);
- TYPE_NAME (type) = xstrdup ("v16i8");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v16i8", field_type, 16);
- type = init_composite_type (NULL, TYPE_CODE_UNION);
- TYPE_NAME (type) = xstrdup ("vec128");
+ type = tdesc_create_union (feature, "vec128");
field_type = tdesc_named_type (feature, "uint128");
- append_composite_type_field (type, xstrdup ("uint128"), field_type);
+ tdesc_add_field (type, "uint128", field_type);
field_type = tdesc_named_type (feature, "v4f");
- append_composite_type_field (type, xstrdup ("v4_float"), field_type);
+ tdesc_add_field (type, "v4_float", field_type);
field_type = tdesc_named_type (feature, "v4i32");
- append_composite_type_field (type, xstrdup ("v4_int32"), field_type);
+ tdesc_add_field (type, "v4_int32", field_type);
field_type = tdesc_named_type (feature, "v8i16");
- append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
+ tdesc_add_field (type, "v8_int16", field_type);
field_type = tdesc_named_type (feature, "v16i8");
- append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_VECTOR (type) = 1;
- tdesc_record_type (feature, type);
+ tdesc_add_field (type, "v16_int8", field_type);
tdesc_create_reg (feature, "vr0", 71, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "vr1", 72, 1, NULL, 128, "vec128");
Index: gdb-head/gdb/features/rs6000/powerpc-vsx32l.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-vsx32l.c
+++ gdb-head/gdb/features/rs6000/powerpc-vsx32l.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-vsx32l.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_vsx32l;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_vsx32l (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common"));
@@ -95,39 +94,28 @@ initialize_tdesc_powerpc_vsx32l (void)
feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec");
field_type = tdesc_named_type (feature, "ieee_single");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4f");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4f", field_type, 4);
field_type = tdesc_named_type (feature, "int32");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4i32");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4i32", field_type, 4);
field_type = tdesc_named_type (feature, "int16");
- type = init_vector_type (field_type, 8);
- TYPE_NAME (type) = xstrdup ("v8i16");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v8i16", field_type, 8);
field_type = tdesc_named_type (feature, "int8");
- type = init_vector_type (field_type, 16);
- TYPE_NAME (type) = xstrdup ("v16i8");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v16i8", field_type, 16);
- type = init_composite_type (NULL, TYPE_CODE_UNION);
- TYPE_NAME (type) = xstrdup ("vec128");
+ type = tdesc_create_union (feature, "vec128");
field_type = tdesc_named_type (feature, "uint128");
- append_composite_type_field (type, xstrdup ("uint128"), field_type);
+ tdesc_add_field (type, "uint128", field_type);
field_type = tdesc_named_type (feature, "v4f");
- append_composite_type_field (type, xstrdup ("v4_float"), field_type);
+ tdesc_add_field (type, "v4_float", field_type);
field_type = tdesc_named_type (feature, "v4i32");
- append_composite_type_field (type, xstrdup ("v4_int32"), field_type);
+ tdesc_add_field (type, "v4_int32", field_type);
field_type = tdesc_named_type (feature, "v8i16");
- append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
+ tdesc_add_field (type, "v8_int16", field_type);
field_type = tdesc_named_type (feature, "v16i8");
- append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_VECTOR (type) = 1;
- tdesc_record_type (feature, type);
+ tdesc_add_field (type, "v16_int8", field_type);
tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128");
Index: gdb-head/gdb/features/rs6000/powerpc-vsx64.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-vsx64.c
+++ gdb-head/gdb/features/rs6000/powerpc-vsx64.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-vsx64.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_vsx64;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_vsx64 (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common64"));
@@ -91,39 +90,28 @@ initialize_tdesc_powerpc_vsx64 (void)
feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec");
field_type = tdesc_named_type (feature, "ieee_single");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4f");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4f", field_type, 4);
field_type = tdesc_named_type (feature, "int32");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4i32");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4i32", field_type, 4);
field_type = tdesc_named_type (feature, "int16");
- type = init_vector_type (field_type, 8);
- TYPE_NAME (type) = xstrdup ("v8i16");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v8i16", field_type, 8);
field_type = tdesc_named_type (feature, "int8");
- type = init_vector_type (field_type, 16);
- TYPE_NAME (type) = xstrdup ("v16i8");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v16i8", field_type, 16);
- type = init_composite_type (NULL, TYPE_CODE_UNION);
- TYPE_NAME (type) = xstrdup ("vec128");
+ type = tdesc_create_union (feature, "vec128");
field_type = tdesc_named_type (feature, "uint128");
- append_composite_type_field (type, xstrdup ("uint128"), field_type);
+ tdesc_add_field (type, "uint128", field_type);
field_type = tdesc_named_type (feature, "v4f");
- append_composite_type_field (type, xstrdup ("v4_float"), field_type);
+ tdesc_add_field (type, "v4_float", field_type);
field_type = tdesc_named_type (feature, "v4i32");
- append_composite_type_field (type, xstrdup ("v4_int32"), field_type);
+ tdesc_add_field (type, "v4_int32", field_type);
field_type = tdesc_named_type (feature, "v8i16");
- append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
+ tdesc_add_field (type, "v8_int16", field_type);
field_type = tdesc_named_type (feature, "v16i8");
- append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_VECTOR (type) = 1;
- tdesc_record_type (feature, type);
+ tdesc_add_field (type, "v16_int8", field_type);
tdesc_create_reg (feature, "vr0", 71, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "vr1", 72, 1, NULL, 128, "vec128");
Index: gdb-head/gdb/features/rs6000/powerpc-vsx64l.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/powerpc-vsx64l.c
+++ gdb-head/gdb/features/rs6000/powerpc-vsx64l.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: powerpc-vsx64l.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_powerpc_vsx64l;
@@ -10,7 +9,7 @@ initialize_tdesc_powerpc_vsx64l (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common64"));
@@ -95,39 +94,28 @@ initialize_tdesc_powerpc_vsx64l (void)
feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec");
field_type = tdesc_named_type (feature, "ieee_single");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4f");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4f", field_type, 4);
field_type = tdesc_named_type (feature, "int32");
- type = init_vector_type (field_type, 4);
- TYPE_NAME (type) = xstrdup ("v4i32");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v4i32", field_type, 4);
field_type = tdesc_named_type (feature, "int16");
- type = init_vector_type (field_type, 8);
- TYPE_NAME (type) = xstrdup ("v8i16");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v8i16", field_type, 8);
field_type = tdesc_named_type (feature, "int8");
- type = init_vector_type (field_type, 16);
- TYPE_NAME (type) = xstrdup ("v16i8");
- tdesc_record_type (feature, type);
+ tdesc_create_vector (feature, "v16i8", field_type, 16);
- type = init_composite_type (NULL, TYPE_CODE_UNION);
- TYPE_NAME (type) = xstrdup ("vec128");
+ type = tdesc_create_union (feature, "vec128");
field_type = tdesc_named_type (feature, "uint128");
- append_composite_type_field (type, xstrdup ("uint128"), field_type);
+ tdesc_add_field (type, "uint128", field_type);
field_type = tdesc_named_type (feature, "v4f");
- append_composite_type_field (type, xstrdup ("v4_float"), field_type);
+ tdesc_add_field (type, "v4_float", field_type);
field_type = tdesc_named_type (feature, "v4i32");
- append_composite_type_field (type, xstrdup ("v4_int32"), field_type);
+ tdesc_add_field (type, "v4_int32", field_type);
field_type = tdesc_named_type (feature, "v8i16");
- append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
+ tdesc_add_field (type, "v8_int16", field_type);
field_type = tdesc_named_type (feature, "v16i8");
- append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_VECTOR (type) = 1;
- tdesc_record_type (feature, type);
+ tdesc_add_field (type, "v16_int8", field_type);
tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128");
Index: gdb-head/gdb/features/rs6000/rs6000.c
===================================================================
--- gdb-head.orig/gdb/features/rs6000/rs6000.c
+++ gdb-head/gdb/features/rs6000/rs6000.c
@@ -1,7 +1,6 @@
/* THIS FILE IS GENERATED. Original: rs6000.xml */
#include "defs.h"
-#include "gdbtypes.h"
#include "target-descriptions.h"
struct target_desc *tdesc_rs6000;
@@ -10,7 +9,7 @@ initialize_tdesc_rs6000 (void)
{
struct target_desc *result = allocate_target_description ();
struct tdesc_feature *feature;
- struct type *field_type, *type;
+ struct tdesc_type *field_type, *type;
set_tdesc_architecture (result, bfd_scan_arch ("rs6000:6000"));
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: Per-type architecture (Re: [10/15] Basic value access routines)
2009-06-22 20:32 ` Per-type architecture (Re: [10/15] Basic value access routines) Ulrich Weigand
@ 2009-06-22 20:59 ` Daniel Jacobowitz
2009-06-23 0:41 ` Ulrich Weigand
0 siblings, 1 reply; 19+ messages in thread
From: Daniel Jacobowitz @ 2009-06-22 20:59 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: Doug Evans, gdb-patches
On Mon, Jun 22, 2009 at 10:32:03PM +0200, Ulrich Weigand wrote:
> As to the first point, upon further investigation, it does seem
> feasible to ensure every type is related to an architecture, and
> this does in fact significantly simplify the rest of the patches.
>
> Dan, one of the reasons you brought up to keep architecture-independent
> types -back when I first started attempting to eliminate then- was the
> target-descriptions infrastructure. This currently builds up GDB type
> structures while parsing the XML file, long before we know the actual
> target gdbarch to use.
>
> However, it seems to me it is relatively straightforward to delay
> creation of GDB types until we're in tdesc_register_type, where we
> know the target gdbarch. This simply requires that while parsing
> the XML file, we store the type details into temporary data structures
> just like we do with all the other information read from XML.
>
> The following patch does so, using a new "tdesc_type" structure to
> hold type information from XML files. Does this look reasonable?
I think you're simplifying the wrong thing - it probably simplifies
your patches to remove the global architecture a lot, but I think it
makes the rest of GDB more complicated in exchange. Why should types
have an associated architecture, in and of themselves?
The only reason I currently know of is the way GDB numbers bitfields.
So while I really do think this is an ugly change, I won't object; I'm
carrying a pretty hideous patch that builds types as big-endian during
parsing and then renumbers bitfield positions if we need a
little-endian copy of the type.
Maybe we can take a similar approach here. Instead of inventing a new
ad-hoc representation of types, use types, but make a copy with the
right architecture when they're accessed. WDYT?
If you like the idea, please let me know before trying it. I'm
merging HEAD into a tree which contains the necessary type walking
routines this afternoon, so I can show you what I mean and save us
both some work.
(You'll probably notice there's nothing about bitfields in that file
now; this is a local patch that we've been meaning to do one last
thing to before submitting it...)
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Per-type architecture (Re: [10/15] Basic value access routines)
2009-06-22 20:59 ` Daniel Jacobowitz
@ 2009-06-23 0:41 ` Ulrich Weigand
2009-06-23 13:49 ` Daniel Jacobowitz
2009-06-23 15:55 ` Doug Evans
0 siblings, 2 replies; 19+ messages in thread
From: Ulrich Weigand @ 2009-06-23 0:41 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: Doug Evans, gdb-patches
Daniel Jacobowitz wrote:
> I think you're simplifying the wrong thing - it probably simplifies
> your patches to remove the global architecture a lot, but I think it
> makes the rest of GDB more complicated in exchange. Why should types
> have an associated architecture, in and of themselves?
Let's start by looking at *values* first. In order to perform just
about any operations on a value, in fact even to understand just what
the contents of a value objects even *mean*, there's a bunch of
information we need:
- for (nearly) every value, the byte order
- for values of bitfield type, the bitfield byte order (as you mention)
- for values of floating point type, the floating point format (which
today is sometimes, but not always, attached to the type)
- for values of pointer/reference type, the architecture-specific semantics
of converting target pointer values to and from GDB internal addresses
- for values of function pointer type, the architecture-specific semantics of
finding the target function (function descriptors etc.)
- for values of C++ specific types (classes, pointers-to-member etc.), how
they are encoded according to the platform ABI
In addition, when printing values, we need additional data on:
- how to format target addresses for printing
- how to interpret requests of printing the value "as something else"
(e.g. as floating point, or as string, or as instruction disassembly)
rather than its base type
All this information today is provided via gdbarch properties accessed
(just about always) from current_gdbarch.
For the second set of properties, one might argue that this is data that
*should* properly be provided as extra information in addition to the
value itself -- you print the value "as something". For example, the
printing routines might carry a gdbarch as print_options.
However, for the *first* set of properties it doesn't seem to make sense
to require this information to be provided apart from the value object;
there is just about nothing you can do with the value if you don't even
understand how to interpret its contents.
If we agree that it should be possible to retrieve those properties from
a value object itself, then the question becomes if they should attach to
single values, or rather types. My initial patch set implemented the
first approach. However, on further thought, I now tend to prefer the
second option. In the end, a "type" is nothing else but a set of rules
how to interpret the contents of uniform classes of values, right? And all
the above properties are of that form ...
Now, those properties could just be attached to the type itself, without
completing the link to a gdbarch object. In a way, this seems to be what
was attempted by TYPE_FLOATFORMAT. However, implementing this looks to
be at least as complex as going all the way to gdbarch -- e.g. if you
make byte order a property of the type, you still need to wait to create
types until you know what target architecture to create them for.
Plus, at this point it isn't actually hard to make that transition; nearly
all types are *already* associated with either an objfile (and thus its
architecture indirectly), or explicitly with an architecture as target-
specific types. There are still a couple of places where we randomly
access builtin_type_int32 or the like, but it seems they can all be
restructured to avoid such accesses *while making the code simpler!*
For example, one class of such uses is to find some random type in order
to construct an index value to pass to value_subscript (or value_ptradd)
or the like. We actually know the *offset* as numerical value, but finding
the *type* to form a value object out of the offset is hard. In this case,
it seems to me the interface of our helper routines is simply ill-defined:
value_subscript does not even *look* at the type of the index operand, the
only thing it does to the value is calling value_as_long! So simply changing
the interface to take a LONGEST instead of value fixes this class of problems
while making the callers simpler.
On the other hand, actually going all the way to ensure every type is
associated with a gdbarch makes several other simplifications possible:
- we can continue to provide a simple lookup_pointer_type interface --
if a type knows its own architecture, it knows the representation of
pointer types to itself!
- we can continue to have architecture-specific properties of *types*
defined via gdbarch callbacks, e.g. address classes
> Maybe we can take a similar approach here. Instead of inventing a new
> ad-hoc representation of types, use types, but make a copy with the
> right architecture when they're accessed. WDYT?
This seems even uglier to me :-) Maybe I'm just looking at this particular
target-description case a bit differently, but for me tdesc_type is not
"inventing a new ad-hoc representation of types", it is simply a 1:1 in-memory
representation of the XML contents without any GDB-specific reinterpretation
-- think something like "DOM tree" structures. In fact, if it weren't that
we want to avoid excessive dependencies on XML libraries, I'd argue we should
just parse XML into a standard DOM tree representation as provided by those.
Looking at this this way, serialization/deserialization of XML into and out
of those "DOM tree" structures *should not* involve too much GDB specifics
like GDB private data structures, but simply follow the self-describing
property of the XML format ...
(Or stating it another way, I think the tdesc_type patch I posted is a good
idea even if we decide in the end to not associate every type with an
architecture.)
Thoughts?
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Per-type architecture (Re: [10/15] Basic value access routines)
2009-06-23 0:41 ` Ulrich Weigand
@ 2009-06-23 13:49 ` Daniel Jacobowitz
2009-06-23 14:02 ` Pedro Alves
2009-06-23 17:06 ` Ulrich Weigand
2009-06-23 15:55 ` Doug Evans
1 sibling, 2 replies; 19+ messages in thread
From: Daniel Jacobowitz @ 2009-06-23 13:49 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: Doug Evans, gdb-patches
On Tue, Jun 23, 2009 at 02:41:22AM +0200, Ulrich Weigand wrote:
> - for values of bitfield type, the bitfield byte order (as you mention)
We don't actually need the architecture for this, given the type. But
that's only because the way we record this in types requires the
architecture when building the type; I've seriously considered
rearranging it so that the type was architecture neutral and the value
architecture dependent. But it seems too fragile to touch without a
better reason...
> - for values of floating point type, the floating point format (which
> today is sometimes, but not always, attached to the type)
Huh, when isn't it attached to the type?
> However, for the *first* set of properties it doesn't seem to make sense
> to require this information to be provided apart from the value object;
> there is just about nothing you can do with the value if you don't even
> understand how to interpret its contents.
This is the part I'm not sure about. An int32_t from a BE application
and an int32_t from an LE application are clearly distinguished
values, but I think they're of the same type. However, I don't feel
so strongly about this to object to your patch.
> For example, one class of such uses is to find some random type in order
> to construct an index value to pass to value_subscript (or value_ptradd)
> or the like. We actually know the *offset* as numerical value, but finding
> the *type* to form a value object out of the offset is hard. In this case,
> it seems to me the interface of our helper routines is simply ill-defined:
> value_subscript does not even *look* at the type of the index operand, the
> only thing it does to the value is calling value_as_long! So simply changing
> the interface to take a LONGEST instead of value fixes this class of problems
> while making the callers simpler.
For my two cents, I would have preferred we had a uniform internal
value/type system where everything operated on struct value. Then you
know exactly what any value_* routine expects: always value(s).
That's why I wanted frame unwinding to use values instead of buffers.
> This seems even uglier to me :-) Maybe I'm just looking at this particular
> target-description case a bit differently, but for me tdesc_type is not
> "inventing a new ad-hoc representation of types", it is simply a 1:1 in-memory
> representation of the XML contents without any GDB-specific reinterpretation
> -- think something like "DOM tree" structures. In fact, if it weren't that
> we want to avoid excessive dependencies on XML libraries, I'd argue we should
> just parse XML into a standard DOM tree representation as provided by those.
Good point. Yes, I'd much preferred we had a DOM; I looked at several
minimalist C DOM implementations, but couldn't find one that I trusted
to work nearly as well as expat. Since expat ended up external to the
GDB source tree anyway, maybe it would have been wiser to pick GNOME's
libxml2.
The duplication of type layouts bugs me, but let's go with it.
Afterwards, I'll do a second merge into our internal tree and see what
the extra type support looks like.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Per-type architecture (Re: [10/15] Basic value access routines)
2009-06-23 13:49 ` Daniel Jacobowitz
@ 2009-06-23 14:02 ` Pedro Alves
2009-06-23 17:06 ` Ulrich Weigand
1 sibling, 0 replies; 19+ messages in thread
From: Pedro Alves @ 2009-06-23 14:02 UTC (permalink / raw)
To: gdb-patches; +Cc: Daniel Jacobowitz, Ulrich Weigand, Doug Evans
On Tuesday 23 June 2009 14:49:38, Daniel Jacobowitz wrote:
> On Tue, Jun 23, 2009 at 02:41:22AM +0200, Ulrich Weigand wrote:
> > - for values of bitfield type, the bitfield byte order (as you mention)
>
> We don't actually need the architecture for this, given the type. But
> that's only because the way we record this in types requires the
> architecture when building the type; I've seriously considered
> rearranging it so that the type was architecture neutral and the value
> architecture dependent. But it seems too fragile to touch without a
> better reason...
Would sharing of objfiles between inferiors be a reason? I can picture
GDB debugging two inferiors with (maybe slightly or not) different
gdbarchs loading the same shared object.
--
Pedro Alves
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Per-type architecture (Re: [10/15] Basic value access routines)
2009-06-23 13:49 ` Daniel Jacobowitz
2009-06-23 14:02 ` Pedro Alves
@ 2009-06-23 17:06 ` Ulrich Weigand
2009-06-23 17:30 ` Daniel Jacobowitz
1 sibling, 1 reply; 19+ messages in thread
From: Ulrich Weigand @ 2009-06-23 17:06 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: Doug Evans, gdb-patches
Daniel Jacobowitz wrote:
> On Tue, Jun 23, 2009 at 02:41:22AM +0200, Ulrich Weigand wrote:
> > - for values of bitfield type, the bitfield byte order (as you mention)
>
> We don't actually need the architecture for this, given the type. But
> that's only because the way we record this in types requires the
> architecture when building the type; I've seriously considered
> rearranging it so that the type was architecture neutral and the value
> architecture dependent. But it seems too fragile to touch without a
> better reason...
We *do* need the architecture to interpret bitfield types; see e.g. the
comment in gdbtypes.h:
/* Position of this field, counting in bits from start of
containing structure.
For gdbarch_bits_big_endian=1 targets, it is the bit offset to the MSB.
For gdbarch_bits_big_endian=0 targets, it is the bit offset to the LSB.
For a range bound or enum value, this is the value itself. */
int bitpos;
and the various references to gdbarch_bits_big_endian (current_gdbarch)
in unpack_field_as_long, modify_field, etc. There's no way to operate
on a bitfield value without knowledge of this property.
> > - for values of floating point type, the floating point format (which
> > today is sometimes, but not always, attached to the type)
>
> Huh, when isn't it attached to the type?
Most of the time :-) In fact, none of the types created by symbol readers
ever has a non-NULL TYPE_FLOATFORMAT. It is only set for builtin types
generated via gdbtypes.c:build_flt (and the builtin_type_ia64_ext special
case). For every other type, the floatformat is computed on the fly in
floatformat_from_type via floatformat_from_length (again consulting gdbarch
properties of current_gdbarch).
> > However, for the *first* set of properties it doesn't seem to make sense
> > to require this information to be provided apart from the value object;
> > there is just about nothing you can do with the value if you don't even
> > understand how to interpret its contents.
>
> This is the part I'm not sure about. An int32_t from a BE application
> and an int32_t from an LE application are clearly distinguished
> values, but I think they're of the same type. However, I don't feel
> so strongly about this to object to your patch.
Well, I strongly feel that byte order needs to determinable from the *value*
object one way or the other. Whether this is done by making byte order a
property of the value's *type*, or rather by making byte order a property of
the value itself in addition to its type, I don't feel very strongly about;
this seems to me to be more a question of what's more convenient to use.
If we decide to associate a gdbarch with a type anyway to cover the other
properties mentioned, then it seems simpler to use it for byte order too.
However, even then we could still have an additional byte-order property
of the value that would override the type's, if we think that necessary ...
> > For example, one class of such uses is to find some random type in order
> > to construct an index value to pass to value_subscript (or value_ptradd)
> > or the like. We actually know the *offset* as numerical value, but finding
> > the *type* to form a value object out of the offset is hard. In this case,
> > it seems to me the interface of our helper routines is simply ill-defined:
> > value_subscript does not even *look* at the type of the index operand, the
> > only thing it does to the value is calling value_as_long! So simply changing
> > the interface to take a LONGEST instead of value fixes this class of problems
> > while making the callers simpler.
>
> For my two cents, I would have preferred we had a uniform internal
> value/type system where everything operated on struct value. Then you
> know exactly what any value_* routine expects: always value(s).
> That's why I wanted frame unwinding to use values instead of buffers.
I agree, but those naturally *have* types ... I guess we can discuss this with
more specificity once I actually post patches about value_subscript etc.
> > This seems even uglier to me :-) Maybe I'm just looking at this particular
> > target-description case a bit differently, but for me tdesc_type is not
> > "inventing a new ad-hoc representation of types", it is simply a 1:1 in-memory
> > representation of the XML contents without any GDB-specific reinterpretation
> > -- think something like "DOM tree" structures. In fact, if it weren't that
> > we want to avoid excessive dependencies on XML libraries, I'd argue we should
> > just parse XML into a standard DOM tree representation as provided by those.
>
> Good point. Yes, I'd much preferred we had a DOM; I looked at several
> minimalist C DOM implementations, but couldn't find one that I trusted
> to work nearly as well as expat. Since expat ended up external to the
> GDB source tree anyway, maybe it would have been wiser to pick GNOME's
> libxml2.
>
> The duplication of type layouts bugs me, but let's go with it.
> Afterwards, I'll do a second merge into our internal tree and see what
> the extra type support looks like.
OK, thanks. I've checked the patch in now.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: Per-type architecture (Re: [10/15] Basic value access routines)
2009-06-23 17:06 ` Ulrich Weigand
@ 2009-06-23 17:30 ` Daniel Jacobowitz
0 siblings, 0 replies; 19+ messages in thread
From: Daniel Jacobowitz @ 2009-06-23 17:30 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: Doug Evans, gdb-patches
On Tue, Jun 23, 2009 at 07:00:24PM +0200, Ulrich Weigand wrote:
> We *do* need the architecture to interpret bitfield types; see e.g. the
> comment in gdbtypes.h:
>
> /* Position of this field, counting in bits from start of
> containing structure.
> For gdbarch_bits_big_endian=1 targets, it is the bit offset to the MSB.
> For gdbarch_bits_big_endian=0 targets, it is the bit offset to the LSB.
> For a range bound or enum value, this is the value itself. */
>
> int bitpos;
>
> and the various references to gdbarch_bits_big_endian (current_gdbarch)
> in unpack_field_as_long, modify_field, etc. There's no way to operate
> on a bitfield value without knowledge of this property.
You're right, we do - it's a very odd representation where we need the
endianness both to set and to use the position, if you ask me, but it
does tend to line up with symbol readers.
> OK, thanks. I've checked the patch in now.
Great. I'll let you know if I have any problems.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Per-type architecture (Re: [10/15] Basic value access routines)
2009-06-23 0:41 ` Ulrich Weigand
2009-06-23 13:49 ` Daniel Jacobowitz
@ 2009-06-23 15:55 ` Doug Evans
2009-06-23 16:42 ` Mark Kettenis
2009-06-23 16:57 ` Ulrich Weigand
1 sibling, 2 replies; 19+ messages in thread
From: Doug Evans @ 2009-06-23 15:55 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: Daniel Jacobowitz, gdb-patches
On Mon, Jun 22, 2009 at 5:41 PM, Ulrich Weigand<uweigand@de.ibm.com> wrote:
> In fact, if it weren't that
> we want to avoid excessive dependencies on XML libraries, I'd argue we should
> just parse XML into a standard DOM tree representation as provided by those.
>
> Looking at this this way, serialization/deserialization of XML into and out
> of those "DOM tree" structures *should not* involve too much GDB specifics
> like GDB private data structures, but simply follow the self-describing
> property of the XML format ...
OOC, what "excessive dependencies" are you referring to?
It seems odd to want to avoid dependencies on libraries, libraries are good.
[I'm sure there's more to the story here, hence the question. :-)]
*If* the issue is not technical (in the sense that if, for example,
the code was GPL'd and if the code was owned by the FSF, we'd already
be using it), then it might be the case that multiple projects would
want such a library (thus increasing the incentive to solve the
non-technical issues).
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Per-type architecture (Re: [10/15] Basic value access routines)
2009-06-23 15:55 ` Doug Evans
@ 2009-06-23 16:42 ` Mark Kettenis
2009-06-23 16:53 ` Daniel Jacobowitz
2009-06-23 16:57 ` Ulrich Weigand
1 sibling, 1 reply; 19+ messages in thread
From: Mark Kettenis @ 2009-06-23 16:42 UTC (permalink / raw)
To: dje; +Cc: uweigand, drow, gdb-patches
> Date: Tue, 23 Jun 2009 08:55:39 -0700
> From: Doug Evans <dje@google.com>
>
> On Mon, Jun 22, 2009 at 5:41 PM, Ulrich Weigand<uweigand@de.ibm.com> wrote:
> > In fact, if it weren't that we want to avoid excessive
> > dependencies on XML libraries, I'd argue we should just parse XML
> > into a standard DOM tree representation as provided by those.
> >
> > Looking at this this way, serialization/deserialization of XML into and out
> > of those "DOM tree" structures *should not* involve too much GDB specifics
> > like GDB private data structures, but simply follow the self-describing
> > property of the XML format ...
>
> OOC, what "excessive dependencies" are you referring to?
> It seems odd to want to avoid dependencies on libraries, libraries are good.
> [I'm sure there's more to the story here, hence the question. :-)]
Some people think that a basic UNIX-like system should include the
tools to build and debug computer programs, at least those written in
C. So on OpenBSD (and most of the other BSD's) we ship gcc, binutils
and gdb as part of the base operating system. This means that if
these tools depend on certain libraries, we have to include those
libraries as well. There are a couple of issues here:
* We think we should not ship any libraries that have a license that
is more restrictive than the BSD license.
* We think we should only ship "standard" libraries since shipping
"non-standard" libraries encourages people to write programs that
are non-portable.
* We think that we should only ship libraries that meet certain
minimal quality standards, especially with respect to security.
Another perhaps less OpenBSD-specific argument is that I think it
should be possible for people to compile software themselves. This
sort of breaks down if before being able to compile that software I
first need to install a dozen of libtraries, especially if those
libraries themseleves have dependencies.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Per-type architecture (Re: [10/15] Basic value access routines)
2009-06-23 16:42 ` Mark Kettenis
@ 2009-06-23 16:53 ` Daniel Jacobowitz
0 siblings, 0 replies; 19+ messages in thread
From: Daniel Jacobowitz @ 2009-06-23 16:53 UTC (permalink / raw)
To: Mark Kettenis; +Cc: dje, uweigand, gdb-patches
On Tue, Jun 23, 2009 at 06:42:06PM +0200, Mark Kettenis wrote:
> Some people think that a basic UNIX-like system should include the
> tools to build and debug computer programs, at least those written in
> C. So on OpenBSD (and most of the other BSD's) we ship gcc, binutils
> and gdb as part of the base operating system. This means that if
> these tools depend on certain libraries, we have to include those
> libraries as well. There are a couple of issues here:
Note that - because of this concern precisely - the XML library
dependency is optional. It would have saved a lot of hassle if it
weren't, but that's a choice we've already made and I think it was
the right choice.
Once the user says they do want to build in XML support, I don't think
that which XML library they need to go build is particularly
important.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Per-type architecture (Re: [10/15] Basic value access routines)
2009-06-23 15:55 ` Doug Evans
2009-06-23 16:42 ` Mark Kettenis
@ 2009-06-23 16:57 ` Ulrich Weigand
2009-06-23 17:36 ` Doug Evans
1 sibling, 1 reply; 19+ messages in thread
From: Ulrich Weigand @ 2009-06-23 16:57 UTC (permalink / raw)
To: Doug Evans; +Cc: Daniel Jacobowitz, gdb-patches
Doug Evans wrote:
> On Mon, Jun 22, 2009 at 5:41 PM, Ulrich Weigand<uweigand@de.ibm.com> wrote:
> > In fact, if it weren't that
> > we want to avoid excessive dependencies on XML libraries, I'd argue we should
> > just parse XML into a standard DOM tree representation as provided by those.
> >
> > Looking at this this way, serialization/deserialization of XML into and out
> > of those "DOM tree" structures *should not* involve too much GDB specifics
> > like GDB private data structures, but simply follow the self-describing
> > property of the XML format ...
>
> OOC, what "excessive dependencies" are you referring to?
> It seems odd to want to avoid dependencies on libraries, libraries are good.
> [I'm sure there's more to the story here, hence the question. :-)]
Well, the concern was in fact really about adding a dependency on an external
library, if I recall correctly. GDB always used to be pretty self-contained,
you don't need to install any external libraries in order to build or use it.
While libraries are good from a developer's point of view, dependencies add
hassles for users ...
Daniel initially suggested to add the expat sources to the src tree in order
to keep that property, see the original discussion here:
http://sourceware.org/ml/gdb-patches/2006-07/msg00231.html
This approach was then discarded in favor of using an external expat library
installed by the user, but only for "non-essential" purposes: if that library
does not exist, it must still be possible to build and use GDB even if some
non-essential GDB features then no longer work:
http://sourceware.org/ml/gdb-patches/2006-08/msg00048.html
That's what I meant by "excessive dependency": if we were to add library
calls to core GDB components with no fallback option, this would *require*
presence of the library, or else GDB will not build at all any more. Up
to now we've always said we don't want to do that.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Per-type architecture (Re: [10/15] Basic value access routines)
2009-06-23 16:57 ` Ulrich Weigand
@ 2009-06-23 17:36 ` Doug Evans
0 siblings, 0 replies; 19+ messages in thread
From: Doug Evans @ 2009-06-23 17:36 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: Daniel Jacobowitz, gdb-patches
On Tue, Jun 23, 2009 at 9:57 AM, Ulrich Weigand<uweigand@de.ibm.com> wrote:
> Doug Evans wrote:
>> OOC, what "excessive dependencies" are you referring to?
>> It seems odd to want to avoid dependencies on libraries, libraries are good.
>> [I'm sure there's more to the story here, hence the question. :-)]
>
> Well, the concern was in fact really about adding a dependency on an external
> library, if I recall correctly.
Ah. That makes all the difference in the world.
> GDB always used to be pretty self-contained,
> you don't need to install any external libraries in order to build or use it.
> While libraries are good from a developer's point of view, dependencies add
> hassles for users ...
For completeness' sake, it's not libraries in and of themselves (gdb
uses libreadline, libiberty, libopcodes, libbfd, for example), it's
dependencies on EXTERNAL libraries that can add hassles.
> Daniel initially suggested to add the expat sources to the src tree in order
> to keep that property, see the original discussion here:
> http://sourceware.org/ml/gdb-patches/2006-07/msg00231.html
Thanks for the reference.
> This approach was then discarded in favor of using an external expat library
> installed by the user, but only for "non-essential" purposes: if that library
> does not exist, it must still be possible to build and use GDB even if some
> non-essential GDB features then no longer work:
> http://sourceware.org/ml/gdb-patches/2006-08/msg00048.html
Ditto!
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [10/15] Basic value access routines
2009-06-15 16:59 ` Ulrich Weigand
2009-06-22 20:32 ` Per-type architecture (Re: [10/15] Basic value access routines) Ulrich Weigand
@ 2009-06-24 15:31 ` Tom Tromey
2009-06-24 15:46 ` Daniel Jacobowitz
1 sibling, 1 reply; 19+ messages in thread
From: Tom Tromey @ 2009-06-24 15:31 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: Doug Evans, gdb-patches
>>>>> "Ulrich" == Ulrich Weigand <uweigand@de.ibm.com> writes:
Ulrich> Those are additional minor issues; the type structures are indeed
Ulrich> space critical
I have been curious about this.
It seems to me that in a given gdb session, most types will not
actually be needed. (I haven't done the experiment though.)
If that is so, then it further seems to me that types would only be
space critical if we are instantiating them too eagerly. This has
lead me to wonder whether lazy instantiation of types would be
beneficial.
A related idea that occurred to me is that, with Jan's type GC, we
could detach types from objfiles and "intern" them (something like
bcache-for-types). This would only be a win if there are many
identical types distributed across objfiles, though.
Tom
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [10/15] Basic value access routines
2009-06-24 15:31 ` [10/15] Basic value access routines Tom Tromey
@ 2009-06-24 15:46 ` Daniel Jacobowitz
2009-06-24 16:26 ` Doug Evans
0 siblings, 1 reply; 19+ messages in thread
From: Daniel Jacobowitz @ 2009-06-24 15:46 UTC (permalink / raw)
To: Tom Tromey; +Cc: Ulrich Weigand, Doug Evans, gdb-patches
On Wed, Jun 24, 2009 at 09:31:16AM -0600, Tom Tromey wrote:
> A related idea that occurred to me is that, with Jan's type GC, we
> could detach types from objfiles and "intern" them (something like
> bcache-for-types). This would only be a win if there are many
> identical types distributed across objfiles, though.
There's plenty of identical types within a single objfile. Load GDB
with -readnow, and I find 66 copies of the typedef for "FILE", for
instance.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [10/15] Basic value access routines
2009-06-24 15:46 ` Daniel Jacobowitz
@ 2009-06-24 16:26 ` Doug Evans
2009-06-24 19:41 ` Tom Tromey
0 siblings, 1 reply; 19+ messages in thread
From: Doug Evans @ 2009-06-24 16:26 UTC (permalink / raw)
To: Tom Tromey, Ulrich Weigand, gdb-patches
On Wed, Jun 24, 2009 at 8:46 AM, Daniel Jacobowitz<drow@false.org> wrote:
> On Wed, Jun 24, 2009 at 09:31:16AM -0600, Tom Tromey wrote:
>> A related idea that occurred to me is that, with Jan's type GC, we
>> could detach types from objfiles and "intern" them (something like
>> bcache-for-types). This would only be a win if there are many
>> identical types distributed across objfiles, though.
>
> There's plenty of identical types within a single objfile. Load GDB
> with -readnow, and I find 66 copies of the typedef for "FILE", for
> instance.
As a data point, I compiled gdb with -g -O2 and again with -gdwarf-4 -O2.
-rwxr-x--- 1 dje eng 16321609 Jun 24 08:52 gdb
-rwxr-x--- 1 dje eng 13019406 Jun 24 08:50 gdb-dw4
Starting gdb with -readnow and then examining space usage:
-g -O2:
gdb$ ps l 24343
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
0 67641 24343 24342 20 0 117356 97764 - S+ pts/13 0:00 ../../../..
-gdwarf-4 -O2:
gdb$ ps l 24349
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
0 67641 24349 16588 20 0 72088 53280 - S+ pts/13 0:00 ../../../..
Until my comdat types patch is vetted more, these numbers are to be
taken with a grain of salt, but they are promising.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [10/15] Basic value access routines
2009-06-24 16:26 ` Doug Evans
@ 2009-06-24 19:41 ` Tom Tromey
0 siblings, 0 replies; 19+ messages in thread
From: Tom Tromey @ 2009-06-24 19:41 UTC (permalink / raw)
To: Doug Evans; +Cc: Ulrich Weigand, gdb-patches
>>>>> "Doug" == Doug Evans <dje@google.com> writes:
Daniel> There's plenty of identical types within a single objfile. Load GDB
Daniel> with -readnow, and I find 66 copies of the typedef for "FILE", for
Daniel> instance.
Thanks. It seems like interning types is something we could do right
away then.
Doug> Until my comdat types patch is vetted more, these numbers are to be
Doug> taken with a grain of salt, but they are promising.
Yes, this is very interesting.
Tom
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2009-06-24 19:41 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-09 15:20 [10/15] Basic value access routines Ulrich Weigand
2009-06-15 16:35 ` Doug Evans
2009-06-15 16:59 ` Ulrich Weigand
2009-06-22 20:32 ` Per-type architecture (Re: [10/15] Basic value access routines) Ulrich Weigand
2009-06-22 20:59 ` Daniel Jacobowitz
2009-06-23 0:41 ` Ulrich Weigand
2009-06-23 13:49 ` Daniel Jacobowitz
2009-06-23 14:02 ` Pedro Alves
2009-06-23 17:06 ` Ulrich Weigand
2009-06-23 17:30 ` Daniel Jacobowitz
2009-06-23 15:55 ` Doug Evans
2009-06-23 16:42 ` Mark Kettenis
2009-06-23 16:53 ` Daniel Jacobowitz
2009-06-23 16:57 ` Ulrich Weigand
2009-06-23 17:36 ` Doug Evans
2009-06-24 15:31 ` [10/15] Basic value access routines Tom Tromey
2009-06-24 15:46 ` Daniel Jacobowitz
2009-06-24 16:26 ` Doug Evans
2009-06-24 19:41 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox