X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Farch-utils.c;h=32d48a744fae2ba43f74c27f04cd43018313ae7a;hb=afa269ae41673cd5cc5f50d683a0f2d275a643e8;hp=803ce1ca26f7f0eea3580228a2554fbe118f24de;hpb=2ea286498fd2ddceaf074bfbc9a2986777ea0396;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 803ce1ca26..32d48a744f 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -1,6 +1,6 @@ /* Dynamic architecture support for GDB, the GNU debugger. - Copyright (C) 1998-2012 Free Software Foundation, Inc. + Copyright (C) 1998-2015 Free Software Foundation, Inc. This file is part of GDB. @@ -23,14 +23,15 @@ #include "buildsym.h" #include "gdbcmd.h" #include "inferior.h" /* enum CALL_DUMMY_LOCATION et al. */ -#include "gdb_string.h" +#include "infrun.h" #include "regcache.h" -#include "gdb_assert.h" #include "sim-regno.h" #include "gdbcore.h" #include "osabi.h" #include "target-descriptions.h" #include "objfiles.h" +#include "language.h" +#include "symtab.h" #include "version.h" @@ -167,17 +168,35 @@ no_op_reg_to_regnum (struct gdbarch *gdbarch, int reg) } void -default_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym) +default_coff_make_msymbol_special (int val, struct minimal_symbol *msym) { return; } +/* See arch-utils.h. */ + void -default_coff_make_msymbol_special (int val, struct minimal_symbol *msym) +default_make_symbol_special (struct symbol *sym, struct objfile *objfile) { return; } +/* See arch-utils.h. */ + +CORE_ADDR +default_adjust_dwarf2_addr (CORE_ADDR pc) +{ + return pc; +} + +/* See arch-utils.h. */ + +CORE_ADDR +default_adjust_dwarf2_line (CORE_ADDR addr, int rel) +{ + return addr; +} + int cannot_register_not (struct gdbarch *gdbarch, int regnum) { @@ -243,6 +262,14 @@ default_remote_register_number (struct gdbarch *gdbarch, return regno; } +/* See arch-utils.h. */ + +int +default_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range) +{ + return 0; +} + /* Functions to manipulate the endianness of the target. */ @@ -476,7 +503,7 @@ set_architecture (char *ignore_args, int from_tty, struct cmd_list_element *c) } /* Try to select a global architecture that matches "info". Return - non-zero if the attempt succeds. */ + non-zero if the attempt succeeds. */ int gdbarch_update_p (struct gdbarch_info info) { @@ -505,7 +532,7 @@ gdbarch_update_p (struct gdbarch_info info) /* If it is the same old architecture, accept the request (but don't swap anything). */ - if (new_gdbarch == target_gdbarch) + if (new_gdbarch == target_gdbarch ()) { if (gdbarch_debug) fprintf_unfiltered (gdb_stdlog, "gdbarch_update_p: " @@ -521,7 +548,7 @@ gdbarch_update_p (struct gdbarch_info info) "New architecture %s (%s) selected\n", host_address_to_string (new_gdbarch), gdbarch_bfd_arch_info (new_gdbarch)->printable_name); - deprecated_target_gdbarch_select_hack (new_gdbarch); + set_target_gdbarch (new_gdbarch); return 1; } @@ -555,7 +582,7 @@ set_gdbarch_from_file (bfd *abfd) if (gdbarch == NULL) error (_("Architecture of file not recognized.")); - deprecated_target_gdbarch_select_hack (gdbarch); + set_target_gdbarch (gdbarch); } /* Initialize the current architecture. Update the ``set @@ -756,7 +783,7 @@ get_current_arch (void) if (has_stack_frames ()) return get_frame_arch (get_selected_frame (NULL)); else - return target_gdbarch; + return target_gdbarch (); } int @@ -793,13 +820,67 @@ default_gen_return_address (struct gdbarch *gdbarch, error (_("This architecture has no method to collect a return address.")); } -enum gdb_signal -default_gdb_signal_from_host (struct gdbarch *gdbarch, int signo) +int +default_return_in_first_hidden_param_p (struct gdbarch *gdbarch, + struct type *type) +{ + /* Usually, the return value's address is stored the in the "first hidden" + parameter if the return value should be passed by reference, as + specified in ABI. */ + return language_pass_by_reference (type); +} + +int default_insn_is_call (struct gdbarch *gdbarch, CORE_ADDR addr) { - return gdb_signal_from_host (signo); + return 0; } -/* */ +int default_insn_is_ret (struct gdbarch *gdbarch, CORE_ADDR addr) +{ + return 0; +} + +int default_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr) +{ + return 0; +} + +void +default_skip_permanent_breakpoint (struct regcache *regcache) +{ + struct gdbarch *gdbarch = get_regcache_arch (regcache); + CORE_ADDR current_pc = regcache_read_pc (regcache); + const gdb_byte *bp_insn; + int bp_len; + + bp_insn = gdbarch_breakpoint_from_pc (gdbarch, ¤t_pc, &bp_len); + current_pc += bp_len; + regcache_write_pc (regcache, current_pc); +} + +CORE_ADDR +default_infcall_mmap (CORE_ADDR size, unsigned prot) +{ + error (_("This target does not support inferior memory allocation by mmap.")); +} + +/* -mcmodel=large is used so that no GOT (Global Offset Table) is needed to be + created in inferior memory by GDB (normally it is set by ld.so). */ + +char * +default_gcc_target_options (struct gdbarch *gdbarch) +{ + return xstrprintf ("-m%d%s", gdbarch_ptr_bit (gdbarch), + gdbarch_ptr_bit (gdbarch) == 64 ? " -mcmodel=large" : ""); +} + +/* gdbarch gnu_triplet_regexp method. */ + +const char * +default_gnu_triplet_regexp (struct gdbarch *gdbarch) +{ + return gdbarch_bfd_arch_info (gdbarch)->arch_name; +} /* -Wmissing-prototypes */ extern initialize_file_ftype _initialize_gdbarch_utils;