X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fgdbarch.sh;h=fe3a8d3deea3b51e717f7e0110a58fcbd9b4a3a3;hb=175ff332d0cbd9e522a396be6a990d20fdd0ea07;hp=f93bfc1e3fb1c88491270df3b255b6f814a50331;hpb=28439f5ef78fd28c36bfc8c4b262f44fdd1ec40f;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index f93bfc1e3f..fe3a8d3dee 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -3,7 +3,7 @@ # Architecture commands for GDB, the GNU debugger. # # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -# 2008, 2009 Free Software Foundation, Inc. +# 2008, 2009, 2010 Free Software Foundation, Inc. # # This file is part of GDB. # @@ -22,8 +22,8 @@ # Make certain that the script is not running in an internationalized # environment. -LANG=c ; export LANG -LC_ALL=c ; export LC_ALL +LANG=C ; export LANG +LC_ALL=C ; export LC_ALL compare_new () @@ -363,12 +363,14 @@ v:int:long_bit:::8 * sizeof (long):4*TARGET_CHAR_BIT::0 # machine. v:int:long_long_bit:::8 * sizeof (LONGEST):2*gdbarch->long_bit::0 -# The ABI default bit-size and format for "float", "double", and "long -# double". These bit/format pairs should eventually be combined into -# a single object. For the moment, just initialize them as a pair. +# The ABI default bit-size and format for "half", "float", "double", and +# "long double". These bit/format pairs should eventually be combined +# into a single object. For the moment, just initialize them as a pair. # Each format describes both the big and little endian layouts (if # useful). +v:int:half_bit:::16:2*TARGET_CHAR_BIT::0 +v:const struct floatformat **:half_format:::::floatformats_ieee_half::pformat (gdbarch->half_format) v:int:float_bit:::8 * sizeof (float):4*TARGET_CHAR_BIT::0 v:const struct floatformat **:float_format:::::floatformats_ieee_single::pformat (gdbarch->float_format) v:int:double_bit:::8 * sizeof (double):8*TARGET_CHAR_BIT::0 @@ -382,14 +384,29 @@ v:const struct floatformat **:long_double_format:::::floatformats_ieee_double::p # / addr_bit will be set from it. # # If gdbarch_ptr_bit and gdbarch_addr_bit are different, you'll probably -# also need to set gdbarch_pointer_to_address and gdbarch_address_to_pointer -# as well. +# also need to set gdbarch_dwarf2_addr_size, gdbarch_pointer_to_address and +# gdbarch_address_to_pointer as well. # # ptr_bit is the size of a pointer on the target v:int:ptr_bit:::8 * sizeof (void*):gdbarch->int_bit::0 # addr_bit is the size of a target address as represented in gdb v:int:addr_bit:::8 * sizeof (void*):0:gdbarch_ptr_bit (gdbarch): # +# dwarf2_addr_size is the target address size as used in the Dwarf debug +# info. For .debug_frame FDEs, this is supposed to be the target address +# size from the associated CU header, and which is equivalent to the +# DWARF2_ADDR_SIZE as defined by the target specific GCC back-end. +# Unfortunately there is no good way to determine this value. Therefore +# dwarf2_addr_size simply defaults to the target pointer size. +# +# dwarf2_addr_size is not used for .eh_frame FDEs, which are generally +# defined using the target's pointer size so far. +# +# Note that dwarf2_addr_size only needs to be redefined by a target if the +# GCC back-end defines a DWARF2_ADDR_SIZE other than the target pointer size, +# and if Dwarf versions < 4 need to be supported. +v:int:dwarf2_addr_size:::sizeof (void*):0:gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT: +# # One if \`char' acts like \`signed char', zero if \`unsigned char'. v:int:char_signed:::1:-1:1 # @@ -410,6 +427,15 @@ v:int:num_regs:::0:-1 # combinations of other registers, or they may be computed by GDB. v:int:num_pseudo_regs:::0:0::0 +# Assemble agent expression bytecode to collect pseudo-register REG. +# Return -1 if something goes wrong, 0 otherwise. +M:int:ax_pseudo_register_collect:struct agent_expr *ax, int reg:ax, reg + +# Assemble agent expression bytecode to push the value of pseudo-register +# REG on the interpreter stack. +# Return -1 if something goes wrong, 0 otherwise. +M:int:ax_pseudo_register_push_stack:struct agent_expr *ax, int reg:ax, reg + # GDB's standard (or well known) register numbers. These can map onto # a real register or a pseudo (computed) register or not be defined at # all (-1). @@ -466,8 +492,8 @@ f:void:value_to_register:struct frame_info *frame, int regnum, struct type *type # (but not the value contents) filled in. f:struct value *:value_from_register:struct type *type, int regnum, struct frame_info *frame:type, regnum, frame::default_value_from_register::0 # -f:CORE_ADDR:pointer_to_address:struct type *type, const gdb_byte *buf:type, buf::unsigned_pointer_to_address::0 -f:void:address_to_pointer:struct type *type, gdb_byte *buf, CORE_ADDR addr:type, buf, addr::unsigned_address_to_pointer::0 +m:CORE_ADDR:pointer_to_address:struct type *type, const gdb_byte *buf:type, buf::unsigned_pointer_to_address::0 +m:void:address_to_pointer:struct type *type, gdb_byte *buf, CORE_ADDR addr:type, buf, addr::unsigned_address_to_pointer::0 M:CORE_ADDR:integer_to_address:struct type *type, const gdb_byte *buf:type, buf # Return the return-value convention that will be used by FUNCTYPE @@ -486,6 +512,10 @@ m:CORE_ADDR:skip_prologue:CORE_ADDR ip:ip:0:0 M:CORE_ADDR:skip_main_prologue:CORE_ADDR ip:ip f:int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs:0:0 m:const gdb_byte *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr::0: +# Return the adjusted address and kind to use for Z0/Z1 packets. +# KIND is usually the memory length of the breakpoint, but may have a +# different target-specific meaning. +m:void:remote_breakpoint_from_pc:CORE_ADDR *pcptr, int *kindptr:pcptr, kindptr:0:default_remote_breakpoint_from_pc::0 M:CORE_ADDR:adjust_breakpoint_address:CORE_ADDR bpaddr:bpaddr m:int:memory_insert_breakpoint:struct bp_target_info *bp_tgt:bp_tgt:0:default_memory_insert_breakpoint::0 m:int:memory_remove_breakpoint:struct bp_target_info *bp_tgt:bp_tgt:0:default_memory_remove_breakpoint::0 @@ -563,7 +593,7 @@ f:CORE_ADDR:skip_trampoline_code:struct frame_info *frame, CORE_ADDR pc:frame, p # a step-resume breakpoint to get us past the dynamic linker. m:CORE_ADDR:skip_solib_resolver:CORE_ADDR pc:pc::generic_skip_solib_resolver::0 # Some systems also have trampoline code for returning from shared libs. -f:int:in_solib_return_trampoline:CORE_ADDR pc, char *name:pc, name::generic_in_solib_return_trampoline::0 +m:int:in_solib_return_trampoline:CORE_ADDR pc, char *name:pc, name::generic_in_solib_return_trampoline::0 # A target might have problems with watchpoints as soon as the stack # frame of the current function has been destroyed. This mostly happens @@ -575,15 +605,6 @@ f:int:in_solib_return_trampoline:CORE_ADDR pc, char *name:pc, name::generic_in_s # which don't suffer from that problem could just let this functionality # untouched. m:int:in_function_epilogue_p:CORE_ADDR addr:addr:0:generic_in_function_epilogue_p::0 -# Given a vector of command-line arguments, return a newly allocated -# string which, when passed to the create_inferior function, will be -# parsed (on Unix systems, by the shell) to yield the same vector. -# This function should call error() if the argument vector is not -# representable for this target or if this target does not support -# command-line arguments. -# ARGC is the number of elements in the vector. -# ARGV is an array of strings, one per argument. -m:char *:construct_inferior_arguments:int argc, char **argv:argc, argv::construct_inferior_arguments::0 f:void:elf_make_msymbol_special:asymbol *sym, struct minimal_symbol *msym:sym, msym::default_elf_make_msymbol_special::0 f:void:coff_make_msymbol_special:int val, struct minimal_symbol *msym:val, msym::default_coff_make_msymbol_special::0 v:int:cannot_step_breakpoint:::0:0::0 @@ -600,13 +621,6 @@ F:CORE_ADDR:fetch_pointer_argument:struct frame_info *frame, int argi, struct ty # name SECT_NAME and size SECT_SIZE. M:const struct regset *:regset_from_core_section:const char *sect_name, size_t sect_size:sect_name, sect_size -# When creating core dumps, some systems encode the PID in addition -# to the LWP id in core file register section names. In those cases, the -# "XXX" in ".reg/XXX" is encoded as [LWPID << 16 | PID]. This setting -# is set to true for such architectures; false if "XXX" represents an LWP -# or thread id with no special encoding. -v:int:core_reg_section_encodes_pid:::0:0::0 - # Supported register notes in a core file. v:struct core_regset_section *:core_regset_sections:const char *name, int len::::::host_address_to_string (gdbarch->core_regset_sections) @@ -614,10 +628,12 @@ v:struct core_regset_section *:core_regset_sections:const char *name, int len::: # core file into buffer READBUF with length LEN. M:LONGEST:core_xfer_shared_libraries:gdb_byte *readbuf, ULONGEST offset, LONGEST len:readbuf, offset, len -# How the core_stratum layer converts a PTID from a core file to a -# string. +# How the core target converts a PTID from a core file to a string. M:char *:core_pid_to_str:ptid_t ptid:ptid +# BFD target to use when generating a core file. +V:const char *:gcore_bfd_target:::0:0:::gdbarch->gcore_bfd_target + # If the elements of C++ vtables are in-place function descriptors rather # than normal function pointers (which may point to code or a descriptor), # set this to one. @@ -660,6 +676,17 @@ V:ULONGEST:max_insn_length:::0:0 # here. M:struct displaced_step_closure *:displaced_step_copy_insn:CORE_ADDR from, CORE_ADDR to, struct regcache *regs:from, to, regs +# Return true if GDB should use hardware single-stepping to execute +# the displaced instruction identified by CLOSURE. If false, +# GDB will simply restart execution at the displaced instruction +# location, and it is up to the target to ensure GDB will receive +# control again (e.g. by placing a software breakpoint instruction +# into the displaced instruction buffer). +# +# The default implementation returns false on all targets that +# provide a gdbarch_software_single_step routine, and true otherwise. +m:int:displaced_step_hw_singlestep:struct displaced_step_closure *closure:closure::default_displaced_step_hw_singlestep::0 + # Fix up the state resulting from successfully single-stepping a # displaced instruction, to give the result we would have gotten from # stepping the instruction in its original location. @@ -699,6 +726,19 @@ m:void:displaced_step_free_closure:struct displaced_step_closure *closure:closur # see the comments in infrun.c. m:CORE_ADDR:displaced_step_location:void:::NULL::(! gdbarch->displaced_step_location) != (! gdbarch->displaced_step_copy_insn) +# Relocate an instruction to execute at a different address. OLDLOC +# is the address in the inferior memory where the instruction to +# relocate is currently at. On input, TO points to the destination +# where we want the instruction to be copied (and possibly adjusted) +# to. On output, it points to one past the end of the resulting +# instruction(s). The effect of executing the instruction at TO shall +# be the same as if executing it at FROM. For example, call +# instructions that implicitly push the return address on the stack +# should be adjusted to return to the instruction after OLDLOC; +# relative branches, and other PC-relative instructions need the +# offset adjusted; etc. +M:void:relocate_instruction:CORE_ADDR *to, CORE_ADDR from:to, from::NULL + # Refresh overlay mapped state for section OSECT. F:void:overlay_update:struct obj_section *osect:osect @@ -709,6 +749,16 @@ F:char *:static_transform_name:char *name:name # Set if the address in N_SO or N_FUN stabs may be zero. v:int:sofun_address_maybe_missing:::0:0::0 +# Parse the instruction at ADDR storing in the record execution log +# the registers REGCACHE and memory ranges that will be affected when +# the instruction executes, along with their current values. +# Return -1 if something goes wrong, 0 otherwise. +M:int:process_record:struct regcache *regcache, CORE_ADDR addr:regcache, addr + +# Save process state after a signal. +# Return -1 if something goes wrong, 0 otherwise. +M:int:process_record_signal:struct regcache *regcache, enum target_signal signal:regcache, signal + # Signal translation: translate inferior's signal (host's) number into # GDB's representation. m:enum target_signal:target_signal_from_host:int signo:signo::default_target_signal_from_host::0 @@ -724,12 +774,47 @@ M:struct type *:get_siginfo_type:void: # Record architecture-specific information from the symbol table. M:void:record_special_symbol:struct objfile *objfile, asymbol *sym:objfile, sym +# Function for the 'catch syscall' feature. + +# Get architecture-specific system calls information from registers. +M:LONGEST:get_syscall_number:ptid_t ptid:ptid + # True if the list of shared libraries is one and only for all # processes, as opposed to a list of shared libraries per inferior. -# When this property is true, GDB assumes that since shared libraries -# are shared across processes, so is all code. Hence, GDB further -# assumes an inserted breakpoint location is visible to all processes. +# This usually means that all processes, although may or may not share +# an address space, will see the same set of symbols at the same +# addresses. v:int:has_global_solist:::0:0::0 + +# On some targets, even though each inferior has its own private +# address space, the debug interface takes care of making breakpoints +# visible to all address spaces automatically. For such cases, +# this property should be set to true. +v:int:has_global_breakpoints:::0:0::0 + +# True if inferiors share an address space (e.g., uClinux). +m:int:has_shared_address_space:void:::default_has_shared_address_space::0 + +# True if a fast tracepoint can be set at an address. +m:int:fast_tracepoint_valid_at:CORE_ADDR addr, int *isize, char **msg:addr, isize, msg::default_fast_tracepoint_valid_at::0 + +# Return the "auto" target charset. +f:const char *:auto_charset:void::default_auto_charset:default_auto_charset::0 +# Return the "auto" target wide charset. +f:const char *:auto_wide_charset:void::default_auto_wide_charset:default_auto_wide_charset::0 + +# If non-empty, this is a file extension that will be opened in place +# of the file extension reported by the shared library list. +# +# This is most useful for toolchains that use a post-linker tool, +# where the names of the files run on the target differ in extension +# compared to the names of the files GDB should load for debug info. +v:const char *:solib_symbols_extension:::::::pstring (gdbarch->solib_symbols_extension) + +# If true, the target OS has DOS-based file system semantics. That +# is, absolute paths include a drive name, and the backslash is +# considered a directory separator. +v:int:has_dos_based_file_system:::0:0::0 EOF } @@ -782,8 +867,8 @@ cat <gdbarch can used to access values from the previously selected architecture for this - architecture family. The global \`\`current_gdbarch'' shall not be - used. + architecture family. The INIT function shall return any of: NULL - indicating that it doesn't recognize the selected architecture; an existing \`\`struct @@ -1068,12 +1166,12 @@ extern int gdbarch_update_p (struct gdbarch_info info); set, and then finished using gdbarch_info_fill. Returns the corresponding architecture, or NULL if no matching - architecture was found. "current_gdbarch" is not updated. */ + architecture was found. */ extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info); -/* Helper function. Set the global "current_gdbarch" to "gdbarch". +/* Helper function. Set the global "target_gdbarch" to "gdbarch". FIXME: kettenis/20031124: Of the functions that follow, only gdbarch_from_bfd is supposed to survive. The others will @@ -1081,7 +1179,7 @@ extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info); multi-arch. However, for now we're still stuck with the concept of a single active architecture. */ -extern void deprecated_current_gdbarch_select_hack (struct gdbarch *gdbarch); +extern void deprecated_target_gdbarch_select_hack (struct gdbarch *gdbarch); /* Register per-architecture data-pointer. @@ -1189,6 +1287,14 @@ pformat (const struct floatformat **format) return format[0]->name; } +static const char * +pstring (const char *string) +{ + if (string == NULL) + return "(null)"; + return string; +} + EOF # gdbarch open the gdbarch object @@ -1303,7 +1409,6 @@ cat <obstack, size); + memset (data, 0, size); return data; } @@ -1385,6 +1491,7 @@ void gdbarch_free (struct gdbarch *arch) { struct obstack *obstack; + gdb_assert (arch != NULL); gdb_assert (!arch->initialized_p); obstack = arch->obstack; @@ -1404,8 +1511,9 @@ verify_gdbarch (struct gdbarch *gdbarch) { struct ui_file *log; struct cleanup *cleanups; - long dummy; + long length; char *buf; + log = mem_fileopen (); cleanups = make_cleanup_ui_file_delete (log); /* fundamental */ @@ -1450,9 +1558,9 @@ do fi done cat < 0) + if (length > 0) internal_error (__FILE__, __LINE__, _("verify_gdbarch: the following are invalid ...%s"), buf); @@ -1470,6 +1578,7 @@ void gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) { const char *gdb_nm_file = ""; + #if defined (GDB_NM_FILE) gdb_nm_file = GDB_NM_FILE; #endif @@ -1674,7 +1783,8 @@ gdbarch_data_register (gdbarch_data_pre_init_ftype *pre_init, gdbarch_data_post_init_ftype *post_init) { struct gdbarch_data_registration **curr; - /* Append the new registraration. */ + + /* Append the new registration. */ for (curr = &gdbarch_data_registry.registrations; (*curr) != NULL; curr = &(*curr)->next); @@ -1790,10 +1900,10 @@ gdbarch_printable_names (void) { /* Accumulate a list of names based on the registed list of architectures. */ - enum bfd_architecture a; int nr_arches = 0; const char **arches = NULL; struct gdbarch_registration *rego; + for (rego = gdbarch_registry; rego != NULL; rego = rego->next) @@ -1822,6 +1932,7 @@ gdbarch_register (enum bfd_architecture bfd_architecture, { struct gdbarch_registration **curr; const struct bfd_arch_info *bfd_arch_info; + /* Check that BFD recognizes this architecture */ bfd_arch_info = bfd_lookup_arch (bfd_architecture, 0); if (bfd_arch_info == NULL) @@ -1885,19 +1996,14 @@ gdbarch_list_lookup_by_info (struct gdbarch_list *arches, /* Find an architecture that matches the specified INFO. Create a new - architecture if needed. Return that new architecture. Assumes - that there is no current architecture. */ + architecture if needed. Return that new architecture. */ -static struct gdbarch * -find_arch_by_info (struct gdbarch_info info) +struct gdbarch * +gdbarch_find_by_info (struct gdbarch_info info) { struct gdbarch *new_gdbarch; struct gdbarch_registration *rego; - /* The existing architecture has been swapped out - all this code - works from a clean slate. */ - gdb_assert (current_gdbarch == NULL); - /* Fill in missing parts of the INFO struct using a number of sources: "set ..."; INFOabfd supplied; and the global defaults. */ @@ -1909,24 +2015,24 @@ find_arch_by_info (struct gdbarch_info info) if (gdbarch_debug) { fprintf_unfiltered (gdb_stdlog, - "find_arch_by_info: info.bfd_arch_info %s\n", + "gdbarch_find_by_info: info.bfd_arch_info %s\n", (info.bfd_arch_info != NULL ? info.bfd_arch_info->printable_name : "(null)")); fprintf_unfiltered (gdb_stdlog, - "find_arch_by_info: info.byte_order %d (%s)\n", + "gdbarch_find_by_info: info.byte_order %d (%s)\n", info.byte_order, (info.byte_order == BFD_ENDIAN_BIG ? "big" : info.byte_order == BFD_ENDIAN_LITTLE ? "little" : "default")); fprintf_unfiltered (gdb_stdlog, - "find_arch_by_info: info.osabi %d (%s)\n", + "gdbarch_find_by_info: info.osabi %d (%s)\n", info.osabi, gdbarch_osabi_name (info.osabi)); fprintf_unfiltered (gdb_stdlog, - "find_arch_by_info: info.abfd %s\n", + "gdbarch_find_by_info: info.abfd %s\n", host_address_to_string (info.abfd)); fprintf_unfiltered (gdb_stdlog, - "find_arch_by_info: info.tdep_info %s\n", + "gdbarch_find_by_info: info.tdep_info %s\n", host_address_to_string (info.tdep_info)); } @@ -1939,7 +2045,7 @@ find_arch_by_info (struct gdbarch_info info) if (rego == NULL) { if (gdbarch_debug) - fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: " "No matching architecture\n"); return 0; } @@ -1952,7 +2058,7 @@ find_arch_by_info (struct gdbarch_info info) if (new_gdbarch == NULL) { if (gdbarch_debug) - fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: " "Target rejected architecture\n"); return NULL; } @@ -1965,7 +2071,7 @@ find_arch_by_info (struct gdbarch_info info) struct gdbarch_list **list; struct gdbarch_list *this; if (gdbarch_debug) - fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: " "Previous architecture %s (%s) selected\n", host_address_to_string (new_gdbarch), new_gdbarch->bfd_arch_info->printable_name); @@ -1987,7 +2093,7 @@ find_arch_by_info (struct gdbarch_info info) /* It's a new architecture. */ if (gdbarch_debug) - fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: " "New architecture %s (%s) selected\n", host_address_to_string (new_gdbarch), new_gdbarch->bfd_arch_info->printable_name); @@ -2013,39 +2119,13 @@ find_arch_by_info (struct gdbarch_info info) return new_gdbarch; } -struct gdbarch * -gdbarch_find_by_info (struct gdbarch_info info) -{ - struct gdbarch *new_gdbarch; - - /* Save the previously selected architecture, setting the global to - NULL. This stops things like gdbarch->init() trying to use the - previous architecture's configuration. The previous architecture - may not even be of the same architecture family. The most recent - architecture of the same family is found at the head of the - rego->arches list. */ - struct gdbarch *old_gdbarch = current_gdbarch; - current_gdbarch = NULL; - - /* Find the specified architecture. */ - new_gdbarch = find_arch_by_info (info); - - /* Restore the existing architecture. */ - gdb_assert (current_gdbarch == NULL); - current_gdbarch = old_gdbarch; - - return new_gdbarch; -} - /* Make the specified architecture current. */ void -deprecated_current_gdbarch_select_hack (struct gdbarch *new_gdbarch) +deprecated_target_gdbarch_select_hack (struct gdbarch *new_gdbarch) { gdb_assert (new_gdbarch != NULL); - gdb_assert (current_gdbarch != NULL); gdb_assert (new_gdbarch->initialized_p); - current_gdbarch = new_gdbarch; target_gdbarch = new_gdbarch; observer_notify_architecture_changed (new_gdbarch); registers_changed (); @@ -2056,8 +2136,6 @@ extern void _initialize_gdbarch (void); void _initialize_gdbarch (void) { - struct cmd_list_element *c; - add_setshow_zinteger_cmd ("arch", class_maintenance, &gdbarch_debug, _("\\ Set architecture debugging."), _("\\ Show architecture debugging."), _("\\