1999-04-16 03:35:26 +02:00
|
|
|
|
/* Core dump and executable file functions below target vector, for GDB.
|
2003-10-23 05:01:55 +02:00
|
|
|
|
|
2017-01-01 07:50:51 +01:00
|
|
|
|
Copyright (C) 1986-2017 Free Software Foundation, Inc.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
|
This file is part of GDB.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-08-23 20:08:50 +02:00
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
1999-07-07 22:19:36 +02:00
|
|
|
|
(at your option) any later version.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-23 20:08:50 +02:00
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
2003-10-29 21:59:07 +01:00
|
|
|
|
#include "arch-utils.h"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
#include <signal.h>
|
|
|
|
|
#include <fcntl.h>
|
2001-02-14 19:48:40 +01:00
|
|
|
|
#ifdef HAVE_SYS_FILE_H
|
|
|
|
|
#include <sys/file.h> /* needed for F_OK and friends */
|
|
|
|
|
#endif
|
1999-07-07 22:19:36 +02:00
|
|
|
|
#include "frame.h" /* required by inferior.h */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
#include "inferior.h"
|
Add new infrun.h header.
Move infrun.c declarations out of inferior.h to a new infrun.h file.
Tested by building on:
i686-w64-mingw32, enable-targets=all
x86_64-linux, enable-targets=all
i586-pc-msdosdjgpp
And also grepped the whole tree for each symbol moved to find where
infrun.h might be necessary.
gdb/
2014-05-22 Pedro Alves <palves@redhat.com>
* inferior.h (debug_infrun, debug_displaced, stop_on_solib_events)
(sync_execution, sched_multi, step_stop_if_no_debug, non_stop)
(disable_randomization, enum exec_direction_kind)
(execution_direction, stop_registers, start_remote)
(clear_proceed_status, proceed, resume, user_visible_resume_ptid)
(wait_for_inferior, normal_stop, get_last_target_status)
(prepare_for_detach, fetch_inferior_event, init_wait_for_inferior)
(insert_step_resume_breakpoint_at_sal)
(follow_inferior_reset_breakpoints, stepping_past_instruction_at)
(set_step_info, print_stop_event, signal_stop_state)
(signal_print_state, signal_pass_state, signal_stop_update)
(signal_print_update, signal_pass_update)
(update_signals_program_target, clear_exit_convenience_vars)
(displaced_step_dump_bytes, update_observer_mode)
(signal_catch_update, gdb_signal_from_command): Move
declarations ...
* infrun.h: ... to this new file.
* amd64-tdep.c: Include infrun.h.
* annotate.c: Include infrun.h.
* arch-utils.c: Include infrun.h.
* arm-linux-tdep.c: Include infrun.h.
* arm-tdep.c: Include infrun.h.
* break-catch-sig.c: Include infrun.h.
* breakpoint.c: Include infrun.h.
* common/agent.c: Include infrun.h instead of inferior.h.
* corelow.c: Include infrun.h.
* event-top.c: Include infrun.h.
* go32-nat.c: Include infrun.h.
* i386-tdep.c: Include infrun.h.
* inf-loop.c: Include infrun.h.
* infcall.c: Include infrun.h.
* infcmd.c: Include infrun.h.
* infrun.c: Include infrun.h.
* linux-fork.c: Include infrun.h.
* linux-nat.c: Include infrun.h.
* linux-thread-db.c: Include infrun.h.
* monitor.c: Include infrun.h.
* nto-tdep.c: Include infrun.h.
* procfs.c: Include infrun.h.
* record-btrace.c: Include infrun.h.
* record-full.c: Include infrun.h.
* remote-m32r-sdi.c: Include infrun.h.
* remote-mips.c: Include infrun.h.
* remote-notif.c: Include infrun.h.
* remote-sim.c: Include infrun.h.
* remote.c: Include infrun.h.
* reverse.c: Include infrun.h.
* rs6000-tdep.c: Include infrun.h.
* s390-linux-tdep.c: Include infrun.h.
* solib-irix.c: Include infrun.h.
* solib-osf.c: Include infrun.h.
* solib-svr4.c: Include infrun.h.
* target.c: Include infrun.h.
* top.c: Include infrun.h.
* windows-nat.c: Include infrun.h.
* mi/mi-interp.c: Include infrun.h.
* mi/mi-main.c: Include infrun.h.
* python/py-threadevent.c: Include infrun.h.
2014-05-22 13:29:11 +02:00
|
|
|
|
#include "infrun.h"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
#include "symtab.h"
|
|
|
|
|
#include "command.h"
|
|
|
|
|
#include "bfd.h"
|
|
|
|
|
#include "target.h"
|
|
|
|
|
#include "gdbcore.h"
|
|
|
|
|
#include "gdbthread.h"
|
2001-03-01 02:39:22 +01:00
|
|
|
|
#include "regcache.h"
|
2003-10-29 21:59:07 +01:00
|
|
|
|
#include "regset.h"
|
2001-11-01 17:17:08 +01:00
|
|
|
|
#include "symfile.h"
|
2003-10-23 05:01:55 +02:00
|
|
|
|
#include "exec.h"
|
2004-02-28 Andrew Cagney <cagney@redhat.com>
* utils.c: Use "", instead of <>, to include readline.
tui/tui-win.c, tui/tui.c, tui/tui-hooks.c: Ditto.
* tracepoint.c, top.c, symmisc.c, symfile.c: Ditto.
* source.c, solib.c, exec.c, event-top.c: Ditto.
* corelow.c, completer.c, cli/cli-setshow.c: Ditto.
* cli/cli-dump.c, cli/cli-cmds.c: Ditto.
* Makefile.in: Update all dependencies.
(readline_tilde_h, readline_history_h): Define.
(readline_headers): Delete.
2004-02-28 19:04:37 +01:00
|
|
|
|
#include "readline/readline.h"
|
* solib.h (CLEAR_SOLIB, SOLIB_ADD)
(SOLIB_CREATE_INFERIOR_HOOK, SOLIB_REMOVE_INFERIOR_HOOK)
(SOLIB_IN_DYNAMIC_LINKER, SOLIB_RESTART)
(DISABLE_UNSETTABLE_BREAK, PC_SOLIB)
(IN_SOLIB_DYNSYM_RESOLVE_CODE): Remove defines and orphaned
comments.
* breakpoint.c: Include "solib.h".
(insert_bp_location) [!DISABLE_UNSETTABLE_BREAK]: Call
solib_address.
(remove_solib_event_breakpoints, create_solib_event_breakpoint)
(disable_breakpoints_in_shlibs)
(disable_breakpoints_in_unloaded_shlib)
(re_enable_breakpoints_in_shlibs): Compile if SOLIB_ADD isn't
defined. If PC_SOLIB isn't defined, call solib_address.
(_initialize_breakpoint): Unconditionally install observer.
* corelow.c: Include "solib.h".
[SOLIB_ADD] (solib_add_stub): Remove prototype.
(core_close) [!CLEAR_SOLIB]: Call clear_solib.
(solib_add_stub) [!SOLIB_ADD] Call solib_add.
(core_open): Unconditionally call solib_add_stub.
* fork-child.c: Include "solib.h".
(fork_inferior) [!SOLIB_CREATE_INFERIOR_HOOK]: Call
solib_create_inferior_hook.
* infcmd.c: Include "solib.h".
(attach_command) [!SOLIB_ADD]: Call shlib_rescan. Unconditionally
call re_enable_breakpoints_in_shlibs.
* infrun.c: Include "solib.h".
(SOLIB_IN_SYNSYM_RESOLVE_CODE): Don't define if not already
defined.
(stop_on_solib_events, show_stop_on_solib_events): Include
unconditionally.
(follow_exec) [!SOLIB_CREATE_INFERIOR_HOOK]: Call
solib_create_inferior_hook.
(handle_inferior_event) [!SOLIB_ADD]: Call shlib_add.
[!IN_SOLIB_DYNSYM_RESOLVE_CODE]: Call in_solib_dynsym_resolve_code.
(_initialize_infrun): Unconditionally add "stop_on_solib-events"
command.
* remote.c: Include "solib.h".
(remote_open_1): Unconditionally call no_shared_libraries.
[!SOLIB_CREATE_INFERIOR_HOOK] Call solib_create_inferior_hook.
* stack.c: Include "solib.h".
(print_frame) [!PC_SOLIB] Call shlib_for_pc.
* xcoffsolib.c (no_shared_libraries): Remove function.
* Makefile.in (SFILES): Add solib.c.
(ALLDEPFILES): Remove solib.c.
(COMMON_OBS): Add solib.o.
(breakpoint.o, corelow.o, fork-chiled.o, infcmd.o, infrun.o)
(remote.o, stack.o): Update dependencies.
2005-05-12 22:21:18 +02:00
|
|
|
|
#include "solib.h"
|
2008-02-09 14:45:33 +01:00
|
|
|
|
#include "filenames.h"
|
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
Add base multi-executable/process support to GDB.
gdb/
* Makefile.in (SFILES): Add progspace.c.
(COMMON_OBS): Add progspace.o.
* progspace.h: New.
* progspace.c: New.
* breakpoint.h (struct bp_target_info) <placed_address_space>: New
field.
(struct bp_location) <pspace>: New field.
(struct breakpoint) <pspace>: New field.
(bpstat_stop_status, breakpoint_here_p)
(moribund_breakpoint_here_p, breakpoint_inserted_here_p)
(regular_breakpoint_inserted_here_p)
(software_breakpoint_inserted_here_p, breakpoint_thread_match)
(set_default_breakpoint): Adjust prototypes.
(remove_breakpoints_pid, breakpoint_program_space_exit): Declare.
(insert_single_step_breakpoint, deprecated_insert_raw_breakpoint):
Adjust prototypes.
* breakpoint.c (executing_startup): Delete.
(default_breakpoint_sspace): New.
(breakpoint_restore_shadows): Skip if the address space doesn't
match.
(update_watchpoint): Record the frame's program space in the
breakpoint location.
(insert_bp_location): Record the address space in target_info.
Adjust to pass the symbol space to solib_name_from_address.
(breakpoint_program_space_exit): New.
(insert_breakpoint_locations): Switch the symbol space and thread
when inserting breakpoints. Don't insert breakpoints in a vfork
parent waiting for vfork done if we're not attached to the vfork
child.
(remove_breakpoints_pid): New.
(reattach_breakpoints): Switch to a thread of PID. Ignore
breakpoints of other symbol spaces.
(create_internal_breakpoint): Store the symbol space in the sal.
(create_longjmp_master_breakpoint): Iterate over all symbol
spaces.
(update_breakpoints_after_exec): Ignore breakpoints for other
symbol spaces.
(remove_breakpoint): Rename to ...
(remove_breakpoint_1): ... this. Pass the breakpoints symbol
space to solib_name_from_address.
(remove_breakpoint): New.
(mark_breakpoints_out): Ignore breakpoints from other symbol
spaces.
(breakpoint_init_inferior): Ditto.
(breakpoint_here_p): Add an address space argument and adjust to
use breakpoint_address_match.
(moribund_breakpoint_here_p): Ditto.
(regular_breakpoint_inserted_here_p): Ditto.
(breakpoint_inserted_here_p): Ditto.
(software_breakpoint_inserted_here_p): Ditto.
(breakpoint_thread_match): Ditto.
(bpstat_check_location): Ditto.
(bpstat_stop_status): Ditto.
(print_breakpoint_location): If there's a location to print,
switch the current symbol space.
(print_one_breakpoint_location): Add `allflag' argument.
(print_one_breakpoint): Ditto. Adjust.
(do_captured_breakpoint_query): Adjust.
(breakpoint_1): Adjust.
(breakpoint_has_pc): Also match the symbol space.
(describe_other_breakpoints): Add a symbol space argument and
adjust.
(set_default_breakpoint): Add a symbol space argument. Set
default_breakpoint_sspace.
(breakpoint_address_match): New.
(check_duplicates_for): Add an address space argument, and adjust.
(set_raw_breakpoint): Record the symbol space in the location and
in the breakpoint.
(set_longjmp_breakpoint): Skip longjmp master breakpoints from
other symbol spaces.
(remove_thread_event_breakpoints, remove_solib_event_breakpoints)
(disable_breakpoints_in_shlibs): Skip breakpoints from other
symbol spaces.
(disable_breakpoints_in_unloaded_shlib): Match symbol spaces.
(create_catchpoint): Set the symbol space in the sal.
(disable_breakpoints_before_startup): Skip breakpoints from other
symbol spaces. Set executing_startup in the current symbol space.
(enable_breakpoints_after_startup): Clear executing_startup in the
current symbol space. Skip breakpoints from other symbol spaces.
(clone_momentary_breakpoint): Also copy the symbol space.
(add_location_to_breakpoint): Set the location's symbol space.
(bp_loc_is_permanent): Switch thread and symbol space.
(create_breakpoint): Adjust.
(expand_line_sal_maybe): Expand comment to mention symbol spaces.
Switch thread and symbol space when reading memory.
(parse_breakpoint_sals): Set the symbol space in the sal.
(break_command_really): Ditto.
(skip_prologue_sal): Switch and space.
(resolve_sal_pc): Ditto.
(watch_command_1): Record the symbol space in the sal.
(create_ada_exception_breakpoint): Adjust.
(clear_command): Adjust. Match symbol spaces.
(update_global_location_list): Use breakpoint_address_match.
(breakpoint_re_set_one): Switch thread and space.
(breakpoint_re_set): Save symbol space.
(breakpoint_re_set_thread): Also reset the symbol space.
(deprecated_insert_raw_breakpoint): Add an address space argument.
Adjust.
(insert_single_step_breakpoint): Ditto.
(single_step_breakpoint_inserted_here_p): Ditto.
(clear_syscall_counts): New.
(_initialize_breakpoint): Install it as inferior_exit observer.
* exec.h: Include "progspace.h".
(exec_bfd, exec_bfd_mtime): New defines.
(exec_close): Declare.
* exec.c: Include "gdbthread.h" and "progspace.h".
(exec_bfd, exec_bfd_mtime, current_target_sections_1): Delete.
(using_exec_ops): New.
(exec_close_1): Rename to exec_close, and make public.
(exec_close): Rename to exec_close_1, and adjust all callers. Add
description. Remove target sections and close executables from
all program spaces.
(exec_file_attach): Add comment.
(add_target_sections): Check on `using_exec_ops' to check if the
target should be pushed.
(remove_target_sections): Only unpush the target if there are no
more target sections in any symbol space.
* gdbcore.h: Include "exec.h".
(exec_bfd, exec_bfd_mtime): Remove declarations.
* frame.h (get_frame_program_space, get_frame_address_space)
(frame_unwind_program_space): Declare.
* frame.c (struct frame_info) <pspace, aspace>: New fields.
(create_sentinel_frame): Add program space argument. Set the
pspace and aspace fields of the frame object.
(get_current_frame, create_new_frame): Adjust.
(get_frame_program_space): New.
(frame_unwind_program_space): New.
(get_frame_address_space): New.
* stack.c (print_frame_info): Adjust.
(print_frame): Use the frame's program space.
* gdbthread.h (any_live_thread_of_process): Declare.
* thread.c (any_live_thread_of_process): New.
(switch_to_thread): Switch the program space as well.
(restore_selected_frame): Don't warn if trying to restore frame
level 0.
* inferior.h: Include "progspace.h".
(detach_fork): Declare.
(struct inferior) <removable, aspace, pspace>
<vfork_parent, vfork_child, pending_detach>
<waiting_for_vfork_done>: New fields.
<terminal_info>: Remove field.
<data, num_data>: New fields.
(register_inferior_data, register_inferior_data_with_cleanup)
(clear_inferior_data, set_inferior_data, inferior_data): Declare.
(exit_inferior, exit_inferior_silent, exit_inferior_num_silent)
(inferior_appeared): Declare.
(find_inferior_pid): Typo.
(find_inferior_id, find_inferior_for_program_space): Declare.
(set_current_inferior, save_current_inferior, prune_inferiors)
(number_of_inferiors): Declare.
(inferior_list): Declare.
* inferior.c: Include "gdbcore.h" and "symfile.h".
(inferior_list): Make public.
(delete_inferior_1): Always delete thread silently.
(find_inferior_id): Make public.
(current_inferior_): New.
(current_inferior): Use it.
(set_current_inferior): New.
(restore_inferior): New.
(save_current_inferior): New.
(free_inferior): Free the per-inferior data.
(add_inferior_silent): Allocate per-inferior data.
Call inferior_appeared.
(delete_threads_of_inferior): New.
(delete_inferior_1): Adjust interface to take an inferior pointer.
(delete_inferior): Adjust.
(delete_inferior_silent): Adjust.
(exit_inferior_1): New.
(exit_inferior): New.
(exit_inferior_silent): New.
(exit_inferior_num_silent): New.
(detach_inferior): Adjust.
(inferior_appeared): New.
(discard_all_inferiors): Adjust.
(find_inferior_id): Make public. Assert pid is not zero.
(find_inferior_for_program_space): New.
(have_inferiors): Check if we have any inferior with pid not zero.
(have_live_inferiors): Go over all pushed targets looking for
process_stratum.
(prune_inferiors): New.
(number_of_inferiors): New.
(print_inferior): Add executable column. Print vfork parent/child
relationships.
(inferior_command): Adjust to cope with not running inferiors.
(remove_inferior_command): New.
(add_inferior_command): New.
(clone_inferior_command): New.
(struct inferior_data): New.
(struct inferior_data_registration): New.
(struct inferior_data_registry): New.
(inferior_data_registry): New.
(register_inferior_data_with_cleanup): New.
(register_inferior_data): New.
(inferior_alloc_data): New.
(inferior_free_data): New.
(clear_inferior_data): New.
(set_inferior_data): New.
(inferior_data): New.
(initialize_inferiors): New.
(_initialize_inferiors): Register "add-inferior",
"remove-inferior" and "clone-inferior" commands.
* objfiles.h: Include "progspace.h".
(struct objfile) <pspace>: New field.
(symfile_objfile, object_files): Don't declare.
(ALL_PSPACE_OBJFILES): New.
(ALL_PSPACE_OBJFILES_SAFE): New.
(ALL_OBJFILES, ALL_OBJFILES_SAFE): Adjust.
(ALL_PSPACE_SYMTABS): New.
(ALL_PRIMARY_SYMTABS): Adjust.
(ALL_PSPACE_PRIMARY_SYMTABS): New.
(ALL_PSYMTABS): Adjust.
(ALL_PSPACE_PSYMTABS): New.
* objfiles.c (object_files, symfile_objfile): Delete.
(struct objfile_sspace_info): New.
(objfiles_pspace_data): New.
(objfiles_pspace_data_cleanup): New.
(get_objfile_pspace_data): New.
(objfiles_changed_p): Delete.
(allocate_objfile): Set the objfile's program space. Adjust to
reference objfiles_changed_p in pspace data.
(free_objfile): Adjust to reference objfiles_changed_p in pspace
data.
(objfile_relocate): Ditto.
(update_section_map): Add pspace argument. Adjust to iterate over
objfiles in the passed in pspace.
(find_pc_section): Delete sections and num_sections statics.
Adjust to refer to program space's objfiles_changed_p. Adjust to
refer to sections and num_sections store in the objfile's pspace
data.
(objfiles_changed): Adjust to reference objfiles_changed_p in
pspace data.
(_initialize_objfiles): New.
* linespec.c (decode_all_digits, decode_dollar): Set the sal's
program space.
* source.c (current_source_pspace): New.
(get_current_source_symtab_and_line): Set the sal's program space.
(set_current_source_symtab_and_line): Set current_source_pspace.
(select_source_symtab): Ditto. Use ALL_OBJFILES.
(forget_cached_source_info): Iterate over all program spaces.
* symfile.c (clear_symtab_users): Adjust.
* symmisc.c (print_symbol_bcache_statistics): Iterate over all
program spaces.
(print_objfile_statistics): Ditto.
(maintenance_print_msymbols): Ditto.
(maintenance_print_objfiles): Ditto.
(maintenance_info_symtabs): Ditto.
(maintenance_info_psymtabs): Ditto.
* symtab.h (SYMTAB_PSPACE): New.
(struct symtab_and_line) <pspace>: New field.
* symtab.c (init_sal): Clear the sal's program space.
(find_pc_sect_symtab): Set the sal's program space. Switch thread
and space.
(append_expanded_sal): Add program space argument. Iterate over
all program spaces.
(expand_line_sal): Iterate over all program spaces. Switch
program space.
* target.h (enum target_waitkind) <TARGET_WAITKIND_VFORK_DONE>: New.
(struct target_ops) <to_thread_address_space>: New field.
(target_thread_address_space): Define.
* target.c (target_detach): Only remove breakpoints from the
inferior we're detaching.
(target_thread_address_space): New.
* defs.h (initialize_progspace): Declare.
* top.c (gdb_init): Call it.
* solist.h (struct so_list) <sspace>: New field.
* solib.h (struct program_space): Forward declare.
(solib_name_from_address): Adjust prototype.
* solib.c (so_list_head): Replace with a macro referencing the
program space.
(update_solib_list): Set the so's program space.
(solib_name_from_address): Add a program space argument and adjust.
* solib-svr4.c (struct svr4_info) <pid>: Delete field.
<interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low>
<interp_plt_sect_high>: New fields.
(svr4_info_p, svr4_info): Delete.
(solib_svr4_sspace_data): New.
(get_svr4_info): Rewrite.
(svr4_sspace_data_cleanup): New.
(open_symbol_file_object): Adjust.
(svr4_default_sos): Adjust.
(svr4_fetch_objfile_link_map): Adjust.
(interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low)
(interp_plt_sect_high): Delete.
(svr4_in_dynsym_resolve_code): Adjust.
(enable_break): Adjust.
(svr4_clear_solib): Revert bit that removed the svr4_info here,
and reinstate clearing debug_base, debug_loader_offset_p,
debug_loader_offset and debug_loader_name.
(_initialize_svr4_solib): Register solib_svr4_pspace_data. Don't
install an inferior_exit observer anymore.
* printcmd.c (struct display) <pspace>: New field.
(display_command): Set the display's sspace.
(do_one_display): Match the display's sspace.
(display_uses_solib_p): Ditto.
* linux-fork.c (detach_fork): Moved to infrun.c.
(_initialize_linux_fork): Moved "detach-on-fork" command to
infrun.c.
* infrun.c (detach_fork): Moved from linux-fork.c.
(proceed_after_vfork_done): New.
(handle_vfork_child_exec_or_exit): New.
(follow_exec_mode_replace, follow_exec_mode_keep)
(follow_exec_mode_names, follow_exec_mode_string)
(show_follow_exec_mode_string): New.
(follow_exec): New. Reinstate the mark_breakpoints_out call.
Remove shared libraries before attaching new executable. If user
wants to keep the inferior, keep it.
(displaced_step_fixup): Adjust to pass an address space to the
breakpoints module.
(resume): Ditto.
(clear_proceed_status): In all-stop mode, always clear the proceed
status of all threads.
(prepare_to_proceed): Adjust to pass an address space to the
breakpoints module.
(proceed): Ditto.
(adjust_pc_after_break): Ditto.
(handle_inferior_event): When handling a process exit, switch the
program space to the inferior's that had exited. Call
handle_vfork_child_exec_or_exit. Adjust to pass an address space
to the breakpoints module. In non-stop mode, when following a
fork and detach-fork is off, also resume the other branch. Handle
TARGET_WAITKIND_VFORK_DONE. Set the program space in sals.
(normal_stop): Prune inferiors.
(_initialize_infrun): Install the new "follow-exec-mode" command.
"detach-on-fork" moved here.
* regcache.h (get_regcache_aspace): Declare.
* regcache.c (struct regcache) <aspace>: New field.
(regcache_xmalloc): Clear the aspace.
(get_regcache_aspace): New.
(regcache_cpy): Copy the aspace field.
(regcache_cpy_no_passthrough): Ditto.
(get_thread_regcache): Fetch the thread's address space from the
target, and store it in the regcache.
* infcall.c (call_function_by_hand): Set the sal's pspace.
* arch-utils.c (default_has_shared_address_space): New.
* arch-utils.h (default_has_shared_address_space): Declare.
* gdbarch.sh (has_shared_address_space): New.
* gdbarch.h, gdbarch.c: Regenerate.
* linux-tdep.c: Include auxv.h, target.h, elf/common.h.
(linux_has_shared_address_space): New.
(_initialize_linux_tdep): Declare.
* arm-tdep.c (arm_software_single_step): Pass the frame's address
space to insert_single_step_breakpoint.
* arm-linux-tdep.c (arm_linux_software_single_step): Pass the
frame's pspace to breakpoint functions.
* cris-tdep.c (crisv32_single_step_through_delay): Ditto.
(cris_software_single_step): Ditto.
* mips-tdep.c (deal_with_atomic_sequence): Add frame argument.
Pass the frame's pspace to breakpoint functions.
(mips_software_single_step): Adjust.
(mips_single_step_through_delay): Adjust.
* rs6000-aix-tdep.c (rs6000_software_single_step): Adjust.
* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust.
* solib-irix.c (enable_break): Adjust to pass the current frame's
address space to breakpoint functions.
* sparc-tdep.c (sparc_software_single_step): Ditto.
* spu-tdep.c (spu_software_single_step): Ditto.
* alpha-tdep.c (alpha_software_single_step): Ditto.
* record.c (record_wait): Adjust to pass an address space to the
breakpoints module.
* fork-child.c (fork_inferior): Set the new inferior's program and
address spaces.
* inf-ptrace.c (inf_ptrace_follow_fork): Copy the parent's program
and address spaces.
(inf_ptrace_attach): Set the inferior's program and address spaces.
* linux-nat.c: Include "solib.h".
(linux_child_follow_fork): Manage parent and child's program and
address spaces. Clone the parent's program space if necessary.
Don't wait for the vfork to be done here. Refuse to resume if
following the vfork parent while leaving the child stopped.
(resume_callback): Don't resume a vfork parent.
(linux_nat_resume): Also check for pending events in the
lp->waitstatus field.
(linux_handle_extended_wait): Report TARGET_WAITKIND_VFORK_DONE
events to the core.
(stop_wait_callback): Don't wait for SIGSTOP on vfork parents.
(cancel_breakpoint): Adjust.
* linux-thread-db.c (thread_db_wait): Don't remove thread event
breakpoints here.
(thread_db_mourn_inferior): Don't mark breakpoints out here.
Remove thread event breakpoints after mourning.
* corelow.c: Include progspace.h.
(core_open): Set the inferior's program and address spaces.
* remote.c (remote_add_inferior): Set the new inferior's program
and address spaces.
(remote_start_remote): Update address spaces.
(extended_remote_create_inferior_1): Don't init the thread list if
we already debugging other inferiors.
* darwin-nat.c (darwin_attach): Set the new inferior's program and
address spaces.
* gnu-nat.c (gnu_attach): Ditto.
* go32-nat.c (go32_create_inferior): Ditto.
* inf-ttrace.c (inf_ttrace_follow_fork, inf_ttrace_attach): Ditto.
* monitor.c (monitor_open): Ditto.
* nto-procfs.c (procfs_attach, procfs_create_inferior): Ditto.
* procfs.c (do_attach): Ditto.
* windows-nat.c (do_initial_windows_stuff): Ditto.
* inflow.c (inferior_process_group)
(terminal_init_inferior_with_pgrp, terminal_inferior,
(terminal_ours_1, inflow_inferior_exit, copy_terminal_info)
(child_terminal_info, new_tty_postfork, set_sigint_trap): Adjust
to use per-inferior data instead of inferior->terminal_info.
(inflow_inferior_data): New.
(inflow_new_inferior): Delete.
(inflow_inferior_data_cleanup): New.
(get_inflow_inferior_data): New.
* mi/mi-interp.c (mi_new_inferior): Rename to...
(mi_inferior_appeared): ... this.
(mi_interpreter_init): Adjust.
* tui/tui-disasm.c: Include "progspace.h".
(tui_set_disassem_content): Pass an address space to
breakpoint_here_p.
* NEWS: Mention multi-program debugging support. Mention new
commands "add-inferior", "clone-inferior", "remove-inferior",
"maint info program-spaces", and new option "set
follow-exec-mode".
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/doc/
* observer.texi (new_inferior): Rename to...
(inferior_appeared): ... this.
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/testsuite/
* gdb.base/foll-vfork.exp: Adjust to spell out "follow-fork".
* gdb.base/foll-exec.exp: Adjust to expect a process id before
"Executing new program".
* gdb.base/foll-fork.exp: Adjust to spell out "follow-fork".
* gdb.base/multi-forks.exp: Ditto. Adjust to the inferior being
left listed after having been killed.
* gdb.base/attach.exp: Adjust to spell out "symbol-file".
* gdb.base/maint.exp: Adjust test.
* Makefile.in (ALL_SUBDIRS): Add gdb.multi.
* gdb.multi/Makefile.in: New.
* gdb.multi/base.exp: New.
* gdb.multi/goodbye.c: New.
* gdb.multi/hangout.c: New.
* gdb.multi/hello.c: New.
* gdb.multi/bkpt-multi-exec.c: New.
* gdb.multi/bkpt-multi-exec.exp: New.
* gdb.multi/crashme.c: New.
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/doc/
* gdb.texinfo (Inferiors): Rename node to ...
(Inferiors and Programs): ... this. Mention running multiple
programs in the same debug session.
<info inferiors>: Mention the new 'Executable' column if "info
inferiors". Update examples. Document the "add-inferior",
"clone-inferior", "remove-inferior" and "maint info
program-spaces" commands.
(Process): Rename node to...
(Forks): ... this. Document "set|show follow-exec-mode".
2009-10-19 11:51:43 +02:00
|
|
|
|
#include "progspace.h"
|
2010-04-14 19:26:11 +02:00
|
|
|
|
#include "objfiles.h"
|
* dwarf2read.c (try_open_dwo_file): Use gdb_bfd_ref and
gdb_bfd_unref.
(free_dwo_file): Use gdb_bfd_unref.
* cli/cli-dump.c: Include gdb_bfd.h.
(bfd_openw_with_cleanup): Use gdb_bfd_ref.
(bfd_openr_with_cleanup): Likewise.
* windows-nat.c (windows_make_so): Use gdb_bfd_ref,
gdb_bfd_unref.
* utils.c: Include gdb_bfd.h.
(do_bfd_close_cleanup): Use gdb_bfd_unref.
* symfile.c: Include gdb_bfd.h.
(separate_debug_file_exists): Use gdb_bfd_unref.
(bfd_open_maybe_remote): Use gdb_bfd_ref.
(symfile_bfd_open): Use gdb_bfd_ref, gdb_bfd_unref.
(generic_load): Use gdb_bfd_ref.
(reread_symbols): Use gdb_bfd_unref.
* symfile-mem.c: Include gdb_bfd.h.
(symbol_file_add_from_memory): Use make_cleanup_bfd_close.
* spu-linux-nat.c (spu_bfd_open): Use gdb_bfd_ref, gdb_bfd_unref.
* solib.c: Include gdb_bfd.h.
(solib_bfd_fopen): Use gdb_bfd_ref.
(solib_bfd_open): Use gdb_bfd_unref.
(free_so_symbols): Use gdb_bfd_unref.
(reload_shared_libraries_1): Use gdb_bfd_unref.
* solib-spu.c: Include gdb_bfd.h.
(spu_bfd_fopen): Use gdb_bfd_ref, gdb_bfd_unref.
* solib-pa64.c (pa64_solib_create_inferior_hook): Use gdb_bfd_ref,
gdb_bfd_unref.
* solib-frv.c: Include gdb_bfd.h.
(enable_break2): Use gdb_bfd_unref.
* solib-dsbt.c: Include gdb_bfd.h.
(enable_break2): Use gdb_bfd_unref.
* solib-darwin.c: Include gdb_bfd.h.
(darwin_solib_get_all_image_info_addr_at_init): Use gdb_bfd_ref,
gdb_bfd_unref.
(darwin_bfd_open): Use gdb_bfd_unref.
* rs6000-nat.c (add_vmap): Use gdb_bfd_ref, gdb_bfd_unref.
* remote-mips.c: Include gdb_bfd.h.
(mips_load_srec): Use gdb_bfd_ref.
(pmon_load_fast): Use gdb_bfd_ref.
* remote-m32r-sdi.c: Include gdb_bfd.h.
(m32r_load): Use gdb_bfd_ref.
* record.c: Include gdb_bfd.h.
(record_save_cleanups): Use gdb_bfd_unref.
(cmd_record_save): Use gdb_bfd_unref.
* procfs.c (insert_dbx_link_bpt_in_file): Use gdb_bfd_ref,
gdb_bfd_unref.
* objfiles.h (gdb_bfd_close_or_warn): Remove.
(gdb_bfd_ref, gdb_bfd_unref): Move to gdb_bfd.h.
* objfiles.c: Include gdb_bfd.h.
(free_objfile): Use gdb_bfd_unref.
(gdb_bfd_close_or_warn, gdb_bfd_ref, gdb_bfd_unref): Move to
gdb_bfd.c.
* machoread.c (macho_add_oso_symfile): Use gdb_bfd_unref.
(macho_symfile_read_all_oso): Use gdb_bfd_ref, gdb_bfd_unref.
(macho_check_dsym): Likewise.
* m32r-rom.c: Include gdb_bfd.h.
(m32r_load): Use gdb_bfd_ref.
(m32r_upload_command): Use gdb_bfd_ref.
* jit.c: Include gdb_bfd.h.
(jit_bfd_try_read_symtab): Use gdb_bfd_ref, gdb_bfd_unref.
* gdb_bfd.h: New file.
* gdb_bfd.c: New file.
* gcore.c: Include gdb_bfd.h.
(create_gcore_bfd): Use gdb_bfd_ref.
(do_bfd_delete_cleanup): Use gdb_bfd_unref.
(gcore_command): Use gdb_bfd_unref.
* exec.c: Include gdb_bfd.h.
(exec_close): Use gdb_bfd_unref.
(exec_close_1): Use gdb_bfd_unref.
(exec_file_attach): Use gdb_bfd_ref.
* elfread.c: Include gdb_bfd.h.
(build_id_verify): Use gdb_bfd_unref.
* dsrec.c: Include gdb_bfd.h.
(load_srec): Use gdb_bfd_ref.
* corelow.c: Include gdb_bfd.h.
(core_close): Use gdb_bfd_unref.
(core_open): Use gdb_bfd_ref.
* bfd-target.c: Include gdb_bfd.h.
(target_bfd_xclose): Use gdb_bfd_unref.
(target_bfd_reopen): Use gdb_bfd_ref.
* Makefile.in (SFILES): Add gdb_bfd.c.
(HFILES_NO_SRCDIR): Add gdb_bfd.h.
(COMMON_OBS): Add gdb_bfd.o.
2012-07-18 21:33:34 +02:00
|
|
|
|
#include "gdb_bfd.h"
|
2013-03-29 16:21:23 +01:00
|
|
|
|
#include "completer.h"
|
PR gdb/7912:
* Makefile.in (SFILES): Add filestuff.c
(COMMON_OBS): Add filestuff.o.
(filestuff.o): New target.
* auto-load.c (auto_load_objfile_script_1): Use
gdb_fopen_cloexec.
* auxv.c (procfs_xfer_auxv): Use gdb_open_cloexec.
* cli/cli-cmds.c (shell_escape): Call close_most_fds.
* cli/cli-dump.c (fopen_with_cleanup): Use gdb_fopen_cloexec.
* common/agent.c (gdb_connect_sync_socket): Use
gdb_socket_cloexec.
* common/filestuff.c: New file.
* common/filestuff.h: New file.
* common/linux-osdata.c (linux_common_core_of_thread)
(command_from_pid, commandline_from_pid, print_source_lines)
(linux_xfer_osdata_shm, linux_xfer_osdata_sem)
(linux_xfer_osdata_msg, linux_xfer_osdata_modules): Use
gdb_fopen_cloexec.
* common/linux-procfs.c (linux_proc_get_int)
(linux_proc_pid_has_state): Use gdb_fopen_cloexec.
* config.in, configure: Rebuild.
* configure.ac: Don't check for sys/socket.h. Check for
fdwalk, pipe2.
* corelow.c (core_open): Use gdb_open_cloexec.
* dwarf2read.c (write_psymtabs_to_index): Use gdb_fopen_cloexec.
* fork-child.c (fork_inferior): Call close_most_fds.
* gdb_bfd.c (gdb_bfd_open): Use gdb_open_cloexec.
* inf-child.c (inf_child_fileio_readlink): Use gdb_open_cloexec.
* linux-nat.c (linux_nat_thread_name, linux_proc_pending_signals):
Use gdb_fopen_cloexec.
(linux_proc_xfer_partial, linux_proc_xfer_spu): Use
gdb_open_cloexec.
(linux_async_pipe): Use gdb_pipe_cloexec.
* remote-fileio.c (remote_fileio_func_open): Use
gdb_open_cloexec.
* remote.c (remote_file_put, remote_file_get): Use
gdb_fopen_cloexec.
* ser-pipe.c (pipe_open): Use gdb_socketpair_cloexec,
close_most_fds.
* ser-tcp.c (net_open): Use gdb_socket_cloexec.
* ser-unix.c (hardwire_open): Use gdb_open_cloexec.
* solib.c (solib_find): Use gdb_open_cloexec.
* source.c (openp, find_and_open_source): Use gdb_open_cloexec.
* tracepoint.c (tfile_start): Use gdb_fopen_cloexec.
(tfile_open): Use gdb_open_cloexec.
* tui/tui-io.c (tui_initialize_io): Use gdb_pipe_cloexec.
* ui-file.c (gdb_fopen): Use gdb_fopen_cloexec.
* xml-support.c (xml_fetch_content_from_file): Use
gdb_fopen_cloexec.
* main.c (captured_main): Call notice_open_fds.
gdbserver
* Makefile.in (SFILES): Add filestuff.c.
(OBS): Add filestuff.o.
(filestuff.o): New target.
* config.in, configure: Rebuild.
* configure.ac: Check for fdwalk, pipe2.
2013-04-22 18:46:15 +02:00
|
|
|
|
#include "filestuff.h"
|
2000-08-27 06:21:35 +02:00
|
|
|
|
|
2004-07-06 16:24:06 +02:00
|
|
|
|
#ifndef O_LARGEFILE
|
|
|
|
|
#define O_LARGEFILE 0
|
|
|
|
|
#endif
|
|
|
|
|
|
2004-04-21 19:47:10 +02:00
|
|
|
|
/* List of all available core_fns. On gdb startup, each core file
|
|
|
|
|
register reader calls deprecated_add_core_fns() to register
|
|
|
|
|
information on each core format it is prepared to read. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
static struct core_fns *core_file_fns = NULL;
|
|
|
|
|
|
2010-12-31 23:59:52 +01:00
|
|
|
|
/* The core_fns for a core file handler that is prepared to read the
|
|
|
|
|
core file currently open on core_bfd. */
|
1999-10-06 01:13:56 +02:00
|
|
|
|
|
|
|
|
|
static struct core_fns *core_vec = NULL;
|
|
|
|
|
|
2003-10-29 21:59:07 +01:00
|
|
|
|
/* FIXME: kettenis/20031023: Eventually this variable should
|
|
|
|
|
disappear. */
|
|
|
|
|
|
2013-06-27 21:38:55 +02:00
|
|
|
|
static struct gdbarch *core_gdbarch = NULL;
|
2003-10-29 21:59:07 +01:00
|
|
|
|
|
2009-06-03 20:50:36 +02:00
|
|
|
|
/* Per-core data. Currently, only the section table. Note that these
|
|
|
|
|
target sections are *not* mapped in the current address spaces' set
|
|
|
|
|
of target sections --- those should come only from pure executable
|
|
|
|
|
or shared library bfds. The core bfd sections are an
|
|
|
|
|
implementation detail of the core target, just like ptrace is for
|
|
|
|
|
unix child targets. */
|
|
|
|
|
static struct target_section_table *core_data;
|
|
|
|
|
|
2000-05-28 03:12:42 +02:00
|
|
|
|
static void core_files_info (struct target_ops *);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2000-05-28 03:12:42 +02:00
|
|
|
|
static struct core_fns *sniff_core_bfd (bfd *);
|
1999-10-06 01:13:56 +02:00
|
|
|
|
|
2002-11-30 17:33:55 +01:00
|
|
|
|
static int gdb_check_format (bfd *);
|
1999-10-06 01:13:56 +02:00
|
|
|
|
|
2013-12-18 05:27:56 +01:00
|
|
|
|
static void core_close (struct target_ops *self);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2000-05-22 11:02:23 +02:00
|
|
|
|
static void core_close_cleanup (void *ignore);
|
|
|
|
|
|
2003-01-18 Andrew Cagney <ac131313@redhat.com>
* ada-valprint.c: Eliminate PTR.
* breakpoint.c, corelow.c, cris-tdep.c, dbxread.c: Ditto.
* defs.h, dve3900-rom.c, dwarf2read.c, dwarfread.c: Ditto.
* exec.c, hppa-tdep.c, hpread.c, infcmd.c, mdebugread.c: Ditto.
* objfiles.c, objfiles.h, ocd.c, remote-es.c: Ditto.
* remote-mips.c, remote-sds.c, remote-vx.c: Ditto.
* solib-svr4.c, solib.c, stack.c, symfile.c, symfile.h: Ditto.
* symmisc.c, v850ice.c, xcoffread.c, cli/cli-script.c: Ditto.
2003-01-18 16:55:53 +01:00
|
|
|
|
static void add_to_thread_list (bfd *, asection *, void *);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2000-05-28 03:12:42 +02:00
|
|
|
|
static void init_core_ops (void);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2000-05-28 03:12:42 +02:00
|
|
|
|
void _initialize_corelow (void);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2010-07-19 19:51:25 +02:00
|
|
|
|
static struct target_ops core_ops;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2008-09-22 17:16:51 +02:00
|
|
|
|
/* An arbitrary identifier for the core inferior. */
|
|
|
|
|
#define CORELOW_PID 1
|
|
|
|
|
|
2010-12-31 23:59:52 +01:00
|
|
|
|
/* Link a new core_fns into the global core_file_fns list. Called on
|
|
|
|
|
gdb startup by the _initialize routine in each core file register
|
2011-02-26 03:07:10 +01:00
|
|
|
|
reader, to register information about each format the reader is
|
2010-12-31 23:59:52 +01:00
|
|
|
|
prepared to handle. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
void
|
2004-04-21 19:47:10 +02:00
|
|
|
|
deprecated_add_core_fns (struct core_fns *cf)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
1999-07-07 22:19:36 +02:00
|
|
|
|
cf->next = core_file_fns;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
core_file_fns = cf;
|
|
|
|
|
}
|
|
|
|
|
|
1999-10-06 01:13:56 +02:00
|
|
|
|
/* The default function that core file handlers can use to examine a
|
|
|
|
|
core file BFD and decide whether or not to accept the job of
|
2010-12-31 23:59:52 +01:00
|
|
|
|
reading the core file. */
|
1999-10-06 01:13:56 +02:00
|
|
|
|
|
|
|
|
|
int
|
2000-07-30 03:48:28 +02:00
|
|
|
|
default_core_sniffer (struct core_fns *our_fns, bfd *abfd)
|
1999-10-06 01:13:56 +02:00
|
|
|
|
{
|
|
|
|
|
int result;
|
|
|
|
|
|
|
|
|
|
result = (bfd_get_flavour (abfd) == our_fns -> core_flavour);
|
|
|
|
|
return (result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Walk through the list of core functions to find a set that can
|
gdb/
Fix duplicate .o files after omitting libbfd.a.
* Makefile.in (ALL_TARGET_OBS): Remove corelow.o.
(SFILES): Add corelow.c.
(COMMON_OBS): Add corelow.o.
(ALLDEPFILES): Remove corelow.c.
* config/alpha/alpha-linux.mh (NATDEPFILES): Remove corelow.o.
* config/alpha/alpha-osf3.mh: Likewise.
* config/alpha/fbsd.mh: Likewise.
* config/arm/nbsdaout.mh: Likewise.
* config/arm/nbsdelf.mh: Likewise.
* config/i386/i386gnu.mh: Likewise.
* config/ia64/hpux.mh: Likewise.
* config/ia64/linux.mh: Likewise.
* config/m32r/linux.mh: Likewise.
* config/m68k/linux.mh: Likewise.
* config/mips/irix5.mh: Likewise.
* config/mips/irix6.mh: Likewise.
* config/pa/hpux.mh: Likewise.
* config/pa/linux.mh: Likewise.
* config/powerpc/aix.mh: Likewise.
* config/sparc/linux.mh: Likewise.
* config/sparc/linux64.mh: Likewise.
* config/sparc/sol2.mh: Likewise.
* config/vax/vax.mh: Likewise.
* configure.tgt (alpha*-*-freebsd* alpha*-*-kfreebsd*-gnu)
(alpha*-*-netbsd*, alpha*-*-knetbsd*-gnu, alpha*-*-openbsd*)
(am33_2.0*-*-linux*, arm*-wince-pe, arm*-*-mingw32ce*, arm*-*-linux*)
(arm*-*-openbsd*, cris*, frv-*-*, hppa*-*-hpux*, hppa*-*-netbsd*)
(hppa*-*-openbsd*, i[34567]86-*-dicos*, i[34567]86-*-freebsd*)
(i[34567]86-*-kfreebsd*-gnu, i[34567]86-*-netbsd*)
(i[34567]86-*-knetbsd*-gnu, i[34567]86-*-openbsd*, i[34567]86-*-nto*)
(i[34567]86-*-solaris2.1[0-9]*, x86_64-*-solaris2.1[0-9]*)
(i[34567]86-*-solaris*, i[34567]86-*-linux*, i[34567]86-*-cygwin*)
(i[34567]86-*-mingw32*, m68*-*-netbsd*, m68*-*-knetbsd*-gnu)
(m68*-*-openbsd*, m88*-*-openbsd*, microblaze*-linux-*)
(microblaze*-*-linux*, mips*-*-linux*, mips*-*-netbsd*)
(mips*-*-knetbsd*-gnu, mips64*-*-openbsd*, powerpc-*-netbsd*)
(powerpc-*-knetbsd*-gnu, powerpc-*-openbsd*, powerpc-*-linux*)
(powerpc64-*-linux*, s390*-*-*, score-*-*, sh*-*-linux*)
(sh*-*-netbsdelf*, sh*-*-knetbsd*-gnu, sh*-*-openbsd*)
(sparc*-*-freebsd*, sparc*-*-kfreebsd*-gnu, sparc-*-netbsd*)
(sparc-*-knetbsd*-gnu, sparc64-*-netbsd*, sparc64-*-knetbsd*-gnu)
(sparc-*-openbsd*, sparc64-*-openbsd*, tic6x-*-*linux, vax-*-netbsd*)
(vax-*-knetbsd*-gnu, vax-*-openbsd*, x86_64-*-dicos*, x86_64-*-linux*)
(x86_64-*-freebsd*, x86_64-*-kfreebsd*-gnu, x86_64-*-netbsd*)
(x86_64-*-knetbsd*-gnu, x86_64-*-openbsd*, xtensa*-*-linux*): Remove
corelow.o from gdb_target_obs.
* corefile.c (core_target): Update the comment on NULL value.
(core_file_command): Replace error by gdb_assert on CORE_TARGET.
* corelow.c (sniff_core_bfd): Call error instead of warning on zero
MATCHES. Drop YUMMY set on NULL.
(core_close): Do not call exit_inferior_silent on zero PID. Do not
reclaim CORE_DATA if it is already NULL.
2012-01-10 17:30:49 +01:00
|
|
|
|
handle the core file open on ABFD. Returns pointer to set that is
|
2010-12-31 23:59:52 +01:00
|
|
|
|
selected. */
|
1999-10-06 01:13:56 +02:00
|
|
|
|
|
|
|
|
|
static struct core_fns *
|
2000-07-30 03:48:28 +02:00
|
|
|
|
sniff_core_bfd (bfd *abfd)
|
1999-10-06 01:13:56 +02:00
|
|
|
|
{
|
|
|
|
|
struct core_fns *cf;
|
|
|
|
|
struct core_fns *yummy = NULL;
|
|
|
|
|
int matches = 0;;
|
|
|
|
|
|
2010-12-31 23:59:52 +01:00
|
|
|
|
/* Don't sniff if we have support for register sets in
|
|
|
|
|
CORE_GDBARCH. */
|
2014-09-10 14:55:39 +02:00
|
|
|
|
if (core_gdbarch && gdbarch_iterate_over_regset_sections_p (core_gdbarch))
|
2003-10-29 21:59:07 +01:00
|
|
|
|
return NULL;
|
|
|
|
|
|
1999-10-06 01:13:56 +02:00
|
|
|
|
for (cf = core_file_fns; cf != NULL; cf = cf->next)
|
|
|
|
|
{
|
|
|
|
|
if (cf->core_sniffer (cf, abfd))
|
|
|
|
|
{
|
|
|
|
|
yummy = cf;
|
|
|
|
|
matches++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (matches > 1)
|
|
|
|
|
{
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
|
warning (_("\"%s\": ambiguous core format, %d handlers match"),
|
1999-10-06 01:13:56 +02:00
|
|
|
|
bfd_get_filename (abfd), matches);
|
|
|
|
|
}
|
|
|
|
|
else if (matches == 0)
|
gdb/
Fix duplicate .o files after omitting libbfd.a.
* Makefile.in (ALL_TARGET_OBS): Remove corelow.o.
(SFILES): Add corelow.c.
(COMMON_OBS): Add corelow.o.
(ALLDEPFILES): Remove corelow.c.
* config/alpha/alpha-linux.mh (NATDEPFILES): Remove corelow.o.
* config/alpha/alpha-osf3.mh: Likewise.
* config/alpha/fbsd.mh: Likewise.
* config/arm/nbsdaout.mh: Likewise.
* config/arm/nbsdelf.mh: Likewise.
* config/i386/i386gnu.mh: Likewise.
* config/ia64/hpux.mh: Likewise.
* config/ia64/linux.mh: Likewise.
* config/m32r/linux.mh: Likewise.
* config/m68k/linux.mh: Likewise.
* config/mips/irix5.mh: Likewise.
* config/mips/irix6.mh: Likewise.
* config/pa/hpux.mh: Likewise.
* config/pa/linux.mh: Likewise.
* config/powerpc/aix.mh: Likewise.
* config/sparc/linux.mh: Likewise.
* config/sparc/linux64.mh: Likewise.
* config/sparc/sol2.mh: Likewise.
* config/vax/vax.mh: Likewise.
* configure.tgt (alpha*-*-freebsd* alpha*-*-kfreebsd*-gnu)
(alpha*-*-netbsd*, alpha*-*-knetbsd*-gnu, alpha*-*-openbsd*)
(am33_2.0*-*-linux*, arm*-wince-pe, arm*-*-mingw32ce*, arm*-*-linux*)
(arm*-*-openbsd*, cris*, frv-*-*, hppa*-*-hpux*, hppa*-*-netbsd*)
(hppa*-*-openbsd*, i[34567]86-*-dicos*, i[34567]86-*-freebsd*)
(i[34567]86-*-kfreebsd*-gnu, i[34567]86-*-netbsd*)
(i[34567]86-*-knetbsd*-gnu, i[34567]86-*-openbsd*, i[34567]86-*-nto*)
(i[34567]86-*-solaris2.1[0-9]*, x86_64-*-solaris2.1[0-9]*)
(i[34567]86-*-solaris*, i[34567]86-*-linux*, i[34567]86-*-cygwin*)
(i[34567]86-*-mingw32*, m68*-*-netbsd*, m68*-*-knetbsd*-gnu)
(m68*-*-openbsd*, m88*-*-openbsd*, microblaze*-linux-*)
(microblaze*-*-linux*, mips*-*-linux*, mips*-*-netbsd*)
(mips*-*-knetbsd*-gnu, mips64*-*-openbsd*, powerpc-*-netbsd*)
(powerpc-*-knetbsd*-gnu, powerpc-*-openbsd*, powerpc-*-linux*)
(powerpc64-*-linux*, s390*-*-*, score-*-*, sh*-*-linux*)
(sh*-*-netbsdelf*, sh*-*-knetbsd*-gnu, sh*-*-openbsd*)
(sparc*-*-freebsd*, sparc*-*-kfreebsd*-gnu, sparc-*-netbsd*)
(sparc-*-knetbsd*-gnu, sparc64-*-netbsd*, sparc64-*-knetbsd*-gnu)
(sparc-*-openbsd*, sparc64-*-openbsd*, tic6x-*-*linux, vax-*-netbsd*)
(vax-*-knetbsd*-gnu, vax-*-openbsd*, x86_64-*-dicos*, x86_64-*-linux*)
(x86_64-*-freebsd*, x86_64-*-kfreebsd*-gnu, x86_64-*-netbsd*)
(x86_64-*-knetbsd*-gnu, x86_64-*-openbsd*, xtensa*-*-linux*): Remove
corelow.o from gdb_target_obs.
* corefile.c (core_target): Update the comment on NULL value.
(core_file_command): Replace error by gdb_assert on CORE_TARGET.
* corelow.c (sniff_core_bfd): Call error instead of warning on zero
MATCHES. Drop YUMMY set on NULL.
(core_close): Do not call exit_inferior_silent on zero PID. Do not
reclaim CORE_DATA if it is already NULL.
2012-01-10 17:30:49 +01:00
|
|
|
|
error (_("\"%s\": no core file handler recognizes format"),
|
|
|
|
|
bfd_get_filename (abfd));
|
|
|
|
|
|
1999-10-06 01:13:56 +02:00
|
|
|
|
return (yummy);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The default is to reject every core file format we see. Either
|
|
|
|
|
BFD has to recognize it, or we have to provide a function in the
|
2010-12-31 23:59:52 +01:00
|
|
|
|
core file handler that recognizes it. */
|
1999-10-06 01:13:56 +02:00
|
|
|
|
|
|
|
|
|
int
|
2000-07-30 03:48:28 +02:00
|
|
|
|
default_check_format (bfd *abfd)
|
1999-10-06 01:13:56 +02:00
|
|
|
|
{
|
|
|
|
|
return (0);
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-31 23:59:52 +01:00
|
|
|
|
/* Attempt to recognize core file formats that BFD rejects. */
|
1999-10-06 01:13:56 +02:00
|
|
|
|
|
2002-11-30 17:33:55 +01:00
|
|
|
|
static int
|
2000-07-30 03:48:28 +02:00
|
|
|
|
gdb_check_format (bfd *abfd)
|
1999-10-06 01:13:56 +02:00
|
|
|
|
{
|
|
|
|
|
struct core_fns *cf;
|
|
|
|
|
|
|
|
|
|
for (cf = core_file_fns; cf != NULL; cf = cf->next)
|
|
|
|
|
{
|
|
|
|
|
if (cf->check_format (abfd))
|
|
|
|
|
{
|
2002-02-27 02:40:36 +01:00
|
|
|
|
return (1);
|
1999-10-06 01:13:56 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2002-02-27 02:40:36 +01:00
|
|
|
|
return (0);
|
1999-10-06 01:13:56 +02:00
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2010-12-31 23:59:52 +01:00
|
|
|
|
/* Discard all vestiges of any previous core file and mark data and
|
|
|
|
|
stack spaces as empty. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
static void
|
2013-12-18 05:27:56 +01:00
|
|
|
|
core_close (struct target_ops *self)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
if (core_bfd)
|
|
|
|
|
{
|
2009-02-16 04:16:24 +01:00
|
|
|
|
int pid = ptid_get_pid (inferior_ptid);
|
2010-12-31 23:59:52 +01:00
|
|
|
|
inferior_ptid = null_ptid; /* Avoid confusion from thread
|
|
|
|
|
stuff. */
|
gdb/
Fix duplicate .o files after omitting libbfd.a.
* Makefile.in (ALL_TARGET_OBS): Remove corelow.o.
(SFILES): Add corelow.c.
(COMMON_OBS): Add corelow.o.
(ALLDEPFILES): Remove corelow.c.
* config/alpha/alpha-linux.mh (NATDEPFILES): Remove corelow.o.
* config/alpha/alpha-osf3.mh: Likewise.
* config/alpha/fbsd.mh: Likewise.
* config/arm/nbsdaout.mh: Likewise.
* config/arm/nbsdelf.mh: Likewise.
* config/i386/i386gnu.mh: Likewise.
* config/ia64/hpux.mh: Likewise.
* config/ia64/linux.mh: Likewise.
* config/m32r/linux.mh: Likewise.
* config/m68k/linux.mh: Likewise.
* config/mips/irix5.mh: Likewise.
* config/mips/irix6.mh: Likewise.
* config/pa/hpux.mh: Likewise.
* config/pa/linux.mh: Likewise.
* config/powerpc/aix.mh: Likewise.
* config/sparc/linux.mh: Likewise.
* config/sparc/linux64.mh: Likewise.
* config/sparc/sol2.mh: Likewise.
* config/vax/vax.mh: Likewise.
* configure.tgt (alpha*-*-freebsd* alpha*-*-kfreebsd*-gnu)
(alpha*-*-netbsd*, alpha*-*-knetbsd*-gnu, alpha*-*-openbsd*)
(am33_2.0*-*-linux*, arm*-wince-pe, arm*-*-mingw32ce*, arm*-*-linux*)
(arm*-*-openbsd*, cris*, frv-*-*, hppa*-*-hpux*, hppa*-*-netbsd*)
(hppa*-*-openbsd*, i[34567]86-*-dicos*, i[34567]86-*-freebsd*)
(i[34567]86-*-kfreebsd*-gnu, i[34567]86-*-netbsd*)
(i[34567]86-*-knetbsd*-gnu, i[34567]86-*-openbsd*, i[34567]86-*-nto*)
(i[34567]86-*-solaris2.1[0-9]*, x86_64-*-solaris2.1[0-9]*)
(i[34567]86-*-solaris*, i[34567]86-*-linux*, i[34567]86-*-cygwin*)
(i[34567]86-*-mingw32*, m68*-*-netbsd*, m68*-*-knetbsd*-gnu)
(m68*-*-openbsd*, m88*-*-openbsd*, microblaze*-linux-*)
(microblaze*-*-linux*, mips*-*-linux*, mips*-*-netbsd*)
(mips*-*-knetbsd*-gnu, mips64*-*-openbsd*, powerpc-*-netbsd*)
(powerpc-*-knetbsd*-gnu, powerpc-*-openbsd*, powerpc-*-linux*)
(powerpc64-*-linux*, s390*-*-*, score-*-*, sh*-*-linux*)
(sh*-*-netbsdelf*, sh*-*-knetbsd*-gnu, sh*-*-openbsd*)
(sparc*-*-freebsd*, sparc*-*-kfreebsd*-gnu, sparc-*-netbsd*)
(sparc-*-knetbsd*-gnu, sparc64-*-netbsd*, sparc64-*-knetbsd*-gnu)
(sparc-*-openbsd*, sparc64-*-openbsd*, tic6x-*-*linux, vax-*-netbsd*)
(vax-*-knetbsd*-gnu, vax-*-openbsd*, x86_64-*-dicos*, x86_64-*-linux*)
(x86_64-*-freebsd*, x86_64-*-kfreebsd*-gnu, x86_64-*-netbsd*)
(x86_64-*-knetbsd*-gnu, x86_64-*-openbsd*, xtensa*-*-linux*): Remove
corelow.o from gdb_target_obs.
* corefile.c (core_target): Update the comment on NULL value.
(core_file_command): Replace error by gdb_assert on CORE_TARGET.
* corelow.c (sniff_core_bfd): Call error instead of warning on zero
MATCHES. Drop YUMMY set on NULL.
(core_close): Do not call exit_inferior_silent on zero PID. Do not
reclaim CORE_DATA if it is already NULL.
2012-01-10 17:30:49 +01:00
|
|
|
|
if (pid != 0)
|
|
|
|
|
exit_inferior_silent (pid);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2010-12-31 23:59:52 +01:00
|
|
|
|
/* Clear out solib state while the bfd is still open. See
|
|
|
|
|
comments in clear_solib in solib.c. */
|
* solib.h (CLEAR_SOLIB, SOLIB_ADD)
(SOLIB_CREATE_INFERIOR_HOOK, SOLIB_REMOVE_INFERIOR_HOOK)
(SOLIB_IN_DYNAMIC_LINKER, SOLIB_RESTART)
(DISABLE_UNSETTABLE_BREAK, PC_SOLIB)
(IN_SOLIB_DYNSYM_RESOLVE_CODE): Remove defines and orphaned
comments.
* breakpoint.c: Include "solib.h".
(insert_bp_location) [!DISABLE_UNSETTABLE_BREAK]: Call
solib_address.
(remove_solib_event_breakpoints, create_solib_event_breakpoint)
(disable_breakpoints_in_shlibs)
(disable_breakpoints_in_unloaded_shlib)
(re_enable_breakpoints_in_shlibs): Compile if SOLIB_ADD isn't
defined. If PC_SOLIB isn't defined, call solib_address.
(_initialize_breakpoint): Unconditionally install observer.
* corelow.c: Include "solib.h".
[SOLIB_ADD] (solib_add_stub): Remove prototype.
(core_close) [!CLEAR_SOLIB]: Call clear_solib.
(solib_add_stub) [!SOLIB_ADD] Call solib_add.
(core_open): Unconditionally call solib_add_stub.
* fork-child.c: Include "solib.h".
(fork_inferior) [!SOLIB_CREATE_INFERIOR_HOOK]: Call
solib_create_inferior_hook.
* infcmd.c: Include "solib.h".
(attach_command) [!SOLIB_ADD]: Call shlib_rescan. Unconditionally
call re_enable_breakpoints_in_shlibs.
* infrun.c: Include "solib.h".
(SOLIB_IN_SYNSYM_RESOLVE_CODE): Don't define if not already
defined.
(stop_on_solib_events, show_stop_on_solib_events): Include
unconditionally.
(follow_exec) [!SOLIB_CREATE_INFERIOR_HOOK]: Call
solib_create_inferior_hook.
(handle_inferior_event) [!SOLIB_ADD]: Call shlib_add.
[!IN_SOLIB_DYNSYM_RESOLVE_CODE]: Call in_solib_dynsym_resolve_code.
(_initialize_infrun): Unconditionally add "stop_on_solib-events"
command.
* remote.c: Include "solib.h".
(remote_open_1): Unconditionally call no_shared_libraries.
[!SOLIB_CREATE_INFERIOR_HOOK] Call solib_create_inferior_hook.
* stack.c: Include "solib.h".
(print_frame) [!PC_SOLIB] Call shlib_for_pc.
* xcoffsolib.c (no_shared_libraries): Remove function.
* Makefile.in (SFILES): Add solib.c.
(ALLDEPFILES): Remove solib.c.
(COMMON_OBS): Add solib.o.
(breakpoint.o, corelow.o, fork-chiled.o, infcmd.o, infrun.o)
(remote.o, stack.o): Update dependencies.
2005-05-12 22:21:18 +02:00
|
|
|
|
clear_solib ();
|
1999-04-26 20:34:20 +02:00
|
|
|
|
|
gdb/
Fix duplicate .o files after omitting libbfd.a.
* Makefile.in (ALL_TARGET_OBS): Remove corelow.o.
(SFILES): Add corelow.c.
(COMMON_OBS): Add corelow.o.
(ALLDEPFILES): Remove corelow.c.
* config/alpha/alpha-linux.mh (NATDEPFILES): Remove corelow.o.
* config/alpha/alpha-osf3.mh: Likewise.
* config/alpha/fbsd.mh: Likewise.
* config/arm/nbsdaout.mh: Likewise.
* config/arm/nbsdelf.mh: Likewise.
* config/i386/i386gnu.mh: Likewise.
* config/ia64/hpux.mh: Likewise.
* config/ia64/linux.mh: Likewise.
* config/m32r/linux.mh: Likewise.
* config/m68k/linux.mh: Likewise.
* config/mips/irix5.mh: Likewise.
* config/mips/irix6.mh: Likewise.
* config/pa/hpux.mh: Likewise.
* config/pa/linux.mh: Likewise.
* config/powerpc/aix.mh: Likewise.
* config/sparc/linux.mh: Likewise.
* config/sparc/linux64.mh: Likewise.
* config/sparc/sol2.mh: Likewise.
* config/vax/vax.mh: Likewise.
* configure.tgt (alpha*-*-freebsd* alpha*-*-kfreebsd*-gnu)
(alpha*-*-netbsd*, alpha*-*-knetbsd*-gnu, alpha*-*-openbsd*)
(am33_2.0*-*-linux*, arm*-wince-pe, arm*-*-mingw32ce*, arm*-*-linux*)
(arm*-*-openbsd*, cris*, frv-*-*, hppa*-*-hpux*, hppa*-*-netbsd*)
(hppa*-*-openbsd*, i[34567]86-*-dicos*, i[34567]86-*-freebsd*)
(i[34567]86-*-kfreebsd*-gnu, i[34567]86-*-netbsd*)
(i[34567]86-*-knetbsd*-gnu, i[34567]86-*-openbsd*, i[34567]86-*-nto*)
(i[34567]86-*-solaris2.1[0-9]*, x86_64-*-solaris2.1[0-9]*)
(i[34567]86-*-solaris*, i[34567]86-*-linux*, i[34567]86-*-cygwin*)
(i[34567]86-*-mingw32*, m68*-*-netbsd*, m68*-*-knetbsd*-gnu)
(m68*-*-openbsd*, m88*-*-openbsd*, microblaze*-linux-*)
(microblaze*-*-linux*, mips*-*-linux*, mips*-*-netbsd*)
(mips*-*-knetbsd*-gnu, mips64*-*-openbsd*, powerpc-*-netbsd*)
(powerpc-*-knetbsd*-gnu, powerpc-*-openbsd*, powerpc-*-linux*)
(powerpc64-*-linux*, s390*-*-*, score-*-*, sh*-*-linux*)
(sh*-*-netbsdelf*, sh*-*-knetbsd*-gnu, sh*-*-openbsd*)
(sparc*-*-freebsd*, sparc*-*-kfreebsd*-gnu, sparc-*-netbsd*)
(sparc-*-knetbsd*-gnu, sparc64-*-netbsd*, sparc64-*-knetbsd*-gnu)
(sparc-*-openbsd*, sparc64-*-openbsd*, tic6x-*-*linux, vax-*-netbsd*)
(vax-*-knetbsd*-gnu, vax-*-openbsd*, x86_64-*-dicos*, x86_64-*-linux*)
(x86_64-*-freebsd*, x86_64-*-kfreebsd*-gnu, x86_64-*-netbsd*)
(x86_64-*-knetbsd*-gnu, x86_64-*-openbsd*, xtensa*-*-linux*): Remove
corelow.o from gdb_target_obs.
* corefile.c (core_target): Update the comment on NULL value.
(core_file_command): Replace error by gdb_assert on CORE_TARGET.
* corelow.c (sniff_core_bfd): Call error instead of warning on zero
MATCHES. Drop YUMMY set on NULL.
(core_close): Do not call exit_inferior_silent on zero PID. Do not
reclaim CORE_DATA if it is already NULL.
2012-01-10 17:30:49 +01:00
|
|
|
|
if (core_data)
|
|
|
|
|
{
|
|
|
|
|
xfree (core_data->sections);
|
|
|
|
|
xfree (core_data);
|
|
|
|
|
core_data = NULL;
|
|
|
|
|
}
|
2009-06-03 20:50:36 +02:00
|
|
|
|
|
* dwarf2read.c (try_open_dwo_file): Use gdb_bfd_ref and
gdb_bfd_unref.
(free_dwo_file): Use gdb_bfd_unref.
* cli/cli-dump.c: Include gdb_bfd.h.
(bfd_openw_with_cleanup): Use gdb_bfd_ref.
(bfd_openr_with_cleanup): Likewise.
* windows-nat.c (windows_make_so): Use gdb_bfd_ref,
gdb_bfd_unref.
* utils.c: Include gdb_bfd.h.
(do_bfd_close_cleanup): Use gdb_bfd_unref.
* symfile.c: Include gdb_bfd.h.
(separate_debug_file_exists): Use gdb_bfd_unref.
(bfd_open_maybe_remote): Use gdb_bfd_ref.
(symfile_bfd_open): Use gdb_bfd_ref, gdb_bfd_unref.
(generic_load): Use gdb_bfd_ref.
(reread_symbols): Use gdb_bfd_unref.
* symfile-mem.c: Include gdb_bfd.h.
(symbol_file_add_from_memory): Use make_cleanup_bfd_close.
* spu-linux-nat.c (spu_bfd_open): Use gdb_bfd_ref, gdb_bfd_unref.
* solib.c: Include gdb_bfd.h.
(solib_bfd_fopen): Use gdb_bfd_ref.
(solib_bfd_open): Use gdb_bfd_unref.
(free_so_symbols): Use gdb_bfd_unref.
(reload_shared_libraries_1): Use gdb_bfd_unref.
* solib-spu.c: Include gdb_bfd.h.
(spu_bfd_fopen): Use gdb_bfd_ref, gdb_bfd_unref.
* solib-pa64.c (pa64_solib_create_inferior_hook): Use gdb_bfd_ref,
gdb_bfd_unref.
* solib-frv.c: Include gdb_bfd.h.
(enable_break2): Use gdb_bfd_unref.
* solib-dsbt.c: Include gdb_bfd.h.
(enable_break2): Use gdb_bfd_unref.
* solib-darwin.c: Include gdb_bfd.h.
(darwin_solib_get_all_image_info_addr_at_init): Use gdb_bfd_ref,
gdb_bfd_unref.
(darwin_bfd_open): Use gdb_bfd_unref.
* rs6000-nat.c (add_vmap): Use gdb_bfd_ref, gdb_bfd_unref.
* remote-mips.c: Include gdb_bfd.h.
(mips_load_srec): Use gdb_bfd_ref.
(pmon_load_fast): Use gdb_bfd_ref.
* remote-m32r-sdi.c: Include gdb_bfd.h.
(m32r_load): Use gdb_bfd_ref.
* record.c: Include gdb_bfd.h.
(record_save_cleanups): Use gdb_bfd_unref.
(cmd_record_save): Use gdb_bfd_unref.
* procfs.c (insert_dbx_link_bpt_in_file): Use gdb_bfd_ref,
gdb_bfd_unref.
* objfiles.h (gdb_bfd_close_or_warn): Remove.
(gdb_bfd_ref, gdb_bfd_unref): Move to gdb_bfd.h.
* objfiles.c: Include gdb_bfd.h.
(free_objfile): Use gdb_bfd_unref.
(gdb_bfd_close_or_warn, gdb_bfd_ref, gdb_bfd_unref): Move to
gdb_bfd.c.
* machoread.c (macho_add_oso_symfile): Use gdb_bfd_unref.
(macho_symfile_read_all_oso): Use gdb_bfd_ref, gdb_bfd_unref.
(macho_check_dsym): Likewise.
* m32r-rom.c: Include gdb_bfd.h.
(m32r_load): Use gdb_bfd_ref.
(m32r_upload_command): Use gdb_bfd_ref.
* jit.c: Include gdb_bfd.h.
(jit_bfd_try_read_symtab): Use gdb_bfd_ref, gdb_bfd_unref.
* gdb_bfd.h: New file.
* gdb_bfd.c: New file.
* gcore.c: Include gdb_bfd.h.
(create_gcore_bfd): Use gdb_bfd_ref.
(do_bfd_delete_cleanup): Use gdb_bfd_unref.
(gcore_command): Use gdb_bfd_unref.
* exec.c: Include gdb_bfd.h.
(exec_close): Use gdb_bfd_unref.
(exec_close_1): Use gdb_bfd_unref.
(exec_file_attach): Use gdb_bfd_ref.
* elfread.c: Include gdb_bfd.h.
(build_id_verify): Use gdb_bfd_unref.
* dsrec.c: Include gdb_bfd.h.
(load_srec): Use gdb_bfd_ref.
* corelow.c: Include gdb_bfd.h.
(core_close): Use gdb_bfd_unref.
(core_open): Use gdb_bfd_ref.
* bfd-target.c: Include gdb_bfd.h.
(target_bfd_xclose): Use gdb_bfd_unref.
(target_bfd_reopen): Use gdb_bfd_ref.
* Makefile.in (SFILES): Add gdb_bfd.c.
(HFILES_NO_SRCDIR): Add gdb_bfd.h.
(COMMON_OBS): Add gdb_bfd.o.
2012-07-18 21:33:34 +02:00
|
|
|
|
gdb_bfd_unref (core_bfd);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
core_bfd = NULL;
|
|
|
|
|
}
|
1999-10-06 01:13:56 +02:00
|
|
|
|
core_vec = NULL;
|
2003-10-29 21:59:07 +01:00
|
|
|
|
core_gdbarch = NULL;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
2000-05-22 11:02:23 +02:00
|
|
|
|
static void
|
|
|
|
|
core_close_cleanup (void *ignore)
|
|
|
|
|
{
|
2013-12-18 05:27:56 +01:00
|
|
|
|
core_close (NULL);
|
2000-05-22 11:02:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-31 23:59:52 +01:00
|
|
|
|
/* Look for sections whose names start with `.reg/' so that we can
|
|
|
|
|
extract the list of threads in a core file. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
static void
|
2003-01-18 Andrew Cagney <ac131313@redhat.com>
* ada-valprint.c: Eliminate PTR.
* breakpoint.c, corelow.c, cris-tdep.c, dbxread.c: Ditto.
* defs.h, dve3900-rom.c, dwarf2read.c, dwarfread.c: Ditto.
* exec.c, hppa-tdep.c, hpread.c, infcmd.c, mdebugread.c: Ditto.
* objfiles.c, objfiles.h, ocd.c, remote-es.c: Ditto.
* remote-mips.c, remote-sds.c, remote-vx.c: Ditto.
* solib-svr4.c, solib.c, stack.c, symfile.c, symfile.h: Ditto.
* symmisc.c, v850ice.c, xcoffread.c, cli/cli-script.c: Ditto.
2003-01-18 16:55:53 +01:00
|
|
|
|
add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
2008-09-08 23:36:01 +02:00
|
|
|
|
ptid_t ptid;
|
2009-10-09 02:49:06 +02:00
|
|
|
|
int core_tid;
|
|
|
|
|
int pid, lwpid;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
asection *reg_sect = (asection *) reg_sect_arg;
|
2012-01-26 17:44:29 +01:00
|
|
|
|
int fake_pid_p = 0;
|
|
|
|
|
struct inferior *inf;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2015-03-06 10:42:06 +01:00
|
|
|
|
if (!startswith (bfd_section_name (abfd, asect), ".reg/"))
|
1999-04-16 03:35:26 +02:00
|
|
|
|
return;
|
|
|
|
|
|
2009-10-09 02:49:06 +02:00
|
|
|
|
core_tid = atoi (bfd_section_name (abfd, asect) + 5);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2010-08-18 14:24:13 +02:00
|
|
|
|
pid = bfd_core_file_pid (core_bfd);
|
|
|
|
|
if (pid == 0)
|
2009-10-09 02:49:06 +02:00
|
|
|
|
{
|
2012-01-26 17:44:29 +01:00
|
|
|
|
fake_pid_p = 1;
|
2009-10-09 02:49:06 +02:00
|
|
|
|
pid = CORELOW_PID;
|
|
|
|
|
}
|
2008-09-08 23:36:01 +02:00
|
|
|
|
|
2010-08-18 14:24:13 +02:00
|
|
|
|
lwpid = core_tid;
|
|
|
|
|
|
2012-01-26 17:44:29 +01:00
|
|
|
|
inf = current_inferior ();
|
|
|
|
|
if (inf->pid == 0)
|
|
|
|
|
{
|
|
|
|
|
inferior_appeared (inf, pid);
|
|
|
|
|
inf->fake_pid_p = fake_pid_p;
|
|
|
|
|
}
|
2009-10-09 02:49:06 +02:00
|
|
|
|
|
|
|
|
|
ptid = ptid_build (pid, lwpid, 0);
|
|
|
|
|
|
|
|
|
|
add_thread (ptid);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
/* Warning, Will Robinson, looking at BFD private data! */
|
|
|
|
|
|
|
|
|
|
if (reg_sect != NULL
|
2010-12-31 23:59:52 +01:00
|
|
|
|
&& asect->filepos == reg_sect->filepos) /* Did we find .reg? */
|
|
|
|
|
inferior_ptid = ptid; /* Yes, make it current. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This routine opens and sets up the core file bfd. */
|
|
|
|
|
|
|
|
|
|
static void
|
constify to_open
This makes target_ops::to_open take a const string and then fixes the
fallout.
There were a few of these I could not build. However I eyeballed it
and in any case the fixes should generally be trivial.
This is based on the patch to fix up the target debugging for to_open,
because that changes gdb to not directly install to_open as the target
command
2014-07-30 Tom Tromey <tromey@redhat.com>
* bsd-kvm.c (bsd_kvm_open): Constify.
* corelow.c (core_open): Constify.
* ctf.c (ctf_open): Constify.
* dbug-rom.c (dbug_open): Constify.
* exec.c (exec_open): Constify.
* m32r-rom.c (m32r_open, mon2000_open): Constify.
* microblaze-rom.c (picobug_open): Constify.
* nto-procfs.c (procfs_open_1, procfs_open, procfs_native_open):
Constify.
* ppcbug-rom.c (ppcbug_open0, ppcbug_open1): Constify.
* record-btrace.c (record_btrace_open): Constify.
* record-full.c (record_full_core_open_1, record_full_open_1)
(record_full_open): Constify.
* remote-m32r-sdi.c (m32r_open): Constify.
* remote-mips.c (common_open, mips_open, pmon_open, ddb_open)
(rockhopper_open, lsi_open): Constify.
* remote-sim.c (gdbsim_open): Constify.
* remote.c (remote_open, extended_remote_open, remote_open_1):
Constify.
* target.h (struct target_ops) <to_open>: Make "arg" const.
* tracefile-tfile.c (tfile_open): Constify.
2014-07-22 18:56:01 +02:00
|
|
|
|
core_open (const char *arg, int from_tty)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
const char *p;
|
|
|
|
|
int siggy;
|
|
|
|
|
struct cleanup *old_chain;
|
|
|
|
|
char *temp;
|
|
|
|
|
int scratch_chan;
|
2004-07-06 16:24:06 +02:00
|
|
|
|
int flags;
|
constify to_open
This makes target_ops::to_open take a const string and then fixes the
fallout.
There were a few of these I could not build. However I eyeballed it
and in any case the fixes should generally be trivial.
This is based on the patch to fix up the target debugging for to_open,
because that changes gdb to not directly install to_open as the target
command
2014-07-30 Tom Tromey <tromey@redhat.com>
* bsd-kvm.c (bsd_kvm_open): Constify.
* corelow.c (core_open): Constify.
* ctf.c (ctf_open): Constify.
* dbug-rom.c (dbug_open): Constify.
* exec.c (exec_open): Constify.
* m32r-rom.c (m32r_open, mon2000_open): Constify.
* microblaze-rom.c (picobug_open): Constify.
* nto-procfs.c (procfs_open_1, procfs_open, procfs_native_open):
Constify.
* ppcbug-rom.c (ppcbug_open0, ppcbug_open1): Constify.
* record-btrace.c (record_btrace_open): Constify.
* record-full.c (record_full_core_open_1, record_full_open_1)
(record_full_open): Constify.
* remote-m32r-sdi.c (m32r_open): Constify.
* remote-mips.c (common_open, mips_open, pmon_open, ddb_open)
(rockhopper_open, lsi_open): Constify.
* remote-sim.c (gdbsim_open): Constify.
* remote.c (remote_open, extended_remote_open, remote_open_1):
Constify.
* target.h (struct target_ops) <to_open>: Make "arg" const.
* tracefile-tfile.c (tfile_open): Constify.
2014-07-22 18:56:01 +02:00
|
|
|
|
char *filename;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
target_preopen (from_tty);
|
constify to_open
This makes target_ops::to_open take a const string and then fixes the
fallout.
There were a few of these I could not build. However I eyeballed it
and in any case the fixes should generally be trivial.
This is based on the patch to fix up the target debugging for to_open,
because that changes gdb to not directly install to_open as the target
command
2014-07-30 Tom Tromey <tromey@redhat.com>
* bsd-kvm.c (bsd_kvm_open): Constify.
* corelow.c (core_open): Constify.
* ctf.c (ctf_open): Constify.
* dbug-rom.c (dbug_open): Constify.
* exec.c (exec_open): Constify.
* m32r-rom.c (m32r_open, mon2000_open): Constify.
* microblaze-rom.c (picobug_open): Constify.
* nto-procfs.c (procfs_open_1, procfs_open, procfs_native_open):
Constify.
* ppcbug-rom.c (ppcbug_open0, ppcbug_open1): Constify.
* record-btrace.c (record_btrace_open): Constify.
* record-full.c (record_full_core_open_1, record_full_open_1)
(record_full_open): Constify.
* remote-m32r-sdi.c (m32r_open): Constify.
* remote-mips.c (common_open, mips_open, pmon_open, ddb_open)
(rockhopper_open, lsi_open): Constify.
* remote-sim.c (gdbsim_open): Constify.
* remote.c (remote_open, extended_remote_open, remote_open_1):
Constify.
* target.h (struct target_ops) <to_open>: Make "arg" const.
* tracefile-tfile.c (tfile_open): Constify.
2014-07-22 18:56:01 +02:00
|
|
|
|
if (!arg)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
|
if (core_bfd)
|
2011-01-05 23:22:53 +01:00
|
|
|
|
error (_("No core file specified. (Use `detach' "
|
|
|
|
|
"to stop debugging a core file.)"));
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
|
else
|
|
|
|
|
error (_("No core file specified."));
|
1999-04-16 03:35:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
constify to_open
This makes target_ops::to_open take a const string and then fixes the
fallout.
There were a few of these I could not build. However I eyeballed it
and in any case the fixes should generally be trivial.
This is based on the patch to fix up the target debugging for to_open,
because that changes gdb to not directly install to_open as the target
command
2014-07-30 Tom Tromey <tromey@redhat.com>
* bsd-kvm.c (bsd_kvm_open): Constify.
* corelow.c (core_open): Constify.
* ctf.c (ctf_open): Constify.
* dbug-rom.c (dbug_open): Constify.
* exec.c (exec_open): Constify.
* m32r-rom.c (m32r_open, mon2000_open): Constify.
* microblaze-rom.c (picobug_open): Constify.
* nto-procfs.c (procfs_open_1, procfs_open, procfs_native_open):
Constify.
* ppcbug-rom.c (ppcbug_open0, ppcbug_open1): Constify.
* record-btrace.c (record_btrace_open): Constify.
* record-full.c (record_full_core_open_1, record_full_open_1)
(record_full_open): Constify.
* remote-m32r-sdi.c (m32r_open): Constify.
* remote-mips.c (common_open, mips_open, pmon_open, ddb_open)
(rockhopper_open, lsi_open): Constify.
* remote-sim.c (gdbsim_open): Constify.
* remote.c (remote_open, extended_remote_open, remote_open_1):
Constify.
* target.h (struct target_ops) <to_open>: Make "arg" const.
* tracefile-tfile.c (tfile_open): Constify.
2014-07-22 18:56:01 +02:00
|
|
|
|
filename = tilde_expand (arg);
|
2010-12-31 23:59:52 +01:00
|
|
|
|
if (!IS_ABSOLUTE_PATH (filename))
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
2010-12-31 23:59:52 +01:00
|
|
|
|
temp = concat (current_directory, "/",
|
|
|
|
|
filename, (char *) NULL);
|
2000-12-15 02:01:51 +01:00
|
|
|
|
xfree (filename);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
filename = temp;
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-15 02:01:51 +01:00
|
|
|
|
old_chain = make_cleanup (xfree, filename);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2004-07-06 16:24:06 +02:00
|
|
|
|
flags = O_BINARY | O_LARGEFILE;
|
|
|
|
|
if (write_files)
|
|
|
|
|
flags |= O_RDWR;
|
|
|
|
|
else
|
|
|
|
|
flags |= O_RDONLY;
|
PR gdb/7912:
* Makefile.in (SFILES): Add filestuff.c
(COMMON_OBS): Add filestuff.o.
(filestuff.o): New target.
* auto-load.c (auto_load_objfile_script_1): Use
gdb_fopen_cloexec.
* auxv.c (procfs_xfer_auxv): Use gdb_open_cloexec.
* cli/cli-cmds.c (shell_escape): Call close_most_fds.
* cli/cli-dump.c (fopen_with_cleanup): Use gdb_fopen_cloexec.
* common/agent.c (gdb_connect_sync_socket): Use
gdb_socket_cloexec.
* common/filestuff.c: New file.
* common/filestuff.h: New file.
* common/linux-osdata.c (linux_common_core_of_thread)
(command_from_pid, commandline_from_pid, print_source_lines)
(linux_xfer_osdata_shm, linux_xfer_osdata_sem)
(linux_xfer_osdata_msg, linux_xfer_osdata_modules): Use
gdb_fopen_cloexec.
* common/linux-procfs.c (linux_proc_get_int)
(linux_proc_pid_has_state): Use gdb_fopen_cloexec.
* config.in, configure: Rebuild.
* configure.ac: Don't check for sys/socket.h. Check for
fdwalk, pipe2.
* corelow.c (core_open): Use gdb_open_cloexec.
* dwarf2read.c (write_psymtabs_to_index): Use gdb_fopen_cloexec.
* fork-child.c (fork_inferior): Call close_most_fds.
* gdb_bfd.c (gdb_bfd_open): Use gdb_open_cloexec.
* inf-child.c (inf_child_fileio_readlink): Use gdb_open_cloexec.
* linux-nat.c (linux_nat_thread_name, linux_proc_pending_signals):
Use gdb_fopen_cloexec.
(linux_proc_xfer_partial, linux_proc_xfer_spu): Use
gdb_open_cloexec.
(linux_async_pipe): Use gdb_pipe_cloexec.
* remote-fileio.c (remote_fileio_func_open): Use
gdb_open_cloexec.
* remote.c (remote_file_put, remote_file_get): Use
gdb_fopen_cloexec.
* ser-pipe.c (pipe_open): Use gdb_socketpair_cloexec,
close_most_fds.
* ser-tcp.c (net_open): Use gdb_socket_cloexec.
* ser-unix.c (hardwire_open): Use gdb_open_cloexec.
* solib.c (solib_find): Use gdb_open_cloexec.
* source.c (openp, find_and_open_source): Use gdb_open_cloexec.
* tracepoint.c (tfile_start): Use gdb_fopen_cloexec.
(tfile_open): Use gdb_open_cloexec.
* tui/tui-io.c (tui_initialize_io): Use gdb_pipe_cloexec.
* ui-file.c (gdb_fopen): Use gdb_fopen_cloexec.
* xml-support.c (xml_fetch_content_from_file): Use
gdb_fopen_cloexec.
* main.c (captured_main): Call notice_open_fds.
gdbserver
* Makefile.in (SFILES): Add filestuff.c.
(OBS): Add filestuff.o.
(filestuff.o): New target.
* config.in, configure: Rebuild.
* configure.ac: Check for fdwalk, pipe2.
2013-04-22 18:46:15 +02:00
|
|
|
|
scratch_chan = gdb_open_cloexec (filename, flags, 0);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
if (scratch_chan < 0)
|
|
|
|
|
perror_with_name (filename);
|
|
|
|
|
|
Use class to manage BFD reference counts
This introduces a new specialization of gdb::ref_ptr that can be used
to manage BFD reference counts. Then it changes most places in gdb to
use this new class, rather than explicit reference-counting or
cleanups. This patch removes make_cleanup_bfd_unref.
If you look you will see a couple of spots using "release" where a use
of gdb_bfd_ref_ptr would be cleaner. These will be fixed in the next
patch.
I think this patch fixes some latent bugs. For example, it seems to
me that previously objfpy_add_separate_debug_file leaked a BFD.
I'm not 100% certain that the macho_symfile_read_all_oso change is
correct. The existing code here is hard for me to follow. One goal
of this sort of automated reference counting, though, is to make it
more difficult to make logic errors; so hopefully the code is clear
now.
2017-01-10 Tom Tromey <tom@tromey.com>
* windows-tdep.c (windows_xfer_shared_library): Update.
* windows-nat.c (windows_make_so): Update.
* utils.h (make_cleanup_bfd_unref): Remove.
* utils.c (do_bfd_close_cleanup, make_cleanup_bfd_unref): Remove.
* symfile.h (symfile_bfd_open)
(find_separate_debug_file_in_section): Return gdb_bfd_ref_ptr.
* symfile.c (read_symbols, symbol_file_add)
(separate_debug_file_exists): Update.
(symfile_bfd_open): Return gdb_bfd_ref_ptr.
(generic_load, reread_symbols): Update.
* symfile-mem.c (symbol_file_add_from_memory): Update.
* spu-linux-nat.c (spu_bfd_open): Return gdb_bfd_ref_ptr.
(spu_symbol_file_add_from_memory): Update.
* solist.h (struct target_so_ops) <bfd_open>: Return
gdb_bfd_ref_ptr.
(solib_bfd_fopen, solib_bfd_open): Return gdb_bfd_ref_ptr.
* solib.c (solib_bfd_fopen, solib_bfd_open): Return
gdb_bfd_ref_ptr.
(solib_map_sections, reload_shared_libraries_1): Update.
* solib-svr4.c (enable_break): Update.
* solib-spu.c (spu_bfd_fopen): Return gdb_bfd_ref_ptr.
* solib-frv.c (enable_break2): Update.
* solib-dsbt.c (enable_break): Update.
* solib-darwin.c (gdb_bfd_mach_o_fat_extract): Return
gdb_bfd_ref_ptr.
(darwin_solib_get_all_image_info_addr_at_init): Update.
(darwin_bfd_open): Return gdb_bfd_ref_ptr.
* solib-aix.c (solib_aix_bfd_open): Return gdb_bfd_ref_ptr.
* record-full.c (record_full_save): Update.
* python/py-objfile.c (objfpy_add_separate_debug_file): Update.
* procfs.c (insert_dbx_link_bpt_in_file): Update.
* minidebug.c (find_separate_debug_file_in_section): Return
gdb_bfd_ref_ptr.
* machoread.c (macho_add_oso_symfile): Change abfd to
gdb_bfd_ref_ptr.
(macho_symfile_read_all_oso): Update.
(macho_check_dsym): Return gdb_bfd_ref_ptr.
(macho_symfile_read): Update.
* jit.c (bfd_open_from_target_memory): Return gdb_bfd_ref_ptr.
(jit_bfd_try_read_symtab): Update.
* gdb_bfd.h (gdb_bfd_open, gdb_bfd_fopen, gdb_bfd_openr)
(gdb_bfd_openw, gdb_bfd_openr_iovec)
(gdb_bfd_openr_next_archived_file, gdb_bfd_fdopenr): Return
gdb_bfd_ref_ptr.
(gdb_bfd_ref_policy): New struct.
(gdb_bfd_ref_ptr): New typedef.
* gdb_bfd.c (gdb_bfd_open, gdb_bfd_fopen, gdb_bfd_openr)
(gdb_bfd_openw, gdb_bfd_openr_iovec)
(gdb_bfd_openr_next_archived_file, gdb_bfd_fdopenr): Return
gdb_bfd_ref_ptr.
* gcore.h (create_gcore_bfd): Return gdb_bfd_ref_ptr.
* gcore.c (create_gcore_bfd): Return gdb_bfd_ref_ptr.
(gcore_command): Update.
* exec.c (exec_file_attach): Update.
* elfread.c (elf_symfile_read): Update.
* dwarf2read.c (dwarf2_get_dwz_file): Update.
(try_open_dwop_file, open_dwo_file): Return gdb_bfd_ref_ptr.
(open_and_init_dwo_file): Update.
(open_dwp_file): Return gdb_bfd_ref_ptr.
(open_and_init_dwp_file): Update.
* corelow.c (core_open): Update.
* compile/compile-object-load.c (compile_object_load): Update.
* common/gdb_ref_ptr.h (ref_ptr::operator->): New operator.
* coffread.c (coff_symfile_read): Update.
* cli/cli-dump.c (bfd_openr_or_error, bfd_openw_or_error): Return
gdb_bfd_ref_ptr. Rename.
(dump_bfd_file, restore_command): Update.
* build-id.h (build_id_to_debug_bfd): Return gdb_bfd_ref_ptr.
* build-id.c (build_id_to_debug_bfd): Return gdb_bfd_ref_ptr.
(find_separate_debug_file_by_buildid): Update.
2016-11-21 19:12:23 +01:00
|
|
|
|
gdb_bfd_ref_ptr temp_bfd (gdb_bfd_fopen (filename, gnutarget,
|
|
|
|
|
write_files ? FOPEN_RUB : FOPEN_RB,
|
|
|
|
|
scratch_chan));
|
1999-04-16 03:35:26 +02:00
|
|
|
|
if (temp_bfd == NULL)
|
|
|
|
|
perror_with_name (filename);
|
|
|
|
|
|
Use class to manage BFD reference counts
This introduces a new specialization of gdb::ref_ptr that can be used
to manage BFD reference counts. Then it changes most places in gdb to
use this new class, rather than explicit reference-counting or
cleanups. This patch removes make_cleanup_bfd_unref.
If you look you will see a couple of spots using "release" where a use
of gdb_bfd_ref_ptr would be cleaner. These will be fixed in the next
patch.
I think this patch fixes some latent bugs. For example, it seems to
me that previously objfpy_add_separate_debug_file leaked a BFD.
I'm not 100% certain that the macho_symfile_read_all_oso change is
correct. The existing code here is hard for me to follow. One goal
of this sort of automated reference counting, though, is to make it
more difficult to make logic errors; so hopefully the code is clear
now.
2017-01-10 Tom Tromey <tom@tromey.com>
* windows-tdep.c (windows_xfer_shared_library): Update.
* windows-nat.c (windows_make_so): Update.
* utils.h (make_cleanup_bfd_unref): Remove.
* utils.c (do_bfd_close_cleanup, make_cleanup_bfd_unref): Remove.
* symfile.h (symfile_bfd_open)
(find_separate_debug_file_in_section): Return gdb_bfd_ref_ptr.
* symfile.c (read_symbols, symbol_file_add)
(separate_debug_file_exists): Update.
(symfile_bfd_open): Return gdb_bfd_ref_ptr.
(generic_load, reread_symbols): Update.
* symfile-mem.c (symbol_file_add_from_memory): Update.
* spu-linux-nat.c (spu_bfd_open): Return gdb_bfd_ref_ptr.
(spu_symbol_file_add_from_memory): Update.
* solist.h (struct target_so_ops) <bfd_open>: Return
gdb_bfd_ref_ptr.
(solib_bfd_fopen, solib_bfd_open): Return gdb_bfd_ref_ptr.
* solib.c (solib_bfd_fopen, solib_bfd_open): Return
gdb_bfd_ref_ptr.
(solib_map_sections, reload_shared_libraries_1): Update.
* solib-svr4.c (enable_break): Update.
* solib-spu.c (spu_bfd_fopen): Return gdb_bfd_ref_ptr.
* solib-frv.c (enable_break2): Update.
* solib-dsbt.c (enable_break): Update.
* solib-darwin.c (gdb_bfd_mach_o_fat_extract): Return
gdb_bfd_ref_ptr.
(darwin_solib_get_all_image_info_addr_at_init): Update.
(darwin_bfd_open): Return gdb_bfd_ref_ptr.
* solib-aix.c (solib_aix_bfd_open): Return gdb_bfd_ref_ptr.
* record-full.c (record_full_save): Update.
* python/py-objfile.c (objfpy_add_separate_debug_file): Update.
* procfs.c (insert_dbx_link_bpt_in_file): Update.
* minidebug.c (find_separate_debug_file_in_section): Return
gdb_bfd_ref_ptr.
* machoread.c (macho_add_oso_symfile): Change abfd to
gdb_bfd_ref_ptr.
(macho_symfile_read_all_oso): Update.
(macho_check_dsym): Return gdb_bfd_ref_ptr.
(macho_symfile_read): Update.
* jit.c (bfd_open_from_target_memory): Return gdb_bfd_ref_ptr.
(jit_bfd_try_read_symtab): Update.
* gdb_bfd.h (gdb_bfd_open, gdb_bfd_fopen, gdb_bfd_openr)
(gdb_bfd_openw, gdb_bfd_openr_iovec)
(gdb_bfd_openr_next_archived_file, gdb_bfd_fdopenr): Return
gdb_bfd_ref_ptr.
(gdb_bfd_ref_policy): New struct.
(gdb_bfd_ref_ptr): New typedef.
* gdb_bfd.c (gdb_bfd_open, gdb_bfd_fopen, gdb_bfd_openr)
(gdb_bfd_openw, gdb_bfd_openr_iovec)
(gdb_bfd_openr_next_archived_file, gdb_bfd_fdopenr): Return
gdb_bfd_ref_ptr.
* gcore.h (create_gcore_bfd): Return gdb_bfd_ref_ptr.
* gcore.c (create_gcore_bfd): Return gdb_bfd_ref_ptr.
(gcore_command): Update.
* exec.c (exec_file_attach): Update.
* elfread.c (elf_symfile_read): Update.
* dwarf2read.c (dwarf2_get_dwz_file): Update.
(try_open_dwop_file, open_dwo_file): Return gdb_bfd_ref_ptr.
(open_and_init_dwo_file): Update.
(open_dwp_file): Return gdb_bfd_ref_ptr.
(open_and_init_dwp_file): Update.
* corelow.c (core_open): Update.
* compile/compile-object-load.c (compile_object_load): Update.
* common/gdb_ref_ptr.h (ref_ptr::operator->): New operator.
* coffread.c (coff_symfile_read): Update.
* cli/cli-dump.c (bfd_openr_or_error, bfd_openw_or_error): Return
gdb_bfd_ref_ptr. Rename.
(dump_bfd_file, restore_command): Update.
* build-id.h (build_id_to_debug_bfd): Return gdb_bfd_ref_ptr.
* build-id.c (build_id_to_debug_bfd): Return gdb_bfd_ref_ptr.
(find_separate_debug_file_by_buildid): Update.
2016-11-21 19:12:23 +01:00
|
|
|
|
if (!bfd_check_format (temp_bfd.get (), bfd_core)
|
|
|
|
|
&& !gdb_check_format (temp_bfd.get ()))
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
/* Do it after the err msg */
|
2010-12-31 23:59:52 +01:00
|
|
|
|
/* FIXME: should be checking for errors from bfd_close (for one
|
|
|
|
|
thing, on error it does not free all the storage associated
|
|
|
|
|
with the bfd). */
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
|
error (_("\"%s\" is not a core dump: %s"),
|
1999-04-16 03:35:26 +02:00
|
|
|
|
filename, bfd_errmsg (bfd_get_error ()));
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-31 23:59:52 +01:00
|
|
|
|
/* Looks semi-reasonable. Toss the old core file and work on the
|
|
|
|
|
new. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2012-07-18 21:34:57 +02:00
|
|
|
|
do_cleanups (old_chain);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
unpush_target (&core_ops);
|
Use class to manage BFD reference counts
This introduces a new specialization of gdb::ref_ptr that can be used
to manage BFD reference counts. Then it changes most places in gdb to
use this new class, rather than explicit reference-counting or
cleanups. This patch removes make_cleanup_bfd_unref.
If you look you will see a couple of spots using "release" where a use
of gdb_bfd_ref_ptr would be cleaner. These will be fixed in the next
patch.
I think this patch fixes some latent bugs. For example, it seems to
me that previously objfpy_add_separate_debug_file leaked a BFD.
I'm not 100% certain that the macho_symfile_read_all_oso change is
correct. The existing code here is hard for me to follow. One goal
of this sort of automated reference counting, though, is to make it
more difficult to make logic errors; so hopefully the code is clear
now.
2017-01-10 Tom Tromey <tom@tromey.com>
* windows-tdep.c (windows_xfer_shared_library): Update.
* windows-nat.c (windows_make_so): Update.
* utils.h (make_cleanup_bfd_unref): Remove.
* utils.c (do_bfd_close_cleanup, make_cleanup_bfd_unref): Remove.
* symfile.h (symfile_bfd_open)
(find_separate_debug_file_in_section): Return gdb_bfd_ref_ptr.
* symfile.c (read_symbols, symbol_file_add)
(separate_debug_file_exists): Update.
(symfile_bfd_open): Return gdb_bfd_ref_ptr.
(generic_load, reread_symbols): Update.
* symfile-mem.c (symbol_file_add_from_memory): Update.
* spu-linux-nat.c (spu_bfd_open): Return gdb_bfd_ref_ptr.
(spu_symbol_file_add_from_memory): Update.
* solist.h (struct target_so_ops) <bfd_open>: Return
gdb_bfd_ref_ptr.
(solib_bfd_fopen, solib_bfd_open): Return gdb_bfd_ref_ptr.
* solib.c (solib_bfd_fopen, solib_bfd_open): Return
gdb_bfd_ref_ptr.
(solib_map_sections, reload_shared_libraries_1): Update.
* solib-svr4.c (enable_break): Update.
* solib-spu.c (spu_bfd_fopen): Return gdb_bfd_ref_ptr.
* solib-frv.c (enable_break2): Update.
* solib-dsbt.c (enable_break): Update.
* solib-darwin.c (gdb_bfd_mach_o_fat_extract): Return
gdb_bfd_ref_ptr.
(darwin_solib_get_all_image_info_addr_at_init): Update.
(darwin_bfd_open): Return gdb_bfd_ref_ptr.
* solib-aix.c (solib_aix_bfd_open): Return gdb_bfd_ref_ptr.
* record-full.c (record_full_save): Update.
* python/py-objfile.c (objfpy_add_separate_debug_file): Update.
* procfs.c (insert_dbx_link_bpt_in_file): Update.
* minidebug.c (find_separate_debug_file_in_section): Return
gdb_bfd_ref_ptr.
* machoread.c (macho_add_oso_symfile): Change abfd to
gdb_bfd_ref_ptr.
(macho_symfile_read_all_oso): Update.
(macho_check_dsym): Return gdb_bfd_ref_ptr.
(macho_symfile_read): Update.
* jit.c (bfd_open_from_target_memory): Return gdb_bfd_ref_ptr.
(jit_bfd_try_read_symtab): Update.
* gdb_bfd.h (gdb_bfd_open, gdb_bfd_fopen, gdb_bfd_openr)
(gdb_bfd_openw, gdb_bfd_openr_iovec)
(gdb_bfd_openr_next_archived_file, gdb_bfd_fdopenr): Return
gdb_bfd_ref_ptr.
(gdb_bfd_ref_policy): New struct.
(gdb_bfd_ref_ptr): New typedef.
* gdb_bfd.c (gdb_bfd_open, gdb_bfd_fopen, gdb_bfd_openr)
(gdb_bfd_openw, gdb_bfd_openr_iovec)
(gdb_bfd_openr_next_archived_file, gdb_bfd_fdopenr): Return
gdb_bfd_ref_ptr.
* gcore.h (create_gcore_bfd): Return gdb_bfd_ref_ptr.
* gcore.c (create_gcore_bfd): Return gdb_bfd_ref_ptr.
(gcore_command): Update.
* exec.c (exec_file_attach): Update.
* elfread.c (elf_symfile_read): Update.
* dwarf2read.c (dwarf2_get_dwz_file): Update.
(try_open_dwop_file, open_dwo_file): Return gdb_bfd_ref_ptr.
(open_and_init_dwo_file): Update.
(open_dwp_file): Return gdb_bfd_ref_ptr.
(open_and_init_dwp_file): Update.
* corelow.c (core_open): Update.
* compile/compile-object-load.c (compile_object_load): Update.
* common/gdb_ref_ptr.h (ref_ptr::operator->): New operator.
* coffread.c (coff_symfile_read): Update.
* cli/cli-dump.c (bfd_openr_or_error, bfd_openw_or_error): Return
gdb_bfd_ref_ptr. Rename.
(dump_bfd_file, restore_command): Update.
* build-id.h (build_id_to_debug_bfd): Return gdb_bfd_ref_ptr.
* build-id.c (build_id_to_debug_bfd): Return gdb_bfd_ref_ptr.
(find_separate_debug_file_by_buildid): Update.
2016-11-21 19:12:23 +01:00
|
|
|
|
core_bfd = temp_bfd.release ();
|
2000-05-22 11:02:23 +02:00
|
|
|
|
old_chain = make_cleanup (core_close_cleanup, 0 /*ignore*/);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2003-10-29 21:59:07 +01:00
|
|
|
|
core_gdbarch = gdbarch_from_bfd (core_bfd);
|
|
|
|
|
|
1999-10-06 01:13:56 +02:00
|
|
|
|
/* Find a suitable core file handler to munch on core_bfd */
|
|
|
|
|
core_vec = sniff_core_bfd (core_bfd);
|
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
|
validate_files ();
|
|
|
|
|
|
2013-12-28 23:31:01 +01:00
|
|
|
|
core_data = XCNEW (struct target_section_table);
|
2009-06-03 20:50:36 +02:00
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
|
/* Find the data section */
|
2009-06-03 20:50:36 +02:00
|
|
|
|
if (build_section_table (core_bfd,
|
2010-12-31 23:59:52 +01:00
|
|
|
|
&core_data->sections,
|
|
|
|
|
&core_data->sections_end))
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
|
error (_("\"%s\": Can't find sections: %s"),
|
1999-04-16 03:35:26 +02:00
|
|
|
|
bfd_get_filename (core_bfd), bfd_errmsg (bfd_get_error ()));
|
|
|
|
|
|
2002-05-18 01:06:10 +02:00
|
|
|
|
/* If we have no exec file, try to set the architecture from the
|
|
|
|
|
core file. We don't do this unconditionally since an exec file
|
|
|
|
|
typically contains more information that helps us determine the
|
|
|
|
|
architecture than a core file. */
|
|
|
|
|
if (!exec_bfd)
|
|
|
|
|
set_gdbarch_from_file (core_bfd);
|
2000-04-27 17:33:01 +02:00
|
|
|
|
|
2008-08-19 01:12:40 +02:00
|
|
|
|
push_target (&core_ops);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
discard_cleanups (old_chain);
|
|
|
|
|
|
2008-09-08 23:36:01 +02:00
|
|
|
|
/* Do this before acknowledging the inferior, so if
|
|
|
|
|
post_create_inferior throws (can happen easilly if you're loading
|
|
|
|
|
a core file with the wrong exec), we aren't left with threads
|
|
|
|
|
from the previous inferior. */
|
|
|
|
|
init_thread_list ();
|
|
|
|
|
|
2009-10-09 02:49:06 +02:00
|
|
|
|
inferior_ptid = null_ptid;
|
2008-09-08 23:36:01 +02:00
|
|
|
|
|
2009-05-18 14:12:16 +02:00
|
|
|
|
/* Need to flush the register cache (and the frame cache) from a
|
|
|
|
|
previous debug session. If inferior_ptid ends up the same as the
|
|
|
|
|
last debug session --- e.g., b foo; run; gcore core1; step; gcore
|
|
|
|
|
core2; core core1; core core2 --- then there's potential for
|
|
|
|
|
get_current_regcache to return the cached regcache of the
|
|
|
|
|
previous session, and the frame cache being stale. */
|
|
|
|
|
registers_changed ();
|
|
|
|
|
|
2008-09-08 23:36:01 +02:00
|
|
|
|
/* Build up thread list from BFD sections, and possibly set the
|
|
|
|
|
current thread to the .reg/NN section matching the .reg
|
2010-12-31 23:59:52 +01:00
|
|
|
|
section. */
|
2008-09-08 23:36:01 +02:00
|
|
|
|
bfd_map_over_sections (core_bfd, add_to_thread_list,
|
|
|
|
|
bfd_get_section_by_name (core_bfd, ".reg"));
|
|
|
|
|
|
2009-10-09 02:49:06 +02:00
|
|
|
|
if (ptid_equal (inferior_ptid, null_ptid))
|
|
|
|
|
{
|
|
|
|
|
/* Either we found no .reg/NN section, and hence we have a
|
|
|
|
|
non-threaded core (single-threaded, from gdb's perspective),
|
|
|
|
|
or for some reason add_to_thread_list couldn't determine
|
|
|
|
|
which was the "main" thread. The latter case shouldn't
|
|
|
|
|
usually happen, but we're dealing with input here, which can
|
|
|
|
|
always be broken in different ways. */
|
|
|
|
|
struct thread_info *thread = first_thread_of_process (-1);
|
2010-05-14 01:53:32 +02:00
|
|
|
|
|
2009-10-09 02:49:06 +02:00
|
|
|
|
if (thread == NULL)
|
|
|
|
|
{
|
2009-12-31 11:57:30 +01:00
|
|
|
|
inferior_appeared (current_inferior (), CORELOW_PID);
|
2009-10-09 02:49:06 +02:00
|
|
|
|
inferior_ptid = pid_to_ptid (CORELOW_PID);
|
|
|
|
|
add_thread_silent (inferior_ptid);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
switch_to_thread (thread->ptid);
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-16 04:16:24 +01:00
|
|
|
|
post_create_inferior (&core_ops, from_tty);
|
|
|
|
|
|
2008-09-08 23:36:01 +02:00
|
|
|
|
/* Now go through the target stack looking for threads since there
|
|
|
|
|
may be a thread_stratum target loaded on top of target core by
|
|
|
|
|
now. The layer above should claim threads found in the BFD
|
|
|
|
|
sections. */
|
Split TRY_CATCH into TRY + CATCH
This patch splits the TRY_CATCH macro into three, so that we go from
this:
~~~
volatile gdb_exception ex;
TRY_CATCH (ex, RETURN_MASK_ERROR)
{
}
if (ex.reason < 0)
{
}
~~~
to this:
~~~
TRY
{
}
CATCH (ex, RETURN_MASK_ERROR)
{
}
END_CATCH
~~~
Thus, we'll be getting rid of the local volatile exception object, and
declaring the caught exception in the catch block.
This allows reimplementing TRY/CATCH in terms of C++ exceptions when
building in C++ mode, while still allowing to build GDB in C mode
(using setjmp/longjmp), as a transition step.
TBC, after this patch, is it _not_ valid to have code between the TRY
and the CATCH blocks, like:
TRY
{
}
// some code here.
CATCH (ex, RETURN_MASK_ERROR)
{
}
END_CATCH
Just like it isn't valid to do that with C++'s native try/catch.
By switching to creating the exception object inside the CATCH block
scope, we can get rid of all the explicitly allocated volatile
exception objects all over the tree, and map the CATCH block more
directly to C++'s catch blocks.
The majority of the TRY_CATCH -> TRY+CATCH+END_CATCH conversion was
done with a script, rerun from scratch at every rebase, no manual
editing involved. After the mechanical conversion, a few places
needed manual intervention, to fix preexisting cases where we were
using the exception object outside of the TRY_CATCH block, and cases
where we were using "else" after a 'if (ex.reason) < 0)' [a CATCH
after this patch]. The result was folded into this patch so that GDB
still builds at each incremental step.
END_CATCH is necessary for two reasons:
First, because we name the exception object in the CATCH block, which
requires creating a scope, which in turn must be closed somewhere.
Declaring the exception variable in the initializer field of a for
block, like:
#define CATCH(EXCEPTION, mask) \
for (struct gdb_exception EXCEPTION; \
exceptions_state_mc_catch (&EXCEPTION, MASK); \
EXCEPTION = exception_none)
would avoid needing END_CATCH, but alas, in C mode, we build with C90,
which doesn't allow mixed declarations and code.
Second, because when TRY/CATCH are wired to real C++ try/catch, as
long as we need to handle cleanup chains, even if there's no CATCH
block that wants to catch the exception, we need for stop at every
frame in the unwind chain and run cleanups, then rethrow. That will
be done in END_CATCH.
After we require C++, we'll still need TRY/CATCH/END_CATCH until
cleanups are completely phased out -- TRY/CATCH in C++ mode will
save/restore the current cleanup chain, like in C mode, and END_CATCH
catches otherwise uncaugh exceptions, runs cleanups and rethrows, so
that C++ cleanups and exceptions can coexist.
IMO, this still makes the TRY/CATCH code look a bit more like a
newcomer would expect, so IMO worth it even if we weren't considering
C++.
gdb/ChangeLog.
2015-03-07 Pedro Alves <palves@redhat.com>
* common/common-exceptions.c (struct catcher) <exception>: No
longer a pointer to volatile exception. Now an exception value.
<mask>: Delete field.
(exceptions_state_mc_init): Remove all parameters. Adjust.
(exceptions_state_mc): No longer pop the catcher here.
(exceptions_state_mc_catch): New function.
(throw_exception): Adjust.
* common/common-exceptions.h (exceptions_state_mc_init): Remove
all parameters.
(exceptions_state_mc_catch): Declare.
(TRY_CATCH): Rename to ...
(TRY): ... this. Remove EXCEPTION and MASK parameters.
(CATCH, END_CATCH): New.
All callers adjusted.
gdb/gdbserver/ChangeLog:
2015-03-07 Pedro Alves <palves@redhat.com>
Adjust all callers of TRY_CATCH to use TRY/CATCH/END_CATCH
instead.
2015-03-07 16:14:14 +01:00
|
|
|
|
TRY
|
2012-01-09 21:27:49 +01:00
|
|
|
|
{
|
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
|
|
|
|
target_update_thread_list ();
|
2012-01-09 21:27:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
Split TRY_CATCH into TRY + CATCH
This patch splits the TRY_CATCH macro into three, so that we go from
this:
~~~
volatile gdb_exception ex;
TRY_CATCH (ex, RETURN_MASK_ERROR)
{
}
if (ex.reason < 0)
{
}
~~~
to this:
~~~
TRY
{
}
CATCH (ex, RETURN_MASK_ERROR)
{
}
END_CATCH
~~~
Thus, we'll be getting rid of the local volatile exception object, and
declaring the caught exception in the catch block.
This allows reimplementing TRY/CATCH in terms of C++ exceptions when
building in C++ mode, while still allowing to build GDB in C mode
(using setjmp/longjmp), as a transition step.
TBC, after this patch, is it _not_ valid to have code between the TRY
and the CATCH blocks, like:
TRY
{
}
// some code here.
CATCH (ex, RETURN_MASK_ERROR)
{
}
END_CATCH
Just like it isn't valid to do that with C++'s native try/catch.
By switching to creating the exception object inside the CATCH block
scope, we can get rid of all the explicitly allocated volatile
exception objects all over the tree, and map the CATCH block more
directly to C++'s catch blocks.
The majority of the TRY_CATCH -> TRY+CATCH+END_CATCH conversion was
done with a script, rerun from scratch at every rebase, no manual
editing involved. After the mechanical conversion, a few places
needed manual intervention, to fix preexisting cases where we were
using the exception object outside of the TRY_CATCH block, and cases
where we were using "else" after a 'if (ex.reason) < 0)' [a CATCH
after this patch]. The result was folded into this patch so that GDB
still builds at each incremental step.
END_CATCH is necessary for two reasons:
First, because we name the exception object in the CATCH block, which
requires creating a scope, which in turn must be closed somewhere.
Declaring the exception variable in the initializer field of a for
block, like:
#define CATCH(EXCEPTION, mask) \
for (struct gdb_exception EXCEPTION; \
exceptions_state_mc_catch (&EXCEPTION, MASK); \
EXCEPTION = exception_none)
would avoid needing END_CATCH, but alas, in C mode, we build with C90,
which doesn't allow mixed declarations and code.
Second, because when TRY/CATCH are wired to real C++ try/catch, as
long as we need to handle cleanup chains, even if there's no CATCH
block that wants to catch the exception, we need for stop at every
frame in the unwind chain and run cleanups, then rethrow. That will
be done in END_CATCH.
After we require C++, we'll still need TRY/CATCH/END_CATCH until
cleanups are completely phased out -- TRY/CATCH in C++ mode will
save/restore the current cleanup chain, like in C mode, and END_CATCH
catches otherwise uncaugh exceptions, runs cleanups and rethrows, so
that C++ cleanups and exceptions can coexist.
IMO, this still makes the TRY/CATCH code look a bit more like a
newcomer would expect, so IMO worth it even if we weren't considering
C++.
gdb/ChangeLog.
2015-03-07 Pedro Alves <palves@redhat.com>
* common/common-exceptions.c (struct catcher) <exception>: No
longer a pointer to volatile exception. Now an exception value.
<mask>: Delete field.
(exceptions_state_mc_init): Remove all parameters. Adjust.
(exceptions_state_mc): No longer pop the catcher here.
(exceptions_state_mc_catch): New function.
(throw_exception): Adjust.
* common/common-exceptions.h (exceptions_state_mc_init): Remove
all parameters.
(exceptions_state_mc_catch): Declare.
(TRY_CATCH): Rename to ...
(TRY): ... this. Remove EXCEPTION and MASK parameters.
(CATCH, END_CATCH): New.
All callers adjusted.
gdb/gdbserver/ChangeLog:
2015-03-07 Pedro Alves <palves@redhat.com>
Adjust all callers of TRY_CATCH to use TRY/CATCH/END_CATCH
instead.
2015-03-07 16:14:14 +01:00
|
|
|
|
CATCH (except, RETURN_MASK_ERROR)
|
|
|
|
|
{
|
|
|
|
|
exception_print (gdb_stderr, except);
|
|
|
|
|
}
|
|
|
|
|
END_CATCH
|
2008-09-08 23:36:01 +02:00
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
|
p = bfd_core_file_failing_command (core_bfd);
|
|
|
|
|
if (p)
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up some of printf_filtered and printf_unfiltered.
* ada-lang.c, annotate.c, arch-utils.c, breakpoint.c: Update.
* corelow.c, cp-namespace.c, cp-support.c, dcache.c: Update.
* demangle.c, dsrec.c, dwarf2read.c, dwarfread.c: Update.
* event-loop.c, event-top.c, exec.c, f-valprint.c: Update.
* gdbtypes.c, inf-loop.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcmd.c, inflow.c, infrun.c, inftarg.c, language.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, maint.c: Update.
* mdebugread.c, memattr.c, monitor.c, objc-lang.c: Update.
* ocd.c, osabi.c, printcmd.c, procfs.c, regcache.c: Update.
* remote.c, solib-som.c, solib.c, somsolib.c, source.c: Update.
* stack.c, symfile.c, symmisc.c, target.c, thread.c: Update.
* top.c, utils.c, valprint.c, value.c, cli/cli-cmds.c: Update.
* cli/cli-dump.c, cli/cli-logging.c, tui/tui-hooks.c: Update.
* tui/tui-regs.c, tui/tui-win.c: Update.
2005-02-12 01:39:24 +01:00
|
|
|
|
printf_filtered (_("Core was generated by `%s'.\n"), p);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2013-10-07 07:34:11 +02:00
|
|
|
|
/* Clearing any previous state of convenience variables. */
|
|
|
|
|
clear_exit_convenience_vars ();
|
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
|
siggy = bfd_core_file_failing_signal (core_bfd);
|
|
|
|
|
if (siggy > 0)
|
2010-09-06 15:59:03 +02:00
|
|
|
|
{
|
2012-05-24 19:03:28 +02:00
|
|
|
|
/* If we don't have a CORE_GDBARCH to work with, assume a native
|
2012-06-04 18:23:57 +02:00
|
|
|
|
core (map gdb_signal from host signals). If we do have
|
|
|
|
|
CORE_GDBARCH to work with, but no gdb_signal_from_target
|
|
|
|
|
implementation for that gdbarch, as a fallback measure,
|
|
|
|
|
assume the host signal mapping. It'll be correct for native
|
|
|
|
|
cores, but most likely incorrect for cross-cores. */
|
2012-05-24 18:39:15 +02:00
|
|
|
|
enum gdb_signal sig = (core_gdbarch != NULL
|
2012-06-04 18:23:57 +02:00
|
|
|
|
&& gdbarch_gdb_signal_from_target_p (core_gdbarch)
|
|
|
|
|
? gdbarch_gdb_signal_from_target (core_gdbarch,
|
|
|
|
|
siggy)
|
|
|
|
|
: gdb_signal_from_host (siggy));
|
2010-09-06 15:59:03 +02:00
|
|
|
|
|
2013-06-17 08:14:24 +02:00
|
|
|
|
printf_filtered (_("Program terminated with signal %s, %s.\n"),
|
|
|
|
|
gdb_signal_to_name (sig), gdb_signal_to_string (sig));
|
2013-10-07 07:34:11 +02:00
|
|
|
|
|
|
|
|
|
/* Set the value of the internal variable $_exitsignal,
|
|
|
|
|
which holds the signal uncaught by the inferior. */
|
|
|
|
|
set_internalvar_integer (lookup_internalvar ("_exitsignal"),
|
|
|
|
|
siggy);
|
2010-09-06 15:59:03 +02:00
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2008-08-19 01:12:40 +02:00
|
|
|
|
/* Fetch all registers from core file. */
|
|
|
|
|
target_fetch_registers (get_current_regcache (), -1);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2008-08-19 01:12:40 +02:00
|
|
|
|
/* Now, set up the frame cache, and print the top of stack. */
|
|
|
|
|
reinit_frame_cache ();
|
PR gdb/15911: "info threads" changes the default source and line (for "break", "list")
"info threads" changes the default source for "break" and "list", to
whatever the location of the first/bottom thread in the thread list
is...
(gdb) b start
(gdb) c
...
(gdb) list
*lists "start"*
(gdb) b 23
Breakpoint 3 at 0x400614: file test.c, line 23.
(gdb) info threads
Id Target Id Frame
* 2 Thread 0x7ffff7fcb700 (LWP 1760) "test" start (arg=0x0) at test.c:23
1 Thread 0x7ffff7fcc740 (LWP 1748) "test" 0x000000323dc08e60 in pthread_join (threadid=140737353922304, thread_return=0x0) at pthread_join.c:93
(gdb) b 23
Breakpoint 4 at 0x323dc08d90: file pthread_join.c, line 23.
^^^^^^^^^^^^^^^
(gdb) list
93 lll_wait_tid (pd->tid);
94
95
96 /* Restore cancellation mode. */
97 CANCEL_RESET (oldtype);
98
99 /* Remove the handler. */
100 pthread_cleanup_pop (0);
101
102
The issue is that print_stack_frame always sets the current sal to the
frame's sal. print_frame_info (which print_stack_frame calls to do
most of the work) also sets the last displayed sal, but only if
print_what isn't LOCATION. Now the call in question, from within
thread.c:print_thread_info, does pass in LOCATION as print_what, but
print_stack_frame doesn't have the same check print_frame_info has.
We could consider adding it, but setting these globals depending on
print_what isn't very clean, IMO. What we have is two logically
distinct operations mixed in the same function(s):
#1 - print frame, in the format specified by {print_what,
print_level and print_args}.
#2 - We're displaying a frame to the user, and I want the default
sal to point here, because the program stopped here, or the user
did some context-changing command (up, down, etc.).
So I added a new parameter to print_stack_frame & friends for point
#2, and went through all calls in the tree adjusting as necessary.
Tested on x86_64 Fedora 17.
gdb/
2013-09-17 Pedro Alves <palves@redhat.com>
PR gdb/15911
* ada-tasks.c (task_command_1): Adjust call to print_stack_frame.
* bsd-kvm.c (bsd_kvm_open, bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd):
* corelow.c (core_open):
* frame.h (print_stack_frame, print_frame_info): New
'set_current_sal' parameter.
* infcmd.c (finish_command, kill_command): Adjust call to
print_stack_frame.
* inferior.c (inferior_command): Likewise.
* infrun.c (normal_stop): Likewise.
* linux-fork.c (linux_fork_context): Likewise.
* record-full.c (record_full_goto_entry, record_full_restore):
Likewise.
* remote-mips.c (common_open): Likewise.
* stack.c (print_stack_frame): New 'set_current_sal' parameter.
Use it.
(print_frame_info): New 'set_current_sal' parameter. Set the last
displayed sal depending on the new paremeter instead of looking at
print_what.
(backtrace_command_1, select_and_print_frame, frame_command)
(current_frame_command, up_command, down_command): Adjust call to
print_stack_frame.
* thread.c (print_thread_info, restore_selected_frame)
(do_captured_thread_select): Adjust call to print_stack_frame.
* tracepoint.c (tfind_1): Likewise.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames)
(mi_cmd_stack_info_frame): Likewise.
* mi/mi-interp.c (mi_on_normal_stop): Likewise.
* mi/mi-main.c (mi_cmd_exec_return, mi_cmd_trace_find): Likewise.
gdb/testsuite/
* gdb.threads/info-threads-cur-sal-2.c: New file.
* gdb.threads/info-threads-cur-sal.c: New file.
* gdb.threads/info-threads-cur-sal.exp: New file.
2013-09-17 20:26:41 +02:00
|
|
|
|
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
|
2015-01-22 21:02:24 +01:00
|
|
|
|
|
|
|
|
|
/* Current thread should be NUM 1 but the user does not know that.
|
|
|
|
|
If a program is single threaded gdb in general does not mention
|
|
|
|
|
anything about threads. That is why the test is >= 2. */
|
|
|
|
|
if (thread_count () >= 2)
|
|
|
|
|
{
|
Split TRY_CATCH into TRY + CATCH
This patch splits the TRY_CATCH macro into three, so that we go from
this:
~~~
volatile gdb_exception ex;
TRY_CATCH (ex, RETURN_MASK_ERROR)
{
}
if (ex.reason < 0)
{
}
~~~
to this:
~~~
TRY
{
}
CATCH (ex, RETURN_MASK_ERROR)
{
}
END_CATCH
~~~
Thus, we'll be getting rid of the local volatile exception object, and
declaring the caught exception in the catch block.
This allows reimplementing TRY/CATCH in terms of C++ exceptions when
building in C++ mode, while still allowing to build GDB in C mode
(using setjmp/longjmp), as a transition step.
TBC, after this patch, is it _not_ valid to have code between the TRY
and the CATCH blocks, like:
TRY
{
}
// some code here.
CATCH (ex, RETURN_MASK_ERROR)
{
}
END_CATCH
Just like it isn't valid to do that with C++'s native try/catch.
By switching to creating the exception object inside the CATCH block
scope, we can get rid of all the explicitly allocated volatile
exception objects all over the tree, and map the CATCH block more
directly to C++'s catch blocks.
The majority of the TRY_CATCH -> TRY+CATCH+END_CATCH conversion was
done with a script, rerun from scratch at every rebase, no manual
editing involved. After the mechanical conversion, a few places
needed manual intervention, to fix preexisting cases where we were
using the exception object outside of the TRY_CATCH block, and cases
where we were using "else" after a 'if (ex.reason) < 0)' [a CATCH
after this patch]. The result was folded into this patch so that GDB
still builds at each incremental step.
END_CATCH is necessary for two reasons:
First, because we name the exception object in the CATCH block, which
requires creating a scope, which in turn must be closed somewhere.
Declaring the exception variable in the initializer field of a for
block, like:
#define CATCH(EXCEPTION, mask) \
for (struct gdb_exception EXCEPTION; \
exceptions_state_mc_catch (&EXCEPTION, MASK); \
EXCEPTION = exception_none)
would avoid needing END_CATCH, but alas, in C mode, we build with C90,
which doesn't allow mixed declarations and code.
Second, because when TRY/CATCH are wired to real C++ try/catch, as
long as we need to handle cleanup chains, even if there's no CATCH
block that wants to catch the exception, we need for stop at every
frame in the unwind chain and run cleanups, then rethrow. That will
be done in END_CATCH.
After we require C++, we'll still need TRY/CATCH/END_CATCH until
cleanups are completely phased out -- TRY/CATCH in C++ mode will
save/restore the current cleanup chain, like in C mode, and END_CATCH
catches otherwise uncaugh exceptions, runs cleanups and rethrows, so
that C++ cleanups and exceptions can coexist.
IMO, this still makes the TRY/CATCH code look a bit more like a
newcomer would expect, so IMO worth it even if we weren't considering
C++.
gdb/ChangeLog.
2015-03-07 Pedro Alves <palves@redhat.com>
* common/common-exceptions.c (struct catcher) <exception>: No
longer a pointer to volatile exception. Now an exception value.
<mask>: Delete field.
(exceptions_state_mc_init): Remove all parameters. Adjust.
(exceptions_state_mc): No longer pop the catcher here.
(exceptions_state_mc_catch): New function.
(throw_exception): Adjust.
* common/common-exceptions.h (exceptions_state_mc_init): Remove
all parameters.
(exceptions_state_mc_catch): Declare.
(TRY_CATCH): Rename to ...
(TRY): ... this. Remove EXCEPTION and MASK parameters.
(CATCH, END_CATCH): New.
All callers adjusted.
gdb/gdbserver/ChangeLog:
2015-03-07 Pedro Alves <palves@redhat.com>
Adjust all callers of TRY_CATCH to use TRY/CATCH/END_CATCH
instead.
2015-03-07 16:14:14 +01:00
|
|
|
|
TRY
|
2015-01-22 21:02:24 +01:00
|
|
|
|
{
|
|
|
|
|
thread_command (NULL, from_tty);
|
|
|
|
|
}
|
Split TRY_CATCH into TRY + CATCH
This patch splits the TRY_CATCH macro into three, so that we go from
this:
~~~
volatile gdb_exception ex;
TRY_CATCH (ex, RETURN_MASK_ERROR)
{
}
if (ex.reason < 0)
{
}
~~~
to this:
~~~
TRY
{
}
CATCH (ex, RETURN_MASK_ERROR)
{
}
END_CATCH
~~~
Thus, we'll be getting rid of the local volatile exception object, and
declaring the caught exception in the catch block.
This allows reimplementing TRY/CATCH in terms of C++ exceptions when
building in C++ mode, while still allowing to build GDB in C mode
(using setjmp/longjmp), as a transition step.
TBC, after this patch, is it _not_ valid to have code between the TRY
and the CATCH blocks, like:
TRY
{
}
// some code here.
CATCH (ex, RETURN_MASK_ERROR)
{
}
END_CATCH
Just like it isn't valid to do that with C++'s native try/catch.
By switching to creating the exception object inside the CATCH block
scope, we can get rid of all the explicitly allocated volatile
exception objects all over the tree, and map the CATCH block more
directly to C++'s catch blocks.
The majority of the TRY_CATCH -> TRY+CATCH+END_CATCH conversion was
done with a script, rerun from scratch at every rebase, no manual
editing involved. After the mechanical conversion, a few places
needed manual intervention, to fix preexisting cases where we were
using the exception object outside of the TRY_CATCH block, and cases
where we were using "else" after a 'if (ex.reason) < 0)' [a CATCH
after this patch]. The result was folded into this patch so that GDB
still builds at each incremental step.
END_CATCH is necessary for two reasons:
First, because we name the exception object in the CATCH block, which
requires creating a scope, which in turn must be closed somewhere.
Declaring the exception variable in the initializer field of a for
block, like:
#define CATCH(EXCEPTION, mask) \
for (struct gdb_exception EXCEPTION; \
exceptions_state_mc_catch (&EXCEPTION, MASK); \
EXCEPTION = exception_none)
would avoid needing END_CATCH, but alas, in C mode, we build with C90,
which doesn't allow mixed declarations and code.
Second, because when TRY/CATCH are wired to real C++ try/catch, as
long as we need to handle cleanup chains, even if there's no CATCH
block that wants to catch the exception, we need for stop at every
frame in the unwind chain and run cleanups, then rethrow. That will
be done in END_CATCH.
After we require C++, we'll still need TRY/CATCH/END_CATCH until
cleanups are completely phased out -- TRY/CATCH in C++ mode will
save/restore the current cleanup chain, like in C mode, and END_CATCH
catches otherwise uncaugh exceptions, runs cleanups and rethrows, so
that C++ cleanups and exceptions can coexist.
IMO, this still makes the TRY/CATCH code look a bit more like a
newcomer would expect, so IMO worth it even if we weren't considering
C++.
gdb/ChangeLog.
2015-03-07 Pedro Alves <palves@redhat.com>
* common/common-exceptions.c (struct catcher) <exception>: No
longer a pointer to volatile exception. Now an exception value.
<mask>: Delete field.
(exceptions_state_mc_init): Remove all parameters. Adjust.
(exceptions_state_mc): No longer pop the catcher here.
(exceptions_state_mc_catch): New function.
(throw_exception): Adjust.
* common/common-exceptions.h (exceptions_state_mc_init): Remove
all parameters.
(exceptions_state_mc_catch): Declare.
(TRY_CATCH): Rename to ...
(TRY): ... this. Remove EXCEPTION and MASK parameters.
(CATCH, END_CATCH): New.
All callers adjusted.
gdb/gdbserver/ChangeLog:
2015-03-07 Pedro Alves <palves@redhat.com>
Adjust all callers of TRY_CATCH to use TRY/CATCH/END_CATCH
instead.
2015-03-07 16:14:14 +01:00
|
|
|
|
CATCH (except, RETURN_MASK_ERROR)
|
|
|
|
|
{
|
|
|
|
|
exception_print (gdb_stderr, except);
|
|
|
|
|
}
|
|
|
|
|
END_CATCH
|
2015-01-22 21:02:24 +01:00
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
constify to_detach
This patch constifies the target_ops method to_detach.
This is a small cleanup, but also, I think, a bug-prevention fix,
since gdb already acts as if the "args" argument here was const.
In particular, top.c:quit_force calls kill_or_detach via
iterate_over_inferiors. kill_or_detach calls target_detach, passing
the same argument each time. So, if one of these methods was not
const-correct, then kill_or_detach would change its behavior in a
strange way.
I could not build every target I modified in this patch. I've
inspected them all by hand, though. Many targets do not use the
"args" parameter; a couple pass it to atoi; and a few pass it on to
the to_detach method of the target beneath. The only code that
required a real change was in linux-nat.c, and that only needed the
introduction of a temporary variable for const-correctness.
2013-11-08 Tom Tromey <tromey@redhat.com>
* aix-thread.c (aix_thread_detach): Update.
* corelow.c (core_detach): Update.
* darwin-nat.c (darwin_detach): Update.
* dec-thread.c (dec_thread_detach): Update.
* gnu-nat.c (gnu_detach): Update.
* go32-nat.c (go32_detach): Update.
* inf-ptrace.c (inf_ptrace_detach): Update.
* inf-ttrace.c (inf_ttrace_detach): Update.
* linux-fork.c (linux_fork_detach): Update.
* linux-fork.h (linux_fork_detach): Update.
* linux-nat.c (linux_nat_detach): Update. Introduce "tem"
local for const-correctness.
* linux-thread-db.c (thread_db_detach): Update.
* monitor.c (monitor_detach): Update.
* nto-procfs.c (procfs_detach): Update.
* procfs.c (procfs_detach): Update.
* record.c (record_detach): Update.
* record.h (record_detach): Update.
* remote-m32r-sdi.c (m32r_detach): Update.
* remote-mips.c (mips_detach): Update.
* remote-sim.c (gdbsim_detach): Update.
* remote.c (remote_detach_1, remote_detach)
(extended_remote_detach): Update.
* sol-thread.c (sol_thread_detach): Update.
* target.c (target_detach): Make "args" const.
(init_dummy_target): Update.
* target.h (struct target_ops) <to_detach>: Make argument const.
(target_detach): Likewise.
* windows-nat.c (windows_detach): Update.
2013-03-19 16:23:17 +01:00
|
|
|
|
core_detach (struct target_ops *ops, const char *args, int from_tty)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
if (args)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
|
error (_("Too many arguments"));
|
Kill pthread_ops_hack
* target.h (struct target_ops): Make to_attach, to_detach,
to_create_inferior and to_mourn_inferior accept a pointer
to struct target_ops.
(target_attach, target_create_inferior, target_create_inferior):
Convert from macros to function. Find the right target to
invoke a method of.
(find_default_attach, find_default_create_inferior): New parameter
ops.
* corefile.c (core_file_command): Pass target to to_detach.
* corelow.c (core_detach): Add 'ops' parameter.
* fork-child.c (fork_inferior): Return the pid. Allow
init_trace_fun to be NULL.
* inf-ptrace (ptrace_ops_hack): Remove.
(inf_ptrace_him): Remove, moving all logic into....
(inf_ptrace_create_inferior): ... here. Push the target
passed as parameter.
(inf_ptrace_mourn_inferior, inf_ptrace_attach, inf_ptrace_detach):
Push/pop target passed as parameter, no ptrace_ops_hack.
(inf_ptrace_target): Don't remember result.
* inferior.h (fork_inferior): Adjust prototype.
* linux-nat.c (linux_nat_create_inferior, linux_nat_attach)
(linux_nat_detach, linux_nat_mourn_inferior): New parameter ops.
Pass it to linux_ops target.
* linux-thread-db.c (thread_db_detach, thread_db_mourn_inferior):
New parameter ops. Pass it to the target beneath.
* remote.c (remote_mourn, extended_remote_mourn, remote_detach)
(extended_remote_create_inferior): New parameter ops. Pass it
further.
* target.c (debug_to_attach, debug_to_detach)
(debug_to_mourn_inferior): New parameter ops.
(target_create_inferior): New.
(update_current_target): Do not inherit to_attach, to_detach,
to_create_inferiour, to_mourn_inferior. Do not default
to_detach and to_mourn_inferior.
(target_detach): Find the right target to use.
(target_mourn_inferior): New.
(find_default_attach, find_default_create_inferior): New parameter
ops. Pass the found target when calling its method.
(init_dummy_target): Provide fallback definition of to_detach.
(target_attach): New.
(debug_to_attach, debug_to_detach, debug_to_create_inferior)
(debug_to_mourn_inferiour): New parameter ops.
* aix-thread.c: Adjust.
* bsd-uthread.c: Adjust.
* gnu-nat.c: Adjust.
* go32-nat.c: Adjust.
* hpux-thread.c: Adjust.
* inf-ttrace.c: Ajust.
* monitor.c: Adjust.
* nto-procfs.c: Adjust.
* procfs.c: Adjust.
* remote-m32r-sdi.c: Adjust.
* remote-mips.c: Adjust.
* remote-sim.c: Adjust.
* rs6000-nat.c: Adjust.
* sol-thread.c: Adjust.
* win32-nat.c: Adjust.
* dec-thread.c: Adjust.
2008-11-09 12:27:18 +01:00
|
|
|
|
unpush_target (ops);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
reinit_frame_cache ();
|
|
|
|
|
if (from_tty)
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up some of printf_filtered and printf_unfiltered.
* ada-lang.c, annotate.c, arch-utils.c, breakpoint.c: Update.
* corelow.c, cp-namespace.c, cp-support.c, dcache.c: Update.
* demangle.c, dsrec.c, dwarf2read.c, dwarfread.c: Update.
* event-loop.c, event-top.c, exec.c, f-valprint.c: Update.
* gdbtypes.c, inf-loop.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcmd.c, inflow.c, infrun.c, inftarg.c, language.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, maint.c: Update.
* mdebugread.c, memattr.c, monitor.c, objc-lang.c: Update.
* ocd.c, osabi.c, printcmd.c, procfs.c, regcache.c: Update.
* remote.c, solib-som.c, solib.c, somsolib.c, source.c: Update.
* stack.c, symfile.c, symmisc.c, target.c, thread.c: Update.
* top.c, utils.c, valprint.c, value.c, cli/cli-cmds.c: Update.
* cli/cli-dump.c, cli/cli-logging.c, tui/tui-hooks.c: Update.
* tui/tui-regs.c, tui/tui-win.c: Update.
2005-02-12 01:39:24 +01:00
|
|
|
|
printf_filtered (_("No core file now.\n"));
|
1999-04-16 03:35:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-08 03:51:13 +01:00
|
|
|
|
/* Try to retrieve registers from a section in core_bfd, and supply
|
|
|
|
|
them to core_vec->core_read_registers, as the register set numbered
|
|
|
|
|
WHICH.
|
|
|
|
|
|
2008-09-08 23:36:01 +02:00
|
|
|
|
If inferior_ptid's lwp member is zero, do the single-threaded
|
|
|
|
|
thing: look for a section named NAME. If inferior_ptid's lwp
|
|
|
|
|
member is non-zero, do the multi-threaded thing: look for a section
|
|
|
|
|
named "NAME/LWP", where LWP is the shortest ASCII decimal
|
|
|
|
|
representation of inferior_ptid's lwp member.
|
1999-12-08 03:51:13 +01:00
|
|
|
|
|
|
|
|
|
HUMAN_NAME is a human-readable name for the kind of registers the
|
|
|
|
|
NAME section contains, for use in error messages.
|
|
|
|
|
|
|
|
|
|
If REQUIRED is non-zero, print an error if the core file doesn't
|
2010-12-31 23:59:52 +01:00
|
|
|
|
have a section by the appropriate name. Otherwise, just do
|
|
|
|
|
nothing. */
|
1999-12-08 03:51:13 +01:00
|
|
|
|
|
|
|
|
|
static void
|
2007-05-06 16:33:21 +02:00
|
|
|
|
get_core_register_section (struct regcache *regcache,
|
Add 'regset' parameter to 'iterate_over_regset_sections_cb'
This adds the 'regset' parameter to the iterator callback.
Consequently the 'regset_from_core_section' method is dropped for all
targets that provide the iterator method.
This change prepares for replacing regset_from_core_section
everywhere, thereby eliminating one gdbarch interface. Since the
iterator is usually no more complex than regset_from_core_section
alone, targets that previously didn't define core_regset_sections will
then gain multi-arch capable core file generation support without
increased complexity.
gdb/ChangeLog:
* gdbarch.sh (iterate_over_regset_sections_cb): Add regset
parameter.
* gdbarch.h: Regenerate.
* corelow.c (sniff_core_bfd): Don't sniff if gdbarch has a regset
iterator.
(get_core_register_section): Add parameter 'regset' and use it, if
set. Add parameter 'min_size' and verify the bfd section size
against it.
(get_core_registers_cb): Add parameter 'regset' and pass it to
get_core_register section. For the "standard" register sections
".reg" and ".reg2", set an appropriate default for human_name.
(get_core_registers): Don't abort when the gdbarch has an iterator
but no regset_from_core_section. Add NULL/0 for parameters
'regset'/'min_size' in calls to get_core_register_section.
* linux-tdep.c (linux_collect_regset_section_cb): Add parameter
'regset' and use it instead of calling the
regset_from_core_section gdbarch method.
* i386-tdep.h (struct gdbarch_tdep): Add field 'fpregset'.
* i386-tdep.c (i386_supply_xstateregset)
(i386_collect_xstateregset, i386_xstateregset): Moved to
i386-linux-tdep.c.
(i386_regset_from_core_section): Drop handling for .reg-xfp and
.reg-xstate.
(i386_gdbarch_init): Set tdep field 'fpregset'. Enable generic
core file support only if the regset iterator hasn't been set.
* i386-linux-tdep.c (i386_linux_supply_xstateregset)
(i386_linux_collect_xstateregset, i386_linux_xstateregset): New.
Moved from i386-tdep.c and renamed to *_linux*.
(i386_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation. Allow any .reg-xstate size when reading
from a core file.
* amd64-tdep.c (amd64_supply_xstateregset)
(amd64_collect_xstateregset, amd64_xstateregset): Moved to
amd64-linux-tdep.c.
(amd64_regset_from_core_section): Remove.
(amd64_init_abi): Set new tdep field 'fpregset'. No longer
install an amd64-specific regset_from_core_section gdbarch method.
* amd64-linux-tdep.c (amd64_linux_supply_xstateregset)
(amd64_linux_collect_xstateregset, amd64_linux_xstateregset): New.
Moved from amd64-tdep.c and renamed to *_linux*.
(amd64_linux_iterate_over_regset_sections): Add regset parameter
to each callback invocation. Allow any .reg-xstate size when
reading from a core file.
* arm-linux-tdep.c (arm_linux_regset_from_core_section): Remove.
(arm_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(arm_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* ppc-linux-tdep.c (ppc_linux_regset_from_core_section): Remove.
(ppc_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(ppc_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* s390-linux-tdep.c (struct gdbarch_tdep): Remove the fields
gregset, sizeof_gregset, fpregset, and sizeof_fpregset.
(s390_regset_from_core_section): Remove.
(s390_iterate_over_regset_sections): Add regset parameter to each
callback invocation.
(s390_gdbarch_init): No longer set the regset_from_core_section
gdbarch method. Drop initialization of deleted tdep fields.
2014-09-12 10:42:48 +02:00
|
|
|
|
const struct regset *regset,
|
2010-01-04 15:57:44 +01:00
|
|
|
|
const char *name,
|
Add 'regset' parameter to 'iterate_over_regset_sections_cb'
This adds the 'regset' parameter to the iterator callback.
Consequently the 'regset_from_core_section' method is dropped for all
targets that provide the iterator method.
This change prepares for replacing regset_from_core_section
everywhere, thereby eliminating one gdbarch interface. Since the
iterator is usually no more complex than regset_from_core_section
alone, targets that previously didn't define core_regset_sections will
then gain multi-arch capable core file generation support without
increased complexity.
gdb/ChangeLog:
* gdbarch.sh (iterate_over_regset_sections_cb): Add regset
parameter.
* gdbarch.h: Regenerate.
* corelow.c (sniff_core_bfd): Don't sniff if gdbarch has a regset
iterator.
(get_core_register_section): Add parameter 'regset' and use it, if
set. Add parameter 'min_size' and verify the bfd section size
against it.
(get_core_registers_cb): Add parameter 'regset' and pass it to
get_core_register section. For the "standard" register sections
".reg" and ".reg2", set an appropriate default for human_name.
(get_core_registers): Don't abort when the gdbarch has an iterator
but no regset_from_core_section. Add NULL/0 for parameters
'regset'/'min_size' in calls to get_core_register_section.
* linux-tdep.c (linux_collect_regset_section_cb): Add parameter
'regset' and use it instead of calling the
regset_from_core_section gdbarch method.
* i386-tdep.h (struct gdbarch_tdep): Add field 'fpregset'.
* i386-tdep.c (i386_supply_xstateregset)
(i386_collect_xstateregset, i386_xstateregset): Moved to
i386-linux-tdep.c.
(i386_regset_from_core_section): Drop handling for .reg-xfp and
.reg-xstate.
(i386_gdbarch_init): Set tdep field 'fpregset'. Enable generic
core file support only if the regset iterator hasn't been set.
* i386-linux-tdep.c (i386_linux_supply_xstateregset)
(i386_linux_collect_xstateregset, i386_linux_xstateregset): New.
Moved from i386-tdep.c and renamed to *_linux*.
(i386_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation. Allow any .reg-xstate size when reading
from a core file.
* amd64-tdep.c (amd64_supply_xstateregset)
(amd64_collect_xstateregset, amd64_xstateregset): Moved to
amd64-linux-tdep.c.
(amd64_regset_from_core_section): Remove.
(amd64_init_abi): Set new tdep field 'fpregset'. No longer
install an amd64-specific regset_from_core_section gdbarch method.
* amd64-linux-tdep.c (amd64_linux_supply_xstateregset)
(amd64_linux_collect_xstateregset, amd64_linux_xstateregset): New.
Moved from amd64-tdep.c and renamed to *_linux*.
(amd64_linux_iterate_over_regset_sections): Add regset parameter
to each callback invocation. Allow any .reg-xstate size when
reading from a core file.
* arm-linux-tdep.c (arm_linux_regset_from_core_section): Remove.
(arm_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(arm_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* ppc-linux-tdep.c (ppc_linux_regset_from_core_section): Remove.
(ppc_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(ppc_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* s390-linux-tdep.c (struct gdbarch_tdep): Remove the fields
gregset, sizeof_gregset, fpregset, and sizeof_fpregset.
(s390_regset_from_core_section): Remove.
(s390_iterate_over_regset_sections): Add regset parameter to each
callback invocation.
(s390_gdbarch_init): No longer set the regset_from_core_section
gdbarch method. Drop initialization of deleted tdep fields.
2014-09-12 10:42:48 +02:00
|
|
|
|
int min_size,
|
1999-12-08 03:51:13 +01:00
|
|
|
|
int which,
|
2010-01-04 15:57:44 +01:00
|
|
|
|
const char *human_name,
|
1999-12-08 03:51:13 +01:00
|
|
|
|
int required)
|
|
|
|
|
{
|
2005-03-17 23:07:42 +01:00
|
|
|
|
static char *section_name = NULL;
|
2003-11-06 03:52:28 +01:00
|
|
|
|
struct bfd_section *section;
|
1999-12-08 03:51:13 +01:00
|
|
|
|
bfd_size_type size;
|
|
|
|
|
char *contents;
|
|
|
|
|
|
2005-03-17 23:07:42 +01:00
|
|
|
|
xfree (section_name);
|
2009-02-16 04:16:24 +01:00
|
|
|
|
|
2010-08-18 14:24:13 +02:00
|
|
|
|
if (ptid_get_lwp (inferior_ptid))
|
2010-12-31 23:59:52 +01:00
|
|
|
|
section_name = xstrprintf ("%s/%ld", name,
|
|
|
|
|
ptid_get_lwp (inferior_ptid));
|
1999-12-08 03:51:13 +01:00
|
|
|
|
else
|
2005-03-17 23:07:42 +01:00
|
|
|
|
section_name = xstrdup (name);
|
1999-12-08 03:51:13 +01:00
|
|
|
|
|
|
|
|
|
section = bfd_get_section_by_name (core_bfd, section_name);
|
|
|
|
|
if (! section)
|
|
|
|
|
{
|
|
|
|
|
if (required)
|
2010-12-31 23:59:52 +01:00
|
|
|
|
warning (_("Couldn't find %s registers in core file."),
|
|
|
|
|
human_name);
|
1999-12-08 03:51:13 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size = bfd_section_size (core_bfd, section);
|
Add 'regset' parameter to 'iterate_over_regset_sections_cb'
This adds the 'regset' parameter to the iterator callback.
Consequently the 'regset_from_core_section' method is dropped for all
targets that provide the iterator method.
This change prepares for replacing regset_from_core_section
everywhere, thereby eliminating one gdbarch interface. Since the
iterator is usually no more complex than regset_from_core_section
alone, targets that previously didn't define core_regset_sections will
then gain multi-arch capable core file generation support without
increased complexity.
gdb/ChangeLog:
* gdbarch.sh (iterate_over_regset_sections_cb): Add regset
parameter.
* gdbarch.h: Regenerate.
* corelow.c (sniff_core_bfd): Don't sniff if gdbarch has a regset
iterator.
(get_core_register_section): Add parameter 'regset' and use it, if
set. Add parameter 'min_size' and verify the bfd section size
against it.
(get_core_registers_cb): Add parameter 'regset' and pass it to
get_core_register section. For the "standard" register sections
".reg" and ".reg2", set an appropriate default for human_name.
(get_core_registers): Don't abort when the gdbarch has an iterator
but no regset_from_core_section. Add NULL/0 for parameters
'regset'/'min_size' in calls to get_core_register_section.
* linux-tdep.c (linux_collect_regset_section_cb): Add parameter
'regset' and use it instead of calling the
regset_from_core_section gdbarch method.
* i386-tdep.h (struct gdbarch_tdep): Add field 'fpregset'.
* i386-tdep.c (i386_supply_xstateregset)
(i386_collect_xstateregset, i386_xstateregset): Moved to
i386-linux-tdep.c.
(i386_regset_from_core_section): Drop handling for .reg-xfp and
.reg-xstate.
(i386_gdbarch_init): Set tdep field 'fpregset'. Enable generic
core file support only if the regset iterator hasn't been set.
* i386-linux-tdep.c (i386_linux_supply_xstateregset)
(i386_linux_collect_xstateregset, i386_linux_xstateregset): New.
Moved from i386-tdep.c and renamed to *_linux*.
(i386_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation. Allow any .reg-xstate size when reading
from a core file.
* amd64-tdep.c (amd64_supply_xstateregset)
(amd64_collect_xstateregset, amd64_xstateregset): Moved to
amd64-linux-tdep.c.
(amd64_regset_from_core_section): Remove.
(amd64_init_abi): Set new tdep field 'fpregset'. No longer
install an amd64-specific regset_from_core_section gdbarch method.
* amd64-linux-tdep.c (amd64_linux_supply_xstateregset)
(amd64_linux_collect_xstateregset, amd64_linux_xstateregset): New.
Moved from amd64-tdep.c and renamed to *_linux*.
(amd64_linux_iterate_over_regset_sections): Add regset parameter
to each callback invocation. Allow any .reg-xstate size when
reading from a core file.
* arm-linux-tdep.c (arm_linux_regset_from_core_section): Remove.
(arm_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(arm_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* ppc-linux-tdep.c (ppc_linux_regset_from_core_section): Remove.
(ppc_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(ppc_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* s390-linux-tdep.c (struct gdbarch_tdep): Remove the fields
gregset, sizeof_gregset, fpregset, and sizeof_fpregset.
(s390_regset_from_core_section): Remove.
(s390_iterate_over_regset_sections): Add regset parameter to each
callback invocation.
(s390_gdbarch_init): No longer set the regset_from_core_section
gdbarch method. Drop initialization of deleted tdep fields.
2014-09-12 10:42:48 +02:00
|
|
|
|
if (size < min_size)
|
|
|
|
|
{
|
|
|
|
|
warning (_("Section `%s' in core file too small."), section_name);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2015-01-15 11:20:45 +01:00
|
|
|
|
if (size != min_size && !(regset->flags & REGSET_VARIABLE_SIZE))
|
|
|
|
|
{
|
|
|
|
|
warning (_("Unexpected size of section `%s' in core file."),
|
|
|
|
|
section_name);
|
|
|
|
|
}
|
Add 'regset' parameter to 'iterate_over_regset_sections_cb'
This adds the 'regset' parameter to the iterator callback.
Consequently the 'regset_from_core_section' method is dropped for all
targets that provide the iterator method.
This change prepares for replacing regset_from_core_section
everywhere, thereby eliminating one gdbarch interface. Since the
iterator is usually no more complex than regset_from_core_section
alone, targets that previously didn't define core_regset_sections will
then gain multi-arch capable core file generation support without
increased complexity.
gdb/ChangeLog:
* gdbarch.sh (iterate_over_regset_sections_cb): Add regset
parameter.
* gdbarch.h: Regenerate.
* corelow.c (sniff_core_bfd): Don't sniff if gdbarch has a regset
iterator.
(get_core_register_section): Add parameter 'regset' and use it, if
set. Add parameter 'min_size' and verify the bfd section size
against it.
(get_core_registers_cb): Add parameter 'regset' and pass it to
get_core_register section. For the "standard" register sections
".reg" and ".reg2", set an appropriate default for human_name.
(get_core_registers): Don't abort when the gdbarch has an iterator
but no regset_from_core_section. Add NULL/0 for parameters
'regset'/'min_size' in calls to get_core_register_section.
* linux-tdep.c (linux_collect_regset_section_cb): Add parameter
'regset' and use it instead of calling the
regset_from_core_section gdbarch method.
* i386-tdep.h (struct gdbarch_tdep): Add field 'fpregset'.
* i386-tdep.c (i386_supply_xstateregset)
(i386_collect_xstateregset, i386_xstateregset): Moved to
i386-linux-tdep.c.
(i386_regset_from_core_section): Drop handling for .reg-xfp and
.reg-xstate.
(i386_gdbarch_init): Set tdep field 'fpregset'. Enable generic
core file support only if the regset iterator hasn't been set.
* i386-linux-tdep.c (i386_linux_supply_xstateregset)
(i386_linux_collect_xstateregset, i386_linux_xstateregset): New.
Moved from i386-tdep.c and renamed to *_linux*.
(i386_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation. Allow any .reg-xstate size when reading
from a core file.
* amd64-tdep.c (amd64_supply_xstateregset)
(amd64_collect_xstateregset, amd64_xstateregset): Moved to
amd64-linux-tdep.c.
(amd64_regset_from_core_section): Remove.
(amd64_init_abi): Set new tdep field 'fpregset'. No longer
install an amd64-specific regset_from_core_section gdbarch method.
* amd64-linux-tdep.c (amd64_linux_supply_xstateregset)
(amd64_linux_collect_xstateregset, amd64_linux_xstateregset): New.
Moved from amd64-tdep.c and renamed to *_linux*.
(amd64_linux_iterate_over_regset_sections): Add regset parameter
to each callback invocation. Allow any .reg-xstate size when
reading from a core file.
* arm-linux-tdep.c (arm_linux_regset_from_core_section): Remove.
(arm_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(arm_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* ppc-linux-tdep.c (ppc_linux_regset_from_core_section): Remove.
(ppc_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(ppc_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* s390-linux-tdep.c (struct gdbarch_tdep): Remove the fields
gregset, sizeof_gregset, fpregset, and sizeof_fpregset.
(s390_regset_from_core_section): Remove.
(s390_iterate_over_regset_sections): Add regset parameter to each
callback invocation.
(s390_gdbarch_init): No longer set the regset_from_core_section
gdbarch method. Drop initialization of deleted tdep fields.
2014-09-12 10:42:48 +02:00
|
|
|
|
|
2015-09-25 20:08:06 +02:00
|
|
|
|
contents = (char *) alloca (size);
|
1999-12-08 03:51:13 +01:00
|
|
|
|
if (! bfd_get_section_contents (core_bfd, section, contents,
|
|
|
|
|
(file_ptr) 0, size))
|
|
|
|
|
{
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
|
warning (_("Couldn't read %s registers from `%s' section in core file."),
|
1999-12-08 03:51:13 +01:00
|
|
|
|
human_name, name);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
Add 'regset' parameter to 'iterate_over_regset_sections_cb'
This adds the 'regset' parameter to the iterator callback.
Consequently the 'regset_from_core_section' method is dropped for all
targets that provide the iterator method.
This change prepares for replacing regset_from_core_section
everywhere, thereby eliminating one gdbarch interface. Since the
iterator is usually no more complex than regset_from_core_section
alone, targets that previously didn't define core_regset_sections will
then gain multi-arch capable core file generation support without
increased complexity.
gdb/ChangeLog:
* gdbarch.sh (iterate_over_regset_sections_cb): Add regset
parameter.
* gdbarch.h: Regenerate.
* corelow.c (sniff_core_bfd): Don't sniff if gdbarch has a regset
iterator.
(get_core_register_section): Add parameter 'regset' and use it, if
set. Add parameter 'min_size' and verify the bfd section size
against it.
(get_core_registers_cb): Add parameter 'regset' and pass it to
get_core_register section. For the "standard" register sections
".reg" and ".reg2", set an appropriate default for human_name.
(get_core_registers): Don't abort when the gdbarch has an iterator
but no regset_from_core_section. Add NULL/0 for parameters
'regset'/'min_size' in calls to get_core_register_section.
* linux-tdep.c (linux_collect_regset_section_cb): Add parameter
'regset' and use it instead of calling the
regset_from_core_section gdbarch method.
* i386-tdep.h (struct gdbarch_tdep): Add field 'fpregset'.
* i386-tdep.c (i386_supply_xstateregset)
(i386_collect_xstateregset, i386_xstateregset): Moved to
i386-linux-tdep.c.
(i386_regset_from_core_section): Drop handling for .reg-xfp and
.reg-xstate.
(i386_gdbarch_init): Set tdep field 'fpregset'. Enable generic
core file support only if the regset iterator hasn't been set.
* i386-linux-tdep.c (i386_linux_supply_xstateregset)
(i386_linux_collect_xstateregset, i386_linux_xstateregset): New.
Moved from i386-tdep.c and renamed to *_linux*.
(i386_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation. Allow any .reg-xstate size when reading
from a core file.
* amd64-tdep.c (amd64_supply_xstateregset)
(amd64_collect_xstateregset, amd64_xstateregset): Moved to
amd64-linux-tdep.c.
(amd64_regset_from_core_section): Remove.
(amd64_init_abi): Set new tdep field 'fpregset'. No longer
install an amd64-specific regset_from_core_section gdbarch method.
* amd64-linux-tdep.c (amd64_linux_supply_xstateregset)
(amd64_linux_collect_xstateregset, amd64_linux_xstateregset): New.
Moved from amd64-tdep.c and renamed to *_linux*.
(amd64_linux_iterate_over_regset_sections): Add regset parameter
to each callback invocation. Allow any .reg-xstate size when
reading from a core file.
* arm-linux-tdep.c (arm_linux_regset_from_core_section): Remove.
(arm_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(arm_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* ppc-linux-tdep.c (ppc_linux_regset_from_core_section): Remove.
(ppc_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(ppc_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* s390-linux-tdep.c (struct gdbarch_tdep): Remove the fields
gregset, sizeof_gregset, fpregset, and sizeof_fpregset.
(s390_regset_from_core_section): Remove.
(s390_iterate_over_regset_sections): Add regset parameter to each
callback invocation.
(s390_gdbarch_init): No longer set the regset_from_core_section
gdbarch method. Drop initialization of deleted tdep fields.
2014-09-12 10:42:48 +02:00
|
|
|
|
if (regset != NULL)
|
|
|
|
|
{
|
2007-05-06 16:33:21 +02:00
|
|
|
|
regset->supply_regset (regset, regcache, -1, contents, size);
|
2003-10-29 21:59:07 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gdb_assert (core_vec);
|
2007-05-06 16:33:21 +02:00
|
|
|
|
core_vec->core_read_registers (regcache, contents, size, which,
|
1999-12-08 03:51:13 +01:00
|
|
|
|
((CORE_ADDR)
|
|
|
|
|
bfd_section_vma (core_bfd, section)));
|
|
|
|
|
}
|
|
|
|
|
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 17:26:43 +02:00
|
|
|
|
/* Callback for get_core_registers that handles a single core file
|
|
|
|
|
register note section. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
get_core_registers_cb (const char *sect_name, int size,
|
Add 'regset' parameter to 'iterate_over_regset_sections_cb'
This adds the 'regset' parameter to the iterator callback.
Consequently the 'regset_from_core_section' method is dropped for all
targets that provide the iterator method.
This change prepares for replacing regset_from_core_section
everywhere, thereby eliminating one gdbarch interface. Since the
iterator is usually no more complex than regset_from_core_section
alone, targets that previously didn't define core_regset_sections will
then gain multi-arch capable core file generation support without
increased complexity.
gdb/ChangeLog:
* gdbarch.sh (iterate_over_regset_sections_cb): Add regset
parameter.
* gdbarch.h: Regenerate.
* corelow.c (sniff_core_bfd): Don't sniff if gdbarch has a regset
iterator.
(get_core_register_section): Add parameter 'regset' and use it, if
set. Add parameter 'min_size' and verify the bfd section size
against it.
(get_core_registers_cb): Add parameter 'regset' and pass it to
get_core_register section. For the "standard" register sections
".reg" and ".reg2", set an appropriate default for human_name.
(get_core_registers): Don't abort when the gdbarch has an iterator
but no regset_from_core_section. Add NULL/0 for parameters
'regset'/'min_size' in calls to get_core_register_section.
* linux-tdep.c (linux_collect_regset_section_cb): Add parameter
'regset' and use it instead of calling the
regset_from_core_section gdbarch method.
* i386-tdep.h (struct gdbarch_tdep): Add field 'fpregset'.
* i386-tdep.c (i386_supply_xstateregset)
(i386_collect_xstateregset, i386_xstateregset): Moved to
i386-linux-tdep.c.
(i386_regset_from_core_section): Drop handling for .reg-xfp and
.reg-xstate.
(i386_gdbarch_init): Set tdep field 'fpregset'. Enable generic
core file support only if the regset iterator hasn't been set.
* i386-linux-tdep.c (i386_linux_supply_xstateregset)
(i386_linux_collect_xstateregset, i386_linux_xstateregset): New.
Moved from i386-tdep.c and renamed to *_linux*.
(i386_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation. Allow any .reg-xstate size when reading
from a core file.
* amd64-tdep.c (amd64_supply_xstateregset)
(amd64_collect_xstateregset, amd64_xstateregset): Moved to
amd64-linux-tdep.c.
(amd64_regset_from_core_section): Remove.
(amd64_init_abi): Set new tdep field 'fpregset'. No longer
install an amd64-specific regset_from_core_section gdbarch method.
* amd64-linux-tdep.c (amd64_linux_supply_xstateregset)
(amd64_linux_collect_xstateregset, amd64_linux_xstateregset): New.
Moved from amd64-tdep.c and renamed to *_linux*.
(amd64_linux_iterate_over_regset_sections): Add regset parameter
to each callback invocation. Allow any .reg-xstate size when
reading from a core file.
* arm-linux-tdep.c (arm_linux_regset_from_core_section): Remove.
(arm_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(arm_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* ppc-linux-tdep.c (ppc_linux_regset_from_core_section): Remove.
(ppc_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(ppc_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* s390-linux-tdep.c (struct gdbarch_tdep): Remove the fields
gregset, sizeof_gregset, fpregset, and sizeof_fpregset.
(s390_regset_from_core_section): Remove.
(s390_iterate_over_regset_sections): Add regset parameter to each
callback invocation.
(s390_gdbarch_init): No longer set the regset_from_core_section
gdbarch method. Drop initialization of deleted tdep fields.
2014-09-12 10:42:48 +02:00
|
|
|
|
const struct regset *regset,
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 17:26:43 +02:00
|
|
|
|
const char *human_name, void *cb_data)
|
|
|
|
|
{
|
|
|
|
|
struct regcache *regcache = (struct regcache *) cb_data;
|
Add 'regset' parameter to 'iterate_over_regset_sections_cb'
This adds the 'regset' parameter to the iterator callback.
Consequently the 'regset_from_core_section' method is dropped for all
targets that provide the iterator method.
This change prepares for replacing regset_from_core_section
everywhere, thereby eliminating one gdbarch interface. Since the
iterator is usually no more complex than regset_from_core_section
alone, targets that previously didn't define core_regset_sections will
then gain multi-arch capable core file generation support without
increased complexity.
gdb/ChangeLog:
* gdbarch.sh (iterate_over_regset_sections_cb): Add regset
parameter.
* gdbarch.h: Regenerate.
* corelow.c (sniff_core_bfd): Don't sniff if gdbarch has a regset
iterator.
(get_core_register_section): Add parameter 'regset' and use it, if
set. Add parameter 'min_size' and verify the bfd section size
against it.
(get_core_registers_cb): Add parameter 'regset' and pass it to
get_core_register section. For the "standard" register sections
".reg" and ".reg2", set an appropriate default for human_name.
(get_core_registers): Don't abort when the gdbarch has an iterator
but no regset_from_core_section. Add NULL/0 for parameters
'regset'/'min_size' in calls to get_core_register_section.
* linux-tdep.c (linux_collect_regset_section_cb): Add parameter
'regset' and use it instead of calling the
regset_from_core_section gdbarch method.
* i386-tdep.h (struct gdbarch_tdep): Add field 'fpregset'.
* i386-tdep.c (i386_supply_xstateregset)
(i386_collect_xstateregset, i386_xstateregset): Moved to
i386-linux-tdep.c.
(i386_regset_from_core_section): Drop handling for .reg-xfp and
.reg-xstate.
(i386_gdbarch_init): Set tdep field 'fpregset'. Enable generic
core file support only if the regset iterator hasn't been set.
* i386-linux-tdep.c (i386_linux_supply_xstateregset)
(i386_linux_collect_xstateregset, i386_linux_xstateregset): New.
Moved from i386-tdep.c and renamed to *_linux*.
(i386_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation. Allow any .reg-xstate size when reading
from a core file.
* amd64-tdep.c (amd64_supply_xstateregset)
(amd64_collect_xstateregset, amd64_xstateregset): Moved to
amd64-linux-tdep.c.
(amd64_regset_from_core_section): Remove.
(amd64_init_abi): Set new tdep field 'fpregset'. No longer
install an amd64-specific regset_from_core_section gdbarch method.
* amd64-linux-tdep.c (amd64_linux_supply_xstateregset)
(amd64_linux_collect_xstateregset, amd64_linux_xstateregset): New.
Moved from amd64-tdep.c and renamed to *_linux*.
(amd64_linux_iterate_over_regset_sections): Add regset parameter
to each callback invocation. Allow any .reg-xstate size when
reading from a core file.
* arm-linux-tdep.c (arm_linux_regset_from_core_section): Remove.
(arm_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(arm_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* ppc-linux-tdep.c (ppc_linux_regset_from_core_section): Remove.
(ppc_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(ppc_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* s390-linux-tdep.c (struct gdbarch_tdep): Remove the fields
gregset, sizeof_gregset, fpregset, and sizeof_fpregset.
(s390_regset_from_core_section): Remove.
(s390_iterate_over_regset_sections): Add regset parameter to each
callback invocation.
(s390_gdbarch_init): No longer set the regset_from_core_section
gdbarch method. Drop initialization of deleted tdep fields.
2014-09-12 10:42:48 +02:00
|
|
|
|
int required = 0;
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 17:26:43 +02:00
|
|
|
|
|
|
|
|
|
if (strcmp (sect_name, ".reg") == 0)
|
Add 'regset' parameter to 'iterate_over_regset_sections_cb'
This adds the 'regset' parameter to the iterator callback.
Consequently the 'regset_from_core_section' method is dropped for all
targets that provide the iterator method.
This change prepares for replacing regset_from_core_section
everywhere, thereby eliminating one gdbarch interface. Since the
iterator is usually no more complex than regset_from_core_section
alone, targets that previously didn't define core_regset_sections will
then gain multi-arch capable core file generation support without
increased complexity.
gdb/ChangeLog:
* gdbarch.sh (iterate_over_regset_sections_cb): Add regset
parameter.
* gdbarch.h: Regenerate.
* corelow.c (sniff_core_bfd): Don't sniff if gdbarch has a regset
iterator.
(get_core_register_section): Add parameter 'regset' and use it, if
set. Add parameter 'min_size' and verify the bfd section size
against it.
(get_core_registers_cb): Add parameter 'regset' and pass it to
get_core_register section. For the "standard" register sections
".reg" and ".reg2", set an appropriate default for human_name.
(get_core_registers): Don't abort when the gdbarch has an iterator
but no regset_from_core_section. Add NULL/0 for parameters
'regset'/'min_size' in calls to get_core_register_section.
* linux-tdep.c (linux_collect_regset_section_cb): Add parameter
'regset' and use it instead of calling the
regset_from_core_section gdbarch method.
* i386-tdep.h (struct gdbarch_tdep): Add field 'fpregset'.
* i386-tdep.c (i386_supply_xstateregset)
(i386_collect_xstateregset, i386_xstateregset): Moved to
i386-linux-tdep.c.
(i386_regset_from_core_section): Drop handling for .reg-xfp and
.reg-xstate.
(i386_gdbarch_init): Set tdep field 'fpregset'. Enable generic
core file support only if the regset iterator hasn't been set.
* i386-linux-tdep.c (i386_linux_supply_xstateregset)
(i386_linux_collect_xstateregset, i386_linux_xstateregset): New.
Moved from i386-tdep.c and renamed to *_linux*.
(i386_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation. Allow any .reg-xstate size when reading
from a core file.
* amd64-tdep.c (amd64_supply_xstateregset)
(amd64_collect_xstateregset, amd64_xstateregset): Moved to
amd64-linux-tdep.c.
(amd64_regset_from_core_section): Remove.
(amd64_init_abi): Set new tdep field 'fpregset'. No longer
install an amd64-specific regset_from_core_section gdbarch method.
* amd64-linux-tdep.c (amd64_linux_supply_xstateregset)
(amd64_linux_collect_xstateregset, amd64_linux_xstateregset): New.
Moved from amd64-tdep.c and renamed to *_linux*.
(amd64_linux_iterate_over_regset_sections): Add regset parameter
to each callback invocation. Allow any .reg-xstate size when
reading from a core file.
* arm-linux-tdep.c (arm_linux_regset_from_core_section): Remove.
(arm_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(arm_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* ppc-linux-tdep.c (ppc_linux_regset_from_core_section): Remove.
(ppc_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(ppc_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* s390-linux-tdep.c (struct gdbarch_tdep): Remove the fields
gregset, sizeof_gregset, fpregset, and sizeof_fpregset.
(s390_regset_from_core_section): Remove.
(s390_iterate_over_regset_sections): Add regset parameter to each
callback invocation.
(s390_gdbarch_init): No longer set the regset_from_core_section
gdbarch method. Drop initialization of deleted tdep fields.
2014-09-12 10:42:48 +02:00
|
|
|
|
{
|
|
|
|
|
required = 1;
|
|
|
|
|
if (human_name == NULL)
|
|
|
|
|
human_name = "general-purpose";
|
|
|
|
|
}
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 17:26:43 +02:00
|
|
|
|
else if (strcmp (sect_name, ".reg2") == 0)
|
Add 'regset' parameter to 'iterate_over_regset_sections_cb'
This adds the 'regset' parameter to the iterator callback.
Consequently the 'regset_from_core_section' method is dropped for all
targets that provide the iterator method.
This change prepares for replacing regset_from_core_section
everywhere, thereby eliminating one gdbarch interface. Since the
iterator is usually no more complex than regset_from_core_section
alone, targets that previously didn't define core_regset_sections will
then gain multi-arch capable core file generation support without
increased complexity.
gdb/ChangeLog:
* gdbarch.sh (iterate_over_regset_sections_cb): Add regset
parameter.
* gdbarch.h: Regenerate.
* corelow.c (sniff_core_bfd): Don't sniff if gdbarch has a regset
iterator.
(get_core_register_section): Add parameter 'regset' and use it, if
set. Add parameter 'min_size' and verify the bfd section size
against it.
(get_core_registers_cb): Add parameter 'regset' and pass it to
get_core_register section. For the "standard" register sections
".reg" and ".reg2", set an appropriate default for human_name.
(get_core_registers): Don't abort when the gdbarch has an iterator
but no regset_from_core_section. Add NULL/0 for parameters
'regset'/'min_size' in calls to get_core_register_section.
* linux-tdep.c (linux_collect_regset_section_cb): Add parameter
'regset' and use it instead of calling the
regset_from_core_section gdbarch method.
* i386-tdep.h (struct gdbarch_tdep): Add field 'fpregset'.
* i386-tdep.c (i386_supply_xstateregset)
(i386_collect_xstateregset, i386_xstateregset): Moved to
i386-linux-tdep.c.
(i386_regset_from_core_section): Drop handling for .reg-xfp and
.reg-xstate.
(i386_gdbarch_init): Set tdep field 'fpregset'. Enable generic
core file support only if the regset iterator hasn't been set.
* i386-linux-tdep.c (i386_linux_supply_xstateregset)
(i386_linux_collect_xstateregset, i386_linux_xstateregset): New.
Moved from i386-tdep.c and renamed to *_linux*.
(i386_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation. Allow any .reg-xstate size when reading
from a core file.
* amd64-tdep.c (amd64_supply_xstateregset)
(amd64_collect_xstateregset, amd64_xstateregset): Moved to
amd64-linux-tdep.c.
(amd64_regset_from_core_section): Remove.
(amd64_init_abi): Set new tdep field 'fpregset'. No longer
install an amd64-specific regset_from_core_section gdbarch method.
* amd64-linux-tdep.c (amd64_linux_supply_xstateregset)
(amd64_linux_collect_xstateregset, amd64_linux_xstateregset): New.
Moved from amd64-tdep.c and renamed to *_linux*.
(amd64_linux_iterate_over_regset_sections): Add regset parameter
to each callback invocation. Allow any .reg-xstate size when
reading from a core file.
* arm-linux-tdep.c (arm_linux_regset_from_core_section): Remove.
(arm_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(arm_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* ppc-linux-tdep.c (ppc_linux_regset_from_core_section): Remove.
(ppc_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(ppc_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* s390-linux-tdep.c (struct gdbarch_tdep): Remove the fields
gregset, sizeof_gregset, fpregset, and sizeof_fpregset.
(s390_regset_from_core_section): Remove.
(s390_iterate_over_regset_sections): Add regset parameter to each
callback invocation.
(s390_gdbarch_init): No longer set the regset_from_core_section
gdbarch method. Drop initialization of deleted tdep fields.
2014-09-12 10:42:48 +02:00
|
|
|
|
{
|
|
|
|
|
if (human_name == NULL)
|
|
|
|
|
human_name = "floating-point";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The 'which' parameter is only used when no regset is provided.
|
|
|
|
|
Thus we just set it to -1. */
|
|
|
|
|
get_core_register_section (regcache, regset, sect_name,
|
|
|
|
|
size, -1, human_name, required);
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 17:26:43 +02:00
|
|
|
|
}
|
1999-12-08 03:51:13 +01:00
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
|
/* Get the registers out of a core file. This is the machine-
|
|
|
|
|
independent part. Fetch_core_registers is the machine-dependent
|
2010-12-31 23:59:52 +01:00
|
|
|
|
part, typically implemented in the xm-file for each
|
|
|
|
|
architecture. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
/* We just get all the registers, so we don't use regno. */
|
|
|
|
|
|
|
|
|
|
static void
|
* corelow.c (get_core_registers): Adjust.
(core_file_thread_alive): Rename to...
(core_thread_alive): ... this.
(core_pid_to_str): Try gdbarch_core_pid_to_str first.
(init_core_ops): Adjust.
(coreops_suppress_target): Delete.
(_initialize_corelow): Unconditionally add core_ops.
* procfs.c: Include "inf-child.h".
(procfs_ops): Delete.
(init_procfs_ops): Delete. Reimplement as...
(procfs_target): ... this, inheriting from inf-child.
(procfs_attach, procfs_detach, procfs_fetch_registers): Adjust.
(procfs_prepare_to_store): Delete.
(procfs_store_registers, procfs_resume): Adjust.
(procfs_open): Delete.
(procfs_suppress_run): Delete.
(procfs_can_run): Delete.
(procfs_mourn_inferior): Adjust.
(procfs_init_inferior): Add target_ops parameter. Adjust.
(procfs_create_inferior): Don't pass procfs_init_inferior to
fork_inferior. Instead call it after fork_inferior returns.
(procfs_find_new_threads): Adjust.
(_initialize_procfs): Adjust to use procfs_target instead of
init_procfs_ops.
* sol-thread.c (orig_core_ops, sol_core_ops): Delete.
(lwp_to_thread): Use target_thread_alive.
(sol_thread_open): Delete.
(sol_thread_attach): Delete.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers): Adjust
to use find_target_beneath.
(sol_thread_prepare_to_store, sol_thread_xfer_memory): Delete.
(sol_thread_xfer_partial): Adjust to use find_target_beneath.
(sol_thread_files_info, sol_thread_kill_inferior): Delete.
(check_for_thread_db): New.
(sol_thread_notice_signals, sol_thread_create_inferior): Delete.
(sol_thread_new_objfile): Call check_for_thread_db.
(sol_thread_mourn_inferior): Adjust to use find_target_beneath.
(sol_thread_can_run): Delete.
(sol_thread_alive): Adjust to use find_target_beneath.
(sol_thread_stop): Delete.
(rw_common): Use target_write_memory or target_read_memory.
(ps_lgetregs, ps_lgetfpregs): Use target_fetch_registers.
(ps_lsetregs, ps_lsetfpregs): Use target_store_registers.
(solaris_pid_to_str): Remove check for libthread_db initialization
failing.
(sol_find_new_threads): Remove check for libthread_db
initialization failing, or for an invalid inferior_ptid. Adjust
to use find_target_beneath.
(sol_core_open, sol_core_close, sol_core_detach,
sol_core_files_info, sol_find_memory_regions,
sol_make_note_section, ignore): Delete.
(init_sol_thread_ops): Make it a thread_stratum target. Remove
unneeded callback settings.
(init_sol_core_ops): Delete.
(_initialize_sol_thread): No longer call init_sol_core_ops, set
procfs_suppress_run, or hack with core_ops.
* target.h (struct target_ops): Add a target_ops * parameter to
to_resume, to_fetch_registers, to_store_registers, to_thread_alive
and to_find_new_threads.
(target_fetch_registers, target_store_registers)
(target_thread_alive, target_find_new_threads): Redeclare as
function.
* target.c (update_current_target): Do not inherit or de_fault
to_resume, to_fetch_registers, to_store_registers,
to_thread_alive, to_find_new_threads.
(target_resume): Adjust.
(target_thread_alive, target_find_new_threads): New.
(debug_to_resume, debug_to_fetch_registers): Delete.
(target_fetch_registers): New.
(debug_to_store_registers): Delete.
(target_store_registers): New.
(debug_to_thread_alive, debug_to_find_new_threads): Delete.
(setup_target_debug): Adjust.
* gdbcore.h (core_ops): Delete declaration.
* inf-ptrace.c, linux-nat.c, remote.c, amd64-linux-nat.c,
inf-child.c, linux-thread-db.c, bsd-uthread.c, inf-ttrace.c,
i386-sol2-tdep.c, darwin-nat.c, gnu-nat.c, go32-nat.c,
hpux-thread.c, i386-linux-nat.c, i386fbsd-nat.c, monitor.c,
nto-procfs.c, remote-m32r-sdi.c, remote-mips.c, windows-nat.c,
alphabsd-nat.c, amd64bsd-nat.c, arm-linux-nat.c, armnbsd-nat.c,
bsd-kvm.c, hppa-hpux-nat.c, hppa-linux-nat.c, hppabsd-nat.c,
hppanbsd-nat.c, i386-darwin-nat.c, i386bsd-nat.c,
ia64-linux-nat.c, m32r-linux-nat.c, m68kbsd-nat.c,
m68klinux-nat.c, m88kbsd-nat.c, mips-linux-nat.c,
mips64obsd-nat.c, mipsnbsd-nat.c, ppc-linux-nat.c, ppcnbsd-nat.c,
ppcobsd-nat.c, remote-sim.c, rs6000-nat.c, s390-nat.c,
shnbsd-nat.c, sparc-nat.c, sparc-nat.h, spu-linux-nat.c,
vaxbsd-nat.c, xtensa-linux-nat.c: Adjust to target_ops changes.
* gdbarch.sh (core_pid_to_str): New gdbarch callback.
* gdbarch.h, gdbarch.c: Regenerate.
* sol2-tdep.c: Include "inferior.h".
(sol2_core_pid_to_str): New.
* sol2-tdep.h (sol2_core_pid_to_str): Declare.
* amd64-sol2-tdep.c (amd64_sol2_init_abi): Set it.
* sparc-sol2-tdep.c (sparc32_sol2_init_abi): Set it.
* sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Set it.
* i386-sol2-tdep.c (i386_sol2_init_abi): Set it.
2009-02-23 01:03:50 +01:00
|
|
|
|
get_core_registers (struct target_ops *ops,
|
|
|
|
|
struct regcache *regcache, int regno)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
2007-05-06 21:37:31 +02:00
|
|
|
|
int i;
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 17:26:43 +02:00
|
|
|
|
struct gdbarch *gdbarch;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2014-09-10 14:55:39 +02:00
|
|
|
|
if (!(core_gdbarch && gdbarch_iterate_over_regset_sections_p (core_gdbarch))
|
2003-10-29 21:59:07 +01:00
|
|
|
|
&& (core_vec == NULL || core_vec->core_read_registers == NULL))
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
fprintf_filtered (gdb_stderr,
|
1999-07-07 22:19:36 +02:00
|
|
|
|
"Can't fetch registers from this type of core file\n");
|
1999-04-16 03:35:26 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 17:26:43 +02:00
|
|
|
|
gdbarch = get_regcache_arch (regcache);
|
|
|
|
|
if (gdbarch_iterate_over_regset_sections_p (gdbarch))
|
|
|
|
|
gdbarch_iterate_over_regset_sections (gdbarch,
|
|
|
|
|
get_core_registers_cb,
|
|
|
|
|
(void *) regcache, NULL);
|
2010-01-04 15:57:44 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
Add 'regset' parameter to 'iterate_over_regset_sections_cb'
This adds the 'regset' parameter to the iterator callback.
Consequently the 'regset_from_core_section' method is dropped for all
targets that provide the iterator method.
This change prepares for replacing regset_from_core_section
everywhere, thereby eliminating one gdbarch interface. Since the
iterator is usually no more complex than regset_from_core_section
alone, targets that previously didn't define core_regset_sections will
then gain multi-arch capable core file generation support without
increased complexity.
gdb/ChangeLog:
* gdbarch.sh (iterate_over_regset_sections_cb): Add regset
parameter.
* gdbarch.h: Regenerate.
* corelow.c (sniff_core_bfd): Don't sniff if gdbarch has a regset
iterator.
(get_core_register_section): Add parameter 'regset' and use it, if
set. Add parameter 'min_size' and verify the bfd section size
against it.
(get_core_registers_cb): Add parameter 'regset' and pass it to
get_core_register section. For the "standard" register sections
".reg" and ".reg2", set an appropriate default for human_name.
(get_core_registers): Don't abort when the gdbarch has an iterator
but no regset_from_core_section. Add NULL/0 for parameters
'regset'/'min_size' in calls to get_core_register_section.
* linux-tdep.c (linux_collect_regset_section_cb): Add parameter
'regset' and use it instead of calling the
regset_from_core_section gdbarch method.
* i386-tdep.h (struct gdbarch_tdep): Add field 'fpregset'.
* i386-tdep.c (i386_supply_xstateregset)
(i386_collect_xstateregset, i386_xstateregset): Moved to
i386-linux-tdep.c.
(i386_regset_from_core_section): Drop handling for .reg-xfp and
.reg-xstate.
(i386_gdbarch_init): Set tdep field 'fpregset'. Enable generic
core file support only if the regset iterator hasn't been set.
* i386-linux-tdep.c (i386_linux_supply_xstateregset)
(i386_linux_collect_xstateregset, i386_linux_xstateregset): New.
Moved from i386-tdep.c and renamed to *_linux*.
(i386_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation. Allow any .reg-xstate size when reading
from a core file.
* amd64-tdep.c (amd64_supply_xstateregset)
(amd64_collect_xstateregset, amd64_xstateregset): Moved to
amd64-linux-tdep.c.
(amd64_regset_from_core_section): Remove.
(amd64_init_abi): Set new tdep field 'fpregset'. No longer
install an amd64-specific regset_from_core_section gdbarch method.
* amd64-linux-tdep.c (amd64_linux_supply_xstateregset)
(amd64_linux_collect_xstateregset, amd64_linux_xstateregset): New.
Moved from amd64-tdep.c and renamed to *_linux*.
(amd64_linux_iterate_over_regset_sections): Add regset parameter
to each callback invocation. Allow any .reg-xstate size when
reading from a core file.
* arm-linux-tdep.c (arm_linux_regset_from_core_section): Remove.
(arm_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(arm_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* ppc-linux-tdep.c (ppc_linux_regset_from_core_section): Remove.
(ppc_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(ppc_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* s390-linux-tdep.c (struct gdbarch_tdep): Remove the fields
gregset, sizeof_gregset, fpregset, and sizeof_fpregset.
(s390_regset_from_core_section): Remove.
(s390_iterate_over_regset_sections): Add regset parameter to each
callback invocation.
(s390_gdbarch_init): No longer set the regset_from_core_section
gdbarch method. Drop initialization of deleted tdep fields.
2014-09-12 10:42:48 +02:00
|
|
|
|
get_core_register_section (regcache, NULL,
|
|
|
|
|
".reg", 0, 0, "general-purpose", 1);
|
|
|
|
|
get_core_register_section (regcache, NULL,
|
|
|
|
|
".reg2", 0, 2, "floating-point", 0);
|
2010-01-04 15:57:44 +01:00
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2011-01-25 13:47:25 +01:00
|
|
|
|
/* Mark all registers not found in the core as unavailable. */
|
2007-10-30 22:46:25 +01:00
|
|
|
|
for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
|
2011-01-25 13:47:25 +01:00
|
|
|
|
if (regcache_register_status (regcache, i) == REG_UNKNOWN)
|
2007-05-06 21:37:31 +02:00
|
|
|
|
regcache_raw_supply (regcache, i, NULL);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 03:48:28 +02:00
|
|
|
|
core_files_info (struct target_ops *t)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
2009-06-03 20:50:36 +02:00
|
|
|
|
print_section_info (core_data, core_bfd);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
}
|
2004-02-01 23:35:20 +01:00
|
|
|
|
|
2009-07-31 17:25:22 +02:00
|
|
|
|
struct spuid_list
|
|
|
|
|
{
|
|
|
|
|
gdb_byte *buf;
|
|
|
|
|
ULONGEST offset;
|
|
|
|
|
LONGEST len;
|
|
|
|
|
ULONGEST pos;
|
|
|
|
|
ULONGEST written;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
add_to_spuid_list (bfd *abfd, asection *asect, void *list_p)
|
|
|
|
|
{
|
Add some more casts (1/2)
Note: I needed to split this patch in two, otherwise it's too big for
the mailing list.
This patch adds explicit casts to situations where a void pointer is
assigned to a pointer to the "real" type. Building in C++ mode requires
those assignments to use an explicit cast. This includes, for example:
- callback arguments (cleanups, comparison functions, ...)
- data attached to some object (objfile, program space, etc) in the form
of a void pointer
- "user data" passed to some function
This patch comes from the commit "(mostly) auto-generated patch to insert
casts needed for C++", taken from Pedro's C++ branch.
Only files built on x86 with --enable-targets=all are modified, so the
native files for other arches will need to be dealt with separately.
I built-tested this with --enable-targets=all and reg-tested. To my
surprise, a test case (selftest.exp) had to be adjusted.
Here's the ChangeLog entry. Again, this was relatively quick to make
despite the length, thanks to David Malcom's script, although I don't
believe it's very useful information in that particular case...
gdb/ChangeLog:
* aarch64-tdep.c (aarch64_make_prologue_cache): Add cast(s).
(aarch64_make_stub_cache): Likewise.
(value_of_aarch64_user_reg): Likewise.
* ada-lang.c (ada_inferior_data_cleanup): Likewise.
(get_ada_inferior_data): Likewise.
(get_ada_pspace_data): Likewise.
(ada_pspace_data_cleanup): Likewise.
(ada_complete_symbol_matcher): Likewise.
(ada_exc_search_name_matches): Likewise.
* ada-tasks.c (get_ada_tasks_pspace_data): Likewise.
(get_ada_tasks_inferior_data): Likewise.
* addrmap.c (addrmap_mutable_foreach_worker): Likewise.
(splay_obstack_alloc): Likewise.
(splay_obstack_free): Likewise.
* alpha-linux-tdep.c (alpha_linux_supply_gregset): Likewise.
(alpha_linux_collect_gregset): Likewise.
(alpha_linux_supply_fpregset): Likewise.
(alpha_linux_collect_fpregset): Likewise.
* alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise.
* alpha-tdep.c (alpha_lds): Likewise.
(alpha_sts): Likewise.
(alpha_sigtramp_frame_unwind_cache): Likewise.
(alpha_heuristic_frame_unwind_cache): Likewise.
(alpha_supply_int_regs): Likewise.
(alpha_fill_int_regs): Likewise.
(alpha_supply_fp_regs): Likewise.
(alpha_fill_fp_regs): Likewise.
* alphanbsd-tdep.c (alphanbsd_supply_fpregset): Likewise.
(alphanbsd_aout_supply_gregset): Likewise.
(alphanbsd_supply_gregset): Likewise.
* amd64-linux-tdep.c (amd64_linux_init_abi): Likewise.
(amd64_x32_linux_init_abi): Likewise.
* amd64-nat.c (amd64_supply_native_gregset): Likewise.
(amd64_collect_native_gregset): Likewise.
* amd64-tdep.c (amd64_frame_cache): Likewise.
(amd64_sigtramp_frame_cache): Likewise.
(amd64_epilogue_frame_cache): Likewise.
(amd64_supply_fxsave): Likewise.
(amd64_supply_xsave): Likewise.
(amd64_collect_fxsave): Likewise.
(amd64_collect_xsave): Likewise.
* amd64-windows-tdep.c (amd64_windows_frame_cache): Likewise.
* amd64obsd-tdep.c (amd64obsd_trapframe_cache): Likewise.
* arm-linux-tdep.c (arm_linux_supply_gregset): Likewise.
(arm_linux_collect_gregset): Likewise.
(arm_linux_supply_nwfpe): Likewise.
(arm_linux_collect_nwfpe): Likewise.
(arm_linux_supply_vfp): Likewise.
(arm_linux_collect_vfp): Likewise.
* arm-tdep.c (arm_find_mapping_symbol): Likewise.
(arm_prologue_unwind_stop_reason): Likewise.
(arm_prologue_this_id): Likewise.
(arm_prologue_prev_register): Likewise.
(arm_exidx_data_free): Likewise.
(arm_find_exidx_entry): Likewise.
(arm_stub_this_id): Likewise.
(arm_m_exception_this_id): Likewise.
(arm_m_exception_prev_register): Likewise.
(arm_normal_frame_base): Likewise.
(gdb_print_insn_arm): Likewise.
(arm_objfile_data_free): Likewise.
(arm_record_special_symbol): Likewise.
(value_of_arm_user_reg): Likewise.
* armbsd-tdep.c (armbsd_supply_fpregset): Likewise.
(armbsd_supply_gregset): Likewise.
* auto-load.c (auto_load_pspace_data_cleanup): Likewise.
(get_auto_load_pspace_data): Likewise.
(hash_loaded_script_entry): Likewise.
(eq_loaded_script_entry): Likewise.
(clear_section_scripts): Likewise.
(collect_matching_scripts): Likewise.
* auxv.c (auxv_inferior_data_cleanup): Likewise.
(get_auxv_inferior_data): Likewise.
* avr-tdep.c (avr_frame_unwind_cache): Likewise.
* ax-general.c (do_free_agent_expr_cleanup): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
(target_bfd_xclose): Likewise.
(target_bfd_get_section_table): Likewise.
* bfin-tdep.c (bfin_frame_cache): Likewise.
* block.c (find_block_in_blockvector): Likewise.
(call_site_for_pc): Likewise.
(block_find_non_opaque_type_preferred): Likewise.
* break-catch-sig.c (signal_catchpoint_insert_location): Likewise.
(signal_catchpoint_remove_location): Likewise.
(signal_catchpoint_breakpoint_hit): Likewise.
(signal_catchpoint_print_one): Likewise.
(signal_catchpoint_print_mention): Likewise.
(signal_catchpoint_print_recreate): Likewise.
* break-catch-syscall.c (get_catch_syscall_inferior_data): Likewise.
* breakpoint.c (do_cleanup_counted_command_line): Likewise.
(bp_location_compare_addrs): Likewise.
(get_first_locp_gte_addr): Likewise.
(check_tracepoint_command): Likewise.
(do_map_commands_command): Likewise.
(get_breakpoint_objfile_data): Likewise.
(free_breakpoint_probes): Likewise.
(do_captured_breakpoint_query): Likewise.
(compare_breakpoints): Likewise.
(bp_location_compare): Likewise.
(bpstat_remove_breakpoint_callback): Likewise.
(do_delete_breakpoint_cleanup): Likewise.
* bsd-uthread.c (bsd_uthread_set_supply_uthread): Likewise.
(bsd_uthread_set_collect_uthread): Likewise.
(bsd_uthread_activate): Likewise.
(bsd_uthread_fetch_registers): Likewise.
(bsd_uthread_store_registers): Likewise.
* btrace.c (check_xml_btrace_version): Likewise.
(parse_xml_btrace_block): Likewise.
(parse_xml_btrace_pt_config_cpu): Likewise.
(parse_xml_btrace_pt_raw): Likewise.
(parse_xml_btrace_pt): Likewise.
(parse_xml_btrace_conf_bts): Likewise.
(parse_xml_btrace_conf_pt): Likewise.
(do_btrace_data_cleanup): Likewise.
* c-typeprint.c (find_typedef_for_canonicalize): Likewise.
* charset.c (cleanup_iconv): Likewise.
(do_cleanup_iterator): Likewise.
* cli-out.c (cli_uiout_dtor): Likewise.
(cli_table_begin): Likewise.
(cli_table_body): Likewise.
(cli_table_end): Likewise.
(cli_table_header): Likewise.
(cli_begin): Likewise.
(cli_end): Likewise.
(cli_field_int): Likewise.
(cli_field_skip): Likewise.
(cli_field_string): Likewise.
(cli_field_fmt): Likewise.
(cli_spaces): Likewise.
(cli_text): Likewise.
(cli_message): Likewise.
(cli_wrap_hint): Likewise.
(cli_flush): Likewise.
(cli_redirect): Likewise.
(out_field_fmt): Likewise.
(field_separator): Likewise.
(cli_out_set_stream): Likewise.
* cli/cli-cmds.c (compare_symtabs): Likewise.
* cli/cli-dump.c (call_dump_func): Likewise.
(restore_section_callback): Likewise.
* cli/cli-script.c (clear_hook_in_cleanup): Likewise.
(do_restore_user_call_depth): Likewise.
(do_free_command_lines_cleanup): Likewise.
* coff-pe-read.c (get_section_vmas): Likewise.
(pe_as16): Likewise.
(pe_as32): Likewise.
* coffread.c (coff_symfile_read): Likewise.
* common/agent.c (agent_look_up_symbols): Likewise.
* common/filestuff.c (do_close_cleanup): Likewise.
* common/format.c (free_format_pieces_cleanup): Likewise.
* common/vec.c (vec_o_reserve): Likewise.
* compile/compile-c-support.c (print_one_macro): Likewise.
* compile/compile-c-symbols.c (hash_symbol_error): Likewise.
(eq_symbol_error): Likewise.
(del_symbol_error): Likewise.
(error_symbol_once): Likewise.
(gcc_convert_symbol): Likewise.
(gcc_symbol_address): Likewise.
(hash_symname): Likewise.
(eq_symname): Likewise.
* compile/compile-c-types.c (hash_type_map_instance): Likewise.
(eq_type_map_instance): Likewise.
(insert_type): Likewise.
(convert_type): Likewise.
* compile/compile-object-load.c (munmap_listp_free_cleanup): Likewise.
(setup_sections): Likewise.
(link_hash_table_free): Likewise.
(copy_sections): Likewise.
* compile/compile-object-run.c (do_module_cleanup): Likewise.
* compile/compile.c (compile_print_value): Likewise.
(do_rmdir): Likewise.
(cleanup_compile_instance): Likewise.
(cleanup_unlink_file): Likewise.
* completer.c (free_completion_tracker): Likewise.
* corelow.c (add_to_spuid_list): Likewise.
* cp-namespace.c (reset_directive_searched): Likewise.
* cp-support.c (reset_directive_searched): Likewise.
* cris-tdep.c (cris_sigtramp_frame_unwind_cache): Likewise.
(cris_frame_unwind_cache): Likewise.
* d-lang.c (builtin_d_type): Likewise.
* d-namespace.c (reset_directive_searched): Likewise.
* dbxread.c (dbx_free_symfile_info): Likewise.
(do_free_bincl_list_cleanup): Likewise.
* disasm.c (hash_dis_line_entry): Likewise.
(eq_dis_line_entry): Likewise.
(dis_asm_print_address): Likewise.
(fprintf_disasm): Likewise.
(do_ui_file_delete): Likewise.
* doublest.c (convert_floatformat_to_doublest): Likewise.
* dummy-frame.c (pop_dummy_frame_bpt): Likewise.
(dummy_frame_prev_register): Likewise.
(dummy_frame_this_id): Likewise.
* dwarf2-frame-tailcall.c (cache_hash): Likewise.
(cache_eq): Likewise.
(cache_find): Likewise.
(tailcall_frame_this_id): Likewise.
(dwarf2_tailcall_prev_register_first): Likewise.
(tailcall_frame_prev_register): Likewise.
(tailcall_frame_dealloc_cache): Likewise.
(tailcall_frame_prev_arch): Likewise.
* dwarf2-frame.c (dwarf2_frame_state_free): Likewise.
(dwarf2_frame_set_init_reg): Likewise.
(dwarf2_frame_init_reg): Likewise.
(dwarf2_frame_set_signal_frame_p): Likewise.
(dwarf2_frame_signal_frame_p): Likewise.
(dwarf2_frame_set_adjust_regnum): Likewise.
(dwarf2_frame_adjust_regnum): Likewise.
(clear_pointer_cleanup): Likewise.
(dwarf2_frame_cache): Likewise.
(find_cie): Likewise.
(dwarf2_frame_find_fde): Likewise.
* dwarf2expr.c (dwarf_expr_address_type): Likewise.
(free_dwarf_expr_context_cleanup): Likewise.
* dwarf2loc.c (locexpr_find_frame_base_location): Likewise.
(locexpr_get_frame_base): Likewise.
(loclist_find_frame_base_location): Likewise.
(loclist_get_frame_base): Likewise.
(dwarf_expr_dwarf_call): Likewise.
(dwarf_expr_get_base_type): Likewise.
(dwarf_expr_push_dwarf_reg_entry_value): Likewise.
(dwarf_expr_get_obj_addr): Likewise.
(entry_data_value_coerce_ref): Likewise.
(entry_data_value_copy_closure): Likewise.
(entry_data_value_free_closure): Likewise.
(get_frame_address_in_block_wrapper): Likewise.
(dwarf2_evaluate_property): Likewise.
(dwarf2_compile_property_to_c): Likewise.
(needs_frame_read_addr_from_reg): Likewise.
(needs_frame_get_reg_value): Likewise.
(needs_frame_frame_base): Likewise.
(needs_frame_frame_cfa): Likewise.
(needs_frame_tls_address): Likewise.
(needs_frame_dwarf_call): Likewise.
(needs_dwarf_reg_entry_value): Likewise.
(get_ax_pc): Likewise.
(locexpr_read_variable): Likewise.
(locexpr_read_variable_at_entry): Likewise.
(locexpr_read_needs_frame): Likewise.
(locexpr_describe_location): Likewise.
(locexpr_tracepoint_var_ref): Likewise.
(locexpr_generate_c_location): Likewise.
(loclist_read_variable): Likewise.
(loclist_read_variable_at_entry): Likewise.
(loclist_describe_location): Likewise.
(loclist_tracepoint_var_ref): Likewise.
(loclist_generate_c_location): Likewise.
* dwarf2read.c (line_header_hash_voidp): Likewise.
(line_header_eq_voidp): Likewise.
(dwarf2_has_info): Likewise.
(dwarf2_get_section_info): Likewise.
(locate_dwz_sections): Likewise.
(hash_file_name_entry): Likewise.
(eq_file_name_entry): Likewise.
(delete_file_name_entry): Likewise.
(dw2_setup): Likewise.
(dw2_get_file_names_reader): Likewise.
(dw2_find_pc_sect_compunit_symtab): Likewise.
(hash_signatured_type): Likewise.
(eq_signatured_type): Likewise.
(add_signatured_type_cu_to_table): Likewise.
(create_debug_types_hash_table): Likewise.
(lookup_dwo_signatured_type): Likewise.
(lookup_dwp_signatured_type): Likewise.
(lookup_signatured_type): Likewise.
(hash_type_unit_group): Likewise.
(eq_type_unit_group): Likewise.
(get_type_unit_group): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(sort_tu_by_abbrev_offset): Likewise.
(process_skeletonless_type_unit): Likewise.
(psymtabs_addrmap_cleanup): Likewise.
(dwarf2_read_symtab): Likewise.
(psymtab_to_symtab_1): Likewise.
(die_hash): Likewise.
(die_eq): Likewise.
(load_full_comp_unit_reader): Likewise.
(reset_die_in_process): Likewise.
(free_cu_line_header): Likewise.
(handle_DW_AT_stmt_list): Likewise.
(hash_dwo_file): Likewise.
(eq_dwo_file): Likewise.
(hash_dwo_unit): Likewise.
(eq_dwo_unit): Likewise.
(create_dwo_cu_reader): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(lookup_dwo_unit_in_dwp): Likewise.
(dwarf2_locate_dwo_sections): Likewise.
(dwarf2_locate_common_dwp_sections): Likewise.
(dwarf2_locate_v2_dwp_sections): Likewise.
(hash_dwp_loaded_cutus): Likewise.
(eq_dwp_loaded_cutus): Likewise.
(lookup_dwo_cutu): Likewise.
(abbrev_table_free_cleanup): Likewise.
(dwarf2_free_abbrev_table): Likewise.
(find_partial_die_in_comp_unit): Likewise.
(free_line_header_voidp): Likewise.
(follow_die_offset): Likewise.
(follow_die_sig_1): Likewise.
(free_heap_comp_unit): Likewise.
(free_stack_comp_unit): Likewise.
(dwarf2_free_objfile): Likewise.
(per_cu_offset_and_type_hash): Likewise.
(per_cu_offset_and_type_eq): Likewise.
(get_die_type_at_offset): Likewise.
(partial_die_hash): Likewise.
(partial_die_eq): Likewise.
(dwarf2_per_objfile_free): Likewise.
(hash_strtab_entry): Likewise.
(eq_strtab_entry): Likewise.
(add_string): Likewise.
(hash_symtab_entry): Likewise.
(eq_symtab_entry): Likewise.
(delete_symtab_entry): Likewise.
(cleanup_mapped_symtab): Likewise.
(add_indices_to_cpool): Likewise.
(hash_psymtab_cu_index): Likewise.
(eq_psymtab_cu_index): Likewise.
(add_address_entry_worker): Likewise.
(unlink_if_set): Likewise.
(write_one_signatured_type): Likewise.
(save_gdb_index_command): Likewise.
* elfread.c (elf_symtab_read): Likewise.
(elf_gnu_ifunc_cache_hash): Likewise.
(elf_gnu_ifunc_cache_eq): Likewise.
(elf_gnu_ifunc_record_cache): Likewise.
(elf_gnu_ifunc_resolve_by_cache): Likewise.
(elf_get_probes): Likewise.
(probe_key_free): Likewise.
* f-lang.c (builtin_f_type): Likewise.
* frame-base.c (frame_base_append_sniffer): Likewise.
(frame_base_set_default): Likewise.
(frame_base_find_by_frame): Likewise.
* frame-unwind.c (frame_unwind_prepend_unwinder): Likewise.
(frame_unwind_append_unwinder): Likewise.
(frame_unwind_find_by_frame): Likewise.
* frame.c (frame_addr_hash): Likewise.
(frame_addr_hash_eq): Likewise.
(frame_stash_find): Likewise.
(do_frame_register_read): Likewise.
(unwind_to_current_frame): Likewise.
(frame_cleanup_after_sniffer): Likewise.
* frv-linux-tdep.c (frv_linux_sigtramp_frame_cache): Likewise.
* frv-tdep.c (frv_frame_unwind_cache): Likewise.
* ft32-tdep.c (ft32_frame_cache): Likewise.
* gcore.c (do_bfd_delete_cleanup): Likewise.
(gcore_create_callback): Likewise.
* gdb_bfd.c (hash_bfd): Likewise.
(eq_bfd): Likewise.
(gdb_bfd_open): Likewise.
(free_one_bfd_section): Likewise.
(gdb_bfd_ref): Likewise.
(gdb_bfd_unref): Likewise.
(get_section_descriptor): Likewise.
(gdb_bfd_map_section): Likewise.
(gdb_bfd_crc): Likewise.
(gdb_bfd_mark_parent): Likewise.
(gdb_bfd_record_inclusion): Likewise.
(gdb_bfd_requires_relocations): Likewise.
(print_one_bfd): Likewise.
* gdbtypes.c (type_pair_hash): Likewise.
(type_pair_eq): Likewise.
(builtin_type): Likewise.
(objfile_type): Likewise.
* gnu-v3-abi.c (vtable_ptrdiff_type): Likewise.
(vtable_address_point_offset): Likewise.
(gnuv3_get_vtable): Likewise.
(hash_value_and_voffset): Likewise.
(eq_value_and_voffset): Likewise.
(compare_value_and_voffset): Likewise.
(compute_vtable_size): Likewise.
(gnuv3_get_typeid_type): Likewise.
* go-lang.c (builtin_go_type): Likewise.
* guile/scm-block.c (bkscm_hash_block_smob): Likewise.
(bkscm_eq_block_smob): Likewise.
(bkscm_objfile_block_map): Likewise.
(bkscm_del_objfile_blocks): Likewise.
* guile/scm-breakpoint.c (bpscm_build_bp_list): Likewise.
* guile/scm-disasm.c (gdbscm_disasm_read_memory_worker): Likewise.
(gdbscm_disasm_print_address): Likewise.
* guile/scm-frame.c (frscm_hash_frame_smob): Likewise.
(frscm_eq_frame_smob): Likewise.
(frscm_inferior_frame_map): Likewise.
(frscm_del_inferior_frames): Likewise.
* guile/scm-gsmob.c (gdbscm_add_objfile_ref): Likewise.
* guile/scm-objfile.c (ofscm_handle_objfile_deleted): Likewise.
(ofscm_objfile_smob_from_objfile): Likewise.
* guile/scm-ports.c (ioscm_write): Likewise.
(ioscm_file_port_delete): Likewise.
(ioscm_file_port_rewind): Likewise.
(ioscm_file_port_put): Likewise.
(ioscm_file_port_write): Likewise.
* guile/scm-progspace.c (psscm_handle_pspace_deleted): Likewise.
(psscm_pspace_smob_from_pspace): Likewise.
* guile/scm-safe-call.c (scscm_recording_pre_unwind_handler): Likewise.
(scscm_recording_unwind_handler): Likewise.
(gdbscm_with_catch): Likewise.
(scscm_call_0_body): Likewise.
(scscm_call_1_body): Likewise.
(scscm_call_2_body): Likewise.
(scscm_call_3_body): Likewise.
(scscm_call_4_body): Likewise.
(scscm_apply_1_body): Likewise.
(scscm_eval_scheme_string): Likewise.
(gdbscm_safe_eval_string): Likewise.
(scscm_source_scheme_script): Likewise.
(gdbscm_safe_source_script): Likewise.
* guile/scm-string.c (gdbscm_call_scm_to_stringn): Likewise.
(gdbscm_call_scm_from_stringn): Likewise.
* guile/scm-symbol.c (syscm_hash_symbol_smob): Likewise.
(syscm_eq_symbol_smob): Likewise.
(syscm_get_symbol_map): Likewise.
(syscm_del_objfile_symbols): Likewise.
* guile/scm-symtab.c (stscm_hash_symtab_smob): Likewise.
(stscm_eq_symtab_smob): Likewise.
(stscm_objfile_symtab_map): Likewise.
(stscm_del_objfile_symtabs): Likewise.
* guile/scm-type.c (tyscm_hash_type_smob): Likewise.
(tyscm_eq_type_smob): Likewise.
(tyscm_type_map): Likewise.
(tyscm_copy_type_recursive): Likewise.
(save_objfile_types): Likewise.
* guile/scm-utils.c (extract_arg): Likewise.
* h8300-tdep.c (h8300_frame_cache): Likewise.
* hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind_cache): Likewise.
* hppa-tdep.c (compare_unwind_entries): Likewise.
(find_unwind_entry): Likewise.
(hppa_frame_cache): Likewise.
(hppa_stub_frame_unwind_cache): Likewise.
* hppanbsd-tdep.c (hppanbsd_supply_gregset): Likewise.
* hppaobsd-tdep.c (hppaobsd_supply_gregset): Likewise.
(hppaobsd_supply_fpregset): Likewise.
* i386-cygwin-tdep.c (core_process_module_section): Likewise.
* i386-linux-tdep.c (i386_linux_init_abi): Likewise.
* i386-tdep.c (i386_frame_cache): Likewise.
(i386_epilogue_frame_cache): Likewise.
(i386_sigtramp_frame_cache): Likewise.
(i386_supply_gregset): Likewise.
(i386_collect_gregset): Likewise.
(i386_gdbarch_init): Likewise.
* i386obsd-tdep.c (i386obsd_aout_supply_regset): Likewise.
(i386obsd_trapframe_cache): Likewise.
* i387-tdep.c (i387_supply_fsave): Likewise.
(i387_collect_fsave): Likewise.
(i387_supply_fxsave): Likewise.
(i387_collect_fxsave): Likewise.
(i387_supply_xsave): Likewise.
(i387_collect_xsave): Likewise.
* ia64-tdep.c (ia64_frame_cache): Likewise.
(ia64_sigtramp_frame_cache): Likewise.
* infcmd.c (attach_command_continuation): Likewise.
(attach_command_continuation_free_args): Likewise.
* inferior.c (restore_inferior): Likewise.
(delete_thread_of_inferior): Likewise.
* inflow.c (inflow_inferior_data_cleanup): Likewise.
(get_inflow_inferior_data): Likewise.
(inflow_inferior_exit): Likewise.
* infrun.c (displaced_step_clear_cleanup): Likewise.
(restore_current_uiout_cleanup): Likewise.
(release_stop_context_cleanup): Likewise.
(do_restore_infcall_suspend_state_cleanup): Likewise.
(do_restore_infcall_control_state_cleanup): Likewise.
(restore_inferior_ptid): Likewise.
* inline-frame.c (block_starting_point_at): Likewise.
* iq2000-tdep.c (iq2000_frame_cache): Likewise.
* jit.c (get_jit_objfile_data): Likewise.
(get_jit_program_space_data): Likewise.
(jit_object_close_impl): Likewise.
(jit_find_objf_with_entry_addr): Likewise.
(jit_breakpoint_deleted): Likewise.
(jit_unwind_reg_set_impl): Likewise.
(jit_unwind_reg_get_impl): Likewise.
(jit_dealloc_cache): Likewise.
(jit_frame_sniffer): Likewise.
(jit_frame_prev_register): Likewise.
(jit_prepend_unwinder): Likewise.
(jit_inferior_exit_hook): Likewise.
(free_objfile_data): Likewise.
* jv-lang.c (jv_per_objfile_free): Likewise.
(get_dynamics_objfile): Likewise.
(get_java_class_symtab): Likewise.
(builtin_java_type): Likewise.
* language.c (language_string_char_type): Likewise.
(language_bool_type): Likewise.
(language_lookup_primitive_type): Likewise.
(language_lookup_primitive_type_as_symbol): Likewise.
* linespec.c (hash_address_entry): Likewise.
(eq_address_entry): Likewise.
(iterate_inline_only): Likewise.
(iterate_name_matcher): Likewise.
(decode_line_2_compare_items): Likewise.
(collect_one_symbol): Likewise.
(compare_symbols): Likewise.
(compare_msymbols): Likewise.
(add_symtabs_to_list): Likewise.
(collect_symbols): Likewise.
(compare_msyms): Likewise.
(add_minsym): Likewise.
(cleanup_linespec_result): Likewise.
* linux-fork.c (inferior_call_waitpid_cleanup): Likewise.
* linux-nat.c (delete_lwp_cleanup): Likewise.
(count_events_callback): Likewise.
(select_event_lwp_callback): Likewise.
(resume_stopped_resumed_lwps): Likewise.
* linux-tdep.c (get_linux_gdbarch_data): Likewise.
(invalidate_linux_cache_inf): Likewise.
(get_linux_inferior_data): Likewise.
(linux_find_memory_regions_thunk): Likewise.
(linux_make_mappings_callback): Likewise.
(linux_corefile_thread_callback): Likewise.
(find_mapping_size): Likewise.
* linux-thread-db.c (find_new_threads_callback): Likewise.
* lm32-tdep.c (lm32_frame_cache): Likewise.
* m2-lang.c (builtin_m2_type): Likewise.
* m32c-tdep.c (m32c_analyze_frame_prologue): Likewise.
* m32r-linux-tdep.c (m32r_linux_sigtramp_frame_cache): Likewise.
(m32r_linux_supply_gregset): Likewise.
(m32r_linux_collect_gregset): Likewise.
* m32r-tdep.c (m32r_frame_unwind_cache): Likewise.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise.
* m68k-tdep.c (m68k_frame_cache): Likewise.
* m68kbsd-tdep.c (m68kbsd_supply_fpregset): Likewise.
(m68kbsd_supply_gregset): Likewise.
* m68klinux-tdep.c (m68k_linux_sigtramp_frame_cache): Likewise.
* m88k-tdep.c (m88k_frame_cache): Likewise.
(m88k_supply_gregset): Likewise.
gdb/gdbserver/ChangeLog:
* dll.c (match_dll): Add cast(s).
(unloaded_dll): Likewise.
* linux-low.c (second_thread_of_pid_p): Likewise.
(delete_lwp_callback): Likewise.
(count_events_callback): Likewise.
(select_event_lwp_callback): Likewise.
(linux_set_resume_request): Likewise.
* server.c (accumulate_file_name_length): Likewise.
(emit_dll_description): Likewise.
(handle_qxfer_threads_worker): Likewise.
(visit_actioned_threads): Likewise.
* thread-db.c (any_thread_of): Likewise.
* tracepoint.c (same_process_p): Likewise.
(match_blocktype): Likewise.
(build_traceframe_info_xml): Likewise.
gdb/testsuite/ChangeLog:
* gdb.gdb/selftest.exp (do_steps_and_nexts): Adjust expected
source line.
2015-09-25 20:08:07 +02:00
|
|
|
|
struct spuid_list *list = (struct spuid_list *) list_p;
|
2009-07-31 17:25:22 +02:00
|
|
|
|
enum bfd_endian byte_order
|
2010-12-31 23:59:52 +01:00
|
|
|
|
= bfd_big_endian (abfd) ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
|
2009-07-31 17:25:22 +02:00
|
|
|
|
int fd, pos = 0;
|
|
|
|
|
|
|
|
|
|
sscanf (bfd_section_name (abfd, asect), "SPU/%d/regs%n", &fd, &pos);
|
|
|
|
|
if (pos == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (list->pos >= list->offset && list->pos + 4 <= list->offset + list->len)
|
|
|
|
|
{
|
|
|
|
|
store_unsigned_integer (list->buf + list->pos - list->offset,
|
|
|
|
|
4, byte_order, fd);
|
|
|
|
|
list->written += 4;
|
|
|
|
|
}
|
|
|
|
|
list->pos += 4;
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-08 22:16:43 +01:00
|
|
|
|
/* Read siginfo data from the core, if possible. Returns -1 on
|
|
|
|
|
failure. Otherwise, returns the number of bytes read. ABFD is the
|
|
|
|
|
core file's BFD; READBUF, OFFSET, and LEN are all as specified by
|
|
|
|
|
the to_xfer_partial interface. */
|
|
|
|
|
|
|
|
|
|
static LONGEST
|
2014-01-10 07:11:59 +01:00
|
|
|
|
get_core_siginfo (bfd *abfd, gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
|
2012-11-08 22:16:43 +01:00
|
|
|
|
{
|
|
|
|
|
asection *section;
|
|
|
|
|
char *section_name;
|
|
|
|
|
const char *name = ".note.linuxcore.siginfo";
|
|
|
|
|
|
|
|
|
|
if (ptid_get_lwp (inferior_ptid))
|
|
|
|
|
section_name = xstrprintf ("%s/%ld", name,
|
|
|
|
|
ptid_get_lwp (inferior_ptid));
|
|
|
|
|
else
|
|
|
|
|
section_name = xstrdup (name);
|
|
|
|
|
|
|
|
|
|
section = bfd_get_section_by_name (abfd, section_name);
|
|
|
|
|
xfree (section_name);
|
|
|
|
|
if (section == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
if (!bfd_get_section_contents (abfd, section, readbuf, offset, len))
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
return len;
|
|
|
|
|
}
|
|
|
|
|
|
Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from
LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);
to
enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN. Generally, the return status has three stats,
- TARGET_XFER_OK,
- TARGET_XFER_EOF,
- TARGET_XFER_E_XXXX,
See the comments to them in 'enum target_xfer_status'. Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF.
With this change, GDB core can handle unavailable data in a convenient
way.
The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html
Consider an object/value like this:
0 100 150 200 512
DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III
where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid). Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out. But, in this scenario, we're interested in
the data at [150,512). The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next. We'd need something like:
get me [0,512) >>>
<<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK
get me [100,512) >>> (**1)
<<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.
get me [150,512) >>>
<<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.
get me [200,512) >>>
<<< no more data, return TARGET_XFER_EOF.
This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target. (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).
Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.
No target implementations to to_xfer_partial adapts this new
interface. The interface still behaves as before.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it. New. All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status. Add argument xfered_len. Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it. New. All callers
updated.
(target_read_live_memory): Likewise. Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status. Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise. Check *XFERED_LEN is set
properly. Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise. All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.
* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise. All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise. All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise. All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise. All
callers updated.
(remote_flash_erase): Likewise. All callers updated.
(remote_write_qxfer): Likewise. All callers updated.
(remote_read_qxfer): Likewise. All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.
2014-01-27 13:35:33 +01:00
|
|
|
|
static enum target_xfer_status
|
2004-02-01 23:35:20 +01:00
|
|
|
|
core_xfer_partial (struct target_ops *ops, enum target_object object,
|
2005-05-16 18:36:24 +02:00
|
|
|
|
const char *annex, gdb_byte *readbuf,
|
2010-12-31 23:59:52 +01:00
|
|
|
|
const gdb_byte *writebuf, ULONGEST offset,
|
Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from
LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);
to
enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN. Generally, the return status has three stats,
- TARGET_XFER_OK,
- TARGET_XFER_EOF,
- TARGET_XFER_E_XXXX,
See the comments to them in 'enum target_xfer_status'. Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF.
With this change, GDB core can handle unavailable data in a convenient
way.
The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html
Consider an object/value like this:
0 100 150 200 512
DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III
where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid). Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out. But, in this scenario, we're interested in
the data at [150,512). The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next. We'd need something like:
get me [0,512) >>>
<<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK
get me [100,512) >>> (**1)
<<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.
get me [150,512) >>>
<<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.
get me [200,512) >>>
<<< no more data, return TARGET_XFER_EOF.
This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target. (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).
Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.
No target implementations to to_xfer_partial adapts this new
interface. The interface still behaves as before.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it. New. All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status. Add argument xfered_len. Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it. New. All callers
updated.
(target_read_live_memory): Likewise. Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status. Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise. Check *XFERED_LEN is set
properly. Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise. All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.
* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise. All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise. All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise. All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise. All
callers updated.
(remote_flash_erase): Likewise. All callers updated.
(remote_write_qxfer): Likewise. All callers updated.
(remote_read_qxfer): Likewise. All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.
2014-01-27 13:35:33 +01:00
|
|
|
|
ULONGEST len, ULONGEST *xfered_len)
|
2004-02-01 23:35:20 +01:00
|
|
|
|
{
|
|
|
|
|
switch (object)
|
|
|
|
|
{
|
|
|
|
|
case TARGET_OBJECT_MEMORY:
|
2009-06-03 20:50:36 +02:00
|
|
|
|
return section_table_xfer_memory_partial (readbuf, writebuf,
|
Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from
LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);
to
enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN. Generally, the return status has three stats,
- TARGET_XFER_OK,
- TARGET_XFER_EOF,
- TARGET_XFER_E_XXXX,
See the comments to them in 'enum target_xfer_status'. Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF.
With this change, GDB core can handle unavailable data in a convenient
way.
The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html
Consider an object/value like this:
0 100 150 200 512
DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III
where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid). Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out. But, in this scenario, we're interested in
the data at [150,512). The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next. We'd need something like:
get me [0,512) >>>
<<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK
get me [100,512) >>> (**1)
<<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.
get me [150,512) >>>
<<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.
get me [200,512) >>>
<<< no more data, return TARGET_XFER_EOF.
This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target. (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).
Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.
No target implementations to to_xfer_partial adapts this new
interface. The interface still behaves as before.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it. New. All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status. Add argument xfered_len. Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it. New. All callers
updated.
(target_read_live_memory): Likewise. Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status. Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise. Check *XFERED_LEN is set
properly. Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise. All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.
* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise. All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise. All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise. All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise. All
callers updated.
(remote_flash_erase): Likewise. All callers updated.
(remote_write_qxfer): Likewise. All callers updated.
(remote_read_qxfer): Likewise. All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.
2014-01-27 13:35:33 +01:00
|
|
|
|
offset, len, xfered_len,
|
2009-06-03 20:50:36 +02:00
|
|
|
|
core_data->sections,
|
|
|
|
|
core_data->sections_end,
|
|
|
|
|
NULL);
|
2004-02-01 23:35:20 +01:00
|
|
|
|
|
|
|
|
|
case TARGET_OBJECT_AUXV:
|
|
|
|
|
if (readbuf)
|
|
|
|
|
{
|
|
|
|
|
/* When the aux vector is stored in core file, BFD
|
|
|
|
|
represents this with a fake section called ".auxv". */
|
|
|
|
|
|
2004-02-14 05:41:33 +01:00
|
|
|
|
struct bfd_section *section;
|
2004-02-01 23:35:20 +01:00
|
|
|
|
bfd_size_type size;
|
|
|
|
|
|
|
|
|
|
section = bfd_get_section_by_name (core_bfd, ".auxv");
|
|
|
|
|
if (section == NULL)
|
2014-01-27 10:32:33 +01:00
|
|
|
|
return TARGET_XFER_E_IO;
|
2004-02-01 23:35:20 +01:00
|
|
|
|
|
|
|
|
|
size = bfd_section_size (core_bfd, section);
|
|
|
|
|
if (offset >= size)
|
Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from
LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);
to
enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN. Generally, the return status has three stats,
- TARGET_XFER_OK,
- TARGET_XFER_EOF,
- TARGET_XFER_E_XXXX,
See the comments to them in 'enum target_xfer_status'. Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF.
With this change, GDB core can handle unavailable data in a convenient
way.
The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html
Consider an object/value like this:
0 100 150 200 512
DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III
where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid). Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out. But, in this scenario, we're interested in
the data at [150,512). The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next. We'd need something like:
get me [0,512) >>>
<<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK
get me [100,512) >>> (**1)
<<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.
get me [150,512) >>>
<<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.
get me [200,512) >>>
<<< no more data, return TARGET_XFER_EOF.
This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target. (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).
Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.
No target implementations to to_xfer_partial adapts this new
interface. The interface still behaves as before.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it. New. All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status. Add argument xfered_len. Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it. New. All callers
updated.
(target_read_live_memory): Likewise. Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status. Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise. Check *XFERED_LEN is set
properly. Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise. All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.
* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise. All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise. All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise. All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise. All
callers updated.
(remote_flash_erase): Likewise. All callers updated.
(remote_write_qxfer): Likewise. All callers updated.
(remote_read_qxfer): Likewise. All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.
2014-01-27 13:35:33 +01:00
|
|
|
|
return TARGET_XFER_EOF;
|
2004-02-01 23:35:20 +01:00
|
|
|
|
size -= offset;
|
|
|
|
|
if (size > len)
|
|
|
|
|
size = len;
|
Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from
LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);
to
enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN. Generally, the return status has three stats,
- TARGET_XFER_OK,
- TARGET_XFER_EOF,
- TARGET_XFER_E_XXXX,
See the comments to them in 'enum target_xfer_status'. Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF.
With this change, GDB core can handle unavailable data in a convenient
way.
The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html
Consider an object/value like this:
0 100 150 200 512
DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III
where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid). Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out. But, in this scenario, we're interested in
the data at [150,512). The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next. We'd need something like:
get me [0,512) >>>
<<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK
get me [100,512) >>> (**1)
<<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.
get me [150,512) >>>
<<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.
get me [200,512) >>>
<<< no more data, return TARGET_XFER_EOF.
This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target. (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).
Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.
No target implementations to to_xfer_partial adapts this new
interface. The interface still behaves as before.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it. New. All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status. Add argument xfered_len. Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it. New. All callers
updated.
(target_read_live_memory): Likewise. Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status. Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise. Check *XFERED_LEN is set
properly. Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise. All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.
* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise. All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise. All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise. All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise. All
callers updated.
(remote_flash_erase): Likewise. All callers updated.
(remote_write_qxfer): Likewise. All callers updated.
(remote_read_qxfer): Likewise. All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.
2014-01-27 13:35:33 +01:00
|
|
|
|
|
|
|
|
|
if (size == 0)
|
|
|
|
|
return TARGET_XFER_EOF;
|
|
|
|
|
if (!bfd_get_section_contents (core_bfd, section, readbuf,
|
|
|
|
|
(file_ptr) offset, size))
|
2004-02-01 23:35:20 +01:00
|
|
|
|
{
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
|
warning (_("Couldn't read NT_AUXV note in core file."));
|
2014-01-27 10:32:33 +01:00
|
|
|
|
return TARGET_XFER_E_IO;
|
2004-02-01 23:35:20 +01:00
|
|
|
|
}
|
|
|
|
|
|
Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from
LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);
to
enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN. Generally, the return status has three stats,
- TARGET_XFER_OK,
- TARGET_XFER_EOF,
- TARGET_XFER_E_XXXX,
See the comments to them in 'enum target_xfer_status'. Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF.
With this change, GDB core can handle unavailable data in a convenient
way.
The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html
Consider an object/value like this:
0 100 150 200 512
DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III
where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid). Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out. But, in this scenario, we're interested in
the data at [150,512). The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next. We'd need something like:
get me [0,512) >>>
<<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK
get me [100,512) >>> (**1)
<<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.
get me [150,512) >>>
<<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.
get me [200,512) >>>
<<< no more data, return TARGET_XFER_EOF.
This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target. (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).
Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.
No target implementations to to_xfer_partial adapts this new
interface. The interface still behaves as before.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it. New. All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status. Add argument xfered_len. Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it. New. All callers
updated.
(target_read_live_memory): Likewise. Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status. Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise. Check *XFERED_LEN is set
properly. Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise. All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.
* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise. All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise. All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise. All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise. All
callers updated.
(remote_flash_erase): Likewise. All callers updated.
(remote_write_qxfer): Likewise. All callers updated.
(remote_read_qxfer): Likewise. All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.
2014-01-27 13:35:33 +01:00
|
|
|
|
*xfered_len = (ULONGEST) size;
|
|
|
|
|
return TARGET_XFER_OK;
|
2004-02-01 23:35:20 +01:00
|
|
|
|
}
|
2014-01-27 10:32:33 +01:00
|
|
|
|
return TARGET_XFER_E_IO;
|
2004-02-01 23:35:20 +01:00
|
|
|
|
|
2004-04-10 11:49:21 +02:00
|
|
|
|
case TARGET_OBJECT_WCOOKIE:
|
|
|
|
|
if (readbuf)
|
|
|
|
|
{
|
|
|
|
|
/* When the StackGhost cookie is stored in core file, BFD
|
2010-12-31 23:59:52 +01:00
|
|
|
|
represents this with a fake section called
|
|
|
|
|
".wcookie". */
|
2004-04-10 11:49:21 +02:00
|
|
|
|
|
|
|
|
|
struct bfd_section *section;
|
|
|
|
|
bfd_size_type size;
|
|
|
|
|
|
|
|
|
|
section = bfd_get_section_by_name (core_bfd, ".wcookie");
|
|
|
|
|
if (section == NULL)
|
2014-01-27 10:32:33 +01:00
|
|
|
|
return TARGET_XFER_E_IO;
|
2004-04-10 11:49:21 +02:00
|
|
|
|
|
|
|
|
|
size = bfd_section_size (core_bfd, section);
|
|
|
|
|
if (offset >= size)
|
2014-08-06 08:02:35 +02:00
|
|
|
|
return TARGET_XFER_EOF;
|
2004-04-10 11:49:21 +02:00
|
|
|
|
size -= offset;
|
|
|
|
|
if (size > len)
|
|
|
|
|
size = len;
|
Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from
LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);
to
enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN. Generally, the return status has three stats,
- TARGET_XFER_OK,
- TARGET_XFER_EOF,
- TARGET_XFER_E_XXXX,
See the comments to them in 'enum target_xfer_status'. Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF.
With this change, GDB core can handle unavailable data in a convenient
way.
The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html
Consider an object/value like this:
0 100 150 200 512
DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III
where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid). Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out. But, in this scenario, we're interested in
the data at [150,512). The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next. We'd need something like:
get me [0,512) >>>
<<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK
get me [100,512) >>> (**1)
<<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.
get me [150,512) >>>
<<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.
get me [200,512) >>>
<<< no more data, return TARGET_XFER_EOF.
This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target. (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).
Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.
No target implementations to to_xfer_partial adapts this new
interface. The interface still behaves as before.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it. New. All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status. Add argument xfered_len. Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it. New. All callers
updated.
(target_read_live_memory): Likewise. Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status. Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise. Check *XFERED_LEN is set
properly. Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise. All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.
* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise. All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise. All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise. All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise. All
callers updated.
(remote_flash_erase): Likewise. All callers updated.
(remote_write_qxfer): Likewise. All callers updated.
(remote_read_qxfer): Likewise. All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.
2014-01-27 13:35:33 +01:00
|
|
|
|
|
|
|
|
|
if (size == 0)
|
|
|
|
|
return TARGET_XFER_EOF;
|
|
|
|
|
if (!bfd_get_section_contents (core_bfd, section, readbuf,
|
|
|
|
|
(file_ptr) offset, size))
|
2004-04-10 11:49:21 +02:00
|
|
|
|
{
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
|
warning (_("Couldn't read StackGhost cookie in core file."));
|
2014-01-27 10:32:33 +01:00
|
|
|
|
return TARGET_XFER_E_IO;
|
2004-04-10 11:49:21 +02:00
|
|
|
|
}
|
|
|
|
|
|
Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from
LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);
to
enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN. Generally, the return status has three stats,
- TARGET_XFER_OK,
- TARGET_XFER_EOF,
- TARGET_XFER_E_XXXX,
See the comments to them in 'enum target_xfer_status'. Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF.
With this change, GDB core can handle unavailable data in a convenient
way.
The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html
Consider an object/value like this:
0 100 150 200 512
DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III
where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid). Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out. But, in this scenario, we're interested in
the data at [150,512). The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next. We'd need something like:
get me [0,512) >>>
<<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK
get me [100,512) >>> (**1)
<<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.
get me [150,512) >>>
<<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.
get me [200,512) >>>
<<< no more data, return TARGET_XFER_EOF.
This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target. (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).
Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.
No target implementations to to_xfer_partial adapts this new
interface. The interface still behaves as before.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it. New. All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status. Add argument xfered_len. Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it. New. All callers
updated.
(target_read_live_memory): Likewise. Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status. Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise. Check *XFERED_LEN is set
properly. Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise. All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.
* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise. All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise. All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise. All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise. All
callers updated.
(remote_flash_erase): Likewise. All callers updated.
(remote_write_qxfer): Likewise. All callers updated.
(remote_read_qxfer): Likewise. All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.
2014-01-27 13:35:33 +01:00
|
|
|
|
*xfered_len = (ULONGEST) size;
|
|
|
|
|
return TARGET_XFER_OK;
|
|
|
|
|
|
2004-04-10 11:49:21 +02:00
|
|
|
|
}
|
2014-01-27 10:32:33 +01:00
|
|
|
|
return TARGET_XFER_E_IO;
|
2004-04-10 11:49:21 +02:00
|
|
|
|
|
2007-09-04 01:06:35 +02:00
|
|
|
|
case TARGET_OBJECT_LIBRARIES:
|
|
|
|
|
if (core_gdbarch
|
|
|
|
|
&& gdbarch_core_xfer_shared_libraries_p (core_gdbarch))
|
|
|
|
|
{
|
|
|
|
|
if (writebuf)
|
2014-01-27 10:32:33 +01:00
|
|
|
|
return TARGET_XFER_E_IO;
|
Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from
LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);
to
enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN. Generally, the return status has three stats,
- TARGET_XFER_OK,
- TARGET_XFER_EOF,
- TARGET_XFER_E_XXXX,
See the comments to them in 'enum target_xfer_status'. Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF.
With this change, GDB core can handle unavailable data in a convenient
way.
The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html
Consider an object/value like this:
0 100 150 200 512
DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III
where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid). Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out. But, in this scenario, we're interested in
the data at [150,512). The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next. We'd need something like:
get me [0,512) >>>
<<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK
get me [100,512) >>> (**1)
<<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.
get me [150,512) >>>
<<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.
get me [200,512) >>>
<<< no more data, return TARGET_XFER_EOF.
This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target. (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).
Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.
No target implementations to to_xfer_partial adapts this new
interface. The interface still behaves as before.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it. New. All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status. Add argument xfered_len. Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it. New. All callers
updated.
(target_read_live_memory): Likewise. Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status. Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise. Check *XFERED_LEN is set
properly. Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise. All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.
* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise. All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise. All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise. All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise. All
callers updated.
(remote_flash_erase): Likewise. All callers updated.
(remote_write_qxfer): Likewise. All callers updated.
(remote_read_qxfer): Likewise. All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.
2014-01-27 13:35:33 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
*xfered_len = gdbarch_core_xfer_shared_libraries (core_gdbarch,
|
|
|
|
|
readbuf,
|
|
|
|
|
offset, len);
|
|
|
|
|
|
|
|
|
|
if (*xfered_len == 0)
|
|
|
|
|
return TARGET_XFER_EOF;
|
|
|
|
|
else
|
|
|
|
|
return TARGET_XFER_OK;
|
|
|
|
|
}
|
2007-09-04 01:06:35 +02:00
|
|
|
|
}
|
|
|
|
|
/* FALL THROUGH */
|
|
|
|
|
|
ppc-aix core file relocation.
The current code attempts to provide relocation support when debugging
core files via the rs6000_xfer_partial method of the rs6000-nat
target_ops vector. However, this target_ops vector does not get pushed
on the target stack at all when debugging core files, thus bypassing
completely that part of the code.
This patch fixes the problem by extending corelow's core_xfer_partial
into handling the TARGET_OBJECT_LIBRARIES_AIX object.
gdb/ChangeLog:
* gdbarch.sh (core_xfer_shared_libraries_aix): New method.
* gdbarch.h, gdbarch.c: Regenerate.
* corelow.c (core_xfer_partial): Add TARGET_OBJECT_LIBRARIES_AIX
handling.
* rs6000-aix-tdep.h: New file.
* Makefile.in (HFILES_NO_SRCDIR): Add rs6000-aix-tdep.h.
* rs6000-aix-tdep.c: Include "rs6000-aix-tdep.h" and
"xml-utils.h".
(struct field_info, struct ld_info_desc): New types.
(ld_info32_desc, ld_info64_desc): New static constants.
(struct ld_info): New type.
(rs6000_aix_extract_ld_info): New function.
(rs6000_aix_shared_library_to_xml): Likewise.
(rs6000_aix_ld_info_to_xml): Likewise.
(rs6000_aix_core_xfer_shared_libraries_aix): Likewise.
(rs6000_aix_init_osabi): Add call to
set_gdbarch_core_xfer_shared_libraries_aix.
* rs6000-nat.c: Add "rs6000-aix-tdep.h" include.
Remove "xml-utils.h" include.
(LdInfo): Delete typedef.
(ARCH64_DECL, LDI_FIELD, LDI_NEXT, LDI_FD, LDI_FILENAME):
Delete macros.
(rs6000_ptrace_ldinfo): Change return type to gdb_byte *.
Adjust code accordingly.
(rs6000_core_ldinfo): Delete, folded into
rs6000_aix_core_xfer_shared_libraries_aix.
(rs6000_xfer_shared_library): Delete.
(rs6000_xfer_shared_libraries): Reimplement.
2013-05-15 14:26:14 +02:00
|
|
|
|
case TARGET_OBJECT_LIBRARIES_AIX:
|
|
|
|
|
if (core_gdbarch
|
|
|
|
|
&& gdbarch_core_xfer_shared_libraries_aix_p (core_gdbarch))
|
|
|
|
|
{
|
|
|
|
|
if (writebuf)
|
2014-01-27 10:32:33 +01:00
|
|
|
|
return TARGET_XFER_E_IO;
|
Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from
LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);
to
enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN. Generally, the return status has three stats,
- TARGET_XFER_OK,
- TARGET_XFER_EOF,
- TARGET_XFER_E_XXXX,
See the comments to them in 'enum target_xfer_status'. Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF.
With this change, GDB core can handle unavailable data in a convenient
way.
The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html
Consider an object/value like this:
0 100 150 200 512
DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III
where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid). Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out. But, in this scenario, we're interested in
the data at [150,512). The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next. We'd need something like:
get me [0,512) >>>
<<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK
get me [100,512) >>> (**1)
<<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.
get me [150,512) >>>
<<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.
get me [200,512) >>>
<<< no more data, return TARGET_XFER_EOF.
This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target. (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).
Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.
No target implementations to to_xfer_partial adapts this new
interface. The interface still behaves as before.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it. New. All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status. Add argument xfered_len. Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it. New. All callers
updated.
(target_read_live_memory): Likewise. Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status. Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise. Check *XFERED_LEN is set
properly. Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise. All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.
* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise. All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise. All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise. All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise. All
callers updated.
(remote_flash_erase): Likewise. All callers updated.
(remote_write_qxfer): Likewise. All callers updated.
(remote_read_qxfer): Likewise. All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.
2014-01-27 13:35:33 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
*xfered_len
|
|
|
|
|
= gdbarch_core_xfer_shared_libraries_aix (core_gdbarch,
|
|
|
|
|
readbuf, offset,
|
|
|
|
|
len);
|
|
|
|
|
|
|
|
|
|
if (*xfered_len == 0)
|
|
|
|
|
return TARGET_XFER_EOF;
|
|
|
|
|
else
|
|
|
|
|
return TARGET_XFER_OK;
|
|
|
|
|
}
|
ppc-aix core file relocation.
The current code attempts to provide relocation support when debugging
core files via the rs6000_xfer_partial method of the rs6000-nat
target_ops vector. However, this target_ops vector does not get pushed
on the target stack at all when debugging core files, thus bypassing
completely that part of the code.
This patch fixes the problem by extending corelow's core_xfer_partial
into handling the TARGET_OBJECT_LIBRARIES_AIX object.
gdb/ChangeLog:
* gdbarch.sh (core_xfer_shared_libraries_aix): New method.
* gdbarch.h, gdbarch.c: Regenerate.
* corelow.c (core_xfer_partial): Add TARGET_OBJECT_LIBRARIES_AIX
handling.
* rs6000-aix-tdep.h: New file.
* Makefile.in (HFILES_NO_SRCDIR): Add rs6000-aix-tdep.h.
* rs6000-aix-tdep.c: Include "rs6000-aix-tdep.h" and
"xml-utils.h".
(struct field_info, struct ld_info_desc): New types.
(ld_info32_desc, ld_info64_desc): New static constants.
(struct ld_info): New type.
(rs6000_aix_extract_ld_info): New function.
(rs6000_aix_shared_library_to_xml): Likewise.
(rs6000_aix_ld_info_to_xml): Likewise.
(rs6000_aix_core_xfer_shared_libraries_aix): Likewise.
(rs6000_aix_init_osabi): Add call to
set_gdbarch_core_xfer_shared_libraries_aix.
* rs6000-nat.c: Add "rs6000-aix-tdep.h" include.
Remove "xml-utils.h" include.
(LdInfo): Delete typedef.
(ARCH64_DECL, LDI_FIELD, LDI_NEXT, LDI_FD, LDI_FILENAME):
Delete macros.
(rs6000_ptrace_ldinfo): Change return type to gdb_byte *.
Adjust code accordingly.
(rs6000_core_ldinfo): Delete, folded into
rs6000_aix_core_xfer_shared_libraries_aix.
(rs6000_xfer_shared_library): Delete.
(rs6000_xfer_shared_libraries): Reimplement.
2013-05-15 14:26:14 +02:00
|
|
|
|
}
|
|
|
|
|
/* FALL THROUGH */
|
|
|
|
|
|
2009-07-31 17:25:22 +02:00
|
|
|
|
case TARGET_OBJECT_SPU:
|
|
|
|
|
if (readbuf && annex)
|
|
|
|
|
{
|
|
|
|
|
/* When the SPU contexts are stored in a core file, BFD
|
2010-12-31 23:59:52 +01:00
|
|
|
|
represents this with a fake section called
|
|
|
|
|
"SPU/<annex>". */
|
2009-07-31 17:25:22 +02:00
|
|
|
|
|
|
|
|
|
struct bfd_section *section;
|
|
|
|
|
bfd_size_type size;
|
|
|
|
|
char sectionstr[100];
|
2010-05-14 01:53:32 +02:00
|
|
|
|
|
2009-07-31 17:25:22 +02:00
|
|
|
|
xsnprintf (sectionstr, sizeof sectionstr, "SPU/%s", annex);
|
|
|
|
|
|
|
|
|
|
section = bfd_get_section_by_name (core_bfd, sectionstr);
|
|
|
|
|
if (section == NULL)
|
2014-01-27 10:32:33 +01:00
|
|
|
|
return TARGET_XFER_E_IO;
|
2009-07-31 17:25:22 +02:00
|
|
|
|
|
|
|
|
|
size = bfd_section_size (core_bfd, section);
|
|
|
|
|
if (offset >= size)
|
Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from
LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);
to
enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN. Generally, the return status has three stats,
- TARGET_XFER_OK,
- TARGET_XFER_EOF,
- TARGET_XFER_E_XXXX,
See the comments to them in 'enum target_xfer_status'. Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF.
With this change, GDB core can handle unavailable data in a convenient
way.
The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html
Consider an object/value like this:
0 100 150 200 512
DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III
where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid). Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out. But, in this scenario, we're interested in
the data at [150,512). The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next. We'd need something like:
get me [0,512) >>>
<<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK
get me [100,512) >>> (**1)
<<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.
get me [150,512) >>>
<<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.
get me [200,512) >>>
<<< no more data, return TARGET_XFER_EOF.
This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target. (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).
Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.
No target implementations to to_xfer_partial adapts this new
interface. The interface still behaves as before.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it. New. All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status. Add argument xfered_len. Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it. New. All callers
updated.
(target_read_live_memory): Likewise. Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status. Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise. Check *XFERED_LEN is set
properly. Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise. All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.
* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise. All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise. All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise. All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise. All
callers updated.
(remote_flash_erase): Likewise. All callers updated.
(remote_write_qxfer): Likewise. All callers updated.
(remote_read_qxfer): Likewise. All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.
2014-01-27 13:35:33 +01:00
|
|
|
|
return TARGET_XFER_EOF;
|
2009-07-31 17:25:22 +02:00
|
|
|
|
size -= offset;
|
|
|
|
|
if (size > len)
|
|
|
|
|
size = len;
|
Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from
LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);
to
enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN. Generally, the return status has three stats,
- TARGET_XFER_OK,
- TARGET_XFER_EOF,
- TARGET_XFER_E_XXXX,
See the comments to them in 'enum target_xfer_status'. Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF.
With this change, GDB core can handle unavailable data in a convenient
way.
The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html
Consider an object/value like this:
0 100 150 200 512
DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III
where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid). Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out. But, in this scenario, we're interested in
the data at [150,512). The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next. We'd need something like:
get me [0,512) >>>
<<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK
get me [100,512) >>> (**1)
<<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.
get me [150,512) >>>
<<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.
get me [200,512) >>>
<<< no more data, return TARGET_XFER_EOF.
This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target. (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).
Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.
No target implementations to to_xfer_partial adapts this new
interface. The interface still behaves as before.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it. New. All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status. Add argument xfered_len. Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it. New. All callers
updated.
(target_read_live_memory): Likewise. Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status. Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise. Check *XFERED_LEN is set
properly. Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise. All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.
* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise. All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise. All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise. All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise. All
callers updated.
(remote_flash_erase): Likewise. All callers updated.
(remote_write_qxfer): Likewise. All callers updated.
(remote_read_qxfer): Likewise. All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.
2014-01-27 13:35:33 +01:00
|
|
|
|
|
|
|
|
|
if (size == 0)
|
|
|
|
|
return TARGET_XFER_EOF;
|
|
|
|
|
if (!bfd_get_section_contents (core_bfd, section, readbuf,
|
|
|
|
|
(file_ptr) offset, size))
|
2009-07-31 17:25:22 +02:00
|
|
|
|
{
|
|
|
|
|
warning (_("Couldn't read SPU section in core file."));
|
2014-01-27 10:32:33 +01:00
|
|
|
|
return TARGET_XFER_E_IO;
|
2009-07-31 17:25:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from
LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);
to
enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN. Generally, the return status has three stats,
- TARGET_XFER_OK,
- TARGET_XFER_EOF,
- TARGET_XFER_E_XXXX,
See the comments to them in 'enum target_xfer_status'. Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF.
With this change, GDB core can handle unavailable data in a convenient
way.
The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html
Consider an object/value like this:
0 100 150 200 512
DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III
where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid). Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out. But, in this scenario, we're interested in
the data at [150,512). The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next. We'd need something like:
get me [0,512) >>>
<<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK
get me [100,512) >>> (**1)
<<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.
get me [150,512) >>>
<<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.
get me [200,512) >>>
<<< no more data, return TARGET_XFER_EOF.
This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target. (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).
Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.
No target implementations to to_xfer_partial adapts this new
interface. The interface still behaves as before.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it. New. All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status. Add argument xfered_len. Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it. New. All callers
updated.
(target_read_live_memory): Likewise. Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status. Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise. Check *XFERED_LEN is set
properly. Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise. All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.
* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise. All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise. All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise. All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise. All
callers updated.
(remote_flash_erase): Likewise. All callers updated.
(remote_write_qxfer): Likewise. All callers updated.
(remote_read_qxfer): Likewise. All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.
2014-01-27 13:35:33 +01:00
|
|
|
|
*xfered_len = (ULONGEST) size;
|
|
|
|
|
return TARGET_XFER_OK;
|
2009-07-31 17:25:22 +02:00
|
|
|
|
}
|
|
|
|
|
else if (readbuf)
|
|
|
|
|
{
|
|
|
|
|
/* NULL annex requests list of all present spuids. */
|
|
|
|
|
struct spuid_list list;
|
2010-05-14 01:53:32 +02:00
|
|
|
|
|
2009-07-31 17:25:22 +02:00
|
|
|
|
list.buf = readbuf;
|
|
|
|
|
list.offset = offset;
|
|
|
|
|
list.len = len;
|
|
|
|
|
list.pos = 0;
|
|
|
|
|
list.written = 0;
|
|
|
|
|
bfd_map_over_sections (core_bfd, add_to_spuid_list, &list);
|
Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from
LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);
to
enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN. Generally, the return status has three stats,
- TARGET_XFER_OK,
- TARGET_XFER_EOF,
- TARGET_XFER_E_XXXX,
See the comments to them in 'enum target_xfer_status'. Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF.
With this change, GDB core can handle unavailable data in a convenient
way.
The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html
Consider an object/value like this:
0 100 150 200 512
DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III
where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid). Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out. But, in this scenario, we're interested in
the data at [150,512). The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next. We'd need something like:
get me [0,512) >>>
<<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK
get me [100,512) >>> (**1)
<<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.
get me [150,512) >>>
<<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.
get me [200,512) >>>
<<< no more data, return TARGET_XFER_EOF.
This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target. (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).
Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.
No target implementations to to_xfer_partial adapts this new
interface. The interface still behaves as before.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it. New. All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status. Add argument xfered_len. Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it. New. All callers
updated.
(target_read_live_memory): Likewise. Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status. Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise. Check *XFERED_LEN is set
properly. Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise. All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.
* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise. All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise. All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise. All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise. All
callers updated.
(remote_flash_erase): Likewise. All callers updated.
(remote_write_qxfer): Likewise. All callers updated.
(remote_read_qxfer): Likewise. All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.
2014-01-27 13:35:33 +01:00
|
|
|
|
|
|
|
|
|
if (list.written == 0)
|
|
|
|
|
return TARGET_XFER_EOF;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
*xfered_len = (ULONGEST) list.written;
|
|
|
|
|
return TARGET_XFER_OK;
|
|
|
|
|
}
|
2009-07-31 17:25:22 +02:00
|
|
|
|
}
|
2014-01-27 10:32:33 +01:00
|
|
|
|
return TARGET_XFER_E_IO;
|
2009-07-31 17:25:22 +02:00
|
|
|
|
|
2012-11-08 22:16:43 +01:00
|
|
|
|
case TARGET_OBJECT_SIGNAL_INFO:
|
|
|
|
|
if (readbuf)
|
Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from
LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);
to
enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN. Generally, the return status has three stats,
- TARGET_XFER_OK,
- TARGET_XFER_EOF,
- TARGET_XFER_E_XXXX,
See the comments to them in 'enum target_xfer_status'. Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF.
With this change, GDB core can handle unavailable data in a convenient
way.
The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html
Consider an object/value like this:
0 100 150 200 512
DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III
where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid). Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out. But, in this scenario, we're interested in
the data at [150,512). The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next. We'd need something like:
get me [0,512) >>>
<<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK
get me [100,512) >>> (**1)
<<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.
get me [150,512) >>>
<<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.
get me [200,512) >>>
<<< no more data, return TARGET_XFER_EOF.
This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target. (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).
Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.
No target implementations to to_xfer_partial adapts this new
interface. The interface still behaves as before.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it. New. All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status. Add argument xfered_len. Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it. New. All callers
updated.
(target_read_live_memory): Likewise. Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status. Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise. Check *XFERED_LEN is set
properly. Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise. All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.
* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise. All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise. All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise. All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise. All
callers updated.
(remote_flash_erase): Likewise. All callers updated.
(remote_write_qxfer): Likewise. All callers updated.
(remote_read_qxfer): Likewise. All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.
2014-01-27 13:35:33 +01:00
|
|
|
|
{
|
|
|
|
|
LONGEST l = get_core_siginfo (core_bfd, readbuf, offset, len);
|
|
|
|
|
|
|
|
|
|
if (l > 0)
|
|
|
|
|
{
|
|
|
|
|
*xfered_len = len;
|
|
|
|
|
return TARGET_XFER_OK;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-01-27 10:32:33 +01:00
|
|
|
|
return TARGET_XFER_E_IO;
|
2012-11-08 22:16:43 +01:00
|
|
|
|
|
2004-02-01 23:35:20 +01:00
|
|
|
|
default:
|
2014-07-11 16:02:03 +02:00
|
|
|
|
return ops->beneath->to_xfer_partial (ops->beneath, object,
|
|
|
|
|
annex, readbuf,
|
|
|
|
|
writebuf, offset, len,
|
|
|
|
|
xfered_len);
|
2004-02-01 23:35:20 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
/* If mourn is being called in all the right places, this could be say
|
2010-12-31 23:59:52 +01:00
|
|
|
|
`gdb internal error' (since generic_mourn calls
|
|
|
|
|
breakpoint_init_inferior). */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
static int
|
target, breakpoint: allow insert/remove breakpoint to be forwarded
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* target.h (target_ops) <to_insert_breakpoint>
<to_remove_breakpoint>: Add target_ops parameter.
(forward_target_insert_breakpoint): New.
(forward_target_remove_breakpoint): New.
(memory_remove_breakpoint, memory_insert_breakpoint):
Add target_ops parameter.
* target.c (target_insert_breakpoint): Split into this and ...
(forward_target_insert_breakpoint): ... this.
(target_remove_breakpoint): Split into this and ...
(forward_target_remove_breakpoint): ... this.
(debug_to_insert_breakpoint): Add target_ops parameter.
Call forward_target_insert_breakpoint.
(debug_to_remove_breakpoint): Add target_ops parameter.
Call forward_target_remove_breakpoint.
(update_current_target): Do not inherit or default to_insert_breakpoint
and to_remove_breakpoint.
* corelow.c (ignore): Add target_ops parameter.
* exec.c (ignore): Add target_ops parameter.
* mem-break.c (memory_insert_breakpoint, memory_remove_breakpoint):
Add target_ops parameter.
* monitor.c (monitor_insert_breakpoint, monitor_remove_breakpoint):
Add target_ops parameter.
* nto-procfs.c (procfs_insert_breakpoint, procfs_remove_breakpoint):
Add target_ops parameter.
* record-full.c (record_full_beneath_to_insert_breakpoint)
(record_full_beneath_to_remove_breakpoint, tmp_to_insert_breakpoint)
(tmp_to_remove_breakpoint, record_full_insert_breakpoint)
(record_full_remove_breakpoint, record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint): Add target_ops parameter.
Update users.
(record_full_beneath_to_insert_breakpoint_ops)
(record_full_beneath_to_remove_breakpoint_ops)
(tmp_to_insert_breakpoint_ops, tmp_to_remove_breakpoint_ops): New.
(record_full_open): Initialize tmp_to_insert_breakpoint_ops,
tmp_to_remove_breakpoint_ops,
record_full_beneath_to_insert_breakpoint_ops, and
record_full_beneath_to_remove_breakpoint_ops.
* remote-m32r-sdi.c (m32r_insert_breakpoint)
(m32r_remove_breakpoint): Add target_ops parameter.
* remote-mips.c (mips_insert_breakpoint, mips_remove_breakpoint):
Add target_ops parameter.
* remote.c (remote_insert_breakpoint, remote_remove_breakpoint):
Add target_ops parameter.
2013-12-17 10:49:03 +01:00
|
|
|
|
ignore (struct target_ops *ops, struct gdbarch *gdbarch,
|
|
|
|
|
struct bp_target_info *bp_tgt)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-11 00:03:29 +02:00
|
|
|
|
/* Implement the to_remove_breakpoint method. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
core_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
|
|
|
|
|
struct bp_target_info *bp_tgt,
|
|
|
|
|
enum remove_bp_reason reason)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
/* Okay, let's be honest: threads gleaned from a core file aren't
|
|
|
|
|
exactly lively, are they? On the other hand, if we don't claim
|
|
|
|
|
that each & every one is alive, then we don't get any of them
|
|
|
|
|
to appear in an "info thread" command, which is quite a useful
|
|
|
|
|
behaviour.
|
1999-07-07 22:19:36 +02:00
|
|
|
|
*/
|
1999-04-16 03:35:26 +02:00
|
|
|
|
static int
|
* corelow.c (get_core_registers): Adjust.
(core_file_thread_alive): Rename to...
(core_thread_alive): ... this.
(core_pid_to_str): Try gdbarch_core_pid_to_str first.
(init_core_ops): Adjust.
(coreops_suppress_target): Delete.
(_initialize_corelow): Unconditionally add core_ops.
* procfs.c: Include "inf-child.h".
(procfs_ops): Delete.
(init_procfs_ops): Delete. Reimplement as...
(procfs_target): ... this, inheriting from inf-child.
(procfs_attach, procfs_detach, procfs_fetch_registers): Adjust.
(procfs_prepare_to_store): Delete.
(procfs_store_registers, procfs_resume): Adjust.
(procfs_open): Delete.
(procfs_suppress_run): Delete.
(procfs_can_run): Delete.
(procfs_mourn_inferior): Adjust.
(procfs_init_inferior): Add target_ops parameter. Adjust.
(procfs_create_inferior): Don't pass procfs_init_inferior to
fork_inferior. Instead call it after fork_inferior returns.
(procfs_find_new_threads): Adjust.
(_initialize_procfs): Adjust to use procfs_target instead of
init_procfs_ops.
* sol-thread.c (orig_core_ops, sol_core_ops): Delete.
(lwp_to_thread): Use target_thread_alive.
(sol_thread_open): Delete.
(sol_thread_attach): Delete.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers): Adjust
to use find_target_beneath.
(sol_thread_prepare_to_store, sol_thread_xfer_memory): Delete.
(sol_thread_xfer_partial): Adjust to use find_target_beneath.
(sol_thread_files_info, sol_thread_kill_inferior): Delete.
(check_for_thread_db): New.
(sol_thread_notice_signals, sol_thread_create_inferior): Delete.
(sol_thread_new_objfile): Call check_for_thread_db.
(sol_thread_mourn_inferior): Adjust to use find_target_beneath.
(sol_thread_can_run): Delete.
(sol_thread_alive): Adjust to use find_target_beneath.
(sol_thread_stop): Delete.
(rw_common): Use target_write_memory or target_read_memory.
(ps_lgetregs, ps_lgetfpregs): Use target_fetch_registers.
(ps_lsetregs, ps_lsetfpregs): Use target_store_registers.
(solaris_pid_to_str): Remove check for libthread_db initialization
failing.
(sol_find_new_threads): Remove check for libthread_db
initialization failing, or for an invalid inferior_ptid. Adjust
to use find_target_beneath.
(sol_core_open, sol_core_close, sol_core_detach,
sol_core_files_info, sol_find_memory_regions,
sol_make_note_section, ignore): Delete.
(init_sol_thread_ops): Make it a thread_stratum target. Remove
unneeded callback settings.
(init_sol_core_ops): Delete.
(_initialize_sol_thread): No longer call init_sol_core_ops, set
procfs_suppress_run, or hack with core_ops.
* target.h (struct target_ops): Add a target_ops * parameter to
to_resume, to_fetch_registers, to_store_registers, to_thread_alive
and to_find_new_threads.
(target_fetch_registers, target_store_registers)
(target_thread_alive, target_find_new_threads): Redeclare as
function.
* target.c (update_current_target): Do not inherit or de_fault
to_resume, to_fetch_registers, to_store_registers,
to_thread_alive, to_find_new_threads.
(target_resume): Adjust.
(target_thread_alive, target_find_new_threads): New.
(debug_to_resume, debug_to_fetch_registers): Delete.
(target_fetch_registers): New.
(debug_to_store_registers): Delete.
(target_store_registers): New.
(debug_to_thread_alive, debug_to_find_new_threads): Delete.
(setup_target_debug): Adjust.
* gdbcore.h (core_ops): Delete declaration.
* inf-ptrace.c, linux-nat.c, remote.c, amd64-linux-nat.c,
inf-child.c, linux-thread-db.c, bsd-uthread.c, inf-ttrace.c,
i386-sol2-tdep.c, darwin-nat.c, gnu-nat.c, go32-nat.c,
hpux-thread.c, i386-linux-nat.c, i386fbsd-nat.c, monitor.c,
nto-procfs.c, remote-m32r-sdi.c, remote-mips.c, windows-nat.c,
alphabsd-nat.c, amd64bsd-nat.c, arm-linux-nat.c, armnbsd-nat.c,
bsd-kvm.c, hppa-hpux-nat.c, hppa-linux-nat.c, hppabsd-nat.c,
hppanbsd-nat.c, i386-darwin-nat.c, i386bsd-nat.c,
ia64-linux-nat.c, m32r-linux-nat.c, m68kbsd-nat.c,
m68klinux-nat.c, m88kbsd-nat.c, mips-linux-nat.c,
mips64obsd-nat.c, mipsnbsd-nat.c, ppc-linux-nat.c, ppcnbsd-nat.c,
ppcobsd-nat.c, remote-sim.c, rs6000-nat.c, s390-nat.c,
shnbsd-nat.c, sparc-nat.c, sparc-nat.h, spu-linux-nat.c,
vaxbsd-nat.c, xtensa-linux-nat.c: Adjust to target_ops changes.
* gdbarch.sh (core_pid_to_str): New gdbarch callback.
* gdbarch.h, gdbarch.c: Regenerate.
* sol2-tdep.c: Include "inferior.h".
(sol2_core_pid_to_str): New.
* sol2-tdep.h (sol2_core_pid_to_str): Declare.
* amd64-sol2-tdep.c (amd64_sol2_init_abi): Set it.
* sparc-sol2-tdep.c (sparc32_sol2_init_abi): Set it.
* sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Set it.
* i386-sol2-tdep.c (i386_sol2_init_abi): Set it.
2009-02-23 01:03:50 +01:00
|
|
|
|
core_thread_alive (struct target_ops *ops, ptid_t ptid)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-10 23:14:11 +02:00
|
|
|
|
/* Ask the current architecture what it knows about this core file.
|
|
|
|
|
That will be used, in turn, to pick a better architecture. This
|
|
|
|
|
wrapper could be avoided if targets got a chance to specialize
|
|
|
|
|
core_ops. */
|
|
|
|
|
|
|
|
|
|
static const struct target_desc *
|
|
|
|
|
core_read_description (struct target_ops *target)
|
|
|
|
|
{
|
2009-06-17 20:48:26 +02:00
|
|
|
|
if (core_gdbarch && gdbarch_core_read_description_p (core_gdbarch))
|
2014-01-13 17:30:30 +01:00
|
|
|
|
{
|
|
|
|
|
const struct target_desc *result;
|
|
|
|
|
|
|
|
|
|
result = gdbarch_core_read_description (core_gdbarch,
|
|
|
|
|
target, core_bfd);
|
|
|
|
|
if (result != NULL)
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2007-09-10 23:14:11 +02:00
|
|
|
|
|
2014-01-13 17:30:30 +01:00
|
|
|
|
return target->beneath->to_read_description (target->beneath);
|
2007-09-10 23:14:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2008-09-08 23:36:01 +02:00
|
|
|
|
static char *
|
* linux-nat.c (linux_nat_wait): Adjust.
(linux_nat_pid_to_str): Adjust. Remove call to thread_db_init.
* linux-nat.h (thread_db_init): Delete declaration.
* linux-thread-db.c (target_beneath): Delete.
(thread_db_init): Delete.
(thread_db_detach): Use find_target_beneath.
(thread_db_wait): Adjust interface. Use find_target_beneath.
(thread_db_mourn_inferior): Use find_target_beneath.
(thread_db_can_async_p, thread_db_is_async_p, thread_db_async)
(thread_db_async_mask): Delete.
(thread_db_pid_to_str): Adjust interface. Use
find_target_beneath.
(thread_db_get_thread_local_address): Adjust interface. Use
find_target_beneath.
(init_thread_db_ops): Delete references to delete functions.
* target.c (update_current_target): Don't inherit or default
to_wait. Don't inherit to_pid_to_str and
to_get_thread_local_address.
(target_translate_tls_address): Look for a pushed target that
implements to_get_thread_local_address, and use it instead of
checking for target_get_thread_local_address_p.
(target_wait, target_pid_to_str): Reimplement as functions.
(dummy_pid_to_str): New.
(init_dummy_target): Register it.
(debug_to_wait): Delete.
* target.h (struct target_ops): Make to_wait, to_pid_to_str and
to_get_thread_local_address accept a pointer to struct target_ops.
(target_wait): Delete macro, and declare as function.
(target_pid_to_str): Likewise.
(target_get_thread_local_address)
(target_get_thread_local_address_p): Delete.
(noprocess): Add NORETURN and ATTR_NORETURN tags.
* inf-ptrace.c (inf_ptrace_wait): Adjust.
(inf_ptrace_pid_to_str): New.
(inf_ptrace_target): Use inf_ptrace_pid_to_str.
* aix-thread.c (aix_thread_wait, aix_thread_pid_to_str): Adjust.
* bsd-kvm.c (bsd_kvm_pid_to_str): Adjust.
* bsd-uthread.c (bsd_uthread_wait, bsd_uthread_pid_to_str):
Adjust.
* corelow.c (core_pid_to_str): Adjust.
* darwin-nat.c (darwin_wait, darwin_pid_to_str): Adjust.
* dec-thread.c (dec_thread_wait, dec_thread_pid_to_str): Adjust.
* gnu-nat.c (gnu_wait, gnu_pid_to_str): Adjust.
* go32-nat.c (go32_wait, go32_pid_to_str): Adjust.
* hpux-thread.c (hpux_thread_wait): Adjust.
* inf-ttrace.c (inf_ttrace_wait, inf_ttrace_pid_to_str): Adjust.
* monitor.c (monitor_wait, monitor_pid_to_str): Adjust.
* nto-procfs.c (procfs_wait, procfs_pid_to_str): Adjust.
* procfs.c (procfs_pid_to_str): Adjust.
* remote-m32r-sdi.c (m32r_wait, m32r_pid_to_str): Adjust.
* remote-mips.c (mips_wait): Adjust.
* remote-sim.c (gdbsim_wait, gdbsim_pid_to_str): Adjust.
* remote.c (remote_wait, remote_pid_to_str)
(remote_get_thread_local_address): Adjust.
* rs6000-nat.c (rs6000_wait): Adjust.
* sol-thread.c (procfs_pid_to_str): Adjust declaration.
(sol_thread_wait, solaris_pid_to_str): Adjust.
* spu-linux-nat.c (spu_child_wait): Adjust.
* windows-nat.c (windows_wait, windows_pid_to_str): Adjust.
2009-02-06 23:21:26 +01:00
|
|
|
|
core_pid_to_str (struct target_ops *ops, ptid_t ptid)
|
2008-09-08 23:36:01 +02:00
|
|
|
|
{
|
|
|
|
|
static char buf[64];
|
2012-01-26 17:44:29 +01:00
|
|
|
|
struct inferior *inf;
|
2010-08-04 17:27:57 +02:00
|
|
|
|
int pid;
|
2008-09-08 23:36:01 +02:00
|
|
|
|
|
2010-08-04 17:27:57 +02:00
|
|
|
|
/* The preferred way is to have a gdbarch/OS specific
|
|
|
|
|
implementation. */
|
* corelow.c (get_core_registers): Adjust.
(core_file_thread_alive): Rename to...
(core_thread_alive): ... this.
(core_pid_to_str): Try gdbarch_core_pid_to_str first.
(init_core_ops): Adjust.
(coreops_suppress_target): Delete.
(_initialize_corelow): Unconditionally add core_ops.
* procfs.c: Include "inf-child.h".
(procfs_ops): Delete.
(init_procfs_ops): Delete. Reimplement as...
(procfs_target): ... this, inheriting from inf-child.
(procfs_attach, procfs_detach, procfs_fetch_registers): Adjust.
(procfs_prepare_to_store): Delete.
(procfs_store_registers, procfs_resume): Adjust.
(procfs_open): Delete.
(procfs_suppress_run): Delete.
(procfs_can_run): Delete.
(procfs_mourn_inferior): Adjust.
(procfs_init_inferior): Add target_ops parameter. Adjust.
(procfs_create_inferior): Don't pass procfs_init_inferior to
fork_inferior. Instead call it after fork_inferior returns.
(procfs_find_new_threads): Adjust.
(_initialize_procfs): Adjust to use procfs_target instead of
init_procfs_ops.
* sol-thread.c (orig_core_ops, sol_core_ops): Delete.
(lwp_to_thread): Use target_thread_alive.
(sol_thread_open): Delete.
(sol_thread_attach): Delete.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers): Adjust
to use find_target_beneath.
(sol_thread_prepare_to_store, sol_thread_xfer_memory): Delete.
(sol_thread_xfer_partial): Adjust to use find_target_beneath.
(sol_thread_files_info, sol_thread_kill_inferior): Delete.
(check_for_thread_db): New.
(sol_thread_notice_signals, sol_thread_create_inferior): Delete.
(sol_thread_new_objfile): Call check_for_thread_db.
(sol_thread_mourn_inferior): Adjust to use find_target_beneath.
(sol_thread_can_run): Delete.
(sol_thread_alive): Adjust to use find_target_beneath.
(sol_thread_stop): Delete.
(rw_common): Use target_write_memory or target_read_memory.
(ps_lgetregs, ps_lgetfpregs): Use target_fetch_registers.
(ps_lsetregs, ps_lsetfpregs): Use target_store_registers.
(solaris_pid_to_str): Remove check for libthread_db initialization
failing.
(sol_find_new_threads): Remove check for libthread_db
initialization failing, or for an invalid inferior_ptid. Adjust
to use find_target_beneath.
(sol_core_open, sol_core_close, sol_core_detach,
sol_core_files_info, sol_find_memory_regions,
sol_make_note_section, ignore): Delete.
(init_sol_thread_ops): Make it a thread_stratum target. Remove
unneeded callback settings.
(init_sol_core_ops): Delete.
(_initialize_sol_thread): No longer call init_sol_core_ops, set
procfs_suppress_run, or hack with core_ops.
* target.h (struct target_ops): Add a target_ops * parameter to
to_resume, to_fetch_registers, to_store_registers, to_thread_alive
and to_find_new_threads.
(target_fetch_registers, target_store_registers)
(target_thread_alive, target_find_new_threads): Redeclare as
function.
* target.c (update_current_target): Do not inherit or de_fault
to_resume, to_fetch_registers, to_store_registers,
to_thread_alive, to_find_new_threads.
(target_resume): Adjust.
(target_thread_alive, target_find_new_threads): New.
(debug_to_resume, debug_to_fetch_registers): Delete.
(target_fetch_registers): New.
(debug_to_store_registers): Delete.
(target_store_registers): New.
(debug_to_thread_alive, debug_to_find_new_threads): Delete.
(setup_target_debug): Adjust.
* gdbcore.h (core_ops): Delete declaration.
* inf-ptrace.c, linux-nat.c, remote.c, amd64-linux-nat.c,
inf-child.c, linux-thread-db.c, bsd-uthread.c, inf-ttrace.c,
i386-sol2-tdep.c, darwin-nat.c, gnu-nat.c, go32-nat.c,
hpux-thread.c, i386-linux-nat.c, i386fbsd-nat.c, monitor.c,
nto-procfs.c, remote-m32r-sdi.c, remote-mips.c, windows-nat.c,
alphabsd-nat.c, amd64bsd-nat.c, arm-linux-nat.c, armnbsd-nat.c,
bsd-kvm.c, hppa-hpux-nat.c, hppa-linux-nat.c, hppabsd-nat.c,
hppanbsd-nat.c, i386-darwin-nat.c, i386bsd-nat.c,
ia64-linux-nat.c, m32r-linux-nat.c, m68kbsd-nat.c,
m68klinux-nat.c, m88kbsd-nat.c, mips-linux-nat.c,
mips64obsd-nat.c, mipsnbsd-nat.c, ppc-linux-nat.c, ppcnbsd-nat.c,
ppcobsd-nat.c, remote-sim.c, rs6000-nat.c, s390-nat.c,
shnbsd-nat.c, sparc-nat.c, sparc-nat.h, spu-linux-nat.c,
vaxbsd-nat.c, xtensa-linux-nat.c: Adjust to target_ops changes.
* gdbarch.sh (core_pid_to_str): New gdbarch callback.
* gdbarch.h, gdbarch.c: Regenerate.
* sol2-tdep.c: Include "inferior.h".
(sol2_core_pid_to_str): New.
* sol2-tdep.h (sol2_core_pid_to_str): Declare.
* amd64-sol2-tdep.c (amd64_sol2_init_abi): Set it.
* sparc-sol2-tdep.c (sparc32_sol2_init_abi): Set it.
* sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Set it.
* i386-sol2-tdep.c (i386_sol2_init_abi): Set it.
2009-02-23 01:03:50 +01:00
|
|
|
|
if (core_gdbarch
|
|
|
|
|
&& gdbarch_core_pid_to_str_p (core_gdbarch))
|
2010-08-04 17:27:57 +02:00
|
|
|
|
return gdbarch_core_pid_to_str (core_gdbarch, ptid);
|
2010-05-14 01:53:32 +02:00
|
|
|
|
|
2010-08-04 17:27:57 +02:00
|
|
|
|
/* Otherwise, if we don't have one, we'll just fallback to
|
|
|
|
|
"process", with normal_pid_to_str. */
|
* corelow.c (get_core_registers): Adjust.
(core_file_thread_alive): Rename to...
(core_thread_alive): ... this.
(core_pid_to_str): Try gdbarch_core_pid_to_str first.
(init_core_ops): Adjust.
(coreops_suppress_target): Delete.
(_initialize_corelow): Unconditionally add core_ops.
* procfs.c: Include "inf-child.h".
(procfs_ops): Delete.
(init_procfs_ops): Delete. Reimplement as...
(procfs_target): ... this, inheriting from inf-child.
(procfs_attach, procfs_detach, procfs_fetch_registers): Adjust.
(procfs_prepare_to_store): Delete.
(procfs_store_registers, procfs_resume): Adjust.
(procfs_open): Delete.
(procfs_suppress_run): Delete.
(procfs_can_run): Delete.
(procfs_mourn_inferior): Adjust.
(procfs_init_inferior): Add target_ops parameter. Adjust.
(procfs_create_inferior): Don't pass procfs_init_inferior to
fork_inferior. Instead call it after fork_inferior returns.
(procfs_find_new_threads): Adjust.
(_initialize_procfs): Adjust to use procfs_target instead of
init_procfs_ops.
* sol-thread.c (orig_core_ops, sol_core_ops): Delete.
(lwp_to_thread): Use target_thread_alive.
(sol_thread_open): Delete.
(sol_thread_attach): Delete.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers): Adjust
to use find_target_beneath.
(sol_thread_prepare_to_store, sol_thread_xfer_memory): Delete.
(sol_thread_xfer_partial): Adjust to use find_target_beneath.
(sol_thread_files_info, sol_thread_kill_inferior): Delete.
(check_for_thread_db): New.
(sol_thread_notice_signals, sol_thread_create_inferior): Delete.
(sol_thread_new_objfile): Call check_for_thread_db.
(sol_thread_mourn_inferior): Adjust to use find_target_beneath.
(sol_thread_can_run): Delete.
(sol_thread_alive): Adjust to use find_target_beneath.
(sol_thread_stop): Delete.
(rw_common): Use target_write_memory or target_read_memory.
(ps_lgetregs, ps_lgetfpregs): Use target_fetch_registers.
(ps_lsetregs, ps_lsetfpregs): Use target_store_registers.
(solaris_pid_to_str): Remove check for libthread_db initialization
failing.
(sol_find_new_threads): Remove check for libthread_db
initialization failing, or for an invalid inferior_ptid. Adjust
to use find_target_beneath.
(sol_core_open, sol_core_close, sol_core_detach,
sol_core_files_info, sol_find_memory_regions,
sol_make_note_section, ignore): Delete.
(init_sol_thread_ops): Make it a thread_stratum target. Remove
unneeded callback settings.
(init_sol_core_ops): Delete.
(_initialize_sol_thread): No longer call init_sol_core_ops, set
procfs_suppress_run, or hack with core_ops.
* target.h (struct target_ops): Add a target_ops * parameter to
to_resume, to_fetch_registers, to_store_registers, to_thread_alive
and to_find_new_threads.
(target_fetch_registers, target_store_registers)
(target_thread_alive, target_find_new_threads): Redeclare as
function.
* target.c (update_current_target): Do not inherit or de_fault
to_resume, to_fetch_registers, to_store_registers,
to_thread_alive, to_find_new_threads.
(target_resume): Adjust.
(target_thread_alive, target_find_new_threads): New.
(debug_to_resume, debug_to_fetch_registers): Delete.
(target_fetch_registers): New.
(debug_to_store_registers): Delete.
(target_store_registers): New.
(debug_to_thread_alive, debug_to_find_new_threads): Delete.
(setup_target_debug): Adjust.
* gdbcore.h (core_ops): Delete declaration.
* inf-ptrace.c, linux-nat.c, remote.c, amd64-linux-nat.c,
inf-child.c, linux-thread-db.c, bsd-uthread.c, inf-ttrace.c,
i386-sol2-tdep.c, darwin-nat.c, gnu-nat.c, go32-nat.c,
hpux-thread.c, i386-linux-nat.c, i386fbsd-nat.c, monitor.c,
nto-procfs.c, remote-m32r-sdi.c, remote-mips.c, windows-nat.c,
alphabsd-nat.c, amd64bsd-nat.c, arm-linux-nat.c, armnbsd-nat.c,
bsd-kvm.c, hppa-hpux-nat.c, hppa-linux-nat.c, hppabsd-nat.c,
hppanbsd-nat.c, i386-darwin-nat.c, i386bsd-nat.c,
ia64-linux-nat.c, m32r-linux-nat.c, m68kbsd-nat.c,
m68klinux-nat.c, m88kbsd-nat.c, mips-linux-nat.c,
mips64obsd-nat.c, mipsnbsd-nat.c, ppc-linux-nat.c, ppcnbsd-nat.c,
ppcobsd-nat.c, remote-sim.c, rs6000-nat.c, s390-nat.c,
shnbsd-nat.c, sparc-nat.c, sparc-nat.h, spu-linux-nat.c,
vaxbsd-nat.c, xtensa-linux-nat.c: Adjust to target_ops changes.
* gdbarch.sh (core_pid_to_str): New gdbarch callback.
* gdbarch.h, gdbarch.c: Regenerate.
* sol2-tdep.c: Include "inferior.h".
(sol2_core_pid_to_str): New.
* sol2-tdep.h (sol2_core_pid_to_str): Declare.
* amd64-sol2-tdep.c (amd64_sol2_init_abi): Set it.
* sparc-sol2-tdep.c (sparc32_sol2_init_abi): Set it.
* sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Set it.
* i386-sol2-tdep.c (i386_sol2_init_abi): Set it.
2009-02-23 01:03:50 +01:00
|
|
|
|
|
2010-08-04 17:27:57 +02:00
|
|
|
|
/* Try the LWPID field first. */
|
|
|
|
|
pid = ptid_get_lwp (ptid);
|
|
|
|
|
if (pid != 0)
|
|
|
|
|
return normal_pid_to_str (pid_to_ptid (pid));
|
|
|
|
|
|
|
|
|
|
/* Otherwise, this isn't a "threaded" core -- use the PID field, but
|
|
|
|
|
only if it isn't a fake PID. */
|
2014-12-15 18:00:55 +01:00
|
|
|
|
inf = find_inferior_ptid (ptid);
|
2012-01-26 17:44:29 +01:00
|
|
|
|
if (inf != NULL && !inf->fake_pid_p)
|
2010-08-04 17:27:57 +02:00
|
|
|
|
return normal_pid_to_str (ptid);
|
2008-09-08 23:36:01 +02:00
|
|
|
|
|
2010-08-04 17:27:57 +02:00
|
|
|
|
/* No luck. We simply don't have a valid PID to print. */
|
|
|
|
|
xsnprintf (buf, sizeof buf, "<main task>");
|
2008-09-08 23:36:01 +02:00
|
|
|
|
return buf;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-18 18:49:23 +01:00
|
|
|
|
static const char *
|
|
|
|
|
core_thread_name (struct target_ops *self, struct thread_info *thr)
|
|
|
|
|
{
|
|
|
|
|
if (core_gdbarch
|
|
|
|
|
&& gdbarch_core_thread_name_p (core_gdbarch))
|
|
|
|
|
return gdbarch_core_thread_name (core_gdbarch, thr);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
* target.h (struct target_ops): Make to_has_all_memory,
to_has_memory, to_has_stack, to_has_registers and to_has_execution
methods instead of variables.
(target_has_all_memory_1, target_has_memory_1, target_has_stack_1)
(target_has_registers_1, target_has_execution_1): Declare
functions.
(target_has_all_memory): Rewrite to call target_has_all_memory_1.
(target_has_memory): Rewrite to call target_has_memory_1.
(target_has_stack): Rewrite to call target_has_all_stack_1.
(target_has_registers): Rewrite to call target_has_registers_1.
(target_has_execution): Rewrite to call target_has_execution_1.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Declare.
(target_mark_running, target_mark_exited): Delete declarations.
* target.c (default_child_has_all_memory,
default_child_has_memory, default_child_has_stack,
default_child_has_registers, default_child_has_execution): New.
(target_has_all_memory_1, target_has_memory_1, target_has_stack_1,
target_has_registers_1, target_has_execution_1): New.
(add_target): Default the to_has_all_memory, to_has_all_memory,
to_has_memory, to_has_stack, to_has_registers and to_has_execution
callbacks to return 0.
(update_current_target): Do not inherit to_has_all_memory,
to_has_memory, to_has_stack, to_has_registers or to_has_execution.
(target_mark_running, target_mark_exited): Delete.
(memory_xfer_partial): Adjust.
(target_read_memory, target_write_memory, target_search_memory):
Dispatch to the the top-most target, not the flattened
current_target.
(target_info): Adjust.
(init_dummy_target): Install return_zero as callback for
to_has_all_memory, to_has_memory, to_has_stack, to_has_registers,
to_has_execution.
(set_maintenance_target_async_permitted): Use have_live_inferiors
instead of target_has_execution.
* target-memory.c (target_write_memory_blocks): Dispatch memory
writes to the the top-most target, not the flattened
current_target.
* breakpoint.c (insert_breakpoints): Don't check for
target_has_execution here.
(update_global_location_list): Check if there are live inferiors
to debug instead of target_has_execution.
* infcmd.c (kill_command, detach_command): Check if there are
inferiors instead of target_has_execution.
* inferior.h (have_live_inferiors): Declare.
* inferior.c (have_live_inferiors): New.
* infrun.c (normal_stop): Don't check for target_has_execution to
finish the thread states.
* thread.c (is_thread_state, is_stopped, is_exited, is_running)
(any_running, is_executing): Remove checks for
target_has_execution.
* top.c (kill_or_detach): Don't try to kill core inferiors.
(quit_target): Don't check for target_has_execution.
* corelow.c (core_has_memory, core_has_stack, core_has_registers):
New.
(init_core_ops): Install core_has_memory, core_has_stack and
core_has_registers.
* exec.c (exec_has_memory): New.
(init_exec_ops): Install exec_has_memory.
* remote.c (remote_add_inferior): Don't call target_mark_running.
(remote_start_remote): Don't call target_mark_exited or call
target_mark_running.
(remote_open_1): Use have_inferiors instead of
target_has_execution. Don't use target_mark_exited.
(init_remote_ops): Install deafult_child_has_all_memory,
default_child_has_memory, default_child_has_stack,
default_child_has_registers, default_child_has_execution.
* bsd-kvm.c (bsd_kvm_return_one): New.
(bsd_kvm_add_target): Register bsd_kvm_return_one as
to_has_memory, to_has_stack and to_has_registers callbacks.
* remote-m32r-sdi.c (m32r_return_one): New.
(init_m32r_ops): Register it.
* inf-child.c (inf_child_target): Adjust to register
default_child_has_all_memory, default_child_has_memory,
default_child_has_stack, default_child_has_registers,
default_child_has_execution callbacks.
* gnu-nat.c (init_gnu_ops): Likewise.
* go32-nat.c (init_go32_ops): Likewise.
* hpux-thread.c (init_hpux_thread_ops): Likewise.
* monitor.c (init_base_monitor_ops): Likewise.
* nto-procfs.c (init_procfs_ops): Likewise.
* remote-mips.c (_initialize_remote_mips): Likewise.
* windows-nat.c (init_windows_ops): Likewise.
* remote-sim.c (gdbsim_create_inferior): Don't use
target_mark_running or target_mark_exited.
(gdbsim_mourn_inferior): Don't call target_mark_exited.
(init_gdbsim_ops): Adjust to register
default_child_has_all_memory, default_child_has_memory,
default_child_has_stack, default_child_has_registers,
default_child_has_execution callbacks.
* linux-nat.c (linux_nat_xfer_partial): If reading memory, and
there's no inferior selected, defer to a lower stratum.
2009-06-07 18:46:48 +02:00
|
|
|
|
static int
|
|
|
|
|
core_has_memory (struct target_ops *ops)
|
|
|
|
|
{
|
|
|
|
|
return (core_bfd != NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
core_has_stack (struct target_ops *ops)
|
|
|
|
|
{
|
|
|
|
|
return (core_bfd != NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
core_has_registers (struct target_ops *ops)
|
|
|
|
|
{
|
|
|
|
|
return (core_bfd != NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-14 16:30:38 +01:00
|
|
|
|
/* Implement the to_info_proc method. */
|
|
|
|
|
|
|
|
|
|
static void
|
2014-06-06 21:38:16 +02:00
|
|
|
|
core_info_proc (struct target_ops *ops, const char *args,
|
|
|
|
|
enum info_proc_what request)
|
2012-12-14 16:30:38 +01:00
|
|
|
|
{
|
|
|
|
|
struct gdbarch *gdbarch = get_current_arch ();
|
|
|
|
|
|
|
|
|
|
/* Since this is the core file target, call the 'core_info_proc'
|
|
|
|
|
method on gdbarch, not 'info_proc'. */
|
|
|
|
|
if (gdbarch_core_info_proc_p (gdbarch))
|
|
|
|
|
gdbarch_core_info_proc (gdbarch, args, request);
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
|
/* Fill in core_ops with its defined operations and properties. */
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 03:48:28 +02:00
|
|
|
|
init_core_ops (void)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
core_ops.to_shortname = "core";
|
|
|
|
|
core_ops.to_longname = "Local core dump file";
|
|
|
|
|
core_ops.to_doc =
|
|
|
|
|
"Use a core file as a target. Specify the filename of the core file.";
|
|
|
|
|
core_ops.to_open = core_open;
|
|
|
|
|
core_ops.to_close = core_close;
|
|
|
|
|
core_ops.to_detach = core_detach;
|
|
|
|
|
core_ops.to_fetch_registers = get_core_registers;
|
2004-02-01 23:35:20 +01:00
|
|
|
|
core_ops.to_xfer_partial = core_xfer_partial;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
core_ops.to_files_info = core_files_info;
|
|
|
|
|
core_ops.to_insert_breakpoint = ignore;
|
2016-08-11 00:03:29 +02:00
|
|
|
|
core_ops.to_remove_breakpoint = core_remove_breakpoint;
|
* corelow.c (get_core_registers): Adjust.
(core_file_thread_alive): Rename to...
(core_thread_alive): ... this.
(core_pid_to_str): Try gdbarch_core_pid_to_str first.
(init_core_ops): Adjust.
(coreops_suppress_target): Delete.
(_initialize_corelow): Unconditionally add core_ops.
* procfs.c: Include "inf-child.h".
(procfs_ops): Delete.
(init_procfs_ops): Delete. Reimplement as...
(procfs_target): ... this, inheriting from inf-child.
(procfs_attach, procfs_detach, procfs_fetch_registers): Adjust.
(procfs_prepare_to_store): Delete.
(procfs_store_registers, procfs_resume): Adjust.
(procfs_open): Delete.
(procfs_suppress_run): Delete.
(procfs_can_run): Delete.
(procfs_mourn_inferior): Adjust.
(procfs_init_inferior): Add target_ops parameter. Adjust.
(procfs_create_inferior): Don't pass procfs_init_inferior to
fork_inferior. Instead call it after fork_inferior returns.
(procfs_find_new_threads): Adjust.
(_initialize_procfs): Adjust to use procfs_target instead of
init_procfs_ops.
* sol-thread.c (orig_core_ops, sol_core_ops): Delete.
(lwp_to_thread): Use target_thread_alive.
(sol_thread_open): Delete.
(sol_thread_attach): Delete.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers): Adjust
to use find_target_beneath.
(sol_thread_prepare_to_store, sol_thread_xfer_memory): Delete.
(sol_thread_xfer_partial): Adjust to use find_target_beneath.
(sol_thread_files_info, sol_thread_kill_inferior): Delete.
(check_for_thread_db): New.
(sol_thread_notice_signals, sol_thread_create_inferior): Delete.
(sol_thread_new_objfile): Call check_for_thread_db.
(sol_thread_mourn_inferior): Adjust to use find_target_beneath.
(sol_thread_can_run): Delete.
(sol_thread_alive): Adjust to use find_target_beneath.
(sol_thread_stop): Delete.
(rw_common): Use target_write_memory or target_read_memory.
(ps_lgetregs, ps_lgetfpregs): Use target_fetch_registers.
(ps_lsetregs, ps_lsetfpregs): Use target_store_registers.
(solaris_pid_to_str): Remove check for libthread_db initialization
failing.
(sol_find_new_threads): Remove check for libthread_db
initialization failing, or for an invalid inferior_ptid. Adjust
to use find_target_beneath.
(sol_core_open, sol_core_close, sol_core_detach,
sol_core_files_info, sol_find_memory_regions,
sol_make_note_section, ignore): Delete.
(init_sol_thread_ops): Make it a thread_stratum target. Remove
unneeded callback settings.
(init_sol_core_ops): Delete.
(_initialize_sol_thread): No longer call init_sol_core_ops, set
procfs_suppress_run, or hack with core_ops.
* target.h (struct target_ops): Add a target_ops * parameter to
to_resume, to_fetch_registers, to_store_registers, to_thread_alive
and to_find_new_threads.
(target_fetch_registers, target_store_registers)
(target_thread_alive, target_find_new_threads): Redeclare as
function.
* target.c (update_current_target): Do not inherit or de_fault
to_resume, to_fetch_registers, to_store_registers,
to_thread_alive, to_find_new_threads.
(target_resume): Adjust.
(target_thread_alive, target_find_new_threads): New.
(debug_to_resume, debug_to_fetch_registers): Delete.
(target_fetch_registers): New.
(debug_to_store_registers): Delete.
(target_store_registers): New.
(debug_to_thread_alive, debug_to_find_new_threads): Delete.
(setup_target_debug): Adjust.
* gdbcore.h (core_ops): Delete declaration.
* inf-ptrace.c, linux-nat.c, remote.c, amd64-linux-nat.c,
inf-child.c, linux-thread-db.c, bsd-uthread.c, inf-ttrace.c,
i386-sol2-tdep.c, darwin-nat.c, gnu-nat.c, go32-nat.c,
hpux-thread.c, i386-linux-nat.c, i386fbsd-nat.c, monitor.c,
nto-procfs.c, remote-m32r-sdi.c, remote-mips.c, windows-nat.c,
alphabsd-nat.c, amd64bsd-nat.c, arm-linux-nat.c, armnbsd-nat.c,
bsd-kvm.c, hppa-hpux-nat.c, hppa-linux-nat.c, hppabsd-nat.c,
hppanbsd-nat.c, i386-darwin-nat.c, i386bsd-nat.c,
ia64-linux-nat.c, m32r-linux-nat.c, m68kbsd-nat.c,
m68klinux-nat.c, m88kbsd-nat.c, mips-linux-nat.c,
mips64obsd-nat.c, mipsnbsd-nat.c, ppc-linux-nat.c, ppcnbsd-nat.c,
ppcobsd-nat.c, remote-sim.c, rs6000-nat.c, s390-nat.c,
shnbsd-nat.c, sparc-nat.c, sparc-nat.h, spu-linux-nat.c,
vaxbsd-nat.c, xtensa-linux-nat.c: Adjust to target_ops changes.
* gdbarch.sh (core_pid_to_str): New gdbarch callback.
* gdbarch.h, gdbarch.c: Regenerate.
* sol2-tdep.c: Include "inferior.h".
(sol2_core_pid_to_str): New.
* sol2-tdep.h (sol2_core_pid_to_str): Declare.
* amd64-sol2-tdep.c (amd64_sol2_init_abi): Set it.
* sparc-sol2-tdep.c (sparc32_sol2_init_abi): Set it.
* sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Set it.
* i386-sol2-tdep.c (i386_sol2_init_abi): Set it.
2009-02-23 01:03:50 +01:00
|
|
|
|
core_ops.to_thread_alive = core_thread_alive;
|
2007-09-10 23:14:11 +02:00
|
|
|
|
core_ops.to_read_description = core_read_description;
|
2008-09-08 23:36:01 +02:00
|
|
|
|
core_ops.to_pid_to_str = core_pid_to_str;
|
2016-01-18 18:49:23 +01:00
|
|
|
|
core_ops.to_thread_name = core_thread_name;
|
2010-07-19 19:51:25 +02:00
|
|
|
|
core_ops.to_stratum = process_stratum;
|
* target.h (struct target_ops): Make to_has_all_memory,
to_has_memory, to_has_stack, to_has_registers and to_has_execution
methods instead of variables.
(target_has_all_memory_1, target_has_memory_1, target_has_stack_1)
(target_has_registers_1, target_has_execution_1): Declare
functions.
(target_has_all_memory): Rewrite to call target_has_all_memory_1.
(target_has_memory): Rewrite to call target_has_memory_1.
(target_has_stack): Rewrite to call target_has_all_stack_1.
(target_has_registers): Rewrite to call target_has_registers_1.
(target_has_execution): Rewrite to call target_has_execution_1.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Declare.
(target_mark_running, target_mark_exited): Delete declarations.
* target.c (default_child_has_all_memory,
default_child_has_memory, default_child_has_stack,
default_child_has_registers, default_child_has_execution): New.
(target_has_all_memory_1, target_has_memory_1, target_has_stack_1,
target_has_registers_1, target_has_execution_1): New.
(add_target): Default the to_has_all_memory, to_has_all_memory,
to_has_memory, to_has_stack, to_has_registers and to_has_execution
callbacks to return 0.
(update_current_target): Do not inherit to_has_all_memory,
to_has_memory, to_has_stack, to_has_registers or to_has_execution.
(target_mark_running, target_mark_exited): Delete.
(memory_xfer_partial): Adjust.
(target_read_memory, target_write_memory, target_search_memory):
Dispatch to the the top-most target, not the flattened
current_target.
(target_info): Adjust.
(init_dummy_target): Install return_zero as callback for
to_has_all_memory, to_has_memory, to_has_stack, to_has_registers,
to_has_execution.
(set_maintenance_target_async_permitted): Use have_live_inferiors
instead of target_has_execution.
* target-memory.c (target_write_memory_blocks): Dispatch memory
writes to the the top-most target, not the flattened
current_target.
* breakpoint.c (insert_breakpoints): Don't check for
target_has_execution here.
(update_global_location_list): Check if there are live inferiors
to debug instead of target_has_execution.
* infcmd.c (kill_command, detach_command): Check if there are
inferiors instead of target_has_execution.
* inferior.h (have_live_inferiors): Declare.
* inferior.c (have_live_inferiors): New.
* infrun.c (normal_stop): Don't check for target_has_execution to
finish the thread states.
* thread.c (is_thread_state, is_stopped, is_exited, is_running)
(any_running, is_executing): Remove checks for
target_has_execution.
* top.c (kill_or_detach): Don't try to kill core inferiors.
(quit_target): Don't check for target_has_execution.
* corelow.c (core_has_memory, core_has_stack, core_has_registers):
New.
(init_core_ops): Install core_has_memory, core_has_stack and
core_has_registers.
* exec.c (exec_has_memory): New.
(init_exec_ops): Install exec_has_memory.
* remote.c (remote_add_inferior): Don't call target_mark_running.
(remote_start_remote): Don't call target_mark_exited or call
target_mark_running.
(remote_open_1): Use have_inferiors instead of
target_has_execution. Don't use target_mark_exited.
(init_remote_ops): Install deafult_child_has_all_memory,
default_child_has_memory, default_child_has_stack,
default_child_has_registers, default_child_has_execution.
* bsd-kvm.c (bsd_kvm_return_one): New.
(bsd_kvm_add_target): Register bsd_kvm_return_one as
to_has_memory, to_has_stack and to_has_registers callbacks.
* remote-m32r-sdi.c (m32r_return_one): New.
(init_m32r_ops): Register it.
* inf-child.c (inf_child_target): Adjust to register
default_child_has_all_memory, default_child_has_memory,
default_child_has_stack, default_child_has_registers,
default_child_has_execution callbacks.
* gnu-nat.c (init_gnu_ops): Likewise.
* go32-nat.c (init_go32_ops): Likewise.
* hpux-thread.c (init_hpux_thread_ops): Likewise.
* monitor.c (init_base_monitor_ops): Likewise.
* nto-procfs.c (init_procfs_ops): Likewise.
* remote-mips.c (_initialize_remote_mips): Likewise.
* windows-nat.c (init_windows_ops): Likewise.
* remote-sim.c (gdbsim_create_inferior): Don't use
target_mark_running or target_mark_exited.
(gdbsim_mourn_inferior): Don't call target_mark_exited.
(init_gdbsim_ops): Adjust to register
default_child_has_all_memory, default_child_has_memory,
default_child_has_stack, default_child_has_registers,
default_child_has_execution callbacks.
* linux-nat.c (linux_nat_xfer_partial): If reading memory, and
there's no inferior selected, defer to a lower stratum.
2009-06-07 18:46:48 +02:00
|
|
|
|
core_ops.to_has_memory = core_has_memory;
|
|
|
|
|
core_ops.to_has_stack = core_has_stack;
|
|
|
|
|
core_ops.to_has_registers = core_has_registers;
|
2012-12-14 16:30:38 +01:00
|
|
|
|
core_ops.to_info_proc = core_info_proc;
|
1999-07-07 22:19:36 +02:00
|
|
|
|
core_ops.to_magic = OPS_MAGIC;
|
2010-07-19 19:51:25 +02:00
|
|
|
|
|
|
|
|
|
if (core_target)
|
|
|
|
|
internal_error (__FILE__, __LINE__,
|
|
|
|
|
_("init_core_ops: core target already exists (\"%s\")."),
|
|
|
|
|
core_target->to_longname);
|
|
|
|
|
core_target = &core_ops;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
|
_initialize_corelow (void)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
init_core_ops ();
|
|
|
|
|
|
2013-03-29 16:21:23 +01:00
|
|
|
|
add_target_with_completer (&core_ops, filename_completer);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
}
|