2000-04-03 08:00:32 +08:00
|
|
|
|
/* Dynamic architecture support for GDB, the GNU debugger.
|
2002-04-19 02:09:09 +08:00
|
|
|
|
|
2012-01-04 16:17:56 +08:00
|
|
|
|
Copyright (C) 1998-2012 Free Software Foundation, Inc.
|
2000-04-03 08:00:32 +08: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-24 02:08:50 +08:00
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2000-04-03 08:00:32 +08:00
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-24 02:08:50 +08:00
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2000-04-03 08:00:32 +08:00
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
|
2001-12-19 22:14:52 +08:00
|
|
|
|
#include "arch-utils.h"
|
2003-09-18 03:48:42 +08:00
|
|
|
|
#include "buildsym.h"
|
2000-04-03 08:00:32 +08:00
|
|
|
|
#include "gdbcmd.h"
|
2011-01-01 03:16:37 +08:00
|
|
|
|
#include "inferior.h" /* enum CALL_DUMMY_LOCATION et al. */
|
2002-07-30 Andrew Cagney <ac131313@redhat.com>
* symtab.h: Replace #include "gdb_obstack.h" with opaque
declaration.
* cli/cli-cmds.c, cli/cli-script.c: Include "gdb_string.h".
* gnu-v3-abi.c, arc-tdep.c, cli/cli-decode.c: Ditto.
* avr-tdep.c, mon960-rom.c, i960-tdep.c: Ditto.
* arch-utils.c, cli/cli-setshow.c: Unconditionally include
"gdb_string.h".
* Makefile.in (cli-script.o, cli-cmds.o): Update dependencies.
(gnu-v3-abi.o, cli-setshow.o, i960-tdep.o): Ditto.
(cli-decode.o, mi-cmd-var.o, mi-cmd-disas.o): Ditto.
(avr-tdep.o, mon960-rom.o): Ditto.
(aout_stabs_gnu_h): Define.
(symtab_h): Remove $(gdb_obstack_h).
2002-07-30 21:45:15 +08:00
|
|
|
|
#include "gdb_string.h"
|
2001-04-19 08:37:24 +08:00
|
|
|
|
#include "regcache.h"
|
2001-08-11 08:59:29 +08:00
|
|
|
|
#include "gdb_assert.h"
|
2002-05-30 00:39:56 +08:00
|
|
|
|
#include "sim-regno.h"
|
2004-06-21 02:10:14 +08:00
|
|
|
|
#include "gdbcore.h"
|
2003-11-10 07:52:28 +08:00
|
|
|
|
#include "osabi.h"
|
2006-11-29 06:10:26 +08:00
|
|
|
|
#include "target-descriptions.h"
|
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-03 00:49:54 +08:00
|
|
|
|
#include "objfiles.h"
|
2003-11-10 07:52:28 +08:00
|
|
|
|
|
2000-06-08 12:00:56 +08:00
|
|
|
|
#include "version.h"
|
|
|
|
|
|
2000-06-02 09:59:13 +08:00
|
|
|
|
#include "floatformat.h"
|
|
|
|
|
|
2003-06-13 07:25:37 +08:00
|
|
|
|
|
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-03 00:49:54 +08:00
|
|
|
|
struct displaced_step_closure *
|
|
|
|
|
simple_displaced_step_copy_insn (struct gdbarch *gdbarch,
|
|
|
|
|
CORE_ADDR from, CORE_ADDR to,
|
|
|
|
|
struct regcache *regs)
|
|
|
|
|
{
|
|
|
|
|
size_t len = gdbarch_max_insn_length (gdbarch);
|
|
|
|
|
gdb_byte *buf = xmalloc (len);
|
|
|
|
|
|
|
|
|
|
read_memory (from, buf, len);
|
|
|
|
|
write_memory (to, buf, len);
|
|
|
|
|
|
|
|
|
|
if (debug_displaced)
|
|
|
|
|
{
|
* defs.h (strlen_paddr, paddr, paddr_nz): Remove.
(paddress): Add GDBARCH parameter.
* utils.c (strlen_paddr, paddr, paddr_nz): Remove.
(paddress): Add GDBARCH parameter, use it instead of current_gdbarch.
* ui-out.h (ui_out_field_core_addr): Add GDBARCH parameter.
* ui-out.c (ui_out_field_core_addr): Add GDBARCH parameter,
use it instead of current_gdbarch.
Update calls to ui_out_field_core_addr to pass architecture:
* ada-lang.c (print_one_exception): Update.
* breakpoint.c (print_one_breakpoint_location,
print_one_exception_catchpoint): Update.
* disasm.c (dump_insns): Update.
* darwin-nat-info.c (darwin_debug_regions_recurse): Update.
* mi/mi-main.c (mi_cmd_data_read_memory): Update.
* mi/mi-symbol-cmds.c: Include "objfiles.h".
(mi_cmd_symbol_list_lines): Update.
* stack.c (print_frame_info, print_frame): Update.
Update callers of paddress to pass architecture:
* ada-tasks.c (info_task): Update.
* ada-valprint.c (ada_val_print_1): Update.
* annotate.c (annotate_source, annotate_frame_begin): Update.
* breakpoint.c (insert_bp_location, describe_other_breakpoints,
mention): Update.
* cli/cli-cmds.c (edit_command, list_command, print_disassembly):
Update.
* corefile.c (memory_error): Update.
* c-valprint.c (print_function_pointer_address, c_val_print): Update.
* disasm.c (dis_asm_print_address): Update.
* exec.c (print_section_info): Update.
* f-valprint.c (f_val_print): Update.
* infcmd.c: Include "arch-utils.h".
(jump_command, program_info): Update.
* linux-fork.c: Include "arch-utils.h".
(info_forks_command): Update.
* m2-valprint.c (print_function_pointer_address,
print_unpacked_pointer, print_variable_at_address,
m2_val_print): Update.
* m32r-rom.c (m32r_load_section, m32r_load, m32r_upload_command):
Update.
* printcmd.c (print_address, print_address_demangle, address_info):
Update.
* p-valprint.c (pascal_val_print): Update.
* source.c: Include "arch-utils.h".
(line_info): Update.
* stack.c (frame_info, print_block_frame_labels): Update.
* symfile.c (add_symbol_file_command, list_overlays_command): Update.
* symmisc.c (dump_msymbols, dump_psymtab, dump_symtab_1,
print_symbol, print_partial_symbols, maintenance_info_psymtabs,
maintenance_check_symtabs): Update.
* symtab.c (find_pc_sect_symtab): Update.
* target.c (deprecated_debug_xfer_memory): Update.
* tracepoint.c (scope_info): Update.
* tui/tui-stack.c (tui_make_status_line): Update.
* valprint.c (val_print_string): Update.
Update callers of paddr_nz to use paddress instead (keeping
user-visible output identical):
* alpha-tdep.c (alpha_heuristic_proc_start): Update.
* amd64-tdep.c (fixup_riprel, amd64_displaced_step_copy_insn,
amd64_displaced_step_fixup): Update.
* arch-utils.c (simple_displaced_step_copy_insn): Update.
* auxv.c (fprint_target_auxv): Update.
* breakpoint.c (insert_single_step_breakpoint): Update.
* buildsym.c (finish_block): Update.
* cli/cli-dump.c (restore_section_callback): Update.
* fbsd-nat.c (fbsd_find_memory_regions): Update.
* frame.c (frame_unwind_register_value): Update.
* gcore.c (gcore_create_callback): Update.
* hppa-tdep.c (hppa_frame_cache, hppa_skip_trampoline_code): Update.
* i386-tdep.c (i386_displaced_step_fixup, i386_record_modrm,
i386_record_lea_modrm_addr, i386_record_lea_modrm,
i386_process_record): Update.
* ia64-tdep.c (ia64_frame_this_id, ia64_sigtramp_frame_this_id,
ia64_libunwind_frame_this_id, ia64_libunwind_sigtramp_frame_this_id,
ia64_dummy_id, ia64_access_reg, ia64_access_rse_reg): Update.
* infrun.c (displaced_step_prepare, displaced_step_fixup,
handle_inferior_event, insert_step_resume_breakpoint_at_sal,
insert_longjmp_resume_breakpoint): Update.
* linux-nat.c (linux_nat_find_memory_regions): Update.
* linux-record.c (record_linux_system_call): Update.
* mips-tdep.c (heuristic_proc_start, mips_eabi_push_dummy_call,
mips_n32n64_push_dummy_call, mips_o32_push_dummy_call,
mips_o64_push_dummy_call): Update.
* monitor.c (monitor_error, monitor_remove_breakpoint): Update.
* record.c (record_arch_list_add_mem, record_wait,
record_xfer_partial): Update.
* remote-mips.c (mips_fetch_word, mips_check_lsi_error,
mips_common_breakpoint): Update.
* remote-sim.c (gdbsim_xfer_inferior_memory): Update.
* rs6000-tdep.c (ppc_displaced_step_fixup): Update.
* solib-som.c (som_current_sos): Update.
* symfile.c (load_progress, generic_load): Update.
* symfile-mem.c (add_vsyscall_page): Update.
* valops.c (value_fetch_lazy): Update.
* windows-tdep.c (windows_xfer_shared_library): Update.
Update callers of paddr_nz to use paddress instead (changing
user-visible output to make it more correct):
* dwarf2loc.c (locexpr_describe_location): Update.
* ia64-tdep.c (ia64_memory_insert_breakpoint,
ia64_memory_remove_breakpoint): Update.
* jv-valprint.c (java_value_print): Update.
* m32c-tdep.c (m32c_m16c_address_to_pointer): Update.
* monitor.c (monitor_read_memory): Update.
Update callers of paddr to use paddress instead (changing
user-visible output to make it more correct):
* arm-tdep.c (arm_push_dummy_call): Update.
* breakpoint.c (insert_bp_location, create_thread_event_breakpoint,
create_breakpoint): Update.
* darwin-nat-info.c (darwin_debug_regions): Update.
* dcache.c (dcache_info): Update.
* dsrec.c (load_srec, make_srec): Update.
* dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program,
dwarf2_frame_cache): Update.
* gcore.c (gcore_copy_callback): Update.
* gnu-nat.c (gnu_xfer_memory): Update.
* mips-linux-nat.c (mips_show_dr): Update.
* monitor.c (monitor_write_memory, monitor_insert_breakpoint,
monitor_remove_breakpoint): Update.
* remote.c (compare_sections_command): Update.
* remote-m32r-sdi.c (m32r_xfer_memory, m32r_insert_breakpoint,
m32r_remove_breakpoint, m32r_insert_watchpoint,
m32r_remove_watchpoint): Update.
* sol-thread.c (info_cb): Update.
* symfile.c (load_progress): Update.
Update callers of paddress or paddr_nz to use hex_string instead
(changes output of internal/error/debug messages only):
* dwarf2read.c (dump_die_shallow): Update.
* frame.c (fprint_field, fprint_frame, frame_pc_unwind,
get_frame_func, create_new_frame): Update.
* hppa-tdep.c (find_unwind_entry, unwind_command): Update.
* ia64-tdep.c (get_kernel_table, ia64_find_proc_info_x,
ia64_get_dyn_info_list): Update.
* maint.c (maintenance_translate_address): Update.
* mi/mi-cmd-var.c (mi_cmd_var_create): Update.
* target.c (target_flash_erase): Update.
Update callers of paddr/paddr_nz to use phex/phex_nz instead,
using an appropriate address size. Remove use of strlen_paddr.
* exec.c (exec_files_info): Update.
* i386-nat.c (i386_show_dr): Update.
* remote.c (remote_flash_erase): Update.
* m32r-rom.c (m32r_load_section): Update.
* monitor.c (monitor_vsprintf, monitor_store_register): Update.
* remote.c (remote_check_symbols, remote_search_memory): Update.
* remote-mips.c (mips_request, mips_common_breakpoint): Update.
* scm-valprint.c (scm_ipruk, scm_scmval_print): Update.
* sh64-tdep.c (sh64_show_media_regs, sh64_show_compact_regs): Update.
* sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs,
sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs,
sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs,
sh_dsp_show_regs): Update.
* xcoffsolib.c (sharedlibrary_command): Update.
* maint.c (maint_print_section_info): Add ADDR_SIZE parameter.
Use hex_string_custom instead of paddr.
(print_bfd_section_info): Pass address size.
(print_objfile_section_info): Likewise.
* annotate.h (annotate_source): Add GDBARCH parameter.
(annotate_frame_begin): Likewise.
* annotate.c (annotate_source): Add GDBARCH parameter.
(annotate_frame_begin): Likewise.
* source.c (identify_source_line): Update call to annotate_source.
* stack.c (print_frame_info, print_frame): Update call to
annotate_frame_begin.
* breakpoint.c (describe_other_breakpoints): Add GDBARCH parameter.
(create_breakpoint, create_ada_exception_breakpoint): Update call.
* stack.c (print_block_frame_labels): Add GDBARCH parameter.
(print_frame_label_vars): Update call.
* symmisc.c (print_partial_symbols): Add GDBARCH parameter.
(dump_psymtab): Update call to print_partial_symbols.
(struct print_symbol_args): Add GDBARCH member.
(dump_symtab_1): Set print_symbol_args architecture member.
(print_symbol): Use it.
* windows-tdep.h (windows_xfer_shared_library): Add GDBARCH
parameter.
* windows-tdep.c (windows_xfer_shared_library): Likewise.
* i386-cygwin-tdep.c (struct cpms_data): Add GDBARCH member.
(core_process_module_section): Pass architecture from cpms_data to
windows_xfer_shared_library.
(windows_core_xfer_shared_libraries): Initialize cmps_data
architecture member.
* windows-nat.c (windows_xfer_shared_libraries): Pass architecture
to windows_xfer_shared_library.
* defs.h (print_address): Add GDBARCH parameter.
* printcmd.c (print_address): Add GDBARCH parameter.
(print_scalar_formatted, do_examine): Update call.
* findcmd.c (find_command): Update call.
* tracepoint.c: Include "arch-utils.h".
(trace_find_line_command): Update call.
* tui/tui-disasm.c (tui_disassemble): Update call.
* value.h (print_address_demangle): Add GDBARCH parameter.
* printcmd.c (print_address_demangle): Add GDBARCH parameter.
* c-valprint.c (print_function_pointer_address, c_val_print):
Update call.
* f-valprint.c (f_val_print): Update call.
* gnu-v3-abi.c (gnuv3_print_method_ptr): Update call.
* jv-valprint.c (java_val_print): Update call.
* m2-valprint.c (print_function_pointer_address, m2_val_print):
Update call.
* p-valprint.c (pascal_val_print): Update call.
* disasm.c (gdb_disassemble_info): Install architecture into
di.application_data field.
testsuite/ChangeLog:
* gdb.threads/tls-shared.exp: Update to locexpr_describe_location
change to prefix TLS offset in hex with 0x.
doc/ChangeLog:
* gdbint.texinfo (Item Output Functions): Update signature
for ui_out_field_core_addr.
2009-07-03 01:21:10 +08:00
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "displaced: copy %s->%s: ",
|
|
|
|
|
paddress (gdbarch, from), paddress (gdbarch, to));
|
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-03 00:49:54 +08:00
|
|
|
|
displaced_step_dump_bytes (gdb_stdlog, buf, len);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (struct displaced_step_closure *) buf;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
simple_displaced_step_free_closure (struct gdbarch *gdbarch,
|
|
|
|
|
struct displaced_step_closure *closure)
|
|
|
|
|
{
|
|
|
|
|
xfree (closure);
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-29 08:53:04 +08:00
|
|
|
|
int
|
|
|
|
|
default_displaced_step_hw_singlestep (struct gdbarch *gdbarch,
|
|
|
|
|
struct displaced_step_closure *closure)
|
|
|
|
|
{
|
|
|
|
|
return !gdbarch_software_single_step_p (gdbarch);
|
|
|
|
|
}
|
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-03 00:49:54 +08:00
|
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
|
displaced_step_at_entry_point (struct gdbarch *gdbarch)
|
|
|
|
|
{
|
|
|
|
|
CORE_ADDR addr;
|
|
|
|
|
int bp_len;
|
|
|
|
|
|
|
|
|
|
addr = entry_point_address ();
|
|
|
|
|
|
|
|
|
|
/* Inferior calls also use the entry point as a breakpoint location.
|
|
|
|
|
We don't want displaced stepping to interfere with those
|
|
|
|
|
breakpoints, so leave space. */
|
|
|
|
|
gdbarch_breakpoint_from_pc (gdbarch, &addr, &bp_len);
|
2012-01-04 21:51:36 +08:00
|
|
|
|
addr += bp_len * 2;
|
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-03 00:49:54 +08:00
|
|
|
|
|
|
|
|
|
return addr;
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-30 00:39:56 +08:00
|
|
|
|
int
|
2007-11-19 13:06:24 +08:00
|
|
|
|
legacy_register_sim_regno (struct gdbarch *gdbarch, int regnum)
|
2002-05-30 00:39:56 +08:00
|
|
|
|
{
|
|
|
|
|
/* Only makes sense to supply raw registers. */
|
2007-11-19 13:06:24 +08:00
|
|
|
|
gdb_assert (regnum >= 0 && regnum < gdbarch_num_regs (gdbarch));
|
2002-05-30 00:39:56 +08:00
|
|
|
|
/* NOTE: cagney/2002-05-13: The old code did it this way and it is
|
|
|
|
|
suspected that some GDB/SIM combinations may rely on this
|
|
|
|
|
behavour. The default should be one2one_register_sim_regno
|
|
|
|
|
(below). */
|
2007-11-19 13:06:24 +08:00
|
|
|
|
if (gdbarch_register_name (gdbarch, regnum) != NULL
|
|
|
|
|
&& gdbarch_register_name (gdbarch, regnum)[0] != '\0')
|
2002-05-30 00:39:56 +08:00
|
|
|
|
return regnum;
|
|
|
|
|
else
|
|
|
|
|
return LEGACY_SIM_REGNO_IGNORE;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-15 23:29:56 +08:00
|
|
|
|
CORE_ADDR
|
2007-06-16 06:39:52 +08:00
|
|
|
|
generic_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
|
2001-08-15 23:29:56 +08:00
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2003-11-09 20:07:16 +08:00
|
|
|
|
CORE_ADDR
|
2003-11-15 05:22:42 +08:00
|
|
|
|
generic_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
|
2003-11-09 20:07:16 +08:00
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-21 07:01:29 +08:00
|
|
|
|
int
|
* 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-03 01:25:59 +08:00
|
|
|
|
generic_in_solib_return_trampoline (struct gdbarch *gdbarch,
|
2012-02-03 04:19:17 +08:00
|
|
|
|
CORE_ADDR pc, const char *name)
|
2002-08-21 07:01:29 +08:00
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2001-11-06 19:02:12 +08:00
|
|
|
|
int
|
|
|
|
|
generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2007-06-06 23:26:28 +08:00
|
|
|
|
/* Helper functions for gdbarch_inner_than */
|
2000-05-15 11:56:30 +08:00
|
|
|
|
|
|
|
|
|
int
|
2000-07-30 09:48:28 +08:00
|
|
|
|
core_addr_lessthan (CORE_ADDR lhs, CORE_ADDR rhs)
|
2000-05-15 11:56:30 +08:00
|
|
|
|
{
|
|
|
|
|
return (lhs < rhs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2000-07-30 09:48:28 +08:00
|
|
|
|
core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs)
|
2000-05-15 11:56:30 +08:00
|
|
|
|
{
|
|
|
|
|
return (lhs > rhs);
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-01 03:16:37 +08:00
|
|
|
|
/* Misc helper functions for targets. */
|
2000-06-06 14:45:19 +08:00
|
|
|
|
|
2000-10-26 15:41:25 +08:00
|
|
|
|
CORE_ADDR
|
2008-09-05 19:42:32 +08:00
|
|
|
|
core_addr_identity (struct gdbarch *gdbarch, CORE_ADDR addr)
|
2000-10-26 15:41:25 +08:00
|
|
|
|
{
|
|
|
|
|
return addr;
|
|
|
|
|
}
|
|
|
|
|
|
2003-10-23 07:54:11 +08:00
|
|
|
|
CORE_ADDR
|
|
|
|
|
convert_from_func_ptr_addr_identity (struct gdbarch *gdbarch, CORE_ADDR addr,
|
|
|
|
|
struct target_ops *targ)
|
|
|
|
|
{
|
|
|
|
|
return addr;
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-04 12:01:16 +08:00
|
|
|
|
int
|
2007-12-07 00:33:00 +08:00
|
|
|
|
no_op_reg_to_regnum (struct gdbarch *gdbarch, int reg)
|
2000-12-04 12:01:16 +08:00
|
|
|
|
{
|
|
|
|
|
return reg;
|
|
|
|
|
}
|
|
|
|
|
|
2002-02-06 09:20:23 +08:00
|
|
|
|
void
|
|
|
|
|
default_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
default_coff_make_msymbol_special (int val, struct minimal_symbol *msym)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-16 07:50:46 +08:00
|
|
|
|
int
|
2007-11-16 12:56:45 +08:00
|
|
|
|
cannot_register_not (struct gdbarch *gdbarch, int regnum)
|
2001-06-16 07:50:46 +08:00
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2001-08-11 08:59:29 +08:00
|
|
|
|
|
|
|
|
|
/* Legacy version of target_virtual_frame_pointer(). Assumes that
|
2011-01-01 03:16:37 +08:00
|
|
|
|
there is an gdbarch_deprecated_fp_regnum and that it is the same,
|
|
|
|
|
cooked or raw. */
|
2001-08-11 08:59:29 +08:00
|
|
|
|
|
|
|
|
|
void
|
2007-11-07 14:58:31 +08:00
|
|
|
|
legacy_virtual_frame_pointer (struct gdbarch *gdbarch,
|
|
|
|
|
CORE_ADDR pc,
|
2001-08-11 08:59:29 +08:00
|
|
|
|
int *frame_regnum,
|
|
|
|
|
LONGEST *frame_offset)
|
|
|
|
|
{
|
2002-09-18 05:18:54 +08:00
|
|
|
|
/* FIXME: cagney/2002-09-13: This code is used when identifying the
|
|
|
|
|
frame pointer of the current PC. It is assuming that a single
|
|
|
|
|
register and an offset can determine this. I think it should
|
|
|
|
|
instead generate a byte code expression as that would work better
|
|
|
|
|
with things like Dwarf2's CFI. */
|
2007-11-07 14:58:31 +08:00
|
|
|
|
if (gdbarch_deprecated_fp_regnum (gdbarch) >= 0
|
|
|
|
|
&& gdbarch_deprecated_fp_regnum (gdbarch)
|
|
|
|
|
< gdbarch_num_regs (gdbarch))
|
|
|
|
|
*frame_regnum = gdbarch_deprecated_fp_regnum (gdbarch);
|
|
|
|
|
else if (gdbarch_sp_regnum (gdbarch) >= 0
|
|
|
|
|
&& gdbarch_sp_regnum (gdbarch)
|
|
|
|
|
< gdbarch_num_regs (gdbarch))
|
|
|
|
|
*frame_regnum = gdbarch_sp_regnum (gdbarch);
|
2002-09-18 05:18:54 +08:00
|
|
|
|
else
|
|
|
|
|
/* Should this be an internal error? I guess so, it is reflecting
|
|
|
|
|
an architectural limitation in the current design. */
|
2011-01-01 03:16:37 +08:00
|
|
|
|
internal_error (__FILE__, __LINE__,
|
|
|
|
|
_("No virtual frame pointer available"));
|
2001-08-11 08:59:29 +08:00
|
|
|
|
*frame_offset = 0;
|
|
|
|
|
}
|
2001-12-10 12:58:31 +08:00
|
|
|
|
|
2002-04-25 00:28:16 +08:00
|
|
|
|
|
2002-05-12 11:09:12 +08:00
|
|
|
|
int
|
2007-11-09 21:11:17 +08:00
|
|
|
|
generic_convert_register_p (struct gdbarch *gdbarch, int regnum,
|
|
|
|
|
struct type *type)
|
2002-05-12 11:09:12 +08:00
|
|
|
|
{
|
2004-06-10 04:42:29 +08:00
|
|
|
|
return 0;
|
2002-05-12 11:09:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
2003-09-18 03:48:42 +08:00
|
|
|
|
int
|
|
|
|
|
default_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-24 05:05:23 +08:00
|
|
|
|
int
|
|
|
|
|
generic_instruction_nullified (struct gdbarch *gdbarch,
|
|
|
|
|
struct regcache *regcache)
|
|
|
|
|
{
|
|
|
|
|
return 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-09 05:00:36 +08:00
|
|
|
|
int
|
|
|
|
|
default_remote_register_number (struct gdbarch *gdbarch,
|
|
|
|
|
int regno)
|
|
|
|
|
{
|
|
|
|
|
return regno;
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-16 07:50:46 +08:00
|
|
|
|
|
2000-06-07 12:38:02 +08:00
|
|
|
|
/* Functions to manipulate the endianness of the target. */
|
|
|
|
|
|
2006-11-11 03:20:37 +08:00
|
|
|
|
static int target_byte_order_user = BFD_ENDIAN_UNKNOWN;
|
2000-06-07 12:38:02 +08:00
|
|
|
|
|
2000-06-08 08:52:56 +08:00
|
|
|
|
static const char endian_big[] = "big";
|
|
|
|
|
static const char endian_little[] = "little";
|
|
|
|
|
static const char endian_auto[] = "auto";
|
2012-01-29 02:08:22 +08:00
|
|
|
|
static const char *const endian_enum[] =
|
2000-06-07 12:38:02 +08:00
|
|
|
|
{
|
|
|
|
|
endian_big,
|
|
|
|
|
endian_little,
|
|
|
|
|
endian_auto,
|
|
|
|
|
NULL,
|
|
|
|
|
};
|
2000-06-08 08:52:56 +08:00
|
|
|
|
static const char *set_endian_string;
|
2000-06-07 12:38:02 +08:00
|
|
|
|
|
2007-02-27 04:13:18 +08:00
|
|
|
|
enum bfd_endian
|
|
|
|
|
selected_byte_order (void)
|
|
|
|
|
{
|
2009-07-03 01:02:35 +08:00
|
|
|
|
return target_byte_order_user;
|
2007-02-27 04:13:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
2000-06-07 12:38:02 +08:00
|
|
|
|
/* Called by ``show endian''. */
|
|
|
|
|
|
|
|
|
|
static void
|
2005-02-21 12:31:59 +08:00
|
|
|
|
show_endian (struct ui_file *file, int from_tty, struct cmd_list_element *c,
|
|
|
|
|
const char *value)
|
2000-06-07 12:38:02 +08:00
|
|
|
|
{
|
2007-01-21 02:31:29 +08:00
|
|
|
|
if (target_byte_order_user == BFD_ENDIAN_UNKNOWN)
|
2009-07-03 01:02:35 +08:00
|
|
|
|
if (gdbarch_byte_order (get_current_arch ()) == BFD_ENDIAN_BIG)
|
2005-02-21 12:31:59 +08:00
|
|
|
|
fprintf_unfiltered (file, _("The target endianness is set automatically "
|
|
|
|
|
"(currently big endian)\n"));
|
2005-01-05 Baurjan Ismagulov <ibr@ata.cs.hun.edu.tr>
Committed by Andrew Cagney.
* ada-valprint.c, aix-thread.c, alpha-nat.c: I18n markup.
* alphabsd-nat.c, alphanbsd-tdep.c, amd64-linux-nat.c: I18n markup.
* amd64-tdep.c, amd64bsd-nat.c, amd64fbsd-nat.c: I18n markup.
* arch-utils.c, arm-linux-nat.c, arm-tdep.c: I18n markup.
* armnbsd-nat.c, armnbsd-tdep.c, auxv.c, avr-tdep.c: I18n markup.
* aix-thread.c (_initialize_aix_thread): Get rid of the
deprecated_add_show_from_set call.
* alpha-tdep.c (_initialize_alpha_tdep): Ditto.
* arm-tdep.c (_initialize_arm_tdep): Ditto.
* command.h (add_setshow_enum_cmd): Add arguments for returning
new list elements.
* cli/cli-decode.c (add_setshow_enum_cmd): Ditto.
* mips-tdep.c (_initialize_mips_tdep): Modify calls to
add_setshow_enum_cmd.
2005-01-05 23:43:50 +08:00
|
|
|
|
else
|
2005-02-21 12:31:59 +08:00
|
|
|
|
fprintf_unfiltered (file, _("The target endianness is set automatically "
|
2011-01-06 06:22:53 +08:00
|
|
|
|
"(currently little endian)\n"));
|
2000-06-07 12:38:02 +08:00
|
|
|
|
else
|
2009-07-03 01:02:35 +08:00
|
|
|
|
if (target_byte_order_user == BFD_ENDIAN_BIG)
|
2005-02-21 12:31:59 +08:00
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
|
_("The target is assumed to be big endian\n"));
|
|
|
|
|
else
|
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
|
_("The target is assumed to be little endian\n"));
|
2000-06-07 12:38:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_endian (char *ignore_args, int from_tty, struct cmd_list_element *c)
|
|
|
|
|
{
|
2006-11-11 03:20:37 +08:00
|
|
|
|
struct gdbarch_info info;
|
|
|
|
|
|
|
|
|
|
gdbarch_info_init (&info);
|
|
|
|
|
|
2002-01-21 03:26:50 +08:00
|
|
|
|
if (set_endian_string == endian_auto)
|
2000-06-07 12:38:02 +08:00
|
|
|
|
{
|
2006-11-11 03:20:37 +08:00
|
|
|
|
target_byte_order_user = BFD_ENDIAN_UNKNOWN;
|
|
|
|
|
if (! gdbarch_update_p (info))
|
|
|
|
|
internal_error (__FILE__, __LINE__,
|
|
|
|
|
_("set_endian: architecture update failed"));
|
2000-06-07 12:38:02 +08:00
|
|
|
|
}
|
|
|
|
|
else if (set_endian_string == endian_little)
|
|
|
|
|
{
|
2003-08-22 04:43:10 +08:00
|
|
|
|
info.byte_order = BFD_ENDIAN_LITTLE;
|
|
|
|
|
if (! gdbarch_update_p (info))
|
2005-01-05 Baurjan Ismagulov <ibr@ata.cs.hun.edu.tr>
Committed by Andrew Cagney.
* ada-valprint.c, aix-thread.c, alpha-nat.c: I18n markup.
* alphabsd-nat.c, alphanbsd-tdep.c, amd64-linux-nat.c: I18n markup.
* amd64-tdep.c, amd64bsd-nat.c, amd64fbsd-nat.c: I18n markup.
* arch-utils.c, arm-linux-nat.c, arm-tdep.c: I18n markup.
* armnbsd-nat.c, armnbsd-tdep.c, auxv.c, avr-tdep.c: I18n markup.
* aix-thread.c (_initialize_aix_thread): Get rid of the
deprecated_add_show_from_set call.
* alpha-tdep.c (_initialize_alpha_tdep): Ditto.
* arm-tdep.c (_initialize_arm_tdep): Ditto.
* command.h (add_setshow_enum_cmd): Add arguments for returning
new list elements.
* cli/cli-decode.c (add_setshow_enum_cmd): Ditto.
* mips-tdep.c (_initialize_mips_tdep): Modify calls to
add_setshow_enum_cmd.
2005-01-05 23:43:50 +08:00
|
|
|
|
printf_unfiltered (_("Little endian target not supported by GDB\n"));
|
2006-11-11 03:20:37 +08:00
|
|
|
|
else
|
|
|
|
|
target_byte_order_user = BFD_ENDIAN_LITTLE;
|
2000-06-07 12:38:02 +08:00
|
|
|
|
}
|
|
|
|
|
else if (set_endian_string == endian_big)
|
|
|
|
|
{
|
2003-08-22 04:43:10 +08:00
|
|
|
|
info.byte_order = BFD_ENDIAN_BIG;
|
|
|
|
|
if (! gdbarch_update_p (info))
|
2005-01-05 Baurjan Ismagulov <ibr@ata.cs.hun.edu.tr>
Committed by Andrew Cagney.
* ada-valprint.c, aix-thread.c, alpha-nat.c: I18n markup.
* alphabsd-nat.c, alphanbsd-tdep.c, amd64-linux-nat.c: I18n markup.
* amd64-tdep.c, amd64bsd-nat.c, amd64fbsd-nat.c: I18n markup.
* arch-utils.c, arm-linux-nat.c, arm-tdep.c: I18n markup.
* armnbsd-nat.c, armnbsd-tdep.c, auxv.c, avr-tdep.c: I18n markup.
* aix-thread.c (_initialize_aix_thread): Get rid of the
deprecated_add_show_from_set call.
* alpha-tdep.c (_initialize_alpha_tdep): Ditto.
* arm-tdep.c (_initialize_arm_tdep): Ditto.
* command.h (add_setshow_enum_cmd): Add arguments for returning
new list elements.
* cli/cli-decode.c (add_setshow_enum_cmd): Ditto.
* mips-tdep.c (_initialize_mips_tdep): Modify calls to
add_setshow_enum_cmd.
2005-01-05 23:43:50 +08:00
|
|
|
|
printf_unfiltered (_("Big endian target not supported by GDB\n"));
|
2006-11-11 03:20:37 +08:00
|
|
|
|
else
|
|
|
|
|
target_byte_order_user = BFD_ENDIAN_BIG;
|
2000-06-07 12:38:02 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
2001-02-08 14:03:54 +08:00
|
|
|
|
internal_error (__FILE__, __LINE__,
|
2005-01-05 Baurjan Ismagulov <ibr@ata.cs.hun.edu.tr>
Committed by Andrew Cagney.
* ada-valprint.c, aix-thread.c, alpha-nat.c: I18n markup.
* alphabsd-nat.c, alphanbsd-tdep.c, amd64-linux-nat.c: I18n markup.
* amd64-tdep.c, amd64bsd-nat.c, amd64fbsd-nat.c: I18n markup.
* arch-utils.c, arm-linux-nat.c, arm-tdep.c: I18n markup.
* armnbsd-nat.c, armnbsd-tdep.c, auxv.c, avr-tdep.c: I18n markup.
* aix-thread.c (_initialize_aix_thread): Get rid of the
deprecated_add_show_from_set call.
* alpha-tdep.c (_initialize_alpha_tdep): Ditto.
* arm-tdep.c (_initialize_arm_tdep): Ditto.
* command.h (add_setshow_enum_cmd): Add arguments for returning
new list elements.
* cli/cli-decode.c (add_setshow_enum_cmd): Ditto.
* mips-tdep.c (_initialize_mips_tdep): Modify calls to
add_setshow_enum_cmd.
2005-01-05 23:43:50 +08:00
|
|
|
|
_("set_endian: bad value"));
|
2006-11-11 03:20:37 +08:00
|
|
|
|
|
2005-02-21 12:31:59 +08:00
|
|
|
|
show_endian (gdb_stdout, from_tty, NULL, NULL);
|
2000-06-07 12:38:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
XML feature description support.
* NEWS: Mention target descriptions, "set tdesc filename",
"unset tdesc filename", "show tdesc filename", and
qXfer:features:read.
* arch-utils.c (choose_architecture_for_target): New function.
(gdbarch_info_fill): Call it.
* target-descriptions.c (struct property): Make members non-const.
(struct target_desc): Add arch member.
(target_description_filename): New variable.
(target_find_description): Try via XML first.
(tdesc_architecture): New.
(free_target_description, make_cleanup_free_target_description): New.
(set_tdesc_property): Call xstrdup.
(set_tdesc_architecture, tdesc_set_cmdlist, tdesc_show_cmdlist)
(tdesc_unset_cmdlist, unset_tdesc_cmd, unset_tdesc_filename_cmd)
(set_tdesc_cmd, show_tdesc_cmd, set_tdesc_filename_cmd)
(show_tdesc_filename_cmd, _initialize_target_descriptions): New.
* target-descriptions.h (tdesc_architecture)
(make_cleanup_free_target_description, set_tdesc_architecture): New
prototypes.
* Makefile.in (SFILES): Add xml-tdesc.c.
(COMMON_OBS): Add xml-tdesc.o.
(target-descriptions.o): Update.
(xml-tdesc.o): New rule.
* xml-tdesc.c, xml-tdesc.h: New files.
* remote.c (PACKET_qXfer_features): New enum.
(remote_protocol_features): Add qXfer:features:read.
(remote_xfer_partial): Handle TARGET_OBJECT_AVAILABLE_FEATURES.
(_initialize_remote): Register qXfer:features:read.
* target.h (enum target_object): Add TARGET_OBJECT_AVAILABLE_FEATURES.
* features/gdb-target.dtd: New file.
* linux-i386-low.c (the_low_target): Set arch_string.
* linux-x86-64-low.c (the_low_target): Likewise.
* linux-low.c (linux_arch_string): New.
(linux_target_ops): Add it.
* linux-low.h (struct linux_target_ops): Add arch_string.
* server.c (write_qxfer_response): Use const void * for DATA.
(get_features_xml): New.
(handle_query): Handle qXfer:features:read. Report it for qSupported.
* target.h (struct target_ops): Add arch_string method.
* gdb.texinfo (Target Descriptions): New section.
(General Query Packets): Add QPassSignals anchor. Mention
qXfer:features:read under qSupported. Expand mentions of
qXfer:memory-map:read and QPassSignals. Document
qXfer:features:read.
2007-01-10 06:55:10 +08:00
|
|
|
|
/* Given SELECTED, a currently selected BFD architecture, and
|
2009-07-31 22:39:12 +08:00
|
|
|
|
TARGET_DESC, the current target description, return what
|
|
|
|
|
architecture to use.
|
|
|
|
|
|
|
|
|
|
SELECTED may be NULL, in which case we return the architecture
|
|
|
|
|
associated with TARGET_DESC. If SELECTED specifies a variant
|
|
|
|
|
of the architecture associtated with TARGET_DESC, return the
|
|
|
|
|
more specific of the two.
|
|
|
|
|
|
|
|
|
|
If SELECTED is a different architecture, but it is accepted as
|
|
|
|
|
compatible by the target, we can use the target architecture.
|
|
|
|
|
|
|
|
|
|
If SELECTED is obviously incompatible, warn the user. */
|
XML feature description support.
* NEWS: Mention target descriptions, "set tdesc filename",
"unset tdesc filename", "show tdesc filename", and
qXfer:features:read.
* arch-utils.c (choose_architecture_for_target): New function.
(gdbarch_info_fill): Call it.
* target-descriptions.c (struct property): Make members non-const.
(struct target_desc): Add arch member.
(target_description_filename): New variable.
(target_find_description): Try via XML first.
(tdesc_architecture): New.
(free_target_description, make_cleanup_free_target_description): New.
(set_tdesc_property): Call xstrdup.
(set_tdesc_architecture, tdesc_set_cmdlist, tdesc_show_cmdlist)
(tdesc_unset_cmdlist, unset_tdesc_cmd, unset_tdesc_filename_cmd)
(set_tdesc_cmd, show_tdesc_cmd, set_tdesc_filename_cmd)
(show_tdesc_filename_cmd, _initialize_target_descriptions): New.
* target-descriptions.h (tdesc_architecture)
(make_cleanup_free_target_description, set_tdesc_architecture): New
prototypes.
* Makefile.in (SFILES): Add xml-tdesc.c.
(COMMON_OBS): Add xml-tdesc.o.
(target-descriptions.o): Update.
(xml-tdesc.o): New rule.
* xml-tdesc.c, xml-tdesc.h: New files.
* remote.c (PACKET_qXfer_features): New enum.
(remote_protocol_features): Add qXfer:features:read.
(remote_xfer_partial): Handle TARGET_OBJECT_AVAILABLE_FEATURES.
(_initialize_remote): Register qXfer:features:read.
* target.h (enum target_object): Add TARGET_OBJECT_AVAILABLE_FEATURES.
* features/gdb-target.dtd: New file.
* linux-i386-low.c (the_low_target): Set arch_string.
* linux-x86-64-low.c (the_low_target): Likewise.
* linux-low.c (linux_arch_string): New.
(linux_target_ops): Add it.
* linux-low.h (struct linux_target_ops): Add arch_string.
* server.c (write_qxfer_response): Use const void * for DATA.
(get_features_xml): New.
(handle_query): Handle qXfer:features:read. Report it for qSupported.
* target.h (struct target_ops): Add arch_string method.
* gdb.texinfo (Target Descriptions): New section.
(General Query Packets): Add QPassSignals anchor. Mention
qXfer:features:read under qSupported. Expand mentions of
qXfer:memory-map:read and QPassSignals. Document
qXfer:features:read.
2007-01-10 06:55:10 +08:00
|
|
|
|
|
|
|
|
|
static const struct bfd_arch_info *
|
2009-07-31 22:39:12 +08:00
|
|
|
|
choose_architecture_for_target (const struct target_desc *target_desc,
|
|
|
|
|
const struct bfd_arch_info *selected)
|
XML feature description support.
* NEWS: Mention target descriptions, "set tdesc filename",
"unset tdesc filename", "show tdesc filename", and
qXfer:features:read.
* arch-utils.c (choose_architecture_for_target): New function.
(gdbarch_info_fill): Call it.
* target-descriptions.c (struct property): Make members non-const.
(struct target_desc): Add arch member.
(target_description_filename): New variable.
(target_find_description): Try via XML first.
(tdesc_architecture): New.
(free_target_description, make_cleanup_free_target_description): New.
(set_tdesc_property): Call xstrdup.
(set_tdesc_architecture, tdesc_set_cmdlist, tdesc_show_cmdlist)
(tdesc_unset_cmdlist, unset_tdesc_cmd, unset_tdesc_filename_cmd)
(set_tdesc_cmd, show_tdesc_cmd, set_tdesc_filename_cmd)
(show_tdesc_filename_cmd, _initialize_target_descriptions): New.
* target-descriptions.h (tdesc_architecture)
(make_cleanup_free_target_description, set_tdesc_architecture): New
prototypes.
* Makefile.in (SFILES): Add xml-tdesc.c.
(COMMON_OBS): Add xml-tdesc.o.
(target-descriptions.o): Update.
(xml-tdesc.o): New rule.
* xml-tdesc.c, xml-tdesc.h: New files.
* remote.c (PACKET_qXfer_features): New enum.
(remote_protocol_features): Add qXfer:features:read.
(remote_xfer_partial): Handle TARGET_OBJECT_AVAILABLE_FEATURES.
(_initialize_remote): Register qXfer:features:read.
* target.h (enum target_object): Add TARGET_OBJECT_AVAILABLE_FEATURES.
* features/gdb-target.dtd: New file.
* linux-i386-low.c (the_low_target): Set arch_string.
* linux-x86-64-low.c (the_low_target): Likewise.
* linux-low.c (linux_arch_string): New.
(linux_target_ops): Add it.
* linux-low.h (struct linux_target_ops): Add arch_string.
* server.c (write_qxfer_response): Use const void * for DATA.
(get_features_xml): New.
(handle_query): Handle qXfer:features:read. Report it for qSupported.
* target.h (struct target_ops): Add arch_string method.
* gdb.texinfo (Target Descriptions): New section.
(General Query Packets): Add QPassSignals anchor. Mention
qXfer:features:read under qSupported. Expand mentions of
qXfer:memory-map:read and QPassSignals. Document
qXfer:features:read.
2007-01-10 06:55:10 +08:00
|
|
|
|
{
|
2009-07-31 22:39:12 +08:00
|
|
|
|
const struct bfd_arch_info *from_target = tdesc_architecture (target_desc);
|
XML feature description support.
* NEWS: Mention target descriptions, "set tdesc filename",
"unset tdesc filename", "show tdesc filename", and
qXfer:features:read.
* arch-utils.c (choose_architecture_for_target): New function.
(gdbarch_info_fill): Call it.
* target-descriptions.c (struct property): Make members non-const.
(struct target_desc): Add arch member.
(target_description_filename): New variable.
(target_find_description): Try via XML first.
(tdesc_architecture): New.
(free_target_description, make_cleanup_free_target_description): New.
(set_tdesc_property): Call xstrdup.
(set_tdesc_architecture, tdesc_set_cmdlist, tdesc_show_cmdlist)
(tdesc_unset_cmdlist, unset_tdesc_cmd, unset_tdesc_filename_cmd)
(set_tdesc_cmd, show_tdesc_cmd, set_tdesc_filename_cmd)
(show_tdesc_filename_cmd, _initialize_target_descriptions): New.
* target-descriptions.h (tdesc_architecture)
(make_cleanup_free_target_description, set_tdesc_architecture): New
prototypes.
* Makefile.in (SFILES): Add xml-tdesc.c.
(COMMON_OBS): Add xml-tdesc.o.
(target-descriptions.o): Update.
(xml-tdesc.o): New rule.
* xml-tdesc.c, xml-tdesc.h: New files.
* remote.c (PACKET_qXfer_features): New enum.
(remote_protocol_features): Add qXfer:features:read.
(remote_xfer_partial): Handle TARGET_OBJECT_AVAILABLE_FEATURES.
(_initialize_remote): Register qXfer:features:read.
* target.h (enum target_object): Add TARGET_OBJECT_AVAILABLE_FEATURES.
* features/gdb-target.dtd: New file.
* linux-i386-low.c (the_low_target): Set arch_string.
* linux-x86-64-low.c (the_low_target): Likewise.
* linux-low.c (linux_arch_string): New.
(linux_target_ops): Add it.
* linux-low.h (struct linux_target_ops): Add arch_string.
* server.c (write_qxfer_response): Use const void * for DATA.
(get_features_xml): New.
(handle_query): Handle qXfer:features:read. Report it for qSupported.
* target.h (struct target_ops): Add arch_string method.
* gdb.texinfo (Target Descriptions): New section.
(General Query Packets): Add QPassSignals anchor. Mention
qXfer:features:read under qSupported. Expand mentions of
qXfer:memory-map:read and QPassSignals. Document
qXfer:features:read.
2007-01-10 06:55:10 +08:00
|
|
|
|
const struct bfd_arch_info *compat1, *compat2;
|
|
|
|
|
|
|
|
|
|
if (selected == NULL)
|
|
|
|
|
return from_target;
|
|
|
|
|
|
|
|
|
|
if (from_target == NULL)
|
|
|
|
|
return selected;
|
|
|
|
|
|
|
|
|
|
/* struct bfd_arch_info objects are singletons: that is, there's
|
|
|
|
|
supposed to be exactly one instance for a given machine. So you
|
|
|
|
|
can tell whether two are equivalent by comparing pointers. */
|
|
|
|
|
if (from_target == selected)
|
|
|
|
|
return selected;
|
|
|
|
|
|
|
|
|
|
/* BFD's 'A->compatible (A, B)' functions return zero if A and B are
|
|
|
|
|
incompatible. But if they are compatible, it returns the 'more
|
|
|
|
|
featureful' of the two arches. That is, if A can run code
|
|
|
|
|
written for B, but B can't run code written for A, then it'll
|
|
|
|
|
return A.
|
|
|
|
|
|
|
|
|
|
Some targets (e.g. MIPS as of 2006-12-04) don't fully
|
|
|
|
|
implement this, instead always returning NULL or the first
|
|
|
|
|
argument. We detect that case by checking both directions. */
|
|
|
|
|
|
|
|
|
|
compat1 = selected->compatible (selected, from_target);
|
|
|
|
|
compat2 = from_target->compatible (from_target, selected);
|
|
|
|
|
|
|
|
|
|
if (compat1 == NULL && compat2 == NULL)
|
|
|
|
|
{
|
2011-01-01 03:16:37 +08:00
|
|
|
|
/* BFD considers the architectures incompatible. Check our
|
|
|
|
|
target description whether it accepts SELECTED as compatible
|
|
|
|
|
anyway. */
|
2009-07-31 22:39:12 +08:00
|
|
|
|
if (tdesc_compatible_p (target_desc, selected))
|
|
|
|
|
return from_target;
|
|
|
|
|
|
XML feature description support.
* NEWS: Mention target descriptions, "set tdesc filename",
"unset tdesc filename", "show tdesc filename", and
qXfer:features:read.
* arch-utils.c (choose_architecture_for_target): New function.
(gdbarch_info_fill): Call it.
* target-descriptions.c (struct property): Make members non-const.
(struct target_desc): Add arch member.
(target_description_filename): New variable.
(target_find_description): Try via XML first.
(tdesc_architecture): New.
(free_target_description, make_cleanup_free_target_description): New.
(set_tdesc_property): Call xstrdup.
(set_tdesc_architecture, tdesc_set_cmdlist, tdesc_show_cmdlist)
(tdesc_unset_cmdlist, unset_tdesc_cmd, unset_tdesc_filename_cmd)
(set_tdesc_cmd, show_tdesc_cmd, set_tdesc_filename_cmd)
(show_tdesc_filename_cmd, _initialize_target_descriptions): New.
* target-descriptions.h (tdesc_architecture)
(make_cleanup_free_target_description, set_tdesc_architecture): New
prototypes.
* Makefile.in (SFILES): Add xml-tdesc.c.
(COMMON_OBS): Add xml-tdesc.o.
(target-descriptions.o): Update.
(xml-tdesc.o): New rule.
* xml-tdesc.c, xml-tdesc.h: New files.
* remote.c (PACKET_qXfer_features): New enum.
(remote_protocol_features): Add qXfer:features:read.
(remote_xfer_partial): Handle TARGET_OBJECT_AVAILABLE_FEATURES.
(_initialize_remote): Register qXfer:features:read.
* target.h (enum target_object): Add TARGET_OBJECT_AVAILABLE_FEATURES.
* features/gdb-target.dtd: New file.
* linux-i386-low.c (the_low_target): Set arch_string.
* linux-x86-64-low.c (the_low_target): Likewise.
* linux-low.c (linux_arch_string): New.
(linux_target_ops): Add it.
* linux-low.h (struct linux_target_ops): Add arch_string.
* server.c (write_qxfer_response): Use const void * for DATA.
(get_features_xml): New.
(handle_query): Handle qXfer:features:read. Report it for qSupported.
* target.h (struct target_ops): Add arch_string method.
* gdb.texinfo (Target Descriptions): New section.
(General Query Packets): Add QPassSignals anchor. Mention
qXfer:features:read under qSupported. Expand mentions of
qXfer:memory-map:read and QPassSignals. Document
qXfer:features:read.
2007-01-10 06:55:10 +08:00
|
|
|
|
warning (_("Selected architecture %s is not compatible "
|
|
|
|
|
"with reported target architecture %s"),
|
|
|
|
|
selected->printable_name, from_target->printable_name);
|
|
|
|
|
return selected;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (compat1 == NULL)
|
|
|
|
|
return compat2;
|
|
|
|
|
if (compat2 == NULL)
|
|
|
|
|
return compat1;
|
|
|
|
|
if (compat1 == compat2)
|
|
|
|
|
return compat1;
|
|
|
|
|
|
2011-01-01 03:16:37 +08:00
|
|
|
|
/* If the two didn't match, but one of them was a default
|
|
|
|
|
architecture, assume the more specific one is correct. This
|
|
|
|
|
handles the case where an executable or target description just
|
|
|
|
|
says "mips", but the other knows which MIPS variant. */
|
XML feature description support.
* NEWS: Mention target descriptions, "set tdesc filename",
"unset tdesc filename", "show tdesc filename", and
qXfer:features:read.
* arch-utils.c (choose_architecture_for_target): New function.
(gdbarch_info_fill): Call it.
* target-descriptions.c (struct property): Make members non-const.
(struct target_desc): Add arch member.
(target_description_filename): New variable.
(target_find_description): Try via XML first.
(tdesc_architecture): New.
(free_target_description, make_cleanup_free_target_description): New.
(set_tdesc_property): Call xstrdup.
(set_tdesc_architecture, tdesc_set_cmdlist, tdesc_show_cmdlist)
(tdesc_unset_cmdlist, unset_tdesc_cmd, unset_tdesc_filename_cmd)
(set_tdesc_cmd, show_tdesc_cmd, set_tdesc_filename_cmd)
(show_tdesc_filename_cmd, _initialize_target_descriptions): New.
* target-descriptions.h (tdesc_architecture)
(make_cleanup_free_target_description, set_tdesc_architecture): New
prototypes.
* Makefile.in (SFILES): Add xml-tdesc.c.
(COMMON_OBS): Add xml-tdesc.o.
(target-descriptions.o): Update.
(xml-tdesc.o): New rule.
* xml-tdesc.c, xml-tdesc.h: New files.
* remote.c (PACKET_qXfer_features): New enum.
(remote_protocol_features): Add qXfer:features:read.
(remote_xfer_partial): Handle TARGET_OBJECT_AVAILABLE_FEATURES.
(_initialize_remote): Register qXfer:features:read.
* target.h (enum target_object): Add TARGET_OBJECT_AVAILABLE_FEATURES.
* features/gdb-target.dtd: New file.
* linux-i386-low.c (the_low_target): Set arch_string.
* linux-x86-64-low.c (the_low_target): Likewise.
* linux-low.c (linux_arch_string): New.
(linux_target_ops): Add it.
* linux-low.h (struct linux_target_ops): Add arch_string.
* server.c (write_qxfer_response): Use const void * for DATA.
(get_features_xml): New.
(handle_query): Handle qXfer:features:read. Report it for qSupported.
* target.h (struct target_ops): Add arch_string method.
* gdb.texinfo (Target Descriptions): New section.
(General Query Packets): Add QPassSignals anchor. Mention
qXfer:features:read under qSupported. Expand mentions of
qXfer:memory-map:read and QPassSignals. Document
qXfer:features:read.
2007-01-10 06:55:10 +08:00
|
|
|
|
if (compat1->the_default)
|
|
|
|
|
return compat2;
|
|
|
|
|
if (compat2->the_default)
|
|
|
|
|
return compat1;
|
|
|
|
|
|
|
|
|
|
/* We have no idea which one is better. This is a bug, but not
|
|
|
|
|
a critical problem; warn the user. */
|
|
|
|
|
warning (_("Selected architecture %s is ambiguous with "
|
|
|
|
|
"reported target architecture %s"),
|
|
|
|
|
selected->printable_name, from_target->printable_name);
|
|
|
|
|
return selected;
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-01 03:16:37 +08:00
|
|
|
|
/* Functions to manipulate the architecture of the target. */
|
2000-06-07 12:38:02 +08:00
|
|
|
|
|
|
|
|
|
enum set_arch { set_arch_auto, set_arch_manual };
|
|
|
|
|
|
2006-11-11 03:20:37 +08:00
|
|
|
|
static const struct bfd_arch_info *target_architecture_user;
|
2000-06-07 12:38:02 +08:00
|
|
|
|
|
2003-11-14 03:06:26 +08:00
|
|
|
|
static const char *set_architecture_string;
|
|
|
|
|
|
|
|
|
|
const char *
|
|
|
|
|
selected_architecture_name (void)
|
|
|
|
|
{
|
2006-11-11 03:20:37 +08:00
|
|
|
|
if (target_architecture_user == NULL)
|
2003-11-14 03:06:26 +08:00
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return set_architecture_string;
|
|
|
|
|
}
|
2000-06-07 12:38:02 +08:00
|
|
|
|
|
|
|
|
|
/* Called if the user enters ``show architecture'' without an
|
2011-01-01 03:16:37 +08:00
|
|
|
|
argument. */
|
2000-06-07 12:38:02 +08:00
|
|
|
|
|
|
|
|
|
static void
|
2005-02-21 12:31:59 +08:00
|
|
|
|
show_architecture (struct ui_file *file, int from_tty,
|
|
|
|
|
struct cmd_list_element *c, const char *value)
|
2000-06-07 12:38:02 +08:00
|
|
|
|
{
|
2006-11-11 03:20:37 +08:00
|
|
|
|
if (target_architecture_user == NULL)
|
2011-01-06 06:22:53 +08:00
|
|
|
|
fprintf_filtered (file, _("The target architecture is set "
|
|
|
|
|
"automatically (currently %s)\n"),
|
|
|
|
|
gdbarch_bfd_arch_info (get_current_arch ())->printable_name);
|
2000-06-07 12:38:02 +08:00
|
|
|
|
else
|
2011-01-06 06:22:53 +08:00
|
|
|
|
fprintf_filtered (file, _("The target architecture is assumed to be %s\n"),
|
|
|
|
|
set_architecture_string);
|
2000-06-07 12:38:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Called if the user enters ``set architecture'' with or without an
|
2011-01-01 03:16:37 +08:00
|
|
|
|
argument. */
|
2000-06-07 12:38:02 +08:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_architecture (char *ignore_args, int from_tty, struct cmd_list_element *c)
|
|
|
|
|
{
|
2006-11-11 03:20:37 +08:00
|
|
|
|
struct gdbarch_info info;
|
|
|
|
|
|
|
|
|
|
gdbarch_info_init (&info);
|
|
|
|
|
|
2000-06-07 12:38:02 +08:00
|
|
|
|
if (strcmp (set_architecture_string, "auto") == 0)
|
|
|
|
|
{
|
2006-11-11 03:20:37 +08:00
|
|
|
|
target_architecture_user = NULL;
|
|
|
|
|
if (!gdbarch_update_p (info))
|
|
|
|
|
internal_error (__FILE__, __LINE__,
|
|
|
|
|
_("could not select an architecture automatically"));
|
2000-06-07 12:38:02 +08:00
|
|
|
|
}
|
2003-08-22 04:43:10 +08:00
|
|
|
|
else
|
2000-06-07 12:38:02 +08:00
|
|
|
|
{
|
|
|
|
|
info.bfd_arch_info = bfd_scan_arch (set_architecture_string);
|
|
|
|
|
if (info.bfd_arch_info == NULL)
|
2001-02-08 14:03:54 +08:00
|
|
|
|
internal_error (__FILE__, __LINE__,
|
2005-01-05 Baurjan Ismagulov <ibr@ata.cs.hun.edu.tr>
Committed by Andrew Cagney.
* ada-valprint.c, aix-thread.c, alpha-nat.c: I18n markup.
* alphabsd-nat.c, alphanbsd-tdep.c, amd64-linux-nat.c: I18n markup.
* amd64-tdep.c, amd64bsd-nat.c, amd64fbsd-nat.c: I18n markup.
* arch-utils.c, arm-linux-nat.c, arm-tdep.c: I18n markup.
* armnbsd-nat.c, armnbsd-tdep.c, auxv.c, avr-tdep.c: I18n markup.
* aix-thread.c (_initialize_aix_thread): Get rid of the
deprecated_add_show_from_set call.
* alpha-tdep.c (_initialize_alpha_tdep): Ditto.
* arm-tdep.c (_initialize_arm_tdep): Ditto.
* command.h (add_setshow_enum_cmd): Add arguments for returning
new list elements.
* cli/cli-decode.c (add_setshow_enum_cmd): Ditto.
* mips-tdep.c (_initialize_mips_tdep): Modify calls to
add_setshow_enum_cmd.
2005-01-05 23:43:50 +08:00
|
|
|
|
_("set_architecture: bfd_scan_arch failed"));
|
2000-08-11 09:30:11 +08:00
|
|
|
|
if (gdbarch_update_p (info))
|
2006-11-11 03:20:37 +08:00
|
|
|
|
target_architecture_user = info.bfd_arch_info;
|
2000-06-07 12:38:02 +08:00
|
|
|
|
else
|
2005-01-05 Baurjan Ismagulov <ibr@ata.cs.hun.edu.tr>
Committed by Andrew Cagney.
* ada-valprint.c, aix-thread.c, alpha-nat.c: I18n markup.
* alphabsd-nat.c, alphanbsd-tdep.c, amd64-linux-nat.c: I18n markup.
* amd64-tdep.c, amd64bsd-nat.c, amd64fbsd-nat.c: I18n markup.
* arch-utils.c, arm-linux-nat.c, arm-tdep.c: I18n markup.
* armnbsd-nat.c, armnbsd-tdep.c, auxv.c, avr-tdep.c: I18n markup.
* aix-thread.c (_initialize_aix_thread): Get rid of the
deprecated_add_show_from_set call.
* alpha-tdep.c (_initialize_alpha_tdep): Ditto.
* arm-tdep.c (_initialize_arm_tdep): Ditto.
* command.h (add_setshow_enum_cmd): Add arguments for returning
new list elements.
* cli/cli-decode.c (add_setshow_enum_cmd): Ditto.
* mips-tdep.c (_initialize_mips_tdep): Modify calls to
add_setshow_enum_cmd.
2005-01-05 23:43:50 +08:00
|
|
|
|
printf_unfiltered (_("Architecture `%s' not recognized.\n"),
|
2000-06-07 12:38:02 +08:00
|
|
|
|
set_architecture_string);
|
|
|
|
|
}
|
2005-02-21 12:31:59 +08:00
|
|
|
|
show_architecture (gdb_stdout, from_tty, NULL, NULL);
|
2000-06-07 12:38:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
2003-11-10 12:39:17 +08:00
|
|
|
|
/* Try to select a global architecture that matches "info". Return
|
|
|
|
|
non-zero if the attempt succeds. */
|
|
|
|
|
int
|
|
|
|
|
gdbarch_update_p (struct gdbarch_info info)
|
|
|
|
|
{
|
2008-05-04 23:21:05 +08:00
|
|
|
|
struct gdbarch *new_gdbarch;
|
|
|
|
|
|
|
|
|
|
/* Check for the current file. */
|
|
|
|
|
if (info.abfd == NULL)
|
|
|
|
|
info.abfd = exec_bfd;
|
|
|
|
|
if (info.abfd == NULL)
|
|
|
|
|
info.abfd = core_bfd;
|
|
|
|
|
|
|
|
|
|
/* Check for the current target description. */
|
|
|
|
|
if (info.target_desc == NULL)
|
|
|
|
|
info.target_desc = target_current_description ();
|
|
|
|
|
|
|
|
|
|
new_gdbarch = gdbarch_find_by_info (info);
|
2003-11-10 12:39:17 +08:00
|
|
|
|
|
|
|
|
|
/* If there no architecture by that name, reject the request. */
|
|
|
|
|
if (new_gdbarch == NULL)
|
|
|
|
|
{
|
|
|
|
|
if (gdbarch_debug)
|
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_update_p: "
|
|
|
|
|
"Architecture not found\n");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If it is the same old architecture, accept the request (but don't
|
|
|
|
|
swap anything). */
|
* gdbarch.sh (target_gdbarch): New global variable.
(deprecated_current_gdbarch_select_hack): Set it.
* gdbarch.c, gdbarch.h: Regenerate.
* arch-utils.c (gdbarch_update_p): Use target_gdbarch instead
of current_gdbarch.
* target-descriptions.c (target_find_description): Likewise.
* arm-tdep.c (arm_update_current_architecture): Likewise.
(show_fp_model, arm_show_abi, arm_show_fallback_mode,
arm_show_force_mode): Likewise.
* mips-tdep.c (show_mask_address, show_mipsfpu_command,
show_mips_abi): Likewise.
* mep-tdep.c (me_module_register_set, current_me_module): Likewise.
* target.c (target_translate_tls_address): Use target_gdbarch
instead of current_gdbarch.
* remote.c (struct packet_reg): Likewise.
(get_remote_arch_state, packet_reg_from_regnum,
packet_reg_from_pnum, remote_check_symbols, remote_wait,
remote_address_masked, remote_insert_breakpoint,
remote_insert_hw_breakpoint, remote_read_description): Likewise.
* remote-m32r-sdi.c (m32r_resume, m32r_wait): Likewise.
* remote-mips.c (mips_open, mips_common_breakpoint): Likewise.
* cris-tdep.c (cris_can_use_hardware_watchpoint): Likewise.
* solib.c (solib_open, solib_map_sections, solib_read_symbols,
solib_add, info_sharedlibrary_command, solib_address,
solib_create_inferior_hook, in_solib_dynsym_resolve_code,
solib_global_lookup): Likewise.
* solib-frv.c (enable_break2, frv_relocate_main_executable): Likewise.
* solib-irix.c (irix_current_sos, irix_open_symbol_file_object):
Likewise.
* solib-sunos.c (sunos_solib_create_inferior_hook): Likewise.
* solib-svr4.c (exec_entry_point, enable_break, svr4_free_so,
set_solib_svr4_fetch_link_map_offsets, svr4_fetch_link_map_offsets):
Likewise.
* nto-tdep.c (nto_find_and_open_solib, nto_init_solib_absolute_prefix,
nto_truncate_ptr): Likewise.
* mips-linux-tdep.c (mips_linux_in_dynsym_stub): Likewise.
2008-08-27 01:21:29 +08:00
|
|
|
|
if (new_gdbarch == target_gdbarch)
|
2003-11-10 12:39:17 +08:00
|
|
|
|
{
|
|
|
|
|
if (gdbarch_debug)
|
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_update_p: "
|
2009-01-09 19:09:08 +08:00
|
|
|
|
"Architecture %s (%s) unchanged\n",
|
|
|
|
|
host_address_to_string (new_gdbarch),
|
2003-11-10 12:39:17 +08:00
|
|
|
|
gdbarch_bfd_arch_info (new_gdbarch)->printable_name);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* It's a new architecture, swap it in. */
|
|
|
|
|
if (gdbarch_debug)
|
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_update_p: "
|
2009-01-09 19:09:08 +08:00
|
|
|
|
"New architecture %s (%s) selected\n",
|
|
|
|
|
host_address_to_string (new_gdbarch),
|
2003-11-10 12:39:17 +08:00
|
|
|
|
gdbarch_bfd_arch_info (new_gdbarch)->printable_name);
|
2009-07-03 01:29:17 +08:00
|
|
|
|
deprecated_target_gdbarch_select_hack (new_gdbarch);
|
2003-11-10 12:39:17 +08:00
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2003-10-28 04:47:27 +08:00
|
|
|
|
/* Return the architecture for ABFD. If no suitable architecture
|
|
|
|
|
could be find, return NULL. */
|
|
|
|
|
|
|
|
|
|
struct gdbarch *
|
|
|
|
|
gdbarch_from_bfd (bfd *abfd)
|
2000-06-07 12:38:02 +08:00
|
|
|
|
{
|
2003-08-22 04:43:10 +08:00
|
|
|
|
struct gdbarch_info info;
|
|
|
|
|
gdbarch_info_init (&info);
|
2010-05-14 05:56:58 +08:00
|
|
|
|
|
2003-08-22 04:43:10 +08:00
|
|
|
|
info.abfd = abfd;
|
2003-11-11 00:03:26 +08:00
|
|
|
|
return gdbarch_find_by_info (info);
|
2003-10-28 04:47:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set the dynamic target-system-dependent parameters (architecture,
|
|
|
|
|
byte-order) using information found in the BFD */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
set_gdbarch_from_file (bfd *abfd)
|
|
|
|
|
{
|
2008-05-04 23:21:05 +08:00
|
|
|
|
struct gdbarch_info info;
|
2003-10-28 04:47:27 +08:00
|
|
|
|
struct gdbarch *gdbarch;
|
|
|
|
|
|
2008-05-04 23:21:05 +08:00
|
|
|
|
gdbarch_info_init (&info);
|
|
|
|
|
info.abfd = abfd;
|
|
|
|
|
info.target_desc = target_current_description ();
|
|
|
|
|
gdbarch = gdbarch_find_by_info (info);
|
|
|
|
|
|
2003-10-28 04:47:27 +08:00
|
|
|
|
if (gdbarch == NULL)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
|
error (_("Architecture of file not recognized."));
|
2009-07-03 01:29:17 +08:00
|
|
|
|
deprecated_target_gdbarch_select_hack (gdbarch);
|
2000-06-07 12:38:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Initialize the current architecture. Update the ``set
|
|
|
|
|
architecture'' command so that it specifies a list of valid
|
|
|
|
|
architectures. */
|
|
|
|
|
|
2000-06-08 12:00:56 +08:00
|
|
|
|
#ifdef DEFAULT_BFD_ARCH
|
|
|
|
|
extern const bfd_arch_info_type DEFAULT_BFD_ARCH;
|
|
|
|
|
static const bfd_arch_info_type *default_bfd_arch = &DEFAULT_BFD_ARCH;
|
|
|
|
|
#else
|
2000-06-10 13:37:47 +08:00
|
|
|
|
static const bfd_arch_info_type *default_bfd_arch;
|
2000-06-08 12:00:56 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef DEFAULT_BFD_VEC
|
|
|
|
|
extern const bfd_target DEFAULT_BFD_VEC;
|
|
|
|
|
static const bfd_target *default_bfd_vec = &DEFAULT_BFD_VEC;
|
|
|
|
|
#else
|
|
|
|
|
static const bfd_target *default_bfd_vec;
|
|
|
|
|
#endif
|
|
|
|
|
|
2006-11-11 03:20:37 +08:00
|
|
|
|
static int default_byte_order = BFD_ENDIAN_UNKNOWN;
|
|
|
|
|
|
2000-06-07 12:38:02 +08:00
|
|
|
|
void
|
|
|
|
|
initialize_current_architecture (void)
|
|
|
|
|
{
|
|
|
|
|
const char **arches = gdbarch_printable_names ();
|
2010-05-14 05:56:58 +08:00
|
|
|
|
struct gdbarch_info info;
|
2000-06-07 12:38:02 +08:00
|
|
|
|
|
2011-01-01 03:16:37 +08:00
|
|
|
|
/* determine a default architecture and byte order. */
|
2001-12-19 22:14:52 +08:00
|
|
|
|
gdbarch_info_init (&info);
|
2000-06-08 12:00:56 +08:00
|
|
|
|
|
2011-01-01 03:16:37 +08:00
|
|
|
|
/* Find a default architecture. */
|
2006-11-11 03:20:37 +08:00
|
|
|
|
if (default_bfd_arch == NULL)
|
2000-06-07 12:38:02 +08:00
|
|
|
|
{
|
2000-06-08 12:00:56 +08:00
|
|
|
|
/* Choose the architecture by taking the first one
|
2011-01-01 03:16:37 +08:00
|
|
|
|
alphabetically. */
|
2000-06-08 12:00:56 +08:00
|
|
|
|
const char *chosen = arches[0];
|
2000-06-07 12:38:02 +08:00
|
|
|
|
const char **arch;
|
|
|
|
|
for (arch = arches; *arch != NULL; arch++)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp (*arch, chosen) < 0)
|
|
|
|
|
chosen = *arch;
|
|
|
|
|
}
|
|
|
|
|
if (chosen == NULL)
|
2001-02-08 14:03:54 +08:00
|
|
|
|
internal_error (__FILE__, __LINE__,
|
2005-01-05 Baurjan Ismagulov <ibr@ata.cs.hun.edu.tr>
Committed by Andrew Cagney.
* ada-valprint.c, aix-thread.c, alpha-nat.c: I18n markup.
* alphabsd-nat.c, alphanbsd-tdep.c, amd64-linux-nat.c: I18n markup.
* amd64-tdep.c, amd64bsd-nat.c, amd64fbsd-nat.c: I18n markup.
* arch-utils.c, arm-linux-nat.c, arm-tdep.c: I18n markup.
* armnbsd-nat.c, armnbsd-tdep.c, auxv.c, avr-tdep.c: I18n markup.
* aix-thread.c (_initialize_aix_thread): Get rid of the
deprecated_add_show_from_set call.
* alpha-tdep.c (_initialize_alpha_tdep): Ditto.
* arm-tdep.c (_initialize_arm_tdep): Ditto.
* command.h (add_setshow_enum_cmd): Add arguments for returning
new list elements.
* cli/cli-decode.c (add_setshow_enum_cmd): Ditto.
* mips-tdep.c (_initialize_mips_tdep): Modify calls to
add_setshow_enum_cmd.
2005-01-05 23:43:50 +08:00
|
|
|
|
_("initialize_current_architecture: No arch"));
|
2006-11-11 03:20:37 +08:00
|
|
|
|
default_bfd_arch = bfd_scan_arch (chosen);
|
|
|
|
|
if (default_bfd_arch == NULL)
|
2001-02-08 14:03:54 +08:00
|
|
|
|
internal_error (__FILE__, __LINE__,
|
2005-01-05 Baurjan Ismagulov <ibr@ata.cs.hun.edu.tr>
Committed by Andrew Cagney.
* ada-valprint.c, aix-thread.c, alpha-nat.c: I18n markup.
* alphabsd-nat.c, alphanbsd-tdep.c, amd64-linux-nat.c: I18n markup.
* amd64-tdep.c, amd64bsd-nat.c, amd64fbsd-nat.c: I18n markup.
* arch-utils.c, arm-linux-nat.c, arm-tdep.c: I18n markup.
* armnbsd-nat.c, armnbsd-tdep.c, auxv.c, avr-tdep.c: I18n markup.
* aix-thread.c (_initialize_aix_thread): Get rid of the
deprecated_add_show_from_set call.
* alpha-tdep.c (_initialize_alpha_tdep): Ditto.
* arm-tdep.c (_initialize_arm_tdep): Ditto.
* command.h (add_setshow_enum_cmd): Add arguments for returning
new list elements.
* cli/cli-decode.c (add_setshow_enum_cmd): Ditto.
* mips-tdep.c (_initialize_mips_tdep): Modify calls to
add_setshow_enum_cmd.
2005-01-05 23:43:50 +08:00
|
|
|
|
_("initialize_current_architecture: Arch not found"));
|
2000-06-08 12:00:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
2006-11-11 03:20:37 +08:00
|
|
|
|
info.bfd_arch_info = default_bfd_arch;
|
|
|
|
|
|
2002-01-29 11:51:19 +08:00
|
|
|
|
/* Take several guesses at a byte order. */
|
2006-11-11 03:20:37 +08:00
|
|
|
|
if (default_byte_order == BFD_ENDIAN_UNKNOWN
|
2000-06-08 12:00:56 +08:00
|
|
|
|
&& default_bfd_vec != NULL)
|
|
|
|
|
{
|
2011-01-01 03:16:37 +08:00
|
|
|
|
/* Extract BFD's default vector's byte order. */
|
2000-06-08 12:00:56 +08:00
|
|
|
|
switch (default_bfd_vec->byteorder)
|
|
|
|
|
{
|
|
|
|
|
case BFD_ENDIAN_BIG:
|
2006-11-11 03:20:37 +08:00
|
|
|
|
default_byte_order = BFD_ENDIAN_BIG;
|
2000-06-08 12:00:56 +08:00
|
|
|
|
break;
|
|
|
|
|
case BFD_ENDIAN_LITTLE:
|
2006-11-11 03:20:37 +08:00
|
|
|
|
default_byte_order = BFD_ENDIAN_LITTLE;
|
2000-06-08 12:00:56 +08:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-11-11 03:20:37 +08:00
|
|
|
|
if (default_byte_order == BFD_ENDIAN_UNKNOWN)
|
2000-06-08 12:00:56 +08:00
|
|
|
|
{
|
2011-01-01 03:16:37 +08:00
|
|
|
|
/* look for ``*el-*'' in the target name. */
|
2000-06-08 12:00:56 +08:00
|
|
|
|
const char *chp;
|
|
|
|
|
chp = strchr (target_name, '-');
|
|
|
|
|
if (chp != NULL
|
|
|
|
|
&& chp - 2 >= target_name
|
|
|
|
|
&& strncmp (chp - 2, "el", 2) == 0)
|
2006-11-11 03:20:37 +08:00
|
|
|
|
default_byte_order = BFD_ENDIAN_LITTLE;
|
2000-06-08 12:00:56 +08:00
|
|
|
|
}
|
2006-11-11 03:20:37 +08:00
|
|
|
|
if (default_byte_order == BFD_ENDIAN_UNKNOWN)
|
2000-06-08 12:00:56 +08:00
|
|
|
|
{
|
|
|
|
|
/* Wire it to big-endian!!! */
|
2006-11-11 03:20:37 +08:00
|
|
|
|
default_byte_order = BFD_ENDIAN_BIG;
|
2000-06-08 12:00:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
2006-11-11 03:20:37 +08:00
|
|
|
|
info.byte_order = default_byte_order;
|
2008-08-12 03:00:25 +08:00
|
|
|
|
info.byte_order_for_code = info.byte_order;
|
2006-11-11 03:20:37 +08:00
|
|
|
|
|
2003-08-22 04:43:10 +08:00
|
|
|
|
if (! gdbarch_update_p (info))
|
|
|
|
|
internal_error (__FILE__, __LINE__,
|
2005-01-05 Baurjan Ismagulov <ibr@ata.cs.hun.edu.tr>
Committed by Andrew Cagney.
* ada-valprint.c, aix-thread.c, alpha-nat.c: I18n markup.
* alphabsd-nat.c, alphanbsd-tdep.c, amd64-linux-nat.c: I18n markup.
* amd64-tdep.c, amd64bsd-nat.c, amd64fbsd-nat.c: I18n markup.
* arch-utils.c, arm-linux-nat.c, arm-tdep.c: I18n markup.
* armnbsd-nat.c, armnbsd-tdep.c, auxv.c, avr-tdep.c: I18n markup.
* aix-thread.c (_initialize_aix_thread): Get rid of the
deprecated_add_show_from_set call.
* alpha-tdep.c (_initialize_alpha_tdep): Ditto.
* arm-tdep.c (_initialize_arm_tdep): Ditto.
* command.h (add_setshow_enum_cmd): Add arguments for returning
new list elements.
* cli/cli-decode.c (add_setshow_enum_cmd): Ditto.
* mips-tdep.c (_initialize_mips_tdep): Modify calls to
add_setshow_enum_cmd.
2005-01-05 23:43:50 +08:00
|
|
|
|
_("initialize_current_architecture: Selection of "
|
|
|
|
|
"initial architecture failed"));
|
2000-06-07 12:38:02 +08:00
|
|
|
|
|
2000-06-08 12:00:56 +08:00
|
|
|
|
/* Create the ``set architecture'' command appending ``auto'' to the
|
2011-01-01 03:16:37 +08:00
|
|
|
|
list of architectures. */
|
2000-06-07 12:38:02 +08:00
|
|
|
|
{
|
2011-01-01 03:16:37 +08:00
|
|
|
|
/* Append ``auto''. */
|
2000-06-07 12:38:02 +08:00
|
|
|
|
int nr;
|
|
|
|
|
for (nr = 0; arches[nr] != NULL; nr++);
|
|
|
|
|
arches = xrealloc (arches, sizeof (char*) * (nr + 2));
|
|
|
|
|
arches[nr + 0] = "auto";
|
|
|
|
|
arches[nr + 1] = NULL;
|
2005-02-21 12:31:59 +08:00
|
|
|
|
add_setshow_enum_cmd ("architecture", class_support,
|
2011-01-06 06:22:53 +08:00
|
|
|
|
arches, &set_architecture_string,
|
|
|
|
|
_("Set architecture of target."),
|
|
|
|
|
_("Show architecture of target."), NULL,
|
2005-02-21 12:31:59 +08:00
|
|
|
|
set_architecture, show_architecture,
|
|
|
|
|
&setlist, &showlist);
|
2000-06-07 12:38:02 +08:00
|
|
|
|
add_alias_cmd ("processor", "architecture", class_support, 1, &setlist);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-12-19 22:14:52 +08:00
|
|
|
|
/* Initialize a gdbarch info to values that will be automatically
|
|
|
|
|
overridden. Note: Originally, this ``struct info'' was initialized
|
Index: mi/ChangeLog
2003-10-24 Andrew Cagney <cagney@redhat.com>
* tui-out.c: Fix "fortunatly"[sic].
Index: doc/ChangeLog
2003-10-24 Andrew Cagney <cagney@redhat.com>
* annotate.texinfo: Fix "fortunatly"[sic].
2003-10-24 Andrew Cagney <cagney@redhat.com>
* osabi.c (gdbarch_init_osabi): Fix typos, and "fortunatly"[sic].
* PROBLEMS, arch-utils.c, cli-out.c, command.h: Ditto.
* complaints.c, cris-tdep.c, disasm.c, dwarf2-frame.c: Ditto.
* frame.c, frame.h, infcall.c, infcmd.c, infrun.c: Ditto.
* kod.c, mips-tdep.c, regcache.c, regcache.h, remote.c: Ditto.
2003-10-25 01:37:04 +08:00
|
|
|
|
using memset(0). Unfortunately, that ran into problems, namely
|
2001-12-19 22:14:52 +08:00
|
|
|
|
BFD_ENDIAN_BIG is zero. An explicit initialization function that
|
|
|
|
|
can explicitly set each field to a well defined value is used. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
gdbarch_info_init (struct gdbarch_info *info)
|
|
|
|
|
{
|
|
|
|
|
memset (info, 0, sizeof (struct gdbarch_info));
|
2001-12-30 03:25:58 +08:00
|
|
|
|
info->byte_order = BFD_ENDIAN_UNKNOWN;
|
2008-08-12 03:00:25 +08:00
|
|
|
|
info->byte_order_for_code = info->byte_order;
|
2003-01-05 07:38:46 +08:00
|
|
|
|
info->osabi = GDB_OSABI_UNINITIALIZED;
|
2001-12-19 22:14:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
2003-11-11 00:17:12 +08:00
|
|
|
|
/* Similar to init, but this time fill in the blanks. Information is
|
2006-11-11 03:20:37 +08:00
|
|
|
|
obtained from the global "set ..." options and explicitly
|
|
|
|
|
initialized INFO fields. */
|
2003-11-10 07:52:28 +08:00
|
|
|
|
|
|
|
|
|
void
|
2006-11-11 03:20:37 +08:00
|
|
|
|
gdbarch_info_fill (struct gdbarch_info *info)
|
2003-11-10 07:52:28 +08:00
|
|
|
|
{
|
|
|
|
|
/* "(gdb) set architecture ...". */
|
|
|
|
|
if (info->bfd_arch_info == NULL
|
2006-11-11 03:20:37 +08:00
|
|
|
|
&& target_architecture_user)
|
|
|
|
|
info->bfd_arch_info = target_architecture_user;
|
2006-11-29 06:10:26 +08:00
|
|
|
|
/* From the file. */
|
2003-11-10 07:52:28 +08:00
|
|
|
|
if (info->bfd_arch_info == NULL
|
|
|
|
|
&& info->abfd != NULL
|
|
|
|
|
&& bfd_get_arch (info->abfd) != bfd_arch_unknown
|
|
|
|
|
&& bfd_get_arch (info->abfd) != bfd_arch_obscure)
|
|
|
|
|
info->bfd_arch_info = bfd_get_arch_info (info->abfd);
|
XML feature description support.
* NEWS: Mention target descriptions, "set tdesc filename",
"unset tdesc filename", "show tdesc filename", and
qXfer:features:read.
* arch-utils.c (choose_architecture_for_target): New function.
(gdbarch_info_fill): Call it.
* target-descriptions.c (struct property): Make members non-const.
(struct target_desc): Add arch member.
(target_description_filename): New variable.
(target_find_description): Try via XML first.
(tdesc_architecture): New.
(free_target_description, make_cleanup_free_target_description): New.
(set_tdesc_property): Call xstrdup.
(set_tdesc_architecture, tdesc_set_cmdlist, tdesc_show_cmdlist)
(tdesc_unset_cmdlist, unset_tdesc_cmd, unset_tdesc_filename_cmd)
(set_tdesc_cmd, show_tdesc_cmd, set_tdesc_filename_cmd)
(show_tdesc_filename_cmd, _initialize_target_descriptions): New.
* target-descriptions.h (tdesc_architecture)
(make_cleanup_free_target_description, set_tdesc_architecture): New
prototypes.
* Makefile.in (SFILES): Add xml-tdesc.c.
(COMMON_OBS): Add xml-tdesc.o.
(target-descriptions.o): Update.
(xml-tdesc.o): New rule.
* xml-tdesc.c, xml-tdesc.h: New files.
* remote.c (PACKET_qXfer_features): New enum.
(remote_protocol_features): Add qXfer:features:read.
(remote_xfer_partial): Handle TARGET_OBJECT_AVAILABLE_FEATURES.
(_initialize_remote): Register qXfer:features:read.
* target.h (enum target_object): Add TARGET_OBJECT_AVAILABLE_FEATURES.
* features/gdb-target.dtd: New file.
* linux-i386-low.c (the_low_target): Set arch_string.
* linux-x86-64-low.c (the_low_target): Likewise.
* linux-low.c (linux_arch_string): New.
(linux_target_ops): Add it.
* linux-low.h (struct linux_target_ops): Add arch_string.
* server.c (write_qxfer_response): Use const void * for DATA.
(get_features_xml): New.
(handle_query): Handle qXfer:features:read. Report it for qSupported.
* target.h (struct target_ops): Add arch_string method.
* gdb.texinfo (Target Descriptions): New section.
(General Query Packets): Add QPassSignals anchor. Mention
qXfer:features:read under qSupported. Expand mentions of
qXfer:memory-map:read and QPassSignals. Document
qXfer:features:read.
2007-01-10 06:55:10 +08:00
|
|
|
|
/* From the target. */
|
|
|
|
|
if (info->target_desc != NULL)
|
|
|
|
|
info->bfd_arch_info = choose_architecture_for_target
|
2009-07-31 22:39:12 +08:00
|
|
|
|
(info->target_desc, info->bfd_arch_info);
|
2006-11-11 03:20:37 +08:00
|
|
|
|
/* From the default. */
|
|
|
|
|
if (info->bfd_arch_info == NULL)
|
|
|
|
|
info->bfd_arch_info = default_bfd_arch;
|
2003-11-10 07:52:28 +08:00
|
|
|
|
|
|
|
|
|
/* "(gdb) set byte-order ...". */
|
|
|
|
|
if (info->byte_order == BFD_ENDIAN_UNKNOWN
|
2006-11-11 03:20:37 +08:00
|
|
|
|
&& target_byte_order_user != BFD_ENDIAN_UNKNOWN)
|
|
|
|
|
info->byte_order = target_byte_order_user;
|
2003-11-10 07:52:28 +08:00
|
|
|
|
/* From the INFO struct. */
|
|
|
|
|
if (info->byte_order == BFD_ENDIAN_UNKNOWN
|
|
|
|
|
&& info->abfd != NULL)
|
|
|
|
|
info->byte_order = (bfd_big_endian (info->abfd) ? BFD_ENDIAN_BIG
|
2006-11-11 03:20:37 +08:00
|
|
|
|
: bfd_little_endian (info->abfd) ? BFD_ENDIAN_LITTLE
|
|
|
|
|
: BFD_ENDIAN_UNKNOWN);
|
|
|
|
|
/* From the default. */
|
|
|
|
|
if (info->byte_order == BFD_ENDIAN_UNKNOWN)
|
|
|
|
|
info->byte_order = default_byte_order;
|
2008-08-12 03:00:25 +08:00
|
|
|
|
info->byte_order_for_code = info->byte_order;
|
2003-11-10 07:52:28 +08:00
|
|
|
|
|
|
|
|
|
/* "(gdb) set osabi ...". Handled by gdbarch_lookup_osabi. */
|
2009-07-21 02:51:42 +08:00
|
|
|
|
/* From the manual override, or from file. */
|
2003-11-10 07:52:28 +08:00
|
|
|
|
if (info->osabi == GDB_OSABI_UNINITIALIZED)
|
|
|
|
|
info->osabi = gdbarch_lookup_osabi (info->abfd);
|
2009-07-21 02:51:42 +08:00
|
|
|
|
/* From the target. */
|
|
|
|
|
if (info->osabi == GDB_OSABI_UNKNOWN && info->target_desc != NULL)
|
|
|
|
|
info->osabi = tdesc_osabi (info->target_desc);
|
|
|
|
|
/* From the configured default. */
|
2009-07-21 03:41:34 +08:00
|
|
|
|
#ifdef GDB_OSABI_DEFAULT
|
2009-07-21 02:51:42 +08:00
|
|
|
|
if (info->osabi == GDB_OSABI_UNKNOWN)
|
|
|
|
|
info->osabi = GDB_OSABI_DEFAULT;
|
2009-07-21 03:41:34 +08:00
|
|
|
|
#endif
|
2003-11-10 07:52:28 +08:00
|
|
|
|
|
|
|
|
|
/* Must have at least filled in the architecture. */
|
|
|
|
|
gdb_assert (info->bfd_arch_info != NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-01 03:16:37 +08:00
|
|
|
|
/* Return "current" architecture. If the target is running, this is
|
|
|
|
|
the architecture of the selected frame. Otherwise, the "current"
|
|
|
|
|
architecture defaults to the target architecture.
|
2009-07-03 01:02:35 +08:00
|
|
|
|
|
2011-01-01 03:16:37 +08:00
|
|
|
|
This function should normally be called solely by the command
|
|
|
|
|
interpreter routines to determine the architecture to execute a
|
|
|
|
|
command in. */
|
2009-07-03 01:02:35 +08:00
|
|
|
|
struct gdbarch *
|
|
|
|
|
get_current_arch (void)
|
|
|
|
|
{
|
|
|
|
|
if (has_stack_frames ())
|
|
|
|
|
return get_frame_arch (get_selected_frame (NULL));
|
|
|
|
|
else
|
|
|
|
|
return target_gdbarch;
|
|
|
|
|
}
|
|
|
|
|
|
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 17:51:43 +08:00
|
|
|
|
int
|
|
|
|
|
default_has_shared_address_space (struct gdbarch *gdbarch)
|
|
|
|
|
{
|
|
|
|
|
/* Simply say no. In most unix-like targets each inferior/process
|
|
|
|
|
has its own address space. */
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-06 12:20:27 +08:00
|
|
|
|
int
|
|
|
|
|
default_fast_tracepoint_valid_at (struct gdbarch *gdbarch,
|
|
|
|
|
CORE_ADDR addr, int *isize, char **msg)
|
|
|
|
|
{
|
|
|
|
|
/* We don't know if maybe the target has some way to do fast
|
|
|
|
|
tracepoints that doesn't need gdbarch, so always say yes. */
|
|
|
|
|
if (msg)
|
|
|
|
|
*msg = NULL;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-02 00:09:22 +08:00
|
|
|
|
void
|
|
|
|
|
default_remote_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
|
|
|
|
|
int *kindptr)
|
|
|
|
|
{
|
|
|
|
|
gdbarch_breakpoint_from_pc (gdbarch, pcptr, kindptr);
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-27 21:09:37 +08:00
|
|
|
|
void
|
|
|
|
|
default_gen_return_address (struct gdbarch *gdbarch,
|
|
|
|
|
struct agent_expr *ax, struct axs_value *value,
|
|
|
|
|
CORE_ADDR scope)
|
|
|
|
|
{
|
|
|
|
|
error (_("This architecture has no method to collect a return address."));
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-02 05:11:23 +08:00
|
|
|
|
int
|
|
|
|
|
default_target_signal_to_host (struct gdbarch *gdbarch, enum target_signal ts)
|
|
|
|
|
{
|
|
|
|
|
return target_signal_to_host (ts);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum target_signal
|
|
|
|
|
default_target_signal_from_host (struct gdbarch *gdbarch, int signo)
|
|
|
|
|
{
|
|
|
|
|
return target_signal_from_host (signo);
|
|
|
|
|
}
|
|
|
|
|
|
2000-04-03 08:00:32 +08:00
|
|
|
|
/* */
|
|
|
|
|
|
2011-01-06 06:22:53 +08:00
|
|
|
|
/* -Wmissing-prototypes */
|
|
|
|
|
extern initialize_file_ftype _initialize_gdbarch_utils;
|
2000-04-03 08:00:32 +08:00
|
|
|
|
|
|
|
|
|
void
|
2000-06-07 12:38:02 +08:00
|
|
|
|
_initialize_gdbarch_utils (void)
|
2000-04-03 08:00:32 +08:00
|
|
|
|
{
|
2005-02-21 12:31:59 +08:00
|
|
|
|
add_setshow_enum_cmd ("endian", class_support,
|
2011-01-06 06:22:53 +08:00
|
|
|
|
endian_enum, &set_endian_string,
|
|
|
|
|
_("Set endianness of target."),
|
|
|
|
|
_("Show endianness of target."),
|
|
|
|
|
NULL, set_endian, show_endian,
|
2005-02-21 12:31:59 +08:00
|
|
|
|
&setlist, &showlist);
|
2000-04-03 08:00:32 +08:00
|
|
|
|
}
|