diff options
author | Jim Blandy <jimb@codesourcery.com> | 2000-04-14 18:43:41 +0000 |
---|---|---|
committer | Jim Blandy <jimb@codesourcery.com> | 2000-04-14 18:43:41 +0000 |
commit | 4478b372e973afcd2253fe4c1ec3f2d083ac3943 (patch) | |
tree | 8140dc777f65fea1264b2d52a191ed79b61eb069 /gdb/gdbarch.c | |
parent | d84dd0c55ec2daf8bc3430098b22760478b4b68b (diff) | |
download | gdb-4478b372e973afcd2253fe4c1ec3f2d083ac3943.zip gdb-4478b372e973afcd2253fe4c1ec3f2d083ac3943.tar.gz gdb-4478b372e973afcd2253fe4c1ec3f2d083ac3943.tar.bz2 |
* gdbarch.sh (POINTER_TO_ADDRESS, ADDRESS_TO_POINTER): Two new
functions which architectures can redefine, defaulting to
generic_pointer_to_address and generic_address_to_pointer.
* findvar.c (extract_typed_address, store_typed_address,
generic_pointer_to_address, generic_address_to_pointer): New
functions.
(POINTER_TO_ADDRESS, ADDRESS_TO_POINTER): Provide default
definitions.
(extract_address, store_address): Doc fixes.
* values.c (value_as_pointer): Doc fix.
(value_from_pointer): New function.
* defs.h (extract_typed_address, store_typed_address): New
declarations.
* inferior.h (generic_address_to_pointer,
generic_pointer_to_address): New declarations.
* value.h (value_from_pointer): New declaration.
* ax-gdb.c (const_var_ref): Use value_from_pointer, not
value_from_longest.
* blockframe.c (generic_push_dummy_frame): Use read_pc and
read_sp, not read_register.
* c-valprint.c (c_val_print): Use extract_typed_address instead of
extract_address to extract vtable entries and references.
* cp-valprint.c (cp_print_value_fields): Use value_from_pointer
instead of value_from_longest to extract the vtable's address.
* eval.c (evaluate_subexp_standard): Use value_from_pointer
instead of value_from_longest to compute `this', and for doing
pointer-to-member dereferencing.
* findvar.c (read_register): Use extract_unsigned_integer, not
extract_address.
(read_var_value): Use store_typed_address instead of store_address
for building label values.
(locate_var_value): Use value_from_pointer instead of
value_from_longest.
* hppa-tdep.c (find_stub_with_shl_get): Use value_from_pointer,
instead of value_from_longest, to build arguments to __d_shl_get.
* printcmd.c (set_next_address): Use value_from_pointer, not
value_from_longest.
(x_command): Use value_from_pointer, not value_from_longest.
* tracepoint.c (set_traceframe_context): Use value_from_pointer,
not value_from_longest.
* valarith.c (value_add, value_sub): Use value_from_pointer, not
value_from_longest.
* valops.c (find_function_in_inferior, value_coerce_array,
value_coerce_function, value_addr, hand_function_call): Same.
* value.h (COERCE_REF): Use unpack_pointer, not unpack_long.
* values.c (unpack_long): Use extract_typed_address to produce
addresses from pointers and references, not extract_address.
(value_from_longest): Use store_typed_address instead of
store_address to produce pointer and reference values.
Diffstat (limited to 'gdb/gdbarch.c')
-rw-r--r-- | gdb/gdbarch.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 98e0743..a1b02ac 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -175,6 +175,8 @@ struct gdbarch gdbarch_register_convertible_ftype *register_convertible; gdbarch_register_convert_to_virtual_ftype *register_convert_to_virtual; gdbarch_register_convert_to_raw_ftype *register_convert_to_raw; + gdbarch_pointer_to_address_ftype *pointer_to_address; + gdbarch_address_to_pointer_ftype *address_to_pointer; gdbarch_extract_return_value_ftype *extract_return_value; gdbarch_push_arguments_ftype *push_arguments; gdbarch_push_dummy_frame_ftype *push_dummy_frame; @@ -309,6 +311,8 @@ struct gdbarch startup_gdbarch = { 0, 0, 0, + 0, + 0, /* startup_gdbarch() */ }; struct gdbarch *current_gdbarch = &startup_gdbarch; @@ -351,6 +355,8 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->call_dummy_stack_adjust_p = -1; gdbarch->coerce_float_to_double = default_coerce_float_to_double; gdbarch->register_convertible = generic_register_convertible_not; + gdbarch->pointer_to_address = generic_pointer_to_address; + gdbarch->address_to_pointer = generic_address_to_pointer; gdbarch->breakpoint_from_pc = legacy_breakpoint_from_pc; gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint; gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint; @@ -517,6 +523,8 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of register_convertible, invalid_p == 0 */ /* Skip verify of register_convert_to_virtual, invalid_p == 0 */ /* Skip verify of register_convert_to_raw, invalid_p == 0 */ + /* Skip verify of pointer_to_address, invalid_p == 0 */ + /* Skip verify of address_to_pointer, invalid_p == 0 */ if ((GDB_MULTI_ARCH >= 2) && (gdbarch->extract_return_value == 0)) internal_error ("gdbarch: verify_gdbarch: extract_return_value invalid"); @@ -793,6 +801,14 @@ gdbarch_dump (void) (long) current_gdbarch->register_convert_to_raw /*REGISTER_CONVERT_TO_RAW ()*/); fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: POINTER_TO_ADDRESS = 0x%08lx\n", + (long) current_gdbarch->pointer_to_address + /*POINTER_TO_ADDRESS ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: ADDRESS_TO_POINTER = 0x%08lx\n", + (long) current_gdbarch->address_to_pointer + /*ADDRESS_TO_POINTER ()*/); + fprintf_unfiltered (gdb_stdlog, "gdbarch_update: EXTRACT_RETURN_VALUE = 0x%08lx\n", (long) current_gdbarch->extract_return_value /*EXTRACT_RETURN_VALUE ()*/); @@ -1778,6 +1794,40 @@ set_gdbarch_register_convert_to_raw (struct gdbarch *gdbarch, gdbarch->register_convert_to_raw = register_convert_to_raw; } +CORE_ADDR +gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, char *buf) +{ + if (gdbarch->pointer_to_address == 0) + internal_error ("gdbarch: gdbarch_pointer_to_address invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_pointer_to_address called\n"); + return gdbarch->pointer_to_address (type, buf); +} + +void +set_gdbarch_pointer_to_address (struct gdbarch *gdbarch, + gdbarch_pointer_to_address_ftype pointer_to_address) +{ + gdbarch->pointer_to_address = pointer_to_address; +} + +void +gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, char *buf, CORE_ADDR addr) +{ + if (gdbarch->address_to_pointer == 0) + internal_error ("gdbarch: gdbarch_address_to_pointer invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_address_to_pointer called\n"); + gdbarch->address_to_pointer (type, buf, addr); +} + +void +set_gdbarch_address_to_pointer (struct gdbarch *gdbarch, + gdbarch_address_to_pointer_ftype address_to_pointer) +{ + gdbarch->address_to_pointer = address_to_pointer; +} + void gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, char *regbuf, char *valbuf) { @@ -3093,6 +3143,7 @@ generic_register_convertible_not (num) return 0; } + /* Disassembler */ /* Pointer to the target-dependent disassembly function. */ |