binutils-gdb/gdb/ravenscar-thread.c

457 lines
15 KiB
C
Raw Normal View History

/* Ada Ravenscar thread support.
Copyright (C) 2004-2017 Free Software Foundation, Inc.
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
the Free Software Foundation; either version 3 of the License, or
(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
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
#include "gdbcore.h"
#include "gdbthread.h"
#include "ada-lang.h"
#include "target.h"
#include "inferior.h"
#include "command.h"
#include "ravenscar-thread.h"
#include "observer.h"
#include "gdbcmd.h"
#include "top.h"
#include "regcache.h"
start change to progspace independence This patch starts changing minimal symbols to be independent of the program space. Specifically, it adds a new objfile parameter to MSYMBOL_VALUE_ADDRESS and changes all the code to use it. This is needed so we can change gdb to apply the section offset when a minsym's address is computed, as opposed to baking the offsets into the symbol itself. A few spots still need the unrelocated address. For these, we introduce MSYMBOL_VALUE_RAW_ADDRESS. As a convenience, we also add the new macro BMSYMBOL_VALUE_ADDRESS, which computes the address of a bound minimal symbol. This just does the obvious thing with the fields. Note that this change does not actually enable program space independence. That requires more changes to gdb. However, to ensure that these changes compile properly, this patch does add the needed section lookup code to MSYMBOL_VALUE_ADDRESS -- it just ensures it has no effect at runtime by multiplying the offset by 0. 2014-02-26 Tom Tromey <tromey@redhat.com> * ada-lang.c (ada_main_name): Update. (ada_add_standard_exceptions): Update. * ada-tasks.c (ada_tasks_inferior_data_sniffer): Update. * aix-thread.c (pdc_symbol_addrs, pd_enable): Update. * arm-tdep.c (skip_prologue_function, arm_skip_stub): Update. * auxv.c (ld_so_xfer_auxv): Update. * avr-tdep.c (avr_scan_prologue): Update. * ax-gdb.c (gen_var_ref): Update. * blockframe.c (get_pc_function_start) (find_pc_partial_function_gnu_ifunc): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * bsd-uthread.c (bsd_uthread_lookup_address): Update. * c-valprint.c (c_val_print): Update. * coff-pe-read.c (add_pe_forwarded_sym): Update. * common/agent.c (agent_look_up_symbols): Update. * dbxread.c (find_stab_function_addr, end_psymtab): Update. * dwarf2loc.c (call_site_to_target_addr): Update. * dwarf2read.c (dw2_find_pc_sect_symtab): Update. * elfread.c (elf_gnu_ifunc_record_cache) (elf_gnu_ifunc_resolve_by_got): Update. * findvar.c (default_read_var_value): Update. * frame.c (inside_main_func): Update. * frv-tdep.c (frv_frame_this_id): Update. * glibc-tdep.c (glibc_skip_solib_resolver): Update. * gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline): Update. * hppa-hpux-tdep.c (hppa64_hpux_search_dummy_call_sequence) (hppa_hpux_find_dummy_bpaddr): Update. * hppa-tdep.c (hppa_symbol_address): Update. * infcmd.c (until_next_command): Update. * jit.c (jit_read_descriptor, jit_breakpoint_re_set_internal): Update. * linespec.c (minsym_found, add_minsym): Update. * linux-nat.c (get_signo): Update. * linux-thread-db.c (inferior_has_bug): Update. * m32c-tdep.c (m32c_return_value) (m32c_m16c_address_to_pointer): Update. * m32r-tdep.c (m32r_frame_this_id): Update. * m68hc11-tdep.c (m68hc11_get_register_info): Update. * machoread.c (macho_resolve_oso_sym_with_minsym): Update. * maint.c (maintenance_translate_address): Update. * minsyms.c (lookup_minimal_symbol_by_pc_name): Update. (frob_address): New function. (lookup_minimal_symbol_by_pc_section_1): Use raw addresses, frob_address. Rename parameter to "pc_in". (compare_minimal_symbols, compact_minimal_symbols): Use raw addresses. (find_solib_trampoline_target, minimal_symbol_upper_bound): Update. * mips-linux-tdep.c (mips_linux_skip_resolver): Update. * mips-tdep.c (mips_skip_pic_trampoline_code): Update. * objc-lang.c (find_objc_msgsend): Update. * objfiles.c (objfile_relocate1): Update. * obsd-tdep.c (obsd_skip_solib_resolver): Update. * p-valprint.c (pascal_val_print): Update. * parse.c (write_exp_msymbol): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_lookup) (ppc_elfv2_skip_entrypoint): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * printcmd.c (build_address_symbolic, msym_info) (address_info): Update. * proc-service.c (ps_pglobal_lookup): Update. * psymtab.c (find_pc_sect_psymtab_closer) (find_pc_sect_psymtab, find_pc_sect_symtab_from_partial): Change msymbol parameter to bound_minimal_symbol. * ravenscar-thread.c (get_running_thread_id): Update. * remote.c (remote_check_symbols): Update. * sh64-tdep.c (sh64_elf_make_msymbol_special): Use raw address. * sol2-tdep.c (sol2_skip_solib_resolver): Update. * solib-dsbt.c (lm_base): Update. * solib-frv.c (lm_base, main_got): Update. * solib-irix.c (locate_base): Update. * solib-som.c (som_solib_create_inferior_hook) (link_map_start): Update. * solib-spu.c (spu_enable_break, ocl_enable_break): Update. * solib-svr4.c (elf_locate_base, enable_break): Update. * spu-tdep.c (spu_get_overlay_table, spu_catch_start) (flush_ea_cache): Update. * stabsread.c (define_symbol, scan_file_globals): Update. * stack.c (find_frame_funname): Update. * symfile-debug.c (debug_qf_expand_symtabs_matching) (debug_qf_find_pc_sect_symtab): Update. * symfile.c (simple_read_overlay_table) (simple_overlay_update): Update. * symfile.h (struct quick_symbol_functions) <find_pc_sect_symtab>: Change type of msymbol to bound_minimal_symbol. * symmisc.c (dump_msymbols): Update. * symtab.c (find_pc_sect_symtab_via_partial) (find_pc_sect_psymtab, find_pc_sect_line, skip_prologue_sal) (search_symbols, print_msymbol_info): Update. * symtab.h (MSYMBOL_VALUE_RAW_ADDRESS): New macro. (MSYMBOL_VALUE_ADDRESS): Redefine. (BMSYMBOL_VALUE_ADDRESS): New macro. * tracepoint.c (scope_info): Update. * tui/tui-disasm.c (tui_find_disassembly_address) (tui_get_begin_asm_address): Update. * valops.c (find_function_in_inferior): Update. * value.c (value_static_field, value_fn_field): Update.
2013-08-15 16:46:35 +02:00
#include "objfiles.h"
/* If non-null, ravenscar task support is enabled. */
static int ravenscar_task_support = 1;
/* This module's target-specific operations. */
static struct target_ops ravenscar_ops;
/* Some base target uses a special value for the null PID (exempli gratia
remote). */
static ptid_t base_magic_null_ptid;
/* Ptid of the inferior as seen by the process stratum. */
static ptid_t base_ptid;
static const char running_thread_name[] = "__gnat_running_thread_table";
static const char known_tasks_name[] = "system__tasking__debug__known_tasks";
static const char first_task_name[] = "system__tasking__debug__first_task";
static const char ravenscar_runtime_initializer[] =
"system__bb__threads__initialize";
Push pruning old threads down to the target When GDB wants to sync the thread list with the target's (e.g., due to "info threads"), it calls update_thread_list: update_thread_list (void) { prune_threads (); target_find_new_threads (); update_threads_executing (); } And then prune_threads does: prune_threads (void) { struct thread_info *tp, *next; for (tp = thread_list; tp; tp = next) { next = tp->next; if (!thread_alive (tp)) delete_thread (tp->ptid); } } Calling thread_live on each thread one by one is expensive. E.g., on Linux, it ends up doing kill(SIG0) once for each thread. Not a big deal, but still a bunch of syscalls... With the remote target, it's cumbersome. That thread_alive call ends up generating one T packet per thread: Sending packet: $Tp2141.2150#82...Packet received: OK Sending packet: $Tp2141.214f#b7...Packet received: OK Sending packet: $Tp2141.2141#82...Packet received: OK Sending packet: $qXfer:threads:read::0,fff#03...Packet received: l<threads>\n<thread id="p2141.2141" core="2"/>\n<thread id="p2141.214f" core="1"/>\n<thread id="p2141.2150" core="2"/>\n</threads>\n That seems a bit silly when target_find_new_threads method implementations will always fetch the whole current set of target threads, and then add those that are not in GDB's thread list, to GDB's thread list. This patch thus pushes down the responsibility of pruning dead threads to the target_find_new_threads method instead, so a target may implement pruning dead threads however it wants. Once we do that, target_find_new_threads becomes a misnomer, so the patch renames it to target_update_thread_list. The patch doesn't attempt to do any optimization to any target yet. It simply exports prune_threads, and makes all implementations of target_update_thread_list call that. It's meant to be a no-op. gdb/ 2014-10-15 Pedro Alves <palves@redhat.com> * ada-tasks.c (print_ada_task_info, task_command_1): Adjust. * bsd-uthread.c (bsd_uthread_find_new_threads): Rename to ... (bsd_uthread_update_thread_list): ... this. Call prune_threads. (bsd_uthread_target): Adjust. * corelow.c (core_open): Adjust. * dec-thread.c (dec_thread_find_new_threads): Update comment. (dec_thread_update_thread_list): New function. (init_dec_thread_ops): Adjust. * gdbthread.h (prune_threads): New declaration. * linux-thread-db.c (thread_db_find_new_threads): Rename to ... (thread_db_update_thread_list): ... this. Call prune_threads. (init_thread_db_ops): Adjust. * nto-procfs.c (procfs_find_new_threads): Rename to ... (procfs_update_thread_list): ... this. Call prune_threads. (procfs_attach, procfs_create_inferior, init_procfs_targets): Adjust. * obsd-nat.c (obsd_find_new_threads): Rename to ... (obsd_update_thread_list): ... this. Call prune_threads. (obsd_add_target): Adjust. * procfs.c (procfs_target): Adjust. (procfs_notice_thread): Update comment. (procfs_find_new_threads): Rename to ... (procfs_update_thread_list): ... this. Call prune_threads. * ravenscar-thread.c (ravenscar_update_inferior_ptid): Update comment. (ravenscar_wait): Adjust. (ravenscar_find_new_threads): Rename to ... (ravenscar_update_thread_list): ... this. Call prune_threads. (init_ravenscar_thread_ops): Adjust. * record-btrace.c (record_btrace_find_new_threads): Rename to ... (record_btrace_update_thread_list): ... this. Adjust comment. (init_record_btrace_ops): Adjust. * remote.c (remote_threads_info): Rename to ... (remote_update_thread_list): ... this. Call prune_threads. (remote_start_remote, extended_remote_attach_1, init_remote_ops): Adjust. * sol-thread.c (check_for_thread_db): Adjust. (sol_find_new_threads_callback): Rename to ... (sol_update_thread_list_callback): ... this. (sol_find_new_threads): Rename to ... (sol_update_thread_list): ... this. Call prune_threads. Adjust. (sol_get_ada_task_ptid, init_sol_thread_ops): Adjust. * target-delegates.c: Regenerate. * target.c (target_find_new_threads): Rename to ... (target_update_thread_list): ... this. * target.h (struct target_ops): Rename to_find_new_threads field to to_update_thread_list. (target_find_new_threads): Rename to ... (target_update_thread_list): ... this. * thread.c (prune_threads): Make extern. (update_thread_list): Adjust.
2014-10-15 23:44:00 +02:00
static void ravenscar_update_thread_list (struct target_ops *ops);
static ptid_t ravenscar_running_thread (void);
-Wwrite-strings: Constify target_pid_to_str and target_thread_extra_thread_info -Wwrite-strings flagged a missing cast for example here: static char * ravenscar_extra_thread_info (struct target_ops *self, struct thread_info *tp) { return "Ravenscar task"; Since callers are not supposed to free the string returned by these methods, change the methods' signature to return const strings. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * aix-thread.c (aix_thread_pid_to_str) (aix_thread_extra_thread_info): Constify. * bsd-kvm.c (bsd_kvm_pid_to_str): Constify. * bsd-uthread.c (bsd_uthread_extra_thread_info) (bsd_uthread_pid_to_str): Constify. * corelow.c (core_pid_to_str): Constify. * darwin-nat.c (darwin_pid_to_str): Constify. * fbsd-nat.c (fbsd_pid_to_str): Constify. * fbsd-tdep.c (fbsd_core_pid_to_str, gdbarch_core_pid_to_str): Constify. * gnu-nat.c (gnu_pid_to_str): Constify. * go32-nat.c (go32_pid_to_str): Constify. * i386-cygwin-tdep.c (i386_windows_core_pid_to_str): Constify. * inf-ptrace.c (inf_ptrace_pid_to_str): Constify. * inferior.c (inferior_pid_to_str): Constify. * linux-nat.c (linux_nat_pid_to_str): Constify. * linux-tdep.c (linux_core_pid_to_str): Constify. * linux-thread-db.c (thread_db_pid_to_str) (thread_db_extra_thread_info): Constify. * nto-tdep.c (nto_extra_thread_info): Constify. * nto-tdep.h (nto_extra_thread_info): Constify. * obsd-nat.c (obsd_pid_to_str): Constify. * procfs.c (procfs_pid_to_str): Constify. * ravenscar-thread.c (ravenscar_extra_thread_info) (ravenscar_pid_to_str): Constify. * remote-sim.c (gdbsim_pid_to_str): Constify. * remote.c (remote_threads_extra_info, remote_pid_to_str): Constify. * sol-thread.c (solaris_pid_to_str): Constify. * sol2-tdep.c (sol2_core_pid_to_str): Constify. * sol2-tdep.h (sol2_core_pid_to_str): Constify. * target.c (default_pid_to_str, target_pid_to_str) (normal_pid_to_str, default_pid_to_str): Constify. * target.h (target_ops::to_pid_to_str) (target_ops::to_extra_thread_info): Constify. (target_pid_to_str, normal_pid_to_str): Constify. * windows-nat.c (windows_pid_to_str): Constify. * gdbarch.sh (core_pid_to_str): Constify. * target-delegates.c: Regenerate. * gdbarch.h, gdbarch.c: Regenerate.
2017-04-05 20:21:34 +02:00
static const char *ravenscar_extra_thread_info (struct target_ops *self,
struct thread_info *tp);
static int ravenscar_thread_alive (struct target_ops *ops, ptid_t ptid);
static void ravenscar_fetch_registers (struct target_ops *ops,
struct regcache *regcache, int regnum);
static void ravenscar_store_registers (struct target_ops *ops,
struct regcache *regcache, int regnum);
static void ravenscar_prepare_to_store (struct target_ops *self,
struct regcache *regcache);
static void ravenscar_resume (struct target_ops *ops, ptid_t ptid, int step,
enum gdb_signal siggnal);
static void ravenscar_mourn_inferior (struct target_ops *ops);
static void ravenscar_update_inferior_ptid (void);
static int has_ravenscar_runtime (void);
static int ravenscar_runtime_initialized (void);
static void ravenscar_inferior_created (struct target_ops *target,
int from_tty);
/* Fetch the ravenscar running thread from target memory and
update inferior_ptid accordingly. */
static void
ravenscar_update_inferior_ptid (void)
{
base_ptid = inferior_ptid;
/* If the runtime has not been initialized yet, the inferior_ptid is
the only ptid that there is. */
if (!ravenscar_runtime_initialized ())
return;
/* Make sure we set base_ptid before calling ravenscar_running_thread
as the latter relies on it. */
inferior_ptid = ravenscar_running_thread ();
gdb_assert (!ptid_equal (inferior_ptid, null_ptid));
/* The running thread may not have been added to
Push pruning old threads down to the target When GDB wants to sync the thread list with the target's (e.g., due to "info threads"), it calls update_thread_list: update_thread_list (void) { prune_threads (); target_find_new_threads (); update_threads_executing (); } And then prune_threads does: prune_threads (void) { struct thread_info *tp, *next; for (tp = thread_list; tp; tp = next) { next = tp->next; if (!thread_alive (tp)) delete_thread (tp->ptid); } } Calling thread_live on each thread one by one is expensive. E.g., on Linux, it ends up doing kill(SIG0) once for each thread. Not a big deal, but still a bunch of syscalls... With the remote target, it's cumbersome. That thread_alive call ends up generating one T packet per thread: Sending packet: $Tp2141.2150#82...Packet received: OK Sending packet: $Tp2141.214f#b7...Packet received: OK Sending packet: $Tp2141.2141#82...Packet received: OK Sending packet: $qXfer:threads:read::0,fff#03...Packet received: l<threads>\n<thread id="p2141.2141" core="2"/>\n<thread id="p2141.214f" core="1"/>\n<thread id="p2141.2150" core="2"/>\n</threads>\n That seems a bit silly when target_find_new_threads method implementations will always fetch the whole current set of target threads, and then add those that are not in GDB's thread list, to GDB's thread list. This patch thus pushes down the responsibility of pruning dead threads to the target_find_new_threads method instead, so a target may implement pruning dead threads however it wants. Once we do that, target_find_new_threads becomes a misnomer, so the patch renames it to target_update_thread_list. The patch doesn't attempt to do any optimization to any target yet. It simply exports prune_threads, and makes all implementations of target_update_thread_list call that. It's meant to be a no-op. gdb/ 2014-10-15 Pedro Alves <palves@redhat.com> * ada-tasks.c (print_ada_task_info, task_command_1): Adjust. * bsd-uthread.c (bsd_uthread_find_new_threads): Rename to ... (bsd_uthread_update_thread_list): ... this. Call prune_threads. (bsd_uthread_target): Adjust. * corelow.c (core_open): Adjust. * dec-thread.c (dec_thread_find_new_threads): Update comment. (dec_thread_update_thread_list): New function. (init_dec_thread_ops): Adjust. * gdbthread.h (prune_threads): New declaration. * linux-thread-db.c (thread_db_find_new_threads): Rename to ... (thread_db_update_thread_list): ... this. Call prune_threads. (init_thread_db_ops): Adjust. * nto-procfs.c (procfs_find_new_threads): Rename to ... (procfs_update_thread_list): ... this. Call prune_threads. (procfs_attach, procfs_create_inferior, init_procfs_targets): Adjust. * obsd-nat.c (obsd_find_new_threads): Rename to ... (obsd_update_thread_list): ... this. Call prune_threads. (obsd_add_target): Adjust. * procfs.c (procfs_target): Adjust. (procfs_notice_thread): Update comment. (procfs_find_new_threads): Rename to ... (procfs_update_thread_list): ... this. Call prune_threads. * ravenscar-thread.c (ravenscar_update_inferior_ptid): Update comment. (ravenscar_wait): Adjust. (ravenscar_find_new_threads): Rename to ... (ravenscar_update_thread_list): ... this. Call prune_threads. (init_ravenscar_thread_ops): Adjust. * record-btrace.c (record_btrace_find_new_threads): Rename to ... (record_btrace_update_thread_list): ... this. Adjust comment. (init_record_btrace_ops): Adjust. * remote.c (remote_threads_info): Rename to ... (remote_update_thread_list): ... this. Call prune_threads. (remote_start_remote, extended_remote_attach_1, init_remote_ops): Adjust. * sol-thread.c (check_for_thread_db): Adjust. (sol_find_new_threads_callback): Rename to ... (sol_update_thread_list_callback): ... this. (sol_find_new_threads): Rename to ... (sol_update_thread_list): ... this. Call prune_threads. Adjust. (sol_get_ada_task_ptid, init_sol_thread_ops): Adjust. * target-delegates.c: Regenerate. * target.c (target_find_new_threads): Rename to ... (target_update_thread_list): ... this. * target.h (struct target_ops): Rename to_find_new_threads field to to_update_thread_list. (target_find_new_threads): Rename to ... (target_update_thread_list): ... this. * thread.c (prune_threads): Make extern. (update_thread_list): Adjust.
2014-10-15 23:44:00 +02:00
system.tasking.debug's list yet; so ravenscar_update_thread_list
may not always add it to the thread list. Add it here. */
if (!find_thread_ptid (inferior_ptid))
add_thread (inferior_ptid);
}
/* The Ravenscar Runtime exports a symbol which contains the ID of
the thread that is currently running. Try to locate that symbol
and return its associated minimal symbol.
Return NULL if not found. */
use bound_minsym as result for lookup_minimal_symbol et al This patch changes a few minimal symbol lookup functions to return a bound_minimal_symbol rather than a pointer to the minsym. This change helps prepare gdb for computing a minimal symbol's address at the point of use. Note that this changes even those functions that ostensibly search a single objfile. That was necessary because, in fact, those functions can search an objfile and its separate debug objfiles; and it is important for the caller to know in which objfile the minimal symbol was actually found. The bulk of this patch is mechanical. 2014-02-26 Tom Tromey <tromey@redhat.com> * ada-lang.c (ada_update_initial_language): Update. (ada_main_name, ada_has_this_exception_support): Update. * ada-tasks.c (ada_tasks_inferior_data_sniffer): Update. * aix-thread.c (pdc_symbol_addrs, pd_enable): Update. * arm-tdep.c (arm_skip_stub): Update. * auxv.c (ld_so_xfer_auxv): Update. * avr-tdep.c (avr_scan_prologue): Update. * ax-gdb.c (gen_var_ref): Update. * breakpoint.c (struct breakpoint_objfile_data) <overlay_msym, longjmp_msym, terminate_msym, exception_msym>: Change type to bound_minimal_symbol. (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * bsd-uthread.c (bsd_uthread_lookup_address): Update. * c-exp.y (classify_name): Update. * coffread.c (coff_symfile_read): Update. * common/agent.c (agent_look_up_symbols): Update. * d-lang.c (d_main_name): Update. * dbxread.c (find_stab_function_addr, end_psymtab): Update. * dec-thread.c (enable_dec_thread): Update. * dwarf2loc.c (call_site_to_target_addr): Update. * elfread.c (elf_gnu_ifunc_resolve_by_got): Update. * eval.c (evaluate_subexp_standard): Update. * findvar.c (struct minsym_lookup_data) <result>: Change type to bound_minimal_symbol. <objfile>: Remove. (minsym_lookup_iterator_cb, default_read_var_value): Update. * frame.c (inside_main_func): Update. * frv-tdep.c (frv_frame_this_id): Update. * gcore.c (call_target_sbrk): Update. * glibc-tdep.c (glibc_skip_solib_resolver): Update. * gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline): Update. * go-lang.c (go_main_name): Update. * hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code) (hppa_hpux_find_import_stub_for_addr): Update. * hppa-tdep.c (hppa_extract_17, hppa_lookup_stub_minimal_symbol): Update. Change return type. * hppa-tdep.h (hppa_lookup_stub_minimal_symbol): Change return type. * jit.c (jit_breakpoint_re_set_internal): Update. * linux-fork.c (inferior_call_waitpid, checkpoint_command): Update. * linux-nat.c (get_signo): Update. * linux-thread-db.c (inferior_has_bug): Update * m32c-tdep.c (m32c_return_value) (m32c_m16c_address_to_pointer): Update. * m32r-tdep.c (m32r_frame_this_id): Update. * m68hc11-tdep.c (m68hc11_get_register_info): Update. * machoread.c (macho_resolve_oso_sym_with_minsym): Update. * minsyms.c (lookup_minimal_symbol_internal): Rename to lookup_minimal_symbol. Change return type. (lookup_minimal_symbol): Remove. (lookup_bound_minimal_symbol): Update. (lookup_minimal_symbol_text): Change return type. (lookup_minimal_symbol_solib_trampoline): Change return type. * minsyms.h (lookup_minimal_symbol, lookup_minimal_symbol_text) (lookup_minimal_symbol_solib_trampoline): Change return type. * mips-linux-tdep.c (mips_linux_skip_resolver): Update. * objc-lang.c (lookup_objc_class, lookup_child_selector) (value_nsstring, find_imps): Update. * obsd-tdep.c (obsd_skip_solib_resolver): Update. * p-lang.c (pascal_main_name): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * proc-service.c (ps_pglobal_lookup): Update. * ravenscar-thread.c (get_running_thread_msymbol): Change return type. (has_ravenscar_runtime, get_running_thread_id): Update. * remote.c (remote_check_symbols): Update. * sol-thread.c (ps_pglobal_lookup): Update. * sol2-tdep.c (sol2_skip_solib_resolver): Update. * solib-dsbt.c (lm_base): Update. * solib-frv.c (lm_base, frv_relocate_section_addresses): Update. * solib-irix.c (locate_base): Update. * solib-som.c (som_solib_create_inferior_hook) (som_solib_desire_dynamic_linker_symbols, link_map_start): Update. * solib-spu.c (spu_enable_break): Update. * solib-svr4.c (elf_locate_base, enable_break): Update. * spu-tdep.c (spu_get_overlay_table, spu_catch_start) (flush_ea_cache): Update. * stabsread.c (define_symbol): Update. * symfile.c (simple_read_overlay_table): Update. * symtab.c (find_pc_sect_line): Update. * tracepoint.c (scope_info): Update. * tui-disasm.c (tui_get_begin_asm_address): Update. * value.c (value_static_field): Update.
2013-10-15 03:53:29 +02:00
static struct bound_minimal_symbol
get_running_thread_msymbol (void)
{
use bound_minsym as result for lookup_minimal_symbol et al This patch changes a few minimal symbol lookup functions to return a bound_minimal_symbol rather than a pointer to the minsym. This change helps prepare gdb for computing a minimal symbol's address at the point of use. Note that this changes even those functions that ostensibly search a single objfile. That was necessary because, in fact, those functions can search an objfile and its separate debug objfiles; and it is important for the caller to know in which objfile the minimal symbol was actually found. The bulk of this patch is mechanical. 2014-02-26 Tom Tromey <tromey@redhat.com> * ada-lang.c (ada_update_initial_language): Update. (ada_main_name, ada_has_this_exception_support): Update. * ada-tasks.c (ada_tasks_inferior_data_sniffer): Update. * aix-thread.c (pdc_symbol_addrs, pd_enable): Update. * arm-tdep.c (arm_skip_stub): Update. * auxv.c (ld_so_xfer_auxv): Update. * avr-tdep.c (avr_scan_prologue): Update. * ax-gdb.c (gen_var_ref): Update. * breakpoint.c (struct breakpoint_objfile_data) <overlay_msym, longjmp_msym, terminate_msym, exception_msym>: Change type to bound_minimal_symbol. (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * bsd-uthread.c (bsd_uthread_lookup_address): Update. * c-exp.y (classify_name): Update. * coffread.c (coff_symfile_read): Update. * common/agent.c (agent_look_up_symbols): Update. * d-lang.c (d_main_name): Update. * dbxread.c (find_stab_function_addr, end_psymtab): Update. * dec-thread.c (enable_dec_thread): Update. * dwarf2loc.c (call_site_to_target_addr): Update. * elfread.c (elf_gnu_ifunc_resolve_by_got): Update. * eval.c (evaluate_subexp_standard): Update. * findvar.c (struct minsym_lookup_data) <result>: Change type to bound_minimal_symbol. <objfile>: Remove. (minsym_lookup_iterator_cb, default_read_var_value): Update. * frame.c (inside_main_func): Update. * frv-tdep.c (frv_frame_this_id): Update. * gcore.c (call_target_sbrk): Update. * glibc-tdep.c (glibc_skip_solib_resolver): Update. * gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline): Update. * go-lang.c (go_main_name): Update. * hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code) (hppa_hpux_find_import_stub_for_addr): Update. * hppa-tdep.c (hppa_extract_17, hppa_lookup_stub_minimal_symbol): Update. Change return type. * hppa-tdep.h (hppa_lookup_stub_minimal_symbol): Change return type. * jit.c (jit_breakpoint_re_set_internal): Update. * linux-fork.c (inferior_call_waitpid, checkpoint_command): Update. * linux-nat.c (get_signo): Update. * linux-thread-db.c (inferior_has_bug): Update * m32c-tdep.c (m32c_return_value) (m32c_m16c_address_to_pointer): Update. * m32r-tdep.c (m32r_frame_this_id): Update. * m68hc11-tdep.c (m68hc11_get_register_info): Update. * machoread.c (macho_resolve_oso_sym_with_minsym): Update. * minsyms.c (lookup_minimal_symbol_internal): Rename to lookup_minimal_symbol. Change return type. (lookup_minimal_symbol): Remove. (lookup_bound_minimal_symbol): Update. (lookup_minimal_symbol_text): Change return type. (lookup_minimal_symbol_solib_trampoline): Change return type. * minsyms.h (lookup_minimal_symbol, lookup_minimal_symbol_text) (lookup_minimal_symbol_solib_trampoline): Change return type. * mips-linux-tdep.c (mips_linux_skip_resolver): Update. * objc-lang.c (lookup_objc_class, lookup_child_selector) (value_nsstring, find_imps): Update. * obsd-tdep.c (obsd_skip_solib_resolver): Update. * p-lang.c (pascal_main_name): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * proc-service.c (ps_pglobal_lookup): Update. * ravenscar-thread.c (get_running_thread_msymbol): Change return type. (has_ravenscar_runtime, get_running_thread_id): Update. * remote.c (remote_check_symbols): Update. * sol-thread.c (ps_pglobal_lookup): Update. * sol2-tdep.c (sol2_skip_solib_resolver): Update. * solib-dsbt.c (lm_base): Update. * solib-frv.c (lm_base, frv_relocate_section_addresses): Update. * solib-irix.c (locate_base): Update. * solib-som.c (som_solib_create_inferior_hook) (som_solib_desire_dynamic_linker_symbols, link_map_start): Update. * solib-spu.c (spu_enable_break): Update. * solib-svr4.c (elf_locate_base, enable_break): Update. * spu-tdep.c (spu_get_overlay_table, spu_catch_start) (flush_ea_cache): Update. * stabsread.c (define_symbol): Update. * symfile.c (simple_read_overlay_table): Update. * symtab.c (find_pc_sect_line): Update. * tracepoint.c (scope_info): Update. * tui-disasm.c (tui_get_begin_asm_address): Update. * value.c (value_static_field): Update.
2013-10-15 03:53:29 +02:00
struct bound_minimal_symbol msym;
msym = lookup_minimal_symbol (running_thread_name, NULL, NULL);
use bound_minsym as result for lookup_minimal_symbol et al This patch changes a few minimal symbol lookup functions to return a bound_minimal_symbol rather than a pointer to the minsym. This change helps prepare gdb for computing a minimal symbol's address at the point of use. Note that this changes even those functions that ostensibly search a single objfile. That was necessary because, in fact, those functions can search an objfile and its separate debug objfiles; and it is important for the caller to know in which objfile the minimal symbol was actually found. The bulk of this patch is mechanical. 2014-02-26 Tom Tromey <tromey@redhat.com> * ada-lang.c (ada_update_initial_language): Update. (ada_main_name, ada_has_this_exception_support): Update. * ada-tasks.c (ada_tasks_inferior_data_sniffer): Update. * aix-thread.c (pdc_symbol_addrs, pd_enable): Update. * arm-tdep.c (arm_skip_stub): Update. * auxv.c (ld_so_xfer_auxv): Update. * avr-tdep.c (avr_scan_prologue): Update. * ax-gdb.c (gen_var_ref): Update. * breakpoint.c (struct breakpoint_objfile_data) <overlay_msym, longjmp_msym, terminate_msym, exception_msym>: Change type to bound_minimal_symbol. (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * bsd-uthread.c (bsd_uthread_lookup_address): Update. * c-exp.y (classify_name): Update. * coffread.c (coff_symfile_read): Update. * common/agent.c (agent_look_up_symbols): Update. * d-lang.c (d_main_name): Update. * dbxread.c (find_stab_function_addr, end_psymtab): Update. * dec-thread.c (enable_dec_thread): Update. * dwarf2loc.c (call_site_to_target_addr): Update. * elfread.c (elf_gnu_ifunc_resolve_by_got): Update. * eval.c (evaluate_subexp_standard): Update. * findvar.c (struct minsym_lookup_data) <result>: Change type to bound_minimal_symbol. <objfile>: Remove. (minsym_lookup_iterator_cb, default_read_var_value): Update. * frame.c (inside_main_func): Update. * frv-tdep.c (frv_frame_this_id): Update. * gcore.c (call_target_sbrk): Update. * glibc-tdep.c (glibc_skip_solib_resolver): Update. * gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline): Update. * go-lang.c (go_main_name): Update. * hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code) (hppa_hpux_find_import_stub_for_addr): Update. * hppa-tdep.c (hppa_extract_17, hppa_lookup_stub_minimal_symbol): Update. Change return type. * hppa-tdep.h (hppa_lookup_stub_minimal_symbol): Change return type. * jit.c (jit_breakpoint_re_set_internal): Update. * linux-fork.c (inferior_call_waitpid, checkpoint_command): Update. * linux-nat.c (get_signo): Update. * linux-thread-db.c (inferior_has_bug): Update * m32c-tdep.c (m32c_return_value) (m32c_m16c_address_to_pointer): Update. * m32r-tdep.c (m32r_frame_this_id): Update. * m68hc11-tdep.c (m68hc11_get_register_info): Update. * machoread.c (macho_resolve_oso_sym_with_minsym): Update. * minsyms.c (lookup_minimal_symbol_internal): Rename to lookup_minimal_symbol. Change return type. (lookup_minimal_symbol): Remove. (lookup_bound_minimal_symbol): Update. (lookup_minimal_symbol_text): Change return type. (lookup_minimal_symbol_solib_trampoline): Change return type. * minsyms.h (lookup_minimal_symbol, lookup_minimal_symbol_text) (lookup_minimal_symbol_solib_trampoline): Change return type. * mips-linux-tdep.c (mips_linux_skip_resolver): Update. * objc-lang.c (lookup_objc_class, lookup_child_selector) (value_nsstring, find_imps): Update. * obsd-tdep.c (obsd_skip_solib_resolver): Update. * p-lang.c (pascal_main_name): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * proc-service.c (ps_pglobal_lookup): Update. * ravenscar-thread.c (get_running_thread_msymbol): Change return type. (has_ravenscar_runtime, get_running_thread_id): Update. * remote.c (remote_check_symbols): Update. * sol-thread.c (ps_pglobal_lookup): Update. * sol2-tdep.c (sol2_skip_solib_resolver): Update. * solib-dsbt.c (lm_base): Update. * solib-frv.c (lm_base, frv_relocate_section_addresses): Update. * solib-irix.c (locate_base): Update. * solib-som.c (som_solib_create_inferior_hook) (som_solib_desire_dynamic_linker_symbols, link_map_start): Update. * solib-spu.c (spu_enable_break): Update. * solib-svr4.c (elf_locate_base, enable_break): Update. * spu-tdep.c (spu_get_overlay_table, spu_catch_start) (flush_ea_cache): Update. * stabsread.c (define_symbol): Update. * symfile.c (simple_read_overlay_table): Update. * symtab.c (find_pc_sect_line): Update. * tracepoint.c (scope_info): Update. * tui-disasm.c (tui_get_begin_asm_address): Update. * value.c (value_static_field): Update.
2013-10-15 03:53:29 +02:00
if (!msym.minsym)
/* Older versions of the GNAT runtime were using a different
(less ideal) name for the symbol where the active thread ID
is stored. If we couldn't find the symbol using the latest
name, then try the old one. */
msym = lookup_minimal_symbol ("running_thread", NULL, NULL);
return msym;
}
/* Return True if the Ada Ravenscar run-time can be found in the
application. */
static int
has_ravenscar_runtime (void)
{
use bound_minsym as result for lookup_minimal_symbol et al This patch changes a few minimal symbol lookup functions to return a bound_minimal_symbol rather than a pointer to the minsym. This change helps prepare gdb for computing a minimal symbol's address at the point of use. Note that this changes even those functions that ostensibly search a single objfile. That was necessary because, in fact, those functions can search an objfile and its separate debug objfiles; and it is important for the caller to know in which objfile the minimal symbol was actually found. The bulk of this patch is mechanical. 2014-02-26 Tom Tromey <tromey@redhat.com> * ada-lang.c (ada_update_initial_language): Update. (ada_main_name, ada_has_this_exception_support): Update. * ada-tasks.c (ada_tasks_inferior_data_sniffer): Update. * aix-thread.c (pdc_symbol_addrs, pd_enable): Update. * arm-tdep.c (arm_skip_stub): Update. * auxv.c (ld_so_xfer_auxv): Update. * avr-tdep.c (avr_scan_prologue): Update. * ax-gdb.c (gen_var_ref): Update. * breakpoint.c (struct breakpoint_objfile_data) <overlay_msym, longjmp_msym, terminate_msym, exception_msym>: Change type to bound_minimal_symbol. (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * bsd-uthread.c (bsd_uthread_lookup_address): Update. * c-exp.y (classify_name): Update. * coffread.c (coff_symfile_read): Update. * common/agent.c (agent_look_up_symbols): Update. * d-lang.c (d_main_name): Update. * dbxread.c (find_stab_function_addr, end_psymtab): Update. * dec-thread.c (enable_dec_thread): Update. * dwarf2loc.c (call_site_to_target_addr): Update. * elfread.c (elf_gnu_ifunc_resolve_by_got): Update. * eval.c (evaluate_subexp_standard): Update. * findvar.c (struct minsym_lookup_data) <result>: Change type to bound_minimal_symbol. <objfile>: Remove. (minsym_lookup_iterator_cb, default_read_var_value): Update. * frame.c (inside_main_func): Update. * frv-tdep.c (frv_frame_this_id): Update. * gcore.c (call_target_sbrk): Update. * glibc-tdep.c (glibc_skip_solib_resolver): Update. * gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline): Update. * go-lang.c (go_main_name): Update. * hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code) (hppa_hpux_find_import_stub_for_addr): Update. * hppa-tdep.c (hppa_extract_17, hppa_lookup_stub_minimal_symbol): Update. Change return type. * hppa-tdep.h (hppa_lookup_stub_minimal_symbol): Change return type. * jit.c (jit_breakpoint_re_set_internal): Update. * linux-fork.c (inferior_call_waitpid, checkpoint_command): Update. * linux-nat.c (get_signo): Update. * linux-thread-db.c (inferior_has_bug): Update * m32c-tdep.c (m32c_return_value) (m32c_m16c_address_to_pointer): Update. * m32r-tdep.c (m32r_frame_this_id): Update. * m68hc11-tdep.c (m68hc11_get_register_info): Update. * machoread.c (macho_resolve_oso_sym_with_minsym): Update. * minsyms.c (lookup_minimal_symbol_internal): Rename to lookup_minimal_symbol. Change return type. (lookup_minimal_symbol): Remove. (lookup_bound_minimal_symbol): Update. (lookup_minimal_symbol_text): Change return type. (lookup_minimal_symbol_solib_trampoline): Change return type. * minsyms.h (lookup_minimal_symbol, lookup_minimal_symbol_text) (lookup_minimal_symbol_solib_trampoline): Change return type. * mips-linux-tdep.c (mips_linux_skip_resolver): Update. * objc-lang.c (lookup_objc_class, lookup_child_selector) (value_nsstring, find_imps): Update. * obsd-tdep.c (obsd_skip_solib_resolver): Update. * p-lang.c (pascal_main_name): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * proc-service.c (ps_pglobal_lookup): Update. * ravenscar-thread.c (get_running_thread_msymbol): Change return type. (has_ravenscar_runtime, get_running_thread_id): Update. * remote.c (remote_check_symbols): Update. * sol-thread.c (ps_pglobal_lookup): Update. * sol2-tdep.c (sol2_skip_solib_resolver): Update. * solib-dsbt.c (lm_base): Update. * solib-frv.c (lm_base, frv_relocate_section_addresses): Update. * solib-irix.c (locate_base): Update. * solib-som.c (som_solib_create_inferior_hook) (som_solib_desire_dynamic_linker_symbols, link_map_start): Update. * solib-spu.c (spu_enable_break): Update. * solib-svr4.c (elf_locate_base, enable_break): Update. * spu-tdep.c (spu_get_overlay_table, spu_catch_start) (flush_ea_cache): Update. * stabsread.c (define_symbol): Update. * symfile.c (simple_read_overlay_table): Update. * symtab.c (find_pc_sect_line): Update. * tracepoint.c (scope_info): Update. * tui-disasm.c (tui_get_begin_asm_address): Update. * value.c (value_static_field): Update.
2013-10-15 03:53:29 +02:00
struct bound_minimal_symbol msym_ravenscar_runtime_initializer =
lookup_minimal_symbol (ravenscar_runtime_initializer, NULL, NULL);
use bound_minsym as result for lookup_minimal_symbol et al This patch changes a few minimal symbol lookup functions to return a bound_minimal_symbol rather than a pointer to the minsym. This change helps prepare gdb for computing a minimal symbol's address at the point of use. Note that this changes even those functions that ostensibly search a single objfile. That was necessary because, in fact, those functions can search an objfile and its separate debug objfiles; and it is important for the caller to know in which objfile the minimal symbol was actually found. The bulk of this patch is mechanical. 2014-02-26 Tom Tromey <tromey@redhat.com> * ada-lang.c (ada_update_initial_language): Update. (ada_main_name, ada_has_this_exception_support): Update. * ada-tasks.c (ada_tasks_inferior_data_sniffer): Update. * aix-thread.c (pdc_symbol_addrs, pd_enable): Update. * arm-tdep.c (arm_skip_stub): Update. * auxv.c (ld_so_xfer_auxv): Update. * avr-tdep.c (avr_scan_prologue): Update. * ax-gdb.c (gen_var_ref): Update. * breakpoint.c (struct breakpoint_objfile_data) <overlay_msym, longjmp_msym, terminate_msym, exception_msym>: Change type to bound_minimal_symbol. (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * bsd-uthread.c (bsd_uthread_lookup_address): Update. * c-exp.y (classify_name): Update. * coffread.c (coff_symfile_read): Update. * common/agent.c (agent_look_up_symbols): Update. * d-lang.c (d_main_name): Update. * dbxread.c (find_stab_function_addr, end_psymtab): Update. * dec-thread.c (enable_dec_thread): Update. * dwarf2loc.c (call_site_to_target_addr): Update. * elfread.c (elf_gnu_ifunc_resolve_by_got): Update. * eval.c (evaluate_subexp_standard): Update. * findvar.c (struct minsym_lookup_data) <result>: Change type to bound_minimal_symbol. <objfile>: Remove. (minsym_lookup_iterator_cb, default_read_var_value): Update. * frame.c (inside_main_func): Update. * frv-tdep.c (frv_frame_this_id): Update. * gcore.c (call_target_sbrk): Update. * glibc-tdep.c (glibc_skip_solib_resolver): Update. * gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline): Update. * go-lang.c (go_main_name): Update. * hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code) (hppa_hpux_find_import_stub_for_addr): Update. * hppa-tdep.c (hppa_extract_17, hppa_lookup_stub_minimal_symbol): Update. Change return type. * hppa-tdep.h (hppa_lookup_stub_minimal_symbol): Change return type. * jit.c (jit_breakpoint_re_set_internal): Update. * linux-fork.c (inferior_call_waitpid, checkpoint_command): Update. * linux-nat.c (get_signo): Update. * linux-thread-db.c (inferior_has_bug): Update * m32c-tdep.c (m32c_return_value) (m32c_m16c_address_to_pointer): Update. * m32r-tdep.c (m32r_frame_this_id): Update. * m68hc11-tdep.c (m68hc11_get_register_info): Update. * machoread.c (macho_resolve_oso_sym_with_minsym): Update. * minsyms.c (lookup_minimal_symbol_internal): Rename to lookup_minimal_symbol. Change return type. (lookup_minimal_symbol): Remove. (lookup_bound_minimal_symbol): Update. (lookup_minimal_symbol_text): Change return type. (lookup_minimal_symbol_solib_trampoline): Change return type. * minsyms.h (lookup_minimal_symbol, lookup_minimal_symbol_text) (lookup_minimal_symbol_solib_trampoline): Change return type. * mips-linux-tdep.c (mips_linux_skip_resolver): Update. * objc-lang.c (lookup_objc_class, lookup_child_selector) (value_nsstring, find_imps): Update. * obsd-tdep.c (obsd_skip_solib_resolver): Update. * p-lang.c (pascal_main_name): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * proc-service.c (ps_pglobal_lookup): Update. * ravenscar-thread.c (get_running_thread_msymbol): Change return type. (has_ravenscar_runtime, get_running_thread_id): Update. * remote.c (remote_check_symbols): Update. * sol-thread.c (ps_pglobal_lookup): Update. * sol2-tdep.c (sol2_skip_solib_resolver): Update. * solib-dsbt.c (lm_base): Update. * solib-frv.c (lm_base, frv_relocate_section_addresses): Update. * solib-irix.c (locate_base): Update. * solib-som.c (som_solib_create_inferior_hook) (som_solib_desire_dynamic_linker_symbols, link_map_start): Update. * solib-spu.c (spu_enable_break): Update. * solib-svr4.c (elf_locate_base, enable_break): Update. * spu-tdep.c (spu_get_overlay_table, spu_catch_start) (flush_ea_cache): Update. * stabsread.c (define_symbol): Update. * symfile.c (simple_read_overlay_table): Update. * symtab.c (find_pc_sect_line): Update. * tracepoint.c (scope_info): Update. * tui-disasm.c (tui_get_begin_asm_address): Update. * value.c (value_static_field): Update.
2013-10-15 03:53:29 +02:00
struct bound_minimal_symbol msym_known_tasks =
lookup_minimal_symbol (known_tasks_name, NULL, NULL);
use bound_minsym as result for lookup_minimal_symbol et al This patch changes a few minimal symbol lookup functions to return a bound_minimal_symbol rather than a pointer to the minsym. This change helps prepare gdb for computing a minimal symbol's address at the point of use. Note that this changes even those functions that ostensibly search a single objfile. That was necessary because, in fact, those functions can search an objfile and its separate debug objfiles; and it is important for the caller to know in which objfile the minimal symbol was actually found. The bulk of this patch is mechanical. 2014-02-26 Tom Tromey <tromey@redhat.com> * ada-lang.c (ada_update_initial_language): Update. (ada_main_name, ada_has_this_exception_support): Update. * ada-tasks.c (ada_tasks_inferior_data_sniffer): Update. * aix-thread.c (pdc_symbol_addrs, pd_enable): Update. * arm-tdep.c (arm_skip_stub): Update. * auxv.c (ld_so_xfer_auxv): Update. * avr-tdep.c (avr_scan_prologue): Update. * ax-gdb.c (gen_var_ref): Update. * breakpoint.c (struct breakpoint_objfile_data) <overlay_msym, longjmp_msym, terminate_msym, exception_msym>: Change type to bound_minimal_symbol. (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * bsd-uthread.c (bsd_uthread_lookup_address): Update. * c-exp.y (classify_name): Update. * coffread.c (coff_symfile_read): Update. * common/agent.c (agent_look_up_symbols): Update. * d-lang.c (d_main_name): Update. * dbxread.c (find_stab_function_addr, end_psymtab): Update. * dec-thread.c (enable_dec_thread): Update. * dwarf2loc.c (call_site_to_target_addr): Update. * elfread.c (elf_gnu_ifunc_resolve_by_got): Update. * eval.c (evaluate_subexp_standard): Update. * findvar.c (struct minsym_lookup_data) <result>: Change type to bound_minimal_symbol. <objfile>: Remove. (minsym_lookup_iterator_cb, default_read_var_value): Update. * frame.c (inside_main_func): Update. * frv-tdep.c (frv_frame_this_id): Update. * gcore.c (call_target_sbrk): Update. * glibc-tdep.c (glibc_skip_solib_resolver): Update. * gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline): Update. * go-lang.c (go_main_name): Update. * hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code) (hppa_hpux_find_import_stub_for_addr): Update. * hppa-tdep.c (hppa_extract_17, hppa_lookup_stub_minimal_symbol): Update. Change return type. * hppa-tdep.h (hppa_lookup_stub_minimal_symbol): Change return type. * jit.c (jit_breakpoint_re_set_internal): Update. * linux-fork.c (inferior_call_waitpid, checkpoint_command): Update. * linux-nat.c (get_signo): Update. * linux-thread-db.c (inferior_has_bug): Update * m32c-tdep.c (m32c_return_value) (m32c_m16c_address_to_pointer): Update. * m32r-tdep.c (m32r_frame_this_id): Update. * m68hc11-tdep.c (m68hc11_get_register_info): Update. * machoread.c (macho_resolve_oso_sym_with_minsym): Update. * minsyms.c (lookup_minimal_symbol_internal): Rename to lookup_minimal_symbol. Change return type. (lookup_minimal_symbol): Remove. (lookup_bound_minimal_symbol): Update. (lookup_minimal_symbol_text): Change return type. (lookup_minimal_symbol_solib_trampoline): Change return type. * minsyms.h (lookup_minimal_symbol, lookup_minimal_symbol_text) (lookup_minimal_symbol_solib_trampoline): Change return type. * mips-linux-tdep.c (mips_linux_skip_resolver): Update. * objc-lang.c (lookup_objc_class, lookup_child_selector) (value_nsstring, find_imps): Update. * obsd-tdep.c (obsd_skip_solib_resolver): Update. * p-lang.c (pascal_main_name): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * proc-service.c (ps_pglobal_lookup): Update. * ravenscar-thread.c (get_running_thread_msymbol): Change return type. (has_ravenscar_runtime, get_running_thread_id): Update. * remote.c (remote_check_symbols): Update. * sol-thread.c (ps_pglobal_lookup): Update. * sol2-tdep.c (sol2_skip_solib_resolver): Update. * solib-dsbt.c (lm_base): Update. * solib-frv.c (lm_base, frv_relocate_section_addresses): Update. * solib-irix.c (locate_base): Update. * solib-som.c (som_solib_create_inferior_hook) (som_solib_desire_dynamic_linker_symbols, link_map_start): Update. * solib-spu.c (spu_enable_break): Update. * solib-svr4.c (elf_locate_base, enable_break): Update. * spu-tdep.c (spu_get_overlay_table, spu_catch_start) (flush_ea_cache): Update. * stabsread.c (define_symbol): Update. * symfile.c (simple_read_overlay_table): Update. * symtab.c (find_pc_sect_line): Update. * tracepoint.c (scope_info): Update. * tui-disasm.c (tui_get_begin_asm_address): Update. * value.c (value_static_field): Update.
2013-10-15 03:53:29 +02:00
struct bound_minimal_symbol msym_first_task =
lookup_minimal_symbol (first_task_name, NULL, NULL);
use bound_minsym as result for lookup_minimal_symbol et al This patch changes a few minimal symbol lookup functions to return a bound_minimal_symbol rather than a pointer to the minsym. This change helps prepare gdb for computing a minimal symbol's address at the point of use. Note that this changes even those functions that ostensibly search a single objfile. That was necessary because, in fact, those functions can search an objfile and its separate debug objfiles; and it is important for the caller to know in which objfile the minimal symbol was actually found. The bulk of this patch is mechanical. 2014-02-26 Tom Tromey <tromey@redhat.com> * ada-lang.c (ada_update_initial_language): Update. (ada_main_name, ada_has_this_exception_support): Update. * ada-tasks.c (ada_tasks_inferior_data_sniffer): Update. * aix-thread.c (pdc_symbol_addrs, pd_enable): Update. * arm-tdep.c (arm_skip_stub): Update. * auxv.c (ld_so_xfer_auxv): Update. * avr-tdep.c (avr_scan_prologue): Update. * ax-gdb.c (gen_var_ref): Update. * breakpoint.c (struct breakpoint_objfile_data) <overlay_msym, longjmp_msym, terminate_msym, exception_msym>: Change type to bound_minimal_symbol. (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * bsd-uthread.c (bsd_uthread_lookup_address): Update. * c-exp.y (classify_name): Update. * coffread.c (coff_symfile_read): Update. * common/agent.c (agent_look_up_symbols): Update. * d-lang.c (d_main_name): Update. * dbxread.c (find_stab_function_addr, end_psymtab): Update. * dec-thread.c (enable_dec_thread): Update. * dwarf2loc.c (call_site_to_target_addr): Update. * elfread.c (elf_gnu_ifunc_resolve_by_got): Update. * eval.c (evaluate_subexp_standard): Update. * findvar.c (struct minsym_lookup_data) <result>: Change type to bound_minimal_symbol. <objfile>: Remove. (minsym_lookup_iterator_cb, default_read_var_value): Update. * frame.c (inside_main_func): Update. * frv-tdep.c (frv_frame_this_id): Update. * gcore.c (call_target_sbrk): Update. * glibc-tdep.c (glibc_skip_solib_resolver): Update. * gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline): Update. * go-lang.c (go_main_name): Update. * hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code) (hppa_hpux_find_import_stub_for_addr): Update. * hppa-tdep.c (hppa_extract_17, hppa_lookup_stub_minimal_symbol): Update. Change return type. * hppa-tdep.h (hppa_lookup_stub_minimal_symbol): Change return type. * jit.c (jit_breakpoint_re_set_internal): Update. * linux-fork.c (inferior_call_waitpid, checkpoint_command): Update. * linux-nat.c (get_signo): Update. * linux-thread-db.c (inferior_has_bug): Update * m32c-tdep.c (m32c_return_value) (m32c_m16c_address_to_pointer): Update. * m32r-tdep.c (m32r_frame_this_id): Update. * m68hc11-tdep.c (m68hc11_get_register_info): Update. * machoread.c (macho_resolve_oso_sym_with_minsym): Update. * minsyms.c (lookup_minimal_symbol_internal): Rename to lookup_minimal_symbol. Change return type. (lookup_minimal_symbol): Remove. (lookup_bound_minimal_symbol): Update. (lookup_minimal_symbol_text): Change return type. (lookup_minimal_symbol_solib_trampoline): Change return type. * minsyms.h (lookup_minimal_symbol, lookup_minimal_symbol_text) (lookup_minimal_symbol_solib_trampoline): Change return type. * mips-linux-tdep.c (mips_linux_skip_resolver): Update. * objc-lang.c (lookup_objc_class, lookup_child_selector) (value_nsstring, find_imps): Update. * obsd-tdep.c (obsd_skip_solib_resolver): Update. * p-lang.c (pascal_main_name): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * proc-service.c (ps_pglobal_lookup): Update. * ravenscar-thread.c (get_running_thread_msymbol): Change return type. (has_ravenscar_runtime, get_running_thread_id): Update. * remote.c (remote_check_symbols): Update. * sol-thread.c (ps_pglobal_lookup): Update. * sol2-tdep.c (sol2_skip_solib_resolver): Update. * solib-dsbt.c (lm_base): Update. * solib-frv.c (lm_base, frv_relocate_section_addresses): Update. * solib-irix.c (locate_base): Update. * solib-som.c (som_solib_create_inferior_hook) (som_solib_desire_dynamic_linker_symbols, link_map_start): Update. * solib-spu.c (spu_enable_break): Update. * solib-svr4.c (elf_locate_base, enable_break): Update. * spu-tdep.c (spu_get_overlay_table, spu_catch_start) (flush_ea_cache): Update. * stabsread.c (define_symbol): Update. * symfile.c (simple_read_overlay_table): Update. * symtab.c (find_pc_sect_line): Update. * tracepoint.c (scope_info): Update. * tui-disasm.c (tui_get_begin_asm_address): Update. * value.c (value_static_field): Update.
2013-10-15 03:53:29 +02:00
struct bound_minimal_symbol msym_running_thread
= get_running_thread_msymbol ();
use bound_minsym as result for lookup_minimal_symbol et al This patch changes a few minimal symbol lookup functions to return a bound_minimal_symbol rather than a pointer to the minsym. This change helps prepare gdb for computing a minimal symbol's address at the point of use. Note that this changes even those functions that ostensibly search a single objfile. That was necessary because, in fact, those functions can search an objfile and its separate debug objfiles; and it is important for the caller to know in which objfile the minimal symbol was actually found. The bulk of this patch is mechanical. 2014-02-26 Tom Tromey <tromey@redhat.com> * ada-lang.c (ada_update_initial_language): Update. (ada_main_name, ada_has_this_exception_support): Update. * ada-tasks.c (ada_tasks_inferior_data_sniffer): Update. * aix-thread.c (pdc_symbol_addrs, pd_enable): Update. * arm-tdep.c (arm_skip_stub): Update. * auxv.c (ld_so_xfer_auxv): Update. * avr-tdep.c (avr_scan_prologue): Update. * ax-gdb.c (gen_var_ref): Update. * breakpoint.c (struct breakpoint_objfile_data) <overlay_msym, longjmp_msym, terminate_msym, exception_msym>: Change type to bound_minimal_symbol. (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * bsd-uthread.c (bsd_uthread_lookup_address): Update. * c-exp.y (classify_name): Update. * coffread.c (coff_symfile_read): Update. * common/agent.c (agent_look_up_symbols): Update. * d-lang.c (d_main_name): Update. * dbxread.c (find_stab_function_addr, end_psymtab): Update. * dec-thread.c (enable_dec_thread): Update. * dwarf2loc.c (call_site_to_target_addr): Update. * elfread.c (elf_gnu_ifunc_resolve_by_got): Update. * eval.c (evaluate_subexp_standard): Update. * findvar.c (struct minsym_lookup_data) <result>: Change type to bound_minimal_symbol. <objfile>: Remove. (minsym_lookup_iterator_cb, default_read_var_value): Update. * frame.c (inside_main_func): Update. * frv-tdep.c (frv_frame_this_id): Update. * gcore.c (call_target_sbrk): Update. * glibc-tdep.c (glibc_skip_solib_resolver): Update. * gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline): Update. * go-lang.c (go_main_name): Update. * hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code) (hppa_hpux_find_import_stub_for_addr): Update. * hppa-tdep.c (hppa_extract_17, hppa_lookup_stub_minimal_symbol): Update. Change return type. * hppa-tdep.h (hppa_lookup_stub_minimal_symbol): Change return type. * jit.c (jit_breakpoint_re_set_internal): Update. * linux-fork.c (inferior_call_waitpid, checkpoint_command): Update. * linux-nat.c (get_signo): Update. * linux-thread-db.c (inferior_has_bug): Update * m32c-tdep.c (m32c_return_value) (m32c_m16c_address_to_pointer): Update. * m32r-tdep.c (m32r_frame_this_id): Update. * m68hc11-tdep.c (m68hc11_get_register_info): Update. * machoread.c (macho_resolve_oso_sym_with_minsym): Update. * minsyms.c (lookup_minimal_symbol_internal): Rename to lookup_minimal_symbol. Change return type. (lookup_minimal_symbol): Remove. (lookup_bound_minimal_symbol): Update. (lookup_minimal_symbol_text): Change return type. (lookup_minimal_symbol_solib_trampoline): Change return type. * minsyms.h (lookup_minimal_symbol, lookup_minimal_symbol_text) (lookup_minimal_symbol_solib_trampoline): Change return type. * mips-linux-tdep.c (mips_linux_skip_resolver): Update. * objc-lang.c (lookup_objc_class, lookup_child_selector) (value_nsstring, find_imps): Update. * obsd-tdep.c (obsd_skip_solib_resolver): Update. * p-lang.c (pascal_main_name): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * proc-service.c (ps_pglobal_lookup): Update. * ravenscar-thread.c (get_running_thread_msymbol): Change return type. (has_ravenscar_runtime, get_running_thread_id): Update. * remote.c (remote_check_symbols): Update. * sol-thread.c (ps_pglobal_lookup): Update. * sol2-tdep.c (sol2_skip_solib_resolver): Update. * solib-dsbt.c (lm_base): Update. * solib-frv.c (lm_base, frv_relocate_section_addresses): Update. * solib-irix.c (locate_base): Update. * solib-som.c (som_solib_create_inferior_hook) (som_solib_desire_dynamic_linker_symbols, link_map_start): Update. * solib-spu.c (spu_enable_break): Update. * solib-svr4.c (elf_locate_base, enable_break): Update. * spu-tdep.c (spu_get_overlay_table, spu_catch_start) (flush_ea_cache): Update. * stabsread.c (define_symbol): Update. * symfile.c (simple_read_overlay_table): Update. * symtab.c (find_pc_sect_line): Update. * tracepoint.c (scope_info): Update. * tui-disasm.c (tui_get_begin_asm_address): Update. * value.c (value_static_field): Update.
2013-10-15 03:53:29 +02:00
return (msym_ravenscar_runtime_initializer.minsym
&& (msym_known_tasks.minsym || msym_first_task.minsym)
&& msym_running_thread.minsym);
}
/* Return True if the Ada Ravenscar run-time can be found in the
application, and if it has been initialized on target. */
static int
ravenscar_runtime_initialized (void)
{
return (!(ptid_equal (ravenscar_running_thread (), null_ptid)));
}
/* Return the ID of the thread that is currently running.
Return 0 if the ID could not be determined. */
static CORE_ADDR
get_running_thread_id (void)
{
use bound_minsym as result for lookup_minimal_symbol et al This patch changes a few minimal symbol lookup functions to return a bound_minimal_symbol rather than a pointer to the minsym. This change helps prepare gdb for computing a minimal symbol's address at the point of use. Note that this changes even those functions that ostensibly search a single objfile. That was necessary because, in fact, those functions can search an objfile and its separate debug objfiles; and it is important for the caller to know in which objfile the minimal symbol was actually found. The bulk of this patch is mechanical. 2014-02-26 Tom Tromey <tromey@redhat.com> * ada-lang.c (ada_update_initial_language): Update. (ada_main_name, ada_has_this_exception_support): Update. * ada-tasks.c (ada_tasks_inferior_data_sniffer): Update. * aix-thread.c (pdc_symbol_addrs, pd_enable): Update. * arm-tdep.c (arm_skip_stub): Update. * auxv.c (ld_so_xfer_auxv): Update. * avr-tdep.c (avr_scan_prologue): Update. * ax-gdb.c (gen_var_ref): Update. * breakpoint.c (struct breakpoint_objfile_data) <overlay_msym, longjmp_msym, terminate_msym, exception_msym>: Change type to bound_minimal_symbol. (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * bsd-uthread.c (bsd_uthread_lookup_address): Update. * c-exp.y (classify_name): Update. * coffread.c (coff_symfile_read): Update. * common/agent.c (agent_look_up_symbols): Update. * d-lang.c (d_main_name): Update. * dbxread.c (find_stab_function_addr, end_psymtab): Update. * dec-thread.c (enable_dec_thread): Update. * dwarf2loc.c (call_site_to_target_addr): Update. * elfread.c (elf_gnu_ifunc_resolve_by_got): Update. * eval.c (evaluate_subexp_standard): Update. * findvar.c (struct minsym_lookup_data) <result>: Change type to bound_minimal_symbol. <objfile>: Remove. (minsym_lookup_iterator_cb, default_read_var_value): Update. * frame.c (inside_main_func): Update. * frv-tdep.c (frv_frame_this_id): Update. * gcore.c (call_target_sbrk): Update. * glibc-tdep.c (glibc_skip_solib_resolver): Update. * gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline): Update. * go-lang.c (go_main_name): Update. * hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code) (hppa_hpux_find_import_stub_for_addr): Update. * hppa-tdep.c (hppa_extract_17, hppa_lookup_stub_minimal_symbol): Update. Change return type. * hppa-tdep.h (hppa_lookup_stub_minimal_symbol): Change return type. * jit.c (jit_breakpoint_re_set_internal): Update. * linux-fork.c (inferior_call_waitpid, checkpoint_command): Update. * linux-nat.c (get_signo): Update. * linux-thread-db.c (inferior_has_bug): Update * m32c-tdep.c (m32c_return_value) (m32c_m16c_address_to_pointer): Update. * m32r-tdep.c (m32r_frame_this_id): Update. * m68hc11-tdep.c (m68hc11_get_register_info): Update. * machoread.c (macho_resolve_oso_sym_with_minsym): Update. * minsyms.c (lookup_minimal_symbol_internal): Rename to lookup_minimal_symbol. Change return type. (lookup_minimal_symbol): Remove. (lookup_bound_minimal_symbol): Update. (lookup_minimal_symbol_text): Change return type. (lookup_minimal_symbol_solib_trampoline): Change return type. * minsyms.h (lookup_minimal_symbol, lookup_minimal_symbol_text) (lookup_minimal_symbol_solib_trampoline): Change return type. * mips-linux-tdep.c (mips_linux_skip_resolver): Update. * objc-lang.c (lookup_objc_class, lookup_child_selector) (value_nsstring, find_imps): Update. * obsd-tdep.c (obsd_skip_solib_resolver): Update. * p-lang.c (pascal_main_name): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * proc-service.c (ps_pglobal_lookup): Update. * ravenscar-thread.c (get_running_thread_msymbol): Change return type. (has_ravenscar_runtime, get_running_thread_id): Update. * remote.c (remote_check_symbols): Update. * sol-thread.c (ps_pglobal_lookup): Update. * sol2-tdep.c (sol2_skip_solib_resolver): Update. * solib-dsbt.c (lm_base): Update. * solib-frv.c (lm_base, frv_relocate_section_addresses): Update. * solib-irix.c (locate_base): Update. * solib-som.c (som_solib_create_inferior_hook) (som_solib_desire_dynamic_linker_symbols, link_map_start): Update. * solib-spu.c (spu_enable_break): Update. * solib-svr4.c (elf_locate_base, enable_break): Update. * spu-tdep.c (spu_get_overlay_table, spu_catch_start) (flush_ea_cache): Update. * stabsread.c (define_symbol): Update. * symfile.c (simple_read_overlay_table): Update. * symtab.c (find_pc_sect_line): Update. * tracepoint.c (scope_info): Update. * tui-disasm.c (tui_get_begin_asm_address): Update. * value.c (value_static_field): Update.
2013-10-15 03:53:29 +02:00
struct bound_minimal_symbol object_msym = get_running_thread_msymbol ();
int object_size;
int buf_size;
-Wpointer-sign: char -> gdb_byte. -Wpointer-sign catches all these cases across the codebase that should be using gdb_byte for raw target bytes. I think these are all obvious, hence I've collapsed into a single patch. gdb/ 2013-04-19 Pedro Alves <palves@redhat.com> * aarch64-tdep.c (aarch64_default_breakpoint): Change type to gdb_byte[]. (aarch64_breakpoint_from_pc): Change return type to gdb_byte *. * ada-lang.c (ada_value_assign): Use gdb_byte. * alphanbsd-tdep.c (sigtramp_retcode): Change type to gdb_byte[]. (alphanbsd_sigtramp_offset): Use gdb_byte. * arm-linux-tdep.c (arm_linux_arm_le_breakpoint) (arm_linux_arm_be_breakpoint, eabi_linux_arm_le_breakpoint) (eabi_linux_arm_be_breakpoint, arm_linux_thumb_be_breakpoint) (arm_linux_thumb_le_breakpoint, arm_linux_thumb2_be_breakpoint) (arm_linux_thumb2_le_breakpoint): Change type to gdb_byte[]. * arm-tdep.c (arm_stub_unwind_sniffer) (arm_displaced_init_closure): Use gdb_byte. (arm_default_arm_le_breakpoint, arm_default_arm_be_breakpoint) (arm_default_thumb_le_breakpoint) (arm_default_thumb_be_breakpoint): Change type to gdb_byte[]. * arm-tdep.h (struct gdbarch_tdep) <arm_breakpoint, thumb_breakpoint, thumb2_breakpoint>: Change type to gdb_byte *. * arm-wince-tdep.c (arm_wince_le_breakpoint) (arm_wince_thumb_le_breakpoint): Change type to gdb_byte[]. * armnbsd-tdep.c (arm_nbsd_arm_le_breakpoint) (arm_nbsd_arm_be_breakpoint, arm_nbsd_thumb_le_breakpoint) (arm_nbsd_thumb_be_breakpoint): Change type to gdb_byte[]. * armobsd-tdep.c (arm_obsd_thumb_le_breakpoint) (arm_obsd_thumb_be_breakpoint): Change type to gdb_byte[]. * cris-tdep.c (push_stack_item, cris_push_dummy_call) (cris_store_return_value, cris_extract_return_value): Use gdb_byte. (constraint): Change type of parameter to char * from signed char*. Use gdb_byte. * dwarf2loc.c (read_pieced_value, write_pieced_value): Change type of local buffer to gdb_byte *. * dwarf2read.c (read_index_from_section): Use gdb_byte. (create_dwp_hash_table): Change type of locals to gdb_byte *. (add_address_entry): Change type of local buffer to gdb_byte[]. * frv-tdep.c (frv_adjust_breakpoint_address, find_func_descr) (frv_push_dummy_call): Use gdb_byte. * hppa-hpux-tdep.c (hppa_hpux_push_dummy_code) (hppa_hpux_supply_ss_fpblock, hppa_hpux_supply_ss_wide) (hppa_hpux_supply_save_state): Use gdb_byte. * hppa-tdep.c (hppa32_push_dummy_call) (hppa64_convert_code_addr_to_fptr): Use gdb_byte. * ia64-tdep.c (extract_bit_field, replace_bit_field) (slotN_contents, replace_slotN_contents): Change type of parameter to gdb_byte *. (fetch_instruction, ia64_pseudo_register_write) (ia64_register_to_value, ia64_value_to_register) (ia64_extract_return_value, ia64_store_return_value) (ia64_push_dummy_call): Use gdb_byte. * m32c-tdep.c (m32c_return_value): Remove cast. * m68hc11-tdep.c (m68hc11_pseudo_register_write) (m68hc11_push_dummy_call, m68hc11_store_return_value): Use gdb_byte. * mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Use gdb_byte. * mn10300-tdep.c (mn10300_store_return_value) (mn10300_breakpoint_from_pc, mn10300_push_dummy_call): Use gdb_byte. * moxie-tdep.c (moxie_process_readu): Use gdb_byte. (moxie_process_record): Remove casts. * ppc-ravenscar-thread.c (supply_register_at_address) (ppc_ravenscar_generic_store_registers): Use gdb_byte. * ravenscar-thread.c (get_running_thread_id): Use gdb_byte. * remote-m32r-sdi.c (m32r_fetch_register): Use gdb_byte. * remote-mips.c (mips_xfer_memory): Use gdb_byte. * remote.c (compare_sections_command): Use gdb_byte. * score-tdep.c (score7_free_memblock): Change type of parameter to gdb_byte *. * sh-tdep.c (sh_justify_value_in_reg): Change return type to gdb_byte *. Use gdb_byte. (sh_push_dummy_call_fpu): Use gdb_byte. (sh_extract_return_value_nofpu, sh_extract_return_value_fpu) (sh_store_return_value_nofpu, sh_store_return_value_fpu) (sh_register_convert_to_virtual, sh_register_convert_to_raw): Change parameter type to 'gdb_byte *'. Use gdb_byte. (sh_pseudo_register_read, sh_pseudo_register_write): Use gdb_byte. * sh64-tdep.c (sh64_push_dummy_call): Use gdb_byte. (sh64_store_return_value, sh64_register_convert_to_virtual): Change parameter type to 'gdb_byte *'. Use gdb_byte. (sh64_pseudo_register_write): Use gdb_byte. * solib-darwin.c (darwin_current_sos): Add casts to 'gdb_byte *'. * solib-irix.c (fetch_lm_info): Likewise. Use gdb_byte for byte buffer. (irix_current_sos): Use gdb_byte. * solib-som.c (som_current_sos): Use gdb_byte. * sparc-ravenscar-thread.c (supply_register_at_address) (sparc_ravenscar_generic_store_registers): Use gdb_byte. * spu-multiarch.c (spu_xfer_partial): Add cast to 'char *'. * spu-tdep.c (spu_get_overlay_table): Use gdb_byte. * tic6x-tdep.c (tic6x_breakpoint_from_pc): Change return type to 'gdb_byte *'. * tic6x-tdep.h (struct gdbarch_tdep) <breakpoint>: Change type to 'gdb_byte *'. * tracepoint.c (tfile_fetch_registers): Use gdb_byte. * xstormy16-tdep.c (xstormy16_extract_return_value) (xstormy16_store_return_value): Change parameter type to 'gdb_byte *'. Adjust. (xstormy16_push_dummy_call): Use gdb_byte. * xtensa-tdep.c (xtensa_scan_prologue, call0_ret) (call0_analyze_prologue, execute_code): Use gdb_byte.
2013-04-19 17:09:46 +02:00
gdb_byte *buf;
CORE_ADDR object_addr;
struct type *builtin_type_void_data_ptr =
builtin_type (target_gdbarch ())->builtin_data_ptr;
use bound_minsym as result for lookup_minimal_symbol et al This patch changes a few minimal symbol lookup functions to return a bound_minimal_symbol rather than a pointer to the minsym. This change helps prepare gdb for computing a minimal symbol's address at the point of use. Note that this changes even those functions that ostensibly search a single objfile. That was necessary because, in fact, those functions can search an objfile and its separate debug objfiles; and it is important for the caller to know in which objfile the minimal symbol was actually found. The bulk of this patch is mechanical. 2014-02-26 Tom Tromey <tromey@redhat.com> * ada-lang.c (ada_update_initial_language): Update. (ada_main_name, ada_has_this_exception_support): Update. * ada-tasks.c (ada_tasks_inferior_data_sniffer): Update. * aix-thread.c (pdc_symbol_addrs, pd_enable): Update. * arm-tdep.c (arm_skip_stub): Update. * auxv.c (ld_so_xfer_auxv): Update. * avr-tdep.c (avr_scan_prologue): Update. * ax-gdb.c (gen_var_ref): Update. * breakpoint.c (struct breakpoint_objfile_data) <overlay_msym, longjmp_msym, terminate_msym, exception_msym>: Change type to bound_minimal_symbol. (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * bsd-uthread.c (bsd_uthread_lookup_address): Update. * c-exp.y (classify_name): Update. * coffread.c (coff_symfile_read): Update. * common/agent.c (agent_look_up_symbols): Update. * d-lang.c (d_main_name): Update. * dbxread.c (find_stab_function_addr, end_psymtab): Update. * dec-thread.c (enable_dec_thread): Update. * dwarf2loc.c (call_site_to_target_addr): Update. * elfread.c (elf_gnu_ifunc_resolve_by_got): Update. * eval.c (evaluate_subexp_standard): Update. * findvar.c (struct minsym_lookup_data) <result>: Change type to bound_minimal_symbol. <objfile>: Remove. (minsym_lookup_iterator_cb, default_read_var_value): Update. * frame.c (inside_main_func): Update. * frv-tdep.c (frv_frame_this_id): Update. * gcore.c (call_target_sbrk): Update. * glibc-tdep.c (glibc_skip_solib_resolver): Update. * gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline): Update. * go-lang.c (go_main_name): Update. * hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code) (hppa_hpux_find_import_stub_for_addr): Update. * hppa-tdep.c (hppa_extract_17, hppa_lookup_stub_minimal_symbol): Update. Change return type. * hppa-tdep.h (hppa_lookup_stub_minimal_symbol): Change return type. * jit.c (jit_breakpoint_re_set_internal): Update. * linux-fork.c (inferior_call_waitpid, checkpoint_command): Update. * linux-nat.c (get_signo): Update. * linux-thread-db.c (inferior_has_bug): Update * m32c-tdep.c (m32c_return_value) (m32c_m16c_address_to_pointer): Update. * m32r-tdep.c (m32r_frame_this_id): Update. * m68hc11-tdep.c (m68hc11_get_register_info): Update. * machoread.c (macho_resolve_oso_sym_with_minsym): Update. * minsyms.c (lookup_minimal_symbol_internal): Rename to lookup_minimal_symbol. Change return type. (lookup_minimal_symbol): Remove. (lookup_bound_minimal_symbol): Update. (lookup_minimal_symbol_text): Change return type. (lookup_minimal_symbol_solib_trampoline): Change return type. * minsyms.h (lookup_minimal_symbol, lookup_minimal_symbol_text) (lookup_minimal_symbol_solib_trampoline): Change return type. * mips-linux-tdep.c (mips_linux_skip_resolver): Update. * objc-lang.c (lookup_objc_class, lookup_child_selector) (value_nsstring, find_imps): Update. * obsd-tdep.c (obsd_skip_solib_resolver): Update. * p-lang.c (pascal_main_name): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * proc-service.c (ps_pglobal_lookup): Update. * ravenscar-thread.c (get_running_thread_msymbol): Change return type. (has_ravenscar_runtime, get_running_thread_id): Update. * remote.c (remote_check_symbols): Update. * sol-thread.c (ps_pglobal_lookup): Update. * sol2-tdep.c (sol2_skip_solib_resolver): Update. * solib-dsbt.c (lm_base): Update. * solib-frv.c (lm_base, frv_relocate_section_addresses): Update. * solib-irix.c (locate_base): Update. * solib-som.c (som_solib_create_inferior_hook) (som_solib_desire_dynamic_linker_symbols, link_map_start): Update. * solib-spu.c (spu_enable_break): Update. * solib-svr4.c (elf_locate_base, enable_break): Update. * spu-tdep.c (spu_get_overlay_table, spu_catch_start) (flush_ea_cache): Update. * stabsread.c (define_symbol): Update. * symfile.c (simple_read_overlay_table): Update. * symtab.c (find_pc_sect_line): Update. * tracepoint.c (scope_info): Update. * tui-disasm.c (tui_get_begin_asm_address): Update. * value.c (value_static_field): Update.
2013-10-15 03:53:29 +02:00
if (!object_msym.minsym)
return 0;
start change to progspace independence This patch starts changing minimal symbols to be independent of the program space. Specifically, it adds a new objfile parameter to MSYMBOL_VALUE_ADDRESS and changes all the code to use it. This is needed so we can change gdb to apply the section offset when a minsym's address is computed, as opposed to baking the offsets into the symbol itself. A few spots still need the unrelocated address. For these, we introduce MSYMBOL_VALUE_RAW_ADDRESS. As a convenience, we also add the new macro BMSYMBOL_VALUE_ADDRESS, which computes the address of a bound minimal symbol. This just does the obvious thing with the fields. Note that this change does not actually enable program space independence. That requires more changes to gdb. However, to ensure that these changes compile properly, this patch does add the needed section lookup code to MSYMBOL_VALUE_ADDRESS -- it just ensures it has no effect at runtime by multiplying the offset by 0. 2014-02-26 Tom Tromey <tromey@redhat.com> * ada-lang.c (ada_main_name): Update. (ada_add_standard_exceptions): Update. * ada-tasks.c (ada_tasks_inferior_data_sniffer): Update. * aix-thread.c (pdc_symbol_addrs, pd_enable): Update. * arm-tdep.c (skip_prologue_function, arm_skip_stub): Update. * auxv.c (ld_so_xfer_auxv): Update. * avr-tdep.c (avr_scan_prologue): Update. * ax-gdb.c (gen_var_ref): Update. * blockframe.c (get_pc_function_start) (find_pc_partial_function_gnu_ifunc): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * bsd-uthread.c (bsd_uthread_lookup_address): Update. * c-valprint.c (c_val_print): Update. * coff-pe-read.c (add_pe_forwarded_sym): Update. * common/agent.c (agent_look_up_symbols): Update. * dbxread.c (find_stab_function_addr, end_psymtab): Update. * dwarf2loc.c (call_site_to_target_addr): Update. * dwarf2read.c (dw2_find_pc_sect_symtab): Update. * elfread.c (elf_gnu_ifunc_record_cache) (elf_gnu_ifunc_resolve_by_got): Update. * findvar.c (default_read_var_value): Update. * frame.c (inside_main_func): Update. * frv-tdep.c (frv_frame_this_id): Update. * glibc-tdep.c (glibc_skip_solib_resolver): Update. * gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline): Update. * hppa-hpux-tdep.c (hppa64_hpux_search_dummy_call_sequence) (hppa_hpux_find_dummy_bpaddr): Update. * hppa-tdep.c (hppa_symbol_address): Update. * infcmd.c (until_next_command): Update. * jit.c (jit_read_descriptor, jit_breakpoint_re_set_internal): Update. * linespec.c (minsym_found, add_minsym): Update. * linux-nat.c (get_signo): Update. * linux-thread-db.c (inferior_has_bug): Update. * m32c-tdep.c (m32c_return_value) (m32c_m16c_address_to_pointer): Update. * m32r-tdep.c (m32r_frame_this_id): Update. * m68hc11-tdep.c (m68hc11_get_register_info): Update. * machoread.c (macho_resolve_oso_sym_with_minsym): Update. * maint.c (maintenance_translate_address): Update. * minsyms.c (lookup_minimal_symbol_by_pc_name): Update. (frob_address): New function. (lookup_minimal_symbol_by_pc_section_1): Use raw addresses, frob_address. Rename parameter to "pc_in". (compare_minimal_symbols, compact_minimal_symbols): Use raw addresses. (find_solib_trampoline_target, minimal_symbol_upper_bound): Update. * mips-linux-tdep.c (mips_linux_skip_resolver): Update. * mips-tdep.c (mips_skip_pic_trampoline_code): Update. * objc-lang.c (find_objc_msgsend): Update. * objfiles.c (objfile_relocate1): Update. * obsd-tdep.c (obsd_skip_solib_resolver): Update. * p-valprint.c (pascal_val_print): Update. * parse.c (write_exp_msymbol): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_lookup) (ppc_elfv2_skip_entrypoint): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * printcmd.c (build_address_symbolic, msym_info) (address_info): Update. * proc-service.c (ps_pglobal_lookup): Update. * psymtab.c (find_pc_sect_psymtab_closer) (find_pc_sect_psymtab, find_pc_sect_symtab_from_partial): Change msymbol parameter to bound_minimal_symbol. * ravenscar-thread.c (get_running_thread_id): Update. * remote.c (remote_check_symbols): Update. * sh64-tdep.c (sh64_elf_make_msymbol_special): Use raw address. * sol2-tdep.c (sol2_skip_solib_resolver): Update. * solib-dsbt.c (lm_base): Update. * solib-frv.c (lm_base, main_got): Update. * solib-irix.c (locate_base): Update. * solib-som.c (som_solib_create_inferior_hook) (link_map_start): Update. * solib-spu.c (spu_enable_break, ocl_enable_break): Update. * solib-svr4.c (elf_locate_base, enable_break): Update. * spu-tdep.c (spu_get_overlay_table, spu_catch_start) (flush_ea_cache): Update. * stabsread.c (define_symbol, scan_file_globals): Update. * stack.c (find_frame_funname): Update. * symfile-debug.c (debug_qf_expand_symtabs_matching) (debug_qf_find_pc_sect_symtab): Update. * symfile.c (simple_read_overlay_table) (simple_overlay_update): Update. * symfile.h (struct quick_symbol_functions) <find_pc_sect_symtab>: Change type of msymbol to bound_minimal_symbol. * symmisc.c (dump_msymbols): Update. * symtab.c (find_pc_sect_symtab_via_partial) (find_pc_sect_psymtab, find_pc_sect_line, skip_prologue_sal) (search_symbols, print_msymbol_info): Update. * symtab.h (MSYMBOL_VALUE_RAW_ADDRESS): New macro. (MSYMBOL_VALUE_ADDRESS): Redefine. (BMSYMBOL_VALUE_ADDRESS): New macro. * tracepoint.c (scope_info): Update. * tui/tui-disasm.c (tui_find_disassembly_address) (tui_get_begin_asm_address): Update. * valops.c (find_function_in_inferior): Update. * value.c (value_static_field, value_fn_field): Update.
2013-08-15 16:46:35 +02:00
object_addr = BMSYMBOL_VALUE_ADDRESS (object_msym);
object_size = TYPE_LENGTH (builtin_type_void_data_ptr);
buf_size = object_size;
Add casts to memory allocation related calls Most allocation functions (if not all) return a void* pointing to the allocated memory. In C++, we need to add an explicit cast when assigning the result to a pointer to another type (which is the case more often than not). The content of this patch is taken from Pedro's branch, from commit "(mostly) auto-generated patch to insert casts needed for C++". I validated that the changes make sense and manually reflowed the code to make it respect the coding style. I also found multiple places where I could use XNEW/XNEWVEC/XRESIZEVEC/etc. Thanks a lot to whoever did that automated script to insert casts, doing it completely by hand would have taken a ridiculous amount of time. Only files built on x86 with --enable-targets=all are modified. This means that all other -nat.c files are untouched and will have to be dealt with later by using appropiate compilers. Or maybe we can try to build them with a regular g++ just to know where to add casts, I don't know. I built-tested this with --enable-targets=all and reg-tested. Here's the changelog entry, which was not too bad to make despite the size, thanks to David Malcom's script. I fixed some bits by hand, but there might be some wrong parts left (hopefully not). gdb/ChangeLog: * aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Add cast to allocation result assignment. * ada-exp.y (write_object_renaming): Likewise. (write_ambiguous_var): Likewise. (ada_nget_field_index): Likewise. (write_var_or_type): Likewise. * ada-lang.c (ada_decode_symbol): Likewise. (ada_value_assign): Likewise. (value_pointer): Likewise. (cache_symbol): Likewise. (add_nonlocal_symbols): Likewise. (ada_name_for_lookup): Likewise. (symbol_completion_add): Likewise. (ada_to_fixed_type_1): Likewise. (ada_get_next_arg): Likewise. (defns_collected): Likewise. * ada-lex.l (processId): Likewise. (processString): Likewise. * ada-tasks.c (read_known_tasks_array): Likewise. (read_known_tasks_list): Likewise. * ada-typeprint.c (decoded_type_name): Likewise. * addrmap.c (addrmap_mutable_create_fixed): Likewise. * amd64-tdep.c (amd64_push_arguments): Likewise. (amd64_displaced_step_copy_insn): Likewise. (amd64_classify_insn_at): Likewise. (amd64_relocate_instruction): Likewise. * amd64obsd-tdep.c (amd64obsd_sigtramp_p): Likewise. * arch-utils.c (simple_displaced_step_copy_insn): Likewise. (initialize_current_architecture): Likewise. * arm-linux-tdep.c (arm_stap_parse_special_token): Likewise. * arm-symbian-tdep.c (arm_symbian_osabi_sniffer): Likewise. * arm-tdep.c (arm_exidx_new_objfile): Likewise. (arm_push_dummy_call): Likewise. (extend_buffer_earlier): Likewise. (arm_adjust_breakpoint_address): Likewise. (arm_skip_stub): Likewise. * auto-load.c (filename_is_in_pattern): Likewise. (maybe_add_script_file): Likewise. (maybe_add_script_text): Likewise. (auto_load_objfile_script_1): Likewise. * auxv.c (ld_so_xfer_auxv): Likewise. * ax-general.c (new_agent_expr): Likewise. (grow_expr): Likewise. (ax_reg_mask): Likewise. * bcache.c (bcache_full): Likewise. * breakpoint.c (program_breakpoint_here_p): Likewise. * btrace.c (parse_xml_raw): Likewise. * build-id.c (build_id_to_debug_bfd): Likewise. * buildsym.c (end_symtab_with_blockvector): Likewise. * c-exp.y (string_exp): Likewise. (qualified_name): Likewise. (write_destructor_name): Likewise. (operator_stoken): Likewise. (parse_number): Likewise. (scan_macro_expansion): Likewise. (yylex): Likewise. (c_print_token): Likewise. * c-lang.c (c_get_string): Likewise. (emit_numeric_character): Likewise. * charset.c (wchar_iterate): Likewise. * cli/cli-cmds.c (complete_command): Likewise. (make_command): Likewise. * cli/cli-dump.c (restore_section_callback): Likewise. (restore_binary_file): Likewise. * cli/cli-interp.c (cli_interpreter_exec): Likewise. * cli/cli-script.c (execute_control_command): Likewise. * cli/cli-setshow.c (do_set_command): Likewise. * coff-pe-read.c (add_pe_forwarded_sym): Likewise. (read_pe_exported_syms): Likewise. * coffread.c (coff_read_struct_type): Likewise. (coff_read_enum_type): Likewise. * common/btrace-common.c (btrace_data_append): Likewise. * common/buffer.c (buffer_grow): Likewise. * common/filestuff.c (gdb_fopen_cloexec): Likewise. * common/format.c (parse_format_string): Likewise. * common/gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise. * common/xml-utils.c (xml_escape_text): Likewise. * compile/compile-object-load.c (copy_sections): Likewise. (compile_object_load): Likewise. * compile/compile-object-run.c (compile_object_run): Likewise. * completer.c (filename_completer): Likewise. * corefile.c (read_memory_typed_address): Likewise. (write_memory_unsigned_integer): Likewise. (write_memory_signed_integer): Likewise. (complete_set_gnutarget): Likewise. * corelow.c (get_core_register_section): Likewise. * cp-name-parser.y (d_grab): Likewise. (allocate_info): Likewise. (cp_new_demangle_parse_info): Likewise. * cp-namespace.c (cp_scan_for_anonymous_namespaces): Likewise. (cp_lookup_symbol_in_namespace): Likewise. (lookup_namespace_scope): Likewise. (find_symbol_in_baseclass): Likewise. (cp_lookup_nested_symbol): Likewise. (cp_lookup_transparent_type_loop): Likewise. * cp-support.c (copy_string_to_obstack): Likewise. (make_symbol_overload_list): Likewise. (make_symbol_overload_list_namespace): Likewise. (make_symbol_overload_list_adl_namespace): Likewise. (first_component_command): Likewise. * cp-valprint.c (cp_print_value): Likewise. * ctf.c (ctf_xfer_partial): Likewise. * d-exp.y (StringExp): Likewise. * d-namespace.c (d_lookup_symbol_in_module): Likewise. (lookup_module_scope): Likewise. (find_symbol_in_baseclass): Likewise. (d_lookup_nested_symbol): Likewise. * dbxread.c (find_stab_function_addr): Likewise. (read_dbx_symtab): Likewise. (dbx_end_psymtab): Likewise. (cp_set_block_scope): Likewise. * dcache.c (dcache_alloc): Likewise. * demangle.c (_initialize_demangler): Likewise. * dicos-tdep.c (dicos_load_module_p): Likewise. * dictionary.c (dict_create_hashed_expandable): Likewise. (dict_create_linear_expandable): Likewise. (expand_hashtable): Likewise. (add_symbol_linear_expandable): Likewise. * dwarf2-frame.c (add_cie): Likewise. (add_fde): Likewise. (dwarf2_build_frame_info): Likewise. * dwarf2expr.c (dwarf_expr_grow_stack): Likewise. (dwarf_expr_fetch_address): Likewise. (add_piece): Likewise. (execute_stack_op): Likewise. * dwarf2loc.c (chain_candidate): Likewise. (dwarf_entry_parameter_to_value): Likewise. (read_pieced_value): Likewise. (write_pieced_value): Likewise. * dwarf2read.c (dwarf2_read_section): Likewise. (add_type_unit): Likewise. (read_comp_units_from_section): Likewise. (fixup_go_packaging): Likewise. (dwarf2_compute_name): Likewise. (dwarf2_physname): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (read_func_scope): Likewise. (read_call_site_scope): Likewise. (dwarf2_attach_fields_to_type): Likewise. (process_structure_scope): Likewise. (mark_common_block_symbol_computed): Likewise. (read_common_block): Likewise. (abbrev_table_read_table): Likewise. (guess_partial_die_structure_name): Likewise. (fixup_partial_die): Likewise. (add_file_name): Likewise. (dwarf2_const_value_data): Likewise. (dwarf2_const_value_attr): Likewise. (build_error_marker_type): Likewise. (guess_full_die_structure_name): Likewise. (anonymous_struct_prefix): Likewise. (typename_concat): Likewise. (dwarf2_canonicalize_name): Likewise. (dwarf2_name): Likewise. (write_constant_as_bytes): Likewise. (dwarf2_fetch_constant_bytes): Likewise. (copy_string): Likewise. (parse_macro_definition): Likewise. * elfread.c (elf_symfile_segments): Likewise. (elf_rel_plt_read): Likewise. (elf_gnu_ifunc_resolve_by_cache): Likewise. (elf_gnu_ifunc_resolve_by_got): Likewise. (elf_read_minimal_symbols): Likewise. (elf_gnu_ifunc_record_cache): Likewise. * event-top.c (top_level_prompt): Likewise. (command_line_handler): Likewise. * exec.c (resize_section_table): Likewise. * expprint.c (print_subexp_standard): Likewise. * fbsd-tdep.c (fbsd_collect_regset_section_cb): Likewise. * findcmd.c (parse_find_args): Likewise. * findvar.c (address_from_register): Likewise. * frame.c (get_prev_frame_always): Likewise. * gdb_bfd.c (gdb_bfd_ref): Likewise. (get_section_descriptor): Likewise. * gdb_obstack.c (obconcat): Likewise. (obstack_strdup): Likewise. * gdbtypes.c (lookup_function_type_with_arguments): Likewise. (create_set_type): Likewise. (lookup_unsigned_typename): Likewise. (lookup_signed_typename): Likewise. (resolve_dynamic_union): Likewise. (resolve_dynamic_struct): Likewise. (add_dyn_prop): Likewise. (copy_dynamic_prop_list): Likewise. (arch_flags_type): Likewise. (append_composite_type_field_raw): Likewise. * gdbtypes.h (INIT_FUNC_SPECIFIC): Likewise. * gnu-v3-abi.c (gnuv3_rtti_type): Likewise. * go-exp.y (string_exp): Likewise. * go-lang.c (go_demangle): Likewise. * guile/guile.c (compute_scheme_string): Likewise. * guile/scm-cmd.c (gdbscm_parse_command_name): Likewise. (gdbscm_canonicalize_command_name): Likewise. * guile/scm-ports.c (ioscm_init_stdio_buffers): Likewise. (ioscm_init_memory_port): Likewise. (ioscm_reinit_memory_port): Likewise. * guile/scm-utils.c (gdbscm_gc_xstrdup): Likewise. (gdbscm_gc_dup_argv): Likewise. * h8300-tdep.c (h8300_push_dummy_call): Likewise. * hppa-tdep.c (internalize_unwinds): Likewise. (read_unwind_info): Likewise. * i386-cygwin-tdep.c (core_process_module_section): Likewise. (windows_core_xfer_shared_libraries): Likewise. * i386-tdep.c (i386_displaced_step_copy_insn): Likewise. (i386_stap_parse_special_token_triplet): Likewise. (i386_stap_parse_special_token_three_arg_disp): Likewise. * i386obsd-tdep.c (i386obsd_sigtramp_p): Likewise. * inf-child.c (inf_child_fileio_readlink): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register): Likewise. (inf_ptrace_store_register): Likewise. * infrun.c (follow_exec): Likewise. (displaced_step_prepare_throw): Likewise. (save_stop_context): Likewise. (save_infcall_suspend_state): Likewise. * jit.c (jit_read_descriptor): Likewise. (jit_read_code_entry): Likewise. (jit_symtab_line_mapping_add_impl): Likewise. (finalize_symtab): Likewise. (jit_unwind_reg_get_impl): Likewise. * jv-exp.y (QualifiedName): Likewise. * jv-lang.c (get_java_utf8_name): Likewise. (type_from_class): Likewise. (java_demangle_type_signature): Likewise. (java_class_name_from_physname): Likewise. * jv-typeprint.c (java_type_print_base): Likewise. * jv-valprint.c (java_value_print): Likewise. * language.c (add_language): Likewise. * linespec.c (add_sal_to_sals_basic): Likewise. (add_sal_to_sals): Likewise. (decode_objc): Likewise. (find_linespec_symbols): Likewise. * linux-fork.c (fork_save_infrun_state): Likewise. * linux-nat.c (linux_nat_detach): Likewise. (linux_nat_fileio_readlink): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (Do): Likewise. * linux-tdep.c (linux_core_info_proc_mappings): Likewise. (linux_collect_regset_section_cb): Likewise. (linux_get_siginfo_data): Likewise. * linux-thread-db.c (try_thread_db_load_from_pdir_1): Likewise. (try_thread_db_load_from_dir): Likewise. (thread_db_load_search): Likewise. (info_auto_load_libthread_db): Likewise. * m32c-tdep.c (m32c_m16c_address_to_pointer): Likewise. (m32c_m16c_pointer_to_address): Likewise. * m68hc11-tdep.c (m68hc11_pseudo_register_write): Likewise. * m68k-tdep.c (m68k_get_longjmp_target): Likewise. * machoread.c (macho_check_dsym): Likewise. * macroexp.c (resize_buffer): Likewise. (gather_arguments): Likewise. (maybe_expand): Likewise. * macrotab.c (new_macro_key): Likewise. (new_source_file): Likewise. (new_macro_definition): Likewise. * mdebugread.c (parse_symbol): Likewise. (parse_type): Likewise. (parse_partial_symbols): Likewise. (psymtab_to_symtab_1): Likewise. * mem-break.c (default_memory_insert_breakpoint): Likewise. * mi/mi-cmd-break.c (mi_argv_to_format): Likewise. * mi/mi-main.c (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_data_write_memory_bytes): Likewise. (mi_cmd_trace_frame_collected): Likewise. * mi/mi-parse.c (mi_parse_argv): Likewise. (mi_parse): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. * mips-tdep.c (mips_read_fp_register_single): Likewise. (mips_print_fp_register): Likewise. * mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Likewise. * mipsread.c (read_alphacoff_dynamic_symtab): Likewise. * mt-tdep.c (mt_register_name): Likewise. (mt_registers_info): Likewise. (mt_push_dummy_call): Likewise. * namespace.c (add_using_directive): Likewise. * nat/linux-btrace.c (perf_event_read): Likewise. (linux_enable_bts): Likewise. * nat/linux-osdata.c (linux_common_core_of_thread): Likewise. * nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Likewise. * nto-tdep.c (nto_find_and_open_solib): Likewise. (nto_parse_redirection): Likewise. * objc-lang.c (objc_demangle): Likewise. (find_methods): Likewise. * objfiles.c (get_objfile_bfd_data): Likewise. (set_objfile_main_name): Likewise. (allocate_objfile): Likewise. (objfile_relocate): Likewise. (update_section_map): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * p-exp.y (exp): Likewise. (yylex): Likewise. * p-valprint.c (pascal_object_print_value): Likewise. * parse.c (initialize_expout): Likewise. (mark_completion_tag): Likewise. (copy_name): Likewise. (parse_float): Likewise. (type_stack_reserve): Likewise. * ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise. (ppu2spu_prev_register): Likewise. * ppc-ravenscar-thread.c (supply_register_at_address): Likewise. * printcmd.c (printf_wide_c_string): Likewise. (printf_pointer): Likewise. * probe.c (parse_probes): Likewise. * python/py-cmd.c (gdbpy_parse_command_name): Likewise. (cmdpy_init): Likewise. * python/py-gdb-readline.c (gdbpy_readline_wrapper): Likewise. * python/py-symtab.c (set_sal): Likewise. * python/py-unwind.c (pyuw_sniffer): Likewise. * python/python.c (python_interactive_command): Likewise. (compute_python_string): Likewise. * ravenscar-thread.c (get_running_thread_id): Likewise. * record-full.c (record_full_exec_insn): Likewise. (record_full_core_open_1): Likewise. * regcache.c (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. * remote-fileio.c (remote_fileio_func_open): Likewise. (remote_fileio_func_rename): Likewise. (remote_fileio_func_unlink): Likewise. (remote_fileio_func_stat): Likewise. (remote_fileio_func_system): Likewise. * remote-mips.c (mips_xfer_memory): Likewise. (mips_load_srec): Likewise. (pmon_end_download): Likewise. * remote.c (new_remote_state): Likewise. (map_regcache_remote_table): Likewise. (remote_register_number_and_offset): Likewise. (init_remote_state): Likewise. (get_memory_packet_size): Likewise. (remote_pass_signals): Likewise. (remote_program_signals): Likewise. (remote_start_remote): Likewise. (remote_check_symbols): Likewise. (remote_query_supported): Likewise. (extended_remote_attach): Likewise. (process_g_packet): Likewise. (store_registers_using_G): Likewise. (putpkt_binary): Likewise. (read_frame): Likewise. (compare_sections_command): Likewise. (remote_hostio_pread): Likewise. (remote_hostio_readlink): Likewise. (remote_file_put): Likewise. (remote_file_get): Likewise. (remote_pid_to_exec_file): Likewise. (_initialize_remote): Likewise. * rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise. (rs6000_aix_core_xfer_shared_libraries_aix): Likewise. * rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise. (bfd_uses_spe_extensions): Likewise. * s390-linux-tdep.c (s390_displaced_step_copy_insn): Likewise. * score-tdep.c (score7_malloc_and_get_memblock): Likewise. * solib-dsbt.c (decode_loadmap): Likewise. (fetch_loadmap): Likewise. (scan_dyntag): Likewise. (enable_break): Likewise. (dsbt_relocate_main_executable): Likewise. * solib-frv.c (fetch_loadmap): Likewise. (enable_break2): Likewise. (frv_relocate_main_executable): Likewise. * solib-spu.c (spu_relocate_main_executable): Likewise. (spu_bfd_open): Likewise. * solib-svr4.c (lm_info_read): Likewise. (read_program_header): Likewise. (find_program_interpreter): Likewise. (scan_dyntag): Likewise. (elf_locate_base): Likewise. (open_symbol_file_object): Likewise. (read_program_headers_from_bfd): Likewise. (svr4_relocate_main_executable): Likewise. * solib-target.c (solib_target_relocate_section_addresses): Likewise. * solib.c (solib_find_1): Likewise. (exec_file_find): Likewise. (solib_find): Likewise. * source.c (openp): Likewise. (print_source_lines_base): Likewise. (forward_search_command): Likewise. * sparc-ravenscar-thread.c (supply_register_at_address): Likewise. * spu-tdep.c (spu2ppu_prev_register): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (patch_block_stabs): Likewise. (define_symbol): Likewise. (again:): Likewise. (read_member_functions): Likewise. (read_one_struct_field): Likewise. (read_enum_type): Likewise. (common_block_start): Likewise. * stack.c (read_frame_arg): Likewise. (backtrace_command): Likewise. * stap-probe.c (stap_parse_register_operand): Likewise. * symfile.c (syms_from_objfile_1): Likewise. (find_separate_debug_file): Likewise. (load_command): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (reread_symbols): Likewise. (add_filename_language): Likewise. (allocate_compunit_symtab): Likewise. (read_target_long_array): Likewise. (simple_read_overlay_table): Likewise. * symtab.c (symbol_set_names): Likewise. (resize_symbol_cache): Likewise. (rbreak_command): Likewise. (completion_list_add_name): Likewise. (completion_list_objc_symbol): Likewise. (add_filename_to_list): Likewise. * target-descriptions.c (maint_print_c_tdesc_cmd): Likewise. * target-memory.c (target_write_memory_blocks): Likewise. * target.c (target_read_string): Likewise. (read_whatever_is_readable): Likewise. (target_read_alloc_1): Likewise. (simple_search_memory): Likewise. (target_fileio_read_alloc_1): Likewise. * tilegx-tdep.c (tilegx_push_dummy_call): Likewise. * top.c (command_line_input): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (tracefile_fetch_registers): Likewise. * tracepoint.c (add_memrange): Likewise. (init_collection_list): Likewise. (add_aexpr): Likewise. (trace_dump_actions): Likewise. (parse_trace_status): Likewise. (parse_tracepoint_definition): Likewise. (parse_tsv_definition): Likewise. (parse_static_tracepoint_marker_definition): Likewise. * tui/tui-file.c (tui_sfileopen): Likewise. (tui_file_adjust_strbuf): Likewise. * tui/tui-io.c (tui_expand_tabs): Likewise. * tui/tui-source.c (tui_set_source_content): Likewise. * typeprint.c (find_global_typedef): Likewise. * ui-file.c (do_ui_file_xstrdup): Likewise. (ui_file_obsavestring): Likewise. (mem_file_write): Likewise. * utils.c (make_hex_string): Likewise. (get_regcomp_error): Likewise. (puts_filtered_tabular): Likewise. (gdb_realpath_keepfile): Likewise. (ldirname): Likewise. (gdb_bfd_errmsg): Likewise. (substitute_path_component): Likewise. * valops.c (search_struct_method): Likewise. (find_oload_champ_namespace_loop): Likewise. * valprint.c (print_decimal_chars): Likewise. (read_string): Likewise. (generic_emit_char): Likewise. * varobj.c (varobj_delete): Likewise. (varobj_value_get_print_value): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_sniffer): Likewise. * windows-tdep.c (display_one_tib): Likewise. * xcoffread.c (read_xcoff_symtab): Likewise. (process_xcoff_symbol): Likewise. (swap_sym): Likewise. (scan_xcoff_symtab): Likewise. (xcoff_initial_scan): Likewise. * xml-support.c (gdb_xml_end_element): Likewise. (xml_process_xincludes): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (xml_list_of_syscalls): Likewise. * xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise. gdb/gdbserver/ChangeLog: * ax.c (gdb_parse_agent_expr): Add cast to allocation result assignment. (gdb_unparse_agent_expr): Likewise. * hostio.c (require_data): Likewise. (handle_pread): Likewise. * linux-low.c (disable_regset): Likewise. (fetch_register): Likewise. (store_register): Likewise. (get_dynamic): Likewise. (linux_qxfer_libraries_svr4): Likewise. * mem-break.c (delete_fast_tracepoint_jump): Likewise. (set_fast_tracepoint_jump): Likewise. (uninsert_fast_tracepoint_jumps_at): Likewise. (reinsert_fast_tracepoint_jumps_at): Likewise. (validate_inserted_breakpoint): Likewise. (clone_agent_expr): Likewise. * regcache.c (init_register_cache): Likewise. * remote-utils.c (putpkt_binary_1): Likewise. (decode_M_packet): Likewise. (decode_X_packet): Likewise. (look_up_one_symbol): Likewise. (relocate_instruction): Likewise. (monitor_output): Likewise. * server.c (handle_search_memory): Likewise. (handle_qxfer_exec_file): Likewise. (handle_qxfer_libraries): Likewise. (handle_qxfer): Likewise. (handle_query): Likewise. (handle_v_cont): Likewise. (handle_v_run): Likewise. (captured_main): Likewise. * target.c (write_inferior_memory): Likewise. * thread-db.c (try_thread_db_load_from_dir): Likewise. * tracepoint.c (init_trace_buffer): Likewise. (add_tracepoint_action): Likewise. (add_traceframe): Likewise. (add_traceframe_block): Likewise. (cmd_qtdpsrc): Likewise. (cmd_qtdv): Likewise. (cmd_qtstatus): Likewise. (response_source): Likewise. (response_tsv): Likewise. (cmd_qtnotes): Likewise. (gdb_collect): Likewise. (initialize_tracepoint): Likewise.
2015-09-25 20:08:06 +02:00
buf = (gdb_byte *) alloca (buf_size);
read_memory (object_addr, buf, buf_size);
return extract_typed_address (buf, builtin_type_void_data_ptr);
}
static void
ravenscar_resume (struct target_ops *ops, ptid_t ptid, int step,
enum gdb_signal siggnal)
{
struct target_ops *beneath = find_target_beneath (ops);
inferior_ptid = base_ptid;
beneath->to_resume (beneath, base_ptid, step, siggnal);
}
static ptid_t
ravenscar_wait (struct target_ops *ops, ptid_t ptid,
struct target_waitstatus *status,
int options)
{
struct target_ops *beneath = find_target_beneath (ops);
inferior_ptid = base_ptid;
beneath->to_wait (beneath, base_ptid, status, 0);
/* Find any new threads that might have been created, and update
inferior_ptid to the active thread.
Only do it if the program is still alive, though. Otherwise,
this causes problems when debugging through the remote protocol,
because we might try switching threads (and thus sending packets)
after the remote has disconnected. */
if (status->kind != TARGET_WAITKIND_EXITED
&& status->kind != TARGET_WAITKIND_SIGNALLED)
{
Push pruning old threads down to the target When GDB wants to sync the thread list with the target's (e.g., due to "info threads"), it calls update_thread_list: update_thread_list (void) { prune_threads (); target_find_new_threads (); update_threads_executing (); } And then prune_threads does: prune_threads (void) { struct thread_info *tp, *next; for (tp = thread_list; tp; tp = next) { next = tp->next; if (!thread_alive (tp)) delete_thread (tp->ptid); } } Calling thread_live on each thread one by one is expensive. E.g., on Linux, it ends up doing kill(SIG0) once for each thread. Not a big deal, but still a bunch of syscalls... With the remote target, it's cumbersome. That thread_alive call ends up generating one T packet per thread: Sending packet: $Tp2141.2150#82...Packet received: OK Sending packet: $Tp2141.214f#b7...Packet received: OK Sending packet: $Tp2141.2141#82...Packet received: OK Sending packet: $qXfer:threads:read::0,fff#03...Packet received: l<threads>\n<thread id="p2141.2141" core="2"/>\n<thread id="p2141.214f" core="1"/>\n<thread id="p2141.2150" core="2"/>\n</threads>\n That seems a bit silly when target_find_new_threads method implementations will always fetch the whole current set of target threads, and then add those that are not in GDB's thread list, to GDB's thread list. This patch thus pushes down the responsibility of pruning dead threads to the target_find_new_threads method instead, so a target may implement pruning dead threads however it wants. Once we do that, target_find_new_threads becomes a misnomer, so the patch renames it to target_update_thread_list. The patch doesn't attempt to do any optimization to any target yet. It simply exports prune_threads, and makes all implementations of target_update_thread_list call that. It's meant to be a no-op. gdb/ 2014-10-15 Pedro Alves <palves@redhat.com> * ada-tasks.c (print_ada_task_info, task_command_1): Adjust. * bsd-uthread.c (bsd_uthread_find_new_threads): Rename to ... (bsd_uthread_update_thread_list): ... this. Call prune_threads. (bsd_uthread_target): Adjust. * corelow.c (core_open): Adjust. * dec-thread.c (dec_thread_find_new_threads): Update comment. (dec_thread_update_thread_list): New function. (init_dec_thread_ops): Adjust. * gdbthread.h (prune_threads): New declaration. * linux-thread-db.c (thread_db_find_new_threads): Rename to ... (thread_db_update_thread_list): ... this. Call prune_threads. (init_thread_db_ops): Adjust. * nto-procfs.c (procfs_find_new_threads): Rename to ... (procfs_update_thread_list): ... this. Call prune_threads. (procfs_attach, procfs_create_inferior, init_procfs_targets): Adjust. * obsd-nat.c (obsd_find_new_threads): Rename to ... (obsd_update_thread_list): ... this. Call prune_threads. (obsd_add_target): Adjust. * procfs.c (procfs_target): Adjust. (procfs_notice_thread): Update comment. (procfs_find_new_threads): Rename to ... (procfs_update_thread_list): ... this. Call prune_threads. * ravenscar-thread.c (ravenscar_update_inferior_ptid): Update comment. (ravenscar_wait): Adjust. (ravenscar_find_new_threads): Rename to ... (ravenscar_update_thread_list): ... this. Call prune_threads. (init_ravenscar_thread_ops): Adjust. * record-btrace.c (record_btrace_find_new_threads): Rename to ... (record_btrace_update_thread_list): ... this. Adjust comment. (init_record_btrace_ops): Adjust. * remote.c (remote_threads_info): Rename to ... (remote_update_thread_list): ... this. Call prune_threads. (remote_start_remote, extended_remote_attach_1, init_remote_ops): Adjust. * sol-thread.c (check_for_thread_db): Adjust. (sol_find_new_threads_callback): Rename to ... (sol_update_thread_list_callback): ... this. (sol_find_new_threads): Rename to ... (sol_update_thread_list): ... this. Call prune_threads. Adjust. (sol_get_ada_task_ptid, init_sol_thread_ops): Adjust. * target-delegates.c: Regenerate. * target.c (target_find_new_threads): Rename to ... (target_update_thread_list): ... this. * target.h (struct target_ops): Rename to_find_new_threads field to to_update_thread_list. (target_find_new_threads): Rename to ... (target_update_thread_list): ... this. * thread.c (prune_threads): Make extern. (update_thread_list): Adjust.
2014-10-15 23:44:00 +02:00
ravenscar_update_thread_list (ops);
ravenscar_update_inferior_ptid ();
}
return inferior_ptid;
}
/* Add the thread associated to the given TASK to the thread list
(if the thread has already been added, this is a no-op). */
static void
ravenscar_add_thread (struct ada_task_info *task)
{
if (find_thread_ptid (task->ptid) == NULL)
add_thread (task->ptid);
}
static void
Push pruning old threads down to the target When GDB wants to sync the thread list with the target's (e.g., due to "info threads"), it calls update_thread_list: update_thread_list (void) { prune_threads (); target_find_new_threads (); update_threads_executing (); } And then prune_threads does: prune_threads (void) { struct thread_info *tp, *next; for (tp = thread_list; tp; tp = next) { next = tp->next; if (!thread_alive (tp)) delete_thread (tp->ptid); } } Calling thread_live on each thread one by one is expensive. E.g., on Linux, it ends up doing kill(SIG0) once for each thread. Not a big deal, but still a bunch of syscalls... With the remote target, it's cumbersome. That thread_alive call ends up generating one T packet per thread: Sending packet: $Tp2141.2150#82...Packet received: OK Sending packet: $Tp2141.214f#b7...Packet received: OK Sending packet: $Tp2141.2141#82...Packet received: OK Sending packet: $qXfer:threads:read::0,fff#03...Packet received: l<threads>\n<thread id="p2141.2141" core="2"/>\n<thread id="p2141.214f" core="1"/>\n<thread id="p2141.2150" core="2"/>\n</threads>\n That seems a bit silly when target_find_new_threads method implementations will always fetch the whole current set of target threads, and then add those that are not in GDB's thread list, to GDB's thread list. This patch thus pushes down the responsibility of pruning dead threads to the target_find_new_threads method instead, so a target may implement pruning dead threads however it wants. Once we do that, target_find_new_threads becomes a misnomer, so the patch renames it to target_update_thread_list. The patch doesn't attempt to do any optimization to any target yet. It simply exports prune_threads, and makes all implementations of target_update_thread_list call that. It's meant to be a no-op. gdb/ 2014-10-15 Pedro Alves <palves@redhat.com> * ada-tasks.c (print_ada_task_info, task_command_1): Adjust. * bsd-uthread.c (bsd_uthread_find_new_threads): Rename to ... (bsd_uthread_update_thread_list): ... this. Call prune_threads. (bsd_uthread_target): Adjust. * corelow.c (core_open): Adjust. * dec-thread.c (dec_thread_find_new_threads): Update comment. (dec_thread_update_thread_list): New function. (init_dec_thread_ops): Adjust. * gdbthread.h (prune_threads): New declaration. * linux-thread-db.c (thread_db_find_new_threads): Rename to ... (thread_db_update_thread_list): ... this. Call prune_threads. (init_thread_db_ops): Adjust. * nto-procfs.c (procfs_find_new_threads): Rename to ... (procfs_update_thread_list): ... this. Call prune_threads. (procfs_attach, procfs_create_inferior, init_procfs_targets): Adjust. * obsd-nat.c (obsd_find_new_threads): Rename to ... (obsd_update_thread_list): ... this. Call prune_threads. (obsd_add_target): Adjust. * procfs.c (procfs_target): Adjust. (procfs_notice_thread): Update comment. (procfs_find_new_threads): Rename to ... (procfs_update_thread_list): ... this. Call prune_threads. * ravenscar-thread.c (ravenscar_update_inferior_ptid): Update comment. (ravenscar_wait): Adjust. (ravenscar_find_new_threads): Rename to ... (ravenscar_update_thread_list): ... this. Call prune_threads. (init_ravenscar_thread_ops): Adjust. * record-btrace.c (record_btrace_find_new_threads): Rename to ... (record_btrace_update_thread_list): ... this. Adjust comment. (init_record_btrace_ops): Adjust. * remote.c (remote_threads_info): Rename to ... (remote_update_thread_list): ... this. Call prune_threads. (remote_start_remote, extended_remote_attach_1, init_remote_ops): Adjust. * sol-thread.c (check_for_thread_db): Adjust. (sol_find_new_threads_callback): Rename to ... (sol_update_thread_list_callback): ... this. (sol_find_new_threads): Rename to ... (sol_update_thread_list): ... this. Call prune_threads. Adjust. (sol_get_ada_task_ptid, init_sol_thread_ops): Adjust. * target-delegates.c: Regenerate. * target.c (target_find_new_threads): Rename to ... (target_update_thread_list): ... this. * target.h (struct target_ops): Rename to_find_new_threads field to to_update_thread_list. (target_find_new_threads): Rename to ... (target_update_thread_list): ... this. * thread.c (prune_threads): Make extern. (update_thread_list): Adjust.
2014-10-15 23:44:00 +02:00
ravenscar_update_thread_list (struct target_ops *ops)
{
ada_build_task_list ();
/* Do not clear the thread list before adding the Ada task, to keep
the thread that the process stratum has included into it
(base_ptid) and the running thread, that may not have been included
to system.tasking.debug's list yet. */
iterate_over_live_ada_tasks (ravenscar_add_thread);
}
static ptid_t
ravenscar_running_thread (void)
{
CORE_ADDR tid = get_running_thread_id ();
if (tid == 0)
return null_ptid;
else
return ptid_build (ptid_get_pid (base_ptid), 0, tid);
}
-Wwrite-strings: Constify target_pid_to_str and target_thread_extra_thread_info -Wwrite-strings flagged a missing cast for example here: static char * ravenscar_extra_thread_info (struct target_ops *self, struct thread_info *tp) { return "Ravenscar task"; Since callers are not supposed to free the string returned by these methods, change the methods' signature to return const strings. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * aix-thread.c (aix_thread_pid_to_str) (aix_thread_extra_thread_info): Constify. * bsd-kvm.c (bsd_kvm_pid_to_str): Constify. * bsd-uthread.c (bsd_uthread_extra_thread_info) (bsd_uthread_pid_to_str): Constify. * corelow.c (core_pid_to_str): Constify. * darwin-nat.c (darwin_pid_to_str): Constify. * fbsd-nat.c (fbsd_pid_to_str): Constify. * fbsd-tdep.c (fbsd_core_pid_to_str, gdbarch_core_pid_to_str): Constify. * gnu-nat.c (gnu_pid_to_str): Constify. * go32-nat.c (go32_pid_to_str): Constify. * i386-cygwin-tdep.c (i386_windows_core_pid_to_str): Constify. * inf-ptrace.c (inf_ptrace_pid_to_str): Constify. * inferior.c (inferior_pid_to_str): Constify. * linux-nat.c (linux_nat_pid_to_str): Constify. * linux-tdep.c (linux_core_pid_to_str): Constify. * linux-thread-db.c (thread_db_pid_to_str) (thread_db_extra_thread_info): Constify. * nto-tdep.c (nto_extra_thread_info): Constify. * nto-tdep.h (nto_extra_thread_info): Constify. * obsd-nat.c (obsd_pid_to_str): Constify. * procfs.c (procfs_pid_to_str): Constify. * ravenscar-thread.c (ravenscar_extra_thread_info) (ravenscar_pid_to_str): Constify. * remote-sim.c (gdbsim_pid_to_str): Constify. * remote.c (remote_threads_extra_info, remote_pid_to_str): Constify. * sol-thread.c (solaris_pid_to_str): Constify. * sol2-tdep.c (sol2_core_pid_to_str): Constify. * sol2-tdep.h (sol2_core_pid_to_str): Constify. * target.c (default_pid_to_str, target_pid_to_str) (normal_pid_to_str, default_pid_to_str): Constify. * target.h (target_ops::to_pid_to_str) (target_ops::to_extra_thread_info): Constify. (target_pid_to_str, normal_pid_to_str): Constify. * windows-nat.c (windows_pid_to_str): Constify. * gdbarch.sh (core_pid_to_str): Constify. * target-delegates.c: Regenerate. * gdbarch.h, gdbarch.c: Regenerate.
2017-04-05 20:21:34 +02:00
static const char *
ravenscar_extra_thread_info (struct target_ops *self, struct thread_info *tp)
{
return "Ravenscar task";
}
static int
ravenscar_thread_alive (struct target_ops *ops, ptid_t ptid)
{
/* Ravenscar tasks are non-terminating. */
return 1;
}
-Wwrite-strings: Constify target_pid_to_str and target_thread_extra_thread_info -Wwrite-strings flagged a missing cast for example here: static char * ravenscar_extra_thread_info (struct target_ops *self, struct thread_info *tp) { return "Ravenscar task"; Since callers are not supposed to free the string returned by these methods, change the methods' signature to return const strings. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * aix-thread.c (aix_thread_pid_to_str) (aix_thread_extra_thread_info): Constify. * bsd-kvm.c (bsd_kvm_pid_to_str): Constify. * bsd-uthread.c (bsd_uthread_extra_thread_info) (bsd_uthread_pid_to_str): Constify. * corelow.c (core_pid_to_str): Constify. * darwin-nat.c (darwin_pid_to_str): Constify. * fbsd-nat.c (fbsd_pid_to_str): Constify. * fbsd-tdep.c (fbsd_core_pid_to_str, gdbarch_core_pid_to_str): Constify. * gnu-nat.c (gnu_pid_to_str): Constify. * go32-nat.c (go32_pid_to_str): Constify. * i386-cygwin-tdep.c (i386_windows_core_pid_to_str): Constify. * inf-ptrace.c (inf_ptrace_pid_to_str): Constify. * inferior.c (inferior_pid_to_str): Constify. * linux-nat.c (linux_nat_pid_to_str): Constify. * linux-tdep.c (linux_core_pid_to_str): Constify. * linux-thread-db.c (thread_db_pid_to_str) (thread_db_extra_thread_info): Constify. * nto-tdep.c (nto_extra_thread_info): Constify. * nto-tdep.h (nto_extra_thread_info): Constify. * obsd-nat.c (obsd_pid_to_str): Constify. * procfs.c (procfs_pid_to_str): Constify. * ravenscar-thread.c (ravenscar_extra_thread_info) (ravenscar_pid_to_str): Constify. * remote-sim.c (gdbsim_pid_to_str): Constify. * remote.c (remote_threads_extra_info, remote_pid_to_str): Constify. * sol-thread.c (solaris_pid_to_str): Constify. * sol2-tdep.c (sol2_core_pid_to_str): Constify. * sol2-tdep.h (sol2_core_pid_to_str): Constify. * target.c (default_pid_to_str, target_pid_to_str) (normal_pid_to_str, default_pid_to_str): Constify. * target.h (target_ops::to_pid_to_str) (target_ops::to_extra_thread_info): Constify. (target_pid_to_str, normal_pid_to_str): Constify. * windows-nat.c (windows_pid_to_str): Constify. * gdbarch.sh (core_pid_to_str): Constify. * target-delegates.c: Regenerate. * gdbarch.h, gdbarch.c: Regenerate.
2017-04-05 20:21:34 +02:00
static const char *
ravenscar_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
static char buf[30];
snprintf (buf, sizeof (buf), "Thread %#x", (int) ptid_get_tid (ptid));
return buf;
}
static void
ravenscar_fetch_registers (struct target_ops *ops,
struct regcache *regcache, int regnum)
{
struct target_ops *beneath = find_target_beneath (ops);
Use ptid from regcache in almost all remaining nat files This patch contains almost all of the remaining changes needed to make to_fetch_registers/to_store_registers/to_prepare_to_store independent of inferior_ptid. It contains only some "trivial" changes, the more complicated ones are in separate patches. gdb/ChangeLog: * i386-linux-nat.c (fetch_register, store_register, i386_linux_fetch_inferior_registers, i386_linux_store_inferior_registers): Use ptid from regcache. * ia64-linux-nat.c (ia64_linux_fetch_register, ia64_linux_store_register): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register, inf_ptrace_store_register): Likewise. * m32r-linux-nat.c (m32r_linux_fetch_inferior_registers, m32r_linux_store_inferior_registers): Likewise. * m68k-bsd-nat.c (m68kbsd_fetch_inferior_registers, m68kbsd_store_inferior_registers): Likewise. * m68k-linux-nat.c (fetch_register, store_register, m68k_linux_fetch_inferior_registers, m68k_linux_store_inferior_registers): Likewise. * m88k-bsd-nat.c (m88kbsd_fetch_inferior_registers, m88kbsd_store_inferior_registers): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers, mips_fbsd_store_inferior_registers): Likewise. * mips-linux-nat.c (mips64_linux_regsets_fetch_registers, mips64_linux_regsets_store_registers): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers, mipsnbsd_store_inferior_registers): Likewise. * mips-obsd-nat.c (mips64obsd_fetch_inferior_registers, mips64obsd_store_inferior_registers): Likewise. * nto-procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers, ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (ppc_linux_fetch_inferior_registers, ppc_linux_store_inferior_registers): Likewise. * ppc-nbsd-nat.c (ppcnbsd_fetch_inferior_registers, ppcnbsd_store_inferior_registers): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers, ppcobsd_store_registers): Likewise. * procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers, ravenscar_store_registers, ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers, record_btrace_store_registers, record_btrace_prepare_to_store): Likewise. * remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Lookup inferior using ptid from regcache, instead of current_inferior. * remote.c (remote_fetch_registers, remote_store_registers): Use ptid from regcache. * rs6000-nat.c (fetch_register, store_register): Likewise. * s390-linux-nat.c (s390_linux_fetch_inferior_registers, s390_linux_store_inferior_registers): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Likewise. * sol-thread.c (sol_thread_fetch_registers, sol_thread_store_registers): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers, sparc_store_inferior_registers): Likewise. * tilegx-linux-nat.c (fetch_inferior_registers, store_inferior_registers): Likewise. * vax-bsd-nat.c (vaxbsd_fetch_inferior_registers, vaxbsd_store_inferior_registers): Likewise. * xtensa-linux-nat.c (fetch_gregs, store_gregs, fetch_xtregs, store_xtregs): Likewise.
2017-03-20 22:37:36 +01:00
ptid_t ptid = regcache_get_ptid (regcache);
if (!ravenscar_runtime_initialized ()
Use ptid from regcache in almost all remaining nat files This patch contains almost all of the remaining changes needed to make to_fetch_registers/to_store_registers/to_prepare_to_store independent of inferior_ptid. It contains only some "trivial" changes, the more complicated ones are in separate patches. gdb/ChangeLog: * i386-linux-nat.c (fetch_register, store_register, i386_linux_fetch_inferior_registers, i386_linux_store_inferior_registers): Use ptid from regcache. * ia64-linux-nat.c (ia64_linux_fetch_register, ia64_linux_store_register): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register, inf_ptrace_store_register): Likewise. * m32r-linux-nat.c (m32r_linux_fetch_inferior_registers, m32r_linux_store_inferior_registers): Likewise. * m68k-bsd-nat.c (m68kbsd_fetch_inferior_registers, m68kbsd_store_inferior_registers): Likewise. * m68k-linux-nat.c (fetch_register, store_register, m68k_linux_fetch_inferior_registers, m68k_linux_store_inferior_registers): Likewise. * m88k-bsd-nat.c (m88kbsd_fetch_inferior_registers, m88kbsd_store_inferior_registers): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers, mips_fbsd_store_inferior_registers): Likewise. * mips-linux-nat.c (mips64_linux_regsets_fetch_registers, mips64_linux_regsets_store_registers): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers, mipsnbsd_store_inferior_registers): Likewise. * mips-obsd-nat.c (mips64obsd_fetch_inferior_registers, mips64obsd_store_inferior_registers): Likewise. * nto-procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers, ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (ppc_linux_fetch_inferior_registers, ppc_linux_store_inferior_registers): Likewise. * ppc-nbsd-nat.c (ppcnbsd_fetch_inferior_registers, ppcnbsd_store_inferior_registers): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers, ppcobsd_store_registers): Likewise. * procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers, ravenscar_store_registers, ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers, record_btrace_store_registers, record_btrace_prepare_to_store): Likewise. * remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Lookup inferior using ptid from regcache, instead of current_inferior. * remote.c (remote_fetch_registers, remote_store_registers): Use ptid from regcache. * rs6000-nat.c (fetch_register, store_register): Likewise. * s390-linux-nat.c (s390_linux_fetch_inferior_registers, s390_linux_store_inferior_registers): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Likewise. * sol-thread.c (sol_thread_fetch_registers, sol_thread_store_registers): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers, sparc_store_inferior_registers): Likewise. * tilegx-linux-nat.c (fetch_inferior_registers, store_inferior_registers): Likewise. * vax-bsd-nat.c (vaxbsd_fetch_inferior_registers, vaxbsd_store_inferior_registers): Likewise. * xtensa-linux-nat.c (fetch_gregs, store_gregs, fetch_xtregs, store_xtregs): Likewise.
2017-03-20 22:37:36 +01:00
|| ptid_equal (ptid, base_magic_null_ptid)
|| ptid_equal (ptid, ravenscar_running_thread ()))
beneath->to_fetch_registers (beneath, regcache, regnum);
else
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct ravenscar_arch_ops *arch_ops
= gdbarch_ravenscar_ops (gdbarch);
arch_ops->to_fetch_registers (regcache, regnum);
}
}
static void
ravenscar_store_registers (struct target_ops *ops,
struct regcache *regcache, int regnum)
{
struct target_ops *beneath = find_target_beneath (ops);
Use ptid from regcache in almost all remaining nat files This patch contains almost all of the remaining changes needed to make to_fetch_registers/to_store_registers/to_prepare_to_store independent of inferior_ptid. It contains only some "trivial" changes, the more complicated ones are in separate patches. gdb/ChangeLog: * i386-linux-nat.c (fetch_register, store_register, i386_linux_fetch_inferior_registers, i386_linux_store_inferior_registers): Use ptid from regcache. * ia64-linux-nat.c (ia64_linux_fetch_register, ia64_linux_store_register): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register, inf_ptrace_store_register): Likewise. * m32r-linux-nat.c (m32r_linux_fetch_inferior_registers, m32r_linux_store_inferior_registers): Likewise. * m68k-bsd-nat.c (m68kbsd_fetch_inferior_registers, m68kbsd_store_inferior_registers): Likewise. * m68k-linux-nat.c (fetch_register, store_register, m68k_linux_fetch_inferior_registers, m68k_linux_store_inferior_registers): Likewise. * m88k-bsd-nat.c (m88kbsd_fetch_inferior_registers, m88kbsd_store_inferior_registers): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers, mips_fbsd_store_inferior_registers): Likewise. * mips-linux-nat.c (mips64_linux_regsets_fetch_registers, mips64_linux_regsets_store_registers): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers, mipsnbsd_store_inferior_registers): Likewise. * mips-obsd-nat.c (mips64obsd_fetch_inferior_registers, mips64obsd_store_inferior_registers): Likewise. * nto-procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers, ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (ppc_linux_fetch_inferior_registers, ppc_linux_store_inferior_registers): Likewise. * ppc-nbsd-nat.c (ppcnbsd_fetch_inferior_registers, ppcnbsd_store_inferior_registers): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers, ppcobsd_store_registers): Likewise. * procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers, ravenscar_store_registers, ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers, record_btrace_store_registers, record_btrace_prepare_to_store): Likewise. * remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Lookup inferior using ptid from regcache, instead of current_inferior. * remote.c (remote_fetch_registers, remote_store_registers): Use ptid from regcache. * rs6000-nat.c (fetch_register, store_register): Likewise. * s390-linux-nat.c (s390_linux_fetch_inferior_registers, s390_linux_store_inferior_registers): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Likewise. * sol-thread.c (sol_thread_fetch_registers, sol_thread_store_registers): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers, sparc_store_inferior_registers): Likewise. * tilegx-linux-nat.c (fetch_inferior_registers, store_inferior_registers): Likewise. * vax-bsd-nat.c (vaxbsd_fetch_inferior_registers, vaxbsd_store_inferior_registers): Likewise. * xtensa-linux-nat.c (fetch_gregs, store_gregs, fetch_xtregs, store_xtregs): Likewise.
2017-03-20 22:37:36 +01:00
ptid_t ptid = regcache_get_ptid (regcache);
if (!ravenscar_runtime_initialized ()
Use ptid from regcache in almost all remaining nat files This patch contains almost all of the remaining changes needed to make to_fetch_registers/to_store_registers/to_prepare_to_store independent of inferior_ptid. It contains only some "trivial" changes, the more complicated ones are in separate patches. gdb/ChangeLog: * i386-linux-nat.c (fetch_register, store_register, i386_linux_fetch_inferior_registers, i386_linux_store_inferior_registers): Use ptid from regcache. * ia64-linux-nat.c (ia64_linux_fetch_register, ia64_linux_store_register): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register, inf_ptrace_store_register): Likewise. * m32r-linux-nat.c (m32r_linux_fetch_inferior_registers, m32r_linux_store_inferior_registers): Likewise. * m68k-bsd-nat.c (m68kbsd_fetch_inferior_registers, m68kbsd_store_inferior_registers): Likewise. * m68k-linux-nat.c (fetch_register, store_register, m68k_linux_fetch_inferior_registers, m68k_linux_store_inferior_registers): Likewise. * m88k-bsd-nat.c (m88kbsd_fetch_inferior_registers, m88kbsd_store_inferior_registers): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers, mips_fbsd_store_inferior_registers): Likewise. * mips-linux-nat.c (mips64_linux_regsets_fetch_registers, mips64_linux_regsets_store_registers): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers, mipsnbsd_store_inferior_registers): Likewise. * mips-obsd-nat.c (mips64obsd_fetch_inferior_registers, mips64obsd_store_inferior_registers): Likewise. * nto-procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers, ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (ppc_linux_fetch_inferior_registers, ppc_linux_store_inferior_registers): Likewise. * ppc-nbsd-nat.c (ppcnbsd_fetch_inferior_registers, ppcnbsd_store_inferior_registers): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers, ppcobsd_store_registers): Likewise. * procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers, ravenscar_store_registers, ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers, record_btrace_store_registers, record_btrace_prepare_to_store): Likewise. * remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Lookup inferior using ptid from regcache, instead of current_inferior. * remote.c (remote_fetch_registers, remote_store_registers): Use ptid from regcache. * rs6000-nat.c (fetch_register, store_register): Likewise. * s390-linux-nat.c (s390_linux_fetch_inferior_registers, s390_linux_store_inferior_registers): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Likewise. * sol-thread.c (sol_thread_fetch_registers, sol_thread_store_registers): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers, sparc_store_inferior_registers): Likewise. * tilegx-linux-nat.c (fetch_inferior_registers, store_inferior_registers): Likewise. * vax-bsd-nat.c (vaxbsd_fetch_inferior_registers, vaxbsd_store_inferior_registers): Likewise. * xtensa-linux-nat.c (fetch_gregs, store_gregs, fetch_xtregs, store_xtregs): Likewise.
2017-03-20 22:37:36 +01:00
|| ptid_equal (ptid, base_magic_null_ptid)
|| ptid_equal (ptid, ravenscar_running_thread ()))
beneath->to_store_registers (beneath, regcache, regnum);
else
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct ravenscar_arch_ops *arch_ops
= gdbarch_ravenscar_ops (gdbarch);
arch_ops->to_store_registers (regcache, regnum);
}
}
static void
ravenscar_prepare_to_store (struct target_ops *self,
struct regcache *regcache)
{
struct target_ops *beneath = find_target_beneath (self);
Use ptid from regcache in almost all remaining nat files This patch contains almost all of the remaining changes needed to make to_fetch_registers/to_store_registers/to_prepare_to_store independent of inferior_ptid. It contains only some "trivial" changes, the more complicated ones are in separate patches. gdb/ChangeLog: * i386-linux-nat.c (fetch_register, store_register, i386_linux_fetch_inferior_registers, i386_linux_store_inferior_registers): Use ptid from regcache. * ia64-linux-nat.c (ia64_linux_fetch_register, ia64_linux_store_register): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register, inf_ptrace_store_register): Likewise. * m32r-linux-nat.c (m32r_linux_fetch_inferior_registers, m32r_linux_store_inferior_registers): Likewise. * m68k-bsd-nat.c (m68kbsd_fetch_inferior_registers, m68kbsd_store_inferior_registers): Likewise. * m68k-linux-nat.c (fetch_register, store_register, m68k_linux_fetch_inferior_registers, m68k_linux_store_inferior_registers): Likewise. * m88k-bsd-nat.c (m88kbsd_fetch_inferior_registers, m88kbsd_store_inferior_registers): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers, mips_fbsd_store_inferior_registers): Likewise. * mips-linux-nat.c (mips64_linux_regsets_fetch_registers, mips64_linux_regsets_store_registers): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers, mipsnbsd_store_inferior_registers): Likewise. * mips-obsd-nat.c (mips64obsd_fetch_inferior_registers, mips64obsd_store_inferior_registers): Likewise. * nto-procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers, ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (ppc_linux_fetch_inferior_registers, ppc_linux_store_inferior_registers): Likewise. * ppc-nbsd-nat.c (ppcnbsd_fetch_inferior_registers, ppcnbsd_store_inferior_registers): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers, ppcobsd_store_registers): Likewise. * procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers, ravenscar_store_registers, ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers, record_btrace_store_registers, record_btrace_prepare_to_store): Likewise. * remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Lookup inferior using ptid from regcache, instead of current_inferior. * remote.c (remote_fetch_registers, remote_store_registers): Use ptid from regcache. * rs6000-nat.c (fetch_register, store_register): Likewise. * s390-linux-nat.c (s390_linux_fetch_inferior_registers, s390_linux_store_inferior_registers): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Likewise. * sol-thread.c (sol_thread_fetch_registers, sol_thread_store_registers): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers, sparc_store_inferior_registers): Likewise. * tilegx-linux-nat.c (fetch_inferior_registers, store_inferior_registers): Likewise. * vax-bsd-nat.c (vaxbsd_fetch_inferior_registers, vaxbsd_store_inferior_registers): Likewise. * xtensa-linux-nat.c (fetch_gregs, store_gregs, fetch_xtregs, store_xtregs): Likewise.
2017-03-20 22:37:36 +01:00
ptid_t ptid = regcache_get_ptid (regcache);
if (!ravenscar_runtime_initialized ()
Use ptid from regcache in almost all remaining nat files This patch contains almost all of the remaining changes needed to make to_fetch_registers/to_store_registers/to_prepare_to_store independent of inferior_ptid. It contains only some "trivial" changes, the more complicated ones are in separate patches. gdb/ChangeLog: * i386-linux-nat.c (fetch_register, store_register, i386_linux_fetch_inferior_registers, i386_linux_store_inferior_registers): Use ptid from regcache. * ia64-linux-nat.c (ia64_linux_fetch_register, ia64_linux_store_register): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register, inf_ptrace_store_register): Likewise. * m32r-linux-nat.c (m32r_linux_fetch_inferior_registers, m32r_linux_store_inferior_registers): Likewise. * m68k-bsd-nat.c (m68kbsd_fetch_inferior_registers, m68kbsd_store_inferior_registers): Likewise. * m68k-linux-nat.c (fetch_register, store_register, m68k_linux_fetch_inferior_registers, m68k_linux_store_inferior_registers): Likewise. * m88k-bsd-nat.c (m88kbsd_fetch_inferior_registers, m88kbsd_store_inferior_registers): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers, mips_fbsd_store_inferior_registers): Likewise. * mips-linux-nat.c (mips64_linux_regsets_fetch_registers, mips64_linux_regsets_store_registers): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers, mipsnbsd_store_inferior_registers): Likewise. * mips-obsd-nat.c (mips64obsd_fetch_inferior_registers, mips64obsd_store_inferior_registers): Likewise. * nto-procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers, ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (ppc_linux_fetch_inferior_registers, ppc_linux_store_inferior_registers): Likewise. * ppc-nbsd-nat.c (ppcnbsd_fetch_inferior_registers, ppcnbsd_store_inferior_registers): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers, ppcobsd_store_registers): Likewise. * procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers, ravenscar_store_registers, ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers, record_btrace_store_registers, record_btrace_prepare_to_store): Likewise. * remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Lookup inferior using ptid from regcache, instead of current_inferior. * remote.c (remote_fetch_registers, remote_store_registers): Use ptid from regcache. * rs6000-nat.c (fetch_register, store_register): Likewise. * s390-linux-nat.c (s390_linux_fetch_inferior_registers, s390_linux_store_inferior_registers): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Likewise. * sol-thread.c (sol_thread_fetch_registers, sol_thread_store_registers): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers, sparc_store_inferior_registers): Likewise. * tilegx-linux-nat.c (fetch_inferior_registers, store_inferior_registers): Likewise. * vax-bsd-nat.c (vaxbsd_fetch_inferior_registers, vaxbsd_store_inferior_registers): Likewise. * xtensa-linux-nat.c (fetch_gregs, store_gregs, fetch_xtregs, store_xtregs): Likewise.
2017-03-20 22:37:36 +01:00
|| ptid_equal (ptid, base_magic_null_ptid)
|| ptid_equal (ptid, ravenscar_running_thread ()))
beneath->to_prepare_to_store (beneath, regcache);
else
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct ravenscar_arch_ops *arch_ops
= gdbarch_ravenscar_ops (gdbarch);
arch_ops->to_prepare_to_store (regcache);
}
}
static void
ravenscar_mourn_inferior (struct target_ops *ops)
{
struct target_ops *beneath = find_target_beneath (ops);
base_ptid = null_ptid;
beneath->to_mourn_inferior (beneath);
unpush_target (&ravenscar_ops);
}
/* Observer on inferior_created: push ravenscar thread stratum if needed. */
static void
ravenscar_inferior_created (struct target_ops *target, int from_tty)
{
if (!ravenscar_task_support
|| gdbarch_ravenscar_ops (target_gdbarch ()) == NULL
|| !has_ravenscar_runtime ())
return;
base_magic_null_ptid = inferior_ptid;
ravenscar_update_inferior_ptid ();
push_target (&ravenscar_ops);
}
static ptid_t
ravenscar_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
{
return ptid_build (ptid_get_pid (base_ptid), 0, thread);
}
static void
init_ravenscar_thread_ops (void)
{
ravenscar_ops.to_shortname = "ravenscar";
ravenscar_ops.to_longname = "Ravenscar tasks.";
ravenscar_ops.to_doc = "Ravenscar tasks support.";
ravenscar_ops.to_resume = ravenscar_resume;
ravenscar_ops.to_wait = ravenscar_wait;
ravenscar_ops.to_fetch_registers = ravenscar_fetch_registers;
ravenscar_ops.to_store_registers = ravenscar_store_registers;
ravenscar_ops.to_prepare_to_store = ravenscar_prepare_to_store;
ravenscar_ops.to_thread_alive = ravenscar_thread_alive;
Push pruning old threads down to the target When GDB wants to sync the thread list with the target's (e.g., due to "info threads"), it calls update_thread_list: update_thread_list (void) { prune_threads (); target_find_new_threads (); update_threads_executing (); } And then prune_threads does: prune_threads (void) { struct thread_info *tp, *next; for (tp = thread_list; tp; tp = next) { next = tp->next; if (!thread_alive (tp)) delete_thread (tp->ptid); } } Calling thread_live on each thread one by one is expensive. E.g., on Linux, it ends up doing kill(SIG0) once for each thread. Not a big deal, but still a bunch of syscalls... With the remote target, it's cumbersome. That thread_alive call ends up generating one T packet per thread: Sending packet: $Tp2141.2150#82...Packet received: OK Sending packet: $Tp2141.214f#b7...Packet received: OK Sending packet: $Tp2141.2141#82...Packet received: OK Sending packet: $qXfer:threads:read::0,fff#03...Packet received: l<threads>\n<thread id="p2141.2141" core="2"/>\n<thread id="p2141.214f" core="1"/>\n<thread id="p2141.2150" core="2"/>\n</threads>\n That seems a bit silly when target_find_new_threads method implementations will always fetch the whole current set of target threads, and then add those that are not in GDB's thread list, to GDB's thread list. This patch thus pushes down the responsibility of pruning dead threads to the target_find_new_threads method instead, so a target may implement pruning dead threads however it wants. Once we do that, target_find_new_threads becomes a misnomer, so the patch renames it to target_update_thread_list. The patch doesn't attempt to do any optimization to any target yet. It simply exports prune_threads, and makes all implementations of target_update_thread_list call that. It's meant to be a no-op. gdb/ 2014-10-15 Pedro Alves <palves@redhat.com> * ada-tasks.c (print_ada_task_info, task_command_1): Adjust. * bsd-uthread.c (bsd_uthread_find_new_threads): Rename to ... (bsd_uthread_update_thread_list): ... this. Call prune_threads. (bsd_uthread_target): Adjust. * corelow.c (core_open): Adjust. * dec-thread.c (dec_thread_find_new_threads): Update comment. (dec_thread_update_thread_list): New function. (init_dec_thread_ops): Adjust. * gdbthread.h (prune_threads): New declaration. * linux-thread-db.c (thread_db_find_new_threads): Rename to ... (thread_db_update_thread_list): ... this. Call prune_threads. (init_thread_db_ops): Adjust. * nto-procfs.c (procfs_find_new_threads): Rename to ... (procfs_update_thread_list): ... this. Call prune_threads. (procfs_attach, procfs_create_inferior, init_procfs_targets): Adjust. * obsd-nat.c (obsd_find_new_threads): Rename to ... (obsd_update_thread_list): ... this. Call prune_threads. (obsd_add_target): Adjust. * procfs.c (procfs_target): Adjust. (procfs_notice_thread): Update comment. (procfs_find_new_threads): Rename to ... (procfs_update_thread_list): ... this. Call prune_threads. * ravenscar-thread.c (ravenscar_update_inferior_ptid): Update comment. (ravenscar_wait): Adjust. (ravenscar_find_new_threads): Rename to ... (ravenscar_update_thread_list): ... this. Call prune_threads. (init_ravenscar_thread_ops): Adjust. * record-btrace.c (record_btrace_find_new_threads): Rename to ... (record_btrace_update_thread_list): ... this. Adjust comment. (init_record_btrace_ops): Adjust. * remote.c (remote_threads_info): Rename to ... (remote_update_thread_list): ... this. Call prune_threads. (remote_start_remote, extended_remote_attach_1, init_remote_ops): Adjust. * sol-thread.c (check_for_thread_db): Adjust. (sol_find_new_threads_callback): Rename to ... (sol_update_thread_list_callback): ... this. (sol_find_new_threads): Rename to ... (sol_update_thread_list): ... this. Call prune_threads. Adjust. (sol_get_ada_task_ptid, init_sol_thread_ops): Adjust. * target-delegates.c: Regenerate. * target.c (target_find_new_threads): Rename to ... (target_update_thread_list): ... this. * target.h (struct target_ops): Rename to_find_new_threads field to to_update_thread_list. (target_find_new_threads): Rename to ... (target_update_thread_list): ... this. * thread.c (prune_threads): Make extern. (update_thread_list): Adjust.
2014-10-15 23:44:00 +02:00
ravenscar_ops.to_update_thread_list = ravenscar_update_thread_list;
ravenscar_ops.to_pid_to_str = ravenscar_pid_to_str;
ravenscar_ops.to_extra_thread_info = ravenscar_extra_thread_info;
ravenscar_ops.to_get_ada_task_ptid = ravenscar_get_ada_task_ptid;
ravenscar_ops.to_mourn_inferior = ravenscar_mourn_inferior;
ravenscar_ops.to_has_all_memory = default_child_has_all_memory;
ravenscar_ops.to_has_memory = default_child_has_memory;
ravenscar_ops.to_has_stack = default_child_has_stack;
ravenscar_ops.to_has_registers = default_child_has_registers;
ravenscar_ops.to_has_execution = default_child_has_execution;
ravenscar_ops.to_stratum = thread_stratum;
ravenscar_ops.to_magic = OPS_MAGIC;
}
/* Command-list for the "set/show ravenscar" prefix command. */
static struct cmd_list_element *set_ravenscar_list;
static struct cmd_list_element *show_ravenscar_list;
/* Implement the "set ravenscar" prefix command. */
static void
Constify add_prefix_cmd This changes add_prefix_cmd to accept a const-taking function as an argument; then fixes up all the callers. In a couple of spots I had to add a non-const overload of a function, because the function is passed to two different command-adding "constructors". These overloads are temporary; once constification is complete they can be removed. This patch also fixes a typo I happened to notice while constifying. Note that this touches a couple of files (gnu-nat.c and go32-nat.c) that I can't build. So, while I made a best-effort there, I am not certain they will still compile. Tested by rebuilding. gdb/ChangeLog 2017-10-11 Tom Tromey <tom@tromey.com> * gdbthread.h (thread_command): Constify. * inferior.h (detach_command): Constify. * top.h (set_history, show_history): Constify. * arm-tdep.c (set_arm_command, show_arm_command): Constify. * serial.c (serial_set_cmd, serial_show_cmd): Constify. * bsd-kvm.c (bsd_kvm_cmd): Constify. * printcmd.c (set_command): Constify. (non_const_set_command): New function. * dcache.c (set_dcache_command, show_dcache_command): Constify. * breakpoint.c (enable_command, disable_command, delete_command) (catch_command, tcatch_command, set_breakpoint_cmd) (show_breakpoint_cmd): Constify. * macrocmd.c (macro_command): Constify. * infcmd.c (unset_command, kill_command, detach_command) (info_proc_cmd): Constify. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Constify. * auto-load.c (show_auto_load_cmd, set_auto_load_cmd) (info_auto_load_cmd): Constify. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Constify. * ada-lang.c (set_ada_command, show_ada_command) (maint_set_ada_cmd, maint_show_ada_cmd): Constify. * guile/guile.c (set_guile_command, show_guile_command) (info_guile_command): Constify. * tui/tui-win.c (tui_command, set_tui_cmd, show_tui_cmd): Constify. * skip.c (skip_command): Constify. * compile/compile.c (_initialize_compile): Constify. * dwarf2read.c (set_dwarf_cmd, show_dwarf_cmd): Constify. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd): Constify. * remote.c (set_remote_cmd, show_remote_cmd, remote_command): Constify. * python/python.c (user_show_python, user_set_python): Constify. * mips-tdep.c (set_mips_command, show_mips_command) (set_mipsfpu_command): Constify. * record-btrace.c (cmd_record_btrace_start) (cmd_set_record_btrace, cmd_show_record_btrace) (cmd_set_record_btrace_bts, cmd_show_record_btrace_bts) (cmd_set_record_btrace_pt, cmd_show_record_btrace_pt): Constify. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command): Constify. * symfile.c (overlay_command): Constify. * spu-tdep.c (set_spu_command, show_spu_command): Constify. * cli/cli-logging.c (set_logging_command, show_logging_command): Constify. * cli/cli-dump.c (dump_command, append_command) (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * cli/cli-cmds.c (info_command, show_command, set_debug) (show_debug): Constify. (show_command): Add non-const overload. * top.c (set_history, show_history): Constify. * sh-tdep.c (set_sh_command, show_sh_command): Constify. * command.h (add_prefix_cmd): Accept a cmd_const_cfunc_ftype. * target.c (target_command): Constify. * sparc64-tdep.c (info_adi_command): Constify. * record-full.c (cmd_record_full_start): Constify. (set_record_full_command): Constify. Fix typo. (show_record_full_command): Constify. * thread.c (thread_command, thread_apply_command): Constify. * memattr.c (dummy_cmd): Constify. * value.c (function_command): Constify. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Constify. * probe.c (info_probes_command): Constify. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Constify. * gnu-nat.c (set_task_cmd, show_task_cmd, set_thread_cmd) (show_thread_cmd, set_thread_default_cmd) (show_thread_default_cmd): Constify. (check_empty): Constify. * tracepoint.c (tfind_command): Constify. * cp-support.c (maint_cplus_command): Constify. * windows-tdep.c (info_w32_command): Constify. * record.c (cmd_record_start, set_record_command) (show_record_command, info_record_command, cmd_record_goto): Constify. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Constify. * utils.c (set_internal_problem_cmd, show_internal_problem_cmd): Constify. (add_internal_problem_command): Remove casts. * arc-tdep.c (maintenance_print_arc_command): Constify. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Constify. * maint.c (maintenance_command, maintenance_info_command) (maintenance_print_command, maintenance_set_cmd) (maintenance_show_cmd, set_per_command_cmd) (show_per_command_cmd, maintenance_check_command): Constify. * language.c (set_check, show_check): Constify. * typeprint.c (show_print_type, set_print_type): Constify. * go32-nat.c (go32_info_dos_command): Constify.
2017-09-26 06:28:30 +02:00
set_ravenscar_command (const char *arg, int from_tty)
{
printf_unfiltered (_(\
"\"set ravenscar\" must be followed by the name of a setting.\n"));
make calls to help_list use enumerator Currently there are many calls to help_list that pass the constant -1 as the "class" value. However, the parameter is declared as being of type enum command_class, and uses of the constant violate this abstraction. This patch fixes the error everywhere it occurs in the gdb sources. Tested by rebuilding. 2014-06-13 Tom Tromey <tromey@redhat.com> * cp-support.c (maint_cplus_command): Pass all_commands, not -1, to help_list. * guile/guile.c (info_guile_command): Pass all_commands, not -1, to help_list. * tui/tui-win.c (tui_command): Pass all_commands, not -1, to help_list. * tui/tui-regs.c (tui_reg_command): Pass all_commands, not -1, to help_list.Pass all_commands, not -1, to help_list. * cli/cli-dump.c (dump_command, append_command) (srec_dump_command, ihex_dump_command, tekhex_dump_command) (binary_dump_command, binary_append_command): Pass all_commands, not -1, to help_list. * cli/cli-cmds.c (info_command, set_debug): Pass all_commands, not -1, to help_list. * valprint.c (set_print, set_print_raw): Pass all_commands, not -1, to help_list. * typeprint.c (set_print_type): Pass all_commands, not -1, to help_list. * top.c (set_history): Pass all_commands, not -1, to help_list. * target-descriptions.c (set_tdesc_cmd, unset_tdesc_cmd): Pass all_commands, not -1, to help_list. * symfile.c (overlay_command): Pass all_commands, not -1, to help_list. * spu-tdep.c (info_spu_command): Pass all_commands, not -1, to help_list. * serial.c (serial_set_cmd): Pass all_commands, not -1, to help_list. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Pass all_commands, not -1, to help_list. * remote.c (remote_command, set_remote_cmd): Pass all_commands, not -1, to help_list. * ravenscar-thread.c (set_ravenscar_command): Pass all_commands, not -1, to help_list. * maint.c (maintenance_command, maintenance_info_command) (maintenance_print_command, maintenance_set_cmd): Pass all_commands, not -1, to help_list. * macrocmd.c (macro_command): Pass all_commands, not -1, to help_list. * language.c (set_check): Pass all_commands, not -1, to help_list. * infcmd.c (unset_command): Pass all_commands, not -1, to help_list. * frame.c (set_backtrace_cmd): Pass all_commands, not -1, to help_list. * dwarf2read.c (set_dwarf2_cmd): Pass all_commands, not -1, to help_list. * dcache.c (set_dcache_command): Pass all_commands, not -1, to help_list. * breakpoint.c (save_command): Pass all_commands, not -1, to help_list. * ada-lang.c (maint_set_ada_cmd, set_ada_command): Pass all_commands, not -1, to help_list.
2014-06-05 16:25:00 +02:00
help_list (set_ravenscar_list, "set ravenscar ", all_commands, gdb_stdout);
}
/* Implement the "show ravenscar" prefix command. */
static void
Constify add_prefix_cmd This changes add_prefix_cmd to accept a const-taking function as an argument; then fixes up all the callers. In a couple of spots I had to add a non-const overload of a function, because the function is passed to two different command-adding "constructors". These overloads are temporary; once constification is complete they can be removed. This patch also fixes a typo I happened to notice while constifying. Note that this touches a couple of files (gnu-nat.c and go32-nat.c) that I can't build. So, while I made a best-effort there, I am not certain they will still compile. Tested by rebuilding. gdb/ChangeLog 2017-10-11 Tom Tromey <tom@tromey.com> * gdbthread.h (thread_command): Constify. * inferior.h (detach_command): Constify. * top.h (set_history, show_history): Constify. * arm-tdep.c (set_arm_command, show_arm_command): Constify. * serial.c (serial_set_cmd, serial_show_cmd): Constify. * bsd-kvm.c (bsd_kvm_cmd): Constify. * printcmd.c (set_command): Constify. (non_const_set_command): New function. * dcache.c (set_dcache_command, show_dcache_command): Constify. * breakpoint.c (enable_command, disable_command, delete_command) (catch_command, tcatch_command, set_breakpoint_cmd) (show_breakpoint_cmd): Constify. * macrocmd.c (macro_command): Constify. * infcmd.c (unset_command, kill_command, detach_command) (info_proc_cmd): Constify. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Constify. * auto-load.c (show_auto_load_cmd, set_auto_load_cmd) (info_auto_load_cmd): Constify. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Constify. * ada-lang.c (set_ada_command, show_ada_command) (maint_set_ada_cmd, maint_show_ada_cmd): Constify. * guile/guile.c (set_guile_command, show_guile_command) (info_guile_command): Constify. * tui/tui-win.c (tui_command, set_tui_cmd, show_tui_cmd): Constify. * skip.c (skip_command): Constify. * compile/compile.c (_initialize_compile): Constify. * dwarf2read.c (set_dwarf_cmd, show_dwarf_cmd): Constify. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd): Constify. * remote.c (set_remote_cmd, show_remote_cmd, remote_command): Constify. * python/python.c (user_show_python, user_set_python): Constify. * mips-tdep.c (set_mips_command, show_mips_command) (set_mipsfpu_command): Constify. * record-btrace.c (cmd_record_btrace_start) (cmd_set_record_btrace, cmd_show_record_btrace) (cmd_set_record_btrace_bts, cmd_show_record_btrace_bts) (cmd_set_record_btrace_pt, cmd_show_record_btrace_pt): Constify. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command): Constify. * symfile.c (overlay_command): Constify. * spu-tdep.c (set_spu_command, show_spu_command): Constify. * cli/cli-logging.c (set_logging_command, show_logging_command): Constify. * cli/cli-dump.c (dump_command, append_command) (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * cli/cli-cmds.c (info_command, show_command, set_debug) (show_debug): Constify. (show_command): Add non-const overload. * top.c (set_history, show_history): Constify. * sh-tdep.c (set_sh_command, show_sh_command): Constify. * command.h (add_prefix_cmd): Accept a cmd_const_cfunc_ftype. * target.c (target_command): Constify. * sparc64-tdep.c (info_adi_command): Constify. * record-full.c (cmd_record_full_start): Constify. (set_record_full_command): Constify. Fix typo. (show_record_full_command): Constify. * thread.c (thread_command, thread_apply_command): Constify. * memattr.c (dummy_cmd): Constify. * value.c (function_command): Constify. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Constify. * probe.c (info_probes_command): Constify. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Constify. * gnu-nat.c (set_task_cmd, show_task_cmd, set_thread_cmd) (show_thread_cmd, set_thread_default_cmd) (show_thread_default_cmd): Constify. (check_empty): Constify. * tracepoint.c (tfind_command): Constify. * cp-support.c (maint_cplus_command): Constify. * windows-tdep.c (info_w32_command): Constify. * record.c (cmd_record_start, set_record_command) (show_record_command, info_record_command, cmd_record_goto): Constify. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Constify. * utils.c (set_internal_problem_cmd, show_internal_problem_cmd): Constify. (add_internal_problem_command): Remove casts. * arc-tdep.c (maintenance_print_arc_command): Constify. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Constify. * maint.c (maintenance_command, maintenance_info_command) (maintenance_print_command, maintenance_set_cmd) (maintenance_show_cmd, set_per_command_cmd) (show_per_command_cmd, maintenance_check_command): Constify. * language.c (set_check, show_check): Constify. * typeprint.c (show_print_type, set_print_type): Constify. * go32-nat.c (go32_info_dos_command): Constify.
2017-09-26 06:28:30 +02:00
show_ravenscar_command (const char *args, int from_tty)
{
cmd_show_list (show_ravenscar_list, from_tty, "");
}
/* Implement the "show ravenscar task-switching" command. */
static void
show_ravenscar_task_switching_command (struct ui_file *file, int from_tty,
struct cmd_list_element *c,
const char *value)
{
if (ravenscar_task_support)
fprintf_filtered (file, _("\
Support for Ravenscar task/thread switching is enabled\n"));
else
fprintf_filtered (file, _("\
Support for Ravenscar task/thread switching is disabled\n"));
}
/* Module startup initialization function, automagically called by
init.c. */
void
_initialize_ravenscar (void)
{
init_ravenscar_thread_ops ();
base_ptid = null_ptid;
/* Notice when the inferior is created in order to push the
ravenscar ops if needed. */
observer_attach_inferior_created (ravenscar_inferior_created);
complete_target_initialization (&ravenscar_ops);
add_prefix_cmd ("ravenscar", no_class, set_ravenscar_command,
_("Prefix command for changing Ravenscar-specific settings"),
&set_ravenscar_list, "set ravenscar ", 0, &setlist);
add_prefix_cmd ("ravenscar", no_class, show_ravenscar_command,
_("Prefix command for showing Ravenscar-specific settings"),
&show_ravenscar_list, "show ravenscar ", 0, &showlist);
add_setshow_boolean_cmd ("task-switching", class_obscure,
&ravenscar_task_support, _("\
Enable or disable support for GNAT Ravenscar tasks"), _("\
Show whether support for GNAT Ravenscar tasks is enabled"),
_("\
Enable or disable support for task/thread switching with the GNAT\n\
Ravenscar run-time library for bareboard configuration."),
NULL, show_ravenscar_task_switching_command,
&set_ravenscar_list, &show_ravenscar_list);
}