2012-07-27 22:23:05 +02:00
|
|
|
/* *INDENT-OFF* */ /* THIS FILE IS GENERATED -*- buffer-read-only: t -*- */
|
|
|
|
/* vi:set ro: */
|
2000-03-30 07:32:23 +02:00
|
|
|
|
1999-07-20 01:30:11 +02:00
|
|
|
/* Dynamic architecture support for GDB, the GNU debugger.
|
2004-01-18 00:21:21 +01:00
|
|
|
|
2017-01-01 07:50:51 +01:00
|
|
|
Copyright (C) 1998-2017 Free Software Foundation, Inc.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-08-09 23:36:23 +02:00
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-08-23 20:08:50 +02:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
1999-08-09 23:36:23 +02:00
|
|
|
(at your option) any later version.
|
2016-01-01 05:33:14 +01:00
|
|
|
|
1999-08-09 23:36:23 +02:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2016-01-01 05:33:14 +01:00
|
|
|
|
1999-08-09 23:36:23 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-23 20:08:50 +02:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
1999-07-20 01:30:11 +02:00
|
|
|
|
1999-08-31 03:14:27 +02:00
|
|
|
/* This file was created with the aid of ``gdbarch.sh''.
|
|
|
|
|
2000-08-25 22:51:19 +02:00
|
|
|
The Bourne shell script ``gdbarch.sh'' creates the files
|
1999-08-31 03:14:27 +02:00
|
|
|
``new-gdbarch.c'' and ``new-gdbarch.h and then compares them
|
|
|
|
against the existing ``gdbarch.[hc]''. Any differences found
|
|
|
|
being reported.
|
|
|
|
|
|
|
|
If editing this file, please also run gdbarch.sh and merge any
|
2000-08-25 22:51:19 +02:00
|
|
|
changes into that script. Conversely, when making sweeping changes
|
1999-08-31 03:14:27 +02:00
|
|
|
to this file, modifying gdbarch.sh and using its output may prove
|
2011-01-07 20:36:19 +01:00
|
|
|
easier. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
2000-04-09 16:37:28 +02:00
|
|
|
#include "arch-utils.h"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
#include "gdbcmd.h"
|
2007-05-31 18:57:30 +02:00
|
|
|
#include "inferior.h"
|
1999-04-26 20:34:20 +02:00
|
|
|
#include "symcat.h"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2000-06-02 03:59:13 +02:00
|
|
|
#include "floatformat.h"
|
2002-11-02 16:13:34 +01:00
|
|
|
#include "reggroups.h"
|
2003-01-05 00:38:46 +01:00
|
|
|
#include "osabi.h"
|
2003-07-22 21:49:58 +02:00
|
|
|
#include "gdb_obstack.h"
|
gdb:
* tui/tui-hooks.c: Include observer.h.
(tui_event_default, tui_old_event_hooks, tui_event_hooks):
Remove.
(tui_bp_created_observer, tui_bp_deleted_observer,
tui_bp_modified_observer): New globals.
(tui_install_hooks): Use observers, not events.
(tui_remove_hooks): Likewise.
* mi/mi-cmd-break.c: Include observer.h, not gdb-events.h.
(mi_breakpoint_observers_installed, mi_can_breakpoint_notify): New
globals.
(breakpoint_notify): Check mi_can_breakpoint_notify.
(breakpoint_hooks): Remove.
(mi_cmd_break_insert): Attach observers. Don't use events.
* tracepoint.c: Include observer.h, not gdb-events.h.
(tracepoint_operation, trace_pass_command): Notify observer.
* interps.c: Don't include gdb-events.h.
(clear_interpreter_hooks): Don't call clear_gdb_event_hooks.
* gdbarch.c: Rebuild.
* gdbarch.sh: Emit include for observer.h, not gdb-events.h.
(deprecated_current_gdbarch_select_hack): Notify observer.
* breakpoint.h: Don't include gdb-events.h.
* breakpoint.c: Don't include gdb-events.h.
(condition_command): Notify observer.
(commands_command): Likewise.
(commands_from_control_command): Likewise.
(mention, delete_breakpoint, set_ignore_count): Likewise.
(disable_breakpoint, do_enable_breakpoint): Likewise.
* Makefile.in (gdb_events_h): Remove.
(breakpoint_h): Update.
(COMMON_OBS): Remove gdb-events.o.
(gdb-events.o): Remove.
(breakpoint.o, gdbarch.o, interps.o, tracepoint.o, gdbtk-bp.o,
gdbtk-hooks.o, mi-cmd-break.o, tui-hooks.o): Update.
* gdb-events.c: Remove.
* gdb-events.h: Remove.
* gdb-events.sh: Remove.
gdb/doc:
* observer.texi (GDB Observers): Document new observers:
breakpoint_created, breakpoint_deleted, breakpoint_modified,
tracepoint_created, tracepoint_deleted, tracepoint_modified,
architecture_changed.
gdb/gdbtk:
* generic/gdbtk-hooks.c: Include observer.h, not gdb-events.h.
(gdbtk_add_hooks): Use observers, not events.
(gdbtk_architecture_changed): Add argument, for observer.
* generic/gdbtk-bp.c: Include observer.h.
(gdb_set_bp): Notify observer.
(gdb_set_bp_addr): Likewise.
2008-07-25 18:12:03 +02:00
|
|
|
#include "observer.h"
|
2008-08-22 15:35:00 +02:00
|
|
|
#include "regcache.h"
|
2012-06-05 15:50:50 +02:00
|
|
|
#include "objfiles.h"
|
2016-06-12 00:51:38 +02:00
|
|
|
#include "auxv.h"
|
2001-02-07 03:17:48 +01:00
|
|
|
|
1999-08-31 03:14:27 +02:00
|
|
|
/* Static function declarations */
|
|
|
|
|
2001-06-06 16:46:30 +02:00
|
|
|
static void alloc_gdbarch_data (struct gdbarch *);
|
1999-08-31 03:14:27 +02:00
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
/* Non-zero if we want to trace architecture code. */
|
|
|
|
|
|
|
|
#ifndef GDBARCH_DEBUG
|
|
|
|
#define GDBARCH_DEBUG 0
|
|
|
|
#endif
|
2012-08-02 11:36:40 +02:00
|
|
|
unsigned int gdbarch_debug = GDBARCH_DEBUG;
|
2005-02-24 Andrew Cagney <cagney@gnu.org>
Add show_VARIABLE functions, update add_setshow call.
* varobj.c (_initialize_varobj, show_varobjdebug): Add and update.
* valprint.c (_initialize_valprint, show_print_max)
(show_stop_print_at_null, show_repeat_count_threshold)
(show_prettyprint_structs, show_unionprint)
(show_prettyprint_arrays, show_addressprint, show_input_radix)
(show_output_radix): Ditto.
* valops.c (_initialize_valops, show_overload_resolution): Ditto.
* utils.c (initialize_utils, show_chars_per_line)
(show_lines_per_page, show_demangle, show_pagination_enabled)
(show_sevenbit_strings, show_asm_demangle): Ditto
* tui/tui-win.c (_initialize_tui_win, show_tui_border_kind)
(show_tui_border_mode, show_tui_active_border_mode): Ditto.
* top.c (init_main, show_new_async_prompt)
(show_async_command_editing_p, show_write_history_p)
(show_history_size, show_history_filename, show_caution)
(show_annotation_level, init_main): Ditto.
* target.c (initialize_targets, show_targetdebug)
(show_trust_readonly): Ditto.
* symfile.c (_initialize_symfile, show_symbol_reloading)
(show_ext_args, show_download_write_size)
(show_debug_file_directory): Ditto.
* source.c (_initialize_source, show_lines_to_list): Ditto.
* solib.c (_initialize_solib, show_auto_solib_add)
(show_solib_search_path): Ditto.
* p-valprint.c (_initialize_pascal_valprint)
(show_pascal_static_field_print): Ditto.
* printcmd.c (_initialize_printcmd, show_max_symbolic_offset)
(show_print_symbol_filename): Add and update.
* parse.c (_initialize_parse, show_expressiondebug): Dito.
* observer.c (_initialize_observer, show_observer_debug): Dito.
* maint.c (_initialize_maint_cmds, show_watchdog)
(show_maintenance_profile_p): Dito.
* linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito.
* infrun.c (_initialize_infrun, show_debug_infrun)
(show_stop_on_solib_events, show_follow_fork_mode_string)
(show_scheduler_mode, show_step_stop_if_no_debug): Ditto.
* infcall.c (_initialize_infcall, show_coerce_float_to_double_p)
(show_unwind_on_signal_p): Ditto.
* gdbtypes.c (build_gdbtypes, show_opaque_type_resolution)
(_initialize_gdbtypes, show_overload_debug): Ditto.
* gdb-events.c, gdb-events.sh (_initialize_gdb_events)
(show_gdb_events_debug): Ditto.
* gdbarch.c, gdbarch.sh (show_gdbarch_debug)
(_initialize_gdbarch): Ditto.
* frame.c (_initialize_frame, show_backtrace_past_main)
(show_backtrace_past_entry, show_backtrace_limit)
(show_frame_debug): Ditto.
* exec.c (_initialize_exec, show_write_files): Ditto.
* dwarf2read.c (_initialize_dwarf2_read)
(show_dwarf2_max_cache_age): Ditto.
* demangle.c (_initialize_demangler)
(show_demangling_style_names): Ditto.
* dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto.
* cp-valprint.c (show_static_field_print)
(_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto.
* corefile.c (_initialize_core, show_gnutarget_string): Ditto.
* cli/cli-logging.c (_initialize_cli_logging)
(show_logging_overwrite, show_logging_redirect)
(show_logging_filename): Ditto.
* cli/cli-cmds.c (show_info_verbose, show_history_expansion_p)
(init_cli_cmds, show_baud_rate, show_remote_debug)
(show_remote_timeout, show_max_user_call_depth): Ditto.
* charset.c (show_host_charset_name, show_target_charset_name)
(initialize_charset): Ditto.
* breakpoint.c (show_can_use_hw_watchpoints)
(show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
|
|
|
static void
|
|
|
|
show_gdbarch_debug (struct ui_file *file, int from_tty,
|
|
|
|
struct cmd_list_element *c, const char *value)
|
|
|
|
{
|
|
|
|
fprintf_filtered (file, _("Architecture debugging is %s.\n"), value);
|
|
|
|
}
|
1999-06-14 20:08:47 +02:00
|
|
|
|
2004-08-08 21:49:43 +02:00
|
|
|
static const char *
|
* doublest.c (floatformat_from_length): Use the right element from
gdbarch floatformats.
(floatformat_from_type, extract_typed_floating)
(store_typed_floating): Likewise.
* doublest.h: Remove declarations for undefined floatformat arrays.
* gdbarch.sh (float_format, double_format, long_double_format): Change
to pairs.
(pformat): Update for pairs.
* gdbarch.c, gdbarch.h: Regenerated.
* gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double)
(floatformats_ieee_double_littlebyte_bigword)
(floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext)
(floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f)
(floatformats_vax_d): New variables.
(builtin_type_ieee_single, builtin_type_ieee_double)
(builtin_type_arm_ext, builtin_type_ia64_spill)
(builtin_type_ia64_quad): Replace arrays with individual types.
(builtin_type_ieee_single_big, builtin_type_ieee_single_little)
(builtin_type_ieee_double_big, builtin_type_ieee_double_little)
(builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext)
(builtin_type_m88110_ext, builtin_type_m88110_harris_ext)
(builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword)
(builtin_type_ia64_spill_big, builtin_type_ia64_spill_little)
(builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete
unused and endian-specific types.
(recursive_dump_type): Update for floatformat pairs.
(build_flt): Move higher. Handle bit == -1. Take a floatformat pair.
(build_gdbtypes): Use build_flt.
(_initialize_gdbtypes): Update set of initialized types.
* gdbtypes.h: Update declarations to match gdbtypes.c.
(struct main_type): Store a pointer to two floatformats.
* arch-utils.c (default_float_format, default_double_format): Delete.
* arch-utils.h (default_float_format, default_double_format): Delete.
* arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c,
ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c,
mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c,
sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c,
vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
2007-01-29 18:31:06 +01:00
|
|
|
pformat (const struct floatformat **format)
|
2004-08-08 21:49:43 +02:00
|
|
|
{
|
|
|
|
if (format == NULL)
|
|
|
|
return "(null)";
|
|
|
|
else
|
* doublest.c (floatformat_from_length): Use the right element from
gdbarch floatformats.
(floatformat_from_type, extract_typed_floating)
(store_typed_floating): Likewise.
* doublest.h: Remove declarations for undefined floatformat arrays.
* gdbarch.sh (float_format, double_format, long_double_format): Change
to pairs.
(pformat): Update for pairs.
* gdbarch.c, gdbarch.h: Regenerated.
* gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double)
(floatformats_ieee_double_littlebyte_bigword)
(floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext)
(floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f)
(floatformats_vax_d): New variables.
(builtin_type_ieee_single, builtin_type_ieee_double)
(builtin_type_arm_ext, builtin_type_ia64_spill)
(builtin_type_ia64_quad): Replace arrays with individual types.
(builtin_type_ieee_single_big, builtin_type_ieee_single_little)
(builtin_type_ieee_double_big, builtin_type_ieee_double_little)
(builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext)
(builtin_type_m88110_ext, builtin_type_m88110_harris_ext)
(builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword)
(builtin_type_ia64_spill_big, builtin_type_ia64_spill_little)
(builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete
unused and endian-specific types.
(recursive_dump_type): Update for floatformat pairs.
(build_flt): Move higher. Handle bit == -1. Take a floatformat pair.
(build_gdbtypes): Use build_flt.
(_initialize_gdbtypes): Update set of initialized types.
* gdbtypes.h: Update declarations to match gdbtypes.c.
(struct main_type): Store a pointer to two floatformats.
* arch-utils.c (default_float_format, default_double_format): Delete.
* arch-utils.h (default_float_format, default_double_format): Delete.
* arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c,
ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c,
mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c,
sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c,
vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
2007-01-29 18:31:06 +01:00
|
|
|
/* Just print out one of them - this is only for diagnostics. */
|
|
|
|
return format[0]->name;
|
2004-08-08 21:49:43 +02:00
|
|
|
}
|
|
|
|
|
2010-03-08 20:28:27 +01:00
|
|
|
static const char *
|
|
|
|
pstring (const char *string)
|
|
|
|
{
|
|
|
|
if (string == NULL)
|
|
|
|
return "(null)";
|
|
|
|
return string;
|
|
|
|
}
|
|
|
|
|
-Wwrite-strings: The Rest
This is the remainder boring constification that all looks more of less
borderline obvious IMO.
gdb/ChangeLog:
2017-04-05 Pedro Alves <palves@redhat.com>
* ada-exp.y (yyerror): Constify.
* ada-lang.c (bound_name, get_selections)
(ada_variant_discrim_type)
(ada_variant_discrim_name, ada_value_struct_elt)
(ada_lookup_struct_elt_type, is_unchecked_variant)
(ada_which_variant_applies, standard_exc, ada_get_next_arg)
(catch_ada_exception_command_split)
(catch_ada_assert_command_split, catch_assert_command)
(ada_op_name): Constify.
* ada-lang.h (ada_yyerror, get_selections)
(ada_variant_discrim_name, ada_value_struct_elt): Constify.
* arc-tdep.c (arc_print_frame_cache): Constify.
* arm-tdep.c (arm_skip_stub): Constify.
* ax-gdb.c (gen_binop, gen_struct_ref_recursive, gen_struct_ref)
(gen_aggregate_elt_ref): Constify.
* bcache.c (print_bcache_statistics): Constify.
* bcache.h (print_bcache_statistics): Constify.
* break-catch-throw.c (catch_exception_command_1):
* breakpoint.c (struct ep_type_description::description):
Constify.
(add_solib_catchpoint): Constify.
(catch_fork_command_1): Add cast.
(add_catch_command): Constify.
* breakpoint.h (add_catch_command, add_solib_catchpoint):
Constify.
* bsd-uthread.c (bsd_uthread_state): Constify.
* buildsym.c (patch_subfile_names): Constify.
* buildsym.h (next_symbol_text_func, patch_subfile_names):
Constify.
* c-exp.y (yyerror): Constify.
(token::oper): Constify.
* c-lang.h (c_yyerror, cp_print_class_member): Constify.
* c-varobj.c (cplus_describe_child): Constify.
* charset.c (find_charset_names): Add cast.
(find_charset_names): Constify array and add const_cast.
* cli/cli-cmds.c (complete_command, cd_command): Constify.
(edit_command): Constify.
* cli/cli-decode.c (lookup_cmd): Constify.
* cli/cli-dump.c (dump_memory_command, dump_value_command):
Constify.
(struct dump_context): Constify.
(add_dump_command, restore_command): Constify.
* cli/cli-script.c (get_command_line): Constify.
* cli/cli-script.h (get_command_line): Constify.
* cli/cli-utils.c (check_for_argument): Constify.
* cli/cli-utils.h (check_for_argument): Constify.
* coff-pe-read.c (struct read_pe_section_data): Constify.
* command.h (lookup_cmd): Constify.
* common/print-utils.c (decimal2str): Constify.
* completer.c (gdb_print_filename): Constify.
* corefile.c (set_gnutarget): Constify.
* cp-name-parser.y (yyerror): Constify.
* cp-valprint.c (cp_print_class_member): Constify.
* cris-tdep.c (cris_register_name, crisv32_register_name):
Constify.
* d-exp.y (yyerror): Constify.
(struct token::oper): Constify.
* d-lang.h (d_yyerror): Constify.
* dbxread.c (struct header_file_location::name): Constify.
(add_old_header_file, add_new_header_file, last_function_name)
(dbx_next_symbol_text, add_bincl_to_list)
(find_corresponding_bincl_psymtab, set_namestring)
(find_stab_function_addr, read_dbx_symtab, start_psymtab)
(dbx_end_psymtab, read_ofile_symtab, process_one_symbol):
* defs.h (command_line_input, print_address_symbolic)
(deprecated_readline_begin_hook): Constify.
* dwarf2read.c (anonymous_struct_prefix, dwarf_bool_name):
Constify.
* event-top.c (handle_line_of_input): Constify and add cast.
* exceptions.c (catch_errors): Constify.
* exceptions.h (catch_errors): Constify.
* expprint.c (print_subexp_standard, op_string, op_name)
(op_name_standard, dump_raw_expression, dump_raw_expression):
* expression.h (op_name, op_string, dump_raw_expression):
Constify.
* f-exp.y (yyerror): Constify.
(struct token::oper): Constify.
(struct f77_boolean_val::name): Constify.
* f-lang.c (f_word_break_characters): Constify.
* f-lang.h (f_yyerror): Constify.
* fork-child.c (fork_inferior): Add cast.
* frv-tdep.c (struct gdbarch_tdep::register_names): Constify.
(new_variant): Constify.
* gdbarch.sh (pstring_ptr, pstring_list): Constify.
* gdbarch.c: Regenerate.
* gdbcore.h (set_gnutarget): Constify.
* go-exp.y (yyerror): Constify.
(token::oper): Constify.
* go-lang.h (go_yyerror): Constify.
* go32-nat.c (go32_sysinfo): Constify.
* guile/scm-breakpoint.c (gdbscm_breakpoint_expression): Constify.
* guile/scm-cmd.c (cmdscm_function): Constify.
* guile/scm-param.c (pascm_param_value): Constify.
* h8300-tdep.c (h8300_register_name, h8300s_register_name)
(h8300sx_register_name): Constify.
* hppa-tdep.c (hppa32_register_name, hppa64_register_name):
Constify.
* ia64-tdep.c (ia64_register_names): Constify.
* infcmd.c (construct_inferior_arguments): Constify.
(path_command, attach_post_wait): Constify.
* language.c (show_range_command, show_case_command)
(unk_lang_error): Constify.
* language.h (language_defn::la_error)
(language_defn::la_name_of_this): Constify.
* linespec.c (decode_line_2): Constify.
* linux-thread-db.c (thread_db_err_str): Constify.
* lm32-tdep.c (lm32_register_name): Constify.
* m2-exp.y (yyerror): Constify.
* m2-lang.h (m2_yyerror): Constify.
* m32r-tdep.c (m32r_register_names): Constify and make static.
* m68hc11-tdep.c (m68hc11_register_names): Constify.
* m88k-tdep.c (m88k_register_name): Constify.
* macroexp.c (appendmem): Constify.
* mdebugread.c (fdr_name, add_data_symbol, parse_type)
(upgrade_type, parse_external, parse_partial_symbols)
(mdebug_next_symbol_text, cross_ref, mylookup_symbol, new_psymtab)
(new_symbol): Constify.
* memattr.c (mem_info_command): Constify.
* mep-tdep.c (register_name_from_keyword): Constify.
* mi/mi-cmd-env.c (mi_cmd_env_path, _initialize_mi_cmd_env):
Constify.
* mi/mi-cmd-stack.c (list_args_or_locals): Constify.
* mi/mi-cmd-var.c (mi_cmd_var_show_attributes): Constify.
* mi/mi-main.c (captured_mi_execute_command): Constify and add
cast.
(mi_execute_async_cli_command): Constify.
* mips-tdep.c (mips_register_name): Constify.
* mn10300-tdep.c (register_name, mn10300_generic_register_name)
(am33_register_name, am33_2_register_name)
* moxie-tdep.c (moxie_register_names): Constify.
* nat/linux-osdata.c (osdata_type): Constify fields.
* nto-tdep.c (nto_parse_redirection): Constify.
* objc-lang.c (lookup_struct_typedef, lookup_objc_class)
(lookup_child_selector): Constify.
(objc_methcall::name): Constify.
* objc-lang.h (lookup_objc_class, lookup_child_selector)
(lookup_struct_typedef): Constify.
* objfiles.c (pc_in_section): Constify.
* objfiles.h (pc_in_section): Constify.
* p-exp.y (struct token::oper): Constify.
(yyerror): Constify.
* p-lang.h (pascal_yyerror): Constify.
* parser-defs.h (op_name_standard): Constify.
(op_print::string): Constify.
(exp_descriptor::op_name): Constify.
* printcmd.c (print_address_symbolic): Constify.
* psymtab.c (print_partial_symbols): Constify.
* python/py-breakpoint.c (stop_func): Constify.
(bppy_get_expression): Constify.
* python/py-cmd.c (cmdpy_completer::name): Constify.
(cmdpy_function): Constify.
* python/py-event.c (evpy_add_attribute)
(gdbpy_initialize_event_generic): Constify.
* python/py-event.h (evpy_add_attribute)
(gdbpy_initialize_event_generic): Constify.
* python/py-evts.c (add_new_registry): Constify.
* python/py-finishbreakpoint.c (outofscope_func): Constify.
* python/py-framefilter.c (get_py_iter_from_func): Constify.
* python/py-inferior.c (get_buffer): Add cast.
* python/py-param.c (parm_constant::name): Constify.
* python/py-unwind.c (fprint_frame_id): Constify.
* python/python.c (gdbpy_parameter_value): Constify.
* remote-fileio.c (remote_fio_func_map): Make 'name' const.
* remote.c (memory_packet_config::name): Constify.
(show_packet_config_cmd, remote_write_bytes)
(remote_buffer_add_string):
* reverse.c (exec_reverse_once): Constify.
* rs6000-tdep.c (variant::name, variant::description): Constify.
* rust-exp.y (rustyyerror): Constify.
* rust-lang.c (rust_op_name): Constify.
* rust-lang.h (rustyyerror): Constify.
* serial.h (serial_ops::name): Constify.
* sh-tdep.c (sh_sh_register_name, sh_sh3_register_name)
(sh_sh3e_register_name, sh_sh2e_register_name)
(sh_sh2a_register_name, sh_sh2a_nofpu_register_name)
(sh_sh_dsp_register_name, sh_sh3_dsp_register_name)
(sh_sh4_register_name, sh_sh4_nofpu_register_name)
(sh_sh4al_dsp_register_name): Constify.
* sh64-tdep.c (sh64_register_name): Constify.
* solib-darwin.c (lookup_symbol_from_bfd): Constify.
* spu-tdep.c (spu_register_name, info_spu_dma_cmdlist): Constify.
* stabsread.c (patch_block_stabs, read_type_number)
(ref_map::stabs, ref_add, process_reference)
(symbol_reference_defined, define_symbol, define_symbol)
(error_type, read_type, read_member_functions, read_cpp_abbrev)
(read_one_struct_field, read_struct_fields, read_baseclasses)
(read_tilde_fields, read_struct_type, read_array_type)
(read_enum_type, read_sun_builtin_type, read_sun_floating_type)
(read_huge_number, read_range_type, read_args, common_block_start)
(find_name_end): Constify.
* stabsread.h (common_block_start, define_symbol)
(process_one_symbol, symbol_reference_defined, ref_add):
* symfile.c (get_section_index, add_symbol_file_command):
* symfile.h (get_section_index): Constify.
* target-descriptions.c (tdesc_type::name): Constify.
(tdesc_free_type): Add cast.
* target.c (find_default_run_target):
(add_deprecated_target_alias, find_default_run_target)
(target_announce_detach): Constify.
(do_option): Constify.
* target.h (add_deprecated_target_alias): Constify.
* thread.c (print_thread_info_1): Constify.
* top.c (deprecated_readline_begin_hook, command_line_input):
Constify.
(init_main): Add casts.
* top.h (handle_line_of_input): Constify.
* tracefile-tfile.c (tfile_write_uploaded_tsv): Constify.
* tracepoint.c (tvariables_info_1, trace_status_mi): Constify.
(tfind_command): Rename to ...
(tfind_command_1): ... this and constify.
(tfind_command): New function.
(tfind_end_command, tfind_start_command): Adjust.
(encode_source_string): Constify.
* tracepoint.h (encode_source_string): Constify.
* tui/tui-data.c (tui_partial_win_by_name): Constify.
* tui/tui-data.h (tui_partial_win_by_name): Constify.
* tui/tui-source.c (tui_set_source_content_nil): Constify.
* tui/tui-source.h (tui_set_source_content_nil): Constify.
* tui/tui-win.c (parse_scrolling_args): Constify.
* tui/tui-windata.c (tui_erase_data_content): Constify.
* tui/tui-windata.h (tui_erase_data_content): Constify.
* tui/tui-winsource.c (tui_erase_source_content): Constify.
* tui/tui.c (tui_enable): Add cast.
* utils.c (defaulted_query): Constify.
(init_page_info): Add cast.
(puts_debug, subset_compare): Constify.
* utils.h (subset_compare): Constify.
* varobj.c (varobj_format_string): Constify.
* varobj.h (varobj_format_string): Constify.
* vax-tdep.c (vax_register_name): Constify.
* windows-nat.c (windows_detach): Constify.
* xcoffread.c (process_linenos, xcoff_next_symbol_text): Constify.
* xml-support.c (gdb_xml_end_element): Constify.
* xml-tdesc.c (tdesc_start_reg): Constify.
* xstormy16-tdep.c (xstormy16_register_name): Constify.
* xtensa-tdep.c (xtensa_find_register_by_name): Constify.
* xtensa-tdep.h (xtensa_register_t::name): Constify.
gdb/gdbserver/ChangeLog:
2017-04-05 Pedro Alves <palves@redhat.com>
* gdbreplay.c (sync_error): Constify.
* linux-x86-low.c (push_opcode): Constify.
2017-04-05 20:21:37 +02:00
|
|
|
static const char *
|
2017-03-07 16:49:10 +01:00
|
|
|
pstring_ptr (char **string)
|
|
|
|
{
|
|
|
|
if (string == NULL || *string == NULL)
|
|
|
|
return "(null)";
|
|
|
|
return *string;
|
|
|
|
}
|
|
|
|
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
/* Helper function to print a list of strings, represented as "const
|
|
|
|
char *const *". The list is printed comma-separated. */
|
|
|
|
|
-Wwrite-strings: The Rest
This is the remainder boring constification that all looks more of less
borderline obvious IMO.
gdb/ChangeLog:
2017-04-05 Pedro Alves <palves@redhat.com>
* ada-exp.y (yyerror): Constify.
* ada-lang.c (bound_name, get_selections)
(ada_variant_discrim_type)
(ada_variant_discrim_name, ada_value_struct_elt)
(ada_lookup_struct_elt_type, is_unchecked_variant)
(ada_which_variant_applies, standard_exc, ada_get_next_arg)
(catch_ada_exception_command_split)
(catch_ada_assert_command_split, catch_assert_command)
(ada_op_name): Constify.
* ada-lang.h (ada_yyerror, get_selections)
(ada_variant_discrim_name, ada_value_struct_elt): Constify.
* arc-tdep.c (arc_print_frame_cache): Constify.
* arm-tdep.c (arm_skip_stub): Constify.
* ax-gdb.c (gen_binop, gen_struct_ref_recursive, gen_struct_ref)
(gen_aggregate_elt_ref): Constify.
* bcache.c (print_bcache_statistics): Constify.
* bcache.h (print_bcache_statistics): Constify.
* break-catch-throw.c (catch_exception_command_1):
* breakpoint.c (struct ep_type_description::description):
Constify.
(add_solib_catchpoint): Constify.
(catch_fork_command_1): Add cast.
(add_catch_command): Constify.
* breakpoint.h (add_catch_command, add_solib_catchpoint):
Constify.
* bsd-uthread.c (bsd_uthread_state): Constify.
* buildsym.c (patch_subfile_names): Constify.
* buildsym.h (next_symbol_text_func, patch_subfile_names):
Constify.
* c-exp.y (yyerror): Constify.
(token::oper): Constify.
* c-lang.h (c_yyerror, cp_print_class_member): Constify.
* c-varobj.c (cplus_describe_child): Constify.
* charset.c (find_charset_names): Add cast.
(find_charset_names): Constify array and add const_cast.
* cli/cli-cmds.c (complete_command, cd_command): Constify.
(edit_command): Constify.
* cli/cli-decode.c (lookup_cmd): Constify.
* cli/cli-dump.c (dump_memory_command, dump_value_command):
Constify.
(struct dump_context): Constify.
(add_dump_command, restore_command): Constify.
* cli/cli-script.c (get_command_line): Constify.
* cli/cli-script.h (get_command_line): Constify.
* cli/cli-utils.c (check_for_argument): Constify.
* cli/cli-utils.h (check_for_argument): Constify.
* coff-pe-read.c (struct read_pe_section_data): Constify.
* command.h (lookup_cmd): Constify.
* common/print-utils.c (decimal2str): Constify.
* completer.c (gdb_print_filename): Constify.
* corefile.c (set_gnutarget): Constify.
* cp-name-parser.y (yyerror): Constify.
* cp-valprint.c (cp_print_class_member): Constify.
* cris-tdep.c (cris_register_name, crisv32_register_name):
Constify.
* d-exp.y (yyerror): Constify.
(struct token::oper): Constify.
* d-lang.h (d_yyerror): Constify.
* dbxread.c (struct header_file_location::name): Constify.
(add_old_header_file, add_new_header_file, last_function_name)
(dbx_next_symbol_text, add_bincl_to_list)
(find_corresponding_bincl_psymtab, set_namestring)
(find_stab_function_addr, read_dbx_symtab, start_psymtab)
(dbx_end_psymtab, read_ofile_symtab, process_one_symbol):
* defs.h (command_line_input, print_address_symbolic)
(deprecated_readline_begin_hook): Constify.
* dwarf2read.c (anonymous_struct_prefix, dwarf_bool_name):
Constify.
* event-top.c (handle_line_of_input): Constify and add cast.
* exceptions.c (catch_errors): Constify.
* exceptions.h (catch_errors): Constify.
* expprint.c (print_subexp_standard, op_string, op_name)
(op_name_standard, dump_raw_expression, dump_raw_expression):
* expression.h (op_name, op_string, dump_raw_expression):
Constify.
* f-exp.y (yyerror): Constify.
(struct token::oper): Constify.
(struct f77_boolean_val::name): Constify.
* f-lang.c (f_word_break_characters): Constify.
* f-lang.h (f_yyerror): Constify.
* fork-child.c (fork_inferior): Add cast.
* frv-tdep.c (struct gdbarch_tdep::register_names): Constify.
(new_variant): Constify.
* gdbarch.sh (pstring_ptr, pstring_list): Constify.
* gdbarch.c: Regenerate.
* gdbcore.h (set_gnutarget): Constify.
* go-exp.y (yyerror): Constify.
(token::oper): Constify.
* go-lang.h (go_yyerror): Constify.
* go32-nat.c (go32_sysinfo): Constify.
* guile/scm-breakpoint.c (gdbscm_breakpoint_expression): Constify.
* guile/scm-cmd.c (cmdscm_function): Constify.
* guile/scm-param.c (pascm_param_value): Constify.
* h8300-tdep.c (h8300_register_name, h8300s_register_name)
(h8300sx_register_name): Constify.
* hppa-tdep.c (hppa32_register_name, hppa64_register_name):
Constify.
* ia64-tdep.c (ia64_register_names): Constify.
* infcmd.c (construct_inferior_arguments): Constify.
(path_command, attach_post_wait): Constify.
* language.c (show_range_command, show_case_command)
(unk_lang_error): Constify.
* language.h (language_defn::la_error)
(language_defn::la_name_of_this): Constify.
* linespec.c (decode_line_2): Constify.
* linux-thread-db.c (thread_db_err_str): Constify.
* lm32-tdep.c (lm32_register_name): Constify.
* m2-exp.y (yyerror): Constify.
* m2-lang.h (m2_yyerror): Constify.
* m32r-tdep.c (m32r_register_names): Constify and make static.
* m68hc11-tdep.c (m68hc11_register_names): Constify.
* m88k-tdep.c (m88k_register_name): Constify.
* macroexp.c (appendmem): Constify.
* mdebugread.c (fdr_name, add_data_symbol, parse_type)
(upgrade_type, parse_external, parse_partial_symbols)
(mdebug_next_symbol_text, cross_ref, mylookup_symbol, new_psymtab)
(new_symbol): Constify.
* memattr.c (mem_info_command): Constify.
* mep-tdep.c (register_name_from_keyword): Constify.
* mi/mi-cmd-env.c (mi_cmd_env_path, _initialize_mi_cmd_env):
Constify.
* mi/mi-cmd-stack.c (list_args_or_locals): Constify.
* mi/mi-cmd-var.c (mi_cmd_var_show_attributes): Constify.
* mi/mi-main.c (captured_mi_execute_command): Constify and add
cast.
(mi_execute_async_cli_command): Constify.
* mips-tdep.c (mips_register_name): Constify.
* mn10300-tdep.c (register_name, mn10300_generic_register_name)
(am33_register_name, am33_2_register_name)
* moxie-tdep.c (moxie_register_names): Constify.
* nat/linux-osdata.c (osdata_type): Constify fields.
* nto-tdep.c (nto_parse_redirection): Constify.
* objc-lang.c (lookup_struct_typedef, lookup_objc_class)
(lookup_child_selector): Constify.
(objc_methcall::name): Constify.
* objc-lang.h (lookup_objc_class, lookup_child_selector)
(lookup_struct_typedef): Constify.
* objfiles.c (pc_in_section): Constify.
* objfiles.h (pc_in_section): Constify.
* p-exp.y (struct token::oper): Constify.
(yyerror): Constify.
* p-lang.h (pascal_yyerror): Constify.
* parser-defs.h (op_name_standard): Constify.
(op_print::string): Constify.
(exp_descriptor::op_name): Constify.
* printcmd.c (print_address_symbolic): Constify.
* psymtab.c (print_partial_symbols): Constify.
* python/py-breakpoint.c (stop_func): Constify.
(bppy_get_expression): Constify.
* python/py-cmd.c (cmdpy_completer::name): Constify.
(cmdpy_function): Constify.
* python/py-event.c (evpy_add_attribute)
(gdbpy_initialize_event_generic): Constify.
* python/py-event.h (evpy_add_attribute)
(gdbpy_initialize_event_generic): Constify.
* python/py-evts.c (add_new_registry): Constify.
* python/py-finishbreakpoint.c (outofscope_func): Constify.
* python/py-framefilter.c (get_py_iter_from_func): Constify.
* python/py-inferior.c (get_buffer): Add cast.
* python/py-param.c (parm_constant::name): Constify.
* python/py-unwind.c (fprint_frame_id): Constify.
* python/python.c (gdbpy_parameter_value): Constify.
* remote-fileio.c (remote_fio_func_map): Make 'name' const.
* remote.c (memory_packet_config::name): Constify.
(show_packet_config_cmd, remote_write_bytes)
(remote_buffer_add_string):
* reverse.c (exec_reverse_once): Constify.
* rs6000-tdep.c (variant::name, variant::description): Constify.
* rust-exp.y (rustyyerror): Constify.
* rust-lang.c (rust_op_name): Constify.
* rust-lang.h (rustyyerror): Constify.
* serial.h (serial_ops::name): Constify.
* sh-tdep.c (sh_sh_register_name, sh_sh3_register_name)
(sh_sh3e_register_name, sh_sh2e_register_name)
(sh_sh2a_register_name, sh_sh2a_nofpu_register_name)
(sh_sh_dsp_register_name, sh_sh3_dsp_register_name)
(sh_sh4_register_name, sh_sh4_nofpu_register_name)
(sh_sh4al_dsp_register_name): Constify.
* sh64-tdep.c (sh64_register_name): Constify.
* solib-darwin.c (lookup_symbol_from_bfd): Constify.
* spu-tdep.c (spu_register_name, info_spu_dma_cmdlist): Constify.
* stabsread.c (patch_block_stabs, read_type_number)
(ref_map::stabs, ref_add, process_reference)
(symbol_reference_defined, define_symbol, define_symbol)
(error_type, read_type, read_member_functions, read_cpp_abbrev)
(read_one_struct_field, read_struct_fields, read_baseclasses)
(read_tilde_fields, read_struct_type, read_array_type)
(read_enum_type, read_sun_builtin_type, read_sun_floating_type)
(read_huge_number, read_range_type, read_args, common_block_start)
(find_name_end): Constify.
* stabsread.h (common_block_start, define_symbol)
(process_one_symbol, symbol_reference_defined, ref_add):
* symfile.c (get_section_index, add_symbol_file_command):
* symfile.h (get_section_index): Constify.
* target-descriptions.c (tdesc_type::name): Constify.
(tdesc_free_type): Add cast.
* target.c (find_default_run_target):
(add_deprecated_target_alias, find_default_run_target)
(target_announce_detach): Constify.
(do_option): Constify.
* target.h (add_deprecated_target_alias): Constify.
* thread.c (print_thread_info_1): Constify.
* top.c (deprecated_readline_begin_hook, command_line_input):
Constify.
(init_main): Add casts.
* top.h (handle_line_of_input): Constify.
* tracefile-tfile.c (tfile_write_uploaded_tsv): Constify.
* tracepoint.c (tvariables_info_1, trace_status_mi): Constify.
(tfind_command): Rename to ...
(tfind_command_1): ... this and constify.
(tfind_command): New function.
(tfind_end_command, tfind_start_command): Adjust.
(encode_source_string): Constify.
* tracepoint.h (encode_source_string): Constify.
* tui/tui-data.c (tui_partial_win_by_name): Constify.
* tui/tui-data.h (tui_partial_win_by_name): Constify.
* tui/tui-source.c (tui_set_source_content_nil): Constify.
* tui/tui-source.h (tui_set_source_content_nil): Constify.
* tui/tui-win.c (parse_scrolling_args): Constify.
* tui/tui-windata.c (tui_erase_data_content): Constify.
* tui/tui-windata.h (tui_erase_data_content): Constify.
* tui/tui-winsource.c (tui_erase_source_content): Constify.
* tui/tui.c (tui_enable): Add cast.
* utils.c (defaulted_query): Constify.
(init_page_info): Add cast.
(puts_debug, subset_compare): Constify.
* utils.h (subset_compare): Constify.
* varobj.c (varobj_format_string): Constify.
* varobj.h (varobj_format_string): Constify.
* vax-tdep.c (vax_register_name): Constify.
* windows-nat.c (windows_detach): Constify.
* xcoffread.c (process_linenos, xcoff_next_symbol_text): Constify.
* xml-support.c (gdb_xml_end_element): Constify.
* xml-tdesc.c (tdesc_start_reg): Constify.
* xstormy16-tdep.c (xstormy16_register_name): Constify.
* xtensa-tdep.c (xtensa_find_register_by_name): Constify.
* xtensa-tdep.h (xtensa_register_t::name): Constify.
gdb/gdbserver/ChangeLog:
2017-04-05 Pedro Alves <palves@redhat.com>
* gdbreplay.c (sync_error): Constify.
* linux-x86-low.c (push_opcode): Constify.
2017-04-05 20:21:37 +02:00
|
|
|
static const char *
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
pstring_list (const char *const *list)
|
|
|
|
{
|
|
|
|
static char ret[100];
|
|
|
|
const char *const *p;
|
|
|
|
size_t offset = 0;
|
|
|
|
|
|
|
|
if (list == NULL)
|
|
|
|
return "(null)";
|
|
|
|
|
|
|
|
ret[0] = '\0';
|
|
|
|
for (p = list; *p != NULL && offset < sizeof (ret); ++p)
|
|
|
|
{
|
|
|
|
size_t s = xsnprintf (ret + offset, sizeof (ret) - offset, "%s, ", *p);
|
|
|
|
offset += 2 + s;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (offset > 0)
|
|
|
|
{
|
|
|
|
gdb_assert (offset - 2 < sizeof (ret));
|
|
|
|
ret[offset - 2] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Maintain the struct gdbarch object. */
|
1999-06-14 20:08:47 +02:00
|
|
|
|
|
|
|
struct gdbarch
|
1999-07-20 01:30:11 +02:00
|
|
|
{
|
2002-06-08 20:09:01 +02:00
|
|
|
/* Has this architecture been fully initialized? */
|
|
|
|
int initialized_p;
|
2003-07-22 21:49:58 +02:00
|
|
|
|
|
|
|
/* An obstack bound to the lifetime of the architecture. */
|
|
|
|
struct obstack *obstack;
|
|
|
|
|
2011-01-07 20:36:19 +01:00
|
|
|
/* basic architectural information. */
|
1999-07-20 01:30:11 +02:00
|
|
|
const struct bfd_arch_info * bfd_arch_info;
|
2014-01-02 04:02:56 +01:00
|
|
|
enum bfd_endian byte_order;
|
|
|
|
enum bfd_endian byte_order_for_code;
|
2003-01-05 00:38:46 +01:00
|
|
|
enum gdb_osabi osabi;
|
2006-11-28 23:10:26 +01:00
|
|
|
const struct target_desc * target_desc;
|
1999-06-14 20:08:47 +02:00
|
|
|
|
2011-01-07 20:36:19 +01:00
|
|
|
/* target specific vector. */
|
1999-07-20 01:30:11 +02:00
|
|
|
struct gdbarch_tdep *tdep;
|
2000-06-10 07:37:47 +02:00
|
|
|
gdbarch_dump_tdep_ftype *dump_tdep;
|
1999-06-14 20:08:47 +02:00
|
|
|
|
2011-01-07 20:36:19 +01:00
|
|
|
/* per-architecture data-pointers. */
|
2001-02-07 03:17:48 +01:00
|
|
|
unsigned nr_data;
|
1999-07-20 01:30:11 +02:00
|
|
|
void **data;
|
1999-06-14 20:08:47 +02:00
|
|
|
|
1999-07-20 01:30:11 +02:00
|
|
|
/* Multi-arch values.
|
1999-06-14 20:08:47 +02:00
|
|
|
|
1999-07-20 01:30:11 +02:00
|
|
|
When extending this structure you must:
|
1999-06-14 20:08:47 +02:00
|
|
|
|
1999-07-20 01:30:11 +02:00
|
|
|
Add the field below.
|
1999-06-14 20:08:47 +02:00
|
|
|
|
1999-07-20 01:30:11 +02:00
|
|
|
Declare set/get functions and define the corresponding
|
|
|
|
macro in gdbarch.h.
|
1999-06-14 20:08:47 +02:00
|
|
|
|
1999-07-20 01:30:11 +02:00
|
|
|
gdbarch_alloc(): If zero/NULL is not a suitable default,
|
|
|
|
initialize the new field.
|
1999-06-14 20:08:47 +02:00
|
|
|
|
1999-07-20 01:30:11 +02:00
|
|
|
verify_gdbarch(): Confirm that the target updated the field
|
|
|
|
correctly.
|
1999-06-14 20:08:47 +02:00
|
|
|
|
2000-10-27 17:02:42 +02:00
|
|
|
gdbarch_dump(): Add a fprintf_unfiltered call so that the new
|
1999-07-20 01:30:11 +02:00
|
|
|
field is dumped out
|
1999-06-14 20:08:47 +02:00
|
|
|
|
1999-07-20 01:30:11 +02:00
|
|
|
get_gdbarch(): Implement the set/get functions (probably using
|
|
|
|
the macro's as shortcuts).
|
1999-06-14 20:08:47 +02:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
2008-01-18 18:07:40 +01:00
|
|
|
int bits_big_endian;
|
1999-07-20 01:30:11 +02:00
|
|
|
int short_bit;
|
|
|
|
int int_bit;
|
|
|
|
int long_bit;
|
|
|
|
int long_long_bit;
|
2011-10-11 21:08:59 +02:00
|
|
|
int long_long_align_bit;
|
2010-07-06 14:56:24 +02:00
|
|
|
int half_bit;
|
|
|
|
const struct floatformat ** half_format;
|
1999-07-20 01:30:11 +02:00
|
|
|
int float_bit;
|
* doublest.c (floatformat_from_length): Use the right element from
gdbarch floatformats.
(floatformat_from_type, extract_typed_floating)
(store_typed_floating): Likewise.
* doublest.h: Remove declarations for undefined floatformat arrays.
* gdbarch.sh (float_format, double_format, long_double_format): Change
to pairs.
(pformat): Update for pairs.
* gdbarch.c, gdbarch.h: Regenerated.
* gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double)
(floatformats_ieee_double_littlebyte_bigword)
(floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext)
(floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f)
(floatformats_vax_d): New variables.
(builtin_type_ieee_single, builtin_type_ieee_double)
(builtin_type_arm_ext, builtin_type_ia64_spill)
(builtin_type_ia64_quad): Replace arrays with individual types.
(builtin_type_ieee_single_big, builtin_type_ieee_single_little)
(builtin_type_ieee_double_big, builtin_type_ieee_double_little)
(builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext)
(builtin_type_m88110_ext, builtin_type_m88110_harris_ext)
(builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword)
(builtin_type_ia64_spill_big, builtin_type_ia64_spill_little)
(builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete
unused and endian-specific types.
(recursive_dump_type): Update for floatformat pairs.
(build_flt): Move higher. Handle bit == -1. Take a floatformat pair.
(build_gdbtypes): Use build_flt.
(_initialize_gdbtypes): Update set of initialized types.
* gdbtypes.h: Update declarations to match gdbtypes.c.
(struct main_type): Store a pointer to two floatformats.
* arch-utils.c (default_float_format, default_double_format): Delete.
* arch-utils.h (default_float_format, default_double_format): Delete.
* arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c,
ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c,
mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c,
sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c,
vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
2007-01-29 18:31:06 +01:00
|
|
|
const struct floatformat ** float_format;
|
1999-07-20 01:30:11 +02:00
|
|
|
int double_bit;
|
* doublest.c (floatformat_from_length): Use the right element from
gdbarch floatformats.
(floatformat_from_type, extract_typed_floating)
(store_typed_floating): Likewise.
* doublest.h: Remove declarations for undefined floatformat arrays.
* gdbarch.sh (float_format, double_format, long_double_format): Change
to pairs.
(pformat): Update for pairs.
* gdbarch.c, gdbarch.h: Regenerated.
* gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double)
(floatformats_ieee_double_littlebyte_bigword)
(floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext)
(floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f)
(floatformats_vax_d): New variables.
(builtin_type_ieee_single, builtin_type_ieee_double)
(builtin_type_arm_ext, builtin_type_ia64_spill)
(builtin_type_ia64_quad): Replace arrays with individual types.
(builtin_type_ieee_single_big, builtin_type_ieee_single_little)
(builtin_type_ieee_double_big, builtin_type_ieee_double_little)
(builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext)
(builtin_type_m88110_ext, builtin_type_m88110_harris_ext)
(builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword)
(builtin_type_ia64_spill_big, builtin_type_ia64_spill_little)
(builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete
unused and endian-specific types.
(recursive_dump_type): Update for floatformat pairs.
(build_flt): Move higher. Handle bit == -1. Take a floatformat pair.
(build_gdbtypes): Use build_flt.
(_initialize_gdbtypes): Update set of initialized types.
* gdbtypes.h: Update declarations to match gdbtypes.c.
(struct main_type): Store a pointer to two floatformats.
* arch-utils.c (default_float_format, default_double_format): Delete.
* arch-utils.h (default_float_format, default_double_format): Delete.
* arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c,
ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c,
mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c,
sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c,
vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
2007-01-29 18:31:06 +01:00
|
|
|
const struct floatformat ** double_format;
|
1999-07-20 01:30:11 +02:00
|
|
|
int long_double_bit;
|
* doublest.c (floatformat_from_length): Use the right element from
gdbarch floatformats.
(floatformat_from_type, extract_typed_floating)
(store_typed_floating): Likewise.
* doublest.h: Remove declarations for undefined floatformat arrays.
* gdbarch.sh (float_format, double_format, long_double_format): Change
to pairs.
(pformat): Update for pairs.
* gdbarch.c, gdbarch.h: Regenerated.
* gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double)
(floatformats_ieee_double_littlebyte_bigword)
(floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext)
(floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f)
(floatformats_vax_d): New variables.
(builtin_type_ieee_single, builtin_type_ieee_double)
(builtin_type_arm_ext, builtin_type_ia64_spill)
(builtin_type_ia64_quad): Replace arrays with individual types.
(builtin_type_ieee_single_big, builtin_type_ieee_single_little)
(builtin_type_ieee_double_big, builtin_type_ieee_double_little)
(builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext)
(builtin_type_m88110_ext, builtin_type_m88110_harris_ext)
(builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword)
(builtin_type_ia64_spill_big, builtin_type_ia64_spill_little)
(builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete
unused and endian-specific types.
(recursive_dump_type): Update for floatformat pairs.
(build_flt): Move higher. Handle bit == -1. Take a floatformat pair.
(build_gdbtypes): Use build_flt.
(_initialize_gdbtypes): Update set of initialized types.
* gdbtypes.h: Update declarations to match gdbtypes.c.
(struct main_type): Store a pointer to two floatformats.
* arch-utils.c (default_float_format, default_double_format): Delete.
* arch-utils.h (default_float_format, default_double_format): Delete.
* arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c,
ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c,
mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c,
sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c,
vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
2007-01-29 18:31:06 +01:00
|
|
|
const struct floatformat ** long_double_format;
|
Teach GDB that wchar_t is a built-in type in C++ mode
GDB is currently not aware that wchar_t is a built-in type in C++
mode. This is usually not a problem because the debug info describes
the type, so when you have a program loaded, you don't notice this.
However, if you try expressions involving wchar_t before a program is
loaded, gdb errors out:
(gdb) p (wchar_t)-1
No symbol table is loaded. Use the "file" command.
(gdb) p L"hello"
No type named wchar_t.
(gdb) ptype L"hello"
No type named wchar_t.
This commit teaches gdb about the type. After:
(gdb) p (wchar_t)-1
$1 = -1 L'\xffffffff'
(gdb) p L"hello"
$2 = L"hello"
(gdb) ptype L"hello"
type = wchar_t [6]
Unlike char16_t/char32_t, unfortunately, the underlying type of
wchar_t is implementation dependent, both size and signness. So this
requires adding a couple new gdbarch hooks.
I grepped the GCC code base for WCHAR_TYPE and WCHAR_TYPE_SIZE, and it
seems to me that the majority of the ABIs have a 4-byte signed
wchar_t, so that's what I made the default for GDB too. And then I
looked for which ports have a 16-bit and/or unsigned wchar_t, and made
GDB follow suit.
gdb/ChangeLog:
2017-04-12 Pedro Alves <palves@redhat.com>
PR gdb/21323
* c-lang.c (cplus_primitive_types) <cplus_primitive_type_wchar_t>:
New enum value.
(cplus_language_arch_info): Register cplus_primitive_type_wchar_t.
* gdbtypes.h (struct builtin_type) <builtin_wchar>: New field.
* gdbtypes.c (gdbtypes_post_init): Create the "wchar_t" type.
* gdbarch.sh (wchar_bit, wchar_signed): New per-arch values.
* gdbarch.h, gdbarch.c: Regenerate.
* aarch64-tdep.c (aarch64_gdbarch_init): Override
gdbarch_wchar_bit and gdbarch_wchar_signed.
* alpha-tdep.c (alpha_gdbarch_init): Likewise.
* arm-tdep.c (arm_gdbarch_init): Likewise.
* avr-tdep.c (avr_gdbarch_init): Likewise.
* h8300-tdep.c (h8300_gdbarch_init): Likewise.
* i386-nto-tdep.c (i386nto_init_abi): Likewise.
* i386-tdep.c (i386_go32_init_abi): Likewise.
* m32r-tdep.c (m32r_gdbarch_init): Likewise.
* moxie-tdep.c (moxie_gdbarch_init): Likewise.
* nds32-tdep.c (nds32_gdbarch_init): Likewise.
* rs6000-aix-tdep.c (rs6000_aix_init_osabi): Likewise.
* sh-tdep.c (sh_gdbarch_init): Likewise.
* sparc-tdep.c (sparc32_gdbarch_init): Likewise.
* sparc64-tdep.c (sparc64_init_abi): Likewise.
* windows-tdep.c (windows_init_abi): Likewise.
* xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise.
gdb/testsuite/ChangeLog:
2017-04-12 Pedro Alves <palves@redhat.com>
PR gdb/21323
* gdb.cp/wide_char_types.c: Include <wchar.h>.
(wchar): New global.
* gdb.cp/wide_char_types.exp (wide_char_types_program)
(do_test_wide_char, wide_char_types_no_program, top level): Add
wchar_t testing.
2017-04-12 15:00:49 +02:00
|
|
|
int wchar_bit;
|
|
|
|
int wchar_signed;
|
Add gdbarch callback to provide formats for debug info float types
At this point, all TYPE_CODE_FLT types carry their floating-point format,
except for those creating from reading DWARF or stabs debug info. Those
will be addressed by this commit.
The main issue here is that we actually have to determine which floating-
point format to use. Currently, we only have the type length as input
to this decision. In the future, we may hopefully get --at least in
DWARF-- additional information to help disambiguate multiple different
formats of the same length. For now, we can still look at the type name
as a hint.
This decision logic is encapsulated in a gdbarch callback to allow
platform-specific overrides. The default implementation use the same
logic (compare type length against the various gdbarch_..._bit sizes)
that is currently implemented in floatformat_from_length.
With this commit, all platforms still use the default logic, so there
should be no actual change in behavior. A follow-on commit will add
support for __float128 on Intel and Power.
Once dwarf2read.c and stabsread.c make use of the new callback to
determine floating-point formats, we're now sure every TYPE_CODE_FLT
type will always carry its format. The commit therefore adds asserts
to verify_floatformat to ensure new code will continue to always
provide formats, and removes the code in floatformat_from_type that
used to handle types with a NULL TYPE_FLOATFORMAT.
gdb/ChangeLog:
* gdbarch.sh (floatformat_for_type): New gdbarch callback.
* gdbarch.h, gdbarch.c: Re-generate.
* arch-utils.h (default_floatformat_for_type): New prototype.
* arch-utils.c (default_floatformat_for_type): New function.
* doublest.c (floatformat_from_length): Remove.
(floatformat_from_type): Assume TYPE_FLOATFORMAT is non-NULL.
* gdbtypes.c (verify_floatformat): Require non-NULL format.
* dwarf2read.c (dwarf2_init_float_type): New function.
(read_base_type): Use it.
* stabsread.c (dbx_init_float_type): New function.
(read_sun_floating_type): Use it.
(read_range_type): Likewise.
Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-06 17:31:53 +02:00
|
|
|
gdbarch_floatformat_for_type_ftype *floatformat_for_type;
|
2000-08-11 04:55:38 +02:00
|
|
|
int ptr_bit;
|
2000-08-25 22:51:19 +02:00
|
|
|
int addr_bit;
|
2010-08-06 21:02:15 +02:00
|
|
|
int dwarf2_addr_size;
|
2001-12-20 04:26:08 +01:00
|
|
|
int char_signed;
|
1999-07-20 01:30:11 +02:00
|
|
|
gdbarch_read_pc_ftype *read_pc;
|
|
|
|
gdbarch_write_pc_ftype *write_pc;
|
2001-08-11 02:59:29 +02:00
|
|
|
gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer;
|
2002-08-02 16:48:19 +02:00
|
|
|
gdbarch_pseudo_register_read_ftype *pseudo_register_read;
|
2011-07-22 17:31:52 +02:00
|
|
|
gdbarch_pseudo_register_read_value_ftype *pseudo_register_read_value;
|
2002-08-02 16:48:19 +02:00
|
|
|
gdbarch_pseudo_register_write_ftype *pseudo_register_write;
|
1999-07-20 01:30:11 +02:00
|
|
|
int num_regs;
|
2000-07-24 16:25:22 +02:00
|
|
|
int num_pseudo_regs;
|
2010-12-28 17:00:13 +01:00
|
|
|
gdbarch_ax_pseudo_register_collect_ftype *ax_pseudo_register_collect;
|
|
|
|
gdbarch_ax_pseudo_register_push_stack_ftype *ax_pseudo_register_push_stack;
|
Intel MPX bound violation handling
With Intel Memory Protection Extensions it was introduced the concept of
boundary violation. A boundary violations is presented to the inferior as
a segmentation fault having SIGCODE 3. This patch adds a
handler for a boundary violation extending the information displayed
when a bound violation is presented to the inferior. In the stop mode
case the debugger will also display the kind of violation: "upper" or
"lower", bounds and the address accessed.
On no stop mode the information will still remain unchanged. Additional
information about bound violations are not meaningful in that case user
does not know the line in which violation occurred as well.
When the segmentation fault handler is stop mode the out puts will be
changed as exemplified below.
The usual output of a segfault is:
Program received signal SIGSEGV, Segmentation fault
0x0000000000400d7c in upper (p=0x603010, a=0x603030, b=0x603050,
c=0x603070, d=0x603090, len=7) at i386-mpx-sigsegv.c:68
68 value = *(p + len);
In case it is a bound violation it will be presented as:
Program received signal SIGSEGV, Segmentation fault
Upper bound violation while accessing address 0x7fffffffc3b3
Bounds: [lower = 0x7fffffffc390, upper = 0x7fffffffc3a3]
0x0000000000400d7c in upper (p=0x603010, a=0x603030, b=0x603050,
c=0x603070, d=0x603090, len=7) at i386-mpx-sigsegv.c:68
68 value = *(p + len);
In mi mode the output of a segfault is:
*stopped,reason="signal-received",signal-name="SIGSEGV",
signal-meaning="Segmentation fault", frame={addr="0x0000000000400d7c",
func="upper",args=[{name="p", value="0x603010"},{name="a",value="0x603030"}
,{name="b",value="0x603050"}, {name="c",value="0x603070"},
{name="d",value="0x603090"},{name="len",value="7"}],
file="i386-mpx-sigsegv.c",fullname="i386-mpx-sigsegv.c",line="68"},
thread-id="1",stopped-threads="all",core="6"
in the case of a bound violation:
*stopped,reason="signal-received",signal-name="SIGSEGV",
signal-meaning="Segmentation fault",
sigcode-meaning="Upper bound violation",
lower-bound="0x603010",upper-bound="0x603023",bound-access="0x60302f",
frame={addr="0x0000000000400d7c",func="upper",args=[{name="p",
value="0x603010"},{name="a",value="0x603030"},{name="b",value="0x603050"},
{name="c",value="0x603070"},{name="d",value="0x603090"},
{name="len",value="7"}],file="i386-mpx-sigsegv.c",
fullname="i386-mpx-sigsegv.c",line="68"},thread-id="1",
stopped-threads="all",core="6"
2016-02-18 Walfred Tedeschi <walfred.tedeschi@intel.com>
gdb/ChangeLog:
* NEWS: Add entry for bound violation.
* amd64-linux-tdep.c (amd64_linux_init_abi_common):
Add handler for segmentation fault.
* gdbarch.sh (handle_segmentation_fault): New.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* i386-linux-tdep.c (i386_linux_handle_segmentation_fault): New.
(SIG_CODE_BONDARY_FAULT): New define.
(i386_linux_init_abi): Use i386_mpx_bound_violation_handler.
* i386-linux-tdep.h (i386_linux_handle_segmentation_fault) New.
* i386-tdep.c (i386_mpx_enabled): Add as external.
* i386-tdep.c (i386_mpx_enabled): Add as external.
* infrun.c (handle_segmentation_fault): New function.
(print_signal_received_reason): Use handle_segmentation_fault.
gdb/testsuite/ChangeLog:
* gdb.arch/i386-mpx-sigsegv.c: New file.
* gdb.arch/i386-mpx-sigsegv.exp: New file.
* gdb.arch/i386-mpx-simple_segv.c: New file.
* gdb.arch/i386-mpx-simple_segv.exp: New file.
gdb/doc/ChangeLog:
* gdb.texinfo (Signals): Add bound violation display hints for
a SIGSEGV.
2016-02-18 17:24:59 +01:00
|
|
|
gdbarch_handle_segmentation_fault_ftype *handle_segmentation_fault;
|
1999-07-20 01:30:11 +02:00
|
|
|
int sp_regnum;
|
|
|
|
int pc_regnum;
|
2002-04-06 22:50:10 +02:00
|
|
|
int ps_regnum;
|
2000-05-10 19:38:16 +02:00
|
|
|
int fp0_regnum;
|
2000-12-04 05:01:16 +01:00
|
|
|
gdbarch_stab_reg_to_regnum_ftype *stab_reg_to_regnum;
|
|
|
|
gdbarch_ecoff_reg_to_regnum_ftype *ecoff_reg_to_regnum;
|
|
|
|
gdbarch_sdb_reg_to_regnum_ftype *sdb_reg_to_regnum;
|
|
|
|
gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum;
|
1999-07-20 01:30:11 +02:00
|
|
|
gdbarch_register_name_ftype *register_name;
|
2003-06-13 06:40:34 +02:00
|
|
|
gdbarch_register_type_ftype *register_type;
|
Convert frame unwinders to use the current frame and
"struct value".
* frame.c (frame_debug): Make global.
(get_frame_id): Pass this frame to unwinder routines.
(frame_pc_unwind): Remove unused unwind->prev_pc support.
(do_frame_register_read): Do not discard the return value of
frame_register_read.
(frame_register_unwind): Remove debug messages. Use
frame_unwind_register_value.
(frame_unwind_register_value, get_frame_register_value): New
functions.
(create_new_frame, get_frame_base_address, get_frame_locals_address)
(get_frame_args_address, get_frame_type): Pass this frame to
unwinder routines.
(frame_cleanup_after_sniffer, frame_prepare_for_sniffer): New
functions.
* frame.h: Update comments.
(frame_debug, frame_unwind_register_value, get_frame_register_value)
(frame_prepare_for_sniffer): Declare.
* frame-unwind.h: Update comments and parameter names.
(default_frame_sniffer): Declare.
(frame_prev_register_ftype): Return a struct value *.
(struct frame_unwind): Remove prev_pc member.
(frame_unwind_sniffer_ftype, frame_unwind_append_sniffer): Delete.
(frame_unwind_append_unwinder, frame_unwind_got_optimized)
(frame_unwind_got_register, frame_unwind_got_memory)
(frame_unwind_got_constant, frame_unwind_got_address): Declare.
* frame-base.h: Update comments and parameter names.
* valops.c (value_fetch_lazy): Use get_frame_register_value. Iterate
if necessary. Add debugging output.
* sentinel-frame.c (sentinel_frame_prev_register)
(sentinel_frame_this_id): Update for new signature.
(sentinel_frame_prev_pc): Delete.
(sentinel_frame_unwinder): Remove prev_pc.
* ia64-tdep.c (ia64_libunwind_frame_unwind): Do not initialize
prev_pc.
* libunwind-frame.c (libunwind_frame_unwind): Likewise.
* frame-unwind.c (struct frame_unwind_table_entry): Remove sniffer.
(frame_unwind_append_sniffer): Delete.
(frame_unwind_append_unwinder): New function.
(frame_unwind_find_by_frame): Take this frame. Only use sniffers
from unwinders. Use frame_prepare_for_sniffer.
(default_frame_sniffer, frame_unwind_got_optimized)
(frame_unwind_got_register, frame_unwind_got_memory)
(frame_unwind_got_constant, frame_unwind_got_address): New functions.
* dummy-frame.c (dummy_frame_sniffer): Use gdbarch_dummy_id.
(dummy_frame_prev_register, dummy_frame_this_id): Update for new
signature.
* gdbarch.sh: Replace unwind_dummy_id with dummy_id.
* gdbarch.c, gdbarch.c: Regenerated.
* frame-base.c (default_frame_base_address)
(default_frame_locals_address, default_frame_args_address): Update
for new signature.
(frame_base_find_by_frame): Pass this frame to unwinder routines.
* infcall.c (call_function_by_hand): Update comments.
* Makefile.in (frame-unwind.o): Update dependencies.
* gdbint.texinfo (Stack Frames): New chapter.
(Algorithms): Move Frames text to the new chapter.
(Target Conditionals): Delete SAVE_DUMMY_FRAME_TOS. Document
gdbarch_dummy_id instead of gdbarch_unwind_dummy_id.
2008-04-30 23:16:46 +02:00
|
|
|
gdbarch_dummy_id_ftype *dummy_id;
|
2003-06-14 00:18:49 +02:00
|
|
|
int deprecated_fp_regnum;
|
2003-06-14 01:07:06 +02:00
|
|
|
gdbarch_push_dummy_call_ftype *push_dummy_call;
|
1999-07-20 01:30:11 +02:00
|
|
|
int call_dummy_location;
|
2003-05-03 21:39:23 +02:00
|
|
|
gdbarch_push_dummy_code_ftype *push_dummy_code;
|
Skip unwritable frames in command "finish"
Nowadays, GDB can't insert breakpoint on the return address of the
exception handler on ARM M-profile, because the address is a magic
one 0xfffffff9,
(gdb) bt
#0 CT32B1_IRQHandler () at ../src/timer.c:67
#1 <signal handler called>
#2 main () at ../src/timer.c:127
(gdb) info frame
Stack level 0, frame at 0x200ffa8:
pc = 0x4ec in CT32B1_IRQHandler (../src/timer.c:67); saved pc = 0xfffffff9
called by frame at 0x200ffc8
source language c.
Arglist at 0x200ffa0, args:
Locals at 0x200ffa0, Previous frame's sp is 0x200ffa8
Saved registers:
r7 at 0x200ffa0, lr at 0x200ffa4
(gdb) x/x 0xfffffff9
0xfffffff9: Cannot access memory at address 0xfffffff9
(gdb) finish
Run till exit from #0 CT32B1_IRQHandler () at ../src/timer.c:67
Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?)
Warning:
Cannot insert hardware breakpoint 0.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.
Command aborted.
even some debug probe can't set hardware breakpoint on the magic
address too,
(gdb) hbreak *0xfffffff9
Hardware assisted breakpoint 2 at 0xfffffff9
(gdb) c
Continuing.
Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?)
Warning:
Cannot insert hardware breakpoint 2.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.
Command aborted.
The problem described above is quite similar to PR 8841, in which GDB
can't set breakpoint on signal trampoline, which is mapped to a read-only
page by kernel. The rationale of this patch is to skip "unwritable"
frames when looking for caller frames in command "finish", and a new
gdbarch method code_of_frame_writable is added. This patch fixes
the problem on ARM cortex-m target, but it can be used to fix
PR 8841 too.
gdb:
2016-05-10 Yao Qi <yao.qi@arm.com>
* arch-utils.c (default_code_of_frame_writable): New function.
* arch-utils.h (default_code_of_frame_writable): Declare.
* arm-tdep.c (arm_code_of_frame_writable): New function.
(arm_gdbarch_init): Install gdbarch method
code_of_frame_writable if the target is M-profile.
* frame.c (skip_unwritable_frames): New function.
* frame.h (skip_unwritable_frames): Declare.
* gdbarch.sh (code_of_frame_writable): New.
* gdbarch.c, gdbarch.h: Re-generated.
* infcmd.c (finish_command): Call skip_unwritable_frames.
2016-05-23 18:32:56 +02:00
|
|
|
gdbarch_code_of_frame_writable_ftype *code_of_frame_writable;
|
2003-06-14 01:07:06 +02:00
|
|
|
gdbarch_print_registers_info_ftype *print_registers_info;
|
|
|
|
gdbarch_print_float_info_ftype *print_float_info;
|
|
|
|
gdbarch_print_vector_info_ftype *print_vector_info;
|
|
|
|
gdbarch_register_sim_regno_ftype *register_sim_regno;
|
|
|
|
gdbarch_cannot_fetch_register_ftype *cannot_fetch_register;
|
|
|
|
gdbarch_cannot_store_register_ftype *cannot_store_register;
|
|
|
|
gdbarch_get_longjmp_target_ftype *get_longjmp_target;
|
1999-07-20 01:30:11 +02:00
|
|
|
int believe_pcc_promotion;
|
2002-05-12 05:09:12 +02:00
|
|
|
gdbarch_convert_register_p_ftype *convert_register_p;
|
|
|
|
gdbarch_register_to_value_ftype *register_to_value;
|
|
|
|
gdbarch_value_to_register_ftype *value_to_register;
|
2007-01-08 21:03:49 +01:00
|
|
|
gdbarch_value_from_register_ftype *value_from_register;
|
* 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.
2000-04-14 20:43:41 +02:00
|
|
|
gdbarch_pointer_to_address_ftype *pointer_to_address;
|
|
|
|
gdbarch_address_to_pointer_ftype *address_to_pointer;
|
2001-10-15 20:18:30 +02:00
|
|
|
gdbarch_integer_to_address_ftype *integer_to_address;
|
2003-10-20 17:38:02 +02:00
|
|
|
gdbarch_return_value_ftype *return_value;
|
2012-06-08 16:24:57 +02:00
|
|
|
gdbarch_return_in_first_hidden_param_p_ftype *return_in_first_hidden_param_p;
|
1999-07-20 01:30:11 +02:00
|
|
|
gdbarch_skip_prologue_ftype *skip_prologue;
|
2008-06-12 00:03:49 +02:00
|
|
|
gdbarch_skip_main_prologue_ftype *skip_main_prologue;
|
PowerPC64 ELFv2 ABI: skip global entry point code
This patch handles another aspect of the ELFv2 ABI, which unfortunately
requires common code changes.
In ELFv2, functions may provide both a global and a local entry point.
The global entry point (where the function symbol points to) is intended
to be used for function-pointer or cross-module (PLT) calls, and requires
r12 to be set up to the entry point address itself. The local entry
point (which is found at a fixed offset after the global entry point,
as defined by bits in the symbol table entries' st_other field), instead
expects r2 to be set up to the current TOC.
Now, when setting a breakpoint on a function by name, you really want
that breakpoint to trigger either way, no matter whether the function
is called via its local or global entry point. Since the global entry
point will always fall through into the local entry point, the way to
achieve that is to simply set the breakpoint at the local entry point.
One way to do that would be to have prologue parsing skip the code
sequence that makes up the global entry point. Unfortunately, this
does not work reliably, since -for optimized code- GDB these days
will not actuall invoke the prologue parsing code but instead just
set the breakpoint at the symbol address and rely on DWARF being
correct at any point throughout the function ...
Unfortunately, I don't really see any way to express the notion of
local entry points with the current set of gdbarch callbacks.
Thus this patch adds a new callback, skip_entrypoint, that is
somewhat analogous to skip_prologue, but is called every time
GDB needs to determine a function start address, even in those
cases where GDB decides to not call skip_prologue.
As a side effect, the skip_entrypoint implementation on ppc64
does not need to perform any instruction parsing; it can simply
rely on the local entry point flags in the symbol table entry.
With this implemented, two test cases would still fail to set
the breakpoint correctly, but that's because they use the construct:
gdb_test "break *hello"
Now, using "*hello" explicitly instructs GDB to set the breakpoint
at the numerical value of "hello" treated as function pointer, so
it will by definition only hit the global entry point.
I think this behaviour is unavoidable, but acceptable -- most people
do not use this construct, and if they do, they get what they
asked for ...
In one of those two test cases, use of this construct is really
not appropriate. I think this was added way back when as a means
to work around prologue skipping problems on some platforms. These
days that shouldn't really be necessary any more ...
For the other (step-bt), we really want to make sure backtracing
works on the very first instruction of the routine. To enable that
test also on powerpc64le-linux, we can modify the code to call the
test function via function pointer (which makes it use the global
entry point in the ELFv2 ABI).
gdb/ChangeLog:
* gdbarch.sh (skip_entrypoint): New callback.
* gdbarch.c, gdbarch.h: Regenerate.
* symtab.c (skip_prologue_sal): Call gdbarch_skip_entrypoint.
* infrun.c (fill_in_stop_func): Likewise.
* ppc-linux-tdep.c: Include "elf/ppc64.h".
(ppc_elfv2_elf_make_msymbol_special): New function.
(ppc_elfv2_skip_entrypoint): Likewise.
(ppc_linux_init_abi): Install them for ELFv2.
gdb/testsuite/ChangeLog:
* gdb.base/sigbpt.exp: Do not use "*" when setting breakpoint
on a function.
* gdb.base/step-bt.c: Call hello via function pointer to make
sure its first instruction is executed on powerpc64le-linux.
2014-02-04 18:44:14 +01:00
|
|
|
gdbarch_skip_entrypoint_ftype *skip_entrypoint;
|
1999-07-20 01:30:11 +02:00
|
|
|
gdbarch_inner_than_ftype *inner_than;
|
|
|
|
gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc;
|
New gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind
This patch adds two gdbarch methods breakpoint_kind_from_pc and
sw_breakpoint_from_kind, and uses target_info.placed_size as "kind"
of the breakpoint. This patch updates the usages of
target_info.placed_size.
The "kind" of a breakpoint is determined by gdbarch rather than
target, so we have gdbarch method breakpoint_kind_from_pc, and we
should set target_info.placed_size out of each implementation of
target to_insert_breakpoint. In this way, each target doesn't have
to set target_info.placed_size any more.
This patch also sets target_info.placed_address before
target_insert_breakpoint too, so that target to_insert_breakpoint
can use it, see record_full_insert_breakpoint.
Before we call target_insert_breakpoint, we set
target_info.placed_address and target_info.placed_size like this,
CORE_ADDR addr = bl->target_info.reqstd_address;
bl->target_info.placed_size = gdbarch_breakpoint_kind_from_pc (bl->gdbarch, &addr);
bl->target_info.placed_address = addr;
return target_insert_breakpoint (bl->gdbarch, &bl->target_info);
target_insert_breakpoint may fail, but it doesn't matter to the "kind"
and "placed_address" of a breakpoint. They should be determined by
gdbarch.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): Define
breakpoint_kind_from_pc and sw_breakpoint_from_kind.
(GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN): Likewise.
(SET_GDBARCH_BREAKPOINT_MANIPULATION): Call
set_gdbarch_breakpoint_kind_from_pc and
set_gdbarch_sw_breakpoint_from_kind.
* arm-tdep.c: Add comments.
* bfin-tdep.c: Likewise.
* breakpoint.c (breakpoint_kind): New function.
(insert_bp_location): Set target_info.placed_size and
target_info.placed_address.
(bkpt_insert_location): Likewise.
* cris-tdep.c: Add comments.
* gdbarch.sh (breakpoint_kind_from_pc): New.
(sw_breakpoint_from_kind): New.
* gdbarch.c, gdbarch.h: Regenerated.
* ia64-tdep.c (ia64_memory_insert_breakpoint): Don't set
bp_tgt->placed_size.
(ia64_memory_remove_breakpoint): Don't assert
bp_tgt->placed_size.
(ia64_breakpoint_kind_from_pc): New function.
(ia64_gdbarch_init): Install ia64_breakpoint_kind_from_pc.
* m32r-tdep.c (m32r_memory_insert_breakpoint): Don't set
bp_tgt->placed_size.
* mem-break.c (default_memory_insert_breakpoint): Don't set
bp_tgt->placed_size. Call gdbarch_sw_breakpoint_from_kind.
(default_memory_remove_breakpoint): Call
gdbarch_sw_breakpoint_from_kind.
(memory_validate_breakpoint): Don't check bp_tgt->placed_size.
* mips-tdep.c: Add comments.
* mt-tdep.c: Likewise.
* nios2-tdep.c: Likewise.
* record-full.c (record_full_insert_breakpoint): Don't call
gdbarch_breakpoint_from_pc. Don't set bp_tgt->placed_address
and bp_tgt->placed_size.
* remote.c (remote_insert_breakpoint): Don't call
gdbarch_remote_breakpoint_from_pc. Use bp_tgt->placed_size.
Don't set bp_tgt->placed_address and bp_tgt->placed_size.
(remote_insert_hw_breakpoint): Likewise.
* score-tdep.c: Likewise.
* sh-tdep.c: Likewise.
* tic6x-tdep.c: Likewise.
* v850-tdep.c: Likewise.
* xtensa-tdep.c: Likewise.
2016-11-03 15:35:13 +01:00
|
|
|
gdbarch_breakpoint_kind_from_pc_ftype *breakpoint_kind_from_pc;
|
|
|
|
gdbarch_sw_breakpoint_from_kind_ftype *sw_breakpoint_from_kind;
|
2016-11-03 15:35:14 +01:00
|
|
|
gdbarch_breakpoint_kind_from_current_state_ftype *breakpoint_kind_from_current_state;
|
2003-10-14 01:41:40 +02:00
|
|
|
gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address;
|
1999-10-19 04:47:02 +02:00
|
|
|
gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint;
|
|
|
|
gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint;
|
1999-07-20 01:30:11 +02:00
|
|
|
CORE_ADDR decr_pc_after_break;
|
2004-06-18 23:36:16 +02:00
|
|
|
CORE_ADDR deprecated_function_start_offset;
|
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o)
(xml-tdesc.o): Update.
* xml-support.c: Add a comment.
(gdb_xml_enums_boolean): New variable.
(gdb_xml_parse_attr_enum): Use strcasecmp.
* xml-support.h (gdb_xml_enums_boolean): Declare.
* xml-tdesc.c (struct tdesc_parsing_data): Record current_feature,
next_regnum, and current_union.
(tdesc_start_feature, tdesc_start_reg, tdesc_start_union)
(tdesc_end_union, tdesc_start_field, tdesc_start_vector)
(field_attributes, union_children, reg_attributes, union_attributes)
(vector_attributes, feature_attributes, feature_children): New.
(target_children): Make static. Add <feature>.
(tdesc_elements): Make static.
* target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p)
(struct tdesc_feature, tdesc_feature_p): New types.
(struct target_desc): Add features member.
(struct tdesc_arch_data, tdesc_data): New.
(target_find_description): Clarify error message. Warn about
ignored register descriptions.
(tdesc_has_registers, tdesc_find_feature, tdesc_feature_name)
(tdesc_named_type, tdesc_data_init, tdesc_data_alloc)
(tdesc_data_cleanup, tdesc_numbered_register)
(tdesc_numbered_register_choices, tdesc_find_register)
(tdesc_register_name, tdesc_register_type)
(tdesc_remote_register_number, tdesc_register_reggroup_p)
(set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type)
(set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers)
(tdesc_free_reg, tdesc_create_reg, tdesc_free_feature)
(tdesc_create_feature, tdesc_record_type): New.
(free_target_description): Free features.
(_initialize_target_descriptions): Initialize tdesc_data.
* arch-utils.c (default_remote_register_number): New.
* arch-utils.h (default_remote_register_number): New prototype.
* target-descriptions.h (set_tdesc_pseudo_register_name)
(set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p)
(tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup)
(tdesc_numbered_register, tdesc_numbered_register_choices)
(tdesc_has_registers, tdesc_find_feature, tdesc_feature_name)
(tdesc_named_type, tdesc_create_feature, tdesc_record_type)
(tdesc_create_reg): Declare.
* gdbarch.sh (remote_register_number): New entry.
* gdbarch.c, gdbarch.h: Regenerate.
* remote.c (init_remote_state): Use gdbarch_remote_register_number.
* features/gdb-target.dtd: Add feature, reg, vector, union, and field.
* arm-tdep.c (arm_register_aliases): New.
(arm_register_name_strings): Rename to...
(arm_register_names): ...this. Make const. Delete the old version.
(current_option, arm_register_byte): Delete.
(set_disassembly_style): Simplify. Do not adjust arm_register_names.
(value_of_arm_user_reg): New.
(arm_gdbarch_init): Verify any described registers. Call
tdesc_use_registers. Don't use arm_register_byte. Create aliases
for standard register names.
(_initialize_arm_tdep): Do not adjust arm_register_names.
* user-regs.c (struct user_reg): Add baton member.
(append_user_reg, user_reg_add_builtin, user_regs_init)
(user_reg_add, value_of_user_reg): Use a baton for user
register functions.
* std-regs.c: Update.
* user-regs.h (user_reg_read_ftype, user_reg_add_builtin)
(user_reg_add): Add baton argument.
* NEWS: Mention target description register support.
* features/arm-core.xml, features/arm-fpa.xml: New.
* eval.c (evaluate_subexp_standard): Allow ptype $register
when the program is not running.
* gdb.texinfo (-target-disconnect): Use @smallexample.
(Requirements): Add anchor for Expat. Update description.
(Target Descriptions): Mention Expat.
(Target Description Format): Document new elements. Use
@smallexample.
(Predefined Target Types, Standard Target Features): New sections.
* doc/gdbint.texinfo (Target Descriptions): New section.
* gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp,
gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
|
|
|
gdbarch_remote_register_number_ftype *remote_register_number;
|
2005-03-31 21:58:26 +02:00
|
|
|
gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_address;
|
1999-07-20 01:30:11 +02:00
|
|
|
CORE_ADDR frame_args_skip;
|
2003-03-10 16:28:41 +01:00
|
|
|
gdbarch_unwind_pc_ftype *unwind_pc;
|
2003-06-09 03:02:07 +02:00
|
|
|
gdbarch_unwind_sp_ftype *unwind_sp;
|
1999-07-20 01:30:11 +02:00
|
|
|
gdbarch_frame_num_args_ftype *frame_num_args;
|
2002-09-18 17:37:18 +02:00
|
|
|
gdbarch_frame_align_ftype *frame_align;
|
2003-09-17 21:48:42 +02:00
|
|
|
gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr;
|
2003-08-18 22:04:56 +02:00
|
|
|
int frame_red_zone_size;
|
2000-10-26 09:41:25 +02:00
|
|
|
gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr;
|
2001-06-16 00:10:21 +02:00
|
|
|
gdbarch_addr_bits_remove_ftype *addr_bits_remove;
|
2001-03-24 03:07:49 +01:00
|
|
|
gdbarch_software_single_step_ftype *software_single_step;
|
2004-10-31 18:38:16 +01:00
|
|
|
gdbarch_single_step_through_delay_ftype *single_step_through_delay;
|
2001-09-06 01:44:44 +02:00
|
|
|
gdbarch_print_insn_ftype *print_insn;
|
2001-08-15 17:29:56 +02:00
|
|
|
gdbarch_skip_trampoline_code_ftype *skip_trampoline_code;
|
2003-11-09 13:07:16 +01:00
|
|
|
gdbarch_skip_solib_resolver_ftype *skip_solib_resolver;
|
2002-08-21 01:01:29 +02:00
|
|
|
gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline;
|
2015-05-26 12:59:17 +02:00
|
|
|
gdbarch_stack_frame_destroyed_p_ftype *stack_frame_destroyed_p;
|
2002-02-06 02:20:23 +01:00
|
|
|
gdbarch_elf_make_msymbol_special_ftype *elf_make_msymbol_special;
|
|
|
|
gdbarch_coff_make_msymbol_special_ftype *coff_make_msymbol_special;
|
MIPS: Keep the ISA bit in compressed code addresses
1. Background information
The MIPS architecture, as originally designed and implemented in
mid-1980s has a uniform instruction word size that is 4 bytes, naturally
aligned. As such all MIPS instructions are located at addresses that
have their bits #1 and #0 set to zeroes, and any attempt to execute an
instruction from an address that has any of the two bits set to one
causes an address error exception. This may for example happen when a
jump-register instruction is executed whose register value used as the
jump target has any of these bits set.
Then in mid 1990s LSI sought a way to improve code density for their
TinyRISC family of MIPS cores and invented an alternatively encoded
instruction set in a joint effort with MIPS Technologies (then a
subsidiary of SGI). The new instruction set has been named the MIPS16
ASE (Application-Specific Extension) and uses a variable instruction
word size, which is 2 bytes (as the name of the ASE suggests) for most,
but there are a couple of exceptions that take 4 bytes, and then most of
the 2-byte instructions can be treated with a 2-byte extension prefix to
expand the range of the immediate operands used.
As a result instructions are no longer 4-byte aligned, instead they are
aligned to a multiple of 2. That left the bit #0 still unused for code
references, be it for the standard MIPS (i.e. as originally invented) or
for the MIPS16 instruction set, and based on that observation a clever
trick was invented that on one hand allowed the processor to be
seamlessly switched between the two instruction sets at any time at the
run time while on the other avoided the introduction of any special
control register to do that.
So it is the bit #0 of the instruction address that was chosen as the
selector and named the ISA bit. Any instruction executed at an even
address is interpreted as a standard MIPS instruction (the address still
has to have its bit #1 clear), any instruction executed at an odd
address is interpreted as a MIPS16 instruction.
To switch between modes ordinary jump instructions are used, such as
used for function calls and returns, specifically the bit #0 of the
source register used in jump-register instructions selects the execution
(ISA) mode for the following piece of code to be interpreted in.
Additionally new jump-immediate instructions were added that flipped the
ISA bit to select the opposite mode upon execution. They were
considered necessary to avoid the need to make register jumps in all
cases as the original jump-immediate instructions provided no way to
change the bit #0 at all.
This was all important for cases where standard MIPS and MIPS16 code had
to be mixed, either for compatibility with the existing binary code base
or to access resources not reachable from MIPS16 code (the MIPS16
instruction set only provides access to general-purpose registers, and
not for example floating-point unit registers or privileged coprocessor
0 registers) -- pieces of code in the opposite mode can be executed as
ordinary subroutine calls.
A similar approach has been more recently adopted for the MIPS16
replacement instruction set defined as the so called microMIPS ASE.
This is another instruction set encoding introduced to the MIPS
architecture. Just like the MIPS16 ASE, the microMIPS instruction set
uses a variable-length encoding, where each instruction takes a multiple
of 2 bytes. The ISA bit has been reused and for microMIPS-capable
processors selects between the standard MIPS and the microMIPS mode
instead.
2. Statement of the problem
To put it shortly, MIPS16 and microMIPS code pointers used by GDB are
different to these observed at the run time. This results in the same
expressions being evaluated producing different results in GDB and in
the program being debugged. Obviously it's the results obtained at the
run time that are correct (they define how the program behaves) and
therefore by definition the results obtained in GDB are incorrect.
A bit longer description will record that obviously at the run time the
ISA bit has to be set correctly (refer to background information above
if unsure why so) or the program will not run as expected. This is
recorded in all the executable file structures used at the run time: the
dynamic symbol table (but not always the static one!), the GOT, and
obviously in all the addresses embedded in code or data of the program
itself, calculated by applying the appropriate relocations at the static
link time.
While a program is being processed by GDB, the ISA bit is stripped off
from any code addresses, presumably to make them the same as the
respective raw memory byte address used by the processor to access the
instruction in the instruction fetch access cycle. This stripping is
actually performed outside GDB proper, in BFD, specifically
_bfd_mips_elf_symbol_processing (elfxx-mips.c, see the piece of code at
the very bottom of that function, starting with an: "If this is an
odd-valued function symbol, assume it's a MIPS16 or microMIPS one."
comment).
This function is also responsible for symbol table dumps made by
`objdump' too, so you'll never see the ISA bit reported there by that
tool, you need to use `readelf'.
This is however unlike what is ever done at the run time, the ISA bit
once present is never stripped off, for example a cast like this:
(short *) main
will not strip the ISA bit off and if the resulting pointer is intended
to be used to access instructions as data, for example for software
instruction decoding (like for fault recovery or emulation in a signal
handler) or for self-modifying code then the bit still has to be
stripped off by an explicit AND operation.
This is probably best illustrated with a simple real program example.
Let's consider the following simple program:
$ cat foobar.c
int __attribute__ ((mips16)) foo (void)
{
return 1;
}
int __attribute__ ((mips16)) bar (void)
{
return 2;
}
int __attribute__ ((nomips16)) foo32 (void)
{
return 3;
}
int (*foo32p) (void) = foo32;
int (*foop) (void) = foo;
int fooi = (int) foo;
int
main (void)
{
return foop ();
}
$
This is plain C with no odd tricks, except from the instruction mode
attributes. They are not necessary to trigger this problem, I just put
them here so that the program can be contained in a single source file
and to make it obvious which function is MIPS16 code and which is not.
Let's try it with Linux, so that everyone can repeat this experiment:
$ mips-linux-gnu-gcc -mips16 -g -O2 -o foobar foobar.c
$
Let's have a look at some interesting symbols:
$ mips-linux-gnu-readelf -s foobar | egrep 'table|foo|bar'
Symbol table '.dynsym' contains 7 entries:
Symbol table '.symtab' contains 95 entries:
55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c
66: 0040068c 4 FUNC GLOBAL DEFAULT [MIPS16] 12 bar
68: 00410848 4 OBJECT GLOBAL DEFAULT 21 foo32p
70: 00410844 4 OBJECT GLOBAL DEFAULT 21 foop
78: 00400684 8 FUNC GLOBAL DEFAULT 12 foo32
80: 00400680 4 FUNC GLOBAL DEFAULT [MIPS16] 12 foo
88: 00410840 4 OBJECT GLOBAL DEFAULT 21 fooi
$
Hmm, no sight of the ISA bit, but notice how foo and bar (but not
foo32!) have been marked as MIPS16 functions (ELF symbol structure's
`st_other' field is used for that).
So let's try to run and poke at this program with GDB. I'll be using a
native system for simplicity (I'll be using ellipses here and there to
remove unrelated clutter):
$ ./foobar
$ echo $?
1
$
So far, so good.
$ gdb ./foobar
[...]
(gdb) break main
Breakpoint 1 at 0x400490: file foobar.c, line 23.
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb)
Yay, it worked! OK, so let's poke at it:
(gdb) print main
$1 = {int (void)} 0x400490 <main>
(gdb) print foo32
$2 = {int (void)} 0x400684 <foo32>
(gdb) print foo32p
$3 = (int (*)(void)) 0x400684 <foo32>
(gdb) print bar
$4 = {int (void)} 0x40068c <bar>
(gdb) print foo
$5 = {int (void)} 0x400680 <foo>
(gdb) print foop
$6 = (int (*)(void)) 0x400681 <foo>
(gdb)
A-ha! Here's the difference and finally the ISA bit!
(gdb) print /x fooi
$7 = 0x400681
(gdb) p/x $pc
p/x $pc
$8 = 0x400491
(gdb)
And here as well...
(gdb) advance foo
foo () at foobar.c:4
4 }
(gdb) disassemble
Dump of assembler code for function foo:
0x00400680 <+0>: jr ra
0x00400682 <+2>: li v0,1
End of assembler dump.
(gdb) finish
Run till exit from #0 foo () at foobar.c:4
main () at foobar.c:24
24 }
Value returned is $9 = 1
(gdb) continue
Continuing.
[Inferior 1 (process 14103) exited with code 01]
(gdb)
So let's be a bit inquisitive...
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb)
Actually we do not like to run foo here at all. Let's run bar instead!
(gdb) set foop = bar
(gdb) print foop
$10 = (int (*)(void)) 0x40068c <bar>
(gdb)
Hmm, no ISA bit. Is it going to work?
(gdb) advance bar
bar () at foobar.c:9
9 }
(gdb) p/x $pc
$11 = 0x40068c
(gdb) disassemble
Dump of assembler code for function bar:
=> 0x0040068c <+0>: jr ra
0x0040068e <+2>: li v0,2
End of assembler dump.
(gdb) finish
Run till exit from #0 bar () at foobar.c:9
Program received signal SIGILL, Illegal instruction.
bar () at foobar.c:9
9 }
(gdb)
Oops!
(gdb) p/x $pc
$12 = 0x40068c
(gdb)
We're still there!
(gdb) continue
Continuing.
Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb)
So let's try something else:
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) set foop = foo
(gdb) advance foo
foo () at foobar.c:4
4 }
(gdb) disassemble
Dump of assembler code for function foo:
=> 0x00400680 <+0>: jr ra
0x00400682 <+2>: li v0,1
End of assembler dump.
(gdb) finish
Run till exit from #0 foo () at foobar.c:4
Program received signal SIGILL, Illegal instruction.
foo () at foobar.c:4
4 }
(gdb) continue
Continuing.
Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb)
The same problem!
(gdb) run
Starting program:
/net/build2-lucid-cs/scratch/macro/mips-linux-fsf-gcc/isa-bit/foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) set foop = foo32
(gdb) advance foo32
foo32 () at foobar.c:14
14 }
(gdb) disassemble
Dump of assembler code for function foo32:
=> 0x00400684 <+0>: jr ra
0x00400688 <+4>: li v0,3
End of assembler dump.
(gdb) finish
Run till exit from #0 foo32 () at foobar.c:14
main () at foobar.c:24
24 }
Value returned is $14 = 3
(gdb) continue
Continuing.
[Inferior 1 (process 14113) exited with code 03]
(gdb)
That did work though, so it's the ISA bit only!
(gdb) quit
Enough!
That's the tip of the iceberg only though. So let's rebuild the
executable with some dynamic symbols:
$ mips-linux-gnu-gcc -mips16 -Wl,--export-dynamic -g -O2 -o foobar-dyn foobar.c
$ mips-linux-gnu-readelf -s foobar-dyn | egrep 'table|foo|bar'
Symbol table '.dynsym' contains 32 entries:
6: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar
8: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p
9: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop
15: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32
17: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo
25: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi
Symbol table '.symtab' contains 95 entries:
55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c
69: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar
71: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p
72: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop
79: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32
81: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo
89: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi
$
OK, now the ISA bit is there for a change, but the MIPS16 `st_other'
attribute gone, hmm... What does `objdump' do then:
$ mips-linux-gnu-objdump -Tt foobar-dyn | egrep 'SYMBOL|foo|bar'
foobar-dyn: file format elf32-tradbigmips
SYMBOL TABLE:
00000000 l df *ABS* 00000000 foobar.c
004009cc g F .text 00000004 0xf0 bar
00410b88 g O .data 00000004 foo32p
00410b84 g O .data 00000004 foop
004009c4 g F .text 00000008 foo32
004009c0 g F .text 00000004 0xf0 foo
00410b80 g O .data 00000004 fooi
DYNAMIC SYMBOL TABLE:
004009cc g DF .text 00000004 Base 0xf0 bar
00410b88 g DO .data 00000004 Base foo32p
00410b84 g DO .data 00000004 Base foop
004009c4 g DF .text 00000008 Base foo32
004009c0 g DF .text 00000004 Base 0xf0 foo
00410b80 g DO .data 00000004 Base fooi
$
Hmm, the attribute (0xf0, printed raw) is back, and the ISA bit gone
again.
Let's have a look at some DWARF-2 records GDB uses (I'll be stripping
off a lot here for brevity) -- debug info:
$ mips-linux-gnu-readelf -wi foobar
Contents of the .debug_info section:
[...]
Compilation Unit @ offset 0x88:
Length: 0xbb (32-bit)
Version: 4
Abbrev Offset: 62
Pointer Size: 4
<0><93>: Abbrev Number: 1 (DW_TAG_compile_unit)
<94> DW_AT_producer : (indirect string, offset: 0x19e): GNU C 4.8.0 20120513 (experimental) -meb -mips16 -march=mips32r2 -mhard-float -mllsc -mplt -mno-synci -mno-shared -mabi=32 -g -O2
<98> DW_AT_language : 1 (ANSI C)
<99> DW_AT_name : (indirect string, offset: 0x190): foobar.c
<9d> DW_AT_comp_dir : (indirect string, offset: 0x225): [...]
<a1> DW_AT_ranges : 0x0
<a5> DW_AT_low_pc : 0x0
<a9> DW_AT_stmt_list : 0x27
<1><ad>: Abbrev Number: 2 (DW_TAG_subprogram)
<ae> DW_AT_external : 1
<ae> DW_AT_name : foo
<b2> DW_AT_decl_file : 1
<b3> DW_AT_decl_line : 1
<b4> DW_AT_prototyped : 1
<b4> DW_AT_type : <0xc2>
<b8> DW_AT_low_pc : 0x400680
<bc> DW_AT_high_pc : 0x400684
<c0> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<c2> DW_AT_GNU_all_call_sites: 1
<1><c2>: Abbrev Number: 3 (DW_TAG_base_type)
<c3> DW_AT_byte_size : 4
<c4> DW_AT_encoding : 5 (signed)
<c5> DW_AT_name : int
<1><c9>: Abbrev Number: 4 (DW_TAG_subprogram)
<ca> DW_AT_external : 1
<ca> DW_AT_name : (indirect string, offset: 0x18a): foo32
<ce> DW_AT_decl_file : 1
<cf> DW_AT_decl_line : 11
<d0> DW_AT_prototyped : 1
<d0> DW_AT_type : <0xc2>
<d4> DW_AT_low_pc : 0x400684
<d8> DW_AT_high_pc : 0x40068c
<dc> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<de> DW_AT_GNU_all_call_sites: 1
<1><de>: Abbrev Number: 2 (DW_TAG_subprogram)
<df> DW_AT_external : 1
<df> DW_AT_name : bar
<e3> DW_AT_decl_file : 1
<e4> DW_AT_decl_line : 6
<e5> DW_AT_prototyped : 1
<e5> DW_AT_type : <0xc2>
<e9> DW_AT_low_pc : 0x40068c
<ed> DW_AT_high_pc : 0x400690
<f1> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<f3> DW_AT_GNU_all_call_sites: 1
<1><f3>: Abbrev Number: 5 (DW_TAG_subprogram)
<f4> DW_AT_external : 1
<f4> DW_AT_name : (indirect string, offset: 0x199): main
<f8> DW_AT_decl_file : 1
<f9> DW_AT_decl_line : 21
<fa> DW_AT_prototyped : 1
<fa> DW_AT_type : <0xc2>
<fe> DW_AT_low_pc : 0x400490
<102> DW_AT_high_pc : 0x4004a4
<106> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<108> DW_AT_GNU_all_tail_call_sites: 1
[...]
$
-- no sign of the ISA bit anywhere -- frame info:
$ mips-linux-gnu-readelf -wf foobar
[...]
Contents of the .debug_frame section:
00000000 0000000c ffffffff CIE
Version: 1
Augmentation: ""
Code alignment factor: 1
Data alignment factor: -4
Return address column: 31
DW_CFA_def_cfa_register: r29
DW_CFA_nop
00000010 0000000c 00000000 FDE cie=00000000 pc=00400680..00400684
00000020 0000000c 00000000 FDE cie=00000000 pc=00400684..0040068c
00000030 0000000c 00000000 FDE cie=00000000 pc=0040068c..00400690
00000040 00000018 00000000 FDE cie=00000000 pc=00400490..004004a4
DW_CFA_advance_loc: 6 to 00400496
DW_CFA_def_cfa_offset: 32
DW_CFA_offset: r31 at cfa-4
DW_CFA_advance_loc: 6 to 0040049c
DW_CFA_restore: r31
DW_CFA_def_cfa_offset: 0
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
[...]
$
-- no sign of the ISA bit anywhere -- range info (GDB doesn't use arange):
$ mips-linux-gnu-readelf -wR foobar
Contents of the .debug_ranges section:
Offset Begin End
00000000 00400680 00400690
00000000 00400490 004004a4
00000000 <End of list>
$
-- no sign of the ISA bit anywhere -- line info:
$ mips-linux-gnu-readelf -wl foobar
Raw dump of debug contents of section .debug_line:
[...]
Offset: 0x27
Length: 78
DWARF Version: 2
Prologue Length: 31
Minimum Instruction Length: 1
Initial value of 'is_stmt': 1
Line Base: -5
Line Range: 14
Opcode Base: 13
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 args
Opcode 3 has 1 args
Opcode 4 has 1 args
Opcode 5 has 1 args
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 args
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 args
The Directory Table is empty.
The File Name Table:
Entry Dir Time Size Name
1 0 0 0 foobar.c
Line Number Statements:
Extended opcode 2: set Address to 0x400681
Special opcode 6: advance Address by 0 to 0x400681 and Line by 1 to 2
Special opcode 7: advance Address by 0 to 0x400681 and Line by 2 to 4
Special opcode 55: advance Address by 3 to 0x400684 and Line by 8 to 12
Special opcode 7: advance Address by 0 to 0x400684 and Line by 2 to 14
Advance Line by -7 to 7
Special opcode 131: advance Address by 9 to 0x40068d and Line by 0 to 7
Special opcode 7: advance Address by 0 to 0x40068d and Line by 2 to 9
Advance PC by 3 to 0x400690
Extended opcode 1: End of Sequence
Extended opcode 2: set Address to 0x400491
Advance Line by 21 to 22
Copy
Special opcode 6: advance Address by 0 to 0x400491 and Line by 1 to 23
Special opcode 60: advance Address by 4 to 0x400495 and Line by -1 to 22
Special opcode 34: advance Address by 2 to 0x400497 and Line by 1 to 23
Special opcode 62: advance Address by 4 to 0x40049b and Line by 1 to 24
Special opcode 32: advance Address by 2 to 0x40049d and Line by -1 to 23
Special opcode 6: advance Address by 0 to 0x40049d and Line by 1 to 24
Advance PC by 7 to 0x4004a4
Extended opcode 1: End of Sequence
[...]
-- a-ha, the ISA bit is there! However it's not always right for some
reason, I don't have a small test case to show it, but here's an excerpt
from MIPS16 libc, a prologue of a function:
00019630 <__libc_init_first>:
19630: e8a0 jrc ra
19632: 6500 nop
00019634 <_init>:
19634: f000 6a11 li v0,17
19638: f7d8 0b08 la v1,15e00 <_DYNAMIC+0x15c54>
1963c: f400 3240 sll v0,16
19640: e269 addu v0,v1
19642: 659a move gp,v0
19644: 64f6 save 48,ra,s0-s1
19646: 671c move s0,gp
19648: d204 sw v0,16(sp)
1964a: f352 984c lw v0,-27828(s0)
1964e: 6724 move s1,a0
and the corresponding DWARF-2 line info:
Line Number Statements:
Extended opcode 2: set Address to 0x19631
Advance Line by 44 to 45
Copy
Special opcode 8: advance Address by 0 to 0x19631 and Line by 3 to 48
Special opcode 66: advance Address by 4 to 0x19635 and Line by 5 to 53
Advance PC by constant 17 to 0x19646
Special opcode 25: advance Address by 1 to 0x19647 and Line by 6 to 59
Advance Line by -6 to 53
Special opcode 33: advance Address by 2 to 0x19649 and Line by 0 to 53
Special opcode 39: advance Address by 2 to 0x1964b and Line by 6 to 59
Advance Line by -6 to 53
Special opcode 61: advance Address by 4 to 0x1964f and Line by 0 to 53
-- see that "Advance PC by constant 17" there? It clears the ISA bit,
however code at 0x19646 is not standard MIPS code at all. For some
reason the constant is always 17, I've never seen DW_LNS_const_add_pc
used with any other value -- is that a binutils bug or what?
3. Solution:
I think we should retain the value of the ISA bit in code references,
that is effectively treat them as cookies as they indeed are (although
trivially calculated) rather than raw memory byte addresses.
In a perfect world both the static symbol table and the respective
DWARF-2 records should be fixed to include the ISA bit in all the cases.
I think however that this is infeasible.
All the uses of `_bfd_mips_elf_symbol_processing' can not necessarily be
tracked down. This function is used by `elf_slurp_symbol_table' that in
turn is used by `bfd_canonicalize_symtab' and
`bfd_canonicalize_dynamic_symtab', which are public interfaces.
Similarly DWARF-2 records are used outside GDB, one notable if a bit
questionable is the exception unwinder (libgcc/unwind-dw2.c) -- I have
identified at least bits in `execute_cfa_program' and
`uw_frame_state_for', both around the calls to `_Unwind_IsSignalFrame',
that would need an update as they effectively flip the ISA bit freely;
see also the comment about MASK_RETURN_ADDR in gcc/config/mips/mips.h.
But there may be more places. Any change in how DWARF-2 records are
produced would require an update there and would cause compatibility
problems with libgcc.a binaries already distributed; given that this is
a static library a complex change involving function renames would
likely be required.
I propose therefore to accept the existing inconsistencies and deal with
them entirely within GDB. I have figured out that the ISA bit lost in
various places can still be recovered as long as we have symbol
information -- that'll have the `st_other' attribute correctly set to
one of standard MIPS/MIPS16/microMIPS encoding.
Here's the resulting change. It adds a couple of new `gdbarch' hooks,
one to update symbol information with the ISA bit lost in
`_bfd_mips_elf_symbol_processing', and two other ones to adjust DWARF-2
records as they're processed. The ISA bit is set in each address
handled according to information retrieved from the symbol table for the
symbol spanning the address if any; limits are adjusted based on the
address they point to related to the respective base address.
Additionally minimal symbol information has to be adjusted accordingly
in its gdbarch hook.
With these changes in place some complications with ISA bit juggling in
the PC that never fully worked can be removed from the MIPS backend.
Conversely, the generic dynamic linker event special breakpoint symbol
handler has to be updated to call the minimal symbol gdbarch hook to
record that the symbol is a MIPS16 or microMIPS address if applicable or
the breakpoint will be set at the wrong address and either fail to work
or cause SIGTRAPs (this is because the symbol is handled early on and
bypasses regular symbol processing).
4. Results obtained
The change fixes the example above -- to repeat only the crucial steps:
(gdb) break main
Breakpoint 1 at 0x400491: file foobar.c, line 23.
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) print foo
$1 = {int (void)} 0x400681 <foo>
(gdb) set foop = bar
(gdb) advance bar
bar () at foobar.c:9
9 }
(gdb) disassemble
Dump of assembler code for function bar:
=> 0x0040068d <+0>: jr ra
0x0040068f <+2>: li v0,2
End of assembler dump.
(gdb) finish
Run till exit from #0 bar () at foobar.c:9
main () at foobar.c:24
24 }
Value returned is $2 = 2
(gdb) continue
Continuing.
[Inferior 1 (process 14128) exited with code 02]
(gdb)
-- excellent!
The change removes about 90 failures per MIPS16 multilib in mips-sde-elf
testing too, results for MIPS16 are now similar to that for standard
MIPS; microMIPS results are a bit worse because of host-I/O problems in
QEMU used instead of MIPSsim for microMIPS testing only:
=== gdb Summary ===
# of expected passes 14299
# of unexpected failures 187
# of expected failures 56
# of known failures 58
# of unresolved testcases 11
# of untested testcases 52
# of unsupported tests 174
MIPS16:
=== gdb Summary ===
# of expected passes 14298
# of unexpected failures 187
# of unexpected successes 2
# of expected failures 54
# of known failures 58
# of unresolved testcases 12
# of untested testcases 52
# of unsupported tests 174
microMIPS:
=== gdb Summary ===
# of expected passes 14149
# of unexpected failures 201
# of unexpected successes 2
# of expected failures 54
# of known failures 58
# of unresolved testcases 7
# of untested testcases 53
# of unsupported tests 175
2014-12-12 Maciej W. Rozycki <macro@codesourcery.com>
Maciej W. Rozycki <macro@mips.com>
Pedro Alves <pedro@codesourcery.com>
gdb/
* gdbarch.sh (elf_make_msymbol_special): Change type to `F',
remove `predefault' and `invalid_p' initializers.
(make_symbol_special): New architecture method.
(adjust_dwarf2_addr, adjust_dwarf2_line): Likewise.
(objfile, symbol): New declarations.
* arch-utils.h (default_elf_make_msymbol_special): Remove
prototype.
(default_make_symbol_special): New prototype.
(default_adjust_dwarf2_addr): Likewise.
(default_adjust_dwarf2_line): Likewise.
* mips-tdep.h (mips_unmake_compact_addr): New prototype.
* arch-utils.c (default_elf_make_msymbol_special): Remove
function.
(default_make_symbol_special): New function.
(default_adjust_dwarf2_addr): Likewise.
(default_adjust_dwarf2_line): Likewise.
* dwarf2-frame.c (decode_frame_entry_1): Call
`gdbarch_adjust_dwarf2_addr'.
* dwarf2loc.c (dwarf2_find_location_expression): Likewise.
* dwarf2read.c (create_addrmap_from_index): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(add_partial_symbol): Likewise.
(add_partial_subprogram): Likewise.
(process_full_comp_unit): Likewise.
(read_file_scope): Likewise.
(read_func_scope): Likewise. Call `gdbarch_make_symbol_special'.
(read_lexical_block_scope): Call `gdbarch_adjust_dwarf2_addr'.
(read_call_site_scope): Likewise.
(dwarf2_ranges_read): Likewise.
(dwarf2_record_block_ranges): Likewise.
(read_attribute_value): Likewise.
(dwarf_decode_lines_1): Call `gdbarch_adjust_dwarf2_line'.
(new_symbol_full): Call `gdbarch_adjust_dwarf2_addr'.
* elfread.c (elf_symtab_read): Don't call
`gdbarch_elf_make_msymbol_special' if unset.
* mips-linux-tdep.c (micromips_linux_sigframe_validate): Strip
the ISA bit from the PC.
* mips-tdep.c (mips_unmake_compact_addr): New function.
(mips_elf_make_msymbol_special): Set the ISA bit in the symbol's
address appropriately.
(mips_make_symbol_special): New function.
(mips_pc_is_mips): Set the ISA bit before symbol lookup.
(mips_pc_is_mips16): Likewise.
(mips_pc_is_micromips): Likewise.
(mips_pc_isa): Likewise.
(mips_adjust_dwarf2_addr): New function.
(mips_adjust_dwarf2_line): Likewise.
(mips_read_pc, mips_unwind_pc): Keep the ISA bit.
(mips_addr_bits_remove): Likewise.
(mips_skip_trampoline_code): Likewise.
(mips_write_pc): Don't set the ISA bit.
(mips_eabi_push_dummy_call): Likewise.
(mips_o64_push_dummy_call): Likewise.
(mips_gdbarch_init): Install `mips_make_symbol_special',
`mips_adjust_dwarf2_addr' and `mips_adjust_dwarf2_line' gdbarch
handlers.
* solib.c (gdb_bfd_lookup_symbol_from_symtab): Get
target-specific symbol address adjustments.
* gdbarch.h: Regenerate.
* gdbarch.c: Regenerate.
2014-12-12 Maciej W. Rozycki <macro@codesourcery.com>
gdb/testsuite/
* gdb.base/func-ptrs.c: New file.
* gdb.base/func-ptrs.exp: New file.
2014-12-12 14:31:53 +01:00
|
|
|
gdbarch_make_symbol_special_ftype *make_symbol_special;
|
|
|
|
gdbarch_adjust_dwarf2_addr_ftype *adjust_dwarf2_addr;
|
|
|
|
gdbarch_adjust_dwarf2_line_ftype *adjust_dwarf2_line;
|
2002-10-03 01:28:54 +02:00
|
|
|
int cannot_step_breakpoint;
|
2002-10-09 13:59:54 +02:00
|
|
|
int have_nonsteppable_watchpoint;
|
2002-10-16 22:50:22 +02:00
|
|
|
gdbarch_address_class_type_flags_ftype *address_class_type_flags;
|
|
|
|
gdbarch_address_class_type_flags_to_name_ftype *address_class_type_flags_to_name;
|
2017-04-26 15:05:03 +02:00
|
|
|
gdbarch_execute_dwarf_cfa_vendor_op_ftype *execute_dwarf_cfa_vendor_op;
|
2002-10-16 22:50:22 +02:00
|
|
|
gdbarch_address_class_name_to_type_flags_ftype *address_class_name_to_type_flags;
|
2002-11-02 16:13:34 +01:00
|
|
|
gdbarch_register_reggroup_p_ftype *register_reggroup_p;
|
2003-06-02 04:54:35 +02:00
|
|
|
gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument;
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 17:26:43 +02:00
|
|
|
gdbarch_iterate_over_regset_sections_ftype *iterate_over_regset_sections;
|
2012-01-20 10:56:56 +01:00
|
|
|
gdbarch_make_corefile_notes_ftype *make_corefile_notes;
|
2013-02-04 19:40:41 +01:00
|
|
|
gdbarch_elfcore_write_linux_prpsinfo_ftype *elfcore_write_linux_prpsinfo;
|
2012-01-20 10:59:15 +01:00
|
|
|
gdbarch_find_memory_regions_ftype *find_memory_regions;
|
2007-09-04 01:06:35 +02:00
|
|
|
gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries;
|
ppc-aix core file relocation.
The current code attempts to provide relocation support when debugging
core files via the rs6000_xfer_partial method of the rs6000-nat
target_ops vector. However, this target_ops vector does not get pushed
on the target stack at all when debugging core files, thus bypassing
completely that part of the code.
This patch fixes the problem by extending corelow's core_xfer_partial
into handling the TARGET_OBJECT_LIBRARIES_AIX object.
gdb/ChangeLog:
* gdbarch.sh (core_xfer_shared_libraries_aix): New method.
* gdbarch.h, gdbarch.c: Regenerate.
* corelow.c (core_xfer_partial): Add TARGET_OBJECT_LIBRARIES_AIX
handling.
* rs6000-aix-tdep.h: New file.
* Makefile.in (HFILES_NO_SRCDIR): Add rs6000-aix-tdep.h.
* rs6000-aix-tdep.c: Include "rs6000-aix-tdep.h" and
"xml-utils.h".
(struct field_info, struct ld_info_desc): New types.
(ld_info32_desc, ld_info64_desc): New static constants.
(struct ld_info): New type.
(rs6000_aix_extract_ld_info): New function.
(rs6000_aix_shared_library_to_xml): Likewise.
(rs6000_aix_ld_info_to_xml): Likewise.
(rs6000_aix_core_xfer_shared_libraries_aix): Likewise.
(rs6000_aix_init_osabi): Add call to
set_gdbarch_core_xfer_shared_libraries_aix.
* rs6000-nat.c: Add "rs6000-aix-tdep.h" include.
Remove "xml-utils.h" include.
(LdInfo): Delete typedef.
(ARCH64_DECL, LDI_FIELD, LDI_NEXT, LDI_FD, LDI_FILENAME):
Delete macros.
(rs6000_ptrace_ldinfo): Change return type to gdb_byte *.
Adjust code accordingly.
(rs6000_core_ldinfo): Delete, folded into
rs6000_aix_core_xfer_shared_libraries_aix.
(rs6000_xfer_shared_library): Delete.
(rs6000_xfer_shared_libraries): Reimplement.
2013-05-15 14:26:14 +02:00
|
|
|
gdbarch_core_xfer_shared_libraries_aix_ftype *core_xfer_shared_libraries_aix;
|
* corelow.c (get_core_registers): Adjust.
(core_file_thread_alive): Rename to...
(core_thread_alive): ... this.
(core_pid_to_str): Try gdbarch_core_pid_to_str first.
(init_core_ops): Adjust.
(coreops_suppress_target): Delete.
(_initialize_corelow): Unconditionally add core_ops.
* procfs.c: Include "inf-child.h".
(procfs_ops): Delete.
(init_procfs_ops): Delete. Reimplement as...
(procfs_target): ... this, inheriting from inf-child.
(procfs_attach, procfs_detach, procfs_fetch_registers): Adjust.
(procfs_prepare_to_store): Delete.
(procfs_store_registers, procfs_resume): Adjust.
(procfs_open): Delete.
(procfs_suppress_run): Delete.
(procfs_can_run): Delete.
(procfs_mourn_inferior): Adjust.
(procfs_init_inferior): Add target_ops parameter. Adjust.
(procfs_create_inferior): Don't pass procfs_init_inferior to
fork_inferior. Instead call it after fork_inferior returns.
(procfs_find_new_threads): Adjust.
(_initialize_procfs): Adjust to use procfs_target instead of
init_procfs_ops.
* sol-thread.c (orig_core_ops, sol_core_ops): Delete.
(lwp_to_thread): Use target_thread_alive.
(sol_thread_open): Delete.
(sol_thread_attach): Delete.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers): Adjust
to use find_target_beneath.
(sol_thread_prepare_to_store, sol_thread_xfer_memory): Delete.
(sol_thread_xfer_partial): Adjust to use find_target_beneath.
(sol_thread_files_info, sol_thread_kill_inferior): Delete.
(check_for_thread_db): New.
(sol_thread_notice_signals, sol_thread_create_inferior): Delete.
(sol_thread_new_objfile): Call check_for_thread_db.
(sol_thread_mourn_inferior): Adjust to use find_target_beneath.
(sol_thread_can_run): Delete.
(sol_thread_alive): Adjust to use find_target_beneath.
(sol_thread_stop): Delete.
(rw_common): Use target_write_memory or target_read_memory.
(ps_lgetregs, ps_lgetfpregs): Use target_fetch_registers.
(ps_lsetregs, ps_lsetfpregs): Use target_store_registers.
(solaris_pid_to_str): Remove check for libthread_db initialization
failing.
(sol_find_new_threads): Remove check for libthread_db
initialization failing, or for an invalid inferior_ptid. Adjust
to use find_target_beneath.
(sol_core_open, sol_core_close, sol_core_detach,
sol_core_files_info, sol_find_memory_regions,
sol_make_note_section, ignore): Delete.
(init_sol_thread_ops): Make it a thread_stratum target. Remove
unneeded callback settings.
(init_sol_core_ops): Delete.
(_initialize_sol_thread): No longer call init_sol_core_ops, set
procfs_suppress_run, or hack with core_ops.
* target.h (struct target_ops): Add a target_ops * parameter to
to_resume, to_fetch_registers, to_store_registers, to_thread_alive
and to_find_new_threads.
(target_fetch_registers, target_store_registers)
(target_thread_alive, target_find_new_threads): Redeclare as
function.
* target.c (update_current_target): Do not inherit or de_fault
to_resume, to_fetch_registers, to_store_registers,
to_thread_alive, to_find_new_threads.
(target_resume): Adjust.
(target_thread_alive, target_find_new_threads): New.
(debug_to_resume, debug_to_fetch_registers): Delete.
(target_fetch_registers): New.
(debug_to_store_registers): Delete.
(target_store_registers): New.
(debug_to_thread_alive, debug_to_find_new_threads): Delete.
(setup_target_debug): Adjust.
* gdbcore.h (core_ops): Delete declaration.
* inf-ptrace.c, linux-nat.c, remote.c, amd64-linux-nat.c,
inf-child.c, linux-thread-db.c, bsd-uthread.c, inf-ttrace.c,
i386-sol2-tdep.c, darwin-nat.c, gnu-nat.c, go32-nat.c,
hpux-thread.c, i386-linux-nat.c, i386fbsd-nat.c, monitor.c,
nto-procfs.c, remote-m32r-sdi.c, remote-mips.c, windows-nat.c,
alphabsd-nat.c, amd64bsd-nat.c, arm-linux-nat.c, armnbsd-nat.c,
bsd-kvm.c, hppa-hpux-nat.c, hppa-linux-nat.c, hppabsd-nat.c,
hppanbsd-nat.c, i386-darwin-nat.c, i386bsd-nat.c,
ia64-linux-nat.c, m32r-linux-nat.c, m68kbsd-nat.c,
m68klinux-nat.c, m88kbsd-nat.c, mips-linux-nat.c,
mips64obsd-nat.c, mipsnbsd-nat.c, ppc-linux-nat.c, ppcnbsd-nat.c,
ppcobsd-nat.c, remote-sim.c, rs6000-nat.c, s390-nat.c,
shnbsd-nat.c, sparc-nat.c, sparc-nat.h, spu-linux-nat.c,
vaxbsd-nat.c, xtensa-linux-nat.c: Adjust to target_ops changes.
* gdbarch.sh (core_pid_to_str): New gdbarch callback.
* gdbarch.h, gdbarch.c: Regenerate.
* sol2-tdep.c: Include "inferior.h".
(sol2_core_pid_to_str): New.
* sol2-tdep.h (sol2_core_pid_to_str): Declare.
* amd64-sol2-tdep.c (amd64_sol2_init_abi): Set it.
* sparc-sol2-tdep.c (sparc32_sol2_init_abi): Set it.
* sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Set it.
* i386-sol2-tdep.c (i386_sol2_init_abi): Set it.
2009-02-23 01:03:50 +01:00
|
|
|
gdbarch_core_pid_to_str_ftype *core_pid_to_str;
|
2016-01-18 18:49:23 +01:00
|
|
|
gdbarch_core_thread_name_ftype *core_thread_name;
|
2009-06-17 20:48:26 +02:00
|
|
|
const char * gcore_bfd_target;
|
* NEWS: Mention pointer to member improvements.
* Makefile.in (gnu-v3-abi.o): Delete special rule.
(eval.o, gnu-v3-abi.o, ia64-tdep.o): Update.
* ada-valprint.c (ada_print_scalar): Update for new type codes.
* c-typeprint.c (c_print_type): Update for new type codes.
(c_type_print_varspec_prefix, c_type_print_varspec_suffix)
(c_type_print_base): Likewise.
(c_type_print_args): Rewrite.
* c-valprint.c (c_val_print): Update for new type codes. Remove
support for references to members. Treat methods like functions.
* cp-abi.c (cplus_print_method_ptr, cplus_method_ptr_size)
(cplus_make_method_ptr, cplus_method_ptr_to_value): New.
* cp-abi.h (cplus_print_method_ptr, cplus_method_ptr_size)
(cplus_make_method_ptr, cplus_method_ptr_to_value): New prototypes.
(struct cp_abi_ops): Add corresponding members.
* cp-valprint.c (cp_print_class_method): Delete.
(cp_find_class_member): New function.
(cp_print_class_member): Use it. Simplify support for bogus
member pointers.
* dwarf2read.c (quirk_gcc_member_function_pointer): Use
lookup_methodptr_type.
(read_tag_ptr_to_member_type): Likewise, and lookup_memberptr_type.
* eval.c (evaluate_subexp_standard): Implement EVAL_SKIP for
OP_SCOPE. Update call to value_aggregate_elt. Rewrite member
pointer support.
(evaluate_subexp_for_address): Handle OP_SCOPE explicitly. Handle
references returned by user defined operators.
* f-typeprint.c (f_print_type, f_type_print_varspec_prefix)
(f_type_print_varspec_suffix): Remove support for member pointers.
* gdbtypes.c (lookup_memberptr_type): Renamed from lookup_member_type
and adjusted.
(smash_to_memberptr_type): Likewise, from smash_to_member_type.
(lookup_methodptr_type): New.
(rank_one_type): Adjust for TYPE_CODE_MEMBERPTR.
(recursive_dump_type): Update for new types.
* gdbtypes.h (enum type_code): Replace TYPE_CODE_MEMBER with
TYPE_CODE_MEMBERPTR and TYPE_CODE_METHODPTR.
(lookup_memberptr_type, lookup_methodptr_type)
(smash_to_memberptr_type): New prototypes.
(smash_to_method_type): Formatting fix.
(lookup_member_type, smash_to_member_type): Delete prototypes.
* gnu-v3-abi.c (gnuv3_get_vtable, gnuv3_get_virtual_fn): New.
Do not rely on debug information for the vptr or the method's
enclosing type. Handle function descriptors for IA64.
(gnuv3_virtual_fn_field): Rewrite using the new functions.
(gnuv3_find_method_in, gnuv3_print_method_ptr)
(gnuv3_method_ptr_size, gnuv3_make_method_ptr)
(gnuv3_method_ptr_to_value): New.
(init_gnuv3_ops): Set new members of gnu_v3_abi_ops.
* hpread.c (hpread_type_lookup): Update for new types.
* infcall.c (value_arg_coerce): Likewise.
* m2-typeprint.c (m2_print_type): Remove explicit support
for member pointers.
* m2-valprint.c (m2_val_print): Likewise.
* p-typeprint.c (pascal_type_print_varspec_prefix)
(pascal_type_print_varspec_suffix, pascal_type_print_base): Likewise.
* p-valprint.c (pascal_val_print): Likewise.
(pascal_object_print_class_method, pascal_object_print_class_member):
Delete.
* p-lang.h (pascal_object_print_class_method)
(pascal_object_print_class_member): Delete prototypes.
* stabsread.c (read_type): Update for new types.
* typeprint.c (print_type_scalar): Likewise.
* valops.c (value_struct_elt_for_reference, value_namespace_elt)
(value_maybe_namespace_elt, value_aggregate_elt): Add want_address
argument. Construct a pointer to member if the address of a
function or data member is requested.
(value_cast_pointers): Don't modify the input value.
(value_cast): Adjust pointer to member handling for new types.
Allow null pointer to member constants. Don't modify the input
value.
(value_ind): Remove pointer to member check. Handle function
descriptors for function pointers.
(value_struct_elt, value_find_oload_method_list, check_field):
Remove pointer to member checks.
* value.c (unpack_long): Allow pointers to data members.
(value_from_longest): Allow member pointers.
* value.h (value_aggregate_elt): Add want_address.
* varobj.c (c_variable_editable): Remove check for members.
* gdbarch.sh: Add vtable_function_descriptors and vbit_in_delta.
* ia64-tdep.c (ia64_convert_from_func_ptr_addr): Handle descriptors
in virtual tables.
(ia64_gdbarch_init): Call set_gdbarch_vtable_function_descriptors.
* c-lang.h (cp_print_class_method): Delete prototype.
* arm-tdep.c (arm_gdbarch_init): Call set_gdbarch_vbit_in_delta.
* mips-tdep.c (mips_gdbarch_init): Likewise.
* gdbarch.c, gdbarch.h: Regenerated.
* gdb.cp/classes.exp (test_pointers_to_class_members): Update expected
output. Test the types of members and member pointers.
* gdb.cp/inherit.exp (test_print_mi_member_types): Remove KFAILs for
gdb/2092.
* gdb.cp/member-ptr.exp: Search for a comment instead of a
statement. Enable for GCC. Update expected output for some tests
and add new tests. Remove obsolete GCC KFAILs. Allow GCC's class
layout.
* gdb.cp/member-ptr.cc (Padding, Padding::vspacer, Base, Base::get_x)
(Base::vget_base, Left, Left::vget, Right, Right::vget, Diamond)
(Diamond::vget_base): New.
(main): Add new tests.
* gdb.cp/printmethod.exp: Update expected output for member functions.
* gdb.cp/virtfunc.exp (test_virtual_calls): Add a KFAIL for
print pEe->D::vg().
2007-01-03 19:05:45 +01:00
|
|
|
int vtable_function_descriptors;
|
|
|
|
int vbit_in_delta;
|
2007-05-07 20:20:21 +02:00
|
|
|
gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint;
|
Implement displaced stepping.
gdb/
* gdbarch.sh (max_insn_length): New 'variable'.
(displaced_step_copy, displaced_step_fixup)
(displaced_step_free_closure, displaced_step_location): New
functions.
(struct displaced_step_closure): Add forward declaration.
* gdbarch.c, gdbarch.h: Regenerated.
* arch-utils.c: #include "objfiles.h".
(simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New functions.
* arch-utils.h (simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New prototypes.
* i386-tdep.c (I386_MAX_INSN_LEN): Rename to...
(I386_MAX_MATCHED_INSN_LEN): ... this.
(i386_absolute_jmp_p, i386_absolute_call_p)
(i386_ret_p, i386_call_p, i386_breakpoint_p, i386_syscall_p)
(i386_displaced_step_fixup): New functions.
(struct i386_insn, i386_match_insn): Update.
(i386_gdbarch_init): Set gdbarch_max_insn_length.
* i386-tdep.h (I386_MAX_INSN_LEN): New.
(i386_displaced_step_fixup): New prototype.
* i386-linux-tdep.c (i386_linux_init_abi): Include "arch-utils.h".
Register gdbarch_displaced_step_copy,
gdbarch_displaced_step_fixup, gdbarch_displaced_step_free_closure,
and gdbarch_displaced_step_location functions.
* infrun.c (debug_displaced): New variable.
(show_debug_displaced): New function.
(struct displaced_step_request): New struct.
(displaced_step_request_queue, displaced_step_ptid)
(displaced_step_gdbarch, displaced_step_closure)
(displaced_step_original, displaced_step_copy)
(displaced_step_saved_copy, can_use_displaced_stepping): New
variables.
(show_can_use_displaced_stepping, use_displaced_stepping)
(displaced_step_clear, cleanup_displaced_step_closure)
(displaced_step_dump_bytes, displaced_step_prepare)
(displaced_step_clear_cleanup, write_memory_ptid)
(displaced_step_fixup): New functions.
(resume): Call displaced_step_prepare.
(proceed): Call read_pc once, and remember the value. If using
displaced stepping, don't remove breakpoints.
(handle_inferior_event): Call displaced_step_fixup. Add some
debugging output. When we try to step over a breakpoint, but get
a signal to deliver to the thread instead, ensure the step-resume
breakpoint is actually inserted. If a thread hop is needed, and
displaced stepping is enabled, don't remove breakpoints.
(init_wait_for_inferior): Call displaced_step_clear.
(_initialize_infrun): Add "set debug displaced" command. Add
"maint set can-use-displaced-stepping" command. Clear
displaced_step_ptid.
* inferior.h (debug_displaced): Declare variable.
(displaced_step_dump_bytes): Declare function.
* Makefile.in (arch-utils.o, i386-linux-tdep.o): Update
dependencies.
gdb/testsuite/
* gdb.asm/asmsrc1.s: Add scratch space.
gdb/doc/
* gdb.texinfo (Debugging Output): Document "set/show debug
displaced".
(Maintenance Commands): Document "maint set/show
can-use-displaced-stepping".
2008-05-02 18:49:54 +02:00
|
|
|
ULONGEST max_insn_length;
|
|
|
|
gdbarch_displaced_step_copy_insn_ftype *displaced_step_copy_insn;
|
2009-09-29 02:53:04 +02:00
|
|
|
gdbarch_displaced_step_hw_singlestep_ftype *displaced_step_hw_singlestep;
|
Implement displaced stepping.
gdb/
* gdbarch.sh (max_insn_length): New 'variable'.
(displaced_step_copy, displaced_step_fixup)
(displaced_step_free_closure, displaced_step_location): New
functions.
(struct displaced_step_closure): Add forward declaration.
* gdbarch.c, gdbarch.h: Regenerated.
* arch-utils.c: #include "objfiles.h".
(simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New functions.
* arch-utils.h (simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New prototypes.
* i386-tdep.c (I386_MAX_INSN_LEN): Rename to...
(I386_MAX_MATCHED_INSN_LEN): ... this.
(i386_absolute_jmp_p, i386_absolute_call_p)
(i386_ret_p, i386_call_p, i386_breakpoint_p, i386_syscall_p)
(i386_displaced_step_fixup): New functions.
(struct i386_insn, i386_match_insn): Update.
(i386_gdbarch_init): Set gdbarch_max_insn_length.
* i386-tdep.h (I386_MAX_INSN_LEN): New.
(i386_displaced_step_fixup): New prototype.
* i386-linux-tdep.c (i386_linux_init_abi): Include "arch-utils.h".
Register gdbarch_displaced_step_copy,
gdbarch_displaced_step_fixup, gdbarch_displaced_step_free_closure,
and gdbarch_displaced_step_location functions.
* infrun.c (debug_displaced): New variable.
(show_debug_displaced): New function.
(struct displaced_step_request): New struct.
(displaced_step_request_queue, displaced_step_ptid)
(displaced_step_gdbarch, displaced_step_closure)
(displaced_step_original, displaced_step_copy)
(displaced_step_saved_copy, can_use_displaced_stepping): New
variables.
(show_can_use_displaced_stepping, use_displaced_stepping)
(displaced_step_clear, cleanup_displaced_step_closure)
(displaced_step_dump_bytes, displaced_step_prepare)
(displaced_step_clear_cleanup, write_memory_ptid)
(displaced_step_fixup): New functions.
(resume): Call displaced_step_prepare.
(proceed): Call read_pc once, and remember the value. If using
displaced stepping, don't remove breakpoints.
(handle_inferior_event): Call displaced_step_fixup. Add some
debugging output. When we try to step over a breakpoint, but get
a signal to deliver to the thread instead, ensure the step-resume
breakpoint is actually inserted. If a thread hop is needed, and
displaced stepping is enabled, don't remove breakpoints.
(init_wait_for_inferior): Call displaced_step_clear.
(_initialize_infrun): Add "set debug displaced" command. Add
"maint set can-use-displaced-stepping" command. Clear
displaced_step_ptid.
* inferior.h (debug_displaced): Declare variable.
(displaced_step_dump_bytes): Declare function.
* Makefile.in (arch-utils.o, i386-linux-tdep.o): Update
dependencies.
gdb/testsuite/
* gdb.asm/asmsrc1.s: Add scratch space.
gdb/doc/
* gdb.texinfo (Debugging Output): Document "set/show debug
displaced".
(Maintenance Commands): Document "maint set/show
can-use-displaced-stepping".
2008-05-02 18:49:54 +02:00
|
|
|
gdbarch_displaced_step_fixup_ftype *displaced_step_fixup;
|
|
|
|
gdbarch_displaced_step_free_closure_ftype *displaced_step_free_closure;
|
|
|
|
gdbarch_displaced_step_location_ftype *displaced_step_location;
|
2010-05-26 20:19:28 +02:00
|
|
|
gdbarch_relocate_instruction_ftype *relocate_instruction;
|
2007-05-11 21:57:17 +02:00
|
|
|
gdbarch_overlay_update_ftype *overlay_update;
|
2007-09-10 23:14:11 +02:00
|
|
|
gdbarch_core_read_description_ftype *core_read_description;
|
2007-10-19 14:23:21 +02:00
|
|
|
gdbarch_static_transform_name_ftype *static_transform_name;
|
2007-10-19 14:26:35 +02:00
|
|
|
int sofun_address_maybe_missing;
|
2009-04-30 04:52:16 +02:00
|
|
|
gdbarch_process_record_ftype *process_record;
|
2009-09-21 07:52:06 +02:00
|
|
|
gdbarch_process_record_signal_ftype *process_record_signal;
|
2012-05-24 19:03:28 +02:00
|
|
|
gdbarch_gdb_signal_from_target_ftype *gdb_signal_from_target;
|
This patch implements the new gdbarch method gdbarch_gdb_signal_to_target.
It will be used when one wants to convert between the internal GDB signal
representation (enum gdb_signal) and the target's representation.
The idea of this patch came from a chat between Pedro and I on IRC, plus
the discussion of my patches to add the new $_exitsignal convenience
variable:
<http://sourceware.org/ml/gdb-patches/2013-06/msg00452.html>
<http://sourceware.org/ml/gdb-patches/2013-06/msg00352.html>
What I did was to investigate, on the Linux kernel, which targets shared
the signal numbers definition with the generic definition, present at
<include/uapi/asm-generic/signal.h>. For the record, I used linux-3.10-rc7
as the main source of information, always looking at
<arch/<ARCH_NAME>/include/uapi/asm/signal.h>. For SIGRTMAX (which defaults
to _NSIG in most cases), I had to look at different signal-related
files, but most of them (except MIPS) were defined to 64 anyway.
Then, with all the differences in hand, I implemented the bits on each
target.
2013-08-09 Sergio Durigan Junior <sergiodj@redhat.com>
* linux-tdep.c: Define enum with generic signal numbers.
(linux_gdb_signal_from_target): New function.
(linux_gdb_signal_to_target): Likewise.
(linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
methods to the functions above.
* linux-tdep.h (linux_gdb_signal_from_target): New prototype.
(linux_gdb_signal_to_target): Likewise.
* alpha-linux-tdep.c: Define new enum with signals different
from generic Linux kernel.
(alpha_linux_gdb_signal_from_target): New function.
(alpha_linux_gdb_signal_to_target): Likewise.
(alpha_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
with the functions mentioned above.
* avr-tdep.c: Define enum with differences between Linux kernel
and AVR signals.
(avr_linux_gdb_signal_from_target): New function.
(avr_linux_gdb_signal_to_target): Likewise.
(avr_gdbarch_init): Set gdbarch_gdb_signal_{to,from}_target to
the functions mentioned above.
* sparc-linux-tdep.c: Define enum with differences between SPARC
and generic Linux kernel signal numbers.
(sparc32_linux_gdb_signal_from_target): New function.
(sparc32_linux_gdb_signal_to_target): Likewise.
(sparc32_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
to the functions defined above.
* xtensa-linux-tdep.c: Define enum with differences between
Xtensa and Linux kernel generic signals.
(xtensa_linux_gdb_signal_from_target): New function.
(xtensa_linux_gdb_signal_to_target): Likewise.
(xtensa_linux_init_abi): Set gdbarch_gdb_signal_to_target
to the functions defined above.
* mips-linux-tdep.c: Define enum with differences between
signals in MIPS and Linux kernel generic ones.
(mips_gdb_signal_to_target): New function.
(mips_gdb_signal_from_target): Redefine to use new enum, handle
only different signals from the Linux kernel generic.
(mips_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
the functions defined above.
* mips-linux-tdep.h (enum mips_signals): Remove.
2013-08-09 18:54:43 +02:00
|
|
|
gdbarch_gdb_signal_to_target_ftype *gdb_signal_to_target;
|
2009-02-06 23:59:01 +01:00
|
|
|
gdbarch_get_siginfo_type_ftype *get_siginfo_type;
|
2008-05-02 22:38:16 +02:00
|
|
|
gdbarch_record_special_symbol_ftype *record_special_symbol;
|
2009-09-15 05:30:08 +02:00
|
|
|
gdbarch_get_syscall_number_ftype *get_syscall_number;
|
Partial fix for PR breakpoints/10737: Make syscall info be per-arch instead of global
This patch intends to partially fix PR breakpoints/10737, which is
about making the syscall information (for the "catch syscall" command)
be per-arch, instead of global. This is not a full fix because of the
other issues pointed by Pedro here:
<https://sourceware.org/bugzilla/show_bug.cgi?id=10737#c5>
However, I consider it a good step towards the real fix. It will also
help me fix <https://sourceware.org/bugzilla/show_bug.cgi?id=17402>.
What this patch does, basically, is move the "syscalls_info"
struct to gdbarch. Currently, the syscall information is stored in a
global variable inside gdb/xml-syscall.c, which means that there is no
easy way to correlate this info with the current target or
architecture being used, for example. This causes strange behaviors,
because the syscall info is not re-read when the arch changes. For
example, if you put a syscall catchpoint in syscall 5 on i386 (syscall
open), and then load a x86_64 program on GDB and put the same syscall
5 there (fstat on x86_64), you will still see that GDB tells you that
it is catching "open", even though it is not. With this patch, GDB
correctly says that it will be catching fstat syscalls.
(gdb) set architecture i386
The target architecture is assumed to be i386
(gdb) catch syscall 5
Catchpoint 1 (syscall 'open' [5])
(gdb) set architecture i386:x86-64
The target architecture is assumed to be i386:x86-64
(gdb) catch syscall 5
Catchpoint 2 (syscall 'open' [5])
But with the patch:
(gdb) set architecture i386
The target architecture is assumed to be i386
(gdb) catch syscall 5
Catchpoint 1 (syscall 'open' [5])
(gdb) set architecture i386:x86-64
The target architecture is assumed to be i386:x86-64
(gdb) catch syscall 5
Catchpoint 2 (syscall 'fstat' [5])
As I said, there are still some problems on the "catch syscall"
mechanism, because (for example) the user should be able to "catch
syscall open" on i386, and then expect "open" to be caught also on
x86_64. Currently, it doesn't work. I intend to work on this later.
gdb/
2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/10737
* amd64-linux-tdep.c (amd64_linux_init_abi_common): Adjust call to
set_xml_syscall_file_name to provide gdbarch.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* bfin-linux-tdep.c (bfin_linux_init_abi): Likewise.
* breakpoint.c (print_it_catch_syscall): Adjust call to
get_syscall_by_number to provide gdbarch.
(print_one_catch_syscall): Likewise.
(print_mention_catch_syscall): Likewise.
(print_recreate_catch_syscall): Likewise.
(catch_syscall_split_args): Adjust calls to get_syscall_by_number
and get_syscall_by_name to provide gdbarch.
(catch_syscall_completer): Adjust call to get_syscall_names to
provide gdbarch.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* gdbarch.sh: Forward declare "struct syscalls_info".
(xml_syscall_file): New variable.
(syscalls_info): Likewise.
* i386-linux-tdep.c (i386_linux_init_abi): Adjust call to
set_xml_syscall_file_name to provide gdbarch.
* mips-linux-tdep.c (mips_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* sparc-linux-tdep.c (sparc32_linux_init_abi): Likewise.
* sparc64-linux-tdep.c (sparc64_linux_init_abi): Likewise.
* xml-syscall.c: Include gdbarch.h.
(set_xml_syscall_file_name): Accept gdbarch parameter.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
(my_gdb_datadir): Delete global variable.
(struct syscalls_info) <my_gdb_datadir>: New variable.
(struct syscalls_info) <sysinfo>: Rename variable to
"syscalls_info".
(sysinfo): Delete global variable.
(have_initialized_sysinfo): Likewise.
(xml_syscall_file): Likewise.
(sysinfo_free_syscalls_desc): Rename to...
(syscalls_info_free_syscalls_desc): ... this.
(free_syscalls_info): Rename "sysinfo" to "syscalls_info". Adjust
code to the new layout of "struct syscalls_info".
(make_cleanup_free_syscalls_info): Rename parameter "sysinfo" to
"syscalls_info".
(syscall_create_syscall_desc): Likewise.
(syscall_start_syscall): Likewise.
(syscall_parse_xml): Likewise.
(xml_init_syscalls_info): Likewise. Drop "const" from return value.
(init_sysinfo): Rename to...
(init_syscalls_info): ...this. Add gdbarch as a parameter.
Adjust function to deal with gdbarch.
(xml_get_syscall_number): Delete parameter sysinfo. Accept
gdbarch as a parameter. Adjust code.
(xml_get_syscall_name): Likewise.
(xml_list_of_syscalls): Likewise.
(set_xml_syscall_file_name): Accept gdbarch as parameter.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
* xml-syscall.h (set_xml_syscall_file_name): Likewise.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
gdb/testsuite/
2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/10737
* gdb.base/catch-syscall.exp (do_syscall_tests): Call
test_catch_syscall_multi_arch.
(test_catch_syscall_multi_arch): New function.
2014-11-20 18:28:18 +01:00
|
|
|
const char * xml_syscall_file;
|
|
|
|
struct syscalls_info * syscalls_info;
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
const char *const * stap_integer_prefixes;
|
|
|
|
const char *const * stap_integer_suffixes;
|
|
|
|
const char *const * stap_register_prefixes;
|
|
|
|
const char *const * stap_register_suffixes;
|
|
|
|
const char *const * stap_register_indirection_prefixes;
|
|
|
|
const char *const * stap_register_indirection_suffixes;
|
2012-04-27 22:47:57 +02:00
|
|
|
const char * stap_gdb_register_prefix;
|
|
|
|
const char * stap_gdb_register_suffix;
|
|
|
|
gdbarch_stap_is_single_operand_ftype *stap_is_single_operand;
|
|
|
|
gdbarch_stap_parse_special_token_ftype *stap_parse_special_token;
|
2015-02-17 15:54:44 +01:00
|
|
|
gdbarch_dtrace_parse_probe_argument_ftype *dtrace_parse_probe_argument;
|
|
|
|
gdbarch_dtrace_probe_is_enabled_ftype *dtrace_probe_is_enabled;
|
|
|
|
gdbarch_dtrace_enable_probe_ftype *dtrace_enable_probe;
|
|
|
|
gdbarch_dtrace_disable_probe_ftype *dtrace_disable_probe;
|
* remote.c (remote_start_remote): If the solib list is global,
fetch libraries and insert breakpoints after connecting.
* infcmd.c (post_create_inferior): If the solist is shared between
inferiors, no need to refetch it on every new inferior.
(detach_command): If the shared library list is shared between
inferiors, then don't clear it on every inferior detach.
* gdbarch.sh (has_global_solist): New.
* i386-dicos-tdep.c (i386_dicos_init_abi): Set
gdbarch_has_global_solist.
* target.c (target_pre_inferior): If the shared library list is
shared between inferiors, then don't clear it here, neither
invalidate the memory regions or clear the target description.
(target_detach): If the shared library list is shared between
inferiors, then don't remove breakpoints from the target here.
(target_disconnect): Comment.
* solib.c (update_solib_list): Check for null_ptid.
* breakpoint.c (insert_breakpoints, update_global_location_list):
If the shared library list is shared between inferiors, insert
breakpoints even if there's no execution.
(breakpoint_init_inferior): If the shared library list is shared
between inferiors, don't delete breakpoints or mark them
uninserted here.
* gdbarch.c, gdbarch.h: Regenerate.
2008-11-03 15:01:27 +01:00
|
|
|
int has_global_solist;
|
2009-05-19 02:23:49 +02:00
|
|
|
int has_global_breakpoints;
|
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
Add base multi-executable/process support to GDB.
gdb/
* Makefile.in (SFILES): Add progspace.c.
(COMMON_OBS): Add progspace.o.
* progspace.h: New.
* progspace.c: New.
* breakpoint.h (struct bp_target_info) <placed_address_space>: New
field.
(struct bp_location) <pspace>: New field.
(struct breakpoint) <pspace>: New field.
(bpstat_stop_status, breakpoint_here_p)
(moribund_breakpoint_here_p, breakpoint_inserted_here_p)
(regular_breakpoint_inserted_here_p)
(software_breakpoint_inserted_here_p, breakpoint_thread_match)
(set_default_breakpoint): Adjust prototypes.
(remove_breakpoints_pid, breakpoint_program_space_exit): Declare.
(insert_single_step_breakpoint, deprecated_insert_raw_breakpoint):
Adjust prototypes.
* breakpoint.c (executing_startup): Delete.
(default_breakpoint_sspace): New.
(breakpoint_restore_shadows): Skip if the address space doesn't
match.
(update_watchpoint): Record the frame's program space in the
breakpoint location.
(insert_bp_location): Record the address space in target_info.
Adjust to pass the symbol space to solib_name_from_address.
(breakpoint_program_space_exit): New.
(insert_breakpoint_locations): Switch the symbol space and thread
when inserting breakpoints. Don't insert breakpoints in a vfork
parent waiting for vfork done if we're not attached to the vfork
child.
(remove_breakpoints_pid): New.
(reattach_breakpoints): Switch to a thread of PID. Ignore
breakpoints of other symbol spaces.
(create_internal_breakpoint): Store the symbol space in the sal.
(create_longjmp_master_breakpoint): Iterate over all symbol
spaces.
(update_breakpoints_after_exec): Ignore breakpoints for other
symbol spaces.
(remove_breakpoint): Rename to ...
(remove_breakpoint_1): ... this. Pass the breakpoints symbol
space to solib_name_from_address.
(remove_breakpoint): New.
(mark_breakpoints_out): Ignore breakpoints from other symbol
spaces.
(breakpoint_init_inferior): Ditto.
(breakpoint_here_p): Add an address space argument and adjust to
use breakpoint_address_match.
(moribund_breakpoint_here_p): Ditto.
(regular_breakpoint_inserted_here_p): Ditto.
(breakpoint_inserted_here_p): Ditto.
(software_breakpoint_inserted_here_p): Ditto.
(breakpoint_thread_match): Ditto.
(bpstat_check_location): Ditto.
(bpstat_stop_status): Ditto.
(print_breakpoint_location): If there's a location to print,
switch the current symbol space.
(print_one_breakpoint_location): Add `allflag' argument.
(print_one_breakpoint): Ditto. Adjust.
(do_captured_breakpoint_query): Adjust.
(breakpoint_1): Adjust.
(breakpoint_has_pc): Also match the symbol space.
(describe_other_breakpoints): Add a symbol space argument and
adjust.
(set_default_breakpoint): Add a symbol space argument. Set
default_breakpoint_sspace.
(breakpoint_address_match): New.
(check_duplicates_for): Add an address space argument, and adjust.
(set_raw_breakpoint): Record the symbol space in the location and
in the breakpoint.
(set_longjmp_breakpoint): Skip longjmp master breakpoints from
other symbol spaces.
(remove_thread_event_breakpoints, remove_solib_event_breakpoints)
(disable_breakpoints_in_shlibs): Skip breakpoints from other
symbol spaces.
(disable_breakpoints_in_unloaded_shlib): Match symbol spaces.
(create_catchpoint): Set the symbol space in the sal.
(disable_breakpoints_before_startup): Skip breakpoints from other
symbol spaces. Set executing_startup in the current symbol space.
(enable_breakpoints_after_startup): Clear executing_startup in the
current symbol space. Skip breakpoints from other symbol spaces.
(clone_momentary_breakpoint): Also copy the symbol space.
(add_location_to_breakpoint): Set the location's symbol space.
(bp_loc_is_permanent): Switch thread and symbol space.
(create_breakpoint): Adjust.
(expand_line_sal_maybe): Expand comment to mention symbol spaces.
Switch thread and symbol space when reading memory.
(parse_breakpoint_sals): Set the symbol space in the sal.
(break_command_really): Ditto.
(skip_prologue_sal): Switch and space.
(resolve_sal_pc): Ditto.
(watch_command_1): Record the symbol space in the sal.
(create_ada_exception_breakpoint): Adjust.
(clear_command): Adjust. Match symbol spaces.
(update_global_location_list): Use breakpoint_address_match.
(breakpoint_re_set_one): Switch thread and space.
(breakpoint_re_set): Save symbol space.
(breakpoint_re_set_thread): Also reset the symbol space.
(deprecated_insert_raw_breakpoint): Add an address space argument.
Adjust.
(insert_single_step_breakpoint): Ditto.
(single_step_breakpoint_inserted_here_p): Ditto.
(clear_syscall_counts): New.
(_initialize_breakpoint): Install it as inferior_exit observer.
* exec.h: Include "progspace.h".
(exec_bfd, exec_bfd_mtime): New defines.
(exec_close): Declare.
* exec.c: Include "gdbthread.h" and "progspace.h".
(exec_bfd, exec_bfd_mtime, current_target_sections_1): Delete.
(using_exec_ops): New.
(exec_close_1): Rename to exec_close, and make public.
(exec_close): Rename to exec_close_1, and adjust all callers. Add
description. Remove target sections and close executables from
all program spaces.
(exec_file_attach): Add comment.
(add_target_sections): Check on `using_exec_ops' to check if the
target should be pushed.
(remove_target_sections): Only unpush the target if there are no
more target sections in any symbol space.
* gdbcore.h: Include "exec.h".
(exec_bfd, exec_bfd_mtime): Remove declarations.
* frame.h (get_frame_program_space, get_frame_address_space)
(frame_unwind_program_space): Declare.
* frame.c (struct frame_info) <pspace, aspace>: New fields.
(create_sentinel_frame): Add program space argument. Set the
pspace and aspace fields of the frame object.
(get_current_frame, create_new_frame): Adjust.
(get_frame_program_space): New.
(frame_unwind_program_space): New.
(get_frame_address_space): New.
* stack.c (print_frame_info): Adjust.
(print_frame): Use the frame's program space.
* gdbthread.h (any_live_thread_of_process): Declare.
* thread.c (any_live_thread_of_process): New.
(switch_to_thread): Switch the program space as well.
(restore_selected_frame): Don't warn if trying to restore frame
level 0.
* inferior.h: Include "progspace.h".
(detach_fork): Declare.
(struct inferior) <removable, aspace, pspace>
<vfork_parent, vfork_child, pending_detach>
<waiting_for_vfork_done>: New fields.
<terminal_info>: Remove field.
<data, num_data>: New fields.
(register_inferior_data, register_inferior_data_with_cleanup)
(clear_inferior_data, set_inferior_data, inferior_data): Declare.
(exit_inferior, exit_inferior_silent, exit_inferior_num_silent)
(inferior_appeared): Declare.
(find_inferior_pid): Typo.
(find_inferior_id, find_inferior_for_program_space): Declare.
(set_current_inferior, save_current_inferior, prune_inferiors)
(number_of_inferiors): Declare.
(inferior_list): Declare.
* inferior.c: Include "gdbcore.h" and "symfile.h".
(inferior_list): Make public.
(delete_inferior_1): Always delete thread silently.
(find_inferior_id): Make public.
(current_inferior_): New.
(current_inferior): Use it.
(set_current_inferior): New.
(restore_inferior): New.
(save_current_inferior): New.
(free_inferior): Free the per-inferior data.
(add_inferior_silent): Allocate per-inferior data.
Call inferior_appeared.
(delete_threads_of_inferior): New.
(delete_inferior_1): Adjust interface to take an inferior pointer.
(delete_inferior): Adjust.
(delete_inferior_silent): Adjust.
(exit_inferior_1): New.
(exit_inferior): New.
(exit_inferior_silent): New.
(exit_inferior_num_silent): New.
(detach_inferior): Adjust.
(inferior_appeared): New.
(discard_all_inferiors): Adjust.
(find_inferior_id): Make public. Assert pid is not zero.
(find_inferior_for_program_space): New.
(have_inferiors): Check if we have any inferior with pid not zero.
(have_live_inferiors): Go over all pushed targets looking for
process_stratum.
(prune_inferiors): New.
(number_of_inferiors): New.
(print_inferior): Add executable column. Print vfork parent/child
relationships.
(inferior_command): Adjust to cope with not running inferiors.
(remove_inferior_command): New.
(add_inferior_command): New.
(clone_inferior_command): New.
(struct inferior_data): New.
(struct inferior_data_registration): New.
(struct inferior_data_registry): New.
(inferior_data_registry): New.
(register_inferior_data_with_cleanup): New.
(register_inferior_data): New.
(inferior_alloc_data): New.
(inferior_free_data): New.
(clear_inferior_data): New.
(set_inferior_data): New.
(inferior_data): New.
(initialize_inferiors): New.
(_initialize_inferiors): Register "add-inferior",
"remove-inferior" and "clone-inferior" commands.
* objfiles.h: Include "progspace.h".
(struct objfile) <pspace>: New field.
(symfile_objfile, object_files): Don't declare.
(ALL_PSPACE_OBJFILES): New.
(ALL_PSPACE_OBJFILES_SAFE): New.
(ALL_OBJFILES, ALL_OBJFILES_SAFE): Adjust.
(ALL_PSPACE_SYMTABS): New.
(ALL_PRIMARY_SYMTABS): Adjust.
(ALL_PSPACE_PRIMARY_SYMTABS): New.
(ALL_PSYMTABS): Adjust.
(ALL_PSPACE_PSYMTABS): New.
* objfiles.c (object_files, symfile_objfile): Delete.
(struct objfile_sspace_info): New.
(objfiles_pspace_data): New.
(objfiles_pspace_data_cleanup): New.
(get_objfile_pspace_data): New.
(objfiles_changed_p): Delete.
(allocate_objfile): Set the objfile's program space. Adjust to
reference objfiles_changed_p in pspace data.
(free_objfile): Adjust to reference objfiles_changed_p in pspace
data.
(objfile_relocate): Ditto.
(update_section_map): Add pspace argument. Adjust to iterate over
objfiles in the passed in pspace.
(find_pc_section): Delete sections and num_sections statics.
Adjust to refer to program space's objfiles_changed_p. Adjust to
refer to sections and num_sections store in the objfile's pspace
data.
(objfiles_changed): Adjust to reference objfiles_changed_p in
pspace data.
(_initialize_objfiles): New.
* linespec.c (decode_all_digits, decode_dollar): Set the sal's
program space.
* source.c (current_source_pspace): New.
(get_current_source_symtab_and_line): Set the sal's program space.
(set_current_source_symtab_and_line): Set current_source_pspace.
(select_source_symtab): Ditto. Use ALL_OBJFILES.
(forget_cached_source_info): Iterate over all program spaces.
* symfile.c (clear_symtab_users): Adjust.
* symmisc.c (print_symbol_bcache_statistics): Iterate over all
program spaces.
(print_objfile_statistics): Ditto.
(maintenance_print_msymbols): Ditto.
(maintenance_print_objfiles): Ditto.
(maintenance_info_symtabs): Ditto.
(maintenance_info_psymtabs): Ditto.
* symtab.h (SYMTAB_PSPACE): New.
(struct symtab_and_line) <pspace>: New field.
* symtab.c (init_sal): Clear the sal's program space.
(find_pc_sect_symtab): Set the sal's program space. Switch thread
and space.
(append_expanded_sal): Add program space argument. Iterate over
all program spaces.
(expand_line_sal): Iterate over all program spaces. Switch
program space.
* target.h (enum target_waitkind) <TARGET_WAITKIND_VFORK_DONE>: New.
(struct target_ops) <to_thread_address_space>: New field.
(target_thread_address_space): Define.
* target.c (target_detach): Only remove breakpoints from the
inferior we're detaching.
(target_thread_address_space): New.
* defs.h (initialize_progspace): Declare.
* top.c (gdb_init): Call it.
* solist.h (struct so_list) <sspace>: New field.
* solib.h (struct program_space): Forward declare.
(solib_name_from_address): Adjust prototype.
* solib.c (so_list_head): Replace with a macro referencing the
program space.
(update_solib_list): Set the so's program space.
(solib_name_from_address): Add a program space argument and adjust.
* solib-svr4.c (struct svr4_info) <pid>: Delete field.
<interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low>
<interp_plt_sect_high>: New fields.
(svr4_info_p, svr4_info): Delete.
(solib_svr4_sspace_data): New.
(get_svr4_info): Rewrite.
(svr4_sspace_data_cleanup): New.
(open_symbol_file_object): Adjust.
(svr4_default_sos): Adjust.
(svr4_fetch_objfile_link_map): Adjust.
(interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low)
(interp_plt_sect_high): Delete.
(svr4_in_dynsym_resolve_code): Adjust.
(enable_break): Adjust.
(svr4_clear_solib): Revert bit that removed the svr4_info here,
and reinstate clearing debug_base, debug_loader_offset_p,
debug_loader_offset and debug_loader_name.
(_initialize_svr4_solib): Register solib_svr4_pspace_data. Don't
install an inferior_exit observer anymore.
* printcmd.c (struct display) <pspace>: New field.
(display_command): Set the display's sspace.
(do_one_display): Match the display's sspace.
(display_uses_solib_p): Ditto.
* linux-fork.c (detach_fork): Moved to infrun.c.
(_initialize_linux_fork): Moved "detach-on-fork" command to
infrun.c.
* infrun.c (detach_fork): Moved from linux-fork.c.
(proceed_after_vfork_done): New.
(handle_vfork_child_exec_or_exit): New.
(follow_exec_mode_replace, follow_exec_mode_keep)
(follow_exec_mode_names, follow_exec_mode_string)
(show_follow_exec_mode_string): New.
(follow_exec): New. Reinstate the mark_breakpoints_out call.
Remove shared libraries before attaching new executable. If user
wants to keep the inferior, keep it.
(displaced_step_fixup): Adjust to pass an address space to the
breakpoints module.
(resume): Ditto.
(clear_proceed_status): In all-stop mode, always clear the proceed
status of all threads.
(prepare_to_proceed): Adjust to pass an address space to the
breakpoints module.
(proceed): Ditto.
(adjust_pc_after_break): Ditto.
(handle_inferior_event): When handling a process exit, switch the
program space to the inferior's that had exited. Call
handle_vfork_child_exec_or_exit. Adjust to pass an address space
to the breakpoints module. In non-stop mode, when following a
fork and detach-fork is off, also resume the other branch. Handle
TARGET_WAITKIND_VFORK_DONE. Set the program space in sals.
(normal_stop): Prune inferiors.
(_initialize_infrun): Install the new "follow-exec-mode" command.
"detach-on-fork" moved here.
* regcache.h (get_regcache_aspace): Declare.
* regcache.c (struct regcache) <aspace>: New field.
(regcache_xmalloc): Clear the aspace.
(get_regcache_aspace): New.
(regcache_cpy): Copy the aspace field.
(regcache_cpy_no_passthrough): Ditto.
(get_thread_regcache): Fetch the thread's address space from the
target, and store it in the regcache.
* infcall.c (call_function_by_hand): Set the sal's pspace.
* arch-utils.c (default_has_shared_address_space): New.
* arch-utils.h (default_has_shared_address_space): Declare.
* gdbarch.sh (has_shared_address_space): New.
* gdbarch.h, gdbarch.c: Regenerate.
* linux-tdep.c: Include auxv.h, target.h, elf/common.h.
(linux_has_shared_address_space): New.
(_initialize_linux_tdep): Declare.
* arm-tdep.c (arm_software_single_step): Pass the frame's address
space to insert_single_step_breakpoint.
* arm-linux-tdep.c (arm_linux_software_single_step): Pass the
frame's pspace to breakpoint functions.
* cris-tdep.c (crisv32_single_step_through_delay): Ditto.
(cris_software_single_step): Ditto.
* mips-tdep.c (deal_with_atomic_sequence): Add frame argument.
Pass the frame's pspace to breakpoint functions.
(mips_software_single_step): Adjust.
(mips_single_step_through_delay): Adjust.
* rs6000-aix-tdep.c (rs6000_software_single_step): Adjust.
* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust.
* solib-irix.c (enable_break): Adjust to pass the current frame's
address space to breakpoint functions.
* sparc-tdep.c (sparc_software_single_step): Ditto.
* spu-tdep.c (spu_software_single_step): Ditto.
* alpha-tdep.c (alpha_software_single_step): Ditto.
* record.c (record_wait): Adjust to pass an address space to the
breakpoints module.
* fork-child.c (fork_inferior): Set the new inferior's program and
address spaces.
* inf-ptrace.c (inf_ptrace_follow_fork): Copy the parent's program
and address spaces.
(inf_ptrace_attach): Set the inferior's program and address spaces.
* linux-nat.c: Include "solib.h".
(linux_child_follow_fork): Manage parent and child's program and
address spaces. Clone the parent's program space if necessary.
Don't wait for the vfork to be done here. Refuse to resume if
following the vfork parent while leaving the child stopped.
(resume_callback): Don't resume a vfork parent.
(linux_nat_resume): Also check for pending events in the
lp->waitstatus field.
(linux_handle_extended_wait): Report TARGET_WAITKIND_VFORK_DONE
events to the core.
(stop_wait_callback): Don't wait for SIGSTOP on vfork parents.
(cancel_breakpoint): Adjust.
* linux-thread-db.c (thread_db_wait): Don't remove thread event
breakpoints here.
(thread_db_mourn_inferior): Don't mark breakpoints out here.
Remove thread event breakpoints after mourning.
* corelow.c: Include progspace.h.
(core_open): Set the inferior's program and address spaces.
* remote.c (remote_add_inferior): Set the new inferior's program
and address spaces.
(remote_start_remote): Update address spaces.
(extended_remote_create_inferior_1): Don't init the thread list if
we already debugging other inferiors.
* darwin-nat.c (darwin_attach): Set the new inferior's program and
address spaces.
* gnu-nat.c (gnu_attach): Ditto.
* go32-nat.c (go32_create_inferior): Ditto.
* inf-ttrace.c (inf_ttrace_follow_fork, inf_ttrace_attach): Ditto.
* monitor.c (monitor_open): Ditto.
* nto-procfs.c (procfs_attach, procfs_create_inferior): Ditto.
* procfs.c (do_attach): Ditto.
* windows-nat.c (do_initial_windows_stuff): Ditto.
* inflow.c (inferior_process_group)
(terminal_init_inferior_with_pgrp, terminal_inferior,
(terminal_ours_1, inflow_inferior_exit, copy_terminal_info)
(child_terminal_info, new_tty_postfork, set_sigint_trap): Adjust
to use per-inferior data instead of inferior->terminal_info.
(inflow_inferior_data): New.
(inflow_new_inferior): Delete.
(inflow_inferior_data_cleanup): New.
(get_inflow_inferior_data): New.
* mi/mi-interp.c (mi_new_inferior): Rename to...
(mi_inferior_appeared): ... this.
(mi_interpreter_init): Adjust.
* tui/tui-disasm.c: Include "progspace.h".
(tui_set_disassem_content): Pass an address space to
breakpoint_here_p.
* NEWS: Mention multi-program debugging support. Mention new
commands "add-inferior", "clone-inferior", "remove-inferior",
"maint info program-spaces", and new option "set
follow-exec-mode".
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/doc/
* observer.texi (new_inferior): Rename to...
(inferior_appeared): ... this.
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/testsuite/
* gdb.base/foll-vfork.exp: Adjust to spell out "follow-fork".
* gdb.base/foll-exec.exp: Adjust to expect a process id before
"Executing new program".
* gdb.base/foll-fork.exp: Adjust to spell out "follow-fork".
* gdb.base/multi-forks.exp: Ditto. Adjust to the inferior being
left listed after having been killed.
* gdb.base/attach.exp: Adjust to spell out "symbol-file".
* gdb.base/maint.exp: Adjust test.
* Makefile.in (ALL_SUBDIRS): Add gdb.multi.
* gdb.multi/Makefile.in: New.
* gdb.multi/base.exp: New.
* gdb.multi/goodbye.c: New.
* gdb.multi/hangout.c: New.
* gdb.multi/hello.c: New.
* gdb.multi/bkpt-multi-exec.c: New.
* gdb.multi/bkpt-multi-exec.exp: New.
* gdb.multi/crashme.c: New.
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/doc/
* gdb.texinfo (Inferiors): Rename node to ...
(Inferiors and Programs): ... this. Mention running multiple
programs in the same debug session.
<info inferiors>: Mention the new 'Executable' column if "info
inferiors". Update examples. Document the "add-inferior",
"clone-inferior", "remove-inferior" and "maint info
program-spaces" commands.
(Process): Rename node to...
(Forks): ... this. Document "set|show follow-exec-mode".
2009-10-19 11:51:43 +02:00
|
|
|
gdbarch_has_shared_address_space_ftype *has_shared_address_space;
|
2010-01-06 05:20:27 +01:00
|
|
|
gdbarch_fast_tracepoint_valid_at_ftype *fast_tracepoint_valid_at;
|
2016-02-18 09:21:38 +01:00
|
|
|
gdbarch_guess_tracepoint_registers_ftype *guess_tracepoint_registers;
|
2010-03-05 21:18:19 +01:00
|
|
|
gdbarch_auto_charset_ftype *auto_charset;
|
|
|
|
gdbarch_auto_wide_charset_ftype *auto_wide_charset;
|
2010-03-08 20:28:27 +01:00
|
|
|
const char * solib_symbols_extension;
|
2010-04-24 15:12:56 +02:00
|
|
|
int has_dos_based_file_system;
|
2011-09-27 15:09:37 +02:00
|
|
|
gdbarch_gen_return_address_ftype *gen_return_address;
|
2012-01-20 10:49:58 +01:00
|
|
|
gdbarch_info_proc_ftype *info_proc;
|
2012-12-14 16:30:38 +01:00
|
|
|
gdbarch_core_info_proc_ftype *core_info_proc;
|
2012-06-05 15:50:50 +02:00
|
|
|
gdbarch_iterate_over_objfiles_in_search_order_ftype *iterate_over_objfiles_in_search_order;
|
2012-12-15 15:27:56 +01:00
|
|
|
struct ravenscar_arch_ops * ravenscar_ops;
|
gdbarch: add instruction predicate methods
Add new methods to gdbarch for analyzing the instruction at a given address.
Implement those methods for i386 and amd64 architectures.
This is needed by "record btrace" to detect function calls in the
execution trace.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* amd64-tdep.c (amd64_classify_insn_at, amd64_insn_is_call)
(amd64_insn_is_ret, amd64_insn_is_jump, amd64_jmp_p): New.
(amd64_init_abi): Add insn_is_call, insn_is_ret, and insn_is_jump
to gdbarch.
* i386-tdep.c (i386_insn_is_call, i386_insn_is_ret)
(i386_insn_is_jump, i386_jmp_p): New.
(i386_gdbarch_init): Add insn_is_call, insn_is_ret, and
insn_is_jump to gdbarch.
* gdbarch.sh (insn_is_call, insn_is_ret, insn_is_jump): New.
* gdbarch.h: Regenerated.
* gdbarch.c: Regenerated.
* arch-utils.h (default_insn_is_call, default_insn_is_ret)
(default_insn_is_jump): New.
* arch-utils.c (default_insn_is_call, default_insn_is_ret)
(default_insn_is_jump): New.
2013-03-22 15:56:56 +01:00
|
|
|
gdbarch_insn_is_call_ftype *insn_is_call;
|
|
|
|
gdbarch_insn_is_ret_ftype *insn_is_ret;
|
|
|
|
gdbarch_insn_is_jump_ftype *insn_is_jump;
|
2014-02-27 13:40:15 +01:00
|
|
|
gdbarch_auxv_parse_ftype *auxv_parse;
|
2016-06-12 00:51:38 +02:00
|
|
|
gdbarch_print_auxv_entry_ftype *print_auxv_entry;
|
2014-10-10 16:57:13 +02:00
|
|
|
gdbarch_vsyscall_range_ftype *vsyscall_range;
|
2014-05-14 22:08:57 +02:00
|
|
|
gdbarch_infcall_mmap_ftype *infcall_mmap;
|
2015-06-03 21:22:56 +02:00
|
|
|
gdbarch_infcall_munmap_ftype *infcall_munmap;
|
2014-05-14 22:08:57 +02:00
|
|
|
gdbarch_gcc_target_options_ftype *gcc_target_options;
|
add gnu_triplet_regexp gdbarch method
gdb has to inform libcc1.so of the target being used, so that the
correct compiler can be invoked. The compiler is invoked using the
GNU configury triplet prefix, e.g., "x86_64-unknown-linux-gnu-gcc".
In order for this to work we need to map the gdbarch to the GNU
configury triplet arch. In most cases these are identical; however,
the x86 family poses some problems, as the BFD arch names are quite
different from the GNU triplet names. So, we introduce a new gdbarch
method for this. A regular expression is used because there are
various valid values for the arch prefix in the triplet.
This patch also updates the osabi code to associate a regular
expression with the OS ABI. I have only added a concrete value for
Linux. Note that the "-gnu" part is optional, at least on Fedora it
is omitted from the installed GCC executable's name.
gdb/ChangeLog
2014-12-12 Tom Tromey <tromey@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* osabi.h (osabi_triplet_regexp): Declare.
* osabi.c (struct osabi_names): New.
(gdb_osabi_names): Change type to struct osabi_names. Update
values.
(gdbarch_osabi_name): Update.
(osabi_triplet_regexp): New function.
(osabi_from_tdesc_string, _initialize_gdb_osabi): Update.
* i386-tdep.c (i386_gnu_triplet_regexp): New method.
(i386_elf_init_abi, i386_go32_init_abi, i386_gdbarch_init): Call
set_gdbarch_gnu_triplet_regexp.
* gdbarch.sh (gnu_triplet_regexp): New method.
* gdbarch.c, gdbarch.h: Rebuild.
* arch-utils.h (default_gnu_triplet_regexp): Declare.
* arch-utils.c (default_gnu_triplet_regexp): New function.
2014-06-13 17:28:24 +02:00
|
|
|
gdbarch_gnu_triplet_regexp_ftype *gnu_triplet_regexp;
|
2015-06-12 22:51:51 +02:00
|
|
|
gdbarch_addressable_memory_unit_size_ftype *addressable_memory_unit_size;
|
2017-02-28 19:32:07 +01:00
|
|
|
char ** disassembler_options;
|
|
|
|
const disasm_options_t * valid_disassembler_options;
|
1999-07-20 01:30:11 +02:00
|
|
|
};
|
1999-06-14 20:08:47 +02:00
|
|
|
|
2000-08-11 04:55:38 +02:00
|
|
|
/* Create a new ``struct gdbarch'' based on information provided by
|
2011-01-07 20:36:19 +01:00
|
|
|
``struct gdbarch_info''. */
|
1999-06-14 20:08:47 +02:00
|
|
|
|
|
|
|
struct gdbarch *
|
1999-08-31 03:14:27 +02:00
|
|
|
gdbarch_alloc (const struct gdbarch_info *info,
|
|
|
|
struct gdbarch_tdep *tdep)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2007-11-12 07:47:56 +01:00
|
|
|
struct gdbarch *gdbarch;
|
2003-07-22 21:49:58 +02:00
|
|
|
|
|
|
|
/* Create an obstack for allocating all the per-architecture memory,
|
|
|
|
then use that to allocate the architecture vector. */
|
2013-12-28 23:31:23 +01:00
|
|
|
struct obstack *obstack = XNEW (struct obstack);
|
2003-07-22 21:49:58 +02:00
|
|
|
obstack_init (obstack);
|
Replace some xmalloc-family functions with XNEW-family ones
This patch is part of the make-gdb-buildable-in-C++ effort. The idea is
to change some calls to the xmalloc family of functions to calls to the
equivalents in the XNEW family. This avoids adding an explicit cast, so
it keeps the code a bit more readable. Some of them also map relatively
well to a C++ equivalent (XNEW (struct foo) -> new foo), so it will be
possible to do scripted replacements if needed.
I only changed calls that were obviously allocating memory for one or
multiple "objects". Allocation of variable sizes (such as strings or
buffer handling) will be for later (and won't use XNEW).
- xmalloc (sizeof (struct foo)) -> XNEW (struct foo)
- xmalloc (num * sizeof (struct foo)) -> XNEWVEC (struct foo, num)
- xcalloc (1, sizeof (struct foo)) -> XCNEW (struct foo)
- xcalloc (num, sizeof (struct foo)) -> XCNEWVEC (struct foo, num)
- xrealloc (p, num * sizeof (struct foo) -> XRESIZEVEC (struct foo, p, num)
- obstack_alloc (ob, sizeof (struct foo)) -> XOBNEW (ob, struct foo)
- obstack_alloc (ob, num * sizeof (struct foo)) -> XOBNEWVEC (ob, struct foo, num)
- alloca (sizeof (struct foo)) -> XALLOCA (struct foo)
- alloca (num * sizeof (struct foo)) -> XALLOCAVEC (struct foo, num)
Some instances of xmalloc followed by memset to zero the buffer were
replaced by XCNEW or XCNEWVEC.
I regtested on x86-64, Ubuntu 14.04, but the patch touches many
architecture-specific files. For those I'll have to rely on the
buildbot or people complaining that I broke their gdb.
gdb/ChangeLog:
* aarch64-linux-nat.c (aarch64_add_process): Likewise.
* aarch64-tdep.c (aarch64_gdbarch_init): Likewise.
* ada-exp.y (write_ambiguous_var): Likewise.
* ada-lang.c (resolve_subexp): Likewise.
(user_select_syms): Likewise.
(assign_aggregate): Likewise.
(ada_evaluate_subexp): Likewise.
(cache_symbol): Likewise.
* addrmap.c (allocate_key): Likewise.
(addrmap_create_mutable): Likewise.
* aix-thread.c (sync_threadlists): Likewise.
* alpha-tdep.c (alpha_push_dummy_call): Likewise.
(alpha_gdbarch_init): Likewise.
* amd64-windows-tdep.c (amd64_windows_push_arguments): Likewise.
* arm-linux-nat.c (arm_linux_add_process): Likewise.
* arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Likewise.
* arm-tdep.c (push_stack_item): Likewise.
(arm_displaced_step_copy_insn): Likewise.
(arm_gdbarch_init): Likewise.
(_initialize_arm_tdep): Likewise.
* avr-tdep.c (push_stack_item): Likewise.
* ax-general.c (new_agent_expr): Likewise.
* block.c (block_initialize_namespace): Likewise.
* breakpoint.c (alloc_counted_command_line): Likewise.
(update_dprintf_command_list): Likewise.
(parse_breakpoint_sals): Likewise.
(decode_static_tracepoint_spec): Likewise.
(until_break_command): Likewise.
(clear_command): Likewise.
(update_global_location_list): Likewise.
(get_breakpoint_objfile_data) Likewise.
* btrace.c (ftrace_new_function): Likewise.
(btrace_set_insn_history): Likewise.
(btrace_set_call_history): Likewise.
* buildsym.c (add_symbol_to_list): Likewise.
(record_pending_block): Likewise.
(start_subfile): Likewise.
(start_buildsym_compunit): Likewise.
(push_subfile): Likewise.
(end_symtab_get_static_block): Likewise.
(buildsym_init): Likewise.
* cli/cli-cmds.c (source_command): Likewise.
* cli/cli-decode.c (add_cmd): Likewise.
* cli/cli-script.c (build_command_line): Likewise.
(setup_user_args): Likewise.
(realloc_body_list): Likewise.
(process_next_line): Likewise.
(copy_command_lines): Likewise.
* cli/cli-setshow.c (do_set_command): Likewise.
* coff-pe-read.c (read_pe_exported_syms): Likewise.
* coffread.c (coff_locate_sections): Likewise.
(coff_symtab_read): Likewise.
(coff_read_struct_type): Likewise.
* common/cleanups.c (make_my_cleanup2): Likewise.
* common/common-exceptions.c (throw_it): Likewise.
* common/filestuff.c (make_cleanup_close): Likewise.
* common/format.c (parse_format_string): Likewise.
* common/queue.h (DEFINE_QUEUE_P): Likewise.
* compile/compile-object-load.c (munmap_list_add): Likewise.
(compile_object_load): Likewise.
* compile/compile-object-run.c (compile_object_run): Likewise.
* compile/compile.c (append_args): Likewise.
* corefile.c (specify_exec_file_hook): Likewise.
* cp-support.c (make_symbol_overload_list): Likewise.
* cris-tdep.c (push_stack_item): Likewise.
(cris_gdbarch_init): Likewise.
* ctf.c (ctf_trace_file_writer_new): Likewise.
* dbxread.c (init_header_files): Likewise.
(add_new_header_file): Likewise.
(init_bincl_list): Likewise.
(dbx_end_psymtab): Likewise.
(start_psymtab): Likewise.
(dbx_end_psymtab): Likewise.
* dcache.c (dcache_init): Likewise.
* dictionary.c (dict_create_hashed): Likewise.
(dict_create_hashed_expandable): Likewise.
(dict_create_linear): Likewise.
(dict_create_linear_expandable): Likewise.
* dtrace-probe.c (dtrace_process_dof_probe): Likewise.
* dummy-frame.c (register_dummy_frame_dtor): Likewise.
* dwarf2-frame-tailcall.c (cache_new_ref1): Likewise.
* dwarf2-frame.c (dwarf2_build_frame_info): Likewise.
(decode_frame_entry_1): Likewise.
* dwarf2expr.c (new_dwarf_expr_context): Likewise.
* dwarf2loc.c (dwarf2_compile_expr_to_ax): Likewise.
* dwarf2read.c (dwarf2_has_info): Likewise.
(create_signatured_type_table_from_index): Likewise.
(dwarf2_read_index): Likewise.
(dw2_get_file_names_reader): Likewise.
(create_all_type_units): Likewise.
(read_cutu_die_from_dwo): Likewise.
(init_tu_and_read_dwo_dies): Likewise.
(init_cutu_and_read_dies): Likewise.
(create_all_comp_units): Likewise.
(queue_comp_unit): Likewise.
(inherit_abstract_dies): Likewise.
(read_call_site_scope): Likewise.
(dwarf2_add_field): Likewise.
(dwarf2_add_typedef): Likewise.
(dwarf2_add_member_fn): Likewise.
(attr_to_dynamic_prop): Likewise.
(abbrev_table_alloc_abbrev): Likewise.
(abbrev_table_read_table): Likewise.
(add_include_dir): Likewise.
(add_file_name): Likewise.
(dwarf_decode_line_header): Likewise.
(dwarf2_const_value_attr): Likewise.
(dwarf_alloc_block): Likewise.
(parse_macro_definition): Likewise.
(set_die_type): Likewise.
(write_psymtabs_to_index): Likewise.
(create_cus_from_index): Likewise.
(dwarf2_create_include_psymtab): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(build_type_psymtab_dependencies): Likewise.
(read_comp_units_from_section): Likewise.
(compute_compunit_symtab_includes): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(read_func_scope): Likewise.
(process_structure_scope): Likewise.
(mark_common_block_symbol_computed): Likewise.
(load_partial_dies): Likewise.
(dwarf2_symbol_mark_computed): Likewise.
* elfread.c (elf_symfile_segments): Likewise.
(elf_read_minimal_symbols): Likewise.
* environ.c (make_environ): Likewise.
* eval.c (evaluate_subexp_standard): Likewise.
* event-loop.c (create_file_handler): Likewise.
(create_async_signal_handler): Likewise.
(create_async_event_handler): Likewise.
(create_timer): Likewise.
* exec.c (build_section_table): Likewise.
* fbsd-nat.c (fbsd_remember_child): Likewise.
* fork-child.c (fork_inferior): Likewise.
* frv-tdep.c (new_variant): Likewise.
* gdbarch.sh (gdbarch_alloc): Likewise.
(append_name): Likewise.
* gdbtypes.c (rank_function): Likewise.
(copy_type_recursive): Likewise.
(add_dyn_prop): Likewise.
* gnu-nat.c (make_proc): Likewise.
(make_inf): Likewise.
(gnu_write_inferior): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
(build_std_type_info_type): Likewise.
* guile/scm-param.c (compute_enum_list): Likewise.
* guile/scm-utils.c (gdbscm_parse_function_args): Likewise.
* guile/scm-value.c (gdbscm_value_call): Likewise.
* h8300-tdep.c (h8300_gdbarch_init): Likewise.
* hppa-tdep.c (hppa_init_objfile_priv_data): Likewise.
(read_unwind_info): Likewise.
* ia64-tdep.c (ia64_gdbarch_init): Likewise.
* infcall.c (dummy_frame_context_saver_setup): Likewise.
(call_function_by_hand_dummy): Likewise.
* infcmd.c (step_once): Likewise.
(finish_forward): Likewise.
(attach_command): Likewise.
(notice_new_inferior): Likewise.
* inferior.c (add_inferior_silent): Likewise.
* infrun.c (add_displaced_stepping_state): Likewise.
(save_infcall_control_state): Likewise.
(save_inferior_ptid): Likewise.
(_initialize_infrun): Likewise.
* jit.c (bfd_open_from_target_memory): Likewise.
(jit_gdbarch_data_init): Likewise.
* language.c (add_language): Likewise.
* linespec.c (decode_line_2): Likewise.
* linux-nat.c (add_to_pid_list): Likewise.
(add_initial_lwp): Likewise.
* linux-thread-db.c (add_thread_db_info): Likewise.
(record_thread): Likewise.
(info_auto_load_libthread_db): Likewise.
* m32c-tdep.c (m32c_gdbarch_init): Likewise.
* m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise.
* m68k-tdep.c (m68k_gdbarch_init): Likewise.
* m88k-tdep.c (m88k_analyze_prologue): Likewise.
* macrocmd.c (macro_define_command): Likewise.
* macroexp.c (gather_arguments): Likewise.
* macroscope.c (sal_macro_scope): Likewise.
* macrotab.c (new_macro_table): Likewise.
* mdebugread.c (push_parse_stack): Likewise.
(parse_partial_symbols): Likewise.
(parse_symbol): Likewise.
(psymtab_to_symtab_1): Likewise.
(new_block): Likewise.
(new_psymtab): Likewise.
(mdebug_build_psymtabs): Likewise.
(add_pending): Likewise.
(elfmdebug_build_psymtabs): Likewise.
* mep-tdep.c (mep_gdbarch_init): Likewise.
* mi/mi-main.c (mi_execute_command): Likewise.
* mi/mi-parse.c (mi_parse_argv): Likewise.
* minidebug.c (lzma_open): Likewise.
* minsyms.c (terminate_minimal_symbol_table): Likewise.
* mips-linux-nat.c (mips_linux_insert_watchpoint): Likewise.
* mips-tdep.c (mips_gdbarch_init): Likewise.
* mn10300-tdep.c (mn10300_gdbarch_init): Likewise.
* msp430-tdep.c (msp430_gdbarch_init): Likewise.
* mt-tdep.c (mt_registers_info): Likewise.
* nat/aarch64-linux.c (aarch64_linux_new_thread): Likewise.
* nat/linux-btrace.c (linux_enable_bts): Likewise.
(linux_enable_pt): Likewise.
* nat/linux-osdata.c (linux_xfer_osdata_processes): Likewise.
(linux_xfer_osdata_processgroups): Likewise.
* nios2-tdep.c (nios2_gdbarch_init): Likewise.
* nto-procfs.c (procfs_meminfo): Likewise.
* objc-lang.c (start_msglist): Likewise.
(selectors_info): Likewise.
(classes_info): Likewise.
(find_methods): Likewise.
* objfiles.c (allocate_objfile): Likewise.
(update_section_map): Likewise.
* osabi.c (gdbarch_register_osabi): Likewise.
(gdbarch_register_osabi_sniffer): Likewise.
* parse.c (start_arglist): Likewise.
* ppc-linux-nat.c (hwdebug_find_thread_points_by_tid): Likewise.
(hwdebug_insert_point): Likewise.
* printcmd.c (display_command): Likewise.
(ui_printf): Likewise.
* procfs.c (create_procinfo): Likewise.
(load_syscalls): Likewise.
(proc_get_LDT_entry): Likewise.
(proc_update_threads): Likewise.
* prologue-value.c (make_pv_area): Likewise.
(pv_area_store): Likewise.
* psymtab.c (extend_psymbol_list): Likewise.
(init_psymbol_list): Likewise.
(allocate_psymtab): Likewise.
* python/py-inferior.c (add_thread_object): Likewise.
* python/py-param.c (compute_enum_values): Likewise.
* python/py-value.c (valpy_call): Likewise.
* python/py-varobj.c (py_varobj_iter_next): Likewise.
* python/python.c (ensure_python_env): Likewise.
* record-btrace.c (record_btrace_start_replaying): Likewise.
* record-full.c (record_full_reg_alloc): Likewise.
(record_full_mem_alloc): Likewise.
(record_full_end_alloc): Likewise.
(record_full_core_xfer_partial): Likewise.
* regcache.c (get_thread_arch_aspace_regcache): Likewise.
* remote-fileio.c (remote_fileio_init_fd_map): Likewise.
* remote-notif.c (remote_notif_state_allocate): Likewise.
* remote.c (demand_private_info): Likewise.
(remote_notif_stop_alloc_reply): Likewise.
(remote_enable_btrace): Likewise.
* reverse.c (save_bookmark_command): Likewise.
* rl78-tdep.c (rl78_gdbarch_init): Likewise.
* rx-tdep.c (rx_gdbarch_init): Likewise.
* s390-linux-nat.c (s390_insert_watchpoint): Likewise.
* ser-go32.c (dos_get_tty_state): Likewise.
(dos_copy_tty_state): Likewise.
* ser-mingw.c (ser_windows_open): Likewise.
(ser_console_wait_handle): Likewise.
(ser_console_get_tty_state): Likewise.
(make_pipe_state): Likewise.
(net_windows_open): Likewise.
* ser-unix.c (hardwire_get_tty_state): Likewise.
(hardwire_copy_tty_state): Likewise.
* solib-aix.c (solib_aix_new_lm_info): Likewise.
* solib-dsbt.c (dsbt_current_sos): Likewise.
(dsbt_relocate_main_executable): Likewise.
* solib-frv.c (frv_current_sos): Likewise.
(frv_relocate_main_executable): Likewise.
* solib-spu.c (spu_bfd_fopen): Likewise.
* solib-svr4.c (lm_info_read): Likewise.
(svr4_copy_library_list): Likewise.
(svr4_default_sos): Likewise.
* source.c (find_source_lines): Likewise.
(line_info): Likewise.
(add_substitute_path_rule): Likewise.
* spu-linux-nat.c (spu_bfd_open): Likewise.
* spu-tdep.c (info_spu_dma_cmdlist): Likewise.
* stabsread.c (dbx_lookup_type): Likewise.
(read_type): Likewise.
(read_member_functions): Likewise.
(read_struct_fields): Likewise.
(read_baseclasses): Likewise.
(read_args): Likewise.
(_initialize_stabsread): Likewise.
* stack.c (func_command): Likewise.
* stap-probe.c (handle_stap_probe): Likewise.
* symfile.c (addrs_section_sort): Likewise.
(addr_info_make_relative): Likewise.
(load_section_callback): Likewise.
(add_symbol_file_command): Likewise.
(init_filename_language_table): Likewise.
* symtab.c (create_filename_seen_cache): Likewise.
(sort_search_symbols_remove_dups): Likewise.
(search_symbols): Likewise.
* target.c (make_cleanup_restore_target_terminal): Likewise.
* thread.c (new_thread): Likewise.
(enable_thread_stack_temporaries): Likewise.
(make_cleanup_restore_current_thread): Likewise.
(thread_apply_all_command): Likewise.
* tic6x-tdep.c (tic6x_gdbarch_init): Likewise.
* top.c (gdb_readline_wrapper): Likewise.
* tracefile-tfile.c (tfile_trace_file_writer_new): Likewise.
* tracepoint.c (trace_find_line_command): Likewise.
(all_tracepoint_actions_and_cleanup): Likewise.
(make_cleanup_restore_current_traceframe): Likewise.
(get_uploaded_tp): Likewise.
(get_uploaded_tsv): Likewise.
* tui/tui-data.c (tui_alloc_generic_win_info): Likewise.
(tui_alloc_win_info): Likewise.
(tui_alloc_content): Likewise.
(tui_add_content_elements): Likewise.
* tui/tui-disasm.c (tui_find_disassembly_address): Likewise.
(tui_set_disassem_content): Likewise.
* ui-file.c (ui_file_new): Likewise.
(stdio_file_new): Likewise.
(tee_file_new): Likewise.
* utils.c (make_cleanup_restore_integer): Likewise.
(add_internal_problem_command): Likewise.
* v850-tdep.c (v850_gdbarch_init): Likewise.
* valops.c (find_oload_champ): Likewise.
* value.c (allocate_value_lazy): Likewise.
(record_latest_value): Likewise.
(create_internalvar): Likewise.
* varobj.c (install_variable): Likewise.
(new_variable): Likewise.
(new_root_variable): Likewise.
(cppush): Likewise.
(_initialize_varobj): Likewise.
* windows-nat.c (windows_make_so): Likewise.
* x86-nat.c (x86_add_process): Likewise.
* xcoffread.c (arrange_linetable): Likewise.
(allocate_include_entry): Likewise.
(process_linenos): Likewise.
(SYMBOL_DUP): Likewise.
(xcoff_start_psymtab): Likewise.
(xcoff_end_psymtab): Likewise.
* xml-support.c (gdb_xml_parse_attr_ulongest): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
gdb/gdbserver/ChangeLog:
* ax.c (gdb_parse_agent_expr): Likewise.
(compile_bytecodes): Likewise.
* dll.c (loaded_dll): Likewise.
* event-loop.c (append_callback_event): Likewise.
(create_file_handler): Likewise.
(create_file_event): Likewise.
* hostio.c (handle_open): Likewise.
* inferiors.c (add_thread): Likewise.
(add_process): Likewise.
* linux-aarch64-low.c (aarch64_linux_new_process): Likewise.
* linux-arm-low.c (arm_new_process): Likewise.
(arm_new_thread): Likewise.
* linux-low.c (add_to_pid_list): Likewise.
(linux_add_process): Likewise.
(handle_extended_wait): Likewise.
(add_lwp): Likewise.
(enqueue_one_deferred_signal): Likewise.
(enqueue_pending_signal): Likewise.
(linux_resume_one_lwp_throw): Likewise.
(linux_resume_one_thread): Likewise.
(linux_read_memory): Likewise.
(linux_write_memory): Likewise.
* linux-mips-low.c (mips_linux_new_process): Likewise.
(mips_linux_new_thread): Likewise.
(mips_add_watchpoint): Likewise.
* linux-x86-low.c (initialize_low_arch): Likewise.
* lynx-low.c (lynx_add_process): Likewise.
* mem-break.c (set_raw_breakpoint_at): Likewise.
(set_breakpoint): Likewise.
(add_condition_to_breakpoint): Likewise.
(add_commands_to_breakpoint): Likewise.
(clone_agent_expr): Likewise.
(clone_one_breakpoint): Likewise.
* regcache.c (new_register_cache): Likewise.
* remote-utils.c (look_up_one_symbol): Likewise.
* server.c (queue_stop_reply): Likewise.
(start_inferior): Likewise.
(queue_stop_reply_callback): Likewise.
(handle_target_event): Likewise.
* spu-low.c (fetch_ppc_memory): Likewise.
(store_ppc_memory): Likewise.
* target.c (set_target_ops): Likewise.
* thread-db.c (thread_db_load_search): Likewise.
(try_thread_db_load_1): Likewise.
* tracepoint.c (add_tracepoint): Likewise.
(add_tracepoint_action): Likewise.
(create_trace_state_variable): Likewise.
(cmd_qtdpsrc): Likewise.
(cmd_qtro): Likewise.
(add_while_stepping_state): Likewise.
* win32-low.c (child_add_thread): Likewise.
(get_image_name): Likewise.
2015-08-26 23:16:07 +02:00
|
|
|
gdbarch = XOBNEW (obstack, struct gdbarch);
|
2007-11-12 07:47:56 +01:00
|
|
|
memset (gdbarch, 0, sizeof (*gdbarch));
|
|
|
|
gdbarch->obstack = obstack;
|
1999-06-14 20:08:47 +02:00
|
|
|
|
2007-11-12 07:47:56 +01:00
|
|
|
alloc_gdbarch_data (gdbarch);
|
2001-06-06 16:46:30 +02:00
|
|
|
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch->tdep = tdep;
|
1999-06-14 20:08:47 +02:00
|
|
|
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch->bfd_arch_info = info->bfd_arch_info;
|
|
|
|
gdbarch->byte_order = info->byte_order;
|
2008-08-11 21:00:25 +02:00
|
|
|
gdbarch->byte_order_for_code = info->byte_order_for_code;
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch->osabi = info->osabi;
|
|
|
|
gdbarch->target_desc = info->target_desc;
|
1999-06-14 20:08:47 +02:00
|
|
|
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Force the explicit initialization of these. */
|
2008-01-18 18:07:40 +01:00
|
|
|
gdbarch->bits_big_endian = (gdbarch->byte_order == BFD_ENDIAN_BIG);
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch->short_bit = 2*TARGET_CHAR_BIT;
|
|
|
|
gdbarch->int_bit = 4*TARGET_CHAR_BIT;
|
|
|
|
gdbarch->long_bit = 4*TARGET_CHAR_BIT;
|
|
|
|
gdbarch->long_long_bit = 2*gdbarch->long_bit;
|
2011-10-11 21:08:59 +02:00
|
|
|
gdbarch->long_long_align_bit = 2*gdbarch->long_bit;
|
2010-07-06 14:56:24 +02:00
|
|
|
gdbarch->half_bit = 2*TARGET_CHAR_BIT;
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch->float_bit = 4*TARGET_CHAR_BIT;
|
|
|
|
gdbarch->double_bit = 8*TARGET_CHAR_BIT;
|
|
|
|
gdbarch->long_double_bit = 8*TARGET_CHAR_BIT;
|
Teach GDB that wchar_t is a built-in type in C++ mode
GDB is currently not aware that wchar_t is a built-in type in C++
mode. This is usually not a problem because the debug info describes
the type, so when you have a program loaded, you don't notice this.
However, if you try expressions involving wchar_t before a program is
loaded, gdb errors out:
(gdb) p (wchar_t)-1
No symbol table is loaded. Use the "file" command.
(gdb) p L"hello"
No type named wchar_t.
(gdb) ptype L"hello"
No type named wchar_t.
This commit teaches gdb about the type. After:
(gdb) p (wchar_t)-1
$1 = -1 L'\xffffffff'
(gdb) p L"hello"
$2 = L"hello"
(gdb) ptype L"hello"
type = wchar_t [6]
Unlike char16_t/char32_t, unfortunately, the underlying type of
wchar_t is implementation dependent, both size and signness. So this
requires adding a couple new gdbarch hooks.
I grepped the GCC code base for WCHAR_TYPE and WCHAR_TYPE_SIZE, and it
seems to me that the majority of the ABIs have a 4-byte signed
wchar_t, so that's what I made the default for GDB too. And then I
looked for which ports have a 16-bit and/or unsigned wchar_t, and made
GDB follow suit.
gdb/ChangeLog:
2017-04-12 Pedro Alves <palves@redhat.com>
PR gdb/21323
* c-lang.c (cplus_primitive_types) <cplus_primitive_type_wchar_t>:
New enum value.
(cplus_language_arch_info): Register cplus_primitive_type_wchar_t.
* gdbtypes.h (struct builtin_type) <builtin_wchar>: New field.
* gdbtypes.c (gdbtypes_post_init): Create the "wchar_t" type.
* gdbarch.sh (wchar_bit, wchar_signed): New per-arch values.
* gdbarch.h, gdbarch.c: Regenerate.
* aarch64-tdep.c (aarch64_gdbarch_init): Override
gdbarch_wchar_bit and gdbarch_wchar_signed.
* alpha-tdep.c (alpha_gdbarch_init): Likewise.
* arm-tdep.c (arm_gdbarch_init): Likewise.
* avr-tdep.c (avr_gdbarch_init): Likewise.
* h8300-tdep.c (h8300_gdbarch_init): Likewise.
* i386-nto-tdep.c (i386nto_init_abi): Likewise.
* i386-tdep.c (i386_go32_init_abi): Likewise.
* m32r-tdep.c (m32r_gdbarch_init): Likewise.
* moxie-tdep.c (moxie_gdbarch_init): Likewise.
* nds32-tdep.c (nds32_gdbarch_init): Likewise.
* rs6000-aix-tdep.c (rs6000_aix_init_osabi): Likewise.
* sh-tdep.c (sh_gdbarch_init): Likewise.
* sparc-tdep.c (sparc32_gdbarch_init): Likewise.
* sparc64-tdep.c (sparc64_init_abi): Likewise.
* windows-tdep.c (windows_init_abi): Likewise.
* xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise.
gdb/testsuite/ChangeLog:
2017-04-12 Pedro Alves <palves@redhat.com>
PR gdb/21323
* gdb.cp/wide_char_types.c: Include <wchar.h>.
(wchar): New global.
* gdb.cp/wide_char_types.exp (wide_char_types_program)
(do_test_wide_char, wide_char_types_no_program, top level): Add
wchar_t testing.
2017-04-12 15:00:49 +02:00
|
|
|
gdbarch->wchar_bit = 4*TARGET_CHAR_BIT;
|
|
|
|
gdbarch->wchar_signed = -1;
|
Add gdbarch callback to provide formats for debug info float types
At this point, all TYPE_CODE_FLT types carry their floating-point format,
except for those creating from reading DWARF or stabs debug info. Those
will be addressed by this commit.
The main issue here is that we actually have to determine which floating-
point format to use. Currently, we only have the type length as input
to this decision. In the future, we may hopefully get --at least in
DWARF-- additional information to help disambiguate multiple different
formats of the same length. For now, we can still look at the type name
as a hint.
This decision logic is encapsulated in a gdbarch callback to allow
platform-specific overrides. The default implementation use the same
logic (compare type length against the various gdbarch_..._bit sizes)
that is currently implemented in floatformat_from_length.
With this commit, all platforms still use the default logic, so there
should be no actual change in behavior. A follow-on commit will add
support for __float128 on Intel and Power.
Once dwarf2read.c and stabsread.c make use of the new callback to
determine floating-point formats, we're now sure every TYPE_CODE_FLT
type will always carry its format. The commit therefore adds asserts
to verify_floatformat to ensure new code will continue to always
provide formats, and removes the code in floatformat_from_type that
used to handle types with a NULL TYPE_FLOATFORMAT.
gdb/ChangeLog:
* gdbarch.sh (floatformat_for_type): New gdbarch callback.
* gdbarch.h, gdbarch.c: Re-generate.
* arch-utils.h (default_floatformat_for_type): New prototype.
* arch-utils.c (default_floatformat_for_type): New function.
* doublest.c (floatformat_from_length): Remove.
(floatformat_from_type): Assume TYPE_FLOATFORMAT is non-NULL.
* gdbtypes.c (verify_floatformat): Require non-NULL format.
* dwarf2read.c (dwarf2_init_float_type): New function.
(read_base_type): Use it.
* stabsread.c (dbx_init_float_type): New function.
(read_sun_floating_type): Use it.
(read_range_type): Likewise.
Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-06 17:31:53 +02:00
|
|
|
gdbarch->floatformat_for_type = default_floatformat_for_type;
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch->ptr_bit = gdbarch->int_bit;
|
|
|
|
gdbarch->char_signed = -1;
|
|
|
|
gdbarch->virtual_frame_pointer = legacy_virtual_frame_pointer;
|
|
|
|
gdbarch->num_regs = -1;
|
|
|
|
gdbarch->sp_regnum = -1;
|
|
|
|
gdbarch->pc_regnum = -1;
|
|
|
|
gdbarch->ps_regnum = -1;
|
|
|
|
gdbarch->fp0_regnum = -1;
|
|
|
|
gdbarch->stab_reg_to_regnum = no_op_reg_to_regnum;
|
|
|
|
gdbarch->ecoff_reg_to_regnum = no_op_reg_to_regnum;
|
|
|
|
gdbarch->sdb_reg_to_regnum = no_op_reg_to_regnum;
|
|
|
|
gdbarch->dwarf2_reg_to_regnum = no_op_reg_to_regnum;
|
|
|
|
gdbarch->deprecated_fp_regnum = -1;
|
|
|
|
gdbarch->call_dummy_location = AT_ENTRY_POINT;
|
Skip unwritable frames in command "finish"
Nowadays, GDB can't insert breakpoint on the return address of the
exception handler on ARM M-profile, because the address is a magic
one 0xfffffff9,
(gdb) bt
#0 CT32B1_IRQHandler () at ../src/timer.c:67
#1 <signal handler called>
#2 main () at ../src/timer.c:127
(gdb) info frame
Stack level 0, frame at 0x200ffa8:
pc = 0x4ec in CT32B1_IRQHandler (../src/timer.c:67); saved pc = 0xfffffff9
called by frame at 0x200ffc8
source language c.
Arglist at 0x200ffa0, args:
Locals at 0x200ffa0, Previous frame's sp is 0x200ffa8
Saved registers:
r7 at 0x200ffa0, lr at 0x200ffa4
(gdb) x/x 0xfffffff9
0xfffffff9: Cannot access memory at address 0xfffffff9
(gdb) finish
Run till exit from #0 CT32B1_IRQHandler () at ../src/timer.c:67
Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?)
Warning:
Cannot insert hardware breakpoint 0.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.
Command aborted.
even some debug probe can't set hardware breakpoint on the magic
address too,
(gdb) hbreak *0xfffffff9
Hardware assisted breakpoint 2 at 0xfffffff9
(gdb) c
Continuing.
Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?)
Warning:
Cannot insert hardware breakpoint 2.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.
Command aborted.
The problem described above is quite similar to PR 8841, in which GDB
can't set breakpoint on signal trampoline, which is mapped to a read-only
page by kernel. The rationale of this patch is to skip "unwritable"
frames when looking for caller frames in command "finish", and a new
gdbarch method code_of_frame_writable is added. This patch fixes
the problem on ARM cortex-m target, but it can be used to fix
PR 8841 too.
gdb:
2016-05-10 Yao Qi <yao.qi@arm.com>
* arch-utils.c (default_code_of_frame_writable): New function.
* arch-utils.h (default_code_of_frame_writable): Declare.
* arm-tdep.c (arm_code_of_frame_writable): New function.
(arm_gdbarch_init): Install gdbarch method
code_of_frame_writable if the target is M-profile.
* frame.c (skip_unwritable_frames): New function.
* frame.h (skip_unwritable_frames): Declare.
* gdbarch.sh (code_of_frame_writable): New.
* gdbarch.c, gdbarch.h: Re-generated.
* infcmd.c (finish_command): Call skip_unwritable_frames.
2016-05-23 18:32:56 +02:00
|
|
|
gdbarch->code_of_frame_writable = default_code_of_frame_writable;
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch->print_registers_info = default_print_registers_info;
|
2014-12-18 13:47:28 +01:00
|
|
|
gdbarch->print_float_info = default_print_float_info;
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch->register_sim_regno = legacy_register_sim_regno;
|
|
|
|
gdbarch->cannot_fetch_register = cannot_register_not;
|
|
|
|
gdbarch->cannot_store_register = cannot_register_not;
|
|
|
|
gdbarch->convert_register_p = generic_convert_register_p;
|
|
|
|
gdbarch->value_from_register = default_value_from_register;
|
|
|
|
gdbarch->pointer_to_address = unsigned_pointer_to_address;
|
|
|
|
gdbarch->address_to_pointer = unsigned_address_to_pointer;
|
2012-06-08 16:24:57 +02:00
|
|
|
gdbarch->return_in_first_hidden_param_p = default_return_in_first_hidden_param_p;
|
Add default_breakpoint_from_pc
This patch adds the default implementation of gdbarch breakpoint_from_pc,
which is,
const gdb_byte *
default_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
int *lenptr)
{
int kind = gdbarch_breakpoint_kind_from_pc (gdbarch, pcptr);
return gdbarch_sw_breakpoint_from_kind (gdbarch, kind, lenptr);
}
so gdbarch can only defines sw_breakpoint_from_kind and
breakpoint_kind_from_pc.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.c (default_breakpoint_from_pc): New function.
* arch-utils.h (GDBARCH_BREAKPOINT_FROM_PC): Remove.
(GDBARCH_BREAKPOINT_MANIPULATION): Don't use
GDBARCH_BREAKPOINT_FROM_PC.
(SET_GDBARCH_BREAKPOINT_MANIPULATION): Don't call
set_gdbarch_breakpoint_from_pc.
(default_breakpoint_from_pc): Remove declaration.
* gdbarch.sh (breakpoint_from_pc): Add its default implementation.
* gdbarch.c, gdbarch.h: Regenerate.
* arm-tdep.c: Don't use GDBARCH_BREAKPOINT_FROM_PC.
* arc-tdep.c, bfin-tdep.c, cris-tdep.c, iq2000-tdep.c: Likewise.
* m32r-tdep.c, mips-tdep.c, mt-tdep.c: Likewise.
* nios2-tdep.c, score-tdep.c, sh-tdep.c: Likewise.
* sh64-tdep.c, tic6x-tdep.c, v850-tdep.c, xtensa-tdep.c: Likewise.
2016-11-03 15:35:14 +01:00
|
|
|
gdbarch->breakpoint_from_pc = default_breakpoint_from_pc;
|
New gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind
This patch adds two gdbarch methods breakpoint_kind_from_pc and
sw_breakpoint_from_kind, and uses target_info.placed_size as "kind"
of the breakpoint. This patch updates the usages of
target_info.placed_size.
The "kind" of a breakpoint is determined by gdbarch rather than
target, so we have gdbarch method breakpoint_kind_from_pc, and we
should set target_info.placed_size out of each implementation of
target to_insert_breakpoint. In this way, each target doesn't have
to set target_info.placed_size any more.
This patch also sets target_info.placed_address before
target_insert_breakpoint too, so that target to_insert_breakpoint
can use it, see record_full_insert_breakpoint.
Before we call target_insert_breakpoint, we set
target_info.placed_address and target_info.placed_size like this,
CORE_ADDR addr = bl->target_info.reqstd_address;
bl->target_info.placed_size = gdbarch_breakpoint_kind_from_pc (bl->gdbarch, &addr);
bl->target_info.placed_address = addr;
return target_insert_breakpoint (bl->gdbarch, &bl->target_info);
target_insert_breakpoint may fail, but it doesn't matter to the "kind"
and "placed_address" of a breakpoint. They should be determined by
gdbarch.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): Define
breakpoint_kind_from_pc and sw_breakpoint_from_kind.
(GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN): Likewise.
(SET_GDBARCH_BREAKPOINT_MANIPULATION): Call
set_gdbarch_breakpoint_kind_from_pc and
set_gdbarch_sw_breakpoint_from_kind.
* arm-tdep.c: Add comments.
* bfin-tdep.c: Likewise.
* breakpoint.c (breakpoint_kind): New function.
(insert_bp_location): Set target_info.placed_size and
target_info.placed_address.
(bkpt_insert_location): Likewise.
* cris-tdep.c: Add comments.
* gdbarch.sh (breakpoint_kind_from_pc): New.
(sw_breakpoint_from_kind): New.
* gdbarch.c, gdbarch.h: Regenerated.
* ia64-tdep.c (ia64_memory_insert_breakpoint): Don't set
bp_tgt->placed_size.
(ia64_memory_remove_breakpoint): Don't assert
bp_tgt->placed_size.
(ia64_breakpoint_kind_from_pc): New function.
(ia64_gdbarch_init): Install ia64_breakpoint_kind_from_pc.
* m32r-tdep.c (m32r_memory_insert_breakpoint): Don't set
bp_tgt->placed_size.
* mem-break.c (default_memory_insert_breakpoint): Don't set
bp_tgt->placed_size. Call gdbarch_sw_breakpoint_from_kind.
(default_memory_remove_breakpoint): Call
gdbarch_sw_breakpoint_from_kind.
(memory_validate_breakpoint): Don't check bp_tgt->placed_size.
* mips-tdep.c: Add comments.
* mt-tdep.c: Likewise.
* nios2-tdep.c: Likewise.
* record-full.c (record_full_insert_breakpoint): Don't call
gdbarch_breakpoint_from_pc. Don't set bp_tgt->placed_address
and bp_tgt->placed_size.
* remote.c (remote_insert_breakpoint): Don't call
gdbarch_remote_breakpoint_from_pc. Use bp_tgt->placed_size.
Don't set bp_tgt->placed_address and bp_tgt->placed_size.
(remote_insert_hw_breakpoint): Likewise.
* score-tdep.c: Likewise.
* sh-tdep.c: Likewise.
* tic6x-tdep.c: Likewise.
* v850-tdep.c: Likewise.
* xtensa-tdep.c: Likewise.
2016-11-03 15:35:13 +01:00
|
|
|
gdbarch->sw_breakpoint_from_kind = NULL;
|
2016-11-03 15:35:14 +01:00
|
|
|
gdbarch->breakpoint_kind_from_current_state = default_breakpoint_kind_from_current_state;
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint;
|
|
|
|
gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
|
|
|
|
gdbarch->remote_register_number = default_remote_register_number;
|
|
|
|
gdbarch->stabs_argument_has_addr = default_stabs_argument_has_addr;
|
|
|
|
gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr_identity;
|
|
|
|
gdbarch->addr_bits_remove = core_addr_identity;
|
|
|
|
gdbarch->skip_trampoline_code = generic_skip_trampoline_code;
|
|
|
|
gdbarch->skip_solib_resolver = generic_skip_solib_resolver;
|
|
|
|
gdbarch->in_solib_return_trampoline = generic_in_solib_return_trampoline;
|
2015-05-26 12:59:17 +02:00
|
|
|
gdbarch->stack_frame_destroyed_p = generic_stack_frame_destroyed_p;
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch->coff_make_msymbol_special = default_coff_make_msymbol_special;
|
MIPS: Keep the ISA bit in compressed code addresses
1. Background information
The MIPS architecture, as originally designed and implemented in
mid-1980s has a uniform instruction word size that is 4 bytes, naturally
aligned. As such all MIPS instructions are located at addresses that
have their bits #1 and #0 set to zeroes, and any attempt to execute an
instruction from an address that has any of the two bits set to one
causes an address error exception. This may for example happen when a
jump-register instruction is executed whose register value used as the
jump target has any of these bits set.
Then in mid 1990s LSI sought a way to improve code density for their
TinyRISC family of MIPS cores and invented an alternatively encoded
instruction set in a joint effort with MIPS Technologies (then a
subsidiary of SGI). The new instruction set has been named the MIPS16
ASE (Application-Specific Extension) and uses a variable instruction
word size, which is 2 bytes (as the name of the ASE suggests) for most,
but there are a couple of exceptions that take 4 bytes, and then most of
the 2-byte instructions can be treated with a 2-byte extension prefix to
expand the range of the immediate operands used.
As a result instructions are no longer 4-byte aligned, instead they are
aligned to a multiple of 2. That left the bit #0 still unused for code
references, be it for the standard MIPS (i.e. as originally invented) or
for the MIPS16 instruction set, and based on that observation a clever
trick was invented that on one hand allowed the processor to be
seamlessly switched between the two instruction sets at any time at the
run time while on the other avoided the introduction of any special
control register to do that.
So it is the bit #0 of the instruction address that was chosen as the
selector and named the ISA bit. Any instruction executed at an even
address is interpreted as a standard MIPS instruction (the address still
has to have its bit #1 clear), any instruction executed at an odd
address is interpreted as a MIPS16 instruction.
To switch between modes ordinary jump instructions are used, such as
used for function calls and returns, specifically the bit #0 of the
source register used in jump-register instructions selects the execution
(ISA) mode for the following piece of code to be interpreted in.
Additionally new jump-immediate instructions were added that flipped the
ISA bit to select the opposite mode upon execution. They were
considered necessary to avoid the need to make register jumps in all
cases as the original jump-immediate instructions provided no way to
change the bit #0 at all.
This was all important for cases where standard MIPS and MIPS16 code had
to be mixed, either for compatibility with the existing binary code base
or to access resources not reachable from MIPS16 code (the MIPS16
instruction set only provides access to general-purpose registers, and
not for example floating-point unit registers or privileged coprocessor
0 registers) -- pieces of code in the opposite mode can be executed as
ordinary subroutine calls.
A similar approach has been more recently adopted for the MIPS16
replacement instruction set defined as the so called microMIPS ASE.
This is another instruction set encoding introduced to the MIPS
architecture. Just like the MIPS16 ASE, the microMIPS instruction set
uses a variable-length encoding, where each instruction takes a multiple
of 2 bytes. The ISA bit has been reused and for microMIPS-capable
processors selects between the standard MIPS and the microMIPS mode
instead.
2. Statement of the problem
To put it shortly, MIPS16 and microMIPS code pointers used by GDB are
different to these observed at the run time. This results in the same
expressions being evaluated producing different results in GDB and in
the program being debugged. Obviously it's the results obtained at the
run time that are correct (they define how the program behaves) and
therefore by definition the results obtained in GDB are incorrect.
A bit longer description will record that obviously at the run time the
ISA bit has to be set correctly (refer to background information above
if unsure why so) or the program will not run as expected. This is
recorded in all the executable file structures used at the run time: the
dynamic symbol table (but not always the static one!), the GOT, and
obviously in all the addresses embedded in code or data of the program
itself, calculated by applying the appropriate relocations at the static
link time.
While a program is being processed by GDB, the ISA bit is stripped off
from any code addresses, presumably to make them the same as the
respective raw memory byte address used by the processor to access the
instruction in the instruction fetch access cycle. This stripping is
actually performed outside GDB proper, in BFD, specifically
_bfd_mips_elf_symbol_processing (elfxx-mips.c, see the piece of code at
the very bottom of that function, starting with an: "If this is an
odd-valued function symbol, assume it's a MIPS16 or microMIPS one."
comment).
This function is also responsible for symbol table dumps made by
`objdump' too, so you'll never see the ISA bit reported there by that
tool, you need to use `readelf'.
This is however unlike what is ever done at the run time, the ISA bit
once present is never stripped off, for example a cast like this:
(short *) main
will not strip the ISA bit off and if the resulting pointer is intended
to be used to access instructions as data, for example for software
instruction decoding (like for fault recovery or emulation in a signal
handler) or for self-modifying code then the bit still has to be
stripped off by an explicit AND operation.
This is probably best illustrated with a simple real program example.
Let's consider the following simple program:
$ cat foobar.c
int __attribute__ ((mips16)) foo (void)
{
return 1;
}
int __attribute__ ((mips16)) bar (void)
{
return 2;
}
int __attribute__ ((nomips16)) foo32 (void)
{
return 3;
}
int (*foo32p) (void) = foo32;
int (*foop) (void) = foo;
int fooi = (int) foo;
int
main (void)
{
return foop ();
}
$
This is plain C with no odd tricks, except from the instruction mode
attributes. They are not necessary to trigger this problem, I just put
them here so that the program can be contained in a single source file
and to make it obvious which function is MIPS16 code and which is not.
Let's try it with Linux, so that everyone can repeat this experiment:
$ mips-linux-gnu-gcc -mips16 -g -O2 -o foobar foobar.c
$
Let's have a look at some interesting symbols:
$ mips-linux-gnu-readelf -s foobar | egrep 'table|foo|bar'
Symbol table '.dynsym' contains 7 entries:
Symbol table '.symtab' contains 95 entries:
55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c
66: 0040068c 4 FUNC GLOBAL DEFAULT [MIPS16] 12 bar
68: 00410848 4 OBJECT GLOBAL DEFAULT 21 foo32p
70: 00410844 4 OBJECT GLOBAL DEFAULT 21 foop
78: 00400684 8 FUNC GLOBAL DEFAULT 12 foo32
80: 00400680 4 FUNC GLOBAL DEFAULT [MIPS16] 12 foo
88: 00410840 4 OBJECT GLOBAL DEFAULT 21 fooi
$
Hmm, no sight of the ISA bit, but notice how foo and bar (but not
foo32!) have been marked as MIPS16 functions (ELF symbol structure's
`st_other' field is used for that).
So let's try to run and poke at this program with GDB. I'll be using a
native system for simplicity (I'll be using ellipses here and there to
remove unrelated clutter):
$ ./foobar
$ echo $?
1
$
So far, so good.
$ gdb ./foobar
[...]
(gdb) break main
Breakpoint 1 at 0x400490: file foobar.c, line 23.
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb)
Yay, it worked! OK, so let's poke at it:
(gdb) print main
$1 = {int (void)} 0x400490 <main>
(gdb) print foo32
$2 = {int (void)} 0x400684 <foo32>
(gdb) print foo32p
$3 = (int (*)(void)) 0x400684 <foo32>
(gdb) print bar
$4 = {int (void)} 0x40068c <bar>
(gdb) print foo
$5 = {int (void)} 0x400680 <foo>
(gdb) print foop
$6 = (int (*)(void)) 0x400681 <foo>
(gdb)
A-ha! Here's the difference and finally the ISA bit!
(gdb) print /x fooi
$7 = 0x400681
(gdb) p/x $pc
p/x $pc
$8 = 0x400491
(gdb)
And here as well...
(gdb) advance foo
foo () at foobar.c:4
4 }
(gdb) disassemble
Dump of assembler code for function foo:
0x00400680 <+0>: jr ra
0x00400682 <+2>: li v0,1
End of assembler dump.
(gdb) finish
Run till exit from #0 foo () at foobar.c:4
main () at foobar.c:24
24 }
Value returned is $9 = 1
(gdb) continue
Continuing.
[Inferior 1 (process 14103) exited with code 01]
(gdb)
So let's be a bit inquisitive...
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb)
Actually we do not like to run foo here at all. Let's run bar instead!
(gdb) set foop = bar
(gdb) print foop
$10 = (int (*)(void)) 0x40068c <bar>
(gdb)
Hmm, no ISA bit. Is it going to work?
(gdb) advance bar
bar () at foobar.c:9
9 }
(gdb) p/x $pc
$11 = 0x40068c
(gdb) disassemble
Dump of assembler code for function bar:
=> 0x0040068c <+0>: jr ra
0x0040068e <+2>: li v0,2
End of assembler dump.
(gdb) finish
Run till exit from #0 bar () at foobar.c:9
Program received signal SIGILL, Illegal instruction.
bar () at foobar.c:9
9 }
(gdb)
Oops!
(gdb) p/x $pc
$12 = 0x40068c
(gdb)
We're still there!
(gdb) continue
Continuing.
Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb)
So let's try something else:
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) set foop = foo
(gdb) advance foo
foo () at foobar.c:4
4 }
(gdb) disassemble
Dump of assembler code for function foo:
=> 0x00400680 <+0>: jr ra
0x00400682 <+2>: li v0,1
End of assembler dump.
(gdb) finish
Run till exit from #0 foo () at foobar.c:4
Program received signal SIGILL, Illegal instruction.
foo () at foobar.c:4
4 }
(gdb) continue
Continuing.
Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb)
The same problem!
(gdb) run
Starting program:
/net/build2-lucid-cs/scratch/macro/mips-linux-fsf-gcc/isa-bit/foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) set foop = foo32
(gdb) advance foo32
foo32 () at foobar.c:14
14 }
(gdb) disassemble
Dump of assembler code for function foo32:
=> 0x00400684 <+0>: jr ra
0x00400688 <+4>: li v0,3
End of assembler dump.
(gdb) finish
Run till exit from #0 foo32 () at foobar.c:14
main () at foobar.c:24
24 }
Value returned is $14 = 3
(gdb) continue
Continuing.
[Inferior 1 (process 14113) exited with code 03]
(gdb)
That did work though, so it's the ISA bit only!
(gdb) quit
Enough!
That's the tip of the iceberg only though. So let's rebuild the
executable with some dynamic symbols:
$ mips-linux-gnu-gcc -mips16 -Wl,--export-dynamic -g -O2 -o foobar-dyn foobar.c
$ mips-linux-gnu-readelf -s foobar-dyn | egrep 'table|foo|bar'
Symbol table '.dynsym' contains 32 entries:
6: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar
8: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p
9: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop
15: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32
17: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo
25: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi
Symbol table '.symtab' contains 95 entries:
55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c
69: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar
71: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p
72: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop
79: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32
81: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo
89: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi
$
OK, now the ISA bit is there for a change, but the MIPS16 `st_other'
attribute gone, hmm... What does `objdump' do then:
$ mips-linux-gnu-objdump -Tt foobar-dyn | egrep 'SYMBOL|foo|bar'
foobar-dyn: file format elf32-tradbigmips
SYMBOL TABLE:
00000000 l df *ABS* 00000000 foobar.c
004009cc g F .text 00000004 0xf0 bar
00410b88 g O .data 00000004 foo32p
00410b84 g O .data 00000004 foop
004009c4 g F .text 00000008 foo32
004009c0 g F .text 00000004 0xf0 foo
00410b80 g O .data 00000004 fooi
DYNAMIC SYMBOL TABLE:
004009cc g DF .text 00000004 Base 0xf0 bar
00410b88 g DO .data 00000004 Base foo32p
00410b84 g DO .data 00000004 Base foop
004009c4 g DF .text 00000008 Base foo32
004009c0 g DF .text 00000004 Base 0xf0 foo
00410b80 g DO .data 00000004 Base fooi
$
Hmm, the attribute (0xf0, printed raw) is back, and the ISA bit gone
again.
Let's have a look at some DWARF-2 records GDB uses (I'll be stripping
off a lot here for brevity) -- debug info:
$ mips-linux-gnu-readelf -wi foobar
Contents of the .debug_info section:
[...]
Compilation Unit @ offset 0x88:
Length: 0xbb (32-bit)
Version: 4
Abbrev Offset: 62
Pointer Size: 4
<0><93>: Abbrev Number: 1 (DW_TAG_compile_unit)
<94> DW_AT_producer : (indirect string, offset: 0x19e): GNU C 4.8.0 20120513 (experimental) -meb -mips16 -march=mips32r2 -mhard-float -mllsc -mplt -mno-synci -mno-shared -mabi=32 -g -O2
<98> DW_AT_language : 1 (ANSI C)
<99> DW_AT_name : (indirect string, offset: 0x190): foobar.c
<9d> DW_AT_comp_dir : (indirect string, offset: 0x225): [...]
<a1> DW_AT_ranges : 0x0
<a5> DW_AT_low_pc : 0x0
<a9> DW_AT_stmt_list : 0x27
<1><ad>: Abbrev Number: 2 (DW_TAG_subprogram)
<ae> DW_AT_external : 1
<ae> DW_AT_name : foo
<b2> DW_AT_decl_file : 1
<b3> DW_AT_decl_line : 1
<b4> DW_AT_prototyped : 1
<b4> DW_AT_type : <0xc2>
<b8> DW_AT_low_pc : 0x400680
<bc> DW_AT_high_pc : 0x400684
<c0> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<c2> DW_AT_GNU_all_call_sites: 1
<1><c2>: Abbrev Number: 3 (DW_TAG_base_type)
<c3> DW_AT_byte_size : 4
<c4> DW_AT_encoding : 5 (signed)
<c5> DW_AT_name : int
<1><c9>: Abbrev Number: 4 (DW_TAG_subprogram)
<ca> DW_AT_external : 1
<ca> DW_AT_name : (indirect string, offset: 0x18a): foo32
<ce> DW_AT_decl_file : 1
<cf> DW_AT_decl_line : 11
<d0> DW_AT_prototyped : 1
<d0> DW_AT_type : <0xc2>
<d4> DW_AT_low_pc : 0x400684
<d8> DW_AT_high_pc : 0x40068c
<dc> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<de> DW_AT_GNU_all_call_sites: 1
<1><de>: Abbrev Number: 2 (DW_TAG_subprogram)
<df> DW_AT_external : 1
<df> DW_AT_name : bar
<e3> DW_AT_decl_file : 1
<e4> DW_AT_decl_line : 6
<e5> DW_AT_prototyped : 1
<e5> DW_AT_type : <0xc2>
<e9> DW_AT_low_pc : 0x40068c
<ed> DW_AT_high_pc : 0x400690
<f1> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<f3> DW_AT_GNU_all_call_sites: 1
<1><f3>: Abbrev Number: 5 (DW_TAG_subprogram)
<f4> DW_AT_external : 1
<f4> DW_AT_name : (indirect string, offset: 0x199): main
<f8> DW_AT_decl_file : 1
<f9> DW_AT_decl_line : 21
<fa> DW_AT_prototyped : 1
<fa> DW_AT_type : <0xc2>
<fe> DW_AT_low_pc : 0x400490
<102> DW_AT_high_pc : 0x4004a4
<106> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<108> DW_AT_GNU_all_tail_call_sites: 1
[...]
$
-- no sign of the ISA bit anywhere -- frame info:
$ mips-linux-gnu-readelf -wf foobar
[...]
Contents of the .debug_frame section:
00000000 0000000c ffffffff CIE
Version: 1
Augmentation: ""
Code alignment factor: 1
Data alignment factor: -4
Return address column: 31
DW_CFA_def_cfa_register: r29
DW_CFA_nop
00000010 0000000c 00000000 FDE cie=00000000 pc=00400680..00400684
00000020 0000000c 00000000 FDE cie=00000000 pc=00400684..0040068c
00000030 0000000c 00000000 FDE cie=00000000 pc=0040068c..00400690
00000040 00000018 00000000 FDE cie=00000000 pc=00400490..004004a4
DW_CFA_advance_loc: 6 to 00400496
DW_CFA_def_cfa_offset: 32
DW_CFA_offset: r31 at cfa-4
DW_CFA_advance_loc: 6 to 0040049c
DW_CFA_restore: r31
DW_CFA_def_cfa_offset: 0
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
[...]
$
-- no sign of the ISA bit anywhere -- range info (GDB doesn't use arange):
$ mips-linux-gnu-readelf -wR foobar
Contents of the .debug_ranges section:
Offset Begin End
00000000 00400680 00400690
00000000 00400490 004004a4
00000000 <End of list>
$
-- no sign of the ISA bit anywhere -- line info:
$ mips-linux-gnu-readelf -wl foobar
Raw dump of debug contents of section .debug_line:
[...]
Offset: 0x27
Length: 78
DWARF Version: 2
Prologue Length: 31
Minimum Instruction Length: 1
Initial value of 'is_stmt': 1
Line Base: -5
Line Range: 14
Opcode Base: 13
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 args
Opcode 3 has 1 args
Opcode 4 has 1 args
Opcode 5 has 1 args
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 args
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 args
The Directory Table is empty.
The File Name Table:
Entry Dir Time Size Name
1 0 0 0 foobar.c
Line Number Statements:
Extended opcode 2: set Address to 0x400681
Special opcode 6: advance Address by 0 to 0x400681 and Line by 1 to 2
Special opcode 7: advance Address by 0 to 0x400681 and Line by 2 to 4
Special opcode 55: advance Address by 3 to 0x400684 and Line by 8 to 12
Special opcode 7: advance Address by 0 to 0x400684 and Line by 2 to 14
Advance Line by -7 to 7
Special opcode 131: advance Address by 9 to 0x40068d and Line by 0 to 7
Special opcode 7: advance Address by 0 to 0x40068d and Line by 2 to 9
Advance PC by 3 to 0x400690
Extended opcode 1: End of Sequence
Extended opcode 2: set Address to 0x400491
Advance Line by 21 to 22
Copy
Special opcode 6: advance Address by 0 to 0x400491 and Line by 1 to 23
Special opcode 60: advance Address by 4 to 0x400495 and Line by -1 to 22
Special opcode 34: advance Address by 2 to 0x400497 and Line by 1 to 23
Special opcode 62: advance Address by 4 to 0x40049b and Line by 1 to 24
Special opcode 32: advance Address by 2 to 0x40049d and Line by -1 to 23
Special opcode 6: advance Address by 0 to 0x40049d and Line by 1 to 24
Advance PC by 7 to 0x4004a4
Extended opcode 1: End of Sequence
[...]
-- a-ha, the ISA bit is there! However it's not always right for some
reason, I don't have a small test case to show it, but here's an excerpt
from MIPS16 libc, a prologue of a function:
00019630 <__libc_init_first>:
19630: e8a0 jrc ra
19632: 6500 nop
00019634 <_init>:
19634: f000 6a11 li v0,17
19638: f7d8 0b08 la v1,15e00 <_DYNAMIC+0x15c54>
1963c: f400 3240 sll v0,16
19640: e269 addu v0,v1
19642: 659a move gp,v0
19644: 64f6 save 48,ra,s0-s1
19646: 671c move s0,gp
19648: d204 sw v0,16(sp)
1964a: f352 984c lw v0,-27828(s0)
1964e: 6724 move s1,a0
and the corresponding DWARF-2 line info:
Line Number Statements:
Extended opcode 2: set Address to 0x19631
Advance Line by 44 to 45
Copy
Special opcode 8: advance Address by 0 to 0x19631 and Line by 3 to 48
Special opcode 66: advance Address by 4 to 0x19635 and Line by 5 to 53
Advance PC by constant 17 to 0x19646
Special opcode 25: advance Address by 1 to 0x19647 and Line by 6 to 59
Advance Line by -6 to 53
Special opcode 33: advance Address by 2 to 0x19649 and Line by 0 to 53
Special opcode 39: advance Address by 2 to 0x1964b and Line by 6 to 59
Advance Line by -6 to 53
Special opcode 61: advance Address by 4 to 0x1964f and Line by 0 to 53
-- see that "Advance PC by constant 17" there? It clears the ISA bit,
however code at 0x19646 is not standard MIPS code at all. For some
reason the constant is always 17, I've never seen DW_LNS_const_add_pc
used with any other value -- is that a binutils bug or what?
3. Solution:
I think we should retain the value of the ISA bit in code references,
that is effectively treat them as cookies as they indeed are (although
trivially calculated) rather than raw memory byte addresses.
In a perfect world both the static symbol table and the respective
DWARF-2 records should be fixed to include the ISA bit in all the cases.
I think however that this is infeasible.
All the uses of `_bfd_mips_elf_symbol_processing' can not necessarily be
tracked down. This function is used by `elf_slurp_symbol_table' that in
turn is used by `bfd_canonicalize_symtab' and
`bfd_canonicalize_dynamic_symtab', which are public interfaces.
Similarly DWARF-2 records are used outside GDB, one notable if a bit
questionable is the exception unwinder (libgcc/unwind-dw2.c) -- I have
identified at least bits in `execute_cfa_program' and
`uw_frame_state_for', both around the calls to `_Unwind_IsSignalFrame',
that would need an update as they effectively flip the ISA bit freely;
see also the comment about MASK_RETURN_ADDR in gcc/config/mips/mips.h.
But there may be more places. Any change in how DWARF-2 records are
produced would require an update there and would cause compatibility
problems with libgcc.a binaries already distributed; given that this is
a static library a complex change involving function renames would
likely be required.
I propose therefore to accept the existing inconsistencies and deal with
them entirely within GDB. I have figured out that the ISA bit lost in
various places can still be recovered as long as we have symbol
information -- that'll have the `st_other' attribute correctly set to
one of standard MIPS/MIPS16/microMIPS encoding.
Here's the resulting change. It adds a couple of new `gdbarch' hooks,
one to update symbol information with the ISA bit lost in
`_bfd_mips_elf_symbol_processing', and two other ones to adjust DWARF-2
records as they're processed. The ISA bit is set in each address
handled according to information retrieved from the symbol table for the
symbol spanning the address if any; limits are adjusted based on the
address they point to related to the respective base address.
Additionally minimal symbol information has to be adjusted accordingly
in its gdbarch hook.
With these changes in place some complications with ISA bit juggling in
the PC that never fully worked can be removed from the MIPS backend.
Conversely, the generic dynamic linker event special breakpoint symbol
handler has to be updated to call the minimal symbol gdbarch hook to
record that the symbol is a MIPS16 or microMIPS address if applicable or
the breakpoint will be set at the wrong address and either fail to work
or cause SIGTRAPs (this is because the symbol is handled early on and
bypasses regular symbol processing).
4. Results obtained
The change fixes the example above -- to repeat only the crucial steps:
(gdb) break main
Breakpoint 1 at 0x400491: file foobar.c, line 23.
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) print foo
$1 = {int (void)} 0x400681 <foo>
(gdb) set foop = bar
(gdb) advance bar
bar () at foobar.c:9
9 }
(gdb) disassemble
Dump of assembler code for function bar:
=> 0x0040068d <+0>: jr ra
0x0040068f <+2>: li v0,2
End of assembler dump.
(gdb) finish
Run till exit from #0 bar () at foobar.c:9
main () at foobar.c:24
24 }
Value returned is $2 = 2
(gdb) continue
Continuing.
[Inferior 1 (process 14128) exited with code 02]
(gdb)
-- excellent!
The change removes about 90 failures per MIPS16 multilib in mips-sde-elf
testing too, results for MIPS16 are now similar to that for standard
MIPS; microMIPS results are a bit worse because of host-I/O problems in
QEMU used instead of MIPSsim for microMIPS testing only:
=== gdb Summary ===
# of expected passes 14299
# of unexpected failures 187
# of expected failures 56
# of known failures 58
# of unresolved testcases 11
# of untested testcases 52
# of unsupported tests 174
MIPS16:
=== gdb Summary ===
# of expected passes 14298
# of unexpected failures 187
# of unexpected successes 2
# of expected failures 54
# of known failures 58
# of unresolved testcases 12
# of untested testcases 52
# of unsupported tests 174
microMIPS:
=== gdb Summary ===
# of expected passes 14149
# of unexpected failures 201
# of unexpected successes 2
# of expected failures 54
# of known failures 58
# of unresolved testcases 7
# of untested testcases 53
# of unsupported tests 175
2014-12-12 Maciej W. Rozycki <macro@codesourcery.com>
Maciej W. Rozycki <macro@mips.com>
Pedro Alves <pedro@codesourcery.com>
gdb/
* gdbarch.sh (elf_make_msymbol_special): Change type to `F',
remove `predefault' and `invalid_p' initializers.
(make_symbol_special): New architecture method.
(adjust_dwarf2_addr, adjust_dwarf2_line): Likewise.
(objfile, symbol): New declarations.
* arch-utils.h (default_elf_make_msymbol_special): Remove
prototype.
(default_make_symbol_special): New prototype.
(default_adjust_dwarf2_addr): Likewise.
(default_adjust_dwarf2_line): Likewise.
* mips-tdep.h (mips_unmake_compact_addr): New prototype.
* arch-utils.c (default_elf_make_msymbol_special): Remove
function.
(default_make_symbol_special): New function.
(default_adjust_dwarf2_addr): Likewise.
(default_adjust_dwarf2_line): Likewise.
* dwarf2-frame.c (decode_frame_entry_1): Call
`gdbarch_adjust_dwarf2_addr'.
* dwarf2loc.c (dwarf2_find_location_expression): Likewise.
* dwarf2read.c (create_addrmap_from_index): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(add_partial_symbol): Likewise.
(add_partial_subprogram): Likewise.
(process_full_comp_unit): Likewise.
(read_file_scope): Likewise.
(read_func_scope): Likewise. Call `gdbarch_make_symbol_special'.
(read_lexical_block_scope): Call `gdbarch_adjust_dwarf2_addr'.
(read_call_site_scope): Likewise.
(dwarf2_ranges_read): Likewise.
(dwarf2_record_block_ranges): Likewise.
(read_attribute_value): Likewise.
(dwarf_decode_lines_1): Call `gdbarch_adjust_dwarf2_line'.
(new_symbol_full): Call `gdbarch_adjust_dwarf2_addr'.
* elfread.c (elf_symtab_read): Don't call
`gdbarch_elf_make_msymbol_special' if unset.
* mips-linux-tdep.c (micromips_linux_sigframe_validate): Strip
the ISA bit from the PC.
* mips-tdep.c (mips_unmake_compact_addr): New function.
(mips_elf_make_msymbol_special): Set the ISA bit in the symbol's
address appropriately.
(mips_make_symbol_special): New function.
(mips_pc_is_mips): Set the ISA bit before symbol lookup.
(mips_pc_is_mips16): Likewise.
(mips_pc_is_micromips): Likewise.
(mips_pc_isa): Likewise.
(mips_adjust_dwarf2_addr): New function.
(mips_adjust_dwarf2_line): Likewise.
(mips_read_pc, mips_unwind_pc): Keep the ISA bit.
(mips_addr_bits_remove): Likewise.
(mips_skip_trampoline_code): Likewise.
(mips_write_pc): Don't set the ISA bit.
(mips_eabi_push_dummy_call): Likewise.
(mips_o64_push_dummy_call): Likewise.
(mips_gdbarch_init): Install `mips_make_symbol_special',
`mips_adjust_dwarf2_addr' and `mips_adjust_dwarf2_line' gdbarch
handlers.
* solib.c (gdb_bfd_lookup_symbol_from_symtab): Get
target-specific symbol address adjustments.
* gdbarch.h: Regenerate.
* gdbarch.c: Regenerate.
2014-12-12 Maciej W. Rozycki <macro@codesourcery.com>
gdb/testsuite/
* gdb.base/func-ptrs.c: New file.
* gdb.base/func-ptrs.exp: New file.
2014-12-12 14:31:53 +01:00
|
|
|
gdbarch->make_symbol_special = default_make_symbol_special;
|
|
|
|
gdbarch->adjust_dwarf2_addr = default_adjust_dwarf2_addr;
|
|
|
|
gdbarch->adjust_dwarf2_line = default_adjust_dwarf2_line;
|
2017-04-26 15:05:03 +02:00
|
|
|
gdbarch->execute_dwarf_cfa_vendor_op = default_execute_dwarf_cfa_vendor_op;
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch->register_reggroup_p = default_register_reggroup_p;
|
add a default method for gdbarch_skip_permanent_breakpoint
breakpoint.c uses gdbarch_breakpoint_from_pc to determine whether a
breakpoint location points at a permanent breakpoint:
static int
bp_loc_is_permanent (struct bp_location *loc)
{
...
addr = loc->address;
bpoint = gdbarch_breakpoint_from_pc (loc->gdbarch, &addr, &len);
...
if (target_read_memory (loc->address, target_mem, len) == 0
&& memcmp (target_mem, bpoint, len) == 0)
retval = 1;
...
So I think we should default the gdbarch_skip_permanent_breakpoint
hook to advancing the PC by the length of the breakpoint instruction,
as determined by gdbarch_breakpoint_from_pc. I believe that simple
implementation does the right thing for most architectures. If
there's an oddball architecture where that doesn't work, then it
should override the hook, just like it should be overriding the hook
if there was no default anyway.
The only two implementation of skip_permanent_breakpoint are
i386_skip_permanent_breakpoint, for x86, and
hppa_skip_permanent_breakpoint, for PA-RISC/HP-UX
The x86 implementation is trivial, and can clearly be replaced by the
new default.
I don't know about the HP-UX one though, I know almost nothing about
PA. It may well be advancing the PC ends up being equivalent.
Otherwise, it must be that "jump $pc_after_bp" doesn't work either...
Tested on x86_64 Fedora 20 native and gdbserver.
gdb/
2014-11-12 Pedro Alves <palves@redhat.com>
* arch-utils.c (default_skip_permanent_breakpoint): New function.
* arch-utils.h (default_skip_permanent_breakpoint): New
declaration.
* gdbarch.sh (skip_permanent_breakpoint): Now an 'f' function.
Install default_skip_permanent_breakpoint as default method.
* i386-tdep.c (i386_skip_permanent_breakpoint): Delete function.
(i386_gdbarch_init): Don't install it.
* infrun.c (resume): Assume there's always a
gdbarch_skip_permanent_breakpoint implementation.
* gdbarch.h, gdbarch.c: Regenerate.
2014-11-12 11:10:48 +01:00
|
|
|
gdbarch->skip_permanent_breakpoint = default_skip_permanent_breakpoint;
|
2009-09-29 02:53:04 +02:00
|
|
|
gdbarch->displaced_step_hw_singlestep = default_displaced_step_hw_singlestep;
|
Implement displaced stepping.
gdb/
* gdbarch.sh (max_insn_length): New 'variable'.
(displaced_step_copy, displaced_step_fixup)
(displaced_step_free_closure, displaced_step_location): New
functions.
(struct displaced_step_closure): Add forward declaration.
* gdbarch.c, gdbarch.h: Regenerated.
* arch-utils.c: #include "objfiles.h".
(simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New functions.
* arch-utils.h (simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New prototypes.
* i386-tdep.c (I386_MAX_INSN_LEN): Rename to...
(I386_MAX_MATCHED_INSN_LEN): ... this.
(i386_absolute_jmp_p, i386_absolute_call_p)
(i386_ret_p, i386_call_p, i386_breakpoint_p, i386_syscall_p)
(i386_displaced_step_fixup): New functions.
(struct i386_insn, i386_match_insn): Update.
(i386_gdbarch_init): Set gdbarch_max_insn_length.
* i386-tdep.h (I386_MAX_INSN_LEN): New.
(i386_displaced_step_fixup): New prototype.
* i386-linux-tdep.c (i386_linux_init_abi): Include "arch-utils.h".
Register gdbarch_displaced_step_copy,
gdbarch_displaced_step_fixup, gdbarch_displaced_step_free_closure,
and gdbarch_displaced_step_location functions.
* infrun.c (debug_displaced): New variable.
(show_debug_displaced): New function.
(struct displaced_step_request): New struct.
(displaced_step_request_queue, displaced_step_ptid)
(displaced_step_gdbarch, displaced_step_closure)
(displaced_step_original, displaced_step_copy)
(displaced_step_saved_copy, can_use_displaced_stepping): New
variables.
(show_can_use_displaced_stepping, use_displaced_stepping)
(displaced_step_clear, cleanup_displaced_step_closure)
(displaced_step_dump_bytes, displaced_step_prepare)
(displaced_step_clear_cleanup, write_memory_ptid)
(displaced_step_fixup): New functions.
(resume): Call displaced_step_prepare.
(proceed): Call read_pc once, and remember the value. If using
displaced stepping, don't remove breakpoints.
(handle_inferior_event): Call displaced_step_fixup. Add some
debugging output. When we try to step over a breakpoint, but get
a signal to deliver to the thread instead, ensure the step-resume
breakpoint is actually inserted. If a thread hop is needed, and
displaced stepping is enabled, don't remove breakpoints.
(init_wait_for_inferior): Call displaced_step_clear.
(_initialize_infrun): Add "set debug displaced" command. Add
"maint set can-use-displaced-stepping" command. Clear
displaced_step_ptid.
* inferior.h (debug_displaced): Declare variable.
(displaced_step_dump_bytes): Declare function.
* Makefile.in (arch-utils.o, i386-linux-tdep.o): Update
dependencies.
gdb/testsuite/
* gdb.asm/asmsrc1.s: Add scratch space.
gdb/doc/
* gdb.texinfo (Debugging Output): Document "set/show debug
displaced".
(Maintenance Commands): Document "maint set/show
can-use-displaced-stepping".
2008-05-02 18:49:54 +02:00
|
|
|
gdbarch->displaced_step_fixup = NULL;
|
|
|
|
gdbarch->displaced_step_free_closure = NULL;
|
|
|
|
gdbarch->displaced_step_location = NULL;
|
2010-05-26 20:19:28 +02:00
|
|
|
gdbarch->relocate_instruction = NULL;
|
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
Add base multi-executable/process support to GDB.
gdb/
* Makefile.in (SFILES): Add progspace.c.
(COMMON_OBS): Add progspace.o.
* progspace.h: New.
* progspace.c: New.
* breakpoint.h (struct bp_target_info) <placed_address_space>: New
field.
(struct bp_location) <pspace>: New field.
(struct breakpoint) <pspace>: New field.
(bpstat_stop_status, breakpoint_here_p)
(moribund_breakpoint_here_p, breakpoint_inserted_here_p)
(regular_breakpoint_inserted_here_p)
(software_breakpoint_inserted_here_p, breakpoint_thread_match)
(set_default_breakpoint): Adjust prototypes.
(remove_breakpoints_pid, breakpoint_program_space_exit): Declare.
(insert_single_step_breakpoint, deprecated_insert_raw_breakpoint):
Adjust prototypes.
* breakpoint.c (executing_startup): Delete.
(default_breakpoint_sspace): New.
(breakpoint_restore_shadows): Skip if the address space doesn't
match.
(update_watchpoint): Record the frame's program space in the
breakpoint location.
(insert_bp_location): Record the address space in target_info.
Adjust to pass the symbol space to solib_name_from_address.
(breakpoint_program_space_exit): New.
(insert_breakpoint_locations): Switch the symbol space and thread
when inserting breakpoints. Don't insert breakpoints in a vfork
parent waiting for vfork done if we're not attached to the vfork
child.
(remove_breakpoints_pid): New.
(reattach_breakpoints): Switch to a thread of PID. Ignore
breakpoints of other symbol spaces.
(create_internal_breakpoint): Store the symbol space in the sal.
(create_longjmp_master_breakpoint): Iterate over all symbol
spaces.
(update_breakpoints_after_exec): Ignore breakpoints for other
symbol spaces.
(remove_breakpoint): Rename to ...
(remove_breakpoint_1): ... this. Pass the breakpoints symbol
space to solib_name_from_address.
(remove_breakpoint): New.
(mark_breakpoints_out): Ignore breakpoints from other symbol
spaces.
(breakpoint_init_inferior): Ditto.
(breakpoint_here_p): Add an address space argument and adjust to
use breakpoint_address_match.
(moribund_breakpoint_here_p): Ditto.
(regular_breakpoint_inserted_here_p): Ditto.
(breakpoint_inserted_here_p): Ditto.
(software_breakpoint_inserted_here_p): Ditto.
(breakpoint_thread_match): Ditto.
(bpstat_check_location): Ditto.
(bpstat_stop_status): Ditto.
(print_breakpoint_location): If there's a location to print,
switch the current symbol space.
(print_one_breakpoint_location): Add `allflag' argument.
(print_one_breakpoint): Ditto. Adjust.
(do_captured_breakpoint_query): Adjust.
(breakpoint_1): Adjust.
(breakpoint_has_pc): Also match the symbol space.
(describe_other_breakpoints): Add a symbol space argument and
adjust.
(set_default_breakpoint): Add a symbol space argument. Set
default_breakpoint_sspace.
(breakpoint_address_match): New.
(check_duplicates_for): Add an address space argument, and adjust.
(set_raw_breakpoint): Record the symbol space in the location and
in the breakpoint.
(set_longjmp_breakpoint): Skip longjmp master breakpoints from
other symbol spaces.
(remove_thread_event_breakpoints, remove_solib_event_breakpoints)
(disable_breakpoints_in_shlibs): Skip breakpoints from other
symbol spaces.
(disable_breakpoints_in_unloaded_shlib): Match symbol spaces.
(create_catchpoint): Set the symbol space in the sal.
(disable_breakpoints_before_startup): Skip breakpoints from other
symbol spaces. Set executing_startup in the current symbol space.
(enable_breakpoints_after_startup): Clear executing_startup in the
current symbol space. Skip breakpoints from other symbol spaces.
(clone_momentary_breakpoint): Also copy the symbol space.
(add_location_to_breakpoint): Set the location's symbol space.
(bp_loc_is_permanent): Switch thread and symbol space.
(create_breakpoint): Adjust.
(expand_line_sal_maybe): Expand comment to mention symbol spaces.
Switch thread and symbol space when reading memory.
(parse_breakpoint_sals): Set the symbol space in the sal.
(break_command_really): Ditto.
(skip_prologue_sal): Switch and space.
(resolve_sal_pc): Ditto.
(watch_command_1): Record the symbol space in the sal.
(create_ada_exception_breakpoint): Adjust.
(clear_command): Adjust. Match symbol spaces.
(update_global_location_list): Use breakpoint_address_match.
(breakpoint_re_set_one): Switch thread and space.
(breakpoint_re_set): Save symbol space.
(breakpoint_re_set_thread): Also reset the symbol space.
(deprecated_insert_raw_breakpoint): Add an address space argument.
Adjust.
(insert_single_step_breakpoint): Ditto.
(single_step_breakpoint_inserted_here_p): Ditto.
(clear_syscall_counts): New.
(_initialize_breakpoint): Install it as inferior_exit observer.
* exec.h: Include "progspace.h".
(exec_bfd, exec_bfd_mtime): New defines.
(exec_close): Declare.
* exec.c: Include "gdbthread.h" and "progspace.h".
(exec_bfd, exec_bfd_mtime, current_target_sections_1): Delete.
(using_exec_ops): New.
(exec_close_1): Rename to exec_close, and make public.
(exec_close): Rename to exec_close_1, and adjust all callers. Add
description. Remove target sections and close executables from
all program spaces.
(exec_file_attach): Add comment.
(add_target_sections): Check on `using_exec_ops' to check if the
target should be pushed.
(remove_target_sections): Only unpush the target if there are no
more target sections in any symbol space.
* gdbcore.h: Include "exec.h".
(exec_bfd, exec_bfd_mtime): Remove declarations.
* frame.h (get_frame_program_space, get_frame_address_space)
(frame_unwind_program_space): Declare.
* frame.c (struct frame_info) <pspace, aspace>: New fields.
(create_sentinel_frame): Add program space argument. Set the
pspace and aspace fields of the frame object.
(get_current_frame, create_new_frame): Adjust.
(get_frame_program_space): New.
(frame_unwind_program_space): New.
(get_frame_address_space): New.
* stack.c (print_frame_info): Adjust.
(print_frame): Use the frame's program space.
* gdbthread.h (any_live_thread_of_process): Declare.
* thread.c (any_live_thread_of_process): New.
(switch_to_thread): Switch the program space as well.
(restore_selected_frame): Don't warn if trying to restore frame
level 0.
* inferior.h: Include "progspace.h".
(detach_fork): Declare.
(struct inferior) <removable, aspace, pspace>
<vfork_parent, vfork_child, pending_detach>
<waiting_for_vfork_done>: New fields.
<terminal_info>: Remove field.
<data, num_data>: New fields.
(register_inferior_data, register_inferior_data_with_cleanup)
(clear_inferior_data, set_inferior_data, inferior_data): Declare.
(exit_inferior, exit_inferior_silent, exit_inferior_num_silent)
(inferior_appeared): Declare.
(find_inferior_pid): Typo.
(find_inferior_id, find_inferior_for_program_space): Declare.
(set_current_inferior, save_current_inferior, prune_inferiors)
(number_of_inferiors): Declare.
(inferior_list): Declare.
* inferior.c: Include "gdbcore.h" and "symfile.h".
(inferior_list): Make public.
(delete_inferior_1): Always delete thread silently.
(find_inferior_id): Make public.
(current_inferior_): New.
(current_inferior): Use it.
(set_current_inferior): New.
(restore_inferior): New.
(save_current_inferior): New.
(free_inferior): Free the per-inferior data.
(add_inferior_silent): Allocate per-inferior data.
Call inferior_appeared.
(delete_threads_of_inferior): New.
(delete_inferior_1): Adjust interface to take an inferior pointer.
(delete_inferior): Adjust.
(delete_inferior_silent): Adjust.
(exit_inferior_1): New.
(exit_inferior): New.
(exit_inferior_silent): New.
(exit_inferior_num_silent): New.
(detach_inferior): Adjust.
(inferior_appeared): New.
(discard_all_inferiors): Adjust.
(find_inferior_id): Make public. Assert pid is not zero.
(find_inferior_for_program_space): New.
(have_inferiors): Check if we have any inferior with pid not zero.
(have_live_inferiors): Go over all pushed targets looking for
process_stratum.
(prune_inferiors): New.
(number_of_inferiors): New.
(print_inferior): Add executable column. Print vfork parent/child
relationships.
(inferior_command): Adjust to cope with not running inferiors.
(remove_inferior_command): New.
(add_inferior_command): New.
(clone_inferior_command): New.
(struct inferior_data): New.
(struct inferior_data_registration): New.
(struct inferior_data_registry): New.
(inferior_data_registry): New.
(register_inferior_data_with_cleanup): New.
(register_inferior_data): New.
(inferior_alloc_data): New.
(inferior_free_data): New.
(clear_inferior_data): New.
(set_inferior_data): New.
(inferior_data): New.
(initialize_inferiors): New.
(_initialize_inferiors): Register "add-inferior",
"remove-inferior" and "clone-inferior" commands.
* objfiles.h: Include "progspace.h".
(struct objfile) <pspace>: New field.
(symfile_objfile, object_files): Don't declare.
(ALL_PSPACE_OBJFILES): New.
(ALL_PSPACE_OBJFILES_SAFE): New.
(ALL_OBJFILES, ALL_OBJFILES_SAFE): Adjust.
(ALL_PSPACE_SYMTABS): New.
(ALL_PRIMARY_SYMTABS): Adjust.
(ALL_PSPACE_PRIMARY_SYMTABS): New.
(ALL_PSYMTABS): Adjust.
(ALL_PSPACE_PSYMTABS): New.
* objfiles.c (object_files, symfile_objfile): Delete.
(struct objfile_sspace_info): New.
(objfiles_pspace_data): New.
(objfiles_pspace_data_cleanup): New.
(get_objfile_pspace_data): New.
(objfiles_changed_p): Delete.
(allocate_objfile): Set the objfile's program space. Adjust to
reference objfiles_changed_p in pspace data.
(free_objfile): Adjust to reference objfiles_changed_p in pspace
data.
(objfile_relocate): Ditto.
(update_section_map): Add pspace argument. Adjust to iterate over
objfiles in the passed in pspace.
(find_pc_section): Delete sections and num_sections statics.
Adjust to refer to program space's objfiles_changed_p. Adjust to
refer to sections and num_sections store in the objfile's pspace
data.
(objfiles_changed): Adjust to reference objfiles_changed_p in
pspace data.
(_initialize_objfiles): New.
* linespec.c (decode_all_digits, decode_dollar): Set the sal's
program space.
* source.c (current_source_pspace): New.
(get_current_source_symtab_and_line): Set the sal's program space.
(set_current_source_symtab_and_line): Set current_source_pspace.
(select_source_symtab): Ditto. Use ALL_OBJFILES.
(forget_cached_source_info): Iterate over all program spaces.
* symfile.c (clear_symtab_users): Adjust.
* symmisc.c (print_symbol_bcache_statistics): Iterate over all
program spaces.
(print_objfile_statistics): Ditto.
(maintenance_print_msymbols): Ditto.
(maintenance_print_objfiles): Ditto.
(maintenance_info_symtabs): Ditto.
(maintenance_info_psymtabs): Ditto.
* symtab.h (SYMTAB_PSPACE): New.
(struct symtab_and_line) <pspace>: New field.
* symtab.c (init_sal): Clear the sal's program space.
(find_pc_sect_symtab): Set the sal's program space. Switch thread
and space.
(append_expanded_sal): Add program space argument. Iterate over
all program spaces.
(expand_line_sal): Iterate over all program spaces. Switch
program space.
* target.h (enum target_waitkind) <TARGET_WAITKIND_VFORK_DONE>: New.
(struct target_ops) <to_thread_address_space>: New field.
(target_thread_address_space): Define.
* target.c (target_detach): Only remove breakpoints from the
inferior we're detaching.
(target_thread_address_space): New.
* defs.h (initialize_progspace): Declare.
* top.c (gdb_init): Call it.
* solist.h (struct so_list) <sspace>: New field.
* solib.h (struct program_space): Forward declare.
(solib_name_from_address): Adjust prototype.
* solib.c (so_list_head): Replace with a macro referencing the
program space.
(update_solib_list): Set the so's program space.
(solib_name_from_address): Add a program space argument and adjust.
* solib-svr4.c (struct svr4_info) <pid>: Delete field.
<interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low>
<interp_plt_sect_high>: New fields.
(svr4_info_p, svr4_info): Delete.
(solib_svr4_sspace_data): New.
(get_svr4_info): Rewrite.
(svr4_sspace_data_cleanup): New.
(open_symbol_file_object): Adjust.
(svr4_default_sos): Adjust.
(svr4_fetch_objfile_link_map): Adjust.
(interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low)
(interp_plt_sect_high): Delete.
(svr4_in_dynsym_resolve_code): Adjust.
(enable_break): Adjust.
(svr4_clear_solib): Revert bit that removed the svr4_info here,
and reinstate clearing debug_base, debug_loader_offset_p,
debug_loader_offset and debug_loader_name.
(_initialize_svr4_solib): Register solib_svr4_pspace_data. Don't
install an inferior_exit observer anymore.
* printcmd.c (struct display) <pspace>: New field.
(display_command): Set the display's sspace.
(do_one_display): Match the display's sspace.
(display_uses_solib_p): Ditto.
* linux-fork.c (detach_fork): Moved to infrun.c.
(_initialize_linux_fork): Moved "detach-on-fork" command to
infrun.c.
* infrun.c (detach_fork): Moved from linux-fork.c.
(proceed_after_vfork_done): New.
(handle_vfork_child_exec_or_exit): New.
(follow_exec_mode_replace, follow_exec_mode_keep)
(follow_exec_mode_names, follow_exec_mode_string)
(show_follow_exec_mode_string): New.
(follow_exec): New. Reinstate the mark_breakpoints_out call.
Remove shared libraries before attaching new executable. If user
wants to keep the inferior, keep it.
(displaced_step_fixup): Adjust to pass an address space to the
breakpoints module.
(resume): Ditto.
(clear_proceed_status): In all-stop mode, always clear the proceed
status of all threads.
(prepare_to_proceed): Adjust to pass an address space to the
breakpoints module.
(proceed): Ditto.
(adjust_pc_after_break): Ditto.
(handle_inferior_event): When handling a process exit, switch the
program space to the inferior's that had exited. Call
handle_vfork_child_exec_or_exit. Adjust to pass an address space
to the breakpoints module. In non-stop mode, when following a
fork and detach-fork is off, also resume the other branch. Handle
TARGET_WAITKIND_VFORK_DONE. Set the program space in sals.
(normal_stop): Prune inferiors.
(_initialize_infrun): Install the new "follow-exec-mode" command.
"detach-on-fork" moved here.
* regcache.h (get_regcache_aspace): Declare.
* regcache.c (struct regcache) <aspace>: New field.
(regcache_xmalloc): Clear the aspace.
(get_regcache_aspace): New.
(regcache_cpy): Copy the aspace field.
(regcache_cpy_no_passthrough): Ditto.
(get_thread_regcache): Fetch the thread's address space from the
target, and store it in the regcache.
* infcall.c (call_function_by_hand): Set the sal's pspace.
* arch-utils.c (default_has_shared_address_space): New.
* arch-utils.h (default_has_shared_address_space): Declare.
* gdbarch.sh (has_shared_address_space): New.
* gdbarch.h, gdbarch.c: Regenerate.
* linux-tdep.c: Include auxv.h, target.h, elf/common.h.
(linux_has_shared_address_space): New.
(_initialize_linux_tdep): Declare.
* arm-tdep.c (arm_software_single_step): Pass the frame's address
space to insert_single_step_breakpoint.
* arm-linux-tdep.c (arm_linux_software_single_step): Pass the
frame's pspace to breakpoint functions.
* cris-tdep.c (crisv32_single_step_through_delay): Ditto.
(cris_software_single_step): Ditto.
* mips-tdep.c (deal_with_atomic_sequence): Add frame argument.
Pass the frame's pspace to breakpoint functions.
(mips_software_single_step): Adjust.
(mips_single_step_through_delay): Adjust.
* rs6000-aix-tdep.c (rs6000_software_single_step): Adjust.
* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust.
* solib-irix.c (enable_break): Adjust to pass the current frame's
address space to breakpoint functions.
* sparc-tdep.c (sparc_software_single_step): Ditto.
* spu-tdep.c (spu_software_single_step): Ditto.
* alpha-tdep.c (alpha_software_single_step): Ditto.
* record.c (record_wait): Adjust to pass an address space to the
breakpoints module.
* fork-child.c (fork_inferior): Set the new inferior's program and
address spaces.
* inf-ptrace.c (inf_ptrace_follow_fork): Copy the parent's program
and address spaces.
(inf_ptrace_attach): Set the inferior's program and address spaces.
* linux-nat.c: Include "solib.h".
(linux_child_follow_fork): Manage parent and child's program and
address spaces. Clone the parent's program space if necessary.
Don't wait for the vfork to be done here. Refuse to resume if
following the vfork parent while leaving the child stopped.
(resume_callback): Don't resume a vfork parent.
(linux_nat_resume): Also check for pending events in the
lp->waitstatus field.
(linux_handle_extended_wait): Report TARGET_WAITKIND_VFORK_DONE
events to the core.
(stop_wait_callback): Don't wait for SIGSTOP on vfork parents.
(cancel_breakpoint): Adjust.
* linux-thread-db.c (thread_db_wait): Don't remove thread event
breakpoints here.
(thread_db_mourn_inferior): Don't mark breakpoints out here.
Remove thread event breakpoints after mourning.
* corelow.c: Include progspace.h.
(core_open): Set the inferior's program and address spaces.
* remote.c (remote_add_inferior): Set the new inferior's program
and address spaces.
(remote_start_remote): Update address spaces.
(extended_remote_create_inferior_1): Don't init the thread list if
we already debugging other inferiors.
* darwin-nat.c (darwin_attach): Set the new inferior's program and
address spaces.
* gnu-nat.c (gnu_attach): Ditto.
* go32-nat.c (go32_create_inferior): Ditto.
* inf-ttrace.c (inf_ttrace_follow_fork, inf_ttrace_attach): Ditto.
* monitor.c (monitor_open): Ditto.
* nto-procfs.c (procfs_attach, procfs_create_inferior): Ditto.
* procfs.c (do_attach): Ditto.
* windows-nat.c (do_initial_windows_stuff): Ditto.
* inflow.c (inferior_process_group)
(terminal_init_inferior_with_pgrp, terminal_inferior,
(terminal_ours_1, inflow_inferior_exit, copy_terminal_info)
(child_terminal_info, new_tty_postfork, set_sigint_trap): Adjust
to use per-inferior data instead of inferior->terminal_info.
(inflow_inferior_data): New.
(inflow_new_inferior): Delete.
(inflow_inferior_data_cleanup): New.
(get_inflow_inferior_data): New.
* mi/mi-interp.c (mi_new_inferior): Rename to...
(mi_inferior_appeared): ... this.
(mi_interpreter_init): Adjust.
* tui/tui-disasm.c: Include "progspace.h".
(tui_set_disassem_content): Pass an address space to
breakpoint_here_p.
* NEWS: Mention multi-program debugging support. Mention new
commands "add-inferior", "clone-inferior", "remove-inferior",
"maint info program-spaces", and new option "set
follow-exec-mode".
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/doc/
* observer.texi (new_inferior): Rename to...
(inferior_appeared): ... this.
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/testsuite/
* gdb.base/foll-vfork.exp: Adjust to spell out "follow-fork".
* gdb.base/foll-exec.exp: Adjust to expect a process id before
"Executing new program".
* gdb.base/foll-fork.exp: Adjust to spell out "follow-fork".
* gdb.base/multi-forks.exp: Ditto. Adjust to the inferior being
left listed after having been killed.
* gdb.base/attach.exp: Adjust to spell out "symbol-file".
* gdb.base/maint.exp: Adjust test.
* Makefile.in (ALL_SUBDIRS): Add gdb.multi.
* gdb.multi/Makefile.in: New.
* gdb.multi/base.exp: New.
* gdb.multi/goodbye.c: New.
* gdb.multi/hangout.c: New.
* gdb.multi/hello.c: New.
* gdb.multi/bkpt-multi-exec.c: New.
* gdb.multi/bkpt-multi-exec.exp: New.
* gdb.multi/crashme.c: New.
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/doc/
* gdb.texinfo (Inferiors): Rename node to ...
(Inferiors and Programs): ... this. Mention running multiple
programs in the same debug session.
<info inferiors>: Mention the new 'Executable' column if "info
inferiors". Update examples. Document the "add-inferior",
"clone-inferior", "remove-inferior" and "maint info
program-spaces" commands.
(Process): Rename node to...
(Forks): ... this. Document "set|show follow-exec-mode".
2009-10-19 11:51:43 +02:00
|
|
|
gdbarch->has_shared_address_space = default_has_shared_address_space;
|
2010-01-06 05:20:27 +01:00
|
|
|
gdbarch->fast_tracepoint_valid_at = default_fast_tracepoint_valid_at;
|
2016-02-18 09:21:38 +01:00
|
|
|
gdbarch->guess_tracepoint_registers = default_guess_tracepoint_registers;
|
2010-03-05 21:18:19 +01:00
|
|
|
gdbarch->auto_charset = default_auto_charset;
|
|
|
|
gdbarch->auto_wide_charset = default_auto_wide_charset;
|
2011-09-27 15:09:37 +02:00
|
|
|
gdbarch->gen_return_address = default_gen_return_address;
|
2012-06-05 15:50:50 +02:00
|
|
|
gdbarch->iterate_over_objfiles_in_search_order = default_iterate_over_objfiles_in_search_order;
|
2012-12-15 15:27:56 +01:00
|
|
|
gdbarch->ravenscar_ops = NULL;
|
gdbarch: add instruction predicate methods
Add new methods to gdbarch for analyzing the instruction at a given address.
Implement those methods for i386 and amd64 architectures.
This is needed by "record btrace" to detect function calls in the
execution trace.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* amd64-tdep.c (amd64_classify_insn_at, amd64_insn_is_call)
(amd64_insn_is_ret, amd64_insn_is_jump, amd64_jmp_p): New.
(amd64_init_abi): Add insn_is_call, insn_is_ret, and insn_is_jump
to gdbarch.
* i386-tdep.c (i386_insn_is_call, i386_insn_is_ret)
(i386_insn_is_jump, i386_jmp_p): New.
(i386_gdbarch_init): Add insn_is_call, insn_is_ret, and
insn_is_jump to gdbarch.
* gdbarch.sh (insn_is_call, insn_is_ret, insn_is_jump): New.
* gdbarch.h: Regenerated.
* gdbarch.c: Regenerated.
* arch-utils.h (default_insn_is_call, default_insn_is_ret)
(default_insn_is_jump): New.
* arch-utils.c (default_insn_is_call, default_insn_is_ret)
(default_insn_is_jump): New.
2013-03-22 15:56:56 +01:00
|
|
|
gdbarch->insn_is_call = default_insn_is_call;
|
|
|
|
gdbarch->insn_is_ret = default_insn_is_ret;
|
|
|
|
gdbarch->insn_is_jump = default_insn_is_jump;
|
2016-06-12 00:51:38 +02:00
|
|
|
gdbarch->print_auxv_entry = default_print_auxv_entry;
|
2014-10-10 16:57:13 +02:00
|
|
|
gdbarch->vsyscall_range = default_vsyscall_range;
|
2014-05-14 22:08:57 +02:00
|
|
|
gdbarch->infcall_mmap = default_infcall_mmap;
|
2015-06-03 21:22:56 +02:00
|
|
|
gdbarch->infcall_munmap = default_infcall_munmap;
|
2014-05-14 22:08:57 +02:00
|
|
|
gdbarch->gcc_target_options = default_gcc_target_options;
|
add gnu_triplet_regexp gdbarch method
gdb has to inform libcc1.so of the target being used, so that the
correct compiler can be invoked. The compiler is invoked using the
GNU configury triplet prefix, e.g., "x86_64-unknown-linux-gnu-gcc".
In order for this to work we need to map the gdbarch to the GNU
configury triplet arch. In most cases these are identical; however,
the x86 family poses some problems, as the BFD arch names are quite
different from the GNU triplet names. So, we introduce a new gdbarch
method for this. A regular expression is used because there are
various valid values for the arch prefix in the triplet.
This patch also updates the osabi code to associate a regular
expression with the OS ABI. I have only added a concrete value for
Linux. Note that the "-gnu" part is optional, at least on Fedora it
is omitted from the installed GCC executable's name.
gdb/ChangeLog
2014-12-12 Tom Tromey <tromey@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* osabi.h (osabi_triplet_regexp): Declare.
* osabi.c (struct osabi_names): New.
(gdb_osabi_names): Change type to struct osabi_names. Update
values.
(gdbarch_osabi_name): Update.
(osabi_triplet_regexp): New function.
(osabi_from_tdesc_string, _initialize_gdb_osabi): Update.
* i386-tdep.c (i386_gnu_triplet_regexp): New method.
(i386_elf_init_abi, i386_go32_init_abi, i386_gdbarch_init): Call
set_gdbarch_gnu_triplet_regexp.
* gdbarch.sh (gnu_triplet_regexp): New method.
* gdbarch.c, gdbarch.h: Rebuild.
* arch-utils.h (default_gnu_triplet_regexp): Declare.
* arch-utils.c (default_gnu_triplet_regexp): New function.
2014-06-13 17:28:24 +02:00
|
|
|
gdbarch->gnu_triplet_regexp = default_gnu_triplet_regexp;
|
2015-06-12 22:51:51 +02:00
|
|
|
gdbarch->addressable_memory_unit_size = default_addressable_memory_unit_size;
|
1999-06-14 20:08:47 +02:00
|
|
|
/* gdbarch_alloc() */
|
|
|
|
|
2007-11-12 07:47:56 +01:00
|
|
|
return gdbarch;
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-07-22 21:49:58 +02:00
|
|
|
/* Allocate extra space using the per-architecture obstack. */
|
|
|
|
|
|
|
|
void *
|
|
|
|
gdbarch_obstack_zalloc (struct gdbarch *arch, long size)
|
|
|
|
{
|
|
|
|
void *data = obstack_alloc (arch->obstack, size);
|
2010-05-13 23:56:58 +02:00
|
|
|
|
2003-07-22 21:49:58 +02:00
|
|
|
memset (data, 0, size);
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
2015-08-30 00:07:50 +02:00
|
|
|
/* See gdbarch.h. */
|
|
|
|
|
|
|
|
char *
|
|
|
|
gdbarch_obstack_strdup (struct gdbarch *arch, const char *string)
|
|
|
|
{
|
|
|
|
return obstack_strdup (arch->obstack, string);
|
|
|
|
}
|
|
|
|
|
2003-07-22 21:49:58 +02:00
|
|
|
|
2000-03-21 21:40:43 +01:00
|
|
|
/* Free a gdbarch struct. This should never happen in normal
|
|
|
|
operation --- once you've created a gdbarch, you keep it around.
|
|
|
|
However, if an architecture's init function encounters an error
|
|
|
|
building the structure, it may need to clean up a partially
|
|
|
|
constructed gdbarch. */
|
2000-06-10 07:37:47 +02:00
|
|
|
|
2000-03-21 21:40:43 +01:00
|
|
|
void
|
|
|
|
gdbarch_free (struct gdbarch *arch)
|
|
|
|
{
|
2003-07-22 21:49:58 +02:00
|
|
|
struct obstack *obstack;
|
2010-05-13 23:56:58 +02:00
|
|
|
|
2001-02-07 03:17:48 +01:00
|
|
|
gdb_assert (arch != NULL);
|
2003-07-22 21:49:58 +02:00
|
|
|
gdb_assert (!arch->initialized_p);
|
|
|
|
obstack = arch->obstack;
|
|
|
|
obstack_free (obstack, 0); /* Includes the ARCH. */
|
|
|
|
xfree (obstack);
|
2000-03-21 21:40:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-11-10 02:10:55 +01:00
|
|
|
/* Ensure that all values in a GDBARCH are reasonable. */
|
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
static void
|
2007-11-12 07:47:56 +01:00
|
|
|
verify_gdbarch (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy
This patch starts from the desire to eliminate
make_cleanup_ui_file_delete, but then goes beyond. It makes ui_file &
friends a real C++ class hierarchy, and switches temporary
ui_file-like objects to stack-based allocation.
- mem_fileopen -> string_file
mem_fileopen is replaced with a new string_file class that is treated
as a value class created on the stack. This alone eliminates most
make_cleanup_ui_file_delete calls, and, simplifies code a whole lot
(diffstat shows around 1k loc dropped.)
string_file's internal buffer is a std::string, thus the "string" in
the name. This simplifies the implementation much, compared to
mem_fileopen, which managed growing its internal buffer manually.
- ui_file_as_string, ui_file_strdup, ui_file_obsavestring all gone
The new string_file class has a string() method that provides direct
writable access to the internal std::string buffer. This replaced
ui_file_as_string, which forced a copy of the same data the stream had
inside. With direct access via a writable reference, we can instead
move the string out of the string_stream, avoiding deep string
copying.
Related, ui_file_xstrdup calls are replaced with xstrdup'ping the
stream's string, and ui_file_obsavestring is replaced by
obstack_copy0.
With all those out of the way, getting rid of the weird ui_file_put
mechanism was possible.
- New ui_file::printf, ui_file::puts, etc. methods
These simplify / clarify client code. I considered splitting
client-code changes, like these, e.g.:
- stb = mem_fileopen ();
- fprintf_unfiltered (stb, "%s%s%s",
- _("The valid values are:\n"),
- regdesc,
- _("The default is \"std\"."));
+ string_file stb;
+ stb.printf ("%s%s%s",
+ _("The valid values are:\n"),
+ regdesc,
+ _("The default is \"std\"."));
In two steps, with the first step leaving fprintf_unfiltered (etc.)
calls in place, and only afterwards do a pass to change all those to
call stb.printf etc.. I didn't do that split, because (when I tried),
it turned out to be pointless make-work: the first pass would have to
touch the fprintf_unfiltered line anyway, to replace "stb" with
"&stb".
- gdb_fopen replaced with stack-based objects
This avoids the need for cleanups or unique_ptr's. I.e., this:
struct ui_file *file = gdb_fopen (filename, "w");
if (filename == NULL)
perror_with_name (filename);
cleanups = make_cleanup_ui_file_delete (file);
// use file.
do_cleanups (cleanups);
is replaced with this:
stdio_file file;
if (!file.open (filename, "w"))
perror_with_name (filename);
// use file.
- odd contorsions in null_file_write / null_file_fputs around when to
call to_fputs / to_write eliminated.
- Global null_stream object
A few places that were allocating a ui_file in order to print to
"nowhere" are adjusted to instead refer to a new 'null_stream' global
stream.
- TUI's tui_sfileopen eliminated. TUI's ui_file much simplified
The TUI's ui_file was serving a dual purpose. It supported being used
as string buffer, and supported being backed by a stdio FILE. The
string buffer part is gone, replaced by using of string_file. The
'FILE *' support is now much simplified, by making the TUI's ui_file
inherit from stdio_file.
gdb/ChangeLog:
2017-02-02 Pedro Alves <palves@redhat.com>
* ada-lang.c (type_as_string): Use string_file.
* ada-valprint.c (ada_print_floating): Use string_file.
* ada-varobj.c (ada_varobj_scalar_image)
(ada_varobj_get_value_image): Use string_file.
* aix-thread.c (aix_thread_extra_thread_info): Use string_file.
* arm-tdep.c (_initialize_arm_tdep): Use string_printf.
* breakpoint.c (update_inserted_breakpoint_locations)
(insert_breakpoint_locations, reattach_breakpoints)
(print_breakpoint_location, print_one_detail_ranged_breakpoint)
(print_it_watchpoint): Use string_file.
(save_breakpoints): Use stdio_file.
* c-exp.y (oper): Use string_file.
* cli/cli-logging.c (set_logging_redirect): Use ui_file_up and
tee_file.
(pop_output_files): Use delete.
(handle_redirections): Use stdio_file and tee_file.
* cli/cli-setshow.c (do_show_command): Use string_file.
* compile/compile-c-support.c (c_compute_program): Use
string_file.
* compile/compile-c-symbols.c (generate_vla_size): Take a
'string_file &' instead of a 'ui_file *'.
(generate_c_for_for_one_variable): Take a 'string_file &' instead
of a 'ui_file *'. Use string_file.
(generate_c_for_variable_locations): Take a 'string_file &'
instead of a 'ui_file *'.
* compile/compile-internal.h (generate_c_for_for_one_variable):
Take a 'string_file &' instead of a 'ui_file *'.
* compile/compile-loc2c.c (push, pushf, unary, binary)
(print_label, pushf_register_address, pushf_register)
(do_compile_dwarf_expr_to_c): Take a 'string_file &' instead of a
'ui_file *'. Adjust.
* compile/compile.c (compile_to_object): Use string_file.
* compile/compile.h (compile_dwarf_expr_to_c)
(compile_dwarf_bounds_to_c): Take a 'string_file &' instead of a
'ui_file *'.
* cp-support.c (inspect_type): Use string_file and obstack_copy0.
(replace_typedefs_qualified_name): Use string_file and
obstack_copy0.
* disasm.c (gdb_pretty_print_insn): Use string_file.
(gdb_disassembly): Adjust reference the null_stream global.
(do_ui_file_delete): Delete.
(gdb_insn_length): Use null_stream.
* dummy-frame.c (maintenance_print_dummy_frames): Use stdio_file.
* dwarf2loc.c (dwarf2_compile_property_to_c)
(locexpr_generate_c_location, loclist_generate_c_location): Take a
'string_file &' instead of a 'ui_file *'.
* dwarf2loc.h (dwarf2_compile_property_to_c): Likewise.
* dwarf2read.c (do_ui_file_peek_last): Delete.
(dwarf2_compute_name): Use string_file.
* event-top.c (gdb_setup_readline): Use stdio_file.
* gdbarch.sh (verify_gdbarch): Use string_file.
* gdbtypes.c (safe_parse_type): Use null_stream.
* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use
string_file.
* guile/scm-disasm.c (gdbscm_print_insn_from_port): Take a
'string_file *' instead of a 'ui_file *'.
(gdbscm_arch_disassemble): Use string_file.
* guile/scm-frame.c (frscm_print_frame_smob): Use string_file.
* guile/scm-ports.c (class ioscm_file_port): Now a class that
inherits from ui_file.
(ioscm_file_port_delete, ioscm_file_port_rewind)
(ioscm_file_port_put): Delete.
(ioscm_file_port_write): Rename to ...
(ioscm_file_port::write): ... this. Remove file_port_magic
checks.
(ioscm_file_port_new): Delete.
(ioscm_with_output_to_port_worker): Use ioscm_file_port and
ui_file_up.
* guile/scm-type.c (tyscm_type_name): Use string_file.
* guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print):
Use string_file.
* infcmd.c (print_return_value_1): Use string_file.
* infrun.c (print_target_wait_results): Use string_file.
* language.c (add_language): Use string_file.
* location.c (explicit_to_string_internal): Use string_file.
* main.c (captured_main_1): Use null_file.
* maint.c (maintenance_print_architecture): Use stdio_file.
* mi/mi-cmd-stack.c (list_arg_or_local): Use string_file.
* mi/mi-common.h (struct mi_interp) <out, err, log, targ,
event_channel>: Change type to mi_console_file pointer.
* mi/mi-console.c (mi_console_file_fputs, mi_console_file_flush)
(mi_console_file_delete): Delete.
(struct mi_console_file): Delete.
(mi_console_file_magic): Delete.
(mi_console_file_new): Delete.
(mi_console_file::mi_console_file): New.
(mi_console_file_delete): Delete.
(mi_console_file_fputs): Delete.
(mi_console_file::write): New.
(mi_console_raw_packet): Delete.
(mi_console_file::flush): New.
(mi_console_file_flush): Delete.
(mi_console_set_raw): Rename to ...
(mi_console_file::set_raw): ... this.
* mi/mi-console.h (class mi_console_file): New class.
(mi_console_file_new, mi_console_set_raw): Delete.
* mi/mi-interp.c (mi_interpreter_init): Use mi_console_file.
(mi_set_logging): Use delete and tee_file. Adjust.
* mi/mi-main.c (output_register): Use string_file.
(mi_cmd_data_evaluate_expression): Use string_file.
(mi_cmd_data_read_memory): Use string_file.
(mi_cmd_execute, print_variable_or_computed): Use string_file.
* mi/mi-out.c (mi_ui_out::main_stream): New.
(mi_ui_out::rewind): Use main_stream and
string_file.
(mi_ui_out::put): Use main_stream and string_file.
(mi_ui_out::mi_ui_out): Remove 'stream' parameter.
Allocate a 'string_file' instead.
(mi_out_new): Don't allocate a mem_fileopen stream here.
* mi/mi-out.h (mi_ui_out::mi_ui_out): Remove 'stream' parameter.
(mi_ui_out::main_stream): Declare method.
* printcmd.c (eval_command): Use string_file.
* psymtab.c (maintenance_print_psymbols): Use stdio_file.
* python/py-arch.c (archpy_disassemble): Use string_file.
* python/py-breakpoint.c (bppy_get_commands): Use string_file.
* python/py-frame.c (frapy_str): Use string_file.
* python/py-framefilter.c (py_print_type, py_print_single_arg):
Use string_file.
* python/py-type.c (typy_str): Use string_file.
* python/py-unwind.c (unwind_infopy_str): Use string_file.
* python/py-value.c (valpy_str): Use string_file.
* record-btrace.c (btrace_insn_history): Use string_file.
* regcache.c (regcache_print): Use stdio_file.
* reggroups.c (maintenance_print_reggroups): Use stdio_file.
* remote.c (escape_buffer): Use string_file.
* rust-lang.c (rust_get_disr_info): Use string_file.
* serial.c (serial_open_ops_1): Use stdio_file.
(do_serial_close): Use delete.
* stack.c (print_frame_arg): Use string_file.
(print_frame_args): Remove local mem_fileopen stream, not used.
(print_frame): Use string_file.
* symmisc.c (maintenance_print_symbols): Use stdio_file.
* symtab.h (struct symbol_computed_ops) <generate_c_location>:
Take a 'string_file *' instead of a 'ui_file *'.
* top.c (new_ui): Use stdio_file and stderr_file.
(free_ui): Use delete.
(execute_command_to_string): Use string_file.
(quit_confirm): Use string_file.
* tracepoint.c (collection_list::append_exp): Use string_file.
* tui/tui-disasm.c (tui_disassemble): Use string_file.
* tui/tui-file.c: Don't include "ui-file.h".
(enum streamtype, struct tui_stream): Delete.
(tui_file_new, tui_file_delete, tui_fileopen, tui_sfileopen)
(tui_file_isatty, tui_file_rewind, tui_file_put): Delete.
(tui_file::tui_file): New method.
(tui_file_fputs): Delete.
(tui_file_get_strbuf): Delete.
(tui_file::puts): New method.
(tui_file_adjust_strbuf): Delete.
(tui_file_flush): Delete.
(tui_file::flush): New method.
* tui/tui-file.h: Tweak intro comment.
Include ui-file.h.
(tui_fileopen, tui_sfileopen, tui_file_get_strbuf)
(tui_file_adjust_strbuf): Delete declarations.
(class tui_file): New class.
* tui/tui-io.c (tui_initialize_io): Use tui_file.
* tui/tui-regs.c (tui_restore_gdbout): Use delete.
(tui_register_format): Use string_stream.
* tui/tui-stack.c (tui_make_status_line): Use string_file.
(tui_get_function_from_frame): Use string_file.
* typeprint.c (type_to_string): Use string_file.
* ui-file.c (struct ui_file, ui_file_magic, ui_file_new): Delete.
(null_stream): New global.
(ui_file_delete): Delete.
(ui_file::ui_file): New.
(null_file_isatty): Delete.
(ui_file::~ui_file): New.
(null_file_rewind): Delete.
(ui_file::printf): New.
(null_file_put): Delete.
(null_file_flush): Delete.
(ui_file::putstr): New.
(null_file_write): Delete.
(ui_file::putstrn): New.
(null_file_read): Delete.
(ui_file::putc): New.
(null_file_fputs): Delete.
(null_file_write_async_safe): Delete.
(ui_file::vprintf): New.
(null_file_delete): Delete.
(null_file::write): New.
(null_file_fseek): Delete.
(null_file::puts): New.
(ui_file_data): Delete.
(null_file::write_async_safe): New.
(gdb_flush, ui_file_isatty): Adjust.
(ui_file_put, ui_file_rewind): Delete.
(ui_file_write): Adjust.
(ui_file_write_for_put): Delete.
(ui_file_write_async_safe, ui_file_read): Adjust.
(ui_file_fseek): Delete.
(fputs_unfiltered): Adjust.
(set_ui_file_flush, set_ui_file_isatty, set_ui_file_rewind)
(set_ui_file_put, set_ui_file_write, set_ui_file_write_async_safe)
(set_ui_file_read, set_ui_file_fputs, set_ui_file_fseek)
(set_ui_file_data): Delete.
(string_file::~string_file, string_file::write)
(struct accumulated_ui_file, do_ui_file_xstrdup, ui_file_xstrdup)
(do_ui_file_as_string, ui_file_as_string): Delete.
(do_ui_file_obsavestring, ui_file_obsavestring): Delete.
(struct mem_file): Delete.
(mem_file_new): Delete.
(stdio_file::stdio_file): New.
(mem_file_delete): Delete.
(stdio_file::stdio_file): New.
(mem_fileopen): Delete.
(stdio_file::~stdio_file): New.
(mem_file_rewind): Delete.
(stdio_file::set_stream): New.
(mem_file_put): Delete.
(stdio_file::open): New.
(mem_file_write): Delete.
(stdio_file_magic, struct stdio_file): Delete.
(stdio_file_new, stdio_file_delete, stdio_file_flush): Delete.
(stdio_file::flush): New.
(stdio_file_read): Rename to ...
(stdio_file::read): ... this. Adjust.
(stdio_file_write): Rename to ...
(stdio_file::write): ... this. Adjust.
(stdio_file_write_async_safe): Rename to ...
(stdio_file::write_async_safe) ... this. Adjust.
(stdio_file_fputs): Rename to ...
(stdio_file::puts) ... this. Adjust.
(stdio_file_isatty): Delete.
(stdio_file_fseek): Delete.
(stdio_file::isatty): New.
(stderr_file_write): Rename to ...
(stderr_file::write) ... this. Adjust.
(stderr_file_fputs): Rename to ...
(stderr_file::puts) ... this. Adjust.
(stderr_fileopen, stdio_fileopen, gdb_fopen): Delete.
(stderr_file::stderr_file): New.
(tee_file_magic): Delete.
(struct tee_file): Delete.
(tee_file::tee_file): New.
(tee_file_new): Delete.
(tee_file::~tee_file): New.
(tee_file_delete): Delete.
(tee_file_flush): Rename to ...
(tee_file::flush): ... this. Adjust.
(tee_file_write): Rename to ...
(tee_file::write): ... this. Adjust.
(tee_file::write_async_safe): New.
(tee_file_fputs): Rename to ...
(tee_file::puts): ... this. Adjust.
(tee_file_isatty): Rename to ...
(tee_file::isatty): ... this. Adjust.
* ui-file.h (struct obstack, struct ui_file): Don't
forward-declare.
(ui_file_new, ui_file_flush_ftype, set_ui_file_flush)
(ui_file_write_ftype)
(set_ui_file_write, ui_file_fputs_ftype, set_ui_file_fputs)
(ui_file_write_async_safe_ftype, set_ui_file_write_async_safe)
(ui_file_read_ftype, set_ui_file_read, ui_file_isatty_ftype)
(set_ui_file_isatty, ui_file_rewind_ftype, set_ui_file_rewind)
(ui_file_put_method_ftype, ui_file_put_ftype, set_ui_file_put)
(ui_file_delete_ftype, set_ui_file_data, ui_file_fseek_ftype)
(set_ui_file_fseek): Delete.
(ui_file_data, ui_file_delete, ui_file_rewind)
(struct ui_file): New.
(ui_file_up): New.
(class null_file): New.
(null_stream): Declare.
(ui_file_write_for_put, ui_file_put): Delete.
(ui_file_xstrdup, ui_file_as_string, ui_file_obsavestring):
Delete.
(ui_file_fseek, mem_fileopen, stdio_fileopen, stderr_fileopen)
(gdb_fopen, tee_file_new): Delete.
(struct string_file): New.
(struct stdio_file): New.
(stdio_file_up): New.
(struct stderr_file): New.
(class tee_file): New.
* ui-out.c (ui_out::field_stream): Take a 'string_file &' instead
of a 'ui_file *'. Adjust.
* ui-out.h (class ui_out) <field_stream>: Likewise.
* utils.c (do_ui_file_delete, make_cleanup_ui_file_delete)
(null_stream): Delete.
(error_stream): Take a 'string_file &' instead of a 'ui_file *'.
Adjust.
* utils.h (struct ui_file): Delete forward declaration..
(make_cleanup_ui_file_delete, null_stream): Delete declarations.
(error_stream): Take a 'string_file &' instead of a
'ui_file *'.
* varobj.c (varobj_value_get_print_value): Use string_file.
* xtensa-tdep.c (xtensa_verify_config): Use string_file.
* gdbarch.c: Regenerate.
2017-02-02 12:11:47 +01:00
|
|
|
string_file log;
|
2010-05-13 23:56:58 +02:00
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
/* fundamental */
|
2007-11-12 07:47:56 +01:00
|
|
|
if (gdbarch->byte_order == BFD_ENDIAN_UNKNOWN)
|
Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy
This patch starts from the desire to eliminate
make_cleanup_ui_file_delete, but then goes beyond. It makes ui_file &
friends a real C++ class hierarchy, and switches temporary
ui_file-like objects to stack-based allocation.
- mem_fileopen -> string_file
mem_fileopen is replaced with a new string_file class that is treated
as a value class created on the stack. This alone eliminates most
make_cleanup_ui_file_delete calls, and, simplifies code a whole lot
(diffstat shows around 1k loc dropped.)
string_file's internal buffer is a std::string, thus the "string" in
the name. This simplifies the implementation much, compared to
mem_fileopen, which managed growing its internal buffer manually.
- ui_file_as_string, ui_file_strdup, ui_file_obsavestring all gone
The new string_file class has a string() method that provides direct
writable access to the internal std::string buffer. This replaced
ui_file_as_string, which forced a copy of the same data the stream had
inside. With direct access via a writable reference, we can instead
move the string out of the string_stream, avoiding deep string
copying.
Related, ui_file_xstrdup calls are replaced with xstrdup'ping the
stream's string, and ui_file_obsavestring is replaced by
obstack_copy0.
With all those out of the way, getting rid of the weird ui_file_put
mechanism was possible.
- New ui_file::printf, ui_file::puts, etc. methods
These simplify / clarify client code. I considered splitting
client-code changes, like these, e.g.:
- stb = mem_fileopen ();
- fprintf_unfiltered (stb, "%s%s%s",
- _("The valid values are:\n"),
- regdesc,
- _("The default is \"std\"."));
+ string_file stb;
+ stb.printf ("%s%s%s",
+ _("The valid values are:\n"),
+ regdesc,
+ _("The default is \"std\"."));
In two steps, with the first step leaving fprintf_unfiltered (etc.)
calls in place, and only afterwards do a pass to change all those to
call stb.printf etc.. I didn't do that split, because (when I tried),
it turned out to be pointless make-work: the first pass would have to
touch the fprintf_unfiltered line anyway, to replace "stb" with
"&stb".
- gdb_fopen replaced with stack-based objects
This avoids the need for cleanups or unique_ptr's. I.e., this:
struct ui_file *file = gdb_fopen (filename, "w");
if (filename == NULL)
perror_with_name (filename);
cleanups = make_cleanup_ui_file_delete (file);
// use file.
do_cleanups (cleanups);
is replaced with this:
stdio_file file;
if (!file.open (filename, "w"))
perror_with_name (filename);
// use file.
- odd contorsions in null_file_write / null_file_fputs around when to
call to_fputs / to_write eliminated.
- Global null_stream object
A few places that were allocating a ui_file in order to print to
"nowhere" are adjusted to instead refer to a new 'null_stream' global
stream.
- TUI's tui_sfileopen eliminated. TUI's ui_file much simplified
The TUI's ui_file was serving a dual purpose. It supported being used
as string buffer, and supported being backed by a stdio FILE. The
string buffer part is gone, replaced by using of string_file. The
'FILE *' support is now much simplified, by making the TUI's ui_file
inherit from stdio_file.
gdb/ChangeLog:
2017-02-02 Pedro Alves <palves@redhat.com>
* ada-lang.c (type_as_string): Use string_file.
* ada-valprint.c (ada_print_floating): Use string_file.
* ada-varobj.c (ada_varobj_scalar_image)
(ada_varobj_get_value_image): Use string_file.
* aix-thread.c (aix_thread_extra_thread_info): Use string_file.
* arm-tdep.c (_initialize_arm_tdep): Use string_printf.
* breakpoint.c (update_inserted_breakpoint_locations)
(insert_breakpoint_locations, reattach_breakpoints)
(print_breakpoint_location, print_one_detail_ranged_breakpoint)
(print_it_watchpoint): Use string_file.
(save_breakpoints): Use stdio_file.
* c-exp.y (oper): Use string_file.
* cli/cli-logging.c (set_logging_redirect): Use ui_file_up and
tee_file.
(pop_output_files): Use delete.
(handle_redirections): Use stdio_file and tee_file.
* cli/cli-setshow.c (do_show_command): Use string_file.
* compile/compile-c-support.c (c_compute_program): Use
string_file.
* compile/compile-c-symbols.c (generate_vla_size): Take a
'string_file &' instead of a 'ui_file *'.
(generate_c_for_for_one_variable): Take a 'string_file &' instead
of a 'ui_file *'. Use string_file.
(generate_c_for_variable_locations): Take a 'string_file &'
instead of a 'ui_file *'.
* compile/compile-internal.h (generate_c_for_for_one_variable):
Take a 'string_file &' instead of a 'ui_file *'.
* compile/compile-loc2c.c (push, pushf, unary, binary)
(print_label, pushf_register_address, pushf_register)
(do_compile_dwarf_expr_to_c): Take a 'string_file &' instead of a
'ui_file *'. Adjust.
* compile/compile.c (compile_to_object): Use string_file.
* compile/compile.h (compile_dwarf_expr_to_c)
(compile_dwarf_bounds_to_c): Take a 'string_file &' instead of a
'ui_file *'.
* cp-support.c (inspect_type): Use string_file and obstack_copy0.
(replace_typedefs_qualified_name): Use string_file and
obstack_copy0.
* disasm.c (gdb_pretty_print_insn): Use string_file.
(gdb_disassembly): Adjust reference the null_stream global.
(do_ui_file_delete): Delete.
(gdb_insn_length): Use null_stream.
* dummy-frame.c (maintenance_print_dummy_frames): Use stdio_file.
* dwarf2loc.c (dwarf2_compile_property_to_c)
(locexpr_generate_c_location, loclist_generate_c_location): Take a
'string_file &' instead of a 'ui_file *'.
* dwarf2loc.h (dwarf2_compile_property_to_c): Likewise.
* dwarf2read.c (do_ui_file_peek_last): Delete.
(dwarf2_compute_name): Use string_file.
* event-top.c (gdb_setup_readline): Use stdio_file.
* gdbarch.sh (verify_gdbarch): Use string_file.
* gdbtypes.c (safe_parse_type): Use null_stream.
* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use
string_file.
* guile/scm-disasm.c (gdbscm_print_insn_from_port): Take a
'string_file *' instead of a 'ui_file *'.
(gdbscm_arch_disassemble): Use string_file.
* guile/scm-frame.c (frscm_print_frame_smob): Use string_file.
* guile/scm-ports.c (class ioscm_file_port): Now a class that
inherits from ui_file.
(ioscm_file_port_delete, ioscm_file_port_rewind)
(ioscm_file_port_put): Delete.
(ioscm_file_port_write): Rename to ...
(ioscm_file_port::write): ... this. Remove file_port_magic
checks.
(ioscm_file_port_new): Delete.
(ioscm_with_output_to_port_worker): Use ioscm_file_port and
ui_file_up.
* guile/scm-type.c (tyscm_type_name): Use string_file.
* guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print):
Use string_file.
* infcmd.c (print_return_value_1): Use string_file.
* infrun.c (print_target_wait_results): Use string_file.
* language.c (add_language): Use string_file.
* location.c (explicit_to_string_internal): Use string_file.
* main.c (captured_main_1): Use null_file.
* maint.c (maintenance_print_architecture): Use stdio_file.
* mi/mi-cmd-stack.c (list_arg_or_local): Use string_file.
* mi/mi-common.h (struct mi_interp) <out, err, log, targ,
event_channel>: Change type to mi_console_file pointer.
* mi/mi-console.c (mi_console_file_fputs, mi_console_file_flush)
(mi_console_file_delete): Delete.
(struct mi_console_file): Delete.
(mi_console_file_magic): Delete.
(mi_console_file_new): Delete.
(mi_console_file::mi_console_file): New.
(mi_console_file_delete): Delete.
(mi_console_file_fputs): Delete.
(mi_console_file::write): New.
(mi_console_raw_packet): Delete.
(mi_console_file::flush): New.
(mi_console_file_flush): Delete.
(mi_console_set_raw): Rename to ...
(mi_console_file::set_raw): ... this.
* mi/mi-console.h (class mi_console_file): New class.
(mi_console_file_new, mi_console_set_raw): Delete.
* mi/mi-interp.c (mi_interpreter_init): Use mi_console_file.
(mi_set_logging): Use delete and tee_file. Adjust.
* mi/mi-main.c (output_register): Use string_file.
(mi_cmd_data_evaluate_expression): Use string_file.
(mi_cmd_data_read_memory): Use string_file.
(mi_cmd_execute, print_variable_or_computed): Use string_file.
* mi/mi-out.c (mi_ui_out::main_stream): New.
(mi_ui_out::rewind): Use main_stream and
string_file.
(mi_ui_out::put): Use main_stream and string_file.
(mi_ui_out::mi_ui_out): Remove 'stream' parameter.
Allocate a 'string_file' instead.
(mi_out_new): Don't allocate a mem_fileopen stream here.
* mi/mi-out.h (mi_ui_out::mi_ui_out): Remove 'stream' parameter.
(mi_ui_out::main_stream): Declare method.
* printcmd.c (eval_command): Use string_file.
* psymtab.c (maintenance_print_psymbols): Use stdio_file.
* python/py-arch.c (archpy_disassemble): Use string_file.
* python/py-breakpoint.c (bppy_get_commands): Use string_file.
* python/py-frame.c (frapy_str): Use string_file.
* python/py-framefilter.c (py_print_type, py_print_single_arg):
Use string_file.
* python/py-type.c (typy_str): Use string_file.
* python/py-unwind.c (unwind_infopy_str): Use string_file.
* python/py-value.c (valpy_str): Use string_file.
* record-btrace.c (btrace_insn_history): Use string_file.
* regcache.c (regcache_print): Use stdio_file.
* reggroups.c (maintenance_print_reggroups): Use stdio_file.
* remote.c (escape_buffer): Use string_file.
* rust-lang.c (rust_get_disr_info): Use string_file.
* serial.c (serial_open_ops_1): Use stdio_file.
(do_serial_close): Use delete.
* stack.c (print_frame_arg): Use string_file.
(print_frame_args): Remove local mem_fileopen stream, not used.
(print_frame): Use string_file.
* symmisc.c (maintenance_print_symbols): Use stdio_file.
* symtab.h (struct symbol_computed_ops) <generate_c_location>:
Take a 'string_file *' instead of a 'ui_file *'.
* top.c (new_ui): Use stdio_file and stderr_file.
(free_ui): Use delete.
(execute_command_to_string): Use string_file.
(quit_confirm): Use string_file.
* tracepoint.c (collection_list::append_exp): Use string_file.
* tui/tui-disasm.c (tui_disassemble): Use string_file.
* tui/tui-file.c: Don't include "ui-file.h".
(enum streamtype, struct tui_stream): Delete.
(tui_file_new, tui_file_delete, tui_fileopen, tui_sfileopen)
(tui_file_isatty, tui_file_rewind, tui_file_put): Delete.
(tui_file::tui_file): New method.
(tui_file_fputs): Delete.
(tui_file_get_strbuf): Delete.
(tui_file::puts): New method.
(tui_file_adjust_strbuf): Delete.
(tui_file_flush): Delete.
(tui_file::flush): New method.
* tui/tui-file.h: Tweak intro comment.
Include ui-file.h.
(tui_fileopen, tui_sfileopen, tui_file_get_strbuf)
(tui_file_adjust_strbuf): Delete declarations.
(class tui_file): New class.
* tui/tui-io.c (tui_initialize_io): Use tui_file.
* tui/tui-regs.c (tui_restore_gdbout): Use delete.
(tui_register_format): Use string_stream.
* tui/tui-stack.c (tui_make_status_line): Use string_file.
(tui_get_function_from_frame): Use string_file.
* typeprint.c (type_to_string): Use string_file.
* ui-file.c (struct ui_file, ui_file_magic, ui_file_new): Delete.
(null_stream): New global.
(ui_file_delete): Delete.
(ui_file::ui_file): New.
(null_file_isatty): Delete.
(ui_file::~ui_file): New.
(null_file_rewind): Delete.
(ui_file::printf): New.
(null_file_put): Delete.
(null_file_flush): Delete.
(ui_file::putstr): New.
(null_file_write): Delete.
(ui_file::putstrn): New.
(null_file_read): Delete.
(ui_file::putc): New.
(null_file_fputs): Delete.
(null_file_write_async_safe): Delete.
(ui_file::vprintf): New.
(null_file_delete): Delete.
(null_file::write): New.
(null_file_fseek): Delete.
(null_file::puts): New.
(ui_file_data): Delete.
(null_file::write_async_safe): New.
(gdb_flush, ui_file_isatty): Adjust.
(ui_file_put, ui_file_rewind): Delete.
(ui_file_write): Adjust.
(ui_file_write_for_put): Delete.
(ui_file_write_async_safe, ui_file_read): Adjust.
(ui_file_fseek): Delete.
(fputs_unfiltered): Adjust.
(set_ui_file_flush, set_ui_file_isatty, set_ui_file_rewind)
(set_ui_file_put, set_ui_file_write, set_ui_file_write_async_safe)
(set_ui_file_read, set_ui_file_fputs, set_ui_file_fseek)
(set_ui_file_data): Delete.
(string_file::~string_file, string_file::write)
(struct accumulated_ui_file, do_ui_file_xstrdup, ui_file_xstrdup)
(do_ui_file_as_string, ui_file_as_string): Delete.
(do_ui_file_obsavestring, ui_file_obsavestring): Delete.
(struct mem_file): Delete.
(mem_file_new): Delete.
(stdio_file::stdio_file): New.
(mem_file_delete): Delete.
(stdio_file::stdio_file): New.
(mem_fileopen): Delete.
(stdio_file::~stdio_file): New.
(mem_file_rewind): Delete.
(stdio_file::set_stream): New.
(mem_file_put): Delete.
(stdio_file::open): New.
(mem_file_write): Delete.
(stdio_file_magic, struct stdio_file): Delete.
(stdio_file_new, stdio_file_delete, stdio_file_flush): Delete.
(stdio_file::flush): New.
(stdio_file_read): Rename to ...
(stdio_file::read): ... this. Adjust.
(stdio_file_write): Rename to ...
(stdio_file::write): ... this. Adjust.
(stdio_file_write_async_safe): Rename to ...
(stdio_file::write_async_safe) ... this. Adjust.
(stdio_file_fputs): Rename to ...
(stdio_file::puts) ... this. Adjust.
(stdio_file_isatty): Delete.
(stdio_file_fseek): Delete.
(stdio_file::isatty): New.
(stderr_file_write): Rename to ...
(stderr_file::write) ... this. Adjust.
(stderr_file_fputs): Rename to ...
(stderr_file::puts) ... this. Adjust.
(stderr_fileopen, stdio_fileopen, gdb_fopen): Delete.
(stderr_file::stderr_file): New.
(tee_file_magic): Delete.
(struct tee_file): Delete.
(tee_file::tee_file): New.
(tee_file_new): Delete.
(tee_file::~tee_file): New.
(tee_file_delete): Delete.
(tee_file_flush): Rename to ...
(tee_file::flush): ... this. Adjust.
(tee_file_write): Rename to ...
(tee_file::write): ... this. Adjust.
(tee_file::write_async_safe): New.
(tee_file_fputs): Rename to ...
(tee_file::puts): ... this. Adjust.
(tee_file_isatty): Rename to ...
(tee_file::isatty): ... this. Adjust.
* ui-file.h (struct obstack, struct ui_file): Don't
forward-declare.
(ui_file_new, ui_file_flush_ftype, set_ui_file_flush)
(ui_file_write_ftype)
(set_ui_file_write, ui_file_fputs_ftype, set_ui_file_fputs)
(ui_file_write_async_safe_ftype, set_ui_file_write_async_safe)
(ui_file_read_ftype, set_ui_file_read, ui_file_isatty_ftype)
(set_ui_file_isatty, ui_file_rewind_ftype, set_ui_file_rewind)
(ui_file_put_method_ftype, ui_file_put_ftype, set_ui_file_put)
(ui_file_delete_ftype, set_ui_file_data, ui_file_fseek_ftype)
(set_ui_file_fseek): Delete.
(ui_file_data, ui_file_delete, ui_file_rewind)
(struct ui_file): New.
(ui_file_up): New.
(class null_file): New.
(null_stream): Declare.
(ui_file_write_for_put, ui_file_put): Delete.
(ui_file_xstrdup, ui_file_as_string, ui_file_obsavestring):
Delete.
(ui_file_fseek, mem_fileopen, stdio_fileopen, stderr_fileopen)
(gdb_fopen, tee_file_new): Delete.
(struct string_file): New.
(struct stdio_file): New.
(stdio_file_up): New.
(struct stderr_file): New.
(class tee_file): New.
* ui-out.c (ui_out::field_stream): Take a 'string_file &' instead
of a 'ui_file *'. Adjust.
* ui-out.h (class ui_out) <field_stream>: Likewise.
* utils.c (do_ui_file_delete, make_cleanup_ui_file_delete)
(null_stream): Delete.
(error_stream): Take a 'string_file &' instead of a 'ui_file *'.
Adjust.
* utils.h (struct ui_file): Delete forward declaration..
(make_cleanup_ui_file_delete, null_stream): Delete declarations.
(error_stream): Take a 'string_file &' instead of a
'ui_file *'.
* varobj.c (varobj_value_get_print_value): Use string_file.
* xtensa-tdep.c (xtensa_verify_config): Use string_file.
* gdbarch.c: Regenerate.
2017-02-02 12:11:47 +01:00
|
|
|
log.puts ("\n\tbyte-order");
|
2007-11-12 07:47:56 +01:00
|
|
|
if (gdbarch->bfd_arch_info == NULL)
|
Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy
This patch starts from the desire to eliminate
make_cleanup_ui_file_delete, but then goes beyond. It makes ui_file &
friends a real C++ class hierarchy, and switches temporary
ui_file-like objects to stack-based allocation.
- mem_fileopen -> string_file
mem_fileopen is replaced with a new string_file class that is treated
as a value class created on the stack. This alone eliminates most
make_cleanup_ui_file_delete calls, and, simplifies code a whole lot
(diffstat shows around 1k loc dropped.)
string_file's internal buffer is a std::string, thus the "string" in
the name. This simplifies the implementation much, compared to
mem_fileopen, which managed growing its internal buffer manually.
- ui_file_as_string, ui_file_strdup, ui_file_obsavestring all gone
The new string_file class has a string() method that provides direct
writable access to the internal std::string buffer. This replaced
ui_file_as_string, which forced a copy of the same data the stream had
inside. With direct access via a writable reference, we can instead
move the string out of the string_stream, avoiding deep string
copying.
Related, ui_file_xstrdup calls are replaced with xstrdup'ping the
stream's string, and ui_file_obsavestring is replaced by
obstack_copy0.
With all those out of the way, getting rid of the weird ui_file_put
mechanism was possible.
- New ui_file::printf, ui_file::puts, etc. methods
These simplify / clarify client code. I considered splitting
client-code changes, like these, e.g.:
- stb = mem_fileopen ();
- fprintf_unfiltered (stb, "%s%s%s",
- _("The valid values are:\n"),
- regdesc,
- _("The default is \"std\"."));
+ string_file stb;
+ stb.printf ("%s%s%s",
+ _("The valid values are:\n"),
+ regdesc,
+ _("The default is \"std\"."));
In two steps, with the first step leaving fprintf_unfiltered (etc.)
calls in place, and only afterwards do a pass to change all those to
call stb.printf etc.. I didn't do that split, because (when I tried),
it turned out to be pointless make-work: the first pass would have to
touch the fprintf_unfiltered line anyway, to replace "stb" with
"&stb".
- gdb_fopen replaced with stack-based objects
This avoids the need for cleanups or unique_ptr's. I.e., this:
struct ui_file *file = gdb_fopen (filename, "w");
if (filename == NULL)
perror_with_name (filename);
cleanups = make_cleanup_ui_file_delete (file);
// use file.
do_cleanups (cleanups);
is replaced with this:
stdio_file file;
if (!file.open (filename, "w"))
perror_with_name (filename);
// use file.
- odd contorsions in null_file_write / null_file_fputs around when to
call to_fputs / to_write eliminated.
- Global null_stream object
A few places that were allocating a ui_file in order to print to
"nowhere" are adjusted to instead refer to a new 'null_stream' global
stream.
- TUI's tui_sfileopen eliminated. TUI's ui_file much simplified
The TUI's ui_file was serving a dual purpose. It supported being used
as string buffer, and supported being backed by a stdio FILE. The
string buffer part is gone, replaced by using of string_file. The
'FILE *' support is now much simplified, by making the TUI's ui_file
inherit from stdio_file.
gdb/ChangeLog:
2017-02-02 Pedro Alves <palves@redhat.com>
* ada-lang.c (type_as_string): Use string_file.
* ada-valprint.c (ada_print_floating): Use string_file.
* ada-varobj.c (ada_varobj_scalar_image)
(ada_varobj_get_value_image): Use string_file.
* aix-thread.c (aix_thread_extra_thread_info): Use string_file.
* arm-tdep.c (_initialize_arm_tdep): Use string_printf.
* breakpoint.c (update_inserted_breakpoint_locations)
(insert_breakpoint_locations, reattach_breakpoints)
(print_breakpoint_location, print_one_detail_ranged_breakpoint)
(print_it_watchpoint): Use string_file.
(save_breakpoints): Use stdio_file.
* c-exp.y (oper): Use string_file.
* cli/cli-logging.c (set_logging_redirect): Use ui_file_up and
tee_file.
(pop_output_files): Use delete.
(handle_redirections): Use stdio_file and tee_file.
* cli/cli-setshow.c (do_show_command): Use string_file.
* compile/compile-c-support.c (c_compute_program): Use
string_file.
* compile/compile-c-symbols.c (generate_vla_size): Take a
'string_file &' instead of a 'ui_file *'.
(generate_c_for_for_one_variable): Take a 'string_file &' instead
of a 'ui_file *'. Use string_file.
(generate_c_for_variable_locations): Take a 'string_file &'
instead of a 'ui_file *'.
* compile/compile-internal.h (generate_c_for_for_one_variable):
Take a 'string_file &' instead of a 'ui_file *'.
* compile/compile-loc2c.c (push, pushf, unary, binary)
(print_label, pushf_register_address, pushf_register)
(do_compile_dwarf_expr_to_c): Take a 'string_file &' instead of a
'ui_file *'. Adjust.
* compile/compile.c (compile_to_object): Use string_file.
* compile/compile.h (compile_dwarf_expr_to_c)
(compile_dwarf_bounds_to_c): Take a 'string_file &' instead of a
'ui_file *'.
* cp-support.c (inspect_type): Use string_file and obstack_copy0.
(replace_typedefs_qualified_name): Use string_file and
obstack_copy0.
* disasm.c (gdb_pretty_print_insn): Use string_file.
(gdb_disassembly): Adjust reference the null_stream global.
(do_ui_file_delete): Delete.
(gdb_insn_length): Use null_stream.
* dummy-frame.c (maintenance_print_dummy_frames): Use stdio_file.
* dwarf2loc.c (dwarf2_compile_property_to_c)
(locexpr_generate_c_location, loclist_generate_c_location): Take a
'string_file &' instead of a 'ui_file *'.
* dwarf2loc.h (dwarf2_compile_property_to_c): Likewise.
* dwarf2read.c (do_ui_file_peek_last): Delete.
(dwarf2_compute_name): Use string_file.
* event-top.c (gdb_setup_readline): Use stdio_file.
* gdbarch.sh (verify_gdbarch): Use string_file.
* gdbtypes.c (safe_parse_type): Use null_stream.
* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use
string_file.
* guile/scm-disasm.c (gdbscm_print_insn_from_port): Take a
'string_file *' instead of a 'ui_file *'.
(gdbscm_arch_disassemble): Use string_file.
* guile/scm-frame.c (frscm_print_frame_smob): Use string_file.
* guile/scm-ports.c (class ioscm_file_port): Now a class that
inherits from ui_file.
(ioscm_file_port_delete, ioscm_file_port_rewind)
(ioscm_file_port_put): Delete.
(ioscm_file_port_write): Rename to ...
(ioscm_file_port::write): ... this. Remove file_port_magic
checks.
(ioscm_file_port_new): Delete.
(ioscm_with_output_to_port_worker): Use ioscm_file_port and
ui_file_up.
* guile/scm-type.c (tyscm_type_name): Use string_file.
* guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print):
Use string_file.
* infcmd.c (print_return_value_1): Use string_file.
* infrun.c (print_target_wait_results): Use string_file.
* language.c (add_language): Use string_file.
* location.c (explicit_to_string_internal): Use string_file.
* main.c (captured_main_1): Use null_file.
* maint.c (maintenance_print_architecture): Use stdio_file.
* mi/mi-cmd-stack.c (list_arg_or_local): Use string_file.
* mi/mi-common.h (struct mi_interp) <out, err, log, targ,
event_channel>: Change type to mi_console_file pointer.
* mi/mi-console.c (mi_console_file_fputs, mi_console_file_flush)
(mi_console_file_delete): Delete.
(struct mi_console_file): Delete.
(mi_console_file_magic): Delete.
(mi_console_file_new): Delete.
(mi_console_file::mi_console_file): New.
(mi_console_file_delete): Delete.
(mi_console_file_fputs): Delete.
(mi_console_file::write): New.
(mi_console_raw_packet): Delete.
(mi_console_file::flush): New.
(mi_console_file_flush): Delete.
(mi_console_set_raw): Rename to ...
(mi_console_file::set_raw): ... this.
* mi/mi-console.h (class mi_console_file): New class.
(mi_console_file_new, mi_console_set_raw): Delete.
* mi/mi-interp.c (mi_interpreter_init): Use mi_console_file.
(mi_set_logging): Use delete and tee_file. Adjust.
* mi/mi-main.c (output_register): Use string_file.
(mi_cmd_data_evaluate_expression): Use string_file.
(mi_cmd_data_read_memory): Use string_file.
(mi_cmd_execute, print_variable_or_computed): Use string_file.
* mi/mi-out.c (mi_ui_out::main_stream): New.
(mi_ui_out::rewind): Use main_stream and
string_file.
(mi_ui_out::put): Use main_stream and string_file.
(mi_ui_out::mi_ui_out): Remove 'stream' parameter.
Allocate a 'string_file' instead.
(mi_out_new): Don't allocate a mem_fileopen stream here.
* mi/mi-out.h (mi_ui_out::mi_ui_out): Remove 'stream' parameter.
(mi_ui_out::main_stream): Declare method.
* printcmd.c (eval_command): Use string_file.
* psymtab.c (maintenance_print_psymbols): Use stdio_file.
* python/py-arch.c (archpy_disassemble): Use string_file.
* python/py-breakpoint.c (bppy_get_commands): Use string_file.
* python/py-frame.c (frapy_str): Use string_file.
* python/py-framefilter.c (py_print_type, py_print_single_arg):
Use string_file.
* python/py-type.c (typy_str): Use string_file.
* python/py-unwind.c (unwind_infopy_str): Use string_file.
* python/py-value.c (valpy_str): Use string_file.
* record-btrace.c (btrace_insn_history): Use string_file.
* regcache.c (regcache_print): Use stdio_file.
* reggroups.c (maintenance_print_reggroups): Use stdio_file.
* remote.c (escape_buffer): Use string_file.
* rust-lang.c (rust_get_disr_info): Use string_file.
* serial.c (serial_open_ops_1): Use stdio_file.
(do_serial_close): Use delete.
* stack.c (print_frame_arg): Use string_file.
(print_frame_args): Remove local mem_fileopen stream, not used.
(print_frame): Use string_file.
* symmisc.c (maintenance_print_symbols): Use stdio_file.
* symtab.h (struct symbol_computed_ops) <generate_c_location>:
Take a 'string_file *' instead of a 'ui_file *'.
* top.c (new_ui): Use stdio_file and stderr_file.
(free_ui): Use delete.
(execute_command_to_string): Use string_file.
(quit_confirm): Use string_file.
* tracepoint.c (collection_list::append_exp): Use string_file.
* tui/tui-disasm.c (tui_disassemble): Use string_file.
* tui/tui-file.c: Don't include "ui-file.h".
(enum streamtype, struct tui_stream): Delete.
(tui_file_new, tui_file_delete, tui_fileopen, tui_sfileopen)
(tui_file_isatty, tui_file_rewind, tui_file_put): Delete.
(tui_file::tui_file): New method.
(tui_file_fputs): Delete.
(tui_file_get_strbuf): Delete.
(tui_file::puts): New method.
(tui_file_adjust_strbuf): Delete.
(tui_file_flush): Delete.
(tui_file::flush): New method.
* tui/tui-file.h: Tweak intro comment.
Include ui-file.h.
(tui_fileopen, tui_sfileopen, tui_file_get_strbuf)
(tui_file_adjust_strbuf): Delete declarations.
(class tui_file): New class.
* tui/tui-io.c (tui_initialize_io): Use tui_file.
* tui/tui-regs.c (tui_restore_gdbout): Use delete.
(tui_register_format): Use string_stream.
* tui/tui-stack.c (tui_make_status_line): Use string_file.
(tui_get_function_from_frame): Use string_file.
* typeprint.c (type_to_string): Use string_file.
* ui-file.c (struct ui_file, ui_file_magic, ui_file_new): Delete.
(null_stream): New global.
(ui_file_delete): Delete.
(ui_file::ui_file): New.
(null_file_isatty): Delete.
(ui_file::~ui_file): New.
(null_file_rewind): Delete.
(ui_file::printf): New.
(null_file_put): Delete.
(null_file_flush): Delete.
(ui_file::putstr): New.
(null_file_write): Delete.
(ui_file::putstrn): New.
(null_file_read): Delete.
(ui_file::putc): New.
(null_file_fputs): Delete.
(null_file_write_async_safe): Delete.
(ui_file::vprintf): New.
(null_file_delete): Delete.
(null_file::write): New.
(null_file_fseek): Delete.
(null_file::puts): New.
(ui_file_data): Delete.
(null_file::write_async_safe): New.
(gdb_flush, ui_file_isatty): Adjust.
(ui_file_put, ui_file_rewind): Delete.
(ui_file_write): Adjust.
(ui_file_write_for_put): Delete.
(ui_file_write_async_safe, ui_file_read): Adjust.
(ui_file_fseek): Delete.
(fputs_unfiltered): Adjust.
(set_ui_file_flush, set_ui_file_isatty, set_ui_file_rewind)
(set_ui_file_put, set_ui_file_write, set_ui_file_write_async_safe)
(set_ui_file_read, set_ui_file_fputs, set_ui_file_fseek)
(set_ui_file_data): Delete.
(string_file::~string_file, string_file::write)
(struct accumulated_ui_file, do_ui_file_xstrdup, ui_file_xstrdup)
(do_ui_file_as_string, ui_file_as_string): Delete.
(do_ui_file_obsavestring, ui_file_obsavestring): Delete.
(struct mem_file): Delete.
(mem_file_new): Delete.
(stdio_file::stdio_file): New.
(mem_file_delete): Delete.
(stdio_file::stdio_file): New.
(mem_fileopen): Delete.
(stdio_file::~stdio_file): New.
(mem_file_rewind): Delete.
(stdio_file::set_stream): New.
(mem_file_put): Delete.
(stdio_file::open): New.
(mem_file_write): Delete.
(stdio_file_magic, struct stdio_file): Delete.
(stdio_file_new, stdio_file_delete, stdio_file_flush): Delete.
(stdio_file::flush): New.
(stdio_file_read): Rename to ...
(stdio_file::read): ... this. Adjust.
(stdio_file_write): Rename to ...
(stdio_file::write): ... this. Adjust.
(stdio_file_write_async_safe): Rename to ...
(stdio_file::write_async_safe) ... this. Adjust.
(stdio_file_fputs): Rename to ...
(stdio_file::puts) ... this. Adjust.
(stdio_file_isatty): Delete.
(stdio_file_fseek): Delete.
(stdio_file::isatty): New.
(stderr_file_write): Rename to ...
(stderr_file::write) ... this. Adjust.
(stderr_file_fputs): Rename to ...
(stderr_file::puts) ... this. Adjust.
(stderr_fileopen, stdio_fileopen, gdb_fopen): Delete.
(stderr_file::stderr_file): New.
(tee_file_magic): Delete.
(struct tee_file): Delete.
(tee_file::tee_file): New.
(tee_file_new): Delete.
(tee_file::~tee_file): New.
(tee_file_delete): Delete.
(tee_file_flush): Rename to ...
(tee_file::flush): ... this. Adjust.
(tee_file_write): Rename to ...
(tee_file::write): ... this. Adjust.
(tee_file::write_async_safe): New.
(tee_file_fputs): Rename to ...
(tee_file::puts): ... this. Adjust.
(tee_file_isatty): Rename to ...
(tee_file::isatty): ... this. Adjust.
* ui-file.h (struct obstack, struct ui_file): Don't
forward-declare.
(ui_file_new, ui_file_flush_ftype, set_ui_file_flush)
(ui_file_write_ftype)
(set_ui_file_write, ui_file_fputs_ftype, set_ui_file_fputs)
(ui_file_write_async_safe_ftype, set_ui_file_write_async_safe)
(ui_file_read_ftype, set_ui_file_read, ui_file_isatty_ftype)
(set_ui_file_isatty, ui_file_rewind_ftype, set_ui_file_rewind)
(ui_file_put_method_ftype, ui_file_put_ftype, set_ui_file_put)
(ui_file_delete_ftype, set_ui_file_data, ui_file_fseek_ftype)
(set_ui_file_fseek): Delete.
(ui_file_data, ui_file_delete, ui_file_rewind)
(struct ui_file): New.
(ui_file_up): New.
(class null_file): New.
(null_stream): Declare.
(ui_file_write_for_put, ui_file_put): Delete.
(ui_file_xstrdup, ui_file_as_string, ui_file_obsavestring):
Delete.
(ui_file_fseek, mem_fileopen, stdio_fileopen, stderr_fileopen)
(gdb_fopen, tee_file_new): Delete.
(struct string_file): New.
(struct stdio_file): New.
(stdio_file_up): New.
(struct stderr_file): New.
(class tee_file): New.
* ui-out.c (ui_out::field_stream): Take a 'string_file &' instead
of a 'ui_file *'. Adjust.
* ui-out.h (class ui_out) <field_stream>: Likewise.
* utils.c (do_ui_file_delete, make_cleanup_ui_file_delete)
(null_stream): Delete.
(error_stream): Take a 'string_file &' instead of a 'ui_file *'.
Adjust.
* utils.h (struct ui_file): Delete forward declaration..
(make_cleanup_ui_file_delete, null_stream): Delete declarations.
(error_stream): Take a 'string_file &' instead of a
'ui_file *'.
* varobj.c (varobj_value_get_print_value): Use string_file.
* xtensa-tdep.c (xtensa_verify_config): Use string_file.
* gdbarch.c: Regenerate.
2017-02-02 12:11:47 +01:00
|
|
|
log.puts ("\n\tbfd_arch_info");
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Check those that need to be defined for the given multi-arch level. */
|
2008-01-18 18:07:40 +01:00
|
|
|
/* Skip verify of bits_big_endian, invalid_p == 0 */
|
2000-08-11 04:55:38 +02:00
|
|
|
/* Skip verify of short_bit, invalid_p == 0 */
|
|
|
|
/* Skip verify of int_bit, invalid_p == 0 */
|
|
|
|
/* Skip verify of long_bit, invalid_p == 0 */
|
|
|
|
/* Skip verify of long_long_bit, invalid_p == 0 */
|
2011-10-11 21:08:59 +02:00
|
|
|
/* Skip verify of long_long_align_bit, invalid_p == 0 */
|
2010-07-06 14:56:24 +02:00
|
|
|
/* Skip verify of half_bit, invalid_p == 0 */
|
|
|
|
if (gdbarch->half_format == 0)
|
|
|
|
gdbarch->half_format = floatformats_ieee_half;
|
2000-08-11 04:55:38 +02:00
|
|
|
/* Skip verify of float_bit, invalid_p == 0 */
|
2007-11-12 07:47:56 +01:00
|
|
|
if (gdbarch->float_format == 0)
|
|
|
|
gdbarch->float_format = floatformats_ieee_single;
|
2000-08-11 04:55:38 +02:00
|
|
|
/* Skip verify of double_bit, invalid_p == 0 */
|
2007-11-12 07:47:56 +01:00
|
|
|
if (gdbarch->double_format == 0)
|
|
|
|
gdbarch->double_format = floatformats_ieee_double;
|
2000-08-11 04:55:38 +02:00
|
|
|
/* Skip verify of long_double_bit, invalid_p == 0 */
|
2007-11-12 07:47:56 +01:00
|
|
|
if (gdbarch->long_double_format == 0)
|
|
|
|
gdbarch->long_double_format = floatformats_ieee_double;
|
Teach GDB that wchar_t is a built-in type in C++ mode
GDB is currently not aware that wchar_t is a built-in type in C++
mode. This is usually not a problem because the debug info describes
the type, so when you have a program loaded, you don't notice this.
However, if you try expressions involving wchar_t before a program is
loaded, gdb errors out:
(gdb) p (wchar_t)-1
No symbol table is loaded. Use the "file" command.
(gdb) p L"hello"
No type named wchar_t.
(gdb) ptype L"hello"
No type named wchar_t.
This commit teaches gdb about the type. After:
(gdb) p (wchar_t)-1
$1 = -1 L'\xffffffff'
(gdb) p L"hello"
$2 = L"hello"
(gdb) ptype L"hello"
type = wchar_t [6]
Unlike char16_t/char32_t, unfortunately, the underlying type of
wchar_t is implementation dependent, both size and signness. So this
requires adding a couple new gdbarch hooks.
I grepped the GCC code base for WCHAR_TYPE and WCHAR_TYPE_SIZE, and it
seems to me that the majority of the ABIs have a 4-byte signed
wchar_t, so that's what I made the default for GDB too. And then I
looked for which ports have a 16-bit and/or unsigned wchar_t, and made
GDB follow suit.
gdb/ChangeLog:
2017-04-12 Pedro Alves <palves@redhat.com>
PR gdb/21323
* c-lang.c (cplus_primitive_types) <cplus_primitive_type_wchar_t>:
New enum value.
(cplus_language_arch_info): Register cplus_primitive_type_wchar_t.
* gdbtypes.h (struct builtin_type) <builtin_wchar>: New field.
* gdbtypes.c (gdbtypes_post_init): Create the "wchar_t" type.
* gdbarch.sh (wchar_bit, wchar_signed): New per-arch values.
* gdbarch.h, gdbarch.c: Regenerate.
* aarch64-tdep.c (aarch64_gdbarch_init): Override
gdbarch_wchar_bit and gdbarch_wchar_signed.
* alpha-tdep.c (alpha_gdbarch_init): Likewise.
* arm-tdep.c (arm_gdbarch_init): Likewise.
* avr-tdep.c (avr_gdbarch_init): Likewise.
* h8300-tdep.c (h8300_gdbarch_init): Likewise.
* i386-nto-tdep.c (i386nto_init_abi): Likewise.
* i386-tdep.c (i386_go32_init_abi): Likewise.
* m32r-tdep.c (m32r_gdbarch_init): Likewise.
* moxie-tdep.c (moxie_gdbarch_init): Likewise.
* nds32-tdep.c (nds32_gdbarch_init): Likewise.
* rs6000-aix-tdep.c (rs6000_aix_init_osabi): Likewise.
* sh-tdep.c (sh_gdbarch_init): Likewise.
* sparc-tdep.c (sparc32_gdbarch_init): Likewise.
* sparc64-tdep.c (sparc64_init_abi): Likewise.
* windows-tdep.c (windows_init_abi): Likewise.
* xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise.
gdb/testsuite/ChangeLog:
2017-04-12 Pedro Alves <palves@redhat.com>
PR gdb/21323
* gdb.cp/wide_char_types.c: Include <wchar.h>.
(wchar): New global.
* gdb.cp/wide_char_types.exp (wide_char_types_program)
(do_test_wide_char, wide_char_types_no_program, top level): Add
wchar_t testing.
2017-04-12 15:00:49 +02:00
|
|
|
/* Skip verify of wchar_bit, invalid_p == 0 */
|
|
|
|
if (gdbarch->wchar_signed == -1)
|
|
|
|
gdbarch->wchar_signed = 1;
|
Add gdbarch callback to provide formats for debug info float types
At this point, all TYPE_CODE_FLT types carry their floating-point format,
except for those creating from reading DWARF or stabs debug info. Those
will be addressed by this commit.
The main issue here is that we actually have to determine which floating-
point format to use. Currently, we only have the type length as input
to this decision. In the future, we may hopefully get --at least in
DWARF-- additional information to help disambiguate multiple different
formats of the same length. For now, we can still look at the type name
as a hint.
This decision logic is encapsulated in a gdbarch callback to allow
platform-specific overrides. The default implementation use the same
logic (compare type length against the various gdbarch_..._bit sizes)
that is currently implemented in floatformat_from_length.
With this commit, all platforms still use the default logic, so there
should be no actual change in behavior. A follow-on commit will add
support for __float128 on Intel and Power.
Once dwarf2read.c and stabsread.c make use of the new callback to
determine floating-point formats, we're now sure every TYPE_CODE_FLT
type will always carry its format. The commit therefore adds asserts
to verify_floatformat to ensure new code will continue to always
provide formats, and removes the code in floatformat_from_type that
used to handle types with a NULL TYPE_FLOATFORMAT.
gdb/ChangeLog:
* gdbarch.sh (floatformat_for_type): New gdbarch callback.
* gdbarch.h, gdbarch.c: Re-generate.
* arch-utils.h (default_floatformat_for_type): New prototype.
* arch-utils.c (default_floatformat_for_type): New function.
* doublest.c (floatformat_from_length): Remove.
(floatformat_from_type): Assume TYPE_FLOATFORMAT is non-NULL.
* gdbtypes.c (verify_floatformat): Require non-NULL format.
* dwarf2read.c (dwarf2_init_float_type): New function.
(read_base_type): Use it.
* stabsread.c (dbx_init_float_type): New function.
(read_sun_floating_type): Use it.
(read_range_type): Likewise.
Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-06 17:31:53 +02:00
|
|
|
/* Skip verify of floatformat_for_type, invalid_p == 0 */
|
2000-08-11 04:55:38 +02:00
|
|
|
/* Skip verify of ptr_bit, invalid_p == 0 */
|
2007-11-12 07:47:56 +01:00
|
|
|
if (gdbarch->addr_bit == 0)
|
|
|
|
gdbarch->addr_bit = gdbarch_ptr_bit (gdbarch);
|
2010-08-06 21:02:15 +02:00
|
|
|
if (gdbarch->dwarf2_addr_size == 0)
|
|
|
|
gdbarch->dwarf2_addr_size = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
|
2007-11-12 07:47:56 +01:00
|
|
|
if (gdbarch->char_signed == -1)
|
|
|
|
gdbarch->char_signed = 1;
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of read_pc, has predicate. */
|
|
|
|
/* Skip verify of write_pc, has predicate. */
|
2001-08-11 02:59:29 +02:00
|
|
|
/* Skip verify of virtual_frame_pointer, invalid_p == 0 */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of pseudo_register_read, has predicate. */
|
2011-07-22 17:31:52 +02:00
|
|
|
/* Skip verify of pseudo_register_read_value, has predicate. */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of pseudo_register_write, has predicate. */
|
2007-11-12 07:47:56 +01:00
|
|
|
if (gdbarch->num_regs == -1)
|
Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy
This patch starts from the desire to eliminate
make_cleanup_ui_file_delete, but then goes beyond. It makes ui_file &
friends a real C++ class hierarchy, and switches temporary
ui_file-like objects to stack-based allocation.
- mem_fileopen -> string_file
mem_fileopen is replaced with a new string_file class that is treated
as a value class created on the stack. This alone eliminates most
make_cleanup_ui_file_delete calls, and, simplifies code a whole lot
(diffstat shows around 1k loc dropped.)
string_file's internal buffer is a std::string, thus the "string" in
the name. This simplifies the implementation much, compared to
mem_fileopen, which managed growing its internal buffer manually.
- ui_file_as_string, ui_file_strdup, ui_file_obsavestring all gone
The new string_file class has a string() method that provides direct
writable access to the internal std::string buffer. This replaced
ui_file_as_string, which forced a copy of the same data the stream had
inside. With direct access via a writable reference, we can instead
move the string out of the string_stream, avoiding deep string
copying.
Related, ui_file_xstrdup calls are replaced with xstrdup'ping the
stream's string, and ui_file_obsavestring is replaced by
obstack_copy0.
With all those out of the way, getting rid of the weird ui_file_put
mechanism was possible.
- New ui_file::printf, ui_file::puts, etc. methods
These simplify / clarify client code. I considered splitting
client-code changes, like these, e.g.:
- stb = mem_fileopen ();
- fprintf_unfiltered (stb, "%s%s%s",
- _("The valid values are:\n"),
- regdesc,
- _("The default is \"std\"."));
+ string_file stb;
+ stb.printf ("%s%s%s",
+ _("The valid values are:\n"),
+ regdesc,
+ _("The default is \"std\"."));
In two steps, with the first step leaving fprintf_unfiltered (etc.)
calls in place, and only afterwards do a pass to change all those to
call stb.printf etc.. I didn't do that split, because (when I tried),
it turned out to be pointless make-work: the first pass would have to
touch the fprintf_unfiltered line anyway, to replace "stb" with
"&stb".
- gdb_fopen replaced with stack-based objects
This avoids the need for cleanups or unique_ptr's. I.e., this:
struct ui_file *file = gdb_fopen (filename, "w");
if (filename == NULL)
perror_with_name (filename);
cleanups = make_cleanup_ui_file_delete (file);
// use file.
do_cleanups (cleanups);
is replaced with this:
stdio_file file;
if (!file.open (filename, "w"))
perror_with_name (filename);
// use file.
- odd contorsions in null_file_write / null_file_fputs around when to
call to_fputs / to_write eliminated.
- Global null_stream object
A few places that were allocating a ui_file in order to print to
"nowhere" are adjusted to instead refer to a new 'null_stream' global
stream.
- TUI's tui_sfileopen eliminated. TUI's ui_file much simplified
The TUI's ui_file was serving a dual purpose. It supported being used
as string buffer, and supported being backed by a stdio FILE. The
string buffer part is gone, replaced by using of string_file. The
'FILE *' support is now much simplified, by making the TUI's ui_file
inherit from stdio_file.
gdb/ChangeLog:
2017-02-02 Pedro Alves <palves@redhat.com>
* ada-lang.c (type_as_string): Use string_file.
* ada-valprint.c (ada_print_floating): Use string_file.
* ada-varobj.c (ada_varobj_scalar_image)
(ada_varobj_get_value_image): Use string_file.
* aix-thread.c (aix_thread_extra_thread_info): Use string_file.
* arm-tdep.c (_initialize_arm_tdep): Use string_printf.
* breakpoint.c (update_inserted_breakpoint_locations)
(insert_breakpoint_locations, reattach_breakpoints)
(print_breakpoint_location, print_one_detail_ranged_breakpoint)
(print_it_watchpoint): Use string_file.
(save_breakpoints): Use stdio_file.
* c-exp.y (oper): Use string_file.
* cli/cli-logging.c (set_logging_redirect): Use ui_file_up and
tee_file.
(pop_output_files): Use delete.
(handle_redirections): Use stdio_file and tee_file.
* cli/cli-setshow.c (do_show_command): Use string_file.
* compile/compile-c-support.c (c_compute_program): Use
string_file.
* compile/compile-c-symbols.c (generate_vla_size): Take a
'string_file &' instead of a 'ui_file *'.
(generate_c_for_for_one_variable): Take a 'string_file &' instead
of a 'ui_file *'. Use string_file.
(generate_c_for_variable_locations): Take a 'string_file &'
instead of a 'ui_file *'.
* compile/compile-internal.h (generate_c_for_for_one_variable):
Take a 'string_file &' instead of a 'ui_file *'.
* compile/compile-loc2c.c (push, pushf, unary, binary)
(print_label, pushf_register_address, pushf_register)
(do_compile_dwarf_expr_to_c): Take a 'string_file &' instead of a
'ui_file *'. Adjust.
* compile/compile.c (compile_to_object): Use string_file.
* compile/compile.h (compile_dwarf_expr_to_c)
(compile_dwarf_bounds_to_c): Take a 'string_file &' instead of a
'ui_file *'.
* cp-support.c (inspect_type): Use string_file and obstack_copy0.
(replace_typedefs_qualified_name): Use string_file and
obstack_copy0.
* disasm.c (gdb_pretty_print_insn): Use string_file.
(gdb_disassembly): Adjust reference the null_stream global.
(do_ui_file_delete): Delete.
(gdb_insn_length): Use null_stream.
* dummy-frame.c (maintenance_print_dummy_frames): Use stdio_file.
* dwarf2loc.c (dwarf2_compile_property_to_c)
(locexpr_generate_c_location, loclist_generate_c_location): Take a
'string_file &' instead of a 'ui_file *'.
* dwarf2loc.h (dwarf2_compile_property_to_c): Likewise.
* dwarf2read.c (do_ui_file_peek_last): Delete.
(dwarf2_compute_name): Use string_file.
* event-top.c (gdb_setup_readline): Use stdio_file.
* gdbarch.sh (verify_gdbarch): Use string_file.
* gdbtypes.c (safe_parse_type): Use null_stream.
* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use
string_file.
* guile/scm-disasm.c (gdbscm_print_insn_from_port): Take a
'string_file *' instead of a 'ui_file *'.
(gdbscm_arch_disassemble): Use string_file.
* guile/scm-frame.c (frscm_print_frame_smob): Use string_file.
* guile/scm-ports.c (class ioscm_file_port): Now a class that
inherits from ui_file.
(ioscm_file_port_delete, ioscm_file_port_rewind)
(ioscm_file_port_put): Delete.
(ioscm_file_port_write): Rename to ...
(ioscm_file_port::write): ... this. Remove file_port_magic
checks.
(ioscm_file_port_new): Delete.
(ioscm_with_output_to_port_worker): Use ioscm_file_port and
ui_file_up.
* guile/scm-type.c (tyscm_type_name): Use string_file.
* guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print):
Use string_file.
* infcmd.c (print_return_value_1): Use string_file.
* infrun.c (print_target_wait_results): Use string_file.
* language.c (add_language): Use string_file.
* location.c (explicit_to_string_internal): Use string_file.
* main.c (captured_main_1): Use null_file.
* maint.c (maintenance_print_architecture): Use stdio_file.
* mi/mi-cmd-stack.c (list_arg_or_local): Use string_file.
* mi/mi-common.h (struct mi_interp) <out, err, log, targ,
event_channel>: Change type to mi_console_file pointer.
* mi/mi-console.c (mi_console_file_fputs, mi_console_file_flush)
(mi_console_file_delete): Delete.
(struct mi_console_file): Delete.
(mi_console_file_magic): Delete.
(mi_console_file_new): Delete.
(mi_console_file::mi_console_file): New.
(mi_console_file_delete): Delete.
(mi_console_file_fputs): Delete.
(mi_console_file::write): New.
(mi_console_raw_packet): Delete.
(mi_console_file::flush): New.
(mi_console_file_flush): Delete.
(mi_console_set_raw): Rename to ...
(mi_console_file::set_raw): ... this.
* mi/mi-console.h (class mi_console_file): New class.
(mi_console_file_new, mi_console_set_raw): Delete.
* mi/mi-interp.c (mi_interpreter_init): Use mi_console_file.
(mi_set_logging): Use delete and tee_file. Adjust.
* mi/mi-main.c (output_register): Use string_file.
(mi_cmd_data_evaluate_expression): Use string_file.
(mi_cmd_data_read_memory): Use string_file.
(mi_cmd_execute, print_variable_or_computed): Use string_file.
* mi/mi-out.c (mi_ui_out::main_stream): New.
(mi_ui_out::rewind): Use main_stream and
string_file.
(mi_ui_out::put): Use main_stream and string_file.
(mi_ui_out::mi_ui_out): Remove 'stream' parameter.
Allocate a 'string_file' instead.
(mi_out_new): Don't allocate a mem_fileopen stream here.
* mi/mi-out.h (mi_ui_out::mi_ui_out): Remove 'stream' parameter.
(mi_ui_out::main_stream): Declare method.
* printcmd.c (eval_command): Use string_file.
* psymtab.c (maintenance_print_psymbols): Use stdio_file.
* python/py-arch.c (archpy_disassemble): Use string_file.
* python/py-breakpoint.c (bppy_get_commands): Use string_file.
* python/py-frame.c (frapy_str): Use string_file.
* python/py-framefilter.c (py_print_type, py_print_single_arg):
Use string_file.
* python/py-type.c (typy_str): Use string_file.
* python/py-unwind.c (unwind_infopy_str): Use string_file.
* python/py-value.c (valpy_str): Use string_file.
* record-btrace.c (btrace_insn_history): Use string_file.
* regcache.c (regcache_print): Use stdio_file.
* reggroups.c (maintenance_print_reggroups): Use stdio_file.
* remote.c (escape_buffer): Use string_file.
* rust-lang.c (rust_get_disr_info): Use string_file.
* serial.c (serial_open_ops_1): Use stdio_file.
(do_serial_close): Use delete.
* stack.c (print_frame_arg): Use string_file.
(print_frame_args): Remove local mem_fileopen stream, not used.
(print_frame): Use string_file.
* symmisc.c (maintenance_print_symbols): Use stdio_file.
* symtab.h (struct symbol_computed_ops) <generate_c_location>:
Take a 'string_file *' instead of a 'ui_file *'.
* top.c (new_ui): Use stdio_file and stderr_file.
(free_ui): Use delete.
(execute_command_to_string): Use string_file.
(quit_confirm): Use string_file.
* tracepoint.c (collection_list::append_exp): Use string_file.
* tui/tui-disasm.c (tui_disassemble): Use string_file.
* tui/tui-file.c: Don't include "ui-file.h".
(enum streamtype, struct tui_stream): Delete.
(tui_file_new, tui_file_delete, tui_fileopen, tui_sfileopen)
(tui_file_isatty, tui_file_rewind, tui_file_put): Delete.
(tui_file::tui_file): New method.
(tui_file_fputs): Delete.
(tui_file_get_strbuf): Delete.
(tui_file::puts): New method.
(tui_file_adjust_strbuf): Delete.
(tui_file_flush): Delete.
(tui_file::flush): New method.
* tui/tui-file.h: Tweak intro comment.
Include ui-file.h.
(tui_fileopen, tui_sfileopen, tui_file_get_strbuf)
(tui_file_adjust_strbuf): Delete declarations.
(class tui_file): New class.
* tui/tui-io.c (tui_initialize_io): Use tui_file.
* tui/tui-regs.c (tui_restore_gdbout): Use delete.
(tui_register_format): Use string_stream.
* tui/tui-stack.c (tui_make_status_line): Use string_file.
(tui_get_function_from_frame): Use string_file.
* typeprint.c (type_to_string): Use string_file.
* ui-file.c (struct ui_file, ui_file_magic, ui_file_new): Delete.
(null_stream): New global.
(ui_file_delete): Delete.
(ui_file::ui_file): New.
(null_file_isatty): Delete.
(ui_file::~ui_file): New.
(null_file_rewind): Delete.
(ui_file::printf): New.
(null_file_put): Delete.
(null_file_flush): Delete.
(ui_file::putstr): New.
(null_file_write): Delete.
(ui_file::putstrn): New.
(null_file_read): Delete.
(ui_file::putc): New.
(null_file_fputs): Delete.
(null_file_write_async_safe): Delete.
(ui_file::vprintf): New.
(null_file_delete): Delete.
(null_file::write): New.
(null_file_fseek): Delete.
(null_file::puts): New.
(ui_file_data): Delete.
(null_file::write_async_safe): New.
(gdb_flush, ui_file_isatty): Adjust.
(ui_file_put, ui_file_rewind): Delete.
(ui_file_write): Adjust.
(ui_file_write_for_put): Delete.
(ui_file_write_async_safe, ui_file_read): Adjust.
(ui_file_fseek): Delete.
(fputs_unfiltered): Adjust.
(set_ui_file_flush, set_ui_file_isatty, set_ui_file_rewind)
(set_ui_file_put, set_ui_file_write, set_ui_file_write_async_safe)
(set_ui_file_read, set_ui_file_fputs, set_ui_file_fseek)
(set_ui_file_data): Delete.
(string_file::~string_file, string_file::write)
(struct accumulated_ui_file, do_ui_file_xstrdup, ui_file_xstrdup)
(do_ui_file_as_string, ui_file_as_string): Delete.
(do_ui_file_obsavestring, ui_file_obsavestring): Delete.
(struct mem_file): Delete.
(mem_file_new): Delete.
(stdio_file::stdio_file): New.
(mem_file_delete): Delete.
(stdio_file::stdio_file): New.
(mem_fileopen): Delete.
(stdio_file::~stdio_file): New.
(mem_file_rewind): Delete.
(stdio_file::set_stream): New.
(mem_file_put): Delete.
(stdio_file::open): New.
(mem_file_write): Delete.
(stdio_file_magic, struct stdio_file): Delete.
(stdio_file_new, stdio_file_delete, stdio_file_flush): Delete.
(stdio_file::flush): New.
(stdio_file_read): Rename to ...
(stdio_file::read): ... this. Adjust.
(stdio_file_write): Rename to ...
(stdio_file::write): ... this. Adjust.
(stdio_file_write_async_safe): Rename to ...
(stdio_file::write_async_safe) ... this. Adjust.
(stdio_file_fputs): Rename to ...
(stdio_file::puts) ... this. Adjust.
(stdio_file_isatty): Delete.
(stdio_file_fseek): Delete.
(stdio_file::isatty): New.
(stderr_file_write): Rename to ...
(stderr_file::write) ... this. Adjust.
(stderr_file_fputs): Rename to ...
(stderr_file::puts) ... this. Adjust.
(stderr_fileopen, stdio_fileopen, gdb_fopen): Delete.
(stderr_file::stderr_file): New.
(tee_file_magic): Delete.
(struct tee_file): Delete.
(tee_file::tee_file): New.
(tee_file_new): Delete.
(tee_file::~tee_file): New.
(tee_file_delete): Delete.
(tee_file_flush): Rename to ...
(tee_file::flush): ... this. Adjust.
(tee_file_write): Rename to ...
(tee_file::write): ... this. Adjust.
(tee_file::write_async_safe): New.
(tee_file_fputs): Rename to ...
(tee_file::puts): ... this. Adjust.
(tee_file_isatty): Rename to ...
(tee_file::isatty): ... this. Adjust.
* ui-file.h (struct obstack, struct ui_file): Don't
forward-declare.
(ui_file_new, ui_file_flush_ftype, set_ui_file_flush)
(ui_file_write_ftype)
(set_ui_file_write, ui_file_fputs_ftype, set_ui_file_fputs)
(ui_file_write_async_safe_ftype, set_ui_file_write_async_safe)
(ui_file_read_ftype, set_ui_file_read, ui_file_isatty_ftype)
(set_ui_file_isatty, ui_file_rewind_ftype, set_ui_file_rewind)
(ui_file_put_method_ftype, ui_file_put_ftype, set_ui_file_put)
(ui_file_delete_ftype, set_ui_file_data, ui_file_fseek_ftype)
(set_ui_file_fseek): Delete.
(ui_file_data, ui_file_delete, ui_file_rewind)
(struct ui_file): New.
(ui_file_up): New.
(class null_file): New.
(null_stream): Declare.
(ui_file_write_for_put, ui_file_put): Delete.
(ui_file_xstrdup, ui_file_as_string, ui_file_obsavestring):
Delete.
(ui_file_fseek, mem_fileopen, stdio_fileopen, stderr_fileopen)
(gdb_fopen, tee_file_new): Delete.
(struct string_file): New.
(struct stdio_file): New.
(stdio_file_up): New.
(struct stderr_file): New.
(class tee_file): New.
* ui-out.c (ui_out::field_stream): Take a 'string_file &' instead
of a 'ui_file *'. Adjust.
* ui-out.h (class ui_out) <field_stream>: Likewise.
* utils.c (do_ui_file_delete, make_cleanup_ui_file_delete)
(null_stream): Delete.
(error_stream): Take a 'string_file &' instead of a 'ui_file *'.
Adjust.
* utils.h (struct ui_file): Delete forward declaration..
(make_cleanup_ui_file_delete, null_stream): Delete declarations.
(error_stream): Take a 'string_file &' instead of a
'ui_file *'.
* varobj.c (varobj_value_get_print_value): Use string_file.
* xtensa-tdep.c (xtensa_verify_config): Use string_file.
* gdbarch.c: Regenerate.
2017-02-02 12:11:47 +01:00
|
|
|
log.puts ("\n\tnum_regs");
|
2000-07-24 16:25:22 +02:00
|
|
|
/* Skip verify of num_pseudo_regs, invalid_p == 0 */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of ax_pseudo_register_collect, has predicate. */
|
|
|
|
/* Skip verify of ax_pseudo_register_push_stack, has predicate. */
|
Intel MPX bound violation handling
With Intel Memory Protection Extensions it was introduced the concept of
boundary violation. A boundary violations is presented to the inferior as
a segmentation fault having SIGCODE 3. This patch adds a
handler for a boundary violation extending the information displayed
when a bound violation is presented to the inferior. In the stop mode
case the debugger will also display the kind of violation: "upper" or
"lower", bounds and the address accessed.
On no stop mode the information will still remain unchanged. Additional
information about bound violations are not meaningful in that case user
does not know the line in which violation occurred as well.
When the segmentation fault handler is stop mode the out puts will be
changed as exemplified below.
The usual output of a segfault is:
Program received signal SIGSEGV, Segmentation fault
0x0000000000400d7c in upper (p=0x603010, a=0x603030, b=0x603050,
c=0x603070, d=0x603090, len=7) at i386-mpx-sigsegv.c:68
68 value = *(p + len);
In case it is a bound violation it will be presented as:
Program received signal SIGSEGV, Segmentation fault
Upper bound violation while accessing address 0x7fffffffc3b3
Bounds: [lower = 0x7fffffffc390, upper = 0x7fffffffc3a3]
0x0000000000400d7c in upper (p=0x603010, a=0x603030, b=0x603050,
c=0x603070, d=0x603090, len=7) at i386-mpx-sigsegv.c:68
68 value = *(p + len);
In mi mode the output of a segfault is:
*stopped,reason="signal-received",signal-name="SIGSEGV",
signal-meaning="Segmentation fault", frame={addr="0x0000000000400d7c",
func="upper",args=[{name="p", value="0x603010"},{name="a",value="0x603030"}
,{name="b",value="0x603050"}, {name="c",value="0x603070"},
{name="d",value="0x603090"},{name="len",value="7"}],
file="i386-mpx-sigsegv.c",fullname="i386-mpx-sigsegv.c",line="68"},
thread-id="1",stopped-threads="all",core="6"
in the case of a bound violation:
*stopped,reason="signal-received",signal-name="SIGSEGV",
signal-meaning="Segmentation fault",
sigcode-meaning="Upper bound violation",
lower-bound="0x603010",upper-bound="0x603023",bound-access="0x60302f",
frame={addr="0x0000000000400d7c",func="upper",args=[{name="p",
value="0x603010"},{name="a",value="0x603030"},{name="b",value="0x603050"},
{name="c",value="0x603070"},{name="d",value="0x603090"},
{name="len",value="7"}],file="i386-mpx-sigsegv.c",
fullname="i386-mpx-sigsegv.c",line="68"},thread-id="1",
stopped-threads="all",core="6"
2016-02-18 Walfred Tedeschi <walfred.tedeschi@intel.com>
gdb/ChangeLog:
* NEWS: Add entry for bound violation.
* amd64-linux-tdep.c (amd64_linux_init_abi_common):
Add handler for segmentation fault.
* gdbarch.sh (handle_segmentation_fault): New.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* i386-linux-tdep.c (i386_linux_handle_segmentation_fault): New.
(SIG_CODE_BONDARY_FAULT): New define.
(i386_linux_init_abi): Use i386_mpx_bound_violation_handler.
* i386-linux-tdep.h (i386_linux_handle_segmentation_fault) New.
* i386-tdep.c (i386_mpx_enabled): Add as external.
* i386-tdep.c (i386_mpx_enabled): Add as external.
* infrun.c (handle_segmentation_fault): New function.
(print_signal_received_reason): Use handle_segmentation_fault.
gdb/testsuite/ChangeLog:
* gdb.arch/i386-mpx-sigsegv.c: New file.
* gdb.arch/i386-mpx-sigsegv.exp: New file.
* gdb.arch/i386-mpx-simple_segv.c: New file.
* gdb.arch/i386-mpx-simple_segv.exp: New file.
gdb/doc/ChangeLog:
* gdb.texinfo (Signals): Add bound violation display hints for
a SIGSEGV.
2016-02-18 17:24:59 +01:00
|
|
|
/* Skip verify of handle_segmentation_fault, has predicate. */
|
2002-04-07 04:16:46 +02:00
|
|
|
/* Skip verify of sp_regnum, invalid_p == 0 */
|
|
|
|
/* Skip verify of pc_regnum, invalid_p == 0 */
|
2002-04-06 22:50:10 +02:00
|
|
|
/* Skip verify of ps_regnum, invalid_p == 0 */
|
2000-05-10 19:38:16 +02:00
|
|
|
/* Skip verify of fp0_regnum, invalid_p == 0 */
|
2000-12-04 05:01:16 +01:00
|
|
|
/* Skip verify of stab_reg_to_regnum, invalid_p == 0 */
|
|
|
|
/* Skip verify of ecoff_reg_to_regnum, invalid_p == 0 */
|
|
|
|
/* Skip verify of sdb_reg_to_regnum, invalid_p == 0 */
|
|
|
|
/* Skip verify of dwarf2_reg_to_regnum, invalid_p == 0 */
|
2007-11-12 07:47:56 +01:00
|
|
|
if (gdbarch->register_name == 0)
|
Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy
This patch starts from the desire to eliminate
make_cleanup_ui_file_delete, but then goes beyond. It makes ui_file &
friends a real C++ class hierarchy, and switches temporary
ui_file-like objects to stack-based allocation.
- mem_fileopen -> string_file
mem_fileopen is replaced with a new string_file class that is treated
as a value class created on the stack. This alone eliminates most
make_cleanup_ui_file_delete calls, and, simplifies code a whole lot
(diffstat shows around 1k loc dropped.)
string_file's internal buffer is a std::string, thus the "string" in
the name. This simplifies the implementation much, compared to
mem_fileopen, which managed growing its internal buffer manually.
- ui_file_as_string, ui_file_strdup, ui_file_obsavestring all gone
The new string_file class has a string() method that provides direct
writable access to the internal std::string buffer. This replaced
ui_file_as_string, which forced a copy of the same data the stream had
inside. With direct access via a writable reference, we can instead
move the string out of the string_stream, avoiding deep string
copying.
Related, ui_file_xstrdup calls are replaced with xstrdup'ping the
stream's string, and ui_file_obsavestring is replaced by
obstack_copy0.
With all those out of the way, getting rid of the weird ui_file_put
mechanism was possible.
- New ui_file::printf, ui_file::puts, etc. methods
These simplify / clarify client code. I considered splitting
client-code changes, like these, e.g.:
- stb = mem_fileopen ();
- fprintf_unfiltered (stb, "%s%s%s",
- _("The valid values are:\n"),
- regdesc,
- _("The default is \"std\"."));
+ string_file stb;
+ stb.printf ("%s%s%s",
+ _("The valid values are:\n"),
+ regdesc,
+ _("The default is \"std\"."));
In two steps, with the first step leaving fprintf_unfiltered (etc.)
calls in place, and only afterwards do a pass to change all those to
call stb.printf etc.. I didn't do that split, because (when I tried),
it turned out to be pointless make-work: the first pass would have to
touch the fprintf_unfiltered line anyway, to replace "stb" with
"&stb".
- gdb_fopen replaced with stack-based objects
This avoids the need for cleanups or unique_ptr's. I.e., this:
struct ui_file *file = gdb_fopen (filename, "w");
if (filename == NULL)
perror_with_name (filename);
cleanups = make_cleanup_ui_file_delete (file);
// use file.
do_cleanups (cleanups);
is replaced with this:
stdio_file file;
if (!file.open (filename, "w"))
perror_with_name (filename);
// use file.
- odd contorsions in null_file_write / null_file_fputs around when to
call to_fputs / to_write eliminated.
- Global null_stream object
A few places that were allocating a ui_file in order to print to
"nowhere" are adjusted to instead refer to a new 'null_stream' global
stream.
- TUI's tui_sfileopen eliminated. TUI's ui_file much simplified
The TUI's ui_file was serving a dual purpose. It supported being used
as string buffer, and supported being backed by a stdio FILE. The
string buffer part is gone, replaced by using of string_file. The
'FILE *' support is now much simplified, by making the TUI's ui_file
inherit from stdio_file.
gdb/ChangeLog:
2017-02-02 Pedro Alves <palves@redhat.com>
* ada-lang.c (type_as_string): Use string_file.
* ada-valprint.c (ada_print_floating): Use string_file.
* ada-varobj.c (ada_varobj_scalar_image)
(ada_varobj_get_value_image): Use string_file.
* aix-thread.c (aix_thread_extra_thread_info): Use string_file.
* arm-tdep.c (_initialize_arm_tdep): Use string_printf.
* breakpoint.c (update_inserted_breakpoint_locations)
(insert_breakpoint_locations, reattach_breakpoints)
(print_breakpoint_location, print_one_detail_ranged_breakpoint)
(print_it_watchpoint): Use string_file.
(save_breakpoints): Use stdio_file.
* c-exp.y (oper): Use string_file.
* cli/cli-logging.c (set_logging_redirect): Use ui_file_up and
tee_file.
(pop_output_files): Use delete.
(handle_redirections): Use stdio_file and tee_file.
* cli/cli-setshow.c (do_show_command): Use string_file.
* compile/compile-c-support.c (c_compute_program): Use
string_file.
* compile/compile-c-symbols.c (generate_vla_size): Take a
'string_file &' instead of a 'ui_file *'.
(generate_c_for_for_one_variable): Take a 'string_file &' instead
of a 'ui_file *'. Use string_file.
(generate_c_for_variable_locations): Take a 'string_file &'
instead of a 'ui_file *'.
* compile/compile-internal.h (generate_c_for_for_one_variable):
Take a 'string_file &' instead of a 'ui_file *'.
* compile/compile-loc2c.c (push, pushf, unary, binary)
(print_label, pushf_register_address, pushf_register)
(do_compile_dwarf_expr_to_c): Take a 'string_file &' instead of a
'ui_file *'. Adjust.
* compile/compile.c (compile_to_object): Use string_file.
* compile/compile.h (compile_dwarf_expr_to_c)
(compile_dwarf_bounds_to_c): Take a 'string_file &' instead of a
'ui_file *'.
* cp-support.c (inspect_type): Use string_file and obstack_copy0.
(replace_typedefs_qualified_name): Use string_file and
obstack_copy0.
* disasm.c (gdb_pretty_print_insn): Use string_file.
(gdb_disassembly): Adjust reference the null_stream global.
(do_ui_file_delete): Delete.
(gdb_insn_length): Use null_stream.
* dummy-frame.c (maintenance_print_dummy_frames): Use stdio_file.
* dwarf2loc.c (dwarf2_compile_property_to_c)
(locexpr_generate_c_location, loclist_generate_c_location): Take a
'string_file &' instead of a 'ui_file *'.
* dwarf2loc.h (dwarf2_compile_property_to_c): Likewise.
* dwarf2read.c (do_ui_file_peek_last): Delete.
(dwarf2_compute_name): Use string_file.
* event-top.c (gdb_setup_readline): Use stdio_file.
* gdbarch.sh (verify_gdbarch): Use string_file.
* gdbtypes.c (safe_parse_type): Use null_stream.
* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use
string_file.
* guile/scm-disasm.c (gdbscm_print_insn_from_port): Take a
'string_file *' instead of a 'ui_file *'.
(gdbscm_arch_disassemble): Use string_file.
* guile/scm-frame.c (frscm_print_frame_smob): Use string_file.
* guile/scm-ports.c (class ioscm_file_port): Now a class that
inherits from ui_file.
(ioscm_file_port_delete, ioscm_file_port_rewind)
(ioscm_file_port_put): Delete.
(ioscm_file_port_write): Rename to ...
(ioscm_file_port::write): ... this. Remove file_port_magic
checks.
(ioscm_file_port_new): Delete.
(ioscm_with_output_to_port_worker): Use ioscm_file_port and
ui_file_up.
* guile/scm-type.c (tyscm_type_name): Use string_file.
* guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print):
Use string_file.
* infcmd.c (print_return_value_1): Use string_file.
* infrun.c (print_target_wait_results): Use string_file.
* language.c (add_language): Use string_file.
* location.c (explicit_to_string_internal): Use string_file.
* main.c (captured_main_1): Use null_file.
* maint.c (maintenance_print_architecture): Use stdio_file.
* mi/mi-cmd-stack.c (list_arg_or_local): Use string_file.
* mi/mi-common.h (struct mi_interp) <out, err, log, targ,
event_channel>: Change type to mi_console_file pointer.
* mi/mi-console.c (mi_console_file_fputs, mi_console_file_flush)
(mi_console_file_delete): Delete.
(struct mi_console_file): Delete.
(mi_console_file_magic): Delete.
(mi_console_file_new): Delete.
(mi_console_file::mi_console_file): New.
(mi_console_file_delete): Delete.
(mi_console_file_fputs): Delete.
(mi_console_file::write): New.
(mi_console_raw_packet): Delete.
(mi_console_file::flush): New.
(mi_console_file_flush): Delete.
(mi_console_set_raw): Rename to ...
(mi_console_file::set_raw): ... this.
* mi/mi-console.h (class mi_console_file): New class.
(mi_console_file_new, mi_console_set_raw): Delete.
* mi/mi-interp.c (mi_interpreter_init): Use mi_console_file.
(mi_set_logging): Use delete and tee_file. Adjust.
* mi/mi-main.c (output_register): Use string_file.
(mi_cmd_data_evaluate_expression): Use string_file.
(mi_cmd_data_read_memory): Use string_file.
(mi_cmd_execute, print_variable_or_computed): Use string_file.
* mi/mi-out.c (mi_ui_out::main_stream): New.
(mi_ui_out::rewind): Use main_stream and
string_file.
(mi_ui_out::put): Use main_stream and string_file.
(mi_ui_out::mi_ui_out): Remove 'stream' parameter.
Allocate a 'string_file' instead.
(mi_out_new): Don't allocate a mem_fileopen stream here.
* mi/mi-out.h (mi_ui_out::mi_ui_out): Remove 'stream' parameter.
(mi_ui_out::main_stream): Declare method.
* printcmd.c (eval_command): Use string_file.
* psymtab.c (maintenance_print_psymbols): Use stdio_file.
* python/py-arch.c (archpy_disassemble): Use string_file.
* python/py-breakpoint.c (bppy_get_commands): Use string_file.
* python/py-frame.c (frapy_str): Use string_file.
* python/py-framefilter.c (py_print_type, py_print_single_arg):
Use string_file.
* python/py-type.c (typy_str): Use string_file.
* python/py-unwind.c (unwind_infopy_str): Use string_file.
* python/py-value.c (valpy_str): Use string_file.
* record-btrace.c (btrace_insn_history): Use string_file.
* regcache.c (regcache_print): Use stdio_file.
* reggroups.c (maintenance_print_reggroups): Use stdio_file.
* remote.c (escape_buffer): Use string_file.
* rust-lang.c (rust_get_disr_info): Use string_file.
* serial.c (serial_open_ops_1): Use stdio_file.
(do_serial_close): Use delete.
* stack.c (print_frame_arg): Use string_file.
(print_frame_args): Remove local mem_fileopen stream, not used.
(print_frame): Use string_file.
* symmisc.c (maintenance_print_symbols): Use stdio_file.
* symtab.h (struct symbol_computed_ops) <generate_c_location>:
Take a 'string_file *' instead of a 'ui_file *'.
* top.c (new_ui): Use stdio_file and stderr_file.
(free_ui): Use delete.
(execute_command_to_string): Use string_file.
(quit_confirm): Use string_file.
* tracepoint.c (collection_list::append_exp): Use string_file.
* tui/tui-disasm.c (tui_disassemble): Use string_file.
* tui/tui-file.c: Don't include "ui-file.h".
(enum streamtype, struct tui_stream): Delete.
(tui_file_new, tui_file_delete, tui_fileopen, tui_sfileopen)
(tui_file_isatty, tui_file_rewind, tui_file_put): Delete.
(tui_file::tui_file): New method.
(tui_file_fputs): Delete.
(tui_file_get_strbuf): Delete.
(tui_file::puts): New method.
(tui_file_adjust_strbuf): Delete.
(tui_file_flush): Delete.
(tui_file::flush): New method.
* tui/tui-file.h: Tweak intro comment.
Include ui-file.h.
(tui_fileopen, tui_sfileopen, tui_file_get_strbuf)
(tui_file_adjust_strbuf): Delete declarations.
(class tui_file): New class.
* tui/tui-io.c (tui_initialize_io): Use tui_file.
* tui/tui-regs.c (tui_restore_gdbout): Use delete.
(tui_register_format): Use string_stream.
* tui/tui-stack.c (tui_make_status_line): Use string_file.
(tui_get_function_from_frame): Use string_file.
* typeprint.c (type_to_string): Use string_file.
* ui-file.c (struct ui_file, ui_file_magic, ui_file_new): Delete.
(null_stream): New global.
(ui_file_delete): Delete.
(ui_file::ui_file): New.
(null_file_isatty): Delete.
(ui_file::~ui_file): New.
(null_file_rewind): Delete.
(ui_file::printf): New.
(null_file_put): Delete.
(null_file_flush): Delete.
(ui_file::putstr): New.
(null_file_write): Delete.
(ui_file::putstrn): New.
(null_file_read): Delete.
(ui_file::putc): New.
(null_file_fputs): Delete.
(null_file_write_async_safe): Delete.
(ui_file::vprintf): New.
(null_file_delete): Delete.
(null_file::write): New.
(null_file_fseek): Delete.
(null_file::puts): New.
(ui_file_data): Delete.
(null_file::write_async_safe): New.
(gdb_flush, ui_file_isatty): Adjust.
(ui_file_put, ui_file_rewind): Delete.
(ui_file_write): Adjust.
(ui_file_write_for_put): Delete.
(ui_file_write_async_safe, ui_file_read): Adjust.
(ui_file_fseek): Delete.
(fputs_unfiltered): Adjust.
(set_ui_file_flush, set_ui_file_isatty, set_ui_file_rewind)
(set_ui_file_put, set_ui_file_write, set_ui_file_write_async_safe)
(set_ui_file_read, set_ui_file_fputs, set_ui_file_fseek)
(set_ui_file_data): Delete.
(string_file::~string_file, string_file::write)
(struct accumulated_ui_file, do_ui_file_xstrdup, ui_file_xstrdup)
(do_ui_file_as_string, ui_file_as_string): Delete.
(do_ui_file_obsavestring, ui_file_obsavestring): Delete.
(struct mem_file): Delete.
(mem_file_new): Delete.
(stdio_file::stdio_file): New.
(mem_file_delete): Delete.
(stdio_file::stdio_file): New.
(mem_fileopen): Delete.
(stdio_file::~stdio_file): New.
(mem_file_rewind): Delete.
(stdio_file::set_stream): New.
(mem_file_put): Delete.
(stdio_file::open): New.
(mem_file_write): Delete.
(stdio_file_magic, struct stdio_file): Delete.
(stdio_file_new, stdio_file_delete, stdio_file_flush): Delete.
(stdio_file::flush): New.
(stdio_file_read): Rename to ...
(stdio_file::read): ... this. Adjust.
(stdio_file_write): Rename to ...
(stdio_file::write): ... this. Adjust.
(stdio_file_write_async_safe): Rename to ...
(stdio_file::write_async_safe) ... this. Adjust.
(stdio_file_fputs): Rename to ...
(stdio_file::puts) ... this. Adjust.
(stdio_file_isatty): Delete.
(stdio_file_fseek): Delete.
(stdio_file::isatty): New.
(stderr_file_write): Rename to ...
(stderr_file::write) ... this. Adjust.
(stderr_file_fputs): Rename to ...
(stderr_file::puts) ... this. Adjust.
(stderr_fileopen, stdio_fileopen, gdb_fopen): Delete.
(stderr_file::stderr_file): New.
(tee_file_magic): Delete.
(struct tee_file): Delete.
(tee_file::tee_file): New.
(tee_file_new): Delete.
(tee_file::~tee_file): New.
(tee_file_delete): Delete.
(tee_file_flush): Rename to ...
(tee_file::flush): ... this. Adjust.
(tee_file_write): Rename to ...
(tee_file::write): ... this. Adjust.
(tee_file::write_async_safe): New.
(tee_file_fputs): Rename to ...
(tee_file::puts): ... this. Adjust.
(tee_file_isatty): Rename to ...
(tee_file::isatty): ... this. Adjust.
* ui-file.h (struct obstack, struct ui_file): Don't
forward-declare.
(ui_file_new, ui_file_flush_ftype, set_ui_file_flush)
(ui_file_write_ftype)
(set_ui_file_write, ui_file_fputs_ftype, set_ui_file_fputs)
(ui_file_write_async_safe_ftype, set_ui_file_write_async_safe)
(ui_file_read_ftype, set_ui_file_read, ui_file_isatty_ftype)
(set_ui_file_isatty, ui_file_rewind_ftype, set_ui_file_rewind)
(ui_file_put_method_ftype, ui_file_put_ftype, set_ui_file_put)
(ui_file_delete_ftype, set_ui_file_data, ui_file_fseek_ftype)
(set_ui_file_fseek): Delete.
(ui_file_data, ui_file_delete, ui_file_rewind)
(struct ui_file): New.
(ui_file_up): New.
(class null_file): New.
(null_stream): Declare.
(ui_file_write_for_put, ui_file_put): Delete.
(ui_file_xstrdup, ui_file_as_string, ui_file_obsavestring):
Delete.
(ui_file_fseek, mem_fileopen, stdio_fileopen, stderr_fileopen)
(gdb_fopen, tee_file_new): Delete.
(struct string_file): New.
(struct stdio_file): New.
(stdio_file_up): New.
(struct stderr_file): New.
(class tee_file): New.
* ui-out.c (ui_out::field_stream): Take a 'string_file &' instead
of a 'ui_file *'. Adjust.
* ui-out.h (class ui_out) <field_stream>: Likewise.
* utils.c (do_ui_file_delete, make_cleanup_ui_file_delete)
(null_stream): Delete.
(error_stream): Take a 'string_file &' instead of a 'ui_file *'.
Adjust.
* utils.h (struct ui_file): Delete forward declaration..
(make_cleanup_ui_file_delete, null_stream): Delete declarations.
(error_stream): Take a 'string_file &' instead of a
'ui_file *'.
* varobj.c (varobj_value_get_print_value): Use string_file.
* xtensa-tdep.c (xtensa_verify_config): Use string_file.
* gdbarch.c: Regenerate.
2017-02-02 12:11:47 +01:00
|
|
|
log.puts ("\n\tregister_name");
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of register_type, has predicate. */
|
|
|
|
/* Skip verify of dummy_id, has predicate. */
|
2003-06-14 00:18:49 +02:00
|
|
|
/* Skip verify of deprecated_fp_regnum, invalid_p == 0 */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of push_dummy_call, has predicate. */
|
2003-06-14 01:07:06 +02:00
|
|
|
/* Skip verify of call_dummy_location, invalid_p == 0 */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of push_dummy_code, has predicate. */
|
Skip unwritable frames in command "finish"
Nowadays, GDB can't insert breakpoint on the return address of the
exception handler on ARM M-profile, because the address is a magic
one 0xfffffff9,
(gdb) bt
#0 CT32B1_IRQHandler () at ../src/timer.c:67
#1 <signal handler called>
#2 main () at ../src/timer.c:127
(gdb) info frame
Stack level 0, frame at 0x200ffa8:
pc = 0x4ec in CT32B1_IRQHandler (../src/timer.c:67); saved pc = 0xfffffff9
called by frame at 0x200ffc8
source language c.
Arglist at 0x200ffa0, args:
Locals at 0x200ffa0, Previous frame's sp is 0x200ffa8
Saved registers:
r7 at 0x200ffa0, lr at 0x200ffa4
(gdb) x/x 0xfffffff9
0xfffffff9: Cannot access memory at address 0xfffffff9
(gdb) finish
Run till exit from #0 CT32B1_IRQHandler () at ../src/timer.c:67
Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?)
Warning:
Cannot insert hardware breakpoint 0.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.
Command aborted.
even some debug probe can't set hardware breakpoint on the magic
address too,
(gdb) hbreak *0xfffffff9
Hardware assisted breakpoint 2 at 0xfffffff9
(gdb) c
Continuing.
Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?)
Warning:
Cannot insert hardware breakpoint 2.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.
Command aborted.
The problem described above is quite similar to PR 8841, in which GDB
can't set breakpoint on signal trampoline, which is mapped to a read-only
page by kernel. The rationale of this patch is to skip "unwritable"
frames when looking for caller frames in command "finish", and a new
gdbarch method code_of_frame_writable is added. This patch fixes
the problem on ARM cortex-m target, but it can be used to fix
PR 8841 too.
gdb:
2016-05-10 Yao Qi <yao.qi@arm.com>
* arch-utils.c (default_code_of_frame_writable): New function.
* arch-utils.h (default_code_of_frame_writable): Declare.
* arm-tdep.c (arm_code_of_frame_writable): New function.
(arm_gdbarch_init): Install gdbarch method
code_of_frame_writable if the target is M-profile.
* frame.c (skip_unwritable_frames): New function.
* frame.h (skip_unwritable_frames): Declare.
* gdbarch.sh (code_of_frame_writable): New.
* gdbarch.c, gdbarch.h: Re-generated.
* infcmd.c (finish_command): Call skip_unwritable_frames.
2016-05-23 18:32:56 +02:00
|
|
|
/* Skip verify of code_of_frame_writable, invalid_p == 0 */
|
2002-08-21 18:34:10 +02:00
|
|
|
/* Skip verify of print_registers_info, invalid_p == 0 */
|
2014-12-18 13:47:28 +01:00
|
|
|
/* Skip verify of print_float_info, invalid_p == 0 */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of print_vector_info, has predicate. */
|
2000-08-02 13:05:50 +02:00
|
|
|
/* Skip verify of register_sim_regno, invalid_p == 0 */
|
2001-06-16 01:50:46 +02:00
|
|
|
/* Skip verify of cannot_fetch_register, invalid_p == 0 */
|
|
|
|
/* Skip verify of cannot_store_register, invalid_p == 0 */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of get_longjmp_target, has predicate. */
|
2002-05-12 05:09:12 +02:00
|
|
|
/* Skip verify of convert_register_p, invalid_p == 0 */
|
2007-01-08 21:03:49 +01:00
|
|
|
/* Skip verify of value_from_register, invalid_p == 0 */
|
* 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.
2000-04-14 20:43:41 +02:00
|
|
|
/* Skip verify of pointer_to_address, invalid_p == 0 */
|
|
|
|
/* Skip verify of address_to_pointer, invalid_p == 0 */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of integer_to_address, has predicate. */
|
|
|
|
/* Skip verify of return_value, has predicate. */
|
2012-06-08 16:24:57 +02:00
|
|
|
/* Skip verify of return_in_first_hidden_param_p, invalid_p == 0 */
|
2007-11-12 07:47:56 +01:00
|
|
|
if (gdbarch->skip_prologue == 0)
|
Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy
This patch starts from the desire to eliminate
make_cleanup_ui_file_delete, but then goes beyond. It makes ui_file &
friends a real C++ class hierarchy, and switches temporary
ui_file-like objects to stack-based allocation.
- mem_fileopen -> string_file
mem_fileopen is replaced with a new string_file class that is treated
as a value class created on the stack. This alone eliminates most
make_cleanup_ui_file_delete calls, and, simplifies code a whole lot
(diffstat shows around 1k loc dropped.)
string_file's internal buffer is a std::string, thus the "string" in
the name. This simplifies the implementation much, compared to
mem_fileopen, which managed growing its internal buffer manually.
- ui_file_as_string, ui_file_strdup, ui_file_obsavestring all gone
The new string_file class has a string() method that provides direct
writable access to the internal std::string buffer. This replaced
ui_file_as_string, which forced a copy of the same data the stream had
inside. With direct access via a writable reference, we can instead
move the string out of the string_stream, avoiding deep string
copying.
Related, ui_file_xstrdup calls are replaced with xstrdup'ping the
stream's string, and ui_file_obsavestring is replaced by
obstack_copy0.
With all those out of the way, getting rid of the weird ui_file_put
mechanism was possible.
- New ui_file::printf, ui_file::puts, etc. methods
These simplify / clarify client code. I considered splitting
client-code changes, like these, e.g.:
- stb = mem_fileopen ();
- fprintf_unfiltered (stb, "%s%s%s",
- _("The valid values are:\n"),
- regdesc,
- _("The default is \"std\"."));
+ string_file stb;
+ stb.printf ("%s%s%s",
+ _("The valid values are:\n"),
+ regdesc,
+ _("The default is \"std\"."));
In two steps, with the first step leaving fprintf_unfiltered (etc.)
calls in place, and only afterwards do a pass to change all those to
call stb.printf etc.. I didn't do that split, because (when I tried),
it turned out to be pointless make-work: the first pass would have to
touch the fprintf_unfiltered line anyway, to replace "stb" with
"&stb".
- gdb_fopen replaced with stack-based objects
This avoids the need for cleanups or unique_ptr's. I.e., this:
struct ui_file *file = gdb_fopen (filename, "w");
if (filename == NULL)
perror_with_name (filename);
cleanups = make_cleanup_ui_file_delete (file);
// use file.
do_cleanups (cleanups);
is replaced with this:
stdio_file file;
if (!file.open (filename, "w"))
perror_with_name (filename);
// use file.
- odd contorsions in null_file_write / null_file_fputs around when to
call to_fputs / to_write eliminated.
- Global null_stream object
A few places that were allocating a ui_file in order to print to
"nowhere" are adjusted to instead refer to a new 'null_stream' global
stream.
- TUI's tui_sfileopen eliminated. TUI's ui_file much simplified
The TUI's ui_file was serving a dual purpose. It supported being used
as string buffer, and supported being backed by a stdio FILE. The
string buffer part is gone, replaced by using of string_file. The
'FILE *' support is now much simplified, by making the TUI's ui_file
inherit from stdio_file.
gdb/ChangeLog:
2017-02-02 Pedro Alves <palves@redhat.com>
* ada-lang.c (type_as_string): Use string_file.
* ada-valprint.c (ada_print_floating): Use string_file.
* ada-varobj.c (ada_varobj_scalar_image)
(ada_varobj_get_value_image): Use string_file.
* aix-thread.c (aix_thread_extra_thread_info): Use string_file.
* arm-tdep.c (_initialize_arm_tdep): Use string_printf.
* breakpoint.c (update_inserted_breakpoint_locations)
(insert_breakpoint_locations, reattach_breakpoints)
(print_breakpoint_location, print_one_detail_ranged_breakpoint)
(print_it_watchpoint): Use string_file.
(save_breakpoints): Use stdio_file.
* c-exp.y (oper): Use string_file.
* cli/cli-logging.c (set_logging_redirect): Use ui_file_up and
tee_file.
(pop_output_files): Use delete.
(handle_redirections): Use stdio_file and tee_file.
* cli/cli-setshow.c (do_show_command): Use string_file.
* compile/compile-c-support.c (c_compute_program): Use
string_file.
* compile/compile-c-symbols.c (generate_vla_size): Take a
'string_file &' instead of a 'ui_file *'.
(generate_c_for_for_one_variable): Take a 'string_file &' instead
of a 'ui_file *'. Use string_file.
(generate_c_for_variable_locations): Take a 'string_file &'
instead of a 'ui_file *'.
* compile/compile-internal.h (generate_c_for_for_one_variable):
Take a 'string_file &' instead of a 'ui_file *'.
* compile/compile-loc2c.c (push, pushf, unary, binary)
(print_label, pushf_register_address, pushf_register)
(do_compile_dwarf_expr_to_c): Take a 'string_file &' instead of a
'ui_file *'. Adjust.
* compile/compile.c (compile_to_object): Use string_file.
* compile/compile.h (compile_dwarf_expr_to_c)
(compile_dwarf_bounds_to_c): Take a 'string_file &' instead of a
'ui_file *'.
* cp-support.c (inspect_type): Use string_file and obstack_copy0.
(replace_typedefs_qualified_name): Use string_file and
obstack_copy0.
* disasm.c (gdb_pretty_print_insn): Use string_file.
(gdb_disassembly): Adjust reference the null_stream global.
(do_ui_file_delete): Delete.
(gdb_insn_length): Use null_stream.
* dummy-frame.c (maintenance_print_dummy_frames): Use stdio_file.
* dwarf2loc.c (dwarf2_compile_property_to_c)
(locexpr_generate_c_location, loclist_generate_c_location): Take a
'string_file &' instead of a 'ui_file *'.
* dwarf2loc.h (dwarf2_compile_property_to_c): Likewise.
* dwarf2read.c (do_ui_file_peek_last): Delete.
(dwarf2_compute_name): Use string_file.
* event-top.c (gdb_setup_readline): Use stdio_file.
* gdbarch.sh (verify_gdbarch): Use string_file.
* gdbtypes.c (safe_parse_type): Use null_stream.
* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use
string_file.
* guile/scm-disasm.c (gdbscm_print_insn_from_port): Take a
'string_file *' instead of a 'ui_file *'.
(gdbscm_arch_disassemble): Use string_file.
* guile/scm-frame.c (frscm_print_frame_smob): Use string_file.
* guile/scm-ports.c (class ioscm_file_port): Now a class that
inherits from ui_file.
(ioscm_file_port_delete, ioscm_file_port_rewind)
(ioscm_file_port_put): Delete.
(ioscm_file_port_write): Rename to ...
(ioscm_file_port::write): ... this. Remove file_port_magic
checks.
(ioscm_file_port_new): Delete.
(ioscm_with_output_to_port_worker): Use ioscm_file_port and
ui_file_up.
* guile/scm-type.c (tyscm_type_name): Use string_file.
* guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print):
Use string_file.
* infcmd.c (print_return_value_1): Use string_file.
* infrun.c (print_target_wait_results): Use string_file.
* language.c (add_language): Use string_file.
* location.c (explicit_to_string_internal): Use string_file.
* main.c (captured_main_1): Use null_file.
* maint.c (maintenance_print_architecture): Use stdio_file.
* mi/mi-cmd-stack.c (list_arg_or_local): Use string_file.
* mi/mi-common.h (struct mi_interp) <out, err, log, targ,
event_channel>: Change type to mi_console_file pointer.
* mi/mi-console.c (mi_console_file_fputs, mi_console_file_flush)
(mi_console_file_delete): Delete.
(struct mi_console_file): Delete.
(mi_console_file_magic): Delete.
(mi_console_file_new): Delete.
(mi_console_file::mi_console_file): New.
(mi_console_file_delete): Delete.
(mi_console_file_fputs): Delete.
(mi_console_file::write): New.
(mi_console_raw_packet): Delete.
(mi_console_file::flush): New.
(mi_console_file_flush): Delete.
(mi_console_set_raw): Rename to ...
(mi_console_file::set_raw): ... this.
* mi/mi-console.h (class mi_console_file): New class.
(mi_console_file_new, mi_console_set_raw): Delete.
* mi/mi-interp.c (mi_interpreter_init): Use mi_console_file.
(mi_set_logging): Use delete and tee_file. Adjust.
* mi/mi-main.c (output_register): Use string_file.
(mi_cmd_data_evaluate_expression): Use string_file.
(mi_cmd_data_read_memory): Use string_file.
(mi_cmd_execute, print_variable_or_computed): Use string_file.
* mi/mi-out.c (mi_ui_out::main_stream): New.
(mi_ui_out::rewind): Use main_stream and
string_file.
(mi_ui_out::put): Use main_stream and string_file.
(mi_ui_out::mi_ui_out): Remove 'stream' parameter.
Allocate a 'string_file' instead.
(mi_out_new): Don't allocate a mem_fileopen stream here.
* mi/mi-out.h (mi_ui_out::mi_ui_out): Remove 'stream' parameter.
(mi_ui_out::main_stream): Declare method.
* printcmd.c (eval_command): Use string_file.
* psymtab.c (maintenance_print_psymbols): Use stdio_file.
* python/py-arch.c (archpy_disassemble): Use string_file.
* python/py-breakpoint.c (bppy_get_commands): Use string_file.
* python/py-frame.c (frapy_str): Use string_file.
* python/py-framefilter.c (py_print_type, py_print_single_arg):
Use string_file.
* python/py-type.c (typy_str): Use string_file.
* python/py-unwind.c (unwind_infopy_str): Use string_file.
* python/py-value.c (valpy_str): Use string_file.
* record-btrace.c (btrace_insn_history): Use string_file.
* regcache.c (regcache_print): Use stdio_file.
* reggroups.c (maintenance_print_reggroups): Use stdio_file.
* remote.c (escape_buffer): Use string_file.
* rust-lang.c (rust_get_disr_info): Use string_file.
* serial.c (serial_open_ops_1): Use stdio_file.
(do_serial_close): Use delete.
* stack.c (print_frame_arg): Use string_file.
(print_frame_args): Remove local mem_fileopen stream, not used.
(print_frame): Use string_file.
* symmisc.c (maintenance_print_symbols): Use stdio_file.
* symtab.h (struct symbol_computed_ops) <generate_c_location>:
Take a 'string_file *' instead of a 'ui_file *'.
* top.c (new_ui): Use stdio_file and stderr_file.
(free_ui): Use delete.
(execute_command_to_string): Use string_file.
(quit_confirm): Use string_file.
* tracepoint.c (collection_list::append_exp): Use string_file.
* tui/tui-disasm.c (tui_disassemble): Use string_file.
* tui/tui-file.c: Don't include "ui-file.h".
(enum streamtype, struct tui_stream): Delete.
(tui_file_new, tui_file_delete, tui_fileopen, tui_sfileopen)
(tui_file_isatty, tui_file_rewind, tui_file_put): Delete.
(tui_file::tui_file): New method.
(tui_file_fputs): Delete.
(tui_file_get_strbuf): Delete.
(tui_file::puts): New method.
(tui_file_adjust_strbuf): Delete.
(tui_file_flush): Delete.
(tui_file::flush): New method.
* tui/tui-file.h: Tweak intro comment.
Include ui-file.h.
(tui_fileopen, tui_sfileopen, tui_file_get_strbuf)
(tui_file_adjust_strbuf): Delete declarations.
(class tui_file): New class.
* tui/tui-io.c (tui_initialize_io): Use tui_file.
* tui/tui-regs.c (tui_restore_gdbout): Use delete.
(tui_register_format): Use string_stream.
* tui/tui-stack.c (tui_make_status_line): Use string_file.
(tui_get_function_from_frame): Use string_file.
* typeprint.c (type_to_string): Use string_file.
* ui-file.c (struct ui_file, ui_file_magic, ui_file_new): Delete.
(null_stream): New global.
(ui_file_delete): Delete.
(ui_file::ui_file): New.
(null_file_isatty): Delete.
(ui_file::~ui_file): New.
(null_file_rewind): Delete.
(ui_file::printf): New.
(null_file_put): Delete.
(null_file_flush): Delete.
(ui_file::putstr): New.
(null_file_write): Delete.
(ui_file::putstrn): New.
(null_file_read): Delete.
(ui_file::putc): New.
(null_file_fputs): Delete.
(null_file_write_async_safe): Delete.
(ui_file::vprintf): New.
(null_file_delete): Delete.
(null_file::write): New.
(null_file_fseek): Delete.
(null_file::puts): New.
(ui_file_data): Delete.
(null_file::write_async_safe): New.
(gdb_flush, ui_file_isatty): Adjust.
(ui_file_put, ui_file_rewind): Delete.
(ui_file_write): Adjust.
(ui_file_write_for_put): Delete.
(ui_file_write_async_safe, ui_file_read): Adjust.
(ui_file_fseek): Delete.
(fputs_unfiltered): Adjust.
(set_ui_file_flush, set_ui_file_isatty, set_ui_file_rewind)
(set_ui_file_put, set_ui_file_write, set_ui_file_write_async_safe)
(set_ui_file_read, set_ui_file_fputs, set_ui_file_fseek)
(set_ui_file_data): Delete.
(string_file::~string_file, string_file::write)
(struct accumulated_ui_file, do_ui_file_xstrdup, ui_file_xstrdup)
(do_ui_file_as_string, ui_file_as_string): Delete.
(do_ui_file_obsavestring, ui_file_obsavestring): Delete.
(struct mem_file): Delete.
(mem_file_new): Delete.
(stdio_file::stdio_file): New.
(mem_file_delete): Delete.
(stdio_file::stdio_file): New.
(mem_fileopen): Delete.
(stdio_file::~stdio_file): New.
(mem_file_rewind): Delete.
(stdio_file::set_stream): New.
(mem_file_put): Delete.
(stdio_file::open): New.
(mem_file_write): Delete.
(stdio_file_magic, struct stdio_file): Delete.
(stdio_file_new, stdio_file_delete, stdio_file_flush): Delete.
(stdio_file::flush): New.
(stdio_file_read): Rename to ...
(stdio_file::read): ... this. Adjust.
(stdio_file_write): Rename to ...
(stdio_file::write): ... this. Adjust.
(stdio_file_write_async_safe): Rename to ...
(stdio_file::write_async_safe) ... this. Adjust.
(stdio_file_fputs): Rename to ...
(stdio_file::puts) ... this. Adjust.
(stdio_file_isatty): Delete.
(stdio_file_fseek): Delete.
(stdio_file::isatty): New.
(stderr_file_write): Rename to ...
(stderr_file::write) ... this. Adjust.
(stderr_file_fputs): Rename to ...
(stderr_file::puts) ... this. Adjust.
(stderr_fileopen, stdio_fileopen, gdb_fopen): Delete.
(stderr_file::stderr_file): New.
(tee_file_magic): Delete.
(struct tee_file): Delete.
(tee_file::tee_file): New.
(tee_file_new): Delete.
(tee_file::~tee_file): New.
(tee_file_delete): Delete.
(tee_file_flush): Rename to ...
(tee_file::flush): ... this. Adjust.
(tee_file_write): Rename to ...
(tee_file::write): ... this. Adjust.
(tee_file::write_async_safe): New.
(tee_file_fputs): Rename to ...
(tee_file::puts): ... this. Adjust.
(tee_file_isatty): Rename to ...
(tee_file::isatty): ... this. Adjust.
* ui-file.h (struct obstack, struct ui_file): Don't
forward-declare.
(ui_file_new, ui_file_flush_ftype, set_ui_file_flush)
(ui_file_write_ftype)
(set_ui_file_write, ui_file_fputs_ftype, set_ui_file_fputs)
(ui_file_write_async_safe_ftype, set_ui_file_write_async_safe)
(ui_file_read_ftype, set_ui_file_read, ui_file_isatty_ftype)
(set_ui_file_isatty, ui_file_rewind_ftype, set_ui_file_rewind)
(ui_file_put_method_ftype, ui_file_put_ftype, set_ui_file_put)
(ui_file_delete_ftype, set_ui_file_data, ui_file_fseek_ftype)
(set_ui_file_fseek): Delete.
(ui_file_data, ui_file_delete, ui_file_rewind)
(struct ui_file): New.
(ui_file_up): New.
(class null_file): New.
(null_stream): Declare.
(ui_file_write_for_put, ui_file_put): Delete.
(ui_file_xstrdup, ui_file_as_string, ui_file_obsavestring):
Delete.
(ui_file_fseek, mem_fileopen, stdio_fileopen, stderr_fileopen)
(gdb_fopen, tee_file_new): Delete.
(struct string_file): New.
(struct stdio_file): New.
(stdio_file_up): New.
(struct stderr_file): New.
(class tee_file): New.
* ui-out.c (ui_out::field_stream): Take a 'string_file &' instead
of a 'ui_file *'. Adjust.
* ui-out.h (class ui_out) <field_stream>: Likewise.
* utils.c (do_ui_file_delete, make_cleanup_ui_file_delete)
(null_stream): Delete.
(error_stream): Take a 'string_file &' instead of a 'ui_file *'.
Adjust.
* utils.h (struct ui_file): Delete forward declaration..
(make_cleanup_ui_file_delete, null_stream): Delete declarations.
(error_stream): Take a 'string_file &' instead of a
'ui_file *'.
* varobj.c (varobj_value_get_print_value): Use string_file.
* xtensa-tdep.c (xtensa_verify_config): Use string_file.
* gdbarch.c: Regenerate.
2017-02-02 12:11:47 +01:00
|
|
|
log.puts ("\n\tskip_prologue");
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of skip_main_prologue, has predicate. */
|
PowerPC64 ELFv2 ABI: skip global entry point code
This patch handles another aspect of the ELFv2 ABI, which unfortunately
requires common code changes.
In ELFv2, functions may provide both a global and a local entry point.
The global entry point (where the function symbol points to) is intended
to be used for function-pointer or cross-module (PLT) calls, and requires
r12 to be set up to the entry point address itself. The local entry
point (which is found at a fixed offset after the global entry point,
as defined by bits in the symbol table entries' st_other field), instead
expects r2 to be set up to the current TOC.
Now, when setting a breakpoint on a function by name, you really want
that breakpoint to trigger either way, no matter whether the function
is called via its local or global entry point. Since the global entry
point will always fall through into the local entry point, the way to
achieve that is to simply set the breakpoint at the local entry point.
One way to do that would be to have prologue parsing skip the code
sequence that makes up the global entry point. Unfortunately, this
does not work reliably, since -for optimized code- GDB these days
will not actuall invoke the prologue parsing code but instead just
set the breakpoint at the symbol address and rely on DWARF being
correct at any point throughout the function ...
Unfortunately, I don't really see any way to express the notion of
local entry points with the current set of gdbarch callbacks.
Thus this patch adds a new callback, skip_entrypoint, that is
somewhat analogous to skip_prologue, but is called every time
GDB needs to determine a function start address, even in those
cases where GDB decides to not call skip_prologue.
As a side effect, the skip_entrypoint implementation on ppc64
does not need to perform any instruction parsing; it can simply
rely on the local entry point flags in the symbol table entry.
With this implemented, two test cases would still fail to set
the breakpoint correctly, but that's because they use the construct:
gdb_test "break *hello"
Now, using "*hello" explicitly instructs GDB to set the breakpoint
at the numerical value of "hello" treated as function pointer, so
it will by definition only hit the global entry point.
I think this behaviour is unavoidable, but acceptable -- most people
do not use this construct, and if they do, they get what they
asked for ...
In one of those two test cases, use of this construct is really
not appropriate. I think this was added way back when as a means
to work around prologue skipping problems on some platforms. These
days that shouldn't really be necessary any more ...
For the other (step-bt), we really want to make sure backtracing
works on the very first instruction of the routine. To enable that
test also on powerpc64le-linux, we can modify the code to call the
test function via function pointer (which makes it use the global
entry point in the ELFv2 ABI).
gdb/ChangeLog:
* gdbarch.sh (skip_entrypoint): New callback.
* gdbarch.c, gdbarch.h: Regenerate.
* symtab.c (skip_prologue_sal): Call gdbarch_skip_entrypoint.
* infrun.c (fill_in_stop_func): Likewise.
* ppc-linux-tdep.c: Include "elf/ppc64.h".
(ppc_elfv2_elf_make_msymbol_special): New function.
(ppc_elfv2_skip_entrypoint): Likewise.
(ppc_linux_init_abi): Install them for ELFv2.
gdb/testsuite/ChangeLog:
* gdb.base/sigbpt.exp: Do not use "*" when setting breakpoint
on a function.
* gdb.base/step-bt.c: Call hello via function pointer to make
sure its first instruction is executed on powerpc64le-linux.
2014-02-04 18:44:14 +01:00
|
|
|
/* Skip verify of skip_entrypoint, has predicate. */
|
2007-11-12 07:47:56 +01:00
|
|
|
if (gdbarch->inner_than == 0)
|
Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy
This patch starts from the desire to eliminate
make_cleanup_ui_file_delete, but then goes beyond. It makes ui_file &
friends a real C++ class hierarchy, and switches temporary
ui_file-like objects to stack-based allocation.
- mem_fileopen -> string_file
mem_fileopen is replaced with a new string_file class that is treated
as a value class created on the stack. This alone eliminates most
make_cleanup_ui_file_delete calls, and, simplifies code a whole lot
(diffstat shows around 1k loc dropped.)
string_file's internal buffer is a std::string, thus the "string" in
the name. This simplifies the implementation much, compared to
mem_fileopen, which managed growing its internal buffer manually.
- ui_file_as_string, ui_file_strdup, ui_file_obsavestring all gone
The new string_file class has a string() method that provides direct
writable access to the internal std::string buffer. This replaced
ui_file_as_string, which forced a copy of the same data the stream had
inside. With direct access via a writable reference, we can instead
move the string out of the string_stream, avoiding deep string
copying.
Related, ui_file_xstrdup calls are replaced with xstrdup'ping the
stream's string, and ui_file_obsavestring is replaced by
obstack_copy0.
With all those out of the way, getting rid of the weird ui_file_put
mechanism was possible.
- New ui_file::printf, ui_file::puts, etc. methods
These simplify / clarify client code. I considered splitting
client-code changes, like these, e.g.:
- stb = mem_fileopen ();
- fprintf_unfiltered (stb, "%s%s%s",
- _("The valid values are:\n"),
- regdesc,
- _("The default is \"std\"."));
+ string_file stb;
+ stb.printf ("%s%s%s",
+ _("The valid values are:\n"),
+ regdesc,
+ _("The default is \"std\"."));
In two steps, with the first step leaving fprintf_unfiltered (etc.)
calls in place, and only afterwards do a pass to change all those to
call stb.printf etc.. I didn't do that split, because (when I tried),
it turned out to be pointless make-work: the first pass would have to
touch the fprintf_unfiltered line anyway, to replace "stb" with
"&stb".
- gdb_fopen replaced with stack-based objects
This avoids the need for cleanups or unique_ptr's. I.e., this:
struct ui_file *file = gdb_fopen (filename, "w");
if (filename == NULL)
perror_with_name (filename);
cleanups = make_cleanup_ui_file_delete (file);
// use file.
do_cleanups (cleanups);
is replaced with this:
stdio_file file;
if (!file.open (filename, "w"))
perror_with_name (filename);
// use file.
- odd contorsions in null_file_write / null_file_fputs around when to
call to_fputs / to_write eliminated.
- Global null_stream object
A few places that were allocating a ui_file in order to print to
"nowhere" are adjusted to instead refer to a new 'null_stream' global
stream.
- TUI's tui_sfileopen eliminated. TUI's ui_file much simplified
The TUI's ui_file was serving a dual purpose. It supported being used
as string buffer, and supported being backed by a stdio FILE. The
string buffer part is gone, replaced by using of string_file. The
'FILE *' support is now much simplified, by making the TUI's ui_file
inherit from stdio_file.
gdb/ChangeLog:
2017-02-02 Pedro Alves <palves@redhat.com>
* ada-lang.c (type_as_string): Use string_file.
* ada-valprint.c (ada_print_floating): Use string_file.
* ada-varobj.c (ada_varobj_scalar_image)
(ada_varobj_get_value_image): Use string_file.
* aix-thread.c (aix_thread_extra_thread_info): Use string_file.
* arm-tdep.c (_initialize_arm_tdep): Use string_printf.
* breakpoint.c (update_inserted_breakpoint_locations)
(insert_breakpoint_locations, reattach_breakpoints)
(print_breakpoint_location, print_one_detail_ranged_breakpoint)
(print_it_watchpoint): Use string_file.
(save_breakpoints): Use stdio_file.
* c-exp.y (oper): Use string_file.
* cli/cli-logging.c (set_logging_redirect): Use ui_file_up and
tee_file.
(pop_output_files): Use delete.
(handle_redirections): Use stdio_file and tee_file.
* cli/cli-setshow.c (do_show_command): Use string_file.
* compile/compile-c-support.c (c_compute_program): Use
string_file.
* compile/compile-c-symbols.c (generate_vla_size): Take a
'string_file &' instead of a 'ui_file *'.
(generate_c_for_for_one_variable): Take a 'string_file &' instead
of a 'ui_file *'. Use string_file.
(generate_c_for_variable_locations): Take a 'string_file &'
instead of a 'ui_file *'.
* compile/compile-internal.h (generate_c_for_for_one_variable):
Take a 'string_file &' instead of a 'ui_file *'.
* compile/compile-loc2c.c (push, pushf, unary, binary)
(print_label, pushf_register_address, pushf_register)
(do_compile_dwarf_expr_to_c): Take a 'string_file &' instead of a
'ui_file *'. Adjust.
* compile/compile.c (compile_to_object): Use string_file.
* compile/compile.h (compile_dwarf_expr_to_c)
(compile_dwarf_bounds_to_c): Take a 'string_file &' instead of a
'ui_file *'.
* cp-support.c (inspect_type): Use string_file and obstack_copy0.
(replace_typedefs_qualified_name): Use string_file and
obstack_copy0.
* disasm.c (gdb_pretty_print_insn): Use string_file.
(gdb_disassembly): Adjust reference the null_stream global.
(do_ui_file_delete): Delete.
(gdb_insn_length): Use null_stream.
* dummy-frame.c (maintenance_print_dummy_frames): Use stdio_file.
* dwarf2loc.c (dwarf2_compile_property_to_c)
(locexpr_generate_c_location, loclist_generate_c_location): Take a
'string_file &' instead of a 'ui_file *'.
* dwarf2loc.h (dwarf2_compile_property_to_c): Likewise.
* dwarf2read.c (do_ui_file_peek_last): Delete.
(dwarf2_compute_name): Use string_file.
* event-top.c (gdb_setup_readline): Use stdio_file.
* gdbarch.sh (verify_gdbarch): Use string_file.
* gdbtypes.c (safe_parse_type): Use null_stream.
* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use
string_file.
* guile/scm-disasm.c (gdbscm_print_insn_from_port): Take a
'string_file *' instead of a 'ui_file *'.
(gdbscm_arch_disassemble): Use string_file.
* guile/scm-frame.c (frscm_print_frame_smob): Use string_file.
* guile/scm-ports.c (class ioscm_file_port): Now a class that
inherits from ui_file.
(ioscm_file_port_delete, ioscm_file_port_rewind)
(ioscm_file_port_put): Delete.
(ioscm_file_port_write): Rename to ...
(ioscm_file_port::write): ... this. Remove file_port_magic
checks.
(ioscm_file_port_new): Delete.
(ioscm_with_output_to_port_worker): Use ioscm_file_port and
ui_file_up.
* guile/scm-type.c (tyscm_type_name): Use string_file.
* guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print):
Use string_file.
* infcmd.c (print_return_value_1): Use string_file.
* infrun.c (print_target_wait_results): Use string_file.
* language.c (add_language): Use string_file.
* location.c (explicit_to_string_internal): Use string_file.
* main.c (captured_main_1): Use null_file.
* maint.c (maintenance_print_architecture): Use stdio_file.
* mi/mi-cmd-stack.c (list_arg_or_local): Use string_file.
* mi/mi-common.h (struct mi_interp) <out, err, log, targ,
event_channel>: Change type to mi_console_file pointer.
* mi/mi-console.c (mi_console_file_fputs, mi_console_file_flush)
(mi_console_file_delete): Delete.
(struct mi_console_file): Delete.
(mi_console_file_magic): Delete.
(mi_console_file_new): Delete.
(mi_console_file::mi_console_file): New.
(mi_console_file_delete): Delete.
(mi_console_file_fputs): Delete.
(mi_console_file::write): New.
(mi_console_raw_packet): Delete.
(mi_console_file::flush): New.
(mi_console_file_flush): Delete.
(mi_console_set_raw): Rename to ...
(mi_console_file::set_raw): ... this.
* mi/mi-console.h (class mi_console_file): New class.
(mi_console_file_new, mi_console_set_raw): Delete.
* mi/mi-interp.c (mi_interpreter_init): Use mi_console_file.
(mi_set_logging): Use delete and tee_file. Adjust.
* mi/mi-main.c (output_register): Use string_file.
(mi_cmd_data_evaluate_expression): Use string_file.
(mi_cmd_data_read_memory): Use string_file.
(mi_cmd_execute, print_variable_or_computed): Use string_file.
* mi/mi-out.c (mi_ui_out::main_stream): New.
(mi_ui_out::rewind): Use main_stream and
string_file.
(mi_ui_out::put): Use main_stream and string_file.
(mi_ui_out::mi_ui_out): Remove 'stream' parameter.
Allocate a 'string_file' instead.
(mi_out_new): Don't allocate a mem_fileopen stream here.
* mi/mi-out.h (mi_ui_out::mi_ui_out): Remove 'stream' parameter.
(mi_ui_out::main_stream): Declare method.
* printcmd.c (eval_command): Use string_file.
* psymtab.c (maintenance_print_psymbols): Use stdio_file.
* python/py-arch.c (archpy_disassemble): Use string_file.
* python/py-breakpoint.c (bppy_get_commands): Use string_file.
* python/py-frame.c (frapy_str): Use string_file.
* python/py-framefilter.c (py_print_type, py_print_single_arg):
Use string_file.
* python/py-type.c (typy_str): Use string_file.
* python/py-unwind.c (unwind_infopy_str): Use string_file.
* python/py-value.c (valpy_str): Use string_file.
* record-btrace.c (btrace_insn_history): Use string_file.
* regcache.c (regcache_print): Use stdio_file.
* reggroups.c (maintenance_print_reggroups): Use stdio_file.
* remote.c (escape_buffer): Use string_file.
* rust-lang.c (rust_get_disr_info): Use string_file.
* serial.c (serial_open_ops_1): Use stdio_file.
(do_serial_close): Use delete.
* stack.c (print_frame_arg): Use string_file.
(print_frame_args): Remove local mem_fileopen stream, not used.
(print_frame): Use string_file.
* symmisc.c (maintenance_print_symbols): Use stdio_file.
* symtab.h (struct symbol_computed_ops) <generate_c_location>:
Take a 'string_file *' instead of a 'ui_file *'.
* top.c (new_ui): Use stdio_file and stderr_file.
(free_ui): Use delete.
(execute_command_to_string): Use string_file.
(quit_confirm): Use string_file.
* tracepoint.c (collection_list::append_exp): Use string_file.
* tui/tui-disasm.c (tui_disassemble): Use string_file.
* tui/tui-file.c: Don't include "ui-file.h".
(enum streamtype, struct tui_stream): Delete.
(tui_file_new, tui_file_delete, tui_fileopen, tui_sfileopen)
(tui_file_isatty, tui_file_rewind, tui_file_put): Delete.
(tui_file::tui_file): New method.
(tui_file_fputs): Delete.
(tui_file_get_strbuf): Delete.
(tui_file::puts): New method.
(tui_file_adjust_strbuf): Delete.
(tui_file_flush): Delete.
(tui_file::flush): New method.
* tui/tui-file.h: Tweak intro comment.
Include ui-file.h.
(tui_fileopen, tui_sfileopen, tui_file_get_strbuf)
(tui_file_adjust_strbuf): Delete declarations.
(class tui_file): New class.
* tui/tui-io.c (tui_initialize_io): Use tui_file.
* tui/tui-regs.c (tui_restore_gdbout): Use delete.
(tui_register_format): Use string_stream.
* tui/tui-stack.c (tui_make_status_line): Use string_file.
(tui_get_function_from_frame): Use string_file.
* typeprint.c (type_to_string): Use string_file.
* ui-file.c (struct ui_file, ui_file_magic, ui_file_new): Delete.
(null_stream): New global.
(ui_file_delete): Delete.
(ui_file::ui_file): New.
(null_file_isatty): Delete.
(ui_file::~ui_file): New.
(null_file_rewind): Delete.
(ui_file::printf): New.
(null_file_put): Delete.
(null_file_flush): Delete.
(ui_file::putstr): New.
(null_file_write): Delete.
(ui_file::putstrn): New.
(null_file_read): Delete.
(ui_file::putc): New.
(null_file_fputs): Delete.
(null_file_write_async_safe): Delete.
(ui_file::vprintf): New.
(null_file_delete): Delete.
(null_file::write): New.
(null_file_fseek): Delete.
(null_file::puts): New.
(ui_file_data): Delete.
(null_file::write_async_safe): New.
(gdb_flush, ui_file_isatty): Adjust.
(ui_file_put, ui_file_rewind): Delete.
(ui_file_write): Adjust.
(ui_file_write_for_put): Delete.
(ui_file_write_async_safe, ui_file_read): Adjust.
(ui_file_fseek): Delete.
(fputs_unfiltered): Adjust.
(set_ui_file_flush, set_ui_file_isatty, set_ui_file_rewind)
(set_ui_file_put, set_ui_file_write, set_ui_file_write_async_safe)
(set_ui_file_read, set_ui_file_fputs, set_ui_file_fseek)
(set_ui_file_data): Delete.
(string_file::~string_file, string_file::write)
(struct accumulated_ui_file, do_ui_file_xstrdup, ui_file_xstrdup)
(do_ui_file_as_string, ui_file_as_string): Delete.
(do_ui_file_obsavestring, ui_file_obsavestring): Delete.
(struct mem_file): Delete.
(mem_file_new): Delete.
(stdio_file::stdio_file): New.
(mem_file_delete): Delete.
(stdio_file::stdio_file): New.
(mem_fileopen): Delete.
(stdio_file::~stdio_file): New.
(mem_file_rewind): Delete.
(stdio_file::set_stream): New.
(mem_file_put): Delete.
(stdio_file::open): New.
(mem_file_write): Delete.
(stdio_file_magic, struct stdio_file): Delete.
(stdio_file_new, stdio_file_delete, stdio_file_flush): Delete.
(stdio_file::flush): New.
(stdio_file_read): Rename to ...
(stdio_file::read): ... this. Adjust.
(stdio_file_write): Rename to ...
(stdio_file::write): ... this. Adjust.
(stdio_file_write_async_safe): Rename to ...
(stdio_file::write_async_safe) ... this. Adjust.
(stdio_file_fputs): Rename to ...
(stdio_file::puts) ... this. Adjust.
(stdio_file_isatty): Delete.
(stdio_file_fseek): Delete.
(stdio_file::isatty): New.
(stderr_file_write): Rename to ...
(stderr_file::write) ... this. Adjust.
(stderr_file_fputs): Rename to ...
(stderr_file::puts) ... this. Adjust.
(stderr_fileopen, stdio_fileopen, gdb_fopen): Delete.
(stderr_file::stderr_file): New.
(tee_file_magic): Delete.
(struct tee_file): Delete.
(tee_file::tee_file): New.
(tee_file_new): Delete.
(tee_file::~tee_file): New.
(tee_file_delete): Delete.
(tee_file_flush): Rename to ...
(tee_file::flush): ... this. Adjust.
(tee_file_write): Rename to ...
(tee_file::write): ... this. Adjust.
(tee_file::write_async_safe): New.
(tee_file_fputs): Rename to ...
(tee_file::puts): ... this. Adjust.
(tee_file_isatty): Rename to ...
(tee_file::isatty): ... this. Adjust.
* ui-file.h (struct obstack, struct ui_file): Don't
forward-declare.
(ui_file_new, ui_file_flush_ftype, set_ui_file_flush)
(ui_file_write_ftype)
(set_ui_file_write, ui_file_fputs_ftype, set_ui_file_fputs)
(ui_file_write_async_safe_ftype, set_ui_file_write_async_safe)
(ui_file_read_ftype, set_ui_file_read, ui_file_isatty_ftype)
(set_ui_file_isatty, ui_file_rewind_ftype, set_ui_file_rewind)
(ui_file_put_method_ftype, ui_file_put_ftype, set_ui_file_put)
(ui_file_delete_ftype, set_ui_file_data, ui_file_fseek_ftype)
(set_ui_file_fseek): Delete.
(ui_file_data, ui_file_delete, ui_file_rewind)
(struct ui_file): New.
(ui_file_up): New.
(class null_file): New.
(null_stream): Declare.
(ui_file_write_for_put, ui_file_put): Delete.
(ui_file_xstrdup, ui_file_as_string, ui_file_obsavestring):
Delete.
(ui_file_fseek, mem_fileopen, stdio_fileopen, stderr_fileopen)
(gdb_fopen, tee_file_new): Delete.
(struct string_file): New.
(struct stdio_file): New.
(stdio_file_up): New.
(struct stderr_file): New.
(class tee_file): New.
* ui-out.c (ui_out::field_stream): Take a 'string_file &' instead
of a 'ui_file *'. Adjust.
* ui-out.h (class ui_out) <field_stream>: Likewise.
* utils.c (do_ui_file_delete, make_cleanup_ui_file_delete)
(null_stream): Delete.
(error_stream): Take a 'string_file &' instead of a 'ui_file *'.
Adjust.
* utils.h (struct ui_file): Delete forward declaration..
(make_cleanup_ui_file_delete, null_stream): Delete declarations.
(error_stream): Take a 'string_file &' instead of a
'ui_file *'.
* varobj.c (varobj_value_get_print_value): Use string_file.
* xtensa-tdep.c (xtensa_verify_config): Use string_file.
* gdbarch.c: Regenerate.
2017-02-02 12:11:47 +01:00
|
|
|
log.puts ("\n\tinner_than");
|
Add default_breakpoint_from_pc
This patch adds the default implementation of gdbarch breakpoint_from_pc,
which is,
const gdb_byte *
default_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
int *lenptr)
{
int kind = gdbarch_breakpoint_kind_from_pc (gdbarch, pcptr);
return gdbarch_sw_breakpoint_from_kind (gdbarch, kind, lenptr);
}
so gdbarch can only defines sw_breakpoint_from_kind and
breakpoint_kind_from_pc.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.c (default_breakpoint_from_pc): New function.
* arch-utils.h (GDBARCH_BREAKPOINT_FROM_PC): Remove.
(GDBARCH_BREAKPOINT_MANIPULATION): Don't use
GDBARCH_BREAKPOINT_FROM_PC.
(SET_GDBARCH_BREAKPOINT_MANIPULATION): Don't call
set_gdbarch_breakpoint_from_pc.
(default_breakpoint_from_pc): Remove declaration.
* gdbarch.sh (breakpoint_from_pc): Add its default implementation.
* gdbarch.c, gdbarch.h: Regenerate.
* arm-tdep.c: Don't use GDBARCH_BREAKPOINT_FROM_PC.
* arc-tdep.c, bfin-tdep.c, cris-tdep.c, iq2000-tdep.c: Likewise.
* m32r-tdep.c, mips-tdep.c, mt-tdep.c: Likewise.
* nios2-tdep.c, score-tdep.c, sh-tdep.c: Likewise.
* sh64-tdep.c, tic6x-tdep.c, v850-tdep.c, xtensa-tdep.c: Likewise.
2016-11-03 15:35:14 +01:00
|
|
|
/* Skip verify of breakpoint_from_pc, invalid_p == 0 */
|
New gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind
This patch adds two gdbarch methods breakpoint_kind_from_pc and
sw_breakpoint_from_kind, and uses target_info.placed_size as "kind"
of the breakpoint. This patch updates the usages of
target_info.placed_size.
The "kind" of a breakpoint is determined by gdbarch rather than
target, so we have gdbarch method breakpoint_kind_from_pc, and we
should set target_info.placed_size out of each implementation of
target to_insert_breakpoint. In this way, each target doesn't have
to set target_info.placed_size any more.
This patch also sets target_info.placed_address before
target_insert_breakpoint too, so that target to_insert_breakpoint
can use it, see record_full_insert_breakpoint.
Before we call target_insert_breakpoint, we set
target_info.placed_address and target_info.placed_size like this,
CORE_ADDR addr = bl->target_info.reqstd_address;
bl->target_info.placed_size = gdbarch_breakpoint_kind_from_pc (bl->gdbarch, &addr);
bl->target_info.placed_address = addr;
return target_insert_breakpoint (bl->gdbarch, &bl->target_info);
target_insert_breakpoint may fail, but it doesn't matter to the "kind"
and "placed_address" of a breakpoint. They should be determined by
gdbarch.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): Define
breakpoint_kind_from_pc and sw_breakpoint_from_kind.
(GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN): Likewise.
(SET_GDBARCH_BREAKPOINT_MANIPULATION): Call
set_gdbarch_breakpoint_kind_from_pc and
set_gdbarch_sw_breakpoint_from_kind.
* arm-tdep.c: Add comments.
* bfin-tdep.c: Likewise.
* breakpoint.c (breakpoint_kind): New function.
(insert_bp_location): Set target_info.placed_size and
target_info.placed_address.
(bkpt_insert_location): Likewise.
* cris-tdep.c: Add comments.
* gdbarch.sh (breakpoint_kind_from_pc): New.
(sw_breakpoint_from_kind): New.
* gdbarch.c, gdbarch.h: Regenerated.
* ia64-tdep.c (ia64_memory_insert_breakpoint): Don't set
bp_tgt->placed_size.
(ia64_memory_remove_breakpoint): Don't assert
bp_tgt->placed_size.
(ia64_breakpoint_kind_from_pc): New function.
(ia64_gdbarch_init): Install ia64_breakpoint_kind_from_pc.
* m32r-tdep.c (m32r_memory_insert_breakpoint): Don't set
bp_tgt->placed_size.
* mem-break.c (default_memory_insert_breakpoint): Don't set
bp_tgt->placed_size. Call gdbarch_sw_breakpoint_from_kind.
(default_memory_remove_breakpoint): Call
gdbarch_sw_breakpoint_from_kind.
(memory_validate_breakpoint): Don't check bp_tgt->placed_size.
* mips-tdep.c: Add comments.
* mt-tdep.c: Likewise.
* nios2-tdep.c: Likewise.
* record-full.c (record_full_insert_breakpoint): Don't call
gdbarch_breakpoint_from_pc. Don't set bp_tgt->placed_address
and bp_tgt->placed_size.
* remote.c (remote_insert_breakpoint): Don't call
gdbarch_remote_breakpoint_from_pc. Use bp_tgt->placed_size.
Don't set bp_tgt->placed_address and bp_tgt->placed_size.
(remote_insert_hw_breakpoint): Likewise.
* score-tdep.c: Likewise.
* sh-tdep.c: Likewise.
* tic6x-tdep.c: Likewise.
* v850-tdep.c: Likewise.
* xtensa-tdep.c: Likewise.
2016-11-03 15:35:13 +01:00
|
|
|
if (gdbarch->breakpoint_kind_from_pc == 0)
|
Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy
This patch starts from the desire to eliminate
make_cleanup_ui_file_delete, but then goes beyond. It makes ui_file &
friends a real C++ class hierarchy, and switches temporary
ui_file-like objects to stack-based allocation.
- mem_fileopen -> string_file
mem_fileopen is replaced with a new string_file class that is treated
as a value class created on the stack. This alone eliminates most
make_cleanup_ui_file_delete calls, and, simplifies code a whole lot
(diffstat shows around 1k loc dropped.)
string_file's internal buffer is a std::string, thus the "string" in
the name. This simplifies the implementation much, compared to
mem_fileopen, which managed growing its internal buffer manually.
- ui_file_as_string, ui_file_strdup, ui_file_obsavestring all gone
The new string_file class has a string() method that provides direct
writable access to the internal std::string buffer. This replaced
ui_file_as_string, which forced a copy of the same data the stream had
inside. With direct access via a writable reference, we can instead
move the string out of the string_stream, avoiding deep string
copying.
Related, ui_file_xstrdup calls are replaced with xstrdup'ping the
stream's string, and ui_file_obsavestring is replaced by
obstack_copy0.
With all those out of the way, getting rid of the weird ui_file_put
mechanism was possible.
- New ui_file::printf, ui_file::puts, etc. methods
These simplify / clarify client code. I considered splitting
client-code changes, like these, e.g.:
- stb = mem_fileopen ();
- fprintf_unfiltered (stb, "%s%s%s",
- _("The valid values are:\n"),
- regdesc,
- _("The default is \"std\"."));
+ string_file stb;
+ stb.printf ("%s%s%s",
+ _("The valid values are:\n"),
+ regdesc,
+ _("The default is \"std\"."));
In two steps, with the first step leaving fprintf_unfiltered (etc.)
calls in place, and only afterwards do a pass to change all those to
call stb.printf etc.. I didn't do that split, because (when I tried),
it turned out to be pointless make-work: the first pass would have to
touch the fprintf_unfiltered line anyway, to replace "stb" with
"&stb".
- gdb_fopen replaced with stack-based objects
This avoids the need for cleanups or unique_ptr's. I.e., this:
struct ui_file *file = gdb_fopen (filename, "w");
if (filename == NULL)
perror_with_name (filename);
cleanups = make_cleanup_ui_file_delete (file);
// use file.
do_cleanups (cleanups);
is replaced with this:
stdio_file file;
if (!file.open (filename, "w"))
perror_with_name (filename);
// use file.
- odd contorsions in null_file_write / null_file_fputs around when to
call to_fputs / to_write eliminated.
- Global null_stream object
A few places that were allocating a ui_file in order to print to
"nowhere" are adjusted to instead refer to a new 'null_stream' global
stream.
- TUI's tui_sfileopen eliminated. TUI's ui_file much simplified
The TUI's ui_file was serving a dual purpose. It supported being used
as string buffer, and supported being backed by a stdio FILE. The
string buffer part is gone, replaced by using of string_file. The
'FILE *' support is now much simplified, by making the TUI's ui_file
inherit from stdio_file.
gdb/ChangeLog:
2017-02-02 Pedro Alves <palves@redhat.com>
* ada-lang.c (type_as_string): Use string_file.
* ada-valprint.c (ada_print_floating): Use string_file.
* ada-varobj.c (ada_varobj_scalar_image)
(ada_varobj_get_value_image): Use string_file.
* aix-thread.c (aix_thread_extra_thread_info): Use string_file.
* arm-tdep.c (_initialize_arm_tdep): Use string_printf.
* breakpoint.c (update_inserted_breakpoint_locations)
(insert_breakpoint_locations, reattach_breakpoints)
(print_breakpoint_location, print_one_detail_ranged_breakpoint)
(print_it_watchpoint): Use string_file.
(save_breakpoints): Use stdio_file.
* c-exp.y (oper): Use string_file.
* cli/cli-logging.c (set_logging_redirect): Use ui_file_up and
tee_file.
(pop_output_files): Use delete.
(handle_redirections): Use stdio_file and tee_file.
* cli/cli-setshow.c (do_show_command): Use string_file.
* compile/compile-c-support.c (c_compute_program): Use
string_file.
* compile/compile-c-symbols.c (generate_vla_size): Take a
'string_file &' instead of a 'ui_file *'.
(generate_c_for_for_one_variable): Take a 'string_file &' instead
of a 'ui_file *'. Use string_file.
(generate_c_for_variable_locations): Take a 'string_file &'
instead of a 'ui_file *'.
* compile/compile-internal.h (generate_c_for_for_one_variable):
Take a 'string_file &' instead of a 'ui_file *'.
* compile/compile-loc2c.c (push, pushf, unary, binary)
(print_label, pushf_register_address, pushf_register)
(do_compile_dwarf_expr_to_c): Take a 'string_file &' instead of a
'ui_file *'. Adjust.
* compile/compile.c (compile_to_object): Use string_file.
* compile/compile.h (compile_dwarf_expr_to_c)
(compile_dwarf_bounds_to_c): Take a 'string_file &' instead of a
'ui_file *'.
* cp-support.c (inspect_type): Use string_file and obstack_copy0.
(replace_typedefs_qualified_name): Use string_file and
obstack_copy0.
* disasm.c (gdb_pretty_print_insn): Use string_file.
(gdb_disassembly): Adjust reference the null_stream global.
(do_ui_file_delete): Delete.
(gdb_insn_length): Use null_stream.
* dummy-frame.c (maintenance_print_dummy_frames): Use stdio_file.
* dwarf2loc.c (dwarf2_compile_property_to_c)
(locexpr_generate_c_location, loclist_generate_c_location): Take a
'string_file &' instead of a 'ui_file *'.
* dwarf2loc.h (dwarf2_compile_property_to_c): Likewise.
* dwarf2read.c (do_ui_file_peek_last): Delete.
(dwarf2_compute_name): Use string_file.
* event-top.c (gdb_setup_readline): Use stdio_file.
* gdbarch.sh (verify_gdbarch): Use string_file.
* gdbtypes.c (safe_parse_type): Use null_stream.
* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use
string_file.
* guile/scm-disasm.c (gdbscm_print_insn_from_port): Take a
'string_file *' instead of a 'ui_file *'.
(gdbscm_arch_disassemble): Use string_file.
* guile/scm-frame.c (frscm_print_frame_smob): Use string_file.
* guile/scm-ports.c (class ioscm_file_port): Now a class that
inherits from ui_file.
(ioscm_file_port_delete, ioscm_file_port_rewind)
(ioscm_file_port_put): Delete.
(ioscm_file_port_write): Rename to ...
(ioscm_file_port::write): ... this. Remove file_port_magic
checks.
(ioscm_file_port_new): Delete.
(ioscm_with_output_to_port_worker): Use ioscm_file_port and
ui_file_up.
* guile/scm-type.c (tyscm_type_name): Use string_file.
* guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print):
Use string_file.
* infcmd.c (print_return_value_1): Use string_file.
* infrun.c (print_target_wait_results): Use string_file.
* language.c (add_language): Use string_file.
* location.c (explicit_to_string_internal): Use string_file.
* main.c (captured_main_1): Use null_file.
* maint.c (maintenance_print_architecture): Use stdio_file.
* mi/mi-cmd-stack.c (list_arg_or_local): Use string_file.
* mi/mi-common.h (struct mi_interp) <out, err, log, targ,
event_channel>: Change type to mi_console_file pointer.
* mi/mi-console.c (mi_console_file_fputs, mi_console_file_flush)
(mi_console_file_delete): Delete.
(struct mi_console_file): Delete.
(mi_console_file_magic): Delete.
(mi_console_file_new): Delete.
(mi_console_file::mi_console_file): New.
(mi_console_file_delete): Delete.
(mi_console_file_fputs): Delete.
(mi_console_file::write): New.
(mi_console_raw_packet): Delete.
(mi_console_file::flush): New.
(mi_console_file_flush): Delete.
(mi_console_set_raw): Rename to ...
(mi_console_file::set_raw): ... this.
* mi/mi-console.h (class mi_console_file): New class.
(mi_console_file_new, mi_console_set_raw): Delete.
* mi/mi-interp.c (mi_interpreter_init): Use mi_console_file.
(mi_set_logging): Use delete and tee_file. Adjust.
* mi/mi-main.c (output_register): Use string_file.
(mi_cmd_data_evaluate_expression): Use string_file.
(mi_cmd_data_read_memory): Use string_file.
(mi_cmd_execute, print_variable_or_computed): Use string_file.
* mi/mi-out.c (mi_ui_out::main_stream): New.
(mi_ui_out::rewind): Use main_stream and
string_file.
(mi_ui_out::put): Use main_stream and string_file.
(mi_ui_out::mi_ui_out): Remove 'stream' parameter.
Allocate a 'string_file' instead.
(mi_out_new): Don't allocate a mem_fileopen stream here.
* mi/mi-out.h (mi_ui_out::mi_ui_out): Remove 'stream' parameter.
(mi_ui_out::main_stream): Declare method.
* printcmd.c (eval_command): Use string_file.
* psymtab.c (maintenance_print_psymbols): Use stdio_file.
* python/py-arch.c (archpy_disassemble): Use string_file.
* python/py-breakpoint.c (bppy_get_commands): Use string_file.
* python/py-frame.c (frapy_str): Use string_file.
* python/py-framefilter.c (py_print_type, py_print_single_arg):
Use string_file.
* python/py-type.c (typy_str): Use string_file.
* python/py-unwind.c (unwind_infopy_str): Use string_file.
* python/py-value.c (valpy_str): Use string_file.
* record-btrace.c (btrace_insn_history): Use string_file.
* regcache.c (regcache_print): Use stdio_file.
* reggroups.c (maintenance_print_reggroups): Use stdio_file.
* remote.c (escape_buffer): Use string_file.
* rust-lang.c (rust_get_disr_info): Use string_file.
* serial.c (serial_open_ops_1): Use stdio_file.
(do_serial_close): Use delete.
* stack.c (print_frame_arg): Use string_file.
(print_frame_args): Remove local mem_fileopen stream, not used.
(print_frame): Use string_file.
* symmisc.c (maintenance_print_symbols): Use stdio_file.
* symtab.h (struct symbol_computed_ops) <generate_c_location>:
Take a 'string_file *' instead of a 'ui_file *'.
* top.c (new_ui): Use stdio_file and stderr_file.
(free_ui): Use delete.
(execute_command_to_string): Use string_file.
(quit_confirm): Use string_file.
* tracepoint.c (collection_list::append_exp): Use string_file.
* tui/tui-disasm.c (tui_disassemble): Use string_file.
* tui/tui-file.c: Don't include "ui-file.h".
(enum streamtype, struct tui_stream): Delete.
(tui_file_new, tui_file_delete, tui_fileopen, tui_sfileopen)
(tui_file_isatty, tui_file_rewind, tui_file_put): Delete.
(tui_file::tui_file): New method.
(tui_file_fputs): Delete.
(tui_file_get_strbuf): Delete.
(tui_file::puts): New method.
(tui_file_adjust_strbuf): Delete.
(tui_file_flush): Delete.
(tui_file::flush): New method.
* tui/tui-file.h: Tweak intro comment.
Include ui-file.h.
(tui_fileopen, tui_sfileopen, tui_file_get_strbuf)
(tui_file_adjust_strbuf): Delete declarations.
(class tui_file): New class.
* tui/tui-io.c (tui_initialize_io): Use tui_file.
* tui/tui-regs.c (tui_restore_gdbout): Use delete.
(tui_register_format): Use string_stream.
* tui/tui-stack.c (tui_make_status_line): Use string_file.
(tui_get_function_from_frame): Use string_file.
* typeprint.c (type_to_string): Use string_file.
* ui-file.c (struct ui_file, ui_file_magic, ui_file_new): Delete.
(null_stream): New global.
(ui_file_delete): Delete.
(ui_file::ui_file): New.
(null_file_isatty): Delete.
(ui_file::~ui_file): New.
(null_file_rewind): Delete.
(ui_file::printf): New.
(null_file_put): Delete.
(null_file_flush): Delete.
(ui_file::putstr): New.
(null_file_write): Delete.
(ui_file::putstrn): New.
(null_file_read): Delete.
(ui_file::putc): New.
(null_file_fputs): Delete.
(null_file_write_async_safe): Delete.
(ui_file::vprintf): New.
(null_file_delete): Delete.
(null_file::write): New.
(null_file_fseek): Delete.
(null_file::puts): New.
(ui_file_data): Delete.
(null_file::write_async_safe): New.
(gdb_flush, ui_file_isatty): Adjust.
(ui_file_put, ui_file_rewind): Delete.
(ui_file_write): Adjust.
(ui_file_write_for_put): Delete.
(ui_file_write_async_safe, ui_file_read): Adjust.
(ui_file_fseek): Delete.
(fputs_unfiltered): Adjust.
(set_ui_file_flush, set_ui_file_isatty, set_ui_file_rewind)
(set_ui_file_put, set_ui_file_write, set_ui_file_write_async_safe)
(set_ui_file_read, set_ui_file_fputs, set_ui_file_fseek)
(set_ui_file_data): Delete.
(string_file::~string_file, string_file::write)
(struct accumulated_ui_file, do_ui_file_xstrdup, ui_file_xstrdup)
(do_ui_file_as_string, ui_file_as_string): Delete.
(do_ui_file_obsavestring, ui_file_obsavestring): Delete.
(struct mem_file): Delete.
(mem_file_new): Delete.
(stdio_file::stdio_file): New.
(mem_file_delete): Delete.
(stdio_file::stdio_file): New.
(mem_fileopen): Delete.
(stdio_file::~stdio_file): New.
(mem_file_rewind): Delete.
(stdio_file::set_stream): New.
(mem_file_put): Delete.
(stdio_file::open): New.
(mem_file_write): Delete.
(stdio_file_magic, struct stdio_file): Delete.
(stdio_file_new, stdio_file_delete, stdio_file_flush): Delete.
(stdio_file::flush): New.
(stdio_file_read): Rename to ...
(stdio_file::read): ... this. Adjust.
(stdio_file_write): Rename to ...
(stdio_file::write): ... this. Adjust.
(stdio_file_write_async_safe): Rename to ...
(stdio_file::write_async_safe) ... this. Adjust.
(stdio_file_fputs): Rename to ...
(stdio_file::puts) ... this. Adjust.
(stdio_file_isatty): Delete.
(stdio_file_fseek): Delete.
(stdio_file::isatty): New.
(stderr_file_write): Rename to ...
(stderr_file::write) ... this. Adjust.
(stderr_file_fputs): Rename to ...
(stderr_file::puts) ... this. Adjust.
(stderr_fileopen, stdio_fileopen, gdb_fopen): Delete.
(stderr_file::stderr_file): New.
(tee_file_magic): Delete.
(struct tee_file): Delete.
(tee_file::tee_file): New.
(tee_file_new): Delete.
(tee_file::~tee_file): New.
(tee_file_delete): Delete.
(tee_file_flush): Rename to ...
(tee_file::flush): ... this. Adjust.
(tee_file_write): Rename to ...
(tee_file::write): ... this. Adjust.
(tee_file::write_async_safe): New.
(tee_file_fputs): Rename to ...
(tee_file::puts): ... this. Adjust.
(tee_file_isatty): Rename to ...
(tee_file::isatty): ... this. Adjust.
* ui-file.h (struct obstack, struct ui_file): Don't
forward-declare.
(ui_file_new, ui_file_flush_ftype, set_ui_file_flush)
(ui_file_write_ftype)
(set_ui_file_write, ui_file_fputs_ftype, set_ui_file_fputs)
(ui_file_write_async_safe_ftype, set_ui_file_write_async_safe)
(ui_file_read_ftype, set_ui_file_read, ui_file_isatty_ftype)
(set_ui_file_isatty, ui_file_rewind_ftype, set_ui_file_rewind)
(ui_file_put_method_ftype, ui_file_put_ftype, set_ui_file_put)
(ui_file_delete_ftype, set_ui_file_data, ui_file_fseek_ftype)
(set_ui_file_fseek): Delete.
(ui_file_data, ui_file_delete, ui_file_rewind)
(struct ui_file): New.
(ui_file_up): New.
(class null_file): New.
(null_stream): Declare.
(ui_file_write_for_put, ui_file_put): Delete.
(ui_file_xstrdup, ui_file_as_string, ui_file_obsavestring):
Delete.
(ui_file_fseek, mem_fileopen, stdio_fileopen, stderr_fileopen)
(gdb_fopen, tee_file_new): Delete.
(struct string_file): New.
(struct stdio_file): New.
(stdio_file_up): New.
(struct stderr_file): New.
(class tee_file): New.
* ui-out.c (ui_out::field_stream): Take a 'string_file &' instead
of a 'ui_file *'. Adjust.
* ui-out.h (class ui_out) <field_stream>: Likewise.
* utils.c (do_ui_file_delete, make_cleanup_ui_file_delete)
(null_stream): Delete.
(error_stream): Take a 'string_file &' instead of a 'ui_file *'.
Adjust.
* utils.h (struct ui_file): Delete forward declaration..
(make_cleanup_ui_file_delete, null_stream): Delete declarations.
(error_stream): Take a 'string_file &' instead of a
'ui_file *'.
* varobj.c (varobj_value_get_print_value): Use string_file.
* xtensa-tdep.c (xtensa_verify_config): Use string_file.
* gdbarch.c: Regenerate.
2017-02-02 12:11:47 +01:00
|
|
|
log.puts ("\n\tbreakpoint_kind_from_pc");
|
New gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind
This patch adds two gdbarch methods breakpoint_kind_from_pc and
sw_breakpoint_from_kind, and uses target_info.placed_size as "kind"
of the breakpoint. This patch updates the usages of
target_info.placed_size.
The "kind" of a breakpoint is determined by gdbarch rather than
target, so we have gdbarch method breakpoint_kind_from_pc, and we
should set target_info.placed_size out of each implementation of
target to_insert_breakpoint. In this way, each target doesn't have
to set target_info.placed_size any more.
This patch also sets target_info.placed_address before
target_insert_breakpoint too, so that target to_insert_breakpoint
can use it, see record_full_insert_breakpoint.
Before we call target_insert_breakpoint, we set
target_info.placed_address and target_info.placed_size like this,
CORE_ADDR addr = bl->target_info.reqstd_address;
bl->target_info.placed_size = gdbarch_breakpoint_kind_from_pc (bl->gdbarch, &addr);
bl->target_info.placed_address = addr;
return target_insert_breakpoint (bl->gdbarch, &bl->target_info);
target_insert_breakpoint may fail, but it doesn't matter to the "kind"
and "placed_address" of a breakpoint. They should be determined by
gdbarch.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): Define
breakpoint_kind_from_pc and sw_breakpoint_from_kind.
(GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN): Likewise.
(SET_GDBARCH_BREAKPOINT_MANIPULATION): Call
set_gdbarch_breakpoint_kind_from_pc and
set_gdbarch_sw_breakpoint_from_kind.
* arm-tdep.c: Add comments.
* bfin-tdep.c: Likewise.
* breakpoint.c (breakpoint_kind): New function.
(insert_bp_location): Set target_info.placed_size and
target_info.placed_address.
(bkpt_insert_location): Likewise.
* cris-tdep.c: Add comments.
* gdbarch.sh (breakpoint_kind_from_pc): New.
(sw_breakpoint_from_kind): New.
* gdbarch.c, gdbarch.h: Regenerated.
* ia64-tdep.c (ia64_memory_insert_breakpoint): Don't set
bp_tgt->placed_size.
(ia64_memory_remove_breakpoint): Don't assert
bp_tgt->placed_size.
(ia64_breakpoint_kind_from_pc): New function.
(ia64_gdbarch_init): Install ia64_breakpoint_kind_from_pc.
* m32r-tdep.c (m32r_memory_insert_breakpoint): Don't set
bp_tgt->placed_size.
* mem-break.c (default_memory_insert_breakpoint): Don't set
bp_tgt->placed_size. Call gdbarch_sw_breakpoint_from_kind.
(default_memory_remove_breakpoint): Call
gdbarch_sw_breakpoint_from_kind.
(memory_validate_breakpoint): Don't check bp_tgt->placed_size.
* mips-tdep.c: Add comments.
* mt-tdep.c: Likewise.
* nios2-tdep.c: Likewise.
* record-full.c (record_full_insert_breakpoint): Don't call
gdbarch_breakpoint_from_pc. Don't set bp_tgt->placed_address
and bp_tgt->placed_size.
* remote.c (remote_insert_breakpoint): Don't call
gdbarch_remote_breakpoint_from_pc. Use bp_tgt->placed_size.
Don't set bp_tgt->placed_address and bp_tgt->placed_size.
(remote_insert_hw_breakpoint): Likewise.
* score-tdep.c: Likewise.
* sh-tdep.c: Likewise.
* tic6x-tdep.c: Likewise.
* v850-tdep.c: Likewise.
* xtensa-tdep.c: Likewise.
2016-11-03 15:35:13 +01:00
|
|
|
/* Skip verify of sw_breakpoint_from_kind, invalid_p == 0 */
|
2016-11-03 15:35:14 +01:00
|
|
|
/* Skip verify of breakpoint_kind_from_current_state, invalid_p == 0 */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of adjust_breakpoint_address, has predicate. */
|
2000-04-03 02:00:32 +02:00
|
|
|
/* Skip verify of memory_insert_breakpoint, invalid_p == 0 */
|
|
|
|
/* Skip verify of memory_remove_breakpoint, invalid_p == 0 */
|
2004-01-17 16:34:13 +01:00
|
|
|
/* Skip verify of decr_pc_after_break, invalid_p == 0 */
|
2004-06-18 23:36:16 +02:00
|
|
|
/* Skip verify of deprecated_function_start_offset, invalid_p == 0 */
|
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o)
(xml-tdesc.o): Update.
* xml-support.c: Add a comment.
(gdb_xml_enums_boolean): New variable.
(gdb_xml_parse_attr_enum): Use strcasecmp.
* xml-support.h (gdb_xml_enums_boolean): Declare.
* xml-tdesc.c (struct tdesc_parsing_data): Record current_feature,
next_regnum, and current_union.
(tdesc_start_feature, tdesc_start_reg, tdesc_start_union)
(tdesc_end_union, tdesc_start_field, tdesc_start_vector)
(field_attributes, union_children, reg_attributes, union_attributes)
(vector_attributes, feature_attributes, feature_children): New.
(target_children): Make static. Add <feature>.
(tdesc_elements): Make static.
* target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p)
(struct tdesc_feature, tdesc_feature_p): New types.
(struct target_desc): Add features member.
(struct tdesc_arch_data, tdesc_data): New.
(target_find_description): Clarify error message. Warn about
ignored register descriptions.
(tdesc_has_registers, tdesc_find_feature, tdesc_feature_name)
(tdesc_named_type, tdesc_data_init, tdesc_data_alloc)
(tdesc_data_cleanup, tdesc_numbered_register)
(tdesc_numbered_register_choices, tdesc_find_register)
(tdesc_register_name, tdesc_register_type)
(tdesc_remote_register_number, tdesc_register_reggroup_p)
(set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type)
(set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers)
(tdesc_free_reg, tdesc_create_reg, tdesc_free_feature)
(tdesc_create_feature, tdesc_record_type): New.
(free_target_description): Free features.
(_initialize_target_descriptions): Initialize tdesc_data.
* arch-utils.c (default_remote_register_number): New.
* arch-utils.h (default_remote_register_number): New prototype.
* target-descriptions.h (set_tdesc_pseudo_register_name)
(set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p)
(tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup)
(tdesc_numbered_register, tdesc_numbered_register_choices)
(tdesc_has_registers, tdesc_find_feature, tdesc_feature_name)
(tdesc_named_type, tdesc_create_feature, tdesc_record_type)
(tdesc_create_reg): Declare.
* gdbarch.sh (remote_register_number): New entry.
* gdbarch.c, gdbarch.h: Regenerate.
* remote.c (init_remote_state): Use gdbarch_remote_register_number.
* features/gdb-target.dtd: Add feature, reg, vector, union, and field.
* arm-tdep.c (arm_register_aliases): New.
(arm_register_name_strings): Rename to...
(arm_register_names): ...this. Make const. Delete the old version.
(current_option, arm_register_byte): Delete.
(set_disassembly_style): Simplify. Do not adjust arm_register_names.
(value_of_arm_user_reg): New.
(arm_gdbarch_init): Verify any described registers. Call
tdesc_use_registers. Don't use arm_register_byte. Create aliases
for standard register names.
(_initialize_arm_tdep): Do not adjust arm_register_names.
* user-regs.c (struct user_reg): Add baton member.
(append_user_reg, user_reg_add_builtin, user_regs_init)
(user_reg_add, value_of_user_reg): Use a baton for user
register functions.
* std-regs.c: Update.
* user-regs.h (user_reg_read_ftype, user_reg_add_builtin)
(user_reg_add): Add baton argument.
* NEWS: Mention target description register support.
* features/arm-core.xml, features/arm-fpa.xml: New.
* eval.c (evaluate_subexp_standard): Allow ptype $register
when the program is not running.
* gdb.texinfo (-target-disconnect): Use @smallexample.
(Requirements): Add anchor for Expat. Update description.
(Target Descriptions): Mention Expat.
(Target Description Format): Document new elements. Use
@smallexample.
(Predefined Target Types, Standard Target Features): New sections.
* doc/gdbint.texinfo (Target Descriptions): New section.
* gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp,
gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
|
|
|
/* Skip verify of remote_register_number, invalid_p == 0 */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of fetch_tls_load_module_address, has predicate. */
|
2004-02-11 16:40:28 +01:00
|
|
|
/* Skip verify of frame_args_skip, invalid_p == 0 */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of unwind_pc, has predicate. */
|
|
|
|
/* Skip verify of unwind_sp, has predicate. */
|
|
|
|
/* Skip verify of frame_num_args, has predicate. */
|
|
|
|
/* Skip verify of frame_align, has predicate. */
|
2003-09-17 21:48:42 +02:00
|
|
|
/* Skip verify of stabs_argument_has_addr, invalid_p == 0 */
|
2000-10-26 09:41:25 +02:00
|
|
|
/* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */
|
2001-06-16 00:10:21 +02:00
|
|
|
/* Skip verify of addr_bits_remove, invalid_p == 0 */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of software_single_step, has predicate. */
|
|
|
|
/* Skip verify of single_step_through_delay, has predicate. */
|
2007-11-12 07:47:56 +01:00
|
|
|
if (gdbarch->print_insn == 0)
|
Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy
This patch starts from the desire to eliminate
make_cleanup_ui_file_delete, but then goes beyond. It makes ui_file &
friends a real C++ class hierarchy, and switches temporary
ui_file-like objects to stack-based allocation.
- mem_fileopen -> string_file
mem_fileopen is replaced with a new string_file class that is treated
as a value class created on the stack. This alone eliminates most
make_cleanup_ui_file_delete calls, and, simplifies code a whole lot
(diffstat shows around 1k loc dropped.)
string_file's internal buffer is a std::string, thus the "string" in
the name. This simplifies the implementation much, compared to
mem_fileopen, which managed growing its internal buffer manually.
- ui_file_as_string, ui_file_strdup, ui_file_obsavestring all gone
The new string_file class has a string() method that provides direct
writable access to the internal std::string buffer. This replaced
ui_file_as_string, which forced a copy of the same data the stream had
inside. With direct access via a writable reference, we can instead
move the string out of the string_stream, avoiding deep string
copying.
Related, ui_file_xstrdup calls are replaced with xstrdup'ping the
stream's string, and ui_file_obsavestring is replaced by
obstack_copy0.
With all those out of the way, getting rid of the weird ui_file_put
mechanism was possible.
- New ui_file::printf, ui_file::puts, etc. methods
These simplify / clarify client code. I considered splitting
client-code changes, like these, e.g.:
- stb = mem_fileopen ();
- fprintf_unfiltered (stb, "%s%s%s",
- _("The valid values are:\n"),
- regdesc,
- _("The default is \"std\"."));
+ string_file stb;
+ stb.printf ("%s%s%s",
+ _("The valid values are:\n"),
+ regdesc,
+ _("The default is \"std\"."));
In two steps, with the first step leaving fprintf_unfiltered (etc.)
calls in place, and only afterwards do a pass to change all those to
call stb.printf etc.. I didn't do that split, because (when I tried),
it turned out to be pointless make-work: the first pass would have to
touch the fprintf_unfiltered line anyway, to replace "stb" with
"&stb".
- gdb_fopen replaced with stack-based objects
This avoids the need for cleanups or unique_ptr's. I.e., this:
struct ui_file *file = gdb_fopen (filename, "w");
if (filename == NULL)
perror_with_name (filename);
cleanups = make_cleanup_ui_file_delete (file);
// use file.
do_cleanups (cleanups);
is replaced with this:
stdio_file file;
if (!file.open (filename, "w"))
perror_with_name (filename);
// use file.
- odd contorsions in null_file_write / null_file_fputs around when to
call to_fputs / to_write eliminated.
- Global null_stream object
A few places that were allocating a ui_file in order to print to
"nowhere" are adjusted to instead refer to a new 'null_stream' global
stream.
- TUI's tui_sfileopen eliminated. TUI's ui_file much simplified
The TUI's ui_file was serving a dual purpose. It supported being used
as string buffer, and supported being backed by a stdio FILE. The
string buffer part is gone, replaced by using of string_file. The
'FILE *' support is now much simplified, by making the TUI's ui_file
inherit from stdio_file.
gdb/ChangeLog:
2017-02-02 Pedro Alves <palves@redhat.com>
* ada-lang.c (type_as_string): Use string_file.
* ada-valprint.c (ada_print_floating): Use string_file.
* ada-varobj.c (ada_varobj_scalar_image)
(ada_varobj_get_value_image): Use string_file.
* aix-thread.c (aix_thread_extra_thread_info): Use string_file.
* arm-tdep.c (_initialize_arm_tdep): Use string_printf.
* breakpoint.c (update_inserted_breakpoint_locations)
(insert_breakpoint_locations, reattach_breakpoints)
(print_breakpoint_location, print_one_detail_ranged_breakpoint)
(print_it_watchpoint): Use string_file.
(save_breakpoints): Use stdio_file.
* c-exp.y (oper): Use string_file.
* cli/cli-logging.c (set_logging_redirect): Use ui_file_up and
tee_file.
(pop_output_files): Use delete.
(handle_redirections): Use stdio_file and tee_file.
* cli/cli-setshow.c (do_show_command): Use string_file.
* compile/compile-c-support.c (c_compute_program): Use
string_file.
* compile/compile-c-symbols.c (generate_vla_size): Take a
'string_file &' instead of a 'ui_file *'.
(generate_c_for_for_one_variable): Take a 'string_file &' instead
of a 'ui_file *'. Use string_file.
(generate_c_for_variable_locations): Take a 'string_file &'
instead of a 'ui_file *'.
* compile/compile-internal.h (generate_c_for_for_one_variable):
Take a 'string_file &' instead of a 'ui_file *'.
* compile/compile-loc2c.c (push, pushf, unary, binary)
(print_label, pushf_register_address, pushf_register)
(do_compile_dwarf_expr_to_c): Take a 'string_file &' instead of a
'ui_file *'. Adjust.
* compile/compile.c (compile_to_object): Use string_file.
* compile/compile.h (compile_dwarf_expr_to_c)
(compile_dwarf_bounds_to_c): Take a 'string_file &' instead of a
'ui_file *'.
* cp-support.c (inspect_type): Use string_file and obstack_copy0.
(replace_typedefs_qualified_name): Use string_file and
obstack_copy0.
* disasm.c (gdb_pretty_print_insn): Use string_file.
(gdb_disassembly): Adjust reference the null_stream global.
(do_ui_file_delete): Delete.
(gdb_insn_length): Use null_stream.
* dummy-frame.c (maintenance_print_dummy_frames): Use stdio_file.
* dwarf2loc.c (dwarf2_compile_property_to_c)
(locexpr_generate_c_location, loclist_generate_c_location): Take a
'string_file &' instead of a 'ui_file *'.
* dwarf2loc.h (dwarf2_compile_property_to_c): Likewise.
* dwarf2read.c (do_ui_file_peek_last): Delete.
(dwarf2_compute_name): Use string_file.
* event-top.c (gdb_setup_readline): Use stdio_file.
* gdbarch.sh (verify_gdbarch): Use string_file.
* gdbtypes.c (safe_parse_type): Use null_stream.
* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use
string_file.
* guile/scm-disasm.c (gdbscm_print_insn_from_port): Take a
'string_file *' instead of a 'ui_file *'.
(gdbscm_arch_disassemble): Use string_file.
* guile/scm-frame.c (frscm_print_frame_smob): Use string_file.
* guile/scm-ports.c (class ioscm_file_port): Now a class that
inherits from ui_file.
(ioscm_file_port_delete, ioscm_file_port_rewind)
(ioscm_file_port_put): Delete.
(ioscm_file_port_write): Rename to ...
(ioscm_file_port::write): ... this. Remove file_port_magic
checks.
(ioscm_file_port_new): Delete.
(ioscm_with_output_to_port_worker): Use ioscm_file_port and
ui_file_up.
* guile/scm-type.c (tyscm_type_name): Use string_file.
* guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print):
Use string_file.
* infcmd.c (print_return_value_1): Use string_file.
* infrun.c (print_target_wait_results): Use string_file.
* language.c (add_language): Use string_file.
* location.c (explicit_to_string_internal): Use string_file.
* main.c (captured_main_1): Use null_file.
* maint.c (maintenance_print_architecture): Use stdio_file.
* mi/mi-cmd-stack.c (list_arg_or_local): Use string_file.
* mi/mi-common.h (struct mi_interp) <out, err, log, targ,
event_channel>: Change type to mi_console_file pointer.
* mi/mi-console.c (mi_console_file_fputs, mi_console_file_flush)
(mi_console_file_delete): Delete.
(struct mi_console_file): Delete.
(mi_console_file_magic): Delete.
(mi_console_file_new): Delete.
(mi_console_file::mi_console_file): New.
(mi_console_file_delete): Delete.
(mi_console_file_fputs): Delete.
(mi_console_file::write): New.
(mi_console_raw_packet): Delete.
(mi_console_file::flush): New.
(mi_console_file_flush): Delete.
(mi_console_set_raw): Rename to ...
(mi_console_file::set_raw): ... this.
* mi/mi-console.h (class mi_console_file): New class.
(mi_console_file_new, mi_console_set_raw): Delete.
* mi/mi-interp.c (mi_interpreter_init): Use mi_console_file.
(mi_set_logging): Use delete and tee_file. Adjust.
* mi/mi-main.c (output_register): Use string_file.
(mi_cmd_data_evaluate_expression): Use string_file.
(mi_cmd_data_read_memory): Use string_file.
(mi_cmd_execute, print_variable_or_computed): Use string_file.
* mi/mi-out.c (mi_ui_out::main_stream): New.
(mi_ui_out::rewind): Use main_stream and
string_file.
(mi_ui_out::put): Use main_stream and string_file.
(mi_ui_out::mi_ui_out): Remove 'stream' parameter.
Allocate a 'string_file' instead.
(mi_out_new): Don't allocate a mem_fileopen stream here.
* mi/mi-out.h (mi_ui_out::mi_ui_out): Remove 'stream' parameter.
(mi_ui_out::main_stream): Declare method.
* printcmd.c (eval_command): Use string_file.
* psymtab.c (maintenance_print_psymbols): Use stdio_file.
* python/py-arch.c (archpy_disassemble): Use string_file.
* python/py-breakpoint.c (bppy_get_commands): Use string_file.
* python/py-frame.c (frapy_str): Use string_file.
* python/py-framefilter.c (py_print_type, py_print_single_arg):
Use string_file.
* python/py-type.c (typy_str): Use string_file.
* python/py-unwind.c (unwind_infopy_str): Use string_file.
* python/py-value.c (valpy_str): Use string_file.
* record-btrace.c (btrace_insn_history): Use string_file.
* regcache.c (regcache_print): Use stdio_file.
* reggroups.c (maintenance_print_reggroups): Use stdio_file.
* remote.c (escape_buffer): Use string_file.
* rust-lang.c (rust_get_disr_info): Use string_file.
* serial.c (serial_open_ops_1): Use stdio_file.
(do_serial_close): Use delete.
* stack.c (print_frame_arg): Use string_file.
(print_frame_args): Remove local mem_fileopen stream, not used.
(print_frame): Use string_file.
* symmisc.c (maintenance_print_symbols): Use stdio_file.
* symtab.h (struct symbol_computed_ops) <generate_c_location>:
Take a 'string_file *' instead of a 'ui_file *'.
* top.c (new_ui): Use stdio_file and stderr_file.
(free_ui): Use delete.
(execute_command_to_string): Use string_file.
(quit_confirm): Use string_file.
* tracepoint.c (collection_list::append_exp): Use string_file.
* tui/tui-disasm.c (tui_disassemble): Use string_file.
* tui/tui-file.c: Don't include "ui-file.h".
(enum streamtype, struct tui_stream): Delete.
(tui_file_new, tui_file_delete, tui_fileopen, tui_sfileopen)
(tui_file_isatty, tui_file_rewind, tui_file_put): Delete.
(tui_file::tui_file): New method.
(tui_file_fputs): Delete.
(tui_file_get_strbuf): Delete.
(tui_file::puts): New method.
(tui_file_adjust_strbuf): Delete.
(tui_file_flush): Delete.
(tui_file::flush): New method.
* tui/tui-file.h: Tweak intro comment.
Include ui-file.h.
(tui_fileopen, tui_sfileopen, tui_file_get_strbuf)
(tui_file_adjust_strbuf): Delete declarations.
(class tui_file): New class.
* tui/tui-io.c (tui_initialize_io): Use tui_file.
* tui/tui-regs.c (tui_restore_gdbout): Use delete.
(tui_register_format): Use string_stream.
* tui/tui-stack.c (tui_make_status_line): Use string_file.
(tui_get_function_from_frame): Use string_file.
* typeprint.c (type_to_string): Use string_file.
* ui-file.c (struct ui_file, ui_file_magic, ui_file_new): Delete.
(null_stream): New global.
(ui_file_delete): Delete.
(ui_file::ui_file): New.
(null_file_isatty): Delete.
(ui_file::~ui_file): New.
(null_file_rewind): Delete.
(ui_file::printf): New.
(null_file_put): Delete.
(null_file_flush): Delete.
(ui_file::putstr): New.
(null_file_write): Delete.
(ui_file::putstrn): New.
(null_file_read): Delete.
(ui_file::putc): New.
(null_file_fputs): Delete.
(null_file_write_async_safe): Delete.
(ui_file::vprintf): New.
(null_file_delete): Delete.
(null_file::write): New.
(null_file_fseek): Delete.
(null_file::puts): New.
(ui_file_data): Delete.
(null_file::write_async_safe): New.
(gdb_flush, ui_file_isatty): Adjust.
(ui_file_put, ui_file_rewind): Delete.
(ui_file_write): Adjust.
(ui_file_write_for_put): Delete.
(ui_file_write_async_safe, ui_file_read): Adjust.
(ui_file_fseek): Delete.
(fputs_unfiltered): Adjust.
(set_ui_file_flush, set_ui_file_isatty, set_ui_file_rewind)
(set_ui_file_put, set_ui_file_write, set_ui_file_write_async_safe)
(set_ui_file_read, set_ui_file_fputs, set_ui_file_fseek)
(set_ui_file_data): Delete.
(string_file::~string_file, string_file::write)
(struct accumulated_ui_file, do_ui_file_xstrdup, ui_file_xstrdup)
(do_ui_file_as_string, ui_file_as_string): Delete.
(do_ui_file_obsavestring, ui_file_obsavestring): Delete.
(struct mem_file): Delete.
(mem_file_new): Delete.
(stdio_file::stdio_file): New.
(mem_file_delete): Delete.
(stdio_file::stdio_file): New.
(mem_fileopen): Delete.
(stdio_file::~stdio_file): New.
(mem_file_rewind): Delete.
(stdio_file::set_stream): New.
(mem_file_put): Delete.
(stdio_file::open): New.
(mem_file_write): Delete.
(stdio_file_magic, struct stdio_file): Delete.
(stdio_file_new, stdio_file_delete, stdio_file_flush): Delete.
(stdio_file::flush): New.
(stdio_file_read): Rename to ...
(stdio_file::read): ... this. Adjust.
(stdio_file_write): Rename to ...
(stdio_file::write): ... this. Adjust.
(stdio_file_write_async_safe): Rename to ...
(stdio_file::write_async_safe) ... this. Adjust.
(stdio_file_fputs): Rename to ...
(stdio_file::puts) ... this. Adjust.
(stdio_file_isatty): Delete.
(stdio_file_fseek): Delete.
(stdio_file::isatty): New.
(stderr_file_write): Rename to ...
(stderr_file::write) ... this. Adjust.
(stderr_file_fputs): Rename to ...
(stderr_file::puts) ... this. Adjust.
(stderr_fileopen, stdio_fileopen, gdb_fopen): Delete.
(stderr_file::stderr_file): New.
(tee_file_magic): Delete.
(struct tee_file): Delete.
(tee_file::tee_file): New.
(tee_file_new): Delete.
(tee_file::~tee_file): New.
(tee_file_delete): Delete.
(tee_file_flush): Rename to ...
(tee_file::flush): ... this. Adjust.
(tee_file_write): Rename to ...
(tee_file::write): ... this. Adjust.
(tee_file::write_async_safe): New.
(tee_file_fputs): Rename to ...
(tee_file::puts): ... this. Adjust.
(tee_file_isatty): Rename to ...
(tee_file::isatty): ... this. Adjust.
* ui-file.h (struct obstack, struct ui_file): Don't
forward-declare.
(ui_file_new, ui_file_flush_ftype, set_ui_file_flush)
(ui_file_write_ftype)
(set_ui_file_write, ui_file_fputs_ftype, set_ui_file_fputs)
(ui_file_write_async_safe_ftype, set_ui_file_write_async_safe)
(ui_file_read_ftype, set_ui_file_read, ui_file_isatty_ftype)
(set_ui_file_isatty, ui_file_rewind_ftype, set_ui_file_rewind)
(ui_file_put_method_ftype, ui_file_put_ftype, set_ui_file_put)
(ui_file_delete_ftype, set_ui_file_data, ui_file_fseek_ftype)
(set_ui_file_fseek): Delete.
(ui_file_data, ui_file_delete, ui_file_rewind)
(struct ui_file): New.
(ui_file_up): New.
(class null_file): New.
(null_stream): Declare.
(ui_file_write_for_put, ui_file_put): Delete.
(ui_file_xstrdup, ui_file_as_string, ui_file_obsavestring):
Delete.
(ui_file_fseek, mem_fileopen, stdio_fileopen, stderr_fileopen)
(gdb_fopen, tee_file_new): Delete.
(struct string_file): New.
(struct stdio_file): New.
(stdio_file_up): New.
(struct stderr_file): New.
(class tee_file): New.
* ui-out.c (ui_out::field_stream): Take a 'string_file &' instead
of a 'ui_file *'. Adjust.
* ui-out.h (class ui_out) <field_stream>: Likewise.
* utils.c (do_ui_file_delete, make_cleanup_ui_file_delete)
(null_stream): Delete.
(error_stream): Take a 'string_file &' instead of a 'ui_file *'.
Adjust.
* utils.h (struct ui_file): Delete forward declaration..
(make_cleanup_ui_file_delete, null_stream): Delete declarations.
(error_stream): Take a 'string_file &' instead of a
'ui_file *'.
* varobj.c (varobj_value_get_print_value): Use string_file.
* xtensa-tdep.c (xtensa_verify_config): Use string_file.
* gdbarch.c: Regenerate.
2017-02-02 12:11:47 +01:00
|
|
|
log.puts ("\n\tprint_insn");
|
2001-08-15 17:29:56 +02:00
|
|
|
/* Skip verify of skip_trampoline_code, invalid_p == 0 */
|
2003-11-09 13:07:16 +01:00
|
|
|
/* Skip verify of skip_solib_resolver, invalid_p == 0 */
|
2002-08-21 01:01:29 +02:00
|
|
|
/* Skip verify of in_solib_return_trampoline, invalid_p == 0 */
|
2015-05-26 12:59:17 +02:00
|
|
|
/* Skip verify of stack_frame_destroyed_p, invalid_p == 0 */
|
MIPS: Keep the ISA bit in compressed code addresses
1. Background information
The MIPS architecture, as originally designed and implemented in
mid-1980s has a uniform instruction word size that is 4 bytes, naturally
aligned. As such all MIPS instructions are located at addresses that
have their bits #1 and #0 set to zeroes, and any attempt to execute an
instruction from an address that has any of the two bits set to one
causes an address error exception. This may for example happen when a
jump-register instruction is executed whose register value used as the
jump target has any of these bits set.
Then in mid 1990s LSI sought a way to improve code density for their
TinyRISC family of MIPS cores and invented an alternatively encoded
instruction set in a joint effort with MIPS Technologies (then a
subsidiary of SGI). The new instruction set has been named the MIPS16
ASE (Application-Specific Extension) and uses a variable instruction
word size, which is 2 bytes (as the name of the ASE suggests) for most,
but there are a couple of exceptions that take 4 bytes, and then most of
the 2-byte instructions can be treated with a 2-byte extension prefix to
expand the range of the immediate operands used.
As a result instructions are no longer 4-byte aligned, instead they are
aligned to a multiple of 2. That left the bit #0 still unused for code
references, be it for the standard MIPS (i.e. as originally invented) or
for the MIPS16 instruction set, and based on that observation a clever
trick was invented that on one hand allowed the processor to be
seamlessly switched between the two instruction sets at any time at the
run time while on the other avoided the introduction of any special
control register to do that.
So it is the bit #0 of the instruction address that was chosen as the
selector and named the ISA bit. Any instruction executed at an even
address is interpreted as a standard MIPS instruction (the address still
has to have its bit #1 clear), any instruction executed at an odd
address is interpreted as a MIPS16 instruction.
To switch between modes ordinary jump instructions are used, such as
used for function calls and returns, specifically the bit #0 of the
source register used in jump-register instructions selects the execution
(ISA) mode for the following piece of code to be interpreted in.
Additionally new jump-immediate instructions were added that flipped the
ISA bit to select the opposite mode upon execution. They were
considered necessary to avoid the need to make register jumps in all
cases as the original jump-immediate instructions provided no way to
change the bit #0 at all.
This was all important for cases where standard MIPS and MIPS16 code had
to be mixed, either for compatibility with the existing binary code base
or to access resources not reachable from MIPS16 code (the MIPS16
instruction set only provides access to general-purpose registers, and
not for example floating-point unit registers or privileged coprocessor
0 registers) -- pieces of code in the opposite mode can be executed as
ordinary subroutine calls.
A similar approach has been more recently adopted for the MIPS16
replacement instruction set defined as the so called microMIPS ASE.
This is another instruction set encoding introduced to the MIPS
architecture. Just like the MIPS16 ASE, the microMIPS instruction set
uses a variable-length encoding, where each instruction takes a multiple
of 2 bytes. The ISA bit has been reused and for microMIPS-capable
processors selects between the standard MIPS and the microMIPS mode
instead.
2. Statement of the problem
To put it shortly, MIPS16 and microMIPS code pointers used by GDB are
different to these observed at the run time. This results in the same
expressions being evaluated producing different results in GDB and in
the program being debugged. Obviously it's the results obtained at the
run time that are correct (they define how the program behaves) and
therefore by definition the results obtained in GDB are incorrect.
A bit longer description will record that obviously at the run time the
ISA bit has to be set correctly (refer to background information above
if unsure why so) or the program will not run as expected. This is
recorded in all the executable file structures used at the run time: the
dynamic symbol table (but not always the static one!), the GOT, and
obviously in all the addresses embedded in code or data of the program
itself, calculated by applying the appropriate relocations at the static
link time.
While a program is being processed by GDB, the ISA bit is stripped off
from any code addresses, presumably to make them the same as the
respective raw memory byte address used by the processor to access the
instruction in the instruction fetch access cycle. This stripping is
actually performed outside GDB proper, in BFD, specifically
_bfd_mips_elf_symbol_processing (elfxx-mips.c, see the piece of code at
the very bottom of that function, starting with an: "If this is an
odd-valued function symbol, assume it's a MIPS16 or microMIPS one."
comment).
This function is also responsible for symbol table dumps made by
`objdump' too, so you'll never see the ISA bit reported there by that
tool, you need to use `readelf'.
This is however unlike what is ever done at the run time, the ISA bit
once present is never stripped off, for example a cast like this:
(short *) main
will not strip the ISA bit off and if the resulting pointer is intended
to be used to access instructions as data, for example for software
instruction decoding (like for fault recovery or emulation in a signal
handler) or for self-modifying code then the bit still has to be
stripped off by an explicit AND operation.
This is probably best illustrated with a simple real program example.
Let's consider the following simple program:
$ cat foobar.c
int __attribute__ ((mips16)) foo (void)
{
return 1;
}
int __attribute__ ((mips16)) bar (void)
{
return 2;
}
int __attribute__ ((nomips16)) foo32 (void)
{
return 3;
}
int (*foo32p) (void) = foo32;
int (*foop) (void) = foo;
int fooi = (int) foo;
int
main (void)
{
return foop ();
}
$
This is plain C with no odd tricks, except from the instruction mode
attributes. They are not necessary to trigger this problem, I just put
them here so that the program can be contained in a single source file
and to make it obvious which function is MIPS16 code and which is not.
Let's try it with Linux, so that everyone can repeat this experiment:
$ mips-linux-gnu-gcc -mips16 -g -O2 -o foobar foobar.c
$
Let's have a look at some interesting symbols:
$ mips-linux-gnu-readelf -s foobar | egrep 'table|foo|bar'
Symbol table '.dynsym' contains 7 entries:
Symbol table '.symtab' contains 95 entries:
55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c
66: 0040068c 4 FUNC GLOBAL DEFAULT [MIPS16] 12 bar
68: 00410848 4 OBJECT GLOBAL DEFAULT 21 foo32p
70: 00410844 4 OBJECT GLOBAL DEFAULT 21 foop
78: 00400684 8 FUNC GLOBAL DEFAULT 12 foo32
80: 00400680 4 FUNC GLOBAL DEFAULT [MIPS16] 12 foo
88: 00410840 4 OBJECT GLOBAL DEFAULT 21 fooi
$
Hmm, no sight of the ISA bit, but notice how foo and bar (but not
foo32!) have been marked as MIPS16 functions (ELF symbol structure's
`st_other' field is used for that).
So let's try to run and poke at this program with GDB. I'll be using a
native system for simplicity (I'll be using ellipses here and there to
remove unrelated clutter):
$ ./foobar
$ echo $?
1
$
So far, so good.
$ gdb ./foobar
[...]
(gdb) break main
Breakpoint 1 at 0x400490: file foobar.c, line 23.
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb)
Yay, it worked! OK, so let's poke at it:
(gdb) print main
$1 = {int (void)} 0x400490 <main>
(gdb) print foo32
$2 = {int (void)} 0x400684 <foo32>
(gdb) print foo32p
$3 = (int (*)(void)) 0x400684 <foo32>
(gdb) print bar
$4 = {int (void)} 0x40068c <bar>
(gdb) print foo
$5 = {int (void)} 0x400680 <foo>
(gdb) print foop
$6 = (int (*)(void)) 0x400681 <foo>
(gdb)
A-ha! Here's the difference and finally the ISA bit!
(gdb) print /x fooi
$7 = 0x400681
(gdb) p/x $pc
p/x $pc
$8 = 0x400491
(gdb)
And here as well...
(gdb) advance foo
foo () at foobar.c:4
4 }
(gdb) disassemble
Dump of assembler code for function foo:
0x00400680 <+0>: jr ra
0x00400682 <+2>: li v0,1
End of assembler dump.
(gdb) finish
Run till exit from #0 foo () at foobar.c:4
main () at foobar.c:24
24 }
Value returned is $9 = 1
(gdb) continue
Continuing.
[Inferior 1 (process 14103) exited with code 01]
(gdb)
So let's be a bit inquisitive...
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb)
Actually we do not like to run foo here at all. Let's run bar instead!
(gdb) set foop = bar
(gdb) print foop
$10 = (int (*)(void)) 0x40068c <bar>
(gdb)
Hmm, no ISA bit. Is it going to work?
(gdb) advance bar
bar () at foobar.c:9
9 }
(gdb) p/x $pc
$11 = 0x40068c
(gdb) disassemble
Dump of assembler code for function bar:
=> 0x0040068c <+0>: jr ra
0x0040068e <+2>: li v0,2
End of assembler dump.
(gdb) finish
Run till exit from #0 bar () at foobar.c:9
Program received signal SIGILL, Illegal instruction.
bar () at foobar.c:9
9 }
(gdb)
Oops!
(gdb) p/x $pc
$12 = 0x40068c
(gdb)
We're still there!
(gdb) continue
Continuing.
Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb)
So let's try something else:
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) set foop = foo
(gdb) advance foo
foo () at foobar.c:4
4 }
(gdb) disassemble
Dump of assembler code for function foo:
=> 0x00400680 <+0>: jr ra
0x00400682 <+2>: li v0,1
End of assembler dump.
(gdb) finish
Run till exit from #0 foo () at foobar.c:4
Program received signal SIGILL, Illegal instruction.
foo () at foobar.c:4
4 }
(gdb) continue
Continuing.
Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb)
The same problem!
(gdb) run
Starting program:
/net/build2-lucid-cs/scratch/macro/mips-linux-fsf-gcc/isa-bit/foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) set foop = foo32
(gdb) advance foo32
foo32 () at foobar.c:14
14 }
(gdb) disassemble
Dump of assembler code for function foo32:
=> 0x00400684 <+0>: jr ra
0x00400688 <+4>: li v0,3
End of assembler dump.
(gdb) finish
Run till exit from #0 foo32 () at foobar.c:14
main () at foobar.c:24
24 }
Value returned is $14 = 3
(gdb) continue
Continuing.
[Inferior 1 (process 14113) exited with code 03]
(gdb)
That did work though, so it's the ISA bit only!
(gdb) quit
Enough!
That's the tip of the iceberg only though. So let's rebuild the
executable with some dynamic symbols:
$ mips-linux-gnu-gcc -mips16 -Wl,--export-dynamic -g -O2 -o foobar-dyn foobar.c
$ mips-linux-gnu-readelf -s foobar-dyn | egrep 'table|foo|bar'
Symbol table '.dynsym' contains 32 entries:
6: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar
8: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p
9: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop
15: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32
17: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo
25: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi
Symbol table '.symtab' contains 95 entries:
55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c
69: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar
71: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p
72: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop
79: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32
81: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo
89: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi
$
OK, now the ISA bit is there for a change, but the MIPS16 `st_other'
attribute gone, hmm... What does `objdump' do then:
$ mips-linux-gnu-objdump -Tt foobar-dyn | egrep 'SYMBOL|foo|bar'
foobar-dyn: file format elf32-tradbigmips
SYMBOL TABLE:
00000000 l df *ABS* 00000000 foobar.c
004009cc g F .text 00000004 0xf0 bar
00410b88 g O .data 00000004 foo32p
00410b84 g O .data 00000004 foop
004009c4 g F .text 00000008 foo32
004009c0 g F .text 00000004 0xf0 foo
00410b80 g O .data 00000004 fooi
DYNAMIC SYMBOL TABLE:
004009cc g DF .text 00000004 Base 0xf0 bar
00410b88 g DO .data 00000004 Base foo32p
00410b84 g DO .data 00000004 Base foop
004009c4 g DF .text 00000008 Base foo32
004009c0 g DF .text 00000004 Base 0xf0 foo
00410b80 g DO .data 00000004 Base fooi
$
Hmm, the attribute (0xf0, printed raw) is back, and the ISA bit gone
again.
Let's have a look at some DWARF-2 records GDB uses (I'll be stripping
off a lot here for brevity) -- debug info:
$ mips-linux-gnu-readelf -wi foobar
Contents of the .debug_info section:
[...]
Compilation Unit @ offset 0x88:
Length: 0xbb (32-bit)
Version: 4
Abbrev Offset: 62
Pointer Size: 4
<0><93>: Abbrev Number: 1 (DW_TAG_compile_unit)
<94> DW_AT_producer : (indirect string, offset: 0x19e): GNU C 4.8.0 20120513 (experimental) -meb -mips16 -march=mips32r2 -mhard-float -mllsc -mplt -mno-synci -mno-shared -mabi=32 -g -O2
<98> DW_AT_language : 1 (ANSI C)
<99> DW_AT_name : (indirect string, offset: 0x190): foobar.c
<9d> DW_AT_comp_dir : (indirect string, offset: 0x225): [...]
<a1> DW_AT_ranges : 0x0
<a5> DW_AT_low_pc : 0x0
<a9> DW_AT_stmt_list : 0x27
<1><ad>: Abbrev Number: 2 (DW_TAG_subprogram)
<ae> DW_AT_external : 1
<ae> DW_AT_name : foo
<b2> DW_AT_decl_file : 1
<b3> DW_AT_decl_line : 1
<b4> DW_AT_prototyped : 1
<b4> DW_AT_type : <0xc2>
<b8> DW_AT_low_pc : 0x400680
<bc> DW_AT_high_pc : 0x400684
<c0> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<c2> DW_AT_GNU_all_call_sites: 1
<1><c2>: Abbrev Number: 3 (DW_TAG_base_type)
<c3> DW_AT_byte_size : 4
<c4> DW_AT_encoding : 5 (signed)
<c5> DW_AT_name : int
<1><c9>: Abbrev Number: 4 (DW_TAG_subprogram)
<ca> DW_AT_external : 1
<ca> DW_AT_name : (indirect string, offset: 0x18a): foo32
<ce> DW_AT_decl_file : 1
<cf> DW_AT_decl_line : 11
<d0> DW_AT_prototyped : 1
<d0> DW_AT_type : <0xc2>
<d4> DW_AT_low_pc : 0x400684
<d8> DW_AT_high_pc : 0x40068c
<dc> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<de> DW_AT_GNU_all_call_sites: 1
<1><de>: Abbrev Number: 2 (DW_TAG_subprogram)
<df> DW_AT_external : 1
<df> DW_AT_name : bar
<e3> DW_AT_decl_file : 1
<e4> DW_AT_decl_line : 6
<e5> DW_AT_prototyped : 1
<e5> DW_AT_type : <0xc2>
<e9> DW_AT_low_pc : 0x40068c
<ed> DW_AT_high_pc : 0x400690
<f1> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<f3> DW_AT_GNU_all_call_sites: 1
<1><f3>: Abbrev Number: 5 (DW_TAG_subprogram)
<f4> DW_AT_external : 1
<f4> DW_AT_name : (indirect string, offset: 0x199): main
<f8> DW_AT_decl_file : 1
<f9> DW_AT_decl_line : 21
<fa> DW_AT_prototyped : 1
<fa> DW_AT_type : <0xc2>
<fe> DW_AT_low_pc : 0x400490
<102> DW_AT_high_pc : 0x4004a4
<106> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<108> DW_AT_GNU_all_tail_call_sites: 1
[...]
$
-- no sign of the ISA bit anywhere -- frame info:
$ mips-linux-gnu-readelf -wf foobar
[...]
Contents of the .debug_frame section:
00000000 0000000c ffffffff CIE
Version: 1
Augmentation: ""
Code alignment factor: 1
Data alignment factor: -4
Return address column: 31
DW_CFA_def_cfa_register: r29
DW_CFA_nop
00000010 0000000c 00000000 FDE cie=00000000 pc=00400680..00400684
00000020 0000000c 00000000 FDE cie=00000000 pc=00400684..0040068c
00000030 0000000c 00000000 FDE cie=00000000 pc=0040068c..00400690
00000040 00000018 00000000 FDE cie=00000000 pc=00400490..004004a4
DW_CFA_advance_loc: 6 to 00400496
DW_CFA_def_cfa_offset: 32
DW_CFA_offset: r31 at cfa-4
DW_CFA_advance_loc: 6 to 0040049c
DW_CFA_restore: r31
DW_CFA_def_cfa_offset: 0
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
[...]
$
-- no sign of the ISA bit anywhere -- range info (GDB doesn't use arange):
$ mips-linux-gnu-readelf -wR foobar
Contents of the .debug_ranges section:
Offset Begin End
00000000 00400680 00400690
00000000 00400490 004004a4
00000000 <End of list>
$
-- no sign of the ISA bit anywhere -- line info:
$ mips-linux-gnu-readelf -wl foobar
Raw dump of debug contents of section .debug_line:
[...]
Offset: 0x27
Length: 78
DWARF Version: 2
Prologue Length: 31
Minimum Instruction Length: 1
Initial value of 'is_stmt': 1
Line Base: -5
Line Range: 14
Opcode Base: 13
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 args
Opcode 3 has 1 args
Opcode 4 has 1 args
Opcode 5 has 1 args
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 args
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 args
The Directory Table is empty.
The File Name Table:
Entry Dir Time Size Name
1 0 0 0 foobar.c
Line Number Statements:
Extended opcode 2: set Address to 0x400681
Special opcode 6: advance Address by 0 to 0x400681 and Line by 1 to 2
Special opcode 7: advance Address by 0 to 0x400681 and Line by 2 to 4
Special opcode 55: advance Address by 3 to 0x400684 and Line by 8 to 12
Special opcode 7: advance Address by 0 to 0x400684 and Line by 2 to 14
Advance Line by -7 to 7
Special opcode 131: advance Address by 9 to 0x40068d and Line by 0 to 7
Special opcode 7: advance Address by 0 to 0x40068d and Line by 2 to 9
Advance PC by 3 to 0x400690
Extended opcode 1: End of Sequence
Extended opcode 2: set Address to 0x400491
Advance Line by 21 to 22
Copy
Special opcode 6: advance Address by 0 to 0x400491 and Line by 1 to 23
Special opcode 60: advance Address by 4 to 0x400495 and Line by -1 to 22
Special opcode 34: advance Address by 2 to 0x400497 and Line by 1 to 23
Special opcode 62: advance Address by 4 to 0x40049b and Line by 1 to 24
Special opcode 32: advance Address by 2 to 0x40049d and Line by -1 to 23
Special opcode 6: advance Address by 0 to 0x40049d and Line by 1 to 24
Advance PC by 7 to 0x4004a4
Extended opcode 1: End of Sequence
[...]
-- a-ha, the ISA bit is there! However it's not always right for some
reason, I don't have a small test case to show it, but here's an excerpt
from MIPS16 libc, a prologue of a function:
00019630 <__libc_init_first>:
19630: e8a0 jrc ra
19632: 6500 nop
00019634 <_init>:
19634: f000 6a11 li v0,17
19638: f7d8 0b08 la v1,15e00 <_DYNAMIC+0x15c54>
1963c: f400 3240 sll v0,16
19640: e269 addu v0,v1
19642: 659a move gp,v0
19644: 64f6 save 48,ra,s0-s1
19646: 671c move s0,gp
19648: d204 sw v0,16(sp)
1964a: f352 984c lw v0,-27828(s0)
1964e: 6724 move s1,a0
and the corresponding DWARF-2 line info:
Line Number Statements:
Extended opcode 2: set Address to 0x19631
Advance Line by 44 to 45
Copy
Special opcode 8: advance Address by 0 to 0x19631 and Line by 3 to 48
Special opcode 66: advance Address by 4 to 0x19635 and Line by 5 to 53
Advance PC by constant 17 to 0x19646
Special opcode 25: advance Address by 1 to 0x19647 and Line by 6 to 59
Advance Line by -6 to 53
Special opcode 33: advance Address by 2 to 0x19649 and Line by 0 to 53
Special opcode 39: advance Address by 2 to 0x1964b and Line by 6 to 59
Advance Line by -6 to 53
Special opcode 61: advance Address by 4 to 0x1964f and Line by 0 to 53
-- see that "Advance PC by constant 17" there? It clears the ISA bit,
however code at 0x19646 is not standard MIPS code at all. For some
reason the constant is always 17, I've never seen DW_LNS_const_add_pc
used with any other value -- is that a binutils bug or what?
3. Solution:
I think we should retain the value of the ISA bit in code references,
that is effectively treat them as cookies as they indeed are (although
trivially calculated) rather than raw memory byte addresses.
In a perfect world both the static symbol table and the respective
DWARF-2 records should be fixed to include the ISA bit in all the cases.
I think however that this is infeasible.
All the uses of `_bfd_mips_elf_symbol_processing' can not necessarily be
tracked down. This function is used by `elf_slurp_symbol_table' that in
turn is used by `bfd_canonicalize_symtab' and
`bfd_canonicalize_dynamic_symtab', which are public interfaces.
Similarly DWARF-2 records are used outside GDB, one notable if a bit
questionable is the exception unwinder (libgcc/unwind-dw2.c) -- I have
identified at least bits in `execute_cfa_program' and
`uw_frame_state_for', both around the calls to `_Unwind_IsSignalFrame',
that would need an update as they effectively flip the ISA bit freely;
see also the comment about MASK_RETURN_ADDR in gcc/config/mips/mips.h.
But there may be more places. Any change in how DWARF-2 records are
produced would require an update there and would cause compatibility
problems with libgcc.a binaries already distributed; given that this is
a static library a complex change involving function renames would
likely be required.
I propose therefore to accept the existing inconsistencies and deal with
them entirely within GDB. I have figured out that the ISA bit lost in
various places can still be recovered as long as we have symbol
information -- that'll have the `st_other' attribute correctly set to
one of standard MIPS/MIPS16/microMIPS encoding.
Here's the resulting change. It adds a couple of new `gdbarch' hooks,
one to update symbol information with the ISA bit lost in
`_bfd_mips_elf_symbol_processing', and two other ones to adjust DWARF-2
records as they're processed. The ISA bit is set in each address
handled according to information retrieved from the symbol table for the
symbol spanning the address if any; limits are adjusted based on the
address they point to related to the respective base address.
Additionally minimal symbol information has to be adjusted accordingly
in its gdbarch hook.
With these changes in place some complications with ISA bit juggling in
the PC that never fully worked can be removed from the MIPS backend.
Conversely, the generic dynamic linker event special breakpoint symbol
handler has to be updated to call the minimal symbol gdbarch hook to
record that the symbol is a MIPS16 or microMIPS address if applicable or
the breakpoint will be set at the wrong address and either fail to work
or cause SIGTRAPs (this is because the symbol is handled early on and
bypasses regular symbol processing).
4. Results obtained
The change fixes the example above -- to repeat only the crucial steps:
(gdb) break main
Breakpoint 1 at 0x400491: file foobar.c, line 23.
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) print foo
$1 = {int (void)} 0x400681 <foo>
(gdb) set foop = bar
(gdb) advance bar
bar () at foobar.c:9
9 }
(gdb) disassemble
Dump of assembler code for function bar:
=> 0x0040068d <+0>: jr ra
0x0040068f <+2>: li v0,2
End of assembler dump.
(gdb) finish
Run till exit from #0 bar () at foobar.c:9
main () at foobar.c:24
24 }
Value returned is $2 = 2
(gdb) continue
Continuing.
[Inferior 1 (process 14128) exited with code 02]
(gdb)
-- excellent!
The change removes about 90 failures per MIPS16 multilib in mips-sde-elf
testing too, results for MIPS16 are now similar to that for standard
MIPS; microMIPS results are a bit worse because of host-I/O problems in
QEMU used instead of MIPSsim for microMIPS testing only:
=== gdb Summary ===
# of expected passes 14299
# of unexpected failures 187
# of expected failures 56
# of known failures 58
# of unresolved testcases 11
# of untested testcases 52
# of unsupported tests 174
MIPS16:
=== gdb Summary ===
# of expected passes 14298
# of unexpected failures 187
# of unexpected successes 2
# of expected failures 54
# of known failures 58
# of unresolved testcases 12
# of untested testcases 52
# of unsupported tests 174
microMIPS:
=== gdb Summary ===
# of expected passes 14149
# of unexpected failures 201
# of unexpected successes 2
# of expected failures 54
# of known failures 58
# of unresolved testcases 7
# of untested testcases 53
# of unsupported tests 175
2014-12-12 Maciej W. Rozycki <macro@codesourcery.com>
Maciej W. Rozycki <macro@mips.com>
Pedro Alves <pedro@codesourcery.com>
gdb/
* gdbarch.sh (elf_make_msymbol_special): Change type to `F',
remove `predefault' and `invalid_p' initializers.
(make_symbol_special): New architecture method.
(adjust_dwarf2_addr, adjust_dwarf2_line): Likewise.
(objfile, symbol): New declarations.
* arch-utils.h (default_elf_make_msymbol_special): Remove
prototype.
(default_make_symbol_special): New prototype.
(default_adjust_dwarf2_addr): Likewise.
(default_adjust_dwarf2_line): Likewise.
* mips-tdep.h (mips_unmake_compact_addr): New prototype.
* arch-utils.c (default_elf_make_msymbol_special): Remove
function.
(default_make_symbol_special): New function.
(default_adjust_dwarf2_addr): Likewise.
(default_adjust_dwarf2_line): Likewise.
* dwarf2-frame.c (decode_frame_entry_1): Call
`gdbarch_adjust_dwarf2_addr'.
* dwarf2loc.c (dwarf2_find_location_expression): Likewise.
* dwarf2read.c (create_addrmap_from_index): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(add_partial_symbol): Likewise.
(add_partial_subprogram): Likewise.
(process_full_comp_unit): Likewise.
(read_file_scope): Likewise.
(read_func_scope): Likewise. Call `gdbarch_make_symbol_special'.
(read_lexical_block_scope): Call `gdbarch_adjust_dwarf2_addr'.
(read_call_site_scope): Likewise.
(dwarf2_ranges_read): Likewise.
(dwarf2_record_block_ranges): Likewise.
(read_attribute_value): Likewise.
(dwarf_decode_lines_1): Call `gdbarch_adjust_dwarf2_line'.
(new_symbol_full): Call `gdbarch_adjust_dwarf2_addr'.
* elfread.c (elf_symtab_read): Don't call
`gdbarch_elf_make_msymbol_special' if unset.
* mips-linux-tdep.c (micromips_linux_sigframe_validate): Strip
the ISA bit from the PC.
* mips-tdep.c (mips_unmake_compact_addr): New function.
(mips_elf_make_msymbol_special): Set the ISA bit in the symbol's
address appropriately.
(mips_make_symbol_special): New function.
(mips_pc_is_mips): Set the ISA bit before symbol lookup.
(mips_pc_is_mips16): Likewise.
(mips_pc_is_micromips): Likewise.
(mips_pc_isa): Likewise.
(mips_adjust_dwarf2_addr): New function.
(mips_adjust_dwarf2_line): Likewise.
(mips_read_pc, mips_unwind_pc): Keep the ISA bit.
(mips_addr_bits_remove): Likewise.
(mips_skip_trampoline_code): Likewise.
(mips_write_pc): Don't set the ISA bit.
(mips_eabi_push_dummy_call): Likewise.
(mips_o64_push_dummy_call): Likewise.
(mips_gdbarch_init): Install `mips_make_symbol_special',
`mips_adjust_dwarf2_addr' and `mips_adjust_dwarf2_line' gdbarch
handlers.
* solib.c (gdb_bfd_lookup_symbol_from_symtab): Get
target-specific symbol address adjustments.
* gdbarch.h: Regenerate.
* gdbarch.c: Regenerate.
2014-12-12 Maciej W. Rozycki <macro@codesourcery.com>
gdb/testsuite/
* gdb.base/func-ptrs.c: New file.
* gdb.base/func-ptrs.exp: New file.
2014-12-12 14:31:53 +01:00
|
|
|
/* Skip verify of elf_make_msymbol_special, has predicate. */
|
2002-02-06 02:20:23 +01:00
|
|
|
/* Skip verify of coff_make_msymbol_special, invalid_p == 0 */
|
MIPS: Keep the ISA bit in compressed code addresses
1. Background information
The MIPS architecture, as originally designed and implemented in
mid-1980s has a uniform instruction word size that is 4 bytes, naturally
aligned. As such all MIPS instructions are located at addresses that
have their bits #1 and #0 set to zeroes, and any attempt to execute an
instruction from an address that has any of the two bits set to one
causes an address error exception. This may for example happen when a
jump-register instruction is executed whose register value used as the
jump target has any of these bits set.
Then in mid 1990s LSI sought a way to improve code density for their
TinyRISC family of MIPS cores and invented an alternatively encoded
instruction set in a joint effort with MIPS Technologies (then a
subsidiary of SGI). The new instruction set has been named the MIPS16
ASE (Application-Specific Extension) and uses a variable instruction
word size, which is 2 bytes (as the name of the ASE suggests) for most,
but there are a couple of exceptions that take 4 bytes, and then most of
the 2-byte instructions can be treated with a 2-byte extension prefix to
expand the range of the immediate operands used.
As a result instructions are no longer 4-byte aligned, instead they are
aligned to a multiple of 2. That left the bit #0 still unused for code
references, be it for the standard MIPS (i.e. as originally invented) or
for the MIPS16 instruction set, and based on that observation a clever
trick was invented that on one hand allowed the processor to be
seamlessly switched between the two instruction sets at any time at the
run time while on the other avoided the introduction of any special
control register to do that.
So it is the bit #0 of the instruction address that was chosen as the
selector and named the ISA bit. Any instruction executed at an even
address is interpreted as a standard MIPS instruction (the address still
has to have its bit #1 clear), any instruction executed at an odd
address is interpreted as a MIPS16 instruction.
To switch between modes ordinary jump instructions are used, such as
used for function calls and returns, specifically the bit #0 of the
source register used in jump-register instructions selects the execution
(ISA) mode for the following piece of code to be interpreted in.
Additionally new jump-immediate instructions were added that flipped the
ISA bit to select the opposite mode upon execution. They were
considered necessary to avoid the need to make register jumps in all
cases as the original jump-immediate instructions provided no way to
change the bit #0 at all.
This was all important for cases where standard MIPS and MIPS16 code had
to be mixed, either for compatibility with the existing binary code base
or to access resources not reachable from MIPS16 code (the MIPS16
instruction set only provides access to general-purpose registers, and
not for example floating-point unit registers or privileged coprocessor
0 registers) -- pieces of code in the opposite mode can be executed as
ordinary subroutine calls.
A similar approach has been more recently adopted for the MIPS16
replacement instruction set defined as the so called microMIPS ASE.
This is another instruction set encoding introduced to the MIPS
architecture. Just like the MIPS16 ASE, the microMIPS instruction set
uses a variable-length encoding, where each instruction takes a multiple
of 2 bytes. The ISA bit has been reused and for microMIPS-capable
processors selects between the standard MIPS and the microMIPS mode
instead.
2. Statement of the problem
To put it shortly, MIPS16 and microMIPS code pointers used by GDB are
different to these observed at the run time. This results in the same
expressions being evaluated producing different results in GDB and in
the program being debugged. Obviously it's the results obtained at the
run time that are correct (they define how the program behaves) and
therefore by definition the results obtained in GDB are incorrect.
A bit longer description will record that obviously at the run time the
ISA bit has to be set correctly (refer to background information above
if unsure why so) or the program will not run as expected. This is
recorded in all the executable file structures used at the run time: the
dynamic symbol table (but not always the static one!), the GOT, and
obviously in all the addresses embedded in code or data of the program
itself, calculated by applying the appropriate relocations at the static
link time.
While a program is being processed by GDB, the ISA bit is stripped off
from any code addresses, presumably to make them the same as the
respective raw memory byte address used by the processor to access the
instruction in the instruction fetch access cycle. This stripping is
actually performed outside GDB proper, in BFD, specifically
_bfd_mips_elf_symbol_processing (elfxx-mips.c, see the piece of code at
the very bottom of that function, starting with an: "If this is an
odd-valued function symbol, assume it's a MIPS16 or microMIPS one."
comment).
This function is also responsible for symbol table dumps made by
`objdump' too, so you'll never see the ISA bit reported there by that
tool, you need to use `readelf'.
This is however unlike what is ever done at the run time, the ISA bit
once present is never stripped off, for example a cast like this:
(short *) main
will not strip the ISA bit off and if the resulting pointer is intended
to be used to access instructions as data, for example for software
instruction decoding (like for fault recovery or emulation in a signal
handler) or for self-modifying code then the bit still has to be
stripped off by an explicit AND operation.
This is probably best illustrated with a simple real program example.
Let's consider the following simple program:
$ cat foobar.c
int __attribute__ ((mips16)) foo (void)
{
return 1;
}
int __attribute__ ((mips16)) bar (void)
{
return 2;
}
int __attribute__ ((nomips16)) foo32 (void)
{
return 3;
}
int (*foo32p) (void) = foo32;
int (*foop) (void) = foo;
int fooi = (int) foo;
int
main (void)
{
return foop ();
}
$
This is plain C with no odd tricks, except from the instruction mode
attributes. They are not necessary to trigger this problem, I just put
them here so that the program can be contained in a single source file
and to make it obvious which function is MIPS16 code and which is not.
Let's try it with Linux, so that everyone can repeat this experiment:
$ mips-linux-gnu-gcc -mips16 -g -O2 -o foobar foobar.c
$
Let's have a look at some interesting symbols:
$ mips-linux-gnu-readelf -s foobar | egrep 'table|foo|bar'
Symbol table '.dynsym' contains 7 entries:
Symbol table '.symtab' contains 95 entries:
55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c
66: 0040068c 4 FUNC GLOBAL DEFAULT [MIPS16] 12 bar
68: 00410848 4 OBJECT GLOBAL DEFAULT 21 foo32p
70: 00410844 4 OBJECT GLOBAL DEFAULT 21 foop
78: 00400684 8 FUNC GLOBAL DEFAULT 12 foo32
80: 00400680 4 FUNC GLOBAL DEFAULT [MIPS16] 12 foo
88: 00410840 4 OBJECT GLOBAL DEFAULT 21 fooi
$
Hmm, no sight of the ISA bit, but notice how foo and bar (but not
foo32!) have been marked as MIPS16 functions (ELF symbol structure's
`st_other' field is used for that).
So let's try to run and poke at this program with GDB. I'll be using a
native system for simplicity (I'll be using ellipses here and there to
remove unrelated clutter):
$ ./foobar
$ echo $?
1
$
So far, so good.
$ gdb ./foobar
[...]
(gdb) break main
Breakpoint 1 at 0x400490: file foobar.c, line 23.
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb)
Yay, it worked! OK, so let's poke at it:
(gdb) print main
$1 = {int (void)} 0x400490 <main>
(gdb) print foo32
$2 = {int (void)} 0x400684 <foo32>
(gdb) print foo32p
$3 = (int (*)(void)) 0x400684 <foo32>
(gdb) print bar
$4 = {int (void)} 0x40068c <bar>
(gdb) print foo
$5 = {int (void)} 0x400680 <foo>
(gdb) print foop
$6 = (int (*)(void)) 0x400681 <foo>
(gdb)
A-ha! Here's the difference and finally the ISA bit!
(gdb) print /x fooi
$7 = 0x400681
(gdb) p/x $pc
p/x $pc
$8 = 0x400491
(gdb)
And here as well...
(gdb) advance foo
foo () at foobar.c:4
4 }
(gdb) disassemble
Dump of assembler code for function foo:
0x00400680 <+0>: jr ra
0x00400682 <+2>: li v0,1
End of assembler dump.
(gdb) finish
Run till exit from #0 foo () at foobar.c:4
main () at foobar.c:24
24 }
Value returned is $9 = 1
(gdb) continue
Continuing.
[Inferior 1 (process 14103) exited with code 01]
(gdb)
So let's be a bit inquisitive...
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb)
Actually we do not like to run foo here at all. Let's run bar instead!
(gdb) set foop = bar
(gdb) print foop
$10 = (int (*)(void)) 0x40068c <bar>
(gdb)
Hmm, no ISA bit. Is it going to work?
(gdb) advance bar
bar () at foobar.c:9
9 }
(gdb) p/x $pc
$11 = 0x40068c
(gdb) disassemble
Dump of assembler code for function bar:
=> 0x0040068c <+0>: jr ra
0x0040068e <+2>: li v0,2
End of assembler dump.
(gdb) finish
Run till exit from #0 bar () at foobar.c:9
Program received signal SIGILL, Illegal instruction.
bar () at foobar.c:9
9 }
(gdb)
Oops!
(gdb) p/x $pc
$12 = 0x40068c
(gdb)
We're still there!
(gdb) continue
Continuing.
Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb)
So let's try something else:
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) set foop = foo
(gdb) advance foo
foo () at foobar.c:4
4 }
(gdb) disassemble
Dump of assembler code for function foo:
=> 0x00400680 <+0>: jr ra
0x00400682 <+2>: li v0,1
End of assembler dump.
(gdb) finish
Run till exit from #0 foo () at foobar.c:4
Program received signal SIGILL, Illegal instruction.
foo () at foobar.c:4
4 }
(gdb) continue
Continuing.
Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb)
The same problem!
(gdb) run
Starting program:
/net/build2-lucid-cs/scratch/macro/mips-linux-fsf-gcc/isa-bit/foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) set foop = foo32
(gdb) advance foo32
foo32 () at foobar.c:14
14 }
(gdb) disassemble
Dump of assembler code for function foo32:
=> 0x00400684 <+0>: jr ra
0x00400688 <+4>: li v0,3
End of assembler dump.
(gdb) finish
Run till exit from #0 foo32 () at foobar.c:14
main () at foobar.c:24
24 }
Value returned is $14 = 3
(gdb) continue
Continuing.
[Inferior 1 (process 14113) exited with code 03]
(gdb)
That did work though, so it's the ISA bit only!
(gdb) quit
Enough!
That's the tip of the iceberg only though. So let's rebuild the
executable with some dynamic symbols:
$ mips-linux-gnu-gcc -mips16 -Wl,--export-dynamic -g -O2 -o foobar-dyn foobar.c
$ mips-linux-gnu-readelf -s foobar-dyn | egrep 'table|foo|bar'
Symbol table '.dynsym' contains 32 entries:
6: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar
8: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p
9: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop
15: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32
17: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo
25: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi
Symbol table '.symtab' contains 95 entries:
55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c
69: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar
71: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p
72: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop
79: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32
81: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo
89: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi
$
OK, now the ISA bit is there for a change, but the MIPS16 `st_other'
attribute gone, hmm... What does `objdump' do then:
$ mips-linux-gnu-objdump -Tt foobar-dyn | egrep 'SYMBOL|foo|bar'
foobar-dyn: file format elf32-tradbigmips
SYMBOL TABLE:
00000000 l df *ABS* 00000000 foobar.c
004009cc g F .text 00000004 0xf0 bar
00410b88 g O .data 00000004 foo32p
00410b84 g O .data 00000004 foop
004009c4 g F .text 00000008 foo32
004009c0 g F .text 00000004 0xf0 foo
00410b80 g O .data 00000004 fooi
DYNAMIC SYMBOL TABLE:
004009cc g DF .text 00000004 Base 0xf0 bar
00410b88 g DO .data 00000004 Base foo32p
00410b84 g DO .data 00000004 Base foop
004009c4 g DF .text 00000008 Base foo32
004009c0 g DF .text 00000004 Base 0xf0 foo
00410b80 g DO .data 00000004 Base fooi
$
Hmm, the attribute (0xf0, printed raw) is back, and the ISA bit gone
again.
Let's have a look at some DWARF-2 records GDB uses (I'll be stripping
off a lot here for brevity) -- debug info:
$ mips-linux-gnu-readelf -wi foobar
Contents of the .debug_info section:
[...]
Compilation Unit @ offset 0x88:
Length: 0xbb (32-bit)
Version: 4
Abbrev Offset: 62
Pointer Size: 4
<0><93>: Abbrev Number: 1 (DW_TAG_compile_unit)
<94> DW_AT_producer : (indirect string, offset: 0x19e): GNU C 4.8.0 20120513 (experimental) -meb -mips16 -march=mips32r2 -mhard-float -mllsc -mplt -mno-synci -mno-shared -mabi=32 -g -O2
<98> DW_AT_language : 1 (ANSI C)
<99> DW_AT_name : (indirect string, offset: 0x190): foobar.c
<9d> DW_AT_comp_dir : (indirect string, offset: 0x225): [...]
<a1> DW_AT_ranges : 0x0
<a5> DW_AT_low_pc : 0x0
<a9> DW_AT_stmt_list : 0x27
<1><ad>: Abbrev Number: 2 (DW_TAG_subprogram)
<ae> DW_AT_external : 1
<ae> DW_AT_name : foo
<b2> DW_AT_decl_file : 1
<b3> DW_AT_decl_line : 1
<b4> DW_AT_prototyped : 1
<b4> DW_AT_type : <0xc2>
<b8> DW_AT_low_pc : 0x400680
<bc> DW_AT_high_pc : 0x400684
<c0> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<c2> DW_AT_GNU_all_call_sites: 1
<1><c2>: Abbrev Number: 3 (DW_TAG_base_type)
<c3> DW_AT_byte_size : 4
<c4> DW_AT_encoding : 5 (signed)
<c5> DW_AT_name : int
<1><c9>: Abbrev Number: 4 (DW_TAG_subprogram)
<ca> DW_AT_external : 1
<ca> DW_AT_name : (indirect string, offset: 0x18a): foo32
<ce> DW_AT_decl_file : 1
<cf> DW_AT_decl_line : 11
<d0> DW_AT_prototyped : 1
<d0> DW_AT_type : <0xc2>
<d4> DW_AT_low_pc : 0x400684
<d8> DW_AT_high_pc : 0x40068c
<dc> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<de> DW_AT_GNU_all_call_sites: 1
<1><de>: Abbrev Number: 2 (DW_TAG_subprogram)
<df> DW_AT_external : 1
<df> DW_AT_name : bar
<e3> DW_AT_decl_file : 1
<e4> DW_AT_decl_line : 6
<e5> DW_AT_prototyped : 1
<e5> DW_AT_type : <0xc2>
<e9> DW_AT_low_pc : 0x40068c
<ed> DW_AT_high_pc : 0x400690
<f1> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<f3> DW_AT_GNU_all_call_sites: 1
<1><f3>: Abbrev Number: 5 (DW_TAG_subprogram)
<f4> DW_AT_external : 1
<f4> DW_AT_name : (indirect string, offset: 0x199): main
<f8> DW_AT_decl_file : 1
<f9> DW_AT_decl_line : 21
<fa> DW_AT_prototyped : 1
<fa> DW_AT_type : <0xc2>
<fe> DW_AT_low_pc : 0x400490
<102> DW_AT_high_pc : 0x4004a4
<106> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<108> DW_AT_GNU_all_tail_call_sites: 1
[...]
$
-- no sign of the ISA bit anywhere -- frame info:
$ mips-linux-gnu-readelf -wf foobar
[...]
Contents of the .debug_frame section:
00000000 0000000c ffffffff CIE
Version: 1
Augmentation: ""
Code alignment factor: 1
Data alignment factor: -4
Return address column: 31
DW_CFA_def_cfa_register: r29
DW_CFA_nop
00000010 0000000c 00000000 FDE cie=00000000 pc=00400680..00400684
00000020 0000000c 00000000 FDE cie=00000000 pc=00400684..0040068c
00000030 0000000c 00000000 FDE cie=00000000 pc=0040068c..00400690
00000040 00000018 00000000 FDE cie=00000000 pc=00400490..004004a4
DW_CFA_advance_loc: 6 to 00400496
DW_CFA_def_cfa_offset: 32
DW_CFA_offset: r31 at cfa-4
DW_CFA_advance_loc: 6 to 0040049c
DW_CFA_restore: r31
DW_CFA_def_cfa_offset: 0
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
[...]
$
-- no sign of the ISA bit anywhere -- range info (GDB doesn't use arange):
$ mips-linux-gnu-readelf -wR foobar
Contents of the .debug_ranges section:
Offset Begin End
00000000 00400680 00400690
00000000 00400490 004004a4
00000000 <End of list>
$
-- no sign of the ISA bit anywhere -- line info:
$ mips-linux-gnu-readelf -wl foobar
Raw dump of debug contents of section .debug_line:
[...]
Offset: 0x27
Length: 78
DWARF Version: 2
Prologue Length: 31
Minimum Instruction Length: 1
Initial value of 'is_stmt': 1
Line Base: -5
Line Range: 14
Opcode Base: 13
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 args
Opcode 3 has 1 args
Opcode 4 has 1 args
Opcode 5 has 1 args
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 args
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 args
The Directory Table is empty.
The File Name Table:
Entry Dir Time Size Name
1 0 0 0 foobar.c
Line Number Statements:
Extended opcode 2: set Address to 0x400681
Special opcode 6: advance Address by 0 to 0x400681 and Line by 1 to 2
Special opcode 7: advance Address by 0 to 0x400681 and Line by 2 to 4
Special opcode 55: advance Address by 3 to 0x400684 and Line by 8 to 12
Special opcode 7: advance Address by 0 to 0x400684 and Line by 2 to 14
Advance Line by -7 to 7
Special opcode 131: advance Address by 9 to 0x40068d and Line by 0 to 7
Special opcode 7: advance Address by 0 to 0x40068d and Line by 2 to 9
Advance PC by 3 to 0x400690
Extended opcode 1: End of Sequence
Extended opcode 2: set Address to 0x400491
Advance Line by 21 to 22
Copy
Special opcode 6: advance Address by 0 to 0x400491 and Line by 1 to 23
Special opcode 60: advance Address by 4 to 0x400495 and Line by -1 to 22
Special opcode 34: advance Address by 2 to 0x400497 and Line by 1 to 23
Special opcode 62: advance Address by 4 to 0x40049b and Line by 1 to 24
Special opcode 32: advance Address by 2 to 0x40049d and Line by -1 to 23
Special opcode 6: advance Address by 0 to 0x40049d and Line by 1 to 24
Advance PC by 7 to 0x4004a4
Extended opcode 1: End of Sequence
[...]
-- a-ha, the ISA bit is there! However it's not always right for some
reason, I don't have a small test case to show it, but here's an excerpt
from MIPS16 libc, a prologue of a function:
00019630 <__libc_init_first>:
19630: e8a0 jrc ra
19632: 6500 nop
00019634 <_init>:
19634: f000 6a11 li v0,17
19638: f7d8 0b08 la v1,15e00 <_DYNAMIC+0x15c54>
1963c: f400 3240 sll v0,16
19640: e269 addu v0,v1
19642: 659a move gp,v0
19644: 64f6 save 48,ra,s0-s1
19646: 671c move s0,gp
19648: d204 sw v0,16(sp)
1964a: f352 984c lw v0,-27828(s0)
1964e: 6724 move s1,a0
and the corresponding DWARF-2 line info:
Line Number Statements:
Extended opcode 2: set Address to 0x19631
Advance Line by 44 to 45
Copy
Special opcode 8: advance Address by 0 to 0x19631 and Line by 3 to 48
Special opcode 66: advance Address by 4 to 0x19635 and Line by 5 to 53
Advance PC by constant 17 to 0x19646
Special opcode 25: advance Address by 1 to 0x19647 and Line by 6 to 59
Advance Line by -6 to 53
Special opcode 33: advance Address by 2 to 0x19649 and Line by 0 to 53
Special opcode 39: advance Address by 2 to 0x1964b and Line by 6 to 59
Advance Line by -6 to 53
Special opcode 61: advance Address by 4 to 0x1964f and Line by 0 to 53
-- see that "Advance PC by constant 17" there? It clears the ISA bit,
however code at 0x19646 is not standard MIPS code at all. For some
reason the constant is always 17, I've never seen DW_LNS_const_add_pc
used with any other value -- is that a binutils bug or what?
3. Solution:
I think we should retain the value of the ISA bit in code references,
that is effectively treat them as cookies as they indeed are (although
trivially calculated) rather than raw memory byte addresses.
In a perfect world both the static symbol table and the respective
DWARF-2 records should be fixed to include the ISA bit in all the cases.
I think however that this is infeasible.
All the uses of `_bfd_mips_elf_symbol_processing' can not necessarily be
tracked down. This function is used by `elf_slurp_symbol_table' that in
turn is used by `bfd_canonicalize_symtab' and
`bfd_canonicalize_dynamic_symtab', which are public interfaces.
Similarly DWARF-2 records are used outside GDB, one notable if a bit
questionable is the exception unwinder (libgcc/unwind-dw2.c) -- I have
identified at least bits in `execute_cfa_program' and
`uw_frame_state_for', both around the calls to `_Unwind_IsSignalFrame',
that would need an update as they effectively flip the ISA bit freely;
see also the comment about MASK_RETURN_ADDR in gcc/config/mips/mips.h.
But there may be more places. Any change in how DWARF-2 records are
produced would require an update there and would cause compatibility
problems with libgcc.a binaries already distributed; given that this is
a static library a complex change involving function renames would
likely be required.
I propose therefore to accept the existing inconsistencies and deal with
them entirely within GDB. I have figured out that the ISA bit lost in
various places can still be recovered as long as we have symbol
information -- that'll have the `st_other' attribute correctly set to
one of standard MIPS/MIPS16/microMIPS encoding.
Here's the resulting change. It adds a couple of new `gdbarch' hooks,
one to update symbol information with the ISA bit lost in
`_bfd_mips_elf_symbol_processing', and two other ones to adjust DWARF-2
records as they're processed. The ISA bit is set in each address
handled according to information retrieved from the symbol table for the
symbol spanning the address if any; limits are adjusted based on the
address they point to related to the respective base address.
Additionally minimal symbol information has to be adjusted accordingly
in its gdbarch hook.
With these changes in place some complications with ISA bit juggling in
the PC that never fully worked can be removed from the MIPS backend.
Conversely, the generic dynamic linker event special breakpoint symbol
handler has to be updated to call the minimal symbol gdbarch hook to
record that the symbol is a MIPS16 or microMIPS address if applicable or
the breakpoint will be set at the wrong address and either fail to work
or cause SIGTRAPs (this is because the symbol is handled early on and
bypasses regular symbol processing).
4. Results obtained
The change fixes the example above -- to repeat only the crucial steps:
(gdb) break main
Breakpoint 1 at 0x400491: file foobar.c, line 23.
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) print foo
$1 = {int (void)} 0x400681 <foo>
(gdb) set foop = bar
(gdb) advance bar
bar () at foobar.c:9
9 }
(gdb) disassemble
Dump of assembler code for function bar:
=> 0x0040068d <+0>: jr ra
0x0040068f <+2>: li v0,2
End of assembler dump.
(gdb) finish
Run till exit from #0 bar () at foobar.c:9
main () at foobar.c:24
24 }
Value returned is $2 = 2
(gdb) continue
Continuing.
[Inferior 1 (process 14128) exited with code 02]
(gdb)
-- excellent!
The change removes about 90 failures per MIPS16 multilib in mips-sde-elf
testing too, results for MIPS16 are now similar to that for standard
MIPS; microMIPS results are a bit worse because of host-I/O problems in
QEMU used instead of MIPSsim for microMIPS testing only:
=== gdb Summary ===
# of expected passes 14299
# of unexpected failures 187
# of expected failures 56
# of known failures 58
# of unresolved testcases 11
# of untested testcases 52
# of unsupported tests 174
MIPS16:
=== gdb Summary ===
# of expected passes 14298
# of unexpected failures 187
# of unexpected successes 2
# of expected failures 54
# of known failures 58
# of unresolved testcases 12
# of untested testcases 52
# of unsupported tests 174
microMIPS:
=== gdb Summary ===
# of expected passes 14149
# of unexpected failures 201
# of unexpected successes 2
# of expected failures 54
# of known failures 58
# of unresolved testcases 7
# of untested testcases 53
# of unsupported tests 175
2014-12-12 Maciej W. Rozycki <macro@codesourcery.com>
Maciej W. Rozycki <macro@mips.com>
Pedro Alves <pedro@codesourcery.com>
gdb/
* gdbarch.sh (elf_make_msymbol_special): Change type to `F',
remove `predefault' and `invalid_p' initializers.
(make_symbol_special): New architecture method.
(adjust_dwarf2_addr, adjust_dwarf2_line): Likewise.
(objfile, symbol): New declarations.
* arch-utils.h (default_elf_make_msymbol_special): Remove
prototype.
(default_make_symbol_special): New prototype.
(default_adjust_dwarf2_addr): Likewise.
(default_adjust_dwarf2_line): Likewise.
* mips-tdep.h (mips_unmake_compact_addr): New prototype.
* arch-utils.c (default_elf_make_msymbol_special): Remove
function.
(default_make_symbol_special): New function.
(default_adjust_dwarf2_addr): Likewise.
(default_adjust_dwarf2_line): Likewise.
* dwarf2-frame.c (decode_frame_entry_1): Call
`gdbarch_adjust_dwarf2_addr'.
* dwarf2loc.c (dwarf2_find_location_expression): Likewise.
* dwarf2read.c (create_addrmap_from_index): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(add_partial_symbol): Likewise.
(add_partial_subprogram): Likewise.
(process_full_comp_unit): Likewise.
(read_file_scope): Likewise.
(read_func_scope): Likewise. Call `gdbarch_make_symbol_special'.
(read_lexical_block_scope): Call `gdbarch_adjust_dwarf2_addr'.
(read_call_site_scope): Likewise.
(dwarf2_ranges_read): Likewise.
(dwarf2_record_block_ranges): Likewise.
(read_attribute_value): Likewise.
(dwarf_decode_lines_1): Call `gdbarch_adjust_dwarf2_line'.
(new_symbol_full): Call `gdbarch_adjust_dwarf2_addr'.
* elfread.c (elf_symtab_read): Don't call
`gdbarch_elf_make_msymbol_special' if unset.
* mips-linux-tdep.c (micromips_linux_sigframe_validate): Strip
the ISA bit from the PC.
* mips-tdep.c (mips_unmake_compact_addr): New function.
(mips_elf_make_msymbol_special): Set the ISA bit in the symbol's
address appropriately.
(mips_make_symbol_special): New function.
(mips_pc_is_mips): Set the ISA bit before symbol lookup.
(mips_pc_is_mips16): Likewise.
(mips_pc_is_micromips): Likewise.
(mips_pc_isa): Likewise.
(mips_adjust_dwarf2_addr): New function.
(mips_adjust_dwarf2_line): Likewise.
(mips_read_pc, mips_unwind_pc): Keep the ISA bit.
(mips_addr_bits_remove): Likewise.
(mips_skip_trampoline_code): Likewise.
(mips_write_pc): Don't set the ISA bit.
(mips_eabi_push_dummy_call): Likewise.
(mips_o64_push_dummy_call): Likewise.
(mips_gdbarch_init): Install `mips_make_symbol_special',
`mips_adjust_dwarf2_addr' and `mips_adjust_dwarf2_line' gdbarch
handlers.
* solib.c (gdb_bfd_lookup_symbol_from_symtab): Get
target-specific symbol address adjustments.
* gdbarch.h: Regenerate.
* gdbarch.c: Regenerate.
2014-12-12 Maciej W. Rozycki <macro@codesourcery.com>
gdb/testsuite/
* gdb.base/func-ptrs.c: New file.
* gdb.base/func-ptrs.exp: New file.
2014-12-12 14:31:53 +01:00
|
|
|
/* Skip verify of make_symbol_special, invalid_p == 0 */
|
|
|
|
/* Skip verify of adjust_dwarf2_addr, invalid_p == 0 */
|
|
|
|
/* Skip verify of adjust_dwarf2_line, invalid_p == 0 */
|
2002-10-03 01:28:54 +02:00
|
|
|
/* Skip verify of cannot_step_breakpoint, invalid_p == 0 */
|
2002-10-09 13:59:54 +02:00
|
|
|
/* Skip verify of have_nonsteppable_watchpoint, invalid_p == 0 */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of address_class_type_flags, has predicate. */
|
|
|
|
/* Skip verify of address_class_type_flags_to_name, has predicate. */
|
2017-04-26 15:05:03 +02:00
|
|
|
/* Skip verify of execute_dwarf_cfa_vendor_op, invalid_p == 0 */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of address_class_name_to_type_flags, has predicate. */
|
2002-11-03 01:30:33 +01:00
|
|
|
/* Skip verify of register_reggroup_p, invalid_p == 0 */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of fetch_pointer_argument, has predicate. */
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 17:26:43 +02:00
|
|
|
/* Skip verify of iterate_over_regset_sections, has predicate. */
|
2012-01-20 10:56:56 +01:00
|
|
|
/* Skip verify of make_corefile_notes, has predicate. */
|
2013-02-04 19:40:41 +01:00
|
|
|
/* Skip verify of elfcore_write_linux_prpsinfo, has predicate. */
|
2012-01-20 10:59:15 +01:00
|
|
|
/* Skip verify of find_memory_regions, has predicate. */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of core_xfer_shared_libraries, has predicate. */
|
ppc-aix core file relocation.
The current code attempts to provide relocation support when debugging
core files via the rs6000_xfer_partial method of the rs6000-nat
target_ops vector. However, this target_ops vector does not get pushed
on the target stack at all when debugging core files, thus bypassing
completely that part of the code.
This patch fixes the problem by extending corelow's core_xfer_partial
into handling the TARGET_OBJECT_LIBRARIES_AIX object.
gdb/ChangeLog:
* gdbarch.sh (core_xfer_shared_libraries_aix): New method.
* gdbarch.h, gdbarch.c: Regenerate.
* corelow.c (core_xfer_partial): Add TARGET_OBJECT_LIBRARIES_AIX
handling.
* rs6000-aix-tdep.h: New file.
* Makefile.in (HFILES_NO_SRCDIR): Add rs6000-aix-tdep.h.
* rs6000-aix-tdep.c: Include "rs6000-aix-tdep.h" and
"xml-utils.h".
(struct field_info, struct ld_info_desc): New types.
(ld_info32_desc, ld_info64_desc): New static constants.
(struct ld_info): New type.
(rs6000_aix_extract_ld_info): New function.
(rs6000_aix_shared_library_to_xml): Likewise.
(rs6000_aix_ld_info_to_xml): Likewise.
(rs6000_aix_core_xfer_shared_libraries_aix): Likewise.
(rs6000_aix_init_osabi): Add call to
set_gdbarch_core_xfer_shared_libraries_aix.
* rs6000-nat.c: Add "rs6000-aix-tdep.h" include.
Remove "xml-utils.h" include.
(LdInfo): Delete typedef.
(ARCH64_DECL, LDI_FIELD, LDI_NEXT, LDI_FD, LDI_FILENAME):
Delete macros.
(rs6000_ptrace_ldinfo): Change return type to gdb_byte *.
Adjust code accordingly.
(rs6000_core_ldinfo): Delete, folded into
rs6000_aix_core_xfer_shared_libraries_aix.
(rs6000_xfer_shared_library): Delete.
(rs6000_xfer_shared_libraries): Reimplement.
2013-05-15 14:26:14 +02:00
|
|
|
/* Skip verify of core_xfer_shared_libraries_aix, has predicate. */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of core_pid_to_str, has predicate. */
|
2016-01-18 18:49:23 +01:00
|
|
|
/* Skip verify of core_thread_name, has predicate. */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of gcore_bfd_target, has predicate. */
|
* NEWS: Mention pointer to member improvements.
* Makefile.in (gnu-v3-abi.o): Delete special rule.
(eval.o, gnu-v3-abi.o, ia64-tdep.o): Update.
* ada-valprint.c (ada_print_scalar): Update for new type codes.
* c-typeprint.c (c_print_type): Update for new type codes.
(c_type_print_varspec_prefix, c_type_print_varspec_suffix)
(c_type_print_base): Likewise.
(c_type_print_args): Rewrite.
* c-valprint.c (c_val_print): Update for new type codes. Remove
support for references to members. Treat methods like functions.
* cp-abi.c (cplus_print_method_ptr, cplus_method_ptr_size)
(cplus_make_method_ptr, cplus_method_ptr_to_value): New.
* cp-abi.h (cplus_print_method_ptr, cplus_method_ptr_size)
(cplus_make_method_ptr, cplus_method_ptr_to_value): New prototypes.
(struct cp_abi_ops): Add corresponding members.
* cp-valprint.c (cp_print_class_method): Delete.
(cp_find_class_member): New function.
(cp_print_class_member): Use it. Simplify support for bogus
member pointers.
* dwarf2read.c (quirk_gcc_member_function_pointer): Use
lookup_methodptr_type.
(read_tag_ptr_to_member_type): Likewise, and lookup_memberptr_type.
* eval.c (evaluate_subexp_standard): Implement EVAL_SKIP for
OP_SCOPE. Update call to value_aggregate_elt. Rewrite member
pointer support.
(evaluate_subexp_for_address): Handle OP_SCOPE explicitly. Handle
references returned by user defined operators.
* f-typeprint.c (f_print_type, f_type_print_varspec_prefix)
(f_type_print_varspec_suffix): Remove support for member pointers.
* gdbtypes.c (lookup_memberptr_type): Renamed from lookup_member_type
and adjusted.
(smash_to_memberptr_type): Likewise, from smash_to_member_type.
(lookup_methodptr_type): New.
(rank_one_type): Adjust for TYPE_CODE_MEMBERPTR.
(recursive_dump_type): Update for new types.
* gdbtypes.h (enum type_code): Replace TYPE_CODE_MEMBER with
TYPE_CODE_MEMBERPTR and TYPE_CODE_METHODPTR.
(lookup_memberptr_type, lookup_methodptr_type)
(smash_to_memberptr_type): New prototypes.
(smash_to_method_type): Formatting fix.
(lookup_member_type, smash_to_member_type): Delete prototypes.
* gnu-v3-abi.c (gnuv3_get_vtable, gnuv3_get_virtual_fn): New.
Do not rely on debug information for the vptr or the method's
enclosing type. Handle function descriptors for IA64.
(gnuv3_virtual_fn_field): Rewrite using the new functions.
(gnuv3_find_method_in, gnuv3_print_method_ptr)
(gnuv3_method_ptr_size, gnuv3_make_method_ptr)
(gnuv3_method_ptr_to_value): New.
(init_gnuv3_ops): Set new members of gnu_v3_abi_ops.
* hpread.c (hpread_type_lookup): Update for new types.
* infcall.c (value_arg_coerce): Likewise.
* m2-typeprint.c (m2_print_type): Remove explicit support
for member pointers.
* m2-valprint.c (m2_val_print): Likewise.
* p-typeprint.c (pascal_type_print_varspec_prefix)
(pascal_type_print_varspec_suffix, pascal_type_print_base): Likewise.
* p-valprint.c (pascal_val_print): Likewise.
(pascal_object_print_class_method, pascal_object_print_class_member):
Delete.
* p-lang.h (pascal_object_print_class_method)
(pascal_object_print_class_member): Delete prototypes.
* stabsread.c (read_type): Update for new types.
* typeprint.c (print_type_scalar): Likewise.
* valops.c (value_struct_elt_for_reference, value_namespace_elt)
(value_maybe_namespace_elt, value_aggregate_elt): Add want_address
argument. Construct a pointer to member if the address of a
function or data member is requested.
(value_cast_pointers): Don't modify the input value.
(value_cast): Adjust pointer to member handling for new types.
Allow null pointer to member constants. Don't modify the input
value.
(value_ind): Remove pointer to member check. Handle function
descriptors for function pointers.
(value_struct_elt, value_find_oload_method_list, check_field):
Remove pointer to member checks.
* value.c (unpack_long): Allow pointers to data members.
(value_from_longest): Allow member pointers.
* value.h (value_aggregate_elt): Add want_address.
* varobj.c (c_variable_editable): Remove check for members.
* gdbarch.sh: Add vtable_function_descriptors and vbit_in_delta.
* ia64-tdep.c (ia64_convert_from_func_ptr_addr): Handle descriptors
in virtual tables.
(ia64_gdbarch_init): Call set_gdbarch_vtable_function_descriptors.
* c-lang.h (cp_print_class_method): Delete prototype.
* arm-tdep.c (arm_gdbarch_init): Call set_gdbarch_vbit_in_delta.
* mips-tdep.c (mips_gdbarch_init): Likewise.
* gdbarch.c, gdbarch.h: Regenerated.
* gdb.cp/classes.exp (test_pointers_to_class_members): Update expected
output. Test the types of members and member pointers.
* gdb.cp/inherit.exp (test_print_mi_member_types): Remove KFAILs for
gdb/2092.
* gdb.cp/member-ptr.exp: Search for a comment instead of a
statement. Enable for GCC. Update expected output for some tests
and add new tests. Remove obsolete GCC KFAILs. Allow GCC's class
layout.
* gdb.cp/member-ptr.cc (Padding, Padding::vspacer, Base, Base::get_x)
(Base::vget_base, Left, Left::vget, Right, Right::vget, Diamond)
(Diamond::vget_base): New.
(main): Add new tests.
* gdb.cp/printmethod.exp: Update expected output for member functions.
* gdb.cp/virtfunc.exp (test_virtual_calls): Add a KFAIL for
print pEe->D::vg().
2007-01-03 19:05:45 +01:00
|
|
|
/* Skip verify of vtable_function_descriptors, invalid_p == 0 */
|
|
|
|
/* Skip verify of vbit_in_delta, invalid_p == 0 */
|
add a default method for gdbarch_skip_permanent_breakpoint
breakpoint.c uses gdbarch_breakpoint_from_pc to determine whether a
breakpoint location points at a permanent breakpoint:
static int
bp_loc_is_permanent (struct bp_location *loc)
{
...
addr = loc->address;
bpoint = gdbarch_breakpoint_from_pc (loc->gdbarch, &addr, &len);
...
if (target_read_memory (loc->address, target_mem, len) == 0
&& memcmp (target_mem, bpoint, len) == 0)
retval = 1;
...
So I think we should default the gdbarch_skip_permanent_breakpoint
hook to advancing the PC by the length of the breakpoint instruction,
as determined by gdbarch_breakpoint_from_pc. I believe that simple
implementation does the right thing for most architectures. If
there's an oddball architecture where that doesn't work, then it
should override the hook, just like it should be overriding the hook
if there was no default anyway.
The only two implementation of skip_permanent_breakpoint are
i386_skip_permanent_breakpoint, for x86, and
hppa_skip_permanent_breakpoint, for PA-RISC/HP-UX
The x86 implementation is trivial, and can clearly be replaced by the
new default.
I don't know about the HP-UX one though, I know almost nothing about
PA. It may well be advancing the PC ends up being equivalent.
Otherwise, it must be that "jump $pc_after_bp" doesn't work either...
Tested on x86_64 Fedora 20 native and gdbserver.
gdb/
2014-11-12 Pedro Alves <palves@redhat.com>
* arch-utils.c (default_skip_permanent_breakpoint): New function.
* arch-utils.h (default_skip_permanent_breakpoint): New
declaration.
* gdbarch.sh (skip_permanent_breakpoint): Now an 'f' function.
Install default_skip_permanent_breakpoint as default method.
* i386-tdep.c (i386_skip_permanent_breakpoint): Delete function.
(i386_gdbarch_init): Don't install it.
* infrun.c (resume): Assume there's always a
gdbarch_skip_permanent_breakpoint implementation.
* gdbarch.h, gdbarch.c: Regenerate.
2014-11-12 11:10:48 +01:00
|
|
|
/* Skip verify of skip_permanent_breakpoint, invalid_p == 0 */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of max_insn_length, has predicate. */
|
|
|
|
/* Skip verify of displaced_step_copy_insn, has predicate. */
|
2009-09-29 02:53:04 +02:00
|
|
|
/* Skip verify of displaced_step_hw_singlestep, invalid_p == 0 */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of displaced_step_fixup, has predicate. */
|
Implement displaced stepping.
gdb/
* gdbarch.sh (max_insn_length): New 'variable'.
(displaced_step_copy, displaced_step_fixup)
(displaced_step_free_closure, displaced_step_location): New
functions.
(struct displaced_step_closure): Add forward declaration.
* gdbarch.c, gdbarch.h: Regenerated.
* arch-utils.c: #include "objfiles.h".
(simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New functions.
* arch-utils.h (simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New prototypes.
* i386-tdep.c (I386_MAX_INSN_LEN): Rename to...
(I386_MAX_MATCHED_INSN_LEN): ... this.
(i386_absolute_jmp_p, i386_absolute_call_p)
(i386_ret_p, i386_call_p, i386_breakpoint_p, i386_syscall_p)
(i386_displaced_step_fixup): New functions.
(struct i386_insn, i386_match_insn): Update.
(i386_gdbarch_init): Set gdbarch_max_insn_length.
* i386-tdep.h (I386_MAX_INSN_LEN): New.
(i386_displaced_step_fixup): New prototype.
* i386-linux-tdep.c (i386_linux_init_abi): Include "arch-utils.h".
Register gdbarch_displaced_step_copy,
gdbarch_displaced_step_fixup, gdbarch_displaced_step_free_closure,
and gdbarch_displaced_step_location functions.
* infrun.c (debug_displaced): New variable.
(show_debug_displaced): New function.
(struct displaced_step_request): New struct.
(displaced_step_request_queue, displaced_step_ptid)
(displaced_step_gdbarch, displaced_step_closure)
(displaced_step_original, displaced_step_copy)
(displaced_step_saved_copy, can_use_displaced_stepping): New
variables.
(show_can_use_displaced_stepping, use_displaced_stepping)
(displaced_step_clear, cleanup_displaced_step_closure)
(displaced_step_dump_bytes, displaced_step_prepare)
(displaced_step_clear_cleanup, write_memory_ptid)
(displaced_step_fixup): New functions.
(resume): Call displaced_step_prepare.
(proceed): Call read_pc once, and remember the value. If using
displaced stepping, don't remove breakpoints.
(handle_inferior_event): Call displaced_step_fixup. Add some
debugging output. When we try to step over a breakpoint, but get
a signal to deliver to the thread instead, ensure the step-resume
breakpoint is actually inserted. If a thread hop is needed, and
displaced stepping is enabled, don't remove breakpoints.
(init_wait_for_inferior): Call displaced_step_clear.
(_initialize_infrun): Add "set debug displaced" command. Add
"maint set can-use-displaced-stepping" command. Clear
displaced_step_ptid.
* inferior.h (debug_displaced): Declare variable.
(displaced_step_dump_bytes): Declare function.
* Makefile.in (arch-utils.o, i386-linux-tdep.o): Update
dependencies.
gdb/testsuite/
* gdb.asm/asmsrc1.s: Add scratch space.
gdb/doc/
* gdb.texinfo (Debugging Output): Document "set/show debug
displaced".
(Maintenance Commands): Document "maint set/show
can-use-displaced-stepping".
2008-05-02 18:49:54 +02:00
|
|
|
if ((! gdbarch->displaced_step_free_closure) != (! gdbarch->displaced_step_copy_insn))
|
Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy
This patch starts from the desire to eliminate
make_cleanup_ui_file_delete, but then goes beyond. It makes ui_file &
friends a real C++ class hierarchy, and switches temporary
ui_file-like objects to stack-based allocation.
- mem_fileopen -> string_file
mem_fileopen is replaced with a new string_file class that is treated
as a value class created on the stack. This alone eliminates most
make_cleanup_ui_file_delete calls, and, simplifies code a whole lot
(diffstat shows around 1k loc dropped.)
string_file's internal buffer is a std::string, thus the "string" in
the name. This simplifies the implementation much, compared to
mem_fileopen, which managed growing its internal buffer manually.
- ui_file_as_string, ui_file_strdup, ui_file_obsavestring all gone
The new string_file class has a string() method that provides direct
writable access to the internal std::string buffer. This replaced
ui_file_as_string, which forced a copy of the same data the stream had
inside. With direct access via a writable reference, we can instead
move the string out of the string_stream, avoiding deep string
copying.
Related, ui_file_xstrdup calls are replaced with xstrdup'ping the
stream's string, and ui_file_obsavestring is replaced by
obstack_copy0.
With all those out of the way, getting rid of the weird ui_file_put
mechanism was possible.
- New ui_file::printf, ui_file::puts, etc. methods
These simplify / clarify client code. I considered splitting
client-code changes, like these, e.g.:
- stb = mem_fileopen ();
- fprintf_unfiltered (stb, "%s%s%s",
- _("The valid values are:\n"),
- regdesc,
- _("The default is \"std\"."));
+ string_file stb;
+ stb.printf ("%s%s%s",
+ _("The valid values are:\n"),
+ regdesc,
+ _("The default is \"std\"."));
In two steps, with the first step leaving fprintf_unfiltered (etc.)
calls in place, and only afterwards do a pass to change all those to
call stb.printf etc.. I didn't do that split, because (when I tried),
it turned out to be pointless make-work: the first pass would have to
touch the fprintf_unfiltered line anyway, to replace "stb" with
"&stb".
- gdb_fopen replaced with stack-based objects
This avoids the need for cleanups or unique_ptr's. I.e., this:
struct ui_file *file = gdb_fopen (filename, "w");
if (filename == NULL)
perror_with_name (filename);
cleanups = make_cleanup_ui_file_delete (file);
// use file.
do_cleanups (cleanups);
is replaced with this:
stdio_file file;
if (!file.open (filename, "w"))
perror_with_name (filename);
// use file.
- odd contorsions in null_file_write / null_file_fputs around when to
call to_fputs / to_write eliminated.
- Global null_stream object
A few places that were allocating a ui_file in order to print to
"nowhere" are adjusted to instead refer to a new 'null_stream' global
stream.
- TUI's tui_sfileopen eliminated. TUI's ui_file much simplified
The TUI's ui_file was serving a dual purpose. It supported being used
as string buffer, and supported being backed by a stdio FILE. The
string buffer part is gone, replaced by using of string_file. The
'FILE *' support is now much simplified, by making the TUI's ui_file
inherit from stdio_file.
gdb/ChangeLog:
2017-02-02 Pedro Alves <palves@redhat.com>
* ada-lang.c (type_as_string): Use string_file.
* ada-valprint.c (ada_print_floating): Use string_file.
* ada-varobj.c (ada_varobj_scalar_image)
(ada_varobj_get_value_image): Use string_file.
* aix-thread.c (aix_thread_extra_thread_info): Use string_file.
* arm-tdep.c (_initialize_arm_tdep): Use string_printf.
* breakpoint.c (update_inserted_breakpoint_locations)
(insert_breakpoint_locations, reattach_breakpoints)
(print_breakpoint_location, print_one_detail_ranged_breakpoint)
(print_it_watchpoint): Use string_file.
(save_breakpoints): Use stdio_file.
* c-exp.y (oper): Use string_file.
* cli/cli-logging.c (set_logging_redirect): Use ui_file_up and
tee_file.
(pop_output_files): Use delete.
(handle_redirections): Use stdio_file and tee_file.
* cli/cli-setshow.c (do_show_command): Use string_file.
* compile/compile-c-support.c (c_compute_program): Use
string_file.
* compile/compile-c-symbols.c (generate_vla_size): Take a
'string_file &' instead of a 'ui_file *'.
(generate_c_for_for_one_variable): Take a 'string_file &' instead
of a 'ui_file *'. Use string_file.
(generate_c_for_variable_locations): Take a 'string_file &'
instead of a 'ui_file *'.
* compile/compile-internal.h (generate_c_for_for_one_variable):
Take a 'string_file &' instead of a 'ui_file *'.
* compile/compile-loc2c.c (push, pushf, unary, binary)
(print_label, pushf_register_address, pushf_register)
(do_compile_dwarf_expr_to_c): Take a 'string_file &' instead of a
'ui_file *'. Adjust.
* compile/compile.c (compile_to_object): Use string_file.
* compile/compile.h (compile_dwarf_expr_to_c)
(compile_dwarf_bounds_to_c): Take a 'string_file &' instead of a
'ui_file *'.
* cp-support.c (inspect_type): Use string_file and obstack_copy0.
(replace_typedefs_qualified_name): Use string_file and
obstack_copy0.
* disasm.c (gdb_pretty_print_insn): Use string_file.
(gdb_disassembly): Adjust reference the null_stream global.
(do_ui_file_delete): Delete.
(gdb_insn_length): Use null_stream.
* dummy-frame.c (maintenance_print_dummy_frames): Use stdio_file.
* dwarf2loc.c (dwarf2_compile_property_to_c)
(locexpr_generate_c_location, loclist_generate_c_location): Take a
'string_file &' instead of a 'ui_file *'.
* dwarf2loc.h (dwarf2_compile_property_to_c): Likewise.
* dwarf2read.c (do_ui_file_peek_last): Delete.
(dwarf2_compute_name): Use string_file.
* event-top.c (gdb_setup_readline): Use stdio_file.
* gdbarch.sh (verify_gdbarch): Use string_file.
* gdbtypes.c (safe_parse_type): Use null_stream.
* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use
string_file.
* guile/scm-disasm.c (gdbscm_print_insn_from_port): Take a
'string_file *' instead of a 'ui_file *'.
(gdbscm_arch_disassemble): Use string_file.
* guile/scm-frame.c (frscm_print_frame_smob): Use string_file.
* guile/scm-ports.c (class ioscm_file_port): Now a class that
inherits from ui_file.
(ioscm_file_port_delete, ioscm_file_port_rewind)
(ioscm_file_port_put): Delete.
(ioscm_file_port_write): Rename to ...
(ioscm_file_port::write): ... this. Remove file_port_magic
checks.
(ioscm_file_port_new): Delete.
(ioscm_with_output_to_port_worker): Use ioscm_file_port and
ui_file_up.
* guile/scm-type.c (tyscm_type_name): Use string_file.
* guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print):
Use string_file.
* infcmd.c (print_return_value_1): Use string_file.
* infrun.c (print_target_wait_results): Use string_file.
* language.c (add_language): Use string_file.
* location.c (explicit_to_string_internal): Use string_file.
* main.c (captured_main_1): Use null_file.
* maint.c (maintenance_print_architecture): Use stdio_file.
* mi/mi-cmd-stack.c (list_arg_or_local): Use string_file.
* mi/mi-common.h (struct mi_interp) <out, err, log, targ,
event_channel>: Change type to mi_console_file pointer.
* mi/mi-console.c (mi_console_file_fputs, mi_console_file_flush)
(mi_console_file_delete): Delete.
(struct mi_console_file): Delete.
(mi_console_file_magic): Delete.
(mi_console_file_new): Delete.
(mi_console_file::mi_console_file): New.
(mi_console_file_delete): Delete.
(mi_console_file_fputs): Delete.
(mi_console_file::write): New.
(mi_console_raw_packet): Delete.
(mi_console_file::flush): New.
(mi_console_file_flush): Delete.
(mi_console_set_raw): Rename to ...
(mi_console_file::set_raw): ... this.
* mi/mi-console.h (class mi_console_file): New class.
(mi_console_file_new, mi_console_set_raw): Delete.
* mi/mi-interp.c (mi_interpreter_init): Use mi_console_file.
(mi_set_logging): Use delete and tee_file. Adjust.
* mi/mi-main.c (output_register): Use string_file.
(mi_cmd_data_evaluate_expression): Use string_file.
(mi_cmd_data_read_memory): Use string_file.
(mi_cmd_execute, print_variable_or_computed): Use string_file.
* mi/mi-out.c (mi_ui_out::main_stream): New.
(mi_ui_out::rewind): Use main_stream and
string_file.
(mi_ui_out::put): Use main_stream and string_file.
(mi_ui_out::mi_ui_out): Remove 'stream' parameter.
Allocate a 'string_file' instead.
(mi_out_new): Don't allocate a mem_fileopen stream here.
* mi/mi-out.h (mi_ui_out::mi_ui_out): Remove 'stream' parameter.
(mi_ui_out::main_stream): Declare method.
* printcmd.c (eval_command): Use string_file.
* psymtab.c (maintenance_print_psymbols): Use stdio_file.
* python/py-arch.c (archpy_disassemble): Use string_file.
* python/py-breakpoint.c (bppy_get_commands): Use string_file.
* python/py-frame.c (frapy_str): Use string_file.
* python/py-framefilter.c (py_print_type, py_print_single_arg):
Use string_file.
* python/py-type.c (typy_str): Use string_file.
* python/py-unwind.c (unwind_infopy_str): Use string_file.
* python/py-value.c (valpy_str): Use string_file.
* record-btrace.c (btrace_insn_history): Use string_file.
* regcache.c (regcache_print): Use stdio_file.
* reggroups.c (maintenance_print_reggroups): Use stdio_file.
* remote.c (escape_buffer): Use string_file.
* rust-lang.c (rust_get_disr_info): Use string_file.
* serial.c (serial_open_ops_1): Use stdio_file.
(do_serial_close): Use delete.
* stack.c (print_frame_arg): Use string_file.
(print_frame_args): Remove local mem_fileopen stream, not used.
(print_frame): Use string_file.
* symmisc.c (maintenance_print_symbols): Use stdio_file.
* symtab.h (struct symbol_computed_ops) <generate_c_location>:
Take a 'string_file *' instead of a 'ui_file *'.
* top.c (new_ui): Use stdio_file and stderr_file.
(free_ui): Use delete.
(execute_command_to_string): Use string_file.
(quit_confirm): Use string_file.
* tracepoint.c (collection_list::append_exp): Use string_file.
* tui/tui-disasm.c (tui_disassemble): Use string_file.
* tui/tui-file.c: Don't include "ui-file.h".
(enum streamtype, struct tui_stream): Delete.
(tui_file_new, tui_file_delete, tui_fileopen, tui_sfileopen)
(tui_file_isatty, tui_file_rewind, tui_file_put): Delete.
(tui_file::tui_file): New method.
(tui_file_fputs): Delete.
(tui_file_get_strbuf): Delete.
(tui_file::puts): New method.
(tui_file_adjust_strbuf): Delete.
(tui_file_flush): Delete.
(tui_file::flush): New method.
* tui/tui-file.h: Tweak intro comment.
Include ui-file.h.
(tui_fileopen, tui_sfileopen, tui_file_get_strbuf)
(tui_file_adjust_strbuf): Delete declarations.
(class tui_file): New class.
* tui/tui-io.c (tui_initialize_io): Use tui_file.
* tui/tui-regs.c (tui_restore_gdbout): Use delete.
(tui_register_format): Use string_stream.
* tui/tui-stack.c (tui_make_status_line): Use string_file.
(tui_get_function_from_frame): Use string_file.
* typeprint.c (type_to_string): Use string_file.
* ui-file.c (struct ui_file, ui_file_magic, ui_file_new): Delete.
(null_stream): New global.
(ui_file_delete): Delete.
(ui_file::ui_file): New.
(null_file_isatty): Delete.
(ui_file::~ui_file): New.
(null_file_rewind): Delete.
(ui_file::printf): New.
(null_file_put): Delete.
(null_file_flush): Delete.
(ui_file::putstr): New.
(null_file_write): Delete.
(ui_file::putstrn): New.
(null_file_read): Delete.
(ui_file::putc): New.
(null_file_fputs): Delete.
(null_file_write_async_safe): Delete.
(ui_file::vprintf): New.
(null_file_delete): Delete.
(null_file::write): New.
(null_file_fseek): Delete.
(null_file::puts): New.
(ui_file_data): Delete.
(null_file::write_async_safe): New.
(gdb_flush, ui_file_isatty): Adjust.
(ui_file_put, ui_file_rewind): Delete.
(ui_file_write): Adjust.
(ui_file_write_for_put): Delete.
(ui_file_write_async_safe, ui_file_read): Adjust.
(ui_file_fseek): Delete.
(fputs_unfiltered): Adjust.
(set_ui_file_flush, set_ui_file_isatty, set_ui_file_rewind)
(set_ui_file_put, set_ui_file_write, set_ui_file_write_async_safe)
(set_ui_file_read, set_ui_file_fputs, set_ui_file_fseek)
(set_ui_file_data): Delete.
(string_file::~string_file, string_file::write)
(struct accumulated_ui_file, do_ui_file_xstrdup, ui_file_xstrdup)
(do_ui_file_as_string, ui_file_as_string): Delete.
(do_ui_file_obsavestring, ui_file_obsavestring): Delete.
(struct mem_file): Delete.
(mem_file_new): Delete.
(stdio_file::stdio_file): New.
(mem_file_delete): Delete.
(stdio_file::stdio_file): New.
(mem_fileopen): Delete.
(stdio_file::~stdio_file): New.
(mem_file_rewind): Delete.
(stdio_file::set_stream): New.
(mem_file_put): Delete.
(stdio_file::open): New.
(mem_file_write): Delete.
(stdio_file_magic, struct stdio_file): Delete.
(stdio_file_new, stdio_file_delete, stdio_file_flush): Delete.
(stdio_file::flush): New.
(stdio_file_read): Rename to ...
(stdio_file::read): ... this. Adjust.
(stdio_file_write): Rename to ...
(stdio_file::write): ... this. Adjust.
(stdio_file_write_async_safe): Rename to ...
(stdio_file::write_async_safe) ... this. Adjust.
(stdio_file_fputs): Rename to ...
(stdio_file::puts) ... this. Adjust.
(stdio_file_isatty): Delete.
(stdio_file_fseek): Delete.
(stdio_file::isatty): New.
(stderr_file_write): Rename to ...
(stderr_file::write) ... this. Adjust.
(stderr_file_fputs): Rename to ...
(stderr_file::puts) ... this. Adjust.
(stderr_fileopen, stdio_fileopen, gdb_fopen): Delete.
(stderr_file::stderr_file): New.
(tee_file_magic): Delete.
(struct tee_file): Delete.
(tee_file::tee_file): New.
(tee_file_new): Delete.
(tee_file::~tee_file): New.
(tee_file_delete): Delete.
(tee_file_flush): Rename to ...
(tee_file::flush): ... this. Adjust.
(tee_file_write): Rename to ...
(tee_file::write): ... this. Adjust.
(tee_file::write_async_safe): New.
(tee_file_fputs): Rename to ...
(tee_file::puts): ... this. Adjust.
(tee_file_isatty): Rename to ...
(tee_file::isatty): ... this. Adjust.
* ui-file.h (struct obstack, struct ui_file): Don't
forward-declare.
(ui_file_new, ui_file_flush_ftype, set_ui_file_flush)
(ui_file_write_ftype)
(set_ui_file_write, ui_file_fputs_ftype, set_ui_file_fputs)
(ui_file_write_async_safe_ftype, set_ui_file_write_async_safe)
(ui_file_read_ftype, set_ui_file_read, ui_file_isatty_ftype)
(set_ui_file_isatty, ui_file_rewind_ftype, set_ui_file_rewind)
(ui_file_put_method_ftype, ui_file_put_ftype, set_ui_file_put)
(ui_file_delete_ftype, set_ui_file_data, ui_file_fseek_ftype)
(set_ui_file_fseek): Delete.
(ui_file_data, ui_file_delete, ui_file_rewind)
(struct ui_file): New.
(ui_file_up): New.
(class null_file): New.
(null_stream): Declare.
(ui_file_write_for_put, ui_file_put): Delete.
(ui_file_xstrdup, ui_file_as_string, ui_file_obsavestring):
Delete.
(ui_file_fseek, mem_fileopen, stdio_fileopen, stderr_fileopen)
(gdb_fopen, tee_file_new): Delete.
(struct string_file): New.
(struct stdio_file): New.
(stdio_file_up): New.
(struct stderr_file): New.
(class tee_file): New.
* ui-out.c (ui_out::field_stream): Take a 'string_file &' instead
of a 'ui_file *'. Adjust.
* ui-out.h (class ui_out) <field_stream>: Likewise.
* utils.c (do_ui_file_delete, make_cleanup_ui_file_delete)
(null_stream): Delete.
(error_stream): Take a 'string_file &' instead of a 'ui_file *'.
Adjust.
* utils.h (struct ui_file): Delete forward declaration..
(make_cleanup_ui_file_delete, null_stream): Delete declarations.
(error_stream): Take a 'string_file &' instead of a
'ui_file *'.
* varobj.c (varobj_value_get_print_value): Use string_file.
* xtensa-tdep.c (xtensa_verify_config): Use string_file.
* gdbarch.c: Regenerate.
2017-02-02 12:11:47 +01:00
|
|
|
log.puts ("\n\tdisplaced_step_free_closure");
|
Implement displaced stepping.
gdb/
* gdbarch.sh (max_insn_length): New 'variable'.
(displaced_step_copy, displaced_step_fixup)
(displaced_step_free_closure, displaced_step_location): New
functions.
(struct displaced_step_closure): Add forward declaration.
* gdbarch.c, gdbarch.h: Regenerated.
* arch-utils.c: #include "objfiles.h".
(simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New functions.
* arch-utils.h (simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New prototypes.
* i386-tdep.c (I386_MAX_INSN_LEN): Rename to...
(I386_MAX_MATCHED_INSN_LEN): ... this.
(i386_absolute_jmp_p, i386_absolute_call_p)
(i386_ret_p, i386_call_p, i386_breakpoint_p, i386_syscall_p)
(i386_displaced_step_fixup): New functions.
(struct i386_insn, i386_match_insn): Update.
(i386_gdbarch_init): Set gdbarch_max_insn_length.
* i386-tdep.h (I386_MAX_INSN_LEN): New.
(i386_displaced_step_fixup): New prototype.
* i386-linux-tdep.c (i386_linux_init_abi): Include "arch-utils.h".
Register gdbarch_displaced_step_copy,
gdbarch_displaced_step_fixup, gdbarch_displaced_step_free_closure,
and gdbarch_displaced_step_location functions.
* infrun.c (debug_displaced): New variable.
(show_debug_displaced): New function.
(struct displaced_step_request): New struct.
(displaced_step_request_queue, displaced_step_ptid)
(displaced_step_gdbarch, displaced_step_closure)
(displaced_step_original, displaced_step_copy)
(displaced_step_saved_copy, can_use_displaced_stepping): New
variables.
(show_can_use_displaced_stepping, use_displaced_stepping)
(displaced_step_clear, cleanup_displaced_step_closure)
(displaced_step_dump_bytes, displaced_step_prepare)
(displaced_step_clear_cleanup, write_memory_ptid)
(displaced_step_fixup): New functions.
(resume): Call displaced_step_prepare.
(proceed): Call read_pc once, and remember the value. If using
displaced stepping, don't remove breakpoints.
(handle_inferior_event): Call displaced_step_fixup. Add some
debugging output. When we try to step over a breakpoint, but get
a signal to deliver to the thread instead, ensure the step-resume
breakpoint is actually inserted. If a thread hop is needed, and
displaced stepping is enabled, don't remove breakpoints.
(init_wait_for_inferior): Call displaced_step_clear.
(_initialize_infrun): Add "set debug displaced" command. Add
"maint set can-use-displaced-stepping" command. Clear
displaced_step_ptid.
* inferior.h (debug_displaced): Declare variable.
(displaced_step_dump_bytes): Declare function.
* Makefile.in (arch-utils.o, i386-linux-tdep.o): Update
dependencies.
gdb/testsuite/
* gdb.asm/asmsrc1.s: Add scratch space.
gdb/doc/
* gdb.texinfo (Debugging Output): Document "set/show debug
displaced".
(Maintenance Commands): Document "maint set/show
can-use-displaced-stepping".
2008-05-02 18:49:54 +02:00
|
|
|
if ((! gdbarch->displaced_step_location) != (! gdbarch->displaced_step_copy_insn))
|
Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy
This patch starts from the desire to eliminate
make_cleanup_ui_file_delete, but then goes beyond. It makes ui_file &
friends a real C++ class hierarchy, and switches temporary
ui_file-like objects to stack-based allocation.
- mem_fileopen -> string_file
mem_fileopen is replaced with a new string_file class that is treated
as a value class created on the stack. This alone eliminates most
make_cleanup_ui_file_delete calls, and, simplifies code a whole lot
(diffstat shows around 1k loc dropped.)
string_file's internal buffer is a std::string, thus the "string" in
the name. This simplifies the implementation much, compared to
mem_fileopen, which managed growing its internal buffer manually.
- ui_file_as_string, ui_file_strdup, ui_file_obsavestring all gone
The new string_file class has a string() method that provides direct
writable access to the internal std::string buffer. This replaced
ui_file_as_string, which forced a copy of the same data the stream had
inside. With direct access via a writable reference, we can instead
move the string out of the string_stream, avoiding deep string
copying.
Related, ui_file_xstrdup calls are replaced with xstrdup'ping the
stream's string, and ui_file_obsavestring is replaced by
obstack_copy0.
With all those out of the way, getting rid of the weird ui_file_put
mechanism was possible.
- New ui_file::printf, ui_file::puts, etc. methods
These simplify / clarify client code. I considered splitting
client-code changes, like these, e.g.:
- stb = mem_fileopen ();
- fprintf_unfiltered (stb, "%s%s%s",
- _("The valid values are:\n"),
- regdesc,
- _("The default is \"std\"."));
+ string_file stb;
+ stb.printf ("%s%s%s",
+ _("The valid values are:\n"),
+ regdesc,
+ _("The default is \"std\"."));
In two steps, with the first step leaving fprintf_unfiltered (etc.)
calls in place, and only afterwards do a pass to change all those to
call stb.printf etc.. I didn't do that split, because (when I tried),
it turned out to be pointless make-work: the first pass would have to
touch the fprintf_unfiltered line anyway, to replace "stb" with
"&stb".
- gdb_fopen replaced with stack-based objects
This avoids the need for cleanups or unique_ptr's. I.e., this:
struct ui_file *file = gdb_fopen (filename, "w");
if (filename == NULL)
perror_with_name (filename);
cleanups = make_cleanup_ui_file_delete (file);
// use file.
do_cleanups (cleanups);
is replaced with this:
stdio_file file;
if (!file.open (filename, "w"))
perror_with_name (filename);
// use file.
- odd contorsions in null_file_write / null_file_fputs around when to
call to_fputs / to_write eliminated.
- Global null_stream object
A few places that were allocating a ui_file in order to print to
"nowhere" are adjusted to instead refer to a new 'null_stream' global
stream.
- TUI's tui_sfileopen eliminated. TUI's ui_file much simplified
The TUI's ui_file was serving a dual purpose. It supported being used
as string buffer, and supported being backed by a stdio FILE. The
string buffer part is gone, replaced by using of string_file. The
'FILE *' support is now much simplified, by making the TUI's ui_file
inherit from stdio_file.
gdb/ChangeLog:
2017-02-02 Pedro Alves <palves@redhat.com>
* ada-lang.c (type_as_string): Use string_file.
* ada-valprint.c (ada_print_floating): Use string_file.
* ada-varobj.c (ada_varobj_scalar_image)
(ada_varobj_get_value_image): Use string_file.
* aix-thread.c (aix_thread_extra_thread_info): Use string_file.
* arm-tdep.c (_initialize_arm_tdep): Use string_printf.
* breakpoint.c (update_inserted_breakpoint_locations)
(insert_breakpoint_locations, reattach_breakpoints)
(print_breakpoint_location, print_one_detail_ranged_breakpoint)
(print_it_watchpoint): Use string_file.
(save_breakpoints): Use stdio_file.
* c-exp.y (oper): Use string_file.
* cli/cli-logging.c (set_logging_redirect): Use ui_file_up and
tee_file.
(pop_output_files): Use delete.
(handle_redirections): Use stdio_file and tee_file.
* cli/cli-setshow.c (do_show_command): Use string_file.
* compile/compile-c-support.c (c_compute_program): Use
string_file.
* compile/compile-c-symbols.c (generate_vla_size): Take a
'string_file &' instead of a 'ui_file *'.
(generate_c_for_for_one_variable): Take a 'string_file &' instead
of a 'ui_file *'. Use string_file.
(generate_c_for_variable_locations): Take a 'string_file &'
instead of a 'ui_file *'.
* compile/compile-internal.h (generate_c_for_for_one_variable):
Take a 'string_file &' instead of a 'ui_file *'.
* compile/compile-loc2c.c (push, pushf, unary, binary)
(print_label, pushf_register_address, pushf_register)
(do_compile_dwarf_expr_to_c): Take a 'string_file &' instead of a
'ui_file *'. Adjust.
* compile/compile.c (compile_to_object): Use string_file.
* compile/compile.h (compile_dwarf_expr_to_c)
(compile_dwarf_bounds_to_c): Take a 'string_file &' instead of a
'ui_file *'.
* cp-support.c (inspect_type): Use string_file and obstack_copy0.
(replace_typedefs_qualified_name): Use string_file and
obstack_copy0.
* disasm.c (gdb_pretty_print_insn): Use string_file.
(gdb_disassembly): Adjust reference the null_stream global.
(do_ui_file_delete): Delete.
(gdb_insn_length): Use null_stream.
* dummy-frame.c (maintenance_print_dummy_frames): Use stdio_file.
* dwarf2loc.c (dwarf2_compile_property_to_c)
(locexpr_generate_c_location, loclist_generate_c_location): Take a
'string_file &' instead of a 'ui_file *'.
* dwarf2loc.h (dwarf2_compile_property_to_c): Likewise.
* dwarf2read.c (do_ui_file_peek_last): Delete.
(dwarf2_compute_name): Use string_file.
* event-top.c (gdb_setup_readline): Use stdio_file.
* gdbarch.sh (verify_gdbarch): Use string_file.
* gdbtypes.c (safe_parse_type): Use null_stream.
* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use
string_file.
* guile/scm-disasm.c (gdbscm_print_insn_from_port): Take a
'string_file *' instead of a 'ui_file *'.
(gdbscm_arch_disassemble): Use string_file.
* guile/scm-frame.c (frscm_print_frame_smob): Use string_file.
* guile/scm-ports.c (class ioscm_file_port): Now a class that
inherits from ui_file.
(ioscm_file_port_delete, ioscm_file_port_rewind)
(ioscm_file_port_put): Delete.
(ioscm_file_port_write): Rename to ...
(ioscm_file_port::write): ... this. Remove file_port_magic
checks.
(ioscm_file_port_new): Delete.
(ioscm_with_output_to_port_worker): Use ioscm_file_port and
ui_file_up.
* guile/scm-type.c (tyscm_type_name): Use string_file.
* guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print):
Use string_file.
* infcmd.c (print_return_value_1): Use string_file.
* infrun.c (print_target_wait_results): Use string_file.
* language.c (add_language): Use string_file.
* location.c (explicit_to_string_internal): Use string_file.
* main.c (captured_main_1): Use null_file.
* maint.c (maintenance_print_architecture): Use stdio_file.
* mi/mi-cmd-stack.c (list_arg_or_local): Use string_file.
* mi/mi-common.h (struct mi_interp) <out, err, log, targ,
event_channel>: Change type to mi_console_file pointer.
* mi/mi-console.c (mi_console_file_fputs, mi_console_file_flush)
(mi_console_file_delete): Delete.
(struct mi_console_file): Delete.
(mi_console_file_magic): Delete.
(mi_console_file_new): Delete.
(mi_console_file::mi_console_file): New.
(mi_console_file_delete): Delete.
(mi_console_file_fputs): Delete.
(mi_console_file::write): New.
(mi_console_raw_packet): Delete.
(mi_console_file::flush): New.
(mi_console_file_flush): Delete.
(mi_console_set_raw): Rename to ...
(mi_console_file::set_raw): ... this.
* mi/mi-console.h (class mi_console_file): New class.
(mi_console_file_new, mi_console_set_raw): Delete.
* mi/mi-interp.c (mi_interpreter_init): Use mi_console_file.
(mi_set_logging): Use delete and tee_file. Adjust.
* mi/mi-main.c (output_register): Use string_file.
(mi_cmd_data_evaluate_expression): Use string_file.
(mi_cmd_data_read_memory): Use string_file.
(mi_cmd_execute, print_variable_or_computed): Use string_file.
* mi/mi-out.c (mi_ui_out::main_stream): New.
(mi_ui_out::rewind): Use main_stream and
string_file.
(mi_ui_out::put): Use main_stream and string_file.
(mi_ui_out::mi_ui_out): Remove 'stream' parameter.
Allocate a 'string_file' instead.
(mi_out_new): Don't allocate a mem_fileopen stream here.
* mi/mi-out.h (mi_ui_out::mi_ui_out): Remove 'stream' parameter.
(mi_ui_out::main_stream): Declare method.
* printcmd.c (eval_command): Use string_file.
* psymtab.c (maintenance_print_psymbols): Use stdio_file.
* python/py-arch.c (archpy_disassemble): Use string_file.
* python/py-breakpoint.c (bppy_get_commands): Use string_file.
* python/py-frame.c (frapy_str): Use string_file.
* python/py-framefilter.c (py_print_type, py_print_single_arg):
Use string_file.
* python/py-type.c (typy_str): Use string_file.
* python/py-unwind.c (unwind_infopy_str): Use string_file.
* python/py-value.c (valpy_str): Use string_file.
* record-btrace.c (btrace_insn_history): Use string_file.
* regcache.c (regcache_print): Use stdio_file.
* reggroups.c (maintenance_print_reggroups): Use stdio_file.
* remote.c (escape_buffer): Use string_file.
* rust-lang.c (rust_get_disr_info): Use string_file.
* serial.c (serial_open_ops_1): Use stdio_file.
(do_serial_close): Use delete.
* stack.c (print_frame_arg): Use string_file.
(print_frame_args): Remove local mem_fileopen stream, not used.
(print_frame): Use string_file.
* symmisc.c (maintenance_print_symbols): Use stdio_file.
* symtab.h (struct symbol_computed_ops) <generate_c_location>:
Take a 'string_file *' instead of a 'ui_file *'.
* top.c (new_ui): Use stdio_file and stderr_file.
(free_ui): Use delete.
(execute_command_to_string): Use string_file.
(quit_confirm): Use string_file.
* tracepoint.c (collection_list::append_exp): Use string_file.
* tui/tui-disasm.c (tui_disassemble): Use string_file.
* tui/tui-file.c: Don't include "ui-file.h".
(enum streamtype, struct tui_stream): Delete.
(tui_file_new, tui_file_delete, tui_fileopen, tui_sfileopen)
(tui_file_isatty, tui_file_rewind, tui_file_put): Delete.
(tui_file::tui_file): New method.
(tui_file_fputs): Delete.
(tui_file_get_strbuf): Delete.
(tui_file::puts): New method.
(tui_file_adjust_strbuf): Delete.
(tui_file_flush): Delete.
(tui_file::flush): New method.
* tui/tui-file.h: Tweak intro comment.
Include ui-file.h.
(tui_fileopen, tui_sfileopen, tui_file_get_strbuf)
(tui_file_adjust_strbuf): Delete declarations.
(class tui_file): New class.
* tui/tui-io.c (tui_initialize_io): Use tui_file.
* tui/tui-regs.c (tui_restore_gdbout): Use delete.
(tui_register_format): Use string_stream.
* tui/tui-stack.c (tui_make_status_line): Use string_file.
(tui_get_function_from_frame): Use string_file.
* typeprint.c (type_to_string): Use string_file.
* ui-file.c (struct ui_file, ui_file_magic, ui_file_new): Delete.
(null_stream): New global.
(ui_file_delete): Delete.
(ui_file::ui_file): New.
(null_file_isatty): Delete.
(ui_file::~ui_file): New.
(null_file_rewind): Delete.
(ui_file::printf): New.
(null_file_put): Delete.
(null_file_flush): Delete.
(ui_file::putstr): New.
(null_file_write): Delete.
(ui_file::putstrn): New.
(null_file_read): Delete.
(ui_file::putc): New.
(null_file_fputs): Delete.
(null_file_write_async_safe): Delete.
(ui_file::vprintf): New.
(null_file_delete): Delete.
(null_file::write): New.
(null_file_fseek): Delete.
(null_file::puts): New.
(ui_file_data): Delete.
(null_file::write_async_safe): New.
(gdb_flush, ui_file_isatty): Adjust.
(ui_file_put, ui_file_rewind): Delete.
(ui_file_write): Adjust.
(ui_file_write_for_put): Delete.
(ui_file_write_async_safe, ui_file_read): Adjust.
(ui_file_fseek): Delete.
(fputs_unfiltered): Adjust.
(set_ui_file_flush, set_ui_file_isatty, set_ui_file_rewind)
(set_ui_file_put, set_ui_file_write, set_ui_file_write_async_safe)
(set_ui_file_read, set_ui_file_fputs, set_ui_file_fseek)
(set_ui_file_data): Delete.
(string_file::~string_file, string_file::write)
(struct accumulated_ui_file, do_ui_file_xstrdup, ui_file_xstrdup)
(do_ui_file_as_string, ui_file_as_string): Delete.
(do_ui_file_obsavestring, ui_file_obsavestring): Delete.
(struct mem_file): Delete.
(mem_file_new): Delete.
(stdio_file::stdio_file): New.
(mem_file_delete): Delete.
(stdio_file::stdio_file): New.
(mem_fileopen): Delete.
(stdio_file::~stdio_file): New.
(mem_file_rewind): Delete.
(stdio_file::set_stream): New.
(mem_file_put): Delete.
(stdio_file::open): New.
(mem_file_write): Delete.
(stdio_file_magic, struct stdio_file): Delete.
(stdio_file_new, stdio_file_delete, stdio_file_flush): Delete.
(stdio_file::flush): New.
(stdio_file_read): Rename to ...
(stdio_file::read): ... this. Adjust.
(stdio_file_write): Rename to ...
(stdio_file::write): ... this. Adjust.
(stdio_file_write_async_safe): Rename to ...
(stdio_file::write_async_safe) ... this. Adjust.
(stdio_file_fputs): Rename to ...
(stdio_file::puts) ... this. Adjust.
(stdio_file_isatty): Delete.
(stdio_file_fseek): Delete.
(stdio_file::isatty): New.
(stderr_file_write): Rename to ...
(stderr_file::write) ... this. Adjust.
(stderr_file_fputs): Rename to ...
(stderr_file::puts) ... this. Adjust.
(stderr_fileopen, stdio_fileopen, gdb_fopen): Delete.
(stderr_file::stderr_file): New.
(tee_file_magic): Delete.
(struct tee_file): Delete.
(tee_file::tee_file): New.
(tee_file_new): Delete.
(tee_file::~tee_file): New.
(tee_file_delete): Delete.
(tee_file_flush): Rename to ...
(tee_file::flush): ... this. Adjust.
(tee_file_write): Rename to ...
(tee_file::write): ... this. Adjust.
(tee_file::write_async_safe): New.
(tee_file_fputs): Rename to ...
(tee_file::puts): ... this. Adjust.
(tee_file_isatty): Rename to ...
(tee_file::isatty): ... this. Adjust.
* ui-file.h (struct obstack, struct ui_file): Don't
forward-declare.
(ui_file_new, ui_file_flush_ftype, set_ui_file_flush)
(ui_file_write_ftype)
(set_ui_file_write, ui_file_fputs_ftype, set_ui_file_fputs)
(ui_file_write_async_safe_ftype, set_ui_file_write_async_safe)
(ui_file_read_ftype, set_ui_file_read, ui_file_isatty_ftype)
(set_ui_file_isatty, ui_file_rewind_ftype, set_ui_file_rewind)
(ui_file_put_method_ftype, ui_file_put_ftype, set_ui_file_put)
(ui_file_delete_ftype, set_ui_file_data, ui_file_fseek_ftype)
(set_ui_file_fseek): Delete.
(ui_file_data, ui_file_delete, ui_file_rewind)
(struct ui_file): New.
(ui_file_up): New.
(class null_file): New.
(null_stream): Declare.
(ui_file_write_for_put, ui_file_put): Delete.
(ui_file_xstrdup, ui_file_as_string, ui_file_obsavestring):
Delete.
(ui_file_fseek, mem_fileopen, stdio_fileopen, stderr_fileopen)
(gdb_fopen, tee_file_new): Delete.
(struct string_file): New.
(struct stdio_file): New.
(stdio_file_up): New.
(struct stderr_file): New.
(class tee_file): New.
* ui-out.c (ui_out::field_stream): Take a 'string_file &' instead
of a 'ui_file *'. Adjust.
* ui-out.h (class ui_out) <field_stream>: Likewise.
* utils.c (do_ui_file_delete, make_cleanup_ui_file_delete)
(null_stream): Delete.
(error_stream): Take a 'string_file &' instead of a 'ui_file *'.
Adjust.
* utils.h (struct ui_file): Delete forward declaration..
(make_cleanup_ui_file_delete, null_stream): Delete declarations.
(error_stream): Take a 'string_file &' instead of a
'ui_file *'.
* varobj.c (varobj_value_get_print_value): Use string_file.
* xtensa-tdep.c (xtensa_verify_config): Use string_file.
* gdbarch.c: Regenerate.
2017-02-02 12:11:47 +01:00
|
|
|
log.puts ("\n\tdisplaced_step_location");
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of relocate_instruction, has predicate. */
|
|
|
|
/* Skip verify of overlay_update, has predicate. */
|
|
|
|
/* Skip verify of core_read_description, has predicate. */
|
|
|
|
/* Skip verify of static_transform_name, has predicate. */
|
2007-10-19 14:26:35 +02:00
|
|
|
/* Skip verify of sofun_address_maybe_missing, invalid_p == 0 */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of process_record, has predicate. */
|
|
|
|
/* Skip verify of process_record_signal, has predicate. */
|
2012-06-04 18:23:57 +02:00
|
|
|
/* Skip verify of gdb_signal_from_target, has predicate. */
|
This patch implements the new gdbarch method gdbarch_gdb_signal_to_target.
It will be used when one wants to convert between the internal GDB signal
representation (enum gdb_signal) and the target's representation.
The idea of this patch came from a chat between Pedro and I on IRC, plus
the discussion of my patches to add the new $_exitsignal convenience
variable:
<http://sourceware.org/ml/gdb-patches/2013-06/msg00452.html>
<http://sourceware.org/ml/gdb-patches/2013-06/msg00352.html>
What I did was to investigate, on the Linux kernel, which targets shared
the signal numbers definition with the generic definition, present at
<include/uapi/asm-generic/signal.h>. For the record, I used linux-3.10-rc7
as the main source of information, always looking at
<arch/<ARCH_NAME>/include/uapi/asm/signal.h>. For SIGRTMAX (which defaults
to _NSIG in most cases), I had to look at different signal-related
files, but most of them (except MIPS) were defined to 64 anyway.
Then, with all the differences in hand, I implemented the bits on each
target.
2013-08-09 Sergio Durigan Junior <sergiodj@redhat.com>
* linux-tdep.c: Define enum with generic signal numbers.
(linux_gdb_signal_from_target): New function.
(linux_gdb_signal_to_target): Likewise.
(linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
methods to the functions above.
* linux-tdep.h (linux_gdb_signal_from_target): New prototype.
(linux_gdb_signal_to_target): Likewise.
* alpha-linux-tdep.c: Define new enum with signals different
from generic Linux kernel.
(alpha_linux_gdb_signal_from_target): New function.
(alpha_linux_gdb_signal_to_target): Likewise.
(alpha_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
with the functions mentioned above.
* avr-tdep.c: Define enum with differences between Linux kernel
and AVR signals.
(avr_linux_gdb_signal_from_target): New function.
(avr_linux_gdb_signal_to_target): Likewise.
(avr_gdbarch_init): Set gdbarch_gdb_signal_{to,from}_target to
the functions mentioned above.
* sparc-linux-tdep.c: Define enum with differences between SPARC
and generic Linux kernel signal numbers.
(sparc32_linux_gdb_signal_from_target): New function.
(sparc32_linux_gdb_signal_to_target): Likewise.
(sparc32_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
to the functions defined above.
* xtensa-linux-tdep.c: Define enum with differences between
Xtensa and Linux kernel generic signals.
(xtensa_linux_gdb_signal_from_target): New function.
(xtensa_linux_gdb_signal_to_target): Likewise.
(xtensa_linux_init_abi): Set gdbarch_gdb_signal_to_target
to the functions defined above.
* mips-linux-tdep.c: Define enum with differences between
signals in MIPS and Linux kernel generic ones.
(mips_gdb_signal_to_target): New function.
(mips_gdb_signal_from_target): Redefine to use new enum, handle
only different signals from the Linux kernel generic.
(mips_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
the functions defined above.
* mips-linux-tdep.h (enum mips_signals): Remove.
2013-08-09 18:54:43 +02:00
|
|
|
/* Skip verify of gdb_signal_to_target, has predicate. */
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Skip verify of get_siginfo_type, has predicate. */
|
|
|
|
/* Skip verify of record_special_symbol, has predicate. */
|
|
|
|
/* Skip verify of get_syscall_number, has predicate. */
|
Partial fix for PR breakpoints/10737: Make syscall info be per-arch instead of global
This patch intends to partially fix PR breakpoints/10737, which is
about making the syscall information (for the "catch syscall" command)
be per-arch, instead of global. This is not a full fix because of the
other issues pointed by Pedro here:
<https://sourceware.org/bugzilla/show_bug.cgi?id=10737#c5>
However, I consider it a good step towards the real fix. It will also
help me fix <https://sourceware.org/bugzilla/show_bug.cgi?id=17402>.
What this patch does, basically, is move the "syscalls_info"
struct to gdbarch. Currently, the syscall information is stored in a
global variable inside gdb/xml-syscall.c, which means that there is no
easy way to correlate this info with the current target or
architecture being used, for example. This causes strange behaviors,
because the syscall info is not re-read when the arch changes. For
example, if you put a syscall catchpoint in syscall 5 on i386 (syscall
open), and then load a x86_64 program on GDB and put the same syscall
5 there (fstat on x86_64), you will still see that GDB tells you that
it is catching "open", even though it is not. With this patch, GDB
correctly says that it will be catching fstat syscalls.
(gdb) set architecture i386
The target architecture is assumed to be i386
(gdb) catch syscall 5
Catchpoint 1 (syscall 'open' [5])
(gdb) set architecture i386:x86-64
The target architecture is assumed to be i386:x86-64
(gdb) catch syscall 5
Catchpoint 2 (syscall 'open' [5])
But with the patch:
(gdb) set architecture i386
The target architecture is assumed to be i386
(gdb) catch syscall 5
Catchpoint 1 (syscall 'open' [5])
(gdb) set architecture i386:x86-64
The target architecture is assumed to be i386:x86-64
(gdb) catch syscall 5
Catchpoint 2 (syscall 'fstat' [5])
As I said, there are still some problems on the "catch syscall"
mechanism, because (for example) the user should be able to "catch
syscall open" on i386, and then expect "open" to be caught also on
x86_64. Currently, it doesn't work. I intend to work on this later.
gdb/
2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/10737
* amd64-linux-tdep.c (amd64_linux_init_abi_common): Adjust call to
set_xml_syscall_file_name to provide gdbarch.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* bfin-linux-tdep.c (bfin_linux_init_abi): Likewise.
* breakpoint.c (print_it_catch_syscall): Adjust call to
get_syscall_by_number to provide gdbarch.
(print_one_catch_syscall): Likewise.
(print_mention_catch_syscall): Likewise.
(print_recreate_catch_syscall): Likewise.
(catch_syscall_split_args): Adjust calls to get_syscall_by_number
and get_syscall_by_name to provide gdbarch.
(catch_syscall_completer): Adjust call to get_syscall_names to
provide gdbarch.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* gdbarch.sh: Forward declare "struct syscalls_info".
(xml_syscall_file): New variable.
(syscalls_info): Likewise.
* i386-linux-tdep.c (i386_linux_init_abi): Adjust call to
set_xml_syscall_file_name to provide gdbarch.
* mips-linux-tdep.c (mips_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* sparc-linux-tdep.c (sparc32_linux_init_abi): Likewise.
* sparc64-linux-tdep.c (sparc64_linux_init_abi): Likewise.
* xml-syscall.c: Include gdbarch.h.
(set_xml_syscall_file_name): Accept gdbarch parameter.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
(my_gdb_datadir): Delete global variable.
(struct syscalls_info) <my_gdb_datadir>: New variable.
(struct syscalls_info) <sysinfo>: Rename variable to
"syscalls_info".
(sysinfo): Delete global variable.
(have_initialized_sysinfo): Likewise.
(xml_syscall_file): Likewise.
(sysinfo_free_syscalls_desc): Rename to...
(syscalls_info_free_syscalls_desc): ... this.
(free_syscalls_info): Rename "sysinfo" to "syscalls_info". Adjust
code to the new layout of "struct syscalls_info".
(make_cleanup_free_syscalls_info): Rename parameter "sysinfo" to
"syscalls_info".
(syscall_create_syscall_desc): Likewise.
(syscall_start_syscall): Likewise.
(syscall_parse_xml): Likewise.
(xml_init_syscalls_info): Likewise. Drop "const" from return value.
(init_sysinfo): Rename to...
(init_syscalls_info): ...this. Add gdbarch as a parameter.
Adjust function to deal with gdbarch.
(xml_get_syscall_number): Delete parameter sysinfo. Accept
gdbarch as a parameter. Adjust code.
(xml_get_syscall_name): Likewise.
(xml_list_of_syscalls): Likewise.
(set_xml_syscall_file_name): Accept gdbarch as parameter.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
* xml-syscall.h (set_xml_syscall_file_name): Likewise.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
gdb/testsuite/
2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/10737
* gdb.base/catch-syscall.exp (do_syscall_tests): Call
test_catch_syscall_multi_arch.
(test_catch_syscall_multi_arch): New function.
2014-11-20 18:28:18 +01:00
|
|
|
/* Skip verify of xml_syscall_file, invalid_p == 0 */
|
|
|
|
/* Skip verify of syscalls_info, invalid_p == 0 */
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
/* Skip verify of stap_integer_prefixes, invalid_p == 0 */
|
|
|
|
/* Skip verify of stap_integer_suffixes, invalid_p == 0 */
|
|
|
|
/* Skip verify of stap_register_prefixes, invalid_p == 0 */
|
|
|
|
/* Skip verify of stap_register_suffixes, invalid_p == 0 */
|
|
|
|
/* Skip verify of stap_register_indirection_prefixes, invalid_p == 0 */
|
|
|
|
/* Skip verify of stap_register_indirection_suffixes, invalid_p == 0 */
|
2012-04-27 22:47:57 +02:00
|
|
|
/* Skip verify of stap_gdb_register_prefix, invalid_p == 0 */
|
|
|
|
/* Skip verify of stap_gdb_register_suffix, invalid_p == 0 */
|
|
|
|
/* Skip verify of stap_is_single_operand, has predicate. */
|
|
|
|
/* Skip verify of stap_parse_special_token, has predicate. */
|
2015-02-17 15:54:44 +01:00
|
|
|
/* Skip verify of dtrace_parse_probe_argument, has predicate. */
|
|
|
|
/* Skip verify of dtrace_probe_is_enabled, has predicate. */
|
|
|
|
/* Skip verify of dtrace_enable_probe, has predicate. */
|
|
|
|
/* Skip verify of dtrace_disable_probe, has predicate. */
|
* remote.c (remote_start_remote): If the solib list is global,
fetch libraries and insert breakpoints after connecting.
* infcmd.c (post_create_inferior): If the solist is shared between
inferiors, no need to refetch it on every new inferior.
(detach_command): If the shared library list is shared between
inferiors, then don't clear it on every inferior detach.
* gdbarch.sh (has_global_solist): New.
* i386-dicos-tdep.c (i386_dicos_init_abi): Set
gdbarch_has_global_solist.
* target.c (target_pre_inferior): If the shared library list is
shared between inferiors, then don't clear it here, neither
invalidate the memory regions or clear the target description.
(target_detach): If the shared library list is shared between
inferiors, then don't remove breakpoints from the target here.
(target_disconnect): Comment.
* solib.c (update_solib_list): Check for null_ptid.
* breakpoint.c (insert_breakpoints, update_global_location_list):
If the shared library list is shared between inferiors, insert
breakpoints even if there's no execution.
(breakpoint_init_inferior): If the shared library list is shared
between inferiors, don't delete breakpoints or mark them
uninserted here.
* gdbarch.c, gdbarch.h: Regenerate.
2008-11-03 15:01:27 +01:00
|
|
|
/* Skip verify of has_global_solist, invalid_p == 0 */
|
2009-05-19 02:23:49 +02:00
|
|
|
/* Skip verify of has_global_breakpoints, invalid_p == 0 */
|
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
Add base multi-executable/process support to GDB.
gdb/
* Makefile.in (SFILES): Add progspace.c.
(COMMON_OBS): Add progspace.o.
* progspace.h: New.
* progspace.c: New.
* breakpoint.h (struct bp_target_info) <placed_address_space>: New
field.
(struct bp_location) <pspace>: New field.
(struct breakpoint) <pspace>: New field.
(bpstat_stop_status, breakpoint_here_p)
(moribund_breakpoint_here_p, breakpoint_inserted_here_p)
(regular_breakpoint_inserted_here_p)
(software_breakpoint_inserted_here_p, breakpoint_thread_match)
(set_default_breakpoint): Adjust prototypes.
(remove_breakpoints_pid, breakpoint_program_space_exit): Declare.
(insert_single_step_breakpoint, deprecated_insert_raw_breakpoint):
Adjust prototypes.
* breakpoint.c (executing_startup): Delete.
(default_breakpoint_sspace): New.
(breakpoint_restore_shadows): Skip if the address space doesn't
match.
(update_watchpoint): Record the frame's program space in the
breakpoint location.
(insert_bp_location): Record the address space in target_info.
Adjust to pass the symbol space to solib_name_from_address.
(breakpoint_program_space_exit): New.
(insert_breakpoint_locations): Switch the symbol space and thread
when inserting breakpoints. Don't insert breakpoints in a vfork
parent waiting for vfork done if we're not attached to the vfork
child.
(remove_breakpoints_pid): New.
(reattach_breakpoints): Switch to a thread of PID. Ignore
breakpoints of other symbol spaces.
(create_internal_breakpoint): Store the symbol space in the sal.
(create_longjmp_master_breakpoint): Iterate over all symbol
spaces.
(update_breakpoints_after_exec): Ignore breakpoints for other
symbol spaces.
(remove_breakpoint): Rename to ...
(remove_breakpoint_1): ... this. Pass the breakpoints symbol
space to solib_name_from_address.
(remove_breakpoint): New.
(mark_breakpoints_out): Ignore breakpoints from other symbol
spaces.
(breakpoint_init_inferior): Ditto.
(breakpoint_here_p): Add an address space argument and adjust to
use breakpoint_address_match.
(moribund_breakpoint_here_p): Ditto.
(regular_breakpoint_inserted_here_p): Ditto.
(breakpoint_inserted_here_p): Ditto.
(software_breakpoint_inserted_here_p): Ditto.
(breakpoint_thread_match): Ditto.
(bpstat_check_location): Ditto.
(bpstat_stop_status): Ditto.
(print_breakpoint_location): If there's a location to print,
switch the current symbol space.
(print_one_breakpoint_location): Add `allflag' argument.
(print_one_breakpoint): Ditto. Adjust.
(do_captured_breakpoint_query): Adjust.
(breakpoint_1): Adjust.
(breakpoint_has_pc): Also match the symbol space.
(describe_other_breakpoints): Add a symbol space argument and
adjust.
(set_default_breakpoint): Add a symbol space argument. Set
default_breakpoint_sspace.
(breakpoint_address_match): New.
(check_duplicates_for): Add an address space argument, and adjust.
(set_raw_breakpoint): Record the symbol space in the location and
in the breakpoint.
(set_longjmp_breakpoint): Skip longjmp master breakpoints from
other symbol spaces.
(remove_thread_event_breakpoints, remove_solib_event_breakpoints)
(disable_breakpoints_in_shlibs): Skip breakpoints from other
symbol spaces.
(disable_breakpoints_in_unloaded_shlib): Match symbol spaces.
(create_catchpoint): Set the symbol space in the sal.
(disable_breakpoints_before_startup): Skip breakpoints from other
symbol spaces. Set executing_startup in the current symbol space.
(enable_breakpoints_after_startup): Clear executing_startup in the
current symbol space. Skip breakpoints from other symbol spaces.
(clone_momentary_breakpoint): Also copy the symbol space.
(add_location_to_breakpoint): Set the location's symbol space.
(bp_loc_is_permanent): Switch thread and symbol space.
(create_breakpoint): Adjust.
(expand_line_sal_maybe): Expand comment to mention symbol spaces.
Switch thread and symbol space when reading memory.
(parse_breakpoint_sals): Set the symbol space in the sal.
(break_command_really): Ditto.
(skip_prologue_sal): Switch and space.
(resolve_sal_pc): Ditto.
(watch_command_1): Record the symbol space in the sal.
(create_ada_exception_breakpoint): Adjust.
(clear_command): Adjust. Match symbol spaces.
(update_global_location_list): Use breakpoint_address_match.
(breakpoint_re_set_one): Switch thread and space.
(breakpoint_re_set): Save symbol space.
(breakpoint_re_set_thread): Also reset the symbol space.
(deprecated_insert_raw_breakpoint): Add an address space argument.
Adjust.
(insert_single_step_breakpoint): Ditto.
(single_step_breakpoint_inserted_here_p): Ditto.
(clear_syscall_counts): New.
(_initialize_breakpoint): Install it as inferior_exit observer.
* exec.h: Include "progspace.h".
(exec_bfd, exec_bfd_mtime): New defines.
(exec_close): Declare.
* exec.c: Include "gdbthread.h" and "progspace.h".
(exec_bfd, exec_bfd_mtime, current_target_sections_1): Delete.
(using_exec_ops): New.
(exec_close_1): Rename to exec_close, and make public.
(exec_close): Rename to exec_close_1, and adjust all callers. Add
description. Remove target sections and close executables from
all program spaces.
(exec_file_attach): Add comment.
(add_target_sections): Check on `using_exec_ops' to check if the
target should be pushed.
(remove_target_sections): Only unpush the target if there are no
more target sections in any symbol space.
* gdbcore.h: Include "exec.h".
(exec_bfd, exec_bfd_mtime): Remove declarations.
* frame.h (get_frame_program_space, get_frame_address_space)
(frame_unwind_program_space): Declare.
* frame.c (struct frame_info) <pspace, aspace>: New fields.
(create_sentinel_frame): Add program space argument. Set the
pspace and aspace fields of the frame object.
(get_current_frame, create_new_frame): Adjust.
(get_frame_program_space): New.
(frame_unwind_program_space): New.
(get_frame_address_space): New.
* stack.c (print_frame_info): Adjust.
(print_frame): Use the frame's program space.
* gdbthread.h (any_live_thread_of_process): Declare.
* thread.c (any_live_thread_of_process): New.
(switch_to_thread): Switch the program space as well.
(restore_selected_frame): Don't warn if trying to restore frame
level 0.
* inferior.h: Include "progspace.h".
(detach_fork): Declare.
(struct inferior) <removable, aspace, pspace>
<vfork_parent, vfork_child, pending_detach>
<waiting_for_vfork_done>: New fields.
<terminal_info>: Remove field.
<data, num_data>: New fields.
(register_inferior_data, register_inferior_data_with_cleanup)
(clear_inferior_data, set_inferior_data, inferior_data): Declare.
(exit_inferior, exit_inferior_silent, exit_inferior_num_silent)
(inferior_appeared): Declare.
(find_inferior_pid): Typo.
(find_inferior_id, find_inferior_for_program_space): Declare.
(set_current_inferior, save_current_inferior, prune_inferiors)
(number_of_inferiors): Declare.
(inferior_list): Declare.
* inferior.c: Include "gdbcore.h" and "symfile.h".
(inferior_list): Make public.
(delete_inferior_1): Always delete thread silently.
(find_inferior_id): Make public.
(current_inferior_): New.
(current_inferior): Use it.
(set_current_inferior): New.
(restore_inferior): New.
(save_current_inferior): New.
(free_inferior): Free the per-inferior data.
(add_inferior_silent): Allocate per-inferior data.
Call inferior_appeared.
(delete_threads_of_inferior): New.
(delete_inferior_1): Adjust interface to take an inferior pointer.
(delete_inferior): Adjust.
(delete_inferior_silent): Adjust.
(exit_inferior_1): New.
(exit_inferior): New.
(exit_inferior_silent): New.
(exit_inferior_num_silent): New.
(detach_inferior): Adjust.
(inferior_appeared): New.
(discard_all_inferiors): Adjust.
(find_inferior_id): Make public. Assert pid is not zero.
(find_inferior_for_program_space): New.
(have_inferiors): Check if we have any inferior with pid not zero.
(have_live_inferiors): Go over all pushed targets looking for
process_stratum.
(prune_inferiors): New.
(number_of_inferiors): New.
(print_inferior): Add executable column. Print vfork parent/child
relationships.
(inferior_command): Adjust to cope with not running inferiors.
(remove_inferior_command): New.
(add_inferior_command): New.
(clone_inferior_command): New.
(struct inferior_data): New.
(struct inferior_data_registration): New.
(struct inferior_data_registry): New.
(inferior_data_registry): New.
(register_inferior_data_with_cleanup): New.
(register_inferior_data): New.
(inferior_alloc_data): New.
(inferior_free_data): New.
(clear_inferior_data): New.
(set_inferior_data): New.
(inferior_data): New.
(initialize_inferiors): New.
(_initialize_inferiors): Register "add-inferior",
"remove-inferior" and "clone-inferior" commands.
* objfiles.h: Include "progspace.h".
(struct objfile) <pspace>: New field.
(symfile_objfile, object_files): Don't declare.
(ALL_PSPACE_OBJFILES): New.
(ALL_PSPACE_OBJFILES_SAFE): New.
(ALL_OBJFILES, ALL_OBJFILES_SAFE): Adjust.
(ALL_PSPACE_SYMTABS): New.
(ALL_PRIMARY_SYMTABS): Adjust.
(ALL_PSPACE_PRIMARY_SYMTABS): New.
(ALL_PSYMTABS): Adjust.
(ALL_PSPACE_PSYMTABS): New.
* objfiles.c (object_files, symfile_objfile): Delete.
(struct objfile_sspace_info): New.
(objfiles_pspace_data): New.
(objfiles_pspace_data_cleanup): New.
(get_objfile_pspace_data): New.
(objfiles_changed_p): Delete.
(allocate_objfile): Set the objfile's program space. Adjust to
reference objfiles_changed_p in pspace data.
(free_objfile): Adjust to reference objfiles_changed_p in pspace
data.
(objfile_relocate): Ditto.
(update_section_map): Add pspace argument. Adjust to iterate over
objfiles in the passed in pspace.
(find_pc_section): Delete sections and num_sections statics.
Adjust to refer to program space's objfiles_changed_p. Adjust to
refer to sections and num_sections store in the objfile's pspace
data.
(objfiles_changed): Adjust to reference objfiles_changed_p in
pspace data.
(_initialize_objfiles): New.
* linespec.c (decode_all_digits, decode_dollar): Set the sal's
program space.
* source.c (current_source_pspace): New.
(get_current_source_symtab_and_line): Set the sal's program space.
(set_current_source_symtab_and_line): Set current_source_pspace.
(select_source_symtab): Ditto. Use ALL_OBJFILES.
(forget_cached_source_info): Iterate over all program spaces.
* symfile.c (clear_symtab_users): Adjust.
* symmisc.c (print_symbol_bcache_statistics): Iterate over all
program spaces.
(print_objfile_statistics): Ditto.
(maintenance_print_msymbols): Ditto.
(maintenance_print_objfiles): Ditto.
(maintenance_info_symtabs): Ditto.
(maintenance_info_psymtabs): Ditto.
* symtab.h (SYMTAB_PSPACE): New.
(struct symtab_and_line) <pspace>: New field.
* symtab.c (init_sal): Clear the sal's program space.
(find_pc_sect_symtab): Set the sal's program space. Switch thread
and space.
(append_expanded_sal): Add program space argument. Iterate over
all program spaces.
(expand_line_sal): Iterate over all program spaces. Switch
program space.
* target.h (enum target_waitkind) <TARGET_WAITKIND_VFORK_DONE>: New.
(struct target_ops) <to_thread_address_space>: New field.
(target_thread_address_space): Define.
* target.c (target_detach): Only remove breakpoints from the
inferior we're detaching.
(target_thread_address_space): New.
* defs.h (initialize_progspace): Declare.
* top.c (gdb_init): Call it.
* solist.h (struct so_list) <sspace>: New field.
* solib.h (struct program_space): Forward declare.
(solib_name_from_address): Adjust prototype.
* solib.c (so_list_head): Replace with a macro referencing the
program space.
(update_solib_list): Set the so's program space.
(solib_name_from_address): Add a program space argument and adjust.
* solib-svr4.c (struct svr4_info) <pid>: Delete field.
<interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low>
<interp_plt_sect_high>: New fields.
(svr4_info_p, svr4_info): Delete.
(solib_svr4_sspace_data): New.
(get_svr4_info): Rewrite.
(svr4_sspace_data_cleanup): New.
(open_symbol_file_object): Adjust.
(svr4_default_sos): Adjust.
(svr4_fetch_objfile_link_map): Adjust.
(interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low)
(interp_plt_sect_high): Delete.
(svr4_in_dynsym_resolve_code): Adjust.
(enable_break): Adjust.
(svr4_clear_solib): Revert bit that removed the svr4_info here,
and reinstate clearing debug_base, debug_loader_offset_p,
debug_loader_offset and debug_loader_name.
(_initialize_svr4_solib): Register solib_svr4_pspace_data. Don't
install an inferior_exit observer anymore.
* printcmd.c (struct display) <pspace>: New field.
(display_command): Set the display's sspace.
(do_one_display): Match the display's sspace.
(display_uses_solib_p): Ditto.
* linux-fork.c (detach_fork): Moved to infrun.c.
(_initialize_linux_fork): Moved "detach-on-fork" command to
infrun.c.
* infrun.c (detach_fork): Moved from linux-fork.c.
(proceed_after_vfork_done): New.
(handle_vfork_child_exec_or_exit): New.
(follow_exec_mode_replace, follow_exec_mode_keep)
(follow_exec_mode_names, follow_exec_mode_string)
(show_follow_exec_mode_string): New.
(follow_exec): New. Reinstate the mark_breakpoints_out call.
Remove shared libraries before attaching new executable. If user
wants to keep the inferior, keep it.
(displaced_step_fixup): Adjust to pass an address space to the
breakpoints module.
(resume): Ditto.
(clear_proceed_status): In all-stop mode, always clear the proceed
status of all threads.
(prepare_to_proceed): Adjust to pass an address space to the
breakpoints module.
(proceed): Ditto.
(adjust_pc_after_break): Ditto.
(handle_inferior_event): When handling a process exit, switch the
program space to the inferior's that had exited. Call
handle_vfork_child_exec_or_exit. Adjust to pass an address space
to the breakpoints module. In non-stop mode, when following a
fork and detach-fork is off, also resume the other branch. Handle
TARGET_WAITKIND_VFORK_DONE. Set the program space in sals.
(normal_stop): Prune inferiors.
(_initialize_infrun): Install the new "follow-exec-mode" command.
"detach-on-fork" moved here.
* regcache.h (get_regcache_aspace): Declare.
* regcache.c (struct regcache) <aspace>: New field.
(regcache_xmalloc): Clear the aspace.
(get_regcache_aspace): New.
(regcache_cpy): Copy the aspace field.
(regcache_cpy_no_passthrough): Ditto.
(get_thread_regcache): Fetch the thread's address space from the
target, and store it in the regcache.
* infcall.c (call_function_by_hand): Set the sal's pspace.
* arch-utils.c (default_has_shared_address_space): New.
* arch-utils.h (default_has_shared_address_space): Declare.
* gdbarch.sh (has_shared_address_space): New.
* gdbarch.h, gdbarch.c: Regenerate.
* linux-tdep.c: Include auxv.h, target.h, elf/common.h.
(linux_has_shared_address_space): New.
(_initialize_linux_tdep): Declare.
* arm-tdep.c (arm_software_single_step): Pass the frame's address
space to insert_single_step_breakpoint.
* arm-linux-tdep.c (arm_linux_software_single_step): Pass the
frame's pspace to breakpoint functions.
* cris-tdep.c (crisv32_single_step_through_delay): Ditto.
(cris_software_single_step): Ditto.
* mips-tdep.c (deal_with_atomic_sequence): Add frame argument.
Pass the frame's pspace to breakpoint functions.
(mips_software_single_step): Adjust.
(mips_single_step_through_delay): Adjust.
* rs6000-aix-tdep.c (rs6000_software_single_step): Adjust.
* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust.
* solib-irix.c (enable_break): Adjust to pass the current frame's
address space to breakpoint functions.
* sparc-tdep.c (sparc_software_single_step): Ditto.
* spu-tdep.c (spu_software_single_step): Ditto.
* alpha-tdep.c (alpha_software_single_step): Ditto.
* record.c (record_wait): Adjust to pass an address space to the
breakpoints module.
* fork-child.c (fork_inferior): Set the new inferior's program and
address spaces.
* inf-ptrace.c (inf_ptrace_follow_fork): Copy the parent's program
and address spaces.
(inf_ptrace_attach): Set the inferior's program and address spaces.
* linux-nat.c: Include "solib.h".
(linux_child_follow_fork): Manage parent and child's program and
address spaces. Clone the parent's program space if necessary.
Don't wait for the vfork to be done here. Refuse to resume if
following the vfork parent while leaving the child stopped.
(resume_callback): Don't resume a vfork parent.
(linux_nat_resume): Also check for pending events in the
lp->waitstatus field.
(linux_handle_extended_wait): Report TARGET_WAITKIND_VFORK_DONE
events to the core.
(stop_wait_callback): Don't wait for SIGSTOP on vfork parents.
(cancel_breakpoint): Adjust.
* linux-thread-db.c (thread_db_wait): Don't remove thread event
breakpoints here.
(thread_db_mourn_inferior): Don't mark breakpoints out here.
Remove thread event breakpoints after mourning.
* corelow.c: Include progspace.h.
(core_open): Set the inferior's program and address spaces.
* remote.c (remote_add_inferior): Set the new inferior's program
and address spaces.
(remote_start_remote): Update address spaces.
(extended_remote_create_inferior_1): Don't init the thread list if
we already debugging other inferiors.
* darwin-nat.c (darwin_attach): Set the new inferior's program and
address spaces.
* gnu-nat.c (gnu_attach): Ditto.
* go32-nat.c (go32_create_inferior): Ditto.
* inf-ttrace.c (inf_ttrace_follow_fork, inf_ttrace_attach): Ditto.
* monitor.c (monitor_open): Ditto.
* nto-procfs.c (procfs_attach, procfs_create_inferior): Ditto.
* procfs.c (do_attach): Ditto.
* windows-nat.c (do_initial_windows_stuff): Ditto.
* inflow.c (inferior_process_group)
(terminal_init_inferior_with_pgrp, terminal_inferior,
(terminal_ours_1, inflow_inferior_exit, copy_terminal_info)
(child_terminal_info, new_tty_postfork, set_sigint_trap): Adjust
to use per-inferior data instead of inferior->terminal_info.
(inflow_inferior_data): New.
(inflow_new_inferior): Delete.
(inflow_inferior_data_cleanup): New.
(get_inflow_inferior_data): New.
* mi/mi-interp.c (mi_new_inferior): Rename to...
(mi_inferior_appeared): ... this.
(mi_interpreter_init): Adjust.
* tui/tui-disasm.c: Include "progspace.h".
(tui_set_disassem_content): Pass an address space to
breakpoint_here_p.
* NEWS: Mention multi-program debugging support. Mention new
commands "add-inferior", "clone-inferior", "remove-inferior",
"maint info program-spaces", and new option "set
follow-exec-mode".
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/doc/
* observer.texi (new_inferior): Rename to...
(inferior_appeared): ... this.
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/testsuite/
* gdb.base/foll-vfork.exp: Adjust to spell out "follow-fork".
* gdb.base/foll-exec.exp: Adjust to expect a process id before
"Executing new program".
* gdb.base/foll-fork.exp: Adjust to spell out "follow-fork".
* gdb.base/multi-forks.exp: Ditto. Adjust to the inferior being
left listed after having been killed.
* gdb.base/attach.exp: Adjust to spell out "symbol-file".
* gdb.base/maint.exp: Adjust test.
* Makefile.in (ALL_SUBDIRS): Add gdb.multi.
* gdb.multi/Makefile.in: New.
* gdb.multi/base.exp: New.
* gdb.multi/goodbye.c: New.
* gdb.multi/hangout.c: New.
* gdb.multi/hello.c: New.
* gdb.multi/bkpt-multi-exec.c: New.
* gdb.multi/bkpt-multi-exec.exp: New.
* gdb.multi/crashme.c: New.
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/doc/
* gdb.texinfo (Inferiors): Rename node to ...
(Inferiors and Programs): ... this. Mention running multiple
programs in the same debug session.
<info inferiors>: Mention the new 'Executable' column if "info
inferiors". Update examples. Document the "add-inferior",
"clone-inferior", "remove-inferior" and "maint info
program-spaces" commands.
(Process): Rename node to...
(Forks): ... this. Document "set|show follow-exec-mode".
2009-10-19 11:51:43 +02:00
|
|
|
/* Skip verify of has_shared_address_space, invalid_p == 0 */
|
2010-01-06 05:20:27 +01:00
|
|
|
/* Skip verify of fast_tracepoint_valid_at, invalid_p == 0 */
|
2016-02-18 09:21:38 +01:00
|
|
|
/* Skip verify of guess_tracepoint_registers, invalid_p == 0 */
|
2010-03-05 21:18:19 +01:00
|
|
|
/* Skip verify of auto_charset, invalid_p == 0 */
|
|
|
|
/* Skip verify of auto_wide_charset, invalid_p == 0 */
|
2010-04-24 15:12:56 +02:00
|
|
|
/* Skip verify of has_dos_based_file_system, invalid_p == 0 */
|
2011-09-27 15:09:37 +02:00
|
|
|
/* Skip verify of gen_return_address, invalid_p == 0 */
|
2012-01-20 10:49:58 +01:00
|
|
|
/* Skip verify of info_proc, has predicate. */
|
2012-12-14 16:30:38 +01:00
|
|
|
/* Skip verify of core_info_proc, has predicate. */
|
2012-06-05 15:50:50 +02:00
|
|
|
/* Skip verify of iterate_over_objfiles_in_search_order, invalid_p == 0 */
|
2012-12-15 15:27:56 +01:00
|
|
|
/* Skip verify of ravenscar_ops, invalid_p == 0 */
|
gdbarch: add instruction predicate methods
Add new methods to gdbarch for analyzing the instruction at a given address.
Implement those methods for i386 and amd64 architectures.
This is needed by "record btrace" to detect function calls in the
execution trace.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* amd64-tdep.c (amd64_classify_insn_at, amd64_insn_is_call)
(amd64_insn_is_ret, amd64_insn_is_jump, amd64_jmp_p): New.
(amd64_init_abi): Add insn_is_call, insn_is_ret, and insn_is_jump
to gdbarch.
* i386-tdep.c (i386_insn_is_call, i386_insn_is_ret)
(i386_insn_is_jump, i386_jmp_p): New.
(i386_gdbarch_init): Add insn_is_call, insn_is_ret, and
insn_is_jump to gdbarch.
* gdbarch.sh (insn_is_call, insn_is_ret, insn_is_jump): New.
* gdbarch.h: Regenerated.
* gdbarch.c: Regenerated.
* arch-utils.h (default_insn_is_call, default_insn_is_ret)
(default_insn_is_jump): New.
* arch-utils.c (default_insn_is_call, default_insn_is_ret)
(default_insn_is_jump): New.
2013-03-22 15:56:56 +01:00
|
|
|
/* Skip verify of insn_is_call, invalid_p == 0 */
|
|
|
|
/* Skip verify of insn_is_ret, invalid_p == 0 */
|
|
|
|
/* Skip verify of insn_is_jump, invalid_p == 0 */
|
2014-02-27 13:40:15 +01:00
|
|
|
/* Skip verify of auxv_parse, has predicate. */
|
2016-06-12 00:51:38 +02:00
|
|
|
/* Skip verify of print_auxv_entry, invalid_p == 0 */
|
2014-10-10 16:57:13 +02:00
|
|
|
/* Skip verify of vsyscall_range, invalid_p == 0 */
|
2014-05-14 22:08:57 +02:00
|
|
|
/* Skip verify of infcall_mmap, invalid_p == 0 */
|
2015-06-03 21:22:56 +02:00
|
|
|
/* Skip verify of infcall_munmap, invalid_p == 0 */
|
2014-05-14 22:08:57 +02:00
|
|
|
/* Skip verify of gcc_target_options, invalid_p == 0 */
|
add gnu_triplet_regexp gdbarch method
gdb has to inform libcc1.so of the target being used, so that the
correct compiler can be invoked. The compiler is invoked using the
GNU configury triplet prefix, e.g., "x86_64-unknown-linux-gnu-gcc".
In order for this to work we need to map the gdbarch to the GNU
configury triplet arch. In most cases these are identical; however,
the x86 family poses some problems, as the BFD arch names are quite
different from the GNU triplet names. So, we introduce a new gdbarch
method for this. A regular expression is used because there are
various valid values for the arch prefix in the triplet.
This patch also updates the osabi code to associate a regular
expression with the OS ABI. I have only added a concrete value for
Linux. Note that the "-gnu" part is optional, at least on Fedora it
is omitted from the installed GCC executable's name.
gdb/ChangeLog
2014-12-12 Tom Tromey <tromey@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* osabi.h (osabi_triplet_regexp): Declare.
* osabi.c (struct osabi_names): New.
(gdb_osabi_names): Change type to struct osabi_names. Update
values.
(gdbarch_osabi_name): Update.
(osabi_triplet_regexp): New function.
(osabi_from_tdesc_string, _initialize_gdb_osabi): Update.
* i386-tdep.c (i386_gnu_triplet_regexp): New method.
(i386_elf_init_abi, i386_go32_init_abi, i386_gdbarch_init): Call
set_gdbarch_gnu_triplet_regexp.
* gdbarch.sh (gnu_triplet_regexp): New method.
* gdbarch.c, gdbarch.h: Rebuild.
* arch-utils.h (default_gnu_triplet_regexp): Declare.
* arch-utils.c (default_gnu_triplet_regexp): New function.
2014-06-13 17:28:24 +02:00
|
|
|
/* Skip verify of gnu_triplet_regexp, invalid_p == 0 */
|
2015-06-12 22:51:51 +02:00
|
|
|
/* Skip verify of addressable_memory_unit_size, invalid_p == 0 */
|
2017-02-28 19:32:07 +01:00
|
|
|
/* Skip verify of disassembler_options, invalid_p == 0 */
|
|
|
|
/* Skip verify of valid_disassembler_options, invalid_p == 0 */
|
Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy
This patch starts from the desire to eliminate
make_cleanup_ui_file_delete, but then goes beyond. It makes ui_file &
friends a real C++ class hierarchy, and switches temporary
ui_file-like objects to stack-based allocation.
- mem_fileopen -> string_file
mem_fileopen is replaced with a new string_file class that is treated
as a value class created on the stack. This alone eliminates most
make_cleanup_ui_file_delete calls, and, simplifies code a whole lot
(diffstat shows around 1k loc dropped.)
string_file's internal buffer is a std::string, thus the "string" in
the name. This simplifies the implementation much, compared to
mem_fileopen, which managed growing its internal buffer manually.
- ui_file_as_string, ui_file_strdup, ui_file_obsavestring all gone
The new string_file class has a string() method that provides direct
writable access to the internal std::string buffer. This replaced
ui_file_as_string, which forced a copy of the same data the stream had
inside. With direct access via a writable reference, we can instead
move the string out of the string_stream, avoiding deep string
copying.
Related, ui_file_xstrdup calls are replaced with xstrdup'ping the
stream's string, and ui_file_obsavestring is replaced by
obstack_copy0.
With all those out of the way, getting rid of the weird ui_file_put
mechanism was possible.
- New ui_file::printf, ui_file::puts, etc. methods
These simplify / clarify client code. I considered splitting
client-code changes, like these, e.g.:
- stb = mem_fileopen ();
- fprintf_unfiltered (stb, "%s%s%s",
- _("The valid values are:\n"),
- regdesc,
- _("The default is \"std\"."));
+ string_file stb;
+ stb.printf ("%s%s%s",
+ _("The valid values are:\n"),
+ regdesc,
+ _("The default is \"std\"."));
In two steps, with the first step leaving fprintf_unfiltered (etc.)
calls in place, and only afterwards do a pass to change all those to
call stb.printf etc.. I didn't do that split, because (when I tried),
it turned out to be pointless make-work: the first pass would have to
touch the fprintf_unfiltered line anyway, to replace "stb" with
"&stb".
- gdb_fopen replaced with stack-based objects
This avoids the need for cleanups or unique_ptr's. I.e., this:
struct ui_file *file = gdb_fopen (filename, "w");
if (filename == NULL)
perror_with_name (filename);
cleanups = make_cleanup_ui_file_delete (file);
// use file.
do_cleanups (cleanups);
is replaced with this:
stdio_file file;
if (!file.open (filename, "w"))
perror_with_name (filename);
// use file.
- odd contorsions in null_file_write / null_file_fputs around when to
call to_fputs / to_write eliminated.
- Global null_stream object
A few places that were allocating a ui_file in order to print to
"nowhere" are adjusted to instead refer to a new 'null_stream' global
stream.
- TUI's tui_sfileopen eliminated. TUI's ui_file much simplified
The TUI's ui_file was serving a dual purpose. It supported being used
as string buffer, and supported being backed by a stdio FILE. The
string buffer part is gone, replaced by using of string_file. The
'FILE *' support is now much simplified, by making the TUI's ui_file
inherit from stdio_file.
gdb/ChangeLog:
2017-02-02 Pedro Alves <palves@redhat.com>
* ada-lang.c (type_as_string): Use string_file.
* ada-valprint.c (ada_print_floating): Use string_file.
* ada-varobj.c (ada_varobj_scalar_image)
(ada_varobj_get_value_image): Use string_file.
* aix-thread.c (aix_thread_extra_thread_info): Use string_file.
* arm-tdep.c (_initialize_arm_tdep): Use string_printf.
* breakpoint.c (update_inserted_breakpoint_locations)
(insert_breakpoint_locations, reattach_breakpoints)
(print_breakpoint_location, print_one_detail_ranged_breakpoint)
(print_it_watchpoint): Use string_file.
(save_breakpoints): Use stdio_file.
* c-exp.y (oper): Use string_file.
* cli/cli-logging.c (set_logging_redirect): Use ui_file_up and
tee_file.
(pop_output_files): Use delete.
(handle_redirections): Use stdio_file and tee_file.
* cli/cli-setshow.c (do_show_command): Use string_file.
* compile/compile-c-support.c (c_compute_program): Use
string_file.
* compile/compile-c-symbols.c (generate_vla_size): Take a
'string_file &' instead of a 'ui_file *'.
(generate_c_for_for_one_variable): Take a 'string_file &' instead
of a 'ui_file *'. Use string_file.
(generate_c_for_variable_locations): Take a 'string_file &'
instead of a 'ui_file *'.
* compile/compile-internal.h (generate_c_for_for_one_variable):
Take a 'string_file &' instead of a 'ui_file *'.
* compile/compile-loc2c.c (push, pushf, unary, binary)
(print_label, pushf_register_address, pushf_register)
(do_compile_dwarf_expr_to_c): Take a 'string_file &' instead of a
'ui_file *'. Adjust.
* compile/compile.c (compile_to_object): Use string_file.
* compile/compile.h (compile_dwarf_expr_to_c)
(compile_dwarf_bounds_to_c): Take a 'string_file &' instead of a
'ui_file *'.
* cp-support.c (inspect_type): Use string_file and obstack_copy0.
(replace_typedefs_qualified_name): Use string_file and
obstack_copy0.
* disasm.c (gdb_pretty_print_insn): Use string_file.
(gdb_disassembly): Adjust reference the null_stream global.
(do_ui_file_delete): Delete.
(gdb_insn_length): Use null_stream.
* dummy-frame.c (maintenance_print_dummy_frames): Use stdio_file.
* dwarf2loc.c (dwarf2_compile_property_to_c)
(locexpr_generate_c_location, loclist_generate_c_location): Take a
'string_file &' instead of a 'ui_file *'.
* dwarf2loc.h (dwarf2_compile_property_to_c): Likewise.
* dwarf2read.c (do_ui_file_peek_last): Delete.
(dwarf2_compute_name): Use string_file.
* event-top.c (gdb_setup_readline): Use stdio_file.
* gdbarch.sh (verify_gdbarch): Use string_file.
* gdbtypes.c (safe_parse_type): Use null_stream.
* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use
string_file.
* guile/scm-disasm.c (gdbscm_print_insn_from_port): Take a
'string_file *' instead of a 'ui_file *'.
(gdbscm_arch_disassemble): Use string_file.
* guile/scm-frame.c (frscm_print_frame_smob): Use string_file.
* guile/scm-ports.c (class ioscm_file_port): Now a class that
inherits from ui_file.
(ioscm_file_port_delete, ioscm_file_port_rewind)
(ioscm_file_port_put): Delete.
(ioscm_file_port_write): Rename to ...
(ioscm_file_port::write): ... this. Remove file_port_magic
checks.
(ioscm_file_port_new): Delete.
(ioscm_with_output_to_port_worker): Use ioscm_file_port and
ui_file_up.
* guile/scm-type.c (tyscm_type_name): Use string_file.
* guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print):
Use string_file.
* infcmd.c (print_return_value_1): Use string_file.
* infrun.c (print_target_wait_results): Use string_file.
* language.c (add_language): Use string_file.
* location.c (explicit_to_string_internal): Use string_file.
* main.c (captured_main_1): Use null_file.
* maint.c (maintenance_print_architecture): Use stdio_file.
* mi/mi-cmd-stack.c (list_arg_or_local): Use string_file.
* mi/mi-common.h (struct mi_interp) <out, err, log, targ,
event_channel>: Change type to mi_console_file pointer.
* mi/mi-console.c (mi_console_file_fputs, mi_console_file_flush)
(mi_console_file_delete): Delete.
(struct mi_console_file): Delete.
(mi_console_file_magic): Delete.
(mi_console_file_new): Delete.
(mi_console_file::mi_console_file): New.
(mi_console_file_delete): Delete.
(mi_console_file_fputs): Delete.
(mi_console_file::write): New.
(mi_console_raw_packet): Delete.
(mi_console_file::flush): New.
(mi_console_file_flush): Delete.
(mi_console_set_raw): Rename to ...
(mi_console_file::set_raw): ... this.
* mi/mi-console.h (class mi_console_file): New class.
(mi_console_file_new, mi_console_set_raw): Delete.
* mi/mi-interp.c (mi_interpreter_init): Use mi_console_file.
(mi_set_logging): Use delete and tee_file. Adjust.
* mi/mi-main.c (output_register): Use string_file.
(mi_cmd_data_evaluate_expression): Use string_file.
(mi_cmd_data_read_memory): Use string_file.
(mi_cmd_execute, print_variable_or_computed): Use string_file.
* mi/mi-out.c (mi_ui_out::main_stream): New.
(mi_ui_out::rewind): Use main_stream and
string_file.
(mi_ui_out::put): Use main_stream and string_file.
(mi_ui_out::mi_ui_out): Remove 'stream' parameter.
Allocate a 'string_file' instead.
(mi_out_new): Don't allocate a mem_fileopen stream here.
* mi/mi-out.h (mi_ui_out::mi_ui_out): Remove 'stream' parameter.
(mi_ui_out::main_stream): Declare method.
* printcmd.c (eval_command): Use string_file.
* psymtab.c (maintenance_print_psymbols): Use stdio_file.
* python/py-arch.c (archpy_disassemble): Use string_file.
* python/py-breakpoint.c (bppy_get_commands): Use string_file.
* python/py-frame.c (frapy_str): Use string_file.
* python/py-framefilter.c (py_print_type, py_print_single_arg):
Use string_file.
* python/py-type.c (typy_str): Use string_file.
* python/py-unwind.c (unwind_infopy_str): Use string_file.
* python/py-value.c (valpy_str): Use string_file.
* record-btrace.c (btrace_insn_history): Use string_file.
* regcache.c (regcache_print): Use stdio_file.
* reggroups.c (maintenance_print_reggroups): Use stdio_file.
* remote.c (escape_buffer): Use string_file.
* rust-lang.c (rust_get_disr_info): Use string_file.
* serial.c (serial_open_ops_1): Use stdio_file.
(do_serial_close): Use delete.
* stack.c (print_frame_arg): Use string_file.
(print_frame_args): Remove local mem_fileopen stream, not used.
(print_frame): Use string_file.
* symmisc.c (maintenance_print_symbols): Use stdio_file.
* symtab.h (struct symbol_computed_ops) <generate_c_location>:
Take a 'string_file *' instead of a 'ui_file *'.
* top.c (new_ui): Use stdio_file and stderr_file.
(free_ui): Use delete.
(execute_command_to_string): Use string_file.
(quit_confirm): Use string_file.
* tracepoint.c (collection_list::append_exp): Use string_file.
* tui/tui-disasm.c (tui_disassemble): Use string_file.
* tui/tui-file.c: Don't include "ui-file.h".
(enum streamtype, struct tui_stream): Delete.
(tui_file_new, tui_file_delete, tui_fileopen, tui_sfileopen)
(tui_file_isatty, tui_file_rewind, tui_file_put): Delete.
(tui_file::tui_file): New method.
(tui_file_fputs): Delete.
(tui_file_get_strbuf): Delete.
(tui_file::puts): New method.
(tui_file_adjust_strbuf): Delete.
(tui_file_flush): Delete.
(tui_file::flush): New method.
* tui/tui-file.h: Tweak intro comment.
Include ui-file.h.
(tui_fileopen, tui_sfileopen, tui_file_get_strbuf)
(tui_file_adjust_strbuf): Delete declarations.
(class tui_file): New class.
* tui/tui-io.c (tui_initialize_io): Use tui_file.
* tui/tui-regs.c (tui_restore_gdbout): Use delete.
(tui_register_format): Use string_stream.
* tui/tui-stack.c (tui_make_status_line): Use string_file.
(tui_get_function_from_frame): Use string_file.
* typeprint.c (type_to_string): Use string_file.
* ui-file.c (struct ui_file, ui_file_magic, ui_file_new): Delete.
(null_stream): New global.
(ui_file_delete): Delete.
(ui_file::ui_file): New.
(null_file_isatty): Delete.
(ui_file::~ui_file): New.
(null_file_rewind): Delete.
(ui_file::printf): New.
(null_file_put): Delete.
(null_file_flush): Delete.
(ui_file::putstr): New.
(null_file_write): Delete.
(ui_file::putstrn): New.
(null_file_read): Delete.
(ui_file::putc): New.
(null_file_fputs): Delete.
(null_file_write_async_safe): Delete.
(ui_file::vprintf): New.
(null_file_delete): Delete.
(null_file::write): New.
(null_file_fseek): Delete.
(null_file::puts): New.
(ui_file_data): Delete.
(null_file::write_async_safe): New.
(gdb_flush, ui_file_isatty): Adjust.
(ui_file_put, ui_file_rewind): Delete.
(ui_file_write): Adjust.
(ui_file_write_for_put): Delete.
(ui_file_write_async_safe, ui_file_read): Adjust.
(ui_file_fseek): Delete.
(fputs_unfiltered): Adjust.
(set_ui_file_flush, set_ui_file_isatty, set_ui_file_rewind)
(set_ui_file_put, set_ui_file_write, set_ui_file_write_async_safe)
(set_ui_file_read, set_ui_file_fputs, set_ui_file_fseek)
(set_ui_file_data): Delete.
(string_file::~string_file, string_file::write)
(struct accumulated_ui_file, do_ui_file_xstrdup, ui_file_xstrdup)
(do_ui_file_as_string, ui_file_as_string): Delete.
(do_ui_file_obsavestring, ui_file_obsavestring): Delete.
(struct mem_file): Delete.
(mem_file_new): Delete.
(stdio_file::stdio_file): New.
(mem_file_delete): Delete.
(stdio_file::stdio_file): New.
(mem_fileopen): Delete.
(stdio_file::~stdio_file): New.
(mem_file_rewind): Delete.
(stdio_file::set_stream): New.
(mem_file_put): Delete.
(stdio_file::open): New.
(mem_file_write): Delete.
(stdio_file_magic, struct stdio_file): Delete.
(stdio_file_new, stdio_file_delete, stdio_file_flush): Delete.
(stdio_file::flush): New.
(stdio_file_read): Rename to ...
(stdio_file::read): ... this. Adjust.
(stdio_file_write): Rename to ...
(stdio_file::write): ... this. Adjust.
(stdio_file_write_async_safe): Rename to ...
(stdio_file::write_async_safe) ... this. Adjust.
(stdio_file_fputs): Rename to ...
(stdio_file::puts) ... this. Adjust.
(stdio_file_isatty): Delete.
(stdio_file_fseek): Delete.
(stdio_file::isatty): New.
(stderr_file_write): Rename to ...
(stderr_file::write) ... this. Adjust.
(stderr_file_fputs): Rename to ...
(stderr_file::puts) ... this. Adjust.
(stderr_fileopen, stdio_fileopen, gdb_fopen): Delete.
(stderr_file::stderr_file): New.
(tee_file_magic): Delete.
(struct tee_file): Delete.
(tee_file::tee_file): New.
(tee_file_new): Delete.
(tee_file::~tee_file): New.
(tee_file_delete): Delete.
(tee_file_flush): Rename to ...
(tee_file::flush): ... this. Adjust.
(tee_file_write): Rename to ...
(tee_file::write): ... this. Adjust.
(tee_file::write_async_safe): New.
(tee_file_fputs): Rename to ...
(tee_file::puts): ... this. Adjust.
(tee_file_isatty): Rename to ...
(tee_file::isatty): ... this. Adjust.
* ui-file.h (struct obstack, struct ui_file): Don't
forward-declare.
(ui_file_new, ui_file_flush_ftype, set_ui_file_flush)
(ui_file_write_ftype)
(set_ui_file_write, ui_file_fputs_ftype, set_ui_file_fputs)
(ui_file_write_async_safe_ftype, set_ui_file_write_async_safe)
(ui_file_read_ftype, set_ui_file_read, ui_file_isatty_ftype)
(set_ui_file_isatty, ui_file_rewind_ftype, set_ui_file_rewind)
(ui_file_put_method_ftype, ui_file_put_ftype, set_ui_file_put)
(ui_file_delete_ftype, set_ui_file_data, ui_file_fseek_ftype)
(set_ui_file_fseek): Delete.
(ui_file_data, ui_file_delete, ui_file_rewind)
(struct ui_file): New.
(ui_file_up): New.
(class null_file): New.
(null_stream): Declare.
(ui_file_write_for_put, ui_file_put): Delete.
(ui_file_xstrdup, ui_file_as_string, ui_file_obsavestring):
Delete.
(ui_file_fseek, mem_fileopen, stdio_fileopen, stderr_fileopen)
(gdb_fopen, tee_file_new): Delete.
(struct string_file): New.
(struct stdio_file): New.
(stdio_file_up): New.
(struct stderr_file): New.
(class tee_file): New.
* ui-out.c (ui_out::field_stream): Take a 'string_file &' instead
of a 'ui_file *'. Adjust.
* ui-out.h (class ui_out) <field_stream>: Likewise.
* utils.c (do_ui_file_delete, make_cleanup_ui_file_delete)
(null_stream): Delete.
(error_stream): Take a 'string_file &' instead of a 'ui_file *'.
Adjust.
* utils.h (struct ui_file): Delete forward declaration..
(make_cleanup_ui_file_delete, null_stream): Delete declarations.
(error_stream): Take a 'string_file &' instead of a
'ui_file *'.
* varobj.c (varobj_value_get_print_value): Use string_file.
* xtensa-tdep.c (xtensa_verify_config): Use string_file.
* gdbarch.c: Regenerate.
2017-02-02 12:11:47 +01:00
|
|
|
if (!log.empty ())
|
2001-11-05 22:34:33 +01:00
|
|
|
internal_error (__FILE__, __LINE__,
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-11 19:13:55 +01:00
|
|
|
_("verify_gdbarch: the following are invalid ...%s"),
|
Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy
This patch starts from the desire to eliminate
make_cleanup_ui_file_delete, but then goes beyond. It makes ui_file &
friends a real C++ class hierarchy, and switches temporary
ui_file-like objects to stack-based allocation.
- mem_fileopen -> string_file
mem_fileopen is replaced with a new string_file class that is treated
as a value class created on the stack. This alone eliminates most
make_cleanup_ui_file_delete calls, and, simplifies code a whole lot
(diffstat shows around 1k loc dropped.)
string_file's internal buffer is a std::string, thus the "string" in
the name. This simplifies the implementation much, compared to
mem_fileopen, which managed growing its internal buffer manually.
- ui_file_as_string, ui_file_strdup, ui_file_obsavestring all gone
The new string_file class has a string() method that provides direct
writable access to the internal std::string buffer. This replaced
ui_file_as_string, which forced a copy of the same data the stream had
inside. With direct access via a writable reference, we can instead
move the string out of the string_stream, avoiding deep string
copying.
Related, ui_file_xstrdup calls are replaced with xstrdup'ping the
stream's string, and ui_file_obsavestring is replaced by
obstack_copy0.
With all those out of the way, getting rid of the weird ui_file_put
mechanism was possible.
- New ui_file::printf, ui_file::puts, etc. methods
These simplify / clarify client code. I considered splitting
client-code changes, like these, e.g.:
- stb = mem_fileopen ();
- fprintf_unfiltered (stb, "%s%s%s",
- _("The valid values are:\n"),
- regdesc,
- _("The default is \"std\"."));
+ string_file stb;
+ stb.printf ("%s%s%s",
+ _("The valid values are:\n"),
+ regdesc,
+ _("The default is \"std\"."));
In two steps, with the first step leaving fprintf_unfiltered (etc.)
calls in place, and only afterwards do a pass to change all those to
call stb.printf etc.. I didn't do that split, because (when I tried),
it turned out to be pointless make-work: the first pass would have to
touch the fprintf_unfiltered line anyway, to replace "stb" with
"&stb".
- gdb_fopen replaced with stack-based objects
This avoids the need for cleanups or unique_ptr's. I.e., this:
struct ui_file *file = gdb_fopen (filename, "w");
if (filename == NULL)
perror_with_name (filename);
cleanups = make_cleanup_ui_file_delete (file);
// use file.
do_cleanups (cleanups);
is replaced with this:
stdio_file file;
if (!file.open (filename, "w"))
perror_with_name (filename);
// use file.
- odd contorsions in null_file_write / null_file_fputs around when to
call to_fputs / to_write eliminated.
- Global null_stream object
A few places that were allocating a ui_file in order to print to
"nowhere" are adjusted to instead refer to a new 'null_stream' global
stream.
- TUI's tui_sfileopen eliminated. TUI's ui_file much simplified
The TUI's ui_file was serving a dual purpose. It supported being used
as string buffer, and supported being backed by a stdio FILE. The
string buffer part is gone, replaced by using of string_file. The
'FILE *' support is now much simplified, by making the TUI's ui_file
inherit from stdio_file.
gdb/ChangeLog:
2017-02-02 Pedro Alves <palves@redhat.com>
* ada-lang.c (type_as_string): Use string_file.
* ada-valprint.c (ada_print_floating): Use string_file.
* ada-varobj.c (ada_varobj_scalar_image)
(ada_varobj_get_value_image): Use string_file.
* aix-thread.c (aix_thread_extra_thread_info): Use string_file.
* arm-tdep.c (_initialize_arm_tdep): Use string_printf.
* breakpoint.c (update_inserted_breakpoint_locations)
(insert_breakpoint_locations, reattach_breakpoints)
(print_breakpoint_location, print_one_detail_ranged_breakpoint)
(print_it_watchpoint): Use string_file.
(save_breakpoints): Use stdio_file.
* c-exp.y (oper): Use string_file.
* cli/cli-logging.c (set_logging_redirect): Use ui_file_up and
tee_file.
(pop_output_files): Use delete.
(handle_redirections): Use stdio_file and tee_file.
* cli/cli-setshow.c (do_show_command): Use string_file.
* compile/compile-c-support.c (c_compute_program): Use
string_file.
* compile/compile-c-symbols.c (generate_vla_size): Take a
'string_file &' instead of a 'ui_file *'.
(generate_c_for_for_one_variable): Take a 'string_file &' instead
of a 'ui_file *'. Use string_file.
(generate_c_for_variable_locations): Take a 'string_file &'
instead of a 'ui_file *'.
* compile/compile-internal.h (generate_c_for_for_one_variable):
Take a 'string_file &' instead of a 'ui_file *'.
* compile/compile-loc2c.c (push, pushf, unary, binary)
(print_label, pushf_register_address, pushf_register)
(do_compile_dwarf_expr_to_c): Take a 'string_file &' instead of a
'ui_file *'. Adjust.
* compile/compile.c (compile_to_object): Use string_file.
* compile/compile.h (compile_dwarf_expr_to_c)
(compile_dwarf_bounds_to_c): Take a 'string_file &' instead of a
'ui_file *'.
* cp-support.c (inspect_type): Use string_file and obstack_copy0.
(replace_typedefs_qualified_name): Use string_file and
obstack_copy0.
* disasm.c (gdb_pretty_print_insn): Use string_file.
(gdb_disassembly): Adjust reference the null_stream global.
(do_ui_file_delete): Delete.
(gdb_insn_length): Use null_stream.
* dummy-frame.c (maintenance_print_dummy_frames): Use stdio_file.
* dwarf2loc.c (dwarf2_compile_property_to_c)
(locexpr_generate_c_location, loclist_generate_c_location): Take a
'string_file &' instead of a 'ui_file *'.
* dwarf2loc.h (dwarf2_compile_property_to_c): Likewise.
* dwarf2read.c (do_ui_file_peek_last): Delete.
(dwarf2_compute_name): Use string_file.
* event-top.c (gdb_setup_readline): Use stdio_file.
* gdbarch.sh (verify_gdbarch): Use string_file.
* gdbtypes.c (safe_parse_type): Use null_stream.
* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use
string_file.
* guile/scm-disasm.c (gdbscm_print_insn_from_port): Take a
'string_file *' instead of a 'ui_file *'.
(gdbscm_arch_disassemble): Use string_file.
* guile/scm-frame.c (frscm_print_frame_smob): Use string_file.
* guile/scm-ports.c (class ioscm_file_port): Now a class that
inherits from ui_file.
(ioscm_file_port_delete, ioscm_file_port_rewind)
(ioscm_file_port_put): Delete.
(ioscm_file_port_write): Rename to ...
(ioscm_file_port::write): ... this. Remove file_port_magic
checks.
(ioscm_file_port_new): Delete.
(ioscm_with_output_to_port_worker): Use ioscm_file_port and
ui_file_up.
* guile/scm-type.c (tyscm_type_name): Use string_file.
* guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print):
Use string_file.
* infcmd.c (print_return_value_1): Use string_file.
* infrun.c (print_target_wait_results): Use string_file.
* language.c (add_language): Use string_file.
* location.c (explicit_to_string_internal): Use string_file.
* main.c (captured_main_1): Use null_file.
* maint.c (maintenance_print_architecture): Use stdio_file.
* mi/mi-cmd-stack.c (list_arg_or_local): Use string_file.
* mi/mi-common.h (struct mi_interp) <out, err, log, targ,
event_channel>: Change type to mi_console_file pointer.
* mi/mi-console.c (mi_console_file_fputs, mi_console_file_flush)
(mi_console_file_delete): Delete.
(struct mi_console_file): Delete.
(mi_console_file_magic): Delete.
(mi_console_file_new): Delete.
(mi_console_file::mi_console_file): New.
(mi_console_file_delete): Delete.
(mi_console_file_fputs): Delete.
(mi_console_file::write): New.
(mi_console_raw_packet): Delete.
(mi_console_file::flush): New.
(mi_console_file_flush): Delete.
(mi_console_set_raw): Rename to ...
(mi_console_file::set_raw): ... this.
* mi/mi-console.h (class mi_console_file): New class.
(mi_console_file_new, mi_console_set_raw): Delete.
* mi/mi-interp.c (mi_interpreter_init): Use mi_console_file.
(mi_set_logging): Use delete and tee_file. Adjust.
* mi/mi-main.c (output_register): Use string_file.
(mi_cmd_data_evaluate_expression): Use string_file.
(mi_cmd_data_read_memory): Use string_file.
(mi_cmd_execute, print_variable_or_computed): Use string_file.
* mi/mi-out.c (mi_ui_out::main_stream): New.
(mi_ui_out::rewind): Use main_stream and
string_file.
(mi_ui_out::put): Use main_stream and string_file.
(mi_ui_out::mi_ui_out): Remove 'stream' parameter.
Allocate a 'string_file' instead.
(mi_out_new): Don't allocate a mem_fileopen stream here.
* mi/mi-out.h (mi_ui_out::mi_ui_out): Remove 'stream' parameter.
(mi_ui_out::main_stream): Declare method.
* printcmd.c (eval_command): Use string_file.
* psymtab.c (maintenance_print_psymbols): Use stdio_file.
* python/py-arch.c (archpy_disassemble): Use string_file.
* python/py-breakpoint.c (bppy_get_commands): Use string_file.
* python/py-frame.c (frapy_str): Use string_file.
* python/py-framefilter.c (py_print_type, py_print_single_arg):
Use string_file.
* python/py-type.c (typy_str): Use string_file.
* python/py-unwind.c (unwind_infopy_str): Use string_file.
* python/py-value.c (valpy_str): Use string_file.
* record-btrace.c (btrace_insn_history): Use string_file.
* regcache.c (regcache_print): Use stdio_file.
* reggroups.c (maintenance_print_reggroups): Use stdio_file.
* remote.c (escape_buffer): Use string_file.
* rust-lang.c (rust_get_disr_info): Use string_file.
* serial.c (serial_open_ops_1): Use stdio_file.
(do_serial_close): Use delete.
* stack.c (print_frame_arg): Use string_file.
(print_frame_args): Remove local mem_fileopen stream, not used.
(print_frame): Use string_file.
* symmisc.c (maintenance_print_symbols): Use stdio_file.
* symtab.h (struct symbol_computed_ops) <generate_c_location>:
Take a 'string_file *' instead of a 'ui_file *'.
* top.c (new_ui): Use stdio_file and stderr_file.
(free_ui): Use delete.
(execute_command_to_string): Use string_file.
(quit_confirm): Use string_file.
* tracepoint.c (collection_list::append_exp): Use string_file.
* tui/tui-disasm.c (tui_disassemble): Use string_file.
* tui/tui-file.c: Don't include "ui-file.h".
(enum streamtype, struct tui_stream): Delete.
(tui_file_new, tui_file_delete, tui_fileopen, tui_sfileopen)
(tui_file_isatty, tui_file_rewind, tui_file_put): Delete.
(tui_file::tui_file): New method.
(tui_file_fputs): Delete.
(tui_file_get_strbuf): Delete.
(tui_file::puts): New method.
(tui_file_adjust_strbuf): Delete.
(tui_file_flush): Delete.
(tui_file::flush): New method.
* tui/tui-file.h: Tweak intro comment.
Include ui-file.h.
(tui_fileopen, tui_sfileopen, tui_file_get_strbuf)
(tui_file_adjust_strbuf): Delete declarations.
(class tui_file): New class.
* tui/tui-io.c (tui_initialize_io): Use tui_file.
* tui/tui-regs.c (tui_restore_gdbout): Use delete.
(tui_register_format): Use string_stream.
* tui/tui-stack.c (tui_make_status_line): Use string_file.
(tui_get_function_from_frame): Use string_file.
* typeprint.c (type_to_string): Use string_file.
* ui-file.c (struct ui_file, ui_file_magic, ui_file_new): Delete.
(null_stream): New global.
(ui_file_delete): Delete.
(ui_file::ui_file): New.
(null_file_isatty): Delete.
(ui_file::~ui_file): New.
(null_file_rewind): Delete.
(ui_file::printf): New.
(null_file_put): Delete.
(null_file_flush): Delete.
(ui_file::putstr): New.
(null_file_write): Delete.
(ui_file::putstrn): New.
(null_file_read): Delete.
(ui_file::putc): New.
(null_file_fputs): Delete.
(null_file_write_async_safe): Delete.
(ui_file::vprintf): New.
(null_file_delete): Delete.
(null_file::write): New.
(null_file_fseek): Delete.
(null_file::puts): New.
(ui_file_data): Delete.
(null_file::write_async_safe): New.
(gdb_flush, ui_file_isatty): Adjust.
(ui_file_put, ui_file_rewind): Delete.
(ui_file_write): Adjust.
(ui_file_write_for_put): Delete.
(ui_file_write_async_safe, ui_file_read): Adjust.
(ui_file_fseek): Delete.
(fputs_unfiltered): Adjust.
(set_ui_file_flush, set_ui_file_isatty, set_ui_file_rewind)
(set_ui_file_put, set_ui_file_write, set_ui_file_write_async_safe)
(set_ui_file_read, set_ui_file_fputs, set_ui_file_fseek)
(set_ui_file_data): Delete.
(string_file::~string_file, string_file::write)
(struct accumulated_ui_file, do_ui_file_xstrdup, ui_file_xstrdup)
(do_ui_file_as_string, ui_file_as_string): Delete.
(do_ui_file_obsavestring, ui_file_obsavestring): Delete.
(struct mem_file): Delete.
(mem_file_new): Delete.
(stdio_file::stdio_file): New.
(mem_file_delete): Delete.
(stdio_file::stdio_file): New.
(mem_fileopen): Delete.
(stdio_file::~stdio_file): New.
(mem_file_rewind): Delete.
(stdio_file::set_stream): New.
(mem_file_put): Delete.
(stdio_file::open): New.
(mem_file_write): Delete.
(stdio_file_magic, struct stdio_file): Delete.
(stdio_file_new, stdio_file_delete, stdio_file_flush): Delete.
(stdio_file::flush): New.
(stdio_file_read): Rename to ...
(stdio_file::read): ... this. Adjust.
(stdio_file_write): Rename to ...
(stdio_file::write): ... this. Adjust.
(stdio_file_write_async_safe): Rename to ...
(stdio_file::write_async_safe) ... this. Adjust.
(stdio_file_fputs): Rename to ...
(stdio_file::puts) ... this. Adjust.
(stdio_file_isatty): Delete.
(stdio_file_fseek): Delete.
(stdio_file::isatty): New.
(stderr_file_write): Rename to ...
(stderr_file::write) ... this. Adjust.
(stderr_file_fputs): Rename to ...
(stderr_file::puts) ... this. Adjust.
(stderr_fileopen, stdio_fileopen, gdb_fopen): Delete.
(stderr_file::stderr_file): New.
(tee_file_magic): Delete.
(struct tee_file): Delete.
(tee_file::tee_file): New.
(tee_file_new): Delete.
(tee_file::~tee_file): New.
(tee_file_delete): Delete.
(tee_file_flush): Rename to ...
(tee_file::flush): ... this. Adjust.
(tee_file_write): Rename to ...
(tee_file::write): ... this. Adjust.
(tee_file::write_async_safe): New.
(tee_file_fputs): Rename to ...
(tee_file::puts): ... this. Adjust.
(tee_file_isatty): Rename to ...
(tee_file::isatty): ... this. Adjust.
* ui-file.h (struct obstack, struct ui_file): Don't
forward-declare.
(ui_file_new, ui_file_flush_ftype, set_ui_file_flush)
(ui_file_write_ftype)
(set_ui_file_write, ui_file_fputs_ftype, set_ui_file_fputs)
(ui_file_write_async_safe_ftype, set_ui_file_write_async_safe)
(ui_file_read_ftype, set_ui_file_read, ui_file_isatty_ftype)
(set_ui_file_isatty, ui_file_rewind_ftype, set_ui_file_rewind)
(ui_file_put_method_ftype, ui_file_put_ftype, set_ui_file_put)
(ui_file_delete_ftype, set_ui_file_data, ui_file_fseek_ftype)
(set_ui_file_fseek): Delete.
(ui_file_data, ui_file_delete, ui_file_rewind)
(struct ui_file): New.
(ui_file_up): New.
(class null_file): New.
(null_stream): Declare.
(ui_file_write_for_put, ui_file_put): Delete.
(ui_file_xstrdup, ui_file_as_string, ui_file_obsavestring):
Delete.
(ui_file_fseek, mem_fileopen, stdio_fileopen, stderr_fileopen)
(gdb_fopen, tee_file_new): Delete.
(struct string_file): New.
(struct stdio_file): New.
(stdio_file_up): New.
(struct stderr_file): New.
(class tee_file): New.
* ui-out.c (ui_out::field_stream): Take a 'string_file &' instead
of a 'ui_file *'. Adjust.
* ui-out.h (class ui_out) <field_stream>: Likewise.
* utils.c (do_ui_file_delete, make_cleanup_ui_file_delete)
(null_stream): Delete.
(error_stream): Take a 'string_file &' instead of a 'ui_file *'.
Adjust.
* utils.h (struct ui_file): Delete forward declaration..
(make_cleanup_ui_file_delete, null_stream): Delete declarations.
(error_stream): Take a 'string_file &' instead of a
'ui_file *'.
* varobj.c (varobj_value_get_print_value): Use string_file.
* xtensa-tdep.c (xtensa_verify_config): Use string_file.
* gdbarch.c: Regenerate.
2017-02-02 12:11:47 +01:00
|
|
|
log.c_str ());
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Print out the details of the current architecture. */
|
1999-06-14 20:08:47 +02:00
|
|
|
|
|
|
|
void
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2004-09-02 19:22:08 +02:00
|
|
|
const char *gdb_nm_file = "<not-defined>";
|
2010-05-13 23:56:58 +02:00
|
|
|
|
2004-09-02 19:22:08 +02:00
|
|
|
#if defined (GDB_NM_FILE)
|
|
|
|
gdb_nm_file = GDB_NM_FILE;
|
|
|
|
#endif
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: GDB_NM_FILE = %s\n",
|
|
|
|
gdb_nm_file);
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: addr_bit = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->addr_bit));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: addr_bits_remove = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->addr_bits_remove));
|
2003-08-17 03:06:47 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_address_class_name_to_type_flags_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_address_class_name_to_type_flags_p (gdbarch));
|
2003-08-17 03:06:47 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: address_class_name_to_type_flags = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->address_class_name_to_type_flags));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_address_class_type_flags_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_address_class_type_flags_p (gdbarch));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: address_class_type_flags = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->address_class_type_flags));
|
2003-08-17 03:06:47 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_address_class_type_flags_to_name_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_address_class_type_flags_to_name_p (gdbarch));
|
2003-08-17 03:06:47 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: address_class_type_flags_to_name = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->address_class_type_flags_to_name));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: address_to_pointer = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->address_to_pointer));
|
2015-06-12 22:51:51 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: addressable_memory_unit_size = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->addressable_memory_unit_size));
|
2003-10-14 01:41:40 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_adjust_breakpoint_address_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_adjust_breakpoint_address_p (gdbarch));
|
2003-10-14 01:41:40 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: adjust_breakpoint_address = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->adjust_breakpoint_address));
|
MIPS: Keep the ISA bit in compressed code addresses
1. Background information
The MIPS architecture, as originally designed and implemented in
mid-1980s has a uniform instruction word size that is 4 bytes, naturally
aligned. As such all MIPS instructions are located at addresses that
have their bits #1 and #0 set to zeroes, and any attempt to execute an
instruction from an address that has any of the two bits set to one
causes an address error exception. This may for example happen when a
jump-register instruction is executed whose register value used as the
jump target has any of these bits set.
Then in mid 1990s LSI sought a way to improve code density for their
TinyRISC family of MIPS cores and invented an alternatively encoded
instruction set in a joint effort with MIPS Technologies (then a
subsidiary of SGI). The new instruction set has been named the MIPS16
ASE (Application-Specific Extension) and uses a variable instruction
word size, which is 2 bytes (as the name of the ASE suggests) for most,
but there are a couple of exceptions that take 4 bytes, and then most of
the 2-byte instructions can be treated with a 2-byte extension prefix to
expand the range of the immediate operands used.
As a result instructions are no longer 4-byte aligned, instead they are
aligned to a multiple of 2. That left the bit #0 still unused for code
references, be it for the standard MIPS (i.e. as originally invented) or
for the MIPS16 instruction set, and based on that observation a clever
trick was invented that on one hand allowed the processor to be
seamlessly switched between the two instruction sets at any time at the
run time while on the other avoided the introduction of any special
control register to do that.
So it is the bit #0 of the instruction address that was chosen as the
selector and named the ISA bit. Any instruction executed at an even
address is interpreted as a standard MIPS instruction (the address still
has to have its bit #1 clear), any instruction executed at an odd
address is interpreted as a MIPS16 instruction.
To switch between modes ordinary jump instructions are used, such as
used for function calls and returns, specifically the bit #0 of the
source register used in jump-register instructions selects the execution
(ISA) mode for the following piece of code to be interpreted in.
Additionally new jump-immediate instructions were added that flipped the
ISA bit to select the opposite mode upon execution. They were
considered necessary to avoid the need to make register jumps in all
cases as the original jump-immediate instructions provided no way to
change the bit #0 at all.
This was all important for cases where standard MIPS and MIPS16 code had
to be mixed, either for compatibility with the existing binary code base
or to access resources not reachable from MIPS16 code (the MIPS16
instruction set only provides access to general-purpose registers, and
not for example floating-point unit registers or privileged coprocessor
0 registers) -- pieces of code in the opposite mode can be executed as
ordinary subroutine calls.
A similar approach has been more recently adopted for the MIPS16
replacement instruction set defined as the so called microMIPS ASE.
This is another instruction set encoding introduced to the MIPS
architecture. Just like the MIPS16 ASE, the microMIPS instruction set
uses a variable-length encoding, where each instruction takes a multiple
of 2 bytes. The ISA bit has been reused and for microMIPS-capable
processors selects between the standard MIPS and the microMIPS mode
instead.
2. Statement of the problem
To put it shortly, MIPS16 and microMIPS code pointers used by GDB are
different to these observed at the run time. This results in the same
expressions being evaluated producing different results in GDB and in
the program being debugged. Obviously it's the results obtained at the
run time that are correct (they define how the program behaves) and
therefore by definition the results obtained in GDB are incorrect.
A bit longer description will record that obviously at the run time the
ISA bit has to be set correctly (refer to background information above
if unsure why so) or the program will not run as expected. This is
recorded in all the executable file structures used at the run time: the
dynamic symbol table (but not always the static one!), the GOT, and
obviously in all the addresses embedded in code or data of the program
itself, calculated by applying the appropriate relocations at the static
link time.
While a program is being processed by GDB, the ISA bit is stripped off
from any code addresses, presumably to make them the same as the
respective raw memory byte address used by the processor to access the
instruction in the instruction fetch access cycle. This stripping is
actually performed outside GDB proper, in BFD, specifically
_bfd_mips_elf_symbol_processing (elfxx-mips.c, see the piece of code at
the very bottom of that function, starting with an: "If this is an
odd-valued function symbol, assume it's a MIPS16 or microMIPS one."
comment).
This function is also responsible for symbol table dumps made by
`objdump' too, so you'll never see the ISA bit reported there by that
tool, you need to use `readelf'.
This is however unlike what is ever done at the run time, the ISA bit
once present is never stripped off, for example a cast like this:
(short *) main
will not strip the ISA bit off and if the resulting pointer is intended
to be used to access instructions as data, for example for software
instruction decoding (like for fault recovery or emulation in a signal
handler) or for self-modifying code then the bit still has to be
stripped off by an explicit AND operation.
This is probably best illustrated with a simple real program example.
Let's consider the following simple program:
$ cat foobar.c
int __attribute__ ((mips16)) foo (void)
{
return 1;
}
int __attribute__ ((mips16)) bar (void)
{
return 2;
}
int __attribute__ ((nomips16)) foo32 (void)
{
return 3;
}
int (*foo32p) (void) = foo32;
int (*foop) (void) = foo;
int fooi = (int) foo;
int
main (void)
{
return foop ();
}
$
This is plain C with no odd tricks, except from the instruction mode
attributes. They are not necessary to trigger this problem, I just put
them here so that the program can be contained in a single source file
and to make it obvious which function is MIPS16 code and which is not.
Let's try it with Linux, so that everyone can repeat this experiment:
$ mips-linux-gnu-gcc -mips16 -g -O2 -o foobar foobar.c
$
Let's have a look at some interesting symbols:
$ mips-linux-gnu-readelf -s foobar | egrep 'table|foo|bar'
Symbol table '.dynsym' contains 7 entries:
Symbol table '.symtab' contains 95 entries:
55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c
66: 0040068c 4 FUNC GLOBAL DEFAULT [MIPS16] 12 bar
68: 00410848 4 OBJECT GLOBAL DEFAULT 21 foo32p
70: 00410844 4 OBJECT GLOBAL DEFAULT 21 foop
78: 00400684 8 FUNC GLOBAL DEFAULT 12 foo32
80: 00400680 4 FUNC GLOBAL DEFAULT [MIPS16] 12 foo
88: 00410840 4 OBJECT GLOBAL DEFAULT 21 fooi
$
Hmm, no sight of the ISA bit, but notice how foo and bar (but not
foo32!) have been marked as MIPS16 functions (ELF symbol structure's
`st_other' field is used for that).
So let's try to run and poke at this program with GDB. I'll be using a
native system for simplicity (I'll be using ellipses here and there to
remove unrelated clutter):
$ ./foobar
$ echo $?
1
$
So far, so good.
$ gdb ./foobar
[...]
(gdb) break main
Breakpoint 1 at 0x400490: file foobar.c, line 23.
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb)
Yay, it worked! OK, so let's poke at it:
(gdb) print main
$1 = {int (void)} 0x400490 <main>
(gdb) print foo32
$2 = {int (void)} 0x400684 <foo32>
(gdb) print foo32p
$3 = (int (*)(void)) 0x400684 <foo32>
(gdb) print bar
$4 = {int (void)} 0x40068c <bar>
(gdb) print foo
$5 = {int (void)} 0x400680 <foo>
(gdb) print foop
$6 = (int (*)(void)) 0x400681 <foo>
(gdb)
A-ha! Here's the difference and finally the ISA bit!
(gdb) print /x fooi
$7 = 0x400681
(gdb) p/x $pc
p/x $pc
$8 = 0x400491
(gdb)
And here as well...
(gdb) advance foo
foo () at foobar.c:4
4 }
(gdb) disassemble
Dump of assembler code for function foo:
0x00400680 <+0>: jr ra
0x00400682 <+2>: li v0,1
End of assembler dump.
(gdb) finish
Run till exit from #0 foo () at foobar.c:4
main () at foobar.c:24
24 }
Value returned is $9 = 1
(gdb) continue
Continuing.
[Inferior 1 (process 14103) exited with code 01]
(gdb)
So let's be a bit inquisitive...
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb)
Actually we do not like to run foo here at all. Let's run bar instead!
(gdb) set foop = bar
(gdb) print foop
$10 = (int (*)(void)) 0x40068c <bar>
(gdb)
Hmm, no ISA bit. Is it going to work?
(gdb) advance bar
bar () at foobar.c:9
9 }
(gdb) p/x $pc
$11 = 0x40068c
(gdb) disassemble
Dump of assembler code for function bar:
=> 0x0040068c <+0>: jr ra
0x0040068e <+2>: li v0,2
End of assembler dump.
(gdb) finish
Run till exit from #0 bar () at foobar.c:9
Program received signal SIGILL, Illegal instruction.
bar () at foobar.c:9
9 }
(gdb)
Oops!
(gdb) p/x $pc
$12 = 0x40068c
(gdb)
We're still there!
(gdb) continue
Continuing.
Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb)
So let's try something else:
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) set foop = foo
(gdb) advance foo
foo () at foobar.c:4
4 }
(gdb) disassemble
Dump of assembler code for function foo:
=> 0x00400680 <+0>: jr ra
0x00400682 <+2>: li v0,1
End of assembler dump.
(gdb) finish
Run till exit from #0 foo () at foobar.c:4
Program received signal SIGILL, Illegal instruction.
foo () at foobar.c:4
4 }
(gdb) continue
Continuing.
Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb)
The same problem!
(gdb) run
Starting program:
/net/build2-lucid-cs/scratch/macro/mips-linux-fsf-gcc/isa-bit/foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) set foop = foo32
(gdb) advance foo32
foo32 () at foobar.c:14
14 }
(gdb) disassemble
Dump of assembler code for function foo32:
=> 0x00400684 <+0>: jr ra
0x00400688 <+4>: li v0,3
End of assembler dump.
(gdb) finish
Run till exit from #0 foo32 () at foobar.c:14
main () at foobar.c:24
24 }
Value returned is $14 = 3
(gdb) continue
Continuing.
[Inferior 1 (process 14113) exited with code 03]
(gdb)
That did work though, so it's the ISA bit only!
(gdb) quit
Enough!
That's the tip of the iceberg only though. So let's rebuild the
executable with some dynamic symbols:
$ mips-linux-gnu-gcc -mips16 -Wl,--export-dynamic -g -O2 -o foobar-dyn foobar.c
$ mips-linux-gnu-readelf -s foobar-dyn | egrep 'table|foo|bar'
Symbol table '.dynsym' contains 32 entries:
6: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar
8: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p
9: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop
15: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32
17: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo
25: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi
Symbol table '.symtab' contains 95 entries:
55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c
69: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar
71: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p
72: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop
79: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32
81: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo
89: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi
$
OK, now the ISA bit is there for a change, but the MIPS16 `st_other'
attribute gone, hmm... What does `objdump' do then:
$ mips-linux-gnu-objdump -Tt foobar-dyn | egrep 'SYMBOL|foo|bar'
foobar-dyn: file format elf32-tradbigmips
SYMBOL TABLE:
00000000 l df *ABS* 00000000 foobar.c
004009cc g F .text 00000004 0xf0 bar
00410b88 g O .data 00000004 foo32p
00410b84 g O .data 00000004 foop
004009c4 g F .text 00000008 foo32
004009c0 g F .text 00000004 0xf0 foo
00410b80 g O .data 00000004 fooi
DYNAMIC SYMBOL TABLE:
004009cc g DF .text 00000004 Base 0xf0 bar
00410b88 g DO .data 00000004 Base foo32p
00410b84 g DO .data 00000004 Base foop
004009c4 g DF .text 00000008 Base foo32
004009c0 g DF .text 00000004 Base 0xf0 foo
00410b80 g DO .data 00000004 Base fooi
$
Hmm, the attribute (0xf0, printed raw) is back, and the ISA bit gone
again.
Let's have a look at some DWARF-2 records GDB uses (I'll be stripping
off a lot here for brevity) -- debug info:
$ mips-linux-gnu-readelf -wi foobar
Contents of the .debug_info section:
[...]
Compilation Unit @ offset 0x88:
Length: 0xbb (32-bit)
Version: 4
Abbrev Offset: 62
Pointer Size: 4
<0><93>: Abbrev Number: 1 (DW_TAG_compile_unit)
<94> DW_AT_producer : (indirect string, offset: 0x19e): GNU C 4.8.0 20120513 (experimental) -meb -mips16 -march=mips32r2 -mhard-float -mllsc -mplt -mno-synci -mno-shared -mabi=32 -g -O2
<98> DW_AT_language : 1 (ANSI C)
<99> DW_AT_name : (indirect string, offset: 0x190): foobar.c
<9d> DW_AT_comp_dir : (indirect string, offset: 0x225): [...]
<a1> DW_AT_ranges : 0x0
<a5> DW_AT_low_pc : 0x0
<a9> DW_AT_stmt_list : 0x27
<1><ad>: Abbrev Number: 2 (DW_TAG_subprogram)
<ae> DW_AT_external : 1
<ae> DW_AT_name : foo
<b2> DW_AT_decl_file : 1
<b3> DW_AT_decl_line : 1
<b4> DW_AT_prototyped : 1
<b4> DW_AT_type : <0xc2>
<b8> DW_AT_low_pc : 0x400680
<bc> DW_AT_high_pc : 0x400684
<c0> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<c2> DW_AT_GNU_all_call_sites: 1
<1><c2>: Abbrev Number: 3 (DW_TAG_base_type)
<c3> DW_AT_byte_size : 4
<c4> DW_AT_encoding : 5 (signed)
<c5> DW_AT_name : int
<1><c9>: Abbrev Number: 4 (DW_TAG_subprogram)
<ca> DW_AT_external : 1
<ca> DW_AT_name : (indirect string, offset: 0x18a): foo32
<ce> DW_AT_decl_file : 1
<cf> DW_AT_decl_line : 11
<d0> DW_AT_prototyped : 1
<d0> DW_AT_type : <0xc2>
<d4> DW_AT_low_pc : 0x400684
<d8> DW_AT_high_pc : 0x40068c
<dc> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<de> DW_AT_GNU_all_call_sites: 1
<1><de>: Abbrev Number: 2 (DW_TAG_subprogram)
<df> DW_AT_external : 1
<df> DW_AT_name : bar
<e3> DW_AT_decl_file : 1
<e4> DW_AT_decl_line : 6
<e5> DW_AT_prototyped : 1
<e5> DW_AT_type : <0xc2>
<e9> DW_AT_low_pc : 0x40068c
<ed> DW_AT_high_pc : 0x400690
<f1> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<f3> DW_AT_GNU_all_call_sites: 1
<1><f3>: Abbrev Number: 5 (DW_TAG_subprogram)
<f4> DW_AT_external : 1
<f4> DW_AT_name : (indirect string, offset: 0x199): main
<f8> DW_AT_decl_file : 1
<f9> DW_AT_decl_line : 21
<fa> DW_AT_prototyped : 1
<fa> DW_AT_type : <0xc2>
<fe> DW_AT_low_pc : 0x400490
<102> DW_AT_high_pc : 0x4004a4
<106> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<108> DW_AT_GNU_all_tail_call_sites: 1
[...]
$
-- no sign of the ISA bit anywhere -- frame info:
$ mips-linux-gnu-readelf -wf foobar
[...]
Contents of the .debug_frame section:
00000000 0000000c ffffffff CIE
Version: 1
Augmentation: ""
Code alignment factor: 1
Data alignment factor: -4
Return address column: 31
DW_CFA_def_cfa_register: r29
DW_CFA_nop
00000010 0000000c 00000000 FDE cie=00000000 pc=00400680..00400684
00000020 0000000c 00000000 FDE cie=00000000 pc=00400684..0040068c
00000030 0000000c 00000000 FDE cie=00000000 pc=0040068c..00400690
00000040 00000018 00000000 FDE cie=00000000 pc=00400490..004004a4
DW_CFA_advance_loc: 6 to 00400496
DW_CFA_def_cfa_offset: 32
DW_CFA_offset: r31 at cfa-4
DW_CFA_advance_loc: 6 to 0040049c
DW_CFA_restore: r31
DW_CFA_def_cfa_offset: 0
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
[...]
$
-- no sign of the ISA bit anywhere -- range info (GDB doesn't use arange):
$ mips-linux-gnu-readelf -wR foobar
Contents of the .debug_ranges section:
Offset Begin End
00000000 00400680 00400690
00000000 00400490 004004a4
00000000 <End of list>
$
-- no sign of the ISA bit anywhere -- line info:
$ mips-linux-gnu-readelf -wl foobar
Raw dump of debug contents of section .debug_line:
[...]
Offset: 0x27
Length: 78
DWARF Version: 2
Prologue Length: 31
Minimum Instruction Length: 1
Initial value of 'is_stmt': 1
Line Base: -5
Line Range: 14
Opcode Base: 13
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 args
Opcode 3 has 1 args
Opcode 4 has 1 args
Opcode 5 has 1 args
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 args
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 args
The Directory Table is empty.
The File Name Table:
Entry Dir Time Size Name
1 0 0 0 foobar.c
Line Number Statements:
Extended opcode 2: set Address to 0x400681
Special opcode 6: advance Address by 0 to 0x400681 and Line by 1 to 2
Special opcode 7: advance Address by 0 to 0x400681 and Line by 2 to 4
Special opcode 55: advance Address by 3 to 0x400684 and Line by 8 to 12
Special opcode 7: advance Address by 0 to 0x400684 and Line by 2 to 14
Advance Line by -7 to 7
Special opcode 131: advance Address by 9 to 0x40068d and Line by 0 to 7
Special opcode 7: advance Address by 0 to 0x40068d and Line by 2 to 9
Advance PC by 3 to 0x400690
Extended opcode 1: End of Sequence
Extended opcode 2: set Address to 0x400491
Advance Line by 21 to 22
Copy
Special opcode 6: advance Address by 0 to 0x400491 and Line by 1 to 23
Special opcode 60: advance Address by 4 to 0x400495 and Line by -1 to 22
Special opcode 34: advance Address by 2 to 0x400497 and Line by 1 to 23
Special opcode 62: advance Address by 4 to 0x40049b and Line by 1 to 24
Special opcode 32: advance Address by 2 to 0x40049d and Line by -1 to 23
Special opcode 6: advance Address by 0 to 0x40049d and Line by 1 to 24
Advance PC by 7 to 0x4004a4
Extended opcode 1: End of Sequence
[...]
-- a-ha, the ISA bit is there! However it's not always right for some
reason, I don't have a small test case to show it, but here's an excerpt
from MIPS16 libc, a prologue of a function:
00019630 <__libc_init_first>:
19630: e8a0 jrc ra
19632: 6500 nop
00019634 <_init>:
19634: f000 6a11 li v0,17
19638: f7d8 0b08 la v1,15e00 <_DYNAMIC+0x15c54>
1963c: f400 3240 sll v0,16
19640: e269 addu v0,v1
19642: 659a move gp,v0
19644: 64f6 save 48,ra,s0-s1
19646: 671c move s0,gp
19648: d204 sw v0,16(sp)
1964a: f352 984c lw v0,-27828(s0)
1964e: 6724 move s1,a0
and the corresponding DWARF-2 line info:
Line Number Statements:
Extended opcode 2: set Address to 0x19631
Advance Line by 44 to 45
Copy
Special opcode 8: advance Address by 0 to 0x19631 and Line by 3 to 48
Special opcode 66: advance Address by 4 to 0x19635 and Line by 5 to 53
Advance PC by constant 17 to 0x19646
Special opcode 25: advance Address by 1 to 0x19647 and Line by 6 to 59
Advance Line by -6 to 53
Special opcode 33: advance Address by 2 to 0x19649 and Line by 0 to 53
Special opcode 39: advance Address by 2 to 0x1964b and Line by 6 to 59
Advance Line by -6 to 53
Special opcode 61: advance Address by 4 to 0x1964f and Line by 0 to 53
-- see that "Advance PC by constant 17" there? It clears the ISA bit,
however code at 0x19646 is not standard MIPS code at all. For some
reason the constant is always 17, I've never seen DW_LNS_const_add_pc
used with any other value -- is that a binutils bug or what?
3. Solution:
I think we should retain the value of the ISA bit in code references,
that is effectively treat them as cookies as they indeed are (although
trivially calculated) rather than raw memory byte addresses.
In a perfect world both the static symbol table and the respective
DWARF-2 records should be fixed to include the ISA bit in all the cases.
I think however that this is infeasible.
All the uses of `_bfd_mips_elf_symbol_processing' can not necessarily be
tracked down. This function is used by `elf_slurp_symbol_table' that in
turn is used by `bfd_canonicalize_symtab' and
`bfd_canonicalize_dynamic_symtab', which are public interfaces.
Similarly DWARF-2 records are used outside GDB, one notable if a bit
questionable is the exception unwinder (libgcc/unwind-dw2.c) -- I have
identified at least bits in `execute_cfa_program' and
`uw_frame_state_for', both around the calls to `_Unwind_IsSignalFrame',
that would need an update as they effectively flip the ISA bit freely;
see also the comment about MASK_RETURN_ADDR in gcc/config/mips/mips.h.
But there may be more places. Any change in how DWARF-2 records are
produced would require an update there and would cause compatibility
problems with libgcc.a binaries already distributed; given that this is
a static library a complex change involving function renames would
likely be required.
I propose therefore to accept the existing inconsistencies and deal with
them entirely within GDB. I have figured out that the ISA bit lost in
various places can still be recovered as long as we have symbol
information -- that'll have the `st_other' attribute correctly set to
one of standard MIPS/MIPS16/microMIPS encoding.
Here's the resulting change. It adds a couple of new `gdbarch' hooks,
one to update symbol information with the ISA bit lost in
`_bfd_mips_elf_symbol_processing', and two other ones to adjust DWARF-2
records as they're processed. The ISA bit is set in each address
handled according to information retrieved from the symbol table for the
symbol spanning the address if any; limits are adjusted based on the
address they point to related to the respective base address.
Additionally minimal symbol information has to be adjusted accordingly
in its gdbarch hook.
With these changes in place some complications with ISA bit juggling in
the PC that never fully worked can be removed from the MIPS backend.
Conversely, the generic dynamic linker event special breakpoint symbol
handler has to be updated to call the minimal symbol gdbarch hook to
record that the symbol is a MIPS16 or microMIPS address if applicable or
the breakpoint will be set at the wrong address and either fail to work
or cause SIGTRAPs (this is because the symbol is handled early on and
bypasses regular symbol processing).
4. Results obtained
The change fixes the example above -- to repeat only the crucial steps:
(gdb) break main
Breakpoint 1 at 0x400491: file foobar.c, line 23.
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) print foo
$1 = {int (void)} 0x400681 <foo>
(gdb) set foop = bar
(gdb) advance bar
bar () at foobar.c:9
9 }
(gdb) disassemble
Dump of assembler code for function bar:
=> 0x0040068d <+0>: jr ra
0x0040068f <+2>: li v0,2
End of assembler dump.
(gdb) finish
Run till exit from #0 bar () at foobar.c:9
main () at foobar.c:24
24 }
Value returned is $2 = 2
(gdb) continue
Continuing.
[Inferior 1 (process 14128) exited with code 02]
(gdb)
-- excellent!
The change removes about 90 failures per MIPS16 multilib in mips-sde-elf
testing too, results for MIPS16 are now similar to that for standard
MIPS; microMIPS results are a bit worse because of host-I/O problems in
QEMU used instead of MIPSsim for microMIPS testing only:
=== gdb Summary ===
# of expected passes 14299
# of unexpected failures 187
# of expected failures 56
# of known failures 58
# of unresolved testcases 11
# of untested testcases 52
# of unsupported tests 174
MIPS16:
=== gdb Summary ===
# of expected passes 14298
# of unexpected failures 187
# of unexpected successes 2
# of expected failures 54
# of known failures 58
# of unresolved testcases 12
# of untested testcases 52
# of unsupported tests 174
microMIPS:
=== gdb Summary ===
# of expected passes 14149
# of unexpected failures 201
# of unexpected successes 2
# of expected failures 54
# of known failures 58
# of unresolved testcases 7
# of untested testcases 53
# of unsupported tests 175
2014-12-12 Maciej W. Rozycki <macro@codesourcery.com>
Maciej W. Rozycki <macro@mips.com>
Pedro Alves <pedro@codesourcery.com>
gdb/
* gdbarch.sh (elf_make_msymbol_special): Change type to `F',
remove `predefault' and `invalid_p' initializers.
(make_symbol_special): New architecture method.
(adjust_dwarf2_addr, adjust_dwarf2_line): Likewise.
(objfile, symbol): New declarations.
* arch-utils.h (default_elf_make_msymbol_special): Remove
prototype.
(default_make_symbol_special): New prototype.
(default_adjust_dwarf2_addr): Likewise.
(default_adjust_dwarf2_line): Likewise.
* mips-tdep.h (mips_unmake_compact_addr): New prototype.
* arch-utils.c (default_elf_make_msymbol_special): Remove
function.
(default_make_symbol_special): New function.
(default_adjust_dwarf2_addr): Likewise.
(default_adjust_dwarf2_line): Likewise.
* dwarf2-frame.c (decode_frame_entry_1): Call
`gdbarch_adjust_dwarf2_addr'.
* dwarf2loc.c (dwarf2_find_location_expression): Likewise.
* dwarf2read.c (create_addrmap_from_index): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(add_partial_symbol): Likewise.
(add_partial_subprogram): Likewise.
(process_full_comp_unit): Likewise.
(read_file_scope): Likewise.
(read_func_scope): Likewise. Call `gdbarch_make_symbol_special'.
(read_lexical_block_scope): Call `gdbarch_adjust_dwarf2_addr'.
(read_call_site_scope): Likewise.
(dwarf2_ranges_read): Likewise.
(dwarf2_record_block_ranges): Likewise.
(read_attribute_value): Likewise.
(dwarf_decode_lines_1): Call `gdbarch_adjust_dwarf2_line'.
(new_symbol_full): Call `gdbarch_adjust_dwarf2_addr'.
* elfread.c (elf_symtab_read): Don't call
`gdbarch_elf_make_msymbol_special' if unset.
* mips-linux-tdep.c (micromips_linux_sigframe_validate): Strip
the ISA bit from the PC.
* mips-tdep.c (mips_unmake_compact_addr): New function.
(mips_elf_make_msymbol_special): Set the ISA bit in the symbol's
address appropriately.
(mips_make_symbol_special): New function.
(mips_pc_is_mips): Set the ISA bit before symbol lookup.
(mips_pc_is_mips16): Likewise.
(mips_pc_is_micromips): Likewise.
(mips_pc_isa): Likewise.
(mips_adjust_dwarf2_addr): New function.
(mips_adjust_dwarf2_line): Likewise.
(mips_read_pc, mips_unwind_pc): Keep the ISA bit.
(mips_addr_bits_remove): Likewise.
(mips_skip_trampoline_code): Likewise.
(mips_write_pc): Don't set the ISA bit.
(mips_eabi_push_dummy_call): Likewise.
(mips_o64_push_dummy_call): Likewise.
(mips_gdbarch_init): Install `mips_make_symbol_special',
`mips_adjust_dwarf2_addr' and `mips_adjust_dwarf2_line' gdbarch
handlers.
* solib.c (gdb_bfd_lookup_symbol_from_symtab): Get
target-specific symbol address adjustments.
* gdbarch.h: Regenerate.
* gdbarch.c: Regenerate.
2014-12-12 Maciej W. Rozycki <macro@codesourcery.com>
gdb/testsuite/
* gdb.base/func-ptrs.c: New file.
* gdb.base/func-ptrs.exp: New file.
2014-12-12 14:31:53 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: adjust_dwarf2_addr = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->adjust_dwarf2_addr));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: adjust_dwarf2_line = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->adjust_dwarf2_line));
|
2010-03-05 21:18:19 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: auto_charset = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->auto_charset));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: auto_wide_charset = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->auto_wide_charset));
|
2014-02-27 13:40:15 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_auxv_parse_p() = %d\n",
|
|
|
|
gdbarch_auxv_parse_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: auxv_parse = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->auxv_parse));
|
2010-12-28 17:00:13 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_ax_pseudo_register_collect_p() = %d\n",
|
|
|
|
gdbarch_ax_pseudo_register_collect_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: ax_pseudo_register_collect = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->ax_pseudo_register_collect));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_ax_pseudo_register_push_stack_p() = %d\n",
|
|
|
|
gdbarch_ax_pseudo_register_push_stack_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: ax_pseudo_register_push_stack = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->ax_pseudo_register_push_stack));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: believe_pcc_promotion = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->believe_pcc_promotion));
|
2004-06-21 17:01:04 +02:00
|
|
|
fprintf_unfiltered (file,
|
2004-06-21 19:54:57 +02:00
|
|
|
"gdbarch_dump: bfd_arch_info = %s\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_bfd_arch_info (gdbarch)->printable_name);
|
2008-01-18 18:07:40 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: bits_big_endian = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->bits_big_endian));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: breakpoint_from_pc = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->breakpoint_from_pc));
|
2016-11-03 15:35:14 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: breakpoint_kind_from_current_state = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->breakpoint_kind_from_current_state));
|
New gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind
This patch adds two gdbarch methods breakpoint_kind_from_pc and
sw_breakpoint_from_kind, and uses target_info.placed_size as "kind"
of the breakpoint. This patch updates the usages of
target_info.placed_size.
The "kind" of a breakpoint is determined by gdbarch rather than
target, so we have gdbarch method breakpoint_kind_from_pc, and we
should set target_info.placed_size out of each implementation of
target to_insert_breakpoint. In this way, each target doesn't have
to set target_info.placed_size any more.
This patch also sets target_info.placed_address before
target_insert_breakpoint too, so that target to_insert_breakpoint
can use it, see record_full_insert_breakpoint.
Before we call target_insert_breakpoint, we set
target_info.placed_address and target_info.placed_size like this,
CORE_ADDR addr = bl->target_info.reqstd_address;
bl->target_info.placed_size = gdbarch_breakpoint_kind_from_pc (bl->gdbarch, &addr);
bl->target_info.placed_address = addr;
return target_insert_breakpoint (bl->gdbarch, &bl->target_info);
target_insert_breakpoint may fail, but it doesn't matter to the "kind"
and "placed_address" of a breakpoint. They should be determined by
gdbarch.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): Define
breakpoint_kind_from_pc and sw_breakpoint_from_kind.
(GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN): Likewise.
(SET_GDBARCH_BREAKPOINT_MANIPULATION): Call
set_gdbarch_breakpoint_kind_from_pc and
set_gdbarch_sw_breakpoint_from_kind.
* arm-tdep.c: Add comments.
* bfin-tdep.c: Likewise.
* breakpoint.c (breakpoint_kind): New function.
(insert_bp_location): Set target_info.placed_size and
target_info.placed_address.
(bkpt_insert_location): Likewise.
* cris-tdep.c: Add comments.
* gdbarch.sh (breakpoint_kind_from_pc): New.
(sw_breakpoint_from_kind): New.
* gdbarch.c, gdbarch.h: Regenerated.
* ia64-tdep.c (ia64_memory_insert_breakpoint): Don't set
bp_tgt->placed_size.
(ia64_memory_remove_breakpoint): Don't assert
bp_tgt->placed_size.
(ia64_breakpoint_kind_from_pc): New function.
(ia64_gdbarch_init): Install ia64_breakpoint_kind_from_pc.
* m32r-tdep.c (m32r_memory_insert_breakpoint): Don't set
bp_tgt->placed_size.
* mem-break.c (default_memory_insert_breakpoint): Don't set
bp_tgt->placed_size. Call gdbarch_sw_breakpoint_from_kind.
(default_memory_remove_breakpoint): Call
gdbarch_sw_breakpoint_from_kind.
(memory_validate_breakpoint): Don't check bp_tgt->placed_size.
* mips-tdep.c: Add comments.
* mt-tdep.c: Likewise.
* nios2-tdep.c: Likewise.
* record-full.c (record_full_insert_breakpoint): Don't call
gdbarch_breakpoint_from_pc. Don't set bp_tgt->placed_address
and bp_tgt->placed_size.
* remote.c (remote_insert_breakpoint): Don't call
gdbarch_remote_breakpoint_from_pc. Use bp_tgt->placed_size.
Don't set bp_tgt->placed_address and bp_tgt->placed_size.
(remote_insert_hw_breakpoint): Likewise.
* score-tdep.c: Likewise.
* sh-tdep.c: Likewise.
* tic6x-tdep.c: Likewise.
* v850-tdep.c: Likewise.
* xtensa-tdep.c: Likewise.
2016-11-03 15:35:13 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: breakpoint_kind_from_pc = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->breakpoint_kind_from_pc));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: byte_order = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->byte_order));
|
2008-08-11 21:00:25 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: byte_order_for_code = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->byte_order_for_code));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: call_dummy_location = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->call_dummy_location));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: cannot_fetch_register = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->cannot_fetch_register));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: cannot_step_breakpoint = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->cannot_step_breakpoint));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: cannot_store_register = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->cannot_store_register));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: char_signed = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->char_signed));
|
Skip unwritable frames in command "finish"
Nowadays, GDB can't insert breakpoint on the return address of the
exception handler on ARM M-profile, because the address is a magic
one 0xfffffff9,
(gdb) bt
#0 CT32B1_IRQHandler () at ../src/timer.c:67
#1 <signal handler called>
#2 main () at ../src/timer.c:127
(gdb) info frame
Stack level 0, frame at 0x200ffa8:
pc = 0x4ec in CT32B1_IRQHandler (../src/timer.c:67); saved pc = 0xfffffff9
called by frame at 0x200ffc8
source language c.
Arglist at 0x200ffa0, args:
Locals at 0x200ffa0, Previous frame's sp is 0x200ffa8
Saved registers:
r7 at 0x200ffa0, lr at 0x200ffa4
(gdb) x/x 0xfffffff9
0xfffffff9: Cannot access memory at address 0xfffffff9
(gdb) finish
Run till exit from #0 CT32B1_IRQHandler () at ../src/timer.c:67
Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?)
Warning:
Cannot insert hardware breakpoint 0.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.
Command aborted.
even some debug probe can't set hardware breakpoint on the magic
address too,
(gdb) hbreak *0xfffffff9
Hardware assisted breakpoint 2 at 0xfffffff9
(gdb) c
Continuing.
Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?)
Warning:
Cannot insert hardware breakpoint 2.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.
Command aborted.
The problem described above is quite similar to PR 8841, in which GDB
can't set breakpoint on signal trampoline, which is mapped to a read-only
page by kernel. The rationale of this patch is to skip "unwritable"
frames when looking for caller frames in command "finish", and a new
gdbarch method code_of_frame_writable is added. This patch fixes
the problem on ARM cortex-m target, but it can be used to fix
PR 8841 too.
gdb:
2016-05-10 Yao Qi <yao.qi@arm.com>
* arch-utils.c (default_code_of_frame_writable): New function.
* arch-utils.h (default_code_of_frame_writable): Declare.
* arm-tdep.c (arm_code_of_frame_writable): New function.
(arm_gdbarch_init): Install gdbarch method
code_of_frame_writable if the target is M-profile.
* frame.c (skip_unwritable_frames): New function.
* frame.h (skip_unwritable_frames): Declare.
* gdbarch.sh (code_of_frame_writable): New.
* gdbarch.c, gdbarch.h: Re-generated.
* infcmd.c (finish_command): Call skip_unwritable_frames.
2016-05-23 18:32:56 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: code_of_frame_writable = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->code_of_frame_writable));
|
2003-08-17 03:06:47 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: coff_make_msymbol_special = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->coff_make_msymbol_special));
|
2004-06-21 02:17:02 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: convert_from_func_ptr_addr = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->convert_from_func_ptr_addr));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: convert_register_p = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->convert_register_p));
|
2012-12-14 16:30:38 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_core_info_proc_p() = %d\n",
|
|
|
|
gdbarch_core_info_proc_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: core_info_proc = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->core_info_proc));
|
* corelow.c (get_core_registers): Adjust.
(core_file_thread_alive): Rename to...
(core_thread_alive): ... this.
(core_pid_to_str): Try gdbarch_core_pid_to_str first.
(init_core_ops): Adjust.
(coreops_suppress_target): Delete.
(_initialize_corelow): Unconditionally add core_ops.
* procfs.c: Include "inf-child.h".
(procfs_ops): Delete.
(init_procfs_ops): Delete. Reimplement as...
(procfs_target): ... this, inheriting from inf-child.
(procfs_attach, procfs_detach, procfs_fetch_registers): Adjust.
(procfs_prepare_to_store): Delete.
(procfs_store_registers, procfs_resume): Adjust.
(procfs_open): Delete.
(procfs_suppress_run): Delete.
(procfs_can_run): Delete.
(procfs_mourn_inferior): Adjust.
(procfs_init_inferior): Add target_ops parameter. Adjust.
(procfs_create_inferior): Don't pass procfs_init_inferior to
fork_inferior. Instead call it after fork_inferior returns.
(procfs_find_new_threads): Adjust.
(_initialize_procfs): Adjust to use procfs_target instead of
init_procfs_ops.
* sol-thread.c (orig_core_ops, sol_core_ops): Delete.
(lwp_to_thread): Use target_thread_alive.
(sol_thread_open): Delete.
(sol_thread_attach): Delete.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers): Adjust
to use find_target_beneath.
(sol_thread_prepare_to_store, sol_thread_xfer_memory): Delete.
(sol_thread_xfer_partial): Adjust to use find_target_beneath.
(sol_thread_files_info, sol_thread_kill_inferior): Delete.
(check_for_thread_db): New.
(sol_thread_notice_signals, sol_thread_create_inferior): Delete.
(sol_thread_new_objfile): Call check_for_thread_db.
(sol_thread_mourn_inferior): Adjust to use find_target_beneath.
(sol_thread_can_run): Delete.
(sol_thread_alive): Adjust to use find_target_beneath.
(sol_thread_stop): Delete.
(rw_common): Use target_write_memory or target_read_memory.
(ps_lgetregs, ps_lgetfpregs): Use target_fetch_registers.
(ps_lsetregs, ps_lsetfpregs): Use target_store_registers.
(solaris_pid_to_str): Remove check for libthread_db initialization
failing.
(sol_find_new_threads): Remove check for libthread_db
initialization failing, or for an invalid inferior_ptid. Adjust
to use find_target_beneath.
(sol_core_open, sol_core_close, sol_core_detach,
sol_core_files_info, sol_find_memory_regions,
sol_make_note_section, ignore): Delete.
(init_sol_thread_ops): Make it a thread_stratum target. Remove
unneeded callback settings.
(init_sol_core_ops): Delete.
(_initialize_sol_thread): No longer call init_sol_core_ops, set
procfs_suppress_run, or hack with core_ops.
* target.h (struct target_ops): Add a target_ops * parameter to
to_resume, to_fetch_registers, to_store_registers, to_thread_alive
and to_find_new_threads.
(target_fetch_registers, target_store_registers)
(target_thread_alive, target_find_new_threads): Redeclare as
function.
* target.c (update_current_target): Do not inherit or de_fault
to_resume, to_fetch_registers, to_store_registers,
to_thread_alive, to_find_new_threads.
(target_resume): Adjust.
(target_thread_alive, target_find_new_threads): New.
(debug_to_resume, debug_to_fetch_registers): Delete.
(target_fetch_registers): New.
(debug_to_store_registers): Delete.
(target_store_registers): New.
(debug_to_thread_alive, debug_to_find_new_threads): Delete.
(setup_target_debug): Adjust.
* gdbcore.h (core_ops): Delete declaration.
* inf-ptrace.c, linux-nat.c, remote.c, amd64-linux-nat.c,
inf-child.c, linux-thread-db.c, bsd-uthread.c, inf-ttrace.c,
i386-sol2-tdep.c, darwin-nat.c, gnu-nat.c, go32-nat.c,
hpux-thread.c, i386-linux-nat.c, i386fbsd-nat.c, monitor.c,
nto-procfs.c, remote-m32r-sdi.c, remote-mips.c, windows-nat.c,
alphabsd-nat.c, amd64bsd-nat.c, arm-linux-nat.c, armnbsd-nat.c,
bsd-kvm.c, hppa-hpux-nat.c, hppa-linux-nat.c, hppabsd-nat.c,
hppanbsd-nat.c, i386-darwin-nat.c, i386bsd-nat.c,
ia64-linux-nat.c, m32r-linux-nat.c, m68kbsd-nat.c,
m68klinux-nat.c, m88kbsd-nat.c, mips-linux-nat.c,
mips64obsd-nat.c, mipsnbsd-nat.c, ppc-linux-nat.c, ppcnbsd-nat.c,
ppcobsd-nat.c, remote-sim.c, rs6000-nat.c, s390-nat.c,
shnbsd-nat.c, sparc-nat.c, sparc-nat.h, spu-linux-nat.c,
vaxbsd-nat.c, xtensa-linux-nat.c: Adjust to target_ops changes.
* gdbarch.sh (core_pid_to_str): New gdbarch callback.
* gdbarch.h, gdbarch.c: Regenerate.
* sol2-tdep.c: Include "inferior.h".
(sol2_core_pid_to_str): New.
* sol2-tdep.h (sol2_core_pid_to_str): Declare.
* amd64-sol2-tdep.c (amd64_sol2_init_abi): Set it.
* sparc-sol2-tdep.c (sparc32_sol2_init_abi): Set it.
* sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Set it.
* i386-sol2-tdep.c (i386_sol2_init_abi): Set it.
2009-02-23 01:03:50 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_core_pid_to_str_p() = %d\n",
|
|
|
|
gdbarch_core_pid_to_str_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: core_pid_to_str = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->core_pid_to_str));
|
2007-09-10 23:14:11 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_core_read_description_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_core_read_description_p (gdbarch));
|
2007-09-10 23:14:11 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: core_read_description = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->core_read_description));
|
2016-01-18 18:49:23 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_core_thread_name_p() = %d\n",
|
|
|
|
gdbarch_core_thread_name_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: core_thread_name = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->core_thread_name));
|
2007-09-04 01:06:35 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_core_xfer_shared_libraries_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_core_xfer_shared_libraries_p (gdbarch));
|
2007-09-04 01:06:35 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: core_xfer_shared_libraries = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->core_xfer_shared_libraries));
|
ppc-aix core file relocation.
The current code attempts to provide relocation support when debugging
core files via the rs6000_xfer_partial method of the rs6000-nat
target_ops vector. However, this target_ops vector does not get pushed
on the target stack at all when debugging core files, thus bypassing
completely that part of the code.
This patch fixes the problem by extending corelow's core_xfer_partial
into handling the TARGET_OBJECT_LIBRARIES_AIX object.
gdb/ChangeLog:
* gdbarch.sh (core_xfer_shared_libraries_aix): New method.
* gdbarch.h, gdbarch.c: Regenerate.
* corelow.c (core_xfer_partial): Add TARGET_OBJECT_LIBRARIES_AIX
handling.
* rs6000-aix-tdep.h: New file.
* Makefile.in (HFILES_NO_SRCDIR): Add rs6000-aix-tdep.h.
* rs6000-aix-tdep.c: Include "rs6000-aix-tdep.h" and
"xml-utils.h".
(struct field_info, struct ld_info_desc): New types.
(ld_info32_desc, ld_info64_desc): New static constants.
(struct ld_info): New type.
(rs6000_aix_extract_ld_info): New function.
(rs6000_aix_shared_library_to_xml): Likewise.
(rs6000_aix_ld_info_to_xml): Likewise.
(rs6000_aix_core_xfer_shared_libraries_aix): Likewise.
(rs6000_aix_init_osabi): Add call to
set_gdbarch_core_xfer_shared_libraries_aix.
* rs6000-nat.c: Add "rs6000-aix-tdep.h" include.
Remove "xml-utils.h" include.
(LdInfo): Delete typedef.
(ARCH64_DECL, LDI_FIELD, LDI_NEXT, LDI_FD, LDI_FILENAME):
Delete macros.
(rs6000_ptrace_ldinfo): Change return type to gdb_byte *.
Adjust code accordingly.
(rs6000_core_ldinfo): Delete, folded into
rs6000_aix_core_xfer_shared_libraries_aix.
(rs6000_xfer_shared_library): Delete.
(rs6000_xfer_shared_libraries): Reimplement.
2013-05-15 14:26:14 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_core_xfer_shared_libraries_aix_p() = %d\n",
|
|
|
|
gdbarch_core_xfer_shared_libraries_aix_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: core_xfer_shared_libraries_aix = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->core_xfer_shared_libraries_aix));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2008-09-05 14:57:16 +02:00
|
|
|
"gdbarch_dump: decr_pc_after_break = %s\n",
|
|
|
|
core_addr_to_string_nz (gdbarch->decr_pc_after_break));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: deprecated_fp_regnum = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->deprecated_fp_regnum));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2008-09-05 14:57:16 +02:00
|
|
|
"gdbarch_dump: deprecated_function_start_offset = %s\n",
|
|
|
|
core_addr_to_string_nz (gdbarch->deprecated_function_start_offset));
|
2017-02-28 19:32:07 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: disassembler_options = %s\n",
|
2017-03-07 16:49:10 +01:00
|
|
|
pstring_ptr (gdbarch->disassembler_options));
|
Implement displaced stepping.
gdb/
* gdbarch.sh (max_insn_length): New 'variable'.
(displaced_step_copy, displaced_step_fixup)
(displaced_step_free_closure, displaced_step_location): New
functions.
(struct displaced_step_closure): Add forward declaration.
* gdbarch.c, gdbarch.h: Regenerated.
* arch-utils.c: #include "objfiles.h".
(simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New functions.
* arch-utils.h (simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New prototypes.
* i386-tdep.c (I386_MAX_INSN_LEN): Rename to...
(I386_MAX_MATCHED_INSN_LEN): ... this.
(i386_absolute_jmp_p, i386_absolute_call_p)
(i386_ret_p, i386_call_p, i386_breakpoint_p, i386_syscall_p)
(i386_displaced_step_fixup): New functions.
(struct i386_insn, i386_match_insn): Update.
(i386_gdbarch_init): Set gdbarch_max_insn_length.
* i386-tdep.h (I386_MAX_INSN_LEN): New.
(i386_displaced_step_fixup): New prototype.
* i386-linux-tdep.c (i386_linux_init_abi): Include "arch-utils.h".
Register gdbarch_displaced_step_copy,
gdbarch_displaced_step_fixup, gdbarch_displaced_step_free_closure,
and gdbarch_displaced_step_location functions.
* infrun.c (debug_displaced): New variable.
(show_debug_displaced): New function.
(struct displaced_step_request): New struct.
(displaced_step_request_queue, displaced_step_ptid)
(displaced_step_gdbarch, displaced_step_closure)
(displaced_step_original, displaced_step_copy)
(displaced_step_saved_copy, can_use_displaced_stepping): New
variables.
(show_can_use_displaced_stepping, use_displaced_stepping)
(displaced_step_clear, cleanup_displaced_step_closure)
(displaced_step_dump_bytes, displaced_step_prepare)
(displaced_step_clear_cleanup, write_memory_ptid)
(displaced_step_fixup): New functions.
(resume): Call displaced_step_prepare.
(proceed): Call read_pc once, and remember the value. If using
displaced stepping, don't remove breakpoints.
(handle_inferior_event): Call displaced_step_fixup. Add some
debugging output. When we try to step over a breakpoint, but get
a signal to deliver to the thread instead, ensure the step-resume
breakpoint is actually inserted. If a thread hop is needed, and
displaced stepping is enabled, don't remove breakpoints.
(init_wait_for_inferior): Call displaced_step_clear.
(_initialize_infrun): Add "set debug displaced" command. Add
"maint set can-use-displaced-stepping" command. Clear
displaced_step_ptid.
* inferior.h (debug_displaced): Declare variable.
(displaced_step_dump_bytes): Declare function.
* Makefile.in (arch-utils.o, i386-linux-tdep.o): Update
dependencies.
gdb/testsuite/
* gdb.asm/asmsrc1.s: Add scratch space.
gdb/doc/
* gdb.texinfo (Debugging Output): Document "set/show debug
displaced".
(Maintenance Commands): Document "maint set/show
can-use-displaced-stepping".
2008-05-02 18:49:54 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_displaced_step_copy_insn_p() = %d\n",
|
|
|
|
gdbarch_displaced_step_copy_insn_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: displaced_step_copy_insn = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->displaced_step_copy_insn));
|
Implement displaced stepping.
gdb/
* gdbarch.sh (max_insn_length): New 'variable'.
(displaced_step_copy, displaced_step_fixup)
(displaced_step_free_closure, displaced_step_location): New
functions.
(struct displaced_step_closure): Add forward declaration.
* gdbarch.c, gdbarch.h: Regenerated.
* arch-utils.c: #include "objfiles.h".
(simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New functions.
* arch-utils.h (simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New prototypes.
* i386-tdep.c (I386_MAX_INSN_LEN): Rename to...
(I386_MAX_MATCHED_INSN_LEN): ... this.
(i386_absolute_jmp_p, i386_absolute_call_p)
(i386_ret_p, i386_call_p, i386_breakpoint_p, i386_syscall_p)
(i386_displaced_step_fixup): New functions.
(struct i386_insn, i386_match_insn): Update.
(i386_gdbarch_init): Set gdbarch_max_insn_length.
* i386-tdep.h (I386_MAX_INSN_LEN): New.
(i386_displaced_step_fixup): New prototype.
* i386-linux-tdep.c (i386_linux_init_abi): Include "arch-utils.h".
Register gdbarch_displaced_step_copy,
gdbarch_displaced_step_fixup, gdbarch_displaced_step_free_closure,
and gdbarch_displaced_step_location functions.
* infrun.c (debug_displaced): New variable.
(show_debug_displaced): New function.
(struct displaced_step_request): New struct.
(displaced_step_request_queue, displaced_step_ptid)
(displaced_step_gdbarch, displaced_step_closure)
(displaced_step_original, displaced_step_copy)
(displaced_step_saved_copy, can_use_displaced_stepping): New
variables.
(show_can_use_displaced_stepping, use_displaced_stepping)
(displaced_step_clear, cleanup_displaced_step_closure)
(displaced_step_dump_bytes, displaced_step_prepare)
(displaced_step_clear_cleanup, write_memory_ptid)
(displaced_step_fixup): New functions.
(resume): Call displaced_step_prepare.
(proceed): Call read_pc once, and remember the value. If using
displaced stepping, don't remove breakpoints.
(handle_inferior_event): Call displaced_step_fixup. Add some
debugging output. When we try to step over a breakpoint, but get
a signal to deliver to the thread instead, ensure the step-resume
breakpoint is actually inserted. If a thread hop is needed, and
displaced stepping is enabled, don't remove breakpoints.
(init_wait_for_inferior): Call displaced_step_clear.
(_initialize_infrun): Add "set debug displaced" command. Add
"maint set can-use-displaced-stepping" command. Clear
displaced_step_ptid.
* inferior.h (debug_displaced): Declare variable.
(displaced_step_dump_bytes): Declare function.
* Makefile.in (arch-utils.o, i386-linux-tdep.o): Update
dependencies.
gdb/testsuite/
* gdb.asm/asmsrc1.s: Add scratch space.
gdb/doc/
* gdb.texinfo (Debugging Output): Document "set/show debug
displaced".
(Maintenance Commands): Document "maint set/show
can-use-displaced-stepping".
2008-05-02 18:49:54 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_displaced_step_fixup_p() = %d\n",
|
|
|
|
gdbarch_displaced_step_fixup_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: displaced_step_fixup = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->displaced_step_fixup));
|
Implement displaced stepping.
gdb/
* gdbarch.sh (max_insn_length): New 'variable'.
(displaced_step_copy, displaced_step_fixup)
(displaced_step_free_closure, displaced_step_location): New
functions.
(struct displaced_step_closure): Add forward declaration.
* gdbarch.c, gdbarch.h: Regenerated.
* arch-utils.c: #include "objfiles.h".
(simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New functions.
* arch-utils.h (simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New prototypes.
* i386-tdep.c (I386_MAX_INSN_LEN): Rename to...
(I386_MAX_MATCHED_INSN_LEN): ... this.
(i386_absolute_jmp_p, i386_absolute_call_p)
(i386_ret_p, i386_call_p, i386_breakpoint_p, i386_syscall_p)
(i386_displaced_step_fixup): New functions.
(struct i386_insn, i386_match_insn): Update.
(i386_gdbarch_init): Set gdbarch_max_insn_length.
* i386-tdep.h (I386_MAX_INSN_LEN): New.
(i386_displaced_step_fixup): New prototype.
* i386-linux-tdep.c (i386_linux_init_abi): Include "arch-utils.h".
Register gdbarch_displaced_step_copy,
gdbarch_displaced_step_fixup, gdbarch_displaced_step_free_closure,
and gdbarch_displaced_step_location functions.
* infrun.c (debug_displaced): New variable.
(show_debug_displaced): New function.
(struct displaced_step_request): New struct.
(displaced_step_request_queue, displaced_step_ptid)
(displaced_step_gdbarch, displaced_step_closure)
(displaced_step_original, displaced_step_copy)
(displaced_step_saved_copy, can_use_displaced_stepping): New
variables.
(show_can_use_displaced_stepping, use_displaced_stepping)
(displaced_step_clear, cleanup_displaced_step_closure)
(displaced_step_dump_bytes, displaced_step_prepare)
(displaced_step_clear_cleanup, write_memory_ptid)
(displaced_step_fixup): New functions.
(resume): Call displaced_step_prepare.
(proceed): Call read_pc once, and remember the value. If using
displaced stepping, don't remove breakpoints.
(handle_inferior_event): Call displaced_step_fixup. Add some
debugging output. When we try to step over a breakpoint, but get
a signal to deliver to the thread instead, ensure the step-resume
breakpoint is actually inserted. If a thread hop is needed, and
displaced stepping is enabled, don't remove breakpoints.
(init_wait_for_inferior): Call displaced_step_clear.
(_initialize_infrun): Add "set debug displaced" command. Add
"maint set can-use-displaced-stepping" command. Clear
displaced_step_ptid.
* inferior.h (debug_displaced): Declare variable.
(displaced_step_dump_bytes): Declare function.
* Makefile.in (arch-utils.o, i386-linux-tdep.o): Update
dependencies.
gdb/testsuite/
* gdb.asm/asmsrc1.s: Add scratch space.
gdb/doc/
* gdb.texinfo (Debugging Output): Document "set/show debug
displaced".
(Maintenance Commands): Document "maint set/show
can-use-displaced-stepping".
2008-05-02 18:49:54 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: displaced_step_free_closure = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->displaced_step_free_closure));
|
2009-09-29 02:53:04 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: displaced_step_hw_singlestep = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->displaced_step_hw_singlestep));
|
Implement displaced stepping.
gdb/
* gdbarch.sh (max_insn_length): New 'variable'.
(displaced_step_copy, displaced_step_fixup)
(displaced_step_free_closure, displaced_step_location): New
functions.
(struct displaced_step_closure): Add forward declaration.
* gdbarch.c, gdbarch.h: Regenerated.
* arch-utils.c: #include "objfiles.h".
(simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New functions.
* arch-utils.h (simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New prototypes.
* i386-tdep.c (I386_MAX_INSN_LEN): Rename to...
(I386_MAX_MATCHED_INSN_LEN): ... this.
(i386_absolute_jmp_p, i386_absolute_call_p)
(i386_ret_p, i386_call_p, i386_breakpoint_p, i386_syscall_p)
(i386_displaced_step_fixup): New functions.
(struct i386_insn, i386_match_insn): Update.
(i386_gdbarch_init): Set gdbarch_max_insn_length.
* i386-tdep.h (I386_MAX_INSN_LEN): New.
(i386_displaced_step_fixup): New prototype.
* i386-linux-tdep.c (i386_linux_init_abi): Include "arch-utils.h".
Register gdbarch_displaced_step_copy,
gdbarch_displaced_step_fixup, gdbarch_displaced_step_free_closure,
and gdbarch_displaced_step_location functions.
* infrun.c (debug_displaced): New variable.
(show_debug_displaced): New function.
(struct displaced_step_request): New struct.
(displaced_step_request_queue, displaced_step_ptid)
(displaced_step_gdbarch, displaced_step_closure)
(displaced_step_original, displaced_step_copy)
(displaced_step_saved_copy, can_use_displaced_stepping): New
variables.
(show_can_use_displaced_stepping, use_displaced_stepping)
(displaced_step_clear, cleanup_displaced_step_closure)
(displaced_step_dump_bytes, displaced_step_prepare)
(displaced_step_clear_cleanup, write_memory_ptid)
(displaced_step_fixup): New functions.
(resume): Call displaced_step_prepare.
(proceed): Call read_pc once, and remember the value. If using
displaced stepping, don't remove breakpoints.
(handle_inferior_event): Call displaced_step_fixup. Add some
debugging output. When we try to step over a breakpoint, but get
a signal to deliver to the thread instead, ensure the step-resume
breakpoint is actually inserted. If a thread hop is needed, and
displaced stepping is enabled, don't remove breakpoints.
(init_wait_for_inferior): Call displaced_step_clear.
(_initialize_infrun): Add "set debug displaced" command. Add
"maint set can-use-displaced-stepping" command. Clear
displaced_step_ptid.
* inferior.h (debug_displaced): Declare variable.
(displaced_step_dump_bytes): Declare function.
* Makefile.in (arch-utils.o, i386-linux-tdep.o): Update
dependencies.
gdb/testsuite/
* gdb.asm/asmsrc1.s: Add scratch space.
gdb/doc/
* gdb.texinfo (Debugging Output): Document "set/show debug
displaced".
(Maintenance Commands): Document "maint set/show
can-use-displaced-stepping".
2008-05-02 18:49:54 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: displaced_step_location = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->displaced_step_location));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: double_bit = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->double_bit));
|
2004-06-21 02:17:02 +02:00
|
|
|
fprintf_unfiltered (file,
|
2004-06-21 19:54:57 +02:00
|
|
|
"gdbarch_dump: double_format = %s\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
pformat (gdbarch->double_format));
|
2015-02-17 15:54:44 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_dtrace_disable_probe_p() = %d\n",
|
|
|
|
gdbarch_dtrace_disable_probe_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: dtrace_disable_probe = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->dtrace_disable_probe));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_dtrace_enable_probe_p() = %d\n",
|
|
|
|
gdbarch_dtrace_enable_probe_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: dtrace_enable_probe = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->dtrace_enable_probe));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_dtrace_parse_probe_argument_p() = %d\n",
|
|
|
|
gdbarch_dtrace_parse_probe_argument_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: dtrace_parse_probe_argument = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->dtrace_parse_probe_argument));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_dtrace_probe_is_enabled_p() = %d\n",
|
|
|
|
gdbarch_dtrace_probe_is_enabled_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: dtrace_probe_is_enabled = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->dtrace_probe_is_enabled));
|
Convert frame unwinders to use the current frame and
"struct value".
* frame.c (frame_debug): Make global.
(get_frame_id): Pass this frame to unwinder routines.
(frame_pc_unwind): Remove unused unwind->prev_pc support.
(do_frame_register_read): Do not discard the return value of
frame_register_read.
(frame_register_unwind): Remove debug messages. Use
frame_unwind_register_value.
(frame_unwind_register_value, get_frame_register_value): New
functions.
(create_new_frame, get_frame_base_address, get_frame_locals_address)
(get_frame_args_address, get_frame_type): Pass this frame to
unwinder routines.
(frame_cleanup_after_sniffer, frame_prepare_for_sniffer): New
functions.
* frame.h: Update comments.
(frame_debug, frame_unwind_register_value, get_frame_register_value)
(frame_prepare_for_sniffer): Declare.
* frame-unwind.h: Update comments and parameter names.
(default_frame_sniffer): Declare.
(frame_prev_register_ftype): Return a struct value *.
(struct frame_unwind): Remove prev_pc member.
(frame_unwind_sniffer_ftype, frame_unwind_append_sniffer): Delete.
(frame_unwind_append_unwinder, frame_unwind_got_optimized)
(frame_unwind_got_register, frame_unwind_got_memory)
(frame_unwind_got_constant, frame_unwind_got_address): Declare.
* frame-base.h: Update comments and parameter names.
* valops.c (value_fetch_lazy): Use get_frame_register_value. Iterate
if necessary. Add debugging output.
* sentinel-frame.c (sentinel_frame_prev_register)
(sentinel_frame_this_id): Update for new signature.
(sentinel_frame_prev_pc): Delete.
(sentinel_frame_unwinder): Remove prev_pc.
* ia64-tdep.c (ia64_libunwind_frame_unwind): Do not initialize
prev_pc.
* libunwind-frame.c (libunwind_frame_unwind): Likewise.
* frame-unwind.c (struct frame_unwind_table_entry): Remove sniffer.
(frame_unwind_append_sniffer): Delete.
(frame_unwind_append_unwinder): New function.
(frame_unwind_find_by_frame): Take this frame. Only use sniffers
from unwinders. Use frame_prepare_for_sniffer.
(default_frame_sniffer, frame_unwind_got_optimized)
(frame_unwind_got_register, frame_unwind_got_memory)
(frame_unwind_got_constant, frame_unwind_got_address): New functions.
* dummy-frame.c (dummy_frame_sniffer): Use gdbarch_dummy_id.
(dummy_frame_prev_register, dummy_frame_this_id): Update for new
signature.
* gdbarch.sh: Replace unwind_dummy_id with dummy_id.
* gdbarch.c, gdbarch.c: Regenerated.
* frame-base.c (default_frame_base_address)
(default_frame_locals_address, default_frame_args_address): Update
for new signature.
(frame_base_find_by_frame): Pass this frame to unwinder routines.
* infcall.c (call_function_by_hand): Update comments.
* Makefile.in (frame-unwind.o): Update dependencies.
* gdbint.texinfo (Stack Frames): New chapter.
(Algorithms): Move Frames text to the new chapter.
(Target Conditionals): Delete SAVE_DUMMY_FRAME_TOS. Document
gdbarch_dummy_id instead of gdbarch_unwind_dummy_id.
2008-04-30 23:16:46 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_dummy_id_p() = %d\n",
|
|
|
|
gdbarch_dummy_id_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: dummy_id = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->dummy_id));
|
2010-08-06 21:02:15 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: dwarf2_addr_size = %s\n",
|
|
|
|
plongest (gdbarch->dwarf2_addr_size));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: dwarf2_reg_to_regnum = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->dwarf2_reg_to_regnum));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: ecoff_reg_to_regnum = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->ecoff_reg_to_regnum));
|
MIPS: Keep the ISA bit in compressed code addresses
1. Background information
The MIPS architecture, as originally designed and implemented in
mid-1980s has a uniform instruction word size that is 4 bytes, naturally
aligned. As such all MIPS instructions are located at addresses that
have their bits #1 and #0 set to zeroes, and any attempt to execute an
instruction from an address that has any of the two bits set to one
causes an address error exception. This may for example happen when a
jump-register instruction is executed whose register value used as the
jump target has any of these bits set.
Then in mid 1990s LSI sought a way to improve code density for their
TinyRISC family of MIPS cores and invented an alternatively encoded
instruction set in a joint effort with MIPS Technologies (then a
subsidiary of SGI). The new instruction set has been named the MIPS16
ASE (Application-Specific Extension) and uses a variable instruction
word size, which is 2 bytes (as the name of the ASE suggests) for most,
but there are a couple of exceptions that take 4 bytes, and then most of
the 2-byte instructions can be treated with a 2-byte extension prefix to
expand the range of the immediate operands used.
As a result instructions are no longer 4-byte aligned, instead they are
aligned to a multiple of 2. That left the bit #0 still unused for code
references, be it for the standard MIPS (i.e. as originally invented) or
for the MIPS16 instruction set, and based on that observation a clever
trick was invented that on one hand allowed the processor to be
seamlessly switched between the two instruction sets at any time at the
run time while on the other avoided the introduction of any special
control register to do that.
So it is the bit #0 of the instruction address that was chosen as the
selector and named the ISA bit. Any instruction executed at an even
address is interpreted as a standard MIPS instruction (the address still
has to have its bit #1 clear), any instruction executed at an odd
address is interpreted as a MIPS16 instruction.
To switch between modes ordinary jump instructions are used, such as
used for function calls and returns, specifically the bit #0 of the
source register used in jump-register instructions selects the execution
(ISA) mode for the following piece of code to be interpreted in.
Additionally new jump-immediate instructions were added that flipped the
ISA bit to select the opposite mode upon execution. They were
considered necessary to avoid the need to make register jumps in all
cases as the original jump-immediate instructions provided no way to
change the bit #0 at all.
This was all important for cases where standard MIPS and MIPS16 code had
to be mixed, either for compatibility with the existing binary code base
or to access resources not reachable from MIPS16 code (the MIPS16
instruction set only provides access to general-purpose registers, and
not for example floating-point unit registers or privileged coprocessor
0 registers) -- pieces of code in the opposite mode can be executed as
ordinary subroutine calls.
A similar approach has been more recently adopted for the MIPS16
replacement instruction set defined as the so called microMIPS ASE.
This is another instruction set encoding introduced to the MIPS
architecture. Just like the MIPS16 ASE, the microMIPS instruction set
uses a variable-length encoding, where each instruction takes a multiple
of 2 bytes. The ISA bit has been reused and for microMIPS-capable
processors selects between the standard MIPS and the microMIPS mode
instead.
2. Statement of the problem
To put it shortly, MIPS16 and microMIPS code pointers used by GDB are
different to these observed at the run time. This results in the same
expressions being evaluated producing different results in GDB and in
the program being debugged. Obviously it's the results obtained at the
run time that are correct (they define how the program behaves) and
therefore by definition the results obtained in GDB are incorrect.
A bit longer description will record that obviously at the run time the
ISA bit has to be set correctly (refer to background information above
if unsure why so) or the program will not run as expected. This is
recorded in all the executable file structures used at the run time: the
dynamic symbol table (but not always the static one!), the GOT, and
obviously in all the addresses embedded in code or data of the program
itself, calculated by applying the appropriate relocations at the static
link time.
While a program is being processed by GDB, the ISA bit is stripped off
from any code addresses, presumably to make them the same as the
respective raw memory byte address used by the processor to access the
instruction in the instruction fetch access cycle. This stripping is
actually performed outside GDB proper, in BFD, specifically
_bfd_mips_elf_symbol_processing (elfxx-mips.c, see the piece of code at
the very bottom of that function, starting with an: "If this is an
odd-valued function symbol, assume it's a MIPS16 or microMIPS one."
comment).
This function is also responsible for symbol table dumps made by
`objdump' too, so you'll never see the ISA bit reported there by that
tool, you need to use `readelf'.
This is however unlike what is ever done at the run time, the ISA bit
once present is never stripped off, for example a cast like this:
(short *) main
will not strip the ISA bit off and if the resulting pointer is intended
to be used to access instructions as data, for example for software
instruction decoding (like for fault recovery or emulation in a signal
handler) or for self-modifying code then the bit still has to be
stripped off by an explicit AND operation.
This is probably best illustrated with a simple real program example.
Let's consider the following simple program:
$ cat foobar.c
int __attribute__ ((mips16)) foo (void)
{
return 1;
}
int __attribute__ ((mips16)) bar (void)
{
return 2;
}
int __attribute__ ((nomips16)) foo32 (void)
{
return 3;
}
int (*foo32p) (void) = foo32;
int (*foop) (void) = foo;
int fooi = (int) foo;
int
main (void)
{
return foop ();
}
$
This is plain C with no odd tricks, except from the instruction mode
attributes. They are not necessary to trigger this problem, I just put
them here so that the program can be contained in a single source file
and to make it obvious which function is MIPS16 code and which is not.
Let's try it with Linux, so that everyone can repeat this experiment:
$ mips-linux-gnu-gcc -mips16 -g -O2 -o foobar foobar.c
$
Let's have a look at some interesting symbols:
$ mips-linux-gnu-readelf -s foobar | egrep 'table|foo|bar'
Symbol table '.dynsym' contains 7 entries:
Symbol table '.symtab' contains 95 entries:
55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c
66: 0040068c 4 FUNC GLOBAL DEFAULT [MIPS16] 12 bar
68: 00410848 4 OBJECT GLOBAL DEFAULT 21 foo32p
70: 00410844 4 OBJECT GLOBAL DEFAULT 21 foop
78: 00400684 8 FUNC GLOBAL DEFAULT 12 foo32
80: 00400680 4 FUNC GLOBAL DEFAULT [MIPS16] 12 foo
88: 00410840 4 OBJECT GLOBAL DEFAULT 21 fooi
$
Hmm, no sight of the ISA bit, but notice how foo and bar (but not
foo32!) have been marked as MIPS16 functions (ELF symbol structure's
`st_other' field is used for that).
So let's try to run and poke at this program with GDB. I'll be using a
native system for simplicity (I'll be using ellipses here and there to
remove unrelated clutter):
$ ./foobar
$ echo $?
1
$
So far, so good.
$ gdb ./foobar
[...]
(gdb) break main
Breakpoint 1 at 0x400490: file foobar.c, line 23.
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb)
Yay, it worked! OK, so let's poke at it:
(gdb) print main
$1 = {int (void)} 0x400490 <main>
(gdb) print foo32
$2 = {int (void)} 0x400684 <foo32>
(gdb) print foo32p
$3 = (int (*)(void)) 0x400684 <foo32>
(gdb) print bar
$4 = {int (void)} 0x40068c <bar>
(gdb) print foo
$5 = {int (void)} 0x400680 <foo>
(gdb) print foop
$6 = (int (*)(void)) 0x400681 <foo>
(gdb)
A-ha! Here's the difference and finally the ISA bit!
(gdb) print /x fooi
$7 = 0x400681
(gdb) p/x $pc
p/x $pc
$8 = 0x400491
(gdb)
And here as well...
(gdb) advance foo
foo () at foobar.c:4
4 }
(gdb) disassemble
Dump of assembler code for function foo:
0x00400680 <+0>: jr ra
0x00400682 <+2>: li v0,1
End of assembler dump.
(gdb) finish
Run till exit from #0 foo () at foobar.c:4
main () at foobar.c:24
24 }
Value returned is $9 = 1
(gdb) continue
Continuing.
[Inferior 1 (process 14103) exited with code 01]
(gdb)
So let's be a bit inquisitive...
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb)
Actually we do not like to run foo here at all. Let's run bar instead!
(gdb) set foop = bar
(gdb) print foop
$10 = (int (*)(void)) 0x40068c <bar>
(gdb)
Hmm, no ISA bit. Is it going to work?
(gdb) advance bar
bar () at foobar.c:9
9 }
(gdb) p/x $pc
$11 = 0x40068c
(gdb) disassemble
Dump of assembler code for function bar:
=> 0x0040068c <+0>: jr ra
0x0040068e <+2>: li v0,2
End of assembler dump.
(gdb) finish
Run till exit from #0 bar () at foobar.c:9
Program received signal SIGILL, Illegal instruction.
bar () at foobar.c:9
9 }
(gdb)
Oops!
(gdb) p/x $pc
$12 = 0x40068c
(gdb)
We're still there!
(gdb) continue
Continuing.
Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb)
So let's try something else:
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) set foop = foo
(gdb) advance foo
foo () at foobar.c:4
4 }
(gdb) disassemble
Dump of assembler code for function foo:
=> 0x00400680 <+0>: jr ra
0x00400682 <+2>: li v0,1
End of assembler dump.
(gdb) finish
Run till exit from #0 foo () at foobar.c:4
Program received signal SIGILL, Illegal instruction.
foo () at foobar.c:4
4 }
(gdb) continue
Continuing.
Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb)
The same problem!
(gdb) run
Starting program:
/net/build2-lucid-cs/scratch/macro/mips-linux-fsf-gcc/isa-bit/foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) set foop = foo32
(gdb) advance foo32
foo32 () at foobar.c:14
14 }
(gdb) disassemble
Dump of assembler code for function foo32:
=> 0x00400684 <+0>: jr ra
0x00400688 <+4>: li v0,3
End of assembler dump.
(gdb) finish
Run till exit from #0 foo32 () at foobar.c:14
main () at foobar.c:24
24 }
Value returned is $14 = 3
(gdb) continue
Continuing.
[Inferior 1 (process 14113) exited with code 03]
(gdb)
That did work though, so it's the ISA bit only!
(gdb) quit
Enough!
That's the tip of the iceberg only though. So let's rebuild the
executable with some dynamic symbols:
$ mips-linux-gnu-gcc -mips16 -Wl,--export-dynamic -g -O2 -o foobar-dyn foobar.c
$ mips-linux-gnu-readelf -s foobar-dyn | egrep 'table|foo|bar'
Symbol table '.dynsym' contains 32 entries:
6: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar
8: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p
9: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop
15: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32
17: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo
25: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi
Symbol table '.symtab' contains 95 entries:
55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c
69: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar
71: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p
72: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop
79: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32
81: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo
89: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi
$
OK, now the ISA bit is there for a change, but the MIPS16 `st_other'
attribute gone, hmm... What does `objdump' do then:
$ mips-linux-gnu-objdump -Tt foobar-dyn | egrep 'SYMBOL|foo|bar'
foobar-dyn: file format elf32-tradbigmips
SYMBOL TABLE:
00000000 l df *ABS* 00000000 foobar.c
004009cc g F .text 00000004 0xf0 bar
00410b88 g O .data 00000004 foo32p
00410b84 g O .data 00000004 foop
004009c4 g F .text 00000008 foo32
004009c0 g F .text 00000004 0xf0 foo
00410b80 g O .data 00000004 fooi
DYNAMIC SYMBOL TABLE:
004009cc g DF .text 00000004 Base 0xf0 bar
00410b88 g DO .data 00000004 Base foo32p
00410b84 g DO .data 00000004 Base foop
004009c4 g DF .text 00000008 Base foo32
004009c0 g DF .text 00000004 Base 0xf0 foo
00410b80 g DO .data 00000004 Base fooi
$
Hmm, the attribute (0xf0, printed raw) is back, and the ISA bit gone
again.
Let's have a look at some DWARF-2 records GDB uses (I'll be stripping
off a lot here for brevity) -- debug info:
$ mips-linux-gnu-readelf -wi foobar
Contents of the .debug_info section:
[...]
Compilation Unit @ offset 0x88:
Length: 0xbb (32-bit)
Version: 4
Abbrev Offset: 62
Pointer Size: 4
<0><93>: Abbrev Number: 1 (DW_TAG_compile_unit)
<94> DW_AT_producer : (indirect string, offset: 0x19e): GNU C 4.8.0 20120513 (experimental) -meb -mips16 -march=mips32r2 -mhard-float -mllsc -mplt -mno-synci -mno-shared -mabi=32 -g -O2
<98> DW_AT_language : 1 (ANSI C)
<99> DW_AT_name : (indirect string, offset: 0x190): foobar.c
<9d> DW_AT_comp_dir : (indirect string, offset: 0x225): [...]
<a1> DW_AT_ranges : 0x0
<a5> DW_AT_low_pc : 0x0
<a9> DW_AT_stmt_list : 0x27
<1><ad>: Abbrev Number: 2 (DW_TAG_subprogram)
<ae> DW_AT_external : 1
<ae> DW_AT_name : foo
<b2> DW_AT_decl_file : 1
<b3> DW_AT_decl_line : 1
<b4> DW_AT_prototyped : 1
<b4> DW_AT_type : <0xc2>
<b8> DW_AT_low_pc : 0x400680
<bc> DW_AT_high_pc : 0x400684
<c0> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<c2> DW_AT_GNU_all_call_sites: 1
<1><c2>: Abbrev Number: 3 (DW_TAG_base_type)
<c3> DW_AT_byte_size : 4
<c4> DW_AT_encoding : 5 (signed)
<c5> DW_AT_name : int
<1><c9>: Abbrev Number: 4 (DW_TAG_subprogram)
<ca> DW_AT_external : 1
<ca> DW_AT_name : (indirect string, offset: 0x18a): foo32
<ce> DW_AT_decl_file : 1
<cf> DW_AT_decl_line : 11
<d0> DW_AT_prototyped : 1
<d0> DW_AT_type : <0xc2>
<d4> DW_AT_low_pc : 0x400684
<d8> DW_AT_high_pc : 0x40068c
<dc> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<de> DW_AT_GNU_all_call_sites: 1
<1><de>: Abbrev Number: 2 (DW_TAG_subprogram)
<df> DW_AT_external : 1
<df> DW_AT_name : bar
<e3> DW_AT_decl_file : 1
<e4> DW_AT_decl_line : 6
<e5> DW_AT_prototyped : 1
<e5> DW_AT_type : <0xc2>
<e9> DW_AT_low_pc : 0x40068c
<ed> DW_AT_high_pc : 0x400690
<f1> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<f3> DW_AT_GNU_all_call_sites: 1
<1><f3>: Abbrev Number: 5 (DW_TAG_subprogram)
<f4> DW_AT_external : 1
<f4> DW_AT_name : (indirect string, offset: 0x199): main
<f8> DW_AT_decl_file : 1
<f9> DW_AT_decl_line : 21
<fa> DW_AT_prototyped : 1
<fa> DW_AT_type : <0xc2>
<fe> DW_AT_low_pc : 0x400490
<102> DW_AT_high_pc : 0x4004a4
<106> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<108> DW_AT_GNU_all_tail_call_sites: 1
[...]
$
-- no sign of the ISA bit anywhere -- frame info:
$ mips-linux-gnu-readelf -wf foobar
[...]
Contents of the .debug_frame section:
00000000 0000000c ffffffff CIE
Version: 1
Augmentation: ""
Code alignment factor: 1
Data alignment factor: -4
Return address column: 31
DW_CFA_def_cfa_register: r29
DW_CFA_nop
00000010 0000000c 00000000 FDE cie=00000000 pc=00400680..00400684
00000020 0000000c 00000000 FDE cie=00000000 pc=00400684..0040068c
00000030 0000000c 00000000 FDE cie=00000000 pc=0040068c..00400690
00000040 00000018 00000000 FDE cie=00000000 pc=00400490..004004a4
DW_CFA_advance_loc: 6 to 00400496
DW_CFA_def_cfa_offset: 32
DW_CFA_offset: r31 at cfa-4
DW_CFA_advance_loc: 6 to 0040049c
DW_CFA_restore: r31
DW_CFA_def_cfa_offset: 0
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
[...]
$
-- no sign of the ISA bit anywhere -- range info (GDB doesn't use arange):
$ mips-linux-gnu-readelf -wR foobar
Contents of the .debug_ranges section:
Offset Begin End
00000000 00400680 00400690
00000000 00400490 004004a4
00000000 <End of list>
$
-- no sign of the ISA bit anywhere -- line info:
$ mips-linux-gnu-readelf -wl foobar
Raw dump of debug contents of section .debug_line:
[...]
Offset: 0x27
Length: 78
DWARF Version: 2
Prologue Length: 31
Minimum Instruction Length: 1
Initial value of 'is_stmt': 1
Line Base: -5
Line Range: 14
Opcode Base: 13
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 args
Opcode 3 has 1 args
Opcode 4 has 1 args
Opcode 5 has 1 args
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 args
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 args
The Directory Table is empty.
The File Name Table:
Entry Dir Time Size Name
1 0 0 0 foobar.c
Line Number Statements:
Extended opcode 2: set Address to 0x400681
Special opcode 6: advance Address by 0 to 0x400681 and Line by 1 to 2
Special opcode 7: advance Address by 0 to 0x400681 and Line by 2 to 4
Special opcode 55: advance Address by 3 to 0x400684 and Line by 8 to 12
Special opcode 7: advance Address by 0 to 0x400684 and Line by 2 to 14
Advance Line by -7 to 7
Special opcode 131: advance Address by 9 to 0x40068d and Line by 0 to 7
Special opcode 7: advance Address by 0 to 0x40068d and Line by 2 to 9
Advance PC by 3 to 0x400690
Extended opcode 1: End of Sequence
Extended opcode 2: set Address to 0x400491
Advance Line by 21 to 22
Copy
Special opcode 6: advance Address by 0 to 0x400491 and Line by 1 to 23
Special opcode 60: advance Address by 4 to 0x400495 and Line by -1 to 22
Special opcode 34: advance Address by 2 to 0x400497 and Line by 1 to 23
Special opcode 62: advance Address by 4 to 0x40049b and Line by 1 to 24
Special opcode 32: advance Address by 2 to 0x40049d and Line by -1 to 23
Special opcode 6: advance Address by 0 to 0x40049d and Line by 1 to 24
Advance PC by 7 to 0x4004a4
Extended opcode 1: End of Sequence
[...]
-- a-ha, the ISA bit is there! However it's not always right for some
reason, I don't have a small test case to show it, but here's an excerpt
from MIPS16 libc, a prologue of a function:
00019630 <__libc_init_first>:
19630: e8a0 jrc ra
19632: 6500 nop
00019634 <_init>:
19634: f000 6a11 li v0,17
19638: f7d8 0b08 la v1,15e00 <_DYNAMIC+0x15c54>
1963c: f400 3240 sll v0,16
19640: e269 addu v0,v1
19642: 659a move gp,v0
19644: 64f6 save 48,ra,s0-s1
19646: 671c move s0,gp
19648: d204 sw v0,16(sp)
1964a: f352 984c lw v0,-27828(s0)
1964e: 6724 move s1,a0
and the corresponding DWARF-2 line info:
Line Number Statements:
Extended opcode 2: set Address to 0x19631
Advance Line by 44 to 45
Copy
Special opcode 8: advance Address by 0 to 0x19631 and Line by 3 to 48
Special opcode 66: advance Address by 4 to 0x19635 and Line by 5 to 53
Advance PC by constant 17 to 0x19646
Special opcode 25: advance Address by 1 to 0x19647 and Line by 6 to 59
Advance Line by -6 to 53
Special opcode 33: advance Address by 2 to 0x19649 and Line by 0 to 53
Special opcode 39: advance Address by 2 to 0x1964b and Line by 6 to 59
Advance Line by -6 to 53
Special opcode 61: advance Address by 4 to 0x1964f and Line by 0 to 53
-- see that "Advance PC by constant 17" there? It clears the ISA bit,
however code at 0x19646 is not standard MIPS code at all. For some
reason the constant is always 17, I've never seen DW_LNS_const_add_pc
used with any other value -- is that a binutils bug or what?
3. Solution:
I think we should retain the value of the ISA bit in code references,
that is effectively treat them as cookies as they indeed are (although
trivially calculated) rather than raw memory byte addresses.
In a perfect world both the static symbol table and the respective
DWARF-2 records should be fixed to include the ISA bit in all the cases.
I think however that this is infeasible.
All the uses of `_bfd_mips_elf_symbol_processing' can not necessarily be
tracked down. This function is used by `elf_slurp_symbol_table' that in
turn is used by `bfd_canonicalize_symtab' and
`bfd_canonicalize_dynamic_symtab', which are public interfaces.
Similarly DWARF-2 records are used outside GDB, one notable if a bit
questionable is the exception unwinder (libgcc/unwind-dw2.c) -- I have
identified at least bits in `execute_cfa_program' and
`uw_frame_state_for', both around the calls to `_Unwind_IsSignalFrame',
that would need an update as they effectively flip the ISA bit freely;
see also the comment about MASK_RETURN_ADDR in gcc/config/mips/mips.h.
But there may be more places. Any change in how DWARF-2 records are
produced would require an update there and would cause compatibility
problems with libgcc.a binaries already distributed; given that this is
a static library a complex change involving function renames would
likely be required.
I propose therefore to accept the existing inconsistencies and deal with
them entirely within GDB. I have figured out that the ISA bit lost in
various places can still be recovered as long as we have symbol
information -- that'll have the `st_other' attribute correctly set to
one of standard MIPS/MIPS16/microMIPS encoding.
Here's the resulting change. It adds a couple of new `gdbarch' hooks,
one to update symbol information with the ISA bit lost in
`_bfd_mips_elf_symbol_processing', and two other ones to adjust DWARF-2
records as they're processed. The ISA bit is set in each address
handled according to information retrieved from the symbol table for the
symbol spanning the address if any; limits are adjusted based on the
address they point to related to the respective base address.
Additionally minimal symbol information has to be adjusted accordingly
in its gdbarch hook.
With these changes in place some complications with ISA bit juggling in
the PC that never fully worked can be removed from the MIPS backend.
Conversely, the generic dynamic linker event special breakpoint symbol
handler has to be updated to call the minimal symbol gdbarch hook to
record that the symbol is a MIPS16 or microMIPS address if applicable or
the breakpoint will be set at the wrong address and either fail to work
or cause SIGTRAPs (this is because the symbol is handled early on and
bypasses regular symbol processing).
4. Results obtained
The change fixes the example above -- to repeat only the crucial steps:
(gdb) break main
Breakpoint 1 at 0x400491: file foobar.c, line 23.
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) print foo
$1 = {int (void)} 0x400681 <foo>
(gdb) set foop = bar
(gdb) advance bar
bar () at foobar.c:9
9 }
(gdb) disassemble
Dump of assembler code for function bar:
=> 0x0040068d <+0>: jr ra
0x0040068f <+2>: li v0,2
End of assembler dump.
(gdb) finish
Run till exit from #0 bar () at foobar.c:9
main () at foobar.c:24
24 }
Value returned is $2 = 2
(gdb) continue
Continuing.
[Inferior 1 (process 14128) exited with code 02]
(gdb)
-- excellent!
The change removes about 90 failures per MIPS16 multilib in mips-sde-elf
testing too, results for MIPS16 are now similar to that for standard
MIPS; microMIPS results are a bit worse because of host-I/O problems in
QEMU used instead of MIPSsim for microMIPS testing only:
=== gdb Summary ===
# of expected passes 14299
# of unexpected failures 187
# of expected failures 56
# of known failures 58
# of unresolved testcases 11
# of untested testcases 52
# of unsupported tests 174
MIPS16:
=== gdb Summary ===
# of expected passes 14298
# of unexpected failures 187
# of unexpected successes 2
# of expected failures 54
# of known failures 58
# of unresolved testcases 12
# of untested testcases 52
# of unsupported tests 174
microMIPS:
=== gdb Summary ===
# of expected passes 14149
# of unexpected failures 201
# of unexpected successes 2
# of expected failures 54
# of known failures 58
# of unresolved testcases 7
# of untested testcases 53
# of unsupported tests 175
2014-12-12 Maciej W. Rozycki <macro@codesourcery.com>
Maciej W. Rozycki <macro@mips.com>
Pedro Alves <pedro@codesourcery.com>
gdb/
* gdbarch.sh (elf_make_msymbol_special): Change type to `F',
remove `predefault' and `invalid_p' initializers.
(make_symbol_special): New architecture method.
(adjust_dwarf2_addr, adjust_dwarf2_line): Likewise.
(objfile, symbol): New declarations.
* arch-utils.h (default_elf_make_msymbol_special): Remove
prototype.
(default_make_symbol_special): New prototype.
(default_adjust_dwarf2_addr): Likewise.
(default_adjust_dwarf2_line): Likewise.
* mips-tdep.h (mips_unmake_compact_addr): New prototype.
* arch-utils.c (default_elf_make_msymbol_special): Remove
function.
(default_make_symbol_special): New function.
(default_adjust_dwarf2_addr): Likewise.
(default_adjust_dwarf2_line): Likewise.
* dwarf2-frame.c (decode_frame_entry_1): Call
`gdbarch_adjust_dwarf2_addr'.
* dwarf2loc.c (dwarf2_find_location_expression): Likewise.
* dwarf2read.c (create_addrmap_from_index): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(add_partial_symbol): Likewise.
(add_partial_subprogram): Likewise.
(process_full_comp_unit): Likewise.
(read_file_scope): Likewise.
(read_func_scope): Likewise. Call `gdbarch_make_symbol_special'.
(read_lexical_block_scope): Call `gdbarch_adjust_dwarf2_addr'.
(read_call_site_scope): Likewise.
(dwarf2_ranges_read): Likewise.
(dwarf2_record_block_ranges): Likewise.
(read_attribute_value): Likewise.
(dwarf_decode_lines_1): Call `gdbarch_adjust_dwarf2_line'.
(new_symbol_full): Call `gdbarch_adjust_dwarf2_addr'.
* elfread.c (elf_symtab_read): Don't call
`gdbarch_elf_make_msymbol_special' if unset.
* mips-linux-tdep.c (micromips_linux_sigframe_validate): Strip
the ISA bit from the PC.
* mips-tdep.c (mips_unmake_compact_addr): New function.
(mips_elf_make_msymbol_special): Set the ISA bit in the symbol's
address appropriately.
(mips_make_symbol_special): New function.
(mips_pc_is_mips): Set the ISA bit before symbol lookup.
(mips_pc_is_mips16): Likewise.
(mips_pc_is_micromips): Likewise.
(mips_pc_isa): Likewise.
(mips_adjust_dwarf2_addr): New function.
(mips_adjust_dwarf2_line): Likewise.
(mips_read_pc, mips_unwind_pc): Keep the ISA bit.
(mips_addr_bits_remove): Likewise.
(mips_skip_trampoline_code): Likewise.
(mips_write_pc): Don't set the ISA bit.
(mips_eabi_push_dummy_call): Likewise.
(mips_o64_push_dummy_call): Likewise.
(mips_gdbarch_init): Install `mips_make_symbol_special',
`mips_adjust_dwarf2_addr' and `mips_adjust_dwarf2_line' gdbarch
handlers.
* solib.c (gdb_bfd_lookup_symbol_from_symtab): Get
target-specific symbol address adjustments.
* gdbarch.h: Regenerate.
* gdbarch.c: Regenerate.
2014-12-12 Maciej W. Rozycki <macro@codesourcery.com>
gdb/testsuite/
* gdb.base/func-ptrs.c: New file.
* gdb.base/func-ptrs.exp: New file.
2014-12-12 14:31:53 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_elf_make_msymbol_special_p() = %d\n",
|
|
|
|
gdbarch_elf_make_msymbol_special_p (gdbarch));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: elf_make_msymbol_special = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->elf_make_msymbol_special));
|
2013-02-04 19:40:41 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_elfcore_write_linux_prpsinfo_p() = %d\n",
|
|
|
|
gdbarch_elfcore_write_linux_prpsinfo_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: elfcore_write_linux_prpsinfo = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->elfcore_write_linux_prpsinfo));
|
2017-04-26 15:05:03 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: execute_dwarf_cfa_vendor_op = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->execute_dwarf_cfa_vendor_op));
|
2010-01-06 05:20:27 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: fast_tracepoint_valid_at = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->fast_tracepoint_valid_at));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_fetch_pointer_argument_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_fetch_pointer_argument_p (gdbarch));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: fetch_pointer_argument = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->fetch_pointer_argument));
|
2005-03-31 21:58:26 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_fetch_tls_load_module_address_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_fetch_tls_load_module_address_p (gdbarch));
|
2005-03-31 21:58:26 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: fetch_tls_load_module_address = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->fetch_tls_load_module_address));
|
2012-01-20 10:59:15 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_find_memory_regions_p() = %d\n",
|
|
|
|
gdbarch_find_memory_regions_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: find_memory_regions = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->find_memory_regions));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: float_bit = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->float_bit));
|
2004-06-21 02:17:02 +02:00
|
|
|
fprintf_unfiltered (file,
|
2004-06-21 19:54:57 +02:00
|
|
|
"gdbarch_dump: float_format = %s\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
pformat (gdbarch->float_format));
|
Add gdbarch callback to provide formats for debug info float types
At this point, all TYPE_CODE_FLT types carry their floating-point format,
except for those creating from reading DWARF or stabs debug info. Those
will be addressed by this commit.
The main issue here is that we actually have to determine which floating-
point format to use. Currently, we only have the type length as input
to this decision. In the future, we may hopefully get --at least in
DWARF-- additional information to help disambiguate multiple different
formats of the same length. For now, we can still look at the type name
as a hint.
This decision logic is encapsulated in a gdbarch callback to allow
platform-specific overrides. The default implementation use the same
logic (compare type length against the various gdbarch_..._bit sizes)
that is currently implemented in floatformat_from_length.
With this commit, all platforms still use the default logic, so there
should be no actual change in behavior. A follow-on commit will add
support for __float128 on Intel and Power.
Once dwarf2read.c and stabsread.c make use of the new callback to
determine floating-point formats, we're now sure every TYPE_CODE_FLT
type will always carry its format. The commit therefore adds asserts
to verify_floatformat to ensure new code will continue to always
provide formats, and removes the code in floatformat_from_type that
used to handle types with a NULL TYPE_FLOATFORMAT.
gdb/ChangeLog:
* gdbarch.sh (floatformat_for_type): New gdbarch callback.
* gdbarch.h, gdbarch.c: Re-generate.
* arch-utils.h (default_floatformat_for_type): New prototype.
* arch-utils.c (default_floatformat_for_type): New function.
* doublest.c (floatformat_from_length): Remove.
(floatformat_from_type): Assume TYPE_FLOATFORMAT is non-NULL.
* gdbtypes.c (verify_floatformat): Require non-NULL format.
* dwarf2read.c (dwarf2_init_float_type): New function.
(read_base_type): Use it.
* stabsread.c (dbx_init_float_type): New function.
(read_sun_floating_type): Use it.
(read_range_type): Likewise.
Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-06 17:31:53 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: floatformat_for_type = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->floatformat_for_type));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: fp0_regnum = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->fp0_regnum));
|
2004-06-21 02:17:02 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_frame_align_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_frame_align_p (gdbarch));
|
2004-06-21 02:17:02 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: frame_align = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->frame_align));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2008-09-05 14:57:16 +02:00
|
|
|
"gdbarch_dump: frame_args_skip = %s\n",
|
|
|
|
core_addr_to_string_nz (gdbarch->frame_args_skip));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_frame_num_args_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_frame_num_args_p (gdbarch));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: frame_num_args = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->frame_num_args));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: frame_red_zone_size = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->frame_red_zone_size));
|
2014-05-14 22:08:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gcc_target_options = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->gcc_target_options));
|
2009-06-17 20:48:26 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_gcore_bfd_target_p() = %d\n",
|
|
|
|
gdbarch_gcore_bfd_target_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gcore_bfd_target = %s\n",
|
2011-10-26 20:21:38 +02:00
|
|
|
pstring (gdbarch->gcore_bfd_target));
|
2012-06-04 18:23:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_gdb_signal_from_target_p() = %d\n",
|
|
|
|
gdbarch_gdb_signal_from_target_p (gdbarch));
|
2012-05-24 18:39:15 +02:00
|
|
|
fprintf_unfiltered (file,
|
2012-05-24 19:03:28 +02:00
|
|
|
"gdbarch_dump: gdb_signal_from_target = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->gdb_signal_from_target));
|
This patch implements the new gdbarch method gdbarch_gdb_signal_to_target.
It will be used when one wants to convert between the internal GDB signal
representation (enum gdb_signal) and the target's representation.
The idea of this patch came from a chat between Pedro and I on IRC, plus
the discussion of my patches to add the new $_exitsignal convenience
variable:
<http://sourceware.org/ml/gdb-patches/2013-06/msg00452.html>
<http://sourceware.org/ml/gdb-patches/2013-06/msg00352.html>
What I did was to investigate, on the Linux kernel, which targets shared
the signal numbers definition with the generic definition, present at
<include/uapi/asm-generic/signal.h>. For the record, I used linux-3.10-rc7
as the main source of information, always looking at
<arch/<ARCH_NAME>/include/uapi/asm/signal.h>. For SIGRTMAX (which defaults
to _NSIG in most cases), I had to look at different signal-related
files, but most of them (except MIPS) were defined to 64 anyway.
Then, with all the differences in hand, I implemented the bits on each
target.
2013-08-09 Sergio Durigan Junior <sergiodj@redhat.com>
* linux-tdep.c: Define enum with generic signal numbers.
(linux_gdb_signal_from_target): New function.
(linux_gdb_signal_to_target): Likewise.
(linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
methods to the functions above.
* linux-tdep.h (linux_gdb_signal_from_target): New prototype.
(linux_gdb_signal_to_target): Likewise.
* alpha-linux-tdep.c: Define new enum with signals different
from generic Linux kernel.
(alpha_linux_gdb_signal_from_target): New function.
(alpha_linux_gdb_signal_to_target): Likewise.
(alpha_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
with the functions mentioned above.
* avr-tdep.c: Define enum with differences between Linux kernel
and AVR signals.
(avr_linux_gdb_signal_from_target): New function.
(avr_linux_gdb_signal_to_target): Likewise.
(avr_gdbarch_init): Set gdbarch_gdb_signal_{to,from}_target to
the functions mentioned above.
* sparc-linux-tdep.c: Define enum with differences between SPARC
and generic Linux kernel signal numbers.
(sparc32_linux_gdb_signal_from_target): New function.
(sparc32_linux_gdb_signal_to_target): Likewise.
(sparc32_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
to the functions defined above.
* xtensa-linux-tdep.c: Define enum with differences between
Xtensa and Linux kernel generic signals.
(xtensa_linux_gdb_signal_from_target): New function.
(xtensa_linux_gdb_signal_to_target): Likewise.
(xtensa_linux_init_abi): Set gdbarch_gdb_signal_to_target
to the functions defined above.
* mips-linux-tdep.c: Define enum with differences between
signals in MIPS and Linux kernel generic ones.
(mips_gdb_signal_to_target): New function.
(mips_gdb_signal_from_target): Redefine to use new enum, handle
only different signals from the Linux kernel generic.
(mips_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
the functions defined above.
* mips-linux-tdep.h (enum mips_signals): Remove.
2013-08-09 18:54:43 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_gdb_signal_to_target_p() = %d\n",
|
|
|
|
gdbarch_gdb_signal_to_target_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdb_signal_to_target = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->gdb_signal_to_target));
|
2011-09-27 15:09:37 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gen_return_address = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->gen_return_address));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_get_longjmp_target_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_get_longjmp_target_p (gdbarch));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: get_longjmp_target = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->get_longjmp_target));
|
2009-02-06 23:59:01 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_get_siginfo_type_p() = %d\n",
|
|
|
|
gdbarch_get_siginfo_type_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
2009-02-11 15:32:17 +01:00
|
|
|
"gdbarch_dump: get_siginfo_type = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->get_siginfo_type));
|
2009-09-15 05:30:08 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_get_syscall_number_p() = %d\n",
|
|
|
|
gdbarch_get_syscall_number_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: get_syscall_number = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->get_syscall_number));
|
add gnu_triplet_regexp gdbarch method
gdb has to inform libcc1.so of the target being used, so that the
correct compiler can be invoked. The compiler is invoked using the
GNU configury triplet prefix, e.g., "x86_64-unknown-linux-gnu-gcc".
In order for this to work we need to map the gdbarch to the GNU
configury triplet arch. In most cases these are identical; however,
the x86 family poses some problems, as the BFD arch names are quite
different from the GNU triplet names. So, we introduce a new gdbarch
method for this. A regular expression is used because there are
various valid values for the arch prefix in the triplet.
This patch also updates the osabi code to associate a regular
expression with the OS ABI. I have only added a concrete value for
Linux. Note that the "-gnu" part is optional, at least on Fedora it
is omitted from the installed GCC executable's name.
gdb/ChangeLog
2014-12-12 Tom Tromey <tromey@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* osabi.h (osabi_triplet_regexp): Declare.
* osabi.c (struct osabi_names): New.
(gdb_osabi_names): Change type to struct osabi_names. Update
values.
(gdbarch_osabi_name): Update.
(osabi_triplet_regexp): New function.
(osabi_from_tdesc_string, _initialize_gdb_osabi): Update.
* i386-tdep.c (i386_gnu_triplet_regexp): New method.
(i386_elf_init_abi, i386_go32_init_abi, i386_gdbarch_init): Call
set_gdbarch_gnu_triplet_regexp.
* gdbarch.sh (gnu_triplet_regexp): New method.
* gdbarch.c, gdbarch.h: Rebuild.
* arch-utils.h (default_gnu_triplet_regexp): Declare.
* arch-utils.c (default_gnu_triplet_regexp): New function.
2014-06-13 17:28:24 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gnu_triplet_regexp = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->gnu_triplet_regexp));
|
2016-02-18 09:21:38 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: guess_tracepoint_registers = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->guess_tracepoint_registers));
|
2010-07-06 14:56:24 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: half_bit = %s\n",
|
|
|
|
plongest (gdbarch->half_bit));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: half_format = %s\n",
|
|
|
|
pformat (gdbarch->half_format));
|
Intel MPX bound violation handling
With Intel Memory Protection Extensions it was introduced the concept of
boundary violation. A boundary violations is presented to the inferior as
a segmentation fault having SIGCODE 3. This patch adds a
handler for a boundary violation extending the information displayed
when a bound violation is presented to the inferior. In the stop mode
case the debugger will also display the kind of violation: "upper" or
"lower", bounds and the address accessed.
On no stop mode the information will still remain unchanged. Additional
information about bound violations are not meaningful in that case user
does not know the line in which violation occurred as well.
When the segmentation fault handler is stop mode the out puts will be
changed as exemplified below.
The usual output of a segfault is:
Program received signal SIGSEGV, Segmentation fault
0x0000000000400d7c in upper (p=0x603010, a=0x603030, b=0x603050,
c=0x603070, d=0x603090, len=7) at i386-mpx-sigsegv.c:68
68 value = *(p + len);
In case it is a bound violation it will be presented as:
Program received signal SIGSEGV, Segmentation fault
Upper bound violation while accessing address 0x7fffffffc3b3
Bounds: [lower = 0x7fffffffc390, upper = 0x7fffffffc3a3]
0x0000000000400d7c in upper (p=0x603010, a=0x603030, b=0x603050,
c=0x603070, d=0x603090, len=7) at i386-mpx-sigsegv.c:68
68 value = *(p + len);
In mi mode the output of a segfault is:
*stopped,reason="signal-received",signal-name="SIGSEGV",
signal-meaning="Segmentation fault", frame={addr="0x0000000000400d7c",
func="upper",args=[{name="p", value="0x603010"},{name="a",value="0x603030"}
,{name="b",value="0x603050"}, {name="c",value="0x603070"},
{name="d",value="0x603090"},{name="len",value="7"}],
file="i386-mpx-sigsegv.c",fullname="i386-mpx-sigsegv.c",line="68"},
thread-id="1",stopped-threads="all",core="6"
in the case of a bound violation:
*stopped,reason="signal-received",signal-name="SIGSEGV",
signal-meaning="Segmentation fault",
sigcode-meaning="Upper bound violation",
lower-bound="0x603010",upper-bound="0x603023",bound-access="0x60302f",
frame={addr="0x0000000000400d7c",func="upper",args=[{name="p",
value="0x603010"},{name="a",value="0x603030"},{name="b",value="0x603050"},
{name="c",value="0x603070"},{name="d",value="0x603090"},
{name="len",value="7"}],file="i386-mpx-sigsegv.c",
fullname="i386-mpx-sigsegv.c",line="68"},thread-id="1",
stopped-threads="all",core="6"
2016-02-18 Walfred Tedeschi <walfred.tedeschi@intel.com>
gdb/ChangeLog:
* NEWS: Add entry for bound violation.
* amd64-linux-tdep.c (amd64_linux_init_abi_common):
Add handler for segmentation fault.
* gdbarch.sh (handle_segmentation_fault): New.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* i386-linux-tdep.c (i386_linux_handle_segmentation_fault): New.
(SIG_CODE_BONDARY_FAULT): New define.
(i386_linux_init_abi): Use i386_mpx_bound_violation_handler.
* i386-linux-tdep.h (i386_linux_handle_segmentation_fault) New.
* i386-tdep.c (i386_mpx_enabled): Add as external.
* i386-tdep.c (i386_mpx_enabled): Add as external.
* infrun.c (handle_segmentation_fault): New function.
(print_signal_received_reason): Use handle_segmentation_fault.
gdb/testsuite/ChangeLog:
* gdb.arch/i386-mpx-sigsegv.c: New file.
* gdb.arch/i386-mpx-sigsegv.exp: New file.
* gdb.arch/i386-mpx-simple_segv.c: New file.
* gdb.arch/i386-mpx-simple_segv.exp: New file.
gdb/doc/ChangeLog:
* gdb.texinfo (Signals): Add bound violation display hints for
a SIGSEGV.
2016-02-18 17:24:59 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_handle_segmentation_fault_p() = %d\n",
|
|
|
|
gdbarch_handle_segmentation_fault_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: handle_segmentation_fault = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->handle_segmentation_fault));
|
2010-04-24 15:12:56 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: has_dos_based_file_system = %s\n",
|
|
|
|
plongest (gdbarch->has_dos_based_file_system));
|
2009-05-19 02:23:49 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: has_global_breakpoints = %s\n",
|
|
|
|
plongest (gdbarch->has_global_breakpoints));
|
* remote.c (remote_start_remote): If the solib list is global,
fetch libraries and insert breakpoints after connecting.
* infcmd.c (post_create_inferior): If the solist is shared between
inferiors, no need to refetch it on every new inferior.
(detach_command): If the shared library list is shared between
inferiors, then don't clear it on every inferior detach.
* gdbarch.sh (has_global_solist): New.
* i386-dicos-tdep.c (i386_dicos_init_abi): Set
gdbarch_has_global_solist.
* target.c (target_pre_inferior): If the shared library list is
shared between inferiors, then don't clear it here, neither
invalidate the memory regions or clear the target description.
(target_detach): If the shared library list is shared between
inferiors, then don't remove breakpoints from the target here.
(target_disconnect): Comment.
* solib.c (update_solib_list): Check for null_ptid.
* breakpoint.c (insert_breakpoints, update_global_location_list):
If the shared library list is shared between inferiors, insert
breakpoints even if there's no execution.
(breakpoint_init_inferior): If the shared library list is shared
between inferiors, don't delete breakpoints or mark them
uninserted here.
* gdbarch.c, gdbarch.h: Regenerate.
2008-11-03 15:01:27 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: has_global_solist = %s\n",
|
|
|
|
plongest (gdbarch->has_global_solist));
|
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
Add base multi-executable/process support to GDB.
gdb/
* Makefile.in (SFILES): Add progspace.c.
(COMMON_OBS): Add progspace.o.
* progspace.h: New.
* progspace.c: New.
* breakpoint.h (struct bp_target_info) <placed_address_space>: New
field.
(struct bp_location) <pspace>: New field.
(struct breakpoint) <pspace>: New field.
(bpstat_stop_status, breakpoint_here_p)
(moribund_breakpoint_here_p, breakpoint_inserted_here_p)
(regular_breakpoint_inserted_here_p)
(software_breakpoint_inserted_here_p, breakpoint_thread_match)
(set_default_breakpoint): Adjust prototypes.
(remove_breakpoints_pid, breakpoint_program_space_exit): Declare.
(insert_single_step_breakpoint, deprecated_insert_raw_breakpoint):
Adjust prototypes.
* breakpoint.c (executing_startup): Delete.
(default_breakpoint_sspace): New.
(breakpoint_restore_shadows): Skip if the address space doesn't
match.
(update_watchpoint): Record the frame's program space in the
breakpoint location.
(insert_bp_location): Record the address space in target_info.
Adjust to pass the symbol space to solib_name_from_address.
(breakpoint_program_space_exit): New.
(insert_breakpoint_locations): Switch the symbol space and thread
when inserting breakpoints. Don't insert breakpoints in a vfork
parent waiting for vfork done if we're not attached to the vfork
child.
(remove_breakpoints_pid): New.
(reattach_breakpoints): Switch to a thread of PID. Ignore
breakpoints of other symbol spaces.
(create_internal_breakpoint): Store the symbol space in the sal.
(create_longjmp_master_breakpoint): Iterate over all symbol
spaces.
(update_breakpoints_after_exec): Ignore breakpoints for other
symbol spaces.
(remove_breakpoint): Rename to ...
(remove_breakpoint_1): ... this. Pass the breakpoints symbol
space to solib_name_from_address.
(remove_breakpoint): New.
(mark_breakpoints_out): Ignore breakpoints from other symbol
spaces.
(breakpoint_init_inferior): Ditto.
(breakpoint_here_p): Add an address space argument and adjust to
use breakpoint_address_match.
(moribund_breakpoint_here_p): Ditto.
(regular_breakpoint_inserted_here_p): Ditto.
(breakpoint_inserted_here_p): Ditto.
(software_breakpoint_inserted_here_p): Ditto.
(breakpoint_thread_match): Ditto.
(bpstat_check_location): Ditto.
(bpstat_stop_status): Ditto.
(print_breakpoint_location): If there's a location to print,
switch the current symbol space.
(print_one_breakpoint_location): Add `allflag' argument.
(print_one_breakpoint): Ditto. Adjust.
(do_captured_breakpoint_query): Adjust.
(breakpoint_1): Adjust.
(breakpoint_has_pc): Also match the symbol space.
(describe_other_breakpoints): Add a symbol space argument and
adjust.
(set_default_breakpoint): Add a symbol space argument. Set
default_breakpoint_sspace.
(breakpoint_address_match): New.
(check_duplicates_for): Add an address space argument, and adjust.
(set_raw_breakpoint): Record the symbol space in the location and
in the breakpoint.
(set_longjmp_breakpoint): Skip longjmp master breakpoints from
other symbol spaces.
(remove_thread_event_breakpoints, remove_solib_event_breakpoints)
(disable_breakpoints_in_shlibs): Skip breakpoints from other
symbol spaces.
(disable_breakpoints_in_unloaded_shlib): Match symbol spaces.
(create_catchpoint): Set the symbol space in the sal.
(disable_breakpoints_before_startup): Skip breakpoints from other
symbol spaces. Set executing_startup in the current symbol space.
(enable_breakpoints_after_startup): Clear executing_startup in the
current symbol space. Skip breakpoints from other symbol spaces.
(clone_momentary_breakpoint): Also copy the symbol space.
(add_location_to_breakpoint): Set the location's symbol space.
(bp_loc_is_permanent): Switch thread and symbol space.
(create_breakpoint): Adjust.
(expand_line_sal_maybe): Expand comment to mention symbol spaces.
Switch thread and symbol space when reading memory.
(parse_breakpoint_sals): Set the symbol space in the sal.
(break_command_really): Ditto.
(skip_prologue_sal): Switch and space.
(resolve_sal_pc): Ditto.
(watch_command_1): Record the symbol space in the sal.
(create_ada_exception_breakpoint): Adjust.
(clear_command): Adjust. Match symbol spaces.
(update_global_location_list): Use breakpoint_address_match.
(breakpoint_re_set_one): Switch thread and space.
(breakpoint_re_set): Save symbol space.
(breakpoint_re_set_thread): Also reset the symbol space.
(deprecated_insert_raw_breakpoint): Add an address space argument.
Adjust.
(insert_single_step_breakpoint): Ditto.
(single_step_breakpoint_inserted_here_p): Ditto.
(clear_syscall_counts): New.
(_initialize_breakpoint): Install it as inferior_exit observer.
* exec.h: Include "progspace.h".
(exec_bfd, exec_bfd_mtime): New defines.
(exec_close): Declare.
* exec.c: Include "gdbthread.h" and "progspace.h".
(exec_bfd, exec_bfd_mtime, current_target_sections_1): Delete.
(using_exec_ops): New.
(exec_close_1): Rename to exec_close, and make public.
(exec_close): Rename to exec_close_1, and adjust all callers. Add
description. Remove target sections and close executables from
all program spaces.
(exec_file_attach): Add comment.
(add_target_sections): Check on `using_exec_ops' to check if the
target should be pushed.
(remove_target_sections): Only unpush the target if there are no
more target sections in any symbol space.
* gdbcore.h: Include "exec.h".
(exec_bfd, exec_bfd_mtime): Remove declarations.
* frame.h (get_frame_program_space, get_frame_address_space)
(frame_unwind_program_space): Declare.
* frame.c (struct frame_info) <pspace, aspace>: New fields.
(create_sentinel_frame): Add program space argument. Set the
pspace and aspace fields of the frame object.
(get_current_frame, create_new_frame): Adjust.
(get_frame_program_space): New.
(frame_unwind_program_space): New.
(get_frame_address_space): New.
* stack.c (print_frame_info): Adjust.
(print_frame): Use the frame's program space.
* gdbthread.h (any_live_thread_of_process): Declare.
* thread.c (any_live_thread_of_process): New.
(switch_to_thread): Switch the program space as well.
(restore_selected_frame): Don't warn if trying to restore frame
level 0.
* inferior.h: Include "progspace.h".
(detach_fork): Declare.
(struct inferior) <removable, aspace, pspace>
<vfork_parent, vfork_child, pending_detach>
<waiting_for_vfork_done>: New fields.
<terminal_info>: Remove field.
<data, num_data>: New fields.
(register_inferior_data, register_inferior_data_with_cleanup)
(clear_inferior_data, set_inferior_data, inferior_data): Declare.
(exit_inferior, exit_inferior_silent, exit_inferior_num_silent)
(inferior_appeared): Declare.
(find_inferior_pid): Typo.
(find_inferior_id, find_inferior_for_program_space): Declare.
(set_current_inferior, save_current_inferior, prune_inferiors)
(number_of_inferiors): Declare.
(inferior_list): Declare.
* inferior.c: Include "gdbcore.h" and "symfile.h".
(inferior_list): Make public.
(delete_inferior_1): Always delete thread silently.
(find_inferior_id): Make public.
(current_inferior_): New.
(current_inferior): Use it.
(set_current_inferior): New.
(restore_inferior): New.
(save_current_inferior): New.
(free_inferior): Free the per-inferior data.
(add_inferior_silent): Allocate per-inferior data.
Call inferior_appeared.
(delete_threads_of_inferior): New.
(delete_inferior_1): Adjust interface to take an inferior pointer.
(delete_inferior): Adjust.
(delete_inferior_silent): Adjust.
(exit_inferior_1): New.
(exit_inferior): New.
(exit_inferior_silent): New.
(exit_inferior_num_silent): New.
(detach_inferior): Adjust.
(inferior_appeared): New.
(discard_all_inferiors): Adjust.
(find_inferior_id): Make public. Assert pid is not zero.
(find_inferior_for_program_space): New.
(have_inferiors): Check if we have any inferior with pid not zero.
(have_live_inferiors): Go over all pushed targets looking for
process_stratum.
(prune_inferiors): New.
(number_of_inferiors): New.
(print_inferior): Add executable column. Print vfork parent/child
relationships.
(inferior_command): Adjust to cope with not running inferiors.
(remove_inferior_command): New.
(add_inferior_command): New.
(clone_inferior_command): New.
(struct inferior_data): New.
(struct inferior_data_registration): New.
(struct inferior_data_registry): New.
(inferior_data_registry): New.
(register_inferior_data_with_cleanup): New.
(register_inferior_data): New.
(inferior_alloc_data): New.
(inferior_free_data): New.
(clear_inferior_data): New.
(set_inferior_data): New.
(inferior_data): New.
(initialize_inferiors): New.
(_initialize_inferiors): Register "add-inferior",
"remove-inferior" and "clone-inferior" commands.
* objfiles.h: Include "progspace.h".
(struct objfile) <pspace>: New field.
(symfile_objfile, object_files): Don't declare.
(ALL_PSPACE_OBJFILES): New.
(ALL_PSPACE_OBJFILES_SAFE): New.
(ALL_OBJFILES, ALL_OBJFILES_SAFE): Adjust.
(ALL_PSPACE_SYMTABS): New.
(ALL_PRIMARY_SYMTABS): Adjust.
(ALL_PSPACE_PRIMARY_SYMTABS): New.
(ALL_PSYMTABS): Adjust.
(ALL_PSPACE_PSYMTABS): New.
* objfiles.c (object_files, symfile_objfile): Delete.
(struct objfile_sspace_info): New.
(objfiles_pspace_data): New.
(objfiles_pspace_data_cleanup): New.
(get_objfile_pspace_data): New.
(objfiles_changed_p): Delete.
(allocate_objfile): Set the objfile's program space. Adjust to
reference objfiles_changed_p in pspace data.
(free_objfile): Adjust to reference objfiles_changed_p in pspace
data.
(objfile_relocate): Ditto.
(update_section_map): Add pspace argument. Adjust to iterate over
objfiles in the passed in pspace.
(find_pc_section): Delete sections and num_sections statics.
Adjust to refer to program space's objfiles_changed_p. Adjust to
refer to sections and num_sections store in the objfile's pspace
data.
(objfiles_changed): Adjust to reference objfiles_changed_p in
pspace data.
(_initialize_objfiles): New.
* linespec.c (decode_all_digits, decode_dollar): Set the sal's
program space.
* source.c (current_source_pspace): New.
(get_current_source_symtab_and_line): Set the sal's program space.
(set_current_source_symtab_and_line): Set current_source_pspace.
(select_source_symtab): Ditto. Use ALL_OBJFILES.
(forget_cached_source_info): Iterate over all program spaces.
* symfile.c (clear_symtab_users): Adjust.
* symmisc.c (print_symbol_bcache_statistics): Iterate over all
program spaces.
(print_objfile_statistics): Ditto.
(maintenance_print_msymbols): Ditto.
(maintenance_print_objfiles): Ditto.
(maintenance_info_symtabs): Ditto.
(maintenance_info_psymtabs): Ditto.
* symtab.h (SYMTAB_PSPACE): New.
(struct symtab_and_line) <pspace>: New field.
* symtab.c (init_sal): Clear the sal's program space.
(find_pc_sect_symtab): Set the sal's program space. Switch thread
and space.
(append_expanded_sal): Add program space argument. Iterate over
all program spaces.
(expand_line_sal): Iterate over all program spaces. Switch
program space.
* target.h (enum target_waitkind) <TARGET_WAITKIND_VFORK_DONE>: New.
(struct target_ops) <to_thread_address_space>: New field.
(target_thread_address_space): Define.
* target.c (target_detach): Only remove breakpoints from the
inferior we're detaching.
(target_thread_address_space): New.
* defs.h (initialize_progspace): Declare.
* top.c (gdb_init): Call it.
* solist.h (struct so_list) <sspace>: New field.
* solib.h (struct program_space): Forward declare.
(solib_name_from_address): Adjust prototype.
* solib.c (so_list_head): Replace with a macro referencing the
program space.
(update_solib_list): Set the so's program space.
(solib_name_from_address): Add a program space argument and adjust.
* solib-svr4.c (struct svr4_info) <pid>: Delete field.
<interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low>
<interp_plt_sect_high>: New fields.
(svr4_info_p, svr4_info): Delete.
(solib_svr4_sspace_data): New.
(get_svr4_info): Rewrite.
(svr4_sspace_data_cleanup): New.
(open_symbol_file_object): Adjust.
(svr4_default_sos): Adjust.
(svr4_fetch_objfile_link_map): Adjust.
(interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low)
(interp_plt_sect_high): Delete.
(svr4_in_dynsym_resolve_code): Adjust.
(enable_break): Adjust.
(svr4_clear_solib): Revert bit that removed the svr4_info here,
and reinstate clearing debug_base, debug_loader_offset_p,
debug_loader_offset and debug_loader_name.
(_initialize_svr4_solib): Register solib_svr4_pspace_data. Don't
install an inferior_exit observer anymore.
* printcmd.c (struct display) <pspace>: New field.
(display_command): Set the display's sspace.
(do_one_display): Match the display's sspace.
(display_uses_solib_p): Ditto.
* linux-fork.c (detach_fork): Moved to infrun.c.
(_initialize_linux_fork): Moved "detach-on-fork" command to
infrun.c.
* infrun.c (detach_fork): Moved from linux-fork.c.
(proceed_after_vfork_done): New.
(handle_vfork_child_exec_or_exit): New.
(follow_exec_mode_replace, follow_exec_mode_keep)
(follow_exec_mode_names, follow_exec_mode_string)
(show_follow_exec_mode_string): New.
(follow_exec): New. Reinstate the mark_breakpoints_out call.
Remove shared libraries before attaching new executable. If user
wants to keep the inferior, keep it.
(displaced_step_fixup): Adjust to pass an address space to the
breakpoints module.
(resume): Ditto.
(clear_proceed_status): In all-stop mode, always clear the proceed
status of all threads.
(prepare_to_proceed): Adjust to pass an address space to the
breakpoints module.
(proceed): Ditto.
(adjust_pc_after_break): Ditto.
(handle_inferior_event): When handling a process exit, switch the
program space to the inferior's that had exited. Call
handle_vfork_child_exec_or_exit. Adjust to pass an address space
to the breakpoints module. In non-stop mode, when following a
fork and detach-fork is off, also resume the other branch. Handle
TARGET_WAITKIND_VFORK_DONE. Set the program space in sals.
(normal_stop): Prune inferiors.
(_initialize_infrun): Install the new "follow-exec-mode" command.
"detach-on-fork" moved here.
* regcache.h (get_regcache_aspace): Declare.
* regcache.c (struct regcache) <aspace>: New field.
(regcache_xmalloc): Clear the aspace.
(get_regcache_aspace): New.
(regcache_cpy): Copy the aspace field.
(regcache_cpy_no_passthrough): Ditto.
(get_thread_regcache): Fetch the thread's address space from the
target, and store it in the regcache.
* infcall.c (call_function_by_hand): Set the sal's pspace.
* arch-utils.c (default_has_shared_address_space): New.
* arch-utils.h (default_has_shared_address_space): Declare.
* gdbarch.sh (has_shared_address_space): New.
* gdbarch.h, gdbarch.c: Regenerate.
* linux-tdep.c: Include auxv.h, target.h, elf/common.h.
(linux_has_shared_address_space): New.
(_initialize_linux_tdep): Declare.
* arm-tdep.c (arm_software_single_step): Pass the frame's address
space to insert_single_step_breakpoint.
* arm-linux-tdep.c (arm_linux_software_single_step): Pass the
frame's pspace to breakpoint functions.
* cris-tdep.c (crisv32_single_step_through_delay): Ditto.
(cris_software_single_step): Ditto.
* mips-tdep.c (deal_with_atomic_sequence): Add frame argument.
Pass the frame's pspace to breakpoint functions.
(mips_software_single_step): Adjust.
(mips_single_step_through_delay): Adjust.
* rs6000-aix-tdep.c (rs6000_software_single_step): Adjust.
* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust.
* solib-irix.c (enable_break): Adjust to pass the current frame's
address space to breakpoint functions.
* sparc-tdep.c (sparc_software_single_step): Ditto.
* spu-tdep.c (spu_software_single_step): Ditto.
* alpha-tdep.c (alpha_software_single_step): Ditto.
* record.c (record_wait): Adjust to pass an address space to the
breakpoints module.
* fork-child.c (fork_inferior): Set the new inferior's program and
address spaces.
* inf-ptrace.c (inf_ptrace_follow_fork): Copy the parent's program
and address spaces.
(inf_ptrace_attach): Set the inferior's program and address spaces.
* linux-nat.c: Include "solib.h".
(linux_child_follow_fork): Manage parent and child's program and
address spaces. Clone the parent's program space if necessary.
Don't wait for the vfork to be done here. Refuse to resume if
following the vfork parent while leaving the child stopped.
(resume_callback): Don't resume a vfork parent.
(linux_nat_resume): Also check for pending events in the
lp->waitstatus field.
(linux_handle_extended_wait): Report TARGET_WAITKIND_VFORK_DONE
events to the core.
(stop_wait_callback): Don't wait for SIGSTOP on vfork parents.
(cancel_breakpoint): Adjust.
* linux-thread-db.c (thread_db_wait): Don't remove thread event
breakpoints here.
(thread_db_mourn_inferior): Don't mark breakpoints out here.
Remove thread event breakpoints after mourning.
* corelow.c: Include progspace.h.
(core_open): Set the inferior's program and address spaces.
* remote.c (remote_add_inferior): Set the new inferior's program
and address spaces.
(remote_start_remote): Update address spaces.
(extended_remote_create_inferior_1): Don't init the thread list if
we already debugging other inferiors.
* darwin-nat.c (darwin_attach): Set the new inferior's program and
address spaces.
* gnu-nat.c (gnu_attach): Ditto.
* go32-nat.c (go32_create_inferior): Ditto.
* inf-ttrace.c (inf_ttrace_follow_fork, inf_ttrace_attach): Ditto.
* monitor.c (monitor_open): Ditto.
* nto-procfs.c (procfs_attach, procfs_create_inferior): Ditto.
* procfs.c (do_attach): Ditto.
* windows-nat.c (do_initial_windows_stuff): Ditto.
* inflow.c (inferior_process_group)
(terminal_init_inferior_with_pgrp, terminal_inferior,
(terminal_ours_1, inflow_inferior_exit, copy_terminal_info)
(child_terminal_info, new_tty_postfork, set_sigint_trap): Adjust
to use per-inferior data instead of inferior->terminal_info.
(inflow_inferior_data): New.
(inflow_new_inferior): Delete.
(inflow_inferior_data_cleanup): New.
(get_inflow_inferior_data): New.
* mi/mi-interp.c (mi_new_inferior): Rename to...
(mi_inferior_appeared): ... this.
(mi_interpreter_init): Adjust.
* tui/tui-disasm.c: Include "progspace.h".
(tui_set_disassem_content): Pass an address space to
breakpoint_here_p.
* NEWS: Mention multi-program debugging support. Mention new
commands "add-inferior", "clone-inferior", "remove-inferior",
"maint info program-spaces", and new option "set
follow-exec-mode".
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/doc/
* observer.texi (new_inferior): Rename to...
(inferior_appeared): ... this.
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/testsuite/
* gdb.base/foll-vfork.exp: Adjust to spell out "follow-fork".
* gdb.base/foll-exec.exp: Adjust to expect a process id before
"Executing new program".
* gdb.base/foll-fork.exp: Adjust to spell out "follow-fork".
* gdb.base/multi-forks.exp: Ditto. Adjust to the inferior being
left listed after having been killed.
* gdb.base/attach.exp: Adjust to spell out "symbol-file".
* gdb.base/maint.exp: Adjust test.
* Makefile.in (ALL_SUBDIRS): Add gdb.multi.
* gdb.multi/Makefile.in: New.
* gdb.multi/base.exp: New.
* gdb.multi/goodbye.c: New.
* gdb.multi/hangout.c: New.
* gdb.multi/hello.c: New.
* gdb.multi/bkpt-multi-exec.c: New.
* gdb.multi/bkpt-multi-exec.exp: New.
* gdb.multi/crashme.c: New.
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/doc/
* gdb.texinfo (Inferiors): Rename node to ...
(Inferiors and Programs): ... this. Mention running multiple
programs in the same debug session.
<info inferiors>: Mention the new 'Executable' column if "info
inferiors". Update examples. Document the "add-inferior",
"clone-inferior", "remove-inferior" and "maint info
program-spaces" commands.
(Process): Rename node to...
(Forks): ... this. Document "set|show follow-exec-mode".
2009-10-19 11:51:43 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: has_shared_address_space = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->has_shared_address_space));
|
2004-06-21 02:17:02 +02:00
|
|
|
fprintf_unfiltered (file,
|
2004-06-21 19:54:57 +02:00
|
|
|
"gdbarch_dump: have_nonsteppable_watchpoint = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->have_nonsteppable_watchpoint));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: in_solib_return_trampoline = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->in_solib_return_trampoline));
|
2014-05-14 22:08:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: infcall_mmap = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->infcall_mmap));
|
2015-06-03 21:22:56 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: infcall_munmap = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->infcall_munmap));
|
2012-01-20 10:49:58 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_info_proc_p() = %d\n",
|
|
|
|
gdbarch_info_proc_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: info_proc = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->info_proc));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: inner_than = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->inner_than));
|
gdbarch: add instruction predicate methods
Add new methods to gdbarch for analyzing the instruction at a given address.
Implement those methods for i386 and amd64 architectures.
This is needed by "record btrace" to detect function calls in the
execution trace.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* amd64-tdep.c (amd64_classify_insn_at, amd64_insn_is_call)
(amd64_insn_is_ret, amd64_insn_is_jump, amd64_jmp_p): New.
(amd64_init_abi): Add insn_is_call, insn_is_ret, and insn_is_jump
to gdbarch.
* i386-tdep.c (i386_insn_is_call, i386_insn_is_ret)
(i386_insn_is_jump, i386_jmp_p): New.
(i386_gdbarch_init): Add insn_is_call, insn_is_ret, and
insn_is_jump to gdbarch.
* gdbarch.sh (insn_is_call, insn_is_ret, insn_is_jump): New.
* gdbarch.h: Regenerated.
* gdbarch.c: Regenerated.
* arch-utils.h (default_insn_is_call, default_insn_is_ret)
(default_insn_is_jump): New.
* arch-utils.c (default_insn_is_call, default_insn_is_ret)
(default_insn_is_jump): New.
2013-03-22 15:56:56 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: insn_is_call = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->insn_is_call));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: insn_is_jump = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->insn_is_jump));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: insn_is_ret = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->insn_is_ret));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: int_bit = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->int_bit));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_integer_to_address_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_integer_to_address_p (gdbarch));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: integer_to_address = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->integer_to_address));
|
2012-06-05 15:50:50 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: iterate_over_objfiles_in_search_order = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->iterate_over_objfiles_in_search_order));
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 17:26:43 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_iterate_over_regset_sections_p() = %d\n",
|
|
|
|
gdbarch_iterate_over_regset_sections_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: iterate_over_regset_sections = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->iterate_over_regset_sections));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: long_bit = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->long_bit));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: long_double_bit = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->long_double_bit));
|
2004-06-21 02:17:02 +02:00
|
|
|
fprintf_unfiltered (file,
|
2004-06-21 19:54:57 +02:00
|
|
|
"gdbarch_dump: long_double_format = %s\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
pformat (gdbarch->long_double_format));
|
2011-10-11 21:08:59 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: long_long_align_bit = %s\n",
|
|
|
|
plongest (gdbarch->long_long_align_bit));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: long_long_bit = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->long_long_bit));
|
2012-01-20 10:56:56 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_make_corefile_notes_p() = %d\n",
|
|
|
|
gdbarch_make_corefile_notes_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: make_corefile_notes = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->make_corefile_notes));
|
MIPS: Keep the ISA bit in compressed code addresses
1. Background information
The MIPS architecture, as originally designed and implemented in
mid-1980s has a uniform instruction word size that is 4 bytes, naturally
aligned. As such all MIPS instructions are located at addresses that
have their bits #1 and #0 set to zeroes, and any attempt to execute an
instruction from an address that has any of the two bits set to one
causes an address error exception. This may for example happen when a
jump-register instruction is executed whose register value used as the
jump target has any of these bits set.
Then in mid 1990s LSI sought a way to improve code density for their
TinyRISC family of MIPS cores and invented an alternatively encoded
instruction set in a joint effort with MIPS Technologies (then a
subsidiary of SGI). The new instruction set has been named the MIPS16
ASE (Application-Specific Extension) and uses a variable instruction
word size, which is 2 bytes (as the name of the ASE suggests) for most,
but there are a couple of exceptions that take 4 bytes, and then most of
the 2-byte instructions can be treated with a 2-byte extension prefix to
expand the range of the immediate operands used.
As a result instructions are no longer 4-byte aligned, instead they are
aligned to a multiple of 2. That left the bit #0 still unused for code
references, be it for the standard MIPS (i.e. as originally invented) or
for the MIPS16 instruction set, and based on that observation a clever
trick was invented that on one hand allowed the processor to be
seamlessly switched between the two instruction sets at any time at the
run time while on the other avoided the introduction of any special
control register to do that.
So it is the bit #0 of the instruction address that was chosen as the
selector and named the ISA bit. Any instruction executed at an even
address is interpreted as a standard MIPS instruction (the address still
has to have its bit #1 clear), any instruction executed at an odd
address is interpreted as a MIPS16 instruction.
To switch between modes ordinary jump instructions are used, such as
used for function calls and returns, specifically the bit #0 of the
source register used in jump-register instructions selects the execution
(ISA) mode for the following piece of code to be interpreted in.
Additionally new jump-immediate instructions were added that flipped the
ISA bit to select the opposite mode upon execution. They were
considered necessary to avoid the need to make register jumps in all
cases as the original jump-immediate instructions provided no way to
change the bit #0 at all.
This was all important for cases where standard MIPS and MIPS16 code had
to be mixed, either for compatibility with the existing binary code base
or to access resources not reachable from MIPS16 code (the MIPS16
instruction set only provides access to general-purpose registers, and
not for example floating-point unit registers or privileged coprocessor
0 registers) -- pieces of code in the opposite mode can be executed as
ordinary subroutine calls.
A similar approach has been more recently adopted for the MIPS16
replacement instruction set defined as the so called microMIPS ASE.
This is another instruction set encoding introduced to the MIPS
architecture. Just like the MIPS16 ASE, the microMIPS instruction set
uses a variable-length encoding, where each instruction takes a multiple
of 2 bytes. The ISA bit has been reused and for microMIPS-capable
processors selects between the standard MIPS and the microMIPS mode
instead.
2. Statement of the problem
To put it shortly, MIPS16 and microMIPS code pointers used by GDB are
different to these observed at the run time. This results in the same
expressions being evaluated producing different results in GDB and in
the program being debugged. Obviously it's the results obtained at the
run time that are correct (they define how the program behaves) and
therefore by definition the results obtained in GDB are incorrect.
A bit longer description will record that obviously at the run time the
ISA bit has to be set correctly (refer to background information above
if unsure why so) or the program will not run as expected. This is
recorded in all the executable file structures used at the run time: the
dynamic symbol table (but not always the static one!), the GOT, and
obviously in all the addresses embedded in code or data of the program
itself, calculated by applying the appropriate relocations at the static
link time.
While a program is being processed by GDB, the ISA bit is stripped off
from any code addresses, presumably to make them the same as the
respective raw memory byte address used by the processor to access the
instruction in the instruction fetch access cycle. This stripping is
actually performed outside GDB proper, in BFD, specifically
_bfd_mips_elf_symbol_processing (elfxx-mips.c, see the piece of code at
the very bottom of that function, starting with an: "If this is an
odd-valued function symbol, assume it's a MIPS16 or microMIPS one."
comment).
This function is also responsible for symbol table dumps made by
`objdump' too, so you'll never see the ISA bit reported there by that
tool, you need to use `readelf'.
This is however unlike what is ever done at the run time, the ISA bit
once present is never stripped off, for example a cast like this:
(short *) main
will not strip the ISA bit off and if the resulting pointer is intended
to be used to access instructions as data, for example for software
instruction decoding (like for fault recovery or emulation in a signal
handler) or for self-modifying code then the bit still has to be
stripped off by an explicit AND operation.
This is probably best illustrated with a simple real program example.
Let's consider the following simple program:
$ cat foobar.c
int __attribute__ ((mips16)) foo (void)
{
return 1;
}
int __attribute__ ((mips16)) bar (void)
{
return 2;
}
int __attribute__ ((nomips16)) foo32 (void)
{
return 3;
}
int (*foo32p) (void) = foo32;
int (*foop) (void) = foo;
int fooi = (int) foo;
int
main (void)
{
return foop ();
}
$
This is plain C with no odd tricks, except from the instruction mode
attributes. They are not necessary to trigger this problem, I just put
them here so that the program can be contained in a single source file
and to make it obvious which function is MIPS16 code and which is not.
Let's try it with Linux, so that everyone can repeat this experiment:
$ mips-linux-gnu-gcc -mips16 -g -O2 -o foobar foobar.c
$
Let's have a look at some interesting symbols:
$ mips-linux-gnu-readelf -s foobar | egrep 'table|foo|bar'
Symbol table '.dynsym' contains 7 entries:
Symbol table '.symtab' contains 95 entries:
55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c
66: 0040068c 4 FUNC GLOBAL DEFAULT [MIPS16] 12 bar
68: 00410848 4 OBJECT GLOBAL DEFAULT 21 foo32p
70: 00410844 4 OBJECT GLOBAL DEFAULT 21 foop
78: 00400684 8 FUNC GLOBAL DEFAULT 12 foo32
80: 00400680 4 FUNC GLOBAL DEFAULT [MIPS16] 12 foo
88: 00410840 4 OBJECT GLOBAL DEFAULT 21 fooi
$
Hmm, no sight of the ISA bit, but notice how foo and bar (but not
foo32!) have been marked as MIPS16 functions (ELF symbol structure's
`st_other' field is used for that).
So let's try to run and poke at this program with GDB. I'll be using a
native system for simplicity (I'll be using ellipses here and there to
remove unrelated clutter):
$ ./foobar
$ echo $?
1
$
So far, so good.
$ gdb ./foobar
[...]
(gdb) break main
Breakpoint 1 at 0x400490: file foobar.c, line 23.
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb)
Yay, it worked! OK, so let's poke at it:
(gdb) print main
$1 = {int (void)} 0x400490 <main>
(gdb) print foo32
$2 = {int (void)} 0x400684 <foo32>
(gdb) print foo32p
$3 = (int (*)(void)) 0x400684 <foo32>
(gdb) print bar
$4 = {int (void)} 0x40068c <bar>
(gdb) print foo
$5 = {int (void)} 0x400680 <foo>
(gdb) print foop
$6 = (int (*)(void)) 0x400681 <foo>
(gdb)
A-ha! Here's the difference and finally the ISA bit!
(gdb) print /x fooi
$7 = 0x400681
(gdb) p/x $pc
p/x $pc
$8 = 0x400491
(gdb)
And here as well...
(gdb) advance foo
foo () at foobar.c:4
4 }
(gdb) disassemble
Dump of assembler code for function foo:
0x00400680 <+0>: jr ra
0x00400682 <+2>: li v0,1
End of assembler dump.
(gdb) finish
Run till exit from #0 foo () at foobar.c:4
main () at foobar.c:24
24 }
Value returned is $9 = 1
(gdb) continue
Continuing.
[Inferior 1 (process 14103) exited with code 01]
(gdb)
So let's be a bit inquisitive...
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb)
Actually we do not like to run foo here at all. Let's run bar instead!
(gdb) set foop = bar
(gdb) print foop
$10 = (int (*)(void)) 0x40068c <bar>
(gdb)
Hmm, no ISA bit. Is it going to work?
(gdb) advance bar
bar () at foobar.c:9
9 }
(gdb) p/x $pc
$11 = 0x40068c
(gdb) disassemble
Dump of assembler code for function bar:
=> 0x0040068c <+0>: jr ra
0x0040068e <+2>: li v0,2
End of assembler dump.
(gdb) finish
Run till exit from #0 bar () at foobar.c:9
Program received signal SIGILL, Illegal instruction.
bar () at foobar.c:9
9 }
(gdb)
Oops!
(gdb) p/x $pc
$12 = 0x40068c
(gdb)
We're still there!
(gdb) continue
Continuing.
Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb)
So let's try something else:
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) set foop = foo
(gdb) advance foo
foo () at foobar.c:4
4 }
(gdb) disassemble
Dump of assembler code for function foo:
=> 0x00400680 <+0>: jr ra
0x00400682 <+2>: li v0,1
End of assembler dump.
(gdb) finish
Run till exit from #0 foo () at foobar.c:4
Program received signal SIGILL, Illegal instruction.
foo () at foobar.c:4
4 }
(gdb) continue
Continuing.
Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb)
The same problem!
(gdb) run
Starting program:
/net/build2-lucid-cs/scratch/macro/mips-linux-fsf-gcc/isa-bit/foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) set foop = foo32
(gdb) advance foo32
foo32 () at foobar.c:14
14 }
(gdb) disassemble
Dump of assembler code for function foo32:
=> 0x00400684 <+0>: jr ra
0x00400688 <+4>: li v0,3
End of assembler dump.
(gdb) finish
Run till exit from #0 foo32 () at foobar.c:14
main () at foobar.c:24
24 }
Value returned is $14 = 3
(gdb) continue
Continuing.
[Inferior 1 (process 14113) exited with code 03]
(gdb)
That did work though, so it's the ISA bit only!
(gdb) quit
Enough!
That's the tip of the iceberg only though. So let's rebuild the
executable with some dynamic symbols:
$ mips-linux-gnu-gcc -mips16 -Wl,--export-dynamic -g -O2 -o foobar-dyn foobar.c
$ mips-linux-gnu-readelf -s foobar-dyn | egrep 'table|foo|bar'
Symbol table '.dynsym' contains 32 entries:
6: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar
8: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p
9: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop
15: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32
17: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo
25: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi
Symbol table '.symtab' contains 95 entries:
55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c
69: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar
71: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p
72: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop
79: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32
81: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo
89: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi
$
OK, now the ISA bit is there for a change, but the MIPS16 `st_other'
attribute gone, hmm... What does `objdump' do then:
$ mips-linux-gnu-objdump -Tt foobar-dyn | egrep 'SYMBOL|foo|bar'
foobar-dyn: file format elf32-tradbigmips
SYMBOL TABLE:
00000000 l df *ABS* 00000000 foobar.c
004009cc g F .text 00000004 0xf0 bar
00410b88 g O .data 00000004 foo32p
00410b84 g O .data 00000004 foop
004009c4 g F .text 00000008 foo32
004009c0 g F .text 00000004 0xf0 foo
00410b80 g O .data 00000004 fooi
DYNAMIC SYMBOL TABLE:
004009cc g DF .text 00000004 Base 0xf0 bar
00410b88 g DO .data 00000004 Base foo32p
00410b84 g DO .data 00000004 Base foop
004009c4 g DF .text 00000008 Base foo32
004009c0 g DF .text 00000004 Base 0xf0 foo
00410b80 g DO .data 00000004 Base fooi
$
Hmm, the attribute (0xf0, printed raw) is back, and the ISA bit gone
again.
Let's have a look at some DWARF-2 records GDB uses (I'll be stripping
off a lot here for brevity) -- debug info:
$ mips-linux-gnu-readelf -wi foobar
Contents of the .debug_info section:
[...]
Compilation Unit @ offset 0x88:
Length: 0xbb (32-bit)
Version: 4
Abbrev Offset: 62
Pointer Size: 4
<0><93>: Abbrev Number: 1 (DW_TAG_compile_unit)
<94> DW_AT_producer : (indirect string, offset: 0x19e): GNU C 4.8.0 20120513 (experimental) -meb -mips16 -march=mips32r2 -mhard-float -mllsc -mplt -mno-synci -mno-shared -mabi=32 -g -O2
<98> DW_AT_language : 1 (ANSI C)
<99> DW_AT_name : (indirect string, offset: 0x190): foobar.c
<9d> DW_AT_comp_dir : (indirect string, offset: 0x225): [...]
<a1> DW_AT_ranges : 0x0
<a5> DW_AT_low_pc : 0x0
<a9> DW_AT_stmt_list : 0x27
<1><ad>: Abbrev Number: 2 (DW_TAG_subprogram)
<ae> DW_AT_external : 1
<ae> DW_AT_name : foo
<b2> DW_AT_decl_file : 1
<b3> DW_AT_decl_line : 1
<b4> DW_AT_prototyped : 1
<b4> DW_AT_type : <0xc2>
<b8> DW_AT_low_pc : 0x400680
<bc> DW_AT_high_pc : 0x400684
<c0> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<c2> DW_AT_GNU_all_call_sites: 1
<1><c2>: Abbrev Number: 3 (DW_TAG_base_type)
<c3> DW_AT_byte_size : 4
<c4> DW_AT_encoding : 5 (signed)
<c5> DW_AT_name : int
<1><c9>: Abbrev Number: 4 (DW_TAG_subprogram)
<ca> DW_AT_external : 1
<ca> DW_AT_name : (indirect string, offset: 0x18a): foo32
<ce> DW_AT_decl_file : 1
<cf> DW_AT_decl_line : 11
<d0> DW_AT_prototyped : 1
<d0> DW_AT_type : <0xc2>
<d4> DW_AT_low_pc : 0x400684
<d8> DW_AT_high_pc : 0x40068c
<dc> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<de> DW_AT_GNU_all_call_sites: 1
<1><de>: Abbrev Number: 2 (DW_TAG_subprogram)
<df> DW_AT_external : 1
<df> DW_AT_name : bar
<e3> DW_AT_decl_file : 1
<e4> DW_AT_decl_line : 6
<e5> DW_AT_prototyped : 1
<e5> DW_AT_type : <0xc2>
<e9> DW_AT_low_pc : 0x40068c
<ed> DW_AT_high_pc : 0x400690
<f1> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<f3> DW_AT_GNU_all_call_sites: 1
<1><f3>: Abbrev Number: 5 (DW_TAG_subprogram)
<f4> DW_AT_external : 1
<f4> DW_AT_name : (indirect string, offset: 0x199): main
<f8> DW_AT_decl_file : 1
<f9> DW_AT_decl_line : 21
<fa> DW_AT_prototyped : 1
<fa> DW_AT_type : <0xc2>
<fe> DW_AT_low_pc : 0x400490
<102> DW_AT_high_pc : 0x4004a4
<106> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<108> DW_AT_GNU_all_tail_call_sites: 1
[...]
$
-- no sign of the ISA bit anywhere -- frame info:
$ mips-linux-gnu-readelf -wf foobar
[...]
Contents of the .debug_frame section:
00000000 0000000c ffffffff CIE
Version: 1
Augmentation: ""
Code alignment factor: 1
Data alignment factor: -4
Return address column: 31
DW_CFA_def_cfa_register: r29
DW_CFA_nop
00000010 0000000c 00000000 FDE cie=00000000 pc=00400680..00400684
00000020 0000000c 00000000 FDE cie=00000000 pc=00400684..0040068c
00000030 0000000c 00000000 FDE cie=00000000 pc=0040068c..00400690
00000040 00000018 00000000 FDE cie=00000000 pc=00400490..004004a4
DW_CFA_advance_loc: 6 to 00400496
DW_CFA_def_cfa_offset: 32
DW_CFA_offset: r31 at cfa-4
DW_CFA_advance_loc: 6 to 0040049c
DW_CFA_restore: r31
DW_CFA_def_cfa_offset: 0
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
[...]
$
-- no sign of the ISA bit anywhere -- range info (GDB doesn't use arange):
$ mips-linux-gnu-readelf -wR foobar
Contents of the .debug_ranges section:
Offset Begin End
00000000 00400680 00400690
00000000 00400490 004004a4
00000000 <End of list>
$
-- no sign of the ISA bit anywhere -- line info:
$ mips-linux-gnu-readelf -wl foobar
Raw dump of debug contents of section .debug_line:
[...]
Offset: 0x27
Length: 78
DWARF Version: 2
Prologue Length: 31
Minimum Instruction Length: 1
Initial value of 'is_stmt': 1
Line Base: -5
Line Range: 14
Opcode Base: 13
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 args
Opcode 3 has 1 args
Opcode 4 has 1 args
Opcode 5 has 1 args
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 args
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 args
The Directory Table is empty.
The File Name Table:
Entry Dir Time Size Name
1 0 0 0 foobar.c
Line Number Statements:
Extended opcode 2: set Address to 0x400681
Special opcode 6: advance Address by 0 to 0x400681 and Line by 1 to 2
Special opcode 7: advance Address by 0 to 0x400681 and Line by 2 to 4
Special opcode 55: advance Address by 3 to 0x400684 and Line by 8 to 12
Special opcode 7: advance Address by 0 to 0x400684 and Line by 2 to 14
Advance Line by -7 to 7
Special opcode 131: advance Address by 9 to 0x40068d and Line by 0 to 7
Special opcode 7: advance Address by 0 to 0x40068d and Line by 2 to 9
Advance PC by 3 to 0x400690
Extended opcode 1: End of Sequence
Extended opcode 2: set Address to 0x400491
Advance Line by 21 to 22
Copy
Special opcode 6: advance Address by 0 to 0x400491 and Line by 1 to 23
Special opcode 60: advance Address by 4 to 0x400495 and Line by -1 to 22
Special opcode 34: advance Address by 2 to 0x400497 and Line by 1 to 23
Special opcode 62: advance Address by 4 to 0x40049b and Line by 1 to 24
Special opcode 32: advance Address by 2 to 0x40049d and Line by -1 to 23
Special opcode 6: advance Address by 0 to 0x40049d and Line by 1 to 24
Advance PC by 7 to 0x4004a4
Extended opcode 1: End of Sequence
[...]
-- a-ha, the ISA bit is there! However it's not always right for some
reason, I don't have a small test case to show it, but here's an excerpt
from MIPS16 libc, a prologue of a function:
00019630 <__libc_init_first>:
19630: e8a0 jrc ra
19632: 6500 nop
00019634 <_init>:
19634: f000 6a11 li v0,17
19638: f7d8 0b08 la v1,15e00 <_DYNAMIC+0x15c54>
1963c: f400 3240 sll v0,16
19640: e269 addu v0,v1
19642: 659a move gp,v0
19644: 64f6 save 48,ra,s0-s1
19646: 671c move s0,gp
19648: d204 sw v0,16(sp)
1964a: f352 984c lw v0,-27828(s0)
1964e: 6724 move s1,a0
and the corresponding DWARF-2 line info:
Line Number Statements:
Extended opcode 2: set Address to 0x19631
Advance Line by 44 to 45
Copy
Special opcode 8: advance Address by 0 to 0x19631 and Line by 3 to 48
Special opcode 66: advance Address by 4 to 0x19635 and Line by 5 to 53
Advance PC by constant 17 to 0x19646
Special opcode 25: advance Address by 1 to 0x19647 and Line by 6 to 59
Advance Line by -6 to 53
Special opcode 33: advance Address by 2 to 0x19649 and Line by 0 to 53
Special opcode 39: advance Address by 2 to 0x1964b and Line by 6 to 59
Advance Line by -6 to 53
Special opcode 61: advance Address by 4 to 0x1964f and Line by 0 to 53
-- see that "Advance PC by constant 17" there? It clears the ISA bit,
however code at 0x19646 is not standard MIPS code at all. For some
reason the constant is always 17, I've never seen DW_LNS_const_add_pc
used with any other value -- is that a binutils bug or what?
3. Solution:
I think we should retain the value of the ISA bit in code references,
that is effectively treat them as cookies as they indeed are (although
trivially calculated) rather than raw memory byte addresses.
In a perfect world both the static symbol table and the respective
DWARF-2 records should be fixed to include the ISA bit in all the cases.
I think however that this is infeasible.
All the uses of `_bfd_mips_elf_symbol_processing' can not necessarily be
tracked down. This function is used by `elf_slurp_symbol_table' that in
turn is used by `bfd_canonicalize_symtab' and
`bfd_canonicalize_dynamic_symtab', which are public interfaces.
Similarly DWARF-2 records are used outside GDB, one notable if a bit
questionable is the exception unwinder (libgcc/unwind-dw2.c) -- I have
identified at least bits in `execute_cfa_program' and
`uw_frame_state_for', both around the calls to `_Unwind_IsSignalFrame',
that would need an update as they effectively flip the ISA bit freely;
see also the comment about MASK_RETURN_ADDR in gcc/config/mips/mips.h.
But there may be more places. Any change in how DWARF-2 records are
produced would require an update there and would cause compatibility
problems with libgcc.a binaries already distributed; given that this is
a static library a complex change involving function renames would
likely be required.
I propose therefore to accept the existing inconsistencies and deal with
them entirely within GDB. I have figured out that the ISA bit lost in
various places can still be recovered as long as we have symbol
information -- that'll have the `st_other' attribute correctly set to
one of standard MIPS/MIPS16/microMIPS encoding.
Here's the resulting change. It adds a couple of new `gdbarch' hooks,
one to update symbol information with the ISA bit lost in
`_bfd_mips_elf_symbol_processing', and two other ones to adjust DWARF-2
records as they're processed. The ISA bit is set in each address
handled according to information retrieved from the symbol table for the
symbol spanning the address if any; limits are adjusted based on the
address they point to related to the respective base address.
Additionally minimal symbol information has to be adjusted accordingly
in its gdbarch hook.
With these changes in place some complications with ISA bit juggling in
the PC that never fully worked can be removed from the MIPS backend.
Conversely, the generic dynamic linker event special breakpoint symbol
handler has to be updated to call the minimal symbol gdbarch hook to
record that the symbol is a MIPS16 or microMIPS address if applicable or
the breakpoint will be set at the wrong address and either fail to work
or cause SIGTRAPs (this is because the symbol is handled early on and
bypasses regular symbol processing).
4. Results obtained
The change fixes the example above -- to repeat only the crucial steps:
(gdb) break main
Breakpoint 1 at 0x400491: file foobar.c, line 23.
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) print foo
$1 = {int (void)} 0x400681 <foo>
(gdb) set foop = bar
(gdb) advance bar
bar () at foobar.c:9
9 }
(gdb) disassemble
Dump of assembler code for function bar:
=> 0x0040068d <+0>: jr ra
0x0040068f <+2>: li v0,2
End of assembler dump.
(gdb) finish
Run till exit from #0 bar () at foobar.c:9
main () at foobar.c:24
24 }
Value returned is $2 = 2
(gdb) continue
Continuing.
[Inferior 1 (process 14128) exited with code 02]
(gdb)
-- excellent!
The change removes about 90 failures per MIPS16 multilib in mips-sde-elf
testing too, results for MIPS16 are now similar to that for standard
MIPS; microMIPS results are a bit worse because of host-I/O problems in
QEMU used instead of MIPSsim for microMIPS testing only:
=== gdb Summary ===
# of expected passes 14299
# of unexpected failures 187
# of expected failures 56
# of known failures 58
# of unresolved testcases 11
# of untested testcases 52
# of unsupported tests 174
MIPS16:
=== gdb Summary ===
# of expected passes 14298
# of unexpected failures 187
# of unexpected successes 2
# of expected failures 54
# of known failures 58
# of unresolved testcases 12
# of untested testcases 52
# of unsupported tests 174
microMIPS:
=== gdb Summary ===
# of expected passes 14149
# of unexpected failures 201
# of unexpected successes 2
# of expected failures 54
# of known failures 58
# of unresolved testcases 7
# of untested testcases 53
# of unsupported tests 175
2014-12-12 Maciej W. Rozycki <macro@codesourcery.com>
Maciej W. Rozycki <macro@mips.com>
Pedro Alves <pedro@codesourcery.com>
gdb/
* gdbarch.sh (elf_make_msymbol_special): Change type to `F',
remove `predefault' and `invalid_p' initializers.
(make_symbol_special): New architecture method.
(adjust_dwarf2_addr, adjust_dwarf2_line): Likewise.
(objfile, symbol): New declarations.
* arch-utils.h (default_elf_make_msymbol_special): Remove
prototype.
(default_make_symbol_special): New prototype.
(default_adjust_dwarf2_addr): Likewise.
(default_adjust_dwarf2_line): Likewise.
* mips-tdep.h (mips_unmake_compact_addr): New prototype.
* arch-utils.c (default_elf_make_msymbol_special): Remove
function.
(default_make_symbol_special): New function.
(default_adjust_dwarf2_addr): Likewise.
(default_adjust_dwarf2_line): Likewise.
* dwarf2-frame.c (decode_frame_entry_1): Call
`gdbarch_adjust_dwarf2_addr'.
* dwarf2loc.c (dwarf2_find_location_expression): Likewise.
* dwarf2read.c (create_addrmap_from_index): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(add_partial_symbol): Likewise.
(add_partial_subprogram): Likewise.
(process_full_comp_unit): Likewise.
(read_file_scope): Likewise.
(read_func_scope): Likewise. Call `gdbarch_make_symbol_special'.
(read_lexical_block_scope): Call `gdbarch_adjust_dwarf2_addr'.
(read_call_site_scope): Likewise.
(dwarf2_ranges_read): Likewise.
(dwarf2_record_block_ranges): Likewise.
(read_attribute_value): Likewise.
(dwarf_decode_lines_1): Call `gdbarch_adjust_dwarf2_line'.
(new_symbol_full): Call `gdbarch_adjust_dwarf2_addr'.
* elfread.c (elf_symtab_read): Don't call
`gdbarch_elf_make_msymbol_special' if unset.
* mips-linux-tdep.c (micromips_linux_sigframe_validate): Strip
the ISA bit from the PC.
* mips-tdep.c (mips_unmake_compact_addr): New function.
(mips_elf_make_msymbol_special): Set the ISA bit in the symbol's
address appropriately.
(mips_make_symbol_special): New function.
(mips_pc_is_mips): Set the ISA bit before symbol lookup.
(mips_pc_is_mips16): Likewise.
(mips_pc_is_micromips): Likewise.
(mips_pc_isa): Likewise.
(mips_adjust_dwarf2_addr): New function.
(mips_adjust_dwarf2_line): Likewise.
(mips_read_pc, mips_unwind_pc): Keep the ISA bit.
(mips_addr_bits_remove): Likewise.
(mips_skip_trampoline_code): Likewise.
(mips_write_pc): Don't set the ISA bit.
(mips_eabi_push_dummy_call): Likewise.
(mips_o64_push_dummy_call): Likewise.
(mips_gdbarch_init): Install `mips_make_symbol_special',
`mips_adjust_dwarf2_addr' and `mips_adjust_dwarf2_line' gdbarch
handlers.
* solib.c (gdb_bfd_lookup_symbol_from_symtab): Get
target-specific symbol address adjustments.
* gdbarch.h: Regenerate.
* gdbarch.c: Regenerate.
2014-12-12 Maciej W. Rozycki <macro@codesourcery.com>
gdb/testsuite/
* gdb.base/func-ptrs.c: New file.
* gdb.base/func-ptrs.exp: New file.
2014-12-12 14:31:53 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: make_symbol_special = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->make_symbol_special));
|
Implement displaced stepping.
gdb/
* gdbarch.sh (max_insn_length): New 'variable'.
(displaced_step_copy, displaced_step_fixup)
(displaced_step_free_closure, displaced_step_location): New
functions.
(struct displaced_step_closure): Add forward declaration.
* gdbarch.c, gdbarch.h: Regenerated.
* arch-utils.c: #include "objfiles.h".
(simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New functions.
* arch-utils.h (simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New prototypes.
* i386-tdep.c (I386_MAX_INSN_LEN): Rename to...
(I386_MAX_MATCHED_INSN_LEN): ... this.
(i386_absolute_jmp_p, i386_absolute_call_p)
(i386_ret_p, i386_call_p, i386_breakpoint_p, i386_syscall_p)
(i386_displaced_step_fixup): New functions.
(struct i386_insn, i386_match_insn): Update.
(i386_gdbarch_init): Set gdbarch_max_insn_length.
* i386-tdep.h (I386_MAX_INSN_LEN): New.
(i386_displaced_step_fixup): New prototype.
* i386-linux-tdep.c (i386_linux_init_abi): Include "arch-utils.h".
Register gdbarch_displaced_step_copy,
gdbarch_displaced_step_fixup, gdbarch_displaced_step_free_closure,
and gdbarch_displaced_step_location functions.
* infrun.c (debug_displaced): New variable.
(show_debug_displaced): New function.
(struct displaced_step_request): New struct.
(displaced_step_request_queue, displaced_step_ptid)
(displaced_step_gdbarch, displaced_step_closure)
(displaced_step_original, displaced_step_copy)
(displaced_step_saved_copy, can_use_displaced_stepping): New
variables.
(show_can_use_displaced_stepping, use_displaced_stepping)
(displaced_step_clear, cleanup_displaced_step_closure)
(displaced_step_dump_bytes, displaced_step_prepare)
(displaced_step_clear_cleanup, write_memory_ptid)
(displaced_step_fixup): New functions.
(resume): Call displaced_step_prepare.
(proceed): Call read_pc once, and remember the value. If using
displaced stepping, don't remove breakpoints.
(handle_inferior_event): Call displaced_step_fixup. Add some
debugging output. When we try to step over a breakpoint, but get
a signal to deliver to the thread instead, ensure the step-resume
breakpoint is actually inserted. If a thread hop is needed, and
displaced stepping is enabled, don't remove breakpoints.
(init_wait_for_inferior): Call displaced_step_clear.
(_initialize_infrun): Add "set debug displaced" command. Add
"maint set can-use-displaced-stepping" command. Clear
displaced_step_ptid.
* inferior.h (debug_displaced): Declare variable.
(displaced_step_dump_bytes): Declare function.
* Makefile.in (arch-utils.o, i386-linux-tdep.o): Update
dependencies.
gdb/testsuite/
* gdb.asm/asmsrc1.s: Add scratch space.
gdb/doc/
* gdb.texinfo (Debugging Output): Document "set/show debug
displaced".
(Maintenance Commands): Document "maint set/show
can-use-displaced-stepping".
2008-05-02 18:49:54 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_max_insn_length_p() = %d\n",
|
|
|
|
gdbarch_max_insn_length_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: max_insn_length = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->max_insn_length));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: memory_insert_breakpoint = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->memory_insert_breakpoint));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: memory_remove_breakpoint = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->memory_remove_breakpoint));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: num_pseudo_regs = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->num_pseudo_regs));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: num_regs = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->num_regs));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: osabi = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->osabi));
|
2007-05-11 21:57:17 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_overlay_update_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_overlay_update_p (gdbarch));
|
2007-05-11 21:57:17 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: overlay_update = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->overlay_update));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: pc_regnum = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->pc_regnum));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: pointer_to_address = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->pointer_to_address));
|
2016-06-12 00:51:38 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: print_auxv_entry = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->print_auxv_entry));
|
2003-08-17 03:06:47 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: print_float_info = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->print_float_info));
|
2003-08-17 03:06:47 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: print_insn = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->print_insn));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: print_registers_info = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->print_registers_info));
|
2003-08-17 03:06:47 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_print_vector_info_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_print_vector_info_p (gdbarch));
|
2003-08-17 03:06:47 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: print_vector_info = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->print_vector_info));
|
2009-04-30 04:52:16 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_process_record_p() = %d\n",
|
|
|
|
gdbarch_process_record_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: process_record = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->process_record));
|
2009-09-21 07:52:06 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_process_record_signal_p() = %d\n",
|
|
|
|
gdbarch_process_record_signal_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: process_record_signal = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->process_record_signal));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: ps_regnum = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->ps_regnum));
|
2004-06-21 02:17:02 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_pseudo_register_read_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_pseudo_register_read_p (gdbarch));
|
2004-06-21 02:17:02 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: pseudo_register_read = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->pseudo_register_read));
|
2011-07-22 17:31:52 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_pseudo_register_read_value_p() = %d\n",
|
|
|
|
gdbarch_pseudo_register_read_value_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: pseudo_register_read_value = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->pseudo_register_read_value));
|
2004-06-21 02:17:02 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_pseudo_register_write_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_pseudo_register_write_p (gdbarch));
|
2004-06-21 02:17:02 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: pseudo_register_write = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->pseudo_register_write));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: ptr_bit = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->ptr_bit));
|
2003-08-17 03:06:47 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_push_dummy_call_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_push_dummy_call_p (gdbarch));
|
2003-08-17 03:06:47 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: push_dummy_call = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->push_dummy_call));
|
2003-08-17 03:06:47 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_push_dummy_code_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_push_dummy_code_p (gdbarch));
|
2003-08-17 03:06:47 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: push_dummy_code = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->push_dummy_code));
|
2012-12-15 15:27:56 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: ravenscar_ops = %s\n",
|
|
|
|
host_address_to_string (gdbarch->ravenscar_ops));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_read_pc_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_read_pc_p (gdbarch));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: read_pc = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->read_pc));
|
2008-05-02 22:38:16 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_record_special_symbol_p() = %d\n",
|
|
|
|
gdbarch_record_special_symbol_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: record_special_symbol = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->record_special_symbol));
|
2004-06-21 02:17:02 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: register_name = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->register_name));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: register_reggroup_p = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->register_reggroup_p));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: register_sim_regno = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->register_sim_regno));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: register_to_value = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->register_to_value));
|
2003-08-17 03:06:47 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_register_type_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_register_type_p (gdbarch));
|
2003-08-17 03:06:47 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: register_type = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->register_type));
|
2010-05-26 20:19:28 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_relocate_instruction_p() = %d\n",
|
|
|
|
gdbarch_relocate_instruction_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: relocate_instruction = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->relocate_instruction));
|
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o)
(xml-tdesc.o): Update.
* xml-support.c: Add a comment.
(gdb_xml_enums_boolean): New variable.
(gdb_xml_parse_attr_enum): Use strcasecmp.
* xml-support.h (gdb_xml_enums_boolean): Declare.
* xml-tdesc.c (struct tdesc_parsing_data): Record current_feature,
next_regnum, and current_union.
(tdesc_start_feature, tdesc_start_reg, tdesc_start_union)
(tdesc_end_union, tdesc_start_field, tdesc_start_vector)
(field_attributes, union_children, reg_attributes, union_attributes)
(vector_attributes, feature_attributes, feature_children): New.
(target_children): Make static. Add <feature>.
(tdesc_elements): Make static.
* target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p)
(struct tdesc_feature, tdesc_feature_p): New types.
(struct target_desc): Add features member.
(struct tdesc_arch_data, tdesc_data): New.
(target_find_description): Clarify error message. Warn about
ignored register descriptions.
(tdesc_has_registers, tdesc_find_feature, tdesc_feature_name)
(tdesc_named_type, tdesc_data_init, tdesc_data_alloc)
(tdesc_data_cleanup, tdesc_numbered_register)
(tdesc_numbered_register_choices, tdesc_find_register)
(tdesc_register_name, tdesc_register_type)
(tdesc_remote_register_number, tdesc_register_reggroup_p)
(set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type)
(set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers)
(tdesc_free_reg, tdesc_create_reg, tdesc_free_feature)
(tdesc_create_feature, tdesc_record_type): New.
(free_target_description): Free features.
(_initialize_target_descriptions): Initialize tdesc_data.
* arch-utils.c (default_remote_register_number): New.
* arch-utils.h (default_remote_register_number): New prototype.
* target-descriptions.h (set_tdesc_pseudo_register_name)
(set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p)
(tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup)
(tdesc_numbered_register, tdesc_numbered_register_choices)
(tdesc_has_registers, tdesc_find_feature, tdesc_feature_name)
(tdesc_named_type, tdesc_create_feature, tdesc_record_type)
(tdesc_create_reg): Declare.
* gdbarch.sh (remote_register_number): New entry.
* gdbarch.c, gdbarch.h: Regenerate.
* remote.c (init_remote_state): Use gdbarch_remote_register_number.
* features/gdb-target.dtd: Add feature, reg, vector, union, and field.
* arm-tdep.c (arm_register_aliases): New.
(arm_register_name_strings): Rename to...
(arm_register_names): ...this. Make const. Delete the old version.
(current_option, arm_register_byte): Delete.
(set_disassembly_style): Simplify. Do not adjust arm_register_names.
(value_of_arm_user_reg): New.
(arm_gdbarch_init): Verify any described registers. Call
tdesc_use_registers. Don't use arm_register_byte. Create aliases
for standard register names.
(_initialize_arm_tdep): Do not adjust arm_register_names.
* user-regs.c (struct user_reg): Add baton member.
(append_user_reg, user_reg_add_builtin, user_regs_init)
(user_reg_add, value_of_user_reg): Use a baton for user
register functions.
* std-regs.c: Update.
* user-regs.h (user_reg_read_ftype, user_reg_add_builtin)
(user_reg_add): Add baton argument.
* NEWS: Mention target description register support.
* features/arm-core.xml, features/arm-fpa.xml: New.
* eval.c (evaluate_subexp_standard): Allow ptype $register
when the program is not running.
* gdb.texinfo (-target-disconnect): Use @smallexample.
(Requirements): Add anchor for Expat. Update description.
(Target Descriptions): Mention Expat.
(Target Description Format): Document new elements. Use
@smallexample.
(Predefined Target Types, Standard Target Features): New sections.
* doc/gdbint.texinfo (Target Descriptions): New section.
* gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp,
gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: remote_register_number = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->remote_register_number));
|
2012-06-08 16:24:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: return_in_first_hidden_param_p = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->return_in_first_hidden_param_p));
|
2004-06-21 02:17:02 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_return_value_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_return_value_p (gdbarch));
|
2004-06-21 02:17:02 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: return_value = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->return_value));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: sdb_reg_to_regnum = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->sdb_reg_to_regnum));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: short_bit = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->short_bit));
|
2004-10-31 18:38:16 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_single_step_through_delay_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_single_step_through_delay_p (gdbarch));
|
2004-10-31 18:38:16 +01:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: single_step_through_delay = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->single_step_through_delay));
|
PowerPC64 ELFv2 ABI: skip global entry point code
This patch handles another aspect of the ELFv2 ABI, which unfortunately
requires common code changes.
In ELFv2, functions may provide both a global and a local entry point.
The global entry point (where the function symbol points to) is intended
to be used for function-pointer or cross-module (PLT) calls, and requires
r12 to be set up to the entry point address itself. The local entry
point (which is found at a fixed offset after the global entry point,
as defined by bits in the symbol table entries' st_other field), instead
expects r2 to be set up to the current TOC.
Now, when setting a breakpoint on a function by name, you really want
that breakpoint to trigger either way, no matter whether the function
is called via its local or global entry point. Since the global entry
point will always fall through into the local entry point, the way to
achieve that is to simply set the breakpoint at the local entry point.
One way to do that would be to have prologue parsing skip the code
sequence that makes up the global entry point. Unfortunately, this
does not work reliably, since -for optimized code- GDB these days
will not actuall invoke the prologue parsing code but instead just
set the breakpoint at the symbol address and rely on DWARF being
correct at any point throughout the function ...
Unfortunately, I don't really see any way to express the notion of
local entry points with the current set of gdbarch callbacks.
Thus this patch adds a new callback, skip_entrypoint, that is
somewhat analogous to skip_prologue, but is called every time
GDB needs to determine a function start address, even in those
cases where GDB decides to not call skip_prologue.
As a side effect, the skip_entrypoint implementation on ppc64
does not need to perform any instruction parsing; it can simply
rely on the local entry point flags in the symbol table entry.
With this implemented, two test cases would still fail to set
the breakpoint correctly, but that's because they use the construct:
gdb_test "break *hello"
Now, using "*hello" explicitly instructs GDB to set the breakpoint
at the numerical value of "hello" treated as function pointer, so
it will by definition only hit the global entry point.
I think this behaviour is unavoidable, but acceptable -- most people
do not use this construct, and if they do, they get what they
asked for ...
In one of those two test cases, use of this construct is really
not appropriate. I think this was added way back when as a means
to work around prologue skipping problems on some platforms. These
days that shouldn't really be necessary any more ...
For the other (step-bt), we really want to make sure backtracing
works on the very first instruction of the routine. To enable that
test also on powerpc64le-linux, we can modify the code to call the
test function via function pointer (which makes it use the global
entry point in the ELFv2 ABI).
gdb/ChangeLog:
* gdbarch.sh (skip_entrypoint): New callback.
* gdbarch.c, gdbarch.h: Regenerate.
* symtab.c (skip_prologue_sal): Call gdbarch_skip_entrypoint.
* infrun.c (fill_in_stop_func): Likewise.
* ppc-linux-tdep.c: Include "elf/ppc64.h".
(ppc_elfv2_elf_make_msymbol_special): New function.
(ppc_elfv2_skip_entrypoint): Likewise.
(ppc_linux_init_abi): Install them for ELFv2.
gdb/testsuite/ChangeLog:
* gdb.base/sigbpt.exp: Do not use "*" when setting breakpoint
on a function.
* gdb.base/step-bt.c: Call hello via function pointer to make
sure its first instruction is executed on powerpc64le-linux.
2014-02-04 18:44:14 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_skip_entrypoint_p() = %d\n",
|
|
|
|
gdbarch_skip_entrypoint_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: skip_entrypoint = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->skip_entrypoint));
|
2008-06-12 00:03:49 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_skip_main_prologue_p() = %d\n",
|
|
|
|
gdbarch_skip_main_prologue_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: skip_main_prologue = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->skip_main_prologue));
|
2007-05-07 20:20:21 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: skip_permanent_breakpoint = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->skip_permanent_breakpoint));
|
2003-11-09 13:07:16 +01:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: skip_prologue = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->skip_prologue));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: skip_solib_resolver = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->skip_solib_resolver));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: skip_trampoline_code = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->skip_trampoline_code));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_software_single_step_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_software_single_step_p (gdbarch));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: software_single_step = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->software_single_step));
|
2007-10-19 14:26:35 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: sofun_address_maybe_missing = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->sofun_address_maybe_missing));
|
2010-03-08 20:28:27 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: solib_symbols_extension = %s\n",
|
|
|
|
pstring (gdbarch->solib_symbols_extension));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: sp_regnum = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->sp_regnum));
|
2004-06-21 02:17:02 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: stab_reg_to_regnum = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->stab_reg_to_regnum));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: stabs_argument_has_addr = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->stabs_argument_has_addr));
|
2015-06-04 18:26:29 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: stack_frame_destroyed_p = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->stack_frame_destroyed_p));
|
2012-04-27 22:47:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: stap_gdb_register_prefix = %s\n",
|
2012-10-22 15:35:43 +02:00
|
|
|
pstring (gdbarch->stap_gdb_register_prefix));
|
2012-04-27 22:47:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: stap_gdb_register_suffix = %s\n",
|
2012-10-22 15:35:43 +02:00
|
|
|
pstring (gdbarch->stap_gdb_register_suffix));
|
2012-04-27 22:47:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
"gdbarch_dump: stap_integer_prefixes = %s\n",
|
|
|
|
pstring_list (gdbarch->stap_integer_prefixes));
|
2012-04-27 22:47:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
"gdbarch_dump: stap_integer_suffixes = %s\n",
|
|
|
|
pstring_list (gdbarch->stap_integer_suffixes));
|
2012-04-27 22:47:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_stap_is_single_operand_p() = %d\n",
|
|
|
|
gdbarch_stap_is_single_operand_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: stap_is_single_operand = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->stap_is_single_operand));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_stap_parse_special_token_p() = %d\n",
|
|
|
|
gdbarch_stap_parse_special_token_p (gdbarch));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: stap_parse_special_token = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->stap_parse_special_token));
|
|
|
|
fprintf_unfiltered (file,
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
"gdbarch_dump: stap_register_indirection_prefixes = %s\n",
|
|
|
|
pstring_list (gdbarch->stap_register_indirection_prefixes));
|
2012-04-27 22:47:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
"gdbarch_dump: stap_register_indirection_suffixes = %s\n",
|
|
|
|
pstring_list (gdbarch->stap_register_indirection_suffixes));
|
2012-04-27 22:47:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
"gdbarch_dump: stap_register_prefixes = %s\n",
|
|
|
|
pstring_list (gdbarch->stap_register_prefixes));
|
2012-04-27 22:47:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
"gdbarch_dump: stap_register_suffixes = %s\n",
|
|
|
|
pstring_list (gdbarch->stap_register_suffixes));
|
2007-10-19 14:23:21 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: gdbarch_static_transform_name_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_static_transform_name_p (gdbarch));
|
2007-10-19 14:23:21 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: static_transform_name = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->static_transform_name));
|
New gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind
This patch adds two gdbarch methods breakpoint_kind_from_pc and
sw_breakpoint_from_kind, and uses target_info.placed_size as "kind"
of the breakpoint. This patch updates the usages of
target_info.placed_size.
The "kind" of a breakpoint is determined by gdbarch rather than
target, so we have gdbarch method breakpoint_kind_from_pc, and we
should set target_info.placed_size out of each implementation of
target to_insert_breakpoint. In this way, each target doesn't have
to set target_info.placed_size any more.
This patch also sets target_info.placed_address before
target_insert_breakpoint too, so that target to_insert_breakpoint
can use it, see record_full_insert_breakpoint.
Before we call target_insert_breakpoint, we set
target_info.placed_address and target_info.placed_size like this,
CORE_ADDR addr = bl->target_info.reqstd_address;
bl->target_info.placed_size = gdbarch_breakpoint_kind_from_pc (bl->gdbarch, &addr);
bl->target_info.placed_address = addr;
return target_insert_breakpoint (bl->gdbarch, &bl->target_info);
target_insert_breakpoint may fail, but it doesn't matter to the "kind"
and "placed_address" of a breakpoint. They should be determined by
gdbarch.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): Define
breakpoint_kind_from_pc and sw_breakpoint_from_kind.
(GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN): Likewise.
(SET_GDBARCH_BREAKPOINT_MANIPULATION): Call
set_gdbarch_breakpoint_kind_from_pc and
set_gdbarch_sw_breakpoint_from_kind.
* arm-tdep.c: Add comments.
* bfin-tdep.c: Likewise.
* breakpoint.c (breakpoint_kind): New function.
(insert_bp_location): Set target_info.placed_size and
target_info.placed_address.
(bkpt_insert_location): Likewise.
* cris-tdep.c: Add comments.
* gdbarch.sh (breakpoint_kind_from_pc): New.
(sw_breakpoint_from_kind): New.
* gdbarch.c, gdbarch.h: Regenerated.
* ia64-tdep.c (ia64_memory_insert_breakpoint): Don't set
bp_tgt->placed_size.
(ia64_memory_remove_breakpoint): Don't assert
bp_tgt->placed_size.
(ia64_breakpoint_kind_from_pc): New function.
(ia64_gdbarch_init): Install ia64_breakpoint_kind_from_pc.
* m32r-tdep.c (m32r_memory_insert_breakpoint): Don't set
bp_tgt->placed_size.
* mem-break.c (default_memory_insert_breakpoint): Don't set
bp_tgt->placed_size. Call gdbarch_sw_breakpoint_from_kind.
(default_memory_remove_breakpoint): Call
gdbarch_sw_breakpoint_from_kind.
(memory_validate_breakpoint): Don't check bp_tgt->placed_size.
* mips-tdep.c: Add comments.
* mt-tdep.c: Likewise.
* nios2-tdep.c: Likewise.
* record-full.c (record_full_insert_breakpoint): Don't call
gdbarch_breakpoint_from_pc. Don't set bp_tgt->placed_address
and bp_tgt->placed_size.
* remote.c (remote_insert_breakpoint): Don't call
gdbarch_remote_breakpoint_from_pc. Use bp_tgt->placed_size.
Don't set bp_tgt->placed_address and bp_tgt->placed_size.
(remote_insert_hw_breakpoint): Likewise.
* score-tdep.c: Likewise.
* sh-tdep.c: Likewise.
* tic6x-tdep.c: Likewise.
* v850-tdep.c: Likewise.
* xtensa-tdep.c: Likewise.
2016-11-03 15:35:13 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: sw_breakpoint_from_kind = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->sw_breakpoint_from_kind));
|
Partial fix for PR breakpoints/10737: Make syscall info be per-arch instead of global
This patch intends to partially fix PR breakpoints/10737, which is
about making the syscall information (for the "catch syscall" command)
be per-arch, instead of global. This is not a full fix because of the
other issues pointed by Pedro here:
<https://sourceware.org/bugzilla/show_bug.cgi?id=10737#c5>
However, I consider it a good step towards the real fix. It will also
help me fix <https://sourceware.org/bugzilla/show_bug.cgi?id=17402>.
What this patch does, basically, is move the "syscalls_info"
struct to gdbarch. Currently, the syscall information is stored in a
global variable inside gdb/xml-syscall.c, which means that there is no
easy way to correlate this info with the current target or
architecture being used, for example. This causes strange behaviors,
because the syscall info is not re-read when the arch changes. For
example, if you put a syscall catchpoint in syscall 5 on i386 (syscall
open), and then load a x86_64 program on GDB and put the same syscall
5 there (fstat on x86_64), you will still see that GDB tells you that
it is catching "open", even though it is not. With this patch, GDB
correctly says that it will be catching fstat syscalls.
(gdb) set architecture i386
The target architecture is assumed to be i386
(gdb) catch syscall 5
Catchpoint 1 (syscall 'open' [5])
(gdb) set architecture i386:x86-64
The target architecture is assumed to be i386:x86-64
(gdb) catch syscall 5
Catchpoint 2 (syscall 'open' [5])
But with the patch:
(gdb) set architecture i386
The target architecture is assumed to be i386
(gdb) catch syscall 5
Catchpoint 1 (syscall 'open' [5])
(gdb) set architecture i386:x86-64
The target architecture is assumed to be i386:x86-64
(gdb) catch syscall 5
Catchpoint 2 (syscall 'fstat' [5])
As I said, there are still some problems on the "catch syscall"
mechanism, because (for example) the user should be able to "catch
syscall open" on i386, and then expect "open" to be caught also on
x86_64. Currently, it doesn't work. I intend to work on this later.
gdb/
2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/10737
* amd64-linux-tdep.c (amd64_linux_init_abi_common): Adjust call to
set_xml_syscall_file_name to provide gdbarch.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* bfin-linux-tdep.c (bfin_linux_init_abi): Likewise.
* breakpoint.c (print_it_catch_syscall): Adjust call to
get_syscall_by_number to provide gdbarch.
(print_one_catch_syscall): Likewise.
(print_mention_catch_syscall): Likewise.
(print_recreate_catch_syscall): Likewise.
(catch_syscall_split_args): Adjust calls to get_syscall_by_number
and get_syscall_by_name to provide gdbarch.
(catch_syscall_completer): Adjust call to get_syscall_names to
provide gdbarch.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* gdbarch.sh: Forward declare "struct syscalls_info".
(xml_syscall_file): New variable.
(syscalls_info): Likewise.
* i386-linux-tdep.c (i386_linux_init_abi): Adjust call to
set_xml_syscall_file_name to provide gdbarch.
* mips-linux-tdep.c (mips_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* sparc-linux-tdep.c (sparc32_linux_init_abi): Likewise.
* sparc64-linux-tdep.c (sparc64_linux_init_abi): Likewise.
* xml-syscall.c: Include gdbarch.h.
(set_xml_syscall_file_name): Accept gdbarch parameter.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
(my_gdb_datadir): Delete global variable.
(struct syscalls_info) <my_gdb_datadir>: New variable.
(struct syscalls_info) <sysinfo>: Rename variable to
"syscalls_info".
(sysinfo): Delete global variable.
(have_initialized_sysinfo): Likewise.
(xml_syscall_file): Likewise.
(sysinfo_free_syscalls_desc): Rename to...
(syscalls_info_free_syscalls_desc): ... this.
(free_syscalls_info): Rename "sysinfo" to "syscalls_info". Adjust
code to the new layout of "struct syscalls_info".
(make_cleanup_free_syscalls_info): Rename parameter "sysinfo" to
"syscalls_info".
(syscall_create_syscall_desc): Likewise.
(syscall_start_syscall): Likewise.
(syscall_parse_xml): Likewise.
(xml_init_syscalls_info): Likewise. Drop "const" from return value.
(init_sysinfo): Rename to...
(init_syscalls_info): ...this. Add gdbarch as a parameter.
Adjust function to deal with gdbarch.
(xml_get_syscall_number): Delete parameter sysinfo. Accept
gdbarch as a parameter. Adjust code.
(xml_get_syscall_name): Likewise.
(xml_list_of_syscalls): Likewise.
(set_xml_syscall_file_name): Accept gdbarch as parameter.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
* xml-syscall.h (set_xml_syscall_file_name): Likewise.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
gdb/testsuite/
2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/10737
* gdb.base/catch-syscall.exp (do_syscall_tests): Call
test_catch_syscall_multi_arch.
(test_catch_syscall_multi_arch): New function.
2014-11-20 18:28:18 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: syscalls_info = %s\n",
|
|
|
|
host_address_to_string (gdbarch->syscalls_info));
|
2006-11-28 23:10:26 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: target_desc = %s\n",
|
2009-01-09 12:06:48 +01:00
|
|
|
host_address_to_string (gdbarch->target_desc));
|
2001-09-30 00:35:53 +02:00
|
|
|
fprintf_unfiltered (file,
|
2004-06-21 02:17:02 +02:00
|
|
|
"gdbarch_dump: gdbarch_unwind_pc_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_unwind_pc_p (gdbarch));
|
2003-08-17 03:06:47 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: unwind_pc = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->unwind_pc));
|
2003-06-07 20:08:25 +02:00
|
|
|
fprintf_unfiltered (file,
|
2004-06-21 02:17:02 +02:00
|
|
|
"gdbarch_dump: gdbarch_unwind_sp_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_unwind_sp_p (gdbarch));
|
2003-06-07 20:08:25 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: unwind_sp = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->unwind_sp));
|
2017-02-28 19:32:07 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: valid_disassembler_options = %s\n",
|
2017-03-07 16:49:10 +01:00
|
|
|
host_address_to_string (gdbarch->valid_disassembler_options));
|
2007-01-08 21:03:49 +01:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: value_from_register = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->value_from_register));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: value_to_register = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->value_to_register));
|
* NEWS: Mention pointer to member improvements.
* Makefile.in (gnu-v3-abi.o): Delete special rule.
(eval.o, gnu-v3-abi.o, ia64-tdep.o): Update.
* ada-valprint.c (ada_print_scalar): Update for new type codes.
* c-typeprint.c (c_print_type): Update for new type codes.
(c_type_print_varspec_prefix, c_type_print_varspec_suffix)
(c_type_print_base): Likewise.
(c_type_print_args): Rewrite.
* c-valprint.c (c_val_print): Update for new type codes. Remove
support for references to members. Treat methods like functions.
* cp-abi.c (cplus_print_method_ptr, cplus_method_ptr_size)
(cplus_make_method_ptr, cplus_method_ptr_to_value): New.
* cp-abi.h (cplus_print_method_ptr, cplus_method_ptr_size)
(cplus_make_method_ptr, cplus_method_ptr_to_value): New prototypes.
(struct cp_abi_ops): Add corresponding members.
* cp-valprint.c (cp_print_class_method): Delete.
(cp_find_class_member): New function.
(cp_print_class_member): Use it. Simplify support for bogus
member pointers.
* dwarf2read.c (quirk_gcc_member_function_pointer): Use
lookup_methodptr_type.
(read_tag_ptr_to_member_type): Likewise, and lookup_memberptr_type.
* eval.c (evaluate_subexp_standard): Implement EVAL_SKIP for
OP_SCOPE. Update call to value_aggregate_elt. Rewrite member
pointer support.
(evaluate_subexp_for_address): Handle OP_SCOPE explicitly. Handle
references returned by user defined operators.
* f-typeprint.c (f_print_type, f_type_print_varspec_prefix)
(f_type_print_varspec_suffix): Remove support for member pointers.
* gdbtypes.c (lookup_memberptr_type): Renamed from lookup_member_type
and adjusted.
(smash_to_memberptr_type): Likewise, from smash_to_member_type.
(lookup_methodptr_type): New.
(rank_one_type): Adjust for TYPE_CODE_MEMBERPTR.
(recursive_dump_type): Update for new types.
* gdbtypes.h (enum type_code): Replace TYPE_CODE_MEMBER with
TYPE_CODE_MEMBERPTR and TYPE_CODE_METHODPTR.
(lookup_memberptr_type, lookup_methodptr_type)
(smash_to_memberptr_type): New prototypes.
(smash_to_method_type): Formatting fix.
(lookup_member_type, smash_to_member_type): Delete prototypes.
* gnu-v3-abi.c (gnuv3_get_vtable, gnuv3_get_virtual_fn): New.
Do not rely on debug information for the vptr or the method's
enclosing type. Handle function descriptors for IA64.
(gnuv3_virtual_fn_field): Rewrite using the new functions.
(gnuv3_find_method_in, gnuv3_print_method_ptr)
(gnuv3_method_ptr_size, gnuv3_make_method_ptr)
(gnuv3_method_ptr_to_value): New.
(init_gnuv3_ops): Set new members of gnu_v3_abi_ops.
* hpread.c (hpread_type_lookup): Update for new types.
* infcall.c (value_arg_coerce): Likewise.
* m2-typeprint.c (m2_print_type): Remove explicit support
for member pointers.
* m2-valprint.c (m2_val_print): Likewise.
* p-typeprint.c (pascal_type_print_varspec_prefix)
(pascal_type_print_varspec_suffix, pascal_type_print_base): Likewise.
* p-valprint.c (pascal_val_print): Likewise.
(pascal_object_print_class_method, pascal_object_print_class_member):
Delete.
* p-lang.h (pascal_object_print_class_method)
(pascal_object_print_class_member): Delete prototypes.
* stabsread.c (read_type): Update for new types.
* typeprint.c (print_type_scalar): Likewise.
* valops.c (value_struct_elt_for_reference, value_namespace_elt)
(value_maybe_namespace_elt, value_aggregate_elt): Add want_address
argument. Construct a pointer to member if the address of a
function or data member is requested.
(value_cast_pointers): Don't modify the input value.
(value_cast): Adjust pointer to member handling for new types.
Allow null pointer to member constants. Don't modify the input
value.
(value_ind): Remove pointer to member check. Handle function
descriptors for function pointers.
(value_struct_elt, value_find_oload_method_list, check_field):
Remove pointer to member checks.
* value.c (unpack_long): Allow pointers to data members.
(value_from_longest): Allow member pointers.
* value.h (value_aggregate_elt): Add want_address.
* varobj.c (c_variable_editable): Remove check for members.
* gdbarch.sh: Add vtable_function_descriptors and vbit_in_delta.
* ia64-tdep.c (ia64_convert_from_func_ptr_addr): Handle descriptors
in virtual tables.
(ia64_gdbarch_init): Call set_gdbarch_vtable_function_descriptors.
* c-lang.h (cp_print_class_method): Delete prototype.
* arm-tdep.c (arm_gdbarch_init): Call set_gdbarch_vbit_in_delta.
* mips-tdep.c (mips_gdbarch_init): Likewise.
* gdbarch.c, gdbarch.h: Regenerated.
* gdb.cp/classes.exp (test_pointers_to_class_members): Update expected
output. Test the types of members and member pointers.
* gdb.cp/inherit.exp (test_print_mi_member_types): Remove KFAILs for
gdb/2092.
* gdb.cp/member-ptr.exp: Search for a comment instead of a
statement. Enable for GCC. Update expected output for some tests
and add new tests. Remove obsolete GCC KFAILs. Allow GCC's class
layout.
* gdb.cp/member-ptr.cc (Padding, Padding::vspacer, Base, Base::get_x)
(Base::vget_base, Left, Left::vget, Right, Right::vget, Diamond)
(Diamond::vget_base): New.
(main): Add new tests.
* gdb.cp/printmethod.exp: Update expected output for member functions.
* gdb.cp/virtfunc.exp (test_virtual_calls): Add a KFAIL for
print pEe->D::vg().
2007-01-03 19:05:45 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: vbit_in_delta = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->vbit_in_delta));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: virtual_frame_pointer = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->virtual_frame_pointer));
|
2014-10-10 16:57:13 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: vsyscall_range = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->vsyscall_range));
|
* NEWS: Mention pointer to member improvements.
* Makefile.in (gnu-v3-abi.o): Delete special rule.
(eval.o, gnu-v3-abi.o, ia64-tdep.o): Update.
* ada-valprint.c (ada_print_scalar): Update for new type codes.
* c-typeprint.c (c_print_type): Update for new type codes.
(c_type_print_varspec_prefix, c_type_print_varspec_suffix)
(c_type_print_base): Likewise.
(c_type_print_args): Rewrite.
* c-valprint.c (c_val_print): Update for new type codes. Remove
support for references to members. Treat methods like functions.
* cp-abi.c (cplus_print_method_ptr, cplus_method_ptr_size)
(cplus_make_method_ptr, cplus_method_ptr_to_value): New.
* cp-abi.h (cplus_print_method_ptr, cplus_method_ptr_size)
(cplus_make_method_ptr, cplus_method_ptr_to_value): New prototypes.
(struct cp_abi_ops): Add corresponding members.
* cp-valprint.c (cp_print_class_method): Delete.
(cp_find_class_member): New function.
(cp_print_class_member): Use it. Simplify support for bogus
member pointers.
* dwarf2read.c (quirk_gcc_member_function_pointer): Use
lookup_methodptr_type.
(read_tag_ptr_to_member_type): Likewise, and lookup_memberptr_type.
* eval.c (evaluate_subexp_standard): Implement EVAL_SKIP for
OP_SCOPE. Update call to value_aggregate_elt. Rewrite member
pointer support.
(evaluate_subexp_for_address): Handle OP_SCOPE explicitly. Handle
references returned by user defined operators.
* f-typeprint.c (f_print_type, f_type_print_varspec_prefix)
(f_type_print_varspec_suffix): Remove support for member pointers.
* gdbtypes.c (lookup_memberptr_type): Renamed from lookup_member_type
and adjusted.
(smash_to_memberptr_type): Likewise, from smash_to_member_type.
(lookup_methodptr_type): New.
(rank_one_type): Adjust for TYPE_CODE_MEMBERPTR.
(recursive_dump_type): Update for new types.
* gdbtypes.h (enum type_code): Replace TYPE_CODE_MEMBER with
TYPE_CODE_MEMBERPTR and TYPE_CODE_METHODPTR.
(lookup_memberptr_type, lookup_methodptr_type)
(smash_to_memberptr_type): New prototypes.
(smash_to_method_type): Formatting fix.
(lookup_member_type, smash_to_member_type): Delete prototypes.
* gnu-v3-abi.c (gnuv3_get_vtable, gnuv3_get_virtual_fn): New.
Do not rely on debug information for the vptr or the method's
enclosing type. Handle function descriptors for IA64.
(gnuv3_virtual_fn_field): Rewrite using the new functions.
(gnuv3_find_method_in, gnuv3_print_method_ptr)
(gnuv3_method_ptr_size, gnuv3_make_method_ptr)
(gnuv3_method_ptr_to_value): New.
(init_gnuv3_ops): Set new members of gnu_v3_abi_ops.
* hpread.c (hpread_type_lookup): Update for new types.
* infcall.c (value_arg_coerce): Likewise.
* m2-typeprint.c (m2_print_type): Remove explicit support
for member pointers.
* m2-valprint.c (m2_val_print): Likewise.
* p-typeprint.c (pascal_type_print_varspec_prefix)
(pascal_type_print_varspec_suffix, pascal_type_print_base): Likewise.
* p-valprint.c (pascal_val_print): Likewise.
(pascal_object_print_class_method, pascal_object_print_class_member):
Delete.
* p-lang.h (pascal_object_print_class_method)
(pascal_object_print_class_member): Delete prototypes.
* stabsread.c (read_type): Update for new types.
* typeprint.c (print_type_scalar): Likewise.
* valops.c (value_struct_elt_for_reference, value_namespace_elt)
(value_maybe_namespace_elt, value_aggregate_elt): Add want_address
argument. Construct a pointer to member if the address of a
function or data member is requested.
(value_cast_pointers): Don't modify the input value.
(value_cast): Adjust pointer to member handling for new types.
Allow null pointer to member constants. Don't modify the input
value.
(value_ind): Remove pointer to member check. Handle function
descriptors for function pointers.
(value_struct_elt, value_find_oload_method_list, check_field):
Remove pointer to member checks.
* value.c (unpack_long): Allow pointers to data members.
(value_from_longest): Allow member pointers.
* value.h (value_aggregate_elt): Add want_address.
* varobj.c (c_variable_editable): Remove check for members.
* gdbarch.sh: Add vtable_function_descriptors and vbit_in_delta.
* ia64-tdep.c (ia64_convert_from_func_ptr_addr): Handle descriptors
in virtual tables.
(ia64_gdbarch_init): Call set_gdbarch_vtable_function_descriptors.
* c-lang.h (cp_print_class_method): Delete prototype.
* arm-tdep.c (arm_gdbarch_init): Call set_gdbarch_vbit_in_delta.
* mips-tdep.c (mips_gdbarch_init): Likewise.
* gdbarch.c, gdbarch.h: Regenerated.
* gdb.cp/classes.exp (test_pointers_to_class_members): Update expected
output. Test the types of members and member pointers.
* gdb.cp/inherit.exp (test_print_mi_member_types): Remove KFAILs for
gdb/2092.
* gdb.cp/member-ptr.exp: Search for a comment instead of a
statement. Enable for GCC. Update expected output for some tests
and add new tests. Remove obsolete GCC KFAILs. Allow GCC's class
layout.
* gdb.cp/member-ptr.cc (Padding, Padding::vspacer, Base, Base::get_x)
(Base::vget_base, Left, Left::vget, Right, Right::vget, Diamond)
(Diamond::vget_base): New.
(main): Add new tests.
* gdb.cp/printmethod.exp: Update expected output for member functions.
* gdb.cp/virtfunc.exp (test_virtual_calls): Add a KFAIL for
print pEe->D::vg().
2007-01-03 19:05:45 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: vtable_function_descriptors = %s\n",
|
2008-09-05 00:49:30 +02:00
|
|
|
plongest (gdbarch->vtable_function_descriptors));
|
Teach GDB that wchar_t is a built-in type in C++ mode
GDB is currently not aware that wchar_t is a built-in type in C++
mode. This is usually not a problem because the debug info describes
the type, so when you have a program loaded, you don't notice this.
However, if you try expressions involving wchar_t before a program is
loaded, gdb errors out:
(gdb) p (wchar_t)-1
No symbol table is loaded. Use the "file" command.
(gdb) p L"hello"
No type named wchar_t.
(gdb) ptype L"hello"
No type named wchar_t.
This commit teaches gdb about the type. After:
(gdb) p (wchar_t)-1
$1 = -1 L'\xffffffff'
(gdb) p L"hello"
$2 = L"hello"
(gdb) ptype L"hello"
type = wchar_t [6]
Unlike char16_t/char32_t, unfortunately, the underlying type of
wchar_t is implementation dependent, both size and signness. So this
requires adding a couple new gdbarch hooks.
I grepped the GCC code base for WCHAR_TYPE and WCHAR_TYPE_SIZE, and it
seems to me that the majority of the ABIs have a 4-byte signed
wchar_t, so that's what I made the default for GDB too. And then I
looked for which ports have a 16-bit and/or unsigned wchar_t, and made
GDB follow suit.
gdb/ChangeLog:
2017-04-12 Pedro Alves <palves@redhat.com>
PR gdb/21323
* c-lang.c (cplus_primitive_types) <cplus_primitive_type_wchar_t>:
New enum value.
(cplus_language_arch_info): Register cplus_primitive_type_wchar_t.
* gdbtypes.h (struct builtin_type) <builtin_wchar>: New field.
* gdbtypes.c (gdbtypes_post_init): Create the "wchar_t" type.
* gdbarch.sh (wchar_bit, wchar_signed): New per-arch values.
* gdbarch.h, gdbarch.c: Regenerate.
* aarch64-tdep.c (aarch64_gdbarch_init): Override
gdbarch_wchar_bit and gdbarch_wchar_signed.
* alpha-tdep.c (alpha_gdbarch_init): Likewise.
* arm-tdep.c (arm_gdbarch_init): Likewise.
* avr-tdep.c (avr_gdbarch_init): Likewise.
* h8300-tdep.c (h8300_gdbarch_init): Likewise.
* i386-nto-tdep.c (i386nto_init_abi): Likewise.
* i386-tdep.c (i386_go32_init_abi): Likewise.
* m32r-tdep.c (m32r_gdbarch_init): Likewise.
* moxie-tdep.c (moxie_gdbarch_init): Likewise.
* nds32-tdep.c (nds32_gdbarch_init): Likewise.
* rs6000-aix-tdep.c (rs6000_aix_init_osabi): Likewise.
* sh-tdep.c (sh_gdbarch_init): Likewise.
* sparc-tdep.c (sparc32_gdbarch_init): Likewise.
* sparc64-tdep.c (sparc64_init_abi): Likewise.
* windows-tdep.c (windows_init_abi): Likewise.
* xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise.
gdb/testsuite/ChangeLog:
2017-04-12 Pedro Alves <palves@redhat.com>
PR gdb/21323
* gdb.cp/wide_char_types.c: Include <wchar.h>.
(wchar): New global.
* gdb.cp/wide_char_types.exp (wide_char_types_program)
(do_test_wide_char, wide_char_types_no_program, top level): Add
wchar_t testing.
2017-04-12 15:00:49 +02:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: wchar_bit = %s\n",
|
|
|
|
plongest (gdbarch->wchar_bit));
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: wchar_signed = %s\n",
|
|
|
|
plongest (gdbarch->wchar_signed));
|
2000-06-10 07:37:47 +02:00
|
|
|
fprintf_unfiltered (file,
|
2007-06-16 00:44:56 +02:00
|
|
|
"gdbarch_dump: gdbarch_write_pc_p() = %d\n",
|
2007-11-12 07:47:56 +01:00
|
|
|
gdbarch_write_pc_p (gdbarch));
|
2004-06-21 19:54:57 +02:00
|
|
|
fprintf_unfiltered (file,
|
2009-01-09 12:06:48 +01:00
|
|
|
"gdbarch_dump: write_pc = <%s>\n",
|
|
|
|
host_address_to_string (gdbarch->write_pc));
|
Partial fix for PR breakpoints/10737: Make syscall info be per-arch instead of global
This patch intends to partially fix PR breakpoints/10737, which is
about making the syscall information (for the "catch syscall" command)
be per-arch, instead of global. This is not a full fix because of the
other issues pointed by Pedro here:
<https://sourceware.org/bugzilla/show_bug.cgi?id=10737#c5>
However, I consider it a good step towards the real fix. It will also
help me fix <https://sourceware.org/bugzilla/show_bug.cgi?id=17402>.
What this patch does, basically, is move the "syscalls_info"
struct to gdbarch. Currently, the syscall information is stored in a
global variable inside gdb/xml-syscall.c, which means that there is no
easy way to correlate this info with the current target or
architecture being used, for example. This causes strange behaviors,
because the syscall info is not re-read when the arch changes. For
example, if you put a syscall catchpoint in syscall 5 on i386 (syscall
open), and then load a x86_64 program on GDB and put the same syscall
5 there (fstat on x86_64), you will still see that GDB tells you that
it is catching "open", even though it is not. With this patch, GDB
correctly says that it will be catching fstat syscalls.
(gdb) set architecture i386
The target architecture is assumed to be i386
(gdb) catch syscall 5
Catchpoint 1 (syscall 'open' [5])
(gdb) set architecture i386:x86-64
The target architecture is assumed to be i386:x86-64
(gdb) catch syscall 5
Catchpoint 2 (syscall 'open' [5])
But with the patch:
(gdb) set architecture i386
The target architecture is assumed to be i386
(gdb) catch syscall 5
Catchpoint 1 (syscall 'open' [5])
(gdb) set architecture i386:x86-64
The target architecture is assumed to be i386:x86-64
(gdb) catch syscall 5
Catchpoint 2 (syscall 'fstat' [5])
As I said, there are still some problems on the "catch syscall"
mechanism, because (for example) the user should be able to "catch
syscall open" on i386, and then expect "open" to be caught also on
x86_64. Currently, it doesn't work. I intend to work on this later.
gdb/
2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/10737
* amd64-linux-tdep.c (amd64_linux_init_abi_common): Adjust call to
set_xml_syscall_file_name to provide gdbarch.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* bfin-linux-tdep.c (bfin_linux_init_abi): Likewise.
* breakpoint.c (print_it_catch_syscall): Adjust call to
get_syscall_by_number to provide gdbarch.
(print_one_catch_syscall): Likewise.
(print_mention_catch_syscall): Likewise.
(print_recreate_catch_syscall): Likewise.
(catch_syscall_split_args): Adjust calls to get_syscall_by_number
and get_syscall_by_name to provide gdbarch.
(catch_syscall_completer): Adjust call to get_syscall_names to
provide gdbarch.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* gdbarch.sh: Forward declare "struct syscalls_info".
(xml_syscall_file): New variable.
(syscalls_info): Likewise.
* i386-linux-tdep.c (i386_linux_init_abi): Adjust call to
set_xml_syscall_file_name to provide gdbarch.
* mips-linux-tdep.c (mips_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* sparc-linux-tdep.c (sparc32_linux_init_abi): Likewise.
* sparc64-linux-tdep.c (sparc64_linux_init_abi): Likewise.
* xml-syscall.c: Include gdbarch.h.
(set_xml_syscall_file_name): Accept gdbarch parameter.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
(my_gdb_datadir): Delete global variable.
(struct syscalls_info) <my_gdb_datadir>: New variable.
(struct syscalls_info) <sysinfo>: Rename variable to
"syscalls_info".
(sysinfo): Delete global variable.
(have_initialized_sysinfo): Likewise.
(xml_syscall_file): Likewise.
(sysinfo_free_syscalls_desc): Rename to...
(syscalls_info_free_syscalls_desc): ... this.
(free_syscalls_info): Rename "sysinfo" to "syscalls_info". Adjust
code to the new layout of "struct syscalls_info".
(make_cleanup_free_syscalls_info): Rename parameter "sysinfo" to
"syscalls_info".
(syscall_create_syscall_desc): Likewise.
(syscall_start_syscall): Likewise.
(syscall_parse_xml): Likewise.
(xml_init_syscalls_info): Likewise. Drop "const" from return value.
(init_sysinfo): Rename to...
(init_syscalls_info): ...this. Add gdbarch as a parameter.
Adjust function to deal with gdbarch.
(xml_get_syscall_number): Delete parameter sysinfo. Accept
gdbarch as a parameter. Adjust code.
(xml_get_syscall_name): Likewise.
(xml_list_of_syscalls): Likewise.
(set_xml_syscall_file_name): Accept gdbarch as parameter.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
* xml-syscall.h (set_xml_syscall_file_name): Likewise.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
gdb/testsuite/
2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/10737
* gdb.base/catch-syscall.exp (do_syscall_tests): Call
test_catch_syscall_multi_arch.
(test_catch_syscall_multi_arch): New function.
2014-11-20 18:28:18 +01:00
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"gdbarch_dump: xml_syscall_file = %s\n",
|
|
|
|
pstring (gdbarch->xml_syscall_file));
|
2007-11-12 07:47:56 +01:00
|
|
|
if (gdbarch->dump_tdep != NULL)
|
|
|
|
gdbarch->dump_tdep (gdbarch, file);
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
struct gdbarch_tdep *
|
1999-08-31 03:14:27 +02:00
|
|
|
gdbarch_tdep (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_tdep called\n");
|
|
|
|
return gdbarch->tdep;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const struct bfd_arch_info *
|
1999-08-31 03:14:27 +02:00
|
|
|
gdbarch_bfd_arch_info (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_arch_info called\n");
|
|
|
|
return gdbarch->bfd_arch_info;
|
|
|
|
}
|
|
|
|
|
2014-01-02 04:02:56 +01:00
|
|
|
enum bfd_endian
|
1999-08-31 03:14:27 +02:00
|
|
|
gdbarch_byte_order (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_byte_order called\n");
|
|
|
|
return gdbarch->byte_order;
|
|
|
|
}
|
|
|
|
|
2014-01-02 04:02:56 +01:00
|
|
|
enum bfd_endian
|
2008-08-11 21:00:25 +02:00
|
|
|
gdbarch_byte_order_for_code (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_byte_order_for_code called\n");
|
|
|
|
return gdbarch->byte_order_for_code;
|
|
|
|
}
|
|
|
|
|
2003-01-05 00:38:46 +01:00
|
|
|
enum gdb_osabi
|
|
|
|
gdbarch_osabi (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_osabi called\n");
|
|
|
|
return gdbarch->osabi;
|
|
|
|
}
|
|
|
|
|
2006-11-28 23:10:26 +01:00
|
|
|
const struct target_desc *
|
|
|
|
gdbarch_target_desc (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_target_desc called\n");
|
|
|
|
return gdbarch->target_desc;
|
|
|
|
}
|
|
|
|
|
2008-01-18 18:07:40 +01:00
|
|
|
int
|
|
|
|
gdbarch_bits_big_endian (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of bits_big_endian, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_bits_big_endian called\n");
|
|
|
|
return gdbarch->bits_big_endian;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_bits_big_endian (struct gdbarch *gdbarch,
|
|
|
|
int bits_big_endian)
|
|
|
|
{
|
|
|
|
gdbarch->bits_big_endian = bits_big_endian;
|
|
|
|
}
|
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
int
|
1999-08-31 03:14:27 +02:00
|
|
|
gdbarch_short_bit (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2000-08-11 04:55:38 +02:00
|
|
|
/* Skip verify of short_bit, invalid_p == 0 */
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_short_bit called\n");
|
|
|
|
return gdbarch->short_bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_short_bit (struct gdbarch *gdbarch,
|
|
|
|
int short_bit)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->short_bit = short_bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
1999-08-31 03:14:27 +02:00
|
|
|
gdbarch_int_bit (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2000-08-11 04:55:38 +02:00
|
|
|
/* Skip verify of int_bit, invalid_p == 0 */
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_int_bit called\n");
|
|
|
|
return gdbarch->int_bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_int_bit (struct gdbarch *gdbarch,
|
|
|
|
int int_bit)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->int_bit = int_bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
1999-08-31 03:14:27 +02:00
|
|
|
gdbarch_long_bit (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2000-08-11 04:55:38 +02:00
|
|
|
/* Skip verify of long_bit, invalid_p == 0 */
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_long_bit called\n");
|
|
|
|
return gdbarch->long_bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_long_bit (struct gdbarch *gdbarch,
|
|
|
|
int long_bit)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->long_bit = long_bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
1999-08-31 03:14:27 +02:00
|
|
|
gdbarch_long_long_bit (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2000-08-11 04:55:38 +02:00
|
|
|
/* Skip verify of long_long_bit, invalid_p == 0 */
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_long_long_bit called\n");
|
|
|
|
return gdbarch->long_long_bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_long_long_bit (struct gdbarch *gdbarch,
|
|
|
|
int long_long_bit)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->long_long_bit = long_long_bit;
|
|
|
|
}
|
|
|
|
|
2011-10-11 21:08:59 +02:00
|
|
|
int
|
|
|
|
gdbarch_long_long_align_bit (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of long_long_align_bit, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_long_long_align_bit called\n");
|
|
|
|
return gdbarch->long_long_align_bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_long_long_align_bit (struct gdbarch *gdbarch,
|
|
|
|
int long_long_align_bit)
|
|
|
|
{
|
|
|
|
gdbarch->long_long_align_bit = long_long_align_bit;
|
|
|
|
}
|
|
|
|
|
2010-07-06 14:56:24 +02:00
|
|
|
int
|
|
|
|
gdbarch_half_bit (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of half_bit, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_half_bit called\n");
|
|
|
|
return gdbarch->half_bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_half_bit (struct gdbarch *gdbarch,
|
|
|
|
int half_bit)
|
|
|
|
{
|
|
|
|
gdbarch->half_bit = half_bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
const struct floatformat **
|
|
|
|
gdbarch_half_format (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_half_format called\n");
|
|
|
|
return gdbarch->half_format;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_half_format (struct gdbarch *gdbarch,
|
|
|
|
const struct floatformat ** half_format)
|
|
|
|
{
|
|
|
|
gdbarch->half_format = half_format;
|
|
|
|
}
|
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
int
|
1999-08-31 03:14:27 +02:00
|
|
|
gdbarch_float_bit (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2000-08-11 04:55:38 +02:00
|
|
|
/* Skip verify of float_bit, invalid_p == 0 */
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_float_bit called\n");
|
|
|
|
return gdbarch->float_bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_float_bit (struct gdbarch *gdbarch,
|
|
|
|
int float_bit)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->float_bit = float_bit;
|
|
|
|
}
|
|
|
|
|
* doublest.c (floatformat_from_length): Use the right element from
gdbarch floatformats.
(floatformat_from_type, extract_typed_floating)
(store_typed_floating): Likewise.
* doublest.h: Remove declarations for undefined floatformat arrays.
* gdbarch.sh (float_format, double_format, long_double_format): Change
to pairs.
(pformat): Update for pairs.
* gdbarch.c, gdbarch.h: Regenerated.
* gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double)
(floatformats_ieee_double_littlebyte_bigword)
(floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext)
(floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f)
(floatformats_vax_d): New variables.
(builtin_type_ieee_single, builtin_type_ieee_double)
(builtin_type_arm_ext, builtin_type_ia64_spill)
(builtin_type_ia64_quad): Replace arrays with individual types.
(builtin_type_ieee_single_big, builtin_type_ieee_single_little)
(builtin_type_ieee_double_big, builtin_type_ieee_double_little)
(builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext)
(builtin_type_m88110_ext, builtin_type_m88110_harris_ext)
(builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword)
(builtin_type_ia64_spill_big, builtin_type_ia64_spill_little)
(builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete
unused and endian-specific types.
(recursive_dump_type): Update for floatformat pairs.
(build_flt): Move higher. Handle bit == -1. Take a floatformat pair.
(build_gdbtypes): Use build_flt.
(_initialize_gdbtypes): Update set of initialized types.
* gdbtypes.h: Update declarations to match gdbtypes.c.
(struct main_type): Store a pointer to two floatformats.
* arch-utils.c (default_float_format, default_double_format): Delete.
* arch-utils.h (default_float_format, default_double_format): Delete.
* arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c,
ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c,
mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c,
sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c,
vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
2007-01-29 18:31:06 +01:00
|
|
|
const struct floatformat **
|
2004-08-08 21:49:43 +02:00
|
|
|
gdbarch_float_format (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_float_format called\n");
|
|
|
|
return gdbarch->float_format;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_float_format (struct gdbarch *gdbarch,
|
* doublest.c (floatformat_from_length): Use the right element from
gdbarch floatformats.
(floatformat_from_type, extract_typed_floating)
(store_typed_floating): Likewise.
* doublest.h: Remove declarations for undefined floatformat arrays.
* gdbarch.sh (float_format, double_format, long_double_format): Change
to pairs.
(pformat): Update for pairs.
* gdbarch.c, gdbarch.h: Regenerated.
* gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double)
(floatformats_ieee_double_littlebyte_bigword)
(floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext)
(floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f)
(floatformats_vax_d): New variables.
(builtin_type_ieee_single, builtin_type_ieee_double)
(builtin_type_arm_ext, builtin_type_ia64_spill)
(builtin_type_ia64_quad): Replace arrays with individual types.
(builtin_type_ieee_single_big, builtin_type_ieee_single_little)
(builtin_type_ieee_double_big, builtin_type_ieee_double_little)
(builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext)
(builtin_type_m88110_ext, builtin_type_m88110_harris_ext)
(builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword)
(builtin_type_ia64_spill_big, builtin_type_ia64_spill_little)
(builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete
unused and endian-specific types.
(recursive_dump_type): Update for floatformat pairs.
(build_flt): Move higher. Handle bit == -1. Take a floatformat pair.
(build_gdbtypes): Use build_flt.
(_initialize_gdbtypes): Update set of initialized types.
* gdbtypes.h: Update declarations to match gdbtypes.c.
(struct main_type): Store a pointer to two floatformats.
* arch-utils.c (default_float_format, default_double_format): Delete.
* arch-utils.h (default_float_format, default_double_format): Delete.
* arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c,
ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c,
mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c,
sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c,
vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
2007-01-29 18:31:06 +01:00
|
|
|
const struct floatformat ** float_format)
|
2004-08-08 21:49:43 +02:00
|
|
|
{
|
|
|
|
gdbarch->float_format = float_format;
|
|
|
|
}
|
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
int
|
1999-08-31 03:14:27 +02:00
|
|
|
gdbarch_double_bit (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2000-08-11 04:55:38 +02:00
|
|
|
/* Skip verify of double_bit, invalid_p == 0 */
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_double_bit called\n");
|
|
|
|
return gdbarch->double_bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_double_bit (struct gdbarch *gdbarch,
|
|
|
|
int double_bit)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->double_bit = double_bit;
|
|
|
|
}
|
|
|
|
|
* doublest.c (floatformat_from_length): Use the right element from
gdbarch floatformats.
(floatformat_from_type, extract_typed_floating)
(store_typed_floating): Likewise.
* doublest.h: Remove declarations for undefined floatformat arrays.
* gdbarch.sh (float_format, double_format, long_double_format): Change
to pairs.
(pformat): Update for pairs.
* gdbarch.c, gdbarch.h: Regenerated.
* gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double)
(floatformats_ieee_double_littlebyte_bigword)
(floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext)
(floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f)
(floatformats_vax_d): New variables.
(builtin_type_ieee_single, builtin_type_ieee_double)
(builtin_type_arm_ext, builtin_type_ia64_spill)
(builtin_type_ia64_quad): Replace arrays with individual types.
(builtin_type_ieee_single_big, builtin_type_ieee_single_little)
(builtin_type_ieee_double_big, builtin_type_ieee_double_little)
(builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext)
(builtin_type_m88110_ext, builtin_type_m88110_harris_ext)
(builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword)
(builtin_type_ia64_spill_big, builtin_type_ia64_spill_little)
(builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete
unused and endian-specific types.
(recursive_dump_type): Update for floatformat pairs.
(build_flt): Move higher. Handle bit == -1. Take a floatformat pair.
(build_gdbtypes): Use build_flt.
(_initialize_gdbtypes): Update set of initialized types.
* gdbtypes.h: Update declarations to match gdbtypes.c.
(struct main_type): Store a pointer to two floatformats.
* arch-utils.c (default_float_format, default_double_format): Delete.
* arch-utils.h (default_float_format, default_double_format): Delete.
* arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c,
ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c,
mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c,
sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c,
vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
2007-01-29 18:31:06 +01:00
|
|
|
const struct floatformat **
|
2004-08-08 21:49:43 +02:00
|
|
|
gdbarch_double_format (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_double_format called\n");
|
|
|
|
return gdbarch->double_format;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_double_format (struct gdbarch *gdbarch,
|
* doublest.c (floatformat_from_length): Use the right element from
gdbarch floatformats.
(floatformat_from_type, extract_typed_floating)
(store_typed_floating): Likewise.
* doublest.h: Remove declarations for undefined floatformat arrays.
* gdbarch.sh (float_format, double_format, long_double_format): Change
to pairs.
(pformat): Update for pairs.
* gdbarch.c, gdbarch.h: Regenerated.
* gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double)
(floatformats_ieee_double_littlebyte_bigword)
(floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext)
(floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f)
(floatformats_vax_d): New variables.
(builtin_type_ieee_single, builtin_type_ieee_double)
(builtin_type_arm_ext, builtin_type_ia64_spill)
(builtin_type_ia64_quad): Replace arrays with individual types.
(builtin_type_ieee_single_big, builtin_type_ieee_single_little)
(builtin_type_ieee_double_big, builtin_type_ieee_double_little)
(builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext)
(builtin_type_m88110_ext, builtin_type_m88110_harris_ext)
(builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword)
(builtin_type_ia64_spill_big, builtin_type_ia64_spill_little)
(builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete
unused and endian-specific types.
(recursive_dump_type): Update for floatformat pairs.
(build_flt): Move higher. Handle bit == -1. Take a floatformat pair.
(build_gdbtypes): Use build_flt.
(_initialize_gdbtypes): Update set of initialized types.
* gdbtypes.h: Update declarations to match gdbtypes.c.
(struct main_type): Store a pointer to two floatformats.
* arch-utils.c (default_float_format, default_double_format): Delete.
* arch-utils.h (default_float_format, default_double_format): Delete.
* arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c,
ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c,
mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c,
sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c,
vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
2007-01-29 18:31:06 +01:00
|
|
|
const struct floatformat ** double_format)
|
2004-08-08 21:49:43 +02:00
|
|
|
{
|
|
|
|
gdbarch->double_format = double_format;
|
|
|
|
}
|
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
int
|
1999-08-31 03:14:27 +02:00
|
|
|
gdbarch_long_double_bit (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2000-08-11 04:55:38 +02:00
|
|
|
/* Skip verify of long_double_bit, invalid_p == 0 */
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_long_double_bit called\n");
|
|
|
|
return gdbarch->long_double_bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_long_double_bit (struct gdbarch *gdbarch,
|
|
|
|
int long_double_bit)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->long_double_bit = long_double_bit;
|
|
|
|
}
|
|
|
|
|
* doublest.c (floatformat_from_length): Use the right element from
gdbarch floatformats.
(floatformat_from_type, extract_typed_floating)
(store_typed_floating): Likewise.
* doublest.h: Remove declarations for undefined floatformat arrays.
* gdbarch.sh (float_format, double_format, long_double_format): Change
to pairs.
(pformat): Update for pairs.
* gdbarch.c, gdbarch.h: Regenerated.
* gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double)
(floatformats_ieee_double_littlebyte_bigword)
(floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext)
(floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f)
(floatformats_vax_d): New variables.
(builtin_type_ieee_single, builtin_type_ieee_double)
(builtin_type_arm_ext, builtin_type_ia64_spill)
(builtin_type_ia64_quad): Replace arrays with individual types.
(builtin_type_ieee_single_big, builtin_type_ieee_single_little)
(builtin_type_ieee_double_big, builtin_type_ieee_double_little)
(builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext)
(builtin_type_m88110_ext, builtin_type_m88110_harris_ext)
(builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword)
(builtin_type_ia64_spill_big, builtin_type_ia64_spill_little)
(builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete
unused and endian-specific types.
(recursive_dump_type): Update for floatformat pairs.
(build_flt): Move higher. Handle bit == -1. Take a floatformat pair.
(build_gdbtypes): Use build_flt.
(_initialize_gdbtypes): Update set of initialized types.
* gdbtypes.h: Update declarations to match gdbtypes.c.
(struct main_type): Store a pointer to two floatformats.
* arch-utils.c (default_float_format, default_double_format): Delete.
* arch-utils.h (default_float_format, default_double_format): Delete.
* arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c,
ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c,
mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c,
sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c,
vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
2007-01-29 18:31:06 +01:00
|
|
|
const struct floatformat **
|
2004-08-08 21:49:43 +02:00
|
|
|
gdbarch_long_double_format (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_long_double_format called\n");
|
|
|
|
return gdbarch->long_double_format;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_long_double_format (struct gdbarch *gdbarch,
|
* doublest.c (floatformat_from_length): Use the right element from
gdbarch floatformats.
(floatformat_from_type, extract_typed_floating)
(store_typed_floating): Likewise.
* doublest.h: Remove declarations for undefined floatformat arrays.
* gdbarch.sh (float_format, double_format, long_double_format): Change
to pairs.
(pformat): Update for pairs.
* gdbarch.c, gdbarch.h: Regenerated.
* gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double)
(floatformats_ieee_double_littlebyte_bigword)
(floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext)
(floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f)
(floatformats_vax_d): New variables.
(builtin_type_ieee_single, builtin_type_ieee_double)
(builtin_type_arm_ext, builtin_type_ia64_spill)
(builtin_type_ia64_quad): Replace arrays with individual types.
(builtin_type_ieee_single_big, builtin_type_ieee_single_little)
(builtin_type_ieee_double_big, builtin_type_ieee_double_little)
(builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext)
(builtin_type_m88110_ext, builtin_type_m88110_harris_ext)
(builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword)
(builtin_type_ia64_spill_big, builtin_type_ia64_spill_little)
(builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete
unused and endian-specific types.
(recursive_dump_type): Update for floatformat pairs.
(build_flt): Move higher. Handle bit == -1. Take a floatformat pair.
(build_gdbtypes): Use build_flt.
(_initialize_gdbtypes): Update set of initialized types.
* gdbtypes.h: Update declarations to match gdbtypes.c.
(struct main_type): Store a pointer to two floatformats.
* arch-utils.c (default_float_format, default_double_format): Delete.
* arch-utils.h (default_float_format, default_double_format): Delete.
* arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c,
ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c,
mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c,
sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c,
vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
2007-01-29 18:31:06 +01:00
|
|
|
const struct floatformat ** long_double_format)
|
2004-08-08 21:49:43 +02:00
|
|
|
{
|
|
|
|
gdbarch->long_double_format = long_double_format;
|
|
|
|
}
|
|
|
|
|
Teach GDB that wchar_t is a built-in type in C++ mode
GDB is currently not aware that wchar_t is a built-in type in C++
mode. This is usually not a problem because the debug info describes
the type, so when you have a program loaded, you don't notice this.
However, if you try expressions involving wchar_t before a program is
loaded, gdb errors out:
(gdb) p (wchar_t)-1
No symbol table is loaded. Use the "file" command.
(gdb) p L"hello"
No type named wchar_t.
(gdb) ptype L"hello"
No type named wchar_t.
This commit teaches gdb about the type. After:
(gdb) p (wchar_t)-1
$1 = -1 L'\xffffffff'
(gdb) p L"hello"
$2 = L"hello"
(gdb) ptype L"hello"
type = wchar_t [6]
Unlike char16_t/char32_t, unfortunately, the underlying type of
wchar_t is implementation dependent, both size and signness. So this
requires adding a couple new gdbarch hooks.
I grepped the GCC code base for WCHAR_TYPE and WCHAR_TYPE_SIZE, and it
seems to me that the majority of the ABIs have a 4-byte signed
wchar_t, so that's what I made the default for GDB too. And then I
looked for which ports have a 16-bit and/or unsigned wchar_t, and made
GDB follow suit.
gdb/ChangeLog:
2017-04-12 Pedro Alves <palves@redhat.com>
PR gdb/21323
* c-lang.c (cplus_primitive_types) <cplus_primitive_type_wchar_t>:
New enum value.
(cplus_language_arch_info): Register cplus_primitive_type_wchar_t.
* gdbtypes.h (struct builtin_type) <builtin_wchar>: New field.
* gdbtypes.c (gdbtypes_post_init): Create the "wchar_t" type.
* gdbarch.sh (wchar_bit, wchar_signed): New per-arch values.
* gdbarch.h, gdbarch.c: Regenerate.
* aarch64-tdep.c (aarch64_gdbarch_init): Override
gdbarch_wchar_bit and gdbarch_wchar_signed.
* alpha-tdep.c (alpha_gdbarch_init): Likewise.
* arm-tdep.c (arm_gdbarch_init): Likewise.
* avr-tdep.c (avr_gdbarch_init): Likewise.
* h8300-tdep.c (h8300_gdbarch_init): Likewise.
* i386-nto-tdep.c (i386nto_init_abi): Likewise.
* i386-tdep.c (i386_go32_init_abi): Likewise.
* m32r-tdep.c (m32r_gdbarch_init): Likewise.
* moxie-tdep.c (moxie_gdbarch_init): Likewise.
* nds32-tdep.c (nds32_gdbarch_init): Likewise.
* rs6000-aix-tdep.c (rs6000_aix_init_osabi): Likewise.
* sh-tdep.c (sh_gdbarch_init): Likewise.
* sparc-tdep.c (sparc32_gdbarch_init): Likewise.
* sparc64-tdep.c (sparc64_init_abi): Likewise.
* windows-tdep.c (windows_init_abi): Likewise.
* xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise.
gdb/testsuite/ChangeLog:
2017-04-12 Pedro Alves <palves@redhat.com>
PR gdb/21323
* gdb.cp/wide_char_types.c: Include <wchar.h>.
(wchar): New global.
* gdb.cp/wide_char_types.exp (wide_char_types_program)
(do_test_wide_char, wide_char_types_no_program, top level): Add
wchar_t testing.
2017-04-12 15:00:49 +02:00
|
|
|
int
|
|
|
|
gdbarch_wchar_bit (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of wchar_bit, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_wchar_bit called\n");
|
|
|
|
return gdbarch->wchar_bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_wchar_bit (struct gdbarch *gdbarch,
|
|
|
|
int wchar_bit)
|
|
|
|
{
|
|
|
|
gdbarch->wchar_bit = wchar_bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_wchar_signed (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Check variable changed from pre-default. */
|
|
|
|
gdb_assert (gdbarch->wchar_signed != -1);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_wchar_signed called\n");
|
|
|
|
return gdbarch->wchar_signed;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_wchar_signed (struct gdbarch *gdbarch,
|
|
|
|
int wchar_signed)
|
|
|
|
{
|
|
|
|
gdbarch->wchar_signed = wchar_signed;
|
|
|
|
}
|
|
|
|
|
Add gdbarch callback to provide formats for debug info float types
At this point, all TYPE_CODE_FLT types carry their floating-point format,
except for those creating from reading DWARF or stabs debug info. Those
will be addressed by this commit.
The main issue here is that we actually have to determine which floating-
point format to use. Currently, we only have the type length as input
to this decision. In the future, we may hopefully get --at least in
DWARF-- additional information to help disambiguate multiple different
formats of the same length. For now, we can still look at the type name
as a hint.
This decision logic is encapsulated in a gdbarch callback to allow
platform-specific overrides. The default implementation use the same
logic (compare type length against the various gdbarch_..._bit sizes)
that is currently implemented in floatformat_from_length.
With this commit, all platforms still use the default logic, so there
should be no actual change in behavior. A follow-on commit will add
support for __float128 on Intel and Power.
Once dwarf2read.c and stabsread.c make use of the new callback to
determine floating-point formats, we're now sure every TYPE_CODE_FLT
type will always carry its format. The commit therefore adds asserts
to verify_floatformat to ensure new code will continue to always
provide formats, and removes the code in floatformat_from_type that
used to handle types with a NULL TYPE_FLOATFORMAT.
gdb/ChangeLog:
* gdbarch.sh (floatformat_for_type): New gdbarch callback.
* gdbarch.h, gdbarch.c: Re-generate.
* arch-utils.h (default_floatformat_for_type): New prototype.
* arch-utils.c (default_floatformat_for_type): New function.
* doublest.c (floatformat_from_length): Remove.
(floatformat_from_type): Assume TYPE_FLOATFORMAT is non-NULL.
* gdbtypes.c (verify_floatformat): Require non-NULL format.
* dwarf2read.c (dwarf2_init_float_type): New function.
(read_base_type): Use it.
* stabsread.c (dbx_init_float_type): New function.
(read_sun_floating_type): Use it.
(read_range_type): Likewise.
Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-06 17:31:53 +02:00
|
|
|
const struct floatformat **
|
|
|
|
gdbarch_floatformat_for_type (struct gdbarch *gdbarch, const char *name, int length)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->floatformat_for_type != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_floatformat_for_type called\n");
|
|
|
|
return gdbarch->floatformat_for_type (gdbarch, name, length);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_floatformat_for_type (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_floatformat_for_type_ftype floatformat_for_type)
|
|
|
|
{
|
|
|
|
gdbarch->floatformat_for_type = floatformat_for_type;
|
|
|
|
}
|
|
|
|
|
2000-08-11 04:55:38 +02:00
|
|
|
int
|
|
|
|
gdbarch_ptr_bit (struct gdbarch *gdbarch)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2000-08-11 04:55:38 +02:00
|
|
|
/* Skip verify of ptr_bit, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_ptr_bit called\n");
|
|
|
|
return gdbarch->ptr_bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_ptr_bit (struct gdbarch *gdbarch,
|
|
|
|
int ptr_bit)
|
|
|
|
{
|
|
|
|
gdbarch->ptr_bit = ptr_bit;
|
|
|
|
}
|
|
|
|
|
2000-08-25 22:51:19 +02:00
|
|
|
int
|
|
|
|
gdbarch_addr_bit (struct gdbarch *gdbarch)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
/* Check variable changed from pre-default. */
|
|
|
|
gdb_assert (gdbarch->addr_bit != 0);
|
2000-08-25 22:51:19 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_addr_bit called\n");
|
|
|
|
return gdbarch->addr_bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_addr_bit (struct gdbarch *gdbarch,
|
|
|
|
int addr_bit)
|
|
|
|
{
|
|
|
|
gdbarch->addr_bit = addr_bit;
|
|
|
|
}
|
|
|
|
|
2010-08-06 21:02:15 +02:00
|
|
|
int
|
|
|
|
gdbarch_dwarf2_addr_size (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Check variable changed from pre-default. */
|
|
|
|
gdb_assert (gdbarch->dwarf2_addr_size != 0);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_dwarf2_addr_size called\n");
|
|
|
|
return gdbarch->dwarf2_addr_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_dwarf2_addr_size (struct gdbarch *gdbarch,
|
|
|
|
int dwarf2_addr_size)
|
|
|
|
{
|
|
|
|
gdbarch->dwarf2_addr_size = dwarf2_addr_size;
|
|
|
|
}
|
|
|
|
|
2001-12-20 04:26:08 +01:00
|
|
|
int
|
|
|
|
gdbarch_char_signed (struct gdbarch *gdbarch)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
/* Check variable changed from pre-default. */
|
|
|
|
gdb_assert (gdbarch->char_signed != -1);
|
2001-12-20 04:26:08 +01:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_char_signed called\n");
|
|
|
|
return gdbarch->char_signed;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_char_signed (struct gdbarch *gdbarch,
|
|
|
|
int char_signed)
|
|
|
|
{
|
|
|
|
gdbarch->char_signed = char_signed;
|
|
|
|
}
|
|
|
|
|
2003-06-07 18:23:12 +02:00
|
|
|
int
|
|
|
|
gdbarch_read_pc_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
return gdbarch->read_pc != NULL;
|
2003-06-07 18:23:12 +02:00
|
|
|
}
|
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
CORE_ADDR
|
2007-06-16 00:44:56 +02:00
|
|
|
gdbarch_read_pc (struct gdbarch *gdbarch, struct regcache *regcache)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->read_pc != NULL);
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_read_pc called\n");
|
2007-06-16 00:44:56 +02:00
|
|
|
return gdbarch->read_pc (regcache);
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_read_pc (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_read_pc_ftype read_pc)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->read_pc = read_pc;
|
|
|
|
}
|
|
|
|
|
2007-06-16 00:44:56 +02:00
|
|
|
int
|
|
|
|
gdbarch_write_pc_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->write_pc != NULL;
|
|
|
|
}
|
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
void
|
2007-06-16 00:44:56 +02:00
|
|
|
gdbarch_write_pc (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR val)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->write_pc != NULL);
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_write_pc called\n");
|
2007-06-16 00:44:56 +02:00
|
|
|
gdbarch->write_pc (regcache, val);
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_write_pc (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_write_pc_ftype write_pc)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->write_pc = write_pc;
|
|
|
|
}
|
|
|
|
|
2001-08-11 02:59:29 +02:00
|
|
|
void
|
|
|
|
gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->virtual_frame_pointer != NULL);
|
2001-08-11 02:59:29 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_virtual_frame_pointer called\n");
|
2007-11-07 07:58:31 +01:00
|
|
|
gdbarch->virtual_frame_pointer (gdbarch, pc, frame_regnum, frame_offset);
|
2001-08-11 02:59:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_virtual_frame_pointer_ftype virtual_frame_pointer)
|
|
|
|
{
|
|
|
|
gdbarch->virtual_frame_pointer = virtual_frame_pointer;
|
|
|
|
}
|
|
|
|
|
2001-03-24 02:26:09 +01:00
|
|
|
int
|
2002-08-02 16:48:19 +02:00
|
|
|
gdbarch_pseudo_register_read_p (struct gdbarch *gdbarch)
|
2001-03-24 02:26:09 +01:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
return gdbarch->pseudo_register_read != NULL;
|
2001-03-24 02:26:09 +01:00
|
|
|
}
|
|
|
|
|
gdb/
* regcache.h (regcache_raw_read, regcache_raw_read_signed)
(regcache_raw_read_unsigned, regcache_raw_read_signed)
(regcache_raw_read_unsigned, regcache_raw_read_part)
(regcache_cooked_read, regcache_cooked_read_signed)
(regcache_cooked_read_unsigned, regcache_cooked_read_part)
(regcache_cooked_read_ftype): Change return to enum
register_status.
* regcache.c: Include exceptions.h
(regcache_save): Adjust to handle REG_UNAVAILABLE registers.
(do_cooked_read): Change return to enum register_status. Always
forward to regcache_cooked_read.
(regcache_raw_read): Change return to enum register_status. If
the register is not REG_VALID, memset the buffer. Return the
register's status.
(regcache_raw_read_signed): Handle non-REG_VALID registers and
return the register's status.
(regcache_raw_read_unsigned): Ditto.
(regcache_cooked_read): Change return to enum register_status.
Assert that with read-only regcaches, the register's status must
be known. If the regcache is read-only, and the register is not
REG_VALID, memset the buffer. Return the register's status.
(regcache_cooked_read_signed): Change return to enum
register_status. Handle non-REG_VALID registers and return the
register's status.
(regcache_cooked_read_unsigned): Change return to enum
register_status. Handle non-REG_VALID registers and return the
register's status.
(regcache_xfer_part, regcache_raw_read_part)
(regcache_cooked_read_part): Change return to enum
register_status. Return the register's status.
(regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is
unavailable.
(regcache_dump): Handle unavailable cooked registers.
* frame.c (do_frame_register_read): Adjust interface to match
regcache_cooked_read_ftype.
* gdbarch.sh (pseudo_register_read): Change return to enum
register_status.
* gdbarch.h, gdbarch.c: Regenerate.
* i386-tdep.h (i386_pseudo_register_read): Change return to enum
register_status.
* i386-tdep.c (i386_pseudo_register_read): Change return to enum
register_status. If reading a raw register indicates the raw
register is not valid, return the raw register's status,
otherwise, return REG_VALID.
* amd64-tdep.c (amd64_pseudo_register_read): Change return to enum
register_status. Handle non-REG_VALID raw registers and return
the register's status.
* arm-tdep.c (arm_neon_quad_read)
(arm_pseudo_read): Change return to enum register_status. Handle
non-REG_VALID raw registers and return the register's status.
* avr-tdep.c (avr_pseudo_register_read): Ditto.
* frv-tdep.c (frv_pseudo_register_read): Ditto.
* h8300-tdep.c (h8300_pseudo_register_read): Ditto.
* hppa-tdep.c (hppa_pseudo_register_read): Ditto.
* m32c-tdep.c (m32c_move_reg_t): Change return to enum
register_status.
(m32c_raw_read, m32c_raw_write, m32c_banked_read)
(m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read)
(m32c_part_write, m32c_cat_read, m32c_cat_write)
(m32c_r3r2r1r0_read, m32c_r3r2r1r0_write)
(m32c_pseudo_register_read): Change return to enum
register_status. Adjust.
* m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to
enum register_status. Return the register's status.
* mep-tdep.c (mep_pseudo_cr32_read): Change return to enum
register_status. Return the register's status.
(mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto.
* mips-tdep.c (mips_pseudo_register_read): Ditto.
* mt-tdep.c (mt_pseudo_register_read): Ditto.
* rs6000-tdep.c (move_ev_register_func): New typedef.
(e500_move_ev_register): Use it. Change return to enum
register_status. Return the register's status.
(do_regcache_raw_read): New function.
(do_regcache_raw_write): New function.
(e500_pseudo_register_read): Change return to enum
register_status. Return the register's status. Use
do_regcache_raw_read.
(e500_pseudo_register_write): Adjust. Use do_regcache_raw_write.
(dfp_pseudo_register_read): Change return to enum register_status.
Return the register's status.
(vsx_pseudo_register_read): Ditto.
(efpr_pseudo_register_read): Ditto.
(rs6000_pseudo_register_read): Ditto.
* s390-tdep.c (s390_pseudo_register_read): Change return to enum
register_status. Return the register's status.
* sh64-tdep.c (pseudo_register_read_portions): New function.
(sh64_pseudo_register_read): Change return to enum
register_status. Use pseudo_register_read_portions. Return the
register's status.
* ia64-tdep.c (ia64_pseudo_register_read): Change return to enum
register_status. Return the register's status.
* sh-tdep.c (pseudo_register_read_portions): New function.
(sh_pseudo_register_read): Change return to enum register_status.
Use pseudo_register_read_portions. Return the register's status.
* sparc-tdep.c (sparc32_pseudo_register_read): Change return to
enum register_status. Return the register's status.
* sparc64-tdep.c (sparc64_pseudo_register_read): Ditto.
* spu-tdep.c (spu_pseudo_register_read_spu)
(spu_pseudo_register_read): Ditto.
* xtensa-tdep.c (xtensa_register_read_masked)
(xtensa_pseudo_register_read): Ditto.
* bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
|
|
|
enum register_status
|
2005-05-14 08:07:42 +02:00
|
|
|
gdbarch_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, gdb_byte *buf)
|
2001-03-24 02:26:09 +01:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->pseudo_register_read != NULL);
|
2001-03-24 02:26:09 +01:00
|
|
|
if (gdbarch_debug >= 2)
|
2002-08-02 16:48:19 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_pseudo_register_read called\n");
|
gdb/
* regcache.h (regcache_raw_read, regcache_raw_read_signed)
(regcache_raw_read_unsigned, regcache_raw_read_signed)
(regcache_raw_read_unsigned, regcache_raw_read_part)
(regcache_cooked_read, regcache_cooked_read_signed)
(regcache_cooked_read_unsigned, regcache_cooked_read_part)
(regcache_cooked_read_ftype): Change return to enum
register_status.
* regcache.c: Include exceptions.h
(regcache_save): Adjust to handle REG_UNAVAILABLE registers.
(do_cooked_read): Change return to enum register_status. Always
forward to regcache_cooked_read.
(regcache_raw_read): Change return to enum register_status. If
the register is not REG_VALID, memset the buffer. Return the
register's status.
(regcache_raw_read_signed): Handle non-REG_VALID registers and
return the register's status.
(regcache_raw_read_unsigned): Ditto.
(regcache_cooked_read): Change return to enum register_status.
Assert that with read-only regcaches, the register's status must
be known. If the regcache is read-only, and the register is not
REG_VALID, memset the buffer. Return the register's status.
(regcache_cooked_read_signed): Change return to enum
register_status. Handle non-REG_VALID registers and return the
register's status.
(regcache_cooked_read_unsigned): Change return to enum
register_status. Handle non-REG_VALID registers and return the
register's status.
(regcache_xfer_part, regcache_raw_read_part)
(regcache_cooked_read_part): Change return to enum
register_status. Return the register's status.
(regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is
unavailable.
(regcache_dump): Handle unavailable cooked registers.
* frame.c (do_frame_register_read): Adjust interface to match
regcache_cooked_read_ftype.
* gdbarch.sh (pseudo_register_read): Change return to enum
register_status.
* gdbarch.h, gdbarch.c: Regenerate.
* i386-tdep.h (i386_pseudo_register_read): Change return to enum
register_status.
* i386-tdep.c (i386_pseudo_register_read): Change return to enum
register_status. If reading a raw register indicates the raw
register is not valid, return the raw register's status,
otherwise, return REG_VALID.
* amd64-tdep.c (amd64_pseudo_register_read): Change return to enum
register_status. Handle non-REG_VALID raw registers and return
the register's status.
* arm-tdep.c (arm_neon_quad_read)
(arm_pseudo_read): Change return to enum register_status. Handle
non-REG_VALID raw registers and return the register's status.
* avr-tdep.c (avr_pseudo_register_read): Ditto.
* frv-tdep.c (frv_pseudo_register_read): Ditto.
* h8300-tdep.c (h8300_pseudo_register_read): Ditto.
* hppa-tdep.c (hppa_pseudo_register_read): Ditto.
* m32c-tdep.c (m32c_move_reg_t): Change return to enum
register_status.
(m32c_raw_read, m32c_raw_write, m32c_banked_read)
(m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read)
(m32c_part_write, m32c_cat_read, m32c_cat_write)
(m32c_r3r2r1r0_read, m32c_r3r2r1r0_write)
(m32c_pseudo_register_read): Change return to enum
register_status. Adjust.
* m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to
enum register_status. Return the register's status.
* mep-tdep.c (mep_pseudo_cr32_read): Change return to enum
register_status. Return the register's status.
(mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto.
* mips-tdep.c (mips_pseudo_register_read): Ditto.
* mt-tdep.c (mt_pseudo_register_read): Ditto.
* rs6000-tdep.c (move_ev_register_func): New typedef.
(e500_move_ev_register): Use it. Change return to enum
register_status. Return the register's status.
(do_regcache_raw_read): New function.
(do_regcache_raw_write): New function.
(e500_pseudo_register_read): Change return to enum
register_status. Return the register's status. Use
do_regcache_raw_read.
(e500_pseudo_register_write): Adjust. Use do_regcache_raw_write.
(dfp_pseudo_register_read): Change return to enum register_status.
Return the register's status.
(vsx_pseudo_register_read): Ditto.
(efpr_pseudo_register_read): Ditto.
(rs6000_pseudo_register_read): Ditto.
* s390-tdep.c (s390_pseudo_register_read): Change return to enum
register_status. Return the register's status.
* sh64-tdep.c (pseudo_register_read_portions): New function.
(sh64_pseudo_register_read): Change return to enum
register_status. Use pseudo_register_read_portions. Return the
register's status.
* ia64-tdep.c (ia64_pseudo_register_read): Change return to enum
register_status. Return the register's status.
* sh-tdep.c (pseudo_register_read_portions): New function.
(sh_pseudo_register_read): Change return to enum register_status.
Use pseudo_register_read_portions. Return the register's status.
* sparc-tdep.c (sparc32_pseudo_register_read): Change return to
enum register_status. Return the register's status.
* sparc64-tdep.c (sparc64_pseudo_register_read): Ditto.
* spu-tdep.c (spu_pseudo_register_read_spu)
(spu_pseudo_register_read): Ditto.
* xtensa-tdep.c (xtensa_register_read_masked)
(xtensa_pseudo_register_read): Ditto.
* bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
|
|
|
return gdbarch->pseudo_register_read (gdbarch, regcache, cookednum, buf);
|
2001-03-24 02:26:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-08-02 16:48:19 +02:00
|
|
|
set_gdbarch_pseudo_register_read (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_pseudo_register_read_ftype pseudo_register_read)
|
2001-03-24 02:26:09 +01:00
|
|
|
{
|
2002-08-02 16:48:19 +02:00
|
|
|
gdbarch->pseudo_register_read = pseudo_register_read;
|
2001-03-24 02:26:09 +01:00
|
|
|
}
|
|
|
|
|
2011-07-22 17:31:52 +02:00
|
|
|
int
|
|
|
|
gdbarch_pseudo_register_read_value_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->pseudo_register_read_value != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct value *
|
|
|
|
gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->pseudo_register_read_value != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_pseudo_register_read_value called\n");
|
|
|
|
return gdbarch->pseudo_register_read_value (gdbarch, regcache, cookednum);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_pseudo_register_read_value_ftype pseudo_register_read_value)
|
|
|
|
{
|
|
|
|
gdbarch->pseudo_register_read_value = pseudo_register_read_value;
|
|
|
|
}
|
|
|
|
|
2001-03-24 02:26:09 +01:00
|
|
|
int
|
2002-08-02 16:48:19 +02:00
|
|
|
gdbarch_pseudo_register_write_p (struct gdbarch *gdbarch)
|
2001-03-24 02:26:09 +01:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
return gdbarch->pseudo_register_write != NULL;
|
2001-03-24 02:26:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-05-14 08:07:42 +02:00
|
|
|
gdbarch_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const gdb_byte *buf)
|
2001-03-24 02:26:09 +01:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->pseudo_register_write != NULL);
|
2001-03-24 02:26:09 +01:00
|
|
|
if (gdbarch_debug >= 2)
|
2002-08-02 16:48:19 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_pseudo_register_write called\n");
|
|
|
|
gdbarch->pseudo_register_write (gdbarch, regcache, cookednum, buf);
|
2001-03-24 02:26:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-08-02 16:48:19 +02:00
|
|
|
set_gdbarch_pseudo_register_write (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_pseudo_register_write_ftype pseudo_register_write)
|
2001-03-24 02:26:09 +01:00
|
|
|
{
|
2002-08-02 16:48:19 +02:00
|
|
|
gdbarch->pseudo_register_write = pseudo_register_write;
|
2001-03-24 02:26:09 +01:00
|
|
|
}
|
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
int
|
1999-08-31 03:14:27 +02:00
|
|
|
gdbarch_num_regs (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
/* Check variable changed from pre-default. */
|
|
|
|
gdb_assert (gdbarch->num_regs != -1);
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_num_regs called\n");
|
|
|
|
return gdbarch->num_regs;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_num_regs (struct gdbarch *gdbarch,
|
|
|
|
int num_regs)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->num_regs = num_regs;
|
|
|
|
}
|
|
|
|
|
2000-07-24 16:25:22 +02:00
|
|
|
int
|
|
|
|
gdbarch_num_pseudo_regs (struct gdbarch *gdbarch)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2000-07-24 16:25:22 +02:00
|
|
|
/* Skip verify of num_pseudo_regs, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_num_pseudo_regs called\n");
|
|
|
|
return gdbarch->num_pseudo_regs;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch,
|
|
|
|
int num_pseudo_regs)
|
|
|
|
{
|
|
|
|
gdbarch->num_pseudo_regs = num_pseudo_regs;
|
|
|
|
}
|
|
|
|
|
2010-12-28 17:00:13 +01:00
|
|
|
int
|
|
|
|
gdbarch_ax_pseudo_register_collect_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->ax_pseudo_register_collect != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_ax_pseudo_register_collect (struct gdbarch *gdbarch, struct agent_expr *ax, int reg)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->ax_pseudo_register_collect != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_ax_pseudo_register_collect called\n");
|
|
|
|
return gdbarch->ax_pseudo_register_collect (gdbarch, ax, reg);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_ax_pseudo_register_collect (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_ax_pseudo_register_collect_ftype ax_pseudo_register_collect)
|
|
|
|
{
|
|
|
|
gdbarch->ax_pseudo_register_collect = ax_pseudo_register_collect;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_ax_pseudo_register_push_stack_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->ax_pseudo_register_push_stack != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch, struct agent_expr *ax, int reg)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->ax_pseudo_register_push_stack != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_ax_pseudo_register_push_stack called\n");
|
|
|
|
return gdbarch->ax_pseudo_register_push_stack (gdbarch, ax, reg);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_ax_pseudo_register_push_stack_ftype ax_pseudo_register_push_stack)
|
|
|
|
{
|
|
|
|
gdbarch->ax_pseudo_register_push_stack = ax_pseudo_register_push_stack;
|
|
|
|
}
|
|
|
|
|
Intel MPX bound violation handling
With Intel Memory Protection Extensions it was introduced the concept of
boundary violation. A boundary violations is presented to the inferior as
a segmentation fault having SIGCODE 3. This patch adds a
handler for a boundary violation extending the information displayed
when a bound violation is presented to the inferior. In the stop mode
case the debugger will also display the kind of violation: "upper" or
"lower", bounds and the address accessed.
On no stop mode the information will still remain unchanged. Additional
information about bound violations are not meaningful in that case user
does not know the line in which violation occurred as well.
When the segmentation fault handler is stop mode the out puts will be
changed as exemplified below.
The usual output of a segfault is:
Program received signal SIGSEGV, Segmentation fault
0x0000000000400d7c in upper (p=0x603010, a=0x603030, b=0x603050,
c=0x603070, d=0x603090, len=7) at i386-mpx-sigsegv.c:68
68 value = *(p + len);
In case it is a bound violation it will be presented as:
Program received signal SIGSEGV, Segmentation fault
Upper bound violation while accessing address 0x7fffffffc3b3
Bounds: [lower = 0x7fffffffc390, upper = 0x7fffffffc3a3]
0x0000000000400d7c in upper (p=0x603010, a=0x603030, b=0x603050,
c=0x603070, d=0x603090, len=7) at i386-mpx-sigsegv.c:68
68 value = *(p + len);
In mi mode the output of a segfault is:
*stopped,reason="signal-received",signal-name="SIGSEGV",
signal-meaning="Segmentation fault", frame={addr="0x0000000000400d7c",
func="upper",args=[{name="p", value="0x603010"},{name="a",value="0x603030"}
,{name="b",value="0x603050"}, {name="c",value="0x603070"},
{name="d",value="0x603090"},{name="len",value="7"}],
file="i386-mpx-sigsegv.c",fullname="i386-mpx-sigsegv.c",line="68"},
thread-id="1",stopped-threads="all",core="6"
in the case of a bound violation:
*stopped,reason="signal-received",signal-name="SIGSEGV",
signal-meaning="Segmentation fault",
sigcode-meaning="Upper bound violation",
lower-bound="0x603010",upper-bound="0x603023",bound-access="0x60302f",
frame={addr="0x0000000000400d7c",func="upper",args=[{name="p",
value="0x603010"},{name="a",value="0x603030"},{name="b",value="0x603050"},
{name="c",value="0x603070"},{name="d",value="0x603090"},
{name="len",value="7"}],file="i386-mpx-sigsegv.c",
fullname="i386-mpx-sigsegv.c",line="68"},thread-id="1",
stopped-threads="all",core="6"
2016-02-18 Walfred Tedeschi <walfred.tedeschi@intel.com>
gdb/ChangeLog:
* NEWS: Add entry for bound violation.
* amd64-linux-tdep.c (amd64_linux_init_abi_common):
Add handler for segmentation fault.
* gdbarch.sh (handle_segmentation_fault): New.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* i386-linux-tdep.c (i386_linux_handle_segmentation_fault): New.
(SIG_CODE_BONDARY_FAULT): New define.
(i386_linux_init_abi): Use i386_mpx_bound_violation_handler.
* i386-linux-tdep.h (i386_linux_handle_segmentation_fault) New.
* i386-tdep.c (i386_mpx_enabled): Add as external.
* i386-tdep.c (i386_mpx_enabled): Add as external.
* infrun.c (handle_segmentation_fault): New function.
(print_signal_received_reason): Use handle_segmentation_fault.
gdb/testsuite/ChangeLog:
* gdb.arch/i386-mpx-sigsegv.c: New file.
* gdb.arch/i386-mpx-sigsegv.exp: New file.
* gdb.arch/i386-mpx-simple_segv.c: New file.
* gdb.arch/i386-mpx-simple_segv.exp: New file.
gdb/doc/ChangeLog:
* gdb.texinfo (Signals): Add bound violation display hints for
a SIGSEGV.
2016-02-18 17:24:59 +01:00
|
|
|
int
|
|
|
|
gdbarch_handle_segmentation_fault_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->handle_segmentation_fault != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdbarch_handle_segmentation_fault (struct gdbarch *gdbarch, struct ui_out *uiout)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->handle_segmentation_fault != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_handle_segmentation_fault called\n");
|
|
|
|
gdbarch->handle_segmentation_fault (gdbarch, uiout);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_handle_segmentation_fault (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_handle_segmentation_fault_ftype handle_segmentation_fault)
|
|
|
|
{
|
|
|
|
gdbarch->handle_segmentation_fault = handle_segmentation_fault;
|
|
|
|
}
|
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
int
|
1999-08-31 03:14:27 +02:00
|
|
|
gdbarch_sp_regnum (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2002-04-07 04:16:46 +02:00
|
|
|
/* Skip verify of sp_regnum, invalid_p == 0 */
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_sp_regnum called\n");
|
|
|
|
return gdbarch->sp_regnum;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_sp_regnum (struct gdbarch *gdbarch,
|
|
|
|
int sp_regnum)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->sp_regnum = sp_regnum;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
1999-08-31 03:14:27 +02:00
|
|
|
gdbarch_pc_regnum (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2002-04-07 04:16:46 +02:00
|
|
|
/* Skip verify of pc_regnum, invalid_p == 0 */
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_pc_regnum called\n");
|
|
|
|
return gdbarch->pc_regnum;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_pc_regnum (struct gdbarch *gdbarch,
|
|
|
|
int pc_regnum)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->pc_regnum = pc_regnum;
|
|
|
|
}
|
|
|
|
|
2002-04-06 22:50:10 +02:00
|
|
|
int
|
|
|
|
gdbarch_ps_regnum (struct gdbarch *gdbarch)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2002-04-06 22:50:10 +02:00
|
|
|
/* Skip verify of ps_regnum, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_ps_regnum called\n");
|
|
|
|
return gdbarch->ps_regnum;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_ps_regnum (struct gdbarch *gdbarch,
|
|
|
|
int ps_regnum)
|
|
|
|
{
|
|
|
|
gdbarch->ps_regnum = ps_regnum;
|
|
|
|
}
|
|
|
|
|
2000-05-10 19:38:16 +02:00
|
|
|
int
|
|
|
|
gdbarch_fp0_regnum (struct gdbarch *gdbarch)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2000-05-10 19:38:16 +02:00
|
|
|
/* Skip verify of fp0_regnum, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_fp0_regnum called\n");
|
|
|
|
return gdbarch->fp0_regnum;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_fp0_regnum (struct gdbarch *gdbarch,
|
|
|
|
int fp0_regnum)
|
|
|
|
{
|
|
|
|
gdbarch->fp0_regnum = fp0_regnum;
|
|
|
|
}
|
|
|
|
|
2000-12-04 05:01:16 +01:00
|
|
|
int
|
|
|
|
gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, int stab_regnr)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->stab_reg_to_regnum != NULL);
|
2000-12-04 05:01:16 +01:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_stab_reg_to_regnum called\n");
|
2007-12-06 17:33:00 +01:00
|
|
|
return gdbarch->stab_reg_to_regnum (gdbarch, stab_regnr);
|
2000-12-04 05:01:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_stab_reg_to_regnum_ftype stab_reg_to_regnum)
|
|
|
|
{
|
|
|
|
gdbarch->stab_reg_to_regnum = stab_reg_to_regnum;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, int ecoff_regnr)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->ecoff_reg_to_regnum != NULL);
|
2000-12-04 05:01:16 +01:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_ecoff_reg_to_regnum called\n");
|
2007-12-06 17:33:00 +01:00
|
|
|
return gdbarch->ecoff_reg_to_regnum (gdbarch, ecoff_regnr);
|
2000-12-04 05:01:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_ecoff_reg_to_regnum_ftype ecoff_reg_to_regnum)
|
|
|
|
{
|
|
|
|
gdbarch->ecoff_reg_to_regnum = ecoff_reg_to_regnum;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, int sdb_regnr)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->sdb_reg_to_regnum != NULL);
|
2000-12-04 05:01:16 +01:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_sdb_reg_to_regnum called\n");
|
2007-12-06 17:33:00 +01:00
|
|
|
return gdbarch->sdb_reg_to_regnum (gdbarch, sdb_regnr);
|
2000-12-04 05:01:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_sdb_reg_to_regnum_ftype sdb_reg_to_regnum)
|
|
|
|
{
|
|
|
|
gdbarch->sdb_reg_to_regnum = sdb_reg_to_regnum;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int dwarf2_regnr)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->dwarf2_reg_to_regnum != NULL);
|
2000-12-04 05:01:16 +01:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_dwarf2_reg_to_regnum called\n");
|
2007-12-06 17:33:00 +01:00
|
|
|
return gdbarch->dwarf2_reg_to_regnum (gdbarch, dwarf2_regnr);
|
2000-12-04 05:01:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_dwarf2_reg_to_regnum_ftype dwarf2_reg_to_regnum)
|
|
|
|
{
|
|
|
|
gdbarch->dwarf2_reg_to_regnum = dwarf2_reg_to_regnum;
|
|
|
|
}
|
|
|
|
|
2002-06-18 01:32:36 +02:00
|
|
|
const char *
|
1999-06-14 20:08:47 +02:00
|
|
|
gdbarch_register_name (struct gdbarch *gdbarch, int regnr)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->register_name != NULL);
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_register_name called\n");
|
2007-11-02 Markus Deuling <deuling@de.ibm.com>
* gdbarch.sh (register_name): Add gdbarch parameter.
* gdbarch.{c,h}: Regenerate.
* target-descriptions.c (tdesc_register_name): Add gdbarch parameter.
(tdesc_register_name): Replace current_gdbarch by gdbarch.
* target-descriptions.h (tdesc_register_name): Add gdbarch parameter.
* xstormy16-tdep.c (xstormy16_register_name): Add gdbarch parameter.
* vax-tdep.c (vax_register_name): Add gdbarch parameter.
* spu-tdep.c (spu_register_name): Add gdbarch parameter.
* s390-tdep.c (s390_register_name): Add gdbarch parameter.
* mt-tdep.c (mt_register_name): Add gdbarch parameter.
(mt_registers_info): Replace current_gdbarch by gdbarch.
(mt_register_reggroup_p): Add gdbarch to mt_register_name call.
* mips-tdep.c (mips_register_name): Add gdbarch parameter. Replace
current_gdbarch by gdbarch.
(mips_register_name): Add gdbarch to tdesc_register_name call.
* mep-tdep.c (mep_register_name): Add gdbarch parameter. Replace
current_gdbarch by gdbarch.
(mep_register_reggroup_p): Add gdbarch to mep_register_name call.
* m32c-tdep.c (m32c_register_name): Add gdbarch parameter. Replace
current_gdbarch by gdbarch.
* m88k-tdep.c (m88k_register_name): Add gdbarch parameter.
* m68k-tdep.c (m68k_register_name): Add gdbarch parameter.
* m32r-tdep.c (m32r_register_name): Add gdbarch parameter.
(m32r_frame_unwind_cache): Use get_frame_arch to get at the current
architecture by frame_info.
* iq2000-tdep.c (iq2000_register_name): Add gdbarch parameter.
* ia64-tdep.c (ia64_register_name): Add gdbarch parameter.
* hppa-tdep.c (hppa32_register_name, hppa64_register_name): Add gdbarch
parameter.
* h8300-tdep.c (h8300_register_name, h8300s_register_name)
(h8300sx_register_name): Add gdbarch parameter.
* cris-tdep.c (cris_register_name, crisv32_register_name): Add
gdbarch parameter. Replace current_gdbarch by gdbarch.
(cris_gdbarch_init): Replace current_gdbarch by gdbarch (comment).
* avr-tdep.c (avr_register_name): Add gdbarch parameter.
* arm-tdep.c (arm_register_name): Add gdbarch paramete
* amd64-tdep.c (amd64_register_name): Add gdbarch parameter. Update
caller.
* amd64-tdep.h (amd64_register_name): Add gdbarch parameter.
* amd64-linux-tdep.c (amd64_linux_register_name): Add gdbarch parameter.
* alpha-tdep.c (alpha_register_name): Add gdbarch parameter.
(alpha_cannot_fetch_register, alpha_cannot_store_register): Update call
of alpha_register_name.
* frv-tdep.c (frv_register_name): Add gdbarch parameter.
* i386-tdep.c (i386_register_name): Add gdbarch parameter. Replace
current_gdbarch by gdbarch.
(i386_register_type): Replace ?current_gdbarch by gdbarch.
* i386-tdep.h (i386_register_name): Add gdbarch parameter.
* i386-linux-tdep.c (i386_linux_register_name): Add gdbarch parameter.
* m68hc11-tdep.c (m68hc11_register_name): Add gdbarch parameter.
(m68hc11_register_reggroup_p): Add gdbarch to call of
m68hc11_register_name.
* mn10300-tdep.c (mn10300_generic_register_name, am33_register_name)
(am33_2_register_name): Add gdbarch parameter.
(mn10300_frame_unwind_cache): Use get_frame_arch to get at the current
architecture by frame_info.
(mn10300_dump_tdep): Replace current_gdbarch by gdbarch.
* rs6000-tdep.c (rs6000_register_name): Add gdbarch parameter. Replace
current_gdbarch by gdbarch.
* score-tdep.c (score_register_name): Add gdbarch parameter.
(score_return_value, score_push_dummy_call): Replace current_gdbarch
by gdbarch.
* sh64-tdep.c (sh64_register_name): Add gdbarch parameter.
(sh64_compact_reg_base_num, sh64_register_convert_to_virtual)
(sh64_register_convert_to_raw, sh64_fv_reg_base_num)
(sh64_dr_reg_base_num, sh64_fpp_reg_base_num): Add gdbarch parameter
and update caller. Replace current_gdbarch by gdbarch.
(sh64_extract_return_value, sh64_store_return_value): Use
get_regcache_arch to get at the current architecture by regcache.
* sh-tdep.c (sh_sh_register_name, sh_sh3_register_name)
(sh_sh3e_register_name, sh_sh2e_register_name, sh_sh2a_register_name)
(sh_sh2a_nofpu_register_name, sh_sh_dsp_register_name)
(sh_sh3_dsp_register_name, sh_sh4_register_name)
(sh_sh4_nofpu_register_name, sh_sh4al_dsp_register_name): Add gdbarch
parameter.
(fv_reg_base_num, dr_reg_base_num, sh_justify_value_in_reg)
(sh_next_flt_argreg): Add gdbarch parameter and update caller. Replace
current_gdbarch by gdbarch.
(sh_extract_return_value_fpu, sh_store_return_value_fpu): Use
get_regcache_arch to get at the current architecture by regcache.
* sparc-tdep.c (sparc32_register_name): Add gdbarch parameter.
* sparc64-tdep.c (sparc64_register_name): Add gdbarch parameter.
* v850-tdep.c (v850_register_name, v850e_register_name): Add gdbarch
parameter.
(v850_unwind_sp, v850_unwind_pc): Replace current_gdbarch by gdbarch.
* xtensa-tdep.c (xtensa_register_name): Add gdbarch parameter. Replace
current_gdbarch by gdbarch.
(xtensa_pseudo_register_read, xtensa_pseudo_register_write)
(xtensa_frame_prev_register): Add gdbarch parameter to
xtensa_register_name call.
2007-11-02 15:27:15 +01:00
|
|
|
return gdbarch->register_name (gdbarch, regnr);
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_register_name (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_register_name_ftype register_name)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->register_name = register_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2003-06-13 06:40:34 +02:00
|
|
|
gdbarch_register_type_p (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
return gdbarch->register_type != NULL;
|
2003-06-13 06:40:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
struct type *
|
|
|
|
gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->register_type != NULL);
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
2003-06-13 06:40:34 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_register_type called\n");
|
|
|
|
return gdbarch->register_type (gdbarch, reg_nr);
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-06-13 06:40:34 +02:00
|
|
|
set_gdbarch_register_type (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_register_type_ftype register_type)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2003-06-13 06:40:34 +02:00
|
|
|
gdbarch->register_type = register_type;
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
2003-06-14 00:18:49 +02:00
|
|
|
int
|
Convert frame unwinders to use the current frame and
"struct value".
* frame.c (frame_debug): Make global.
(get_frame_id): Pass this frame to unwinder routines.
(frame_pc_unwind): Remove unused unwind->prev_pc support.
(do_frame_register_read): Do not discard the return value of
frame_register_read.
(frame_register_unwind): Remove debug messages. Use
frame_unwind_register_value.
(frame_unwind_register_value, get_frame_register_value): New
functions.
(create_new_frame, get_frame_base_address, get_frame_locals_address)
(get_frame_args_address, get_frame_type): Pass this frame to
unwinder routines.
(frame_cleanup_after_sniffer, frame_prepare_for_sniffer): New
functions.
* frame.h: Update comments.
(frame_debug, frame_unwind_register_value, get_frame_register_value)
(frame_prepare_for_sniffer): Declare.
* frame-unwind.h: Update comments and parameter names.
(default_frame_sniffer): Declare.
(frame_prev_register_ftype): Return a struct value *.
(struct frame_unwind): Remove prev_pc member.
(frame_unwind_sniffer_ftype, frame_unwind_append_sniffer): Delete.
(frame_unwind_append_unwinder, frame_unwind_got_optimized)
(frame_unwind_got_register, frame_unwind_got_memory)
(frame_unwind_got_constant, frame_unwind_got_address): Declare.
* frame-base.h: Update comments and parameter names.
* valops.c (value_fetch_lazy): Use get_frame_register_value. Iterate
if necessary. Add debugging output.
* sentinel-frame.c (sentinel_frame_prev_register)
(sentinel_frame_this_id): Update for new signature.
(sentinel_frame_prev_pc): Delete.
(sentinel_frame_unwinder): Remove prev_pc.
* ia64-tdep.c (ia64_libunwind_frame_unwind): Do not initialize
prev_pc.
* libunwind-frame.c (libunwind_frame_unwind): Likewise.
* frame-unwind.c (struct frame_unwind_table_entry): Remove sniffer.
(frame_unwind_append_sniffer): Delete.
(frame_unwind_append_unwinder): New function.
(frame_unwind_find_by_frame): Take this frame. Only use sniffers
from unwinders. Use frame_prepare_for_sniffer.
(default_frame_sniffer, frame_unwind_got_optimized)
(frame_unwind_got_register, frame_unwind_got_memory)
(frame_unwind_got_constant, frame_unwind_got_address): New functions.
* dummy-frame.c (dummy_frame_sniffer): Use gdbarch_dummy_id.
(dummy_frame_prev_register, dummy_frame_this_id): Update for new
signature.
* gdbarch.sh: Replace unwind_dummy_id with dummy_id.
* gdbarch.c, gdbarch.c: Regenerated.
* frame-base.c (default_frame_base_address)
(default_frame_locals_address, default_frame_args_address): Update
for new signature.
(frame_base_find_by_frame): Pass this frame to unwinder routines.
* infcall.c (call_function_by_hand): Update comments.
* Makefile.in (frame-unwind.o): Update dependencies.
* gdbint.texinfo (Stack Frames): New chapter.
(Algorithms): Move Frames text to the new chapter.
(Target Conditionals): Delete SAVE_DUMMY_FRAME_TOS. Document
gdbarch_dummy_id instead of gdbarch_unwind_dummy_id.
2008-04-30 23:16:46 +02:00
|
|
|
gdbarch_dummy_id_p (struct gdbarch *gdbarch)
|
2003-06-14 00:18:49 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
Convert frame unwinders to use the current frame and
"struct value".
* frame.c (frame_debug): Make global.
(get_frame_id): Pass this frame to unwinder routines.
(frame_pc_unwind): Remove unused unwind->prev_pc support.
(do_frame_register_read): Do not discard the return value of
frame_register_read.
(frame_register_unwind): Remove debug messages. Use
frame_unwind_register_value.
(frame_unwind_register_value, get_frame_register_value): New
functions.
(create_new_frame, get_frame_base_address, get_frame_locals_address)
(get_frame_args_address, get_frame_type): Pass this frame to
unwinder routines.
(frame_cleanup_after_sniffer, frame_prepare_for_sniffer): New
functions.
* frame.h: Update comments.
(frame_debug, frame_unwind_register_value, get_frame_register_value)
(frame_prepare_for_sniffer): Declare.
* frame-unwind.h: Update comments and parameter names.
(default_frame_sniffer): Declare.
(frame_prev_register_ftype): Return a struct value *.
(struct frame_unwind): Remove prev_pc member.
(frame_unwind_sniffer_ftype, frame_unwind_append_sniffer): Delete.
(frame_unwind_append_unwinder, frame_unwind_got_optimized)
(frame_unwind_got_register, frame_unwind_got_memory)
(frame_unwind_got_constant, frame_unwind_got_address): Declare.
* frame-base.h: Update comments and parameter names.
* valops.c (value_fetch_lazy): Use get_frame_register_value. Iterate
if necessary. Add debugging output.
* sentinel-frame.c (sentinel_frame_prev_register)
(sentinel_frame_this_id): Update for new signature.
(sentinel_frame_prev_pc): Delete.
(sentinel_frame_unwinder): Remove prev_pc.
* ia64-tdep.c (ia64_libunwind_frame_unwind): Do not initialize
prev_pc.
* libunwind-frame.c (libunwind_frame_unwind): Likewise.
* frame-unwind.c (struct frame_unwind_table_entry): Remove sniffer.
(frame_unwind_append_sniffer): Delete.
(frame_unwind_append_unwinder): New function.
(frame_unwind_find_by_frame): Take this frame. Only use sniffers
from unwinders. Use frame_prepare_for_sniffer.
(default_frame_sniffer, frame_unwind_got_optimized)
(frame_unwind_got_register, frame_unwind_got_memory)
(frame_unwind_got_constant, frame_unwind_got_address): New functions.
* dummy-frame.c (dummy_frame_sniffer): Use gdbarch_dummy_id.
(dummy_frame_prev_register, dummy_frame_this_id): Update for new
signature.
* gdbarch.sh: Replace unwind_dummy_id with dummy_id.
* gdbarch.c, gdbarch.c: Regenerated.
* frame-base.c (default_frame_base_address)
(default_frame_locals_address, default_frame_args_address): Update
for new signature.
(frame_base_find_by_frame): Pass this frame to unwinder routines.
* infcall.c (call_function_by_hand): Update comments.
* Makefile.in (frame-unwind.o): Update dependencies.
* gdbint.texinfo (Stack Frames): New chapter.
(Algorithms): Move Frames text to the new chapter.
(Target Conditionals): Delete SAVE_DUMMY_FRAME_TOS. Document
gdbarch_dummy_id instead of gdbarch_unwind_dummy_id.
2008-04-30 23:16:46 +02:00
|
|
|
return gdbarch->dummy_id != NULL;
|
2003-06-14 00:18:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
struct frame_id
|
Convert frame unwinders to use the current frame and
"struct value".
* frame.c (frame_debug): Make global.
(get_frame_id): Pass this frame to unwinder routines.
(frame_pc_unwind): Remove unused unwind->prev_pc support.
(do_frame_register_read): Do not discard the return value of
frame_register_read.
(frame_register_unwind): Remove debug messages. Use
frame_unwind_register_value.
(frame_unwind_register_value, get_frame_register_value): New
functions.
(create_new_frame, get_frame_base_address, get_frame_locals_address)
(get_frame_args_address, get_frame_type): Pass this frame to
unwinder routines.
(frame_cleanup_after_sniffer, frame_prepare_for_sniffer): New
functions.
* frame.h: Update comments.
(frame_debug, frame_unwind_register_value, get_frame_register_value)
(frame_prepare_for_sniffer): Declare.
* frame-unwind.h: Update comments and parameter names.
(default_frame_sniffer): Declare.
(frame_prev_register_ftype): Return a struct value *.
(struct frame_unwind): Remove prev_pc member.
(frame_unwind_sniffer_ftype, frame_unwind_append_sniffer): Delete.
(frame_unwind_append_unwinder, frame_unwind_got_optimized)
(frame_unwind_got_register, frame_unwind_got_memory)
(frame_unwind_got_constant, frame_unwind_got_address): Declare.
* frame-base.h: Update comments and parameter names.
* valops.c (value_fetch_lazy): Use get_frame_register_value. Iterate
if necessary. Add debugging output.
* sentinel-frame.c (sentinel_frame_prev_register)
(sentinel_frame_this_id): Update for new signature.
(sentinel_frame_prev_pc): Delete.
(sentinel_frame_unwinder): Remove prev_pc.
* ia64-tdep.c (ia64_libunwind_frame_unwind): Do not initialize
prev_pc.
* libunwind-frame.c (libunwind_frame_unwind): Likewise.
* frame-unwind.c (struct frame_unwind_table_entry): Remove sniffer.
(frame_unwind_append_sniffer): Delete.
(frame_unwind_append_unwinder): New function.
(frame_unwind_find_by_frame): Take this frame. Only use sniffers
from unwinders. Use frame_prepare_for_sniffer.
(default_frame_sniffer, frame_unwind_got_optimized)
(frame_unwind_got_register, frame_unwind_got_memory)
(frame_unwind_got_constant, frame_unwind_got_address): New functions.
* dummy-frame.c (dummy_frame_sniffer): Use gdbarch_dummy_id.
(dummy_frame_prev_register, dummy_frame_this_id): Update for new
signature.
* gdbarch.sh: Replace unwind_dummy_id with dummy_id.
* gdbarch.c, gdbarch.c: Regenerated.
* frame-base.c (default_frame_base_address)
(default_frame_locals_address, default_frame_args_address): Update
for new signature.
(frame_base_find_by_frame): Pass this frame to unwinder routines.
* infcall.c (call_function_by_hand): Update comments.
* Makefile.in (frame-unwind.o): Update dependencies.
* gdbint.texinfo (Stack Frames): New chapter.
(Algorithms): Move Frames text to the new chapter.
(Target Conditionals): Delete SAVE_DUMMY_FRAME_TOS. Document
gdbarch_dummy_id instead of gdbarch_unwind_dummy_id.
2008-04-30 23:16:46 +02:00
|
|
|
gdbarch_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
2003-06-14 00:18:49 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
Convert frame unwinders to use the current frame and
"struct value".
* frame.c (frame_debug): Make global.
(get_frame_id): Pass this frame to unwinder routines.
(frame_pc_unwind): Remove unused unwind->prev_pc support.
(do_frame_register_read): Do not discard the return value of
frame_register_read.
(frame_register_unwind): Remove debug messages. Use
frame_unwind_register_value.
(frame_unwind_register_value, get_frame_register_value): New
functions.
(create_new_frame, get_frame_base_address, get_frame_locals_address)
(get_frame_args_address, get_frame_type): Pass this frame to
unwinder routines.
(frame_cleanup_after_sniffer, frame_prepare_for_sniffer): New
functions.
* frame.h: Update comments.
(frame_debug, frame_unwind_register_value, get_frame_register_value)
(frame_prepare_for_sniffer): Declare.
* frame-unwind.h: Update comments and parameter names.
(default_frame_sniffer): Declare.
(frame_prev_register_ftype): Return a struct value *.
(struct frame_unwind): Remove prev_pc member.
(frame_unwind_sniffer_ftype, frame_unwind_append_sniffer): Delete.
(frame_unwind_append_unwinder, frame_unwind_got_optimized)
(frame_unwind_got_register, frame_unwind_got_memory)
(frame_unwind_got_constant, frame_unwind_got_address): Declare.
* frame-base.h: Update comments and parameter names.
* valops.c (value_fetch_lazy): Use get_frame_register_value. Iterate
if necessary. Add debugging output.
* sentinel-frame.c (sentinel_frame_prev_register)
(sentinel_frame_this_id): Update for new signature.
(sentinel_frame_prev_pc): Delete.
(sentinel_frame_unwinder): Remove prev_pc.
* ia64-tdep.c (ia64_libunwind_frame_unwind): Do not initialize
prev_pc.
* libunwind-frame.c (libunwind_frame_unwind): Likewise.
* frame-unwind.c (struct frame_unwind_table_entry): Remove sniffer.
(frame_unwind_append_sniffer): Delete.
(frame_unwind_append_unwinder): New function.
(frame_unwind_find_by_frame): Take this frame. Only use sniffers
from unwinders. Use frame_prepare_for_sniffer.
(default_frame_sniffer, frame_unwind_got_optimized)
(frame_unwind_got_register, frame_unwind_got_memory)
(frame_unwind_got_constant, frame_unwind_got_address): New functions.
* dummy-frame.c (dummy_frame_sniffer): Use gdbarch_dummy_id.
(dummy_frame_prev_register, dummy_frame_this_id): Update for new
signature.
* gdbarch.sh: Replace unwind_dummy_id with dummy_id.
* gdbarch.c, gdbarch.c: Regenerated.
* frame-base.c (default_frame_base_address)
(default_frame_locals_address, default_frame_args_address): Update
for new signature.
(frame_base_find_by_frame): Pass this frame to unwinder routines.
* infcall.c (call_function_by_hand): Update comments.
* Makefile.in (frame-unwind.o): Update dependencies.
* gdbint.texinfo (Stack Frames): New chapter.
(Algorithms): Move Frames text to the new chapter.
(Target Conditionals): Delete SAVE_DUMMY_FRAME_TOS. Document
gdbarch_dummy_id instead of gdbarch_unwind_dummy_id.
2008-04-30 23:16:46 +02:00
|
|
|
gdb_assert (gdbarch->dummy_id != NULL);
|
2003-06-14 00:18:49 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
Convert frame unwinders to use the current frame and
"struct value".
* frame.c (frame_debug): Make global.
(get_frame_id): Pass this frame to unwinder routines.
(frame_pc_unwind): Remove unused unwind->prev_pc support.
(do_frame_register_read): Do not discard the return value of
frame_register_read.
(frame_register_unwind): Remove debug messages. Use
frame_unwind_register_value.
(frame_unwind_register_value, get_frame_register_value): New
functions.
(create_new_frame, get_frame_base_address, get_frame_locals_address)
(get_frame_args_address, get_frame_type): Pass this frame to
unwinder routines.
(frame_cleanup_after_sniffer, frame_prepare_for_sniffer): New
functions.
* frame.h: Update comments.
(frame_debug, frame_unwind_register_value, get_frame_register_value)
(frame_prepare_for_sniffer): Declare.
* frame-unwind.h: Update comments and parameter names.
(default_frame_sniffer): Declare.
(frame_prev_register_ftype): Return a struct value *.
(struct frame_unwind): Remove prev_pc member.
(frame_unwind_sniffer_ftype, frame_unwind_append_sniffer): Delete.
(frame_unwind_append_unwinder, frame_unwind_got_optimized)
(frame_unwind_got_register, frame_unwind_got_memory)
(frame_unwind_got_constant, frame_unwind_got_address): Declare.
* frame-base.h: Update comments and parameter names.
* valops.c (value_fetch_lazy): Use get_frame_register_value. Iterate
if necessary. Add debugging output.
* sentinel-frame.c (sentinel_frame_prev_register)
(sentinel_frame_this_id): Update for new signature.
(sentinel_frame_prev_pc): Delete.
(sentinel_frame_unwinder): Remove prev_pc.
* ia64-tdep.c (ia64_libunwind_frame_unwind): Do not initialize
prev_pc.
* libunwind-frame.c (libunwind_frame_unwind): Likewise.
* frame-unwind.c (struct frame_unwind_table_entry): Remove sniffer.
(frame_unwind_append_sniffer): Delete.
(frame_unwind_append_unwinder): New function.
(frame_unwind_find_by_frame): Take this frame. Only use sniffers
from unwinders. Use frame_prepare_for_sniffer.
(default_frame_sniffer, frame_unwind_got_optimized)
(frame_unwind_got_register, frame_unwind_got_memory)
(frame_unwind_got_constant, frame_unwind_got_address): New functions.
* dummy-frame.c (dummy_frame_sniffer): Use gdbarch_dummy_id.
(dummy_frame_prev_register, dummy_frame_this_id): Update for new
signature.
* gdbarch.sh: Replace unwind_dummy_id with dummy_id.
* gdbarch.c, gdbarch.c: Regenerated.
* frame-base.c (default_frame_base_address)
(default_frame_locals_address, default_frame_args_address): Update
for new signature.
(frame_base_find_by_frame): Pass this frame to unwinder routines.
* infcall.c (call_function_by_hand): Update comments.
* Makefile.in (frame-unwind.o): Update dependencies.
* gdbint.texinfo (Stack Frames): New chapter.
(Algorithms): Move Frames text to the new chapter.
(Target Conditionals): Delete SAVE_DUMMY_FRAME_TOS. Document
gdbarch_dummy_id instead of gdbarch_unwind_dummy_id.
2008-04-30 23:16:46 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_dummy_id called\n");
|
|
|
|
return gdbarch->dummy_id (gdbarch, this_frame);
|
2003-06-14 00:18:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Convert frame unwinders to use the current frame and
"struct value".
* frame.c (frame_debug): Make global.
(get_frame_id): Pass this frame to unwinder routines.
(frame_pc_unwind): Remove unused unwind->prev_pc support.
(do_frame_register_read): Do not discard the return value of
frame_register_read.
(frame_register_unwind): Remove debug messages. Use
frame_unwind_register_value.
(frame_unwind_register_value, get_frame_register_value): New
functions.
(create_new_frame, get_frame_base_address, get_frame_locals_address)
(get_frame_args_address, get_frame_type): Pass this frame to
unwinder routines.
(frame_cleanup_after_sniffer, frame_prepare_for_sniffer): New
functions.
* frame.h: Update comments.
(frame_debug, frame_unwind_register_value, get_frame_register_value)
(frame_prepare_for_sniffer): Declare.
* frame-unwind.h: Update comments and parameter names.
(default_frame_sniffer): Declare.
(frame_prev_register_ftype): Return a struct value *.
(struct frame_unwind): Remove prev_pc member.
(frame_unwind_sniffer_ftype, frame_unwind_append_sniffer): Delete.
(frame_unwind_append_unwinder, frame_unwind_got_optimized)
(frame_unwind_got_register, frame_unwind_got_memory)
(frame_unwind_got_constant, frame_unwind_got_address): Declare.
* frame-base.h: Update comments and parameter names.
* valops.c (value_fetch_lazy): Use get_frame_register_value. Iterate
if necessary. Add debugging output.
* sentinel-frame.c (sentinel_frame_prev_register)
(sentinel_frame_this_id): Update for new signature.
(sentinel_frame_prev_pc): Delete.
(sentinel_frame_unwinder): Remove prev_pc.
* ia64-tdep.c (ia64_libunwind_frame_unwind): Do not initialize
prev_pc.
* libunwind-frame.c (libunwind_frame_unwind): Likewise.
* frame-unwind.c (struct frame_unwind_table_entry): Remove sniffer.
(frame_unwind_append_sniffer): Delete.
(frame_unwind_append_unwinder): New function.
(frame_unwind_find_by_frame): Take this frame. Only use sniffers
from unwinders. Use frame_prepare_for_sniffer.
(default_frame_sniffer, frame_unwind_got_optimized)
(frame_unwind_got_register, frame_unwind_got_memory)
(frame_unwind_got_constant, frame_unwind_got_address): New functions.
* dummy-frame.c (dummy_frame_sniffer): Use gdbarch_dummy_id.
(dummy_frame_prev_register, dummy_frame_this_id): Update for new
signature.
* gdbarch.sh: Replace unwind_dummy_id with dummy_id.
* gdbarch.c, gdbarch.c: Regenerated.
* frame-base.c (default_frame_base_address)
(default_frame_locals_address, default_frame_args_address): Update
for new signature.
(frame_base_find_by_frame): Pass this frame to unwinder routines.
* infcall.c (call_function_by_hand): Update comments.
* Makefile.in (frame-unwind.o): Update dependencies.
* gdbint.texinfo (Stack Frames): New chapter.
(Algorithms): Move Frames text to the new chapter.
(Target Conditionals): Delete SAVE_DUMMY_FRAME_TOS. Document
gdbarch_dummy_id instead of gdbarch_unwind_dummy_id.
2008-04-30 23:16:46 +02:00
|
|
|
set_gdbarch_dummy_id (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_dummy_id_ftype dummy_id)
|
2003-06-14 00:18:49 +02:00
|
|
|
{
|
Convert frame unwinders to use the current frame and
"struct value".
* frame.c (frame_debug): Make global.
(get_frame_id): Pass this frame to unwinder routines.
(frame_pc_unwind): Remove unused unwind->prev_pc support.
(do_frame_register_read): Do not discard the return value of
frame_register_read.
(frame_register_unwind): Remove debug messages. Use
frame_unwind_register_value.
(frame_unwind_register_value, get_frame_register_value): New
functions.
(create_new_frame, get_frame_base_address, get_frame_locals_address)
(get_frame_args_address, get_frame_type): Pass this frame to
unwinder routines.
(frame_cleanup_after_sniffer, frame_prepare_for_sniffer): New
functions.
* frame.h: Update comments.
(frame_debug, frame_unwind_register_value, get_frame_register_value)
(frame_prepare_for_sniffer): Declare.
* frame-unwind.h: Update comments and parameter names.
(default_frame_sniffer): Declare.
(frame_prev_register_ftype): Return a struct value *.
(struct frame_unwind): Remove prev_pc member.
(frame_unwind_sniffer_ftype, frame_unwind_append_sniffer): Delete.
(frame_unwind_append_unwinder, frame_unwind_got_optimized)
(frame_unwind_got_register, frame_unwind_got_memory)
(frame_unwind_got_constant, frame_unwind_got_address): Declare.
* frame-base.h: Update comments and parameter names.
* valops.c (value_fetch_lazy): Use get_frame_register_value. Iterate
if necessary. Add debugging output.
* sentinel-frame.c (sentinel_frame_prev_register)
(sentinel_frame_this_id): Update for new signature.
(sentinel_frame_prev_pc): Delete.
(sentinel_frame_unwinder): Remove prev_pc.
* ia64-tdep.c (ia64_libunwind_frame_unwind): Do not initialize
prev_pc.
* libunwind-frame.c (libunwind_frame_unwind): Likewise.
* frame-unwind.c (struct frame_unwind_table_entry): Remove sniffer.
(frame_unwind_append_sniffer): Delete.
(frame_unwind_append_unwinder): New function.
(frame_unwind_find_by_frame): Take this frame. Only use sniffers
from unwinders. Use frame_prepare_for_sniffer.
(default_frame_sniffer, frame_unwind_got_optimized)
(frame_unwind_got_register, frame_unwind_got_memory)
(frame_unwind_got_constant, frame_unwind_got_address): New functions.
* dummy-frame.c (dummy_frame_sniffer): Use gdbarch_dummy_id.
(dummy_frame_prev_register, dummy_frame_this_id): Update for new
signature.
* gdbarch.sh: Replace unwind_dummy_id with dummy_id.
* gdbarch.c, gdbarch.c: Regenerated.
* frame-base.c (default_frame_base_address)
(default_frame_locals_address, default_frame_args_address): Update
for new signature.
(frame_base_find_by_frame): Pass this frame to unwinder routines.
* infcall.c (call_function_by_hand): Update comments.
* Makefile.in (frame-unwind.o): Update dependencies.
* gdbint.texinfo (Stack Frames): New chapter.
(Algorithms): Move Frames text to the new chapter.
(Target Conditionals): Delete SAVE_DUMMY_FRAME_TOS. Document
gdbarch_dummy_id instead of gdbarch_unwind_dummy_id.
2008-04-30 23:16:46 +02:00
|
|
|
gdbarch->dummy_id = dummy_id;
|
2003-06-14 00:18:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of deprecated_fp_regnum, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_fp_regnum called\n");
|
|
|
|
return gdbarch->deprecated_fp_regnum;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch,
|
|
|
|
int deprecated_fp_regnum)
|
|
|
|
{
|
|
|
|
gdbarch->deprecated_fp_regnum = deprecated_fp_regnum;
|
|
|
|
}
|
|
|
|
|
2002-08-21 18:34:10 +02:00
|
|
|
int
|
2003-06-14 01:07:06 +02:00
|
|
|
gdbarch_push_dummy_call_p (struct gdbarch *gdbarch)
|
2002-08-21 18:34:10 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
return gdbarch->push_dummy_call != NULL;
|
2002-08-21 18:34:10 +02:00
|
|
|
}
|
|
|
|
|
2003-06-14 01:07:06 +02:00
|
|
|
CORE_ADDR
|
2004-06-07 04:02:55 +02:00
|
|
|
gdbarch_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
|
2000-08-01 16:48:01 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->push_dummy_call != NULL);
|
2000-08-01 16:48:01 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
2003-06-14 01:07:06 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_call called\n");
|
2004-06-07 04:02:55 +02:00
|
|
|
return gdbarch->push_dummy_call (gdbarch, function, regcache, bp_addr, nargs, args, sp, struct_return, struct_addr);
|
2000-08-01 16:48:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-06-14 01:07:06 +02:00
|
|
|
set_gdbarch_push_dummy_call (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_push_dummy_call_ftype push_dummy_call)
|
2000-08-01 16:48:01 +02:00
|
|
|
{
|
2003-06-14 01:07:06 +02:00
|
|
|
gdbarch->push_dummy_call = push_dummy_call;
|
2000-08-01 16:48:01 +02:00
|
|
|
}
|
|
|
|
|
2000-12-15 13:33:08 +01:00
|
|
|
int
|
2003-06-14 01:07:06 +02:00
|
|
|
gdbarch_call_dummy_location (struct gdbarch *gdbarch)
|
2000-12-15 13:33:08 +01:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-06-14 01:07:06 +02:00
|
|
|
/* Skip verify of call_dummy_location, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_location called\n");
|
|
|
|
return gdbarch->call_dummy_location;
|
2000-12-15 13:33:08 +01:00
|
|
|
}
|
|
|
|
|
2003-06-14 01:07:06 +02:00
|
|
|
void
|
|
|
|
set_gdbarch_call_dummy_location (struct gdbarch *gdbarch,
|
|
|
|
int call_dummy_location)
|
|
|
|
{
|
|
|
|
gdbarch->call_dummy_location = call_dummy_location;
|
|
|
|
}
|
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
int
|
2003-06-14 01:07:06 +02:00
|
|
|
gdbarch_push_dummy_code_p (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
return gdbarch->push_dummy_code != NULL;
|
2003-06-14 01:07:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CORE_ADDR
|
2007-10-12 17:34:45 +02:00
|
|
|
gdbarch_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr, struct regcache *regcache)
|
2003-06-14 01:07:06 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->push_dummy_code != NULL);
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
2003-06-14 01:07:06 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_code called\n");
|
2007-10-12 17:34:45 +02:00
|
|
|
return gdbarch->push_dummy_code (gdbarch, sp, funaddr, args, nargs, value_type, real_pc, bp_addr, regcache);
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-06-14 01:07:06 +02:00
|
|
|
set_gdbarch_push_dummy_code (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_push_dummy_code_ftype push_dummy_code)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2003-06-14 01:07:06 +02:00
|
|
|
gdbarch->push_dummy_code = push_dummy_code;
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
Skip unwritable frames in command "finish"
Nowadays, GDB can't insert breakpoint on the return address of the
exception handler on ARM M-profile, because the address is a magic
one 0xfffffff9,
(gdb) bt
#0 CT32B1_IRQHandler () at ../src/timer.c:67
#1 <signal handler called>
#2 main () at ../src/timer.c:127
(gdb) info frame
Stack level 0, frame at 0x200ffa8:
pc = 0x4ec in CT32B1_IRQHandler (../src/timer.c:67); saved pc = 0xfffffff9
called by frame at 0x200ffc8
source language c.
Arglist at 0x200ffa0, args:
Locals at 0x200ffa0, Previous frame's sp is 0x200ffa8
Saved registers:
r7 at 0x200ffa0, lr at 0x200ffa4
(gdb) x/x 0xfffffff9
0xfffffff9: Cannot access memory at address 0xfffffff9
(gdb) finish
Run till exit from #0 CT32B1_IRQHandler () at ../src/timer.c:67
Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?)
Warning:
Cannot insert hardware breakpoint 0.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.
Command aborted.
even some debug probe can't set hardware breakpoint on the magic
address too,
(gdb) hbreak *0xfffffff9
Hardware assisted breakpoint 2 at 0xfffffff9
(gdb) c
Continuing.
Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?)
Warning:
Cannot insert hardware breakpoint 2.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.
Command aborted.
The problem described above is quite similar to PR 8841, in which GDB
can't set breakpoint on signal trampoline, which is mapped to a read-only
page by kernel. The rationale of this patch is to skip "unwritable"
frames when looking for caller frames in command "finish", and a new
gdbarch method code_of_frame_writable is added. This patch fixes
the problem on ARM cortex-m target, but it can be used to fix
PR 8841 too.
gdb:
2016-05-10 Yao Qi <yao.qi@arm.com>
* arch-utils.c (default_code_of_frame_writable): New function.
* arch-utils.h (default_code_of_frame_writable): Declare.
* arm-tdep.c (arm_code_of_frame_writable): New function.
(arm_gdbarch_init): Install gdbarch method
code_of_frame_writable if the target is M-profile.
* frame.c (skip_unwritable_frames): New function.
* frame.h (skip_unwritable_frames): Declare.
* gdbarch.sh (code_of_frame_writable): New.
* gdbarch.c, gdbarch.h: Re-generated.
* infcmd.c (finish_command): Call skip_unwritable_frames.
2016-05-23 18:32:56 +02:00
|
|
|
int
|
|
|
|
gdbarch_code_of_frame_writable (struct gdbarch *gdbarch, struct frame_info *frame)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->code_of_frame_writable != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_code_of_frame_writable called\n");
|
|
|
|
return gdbarch->code_of_frame_writable (gdbarch, frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_code_of_frame_writable (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_code_of_frame_writable_ftype code_of_frame_writable)
|
|
|
|
{
|
|
|
|
gdbarch->code_of_frame_writable = code_of_frame_writable;
|
|
|
|
}
|
|
|
|
|
2003-06-14 01:07:06 +02:00
|
|
|
void
|
|
|
|
gdbarch_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, int regnum, int all)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->print_registers_info != NULL);
|
2003-06-14 01:07:06 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_print_registers_info called\n");
|
|
|
|
gdbarch->print_registers_info (gdbarch, file, frame, regnum, all);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_print_registers_info (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_print_registers_info_ftype print_registers_info)
|
|
|
|
{
|
|
|
|
gdbarch->print_registers_info = print_registers_info;
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
2003-06-14 01:07:06 +02:00
|
|
|
void
|
|
|
|
gdbarch_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->print_float_info != NULL);
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
2003-06-14 01:07:06 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_print_float_info called\n");
|
|
|
|
gdbarch->print_float_info (gdbarch, file, frame, args);
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-06-14 01:07:06 +02:00
|
|
|
set_gdbarch_print_float_info (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_print_float_info_ftype print_float_info)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2003-06-14 01:07:06 +02:00
|
|
|
gdbarch->print_float_info = print_float_info;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_print_vector_info_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
return gdbarch->print_vector_info != NULL;
|
2003-06-14 01:07:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdbarch_print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->print_vector_info != NULL);
|
2003-06-14 01:07:06 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_print_vector_info called\n");
|
|
|
|
gdbarch->print_vector_info (gdbarch, file, frame, args);
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
2003-06-14 01:07:06 +02:00
|
|
|
void
|
|
|
|
set_gdbarch_print_vector_info (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_print_vector_info_ftype print_vector_info)
|
2002-12-01 Andrew Cagney <ac131313@redhat.com>
* gdbarch.sh (DEPRECATED_PC_IN_CALL_DUMMY): Rename
PC_IN_CALL_DUMMY. Change to predicate. Always allow call.
* gdbarch.h, gdbarch.c: Re-generate.
* config/sparc/tm-sparc.h, config/sparc/tm-sp64.h: Update.
* config/mn10200/tm-mn10200.h, config/h8500/tm-h8500.h: Update.
* config/pa/tm-hppa.h, frame.h: Update.
* x86-64-tdep.c, vax-tdep.c, sparc-tdep.c: Update.
* s390-tdep.c, ns32k-tdep.c, mn10300-tdep.c: Update.
* m68k-tdep.c, i386-tdep.c, frv-tdep.c: Update.
* cris-tdep.c, alpha-tdep.c: Update.
* frame.c (set_unwind_by_pc, create_new_frame): Use either
DEPRECATED_PC_IN_CALL_DUMMY or pc_in_dummy_frame.
(get_prev_frame): Ditto.
Index: doc/ChangeLog
2002-12-01 Andrew Cagney <ac131313@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Delete
PC_IN_CALL_DUMMY.
2002-12-01 20:07:16 +01:00
|
|
|
{
|
2003-06-14 01:07:06 +02:00
|
|
|
gdbarch->print_vector_info = print_vector_info;
|
2002-12-01 Andrew Cagney <ac131313@redhat.com>
* gdbarch.sh (DEPRECATED_PC_IN_CALL_DUMMY): Rename
PC_IN_CALL_DUMMY. Change to predicate. Always allow call.
* gdbarch.h, gdbarch.c: Re-generate.
* config/sparc/tm-sparc.h, config/sparc/tm-sp64.h: Update.
* config/mn10200/tm-mn10200.h, config/h8500/tm-h8500.h: Update.
* config/pa/tm-hppa.h, frame.h: Update.
* x86-64-tdep.c, vax-tdep.c, sparc-tdep.c: Update.
* s390-tdep.c, ns32k-tdep.c, mn10300-tdep.c: Update.
* m68k-tdep.c, i386-tdep.c, frv-tdep.c: Update.
* cris-tdep.c, alpha-tdep.c: Update.
* frame.c (set_unwind_by_pc, create_new_frame): Use either
DEPRECATED_PC_IN_CALL_DUMMY or pc_in_dummy_frame.
(get_prev_frame): Ditto.
Index: doc/ChangeLog
2002-12-01 Andrew Cagney <ac131313@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Delete
PC_IN_CALL_DUMMY.
2002-12-01 20:07:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2003-06-14 01:07:06 +02:00
|
|
|
gdbarch_register_sim_regno (struct gdbarch *gdbarch, int reg_nr)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->register_sim_regno != NULL);
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
2003-06-14 01:07:06 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_register_sim_regno called\n");
|
2007-11-19 06:06:24 +01:00
|
|
|
return gdbarch->register_sim_regno (gdbarch, reg_nr);
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-06-14 01:07:06 +02:00
|
|
|
set_gdbarch_register_sim_regno (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_register_sim_regno_ftype register_sim_regno)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2003-06-14 01:07:06 +02:00
|
|
|
gdbarch->register_sim_regno = register_sim_regno;
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2003-06-14 01:07:06 +02:00
|
|
|
gdbarch_cannot_fetch_register (struct gdbarch *gdbarch, int regnum)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->cannot_fetch_register != NULL);
|
2003-06-14 01:07:06 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_cannot_fetch_register called\n");
|
2007-11-16 05:56:45 +01:00
|
|
|
return gdbarch->cannot_fetch_register (gdbarch, regnum);
|
2003-06-14 01:07:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_cannot_fetch_register (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_cannot_fetch_register_ftype cannot_fetch_register)
|
|
|
|
{
|
|
|
|
gdbarch->cannot_fetch_register = cannot_fetch_register;
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2003-06-14 01:07:06 +02:00
|
|
|
gdbarch_cannot_store_register (struct gdbarch *gdbarch, int regnum)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->cannot_store_register != NULL);
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
2003-06-14 01:07:06 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_cannot_store_register called\n");
|
2007-11-16 05:56:45 +01:00
|
|
|
return gdbarch->cannot_store_register (gdbarch, regnum);
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-06-14 01:07:06 +02:00
|
|
|
set_gdbarch_cannot_store_register (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_cannot_store_register_ftype cannot_store_register)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2003-06-14 01:07:06 +02:00
|
|
|
gdbarch->cannot_store_register = cannot_store_register;
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
2003-04-01 01:52:38 +02:00
|
|
|
int
|
2003-06-14 01:07:06 +02:00
|
|
|
gdbarch_get_longjmp_target_p (struct gdbarch *gdbarch)
|
2003-04-01 01:52:38 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
return gdbarch->get_longjmp_target != NULL;
|
2003-04-01 01:52:38 +02:00
|
|
|
}
|
|
|
|
|
2003-06-14 01:07:06 +02:00
|
|
|
int
|
2007-06-16 00:41:13 +02:00
|
|
|
gdbarch_get_longjmp_target (struct gdbarch *gdbarch, struct frame_info *frame, CORE_ADDR *pc)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->get_longjmp_target != NULL);
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
2003-06-14 01:07:06 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_get_longjmp_target called\n");
|
2007-06-16 00:41:13 +02:00
|
|
|
return gdbarch->get_longjmp_target (frame, pc);
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-06-14 01:07:06 +02:00
|
|
|
set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_get_longjmp_target_ftype get_longjmp_target)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2003-06-14 01:07:06 +02:00
|
|
|
gdbarch->get_longjmp_target = get_longjmp_target;
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
1999-08-31 03:14:27 +02:00
|
|
|
gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_believe_pcc_promotion called\n");
|
|
|
|
return gdbarch->believe_pcc_promotion;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch,
|
|
|
|
int believe_pcc_promotion)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->believe_pcc_promotion = believe_pcc_promotion;
|
|
|
|
}
|
|
|
|
|
2002-05-12 05:09:12 +02:00
|
|
|
int
|
2003-06-14 Andrew Cagney <cagney@redhat.com>
Mark Kettenis <kettenis@gnu.org>
* gdbarch.sh (CONVERT_REGISTER_P): Add "type" parameter.
(REGISTER_TO_VALUE, VALUE_TO_REGISTER): Replace raw buffer
parameter with "frame".
* gdbarch.h, gdbarch.c: Re-generate.
* frame.h (put_frame_register): Declare.
* frame.c (put_frame_register): New function.
* arch-utils.c (legacy_convert_register_p): Add "type" parameter.
(legacy_register_to_value): Rewrite, use "frame" to get the
register value.
(legacy_value_to_register): Rewrite, use "frame" to find the
register's location before storing.
* arch-utils.h (legacy_convert_register_p): Update.
(legacy_register_to_value, legacy_value_to_register): Update.
* findvar.c (value_from_register): Rewrite, eliminate use of
REGISTER_CONVERT_TO_TYPE, pass "type" to CONVERT_REGISTER_P, pass
"frame" to REGISTER_TO_VALUE.
* valops.c (value_assign): Move the CONVERT_REGISTER code to the
lval_reg_frame_relative + lval_register branch of the switch. Do
not use REGISTER_CONVERT_FROM_TYPE. Use put_frame_register.
* i386-tdep.c (I386_EBX_REGNUM, I386_ECX_REGNUM, I386_ESI_REGNUM,
I386_EDI_REGNUM): New defines.
(i386_next_regnum, i386_convert_register_p,
i386_register_to_value, i386_value_to_register): New functions.
(i386_register_convertible, i386_register_convert_to_virtual,
i386_convert_to_raw): Remove functions.
(i386_gdbarch_init): Set convert_register_p, register_to_value and
value_to_register instead of register_convertible,
register_convert_to_virtual and register_convert_to_raw.
* mips-tdep.c (mips_convert_register_p): New function.
(mips_value_to_register): Replace mips_register_convert_from_type.
(mips_register_to_value): Replace mips_register_convert_to_type.
(mips_gdbarch_init): Set conver_register_p, value_to_register and
register_to_value.
* alpha-tdep.c (alpha_convert_register_p): Update.
(alpha_value_to_register): Update, store the register.
(alpha_register_to_value): Update, fetch the register.
2003-06-15 00:35:25 +02:00
|
|
|
gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type)
|
2002-05-12 05:09:12 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->convert_register_p != NULL);
|
2002-05-12 05:09:12 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_convert_register_p called\n");
|
2007-11-09 06:32:19 +01:00
|
|
|
return gdbarch->convert_register_p (gdbarch, regnum, type);
|
2002-05-12 05:09:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_convert_register_p (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_convert_register_p_ftype convert_register_p)
|
|
|
|
{
|
|
|
|
gdbarch->convert_register_p = convert_register_p;
|
|
|
|
}
|
|
|
|
|
2011-03-18 19:42:41 +01:00
|
|
|
int
|
|
|
|
gdbarch_register_to_value (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, gdb_byte *buf, int *optimizedp, int *unavailablep)
|
2002-05-12 05:09:12 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->register_to_value != NULL);
|
2002-05-12 05:09:12 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_register_to_value called\n");
|
2011-03-18 19:42:41 +01:00
|
|
|
return gdbarch->register_to_value (frame, regnum, type, buf, optimizedp, unavailablep);
|
2002-05-12 05:09:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_register_to_value (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_register_to_value_ftype register_to_value)
|
|
|
|
{
|
|
|
|
gdbarch->register_to_value = register_to_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-05-14 08:07:42 +02:00
|
|
|
gdbarch_value_to_register (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, const gdb_byte *buf)
|
2002-05-12 05:09:12 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->value_to_register != NULL);
|
2002-05-12 05:09:12 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_value_to_register called\n");
|
2003-06-14 Andrew Cagney <cagney@redhat.com>
Mark Kettenis <kettenis@gnu.org>
* gdbarch.sh (CONVERT_REGISTER_P): Add "type" parameter.
(REGISTER_TO_VALUE, VALUE_TO_REGISTER): Replace raw buffer
parameter with "frame".
* gdbarch.h, gdbarch.c: Re-generate.
* frame.h (put_frame_register): Declare.
* frame.c (put_frame_register): New function.
* arch-utils.c (legacy_convert_register_p): Add "type" parameter.
(legacy_register_to_value): Rewrite, use "frame" to get the
register value.
(legacy_value_to_register): Rewrite, use "frame" to find the
register's location before storing.
* arch-utils.h (legacy_convert_register_p): Update.
(legacy_register_to_value, legacy_value_to_register): Update.
* findvar.c (value_from_register): Rewrite, eliminate use of
REGISTER_CONVERT_TO_TYPE, pass "type" to CONVERT_REGISTER_P, pass
"frame" to REGISTER_TO_VALUE.
* valops.c (value_assign): Move the CONVERT_REGISTER code to the
lval_reg_frame_relative + lval_register branch of the switch. Do
not use REGISTER_CONVERT_FROM_TYPE. Use put_frame_register.
* i386-tdep.c (I386_EBX_REGNUM, I386_ECX_REGNUM, I386_ESI_REGNUM,
I386_EDI_REGNUM): New defines.
(i386_next_regnum, i386_convert_register_p,
i386_register_to_value, i386_value_to_register): New functions.
(i386_register_convertible, i386_register_convert_to_virtual,
i386_convert_to_raw): Remove functions.
(i386_gdbarch_init): Set convert_register_p, register_to_value and
value_to_register instead of register_convertible,
register_convert_to_virtual and register_convert_to_raw.
* mips-tdep.c (mips_convert_register_p): New function.
(mips_value_to_register): Replace mips_register_convert_from_type.
(mips_register_to_value): Replace mips_register_convert_to_type.
(mips_gdbarch_init): Set conver_register_p, value_to_register and
register_to_value.
* alpha-tdep.c (alpha_convert_register_p): Update.
(alpha_value_to_register): Update, store the register.
(alpha_register_to_value): Update, fetch the register.
2003-06-15 00:35:25 +02:00
|
|
|
gdbarch->value_to_register (frame, regnum, type, buf);
|
2002-05-12 05:09:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_value_to_register (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_value_to_register_ftype value_to_register)
|
|
|
|
{
|
|
|
|
gdbarch->value_to_register = value_to_register;
|
|
|
|
}
|
|
|
|
|
2007-01-08 21:03:49 +01:00
|
|
|
struct value *
|
Use address_from_register in dwarf2-frame.c:read_addr_from_reg
This patch fixes a problem that prevented use of the Dwarf unwinders on SPU,
because dwarf2-frame.c common code did not support the situation where the
stack and/or frame pointer is maintained in a *vector* register. This is
because read_addr_from_reg is hard-coded to assume that such pointers can
be read from registers via a simple get_frame_register / unpack_pointer
operation.
Now, there *is* a routine address_from_register that calls into the
appropriate tdep routines to handle pointer values in "weird" registers
like on SPU, but it turns out I cannot simply change dwarf2-frame.c to
use address_from_register. This is because address_from_register uses
value_from_register to create a (temporary) value, and that routine
at some point calls get_frame_id in order to set up that value's
VALUE_FRAME_ID entry.
However, the dwarf2-frame.c read_addr_from_reg routine will be called
during early unwinding (to unwind the frame's CFA), at which point the
frame's ID is not actually known yet! This would cause an assert.
On the other hand, we may notice that VALUE_FRAME_ID is only needed in the
value returned by value_from_register if that value is later used as an
lvalue. But this is obviously never done to the temporary value used in
address_from_register. So, if we could change address_from_register to
not call value_from_register but instead accept constructing a value
that doesn't have VALUE_FRAME_ID set, things should be fine.
To do that, we can change the value_from_register callback to accept
a FRAME_ID instead of a FRAME; the only existing uses of the FRAME
argument were either to extract its frame ID, or its gdbarch. (To
keep a way of getting at the latter, we also change the callback's
type from "f" to "m".) Together with the required follow-on changes
in the existing value_from_register implementations (including the
default one), this seems to fix the problem.
As another minor interface cleanup, I've removed the explicit TYPE
argument from address_from_register. This routine really always
uses a default pointer type, and in the new implementation it -to
some extent- relies on that fact, in that it will now no longer
handle types that require gdbarch_convert_register_p handling.
gdb:
2014-04-17 Ulrich Weigand <uweigand@de.ibm.com>
* gdbarch.sh (value_from_register): Make class "m" instead of "f".
Replace FRAME argument with FRAME_ID.
* gdbarch.c, gdbarch.h: Regenerate.
* findvar.c (default_value_from_register): Add GDBARCH argument;
replace FRAME by FRAME_ID. No longer call get_frame_id.
(value_from_register): Update call to gdbarch_value_from_register.
* value.h (default_value_from_register): Update prototype.
* s390-linux-tdep.c (s390_value_from_register): Update interface
and call to default_value_from_register.
* spu-tdep.c (spu_value_from_register): Likewise.
* findvar.c (address_from_register): Remove TYPE argument.
Do not call value_from_register; use gdbarch_value_from_register
with null_frame_id instead.
* value.h (address_from_register): Update prototype.
* dwarf2-frame.c (read_addr_from_reg): Use address_from_register.
* dwarf2loc.c (dwarf_expr_read_addr_from_reg): Update for
address_from_register interface change.
2014-04-17 14:01:39 +02:00
|
|
|
gdbarch_value_from_register (struct gdbarch *gdbarch, struct type *type, int regnum, struct frame_id frame_id)
|
2007-01-08 21:03:49 +01:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->value_from_register != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_value_from_register called\n");
|
Use address_from_register in dwarf2-frame.c:read_addr_from_reg
This patch fixes a problem that prevented use of the Dwarf unwinders on SPU,
because dwarf2-frame.c common code did not support the situation where the
stack and/or frame pointer is maintained in a *vector* register. This is
because read_addr_from_reg is hard-coded to assume that such pointers can
be read from registers via a simple get_frame_register / unpack_pointer
operation.
Now, there *is* a routine address_from_register that calls into the
appropriate tdep routines to handle pointer values in "weird" registers
like on SPU, but it turns out I cannot simply change dwarf2-frame.c to
use address_from_register. This is because address_from_register uses
value_from_register to create a (temporary) value, and that routine
at some point calls get_frame_id in order to set up that value's
VALUE_FRAME_ID entry.
However, the dwarf2-frame.c read_addr_from_reg routine will be called
during early unwinding (to unwind the frame's CFA), at which point the
frame's ID is not actually known yet! This would cause an assert.
On the other hand, we may notice that VALUE_FRAME_ID is only needed in the
value returned by value_from_register if that value is later used as an
lvalue. But this is obviously never done to the temporary value used in
address_from_register. So, if we could change address_from_register to
not call value_from_register but instead accept constructing a value
that doesn't have VALUE_FRAME_ID set, things should be fine.
To do that, we can change the value_from_register callback to accept
a FRAME_ID instead of a FRAME; the only existing uses of the FRAME
argument were either to extract its frame ID, or its gdbarch. (To
keep a way of getting at the latter, we also change the callback's
type from "f" to "m".) Together with the required follow-on changes
in the existing value_from_register implementations (including the
default one), this seems to fix the problem.
As another minor interface cleanup, I've removed the explicit TYPE
argument from address_from_register. This routine really always
uses a default pointer type, and in the new implementation it -to
some extent- relies on that fact, in that it will now no longer
handle types that require gdbarch_convert_register_p handling.
gdb:
2014-04-17 Ulrich Weigand <uweigand@de.ibm.com>
* gdbarch.sh (value_from_register): Make class "m" instead of "f".
Replace FRAME argument with FRAME_ID.
* gdbarch.c, gdbarch.h: Regenerate.
* findvar.c (default_value_from_register): Add GDBARCH argument;
replace FRAME by FRAME_ID. No longer call get_frame_id.
(value_from_register): Update call to gdbarch_value_from_register.
* value.h (default_value_from_register): Update prototype.
* s390-linux-tdep.c (s390_value_from_register): Update interface
and call to default_value_from_register.
* spu-tdep.c (spu_value_from_register): Likewise.
* findvar.c (address_from_register): Remove TYPE argument.
Do not call value_from_register; use gdbarch_value_from_register
with null_frame_id instead.
* value.h (address_from_register): Update prototype.
* dwarf2-frame.c (read_addr_from_reg): Use address_from_register.
* dwarf2loc.c (dwarf_expr_read_addr_from_reg): Update for
address_from_register interface change.
2014-04-17 14:01:39 +02:00
|
|
|
return gdbarch->value_from_register (gdbarch, type, regnum, frame_id);
|
2007-01-08 21:03:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_value_from_register (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_value_from_register_ftype value_from_register)
|
|
|
|
{
|
|
|
|
gdbarch->value_from_register = value_from_register;
|
|
|
|
}
|
|
|
|
|
* 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.
2000-04-14 20:43:41 +02:00
|
|
|
CORE_ADDR
|
2005-05-14 08:07:42 +02:00
|
|
|
gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf)
|
* 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.
2000-04-14 20:43:41 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->pointer_to_address != NULL);
|
* 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.
2000-04-14 20:43:41 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_pointer_to_address called\n");
|
2009-06-17 20:50:31 +02:00
|
|
|
return gdbarch->pointer_to_address (gdbarch, type, buf);
|
* 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.
2000-04-14 20:43:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2005-05-14 08:07:42 +02:00
|
|
|
gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr)
|
* 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.
2000-04-14 20:43:41 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->address_to_pointer != NULL);
|
* 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.
2000-04-14 20:43:41 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_address_to_pointer called\n");
|
2009-06-17 20:50:31 +02:00
|
|
|
gdbarch->address_to_pointer (gdbarch, type, buf, addr);
|
* 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.
2000-04-14 20:43:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_address_to_pointer (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_address_to_pointer_ftype address_to_pointer)
|
|
|
|
{
|
|
|
|
gdbarch->address_to_pointer = address_to_pointer;
|
|
|
|
}
|
|
|
|
|
2001-10-15 20:18:30 +02:00
|
|
|
int
|
|
|
|
gdbarch_integer_to_address_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
return gdbarch->integer_to_address != NULL;
|
2001-10-15 20:18:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CORE_ADDR
|
2005-05-09 Andrew Cagney <cagney@gnu.org>
Use gdb_byte in preference to bfd_byte.
* gdbarch.sh: Update.
* gdbarch.h, gdbarch.c: Re-generate.
* ada-lang.c, ada-lang.h, ada-valprint.c, arch-utils.c: Update.
* c-lang.c, c-lang.h, c-valprint.c, cp-valprint.c: Update.
* f-lang.c, f-lang.h, f-valprint.c, gdbcore.h, jv-lang.h: Update.
* jv-valprint.c, language.c, language.h, m2-lang.c: Update.
* m2-lang.h, m2-valprint.c, objc-lang.c, p-lang.c: Update.
* p-lang.h, p-valprint.c, regcache.c, scm-lang.c: Update.
* scm-lang.h, scm-valprint.c, target.c, target.h: Update.
* tramp-frame.c, valarith.c, valops.c, valprint.c: Update.
* valprint.h, value.c, value.h: Update.
2005-05-09 23:20:35 +02:00
|
|
|
gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf)
|
2001-10-15 20:18:30 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->integer_to_address != NULL);
|
2001-10-15 20:18:30 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_integer_to_address called\n");
|
2005-01-27 22:00:59 +01:00
|
|
|
return gdbarch->integer_to_address (gdbarch, type, buf);
|
2001-10-15 20:18:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_integer_to_address (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_integer_to_address_ftype integer_to_address)
|
|
|
|
{
|
|
|
|
gdbarch->integer_to_address = integer_to_address;
|
|
|
|
}
|
|
|
|
|
2003-10-20 17:38:02 +02:00
|
|
|
int
|
|
|
|
gdbarch_return_value_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2007-10-13 02:06:54 +02:00
|
|
|
return gdbarch->return_value != NULL;
|
2003-10-20 17:38:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
enum return_value_convention
|
2012-05-16 16:35:09 +02:00
|
|
|
gdbarch_return_value (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
|
2003-10-20 17:38:02 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->return_value != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_return_value called\n");
|
2012-05-16 16:35:09 +02:00
|
|
|
return gdbarch->return_value (gdbarch, function, valtype, regcache, readbuf, writebuf);
|
2003-10-20 17:38:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_return_value (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_return_value_ftype return_value)
|
|
|
|
{
|
|
|
|
gdbarch->return_value = return_value;
|
|
|
|
}
|
|
|
|
|
2012-06-08 16:24:57 +02:00
|
|
|
int
|
|
|
|
gdbarch_return_in_first_hidden_param_p (struct gdbarch *gdbarch, struct type *type)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->return_in_first_hidden_param_p != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_return_in_first_hidden_param_p called\n");
|
|
|
|
return gdbarch->return_in_first_hidden_param_p (gdbarch, type);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_return_in_first_hidden_param_p (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_return_in_first_hidden_param_p_ftype return_in_first_hidden_param_p)
|
|
|
|
{
|
|
|
|
gdbarch->return_in_first_hidden_param_p = return_in_first_hidden_param_p;
|
|
|
|
}
|
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
CORE_ADDR
|
|
|
|
gdbarch_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->skip_prologue != NULL);
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_prologue called\n");
|
2008-01-11 14:20:02 +01:00
|
|
|
return gdbarch->skip_prologue (gdbarch, ip);
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_skip_prologue (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_skip_prologue_ftype skip_prologue)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->skip_prologue = skip_prologue;
|
|
|
|
}
|
|
|
|
|
2008-06-12 00:03:49 +02:00
|
|
|
int
|
|
|
|
gdbarch_skip_main_prologue_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->skip_main_prologue != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
gdbarch_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR ip)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->skip_main_prologue != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_main_prologue called\n");
|
|
|
|
return gdbarch->skip_main_prologue (gdbarch, ip);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_skip_main_prologue (struct gdbarch *gdbarch,
|
2008-07-22 04:10:14 +02:00
|
|
|
gdbarch_skip_main_prologue_ftype skip_main_prologue)
|
2008-06-12 00:03:49 +02:00
|
|
|
{
|
|
|
|
gdbarch->skip_main_prologue = skip_main_prologue;
|
|
|
|
}
|
|
|
|
|
PowerPC64 ELFv2 ABI: skip global entry point code
This patch handles another aspect of the ELFv2 ABI, which unfortunately
requires common code changes.
In ELFv2, functions may provide both a global and a local entry point.
The global entry point (where the function symbol points to) is intended
to be used for function-pointer or cross-module (PLT) calls, and requires
r12 to be set up to the entry point address itself. The local entry
point (which is found at a fixed offset after the global entry point,
as defined by bits in the symbol table entries' st_other field), instead
expects r2 to be set up to the current TOC.
Now, when setting a breakpoint on a function by name, you really want
that breakpoint to trigger either way, no matter whether the function
is called via its local or global entry point. Since the global entry
point will always fall through into the local entry point, the way to
achieve that is to simply set the breakpoint at the local entry point.
One way to do that would be to have prologue parsing skip the code
sequence that makes up the global entry point. Unfortunately, this
does not work reliably, since -for optimized code- GDB these days
will not actuall invoke the prologue parsing code but instead just
set the breakpoint at the symbol address and rely on DWARF being
correct at any point throughout the function ...
Unfortunately, I don't really see any way to express the notion of
local entry points with the current set of gdbarch callbacks.
Thus this patch adds a new callback, skip_entrypoint, that is
somewhat analogous to skip_prologue, but is called every time
GDB needs to determine a function start address, even in those
cases where GDB decides to not call skip_prologue.
As a side effect, the skip_entrypoint implementation on ppc64
does not need to perform any instruction parsing; it can simply
rely on the local entry point flags in the symbol table entry.
With this implemented, two test cases would still fail to set
the breakpoint correctly, but that's because they use the construct:
gdb_test "break *hello"
Now, using "*hello" explicitly instructs GDB to set the breakpoint
at the numerical value of "hello" treated as function pointer, so
it will by definition only hit the global entry point.
I think this behaviour is unavoidable, but acceptable -- most people
do not use this construct, and if they do, they get what they
asked for ...
In one of those two test cases, use of this construct is really
not appropriate. I think this was added way back when as a means
to work around prologue skipping problems on some platforms. These
days that shouldn't really be necessary any more ...
For the other (step-bt), we really want to make sure backtracing
works on the very first instruction of the routine. To enable that
test also on powerpc64le-linux, we can modify the code to call the
test function via function pointer (which makes it use the global
entry point in the ELFv2 ABI).
gdb/ChangeLog:
* gdbarch.sh (skip_entrypoint): New callback.
* gdbarch.c, gdbarch.h: Regenerate.
* symtab.c (skip_prologue_sal): Call gdbarch_skip_entrypoint.
* infrun.c (fill_in_stop_func): Likewise.
* ppc-linux-tdep.c: Include "elf/ppc64.h".
(ppc_elfv2_elf_make_msymbol_special): New function.
(ppc_elfv2_skip_entrypoint): Likewise.
(ppc_linux_init_abi): Install them for ELFv2.
gdb/testsuite/ChangeLog:
* gdb.base/sigbpt.exp: Do not use "*" when setting breakpoint
on a function.
* gdb.base/step-bt.c: Call hello via function pointer to make
sure its first instruction is executed on powerpc64le-linux.
2014-02-04 18:44:14 +01:00
|
|
|
int
|
|
|
|
gdbarch_skip_entrypoint_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->skip_entrypoint != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
gdbarch_skip_entrypoint (struct gdbarch *gdbarch, CORE_ADDR ip)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->skip_entrypoint != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_entrypoint called\n");
|
|
|
|
return gdbarch->skip_entrypoint (gdbarch, ip);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_skip_entrypoint (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_skip_entrypoint_ftype skip_entrypoint)
|
|
|
|
{
|
|
|
|
gdbarch->skip_entrypoint = skip_entrypoint;
|
|
|
|
}
|
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
int
|
|
|
|
gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->inner_than != NULL);
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_inner_than called\n");
|
|
|
|
return gdbarch->inner_than (lhs, rhs);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_inner_than (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_inner_than_ftype inner_than)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->inner_than = inner_than;
|
|
|
|
}
|
|
|
|
|
2005-05-09 Andrew Cagney <cagney@gnu.org>
Use gdb_byte in preference to bfd_byte.
* gdbarch.sh: Update.
* gdbarch.h, gdbarch.c: Re-generate.
* ada-lang.c, ada-lang.h, ada-valprint.c, arch-utils.c: Update.
* c-lang.c, c-lang.h, c-valprint.c, cp-valprint.c: Update.
* f-lang.c, f-lang.h, f-valprint.c, gdbcore.h, jv-lang.h: Update.
* jv-valprint.c, language.c, language.h, m2-lang.c: Update.
* m2-lang.h, m2-valprint.c, objc-lang.c, p-lang.c: Update.
* p-lang.h, p-valprint.c, regcache.c, scm-lang.c: Update.
* scm-lang.h, scm-valprint.c, target.c, target.h: Update.
* tramp-frame.c, valarith.c, valops.c, valprint.c: Update.
* valprint.h, value.c, value.h: Update.
2005-05-09 23:20:35 +02:00
|
|
|
const gdb_byte *
|
1999-07-20 01:30:11 +02:00
|
|
|
gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->breakpoint_from_pc != NULL);
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_breakpoint_from_pc called\n");
|
2007-11-07 07:33:01 +01:00
|
|
|
return gdbarch->breakpoint_from_pc (gdbarch, pcptr, lenptr);
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_breakpoint_from_pc_ftype breakpoint_from_pc)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->breakpoint_from_pc = breakpoint_from_pc;
|
|
|
|
}
|
|
|
|
|
New gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind
This patch adds two gdbarch methods breakpoint_kind_from_pc and
sw_breakpoint_from_kind, and uses target_info.placed_size as "kind"
of the breakpoint. This patch updates the usages of
target_info.placed_size.
The "kind" of a breakpoint is determined by gdbarch rather than
target, so we have gdbarch method breakpoint_kind_from_pc, and we
should set target_info.placed_size out of each implementation of
target to_insert_breakpoint. In this way, each target doesn't have
to set target_info.placed_size any more.
This patch also sets target_info.placed_address before
target_insert_breakpoint too, so that target to_insert_breakpoint
can use it, see record_full_insert_breakpoint.
Before we call target_insert_breakpoint, we set
target_info.placed_address and target_info.placed_size like this,
CORE_ADDR addr = bl->target_info.reqstd_address;
bl->target_info.placed_size = gdbarch_breakpoint_kind_from_pc (bl->gdbarch, &addr);
bl->target_info.placed_address = addr;
return target_insert_breakpoint (bl->gdbarch, &bl->target_info);
target_insert_breakpoint may fail, but it doesn't matter to the "kind"
and "placed_address" of a breakpoint. They should be determined by
gdbarch.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): Define
breakpoint_kind_from_pc and sw_breakpoint_from_kind.
(GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN): Likewise.
(SET_GDBARCH_BREAKPOINT_MANIPULATION): Call
set_gdbarch_breakpoint_kind_from_pc and
set_gdbarch_sw_breakpoint_from_kind.
* arm-tdep.c: Add comments.
* bfin-tdep.c: Likewise.
* breakpoint.c (breakpoint_kind): New function.
(insert_bp_location): Set target_info.placed_size and
target_info.placed_address.
(bkpt_insert_location): Likewise.
* cris-tdep.c: Add comments.
* gdbarch.sh (breakpoint_kind_from_pc): New.
(sw_breakpoint_from_kind): New.
* gdbarch.c, gdbarch.h: Regenerated.
* ia64-tdep.c (ia64_memory_insert_breakpoint): Don't set
bp_tgt->placed_size.
(ia64_memory_remove_breakpoint): Don't assert
bp_tgt->placed_size.
(ia64_breakpoint_kind_from_pc): New function.
(ia64_gdbarch_init): Install ia64_breakpoint_kind_from_pc.
* m32r-tdep.c (m32r_memory_insert_breakpoint): Don't set
bp_tgt->placed_size.
* mem-break.c (default_memory_insert_breakpoint): Don't set
bp_tgt->placed_size. Call gdbarch_sw_breakpoint_from_kind.
(default_memory_remove_breakpoint): Call
gdbarch_sw_breakpoint_from_kind.
(memory_validate_breakpoint): Don't check bp_tgt->placed_size.
* mips-tdep.c: Add comments.
* mt-tdep.c: Likewise.
* nios2-tdep.c: Likewise.
* record-full.c (record_full_insert_breakpoint): Don't call
gdbarch_breakpoint_from_pc. Don't set bp_tgt->placed_address
and bp_tgt->placed_size.
* remote.c (remote_insert_breakpoint): Don't call
gdbarch_remote_breakpoint_from_pc. Use bp_tgt->placed_size.
Don't set bp_tgt->placed_address and bp_tgt->placed_size.
(remote_insert_hw_breakpoint): Likewise.
* score-tdep.c: Likewise.
* sh-tdep.c: Likewise.
* tic6x-tdep.c: Likewise.
* v850-tdep.c: Likewise.
* xtensa-tdep.c: Likewise.
2016-11-03 15:35:13 +01:00
|
|
|
int
|
|
|
|
gdbarch_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->breakpoint_kind_from_pc != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_breakpoint_kind_from_pc called\n");
|
|
|
|
return gdbarch->breakpoint_kind_from_pc (gdbarch, pcptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_breakpoint_kind_from_pc (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_breakpoint_kind_from_pc_ftype breakpoint_kind_from_pc)
|
|
|
|
{
|
|
|
|
gdbarch->breakpoint_kind_from_pc = breakpoint_kind_from_pc;
|
|
|
|
}
|
|
|
|
|
|
|
|
const gdb_byte *
|
|
|
|
gdbarch_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->sw_breakpoint_from_kind != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_sw_breakpoint_from_kind called\n");
|
|
|
|
return gdbarch->sw_breakpoint_from_kind (gdbarch, kind, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_sw_breakpoint_from_kind (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_sw_breakpoint_from_kind_ftype sw_breakpoint_from_kind)
|
|
|
|
{
|
|
|
|
gdbarch->sw_breakpoint_from_kind = sw_breakpoint_from_kind;
|
|
|
|
}
|
|
|
|
|
2016-11-03 15:35:14 +01:00
|
|
|
int
|
|
|
|
gdbarch_breakpoint_kind_from_current_state (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR *pcptr)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->breakpoint_kind_from_current_state != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_breakpoint_kind_from_current_state called\n");
|
|
|
|
return gdbarch->breakpoint_kind_from_current_state (gdbarch, regcache, pcptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_breakpoint_kind_from_current_state (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_breakpoint_kind_from_current_state_ftype breakpoint_kind_from_current_state)
|
|
|
|
{
|
|
|
|
gdbarch->breakpoint_kind_from_current_state = breakpoint_kind_from_current_state;
|
|
|
|
}
|
|
|
|
|
2003-10-14 01:41:40 +02:00
|
|
|
int
|
|
|
|
gdbarch_adjust_breakpoint_address_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->adjust_breakpoint_address != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->adjust_breakpoint_address != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_adjust_breakpoint_address called\n");
|
|
|
|
return gdbarch->adjust_breakpoint_address (gdbarch, bpaddr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_adjust_breakpoint_address_ftype adjust_breakpoint_address)
|
|
|
|
{
|
|
|
|
gdbarch->adjust_breakpoint_address = adjust_breakpoint_address;
|
|
|
|
}
|
|
|
|
|
1999-10-19 04:47:02 +02:00
|
|
|
int
|
gdb/
* breakpoint.c (deprecated_read_memory_nobpt): Update to use
shadow_len.
(insert_bp_location, reattach_breakpoints, remove_breakpoint)
(delete_breakpoint): Update calls to changed methods.
(deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint)
(single_step_breakpoints, insert_single_step_breakpoint)
(remove_single_step_breakpoints): New.
* breakpoint.h (struct bp_target_info): New.
(struct bp_location): Replace shadow_contents with
target_info and overlay_target_info.
(deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint)
(insert_single_step_breakpoint, remove_single_step_breakpoints): New
prototypes.
* gdbarch.sh: Forward declare struct bp_target_info in gdbarch.h.
(memory_insert_breakpoint, memory_remove_breakpoint): Update second
argument.
* mem-break.c (default_memory_insert_breakpoint): Update. Set
placed_address, placed_size, and shadow_len.
(default_memory_remove_breakpoint): Update. Don't use
BREAKPOINT_FROM_PC.
(memory_insert_breakpoint, memory_remove_breakpoint): Update.
* target.c (update_current_target): Update prototypes for changed
functions.
(debug_to_insert_breakpoint, debug_to_remove_breakpoint)
(debug_to_insert_hw_breakpoint, debug_to_remove_hw_breakpoint):
Update.
* target.h: Forward declare struct bp_target_info.
(struct target_ops): Use a bp_target_info argument for
to_insert_breakpoint, to_remove_breakpoint,
to_insert_hw_breakpoint, and to_remove_hw_breakpoint.
(target_insert_breakpoint, target_remove_breakpoint)
(target_insert_hw_breakpoint, target_remove_hw_breakpoint)
(memory_insert_breakpoint, memory_remove_breakpoint)
(default_memory_insert_breakpoint, default_memory_remove_breakpoint):
Update.
* config/i386/nm-i386.h: Forward declare struct bp_target_info.
(i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): Update.
(target_insert_hw_breakpoint, target_remove_hw_breakpoint): Likewise.
* gdbarch.c, gdbarch.h: Regenerated.
* alpha-tdep.c (alpha_software_single_step): Use
insert_single_step_breakpoint and remove_single_step_breakpoints.
Remove unused statics.
* arm-tdep.c (arm_software_single_step): Likewise. Add a note.
* cris-tdep.c (cris_software_single_step): Likewise.
* mips-tdep.c (mips_software_single_step): Likewise.
* rs6000-tdep.c (rs6000_software_single_step): Likewise.
* sparc-tdep.c (sparc_software_single_step): Likewise.
* wince.c (struct thread_info_struct): Remove step_prev.
(undoSStep): Use remove_single_step_breakpoints.
(wince_software_single_step): Use insert_single_step_breakpoint.
* corelow.c (ignore): Remove unneeded prototype. Update arguments.
* exec.c (ignore): Likewise.
* sol-thread.c (ignore): Likewise.
* procfs.c (dbx_link_shadow_contents): Delete.
(dbx_link_bpt): New.
(procfs_mourn_inferior): Remove it if necessary.
(remove_dbx_link_breakpoint): Use it.
(insert_dbx_link_bpt_in_file): Set it.
(procfs_init_inferior): Don't update dbx_link_bpt_addr.
* rs6000-nat.c (exec_one_dummy_insn): Use
deprecated_insert_raw_breakpoint and
deprecated_remove_raw_breakpoint.
* solib-irix.c (shadow_contents, breakpoint_addr): Delete.
(base_breakpoint): New.
(disable_break): Use it.
(enable_break): Set it.
* i386-nat.c (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint):
Update.
* ia64-tdep.c (ia64_memory_insert_breakpoint)
(ia64_memory_remove_breakpoint): Likewise.
* m32r-tdep.c (m32r_memory_insert_breakpoint)
(m32r_memory_remove_breakpoint): Likewise.
* monitor.c (monitor_insert_breakpoint, monitor_remove_breakpoint):
Likewise. Remove unnecessary prototypes. Use placed_address
and placed_size. Removed useless read from memory.
* nto-procfs.c (procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint): Update.
* ocd.c (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise.
* ocd.h (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise.
* ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Likewise.
* ppc-tdep.h (ppc_linux_memory_remove_breakpoint): Likewise.
* remote-e7000.c (e7000_insert_breakpoint)
(e7000_remove_breakpoint): Likewise.
* remote-m32r-sdi.c (m32r_insert_breakpoint)
(m32r_remove_breakpoint): Likewise.
* remote-mips.c (mips_insert_breakpoint)
(mips_remove_breakpoint): Likewise.
* remote-rdp.c (remote_rdp_insert_breakpoint)
(remote_rdp_remove_breakpoint): Likewise.
(rdp_step): Use deprecated_insert_raw_breakpoint and
deprecated_remove_raw_breakpoint.
* remote-sds.c (sds_insert_breakpoint, sds_remove_breakpoint):
Update.
* remote-sim.c (gdbsim_insert_breakpoint, gdbsim_remove_breakpoint):
Delete.
(init_gdbsim_ops): Use memory_insert_breakpoint and
memory_remove_breakpoint.
* remote-st.c (st2000_insert_breakpoint)
(st2000_remove_breakpoint): Update. Remove unused
BREAKPOINT_FROM_PC.
* remote.c (remote_insert_breakpoint, remote_remove_breakpoint):
Update. Use placed_address and placed_size.
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Likewise.
gdb/doc/
* gdbint.texinfo (x86 Watchpoints, Target Conditionals): Update insert
and remove breakpoint prototypes.
(Watchpoints): Move description of target_insert_hw_breakpoint and
target_remove_hw_breakpoint ...
(Breakpoints): ... to here. Document target_insert_breakpoint and
target_remove_breakpoint.
2006-04-18 21:20:08 +02:00
|
|
|
gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
|
1999-10-19 04:47:02 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->memory_insert_breakpoint != NULL);
|
1999-10-19 04:47:02 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_insert_breakpoint called\n");
|
2008-02-20 15:31:40 +01:00
|
|
|
return gdbarch->memory_insert_breakpoint (gdbarch, bp_tgt);
|
1999-10-19 04:47:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_memory_insert_breakpoint_ftype memory_insert_breakpoint)
|
|
|
|
{
|
|
|
|
gdbarch->memory_insert_breakpoint = memory_insert_breakpoint;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
gdb/
* breakpoint.c (deprecated_read_memory_nobpt): Update to use
shadow_len.
(insert_bp_location, reattach_breakpoints, remove_breakpoint)
(delete_breakpoint): Update calls to changed methods.
(deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint)
(single_step_breakpoints, insert_single_step_breakpoint)
(remove_single_step_breakpoints): New.
* breakpoint.h (struct bp_target_info): New.
(struct bp_location): Replace shadow_contents with
target_info and overlay_target_info.
(deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint)
(insert_single_step_breakpoint, remove_single_step_breakpoints): New
prototypes.
* gdbarch.sh: Forward declare struct bp_target_info in gdbarch.h.
(memory_insert_breakpoint, memory_remove_breakpoint): Update second
argument.
* mem-break.c (default_memory_insert_breakpoint): Update. Set
placed_address, placed_size, and shadow_len.
(default_memory_remove_breakpoint): Update. Don't use
BREAKPOINT_FROM_PC.
(memory_insert_breakpoint, memory_remove_breakpoint): Update.
* target.c (update_current_target): Update prototypes for changed
functions.
(debug_to_insert_breakpoint, debug_to_remove_breakpoint)
(debug_to_insert_hw_breakpoint, debug_to_remove_hw_breakpoint):
Update.
* target.h: Forward declare struct bp_target_info.
(struct target_ops): Use a bp_target_info argument for
to_insert_breakpoint, to_remove_breakpoint,
to_insert_hw_breakpoint, and to_remove_hw_breakpoint.
(target_insert_breakpoint, target_remove_breakpoint)
(target_insert_hw_breakpoint, target_remove_hw_breakpoint)
(memory_insert_breakpoint, memory_remove_breakpoint)
(default_memory_insert_breakpoint, default_memory_remove_breakpoint):
Update.
* config/i386/nm-i386.h: Forward declare struct bp_target_info.
(i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): Update.
(target_insert_hw_breakpoint, target_remove_hw_breakpoint): Likewise.
* gdbarch.c, gdbarch.h: Regenerated.
* alpha-tdep.c (alpha_software_single_step): Use
insert_single_step_breakpoint and remove_single_step_breakpoints.
Remove unused statics.
* arm-tdep.c (arm_software_single_step): Likewise. Add a note.
* cris-tdep.c (cris_software_single_step): Likewise.
* mips-tdep.c (mips_software_single_step): Likewise.
* rs6000-tdep.c (rs6000_software_single_step): Likewise.
* sparc-tdep.c (sparc_software_single_step): Likewise.
* wince.c (struct thread_info_struct): Remove step_prev.
(undoSStep): Use remove_single_step_breakpoints.
(wince_software_single_step): Use insert_single_step_breakpoint.
* corelow.c (ignore): Remove unneeded prototype. Update arguments.
* exec.c (ignore): Likewise.
* sol-thread.c (ignore): Likewise.
* procfs.c (dbx_link_shadow_contents): Delete.
(dbx_link_bpt): New.
(procfs_mourn_inferior): Remove it if necessary.
(remove_dbx_link_breakpoint): Use it.
(insert_dbx_link_bpt_in_file): Set it.
(procfs_init_inferior): Don't update dbx_link_bpt_addr.
* rs6000-nat.c (exec_one_dummy_insn): Use
deprecated_insert_raw_breakpoint and
deprecated_remove_raw_breakpoint.
* solib-irix.c (shadow_contents, breakpoint_addr): Delete.
(base_breakpoint): New.
(disable_break): Use it.
(enable_break): Set it.
* i386-nat.c (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint):
Update.
* ia64-tdep.c (ia64_memory_insert_breakpoint)
(ia64_memory_remove_breakpoint): Likewise.
* m32r-tdep.c (m32r_memory_insert_breakpoint)
(m32r_memory_remove_breakpoint): Likewise.
* monitor.c (monitor_insert_breakpoint, monitor_remove_breakpoint):
Likewise. Remove unnecessary prototypes. Use placed_address
and placed_size. Removed useless read from memory.
* nto-procfs.c (procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint): Update.
* ocd.c (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise.
* ocd.h (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise.
* ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Likewise.
* ppc-tdep.h (ppc_linux_memory_remove_breakpoint): Likewise.
* remote-e7000.c (e7000_insert_breakpoint)
(e7000_remove_breakpoint): Likewise.
* remote-m32r-sdi.c (m32r_insert_breakpoint)
(m32r_remove_breakpoint): Likewise.
* remote-mips.c (mips_insert_breakpoint)
(mips_remove_breakpoint): Likewise.
* remote-rdp.c (remote_rdp_insert_breakpoint)
(remote_rdp_remove_breakpoint): Likewise.
(rdp_step): Use deprecated_insert_raw_breakpoint and
deprecated_remove_raw_breakpoint.
* remote-sds.c (sds_insert_breakpoint, sds_remove_breakpoint):
Update.
* remote-sim.c (gdbsim_insert_breakpoint, gdbsim_remove_breakpoint):
Delete.
(init_gdbsim_ops): Use memory_insert_breakpoint and
memory_remove_breakpoint.
* remote-st.c (st2000_insert_breakpoint)
(st2000_remove_breakpoint): Update. Remove unused
BREAKPOINT_FROM_PC.
* remote.c (remote_insert_breakpoint, remote_remove_breakpoint):
Update. Use placed_address and placed_size.
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Likewise.
gdb/doc/
* gdbint.texinfo (x86 Watchpoints, Target Conditionals): Update insert
and remove breakpoint prototypes.
(Watchpoints): Move description of target_insert_hw_breakpoint and
target_remove_hw_breakpoint ...
(Breakpoints): ... to here. Document target_insert_breakpoint and
target_remove_breakpoint.
2006-04-18 21:20:08 +02:00
|
|
|
gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
|
1999-10-19 04:47:02 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->memory_remove_breakpoint != NULL);
|
1999-10-19 04:47:02 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_remove_breakpoint called\n");
|
2008-02-20 15:31:40 +01:00
|
|
|
return gdbarch->memory_remove_breakpoint (gdbarch, bp_tgt);
|
1999-10-19 04:47:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_memory_remove_breakpoint_ftype memory_remove_breakpoint)
|
|
|
|
{
|
|
|
|
gdbarch->memory_remove_breakpoint = memory_remove_breakpoint;
|
|
|
|
}
|
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
CORE_ADDR
|
1999-08-31 03:14:27 +02:00
|
|
|
gdbarch_decr_pc_after_break (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2004-01-17 16:34:13 +01:00
|
|
|
/* Skip verify of decr_pc_after_break, invalid_p == 0 */
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_decr_pc_after_break called\n");
|
|
|
|
return gdbarch->decr_pc_after_break;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch,
|
|
|
|
CORE_ADDR decr_pc_after_break)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->decr_pc_after_break = decr_pc_after_break;
|
|
|
|
}
|
|
|
|
|
|
|
|
CORE_ADDR
|
2004-06-18 23:36:16 +02:00
|
|
|
gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2004-06-18 23:36:16 +02:00
|
|
|
/* Skip verify of deprecated_function_start_offset, invalid_p == 0 */
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
2004-06-18 23:36:16 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_function_start_offset called\n");
|
|
|
|
return gdbarch->deprecated_function_start_offset;
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-06-18 23:36:16 +02:00
|
|
|
set_gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch,
|
|
|
|
CORE_ADDR deprecated_function_start_offset)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2004-06-18 23:36:16 +02:00
|
|
|
gdbarch->deprecated_function_start_offset = deprecated_function_start_offset;
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o)
(xml-tdesc.o): Update.
* xml-support.c: Add a comment.
(gdb_xml_enums_boolean): New variable.
(gdb_xml_parse_attr_enum): Use strcasecmp.
* xml-support.h (gdb_xml_enums_boolean): Declare.
* xml-tdesc.c (struct tdesc_parsing_data): Record current_feature,
next_regnum, and current_union.
(tdesc_start_feature, tdesc_start_reg, tdesc_start_union)
(tdesc_end_union, tdesc_start_field, tdesc_start_vector)
(field_attributes, union_children, reg_attributes, union_attributes)
(vector_attributes, feature_attributes, feature_children): New.
(target_children): Make static. Add <feature>.
(tdesc_elements): Make static.
* target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p)
(struct tdesc_feature, tdesc_feature_p): New types.
(struct target_desc): Add features member.
(struct tdesc_arch_data, tdesc_data): New.
(target_find_description): Clarify error message. Warn about
ignored register descriptions.
(tdesc_has_registers, tdesc_find_feature, tdesc_feature_name)
(tdesc_named_type, tdesc_data_init, tdesc_data_alloc)
(tdesc_data_cleanup, tdesc_numbered_register)
(tdesc_numbered_register_choices, tdesc_find_register)
(tdesc_register_name, tdesc_register_type)
(tdesc_remote_register_number, tdesc_register_reggroup_p)
(set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type)
(set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers)
(tdesc_free_reg, tdesc_create_reg, tdesc_free_feature)
(tdesc_create_feature, tdesc_record_type): New.
(free_target_description): Free features.
(_initialize_target_descriptions): Initialize tdesc_data.
* arch-utils.c (default_remote_register_number): New.
* arch-utils.h (default_remote_register_number): New prototype.
* target-descriptions.h (set_tdesc_pseudo_register_name)
(set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p)
(tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup)
(tdesc_numbered_register, tdesc_numbered_register_choices)
(tdesc_has_registers, tdesc_find_feature, tdesc_feature_name)
(tdesc_named_type, tdesc_create_feature, tdesc_record_type)
(tdesc_create_reg): Declare.
* gdbarch.sh (remote_register_number): New entry.
* gdbarch.c, gdbarch.h: Regenerate.
* remote.c (init_remote_state): Use gdbarch_remote_register_number.
* features/gdb-target.dtd: Add feature, reg, vector, union, and field.
* arm-tdep.c (arm_register_aliases): New.
(arm_register_name_strings): Rename to...
(arm_register_names): ...this. Make const. Delete the old version.
(current_option, arm_register_byte): Delete.
(set_disassembly_style): Simplify. Do not adjust arm_register_names.
(value_of_arm_user_reg): New.
(arm_gdbarch_init): Verify any described registers. Call
tdesc_use_registers. Don't use arm_register_byte. Create aliases
for standard register names.
(_initialize_arm_tdep): Do not adjust arm_register_names.
* user-regs.c (struct user_reg): Add baton member.
(append_user_reg, user_reg_add_builtin, user_regs_init)
(user_reg_add, value_of_user_reg): Use a baton for user
register functions.
* std-regs.c: Update.
* user-regs.h (user_reg_read_ftype, user_reg_add_builtin)
(user_reg_add): Add baton argument.
* NEWS: Mention target description register support.
* features/arm-core.xml, features/arm-fpa.xml: New.
* eval.c (evaluate_subexp_standard): Allow ptype $register
when the program is not running.
* gdb.texinfo (-target-disconnect): Use @smallexample.
(Requirements): Add anchor for Expat. Update description.
(Target Descriptions): Mention Expat.
(Target Description Format): Document new elements. Use
@smallexample.
(Predefined Target Types, Standard Target Features): New sections.
* doc/gdbint.texinfo (Target Descriptions): New section.
* gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp,
gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
|
|
|
int
|
|
|
|
gdbarch_remote_register_number (struct gdbarch *gdbarch, int regno)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->remote_register_number != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_remote_register_number called\n");
|
|
|
|
return gdbarch->remote_register_number (gdbarch, regno);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_remote_register_number (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_remote_register_number_ftype remote_register_number)
|
|
|
|
{
|
|
|
|
gdbarch->remote_register_number = remote_register_number;
|
|
|
|
}
|
|
|
|
|
2005-03-31 21:58:26 +02:00
|
|
|
int
|
|
|
|
gdbarch_fetch_tls_load_module_address_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->fetch_tls_load_module_address != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch, struct objfile *objfile)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->fetch_tls_load_module_address != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_fetch_tls_load_module_address called\n");
|
|
|
|
return gdbarch->fetch_tls_load_module_address (objfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_fetch_tls_load_module_address_ftype fetch_tls_load_module_address)
|
|
|
|
{
|
|
|
|
gdbarch->fetch_tls_load_module_address = fetch_tls_load_module_address;
|
|
|
|
}
|
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
CORE_ADDR
|
1999-08-31 03:14:27 +02:00
|
|
|
gdbarch_frame_args_skip (struct gdbarch *gdbarch)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2004-02-11 16:40:28 +01:00
|
|
|
/* Skip verify of frame_args_skip, invalid_p == 0 */
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_args_skip called\n");
|
|
|
|
return gdbarch->frame_args_skip;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_frame_args_skip (struct gdbarch *gdbarch,
|
|
|
|
CORE_ADDR frame_args_skip)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->frame_args_skip = frame_args_skip;
|
|
|
|
}
|
|
|
|
|
2003-03-10 16:28:41 +01:00
|
|
|
int
|
|
|
|
gdbarch_unwind_pc_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
return gdbarch->unwind_pc != NULL;
|
2003-03-10 16:28:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->unwind_pc != NULL);
|
2003-03-10 16:28:41 +01:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_pc called\n");
|
|
|
|
return gdbarch->unwind_pc (gdbarch, next_frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_unwind_pc (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_unwind_pc_ftype unwind_pc)
|
|
|
|
{
|
|
|
|
gdbarch->unwind_pc = unwind_pc;
|
|
|
|
}
|
|
|
|
|
2003-06-09 03:02:07 +02:00
|
|
|
int
|
|
|
|
gdbarch_unwind_sp_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
return gdbarch->unwind_sp != NULL;
|
2003-06-09 03:02:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
gdbarch_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->unwind_sp != NULL);
|
2003-06-09 03:02:07 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_sp called\n");
|
|
|
|
return gdbarch->unwind_sp (gdbarch, next_frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_unwind_sp (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_unwind_sp_ftype unwind_sp)
|
|
|
|
{
|
|
|
|
gdbarch->unwind_sp = unwind_sp;
|
|
|
|
}
|
|
|
|
|
2003-06-09 19:35:59 +02:00
|
|
|
int
|
|
|
|
gdbarch_frame_num_args_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
return gdbarch->frame_num_args != NULL;
|
2003-06-09 19:35:59 +02:00
|
|
|
}
|
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
int
|
|
|
|
gdbarch_frame_num_args (struct gdbarch *gdbarch, struct frame_info *frame)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->frame_num_args != NULL);
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_num_args called\n");
|
|
|
|
return gdbarch->frame_num_args (frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-08-31 03:14:27 +02:00
|
|
|
set_gdbarch_frame_num_args (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_frame_num_args_ftype frame_num_args)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
gdbarch->frame_num_args = frame_num_args;
|
|
|
|
}
|
|
|
|
|
2002-09-18 17:37:18 +02:00
|
|
|
int
|
|
|
|
gdbarch_frame_align_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
return gdbarch->frame_align != NULL;
|
2002-09-18 17:37:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
gdbarch_frame_align (struct gdbarch *gdbarch, CORE_ADDR address)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->frame_align != NULL);
|
2002-09-18 17:37:18 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_align called\n");
|
|
|
|
return gdbarch->frame_align (gdbarch, address);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_frame_align (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_frame_align_ftype frame_align)
|
|
|
|
{
|
|
|
|
gdbarch->frame_align = frame_align;
|
|
|
|
}
|
|
|
|
|
2003-09-17 21:48:42 +02:00
|
|
|
int
|
|
|
|
gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->stabs_argument_has_addr != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_stabs_argument_has_addr called\n");
|
|
|
|
return gdbarch->stabs_argument_has_addr (gdbarch, type);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_stabs_argument_has_addr_ftype stabs_argument_has_addr)
|
|
|
|
{
|
|
|
|
gdbarch->stabs_argument_has_addr = stabs_argument_has_addr;
|
|
|
|
}
|
|
|
|
|
2003-08-18 22:04:56 +02:00
|
|
|
int
|
|
|
|
gdbarch_frame_red_zone_size (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_red_zone_size called\n");
|
|
|
|
return gdbarch->frame_red_zone_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_frame_red_zone_size (struct gdbarch *gdbarch,
|
|
|
|
int frame_red_zone_size)
|
|
|
|
{
|
|
|
|
gdbarch->frame_red_zone_size = frame_red_zone_size;
|
|
|
|
}
|
|
|
|
|
2000-10-26 09:41:25 +02:00
|
|
|
CORE_ADDR
|
2003-10-23 01:54:11 +02:00
|
|
|
gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ)
|
2000-10-26 09:41:25 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->convert_from_func_ptr_addr != NULL);
|
2000-10-26 09:41:25 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_convert_from_func_ptr_addr called\n");
|
2003-10-23 01:54:11 +02:00
|
|
|
return gdbarch->convert_from_func_ptr_addr (gdbarch, addr, targ);
|
2000-10-26 09:41:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_convert_from_func_ptr_addr_ftype convert_from_func_ptr_addr)
|
|
|
|
{
|
|
|
|
gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr;
|
|
|
|
}
|
|
|
|
|
2001-06-16 00:10:21 +02:00
|
|
|
CORE_ADDR
|
|
|
|
gdbarch_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->addr_bits_remove != NULL);
|
2001-06-16 00:10:21 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_addr_bits_remove called\n");
|
2008-09-05 13:42:32 +02:00
|
|
|
return gdbarch->addr_bits_remove (gdbarch, addr);
|
2001-06-16 00:10:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_addr_bits_remove_ftype addr_bits_remove)
|
|
|
|
{
|
|
|
|
gdbarch->addr_bits_remove = addr_bits_remove;
|
|
|
|
}
|
|
|
|
|
2001-03-24 03:07:49 +01:00
|
|
|
int
|
|
|
|
gdbarch_software_single_step_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
return gdbarch->software_single_step != NULL;
|
2001-03-24 03:07:49 +01:00
|
|
|
}
|
|
|
|
|
2016-11-08 15:28:32 +01:00
|
|
|
VEC (CORE_ADDR) *
|
2016-11-22 15:05:06 +01:00
|
|
|
gdbarch_software_single_step (struct gdbarch *gdbarch, struct regcache *regcache)
|
2001-03-24 03:07:49 +01:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->software_single_step != NULL);
|
2001-03-24 03:07:49 +01:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_software_single_step called\n");
|
2016-11-22 15:05:06 +01:00
|
|
|
return gdbarch->software_single_step (regcache);
|
2001-03-24 03:07:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_software_single_step (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_software_single_step_ftype software_single_step)
|
|
|
|
{
|
|
|
|
gdbarch->software_single_step = software_single_step;
|
|
|
|
}
|
|
|
|
|
2004-10-31 18:38:16 +01:00
|
|
|
int
|
|
|
|
gdbarch_single_step_through_delay_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->single_step_through_delay != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_single_step_through_delay (struct gdbarch *gdbarch, struct frame_info *frame)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->single_step_through_delay != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_single_step_through_delay called\n");
|
|
|
|
return gdbarch->single_step_through_delay (gdbarch, frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_single_step_through_delay (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_single_step_through_delay_ftype single_step_through_delay)
|
|
|
|
{
|
|
|
|
gdbarch->single_step_through_delay = single_step_through_delay;
|
|
|
|
}
|
|
|
|
|
2001-09-06 01:44:44 +02:00
|
|
|
int
|
2003-09-04 Andrew Cagney <cagney@redhat.com>
* avr-tdep.c: Include "dis-asm.h".
* cris-tdep.c: Include "dis-asm.h".
(cris_delayed_get_disassembler): Use "struct disassemble_info"
instead of corresponding typedef.
* h8300-tdep.c: Include "dis-asm.h".
* ia64-tdep.c: Include "dis-asm.h".
* i386-tdep.c: Include "dis-asm.h".
(i386_print_insn): Use "struct disassemble_info" instead of
corresponding typedef.
* m68k-tdep.c: Include "dis-asm.h".
* mcore-tdep.c: Include "dis-asm.h".
* mips-tdep.c: Include "dis-asm.h".
(gdb_print_insn_mips): Make static, use "struct disassemble_info"
instead of corresponding typedef.
* ns32k-tdep.c: Include "dis-asm.h".
* s390-tdep.c: Include "dis-asm.h".
* sparc-tdep.c: Include "dis-asm.h".
* vax-tdep.c: Include "dis-asm.h".
* v850-tdep.c: Include "dis-asm.h".
* mn10300-tdep.c: Include "dis-asm.h".
* rs6000-tdep.c: Include "dis-asm.h".
* xstormy16-tdep.c: Include "dis-asm.h".
(_initialize_xstormy16_tdep): Delete "extern" declaration of
print_insn_xstormy16.
* Makefile.in (v850-tdep.o): Update dependencies.
(vax-tdep.o, sparc-tdep.o, s390-tdep.o): Ditto.
(ns32k-tdep.o, mips-tdep.o, mcore-tdep.o): Ditto.
(m68k-tdep.o, ia64-tdep.o, i386-tdep.o): Ditto.
(h8300-tdep.o, cris-tdep.o, avr-tdep.o): Ditto.
(mn10300-tdep.o, xstormy16-tdep.o, disasm.o): Ditto.
(gdbarch_h): Remove $(dis_asm_h).
* disasm.c: Include "dis-asm.h".
(dis_asm_read_memory): Use "struct disassemble_info" instead of
corresponding typedef.
(dis_asm_memory_error, dump_insns, do_assembly_only): Ditto.
(gdb_disassemble_info, gdb_disassembly, gdb_print_insn): Ditto.
* gdbarch.sh: Do not include "dis-asm.h".
(struct disassemble_info): Declare opaque.
(TARGET_PRINT_INSN): Update declaration.
* gdbarch.h, gdbarch.c: Re-generate.
2003-09-09 06:41:32 +02:00
|
|
|
gdbarch_print_insn (struct gdbarch *gdbarch, bfd_vma vma, struct disassemble_info *info)
|
2001-09-06 01:44:44 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->print_insn != NULL);
|
2001-09-06 01:44:44 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_print_insn called\n");
|
|
|
|
return gdbarch->print_insn (vma, info);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_print_insn (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_print_insn_ftype print_insn)
|
|
|
|
{
|
|
|
|
gdbarch->print_insn = print_insn;
|
|
|
|
}
|
|
|
|
|
2001-08-15 17:29:56 +02:00
|
|
|
CORE_ADDR
|
2007-06-16 00:39:52 +02:00
|
|
|
gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, struct frame_info *frame, CORE_ADDR pc)
|
2001-08-15 17:29:56 +02:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->skip_trampoline_code != NULL);
|
2001-08-15 17:29:56 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_trampoline_code called\n");
|
2007-06-16 00:39:52 +02:00
|
|
|
return gdbarch->skip_trampoline_code (frame, pc);
|
2001-08-15 17:29:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_skip_trampoline_code_ftype skip_trampoline_code)
|
|
|
|
{
|
|
|
|
gdbarch->skip_trampoline_code = skip_trampoline_code;
|
|
|
|
}
|
|
|
|
|
2003-11-09 13:07:16 +01:00
|
|
|
CORE_ADDR
|
|
|
|
gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->skip_solib_resolver != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_solib_resolver called\n");
|
2003-11-14 22:22:42 +01:00
|
|
|
return gdbarch->skip_solib_resolver (gdbarch, pc);
|
2003-11-09 13:07:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_skip_solib_resolver (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_skip_solib_resolver_ftype skip_solib_resolver)
|
|
|
|
{
|
|
|
|
gdbarch->skip_solib_resolver = skip_solib_resolver;
|
|
|
|
}
|
|
|
|
|
2002-08-21 01:01:29 +02:00
|
|
|
int
|
2012-02-02 21:19:17 +01:00
|
|
|
gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name)
|
2002-08-21 01:01:29 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->in_solib_return_trampoline != NULL);
|
2002-08-21 01:01:29 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_in_solib_return_trampoline called\n");
|
* defs.h (extract_signed_integer, extract_unsigned_integer,
extract_long_unsigned_integer, store_signed_integer,
store_unsigned_integer): Add BYTE_ORDER parameter.
* findvar.c (extract_signed_integer, extract_unsigned_integer,
extract_long_unsigned_integer, store_signed_integer,
store_unsigned_integer): Add BYTE_ORDER parameter. Use it
instead of current_gdbarch.
* gdbcore.h (read_memory_integer, safe_read_memory_integer,
read_memory_unsigned_integer, write_memory_signed_integer,
write_memory_unsigned_integer): Add BYTE_ORDER parameter.
* corefile.c (struct captured_read_memory_integer_arguments): Add
BYTE_ORDER member.
(safe_read_memory_integer): Add BYTE_ORDER parameter. Store it into
struct captured_read_memory_integer_arguments.
(do_captured_read_memory_integer): Pass it to read_memory_integer.
(read_memory_integer): Add BYTE_ORDER parameter. Pass it to
extract_signed_integer.
(read_memory_unsigned_integer): Add BYTE_ORDER parameter. Pass it to
extract_unsigned_integer.
(write_memory_signed_integer): Add BYTE_ORDER parameter. Pass it
to store_signed_integer.
(write_memory_unsigned_integer): Add BYTE_ORDER parameter. Pass it
to store_unsigned_integer.
* target.h (get_target_memory_unsigned): Add BYTE_ORDER parameter.
* target.c (get_target_memory_unsigned): Add BYTE_ORDER parameter.
Pass it to extract_unsigned_integer.
Update calls to extract_signed_integer, extract_unsigned_integer,
extract_long_unsigned_integer, store_signed_integer,
store_unsigned_integer, read_memory_integer,
read_memory_unsigned_integer, safe_read_memory_integer,
write_memory_signed_integer, write_memory_unsigned_integer, and
get_target_memory_unsigned to pass byte order:
* ada-lang.c (ada_value_binop): Update.
* ada-valprint.c (char_at): Update.
* alpha-osf1-tdep.c (alpha_osf1_sigcontext_addr): Update.
* alpha-tdep.c (alpha_lds, alpha_sts, alpha_push_dummy_call,
alpha_extract_return_value, alpha_read_insn,
alpha_get_longjmp_target): Update.
* amd64-linux-tdep.c (amd64_linux_sigcontext_addr): Update.
* amd64obsd-tdep.c (amd64obsd_supply_uthread,
amd64obsd_collect_uthread, amd64obsd_trapframe_cache): Update.
* amd64-tdep.c (amd64_push_dummy_call, amd64_analyze_prologue,
amd64_frame_cache, amd64_sigtramp_frame_cache, fixup_riprel,
amd64_displaced_step_fixup): Update.
* arm-linux-tdep.c (arm_linux_sigreturn_init,
arm_linux_rt_sigreturn_init, arm_linux_supply_gregset): Update.
* arm-tdep.c (thumb_analyze_prologue, arm_skip_prologue,
arm_scan_prologue, arm_push_dummy_call, thumb_get_next_pc,
arm_get_next_pc, arm_extract_return_value, arm_store_return_value,
arm_return_value): Update.
* arm-wince-tdep.c (arm_pe_skip_trampoline_code): Update.
* auxv.c (default_auxv_parse): Update.
* avr-tdep.c (avr_address_to_pointer, avr_pointer_to_address,
avr_scan_prologue, avr_extract_return_value,
avr_frame_prev_register, avr_push_dummy_call): Update.
* bsd-uthread.c (bsd_uthread_check_magic, bsd_uthread_lookup_offset,
bsd_uthread_wait, bsd_uthread_thread_alive,
bsd_uthread_extra_thread_info): Update.
* c-lang.c (c_printstr, print_wchar): Update.
* cp-valprint.c (cp_print_class_member): Update.
* cris-tdep.c (cris_sigcontext_addr, cris_sigtramp_frame_unwind_cache,
cris_push_dummy_call, cris_scan_prologue, cris_store_return_value,
cris_extract_return_value, find_step_target, dip_prefix,
sixteen_bit_offset_branch_op, none_reg_mode_jump_op,
move_mem_to_reg_movem_op, get_data_from_address): Update.
* dwarf2expr.c (dwarf2_read_address, execute_stack_op): Update.
* dwarf2-frame.c (execute_cfa_program): Update.
* dwarf2loc.c (find_location_expression): Update.
* dwarf2read.c (dwarf2_const_value): Update.
* expprint.c (print_subexp_standard): Update.
* findvar.c (unsigned_pointer_to_address, signed_pointer_to_address,
unsigned_address_to_pointer, address_to_signed_pointer,
read_var_value): Update.
* frame.c (frame_unwind_register_signed,
frame_unwind_register_unsigned, get_frame_memory_signed,
get_frame_memory_unsigned): Update.
* frame-unwind.c (frame_unwind_got_constant): Update.
* frv-linux-tdep.c (frv_linux_pc_in_sigtramp,
frv_linux_sigcontext_reg_addr, frv_linux_sigtramp_frame_cache):
Update.
* frv-tdep.c (frv_analyze_prologue, frv_skip_main_prologue,
frv_extract_return_value, find_func_descr,
frv_convert_from_func_ptr_addr, frv_push_dummy_call): Update.
* f-valprint.c (f_val_print): Update.
* gnu-v3-abi.c (gnuv3_decode_method_ptr, gnuv3_make_method_ptr):
Update.
* h8300-tdep.c (h8300_is_argument_spill, h8300_analyze_prologue,
h8300_push_dummy_call, h8300_extract_return_value,
h8300h_extract_return_value, h8300_store_return_value,
h8300h_store_return_value): Update.
* hppabsd-tdep.c (hppabsd_find_global_pointer): Update.
* hppa-hpux-nat.c (hppa_hpux_fetch_register, hppa_hpux_store_register):
Update.
* hppa-hpux-tdep.c (hppa32_hpux_in_solib_call_trampoline,
hppa64_hpux_in_solib_call_trampoline,
hppa_hpux_in_solib_return_trampoline, hppa_hpux_skip_trampoline_code,
hppa_hpux_sigtramp_frame_unwind_cache,
hppa_hpux_sigtramp_unwind_sniffer, hppa32_hpux_find_global_pointer,
hppa64_hpux_find_global_pointer, hppa_hpux_search_pattern,
hppa32_hpux_search_dummy_call_sequence,
hppa64_hpux_search_dummy_call_sequence, hppa_hpux_supply_save_state,
hppa_hpux_unwind_adjust_stub): Update.
* hppa-linux-tdep.c (insns_match_pattern,
hppa_linux_find_global_pointer): Update.
* hppa-tdep.c (hppa_in_function_epilogue_p, hppa32_push_dummy_call,
hppa64_convert_code_addr_to_fptr, hppa64_push_dummy_call,
skip_prologue_hard_way, hppa_frame_cache, hppa_fallback_frame_cache,
hppa_pseudo_register_read, hppa_frame_prev_register_helper,
hppa_match_insns): Update.
* hpux-thread.c (hpux_thread_fetch_registers): Update.
* i386-tdep.c (i386bsd_sigcontext_addr): Update.
* i386-cygwin-tdep.c (core_process_module_section): Update.
* i386-darwin-nat.c (i386_darwin_sstep_at_sigreturn,
amd64_darwin_sstep_at_sigreturn): Update.
* i386-darwin-tdep.c (i386_darwin_sigcontext_addr,
amd64_darwin_sigcontext_addr): Likewise.
* i386-linux-nat.c (i386_linux_sigcontext_addr): Update.
* i386nbsd-tdep.c (i386nbsd_sigtramp_cache_init): Update.
* i386-nto-tdep.c (i386nto_sigcontext_addr): Update.
* i386obsd-nat.c (i386obsd_supply_pcb): Update.
* i386obsd-tdep.c (i386obsd_supply_uthread, i386obsd_collect_uthread,
i386obsd_trapframe_cache): Update.
* i386-tdep.c (i386_displaced_step_fixup, i386_follow_jump,
i386_analyze_frame_setup, i386_analyze_prologue,
i386_skip_main_prologue, i386_frame_cache, i386_sigtramp_frame_cache,
i386_get_longjmp_target, i386_push_dummy_call,
i386_pe_skip_trampoline_code, i386_svr4_sigcontext_addr,
i386_fetch_pointer_argument): Update.
* i387-tdep.c (i387_supply_fsave): Update.
* ia64-linux-tdep.c (ia64_linux_sigcontext_register_address): Update.
* ia64-tdep.c (ia64_pseudo_register_read, ia64_pseudo_register_write,
examine_prologue, ia64_frame_cache, ia64_frame_prev_register,
ia64_sigtramp_frame_cache, ia64_sigtramp_frame_prev_register,
ia64_access_reg, ia64_access_rse_reg, ia64_libunwind_frame_this_id,
ia64_libunwind_frame_prev_register,
ia64_libunwind_sigtramp_frame_this_id,
ia64_libunwind_sigtramp_frame_prev_register, ia64_find_global_pointer,
find_extant_func_descr, find_func_descr,
ia64_convert_from_func_ptr_addr, ia64_push_dummy_call, ia64_dummy_id,
ia64_unwind_pc): Update.
* iq2000-tdep.c (iq2000_pointer_to_address, iq2000_address_to_pointer,
iq2000_scan_prologue, iq2000_extract_return_value,
iq2000_push_dummy_call): Update.
* irix5nat.c (fill_gregset): Update.
* jv-lang.c (evaluate_subexp_java): Update.
* jv-valprint.c (java_value_print): Update.
* lm32-tdep.c (lm32_analyze_prologue, lm32_push_dummy_call,
lm32_extract_return_value, lm32_store_return_value): Update.
* m32c-tdep.c (m32c_push_dummy_call, m32c_return_value,
m32c_skip_trampoline_code, m32c_m16c_address_to_pointer,
m32c_m16c_pointer_to_address): Update.
* m32r-tdep.c (m32r_store_return_value, decode_prologue,
m32r_skip_prologue, m32r_push_dummy_call, m32r_extract_return_value):
Update.
* m68hc11-tdep.c (m68hc11_pseudo_register_read,
m68hc11_pseudo_register_write, m68hc11_analyze_instruction,
m68hc11_push_dummy_call): Update.
* m68linux-tdep.c (m68k_linux_pc_in_sigtramp,
m68k_linux_get_sigtramp_info, m68k_linux_sigtramp_frame_cache):
Update.
* m68k-tdep.c (m68k_push_dummy_call, m68k_analyze_frame_setup,
m68k_analyze_register_saves, m68k_analyze_prologue, m68k_frame_cache,
m68k_get_longjmp_target): Update.
* m88k-tdep.c (m88k_fetch_instruction): Update.
* mep-tdep.c (mep_pseudo_cr32_read, mep_pseudo_csr_write,
mep_pseudo_cr32_write, mep_get_insn, mep_push_dummy_call): Update.
* mi/mi-main.c (mi_cmd_data_write_memory): Update.
* mips-linux-tdep.c (mips_linux_get_longjmp_target, supply_32bit_reg,
mips64_linux_get_longjmp_target, mips64_fill_gregset,
mips64_fill_fpregset, mips_linux_in_dynsym_stub): Update.
* mipsnbdsd-tdep.c (mipsnbsd_get_longjmp_target): Update.
* mips-tdep.c (mips_fetch_instruction, fetch_mips_16,
mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call,
mips_o32_push_dummy_call, mips_o64_push_dummy_call,
mips_single_step_through_delay, mips_skip_pic_trampoline_code,
mips_integer_to_address): Update.
* mn10300-tdep.c (mn10300_analyze_prologue, mn10300_push_dummy_call):
Update.
* monitor.c (monitor_supply_register, monitor_write_memory,
monitor_read_memory_single): Update.
* moxie-tdep.c (moxie_store_return_value, moxie_extract_return_value,
moxie_analyze_prologue): Update.
* mt-tdep.c (mt_return_value, mt_skip_prologue, mt_select_coprocessor,
mt_pseudo_register_read, mt_pseudo_register_write, mt_registers_info,
mt_push_dummy_call): Update.
* objc-lang.c (read_objc_method, read_objc_methlist_nmethods,
read_objc_methlist_method, read_objc_object, read_objc_super,
read_objc_class, find_implementation_from_class): Update.
* ppc64-linux-tdep.c (ppc64_desc_entry_point,
ppc64_linux_convert_from_func_ptr_addr, ppc_linux_sigtramp_cache):
Update.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_sniffer,
ppcobsd_sigtramp_frame_cache): 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.
* ppc-linux-nat.c (ppc_linux_auxv_parse): Update.
* procfs.c (procfs_auxv_parse): Update.
* p-valprint.c (pascal_val_print): Update.
* regcache.c (regcache_raw_read_signed, regcache_raw_read_unsigned,
regcache_raw_write_signed, regcache_raw_write_unsigned,
regcache_cooked_read_signed, regcache_cooked_read_unsigned,
regcache_cooked_write_signed, regcache_cooked_write_unsigned): Update.
* remote-m32r-sdi.c (m32r_fetch_register): Update.
* remote-mips.c (mips_wait, mips_fetch_registers, mips_xfer_memory):
Update.
* rs6000-aix-tdep.c (rs6000_push_dummy_call, rs6000_return_value,
rs6000_convert_from_func_ptr_addr, branch_dest,
rs6000_software_single_step): Update.
* rs6000-tdep.c (rs6000_in_function_epilogue_p,
ppc_displaced_step_fixup, ppc_deal_with_atomic_sequence,
bl_to_blrl_insn_p, rs6000_fetch_instruction, skip_prologue,
rs6000_skip_main_prologue, rs6000_skip_trampoline_code,
rs6000_frame_cache): Update.
* s390-tdep.c (s390_pseudo_register_read, s390_pseudo_register_write,
s390x_pseudo_register_read, s390x_pseudo_register_write, s390_load,
s390_backchain_frame_unwind_cache, s390_sigtramp_frame_unwind_cache,
extend_simple_arg, s390_push_dummy_call, s390_return_value): Update.
* scm-exp.c (scm_lreadr): Update.
* scm-lang.c (scm_get_field, scm_unpack): Update.
* scm-valprint.c (scm_val_print): Update.
* score-tdep.c (score_breakpoint_from_pc, score_push_dummy_call,
score_fetch_inst): Update.
* sh64-tdep.c (look_for_args_moves, sh64_skip_prologue_hard_way,
sh64_analyze_prologue, sh64_push_dummy_call, sh64_extract_return_value,
sh64_pseudo_register_read, sh64_pseudo_register_write,
sh64_frame_prev_register): Update:
* sh-tdep.c (sh_analyze_prologue, sh_push_dummy_call_fpu,
sh_push_dummy_call_nofpu, sh_extract_return_value_nofpu,
sh_store_return_value_nofpu, sh_in_function_epilogue_p): Update.
* solib-darwin.c (darwin_load_image_infos): Update.
* solib-frv.c (fetch_loadmap, lm_base, frv_current_sos, enable_break2,
find_canonical_descriptor_in_load_object): Update.
* solib-irix.c (extract_mips_address, fetch_lm_info, irix_current_sos,
irix_open_symbol_file_object): Update.
* solib-som.c (som_solib_create_inferior_hook, link_map_start,
som_current_sos, som_open_symbol_file_object): Update.
* solib-sunos.c (SOLIB_EXTRACT_ADDRESS, LM_ADDR, LM_NEXT, LM_NAME):
Update.
* solib-svr4.c (read_program_header, scan_dyntag_auxv,
solib_svr4_r_ldsomap): Update.
* sparc64-linux-tdep.c (sparc64_linux_step_trap): Update.
* sparc64obsd-tdep.c (sparc64obsd_supply_uthread,
sparc64obsd_collect_uthread): Update.
* sparc64-tdep.c (sparc64_pseudo_register_read,
sparc64_pseudo_register_write, sparc64_supply_gregset,
sparc64_collect_gregset): Update.
* sparc-linux-tdep.c (sparc32_linux_step_trap): Update.
* sparcobsd-tdep.c (sparc32obsd_supply_uthread,
sparc32obsd_collect_uthread): Update.
* sparc-tdep.c (sparc_fetch_wcookie, sparc32_push_dummy_code,
sparc32_store_arguments, sparc32_return_value, sparc_supply_rwindow,
sparc_collect_rwindow): Update.
* spu-linux-nat.c (parse_spufs_run): Update.
* spu-tdep.c (spu_pseudo_register_read_spu,
spu_pseudo_register_write_spu, spu_pointer_to_address,
spu_analyze_prologue, spu_in_function_epilogue_p,
spu_frame_unwind_cache, spu_push_dummy_call, spu_software_single_step,
spu_get_longjmp_target, spu_get_overlay_table, spu_overlay_update_osect,
info_spu_signal_command, info_spu_mailbox_list, info_spu_dma_cmdlist,
info_spu_dma_command, info_spu_proxydma_command): Update.
* stack.c (print_frame_nameless_args, frame_info): Update.
* symfile.c (read_target_long_array, simple_read_overlay_table,
simple_read_overlay_region_table): Update.
* target.c (debug_print_register): Update.
* tramp-frame.c (tramp_frame_start): Update.
* v850-tdep.c (v850_analyze_prologue, v850_push_dummy_call,
v850_extract_return_value, v850_store_return_value,
* valarith.c (value_binop, value_bit_index): Update.
* valops.c (value_cast): Update.
* valprint.c (val_print_type_code_int, val_print_string,
read_string): Update.
* value.c (unpack_long, unpack_double, unpack_field_as_long,
modify_field, pack_long): Update.
* vax-tdep.c (vax_store_arguments, vax_push_dummy_call,
vax_skip_prologue): Update.
* xstormy16-tdep.c (xstormy16_push_dummy_call,
xstormy16_analyze_prologue, xstormy16_in_function_epilogue_p,
xstormy16_resolve_jmp_table_entry, xstormy16_find_jmp_table_entry,
xstormy16_pointer_to_address, xstormy16_address_to_pointer): Update.
* xtensa-tdep.c (extract_call_winsize, xtensa_pseudo_register_read,
xtensa_pseudo_register_write, xtensa_frame_cache,
xtensa_push_dummy_call, call0_track_op, call0_frame_cache): Update.
* dfp.h (decimal_to_string, decimal_from_string, decimal_from_integral,
decimal_from_floating, decimal_to_doublest, decimal_is_zero): Add
BYTE_ORDER parameter.
(decimal_binop): Add BYTE_ORDER_X, BYTE_ORDER_Y, and BYTE_ORDER_RESULT
parameters.
(decimal_compare): Add BYTE_ORDER_X and BYTE_ORDER_Y parameters.
(decimal_convert): Add BYTE_ORDER_FROM and BYTE_ORDER_TO parameters.
* dfp.c (match_endianness): Add BYTE_ORDER parameter. Use it
instead of current_gdbarch.
(decimal_to_string, decimal_from_integral, decimal_from_floating,
decimal_to_doublest, decimal_is_zero): Add BYTE_ORDER parameter.
Pass it to match_endianness.
(decimal_binop): Add BYTE_ORDER_X, BYTE_ORDER_Y, and BYTE_ORDER_RESULT
parameters. Pass them to match_endianness.
(decimal_compare): Add BYTE_ORDER_X and BYTE_ORDER_Y parameters.
Pass them to match_endianness.
(decimal_convert): Add BYTE_ORDER_FROM and BYTE_ORDER_TO parameters.
Pass them to match_endianness.
* valarith.c (value_args_as_decimal): Add BYTE_ORDER_X and
BYTE_ORDER_Y output parameters.
(value_binop): Update call to value_args_as_decimal.
Update calls to decimal_to_string, decimal_from_string,
decimal_from_integral, decimal_from_floating, decimal_to_doublest,
decimal_is_zero, decimal_binop, decimal_compare and decimal_convert
to pass/receive byte order:
* c-exp.y (parse_number): Update.
* printcmd.c (printf_command): Update.
* valarith.c (value_args_as_decimal, value_binop, value_logical_not,
value_equal, value_less): Update.
* valops.c (value_cast, value_one): Update.
* valprint.c (print_decimal_floating): Update.
* value.c (unpack_long, unpack_double): Update.
* python/python-value.c (valpy_nonzero): Update.
* ada-valprint.c (char_at): Add BYTE_ORDER parameter.
(printstr): Update calls to char_at.
(ada_val_print_array): Likewise.
* valprint.c (read_string): Add BYTE_ORDER parameter.
(val_print_string): Update call to read_string.
* c-lang.c (c_get_string): Likewise.
* charset.h (target_wide_charset): Add BYTE_ORDER parameter.
* charset.c (target_wide_charset): Add BYTE_ORDER parameter.
Use it instead of current_gdbarch.
* printcmd.c (printf_command): Update calls to target_wide_charset.
* c-lang.c (charset_for_string_type): Add BYTE_ORDER parameter.
Pass to target_wide_charset. Use it instead of current_gdbarch.
(classify_type): Add BYTE_ORDER parameter. Pass to
charset_for_string_type. Allow NULL encoding pointer.
(print_wchar): Add BYTE_ORDER parameter.
(c_emit_char): Update calls to classify_type and print_wchar.
(c_printchar, c_printstr): Likewise.
* gdbarch.sh (in_solib_return_trampoline): Convert to type "m".
* gdbarch.c, gdbarch.h: Regenerate.
* arch-utils.h (generic_in_solib_return_trampoline): Add GDBARCH
parameter.
* arch-utils.c (generic_in_solib_return_trampoline): Likewise.
* hppa-hpux-tdep.c (hppa_hpux_in_solib_return_trampoline): Likewise.
* rs6000-tdep.c (rs6000_in_solib_return_trampoline): Likewise.
(rs6000_skip_trampoline_code): Update call.
* alpha-tdep.h (struct gdbarch_tdep): Add GDBARCH parameter to
dynamic_sigtramp_offset and pc_in_sigtramp callbacks.
(alpha_read_insn): Add GDBARCH parameter.
* alpha-tdep.c (alpha_lds, alpha_sts): Add GDBARCH parameter.
(alpha_register_to_value): Pass architecture to alpha_sts.
(alpha_extract_return_value): Likewise.
(alpha_value_to_register): Pass architecture to alpha_lds.
(alpha_store_return_value): Likewise.
(alpha_read_insn): Add GDBARCH parameter.
(alpha_skip_prologue): Pass architecture to alpha_read_insn.
(alpha_heuristic_proc_start): Likewise.
(alpha_heuristic_frame_unwind_cache): Likewise.
(alpha_next_pc): Likewise.
(alpha_sigtramp_frame_this_id): Pass architecture to
tdep->dynamic_sigtramp_offset callback.
(alpha_sigtramp_frame_sniffer): Pass architecture to
tdep->pc_in_sigtramp callback.
* alphafbsd-tdep.c (alphafbsd_pc_in_sigtramp): Add GDBARCH parameter.
(alphafbsd_sigtramp_offset): Likewise.
* alpha-linux-tdep.c (alpha_linux_sigtramp_offset_1): Add GDBARCH
parameter. Pass to alpha_read_insn.
(alpha_linux_sigtramp_offset): Add GDBARCH parameter. Pass to
alpha_linux_sigtramp_offset_1.
(alpha_linux_pc_in_sigtramp): Add GDBARCH parameter. Pass to
alpha_linux_sigtramp_offset.
(alpha_linux_sigcontext_addr): Pass architecture to alpha_read_insn
and alpha_linux_sigtramp_offset.
* alphanbsd-tdep.c (alphanbsd_sigtramp_offset): Add GDBARCH parameter.
(alphanbsd_pc_in_sigtramp): Add GDBARCH parameter. Pass to
alphanbsd_sigtramp_offset.
* alphaobsd-tdep.c (alphaobsd_sigtramp_offset): Add GDBARCH parameter.
(alphaobsd_pc_in_sigtramp): Add GDBARCH parameter. Pass to
alpha_read_insn.
(alphaobsd_sigcontext_addr): Pass architecture to
alphaobsd_sigtramp_offset.
* alpha-osf1-tdep.c (alpha_osf1_pc_in_sigtramp): Add GDBARCH
parameter.
* amd64-tdep.c (amd64_analyze_prologue): Add GDBARCH parameter.
(amd64_skip_prologue): Pass architecture to amd64_analyze_prologue.
(amd64_frame_cache): Likewise.
* arm-tdep.c (SWAP_SHORT, SWAP_INT): Remove.
(thumb_analyze_prologue, arm_skip_prologue, arm_scan_prologue,
thumb_get_next_pc, arm_get_next_pc): Do not use SWAP_ macros.
* arm-wince-tdep.c: Include "frame.h".
* avr-tdep.c (EXTRACT_INSN): Remove.
(avr_scan_prologue): Add GDBARCH argument, inline EXTRACT_INSN.
(avr_skip_prologue): Pass architecture to avr_scan_prologue.
(avr_frame_unwind_cache): Likewise.
* cris-tdep.c (struct instruction_environment): Add BYTE_ORDER member.
(find_step_target): Initialize it.
(get_data_from_address): Add BYTE_ORDER parameter.
(bdap_prefix): Pass byte order to get_data_from_address.
(handle_prefix_assign_mode_for_aritm_op): Likewise.
(three_operand_add_sub_cmp_and_or_op): Likewise.
(handle_inc_and_index_mode_for_aritm_op): Likewise.
* frv-linux-tdep.c (frv_linux_pc_in_sigtramp): Add GDBARCH parameter.
(frv_linux_sigcontext_reg_addr): Pass architecture to
frv_linux_pc_in_sigtramp.
(frv_linux_sigtramp_frame_sniffer): Likewise.
* h8300-tdep.c (h8300_is_argument_spill): Add GDBARCH parameter.
(h8300_analyze_prologue): Add GDBARCH parameter. Pass to
h8300_is_argument_spill.
(h8300_frame_cache, h8300_skip_prologue): Pass architecture
to h8300_analyze_prologue.
* hppa-tdep.h (struct gdbarch_tdep): Add GDBARCH parameter to
in_solib_call_trampoline callback.
(hppa_in_solib_call_trampoline): Add GDBARCH parameter.
* hppa-tdep.c (hppa64_convert_code_addr_to_fptr): Add GDBARCH
parameter.
(hppa64_push_dummy_call): Pass architecture to
hppa64_convert_code_addr_to_fptr.
(hppa_match_insns): Add GDBARCH parameter.
(hppa_match_insns_relaxed): Add GDBARCH parameter. Pass to
hppa_match_insns.
(hppa_skip_trampoline_code): Pass architecture to hppa_match_insns.
(hppa_in_solib_call_trampoline): Add GDBARCH parameter. Pass to
hppa_match_insns_relaxed.
(hppa_stub_unwind_sniffer): Pass architecture to
tdep->in_solib_call_trampoline callback.
* hppa-hpux-tdep.c (hppa_hpux_search_pattern): Add GDBARCH parameter.
(hppa32_hpux_search_dummy_call_sequence): Pass architecture to
hppa_hpux_search_pattern.
* hppa-linux-tdep.c (insns_match_pattern): Add GDBARCH parameter.
(hppa_linux_sigtramp_find_sigcontext): Add GDBARCH parameter.
Pass to insns_match_pattern.
(hppa_linux_sigtramp_frame_unwind_cache): Pass architecture to
hppa_linux_sigtramp_find_sigcontext.
(hppa_linux_sigtramp_frame_sniffer): Likewise.
(hppa32_hpux_in_solib_call_trampoline): Add GDBARCH parameter.
(hppa64_hpux_in_solib_call_trampoline): Likewise.
* i386-tdep.c (i386_follow_jump): Add GDBARCH parameter.
(i386_analyze_frame_setup): Add GDBARCH parameter.
(i386_analyze_prologue): Add GDBARCH parameter. Pass to
i386_follow_jump and i386_analyze_frame_setup.
(i386_skip_prologue): Pass architecture to i386_analyze_prologue
and i386_follow_jump.
(i386_frame_cache): Pass architecture to i386_analyze_prologue.
(i386_pe_skip_trampoline_code): Add FRAME parameter.
* i386-tdep.h (i386_pe_skip_trampoline_code): Add FRAME parameter.
* i386-cygwin-tdep.c (i386_cygwin_skip_trampoline_code): Pass
frame to i386_pe_skip_trampoline_code.
* ia64-tdep.h (struct gdbarch_tdep): Add GDBARCH parameter
to sigcontext_register_address callback.
* ia64-tdep.c (ia64_find_global_pointer): Add GDBARCH parameter.
(ia64_find_unwind_table): Pass architecture to
ia64_find_global_pointer.
(find_extant_func_descr): Add GDBARCH parameter.
(find_func_descr): Pass architecture to find_extant_func_descr
and ia64_find_global_pointer.
(ia64_sigtramp_frame_init_saved_regs): Pass architecture to
tdep->sigcontext_register_address callback.
* ia64-linux-tdep.c (ia64_linux_sigcontext_register_address): Add
GDBARCH parameter.
* iq2000-tdep.c (iq2000_scan_prologue): Add GDBARCH parameter.
(iq2000_frame_cache): Pass architecture to iq2000_scan_prologue.
* lm32-tdep.c (lm32_analyze_prologue): Add GDBARCH parameter.
(lm32_skip_prologue, lm32_frame_cache): Pass architecture to
lm32_analyze_prologue.
* m32r-tdep.c (decode_prologue): Add GDBARCH parameter.
(m32r_skip_prologue): Pass architecture to decode_prologue.
* m68hc11-tdep.c (m68hc11_analyze_instruction): Add GDBARCH parameter.
(m68hc11_scan_prologue): Pass architecture to
m68hc11_analyze_instruction.
* m68k-tdep.c (m68k_analyze_frame_setup): Add GDBARCH parameter.
(m68k_analyze_prologue): Pass architecture to
m68k_analyze_frame_setup.
* m88k-tdep.c (m88k_fetch_instruction): Add BYTE_ORDER parameter.
(m88k_analyze_prologue): Add GDBARCH parameter. Pass byte order
to m88k_fetch_instruction.
(m88k_skip_prologue): Pass architecture to m88k_analyze_prologue.
(m88k_frame_cache): Likewise.
* mep-tdep.c (mep_get_insn): Add GDBARCH parameter.
(mep_analyze_prologue): Pass architecture to mep_get_insn.
* mips-tdep.c (mips_fetch_instruction): Add GDBARCH parameter.
(mips32_next_pc): Pass architecture to mips_fetch_instruction.
(deal_with_atomic_sequence): Likewise.
(unpack_mips16): Add GDBARCH parameter, pass to mips_fetch_instruction.
(mips16_scan_prologue): Likewise.
(mips32_scan_prologue): Likewise.
(mips16_in_function_epilogue_p): Likewise.
(mips32_in_function_epilogue_p): Likewise.
(mips_about_to_return): Likewise.
(mips_insn16_frame_cache): Pass architecture to mips16_scan_prologue.
(mips_insn32_frame_cache): Pass architecture to mips32_scan_prologue.
(mips_skip_prologue): Pass architecture to mips16_scan_prologue
and mips32_scan_prologue.
(mips_in_function_epilogue_p): Pass architecture to
mips16_in_function_epilogue_p and
mips32_in_function_epilogue_p.
(heuristic_proc_start): Pass architecture to mips_fetch_instruction
and mips_about_to_return.
(mips_skip_mips16_trampoline_code): Pass architecture to
mips_fetch_instruction.
(fetch_mips_16): Add GDBARCH parameter.
(mips16_next_pc): Pass architecture to fetch_mips_16.
(extended_mips16_next_pc): Pass architecture to unpack_mips16 and
fetch_mips_16.
* objc-lang.c (read_objc_method, read_objc_methlist_nmethods,
read_objc_methlist_method, read_objc_object, read_objc_super,
read_objc_class): Add GDBARCH parameter.
(find_implementation_from_class): Add GDBARCH parameter, pass
to read_objc_class, read_objc_methlist_nmethods, and
read_objc_methlist_method.
(find_implementation): Add GDBARCH parameter, pass to
read_objc_object and find_implementation_from_class.
(resolve_msgsend, resolve_msgsend_stret): Pass architecture
to find_implementation.
(resolve_msgsend_super, resolve_msgsend_super_stret): Pass
architecture to read_objc_super and find_implementation_from_class.
* ppc64-linux-tdep.c (ppc64_desc_entry_point): Add GDBARCH parameter.
(ppc64_standard_linkage1_target, ppc64_standard_linkage2_target,
ppc64_standard_linkage3_target): Pass architecture to
ppc64_desc_entry_point.
* rs6000-tdep.c (bl_to_blrl_insn_p): Add BYTE_ORDER parameter.
(skip_prologue): Pass byte order to bl_to_blrl_insn_p.
(rs6000_fetch_instruction): Add GDBARCH parameter.
(rs6000_skip_stack_check): Add GDBARCH parameter, pass to
rs6000_fetch_instruction.
(skip_prologue): Pass architecture to rs6000_fetch_instruction.
* remote-mips.c (mips_store_word): Return old_contents as host
integer value instead of target bytes.
* s390-tdep.c (struct s390_prologue_data): Add BYTE_ORDER member.
(s390_analyze_prologue): Initialize it.
(extend_simple_arg): Add GDBARCH parameter.
(s390_push_dummy_call): Pass architecture to extend_simple_arg.
* scm-lang.c (scm_get_field): Add BYTE_ORDER parameter.
* scm-lang.h (scm_get_field): Add BYTE_ORDER parameter.
(SCM_CAR, SCM_CDR): Pass SCM_BYTE_ORDER to scm_get_field.
* scm-valprint.c (scm_scmval_print): Likewise.
(scm_scmlist_print, scm_ipruk, scm_scmval_print): Define
SCM_BYTE_ORDER.
* sh64-tdep.c (look_for_args_moves): Add GDBARCH parameter.
(sh64_skip_prologue_hard_way): Add GDBARCH parameter, pass to
look_for_args_moves.
(sh64_skip_prologue): Pass architecture to
sh64_skip_prologue_hard_way.
* sh-tdep.c (sh_analyze_prologue): Add GDBARCH parameter.
(sh_skip_prologue): Pass architecture to sh_analyze_prologue.
(sh_frame_cache): Likewise.
* solib-irix.c (extract_mips_address): Add GDBARCH parameter.
(fetch_lm_info, irix_current_sos, irix_open_symbol_file_object):
Pass architecture to extract_mips_address.
* sparc-tdep.h (sparc_fetch_wcookie): Add GDBARCH parameter.
* sparc-tdep.c (sparc_fetch_wcookie): Add GDBARCH parameter.
(sparc_supply_rwindow, sparc_collect_rwindow): Pass architecture
to sparc_fetch_wcookie.
(sparc32_frame_prev_register): Likewise.
* sparc64-tdep.c (sparc64_frame_prev_register): Likewise.
* sparc32nbsd-tdep.c (sparc32nbsd_sigcontext_saved_regs): Likewise.
* sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_saved_regs): Likewise.
* spu-tdep.c (spu_analyze_prologue): Add GDBARCH parameter.
(spu_skip_prologue): Pass architecture to spu_analyze_prologue.
(spu_virtual_frame_pointer): Likewise.
(spu_frame_unwind_cache): Likewise.
(info_spu_mailbox_list): Add BYTE_ORER parameter.
(info_spu_mailbox_command): Pass byte order to info_spu_mailbox_list.
(info_spu_dma_cmdlist): Add BYTE_ORER parameter.
(info_spu_dma_command, info_spu_proxydma_command): Pass byte order
to info_spu_dma_cmdlist.
* symfile.c (read_target_long_array): Add GDBARCH parameter.
(simple_read_overlay_table, simple_read_overlay_region_table,
simple_overlay_update_1): Pass architecture to read_target_long_array.
* v850-tdep.c (v850_analyze_prologue): Add GDBARCH parameter.
(v850_frame_cache): Pass architecture to v850_analyze_prologue.
* xstormy16-tdep.c (xstormy16_analyze_prologue): Add GDBARCH
parameter.
(xstormy16_skip_prologue, xstormy16_frame_cache): Pass architecture
to xstormy16_analyze_prologue.
(xstormy16_resolve_jmp_table_entry): Add GDBARCH parameter.
(xstormy16_find_jmp_table_entry): Likewise.
(xstormy16_skip_trampoline_code): Pass architecture to
xstormy16_resolve_jmp_table_entry.
(xstormy16_pointer_to_address): Likewise.
(xstormy16_address_to_pointer): Pass architecture to
xstormy16_find_jmp_table_entry.
* xtensa-tdep.c (call0_track_op): Add GDBARCH parameter.
(call0_analyze_prologue): Add GDBARCH parameter, pass to
call0_track_op.
(call0_frame_cache): Pass architecture to call0_analyze_prologue.
(xtensa_skip_prologue): Likewise.
2009-07-02 19:25:59 +02:00
|
|
|
return gdbarch->in_solib_return_trampoline (gdbarch, pc, name);
|
2002-08-21 01:01:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_in_solib_return_trampoline_ftype in_solib_return_trampoline)
|
|
|
|
{
|
|
|
|
gdbarch->in_solib_return_trampoline = in_solib_return_trampoline;
|
|
|
|
}
|
|
|
|
|
2001-11-06 12:02:12 +01:00
|
|
|
int
|
2015-05-26 12:59:17 +02:00
|
|
|
gdbarch_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR addr)
|
2001-11-06 12:02:12 +01:00
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2015-05-26 12:59:17 +02:00
|
|
|
gdb_assert (gdbarch->stack_frame_destroyed_p != NULL);
|
2001-11-06 12:02:12 +01:00
|
|
|
if (gdbarch_debug >= 2)
|
2015-05-26 12:59:17 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_stack_frame_destroyed_p called\n");
|
|
|
|
return gdbarch->stack_frame_destroyed_p (gdbarch, addr);
|
2001-11-06 12:02:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-05-26 12:59:17 +02:00
|
|
|
set_gdbarch_stack_frame_destroyed_p (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_stack_frame_destroyed_p_ftype stack_frame_destroyed_p)
|
2001-11-06 12:02:12 +01:00
|
|
|
{
|
2015-05-26 12:59:17 +02:00
|
|
|
gdbarch->stack_frame_destroyed_p = stack_frame_destroyed_p;
|
2001-11-06 12:02:12 +01:00
|
|
|
}
|
|
|
|
|
MIPS: Keep the ISA bit in compressed code addresses
1. Background information
The MIPS architecture, as originally designed and implemented in
mid-1980s has a uniform instruction word size that is 4 bytes, naturally
aligned. As such all MIPS instructions are located at addresses that
have their bits #1 and #0 set to zeroes, and any attempt to execute an
instruction from an address that has any of the two bits set to one
causes an address error exception. This may for example happen when a
jump-register instruction is executed whose register value used as the
jump target has any of these bits set.
Then in mid 1990s LSI sought a way to improve code density for their
TinyRISC family of MIPS cores and invented an alternatively encoded
instruction set in a joint effort with MIPS Technologies (then a
subsidiary of SGI). The new instruction set has been named the MIPS16
ASE (Application-Specific Extension) and uses a variable instruction
word size, which is 2 bytes (as the name of the ASE suggests) for most,
but there are a couple of exceptions that take 4 bytes, and then most of
the 2-byte instructions can be treated with a 2-byte extension prefix to
expand the range of the immediate operands used.
As a result instructions are no longer 4-byte aligned, instead they are
aligned to a multiple of 2. That left the bit #0 still unused for code
references, be it for the standard MIPS (i.e. as originally invented) or
for the MIPS16 instruction set, and based on that observation a clever
trick was invented that on one hand allowed the processor to be
seamlessly switched between the two instruction sets at any time at the
run time while on the other avoided the introduction of any special
control register to do that.
So it is the bit #0 of the instruction address that was chosen as the
selector and named the ISA bit. Any instruction executed at an even
address is interpreted as a standard MIPS instruction (the address still
has to have its bit #1 clear), any instruction executed at an odd
address is interpreted as a MIPS16 instruction.
To switch between modes ordinary jump instructions are used, such as
used for function calls and returns, specifically the bit #0 of the
source register used in jump-register instructions selects the execution
(ISA) mode for the following piece of code to be interpreted in.
Additionally new jump-immediate instructions were added that flipped the
ISA bit to select the opposite mode upon execution. They were
considered necessary to avoid the need to make register jumps in all
cases as the original jump-immediate instructions provided no way to
change the bit #0 at all.
This was all important for cases where standard MIPS and MIPS16 code had
to be mixed, either for compatibility with the existing binary code base
or to access resources not reachable from MIPS16 code (the MIPS16
instruction set only provides access to general-purpose registers, and
not for example floating-point unit registers or privileged coprocessor
0 registers) -- pieces of code in the opposite mode can be executed as
ordinary subroutine calls.
A similar approach has been more recently adopted for the MIPS16
replacement instruction set defined as the so called microMIPS ASE.
This is another instruction set encoding introduced to the MIPS
architecture. Just like the MIPS16 ASE, the microMIPS instruction set
uses a variable-length encoding, where each instruction takes a multiple
of 2 bytes. The ISA bit has been reused and for microMIPS-capable
processors selects between the standard MIPS and the microMIPS mode
instead.
2. Statement of the problem
To put it shortly, MIPS16 and microMIPS code pointers used by GDB are
different to these observed at the run time. This results in the same
expressions being evaluated producing different results in GDB and in
the program being debugged. Obviously it's the results obtained at the
run time that are correct (they define how the program behaves) and
therefore by definition the results obtained in GDB are incorrect.
A bit longer description will record that obviously at the run time the
ISA bit has to be set correctly (refer to background information above
if unsure why so) or the program will not run as expected. This is
recorded in all the executable file structures used at the run time: the
dynamic symbol table (but not always the static one!), the GOT, and
obviously in all the addresses embedded in code or data of the program
itself, calculated by applying the appropriate relocations at the static
link time.
While a program is being processed by GDB, the ISA bit is stripped off
from any code addresses, presumably to make them the same as the
respective raw memory byte address used by the processor to access the
instruction in the instruction fetch access cycle. This stripping is
actually performed outside GDB proper, in BFD, specifically
_bfd_mips_elf_symbol_processing (elfxx-mips.c, see the piece of code at
the very bottom of that function, starting with an: "If this is an
odd-valued function symbol, assume it's a MIPS16 or microMIPS one."
comment).
This function is also responsible for symbol table dumps made by
`objdump' too, so you'll never see the ISA bit reported there by that
tool, you need to use `readelf'.
This is however unlike what is ever done at the run time, the ISA bit
once present is never stripped off, for example a cast like this:
(short *) main
will not strip the ISA bit off and if the resulting pointer is intended
to be used to access instructions as data, for example for software
instruction decoding (like for fault recovery or emulation in a signal
handler) or for self-modifying code then the bit still has to be
stripped off by an explicit AND operation.
This is probably best illustrated with a simple real program example.
Let's consider the following simple program:
$ cat foobar.c
int __attribute__ ((mips16)) foo (void)
{
return 1;
}
int __attribute__ ((mips16)) bar (void)
{
return 2;
}
int __attribute__ ((nomips16)) foo32 (void)
{
return 3;
}
int (*foo32p) (void) = foo32;
int (*foop) (void) = foo;
int fooi = (int) foo;
int
main (void)
{
return foop ();
}
$
This is plain C with no odd tricks, except from the instruction mode
attributes. They are not necessary to trigger this problem, I just put
them here so that the program can be contained in a single source file
and to make it obvious which function is MIPS16 code and which is not.
Let's try it with Linux, so that everyone can repeat this experiment:
$ mips-linux-gnu-gcc -mips16 -g -O2 -o foobar foobar.c
$
Let's have a look at some interesting symbols:
$ mips-linux-gnu-readelf -s foobar | egrep 'table|foo|bar'
Symbol table '.dynsym' contains 7 entries:
Symbol table '.symtab' contains 95 entries:
55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c
66: 0040068c 4 FUNC GLOBAL DEFAULT [MIPS16] 12 bar
68: 00410848 4 OBJECT GLOBAL DEFAULT 21 foo32p
70: 00410844 4 OBJECT GLOBAL DEFAULT 21 foop
78: 00400684 8 FUNC GLOBAL DEFAULT 12 foo32
80: 00400680 4 FUNC GLOBAL DEFAULT [MIPS16] 12 foo
88: 00410840 4 OBJECT GLOBAL DEFAULT 21 fooi
$
Hmm, no sight of the ISA bit, but notice how foo and bar (but not
foo32!) have been marked as MIPS16 functions (ELF symbol structure's
`st_other' field is used for that).
So let's try to run and poke at this program with GDB. I'll be using a
native system for simplicity (I'll be using ellipses here and there to
remove unrelated clutter):
$ ./foobar
$ echo $?
1
$
So far, so good.
$ gdb ./foobar
[...]
(gdb) break main
Breakpoint 1 at 0x400490: file foobar.c, line 23.
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb)
Yay, it worked! OK, so let's poke at it:
(gdb) print main
$1 = {int (void)} 0x400490 <main>
(gdb) print foo32
$2 = {int (void)} 0x400684 <foo32>
(gdb) print foo32p
$3 = (int (*)(void)) 0x400684 <foo32>
(gdb) print bar
$4 = {int (void)} 0x40068c <bar>
(gdb) print foo
$5 = {int (void)} 0x400680 <foo>
(gdb) print foop
$6 = (int (*)(void)) 0x400681 <foo>
(gdb)
A-ha! Here's the difference and finally the ISA bit!
(gdb) print /x fooi
$7 = 0x400681
(gdb) p/x $pc
p/x $pc
$8 = 0x400491
(gdb)
And here as well...
(gdb) advance foo
foo () at foobar.c:4
4 }
(gdb) disassemble
Dump of assembler code for function foo:
0x00400680 <+0>: jr ra
0x00400682 <+2>: li v0,1
End of assembler dump.
(gdb) finish
Run till exit from #0 foo () at foobar.c:4
main () at foobar.c:24
24 }
Value returned is $9 = 1
(gdb) continue
Continuing.
[Inferior 1 (process 14103) exited with code 01]
(gdb)
So let's be a bit inquisitive...
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb)
Actually we do not like to run foo here at all. Let's run bar instead!
(gdb) set foop = bar
(gdb) print foop
$10 = (int (*)(void)) 0x40068c <bar>
(gdb)
Hmm, no ISA bit. Is it going to work?
(gdb) advance bar
bar () at foobar.c:9
9 }
(gdb) p/x $pc
$11 = 0x40068c
(gdb) disassemble
Dump of assembler code for function bar:
=> 0x0040068c <+0>: jr ra
0x0040068e <+2>: li v0,2
End of assembler dump.
(gdb) finish
Run till exit from #0 bar () at foobar.c:9
Program received signal SIGILL, Illegal instruction.
bar () at foobar.c:9
9 }
(gdb)
Oops!
(gdb) p/x $pc
$12 = 0x40068c
(gdb)
We're still there!
(gdb) continue
Continuing.
Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb)
So let's try something else:
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) set foop = foo
(gdb) advance foo
foo () at foobar.c:4
4 }
(gdb) disassemble
Dump of assembler code for function foo:
=> 0x00400680 <+0>: jr ra
0x00400682 <+2>: li v0,1
End of assembler dump.
(gdb) finish
Run till exit from #0 foo () at foobar.c:4
Program received signal SIGILL, Illegal instruction.
foo () at foobar.c:4
4 }
(gdb) continue
Continuing.
Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb)
The same problem!
(gdb) run
Starting program:
/net/build2-lucid-cs/scratch/macro/mips-linux-fsf-gcc/isa-bit/foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) set foop = foo32
(gdb) advance foo32
foo32 () at foobar.c:14
14 }
(gdb) disassemble
Dump of assembler code for function foo32:
=> 0x00400684 <+0>: jr ra
0x00400688 <+4>: li v0,3
End of assembler dump.
(gdb) finish
Run till exit from #0 foo32 () at foobar.c:14
main () at foobar.c:24
24 }
Value returned is $14 = 3
(gdb) continue
Continuing.
[Inferior 1 (process 14113) exited with code 03]
(gdb)
That did work though, so it's the ISA bit only!
(gdb) quit
Enough!
That's the tip of the iceberg only though. So let's rebuild the
executable with some dynamic symbols:
$ mips-linux-gnu-gcc -mips16 -Wl,--export-dynamic -g -O2 -o foobar-dyn foobar.c
$ mips-linux-gnu-readelf -s foobar-dyn | egrep 'table|foo|bar'
Symbol table '.dynsym' contains 32 entries:
6: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar
8: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p
9: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop
15: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32
17: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo
25: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi
Symbol table '.symtab' contains 95 entries:
55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c
69: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar
71: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p
72: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop
79: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32
81: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo
89: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi
$
OK, now the ISA bit is there for a change, but the MIPS16 `st_other'
attribute gone, hmm... What does `objdump' do then:
$ mips-linux-gnu-objdump -Tt foobar-dyn | egrep 'SYMBOL|foo|bar'
foobar-dyn: file format elf32-tradbigmips
SYMBOL TABLE:
00000000 l df *ABS* 00000000 foobar.c
004009cc g F .text 00000004 0xf0 bar
00410b88 g O .data 00000004 foo32p
00410b84 g O .data 00000004 foop
004009c4 g F .text 00000008 foo32
004009c0 g F .text 00000004 0xf0 foo
00410b80 g O .data 00000004 fooi
DYNAMIC SYMBOL TABLE:
004009cc g DF .text 00000004 Base 0xf0 bar
00410b88 g DO .data 00000004 Base foo32p
00410b84 g DO .data 00000004 Base foop
004009c4 g DF .text 00000008 Base foo32
004009c0 g DF .text 00000004 Base 0xf0 foo
00410b80 g DO .data 00000004 Base fooi
$
Hmm, the attribute (0xf0, printed raw) is back, and the ISA bit gone
again.
Let's have a look at some DWARF-2 records GDB uses (I'll be stripping
off a lot here for brevity) -- debug info:
$ mips-linux-gnu-readelf -wi foobar
Contents of the .debug_info section:
[...]
Compilation Unit @ offset 0x88:
Length: 0xbb (32-bit)
Version: 4
Abbrev Offset: 62
Pointer Size: 4
<0><93>: Abbrev Number: 1 (DW_TAG_compile_unit)
<94> DW_AT_producer : (indirect string, offset: 0x19e): GNU C 4.8.0 20120513 (experimental) -meb -mips16 -march=mips32r2 -mhard-float -mllsc -mplt -mno-synci -mno-shared -mabi=32 -g -O2
<98> DW_AT_language : 1 (ANSI C)
<99> DW_AT_name : (indirect string, offset: 0x190): foobar.c
<9d> DW_AT_comp_dir : (indirect string, offset: 0x225): [...]
<a1> DW_AT_ranges : 0x0
<a5> DW_AT_low_pc : 0x0
<a9> DW_AT_stmt_list : 0x27
<1><ad>: Abbrev Number: 2 (DW_TAG_subprogram)
<ae> DW_AT_external : 1
<ae> DW_AT_name : foo
<b2> DW_AT_decl_file : 1
<b3> DW_AT_decl_line : 1
<b4> DW_AT_prototyped : 1
<b4> DW_AT_type : <0xc2>
<b8> DW_AT_low_pc : 0x400680
<bc> DW_AT_high_pc : 0x400684
<c0> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<c2> DW_AT_GNU_all_call_sites: 1
<1><c2>: Abbrev Number: 3 (DW_TAG_base_type)
<c3> DW_AT_byte_size : 4
<c4> DW_AT_encoding : 5 (signed)
<c5> DW_AT_name : int
<1><c9>: Abbrev Number: 4 (DW_TAG_subprogram)
<ca> DW_AT_external : 1
<ca> DW_AT_name : (indirect string, offset: 0x18a): foo32
<ce> DW_AT_decl_file : 1
<cf> DW_AT_decl_line : 11
<d0> DW_AT_prototyped : 1
<d0> DW_AT_type : <0xc2>
<d4> DW_AT_low_pc : 0x400684
<d8> DW_AT_high_pc : 0x40068c
<dc> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<de> DW_AT_GNU_all_call_sites: 1
<1><de>: Abbrev Number: 2 (DW_TAG_subprogram)
<df> DW_AT_external : 1
<df> DW_AT_name : bar
<e3> DW_AT_decl_file : 1
<e4> DW_AT_decl_line : 6
<e5> DW_AT_prototyped : 1
<e5> DW_AT_type : <0xc2>
<e9> DW_AT_low_pc : 0x40068c
<ed> DW_AT_high_pc : 0x400690
<f1> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<f3> DW_AT_GNU_all_call_sites: 1
<1><f3>: Abbrev Number: 5 (DW_TAG_subprogram)
<f4> DW_AT_external : 1
<f4> DW_AT_name : (indirect string, offset: 0x199): main
<f8> DW_AT_decl_file : 1
<f9> DW_AT_decl_line : 21
<fa> DW_AT_prototyped : 1
<fa> DW_AT_type : <0xc2>
<fe> DW_AT_low_pc : 0x400490
<102> DW_AT_high_pc : 0x4004a4
<106> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<108> DW_AT_GNU_all_tail_call_sites: 1
[...]
$
-- no sign of the ISA bit anywhere -- frame info:
$ mips-linux-gnu-readelf -wf foobar
[...]
Contents of the .debug_frame section:
00000000 0000000c ffffffff CIE
Version: 1
Augmentation: ""
Code alignment factor: 1
Data alignment factor: -4
Return address column: 31
DW_CFA_def_cfa_register: r29
DW_CFA_nop
00000010 0000000c 00000000 FDE cie=00000000 pc=00400680..00400684
00000020 0000000c 00000000 FDE cie=00000000 pc=00400684..0040068c
00000030 0000000c 00000000 FDE cie=00000000 pc=0040068c..00400690
00000040 00000018 00000000 FDE cie=00000000 pc=00400490..004004a4
DW_CFA_advance_loc: 6 to 00400496
DW_CFA_def_cfa_offset: 32
DW_CFA_offset: r31 at cfa-4
DW_CFA_advance_loc: 6 to 0040049c
DW_CFA_restore: r31
DW_CFA_def_cfa_offset: 0
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
[...]
$
-- no sign of the ISA bit anywhere -- range info (GDB doesn't use arange):
$ mips-linux-gnu-readelf -wR foobar
Contents of the .debug_ranges section:
Offset Begin End
00000000 00400680 00400690
00000000 00400490 004004a4
00000000 <End of list>
$
-- no sign of the ISA bit anywhere -- line info:
$ mips-linux-gnu-readelf -wl foobar
Raw dump of debug contents of section .debug_line:
[...]
Offset: 0x27
Length: 78
DWARF Version: 2
Prologue Length: 31
Minimum Instruction Length: 1
Initial value of 'is_stmt': 1
Line Base: -5
Line Range: 14
Opcode Base: 13
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 args
Opcode 3 has 1 args
Opcode 4 has 1 args
Opcode 5 has 1 args
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 args
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 args
The Directory Table is empty.
The File Name Table:
Entry Dir Time Size Name
1 0 0 0 foobar.c
Line Number Statements:
Extended opcode 2: set Address to 0x400681
Special opcode 6: advance Address by 0 to 0x400681 and Line by 1 to 2
Special opcode 7: advance Address by 0 to 0x400681 and Line by 2 to 4
Special opcode 55: advance Address by 3 to 0x400684 and Line by 8 to 12
Special opcode 7: advance Address by 0 to 0x400684 and Line by 2 to 14
Advance Line by -7 to 7
Special opcode 131: advance Address by 9 to 0x40068d and Line by 0 to 7
Special opcode 7: advance Address by 0 to 0x40068d and Line by 2 to 9
Advance PC by 3 to 0x400690
Extended opcode 1: End of Sequence
Extended opcode 2: set Address to 0x400491
Advance Line by 21 to 22
Copy
Special opcode 6: advance Address by 0 to 0x400491 and Line by 1 to 23
Special opcode 60: advance Address by 4 to 0x400495 and Line by -1 to 22
Special opcode 34: advance Address by 2 to 0x400497 and Line by 1 to 23
Special opcode 62: advance Address by 4 to 0x40049b and Line by 1 to 24
Special opcode 32: advance Address by 2 to 0x40049d and Line by -1 to 23
Special opcode 6: advance Address by 0 to 0x40049d and Line by 1 to 24
Advance PC by 7 to 0x4004a4
Extended opcode 1: End of Sequence
[...]
-- a-ha, the ISA bit is there! However it's not always right for some
reason, I don't have a small test case to show it, but here's an excerpt
from MIPS16 libc, a prologue of a function:
00019630 <__libc_init_first>:
19630: e8a0 jrc ra
19632: 6500 nop
00019634 <_init>:
19634: f000 6a11 li v0,17
19638: f7d8 0b08 la v1,15e00 <_DYNAMIC+0x15c54>
1963c: f400 3240 sll v0,16
19640: e269 addu v0,v1
19642: 659a move gp,v0
19644: 64f6 save 48,ra,s0-s1
19646: 671c move s0,gp
19648: d204 sw v0,16(sp)
1964a: f352 984c lw v0,-27828(s0)
1964e: 6724 move s1,a0
and the corresponding DWARF-2 line info:
Line Number Statements:
Extended opcode 2: set Address to 0x19631
Advance Line by 44 to 45
Copy
Special opcode 8: advance Address by 0 to 0x19631 and Line by 3 to 48
Special opcode 66: advance Address by 4 to 0x19635 and Line by 5 to 53
Advance PC by constant 17 to 0x19646
Special opcode 25: advance Address by 1 to 0x19647 and Line by 6 to 59
Advance Line by -6 to 53
Special opcode 33: advance Address by 2 to 0x19649 and Line by 0 to 53
Special opcode 39: advance Address by 2 to 0x1964b and Line by 6 to 59
Advance Line by -6 to 53
Special opcode 61: advance Address by 4 to 0x1964f and Line by 0 to 53
-- see that "Advance PC by constant 17" there? It clears the ISA bit,
however code at 0x19646 is not standard MIPS code at all. For some
reason the constant is always 17, I've never seen DW_LNS_const_add_pc
used with any other value -- is that a binutils bug or what?
3. Solution:
I think we should retain the value of the ISA bit in code references,
that is effectively treat them as cookies as they indeed are (although
trivially calculated) rather than raw memory byte addresses.
In a perfect world both the static symbol table and the respective
DWARF-2 records should be fixed to include the ISA bit in all the cases.
I think however that this is infeasible.
All the uses of `_bfd_mips_elf_symbol_processing' can not necessarily be
tracked down. This function is used by `elf_slurp_symbol_table' that in
turn is used by `bfd_canonicalize_symtab' and
`bfd_canonicalize_dynamic_symtab', which are public interfaces.
Similarly DWARF-2 records are used outside GDB, one notable if a bit
questionable is the exception unwinder (libgcc/unwind-dw2.c) -- I have
identified at least bits in `execute_cfa_program' and
`uw_frame_state_for', both around the calls to `_Unwind_IsSignalFrame',
that would need an update as they effectively flip the ISA bit freely;
see also the comment about MASK_RETURN_ADDR in gcc/config/mips/mips.h.
But there may be more places. Any change in how DWARF-2 records are
produced would require an update there and would cause compatibility
problems with libgcc.a binaries already distributed; given that this is
a static library a complex change involving function renames would
likely be required.
I propose therefore to accept the existing inconsistencies and deal with
them entirely within GDB. I have figured out that the ISA bit lost in
various places can still be recovered as long as we have symbol
information -- that'll have the `st_other' attribute correctly set to
one of standard MIPS/MIPS16/microMIPS encoding.
Here's the resulting change. It adds a couple of new `gdbarch' hooks,
one to update symbol information with the ISA bit lost in
`_bfd_mips_elf_symbol_processing', and two other ones to adjust DWARF-2
records as they're processed. The ISA bit is set in each address
handled according to information retrieved from the symbol table for the
symbol spanning the address if any; limits are adjusted based on the
address they point to related to the respective base address.
Additionally minimal symbol information has to be adjusted accordingly
in its gdbarch hook.
With these changes in place some complications with ISA bit juggling in
the PC that never fully worked can be removed from the MIPS backend.
Conversely, the generic dynamic linker event special breakpoint symbol
handler has to be updated to call the minimal symbol gdbarch hook to
record that the symbol is a MIPS16 or microMIPS address if applicable or
the breakpoint will be set at the wrong address and either fail to work
or cause SIGTRAPs (this is because the symbol is handled early on and
bypasses regular symbol processing).
4. Results obtained
The change fixes the example above -- to repeat only the crucial steps:
(gdb) break main
Breakpoint 1 at 0x400491: file foobar.c, line 23.
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) print foo
$1 = {int (void)} 0x400681 <foo>
(gdb) set foop = bar
(gdb) advance bar
bar () at foobar.c:9
9 }
(gdb) disassemble
Dump of assembler code for function bar:
=> 0x0040068d <+0>: jr ra
0x0040068f <+2>: li v0,2
End of assembler dump.
(gdb) finish
Run till exit from #0 bar () at foobar.c:9
main () at foobar.c:24
24 }
Value returned is $2 = 2
(gdb) continue
Continuing.
[Inferior 1 (process 14128) exited with code 02]
(gdb)
-- excellent!
The change removes about 90 failures per MIPS16 multilib in mips-sde-elf
testing too, results for MIPS16 are now similar to that for standard
MIPS; microMIPS results are a bit worse because of host-I/O problems in
QEMU used instead of MIPSsim for microMIPS testing only:
=== gdb Summary ===
# of expected passes 14299
# of unexpected failures 187
# of expected failures 56
# of known failures 58
# of unresolved testcases 11
# of untested testcases 52
# of unsupported tests 174
MIPS16:
=== gdb Summary ===
# of expected passes 14298
# of unexpected failures 187
# of unexpected successes 2
# of expected failures 54
# of known failures 58
# of unresolved testcases 12
# of untested testcases 52
# of unsupported tests 174
microMIPS:
=== gdb Summary ===
# of expected passes 14149
# of unexpected failures 201
# of unexpected successes 2
# of expected failures 54
# of known failures 58
# of unresolved testcases 7
# of untested testcases 53
# of unsupported tests 175
2014-12-12 Maciej W. Rozycki <macro@codesourcery.com>
Maciej W. Rozycki <macro@mips.com>
Pedro Alves <pedro@codesourcery.com>
gdb/
* gdbarch.sh (elf_make_msymbol_special): Change type to `F',
remove `predefault' and `invalid_p' initializers.
(make_symbol_special): New architecture method.
(adjust_dwarf2_addr, adjust_dwarf2_line): Likewise.
(objfile, symbol): New declarations.
* arch-utils.h (default_elf_make_msymbol_special): Remove
prototype.
(default_make_symbol_special): New prototype.
(default_adjust_dwarf2_addr): Likewise.
(default_adjust_dwarf2_line): Likewise.
* mips-tdep.h (mips_unmake_compact_addr): New prototype.
* arch-utils.c (default_elf_make_msymbol_special): Remove
function.
(default_make_symbol_special): New function.
(default_adjust_dwarf2_addr): Likewise.
(default_adjust_dwarf2_line): Likewise.
* dwarf2-frame.c (decode_frame_entry_1): Call
`gdbarch_adjust_dwarf2_addr'.
* dwarf2loc.c (dwarf2_find_location_expression): Likewise.
* dwarf2read.c (create_addrmap_from_index): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(add_partial_symbol): Likewise.
(add_partial_subprogram): Likewise.
(process_full_comp_unit): Likewise.
(read_file_scope): Likewise.
(read_func_scope): Likewise. Call `gdbarch_make_symbol_special'.
(read_lexical_block_scope): Call `gdbarch_adjust_dwarf2_addr'.
(read_call_site_scope): Likewise.
(dwarf2_ranges_read): Likewise.
(dwarf2_record_block_ranges): Likewise.
(read_attribute_value): Likewise.
(dwarf_decode_lines_1): Call `gdbarch_adjust_dwarf2_line'.
(new_symbol_full): Call `gdbarch_adjust_dwarf2_addr'.
* elfread.c (elf_symtab_read): Don't call
`gdbarch_elf_make_msymbol_special' if unset.
* mips-linux-tdep.c (micromips_linux_sigframe_validate): Strip
the ISA bit from the PC.
* mips-tdep.c (mips_unmake_compact_addr): New function.
(mips_elf_make_msymbol_special): Set the ISA bit in the symbol's
address appropriately.
(mips_make_symbol_special): New function.
(mips_pc_is_mips): Set the ISA bit before symbol lookup.
(mips_pc_is_mips16): Likewise.
(mips_pc_is_micromips): Likewise.
(mips_pc_isa): Likewise.
(mips_adjust_dwarf2_addr): New function.
(mips_adjust_dwarf2_line): Likewise.
(mips_read_pc, mips_unwind_pc): Keep the ISA bit.
(mips_addr_bits_remove): Likewise.
(mips_skip_trampoline_code): Likewise.
(mips_write_pc): Don't set the ISA bit.
(mips_eabi_push_dummy_call): Likewise.
(mips_o64_push_dummy_call): Likewise.
(mips_gdbarch_init): Install `mips_make_symbol_special',
`mips_adjust_dwarf2_addr' and `mips_adjust_dwarf2_line' gdbarch
handlers.
* solib.c (gdb_bfd_lookup_symbol_from_symtab): Get
target-specific symbol address adjustments.
* gdbarch.h: Regenerate.
* gdbarch.c: Regenerate.
2014-12-12 Maciej W. Rozycki <macro@codesourcery.com>
gdb/testsuite/
* gdb.base/func-ptrs.c: New file.
* gdb.base/func-ptrs.exp: New file.
2014-12-12 14:31:53 +01:00
|
|
|
int
|
|
|
|
gdbarch_elf_make_msymbol_special_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->elf_make_msymbol_special != NULL;
|
|
|
|
}
|
|
|
|
|
2002-02-06 02:20:23 +01:00
|
|
|
void
|
|
|
|
gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, asymbol *sym, struct minimal_symbol *msym)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->elf_make_msymbol_special != NULL);
|
2002-02-06 02:20:23 +01:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_elf_make_msymbol_special called\n");
|
|
|
|
gdbarch->elf_make_msymbol_special (sym, msym);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_elf_make_msymbol_special_ftype elf_make_msymbol_special)
|
|
|
|
{
|
|
|
|
gdbarch->elf_make_msymbol_special = elf_make_msymbol_special;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, int val, struct minimal_symbol *msym)
|
|
|
|
{
|
2002-05-03 23:05:36 +02:00
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->coff_make_msymbol_special != NULL);
|
2002-02-06 02:20:23 +01:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_coff_make_msymbol_special called\n");
|
|
|
|
gdbarch->coff_make_msymbol_special (val, msym);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_coff_make_msymbol_special_ftype coff_make_msymbol_special)
|
|
|
|
{
|
|
|
|
gdbarch->coff_make_msymbol_special = coff_make_msymbol_special;
|
|
|
|
}
|
|
|
|
|
MIPS: Keep the ISA bit in compressed code addresses
1. Background information
The MIPS architecture, as originally designed and implemented in
mid-1980s has a uniform instruction word size that is 4 bytes, naturally
aligned. As such all MIPS instructions are located at addresses that
have their bits #1 and #0 set to zeroes, and any attempt to execute an
instruction from an address that has any of the two bits set to one
causes an address error exception. This may for example happen when a
jump-register instruction is executed whose register value used as the
jump target has any of these bits set.
Then in mid 1990s LSI sought a way to improve code density for their
TinyRISC family of MIPS cores and invented an alternatively encoded
instruction set in a joint effort with MIPS Technologies (then a
subsidiary of SGI). The new instruction set has been named the MIPS16
ASE (Application-Specific Extension) and uses a variable instruction
word size, which is 2 bytes (as the name of the ASE suggests) for most,
but there are a couple of exceptions that take 4 bytes, and then most of
the 2-byte instructions can be treated with a 2-byte extension prefix to
expand the range of the immediate operands used.
As a result instructions are no longer 4-byte aligned, instead they are
aligned to a multiple of 2. That left the bit #0 still unused for code
references, be it for the standard MIPS (i.e. as originally invented) or
for the MIPS16 instruction set, and based on that observation a clever
trick was invented that on one hand allowed the processor to be
seamlessly switched between the two instruction sets at any time at the
run time while on the other avoided the introduction of any special
control register to do that.
So it is the bit #0 of the instruction address that was chosen as the
selector and named the ISA bit. Any instruction executed at an even
address is interpreted as a standard MIPS instruction (the address still
has to have its bit #1 clear), any instruction executed at an odd
address is interpreted as a MIPS16 instruction.
To switch between modes ordinary jump instructions are used, such as
used for function calls and returns, specifically the bit #0 of the
source register used in jump-register instructions selects the execution
(ISA) mode for the following piece of code to be interpreted in.
Additionally new jump-immediate instructions were added that flipped the
ISA bit to select the opposite mode upon execution. They were
considered necessary to avoid the need to make register jumps in all
cases as the original jump-immediate instructions provided no way to
change the bit #0 at all.
This was all important for cases where standard MIPS and MIPS16 code had
to be mixed, either for compatibility with the existing binary code base
or to access resources not reachable from MIPS16 code (the MIPS16
instruction set only provides access to general-purpose registers, and
not for example floating-point unit registers or privileged coprocessor
0 registers) -- pieces of code in the opposite mode can be executed as
ordinary subroutine calls.
A similar approach has been more recently adopted for the MIPS16
replacement instruction set defined as the so called microMIPS ASE.
This is another instruction set encoding introduced to the MIPS
architecture. Just like the MIPS16 ASE, the microMIPS instruction set
uses a variable-length encoding, where each instruction takes a multiple
of 2 bytes. The ISA bit has been reused and for microMIPS-capable
processors selects between the standard MIPS and the microMIPS mode
instead.
2. Statement of the problem
To put it shortly, MIPS16 and microMIPS code pointers used by GDB are
different to these observed at the run time. This results in the same
expressions being evaluated producing different results in GDB and in
the program being debugged. Obviously it's the results obtained at the
run time that are correct (they define how the program behaves) and
therefore by definition the results obtained in GDB are incorrect.
A bit longer description will record that obviously at the run time the
ISA bit has to be set correctly (refer to background information above
if unsure why so) or the program will not run as expected. This is
recorded in all the executable file structures used at the run time: the
dynamic symbol table (but not always the static one!), the GOT, and
obviously in all the addresses embedded in code or data of the program
itself, calculated by applying the appropriate relocations at the static
link time.
While a program is being processed by GDB, the ISA bit is stripped off
from any code addresses, presumably to make them the same as the
respective raw memory byte address used by the processor to access the
instruction in the instruction fetch access cycle. This stripping is
actually performed outside GDB proper, in BFD, specifically
_bfd_mips_elf_symbol_processing (elfxx-mips.c, see the piece of code at
the very bottom of that function, starting with an: "If this is an
odd-valued function symbol, assume it's a MIPS16 or microMIPS one."
comment).
This function is also responsible for symbol table dumps made by
`objdump' too, so you'll never see the ISA bit reported there by that
tool, you need to use `readelf'.
This is however unlike what is ever done at the run time, the ISA bit
once present is never stripped off, for example a cast like this:
(short *) main
will not strip the ISA bit off and if the resulting pointer is intended
to be used to access instructions as data, for example for software
instruction decoding (like for fault recovery or emulation in a signal
handler) or for self-modifying code then the bit still has to be
stripped off by an explicit AND operation.
This is probably best illustrated with a simple real program example.
Let's consider the following simple program:
$ cat foobar.c
int __attribute__ ((mips16)) foo (void)
{
return 1;
}
int __attribute__ ((mips16)) bar (void)
{
return 2;
}
int __attribute__ ((nomips16)) foo32 (void)
{
return 3;
}
int (*foo32p) (void) = foo32;
int (*foop) (void) = foo;
int fooi = (int) foo;
int
main (void)
{
return foop ();
}
$
This is plain C with no odd tricks, except from the instruction mode
attributes. They are not necessary to trigger this problem, I just put
them here so that the program can be contained in a single source file
and to make it obvious which function is MIPS16 code and which is not.
Let's try it with Linux, so that everyone can repeat this experiment:
$ mips-linux-gnu-gcc -mips16 -g -O2 -o foobar foobar.c
$
Let's have a look at some interesting symbols:
$ mips-linux-gnu-readelf -s foobar | egrep 'table|foo|bar'
Symbol table '.dynsym' contains 7 entries:
Symbol table '.symtab' contains 95 entries:
55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c
66: 0040068c 4 FUNC GLOBAL DEFAULT [MIPS16] 12 bar
68: 00410848 4 OBJECT GLOBAL DEFAULT 21 foo32p
70: 00410844 4 OBJECT GLOBAL DEFAULT 21 foop
78: 00400684 8 FUNC GLOBAL DEFAULT 12 foo32
80: 00400680 4 FUNC GLOBAL DEFAULT [MIPS16] 12 foo
88: 00410840 4 OBJECT GLOBAL DEFAULT 21 fooi
$
Hmm, no sight of the ISA bit, but notice how foo and bar (but not
foo32!) have been marked as MIPS16 functions (ELF symbol structure's
`st_other' field is used for that).
So let's try to run and poke at this program with GDB. I'll be using a
native system for simplicity (I'll be using ellipses here and there to
remove unrelated clutter):
$ ./foobar
$ echo $?
1
$
So far, so good.
$ gdb ./foobar
[...]
(gdb) break main
Breakpoint 1 at 0x400490: file foobar.c, line 23.
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb)
Yay, it worked! OK, so let's poke at it:
(gdb) print main
$1 = {int (void)} 0x400490 <main>
(gdb) print foo32
$2 = {int (void)} 0x400684 <foo32>
(gdb) print foo32p
$3 = (int (*)(void)) 0x400684 <foo32>
(gdb) print bar
$4 = {int (void)} 0x40068c <bar>
(gdb) print foo
$5 = {int (void)} 0x400680 <foo>
(gdb) print foop
$6 = (int (*)(void)) 0x400681 <foo>
(gdb)
A-ha! Here's the difference and finally the ISA bit!
(gdb) print /x fooi
$7 = 0x400681
(gdb) p/x $pc
p/x $pc
$8 = 0x400491
(gdb)
And here as well...
(gdb) advance foo
foo () at foobar.c:4
4 }
(gdb) disassemble
Dump of assembler code for function foo:
0x00400680 <+0>: jr ra
0x00400682 <+2>: li v0,1
End of assembler dump.
(gdb) finish
Run till exit from #0 foo () at foobar.c:4
main () at foobar.c:24
24 }
Value returned is $9 = 1
(gdb) continue
Continuing.
[Inferior 1 (process 14103) exited with code 01]
(gdb)
So let's be a bit inquisitive...
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb)
Actually we do not like to run foo here at all. Let's run bar instead!
(gdb) set foop = bar
(gdb) print foop
$10 = (int (*)(void)) 0x40068c <bar>
(gdb)
Hmm, no ISA bit. Is it going to work?
(gdb) advance bar
bar () at foobar.c:9
9 }
(gdb) p/x $pc
$11 = 0x40068c
(gdb) disassemble
Dump of assembler code for function bar:
=> 0x0040068c <+0>: jr ra
0x0040068e <+2>: li v0,2
End of assembler dump.
(gdb) finish
Run till exit from #0 bar () at foobar.c:9
Program received signal SIGILL, Illegal instruction.
bar () at foobar.c:9
9 }
(gdb)
Oops!
(gdb) p/x $pc
$12 = 0x40068c
(gdb)
We're still there!
(gdb) continue
Continuing.
Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb)
So let's try something else:
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) set foop = foo
(gdb) advance foo
foo () at foobar.c:4
4 }
(gdb) disassemble
Dump of assembler code for function foo:
=> 0x00400680 <+0>: jr ra
0x00400682 <+2>: li v0,1
End of assembler dump.
(gdb) finish
Run till exit from #0 foo () at foobar.c:4
Program received signal SIGILL, Illegal instruction.
foo () at foobar.c:4
4 }
(gdb) continue
Continuing.
Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb)
The same problem!
(gdb) run
Starting program:
/net/build2-lucid-cs/scratch/macro/mips-linux-fsf-gcc/isa-bit/foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) set foop = foo32
(gdb) advance foo32
foo32 () at foobar.c:14
14 }
(gdb) disassemble
Dump of assembler code for function foo32:
=> 0x00400684 <+0>: jr ra
0x00400688 <+4>: li v0,3
End of assembler dump.
(gdb) finish
Run till exit from #0 foo32 () at foobar.c:14
main () at foobar.c:24
24 }
Value returned is $14 = 3
(gdb) continue
Continuing.
[Inferior 1 (process 14113) exited with code 03]
(gdb)
That did work though, so it's the ISA bit only!
(gdb) quit
Enough!
That's the tip of the iceberg only though. So let's rebuild the
executable with some dynamic symbols:
$ mips-linux-gnu-gcc -mips16 -Wl,--export-dynamic -g -O2 -o foobar-dyn foobar.c
$ mips-linux-gnu-readelf -s foobar-dyn | egrep 'table|foo|bar'
Symbol table '.dynsym' contains 32 entries:
6: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar
8: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p
9: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop
15: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32
17: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo
25: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi
Symbol table '.symtab' contains 95 entries:
55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c
69: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar
71: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p
72: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop
79: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32
81: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo
89: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi
$
OK, now the ISA bit is there for a change, but the MIPS16 `st_other'
attribute gone, hmm... What does `objdump' do then:
$ mips-linux-gnu-objdump -Tt foobar-dyn | egrep 'SYMBOL|foo|bar'
foobar-dyn: file format elf32-tradbigmips
SYMBOL TABLE:
00000000 l df *ABS* 00000000 foobar.c
004009cc g F .text 00000004 0xf0 bar
00410b88 g O .data 00000004 foo32p
00410b84 g O .data 00000004 foop
004009c4 g F .text 00000008 foo32
004009c0 g F .text 00000004 0xf0 foo
00410b80 g O .data 00000004 fooi
DYNAMIC SYMBOL TABLE:
004009cc g DF .text 00000004 Base 0xf0 bar
00410b88 g DO .data 00000004 Base foo32p
00410b84 g DO .data 00000004 Base foop
004009c4 g DF .text 00000008 Base foo32
004009c0 g DF .text 00000004 Base 0xf0 foo
00410b80 g DO .data 00000004 Base fooi
$
Hmm, the attribute (0xf0, printed raw) is back, and the ISA bit gone
again.
Let's have a look at some DWARF-2 records GDB uses (I'll be stripping
off a lot here for brevity) -- debug info:
$ mips-linux-gnu-readelf -wi foobar
Contents of the .debug_info section:
[...]
Compilation Unit @ offset 0x88:
Length: 0xbb (32-bit)
Version: 4
Abbrev Offset: 62
Pointer Size: 4
<0><93>: Abbrev Number: 1 (DW_TAG_compile_unit)
<94> DW_AT_producer : (indirect string, offset: 0x19e): GNU C 4.8.0 20120513 (experimental) -meb -mips16 -march=mips32r2 -mhard-float -mllsc -mplt -mno-synci -mno-shared -mabi=32 -g -O2
<98> DW_AT_language : 1 (ANSI C)
<99> DW_AT_name : (indirect string, offset: 0x190): foobar.c
<9d> DW_AT_comp_dir : (indirect string, offset: 0x225): [...]
<a1> DW_AT_ranges : 0x0
<a5> DW_AT_low_pc : 0x0
<a9> DW_AT_stmt_list : 0x27
<1><ad>: Abbrev Number: 2 (DW_TAG_subprogram)
<ae> DW_AT_external : 1
<ae> DW_AT_name : foo
<b2> DW_AT_decl_file : 1
<b3> DW_AT_decl_line : 1
<b4> DW_AT_prototyped : 1
<b4> DW_AT_type : <0xc2>
<b8> DW_AT_low_pc : 0x400680
<bc> DW_AT_high_pc : 0x400684
<c0> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<c2> DW_AT_GNU_all_call_sites: 1
<1><c2>: Abbrev Number: 3 (DW_TAG_base_type)
<c3> DW_AT_byte_size : 4
<c4> DW_AT_encoding : 5 (signed)
<c5> DW_AT_name : int
<1><c9>: Abbrev Number: 4 (DW_TAG_subprogram)
<ca> DW_AT_external : 1
<ca> DW_AT_name : (indirect string, offset: 0x18a): foo32
<ce> DW_AT_decl_file : 1
<cf> DW_AT_decl_line : 11
<d0> DW_AT_prototyped : 1
<d0> DW_AT_type : <0xc2>
<d4> DW_AT_low_pc : 0x400684
<d8> DW_AT_high_pc : 0x40068c
<dc> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<de> DW_AT_GNU_all_call_sites: 1
<1><de>: Abbrev Number: 2 (DW_TAG_subprogram)
<df> DW_AT_external : 1
<df> DW_AT_name : bar
<e3> DW_AT_decl_file : 1
<e4> DW_AT_decl_line : 6
<e5> DW_AT_prototyped : 1
<e5> DW_AT_type : <0xc2>
<e9> DW_AT_low_pc : 0x40068c
<ed> DW_AT_high_pc : 0x400690
<f1> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<f3> DW_AT_GNU_all_call_sites: 1
<1><f3>: Abbrev Number: 5 (DW_TAG_subprogram)
<f4> DW_AT_external : 1
<f4> DW_AT_name : (indirect string, offset: 0x199): main
<f8> DW_AT_decl_file : 1
<f9> DW_AT_decl_line : 21
<fa> DW_AT_prototyped : 1
<fa> DW_AT_type : <0xc2>
<fe> DW_AT_low_pc : 0x400490
<102> DW_AT_high_pc : 0x4004a4
<106> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<108> DW_AT_GNU_all_tail_call_sites: 1
[...]
$
-- no sign of the ISA bit anywhere -- frame info:
$ mips-linux-gnu-readelf -wf foobar
[...]
Contents of the .debug_frame section:
00000000 0000000c ffffffff CIE
Version: 1
Augmentation: ""
Code alignment factor: 1
Data alignment factor: -4
Return address column: 31
DW_CFA_def_cfa_register: r29
DW_CFA_nop
00000010 0000000c 00000000 FDE cie=00000000 pc=00400680..00400684
00000020 0000000c 00000000 FDE cie=00000000 pc=00400684..0040068c
00000030 0000000c 00000000 FDE cie=00000000 pc=0040068c..00400690
00000040 00000018 00000000 FDE cie=00000000 pc=00400490..004004a4
DW_CFA_advance_loc: 6 to 00400496
DW_CFA_def_cfa_offset: 32
DW_CFA_offset: r31 at cfa-4
DW_CFA_advance_loc: 6 to 0040049c
DW_CFA_restore: r31
DW_CFA_def_cfa_offset: 0
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
[...]
$
-- no sign of the ISA bit anywhere -- range info (GDB doesn't use arange):
$ mips-linux-gnu-readelf -wR foobar
Contents of the .debug_ranges section:
Offset Begin End
00000000 00400680 00400690
00000000 00400490 004004a4
00000000 <End of list>
$
-- no sign of the ISA bit anywhere -- line info:
$ mips-linux-gnu-readelf -wl foobar
Raw dump of debug contents of section .debug_line:
[...]
Offset: 0x27
Length: 78
DWARF Version: 2
Prologue Length: 31
Minimum Instruction Length: 1
Initial value of 'is_stmt': 1
Line Base: -5
Line Range: 14
Opcode Base: 13
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 args
Opcode 3 has 1 args
Opcode 4 has 1 args
Opcode 5 has 1 args
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 args
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 args
The Directory Table is empty.
The File Name Table:
Entry Dir Time Size Name
1 0 0 0 foobar.c
Line Number Statements:
Extended opcode 2: set Address to 0x400681
Special opcode 6: advance Address by 0 to 0x400681 and Line by 1 to 2
Special opcode 7: advance Address by 0 to 0x400681 and Line by 2 to 4
Special opcode 55: advance Address by 3 to 0x400684 and Line by 8 to 12
Special opcode 7: advance Address by 0 to 0x400684 and Line by 2 to 14
Advance Line by -7 to 7
Special opcode 131: advance Address by 9 to 0x40068d and Line by 0 to 7
Special opcode 7: advance Address by 0 to 0x40068d and Line by 2 to 9
Advance PC by 3 to 0x400690
Extended opcode 1: End of Sequence
Extended opcode 2: set Address to 0x400491
Advance Line by 21 to 22
Copy
Special opcode 6: advance Address by 0 to 0x400491 and Line by 1 to 23
Special opcode 60: advance Address by 4 to 0x400495 and Line by -1 to 22
Special opcode 34: advance Address by 2 to 0x400497 and Line by 1 to 23
Special opcode 62: advance Address by 4 to 0x40049b and Line by 1 to 24
Special opcode 32: advance Address by 2 to 0x40049d and Line by -1 to 23
Special opcode 6: advance Address by 0 to 0x40049d and Line by 1 to 24
Advance PC by 7 to 0x4004a4
Extended opcode 1: End of Sequence
[...]
-- a-ha, the ISA bit is there! However it's not always right for some
reason, I don't have a small test case to show it, but here's an excerpt
from MIPS16 libc, a prologue of a function:
00019630 <__libc_init_first>:
19630: e8a0 jrc ra
19632: 6500 nop
00019634 <_init>:
19634: f000 6a11 li v0,17
19638: f7d8 0b08 la v1,15e00 <_DYNAMIC+0x15c54>
1963c: f400 3240 sll v0,16
19640: e269 addu v0,v1
19642: 659a move gp,v0
19644: 64f6 save 48,ra,s0-s1
19646: 671c move s0,gp
19648: d204 sw v0,16(sp)
1964a: f352 984c lw v0,-27828(s0)
1964e: 6724 move s1,a0
and the corresponding DWARF-2 line info:
Line Number Statements:
Extended opcode 2: set Address to 0x19631
Advance Line by 44 to 45
Copy
Special opcode 8: advance Address by 0 to 0x19631 and Line by 3 to 48
Special opcode 66: advance Address by 4 to 0x19635 and Line by 5 to 53
Advance PC by constant 17 to 0x19646
Special opcode 25: advance Address by 1 to 0x19647 and Line by 6 to 59
Advance Line by -6 to 53
Special opcode 33: advance Address by 2 to 0x19649 and Line by 0 to 53
Special opcode 39: advance Address by 2 to 0x1964b and Line by 6 to 59
Advance Line by -6 to 53
Special opcode 61: advance Address by 4 to 0x1964f and Line by 0 to 53
-- see that "Advance PC by constant 17" there? It clears the ISA bit,
however code at 0x19646 is not standard MIPS code at all. For some
reason the constant is always 17, I've never seen DW_LNS_const_add_pc
used with any other value -- is that a binutils bug or what?
3. Solution:
I think we should retain the value of the ISA bit in code references,
that is effectively treat them as cookies as they indeed are (although
trivially calculated) rather than raw memory byte addresses.
In a perfect world both the static symbol table and the respective
DWARF-2 records should be fixed to include the ISA bit in all the cases.
I think however that this is infeasible.
All the uses of `_bfd_mips_elf_symbol_processing' can not necessarily be
tracked down. This function is used by `elf_slurp_symbol_table' that in
turn is used by `bfd_canonicalize_symtab' and
`bfd_canonicalize_dynamic_symtab', which are public interfaces.
Similarly DWARF-2 records are used outside GDB, one notable if a bit
questionable is the exception unwinder (libgcc/unwind-dw2.c) -- I have
identified at least bits in `execute_cfa_program' and
`uw_frame_state_for', both around the calls to `_Unwind_IsSignalFrame',
that would need an update as they effectively flip the ISA bit freely;
see also the comment about MASK_RETURN_ADDR in gcc/config/mips/mips.h.
But there may be more places. Any change in how DWARF-2 records are
produced would require an update there and would cause compatibility
problems with libgcc.a binaries already distributed; given that this is
a static library a complex change involving function renames would
likely be required.
I propose therefore to accept the existing inconsistencies and deal with
them entirely within GDB. I have figured out that the ISA bit lost in
various places can still be recovered as long as we have symbol
information -- that'll have the `st_other' attribute correctly set to
one of standard MIPS/MIPS16/microMIPS encoding.
Here's the resulting change. It adds a couple of new `gdbarch' hooks,
one to update symbol information with the ISA bit lost in
`_bfd_mips_elf_symbol_processing', and two other ones to adjust DWARF-2
records as they're processed. The ISA bit is set in each address
handled according to information retrieved from the symbol table for the
symbol spanning the address if any; limits are adjusted based on the
address they point to related to the respective base address.
Additionally minimal symbol information has to be adjusted accordingly
in its gdbarch hook.
With these changes in place some complications with ISA bit juggling in
the PC that never fully worked can be removed from the MIPS backend.
Conversely, the generic dynamic linker event special breakpoint symbol
handler has to be updated to call the minimal symbol gdbarch hook to
record that the symbol is a MIPS16 or microMIPS address if applicable or
the breakpoint will be set at the wrong address and either fail to work
or cause SIGTRAPs (this is because the symbol is handled early on and
bypasses regular symbol processing).
4. Results obtained
The change fixes the example above -- to repeat only the crucial steps:
(gdb) break main
Breakpoint 1 at 0x400491: file foobar.c, line 23.
(gdb) run
Starting program: .../foobar
Breakpoint 1, main () at foobar.c:23
23 return foop ();
(gdb) print foo
$1 = {int (void)} 0x400681 <foo>
(gdb) set foop = bar
(gdb) advance bar
bar () at foobar.c:9
9 }
(gdb) disassemble
Dump of assembler code for function bar:
=> 0x0040068d <+0>: jr ra
0x0040068f <+2>: li v0,2
End of assembler dump.
(gdb) finish
Run till exit from #0 bar () at foobar.c:9
main () at foobar.c:24
24 }
Value returned is $2 = 2
(gdb) continue
Continuing.
[Inferior 1 (process 14128) exited with code 02]
(gdb)
-- excellent!
The change removes about 90 failures per MIPS16 multilib in mips-sde-elf
testing too, results for MIPS16 are now similar to that for standard
MIPS; microMIPS results are a bit worse because of host-I/O problems in
QEMU used instead of MIPSsim for microMIPS testing only:
=== gdb Summary ===
# of expected passes 14299
# of unexpected failures 187
# of expected failures 56
# of known failures 58
# of unresolved testcases 11
# of untested testcases 52
# of unsupported tests 174
MIPS16:
=== gdb Summary ===
# of expected passes 14298
# of unexpected failures 187
# of unexpected successes 2
# of expected failures 54
# of known failures 58
# of unresolved testcases 12
# of untested testcases 52
# of unsupported tests 174
microMIPS:
=== gdb Summary ===
# of expected passes 14149
# of unexpected failures 201
# of unexpected successes 2
# of expected failures 54
# of known failures 58
# of unresolved testcases 7
# of untested testcases 53
# of unsupported tests 175
2014-12-12 Maciej W. Rozycki <macro@codesourcery.com>
Maciej W. Rozycki <macro@mips.com>
Pedro Alves <pedro@codesourcery.com>
gdb/
* gdbarch.sh (elf_make_msymbol_special): Change type to `F',
remove `predefault' and `invalid_p' initializers.
(make_symbol_special): New architecture method.
(adjust_dwarf2_addr, adjust_dwarf2_line): Likewise.
(objfile, symbol): New declarations.
* arch-utils.h (default_elf_make_msymbol_special): Remove
prototype.
(default_make_symbol_special): New prototype.
(default_adjust_dwarf2_addr): Likewise.
(default_adjust_dwarf2_line): Likewise.
* mips-tdep.h (mips_unmake_compact_addr): New prototype.
* arch-utils.c (default_elf_make_msymbol_special): Remove
function.
(default_make_symbol_special): New function.
(default_adjust_dwarf2_addr): Likewise.
(default_adjust_dwarf2_line): Likewise.
* dwarf2-frame.c (decode_frame_entry_1): Call
`gdbarch_adjust_dwarf2_addr'.
* dwarf2loc.c (dwarf2_find_location_expression): Likewise.
* dwarf2read.c (create_addrmap_from_index): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(add_partial_symbol): Likewise.
(add_partial_subprogram): Likewise.
(process_full_comp_unit): Likewise.
(read_file_scope): Likewise.
(read_func_scope): Likewise. Call `gdbarch_make_symbol_special'.
(read_lexical_block_scope): Call `gdbarch_adjust_dwarf2_addr'.
(read_call_site_scope): Likewise.
(dwarf2_ranges_read): Likewise.
(dwarf2_record_block_ranges): Likewise.
(read_attribute_value): Likewise.
(dwarf_decode_lines_1): Call `gdbarch_adjust_dwarf2_line'.
(new_symbol_full): Call `gdbarch_adjust_dwarf2_addr'.
* elfread.c (elf_symtab_read): Don't call
`gdbarch_elf_make_msymbol_special' if unset.
* mips-linux-tdep.c (micromips_linux_sigframe_validate): Strip
the ISA bit from the PC.
* mips-tdep.c (mips_unmake_compact_addr): New function.
(mips_elf_make_msymbol_special): Set the ISA bit in the symbol's
address appropriately.
(mips_make_symbol_special): New function.
(mips_pc_is_mips): Set the ISA bit before symbol lookup.
(mips_pc_is_mips16): Likewise.
(mips_pc_is_micromips): Likewise.
(mips_pc_isa): Likewise.
(mips_adjust_dwarf2_addr): New function.
(mips_adjust_dwarf2_line): Likewise.
(mips_read_pc, mips_unwind_pc): Keep the ISA bit.
(mips_addr_bits_remove): Likewise.
(mips_skip_trampoline_code): Likewise.
(mips_write_pc): Don't set the ISA bit.
(mips_eabi_push_dummy_call): Likewise.
(mips_o64_push_dummy_call): Likewise.
(mips_gdbarch_init): Install `mips_make_symbol_special',
`mips_adjust_dwarf2_addr' and `mips_adjust_dwarf2_line' gdbarch
handlers.
* solib.c (gdb_bfd_lookup_symbol_from_symtab): Get
target-specific symbol address adjustments.
* gdbarch.h: Regenerate.
* gdbarch.c: Regenerate.
2014-12-12 Maciej W. Rozycki <macro@codesourcery.com>
gdb/testsuite/
* gdb.base/func-ptrs.c: New file.
* gdb.base/func-ptrs.exp: New file.
2014-12-12 14:31:53 +01:00
|
|
|
void
|
|
|
|
gdbarch_make_symbol_special (struct gdbarch *gdbarch, struct symbol *sym, struct objfile *objfile)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->make_symbol_special != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_make_symbol_special called\n");
|
|
|
|
gdbarch->make_symbol_special (sym, objfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_make_symbol_special (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_make_symbol_special_ftype make_symbol_special)
|
|
|
|
{
|
|
|
|
gdbarch->make_symbol_special = make_symbol_special;
|
|
|
|
}
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
gdbarch_adjust_dwarf2_addr (struct gdbarch *gdbarch, CORE_ADDR pc)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->adjust_dwarf2_addr != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_adjust_dwarf2_addr called\n");
|
|
|
|
return gdbarch->adjust_dwarf2_addr (pc);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_adjust_dwarf2_addr (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_adjust_dwarf2_addr_ftype adjust_dwarf2_addr)
|
|
|
|
{
|
|
|
|
gdbarch->adjust_dwarf2_addr = adjust_dwarf2_addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
gdbarch_adjust_dwarf2_line (struct gdbarch *gdbarch, CORE_ADDR addr, int rel)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->adjust_dwarf2_line != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_adjust_dwarf2_line called\n");
|
|
|
|
return gdbarch->adjust_dwarf2_line (addr, rel);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_adjust_dwarf2_line (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_adjust_dwarf2_line_ftype adjust_dwarf2_line)
|
|
|
|
{
|
|
|
|
gdbarch->adjust_dwarf2_line = adjust_dwarf2_line;
|
|
|
|
}
|
|
|
|
|
2002-10-03 01:28:54 +02:00
|
|
|
int
|
|
|
|
gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of cannot_step_breakpoint, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_cannot_step_breakpoint called\n");
|
|
|
|
return gdbarch->cannot_step_breakpoint;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch,
|
|
|
|
int cannot_step_breakpoint)
|
|
|
|
{
|
|
|
|
gdbarch->cannot_step_breakpoint = cannot_step_breakpoint;
|
|
|
|
}
|
|
|
|
|
2002-10-09 13:59:54 +02:00
|
|
|
int
|
|
|
|
gdbarch_have_nonsteppable_watchpoint (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of have_nonsteppable_watchpoint, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_have_nonsteppable_watchpoint called\n");
|
|
|
|
return gdbarch->have_nonsteppable_watchpoint;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_have_nonsteppable_watchpoint (struct gdbarch *gdbarch,
|
2002-10-10 09:41:37 +02:00
|
|
|
int have_nonsteppable_watchpoint)
|
2002-10-09 13:59:54 +02:00
|
|
|
{
|
|
|
|
gdbarch->have_nonsteppable_watchpoint = have_nonsteppable_watchpoint;
|
|
|
|
}
|
|
|
|
|
2002-10-16 22:50:22 +02:00
|
|
|
int
|
|
|
|
gdbarch_address_class_type_flags_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
return gdbarch->address_class_type_flags != NULL;
|
2002-10-16 22:50:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_address_class_type_flags (struct gdbarch *gdbarch, int byte_size, int dwarf2_addr_class)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->address_class_type_flags != NULL);
|
2002-10-16 22:50:22 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_address_class_type_flags called\n");
|
|
|
|
return gdbarch->address_class_type_flags (byte_size, dwarf2_addr_class);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_address_class_type_flags (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_address_class_type_flags_ftype address_class_type_flags)
|
|
|
|
{
|
|
|
|
gdbarch->address_class_type_flags = address_class_type_flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_address_class_type_flags_to_name_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
return gdbarch->address_class_type_flags_to_name != NULL;
|
2002-10-16 22:50:22 +02:00
|
|
|
}
|
|
|
|
|
2002-12-11 21:19:39 +01:00
|
|
|
const char *
|
2002-10-16 22:50:22 +02:00
|
|
|
gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->address_class_type_flags_to_name != NULL);
|
2002-10-16 22:50:22 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_address_class_type_flags_to_name called\n");
|
2002-10-25 17:59:56 +02:00
|
|
|
return gdbarch->address_class_type_flags_to_name (gdbarch, type_flags);
|
2002-10-16 22:50:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_address_class_type_flags_to_name_ftype address_class_type_flags_to_name)
|
|
|
|
{
|
|
|
|
gdbarch->address_class_type_flags_to_name = address_class_type_flags_to_name;
|
|
|
|
}
|
|
|
|
|
2017-04-26 15:05:03 +02:00
|
|
|
bool
|
|
|
|
gdbarch_execute_dwarf_cfa_vendor_op (struct gdbarch *gdbarch, gdb_byte op, struct dwarf2_frame_state *fs)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->execute_dwarf_cfa_vendor_op != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_execute_dwarf_cfa_vendor_op called\n");
|
|
|
|
return gdbarch->execute_dwarf_cfa_vendor_op (gdbarch, op, fs);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_execute_dwarf_cfa_vendor_op (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_execute_dwarf_cfa_vendor_op_ftype execute_dwarf_cfa_vendor_op)
|
|
|
|
{
|
|
|
|
gdbarch->execute_dwarf_cfa_vendor_op = execute_dwarf_cfa_vendor_op;
|
|
|
|
}
|
|
|
|
|
2002-10-16 22:50:22 +02:00
|
|
|
int
|
|
|
|
gdbarch_address_class_name_to_type_flags_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
return gdbarch->address_class_name_to_type_flags != NULL;
|
2002-10-16 22:50:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2002-12-11 21:19:39 +01:00
|
|
|
gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name, int *type_flags_ptr)
|
2002-10-16 22:50:22 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->address_class_name_to_type_flags != NULL);
|
2002-10-16 22:50:22 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_address_class_name_to_type_flags called\n");
|
2002-10-25 17:59:56 +02:00
|
|
|
return gdbarch->address_class_name_to_type_flags (gdbarch, name, type_flags_ptr);
|
2002-10-16 22:50:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_address_class_name_to_type_flags_ftype address_class_name_to_type_flags)
|
|
|
|
{
|
|
|
|
gdbarch->address_class_name_to_type_flags = address_class_name_to_type_flags;
|
|
|
|
}
|
|
|
|
|
2002-11-02 16:13:34 +01:00
|
|
|
int
|
|
|
|
gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->register_reggroup_p != NULL);
|
2002-11-02 16:13:34 +01:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_register_reggroup_p called\n");
|
|
|
|
return gdbarch->register_reggroup_p (gdbarch, regnum, reggroup);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_register_reggroup_p (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_register_reggroup_p_ftype register_reggroup_p)
|
|
|
|
{
|
|
|
|
gdbarch->register_reggroup_p = register_reggroup_p;
|
|
|
|
}
|
|
|
|
|
2003-06-02 04:54:35 +02:00
|
|
|
int
|
|
|
|
gdbarch_fetch_pointer_argument_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
return gdbarch->fetch_pointer_argument != NULL;
|
2003-06-02 04:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, struct frame_info *frame, int argi, struct type *type)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2003-07-11 00:01:14 +02:00
|
|
|
gdb_assert (gdbarch->fetch_pointer_argument != NULL);
|
2003-06-02 04:54:35 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_fetch_pointer_argument called\n");
|
|
|
|
return gdbarch->fetch_pointer_argument (frame, argi, type);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_fetch_pointer_argument_ftype fetch_pointer_argument)
|
|
|
|
{
|
|
|
|
gdbarch->fetch_pointer_argument = fetch_pointer_argument;
|
|
|
|
}
|
|
|
|
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 17:26:43 +02:00
|
|
|
int
|
|
|
|
gdbarch_iterate_over_regset_sections_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->iterate_over_regset_sections != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdbarch_iterate_over_regset_sections (struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data, const struct regcache *regcache)
|
2008-05-24 18:32:01 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 17:26:43 +02:00
|
|
|
gdb_assert (gdbarch->iterate_over_regset_sections != NULL);
|
2008-05-24 18:32:01 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 17:26:43 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_iterate_over_regset_sections called\n");
|
|
|
|
gdbarch->iterate_over_regset_sections (gdbarch, cb, cb_data, regcache);
|
2008-05-24 18:32:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 17:26:43 +02:00
|
|
|
set_gdbarch_iterate_over_regset_sections (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_iterate_over_regset_sections_ftype iterate_over_regset_sections)
|
2008-05-24 18:32:01 +02:00
|
|
|
{
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 17:26:43 +02:00
|
|
|
gdbarch->iterate_over_regset_sections = iterate_over_regset_sections;
|
2008-05-24 18:32:01 +02:00
|
|
|
}
|
|
|
|
|
2012-01-20 10:56:56 +01:00
|
|
|
int
|
|
|
|
gdbarch_make_corefile_notes_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->make_corefile_notes != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *
|
|
|
|
gdbarch_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->make_corefile_notes != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_make_corefile_notes called\n");
|
|
|
|
return gdbarch->make_corefile_notes (gdbarch, obfd, note_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_make_corefile_notes (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_make_corefile_notes_ftype make_corefile_notes)
|
|
|
|
{
|
|
|
|
gdbarch->make_corefile_notes = make_corefile_notes;
|
|
|
|
}
|
|
|
|
|
2013-02-04 19:40:41 +01:00
|
|
|
int
|
|
|
|
gdbarch_elfcore_write_linux_prpsinfo_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->elfcore_write_linux_prpsinfo != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *
|
|
|
|
gdbarch_elfcore_write_linux_prpsinfo (struct gdbarch *gdbarch, bfd *obfd, char *note_data, int *note_size, const struct elf_internal_linux_prpsinfo *info)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->elfcore_write_linux_prpsinfo != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_elfcore_write_linux_prpsinfo called\n");
|
|
|
|
return gdbarch->elfcore_write_linux_prpsinfo (obfd, note_data, note_size, info);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_elfcore_write_linux_prpsinfo (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_elfcore_write_linux_prpsinfo_ftype elfcore_write_linux_prpsinfo)
|
|
|
|
{
|
|
|
|
gdbarch->elfcore_write_linux_prpsinfo = elfcore_write_linux_prpsinfo;
|
|
|
|
}
|
|
|
|
|
2012-01-20 10:59:15 +01:00
|
|
|
int
|
|
|
|
gdbarch_find_memory_regions_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->find_memory_regions != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_find_memory_regions (struct gdbarch *gdbarch, find_memory_region_ftype func, void *data)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->find_memory_regions != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_find_memory_regions called\n");
|
|
|
|
return gdbarch->find_memory_regions (gdbarch, func, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_find_memory_regions (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_find_memory_regions_ftype find_memory_regions)
|
|
|
|
{
|
|
|
|
gdbarch->find_memory_regions = find_memory_regions;
|
|
|
|
}
|
|
|
|
|
2007-09-04 01:06:35 +02:00
|
|
|
int
|
|
|
|
gdbarch_core_xfer_shared_libraries_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->core_xfer_shared_libraries != NULL;
|
|
|
|
}
|
|
|
|
|
2014-01-27 05:56:56 +01:00
|
|
|
ULONGEST
|
2014-01-02 08:36:55 +01:00
|
|
|
gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
|
2007-09-04 01:06:35 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->core_xfer_shared_libraries != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_core_xfer_shared_libraries called\n");
|
|
|
|
return gdbarch->core_xfer_shared_libraries (gdbarch, readbuf, offset, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_core_xfer_shared_libraries_ftype core_xfer_shared_libraries)
|
|
|
|
{
|
|
|
|
gdbarch->core_xfer_shared_libraries = core_xfer_shared_libraries;
|
|
|
|
}
|
|
|
|
|
ppc-aix core file relocation.
The current code attempts to provide relocation support when debugging
core files via the rs6000_xfer_partial method of the rs6000-nat
target_ops vector. However, this target_ops vector does not get pushed
on the target stack at all when debugging core files, thus bypassing
completely that part of the code.
This patch fixes the problem by extending corelow's core_xfer_partial
into handling the TARGET_OBJECT_LIBRARIES_AIX object.
gdb/ChangeLog:
* gdbarch.sh (core_xfer_shared_libraries_aix): New method.
* gdbarch.h, gdbarch.c: Regenerate.
* corelow.c (core_xfer_partial): Add TARGET_OBJECT_LIBRARIES_AIX
handling.
* rs6000-aix-tdep.h: New file.
* Makefile.in (HFILES_NO_SRCDIR): Add rs6000-aix-tdep.h.
* rs6000-aix-tdep.c: Include "rs6000-aix-tdep.h" and
"xml-utils.h".
(struct field_info, struct ld_info_desc): New types.
(ld_info32_desc, ld_info64_desc): New static constants.
(struct ld_info): New type.
(rs6000_aix_extract_ld_info): New function.
(rs6000_aix_shared_library_to_xml): Likewise.
(rs6000_aix_ld_info_to_xml): Likewise.
(rs6000_aix_core_xfer_shared_libraries_aix): Likewise.
(rs6000_aix_init_osabi): Add call to
set_gdbarch_core_xfer_shared_libraries_aix.
* rs6000-nat.c: Add "rs6000-aix-tdep.h" include.
Remove "xml-utils.h" include.
(LdInfo): Delete typedef.
(ARCH64_DECL, LDI_FIELD, LDI_NEXT, LDI_FD, LDI_FILENAME):
Delete macros.
(rs6000_ptrace_ldinfo): Change return type to gdb_byte *.
Adjust code accordingly.
(rs6000_core_ldinfo): Delete, folded into
rs6000_aix_core_xfer_shared_libraries_aix.
(rs6000_xfer_shared_library): Delete.
(rs6000_xfer_shared_libraries): Reimplement.
2013-05-15 14:26:14 +02:00
|
|
|
int
|
|
|
|
gdbarch_core_xfer_shared_libraries_aix_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->core_xfer_shared_libraries_aix != NULL;
|
|
|
|
}
|
|
|
|
|
2014-01-27 05:56:56 +01:00
|
|
|
ULONGEST
|
2014-01-02 08:36:55 +01:00
|
|
|
gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
|
ppc-aix core file relocation.
The current code attempts to provide relocation support when debugging
core files via the rs6000_xfer_partial method of the rs6000-nat
target_ops vector. However, this target_ops vector does not get pushed
on the target stack at all when debugging core files, thus bypassing
completely that part of the code.
This patch fixes the problem by extending corelow's core_xfer_partial
into handling the TARGET_OBJECT_LIBRARIES_AIX object.
gdb/ChangeLog:
* gdbarch.sh (core_xfer_shared_libraries_aix): New method.
* gdbarch.h, gdbarch.c: Regenerate.
* corelow.c (core_xfer_partial): Add TARGET_OBJECT_LIBRARIES_AIX
handling.
* rs6000-aix-tdep.h: New file.
* Makefile.in (HFILES_NO_SRCDIR): Add rs6000-aix-tdep.h.
* rs6000-aix-tdep.c: Include "rs6000-aix-tdep.h" and
"xml-utils.h".
(struct field_info, struct ld_info_desc): New types.
(ld_info32_desc, ld_info64_desc): New static constants.
(struct ld_info): New type.
(rs6000_aix_extract_ld_info): New function.
(rs6000_aix_shared_library_to_xml): Likewise.
(rs6000_aix_ld_info_to_xml): Likewise.
(rs6000_aix_core_xfer_shared_libraries_aix): Likewise.
(rs6000_aix_init_osabi): Add call to
set_gdbarch_core_xfer_shared_libraries_aix.
* rs6000-nat.c: Add "rs6000-aix-tdep.h" include.
Remove "xml-utils.h" include.
(LdInfo): Delete typedef.
(ARCH64_DECL, LDI_FIELD, LDI_NEXT, LDI_FD, LDI_FILENAME):
Delete macros.
(rs6000_ptrace_ldinfo): Change return type to gdb_byte *.
Adjust code accordingly.
(rs6000_core_ldinfo): Delete, folded into
rs6000_aix_core_xfer_shared_libraries_aix.
(rs6000_xfer_shared_library): Delete.
(rs6000_xfer_shared_libraries): Reimplement.
2013-05-15 14:26:14 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->core_xfer_shared_libraries_aix != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_core_xfer_shared_libraries_aix called\n");
|
|
|
|
return gdbarch->core_xfer_shared_libraries_aix (gdbarch, readbuf, offset, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_core_xfer_shared_libraries_aix_ftype core_xfer_shared_libraries_aix)
|
|
|
|
{
|
|
|
|
gdbarch->core_xfer_shared_libraries_aix = core_xfer_shared_libraries_aix;
|
|
|
|
}
|
|
|
|
|
* corelow.c (get_core_registers): Adjust.
(core_file_thread_alive): Rename to...
(core_thread_alive): ... this.
(core_pid_to_str): Try gdbarch_core_pid_to_str first.
(init_core_ops): Adjust.
(coreops_suppress_target): Delete.
(_initialize_corelow): Unconditionally add core_ops.
* procfs.c: Include "inf-child.h".
(procfs_ops): Delete.
(init_procfs_ops): Delete. Reimplement as...
(procfs_target): ... this, inheriting from inf-child.
(procfs_attach, procfs_detach, procfs_fetch_registers): Adjust.
(procfs_prepare_to_store): Delete.
(procfs_store_registers, procfs_resume): Adjust.
(procfs_open): Delete.
(procfs_suppress_run): Delete.
(procfs_can_run): Delete.
(procfs_mourn_inferior): Adjust.
(procfs_init_inferior): Add target_ops parameter. Adjust.
(procfs_create_inferior): Don't pass procfs_init_inferior to
fork_inferior. Instead call it after fork_inferior returns.
(procfs_find_new_threads): Adjust.
(_initialize_procfs): Adjust to use procfs_target instead of
init_procfs_ops.
* sol-thread.c (orig_core_ops, sol_core_ops): Delete.
(lwp_to_thread): Use target_thread_alive.
(sol_thread_open): Delete.
(sol_thread_attach): Delete.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers): Adjust
to use find_target_beneath.
(sol_thread_prepare_to_store, sol_thread_xfer_memory): Delete.
(sol_thread_xfer_partial): Adjust to use find_target_beneath.
(sol_thread_files_info, sol_thread_kill_inferior): Delete.
(check_for_thread_db): New.
(sol_thread_notice_signals, sol_thread_create_inferior): Delete.
(sol_thread_new_objfile): Call check_for_thread_db.
(sol_thread_mourn_inferior): Adjust to use find_target_beneath.
(sol_thread_can_run): Delete.
(sol_thread_alive): Adjust to use find_target_beneath.
(sol_thread_stop): Delete.
(rw_common): Use target_write_memory or target_read_memory.
(ps_lgetregs, ps_lgetfpregs): Use target_fetch_registers.
(ps_lsetregs, ps_lsetfpregs): Use target_store_registers.
(solaris_pid_to_str): Remove check for libthread_db initialization
failing.
(sol_find_new_threads): Remove check for libthread_db
initialization failing, or for an invalid inferior_ptid. Adjust
to use find_target_beneath.
(sol_core_open, sol_core_close, sol_core_detach,
sol_core_files_info, sol_find_memory_regions,
sol_make_note_section, ignore): Delete.
(init_sol_thread_ops): Make it a thread_stratum target. Remove
unneeded callback settings.
(init_sol_core_ops): Delete.
(_initialize_sol_thread): No longer call init_sol_core_ops, set
procfs_suppress_run, or hack with core_ops.
* target.h (struct target_ops): Add a target_ops * parameter to
to_resume, to_fetch_registers, to_store_registers, to_thread_alive
and to_find_new_threads.
(target_fetch_registers, target_store_registers)
(target_thread_alive, target_find_new_threads): Redeclare as
function.
* target.c (update_current_target): Do not inherit or de_fault
to_resume, to_fetch_registers, to_store_registers,
to_thread_alive, to_find_new_threads.
(target_resume): Adjust.
(target_thread_alive, target_find_new_threads): New.
(debug_to_resume, debug_to_fetch_registers): Delete.
(target_fetch_registers): New.
(debug_to_store_registers): Delete.
(target_store_registers): New.
(debug_to_thread_alive, debug_to_find_new_threads): Delete.
(setup_target_debug): Adjust.
* gdbcore.h (core_ops): Delete declaration.
* inf-ptrace.c, linux-nat.c, remote.c, amd64-linux-nat.c,
inf-child.c, linux-thread-db.c, bsd-uthread.c, inf-ttrace.c,
i386-sol2-tdep.c, darwin-nat.c, gnu-nat.c, go32-nat.c,
hpux-thread.c, i386-linux-nat.c, i386fbsd-nat.c, monitor.c,
nto-procfs.c, remote-m32r-sdi.c, remote-mips.c, windows-nat.c,
alphabsd-nat.c, amd64bsd-nat.c, arm-linux-nat.c, armnbsd-nat.c,
bsd-kvm.c, hppa-hpux-nat.c, hppa-linux-nat.c, hppabsd-nat.c,
hppanbsd-nat.c, i386-darwin-nat.c, i386bsd-nat.c,
ia64-linux-nat.c, m32r-linux-nat.c, m68kbsd-nat.c,
m68klinux-nat.c, m88kbsd-nat.c, mips-linux-nat.c,
mips64obsd-nat.c, mipsnbsd-nat.c, ppc-linux-nat.c, ppcnbsd-nat.c,
ppcobsd-nat.c, remote-sim.c, rs6000-nat.c, s390-nat.c,
shnbsd-nat.c, sparc-nat.c, sparc-nat.h, spu-linux-nat.c,
vaxbsd-nat.c, xtensa-linux-nat.c: Adjust to target_ops changes.
* gdbarch.sh (core_pid_to_str): New gdbarch callback.
* gdbarch.h, gdbarch.c: Regenerate.
* sol2-tdep.c: Include "inferior.h".
(sol2_core_pid_to_str): New.
* sol2-tdep.h (sol2_core_pid_to_str): Declare.
* amd64-sol2-tdep.c (amd64_sol2_init_abi): Set it.
* sparc-sol2-tdep.c (sparc32_sol2_init_abi): Set it.
* sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Set it.
* i386-sol2-tdep.c (i386_sol2_init_abi): Set it.
2009-02-23 01:03:50 +01:00
|
|
|
int
|
|
|
|
gdbarch_core_pid_to_str_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->core_pid_to_str != NULL;
|
|
|
|
}
|
|
|
|
|
2017-04-05 20:21:34 +02:00
|
|
|
const char *
|
* corelow.c (get_core_registers): Adjust.
(core_file_thread_alive): Rename to...
(core_thread_alive): ... this.
(core_pid_to_str): Try gdbarch_core_pid_to_str first.
(init_core_ops): Adjust.
(coreops_suppress_target): Delete.
(_initialize_corelow): Unconditionally add core_ops.
* procfs.c: Include "inf-child.h".
(procfs_ops): Delete.
(init_procfs_ops): Delete. Reimplement as...
(procfs_target): ... this, inheriting from inf-child.
(procfs_attach, procfs_detach, procfs_fetch_registers): Adjust.
(procfs_prepare_to_store): Delete.
(procfs_store_registers, procfs_resume): Adjust.
(procfs_open): Delete.
(procfs_suppress_run): Delete.
(procfs_can_run): Delete.
(procfs_mourn_inferior): Adjust.
(procfs_init_inferior): Add target_ops parameter. Adjust.
(procfs_create_inferior): Don't pass procfs_init_inferior to
fork_inferior. Instead call it after fork_inferior returns.
(procfs_find_new_threads): Adjust.
(_initialize_procfs): Adjust to use procfs_target instead of
init_procfs_ops.
* sol-thread.c (orig_core_ops, sol_core_ops): Delete.
(lwp_to_thread): Use target_thread_alive.
(sol_thread_open): Delete.
(sol_thread_attach): Delete.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers): Adjust
to use find_target_beneath.
(sol_thread_prepare_to_store, sol_thread_xfer_memory): Delete.
(sol_thread_xfer_partial): Adjust to use find_target_beneath.
(sol_thread_files_info, sol_thread_kill_inferior): Delete.
(check_for_thread_db): New.
(sol_thread_notice_signals, sol_thread_create_inferior): Delete.
(sol_thread_new_objfile): Call check_for_thread_db.
(sol_thread_mourn_inferior): Adjust to use find_target_beneath.
(sol_thread_can_run): Delete.
(sol_thread_alive): Adjust to use find_target_beneath.
(sol_thread_stop): Delete.
(rw_common): Use target_write_memory or target_read_memory.
(ps_lgetregs, ps_lgetfpregs): Use target_fetch_registers.
(ps_lsetregs, ps_lsetfpregs): Use target_store_registers.
(solaris_pid_to_str): Remove check for libthread_db initialization
failing.
(sol_find_new_threads): Remove check for libthread_db
initialization failing, or for an invalid inferior_ptid. Adjust
to use find_target_beneath.
(sol_core_open, sol_core_close, sol_core_detach,
sol_core_files_info, sol_find_memory_regions,
sol_make_note_section, ignore): Delete.
(init_sol_thread_ops): Make it a thread_stratum target. Remove
unneeded callback settings.
(init_sol_core_ops): Delete.
(_initialize_sol_thread): No longer call init_sol_core_ops, set
procfs_suppress_run, or hack with core_ops.
* target.h (struct target_ops): Add a target_ops * parameter to
to_resume, to_fetch_registers, to_store_registers, to_thread_alive
and to_find_new_threads.
(target_fetch_registers, target_store_registers)
(target_thread_alive, target_find_new_threads): Redeclare as
function.
* target.c (update_current_target): Do not inherit or de_fault
to_resume, to_fetch_registers, to_store_registers,
to_thread_alive, to_find_new_threads.
(target_resume): Adjust.
(target_thread_alive, target_find_new_threads): New.
(debug_to_resume, debug_to_fetch_registers): Delete.
(target_fetch_registers): New.
(debug_to_store_registers): Delete.
(target_store_registers): New.
(debug_to_thread_alive, debug_to_find_new_threads): Delete.
(setup_target_debug): Adjust.
* gdbcore.h (core_ops): Delete declaration.
* inf-ptrace.c, linux-nat.c, remote.c, amd64-linux-nat.c,
inf-child.c, linux-thread-db.c, bsd-uthread.c, inf-ttrace.c,
i386-sol2-tdep.c, darwin-nat.c, gnu-nat.c, go32-nat.c,
hpux-thread.c, i386-linux-nat.c, i386fbsd-nat.c, monitor.c,
nto-procfs.c, remote-m32r-sdi.c, remote-mips.c, windows-nat.c,
alphabsd-nat.c, amd64bsd-nat.c, arm-linux-nat.c, armnbsd-nat.c,
bsd-kvm.c, hppa-hpux-nat.c, hppa-linux-nat.c, hppabsd-nat.c,
hppanbsd-nat.c, i386-darwin-nat.c, i386bsd-nat.c,
ia64-linux-nat.c, m32r-linux-nat.c, m68kbsd-nat.c,
m68klinux-nat.c, m88kbsd-nat.c, mips-linux-nat.c,
mips64obsd-nat.c, mipsnbsd-nat.c, ppc-linux-nat.c, ppcnbsd-nat.c,
ppcobsd-nat.c, remote-sim.c, rs6000-nat.c, s390-nat.c,
shnbsd-nat.c, sparc-nat.c, sparc-nat.h, spu-linux-nat.c,
vaxbsd-nat.c, xtensa-linux-nat.c: Adjust to target_ops changes.
* gdbarch.sh (core_pid_to_str): New gdbarch callback.
* gdbarch.h, gdbarch.c: Regenerate.
* sol2-tdep.c: Include "inferior.h".
(sol2_core_pid_to_str): New.
* sol2-tdep.h (sol2_core_pid_to_str): Declare.
* amd64-sol2-tdep.c (amd64_sol2_init_abi): Set it.
* sparc-sol2-tdep.c (sparc32_sol2_init_abi): Set it.
* sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Set it.
* i386-sol2-tdep.c (i386_sol2_init_abi): Set it.
2009-02-23 01:03:50 +01:00
|
|
|
gdbarch_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->core_pid_to_str != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_core_pid_to_str called\n");
|
|
|
|
return gdbarch->core_pid_to_str (gdbarch, ptid);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_core_pid_to_str (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_core_pid_to_str_ftype core_pid_to_str)
|
|
|
|
{
|
|
|
|
gdbarch->core_pid_to_str = core_pid_to_str;
|
|
|
|
}
|
|
|
|
|
2016-01-18 18:49:23 +01:00
|
|
|
int
|
|
|
|
gdbarch_core_thread_name_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->core_thread_name != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
gdbarch_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->core_thread_name != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_core_thread_name called\n");
|
|
|
|
return gdbarch->core_thread_name (gdbarch, thr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_core_thread_name (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_core_thread_name_ftype core_thread_name)
|
|
|
|
{
|
|
|
|
gdbarch->core_thread_name = core_thread_name;
|
|
|
|
}
|
|
|
|
|
2009-06-17 20:48:26 +02:00
|
|
|
int
|
|
|
|
gdbarch_gcore_bfd_target_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->gcore_bfd_target != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
gdbarch_gcore_bfd_target (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Check variable changed from pre-default. */
|
|
|
|
gdb_assert (gdbarch->gcore_bfd_target != 0);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_gcore_bfd_target called\n");
|
|
|
|
return gdbarch->gcore_bfd_target;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_gcore_bfd_target (struct gdbarch *gdbarch,
|
|
|
|
const char * gcore_bfd_target)
|
|
|
|
{
|
|
|
|
gdbarch->gcore_bfd_target = gcore_bfd_target;
|
|
|
|
}
|
|
|
|
|
* NEWS: Mention pointer to member improvements.
* Makefile.in (gnu-v3-abi.o): Delete special rule.
(eval.o, gnu-v3-abi.o, ia64-tdep.o): Update.
* ada-valprint.c (ada_print_scalar): Update for new type codes.
* c-typeprint.c (c_print_type): Update for new type codes.
(c_type_print_varspec_prefix, c_type_print_varspec_suffix)
(c_type_print_base): Likewise.
(c_type_print_args): Rewrite.
* c-valprint.c (c_val_print): Update for new type codes. Remove
support for references to members. Treat methods like functions.
* cp-abi.c (cplus_print_method_ptr, cplus_method_ptr_size)
(cplus_make_method_ptr, cplus_method_ptr_to_value): New.
* cp-abi.h (cplus_print_method_ptr, cplus_method_ptr_size)
(cplus_make_method_ptr, cplus_method_ptr_to_value): New prototypes.
(struct cp_abi_ops): Add corresponding members.
* cp-valprint.c (cp_print_class_method): Delete.
(cp_find_class_member): New function.
(cp_print_class_member): Use it. Simplify support for bogus
member pointers.
* dwarf2read.c (quirk_gcc_member_function_pointer): Use
lookup_methodptr_type.
(read_tag_ptr_to_member_type): Likewise, and lookup_memberptr_type.
* eval.c (evaluate_subexp_standard): Implement EVAL_SKIP for
OP_SCOPE. Update call to value_aggregate_elt. Rewrite member
pointer support.
(evaluate_subexp_for_address): Handle OP_SCOPE explicitly. Handle
references returned by user defined operators.
* f-typeprint.c (f_print_type, f_type_print_varspec_prefix)
(f_type_print_varspec_suffix): Remove support for member pointers.
* gdbtypes.c (lookup_memberptr_type): Renamed from lookup_member_type
and adjusted.
(smash_to_memberptr_type): Likewise, from smash_to_member_type.
(lookup_methodptr_type): New.
(rank_one_type): Adjust for TYPE_CODE_MEMBERPTR.
(recursive_dump_type): Update for new types.
* gdbtypes.h (enum type_code): Replace TYPE_CODE_MEMBER with
TYPE_CODE_MEMBERPTR and TYPE_CODE_METHODPTR.
(lookup_memberptr_type, lookup_methodptr_type)
(smash_to_memberptr_type): New prototypes.
(smash_to_method_type): Formatting fix.
(lookup_member_type, smash_to_member_type): Delete prototypes.
* gnu-v3-abi.c (gnuv3_get_vtable, gnuv3_get_virtual_fn): New.
Do not rely on debug information for the vptr or the method's
enclosing type. Handle function descriptors for IA64.
(gnuv3_virtual_fn_field): Rewrite using the new functions.
(gnuv3_find_method_in, gnuv3_print_method_ptr)
(gnuv3_method_ptr_size, gnuv3_make_method_ptr)
(gnuv3_method_ptr_to_value): New.
(init_gnuv3_ops): Set new members of gnu_v3_abi_ops.
* hpread.c (hpread_type_lookup): Update for new types.
* infcall.c (value_arg_coerce): Likewise.
* m2-typeprint.c (m2_print_type): Remove explicit support
for member pointers.
* m2-valprint.c (m2_val_print): Likewise.
* p-typeprint.c (pascal_type_print_varspec_prefix)
(pascal_type_print_varspec_suffix, pascal_type_print_base): Likewise.
* p-valprint.c (pascal_val_print): Likewise.
(pascal_object_print_class_method, pascal_object_print_class_member):
Delete.
* p-lang.h (pascal_object_print_class_method)
(pascal_object_print_class_member): Delete prototypes.
* stabsread.c (read_type): Update for new types.
* typeprint.c (print_type_scalar): Likewise.
* valops.c (value_struct_elt_for_reference, value_namespace_elt)
(value_maybe_namespace_elt, value_aggregate_elt): Add want_address
argument. Construct a pointer to member if the address of a
function or data member is requested.
(value_cast_pointers): Don't modify the input value.
(value_cast): Adjust pointer to member handling for new types.
Allow null pointer to member constants. Don't modify the input
value.
(value_ind): Remove pointer to member check. Handle function
descriptors for function pointers.
(value_struct_elt, value_find_oload_method_list, check_field):
Remove pointer to member checks.
* value.c (unpack_long): Allow pointers to data members.
(value_from_longest): Allow member pointers.
* value.h (value_aggregate_elt): Add want_address.
* varobj.c (c_variable_editable): Remove check for members.
* gdbarch.sh: Add vtable_function_descriptors and vbit_in_delta.
* ia64-tdep.c (ia64_convert_from_func_ptr_addr): Handle descriptors
in virtual tables.
(ia64_gdbarch_init): Call set_gdbarch_vtable_function_descriptors.
* c-lang.h (cp_print_class_method): Delete prototype.
* arm-tdep.c (arm_gdbarch_init): Call set_gdbarch_vbit_in_delta.
* mips-tdep.c (mips_gdbarch_init): Likewise.
* gdbarch.c, gdbarch.h: Regenerated.
* gdb.cp/classes.exp (test_pointers_to_class_members): Update expected
output. Test the types of members and member pointers.
* gdb.cp/inherit.exp (test_print_mi_member_types): Remove KFAILs for
gdb/2092.
* gdb.cp/member-ptr.exp: Search for a comment instead of a
statement. Enable for GCC. Update expected output for some tests
and add new tests. Remove obsolete GCC KFAILs. Allow GCC's class
layout.
* gdb.cp/member-ptr.cc (Padding, Padding::vspacer, Base, Base::get_x)
(Base::vget_base, Left, Left::vget, Right, Right::vget, Diamond)
(Diamond::vget_base): New.
(main): Add new tests.
* gdb.cp/printmethod.exp: Update expected output for member functions.
* gdb.cp/virtfunc.exp (test_virtual_calls): Add a KFAIL for
print pEe->D::vg().
2007-01-03 19:05:45 +01:00
|
|
|
int
|
|
|
|
gdbarch_vtable_function_descriptors (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of vtable_function_descriptors, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_vtable_function_descriptors called\n");
|
|
|
|
return gdbarch->vtable_function_descriptors;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_vtable_function_descriptors (struct gdbarch *gdbarch,
|
|
|
|
int vtable_function_descriptors)
|
|
|
|
{
|
|
|
|
gdbarch->vtable_function_descriptors = vtable_function_descriptors;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_vbit_in_delta (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of vbit_in_delta, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_vbit_in_delta called\n");
|
|
|
|
return gdbarch->vbit_in_delta;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_vbit_in_delta (struct gdbarch *gdbarch,
|
|
|
|
int vbit_in_delta)
|
|
|
|
{
|
|
|
|
gdbarch->vbit_in_delta = vbit_in_delta;
|
|
|
|
}
|
|
|
|
|
2007-05-07 20:20:21 +02:00
|
|
|
void
|
|
|
|
gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch, struct regcache *regcache)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->skip_permanent_breakpoint != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_permanent_breakpoint called\n");
|
|
|
|
gdbarch->skip_permanent_breakpoint (regcache);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_skip_permanent_breakpoint_ftype skip_permanent_breakpoint)
|
|
|
|
{
|
|
|
|
gdbarch->skip_permanent_breakpoint = skip_permanent_breakpoint;
|
|
|
|
}
|
|
|
|
|
Implement displaced stepping.
gdb/
* gdbarch.sh (max_insn_length): New 'variable'.
(displaced_step_copy, displaced_step_fixup)
(displaced_step_free_closure, displaced_step_location): New
functions.
(struct displaced_step_closure): Add forward declaration.
* gdbarch.c, gdbarch.h: Regenerated.
* arch-utils.c: #include "objfiles.h".
(simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New functions.
* arch-utils.h (simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New prototypes.
* i386-tdep.c (I386_MAX_INSN_LEN): Rename to...
(I386_MAX_MATCHED_INSN_LEN): ... this.
(i386_absolute_jmp_p, i386_absolute_call_p)
(i386_ret_p, i386_call_p, i386_breakpoint_p, i386_syscall_p)
(i386_displaced_step_fixup): New functions.
(struct i386_insn, i386_match_insn): Update.
(i386_gdbarch_init): Set gdbarch_max_insn_length.
* i386-tdep.h (I386_MAX_INSN_LEN): New.
(i386_displaced_step_fixup): New prototype.
* i386-linux-tdep.c (i386_linux_init_abi): Include "arch-utils.h".
Register gdbarch_displaced_step_copy,
gdbarch_displaced_step_fixup, gdbarch_displaced_step_free_closure,
and gdbarch_displaced_step_location functions.
* infrun.c (debug_displaced): New variable.
(show_debug_displaced): New function.
(struct displaced_step_request): New struct.
(displaced_step_request_queue, displaced_step_ptid)
(displaced_step_gdbarch, displaced_step_closure)
(displaced_step_original, displaced_step_copy)
(displaced_step_saved_copy, can_use_displaced_stepping): New
variables.
(show_can_use_displaced_stepping, use_displaced_stepping)
(displaced_step_clear, cleanup_displaced_step_closure)
(displaced_step_dump_bytes, displaced_step_prepare)
(displaced_step_clear_cleanup, write_memory_ptid)
(displaced_step_fixup): New functions.
(resume): Call displaced_step_prepare.
(proceed): Call read_pc once, and remember the value. If using
displaced stepping, don't remove breakpoints.
(handle_inferior_event): Call displaced_step_fixup. Add some
debugging output. When we try to step over a breakpoint, but get
a signal to deliver to the thread instead, ensure the step-resume
breakpoint is actually inserted. If a thread hop is needed, and
displaced stepping is enabled, don't remove breakpoints.
(init_wait_for_inferior): Call displaced_step_clear.
(_initialize_infrun): Add "set debug displaced" command. Add
"maint set can-use-displaced-stepping" command. Clear
displaced_step_ptid.
* inferior.h (debug_displaced): Declare variable.
(displaced_step_dump_bytes): Declare function.
* Makefile.in (arch-utils.o, i386-linux-tdep.o): Update
dependencies.
gdb/testsuite/
* gdb.asm/asmsrc1.s: Add scratch space.
gdb/doc/
* gdb.texinfo (Debugging Output): Document "set/show debug
displaced".
(Maintenance Commands): Document "maint set/show
can-use-displaced-stepping".
2008-05-02 18:49:54 +02:00
|
|
|
int
|
|
|
|
gdbarch_max_insn_length_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->max_insn_length != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ULONGEST
|
|
|
|
gdbarch_max_insn_length (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Check variable changed from pre-default. */
|
|
|
|
gdb_assert (gdbarch->max_insn_length != 0);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_max_insn_length called\n");
|
|
|
|
return gdbarch->max_insn_length;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_max_insn_length (struct gdbarch *gdbarch,
|
|
|
|
ULONGEST max_insn_length)
|
|
|
|
{
|
|
|
|
gdbarch->max_insn_length = max_insn_length;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_displaced_step_copy_insn_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->displaced_step_copy_insn != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct displaced_step_closure *
|
|
|
|
gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->displaced_step_copy_insn != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_displaced_step_copy_insn called\n");
|
|
|
|
return gdbarch->displaced_step_copy_insn (gdbarch, from, to, regs);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_displaced_step_copy_insn_ftype displaced_step_copy_insn)
|
|
|
|
{
|
|
|
|
gdbarch->displaced_step_copy_insn = displaced_step_copy_insn;
|
|
|
|
}
|
|
|
|
|
2009-09-29 02:53:04 +02:00
|
|
|
int
|
|
|
|
gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch, struct displaced_step_closure *closure)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->displaced_step_hw_singlestep != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_displaced_step_hw_singlestep called\n");
|
|
|
|
return gdbarch->displaced_step_hw_singlestep (gdbarch, closure);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_displaced_step_hw_singlestep_ftype displaced_step_hw_singlestep)
|
|
|
|
{
|
|
|
|
gdbarch->displaced_step_hw_singlestep = displaced_step_hw_singlestep;
|
|
|
|
}
|
|
|
|
|
Implement displaced stepping.
gdb/
* gdbarch.sh (max_insn_length): New 'variable'.
(displaced_step_copy, displaced_step_fixup)
(displaced_step_free_closure, displaced_step_location): New
functions.
(struct displaced_step_closure): Add forward declaration.
* gdbarch.c, gdbarch.h: Regenerated.
* arch-utils.c: #include "objfiles.h".
(simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New functions.
* arch-utils.h (simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New prototypes.
* i386-tdep.c (I386_MAX_INSN_LEN): Rename to...
(I386_MAX_MATCHED_INSN_LEN): ... this.
(i386_absolute_jmp_p, i386_absolute_call_p)
(i386_ret_p, i386_call_p, i386_breakpoint_p, i386_syscall_p)
(i386_displaced_step_fixup): New functions.
(struct i386_insn, i386_match_insn): Update.
(i386_gdbarch_init): Set gdbarch_max_insn_length.
* i386-tdep.h (I386_MAX_INSN_LEN): New.
(i386_displaced_step_fixup): New prototype.
* i386-linux-tdep.c (i386_linux_init_abi): Include "arch-utils.h".
Register gdbarch_displaced_step_copy,
gdbarch_displaced_step_fixup, gdbarch_displaced_step_free_closure,
and gdbarch_displaced_step_location functions.
* infrun.c (debug_displaced): New variable.
(show_debug_displaced): New function.
(struct displaced_step_request): New struct.
(displaced_step_request_queue, displaced_step_ptid)
(displaced_step_gdbarch, displaced_step_closure)
(displaced_step_original, displaced_step_copy)
(displaced_step_saved_copy, can_use_displaced_stepping): New
variables.
(show_can_use_displaced_stepping, use_displaced_stepping)
(displaced_step_clear, cleanup_displaced_step_closure)
(displaced_step_dump_bytes, displaced_step_prepare)
(displaced_step_clear_cleanup, write_memory_ptid)
(displaced_step_fixup): New functions.
(resume): Call displaced_step_prepare.
(proceed): Call read_pc once, and remember the value. If using
displaced stepping, don't remove breakpoints.
(handle_inferior_event): Call displaced_step_fixup. Add some
debugging output. When we try to step over a breakpoint, but get
a signal to deliver to the thread instead, ensure the step-resume
breakpoint is actually inserted. If a thread hop is needed, and
displaced stepping is enabled, don't remove breakpoints.
(init_wait_for_inferior): Call displaced_step_clear.
(_initialize_infrun): Add "set debug displaced" command. Add
"maint set can-use-displaced-stepping" command. Clear
displaced_step_ptid.
* inferior.h (debug_displaced): Declare variable.
(displaced_step_dump_bytes): Declare function.
* Makefile.in (arch-utils.o, i386-linux-tdep.o): Update
dependencies.
gdb/testsuite/
* gdb.asm/asmsrc1.s: Add scratch space.
gdb/doc/
* gdb.texinfo (Debugging Output): Document "set/show debug
displaced".
(Maintenance Commands): Document "maint set/show
can-use-displaced-stepping".
2008-05-02 18:49:54 +02:00
|
|
|
int
|
|
|
|
gdbarch_displaced_step_fixup_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->displaced_step_fixup != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, struct displaced_step_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->displaced_step_fixup != NULL);
|
|
|
|
/* Do not check predicate: gdbarch->displaced_step_fixup != NULL, allow call. */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_displaced_step_fixup called\n");
|
|
|
|
gdbarch->displaced_step_fixup (gdbarch, closure, from, to, regs);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_displaced_step_fixup (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_displaced_step_fixup_ftype displaced_step_fixup)
|
|
|
|
{
|
|
|
|
gdbarch->displaced_step_fixup = displaced_step_fixup;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdbarch_displaced_step_free_closure (struct gdbarch *gdbarch, struct displaced_step_closure *closure)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->displaced_step_free_closure != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_displaced_step_free_closure called\n");
|
|
|
|
gdbarch->displaced_step_free_closure (gdbarch, closure);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_displaced_step_free_closure (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_displaced_step_free_closure_ftype displaced_step_free_closure)
|
|
|
|
{
|
|
|
|
gdbarch->displaced_step_free_closure = displaced_step_free_closure;
|
|
|
|
}
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
gdbarch_displaced_step_location (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->displaced_step_location != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_displaced_step_location called\n");
|
|
|
|
return gdbarch->displaced_step_location (gdbarch);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_displaced_step_location (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_displaced_step_location_ftype displaced_step_location)
|
|
|
|
{
|
|
|
|
gdbarch->displaced_step_location = displaced_step_location;
|
|
|
|
}
|
|
|
|
|
2010-05-26 20:19:28 +02:00
|
|
|
int
|
|
|
|
gdbarch_relocate_instruction_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->relocate_instruction != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdbarch_relocate_instruction (struct gdbarch *gdbarch, CORE_ADDR *to, CORE_ADDR from)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->relocate_instruction != NULL);
|
|
|
|
/* Do not check predicate: gdbarch->relocate_instruction != NULL, allow call. */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_relocate_instruction called\n");
|
|
|
|
gdbarch->relocate_instruction (gdbarch, to, from);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_relocate_instruction (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_relocate_instruction_ftype relocate_instruction)
|
|
|
|
{
|
|
|
|
gdbarch->relocate_instruction = relocate_instruction;
|
|
|
|
}
|
|
|
|
|
2007-05-11 21:57:17 +02:00
|
|
|
int
|
|
|
|
gdbarch_overlay_update_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->overlay_update != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdbarch_overlay_update (struct gdbarch *gdbarch, struct obj_section *osect)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->overlay_update != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_overlay_update called\n");
|
|
|
|
gdbarch->overlay_update (osect);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_overlay_update (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_overlay_update_ftype overlay_update)
|
|
|
|
{
|
|
|
|
gdbarch->overlay_update = overlay_update;
|
|
|
|
}
|
|
|
|
|
2007-09-10 23:14:11 +02:00
|
|
|
int
|
|
|
|
gdbarch_core_read_description_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->core_read_description != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
const struct target_desc *
|
|
|
|
gdbarch_core_read_description (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->core_read_description != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_core_read_description called\n");
|
|
|
|
return gdbarch->core_read_description (gdbarch, target, abfd);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_core_read_description (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_core_read_description_ftype core_read_description)
|
|
|
|
{
|
|
|
|
gdbarch->core_read_description = core_read_description;
|
|
|
|
}
|
|
|
|
|
2007-10-19 14:23:21 +02:00
|
|
|
int
|
|
|
|
gdbarch_static_transform_name_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->static_transform_name != NULL;
|
|
|
|
}
|
|
|
|
|
* gdbtypes.h (struct main_type): Change type of name,tag_name,
and fields.name members from char * to const char *. All uses updated.
(struct cplus_struct_type): Change type of fn_fieldlists.name member
from char * to const char *. All uses updated.
(type_name_no_tag): Update.
(lookup_unsigned_typename, lookup_signed_typename): Update.
* gdbtypes.c (type_name_no_tag): Change result type
from char * to const char *. All callers updated.
(lookup_unsigned_typename, lookup_signed_typename): Change type of
name parameter from char * to const char *.
* symtab.h (struct cplus_specific): Change type of demangled_name
member from char * to const char *. All uses updated.
(struct general_symbol_info): Change type of name and
mangled_lang.demangled_name members from char * to const char *.
All uses updated.
(symbol_get_demangled_name, symbol_natural_name): Update.
(symbol_demangled_name, symbol_search_name): Update.
* symtab.c (symbol_get_demangled_name): Change result type
from char * to const char *. All callers updated.
(symbol_natural_name, symbol_demangled_name): Ditto.
(symbol_search_name): Ditto.
(completion_list_add_name): Change type of symname,sym_text,
text,word parameters from char * to const char *.
(completion_list_objc_symbol): Change type of sym_text,
text,word parameters from char * to const char *.
* ada-lang.c (find_struct_field): Change type of name parameter
from char * to const char *.
(encoded_ordered_before): Similarly for N0,N1 parameters.
(old_renaming_is_invisible): Similarly for function_name parameter.
(ada_type_name): Change result type from char * to const char *.
All callers updated.
* ada-lang.h (ada_type_name): Update.
* buildsym.c (hashname): Change type of name parameter
from char * to const char *.
* buildsym.h (hashname): Update.
* dbxread.c (end_psymtab): Change type of include_list parameter
from char ** to const char **.
* dwarf2read.c (determine_prefix): Change result type
from char * to const char *. All callers updated.
* f-lang.c (find_common_for_function): Change type of name, funcname
parameters from char * to const char *.
* f-lang.c (find_common_for_function): Update.
* f-valprint.c (list_all_visible_commons): Change type of funcname
parameters from char * to const char *.
* gdbarch.sh (static_transform_name): Change type of name parameter
and result from char * to const char *.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* i386-sol2-tdep.c (i386_sol2_static_transform_name): Change type
of name parameter from char * to const char *.
* jv-lang.c (java_primitive_type_from_name): Ditto.
(java_demangled_signature_length): Similarly for signature parameter.
(java_demangled_signature_copy): Ditto.
(java_demangle_type_signature): Ditto.
* jv-lang.h (java_primitive_type_from_name): Update.
(java_demangle_type_signature): Update.
* objc-lang.c (specialcmp): Change type of a,b parameters
from char * to const char *.
* p-lang.c (is_pascal_string_type): Change type of arrayname parameter
from char * to const char *. All callers updated.
* p-lang.h (is_pascal_string_type): Update.
* solib-frv.c (find_canonical_descriptor_in_load_object): Change type
of name parameter from char * to const char *.
* sparc-sol2-tdep.c (sparc_sol2_static_transform_name): Ditto.
* utils.c (fprintf_symbol_filtered): Ditto.
* defs.h (fprintf_symbol_filtered): Update.
* sparc-tdep.h (sparc_sol2_static_transform_name): Update.
* stabsread.h (end_psymtab): Update.
* stack.c (find_frame_funname): Change type of funname parameter
from char ** to const char **.
* stack.h (find_frame_funname): Update.
* typeprint.c (type_print): Change type of varstring parameter
from char * to const char *.
* value.h (type_print): Update.
* xcoffread.c (xcoff_start_psymtab): Change type of filename parameter
from char * to const char *. All callers updated.
(xcoff_end_psymtab): Change type of include_list parameter
from char ** to const char **. All callers updated.
(swap_sym): Similarly for name parameter. All callers updated.
* coffread.c (patch_type): Add (char*) cast to xfree parameter.
Use xstrdup.
(process_coff_symbol): Use xstrdup.
* stabsread.c (stabs_method_name_from_physname): Renamed from
update_method_name_from_physname. Change result type from void
to char *. All callers updated.
(read_member_functions): In has_destructor case, store name in objfile
obstack instead of malloc space. In !has_stub case, fix mem leak.
2012-02-07 05:48:23 +01:00
|
|
|
const char *
|
|
|
|
gdbarch_static_transform_name (struct gdbarch *gdbarch, const char *name)
|
2007-10-19 14:23:21 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->static_transform_name != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_static_transform_name called\n");
|
|
|
|
return gdbarch->static_transform_name (name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_static_transform_name (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_static_transform_name_ftype static_transform_name)
|
|
|
|
{
|
|
|
|
gdbarch->static_transform_name = static_transform_name;
|
|
|
|
}
|
|
|
|
|
2007-10-19 14:26:35 +02:00
|
|
|
int
|
|
|
|
gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of sofun_address_maybe_missing, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_sofun_address_maybe_missing called\n");
|
|
|
|
return gdbarch->sofun_address_maybe_missing;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch,
|
|
|
|
int sofun_address_maybe_missing)
|
|
|
|
{
|
|
|
|
gdbarch->sofun_address_maybe_missing = sofun_address_maybe_missing;
|
|
|
|
}
|
|
|
|
|
2009-04-30 04:52:16 +02:00
|
|
|
int
|
|
|
|
gdbarch_process_record_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->process_record != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_process_record (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->process_record != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_process_record called\n");
|
|
|
|
return gdbarch->process_record (gdbarch, regcache, addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_process_record (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_process_record_ftype process_record)
|
|
|
|
{
|
|
|
|
gdbarch->process_record = process_record;
|
|
|
|
}
|
|
|
|
|
2009-09-21 07:52:06 +02:00
|
|
|
int
|
|
|
|
gdbarch_process_record_signal_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->process_record_signal != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-05-24 18:39:15 +02:00
|
|
|
gdbarch_process_record_signal (struct gdbarch *gdbarch, struct regcache *regcache, enum gdb_signal signal)
|
2009-09-21 07:52:06 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->process_record_signal != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_process_record_signal called\n");
|
|
|
|
return gdbarch->process_record_signal (gdbarch, regcache, signal);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_process_record_signal (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_process_record_signal_ftype process_record_signal)
|
|
|
|
{
|
|
|
|
gdbarch->process_record_signal = process_record_signal;
|
|
|
|
}
|
|
|
|
|
2012-06-04 18:23:57 +02:00
|
|
|
int
|
|
|
|
gdbarch_gdb_signal_from_target_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->gdb_signal_from_target != NULL;
|
|
|
|
}
|
|
|
|
|
2012-05-24 18:39:15 +02:00
|
|
|
enum gdb_signal
|
2012-05-24 19:03:28 +02:00
|
|
|
gdbarch_gdb_signal_from_target (struct gdbarch *gdbarch, int signo)
|
2008-05-01 21:31:52 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
2012-05-24 19:03:28 +02:00
|
|
|
gdb_assert (gdbarch->gdb_signal_from_target != NULL);
|
2008-05-01 21:31:52 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
2012-05-24 19:03:28 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_gdb_signal_from_target called\n");
|
|
|
|
return gdbarch->gdb_signal_from_target (gdbarch, signo);
|
2008-05-01 21:31:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-05-24 19:03:28 +02:00
|
|
|
set_gdbarch_gdb_signal_from_target (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_gdb_signal_from_target_ftype gdb_signal_from_target)
|
2008-05-01 21:31:52 +02:00
|
|
|
{
|
2012-05-24 19:03:28 +02:00
|
|
|
gdbarch->gdb_signal_from_target = gdb_signal_from_target;
|
2008-05-01 21:31:52 +02:00
|
|
|
}
|
|
|
|
|
This patch implements the new gdbarch method gdbarch_gdb_signal_to_target.
It will be used when one wants to convert between the internal GDB signal
representation (enum gdb_signal) and the target's representation.
The idea of this patch came from a chat between Pedro and I on IRC, plus
the discussion of my patches to add the new $_exitsignal convenience
variable:
<http://sourceware.org/ml/gdb-patches/2013-06/msg00452.html>
<http://sourceware.org/ml/gdb-patches/2013-06/msg00352.html>
What I did was to investigate, on the Linux kernel, which targets shared
the signal numbers definition with the generic definition, present at
<include/uapi/asm-generic/signal.h>. For the record, I used linux-3.10-rc7
as the main source of information, always looking at
<arch/<ARCH_NAME>/include/uapi/asm/signal.h>. For SIGRTMAX (which defaults
to _NSIG in most cases), I had to look at different signal-related
files, but most of them (except MIPS) were defined to 64 anyway.
Then, with all the differences in hand, I implemented the bits on each
target.
2013-08-09 Sergio Durigan Junior <sergiodj@redhat.com>
* linux-tdep.c: Define enum with generic signal numbers.
(linux_gdb_signal_from_target): New function.
(linux_gdb_signal_to_target): Likewise.
(linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
methods to the functions above.
* linux-tdep.h (linux_gdb_signal_from_target): New prototype.
(linux_gdb_signal_to_target): Likewise.
* alpha-linux-tdep.c: Define new enum with signals different
from generic Linux kernel.
(alpha_linux_gdb_signal_from_target): New function.
(alpha_linux_gdb_signal_to_target): Likewise.
(alpha_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
with the functions mentioned above.
* avr-tdep.c: Define enum with differences between Linux kernel
and AVR signals.
(avr_linux_gdb_signal_from_target): New function.
(avr_linux_gdb_signal_to_target): Likewise.
(avr_gdbarch_init): Set gdbarch_gdb_signal_{to,from}_target to
the functions mentioned above.
* sparc-linux-tdep.c: Define enum with differences between SPARC
and generic Linux kernel signal numbers.
(sparc32_linux_gdb_signal_from_target): New function.
(sparc32_linux_gdb_signal_to_target): Likewise.
(sparc32_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
to the functions defined above.
* xtensa-linux-tdep.c: Define enum with differences between
Xtensa and Linux kernel generic signals.
(xtensa_linux_gdb_signal_from_target): New function.
(xtensa_linux_gdb_signal_to_target): Likewise.
(xtensa_linux_init_abi): Set gdbarch_gdb_signal_to_target
to the functions defined above.
* mips-linux-tdep.c: Define enum with differences between
signals in MIPS and Linux kernel generic ones.
(mips_gdb_signal_to_target): New function.
(mips_gdb_signal_from_target): Redefine to use new enum, handle
only different signals from the Linux kernel generic.
(mips_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
the functions defined above.
* mips-linux-tdep.h (enum mips_signals): Remove.
2013-08-09 18:54:43 +02:00
|
|
|
int
|
|
|
|
gdbarch_gdb_signal_to_target_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->gdb_signal_to_target != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_gdb_signal_to_target (struct gdbarch *gdbarch, enum gdb_signal signal)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->gdb_signal_to_target != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_gdb_signal_to_target called\n");
|
|
|
|
return gdbarch->gdb_signal_to_target (gdbarch, signal);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_gdb_signal_to_target (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_gdb_signal_to_target_ftype gdb_signal_to_target)
|
|
|
|
{
|
|
|
|
gdbarch->gdb_signal_to_target = gdb_signal_to_target;
|
|
|
|
}
|
|
|
|
|
2009-02-06 23:59:01 +01:00
|
|
|
int
|
|
|
|
gdbarch_get_siginfo_type_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->get_siginfo_type != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct type *
|
|
|
|
gdbarch_get_siginfo_type (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->get_siginfo_type != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_get_siginfo_type called\n");
|
|
|
|
return gdbarch->get_siginfo_type (gdbarch);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_get_siginfo_type (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_get_siginfo_type_ftype get_siginfo_type)
|
|
|
|
{
|
|
|
|
gdbarch->get_siginfo_type = get_siginfo_type;
|
|
|
|
}
|
|
|
|
|
2008-05-02 22:38:16 +02:00
|
|
|
int
|
|
|
|
gdbarch_record_special_symbol_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->record_special_symbol != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdbarch_record_special_symbol (struct gdbarch *gdbarch, struct objfile *objfile, asymbol *sym)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->record_special_symbol != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_record_special_symbol called\n");
|
|
|
|
gdbarch->record_special_symbol (gdbarch, objfile, sym);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_record_special_symbol (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_record_special_symbol_ftype record_special_symbol)
|
|
|
|
{
|
|
|
|
gdbarch->record_special_symbol = record_special_symbol;
|
|
|
|
}
|
|
|
|
|
2009-09-15 05:30:08 +02:00
|
|
|
int
|
|
|
|
gdbarch_get_syscall_number_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->get_syscall_number != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
LONGEST
|
|
|
|
gdbarch_get_syscall_number (struct gdbarch *gdbarch, ptid_t ptid)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->get_syscall_number != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_get_syscall_number called\n");
|
|
|
|
return gdbarch->get_syscall_number (gdbarch, ptid);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_get_syscall_number (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_get_syscall_number_ftype get_syscall_number)
|
|
|
|
{
|
|
|
|
gdbarch->get_syscall_number = get_syscall_number;
|
|
|
|
}
|
|
|
|
|
Partial fix for PR breakpoints/10737: Make syscall info be per-arch instead of global
This patch intends to partially fix PR breakpoints/10737, which is
about making the syscall information (for the "catch syscall" command)
be per-arch, instead of global. This is not a full fix because of the
other issues pointed by Pedro here:
<https://sourceware.org/bugzilla/show_bug.cgi?id=10737#c5>
However, I consider it a good step towards the real fix. It will also
help me fix <https://sourceware.org/bugzilla/show_bug.cgi?id=17402>.
What this patch does, basically, is move the "syscalls_info"
struct to gdbarch. Currently, the syscall information is stored in a
global variable inside gdb/xml-syscall.c, which means that there is no
easy way to correlate this info with the current target or
architecture being used, for example. This causes strange behaviors,
because the syscall info is not re-read when the arch changes. For
example, if you put a syscall catchpoint in syscall 5 on i386 (syscall
open), and then load a x86_64 program on GDB and put the same syscall
5 there (fstat on x86_64), you will still see that GDB tells you that
it is catching "open", even though it is not. With this patch, GDB
correctly says that it will be catching fstat syscalls.
(gdb) set architecture i386
The target architecture is assumed to be i386
(gdb) catch syscall 5
Catchpoint 1 (syscall 'open' [5])
(gdb) set architecture i386:x86-64
The target architecture is assumed to be i386:x86-64
(gdb) catch syscall 5
Catchpoint 2 (syscall 'open' [5])
But with the patch:
(gdb) set architecture i386
The target architecture is assumed to be i386
(gdb) catch syscall 5
Catchpoint 1 (syscall 'open' [5])
(gdb) set architecture i386:x86-64
The target architecture is assumed to be i386:x86-64
(gdb) catch syscall 5
Catchpoint 2 (syscall 'fstat' [5])
As I said, there are still some problems on the "catch syscall"
mechanism, because (for example) the user should be able to "catch
syscall open" on i386, and then expect "open" to be caught also on
x86_64. Currently, it doesn't work. I intend to work on this later.
gdb/
2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/10737
* amd64-linux-tdep.c (amd64_linux_init_abi_common): Adjust call to
set_xml_syscall_file_name to provide gdbarch.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* bfin-linux-tdep.c (bfin_linux_init_abi): Likewise.
* breakpoint.c (print_it_catch_syscall): Adjust call to
get_syscall_by_number to provide gdbarch.
(print_one_catch_syscall): Likewise.
(print_mention_catch_syscall): Likewise.
(print_recreate_catch_syscall): Likewise.
(catch_syscall_split_args): Adjust calls to get_syscall_by_number
and get_syscall_by_name to provide gdbarch.
(catch_syscall_completer): Adjust call to get_syscall_names to
provide gdbarch.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* gdbarch.sh: Forward declare "struct syscalls_info".
(xml_syscall_file): New variable.
(syscalls_info): Likewise.
* i386-linux-tdep.c (i386_linux_init_abi): Adjust call to
set_xml_syscall_file_name to provide gdbarch.
* mips-linux-tdep.c (mips_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* sparc-linux-tdep.c (sparc32_linux_init_abi): Likewise.
* sparc64-linux-tdep.c (sparc64_linux_init_abi): Likewise.
* xml-syscall.c: Include gdbarch.h.
(set_xml_syscall_file_name): Accept gdbarch parameter.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
(my_gdb_datadir): Delete global variable.
(struct syscalls_info) <my_gdb_datadir>: New variable.
(struct syscalls_info) <sysinfo>: Rename variable to
"syscalls_info".
(sysinfo): Delete global variable.
(have_initialized_sysinfo): Likewise.
(xml_syscall_file): Likewise.
(sysinfo_free_syscalls_desc): Rename to...
(syscalls_info_free_syscalls_desc): ... this.
(free_syscalls_info): Rename "sysinfo" to "syscalls_info". Adjust
code to the new layout of "struct syscalls_info".
(make_cleanup_free_syscalls_info): Rename parameter "sysinfo" to
"syscalls_info".
(syscall_create_syscall_desc): Likewise.
(syscall_start_syscall): Likewise.
(syscall_parse_xml): Likewise.
(xml_init_syscalls_info): Likewise. Drop "const" from return value.
(init_sysinfo): Rename to...
(init_syscalls_info): ...this. Add gdbarch as a parameter.
Adjust function to deal with gdbarch.
(xml_get_syscall_number): Delete parameter sysinfo. Accept
gdbarch as a parameter. Adjust code.
(xml_get_syscall_name): Likewise.
(xml_list_of_syscalls): Likewise.
(set_xml_syscall_file_name): Accept gdbarch as parameter.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
* xml-syscall.h (set_xml_syscall_file_name): Likewise.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
gdb/testsuite/
2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/10737
* gdb.base/catch-syscall.exp (do_syscall_tests): Call
test_catch_syscall_multi_arch.
(test_catch_syscall_multi_arch): New function.
2014-11-20 18:28:18 +01:00
|
|
|
const char *
|
|
|
|
gdbarch_xml_syscall_file (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of xml_syscall_file, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_xml_syscall_file called\n");
|
|
|
|
return gdbarch->xml_syscall_file;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_xml_syscall_file (struct gdbarch *gdbarch,
|
|
|
|
const char * xml_syscall_file)
|
|
|
|
{
|
|
|
|
gdbarch->xml_syscall_file = xml_syscall_file;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct syscalls_info *
|
|
|
|
gdbarch_syscalls_info (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of syscalls_info, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_syscalls_info called\n");
|
|
|
|
return gdbarch->syscalls_info;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_syscalls_info (struct gdbarch *gdbarch,
|
|
|
|
struct syscalls_info * syscalls_info)
|
|
|
|
{
|
|
|
|
gdbarch->syscalls_info = syscalls_info;
|
|
|
|
}
|
|
|
|
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
const char *const *
|
|
|
|
gdbarch_stap_integer_prefixes (struct gdbarch *gdbarch)
|
2012-04-27 22:47:57 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
/* Skip verify of stap_integer_prefixes, invalid_p == 0 */
|
2012-04-27 22:47:57 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_integer_prefixes called\n");
|
|
|
|
return gdbarch->stap_integer_prefixes;
|
2012-04-27 22:47:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
set_gdbarch_stap_integer_prefixes (struct gdbarch *gdbarch,
|
|
|
|
const char *const * stap_integer_prefixes)
|
2012-04-27 22:47:57 +02:00
|
|
|
{
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
gdbarch->stap_integer_prefixes = stap_integer_prefixes;
|
2012-04-27 22:47:57 +02:00
|
|
|
}
|
|
|
|
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
const char *const *
|
|
|
|
gdbarch_stap_integer_suffixes (struct gdbarch *gdbarch)
|
2012-04-27 22:47:57 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
/* Skip verify of stap_integer_suffixes, invalid_p == 0 */
|
2012-04-27 22:47:57 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_integer_suffixes called\n");
|
|
|
|
return gdbarch->stap_integer_suffixes;
|
2012-04-27 22:47:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
set_gdbarch_stap_integer_suffixes (struct gdbarch *gdbarch,
|
|
|
|
const char *const * stap_integer_suffixes)
|
2012-04-27 22:47:57 +02:00
|
|
|
{
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
gdbarch->stap_integer_suffixes = stap_integer_suffixes;
|
2012-04-27 22:47:57 +02:00
|
|
|
}
|
|
|
|
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
const char *const *
|
|
|
|
gdbarch_stap_register_prefixes (struct gdbarch *gdbarch)
|
2012-04-27 22:47:57 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
/* Skip verify of stap_register_prefixes, invalid_p == 0 */
|
2012-04-27 22:47:57 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_prefixes called\n");
|
|
|
|
return gdbarch->stap_register_prefixes;
|
2012-04-27 22:47:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
set_gdbarch_stap_register_prefixes (struct gdbarch *gdbarch,
|
|
|
|
const char *const * stap_register_prefixes)
|
2012-04-27 22:47:57 +02:00
|
|
|
{
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
gdbarch->stap_register_prefixes = stap_register_prefixes;
|
2012-04-27 22:47:57 +02:00
|
|
|
}
|
|
|
|
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
const char *const *
|
|
|
|
gdbarch_stap_register_suffixes (struct gdbarch *gdbarch)
|
2012-04-27 22:47:57 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
/* Skip verify of stap_register_suffixes, invalid_p == 0 */
|
2012-04-27 22:47:57 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_suffixes called\n");
|
|
|
|
return gdbarch->stap_register_suffixes;
|
2012-04-27 22:47:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
set_gdbarch_stap_register_suffixes (struct gdbarch *gdbarch,
|
|
|
|
const char *const * stap_register_suffixes)
|
2012-04-27 22:47:57 +02:00
|
|
|
{
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
gdbarch->stap_register_suffixes = stap_register_suffixes;
|
2012-04-27 22:47:57 +02:00
|
|
|
}
|
|
|
|
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
const char *const *
|
|
|
|
gdbarch_stap_register_indirection_prefixes (struct gdbarch *gdbarch)
|
2012-04-27 22:47:57 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
/* Skip verify of stap_register_indirection_prefixes, invalid_p == 0 */
|
2012-04-27 22:47:57 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_indirection_prefixes called\n");
|
|
|
|
return gdbarch->stap_register_indirection_prefixes;
|
2012-04-27 22:47:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
set_gdbarch_stap_register_indirection_prefixes (struct gdbarch *gdbarch,
|
|
|
|
const char *const * stap_register_indirection_prefixes)
|
2012-04-27 22:47:57 +02:00
|
|
|
{
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
gdbarch->stap_register_indirection_prefixes = stap_register_indirection_prefixes;
|
2012-04-27 22:47:57 +02:00
|
|
|
}
|
|
|
|
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
const char *const *
|
|
|
|
gdbarch_stap_register_indirection_suffixes (struct gdbarch *gdbarch)
|
2012-04-27 22:47:57 +02:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
/* Skip verify of stap_register_indirection_suffixes, invalid_p == 0 */
|
2012-04-27 22:47:57 +02:00
|
|
|
if (gdbarch_debug >= 2)
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_indirection_suffixes called\n");
|
|
|
|
return gdbarch->stap_register_indirection_suffixes;
|
2012-04-27 22:47:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
set_gdbarch_stap_register_indirection_suffixes (struct gdbarch *gdbarch,
|
|
|
|
const char *const * stap_register_indirection_suffixes)
|
2012-04-27 22:47:57 +02:00
|
|
|
{
|
Extend SystemTap SDT probe argument parser
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
|
|
|
gdbarch->stap_register_indirection_suffixes = stap_register_indirection_suffixes;
|
2012-04-27 22:47:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of stap_gdb_register_prefix, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_gdb_register_prefix called\n");
|
|
|
|
return gdbarch->stap_gdb_register_prefix;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch,
|
|
|
|
const char * stap_gdb_register_prefix)
|
|
|
|
{
|
|
|
|
gdbarch->stap_gdb_register_prefix = stap_gdb_register_prefix;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
gdbarch_stap_gdb_register_suffix (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of stap_gdb_register_suffix, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_gdb_register_suffix called\n");
|
|
|
|
return gdbarch->stap_gdb_register_suffix;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_stap_gdb_register_suffix (struct gdbarch *gdbarch,
|
|
|
|
const char * stap_gdb_register_suffix)
|
|
|
|
{
|
|
|
|
gdbarch->stap_gdb_register_suffix = stap_gdb_register_suffix;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_stap_is_single_operand_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->stap_is_single_operand != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->stap_is_single_operand != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_is_single_operand called\n");
|
|
|
|
return gdbarch->stap_is_single_operand (gdbarch, s);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_stap_is_single_operand (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_stap_is_single_operand_ftype stap_is_single_operand)
|
|
|
|
{
|
|
|
|
gdbarch->stap_is_single_operand = stap_is_single_operand;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_stap_parse_special_token_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->stap_parse_special_token != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, struct stap_parse_info *p)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->stap_parse_special_token != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_parse_special_token called\n");
|
|
|
|
return gdbarch->stap_parse_special_token (gdbarch, p);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_stap_parse_special_token (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_stap_parse_special_token_ftype stap_parse_special_token)
|
|
|
|
{
|
|
|
|
gdbarch->stap_parse_special_token = stap_parse_special_token;
|
|
|
|
}
|
|
|
|
|
2015-02-17 15:54:44 +01:00
|
|
|
int
|
|
|
|
gdbarch_dtrace_parse_probe_argument_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->dtrace_parse_probe_argument != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdbarch_dtrace_parse_probe_argument (struct gdbarch *gdbarch, struct parser_state *pstate, int narg)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->dtrace_parse_probe_argument != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_dtrace_parse_probe_argument called\n");
|
|
|
|
gdbarch->dtrace_parse_probe_argument (gdbarch, pstate, narg);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_dtrace_parse_probe_argument (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_dtrace_parse_probe_argument_ftype dtrace_parse_probe_argument)
|
|
|
|
{
|
|
|
|
gdbarch->dtrace_parse_probe_argument = dtrace_parse_probe_argument;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_dtrace_probe_is_enabled_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->dtrace_probe_is_enabled != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_dtrace_probe_is_enabled (struct gdbarch *gdbarch, CORE_ADDR addr)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->dtrace_probe_is_enabled != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_dtrace_probe_is_enabled called\n");
|
|
|
|
return gdbarch->dtrace_probe_is_enabled (gdbarch, addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_dtrace_probe_is_enabled (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_dtrace_probe_is_enabled_ftype dtrace_probe_is_enabled)
|
|
|
|
{
|
|
|
|
gdbarch->dtrace_probe_is_enabled = dtrace_probe_is_enabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_dtrace_enable_probe_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->dtrace_enable_probe != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdbarch_dtrace_enable_probe (struct gdbarch *gdbarch, CORE_ADDR addr)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->dtrace_enable_probe != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_dtrace_enable_probe called\n");
|
|
|
|
gdbarch->dtrace_enable_probe (gdbarch, addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_dtrace_enable_probe (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_dtrace_enable_probe_ftype dtrace_enable_probe)
|
|
|
|
{
|
|
|
|
gdbarch->dtrace_enable_probe = dtrace_enable_probe;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_dtrace_disable_probe_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->dtrace_disable_probe != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdbarch_dtrace_disable_probe (struct gdbarch *gdbarch, CORE_ADDR addr)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->dtrace_disable_probe != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_dtrace_disable_probe called\n");
|
|
|
|
gdbarch->dtrace_disable_probe (gdbarch, addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_dtrace_disable_probe (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_dtrace_disable_probe_ftype dtrace_disable_probe)
|
|
|
|
{
|
|
|
|
gdbarch->dtrace_disable_probe = dtrace_disable_probe;
|
|
|
|
}
|
|
|
|
|
* remote.c (remote_start_remote): If the solib list is global,
fetch libraries and insert breakpoints after connecting.
* infcmd.c (post_create_inferior): If the solist is shared between
inferiors, no need to refetch it on every new inferior.
(detach_command): If the shared library list is shared between
inferiors, then don't clear it on every inferior detach.
* gdbarch.sh (has_global_solist): New.
* i386-dicos-tdep.c (i386_dicos_init_abi): Set
gdbarch_has_global_solist.
* target.c (target_pre_inferior): If the shared library list is
shared between inferiors, then don't clear it here, neither
invalidate the memory regions or clear the target description.
(target_detach): If the shared library list is shared between
inferiors, then don't remove breakpoints from the target here.
(target_disconnect): Comment.
* solib.c (update_solib_list): Check for null_ptid.
* breakpoint.c (insert_breakpoints, update_global_location_list):
If the shared library list is shared between inferiors, insert
breakpoints even if there's no execution.
(breakpoint_init_inferior): If the shared library list is shared
between inferiors, don't delete breakpoints or mark them
uninserted here.
* gdbarch.c, gdbarch.h: Regenerate.
2008-11-03 15:01:27 +01:00
|
|
|
int
|
|
|
|
gdbarch_has_global_solist (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of has_global_solist, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_has_global_solist called\n");
|
|
|
|
return gdbarch->has_global_solist;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_has_global_solist (struct gdbarch *gdbarch,
|
|
|
|
int has_global_solist)
|
|
|
|
{
|
|
|
|
gdbarch->has_global_solist = has_global_solist;
|
|
|
|
}
|
|
|
|
|
2009-05-19 02:23:49 +02:00
|
|
|
int
|
|
|
|
gdbarch_has_global_breakpoints (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of has_global_breakpoints, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_has_global_breakpoints called\n");
|
|
|
|
return gdbarch->has_global_breakpoints;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_has_global_breakpoints (struct gdbarch *gdbarch,
|
|
|
|
int has_global_breakpoints)
|
|
|
|
{
|
|
|
|
gdbarch->has_global_breakpoints = has_global_breakpoints;
|
|
|
|
}
|
|
|
|
|
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
Add base multi-executable/process support to GDB.
gdb/
* Makefile.in (SFILES): Add progspace.c.
(COMMON_OBS): Add progspace.o.
* progspace.h: New.
* progspace.c: New.
* breakpoint.h (struct bp_target_info) <placed_address_space>: New
field.
(struct bp_location) <pspace>: New field.
(struct breakpoint) <pspace>: New field.
(bpstat_stop_status, breakpoint_here_p)
(moribund_breakpoint_here_p, breakpoint_inserted_here_p)
(regular_breakpoint_inserted_here_p)
(software_breakpoint_inserted_here_p, breakpoint_thread_match)
(set_default_breakpoint): Adjust prototypes.
(remove_breakpoints_pid, breakpoint_program_space_exit): Declare.
(insert_single_step_breakpoint, deprecated_insert_raw_breakpoint):
Adjust prototypes.
* breakpoint.c (executing_startup): Delete.
(default_breakpoint_sspace): New.
(breakpoint_restore_shadows): Skip if the address space doesn't
match.
(update_watchpoint): Record the frame's program space in the
breakpoint location.
(insert_bp_location): Record the address space in target_info.
Adjust to pass the symbol space to solib_name_from_address.
(breakpoint_program_space_exit): New.
(insert_breakpoint_locations): Switch the symbol space and thread
when inserting breakpoints. Don't insert breakpoints in a vfork
parent waiting for vfork done if we're not attached to the vfork
child.
(remove_breakpoints_pid): New.
(reattach_breakpoints): Switch to a thread of PID. Ignore
breakpoints of other symbol spaces.
(create_internal_breakpoint): Store the symbol space in the sal.
(create_longjmp_master_breakpoint): Iterate over all symbol
spaces.
(update_breakpoints_after_exec): Ignore breakpoints for other
symbol spaces.
(remove_breakpoint): Rename to ...
(remove_breakpoint_1): ... this. Pass the breakpoints symbol
space to solib_name_from_address.
(remove_breakpoint): New.
(mark_breakpoints_out): Ignore breakpoints from other symbol
spaces.
(breakpoint_init_inferior): Ditto.
(breakpoint_here_p): Add an address space argument and adjust to
use breakpoint_address_match.
(moribund_breakpoint_here_p): Ditto.
(regular_breakpoint_inserted_here_p): Ditto.
(breakpoint_inserted_here_p): Ditto.
(software_breakpoint_inserted_here_p): Ditto.
(breakpoint_thread_match): Ditto.
(bpstat_check_location): Ditto.
(bpstat_stop_status): Ditto.
(print_breakpoint_location): If there's a location to print,
switch the current symbol space.
(print_one_breakpoint_location): Add `allflag' argument.
(print_one_breakpoint): Ditto. Adjust.
(do_captured_breakpoint_query): Adjust.
(breakpoint_1): Adjust.
(breakpoint_has_pc): Also match the symbol space.
(describe_other_breakpoints): Add a symbol space argument and
adjust.
(set_default_breakpoint): Add a symbol space argument. Set
default_breakpoint_sspace.
(breakpoint_address_match): New.
(check_duplicates_for): Add an address space argument, and adjust.
(set_raw_breakpoint): Record the symbol space in the location and
in the breakpoint.
(set_longjmp_breakpoint): Skip longjmp master breakpoints from
other symbol spaces.
(remove_thread_event_breakpoints, remove_solib_event_breakpoints)
(disable_breakpoints_in_shlibs): Skip breakpoints from other
symbol spaces.
(disable_breakpoints_in_unloaded_shlib): Match symbol spaces.
(create_catchpoint): Set the symbol space in the sal.
(disable_breakpoints_before_startup): Skip breakpoints from other
symbol spaces. Set executing_startup in the current symbol space.
(enable_breakpoints_after_startup): Clear executing_startup in the
current symbol space. Skip breakpoints from other symbol spaces.
(clone_momentary_breakpoint): Also copy the symbol space.
(add_location_to_breakpoint): Set the location's symbol space.
(bp_loc_is_permanent): Switch thread and symbol space.
(create_breakpoint): Adjust.
(expand_line_sal_maybe): Expand comment to mention symbol spaces.
Switch thread and symbol space when reading memory.
(parse_breakpoint_sals): Set the symbol space in the sal.
(break_command_really): Ditto.
(skip_prologue_sal): Switch and space.
(resolve_sal_pc): Ditto.
(watch_command_1): Record the symbol space in the sal.
(create_ada_exception_breakpoint): Adjust.
(clear_command): Adjust. Match symbol spaces.
(update_global_location_list): Use breakpoint_address_match.
(breakpoint_re_set_one): Switch thread and space.
(breakpoint_re_set): Save symbol space.
(breakpoint_re_set_thread): Also reset the symbol space.
(deprecated_insert_raw_breakpoint): Add an address space argument.
Adjust.
(insert_single_step_breakpoint): Ditto.
(single_step_breakpoint_inserted_here_p): Ditto.
(clear_syscall_counts): New.
(_initialize_breakpoint): Install it as inferior_exit observer.
* exec.h: Include "progspace.h".
(exec_bfd, exec_bfd_mtime): New defines.
(exec_close): Declare.
* exec.c: Include "gdbthread.h" and "progspace.h".
(exec_bfd, exec_bfd_mtime, current_target_sections_1): Delete.
(using_exec_ops): New.
(exec_close_1): Rename to exec_close, and make public.
(exec_close): Rename to exec_close_1, and adjust all callers. Add
description. Remove target sections and close executables from
all program spaces.
(exec_file_attach): Add comment.
(add_target_sections): Check on `using_exec_ops' to check if the
target should be pushed.
(remove_target_sections): Only unpush the target if there are no
more target sections in any symbol space.
* gdbcore.h: Include "exec.h".
(exec_bfd, exec_bfd_mtime): Remove declarations.
* frame.h (get_frame_program_space, get_frame_address_space)
(frame_unwind_program_space): Declare.
* frame.c (struct frame_info) <pspace, aspace>: New fields.
(create_sentinel_frame): Add program space argument. Set the
pspace and aspace fields of the frame object.
(get_current_frame, create_new_frame): Adjust.
(get_frame_program_space): New.
(frame_unwind_program_space): New.
(get_frame_address_space): New.
* stack.c (print_frame_info): Adjust.
(print_frame): Use the frame's program space.
* gdbthread.h (any_live_thread_of_process): Declare.
* thread.c (any_live_thread_of_process): New.
(switch_to_thread): Switch the program space as well.
(restore_selected_frame): Don't warn if trying to restore frame
level 0.
* inferior.h: Include "progspace.h".
(detach_fork): Declare.
(struct inferior) <removable, aspace, pspace>
<vfork_parent, vfork_child, pending_detach>
<waiting_for_vfork_done>: New fields.
<terminal_info>: Remove field.
<data, num_data>: New fields.
(register_inferior_data, register_inferior_data_with_cleanup)
(clear_inferior_data, set_inferior_data, inferior_data): Declare.
(exit_inferior, exit_inferior_silent, exit_inferior_num_silent)
(inferior_appeared): Declare.
(find_inferior_pid): Typo.
(find_inferior_id, find_inferior_for_program_space): Declare.
(set_current_inferior, save_current_inferior, prune_inferiors)
(number_of_inferiors): Declare.
(inferior_list): Declare.
* inferior.c: Include "gdbcore.h" and "symfile.h".
(inferior_list): Make public.
(delete_inferior_1): Always delete thread silently.
(find_inferior_id): Make public.
(current_inferior_): New.
(current_inferior): Use it.
(set_current_inferior): New.
(restore_inferior): New.
(save_current_inferior): New.
(free_inferior): Free the per-inferior data.
(add_inferior_silent): Allocate per-inferior data.
Call inferior_appeared.
(delete_threads_of_inferior): New.
(delete_inferior_1): Adjust interface to take an inferior pointer.
(delete_inferior): Adjust.
(delete_inferior_silent): Adjust.
(exit_inferior_1): New.
(exit_inferior): New.
(exit_inferior_silent): New.
(exit_inferior_num_silent): New.
(detach_inferior): Adjust.
(inferior_appeared): New.
(discard_all_inferiors): Adjust.
(find_inferior_id): Make public. Assert pid is not zero.
(find_inferior_for_program_space): New.
(have_inferiors): Check if we have any inferior with pid not zero.
(have_live_inferiors): Go over all pushed targets looking for
process_stratum.
(prune_inferiors): New.
(number_of_inferiors): New.
(print_inferior): Add executable column. Print vfork parent/child
relationships.
(inferior_command): Adjust to cope with not running inferiors.
(remove_inferior_command): New.
(add_inferior_command): New.
(clone_inferior_command): New.
(struct inferior_data): New.
(struct inferior_data_registration): New.
(struct inferior_data_registry): New.
(inferior_data_registry): New.
(register_inferior_data_with_cleanup): New.
(register_inferior_data): New.
(inferior_alloc_data): New.
(inferior_free_data): New.
(clear_inferior_data): New.
(set_inferior_data): New.
(inferior_data): New.
(initialize_inferiors): New.
(_initialize_inferiors): Register "add-inferior",
"remove-inferior" and "clone-inferior" commands.
* objfiles.h: Include "progspace.h".
(struct objfile) <pspace>: New field.
(symfile_objfile, object_files): Don't declare.
(ALL_PSPACE_OBJFILES): New.
(ALL_PSPACE_OBJFILES_SAFE): New.
(ALL_OBJFILES, ALL_OBJFILES_SAFE): Adjust.
(ALL_PSPACE_SYMTABS): New.
(ALL_PRIMARY_SYMTABS): Adjust.
(ALL_PSPACE_PRIMARY_SYMTABS): New.
(ALL_PSYMTABS): Adjust.
(ALL_PSPACE_PSYMTABS): New.
* objfiles.c (object_files, symfile_objfile): Delete.
(struct objfile_sspace_info): New.
(objfiles_pspace_data): New.
(objfiles_pspace_data_cleanup): New.
(get_objfile_pspace_data): New.
(objfiles_changed_p): Delete.
(allocate_objfile): Set the objfile's program space. Adjust to
reference objfiles_changed_p in pspace data.
(free_objfile): Adjust to reference objfiles_changed_p in pspace
data.
(objfile_relocate): Ditto.
(update_section_map): Add pspace argument. Adjust to iterate over
objfiles in the passed in pspace.
(find_pc_section): Delete sections and num_sections statics.
Adjust to refer to program space's objfiles_changed_p. Adjust to
refer to sections and num_sections store in the objfile's pspace
data.
(objfiles_changed): Adjust to reference objfiles_changed_p in
pspace data.
(_initialize_objfiles): New.
* linespec.c (decode_all_digits, decode_dollar): Set the sal's
program space.
* source.c (current_source_pspace): New.
(get_current_source_symtab_and_line): Set the sal's program space.
(set_current_source_symtab_and_line): Set current_source_pspace.
(select_source_symtab): Ditto. Use ALL_OBJFILES.
(forget_cached_source_info): Iterate over all program spaces.
* symfile.c (clear_symtab_users): Adjust.
* symmisc.c (print_symbol_bcache_statistics): Iterate over all
program spaces.
(print_objfile_statistics): Ditto.
(maintenance_print_msymbols): Ditto.
(maintenance_print_objfiles): Ditto.
(maintenance_info_symtabs): Ditto.
(maintenance_info_psymtabs): Ditto.
* symtab.h (SYMTAB_PSPACE): New.
(struct symtab_and_line) <pspace>: New field.
* symtab.c (init_sal): Clear the sal's program space.
(find_pc_sect_symtab): Set the sal's program space. Switch thread
and space.
(append_expanded_sal): Add program space argument. Iterate over
all program spaces.
(expand_line_sal): Iterate over all program spaces. Switch
program space.
* target.h (enum target_waitkind) <TARGET_WAITKIND_VFORK_DONE>: New.
(struct target_ops) <to_thread_address_space>: New field.
(target_thread_address_space): Define.
* target.c (target_detach): Only remove breakpoints from the
inferior we're detaching.
(target_thread_address_space): New.
* defs.h (initialize_progspace): Declare.
* top.c (gdb_init): Call it.
* solist.h (struct so_list) <sspace>: New field.
* solib.h (struct program_space): Forward declare.
(solib_name_from_address): Adjust prototype.
* solib.c (so_list_head): Replace with a macro referencing the
program space.
(update_solib_list): Set the so's program space.
(solib_name_from_address): Add a program space argument and adjust.
* solib-svr4.c (struct svr4_info) <pid>: Delete field.
<interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low>
<interp_plt_sect_high>: New fields.
(svr4_info_p, svr4_info): Delete.
(solib_svr4_sspace_data): New.
(get_svr4_info): Rewrite.
(svr4_sspace_data_cleanup): New.
(open_symbol_file_object): Adjust.
(svr4_default_sos): Adjust.
(svr4_fetch_objfile_link_map): Adjust.
(interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low)
(interp_plt_sect_high): Delete.
(svr4_in_dynsym_resolve_code): Adjust.
(enable_break): Adjust.
(svr4_clear_solib): Revert bit that removed the svr4_info here,
and reinstate clearing debug_base, debug_loader_offset_p,
debug_loader_offset and debug_loader_name.
(_initialize_svr4_solib): Register solib_svr4_pspace_data. Don't
install an inferior_exit observer anymore.
* printcmd.c (struct display) <pspace>: New field.
(display_command): Set the display's sspace.
(do_one_display): Match the display's sspace.
(display_uses_solib_p): Ditto.
* linux-fork.c (detach_fork): Moved to infrun.c.
(_initialize_linux_fork): Moved "detach-on-fork" command to
infrun.c.
* infrun.c (detach_fork): Moved from linux-fork.c.
(proceed_after_vfork_done): New.
(handle_vfork_child_exec_or_exit): New.
(follow_exec_mode_replace, follow_exec_mode_keep)
(follow_exec_mode_names, follow_exec_mode_string)
(show_follow_exec_mode_string): New.
(follow_exec): New. Reinstate the mark_breakpoints_out call.
Remove shared libraries before attaching new executable. If user
wants to keep the inferior, keep it.
(displaced_step_fixup): Adjust to pass an address space to the
breakpoints module.
(resume): Ditto.
(clear_proceed_status): In all-stop mode, always clear the proceed
status of all threads.
(prepare_to_proceed): Adjust to pass an address space to the
breakpoints module.
(proceed): Ditto.
(adjust_pc_after_break): Ditto.
(handle_inferior_event): When handling a process exit, switch the
program space to the inferior's that had exited. Call
handle_vfork_child_exec_or_exit. Adjust to pass an address space
to the breakpoints module. In non-stop mode, when following a
fork and detach-fork is off, also resume the other branch. Handle
TARGET_WAITKIND_VFORK_DONE. Set the program space in sals.
(normal_stop): Prune inferiors.
(_initialize_infrun): Install the new "follow-exec-mode" command.
"detach-on-fork" moved here.
* regcache.h (get_regcache_aspace): Declare.
* regcache.c (struct regcache) <aspace>: New field.
(regcache_xmalloc): Clear the aspace.
(get_regcache_aspace): New.
(regcache_cpy): Copy the aspace field.
(regcache_cpy_no_passthrough): Ditto.
(get_thread_regcache): Fetch the thread's address space from the
target, and store it in the regcache.
* infcall.c (call_function_by_hand): Set the sal's pspace.
* arch-utils.c (default_has_shared_address_space): New.
* arch-utils.h (default_has_shared_address_space): Declare.
* gdbarch.sh (has_shared_address_space): New.
* gdbarch.h, gdbarch.c: Regenerate.
* linux-tdep.c: Include auxv.h, target.h, elf/common.h.
(linux_has_shared_address_space): New.
(_initialize_linux_tdep): Declare.
* arm-tdep.c (arm_software_single_step): Pass the frame's address
space to insert_single_step_breakpoint.
* arm-linux-tdep.c (arm_linux_software_single_step): Pass the
frame's pspace to breakpoint functions.
* cris-tdep.c (crisv32_single_step_through_delay): Ditto.
(cris_software_single_step): Ditto.
* mips-tdep.c (deal_with_atomic_sequence): Add frame argument.
Pass the frame's pspace to breakpoint functions.
(mips_software_single_step): Adjust.
(mips_single_step_through_delay): Adjust.
* rs6000-aix-tdep.c (rs6000_software_single_step): Adjust.
* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust.
* solib-irix.c (enable_break): Adjust to pass the current frame's
address space to breakpoint functions.
* sparc-tdep.c (sparc_software_single_step): Ditto.
* spu-tdep.c (spu_software_single_step): Ditto.
* alpha-tdep.c (alpha_software_single_step): Ditto.
* record.c (record_wait): Adjust to pass an address space to the
breakpoints module.
* fork-child.c (fork_inferior): Set the new inferior's program and
address spaces.
* inf-ptrace.c (inf_ptrace_follow_fork): Copy the parent's program
and address spaces.
(inf_ptrace_attach): Set the inferior's program and address spaces.
* linux-nat.c: Include "solib.h".
(linux_child_follow_fork): Manage parent and child's program and
address spaces. Clone the parent's program space if necessary.
Don't wait for the vfork to be done here. Refuse to resume if
following the vfork parent while leaving the child stopped.
(resume_callback): Don't resume a vfork parent.
(linux_nat_resume): Also check for pending events in the
lp->waitstatus field.
(linux_handle_extended_wait): Report TARGET_WAITKIND_VFORK_DONE
events to the core.
(stop_wait_callback): Don't wait for SIGSTOP on vfork parents.
(cancel_breakpoint): Adjust.
* linux-thread-db.c (thread_db_wait): Don't remove thread event
breakpoints here.
(thread_db_mourn_inferior): Don't mark breakpoints out here.
Remove thread event breakpoints after mourning.
* corelow.c: Include progspace.h.
(core_open): Set the inferior's program and address spaces.
* remote.c (remote_add_inferior): Set the new inferior's program
and address spaces.
(remote_start_remote): Update address spaces.
(extended_remote_create_inferior_1): Don't init the thread list if
we already debugging other inferiors.
* darwin-nat.c (darwin_attach): Set the new inferior's program and
address spaces.
* gnu-nat.c (gnu_attach): Ditto.
* go32-nat.c (go32_create_inferior): Ditto.
* inf-ttrace.c (inf_ttrace_follow_fork, inf_ttrace_attach): Ditto.
* monitor.c (monitor_open): Ditto.
* nto-procfs.c (procfs_attach, procfs_create_inferior): Ditto.
* procfs.c (do_attach): Ditto.
* windows-nat.c (do_initial_windows_stuff): Ditto.
* inflow.c (inferior_process_group)
(terminal_init_inferior_with_pgrp, terminal_inferior,
(terminal_ours_1, inflow_inferior_exit, copy_terminal_info)
(child_terminal_info, new_tty_postfork, set_sigint_trap): Adjust
to use per-inferior data instead of inferior->terminal_info.
(inflow_inferior_data): New.
(inflow_new_inferior): Delete.
(inflow_inferior_data_cleanup): New.
(get_inflow_inferior_data): New.
* mi/mi-interp.c (mi_new_inferior): Rename to...
(mi_inferior_appeared): ... this.
(mi_interpreter_init): Adjust.
* tui/tui-disasm.c: Include "progspace.h".
(tui_set_disassem_content): Pass an address space to
breakpoint_here_p.
* NEWS: Mention multi-program debugging support. Mention new
commands "add-inferior", "clone-inferior", "remove-inferior",
"maint info program-spaces", and new option "set
follow-exec-mode".
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/doc/
* observer.texi (new_inferior): Rename to...
(inferior_appeared): ... this.
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/testsuite/
* gdb.base/foll-vfork.exp: Adjust to spell out "follow-fork".
* gdb.base/foll-exec.exp: Adjust to expect a process id before
"Executing new program".
* gdb.base/foll-fork.exp: Adjust to spell out "follow-fork".
* gdb.base/multi-forks.exp: Ditto. Adjust to the inferior being
left listed after having been killed.
* gdb.base/attach.exp: Adjust to spell out "symbol-file".
* gdb.base/maint.exp: Adjust test.
* Makefile.in (ALL_SUBDIRS): Add gdb.multi.
* gdb.multi/Makefile.in: New.
* gdb.multi/base.exp: New.
* gdb.multi/goodbye.c: New.
* gdb.multi/hangout.c: New.
* gdb.multi/hello.c: New.
* gdb.multi/bkpt-multi-exec.c: New.
* gdb.multi/bkpt-multi-exec.exp: New.
* gdb.multi/crashme.c: New.
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/doc/
* gdb.texinfo (Inferiors): Rename node to ...
(Inferiors and Programs): ... this. Mention running multiple
programs in the same debug session.
<info inferiors>: Mention the new 'Executable' column if "info
inferiors". Update examples. Document the "add-inferior",
"clone-inferior", "remove-inferior" and "maint info
program-spaces" commands.
(Process): Rename node to...
(Forks): ... this. Document "set|show follow-exec-mode".
2009-10-19 11:51:43 +02:00
|
|
|
int
|
|
|
|
gdbarch_has_shared_address_space (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->has_shared_address_space != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_has_shared_address_space called\n");
|
|
|
|
return gdbarch->has_shared_address_space (gdbarch);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_has_shared_address_space (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_has_shared_address_space_ftype has_shared_address_space)
|
|
|
|
{
|
|
|
|
gdbarch->has_shared_address_space = has_shared_address_space;
|
|
|
|
}
|
|
|
|
|
2010-01-06 05:20:27 +01:00
|
|
|
int
|
2015-07-30 19:05:00 +02:00
|
|
|
gdbarch_fast_tracepoint_valid_at (struct gdbarch *gdbarch, CORE_ADDR addr, char **msg)
|
2010-01-06 05:20:27 +01:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->fast_tracepoint_valid_at != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_fast_tracepoint_valid_at called\n");
|
2015-07-30 19:05:00 +02:00
|
|
|
return gdbarch->fast_tracepoint_valid_at (gdbarch, addr, msg);
|
2010-01-06 05:20:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_fast_tracepoint_valid_at (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_fast_tracepoint_valid_at_ftype fast_tracepoint_valid_at)
|
|
|
|
{
|
|
|
|
gdbarch->fast_tracepoint_valid_at = fast_tracepoint_valid_at;
|
|
|
|
}
|
|
|
|
|
2016-02-18 09:21:38 +01:00
|
|
|
void
|
|
|
|
gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->guess_tracepoint_registers != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_guess_tracepoint_registers called\n");
|
|
|
|
gdbarch->guess_tracepoint_registers (gdbarch, regcache, addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_guess_tracepoint_registers_ftype guess_tracepoint_registers)
|
|
|
|
{
|
|
|
|
gdbarch->guess_tracepoint_registers = guess_tracepoint_registers;
|
|
|
|
}
|
|
|
|
|
2010-03-05 21:18:19 +01:00
|
|
|
const char *
|
|
|
|
gdbarch_auto_charset (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->auto_charset != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_auto_charset called\n");
|
|
|
|
return gdbarch->auto_charset ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_auto_charset (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_auto_charset_ftype auto_charset)
|
|
|
|
{
|
|
|
|
gdbarch->auto_charset = auto_charset;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
gdbarch_auto_wide_charset (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->auto_wide_charset != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_auto_wide_charset called\n");
|
|
|
|
return gdbarch->auto_wide_charset ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_auto_wide_charset (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_auto_wide_charset_ftype auto_wide_charset)
|
|
|
|
{
|
|
|
|
gdbarch->auto_wide_charset = auto_wide_charset;
|
|
|
|
}
|
|
|
|
|
2010-03-08 20:28:27 +01:00
|
|
|
const char *
|
|
|
|
gdbarch_solib_symbols_extension (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_solib_symbols_extension called\n");
|
|
|
|
return gdbarch->solib_symbols_extension;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_solib_symbols_extension (struct gdbarch *gdbarch,
|
|
|
|
const char * solib_symbols_extension)
|
|
|
|
{
|
|
|
|
gdbarch->solib_symbols_extension = solib_symbols_extension;
|
|
|
|
}
|
|
|
|
|
2010-04-24 15:12:56 +02:00
|
|
|
int
|
|
|
|
gdbarch_has_dos_based_file_system (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of has_dos_based_file_system, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_has_dos_based_file_system called\n");
|
|
|
|
return gdbarch->has_dos_based_file_system;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_has_dos_based_file_system (struct gdbarch *gdbarch,
|
|
|
|
int has_dos_based_file_system)
|
|
|
|
{
|
|
|
|
gdbarch->has_dos_based_file_system = has_dos_based_file_system;
|
|
|
|
}
|
|
|
|
|
2011-09-27 15:09:37 +02:00
|
|
|
void
|
|
|
|
gdbarch_gen_return_address (struct gdbarch *gdbarch, struct agent_expr *ax, struct axs_value *value, CORE_ADDR scope)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->gen_return_address != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_gen_return_address called\n");
|
|
|
|
gdbarch->gen_return_address (gdbarch, ax, value, scope);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_gen_return_address (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_gen_return_address_ftype gen_return_address)
|
|
|
|
{
|
|
|
|
gdbarch->gen_return_address = gen_return_address;
|
|
|
|
}
|
|
|
|
|
2012-01-20 10:49:58 +01:00
|
|
|
int
|
|
|
|
gdbarch_info_proc_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->info_proc != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-06-06 21:38:16 +02:00
|
|
|
gdbarch_info_proc (struct gdbarch *gdbarch, const char *args, enum info_proc_what what)
|
2012-01-20 10:49:58 +01:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->info_proc != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_info_proc called\n");
|
|
|
|
gdbarch->info_proc (gdbarch, args, what);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_info_proc (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_info_proc_ftype info_proc)
|
|
|
|
{
|
|
|
|
gdbarch->info_proc = info_proc;
|
|
|
|
}
|
|
|
|
|
2012-12-14 16:30:38 +01:00
|
|
|
int
|
|
|
|
gdbarch_core_info_proc_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->core_info_proc != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-06-06 21:38:16 +02:00
|
|
|
gdbarch_core_info_proc (struct gdbarch *gdbarch, const char *args, enum info_proc_what what)
|
2012-12-14 16:30:38 +01:00
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->core_info_proc != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_core_info_proc called\n");
|
|
|
|
gdbarch->core_info_proc (gdbarch, args, what);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_core_info_proc (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_core_info_proc_ftype core_info_proc)
|
|
|
|
{
|
|
|
|
gdbarch->core_info_proc = core_info_proc;
|
|
|
|
}
|
|
|
|
|
2012-06-05 15:50:50 +02:00
|
|
|
void
|
|
|
|
gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype *cb, void *cb_data, struct objfile *current_objfile)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->iterate_over_objfiles_in_search_order != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_iterate_over_objfiles_in_search_order called\n");
|
|
|
|
gdbarch->iterate_over_objfiles_in_search_order (gdbarch, cb, cb_data, current_objfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_iterate_over_objfiles_in_search_order_ftype iterate_over_objfiles_in_search_order)
|
|
|
|
{
|
|
|
|
gdbarch->iterate_over_objfiles_in_search_order = iterate_over_objfiles_in_search_order;
|
|
|
|
}
|
|
|
|
|
2012-12-15 15:27:56 +01:00
|
|
|
struct ravenscar_arch_ops *
|
|
|
|
gdbarch_ravenscar_ops (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of ravenscar_ops, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_ravenscar_ops called\n");
|
|
|
|
return gdbarch->ravenscar_ops;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_ravenscar_ops (struct gdbarch *gdbarch,
|
|
|
|
struct ravenscar_arch_ops * ravenscar_ops)
|
|
|
|
{
|
|
|
|
gdbarch->ravenscar_ops = ravenscar_ops;
|
|
|
|
}
|
|
|
|
|
gdbarch: add instruction predicate methods
Add new methods to gdbarch for analyzing the instruction at a given address.
Implement those methods for i386 and amd64 architectures.
This is needed by "record btrace" to detect function calls in the
execution trace.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* amd64-tdep.c (amd64_classify_insn_at, amd64_insn_is_call)
(amd64_insn_is_ret, amd64_insn_is_jump, amd64_jmp_p): New.
(amd64_init_abi): Add insn_is_call, insn_is_ret, and insn_is_jump
to gdbarch.
* i386-tdep.c (i386_insn_is_call, i386_insn_is_ret)
(i386_insn_is_jump, i386_jmp_p): New.
(i386_gdbarch_init): Add insn_is_call, insn_is_ret, and
insn_is_jump to gdbarch.
* gdbarch.sh (insn_is_call, insn_is_ret, insn_is_jump): New.
* gdbarch.h: Regenerated.
* gdbarch.c: Regenerated.
* arch-utils.h (default_insn_is_call, default_insn_is_ret)
(default_insn_is_jump): New.
* arch-utils.c (default_insn_is_call, default_insn_is_ret)
(default_insn_is_jump): New.
2013-03-22 15:56:56 +01:00
|
|
|
int
|
|
|
|
gdbarch_insn_is_call (struct gdbarch *gdbarch, CORE_ADDR addr)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->insn_is_call != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_insn_is_call called\n");
|
|
|
|
return gdbarch->insn_is_call (gdbarch, addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_insn_is_call (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_insn_is_call_ftype insn_is_call)
|
|
|
|
{
|
|
|
|
gdbarch->insn_is_call = insn_is_call;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_insn_is_ret (struct gdbarch *gdbarch, CORE_ADDR addr)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->insn_is_ret != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_insn_is_ret called\n");
|
|
|
|
return gdbarch->insn_is_ret (gdbarch, addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_insn_is_ret (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_insn_is_ret_ftype insn_is_ret)
|
|
|
|
{
|
|
|
|
gdbarch->insn_is_ret = insn_is_ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->insn_is_jump != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_insn_is_jump called\n");
|
|
|
|
return gdbarch->insn_is_jump (gdbarch, addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_insn_is_jump (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_insn_is_jump_ftype insn_is_jump)
|
|
|
|
{
|
|
|
|
gdbarch->insn_is_jump = insn_is_jump;
|
|
|
|
}
|
|
|
|
|
2014-02-27 13:40:15 +01:00
|
|
|
int
|
|
|
|
gdbarch_auxv_parse_p (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
return gdbarch->auxv_parse != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
gdbarch_auxv_parse (struct gdbarch *gdbarch, gdb_byte **readptr, gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->auxv_parse != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_auxv_parse called\n");
|
|
|
|
return gdbarch->auxv_parse (gdbarch, readptr, endptr, typep, valp);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_auxv_parse (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_auxv_parse_ftype auxv_parse)
|
|
|
|
{
|
|
|
|
gdbarch->auxv_parse = auxv_parse;
|
|
|
|
}
|
|
|
|
|
2016-06-12 00:51:38 +02:00
|
|
|
void
|
|
|
|
gdbarch_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file, CORE_ADDR type, CORE_ADDR val)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->print_auxv_entry != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_print_auxv_entry called\n");
|
|
|
|
gdbarch->print_auxv_entry (gdbarch, file, type, val);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_print_auxv_entry (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_print_auxv_entry_ftype print_auxv_entry)
|
|
|
|
{
|
|
|
|
gdbarch->print_auxv_entry = print_auxv_entry;
|
|
|
|
}
|
|
|
|
|
2014-10-10 16:57:13 +02:00
|
|
|
int
|
|
|
|
gdbarch_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->vsyscall_range != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_vsyscall_range called\n");
|
|
|
|
return gdbarch->vsyscall_range (gdbarch, range);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_vsyscall_range (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_vsyscall_range_ftype vsyscall_range)
|
|
|
|
{
|
|
|
|
gdbarch->vsyscall_range = vsyscall_range;
|
|
|
|
}
|
|
|
|
|
2014-05-14 22:08:57 +02:00
|
|
|
CORE_ADDR
|
|
|
|
gdbarch_infcall_mmap (struct gdbarch *gdbarch, CORE_ADDR size, unsigned prot)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->infcall_mmap != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_infcall_mmap called\n");
|
|
|
|
return gdbarch->infcall_mmap (size, prot);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_infcall_mmap (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_infcall_mmap_ftype infcall_mmap)
|
|
|
|
{
|
|
|
|
gdbarch->infcall_mmap = infcall_mmap;
|
|
|
|
}
|
|
|
|
|
2015-06-03 21:22:56 +02:00
|
|
|
void
|
|
|
|
gdbarch_infcall_munmap (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR size)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->infcall_munmap != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_infcall_munmap called\n");
|
|
|
|
gdbarch->infcall_munmap (addr, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_infcall_munmap (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_infcall_munmap_ftype infcall_munmap)
|
|
|
|
{
|
|
|
|
gdbarch->infcall_munmap = infcall_munmap;
|
|
|
|
}
|
|
|
|
|
2014-05-14 22:08:57 +02:00
|
|
|
char *
|
|
|
|
gdbarch_gcc_target_options (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->gcc_target_options != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_gcc_target_options called\n");
|
|
|
|
return gdbarch->gcc_target_options (gdbarch);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_gcc_target_options (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_gcc_target_options_ftype gcc_target_options)
|
|
|
|
{
|
|
|
|
gdbarch->gcc_target_options = gcc_target_options;
|
|
|
|
}
|
|
|
|
|
add gnu_triplet_regexp gdbarch method
gdb has to inform libcc1.so of the target being used, so that the
correct compiler can be invoked. The compiler is invoked using the
GNU configury triplet prefix, e.g., "x86_64-unknown-linux-gnu-gcc".
In order for this to work we need to map the gdbarch to the GNU
configury triplet arch. In most cases these are identical; however,
the x86 family poses some problems, as the BFD arch names are quite
different from the GNU triplet names. So, we introduce a new gdbarch
method for this. A regular expression is used because there are
various valid values for the arch prefix in the triplet.
This patch also updates the osabi code to associate a regular
expression with the OS ABI. I have only added a concrete value for
Linux. Note that the "-gnu" part is optional, at least on Fedora it
is omitted from the installed GCC executable's name.
gdb/ChangeLog
2014-12-12 Tom Tromey <tromey@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* osabi.h (osabi_triplet_regexp): Declare.
* osabi.c (struct osabi_names): New.
(gdb_osabi_names): Change type to struct osabi_names. Update
values.
(gdbarch_osabi_name): Update.
(osabi_triplet_regexp): New function.
(osabi_from_tdesc_string, _initialize_gdb_osabi): Update.
* i386-tdep.c (i386_gnu_triplet_regexp): New method.
(i386_elf_init_abi, i386_go32_init_abi, i386_gdbarch_init): Call
set_gdbarch_gnu_triplet_regexp.
* gdbarch.sh (gnu_triplet_regexp): New method.
* gdbarch.c, gdbarch.h: Rebuild.
* arch-utils.h (default_gnu_triplet_regexp): Declare.
* arch-utils.c (default_gnu_triplet_regexp): New function.
2014-06-13 17:28:24 +02:00
|
|
|
const char *
|
|
|
|
gdbarch_gnu_triplet_regexp (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->gnu_triplet_regexp != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_gnu_triplet_regexp called\n");
|
|
|
|
return gdbarch->gnu_triplet_regexp (gdbarch);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_gnu_triplet_regexp (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_gnu_triplet_regexp_ftype gnu_triplet_regexp)
|
|
|
|
{
|
|
|
|
gdbarch->gnu_triplet_regexp = gnu_triplet_regexp;
|
|
|
|
}
|
|
|
|
|
2015-06-12 22:51:51 +02:00
|
|
|
int
|
|
|
|
gdbarch_addressable_memory_unit_size (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
gdb_assert (gdbarch->addressable_memory_unit_size != NULL);
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_addressable_memory_unit_size called\n");
|
|
|
|
return gdbarch->addressable_memory_unit_size (gdbarch);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_addressable_memory_unit_size (struct gdbarch *gdbarch,
|
|
|
|
gdbarch_addressable_memory_unit_size_ftype addressable_memory_unit_size)
|
|
|
|
{
|
|
|
|
gdbarch->addressable_memory_unit_size = addressable_memory_unit_size;
|
|
|
|
}
|
|
|
|
|
2017-02-28 19:32:07 +01:00
|
|
|
char **
|
|
|
|
gdbarch_disassembler_options (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of disassembler_options, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_disassembler_options called\n");
|
|
|
|
return gdbarch->disassembler_options;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_disassembler_options (struct gdbarch *gdbarch,
|
|
|
|
char ** disassembler_options)
|
|
|
|
{
|
|
|
|
gdbarch->disassembler_options = disassembler_options;
|
|
|
|
}
|
|
|
|
|
|
|
|
const disasm_options_t *
|
|
|
|
gdbarch_valid_disassembler_options (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
/* Skip verify of valid_disassembler_options, invalid_p == 0 */
|
|
|
|
if (gdbarch_debug >= 2)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_valid_disassembler_options called\n");
|
|
|
|
return gdbarch->valid_disassembler_options;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_gdbarch_valid_disassembler_options (struct gdbarch *gdbarch,
|
|
|
|
const disasm_options_t * valid_disassembler_options)
|
|
|
|
{
|
|
|
|
gdbarch->valid_disassembler_options = valid_disassembler_options;
|
|
|
|
}
|
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
|
2000-11-30 04:30:52 +01:00
|
|
|
/* Keep a registry of per-architecture data-pointers required by GDB
|
2011-01-07 20:36:19 +01:00
|
|
|
modules. */
|
1999-06-14 20:08:47 +02:00
|
|
|
|
|
|
|
struct gdbarch_data
|
|
|
|
{
|
2001-02-07 03:17:48 +01:00
|
|
|
unsigned index;
|
2002-06-08 20:09:01 +02:00
|
|
|
int init_p;
|
2004-03-15 21:38:08 +01:00
|
|
|
gdbarch_data_pre_init_ftype *pre_init;
|
|
|
|
gdbarch_data_post_init_ftype *post_init;
|
1999-06-14 20:08:47 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct gdbarch_data_registration
|
1999-07-20 01:30:11 +02:00
|
|
|
{
|
|
|
|
struct gdbarch_data *data;
|
|
|
|
struct gdbarch_data_registration *next;
|
|
|
|
};
|
1999-06-14 20:08:47 +02:00
|
|
|
|
2000-11-30 04:30:52 +01:00
|
|
|
struct gdbarch_data_registry
|
1999-07-20 01:30:11 +02:00
|
|
|
{
|
2001-02-07 03:17:48 +01:00
|
|
|
unsigned nr;
|
1999-07-20 01:30:11 +02:00
|
|
|
struct gdbarch_data_registration *registrations;
|
|
|
|
};
|
1999-06-14 20:08:47 +02:00
|
|
|
|
2000-11-30 04:30:52 +01:00
|
|
|
struct gdbarch_data_registry gdbarch_data_registry =
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
0, NULL,
|
|
|
|
};
|
|
|
|
|
2004-03-15 21:38:08 +01:00
|
|
|
static struct gdbarch_data *
|
|
|
|
gdbarch_data_register (gdbarch_data_pre_init_ftype *pre_init,
|
|
|
|
gdbarch_data_post_init_ftype *post_init)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
struct gdbarch_data_registration **curr;
|
2010-05-13 23:56:58 +02:00
|
|
|
|
|
|
|
/* Append the new registration. */
|
2000-11-30 04:30:52 +01:00
|
|
|
for (curr = &gdbarch_data_registry.registrations;
|
1999-06-14 20:08:47 +02:00
|
|
|
(*curr) != NULL;
|
|
|
|
curr = &(*curr)->next);
|
2013-12-28 23:31:23 +01:00
|
|
|
(*curr) = XNEW (struct gdbarch_data_registration);
|
1999-06-14 20:08:47 +02:00
|
|
|
(*curr)->next = NULL;
|
2013-12-28 23:31:23 +01:00
|
|
|
(*curr)->data = XNEW (struct gdbarch_data);
|
2000-11-30 04:30:52 +01:00
|
|
|
(*curr)->data->index = gdbarch_data_registry.nr++;
|
2004-03-15 21:38:08 +01:00
|
|
|
(*curr)->data->pre_init = pre_init;
|
|
|
|
(*curr)->data->post_init = post_init;
|
2002-06-08 20:09:01 +02:00
|
|
|
(*curr)->data->init_p = 1;
|
1999-06-14 20:08:47 +02:00
|
|
|
return (*curr)->data;
|
|
|
|
}
|
|
|
|
|
2004-03-15 21:38:08 +01:00
|
|
|
struct gdbarch_data *
|
|
|
|
gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *pre_init)
|
|
|
|
{
|
|
|
|
return gdbarch_data_register (pre_init, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct gdbarch_data *
|
|
|
|
gdbarch_data_register_post_init (gdbarch_data_post_init_ftype *post_init)
|
|
|
|
{
|
|
|
|
return gdbarch_data_register (NULL, post_init);
|
|
|
|
}
|
1999-06-14 20:08:47 +02:00
|
|
|
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Create/delete the gdbarch data vector. */
|
2001-02-07 03:17:48 +01:00
|
|
|
|
|
|
|
static void
|
2001-06-06 16:46:30 +02:00
|
|
|
alloc_gdbarch_data (struct gdbarch *gdbarch)
|
2001-02-07 03:17:48 +01:00
|
|
|
{
|
2001-06-06 16:46:30 +02:00
|
|
|
gdb_assert (gdbarch->data == NULL);
|
|
|
|
gdbarch->nr_data = gdbarch_data_registry.nr;
|
2003-07-22 21:49:58 +02:00
|
|
|
gdbarch->data = GDBARCH_OBSTACK_CALLOC (gdbarch, gdbarch->nr_data, void *);
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
2002-06-08 20:09:01 +02:00
|
|
|
/* Initialize the current value of the specified per-architecture
|
2011-01-07 20:36:19 +01:00
|
|
|
data-pointer. */
|
2001-06-06 16:46:30 +02:00
|
|
|
|
2001-02-07 03:17:48 +01:00
|
|
|
void
|
2004-03-15 21:38:08 +01:00
|
|
|
deprecated_set_gdbarch_data (struct gdbarch *gdbarch,
|
|
|
|
struct gdbarch_data *data,
|
|
|
|
void *pointer)
|
2001-02-07 03:17:48 +01:00
|
|
|
{
|
|
|
|
gdb_assert (data->index < gdbarch->nr_data);
|
2003-07-22 21:49:58 +02:00
|
|
|
gdb_assert (gdbarch->data[data->index] == NULL);
|
2004-03-15 21:38:08 +01:00
|
|
|
gdb_assert (data->pre_init == NULL);
|
2001-02-07 03:17:48 +01:00
|
|
|
gdbarch->data[data->index] = pointer;
|
|
|
|
}
|
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
/* Return the current value of the specified per-architecture
|
2011-01-07 20:36:19 +01:00
|
|
|
data-pointer. */
|
1999-06-14 20:08:47 +02:00
|
|
|
|
|
|
|
void *
|
2002-05-12 03:02:58 +02:00
|
|
|
gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2002-05-12 03:02:58 +02:00
|
|
|
gdb_assert (data->index < gdbarch->nr_data);
|
2004-03-15 21:38:08 +01:00
|
|
|
if (gdbarch->data[data->index] == NULL)
|
2002-06-08 20:09:01 +02:00
|
|
|
{
|
2004-03-15 21:38:08 +01:00
|
|
|
/* The data-pointer isn't initialized, call init() to get a
|
|
|
|
value. */
|
|
|
|
if (data->pre_init != NULL)
|
|
|
|
/* Mid architecture creation: pass just the obstack, and not
|
|
|
|
the entire architecture, as that way it isn't possible for
|
|
|
|
pre-init code to refer to undefined architecture
|
|
|
|
fields. */
|
|
|
|
gdbarch->data[data->index] = data->pre_init (gdbarch->obstack);
|
|
|
|
else if (gdbarch->initialized_p
|
|
|
|
&& data->post_init != NULL)
|
|
|
|
/* Post architecture creation: pass the entire architecture
|
|
|
|
(as all fields are valid), but be careful to also detect
|
|
|
|
recursive references. */
|
|
|
|
{
|
|
|
|
gdb_assert (data->init_p);
|
|
|
|
data->init_p = 0;
|
|
|
|
gdbarch->data[data->index] = data->post_init (gdbarch);
|
|
|
|
data->init_p = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
/* The architecture initialization hasn't completed - punt -
|
|
|
|
hope that the caller knows what they are doing. Once
|
|
|
|
deprecated_set_gdbarch_data has been initialized, this can be
|
|
|
|
changed to an internal error. */
|
|
|
|
return NULL;
|
2002-06-08 20:09:01 +02:00
|
|
|
gdb_assert (gdbarch->data[data->index] != NULL);
|
|
|
|
}
|
2002-05-12 03:02:58 +02:00
|
|
|
return gdbarch->data[data->index];
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Keep a registry of the architectures known by GDB. */
|
1999-06-14 20:08:47 +02:00
|
|
|
|
2000-06-10 07:37:47 +02:00
|
|
|
struct gdbarch_registration
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
enum bfd_architecture bfd_architecture;
|
|
|
|
gdbarch_init_ftype *init;
|
2000-06-10 07:37:47 +02:00
|
|
|
gdbarch_dump_tdep_ftype *dump_tdep;
|
1999-06-14 20:08:47 +02:00
|
|
|
struct gdbarch_list *arches;
|
2000-06-10 07:37:47 +02:00
|
|
|
struct gdbarch_registration *next;
|
1999-06-14 20:08:47 +02:00
|
|
|
};
|
|
|
|
|
2000-11-30 04:30:52 +01:00
|
|
|
static struct gdbarch_registration *gdbarch_registry = NULL;
|
1999-06-14 20:08:47 +02:00
|
|
|
|
2000-06-07 06:38:02 +02:00
|
|
|
static void
|
|
|
|
append_name (const char ***buf, int *nr, const char *name)
|
|
|
|
{
|
2015-08-26 23:31:47 +02:00
|
|
|
*buf = XRESIZEVEC (const char *, *buf, *nr + 1);
|
2000-06-07 06:38:02 +02:00
|
|
|
(*buf)[*nr] = name;
|
|
|
|
*nr += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char **
|
|
|
|
gdbarch_printable_names (void)
|
|
|
|
{
|
2003-08-17 03:06:47 +02:00
|
|
|
/* Accumulate a list of names based on the registed list of
|
2011-01-07 20:36:19 +01:00
|
|
|
architectures. */
|
2003-08-17 03:06:47 +02:00
|
|
|
int nr_arches = 0;
|
|
|
|
const char **arches = NULL;
|
|
|
|
struct gdbarch_registration *rego;
|
2010-05-13 23:56:58 +02:00
|
|
|
|
2003-08-17 03:06:47 +02:00
|
|
|
for (rego = gdbarch_registry;
|
|
|
|
rego != NULL;
|
|
|
|
rego = rego->next)
|
2000-06-07 06:38:02 +02:00
|
|
|
{
|
2003-08-17 03:06:47 +02:00
|
|
|
const struct bfd_arch_info *ap;
|
|
|
|
ap = bfd_lookup_arch (rego->bfd_architecture, 0);
|
|
|
|
if (ap == NULL)
|
|
|
|
internal_error (__FILE__, __LINE__,
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-11 19:13:55 +01:00
|
|
|
_("gdbarch_architecture_names: multi-arch unknown"));
|
2003-08-17 03:06:47 +02:00
|
|
|
do
|
|
|
|
{
|
|
|
|
append_name (&arches, &nr_arches, ap->printable_name);
|
|
|
|
ap = ap->next;
|
|
|
|
}
|
|
|
|
while (ap != NULL);
|
2000-06-07 06:38:02 +02:00
|
|
|
}
|
2003-08-17 03:06:47 +02:00
|
|
|
append_name (&arches, &nr_arches, NULL);
|
|
|
|
return arches;
|
2000-06-07 06:38:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-06-14 20:08:47 +02:00
|
|
|
void
|
2000-06-10 07:37:47 +02:00
|
|
|
gdbarch_register (enum bfd_architecture bfd_architecture,
|
|
|
|
gdbarch_init_ftype *init,
|
|
|
|
gdbarch_dump_tdep_ftype *dump_tdep)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2000-06-10 07:37:47 +02:00
|
|
|
struct gdbarch_registration **curr;
|
1999-06-14 20:08:47 +02:00
|
|
|
const struct bfd_arch_info *bfd_arch_info;
|
2010-05-13 23:56:58 +02:00
|
|
|
|
2000-10-27 21:17:57 +02:00
|
|
|
/* Check that BFD recognizes this architecture */
|
1999-06-14 20:08:47 +02:00
|
|
|
bfd_arch_info = bfd_lookup_arch (bfd_architecture, 0);
|
|
|
|
if (bfd_arch_info == NULL)
|
|
|
|
{
|
2001-02-08 07:03:54 +01:00
|
|
|
internal_error (__FILE__, __LINE__,
|
2011-01-07 20:36:19 +01:00
|
|
|
_("gdbarch: Attempt to register "
|
|
|
|
"unknown architecture (%d)"),
|
2001-02-08 07:03:54 +01:00
|
|
|
bfd_architecture);
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Check that we haven't seen this architecture before. */
|
2000-11-30 04:30:52 +01:00
|
|
|
for (curr = &gdbarch_registry;
|
1999-06-14 20:08:47 +02:00
|
|
|
(*curr) != NULL;
|
|
|
|
curr = &(*curr)->next)
|
|
|
|
{
|
|
|
|
if (bfd_architecture == (*curr)->bfd_architecture)
|
2001-02-08 07:03:54 +01:00
|
|
|
internal_error (__FILE__, __LINE__,
|
2011-06-04 01:47:46 +02:00
|
|
|
_("gdbarch: Duplicate registration "
|
2011-01-07 20:36:19 +01:00
|
|
|
"of architecture (%s)"),
|
2001-02-08 07:03:54 +01:00
|
|
|
bfd_arch_info->printable_name);
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
/* log it */
|
|
|
|
if (gdbarch_debug)
|
2009-01-09 12:06:48 +01:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "register_gdbarch_init (%s, %s)\n",
|
1999-06-14 20:08:47 +02:00
|
|
|
bfd_arch_info->printable_name,
|
2009-01-09 12:06:48 +01:00
|
|
|
host_address_to_string (init));
|
1999-06-14 20:08:47 +02:00
|
|
|
/* Append it */
|
2013-12-28 23:31:23 +01:00
|
|
|
(*curr) = XNEW (struct gdbarch_registration);
|
1999-06-14 20:08:47 +02:00
|
|
|
(*curr)->bfd_architecture = bfd_architecture;
|
|
|
|
(*curr)->init = init;
|
2000-06-10 07:37:47 +02:00
|
|
|
(*curr)->dump_tdep = dump_tdep;
|
1999-06-14 20:08:47 +02:00
|
|
|
(*curr)->arches = NULL;
|
|
|
|
(*curr)->next = NULL;
|
2000-06-10 07:37:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
register_gdbarch_init (enum bfd_architecture bfd_architecture,
|
|
|
|
gdbarch_init_ftype *init)
|
|
|
|
{
|
|
|
|
gdbarch_register (bfd_architecture, init, NULL);
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-28 23:10:26 +01:00
|
|
|
/* Look for an architecture using gdbarch_info. */
|
1999-06-14 20:08:47 +02:00
|
|
|
|
|
|
|
struct gdbarch_list *
|
1999-08-31 03:14:27 +02:00
|
|
|
gdbarch_list_lookup_by_info (struct gdbarch_list *arches,
|
|
|
|
const struct gdbarch_info *info)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
for (; arches != NULL; arches = arches->next)
|
|
|
|
{
|
|
|
|
if (info->bfd_arch_info != arches->gdbarch->bfd_arch_info)
|
|
|
|
continue;
|
|
|
|
if (info->byte_order != arches->gdbarch->byte_order)
|
|
|
|
continue;
|
2003-01-05 00:38:46 +01:00
|
|
|
if (info->osabi != arches->gdbarch->osabi)
|
|
|
|
continue;
|
2006-11-28 23:10:26 +01:00
|
|
|
if (info->target_desc != arches->gdbarch->target_desc)
|
|
|
|
continue;
|
1999-06-14 20:08:47 +02:00
|
|
|
return arches;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-11-10 05:39:17 +01:00
|
|
|
/* Find an architecture that matches the specified INFO. Create a new
|
2009-07-02 19:29:17 +02:00
|
|
|
architecture if needed. Return that new architecture. */
|
1999-06-14 20:08:47 +02:00
|
|
|
|
2009-07-02 19:29:17 +02:00
|
|
|
struct gdbarch *
|
|
|
|
gdbarch_find_by_info (struct gdbarch_info info)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
|
|
|
struct gdbarch *new_gdbarch;
|
2000-06-10 07:37:47 +02:00
|
|
|
struct gdbarch_registration *rego;
|
1999-06-14 20:08:47 +02:00
|
|
|
|
2001-05-14 18:43:35 +02:00
|
|
|
/* Fill in missing parts of the INFO struct using a number of
|
2006-11-10 20:20:37 +01:00
|
|
|
sources: "set ..."; INFOabfd supplied; and the global
|
|
|
|
defaults. */
|
|
|
|
gdbarch_info_fill (&info);
|
2003-01-05 00:38:46 +01:00
|
|
|
|
2011-01-07 20:36:19 +01:00
|
|
|
/* Must have found some sort of architecture. */
|
2001-05-14 18:43:35 +02:00
|
|
|
gdb_assert (info.bfd_arch_info != NULL);
|
1999-06-14 20:08:47 +02:00
|
|
|
|
|
|
|
if (gdbarch_debug)
|
|
|
|
{
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
2009-07-02 19:29:17 +02:00
|
|
|
"gdbarch_find_by_info: info.bfd_arch_info %s\n",
|
1999-06-14 20:08:47 +02:00
|
|
|
(info.bfd_arch_info != NULL
|
|
|
|
? info.bfd_arch_info->printable_name
|
|
|
|
: "(null)"));
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
2009-07-02 19:29:17 +02:00
|
|
|
"gdbarch_find_by_info: info.byte_order %d (%s)\n",
|
1999-06-14 20:08:47 +02:00
|
|
|
info.byte_order,
|
2002-01-05 05:30:46 +01:00
|
|
|
(info.byte_order == BFD_ENDIAN_BIG ? "big"
|
2001-12-15 17:53:24 +01:00
|
|
|
: info.byte_order == BFD_ENDIAN_LITTLE ? "little"
|
1999-06-14 20:08:47 +02:00
|
|
|
: "default"));
|
2003-01-05 00:38:46 +01:00
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
2009-07-02 19:29:17 +02:00
|
|
|
"gdbarch_find_by_info: info.osabi %d (%s)\n",
|
2003-01-05 00:38:46 +01:00
|
|
|
info.osabi, gdbarch_osabi_name (info.osabi));
|
1999-06-14 20:08:47 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
2009-07-02 19:29:17 +02:00
|
|
|
"gdbarch_find_by_info: info.abfd %s\n",
|
2009-01-09 12:06:48 +01:00
|
|
|
host_address_to_string (info.abfd));
|
1999-06-14 20:08:47 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
2009-07-02 19:29:17 +02:00
|
|
|
"gdbarch_find_by_info: info.tdep_info %s\n",
|
2009-01-09 12:06:48 +01:00
|
|
|
host_address_to_string (info.tdep_info));
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
2003-11-10 05:39:17 +01:00
|
|
|
/* Find the tdep code that knows about this architecture. */
|
2001-05-14 18:43:35 +02:00
|
|
|
for (rego = gdbarch_registry;
|
|
|
|
rego != NULL;
|
|
|
|
rego = rego->next)
|
|
|
|
if (rego->bfd_architecture == info.bfd_arch_info->arch)
|
|
|
|
break;
|
|
|
|
if (rego == NULL)
|
|
|
|
{
|
|
|
|
if (gdbarch_debug)
|
2009-07-02 19:29:17 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
|
2003-11-10 05:39:17 +01:00
|
|
|
"No matching architecture\n");
|
2001-05-14 18:43:35 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-11-10 05:39:17 +01:00
|
|
|
/* Ask the tdep code for an architecture that matches "info". */
|
1999-06-14 20:08:47 +02:00
|
|
|
new_gdbarch = rego->init (info, rego->arches);
|
|
|
|
|
2003-11-10 05:39:17 +01:00
|
|
|
/* Did the tdep code like it? No. Reject the change and revert to
|
|
|
|
the old architecture. */
|
1999-06-14 20:08:47 +02:00
|
|
|
if (new_gdbarch == NULL)
|
|
|
|
{
|
|
|
|
if (gdbarch_debug)
|
2009-07-02 19:29:17 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
|
2003-11-10 05:39:17 +01:00
|
|
|
"Target rejected architecture\n");
|
|
|
|
return NULL;
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
2003-11-10 05:39:17 +01:00
|
|
|
/* Is this a pre-existing architecture (as determined by already
|
|
|
|
being initialized)? Move it to the front of the architecture
|
|
|
|
list (keeping the list sorted Most Recently Used). */
|
|
|
|
if (new_gdbarch->initialized_p)
|
1999-06-14 20:08:47 +02:00
|
|
|
{
|
2003-11-10 05:39:17 +01:00
|
|
|
struct gdbarch_list **list;
|
2015-02-27 17:33:07 +01:00
|
|
|
struct gdbarch_list *self;
|
1999-06-14 20:08:47 +02:00
|
|
|
if (gdbarch_debug)
|
2009-07-02 19:29:17 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
|
2009-01-09 12:06:48 +01:00
|
|
|
"Previous architecture %s (%s) selected\n",
|
|
|
|
host_address_to_string (new_gdbarch),
|
1999-06-14 20:08:47 +02:00
|
|
|
new_gdbarch->bfd_arch_info->printable_name);
|
2003-11-10 05:39:17 +01:00
|
|
|
/* Find the existing arch in the list. */
|
|
|
|
for (list = ®o->arches;
|
|
|
|
(*list) != NULL && (*list)->gdbarch != new_gdbarch;
|
|
|
|
list = &(*list)->next);
|
|
|
|
/* It had better be in the list of architectures. */
|
|
|
|
gdb_assert ((*list) != NULL && (*list)->gdbarch == new_gdbarch);
|
2015-02-27 17:33:07 +01:00
|
|
|
/* Unlink SELF. */
|
|
|
|
self = (*list);
|
|
|
|
(*list) = self->next;
|
|
|
|
/* Insert SELF at the front. */
|
|
|
|
self->next = rego->arches;
|
|
|
|
rego->arches = self;
|
2003-11-10 05:39:17 +01:00
|
|
|
/* Return it. */
|
|
|
|
return new_gdbarch;
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
2003-11-10 05:39:17 +01:00
|
|
|
/* It's a new architecture. */
|
|
|
|
if (gdbarch_debug)
|
2009-07-02 19:29:17 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
|
2009-01-09 12:06:48 +01:00
|
|
|
"New architecture %s (%s) selected\n",
|
|
|
|
host_address_to_string (new_gdbarch),
|
2003-11-10 05:39:17 +01:00
|
|
|
new_gdbarch->bfd_arch_info->printable_name);
|
|
|
|
|
|
|
|
/* Insert the new architecture into the front of the architecture
|
|
|
|
list (keep the list sorted Most Recently Used). */
|
2002-04-20 19:41:18 +02:00
|
|
|
{
|
2015-02-27 17:33:07 +01:00
|
|
|
struct gdbarch_list *self = XNEW (struct gdbarch_list);
|
|
|
|
self->next = rego->arches;
|
|
|
|
self->gdbarch = new_gdbarch;
|
|
|
|
rego->arches = self;
|
2002-04-20 19:41:18 +02:00
|
|
|
}
|
1999-06-14 20:08:47 +02:00
|
|
|
|
2000-06-10 07:37:47 +02:00
|
|
|
/* Check that the newly installed architecture is valid. Plug in
|
|
|
|
any post init values. */
|
|
|
|
new_gdbarch->dump_tdep = rego->dump_tdep;
|
1999-06-14 20:08:47 +02:00
|
|
|
verify_gdbarch (new_gdbarch);
|
2003-11-10 05:39:17 +01:00
|
|
|
new_gdbarch->initialized_p = 1;
|
1999-06-14 20:08:47 +02:00
|
|
|
|
2000-06-10 07:37:47 +02:00
|
|
|
if (gdbarch_debug)
|
2003-11-10 05:39:17 +01:00
|
|
|
gdbarch_dump (new_gdbarch, gdb_stdlog);
|
2000-06-10 07:37:47 +02:00
|
|
|
|
2003-11-10 05:39:17 +01:00
|
|
|
return new_gdbarch;
|
1999-06-14 20:08:47 +02:00
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
* gdbarch.sh (gdbarch_swap_ftype, deprecated_register_gdbarch_swap,
DEPRECATED_REGISTER_GDBARCH_SWAP): Remove.
(struct gdbarch_swap, struct gdbarch_swap_registration,
struct gdbarch_swap_registry, gdbarch_swap_registry,
current_gdbarch_swap_init_hack, current_gdbarch_swap_out_hack,
current_gdbarch_swap_in_hack): Remove.
(find_arch_by_info): Do not call current_gdbarch_swap_init_hack.
(gdbarch_find_by_info): Do not call current_gdbarch_swap_in_hack
and current_gdbarch_swap_out_hack, update current_gdbarch directly.
(deprecated_current_gdbarch_select_hack): Likewise.
* gdbarch.h, gdbarch.c: Regenerate.
2007-06-22 14:45:38 +02:00
|
|
|
/* Make the specified architecture current. */
|
2003-11-10 05:39:17 +01:00
|
|
|
|
|
|
|
void
|
2012-11-14 16:40:35 +01:00
|
|
|
set_target_gdbarch (struct gdbarch *new_gdbarch)
|
2003-11-10 05:39:17 +01:00
|
|
|
{
|
|
|
|
gdb_assert (new_gdbarch != NULL);
|
|
|
|
gdb_assert (new_gdbarch->initialized_p);
|
2012-11-09 02:47:20 +01:00
|
|
|
current_inferior ()->gdbarch = new_gdbarch;
|
gdb:
* tui/tui-hooks.c: Include observer.h.
(tui_event_default, tui_old_event_hooks, tui_event_hooks):
Remove.
(tui_bp_created_observer, tui_bp_deleted_observer,
tui_bp_modified_observer): New globals.
(tui_install_hooks): Use observers, not events.
(tui_remove_hooks): Likewise.
* mi/mi-cmd-break.c: Include observer.h, not gdb-events.h.
(mi_breakpoint_observers_installed, mi_can_breakpoint_notify): New
globals.
(breakpoint_notify): Check mi_can_breakpoint_notify.
(breakpoint_hooks): Remove.
(mi_cmd_break_insert): Attach observers. Don't use events.
* tracepoint.c: Include observer.h, not gdb-events.h.
(tracepoint_operation, trace_pass_command): Notify observer.
* interps.c: Don't include gdb-events.h.
(clear_interpreter_hooks): Don't call clear_gdb_event_hooks.
* gdbarch.c: Rebuild.
* gdbarch.sh: Emit include for observer.h, not gdb-events.h.
(deprecated_current_gdbarch_select_hack): Notify observer.
* breakpoint.h: Don't include gdb-events.h.
* breakpoint.c: Don't include gdb-events.h.
(condition_command): Notify observer.
(commands_command): Likewise.
(commands_from_control_command): Likewise.
(mention, delete_breakpoint, set_ignore_count): Likewise.
(disable_breakpoint, do_enable_breakpoint): Likewise.
* Makefile.in (gdb_events_h): Remove.
(breakpoint_h): Update.
(COMMON_OBS): Remove gdb-events.o.
(gdb-events.o): Remove.
(breakpoint.o, gdbarch.o, interps.o, tracepoint.o, gdbtk-bp.o,
gdbtk-hooks.o, mi-cmd-break.o, tui-hooks.o): Update.
* gdb-events.c: Remove.
* gdb-events.h: Remove.
* gdb-events.sh: Remove.
gdb/doc:
* observer.texi (GDB Observers): Document new observers:
breakpoint_created, breakpoint_deleted, breakpoint_modified,
tracepoint_created, tracepoint_deleted, tracepoint_modified,
architecture_changed.
gdb/gdbtk:
* generic/gdbtk-hooks.c: Include observer.h, not gdb-events.h.
(gdbtk_add_hooks): Use observers, not events.
(gdbtk_architecture_changed): Add argument, for observer.
* generic/gdbtk-bp.c: Include observer.h.
(gdb_set_bp): Notify observer.
(gdb_set_bp_addr): Likewise.
2008-07-25 18:12:03 +02:00
|
|
|
observer_notify_architecture_changed (new_gdbarch);
|
2008-08-22 15:35:00 +02:00
|
|
|
registers_changed ();
|
2003-11-10 05:39:17 +01:00
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
* gdbarch.sh (target_gdbarch): Remove macro.
(get_target_gdbarch): Rename to target_gdbarch.
* gdbarch.c, gdbarch.h: Rebuild.
* ada-tasks.c, aix-thread.c, amd64-linux-nat.c, arch-utils.c,
arm-tdep.c, auxv.c, breakpoint.c, bsd-uthread.c, corefile.c,
darwin-nat-info.c, dcache.c, dsrec.c, exec.c, fbsd-nat.c,
filesystem.c, gcore.c, gnu-nat.c, i386-darwin-nat.c, i386-nat.c,
ia64-vms-tdep.c, inf-ptrace.c, infcmd.c, jit.c, linux-nat.c,
linux-tdep.c, linux-thread-db.c, m32r-rom.c, memattr.c,
mep-tdep.c, microblaze-tdep.c, mips-linux-nat.c,
mips-linux-tdep.c, mips-tdep.c, monitor.c, moxie-tdep.c,
nto-procfs.c, nto-tdep.c, ppc-linux-nat.c, proc-service.c,
procfs.c, progspace.c, ravenscar-thread.c, record.c,
remote-m32r-sdi.c, remote-mips.c, remote-sim.c, remote.c,
rl78-tdep.c, rs6000-nat.c, rx-tdep.c, s390-nat.c, sol-thread.c,
solib-darwin.c, solib-dsbt.c, solib-frv.c, solib-ia64-hpux.c,
solib-irix.c, solib-pa64.c, solib-som.c, solib-spu.c,
solib-sunos.c, solib-svr4.c, solib.c, spu-linux-nat.c,
spu-multiarch.c, spu-tdep.c, symfile-mem.c, symfile.c, symtab.c,
target-descriptions.c, target.c, target.h, tracepoint.c,
windows-nat.c, windows-tdep.c, xcoffsolib.c, cli/cli-dump.c,
common/agent.c, mi/mi-interp.c, python/py-finishbreakpoint.c,
python/py-inferior.c, python/python.c: Update.
2012-11-09 20:58:03 +01:00
|
|
|
/* Return the current inferior's arch. */
|
2012-11-09 02:47:20 +01:00
|
|
|
|
|
|
|
struct gdbarch *
|
* gdbarch.sh (target_gdbarch): Remove macro.
(get_target_gdbarch): Rename to target_gdbarch.
* gdbarch.c, gdbarch.h: Rebuild.
* ada-tasks.c, aix-thread.c, amd64-linux-nat.c, arch-utils.c,
arm-tdep.c, auxv.c, breakpoint.c, bsd-uthread.c, corefile.c,
darwin-nat-info.c, dcache.c, dsrec.c, exec.c, fbsd-nat.c,
filesystem.c, gcore.c, gnu-nat.c, i386-darwin-nat.c, i386-nat.c,
ia64-vms-tdep.c, inf-ptrace.c, infcmd.c, jit.c, linux-nat.c,
linux-tdep.c, linux-thread-db.c, m32r-rom.c, memattr.c,
mep-tdep.c, microblaze-tdep.c, mips-linux-nat.c,
mips-linux-tdep.c, mips-tdep.c, monitor.c, moxie-tdep.c,
nto-procfs.c, nto-tdep.c, ppc-linux-nat.c, proc-service.c,
procfs.c, progspace.c, ravenscar-thread.c, record.c,
remote-m32r-sdi.c, remote-mips.c, remote-sim.c, remote.c,
rl78-tdep.c, rs6000-nat.c, rx-tdep.c, s390-nat.c, sol-thread.c,
solib-darwin.c, solib-dsbt.c, solib-frv.c, solib-ia64-hpux.c,
solib-irix.c, solib-pa64.c, solib-som.c, solib-spu.c,
solib-sunos.c, solib-svr4.c, solib.c, spu-linux-nat.c,
spu-multiarch.c, spu-tdep.c, symfile-mem.c, symfile.c, symtab.c,
target-descriptions.c, target.c, target.h, tracepoint.c,
windows-nat.c, windows-tdep.c, xcoffsolib.c, cli/cli-dump.c,
common/agent.c, mi/mi-interp.c, python/py-finishbreakpoint.c,
python/py-inferior.c, python/python.c: Update.
2012-11-09 20:58:03 +01:00
|
|
|
target_gdbarch (void)
|
2012-11-09 02:47:20 +01:00
|
|
|
{
|
|
|
|
return current_inferior ()->gdbarch;
|
|
|
|
}
|
|
|
|
|
1999-08-31 03:14:27 +02:00
|
|
|
extern void _initialize_gdbarch (void);
|
2000-06-07 06:38:02 +02:00
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
void
|
2000-08-02 13:05:50 +02:00
|
|
|
_initialize_gdbarch (void)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2012-08-02 11:36:40 +02:00
|
|
|
add_setshow_zuinteger_cmd ("arch", class_maintenance, &gdbarch_debug, _("\
|
2005-02-18 Andrew Cagney <cagney@gnu.org>
Use add_setshow_zinteger_cmd through out. Re-sync gdbarch.sh
and gdbarch.c.
* breakpoint.c, frame.c, gdb-events.sh, gdbarch.sh: Update.
* gdbtypes.c, infrun.c, linux-nat.c, maint.c, monitor.c: Update.
* pa64solib.c, parse.c, remote-mips.c, ser-go32.c: Update.
* serial.c, solib-frv.c, somsolib.c, target.c, top.c: Update.
* varobj.c, cli/cli-cmds.c: Update.
* gdbarch.c, gdb-events.c: Regenerate.
2005-02-18 19:58:56 +01:00
|
|
|
Set architecture debugging."), _("\
|
|
|
|
Show architecture debugging."), _("\
|
|
|
|
When non-zero, architecture debugging is enabled."),
|
|
|
|
NULL,
|
2005-02-24 Andrew Cagney <cagney@gnu.org>
Add show_VARIABLE functions, update add_setshow call.
* varobj.c (_initialize_varobj, show_varobjdebug): Add and update.
* valprint.c (_initialize_valprint, show_print_max)
(show_stop_print_at_null, show_repeat_count_threshold)
(show_prettyprint_structs, show_unionprint)
(show_prettyprint_arrays, show_addressprint, show_input_radix)
(show_output_radix): Ditto.
* valops.c (_initialize_valops, show_overload_resolution): Ditto.
* utils.c (initialize_utils, show_chars_per_line)
(show_lines_per_page, show_demangle, show_pagination_enabled)
(show_sevenbit_strings, show_asm_demangle): Ditto
* tui/tui-win.c (_initialize_tui_win, show_tui_border_kind)
(show_tui_border_mode, show_tui_active_border_mode): Ditto.
* top.c (init_main, show_new_async_prompt)
(show_async_command_editing_p, show_write_history_p)
(show_history_size, show_history_filename, show_caution)
(show_annotation_level, init_main): Ditto.
* target.c (initialize_targets, show_targetdebug)
(show_trust_readonly): Ditto.
* symfile.c (_initialize_symfile, show_symbol_reloading)
(show_ext_args, show_download_write_size)
(show_debug_file_directory): Ditto.
* source.c (_initialize_source, show_lines_to_list): Ditto.
* solib.c (_initialize_solib, show_auto_solib_add)
(show_solib_search_path): Ditto.
* p-valprint.c (_initialize_pascal_valprint)
(show_pascal_static_field_print): Ditto.
* printcmd.c (_initialize_printcmd, show_max_symbolic_offset)
(show_print_symbol_filename): Add and update.
* parse.c (_initialize_parse, show_expressiondebug): Dito.
* observer.c (_initialize_observer, show_observer_debug): Dito.
* maint.c (_initialize_maint_cmds, show_watchdog)
(show_maintenance_profile_p): Dito.
* linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito.
* infrun.c (_initialize_infrun, show_debug_infrun)
(show_stop_on_solib_events, show_follow_fork_mode_string)
(show_scheduler_mode, show_step_stop_if_no_debug): Ditto.
* infcall.c (_initialize_infcall, show_coerce_float_to_double_p)
(show_unwind_on_signal_p): Ditto.
* gdbtypes.c (build_gdbtypes, show_opaque_type_resolution)
(_initialize_gdbtypes, show_overload_debug): Ditto.
* gdb-events.c, gdb-events.sh (_initialize_gdb_events)
(show_gdb_events_debug): Ditto.
* gdbarch.c, gdbarch.sh (show_gdbarch_debug)
(_initialize_gdbarch): Ditto.
* frame.c (_initialize_frame, show_backtrace_past_main)
(show_backtrace_past_entry, show_backtrace_limit)
(show_frame_debug): Ditto.
* exec.c (_initialize_exec, show_write_files): Ditto.
* dwarf2read.c (_initialize_dwarf2_read)
(show_dwarf2_max_cache_age): Ditto.
* demangle.c (_initialize_demangler)
(show_demangling_style_names): Ditto.
* dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto.
* cp-valprint.c (show_static_field_print)
(_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto.
* corefile.c (_initialize_core, show_gnutarget_string): Ditto.
* cli/cli-logging.c (_initialize_cli_logging)
(show_logging_overwrite, show_logging_redirect)
(show_logging_filename): Ditto.
* cli/cli-cmds.c (show_info_verbose, show_history_expansion_p)
(init_cli_cmds, show_baud_rate, show_remote_debug)
(show_remote_timeout, show_max_user_call_depth): Ditto.
* charset.c (show_host_charset_name, show_target_charset_name)
(initialize_charset): Ditto.
* breakpoint.c (show_can_use_hw_watchpoints)
(show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
|
|
|
show_gdbarch_debug,
|
2005-02-18 Andrew Cagney <cagney@gnu.org>
Use add_setshow_zinteger_cmd through out. Re-sync gdbarch.sh
and gdbarch.c.
* breakpoint.c, frame.c, gdb-events.sh, gdbarch.sh: Update.
* gdbtypes.c, infrun.c, linux-nat.c, maint.c, monitor.c: Update.
* pa64solib.c, parse.c, remote-mips.c, ser-go32.c: Update.
* serial.c, solib-frv.c, somsolib.c, target.c, top.c: Update.
* varobj.c, cli/cli-cmds.c: Update.
* gdbarch.c, gdb-events.c: Regenerate.
2005-02-18 19:58:56 +01:00
|
|
|
&setdebuglist, &showdebuglist);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|