2006-01-04 20:34:58 +01:00
|
|
|
/* GNU/Linux native-dependent code for debugging multiple forks.
|
|
|
|
|
2012-01-04 09:17:56 +01:00
|
|
|
Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
2006-01-04 20:34:58 +01:00
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-08-23 20:08:50 +02:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2006-01-04 20:34:58 +01:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-23 20:08:50 +02:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2006-01-04 20:34:58 +01:00
|
|
|
|
|
|
|
#include "defs.h"
|
* defs.h (strlen_paddr, paddr, paddr_nz): Remove.
(paddress): Add GDBARCH parameter.
* utils.c (strlen_paddr, paddr, paddr_nz): Remove.
(paddress): Add GDBARCH parameter, use it instead of current_gdbarch.
* ui-out.h (ui_out_field_core_addr): Add GDBARCH parameter.
* ui-out.c (ui_out_field_core_addr): Add GDBARCH parameter,
use it instead of current_gdbarch.
Update calls to ui_out_field_core_addr to pass architecture:
* ada-lang.c (print_one_exception): Update.
* breakpoint.c (print_one_breakpoint_location,
print_one_exception_catchpoint): Update.
* disasm.c (dump_insns): Update.
* darwin-nat-info.c (darwin_debug_regions_recurse): Update.
* mi/mi-main.c (mi_cmd_data_read_memory): Update.
* mi/mi-symbol-cmds.c: Include "objfiles.h".
(mi_cmd_symbol_list_lines): Update.
* stack.c (print_frame_info, print_frame): Update.
Update callers of paddress to pass architecture:
* ada-tasks.c (info_task): Update.
* ada-valprint.c (ada_val_print_1): Update.
* annotate.c (annotate_source, annotate_frame_begin): Update.
* breakpoint.c (insert_bp_location, describe_other_breakpoints,
mention): Update.
* cli/cli-cmds.c (edit_command, list_command, print_disassembly):
Update.
* corefile.c (memory_error): Update.
* c-valprint.c (print_function_pointer_address, c_val_print): Update.
* disasm.c (dis_asm_print_address): Update.
* exec.c (print_section_info): Update.
* f-valprint.c (f_val_print): Update.
* infcmd.c: Include "arch-utils.h".
(jump_command, program_info): Update.
* linux-fork.c: Include "arch-utils.h".
(info_forks_command): Update.
* m2-valprint.c (print_function_pointer_address,
print_unpacked_pointer, print_variable_at_address,
m2_val_print): Update.
* m32r-rom.c (m32r_load_section, m32r_load, m32r_upload_command):
Update.
* printcmd.c (print_address, print_address_demangle, address_info):
Update.
* p-valprint.c (pascal_val_print): Update.
* source.c: Include "arch-utils.h".
(line_info): Update.
* stack.c (frame_info, print_block_frame_labels): Update.
* symfile.c (add_symbol_file_command, list_overlays_command): Update.
* symmisc.c (dump_msymbols, dump_psymtab, dump_symtab_1,
print_symbol, print_partial_symbols, maintenance_info_psymtabs,
maintenance_check_symtabs): Update.
* symtab.c (find_pc_sect_symtab): Update.
* target.c (deprecated_debug_xfer_memory): Update.
* tracepoint.c (scope_info): Update.
* tui/tui-stack.c (tui_make_status_line): Update.
* valprint.c (val_print_string): Update.
Update callers of paddr_nz to use paddress instead (keeping
user-visible output identical):
* alpha-tdep.c (alpha_heuristic_proc_start): Update.
* amd64-tdep.c (fixup_riprel, amd64_displaced_step_copy_insn,
amd64_displaced_step_fixup): Update.
* arch-utils.c (simple_displaced_step_copy_insn): Update.
* auxv.c (fprint_target_auxv): Update.
* breakpoint.c (insert_single_step_breakpoint): Update.
* buildsym.c (finish_block): Update.
* cli/cli-dump.c (restore_section_callback): Update.
* fbsd-nat.c (fbsd_find_memory_regions): Update.
* frame.c (frame_unwind_register_value): Update.
* gcore.c (gcore_create_callback): Update.
* hppa-tdep.c (hppa_frame_cache, hppa_skip_trampoline_code): Update.
* i386-tdep.c (i386_displaced_step_fixup, i386_record_modrm,
i386_record_lea_modrm_addr, i386_record_lea_modrm,
i386_process_record): Update.
* ia64-tdep.c (ia64_frame_this_id, ia64_sigtramp_frame_this_id,
ia64_libunwind_frame_this_id, ia64_libunwind_sigtramp_frame_this_id,
ia64_dummy_id, ia64_access_reg, ia64_access_rse_reg): Update.
* infrun.c (displaced_step_prepare, displaced_step_fixup,
handle_inferior_event, insert_step_resume_breakpoint_at_sal,
insert_longjmp_resume_breakpoint): Update.
* linux-nat.c (linux_nat_find_memory_regions): Update.
* linux-record.c (record_linux_system_call): Update.
* mips-tdep.c (heuristic_proc_start, mips_eabi_push_dummy_call,
mips_n32n64_push_dummy_call, mips_o32_push_dummy_call,
mips_o64_push_dummy_call): Update.
* monitor.c (monitor_error, monitor_remove_breakpoint): Update.
* record.c (record_arch_list_add_mem, record_wait,
record_xfer_partial): Update.
* remote-mips.c (mips_fetch_word, mips_check_lsi_error,
mips_common_breakpoint): Update.
* remote-sim.c (gdbsim_xfer_inferior_memory): Update.
* rs6000-tdep.c (ppc_displaced_step_fixup): Update.
* solib-som.c (som_current_sos): Update.
* symfile.c (load_progress, generic_load): Update.
* symfile-mem.c (add_vsyscall_page): Update.
* valops.c (value_fetch_lazy): Update.
* windows-tdep.c (windows_xfer_shared_library): Update.
Update callers of paddr_nz to use paddress instead (changing
user-visible output to make it more correct):
* dwarf2loc.c (locexpr_describe_location): Update.
* ia64-tdep.c (ia64_memory_insert_breakpoint,
ia64_memory_remove_breakpoint): Update.
* jv-valprint.c (java_value_print): Update.
* m32c-tdep.c (m32c_m16c_address_to_pointer): Update.
* monitor.c (monitor_read_memory): Update.
Update callers of paddr to use paddress instead (changing
user-visible output to make it more correct):
* arm-tdep.c (arm_push_dummy_call): Update.
* breakpoint.c (insert_bp_location, create_thread_event_breakpoint,
create_breakpoint): Update.
* darwin-nat-info.c (darwin_debug_regions): Update.
* dcache.c (dcache_info): Update.
* dsrec.c (load_srec, make_srec): Update.
* dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program,
dwarf2_frame_cache): Update.
* gcore.c (gcore_copy_callback): Update.
* gnu-nat.c (gnu_xfer_memory): Update.
* mips-linux-nat.c (mips_show_dr): Update.
* monitor.c (monitor_write_memory, monitor_insert_breakpoint,
monitor_remove_breakpoint): Update.
* remote.c (compare_sections_command): Update.
* remote-m32r-sdi.c (m32r_xfer_memory, m32r_insert_breakpoint,
m32r_remove_breakpoint, m32r_insert_watchpoint,
m32r_remove_watchpoint): Update.
* sol-thread.c (info_cb): Update.
* symfile.c (load_progress): Update.
Update callers of paddress or paddr_nz to use hex_string instead
(changes output of internal/error/debug messages only):
* dwarf2read.c (dump_die_shallow): Update.
* frame.c (fprint_field, fprint_frame, frame_pc_unwind,
get_frame_func, create_new_frame): Update.
* hppa-tdep.c (find_unwind_entry, unwind_command): Update.
* ia64-tdep.c (get_kernel_table, ia64_find_proc_info_x,
ia64_get_dyn_info_list): Update.
* maint.c (maintenance_translate_address): Update.
* mi/mi-cmd-var.c (mi_cmd_var_create): Update.
* target.c (target_flash_erase): Update.
Update callers of paddr/paddr_nz to use phex/phex_nz instead,
using an appropriate address size. Remove use of strlen_paddr.
* exec.c (exec_files_info): Update.
* i386-nat.c (i386_show_dr): Update.
* remote.c (remote_flash_erase): Update.
* m32r-rom.c (m32r_load_section): Update.
* monitor.c (monitor_vsprintf, monitor_store_register): Update.
* remote.c (remote_check_symbols, remote_search_memory): Update.
* remote-mips.c (mips_request, mips_common_breakpoint): Update.
* scm-valprint.c (scm_ipruk, scm_scmval_print): Update.
* sh64-tdep.c (sh64_show_media_regs, sh64_show_compact_regs): Update.
* sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs,
sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs,
sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs,
sh_dsp_show_regs): Update.
* xcoffsolib.c (sharedlibrary_command): Update.
* maint.c (maint_print_section_info): Add ADDR_SIZE parameter.
Use hex_string_custom instead of paddr.
(print_bfd_section_info): Pass address size.
(print_objfile_section_info): Likewise.
* annotate.h (annotate_source): Add GDBARCH parameter.
(annotate_frame_begin): Likewise.
* annotate.c (annotate_source): Add GDBARCH parameter.
(annotate_frame_begin): Likewise.
* source.c (identify_source_line): Update call to annotate_source.
* stack.c (print_frame_info, print_frame): Update call to
annotate_frame_begin.
* breakpoint.c (describe_other_breakpoints): Add GDBARCH parameter.
(create_breakpoint, create_ada_exception_breakpoint): Update call.
* stack.c (print_block_frame_labels): Add GDBARCH parameter.
(print_frame_label_vars): Update call.
* symmisc.c (print_partial_symbols): Add GDBARCH parameter.
(dump_psymtab): Update call to print_partial_symbols.
(struct print_symbol_args): Add GDBARCH member.
(dump_symtab_1): Set print_symbol_args architecture member.
(print_symbol): Use it.
* windows-tdep.h (windows_xfer_shared_library): Add GDBARCH
parameter.
* windows-tdep.c (windows_xfer_shared_library): Likewise.
* i386-cygwin-tdep.c (struct cpms_data): Add GDBARCH member.
(core_process_module_section): Pass architecture from cpms_data to
windows_xfer_shared_library.
(windows_core_xfer_shared_libraries): Initialize cmps_data
architecture member.
* windows-nat.c (windows_xfer_shared_libraries): Pass architecture
to windows_xfer_shared_library.
* defs.h (print_address): Add GDBARCH parameter.
* printcmd.c (print_address): Add GDBARCH parameter.
(print_scalar_formatted, do_examine): Update call.
* findcmd.c (find_command): Update call.
* tracepoint.c: Include "arch-utils.h".
(trace_find_line_command): Update call.
* tui/tui-disasm.c (tui_disassemble): Update call.
* value.h (print_address_demangle): Add GDBARCH parameter.
* printcmd.c (print_address_demangle): Add GDBARCH parameter.
* c-valprint.c (print_function_pointer_address, c_val_print):
Update call.
* f-valprint.c (f_val_print): Update call.
* gnu-v3-abi.c (gnuv3_print_method_ptr): Update call.
* jv-valprint.c (java_val_print): Update call.
* m2-valprint.c (print_function_pointer_address, m2_val_print):
Update call.
* p-valprint.c (pascal_val_print): Update call.
* disasm.c (gdb_disassemble_info): Install architecture into
di.application_data field.
testsuite/ChangeLog:
* gdb.threads/tls-shared.exp: Update to locexpr_describe_location
change to prefix TLS offset in hex with 0x.
doc/ChangeLog:
* gdbint.texinfo (Item Output Functions): Update signature
for ui_out_field_core_addr.
2009-07-02 19:21:10 +02:00
|
|
|
#include "arch-utils.h"
|
2006-01-04 20:34:58 +01:00
|
|
|
#include "inferior.h"
|
|
|
|
#include "regcache.h"
|
|
|
|
#include "gdbcmd.h"
|
|
|
|
#include "infcall.h"
|
2008-09-11 16:27:34 +02:00
|
|
|
#include "objfiles.h"
|
2006-03-24 23:44:05 +01:00
|
|
|
#include "gdb_assert.h"
|
2006-01-04 20:34:58 +01:00
|
|
|
#include "gdb_string.h"
|
|
|
|
#include "linux-fork.h"
|
* linux-nat.c (linux_ops_saved): New.
(super_mourn_inferior, kill_inferior, threaded, linux_nat_ops)
(child_mourn_inferior, child_wait, linux_nat_create_inferior)
(linux_nat_fetch_registers, linux_nat_store_registers)
(linux_nat_child_post_startup_inferior, init_linux_nat_ops): Delete.
(init_lwp_list): Don't set threaded.
(add_lwp): Don't modify threaded.
(delete_lwp): Don't mention non-threaded mode.
(linux_nat_switch_fork): New.
(linux_nat_attach): Update inferior_ptid.
(linux_nat_wait): Handle num_lwps == 0 at entry. Don't check
threaded flag.
(linux_nat_kill): Handle pending forks and saved forks.
(linux_nat_mourn_inferior): Handle saved forks.
(linux_nat_pid_to_str): Don't use the LWP form when there is
only one thread.
(linux_target): Don't set to_wait, to_kill, or to_mourn_inferior.
(linux_nat_add_target): New.
(_initialize_linux_nat): Don't initialize the linux native target
here.
* linux-nat.h (linux_nat_add_target, linux_nat_switch_fork): New
prototypes.
* linux-fork.c: Include "linux-nat.h".
(add_fork): Update initial PID.
(fork_load_infrun_state): Call linux_nat_switch_fork.
* Makefile.in (linux-fork.o): Update.
* alpha-linux-nat.c (_initialize_alpha_linux_nat): Use
linux_nat_add_target instead of add_target.
* amd64-linux-nat.c (_initialize_amd64_linux_nat): Likewise.
* arm-linux-nat.c (_initialize_arm_linux_nat): Likewise.
* hppa-linux-nat.c (_initialize_hppa_linux_nat): Likewise.
* ia64-linux-nat.c (_initialize_ia64_linux_nat): Likewise.
* i386-linux-nat.c (_initialize_i386_linux_nat): Likewise.
* m32r-linux-nat.c (_initialize_m32r_linux_nat): Likewise.
* m68klinux-nat.c (_initialize_m68k_linux_nat): Likewise.
* mips-linux-nat.c (_initialize_mips_linux_nat): Likewise.
* ppc-linux-nat.c (_initialize_ppc_linux_nat): Likewise.
* s390-nat.c (_initialize_s390_nat): Likewise.
* sparc-linux-nat.c (_initialize_sparc_linux_nat): Likewise.
* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Likewise.
2006-03-25 00:08:16 +01:00
|
|
|
#include "linux-nat.h"
|
2010-05-14 08:38:44 +02:00
|
|
|
#include "gdbthread.h"
|
2006-01-04 20:34:58 +01:00
|
|
|
|
|
|
|
#include <sys/ptrace.h>
|
2007-10-08 16:40:42 +02:00
|
|
|
#include "gdb_wait.h"
|
2006-01-04 20:34:58 +01:00
|
|
|
#include <sys/param.h>
|
2007-10-08 17:09:04 +02:00
|
|
|
#include "gdb_dirent.h"
|
2006-01-04 20:34:58 +01:00
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
struct fork_info *fork_list;
|
|
|
|
static int highest_fork_num;
|
|
|
|
|
|
|
|
/* Prevent warning from -Wmissing-prototypes. */
|
|
|
|
extern void _initialize_linux_fork (void);
|
|
|
|
|
|
|
|
/* Fork list data structure: */
|
|
|
|
struct fork_info
|
|
|
|
{
|
|
|
|
struct fork_info *next;
|
|
|
|
ptid_t ptid;
|
2010-05-14 08:38:44 +02:00
|
|
|
ptid_t parent_ptid;
|
2011-01-09 04:08:57 +01:00
|
|
|
int num; /* Convenient handle (GDB fork id). */
|
2009-07-03 00:24:07 +02:00
|
|
|
struct regcache *savedregs; /* Convenient for info fork, saves
|
2006-01-04 20:34:58 +01:00
|
|
|
having to actually switch contexts. */
|
|
|
|
int clobber_regs; /* True if we should restore saved regs. */
|
|
|
|
off_t *filepos; /* Set of open file descriptors' offsets. */
|
|
|
|
int maxfd;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Fork list methods: */
|
|
|
|
|
2009-07-03 00:24:07 +02:00
|
|
|
int
|
2006-01-04 20:34:58 +01:00
|
|
|
forks_exist_p (void)
|
|
|
|
{
|
|
|
|
return (fork_list != NULL);
|
|
|
|
}
|
|
|
|
|
2009-07-03 00:24:07 +02:00
|
|
|
/* Add a fork to the internal fork list. */
|
2006-01-04 20:34:58 +01:00
|
|
|
|
2009-07-03 00:24:07 +02:00
|
|
|
struct fork_info *
|
2006-01-04 20:34:58 +01:00
|
|
|
add_fork (pid_t pid)
|
|
|
|
{
|
|
|
|
struct fork_info *fp;
|
|
|
|
|
2006-03-10 21:15:42 +01:00
|
|
|
if (fork_list == NULL && pid != PIDGET (inferior_ptid))
|
2006-01-04 20:34:58 +01:00
|
|
|
{
|
|
|
|
/* Special case -- if this is the first fork in the list
|
|
|
|
(the list is hitherto empty), and if this new fork is
|
|
|
|
NOT the current inferior_ptid, then add inferior_ptid
|
|
|
|
first, as a special zeroeth fork id. */
|
|
|
|
highest_fork_num = -1;
|
|
|
|
add_fork (PIDGET (inferior_ptid)); /* safe recursion */
|
|
|
|
}
|
|
|
|
|
|
|
|
fp = XZALLOC (struct fork_info);
|
* linux-nat.c (linux_ops_saved): New.
(super_mourn_inferior, kill_inferior, threaded, linux_nat_ops)
(child_mourn_inferior, child_wait, linux_nat_create_inferior)
(linux_nat_fetch_registers, linux_nat_store_registers)
(linux_nat_child_post_startup_inferior, init_linux_nat_ops): Delete.
(init_lwp_list): Don't set threaded.
(add_lwp): Don't modify threaded.
(delete_lwp): Don't mention non-threaded mode.
(linux_nat_switch_fork): New.
(linux_nat_attach): Update inferior_ptid.
(linux_nat_wait): Handle num_lwps == 0 at entry. Don't check
threaded flag.
(linux_nat_kill): Handle pending forks and saved forks.
(linux_nat_mourn_inferior): Handle saved forks.
(linux_nat_pid_to_str): Don't use the LWP form when there is
only one thread.
(linux_target): Don't set to_wait, to_kill, or to_mourn_inferior.
(linux_nat_add_target): New.
(_initialize_linux_nat): Don't initialize the linux native target
here.
* linux-nat.h (linux_nat_add_target, linux_nat_switch_fork): New
prototypes.
* linux-fork.c: Include "linux-nat.h".
(add_fork): Update initial PID.
(fork_load_infrun_state): Call linux_nat_switch_fork.
* Makefile.in (linux-fork.o): Update.
* alpha-linux-nat.c (_initialize_alpha_linux_nat): Use
linux_nat_add_target instead of add_target.
* amd64-linux-nat.c (_initialize_amd64_linux_nat): Likewise.
* arm-linux-nat.c (_initialize_arm_linux_nat): Likewise.
* hppa-linux-nat.c (_initialize_hppa_linux_nat): Likewise.
* ia64-linux-nat.c (_initialize_ia64_linux_nat): Likewise.
* i386-linux-nat.c (_initialize_i386_linux_nat): Likewise.
* m32r-linux-nat.c (_initialize_m32r_linux_nat): Likewise.
* m68klinux-nat.c (_initialize_m68k_linux_nat): Likewise.
* mips-linux-nat.c (_initialize_mips_linux_nat): Likewise.
* ppc-linux-nat.c (_initialize_ppc_linux_nat): Likewise.
* s390-nat.c (_initialize_s390_nat): Likewise.
* sparc-linux-nat.c (_initialize_sparc_linux_nat): Likewise.
* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Likewise.
2006-03-25 00:08:16 +01:00
|
|
|
fp->ptid = ptid_build (pid, pid, 0);
|
2006-01-04 20:34:58 +01:00
|
|
|
fp->num = ++highest_fork_num;
|
|
|
|
fp->next = fork_list;
|
|
|
|
fork_list = fp;
|
|
|
|
return fp;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
free_fork (struct fork_info *fp)
|
|
|
|
{
|
|
|
|
/* Notes on step-resume breakpoints: since this is a concern for
|
|
|
|
threads, let's convince ourselves that it's not a concern for
|
|
|
|
forks. There are two ways for a fork_info to be created. First,
|
|
|
|
by the checkpoint command, in which case we're at a gdb prompt
|
|
|
|
and there can't be any step-resume breakpoint. Second, by a fork
|
|
|
|
in the user program, in which case we *may* have stepped into the
|
|
|
|
fork call, but regardless of whether we follow the parent or the
|
|
|
|
child, we will return to the same place and the step-resume
|
|
|
|
breakpoint, if any, will take care of itself as usual. And
|
|
|
|
unlike threads, we do not save a private copy of the step-resume
|
|
|
|
breakpoint -- so we're OK. */
|
|
|
|
|
|
|
|
if (fp)
|
|
|
|
{
|
|
|
|
if (fp->savedregs)
|
|
|
|
regcache_xfree (fp->savedregs);
|
|
|
|
if (fp->filepos)
|
|
|
|
xfree (fp->filepos);
|
|
|
|
xfree (fp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
delete_fork (ptid_t ptid)
|
|
|
|
{
|
|
|
|
struct fork_info *fp, *fpprev;
|
|
|
|
|
|
|
|
fpprev = NULL;
|
|
|
|
|
|
|
|
for (fp = fork_list; fp; fpprev = fp, fp = fp->next)
|
|
|
|
if (ptid_equal (fp->ptid, ptid))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (!fp)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (fpprev)
|
|
|
|
fpprev->next = fp->next;
|
|
|
|
else
|
|
|
|
fork_list = fp->next;
|
|
|
|
|
|
|
|
free_fork (fp);
|
|
|
|
|
2009-07-03 00:24:07 +02:00
|
|
|
/* Special case: if there is now only one process in the list,
|
2006-01-04 20:34:58 +01:00
|
|
|
and if it is (hopefully!) the current inferior_ptid, then
|
|
|
|
remove it, leaving the list empty -- we're now down to the
|
|
|
|
default case of debugging a single process. */
|
|
|
|
if (fork_list != NULL && fork_list->next == NULL &&
|
|
|
|
ptid_equal (fork_list->ptid, inferior_ptid))
|
|
|
|
{
|
|
|
|
/* Last fork -- delete from list and handle as solo process
|
|
|
|
(should be a safe recursion). */
|
|
|
|
delete_fork (inferior_ptid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Find a fork_info by matching PTID. */
|
|
|
|
static struct fork_info *
|
|
|
|
find_fork_ptid (ptid_t ptid)
|
|
|
|
{
|
|
|
|
struct fork_info *fp;
|
|
|
|
|
|
|
|
for (fp = fork_list; fp; fp = fp->next)
|
|
|
|
if (ptid_equal (fp->ptid, ptid))
|
|
|
|
return fp;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Find a fork_info by matching ID. */
|
|
|
|
static struct fork_info *
|
|
|
|
find_fork_id (int num)
|
|
|
|
{
|
|
|
|
struct fork_info *fp;
|
|
|
|
|
|
|
|
for (fp = fork_list; fp; fp = fp->next)
|
|
|
|
if (fp->num == num)
|
|
|
|
return fp;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Find a fork_info by matching pid. */
|
|
|
|
extern struct fork_info *
|
|
|
|
find_fork_pid (pid_t pid)
|
|
|
|
{
|
|
|
|
struct fork_info *fp;
|
|
|
|
|
|
|
|
for (fp = fork_list; fp; fp = fp->next)
|
|
|
|
if (pid == ptid_get_pid (fp->ptid))
|
|
|
|
return fp;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ptid_t
|
|
|
|
fork_id_to_ptid (int num)
|
|
|
|
{
|
|
|
|
struct fork_info *fork = find_fork_id (num);
|
|
|
|
if (fork)
|
|
|
|
return fork->ptid;
|
|
|
|
else
|
|
|
|
return pid_to_ptid (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
init_fork_list (void)
|
|
|
|
{
|
|
|
|
struct fork_info *fp, *fpnext;
|
|
|
|
|
|
|
|
if (!fork_list)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (fp = fork_list; fp; fp = fpnext)
|
|
|
|
{
|
|
|
|
fpnext = fp->next;
|
|
|
|
free_fork (fp);
|
|
|
|
}
|
|
|
|
|
|
|
|
fork_list = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Fork list <-> gdb interface. */
|
|
|
|
|
2009-07-03 00:24:07 +02:00
|
|
|
/* Utility function for fork_load/fork_save.
|
2006-01-04 20:34:58 +01:00
|
|
|
Calls lseek in the (current) inferior process. */
|
|
|
|
|
|
|
|
static off_t
|
|
|
|
call_lseek (int fd, off_t offset, int whence)
|
|
|
|
{
|
|
|
|
char exp[80];
|
|
|
|
|
|
|
|
snprintf (&exp[0], sizeof (exp), "lseek (%d, %ld, %d)",
|
|
|
|
fd, (long) offset, whence);
|
|
|
|
return (off_t) parse_and_eval_long (&exp[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Load infrun state for the fork PTID. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
fork_load_infrun_state (struct fork_info *fp)
|
|
|
|
{
|
|
|
|
extern void nullify_last_target_wait_ptid ();
|
|
|
|
int i;
|
|
|
|
|
gdb/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
2009-07-02 23:57:28 +02:00
|
|
|
linux_nat_switch_fork (fp->ptid);
|
* linux-nat.c (linux_ops_saved): New.
(super_mourn_inferior, kill_inferior, threaded, linux_nat_ops)
(child_mourn_inferior, child_wait, linux_nat_create_inferior)
(linux_nat_fetch_registers, linux_nat_store_registers)
(linux_nat_child_post_startup_inferior, init_linux_nat_ops): Delete.
(init_lwp_list): Don't set threaded.
(add_lwp): Don't modify threaded.
(delete_lwp): Don't mention non-threaded mode.
(linux_nat_switch_fork): New.
(linux_nat_attach): Update inferior_ptid.
(linux_nat_wait): Handle num_lwps == 0 at entry. Don't check
threaded flag.
(linux_nat_kill): Handle pending forks and saved forks.
(linux_nat_mourn_inferior): Handle saved forks.
(linux_nat_pid_to_str): Don't use the LWP form when there is
only one thread.
(linux_target): Don't set to_wait, to_kill, or to_mourn_inferior.
(linux_nat_add_target): New.
(_initialize_linux_nat): Don't initialize the linux native target
here.
* linux-nat.h (linux_nat_add_target, linux_nat_switch_fork): New
prototypes.
* linux-fork.c: Include "linux-nat.h".
(add_fork): Update initial PID.
(fork_load_infrun_state): Call linux_nat_switch_fork.
* Makefile.in (linux-fork.o): Update.
* alpha-linux-nat.c (_initialize_alpha_linux_nat): Use
linux_nat_add_target instead of add_target.
* amd64-linux-nat.c (_initialize_amd64_linux_nat): Likewise.
* arm-linux-nat.c (_initialize_arm_linux_nat): Likewise.
* hppa-linux-nat.c (_initialize_hppa_linux_nat): Likewise.
* ia64-linux-nat.c (_initialize_ia64_linux_nat): Likewise.
* i386-linux-nat.c (_initialize_i386_linux_nat): Likewise.
* m32r-linux-nat.c (_initialize_m32r_linux_nat): Likewise.
* m68klinux-nat.c (_initialize_m68k_linux_nat): Likewise.
* mips-linux-nat.c (_initialize_mips_linux_nat): Likewise.
* ppc-linux-nat.c (_initialize_ppc_linux_nat): Likewise.
* s390-nat.c (_initialize_s390_nat): Likewise.
* sparc-linux-nat.c (_initialize_sparc_linux_nat): Likewise.
* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Likewise.
2006-03-25 00:08:16 +01:00
|
|
|
|
2006-01-04 20:34:58 +01:00
|
|
|
if (fp->savedregs && fp->clobber_regs)
|
2007-06-16 19:16:26 +02:00
|
|
|
regcache_cpy (get_current_regcache (), fp->savedregs);
|
2006-01-04 20:34:58 +01:00
|
|
|
|
2006-03-24 23:44:05 +01:00
|
|
|
registers_changed ();
|
|
|
|
reinit_frame_cache ();
|
|
|
|
|
2009-05-05 15:24:49 +02:00
|
|
|
stop_pc = regcache_read_pc (get_current_regcache ());
|
2006-01-04 20:34:58 +01:00
|
|
|
nullify_last_target_wait_ptid ();
|
|
|
|
|
|
|
|
/* Now restore the file positions of open file descriptors. */
|
|
|
|
if (fp->filepos)
|
|
|
|
{
|
|
|
|
for (i = 0; i <= fp->maxfd; i++)
|
|
|
|
if (fp->filepos[i] != (off_t) -1)
|
|
|
|
call_lseek (i, fp->filepos[i], SEEK_SET);
|
|
|
|
/* NOTE: I can get away with using SEEK_SET and SEEK_CUR because
|
|
|
|
this is native-only. If it ever has to be cross, we'll have
|
|
|
|
to rethink this. */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Save infrun state for the fork PTID.
|
|
|
|
Exported for use by linux child_follow_fork. */
|
|
|
|
|
gdb/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
2009-07-02 23:57:28 +02:00
|
|
|
static void
|
2006-01-04 20:34:58 +01:00
|
|
|
fork_save_infrun_state (struct fork_info *fp, int clobber_regs)
|
|
|
|
{
|
|
|
|
char path[MAXPATHLEN];
|
|
|
|
struct dirent *de;
|
|
|
|
DIR *d;
|
|
|
|
|
|
|
|
if (fp->savedregs)
|
|
|
|
regcache_xfree (fp->savedregs);
|
|
|
|
|
2007-06-16 19:16:26 +02:00
|
|
|
fp->savedregs = regcache_dup (get_current_regcache ());
|
2006-01-04 20:34:58 +01:00
|
|
|
fp->clobber_regs = clobber_regs;
|
|
|
|
|
|
|
|
if (clobber_regs)
|
|
|
|
{
|
|
|
|
/* Now save the 'state' (file position) of all open file descriptors.
|
|
|
|
Unfortunately fork does not take care of that for us... */
|
|
|
|
snprintf (path, MAXPATHLEN, "/proc/%ld/fd", (long) PIDGET (fp->ptid));
|
|
|
|
if ((d = opendir (path)) != NULL)
|
|
|
|
{
|
|
|
|
long tmp;
|
|
|
|
|
|
|
|
fp->maxfd = 0;
|
|
|
|
while ((de = readdir (d)) != NULL)
|
|
|
|
{
|
|
|
|
/* Count open file descriptors (actually find highest
|
|
|
|
numbered). */
|
|
|
|
tmp = strtol (&de->d_name[0], NULL, 10);
|
|
|
|
if (fp->maxfd < tmp)
|
|
|
|
fp->maxfd = tmp;
|
|
|
|
}
|
|
|
|
/* Allocate array of file positions. */
|
2009-07-03 00:24:07 +02:00
|
|
|
fp->filepos = xrealloc (fp->filepos,
|
2006-01-04 20:34:58 +01:00
|
|
|
(fp->maxfd + 1) * sizeof (*fp->filepos));
|
|
|
|
|
|
|
|
/* Initialize to -1 (invalid). */
|
|
|
|
for (tmp = 0; tmp <= fp->maxfd; tmp++)
|
|
|
|
fp->filepos[tmp] = -1;
|
|
|
|
|
|
|
|
/* Now find actual file positions. */
|
|
|
|
rewinddir (d);
|
|
|
|
while ((de = readdir (d)) != NULL)
|
|
|
|
if (isdigit (de->d_name[0]))
|
|
|
|
{
|
|
|
|
tmp = strtol (&de->d_name[0], NULL, 10);
|
|
|
|
fp->filepos[tmp] = call_lseek (tmp, 0, SEEK_CUR);
|
|
|
|
}
|
|
|
|
closedir (d);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Kill 'em all, let God sort 'em out... */
|
|
|
|
|
2009-07-03 00:24:07 +02:00
|
|
|
void
|
2006-01-04 20:34:58 +01:00
|
|
|
linux_fork_killall (void)
|
|
|
|
{
|
|
|
|
/* Walk list and kill every pid. No need to treat the
|
|
|
|
current inferior_ptid as special (we do not return a
|
|
|
|
status for it) -- however any process may be a child
|
|
|
|
or a parent, so may get a SIGCHLD from a previously
|
|
|
|
killed child. Wait them all out. */
|
2006-03-10 21:15:42 +01:00
|
|
|
struct fork_info *fp;
|
2006-01-04 20:34:58 +01:00
|
|
|
pid_t pid, ret;
|
|
|
|
int status;
|
|
|
|
|
2006-03-10 21:15:42 +01:00
|
|
|
for (fp = fork_list; fp; fp = fp->next)
|
|
|
|
{
|
|
|
|
pid = PIDGET (fp->ptid);
|
|
|
|
do {
|
2008-07-11 00:58:37 +02:00
|
|
|
/* Use SIGKILL instead of PTRACE_KILL because the former works even
|
|
|
|
if the thread is running, while the later doesn't. */
|
|
|
|
kill (pid, SIGKILL);
|
2006-03-10 21:15:42 +01:00
|
|
|
ret = waitpid (pid, &status, 0);
|
|
|
|
/* We might get a SIGCHLD instead of an exit status. This is
|
|
|
|
aggravated by the first kill above - a child has just
|
|
|
|
died. MVS comment cut-and-pasted from linux-nat. */
|
|
|
|
} while (ret == pid && WIFSTOPPED (status));
|
|
|
|
}
|
|
|
|
init_fork_list (); /* Clear list, prepare to start fresh. */
|
2006-01-04 20:34:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* The current inferior_ptid has exited, but there are other viable
|
|
|
|
forks to debug. Delete the exiting one and context-switch to the
|
|
|
|
first available. */
|
|
|
|
|
2009-07-03 00:24:07 +02:00
|
|
|
void
|
2006-01-04 20:34:58 +01:00
|
|
|
linux_fork_mourn_inferior (void)
|
|
|
|
{
|
|
|
|
/* Wait just one more time to collect the inferior's exit status.
|
|
|
|
Do not check whether this succeeds though, since we may be
|
|
|
|
dealing with a process that we attached to. Such a process will
|
|
|
|
only report its exit status to its original parent. */
|
|
|
|
int status;
|
|
|
|
|
|
|
|
waitpid (ptid_get_pid (inferior_ptid), &status, 0);
|
|
|
|
|
|
|
|
/* OK, presumably inferior_ptid is the one who has exited.
|
|
|
|
We need to delete that one from the fork_list, and switch
|
|
|
|
to the next available fork. */
|
|
|
|
delete_fork (inferior_ptid);
|
2006-03-24 23:44:05 +01:00
|
|
|
|
|
|
|
/* There should still be a fork - if there's only one left,
|
|
|
|
delete_fork won't remove it, because we haven't updated
|
|
|
|
inferior_ptid yet. */
|
|
|
|
gdb_assert (fork_list);
|
|
|
|
|
|
|
|
fork_load_infrun_state (fork_list);
|
|
|
|
printf_filtered (_("[Switching to %s]\n"),
|
|
|
|
target_pid_to_str (inferior_ptid));
|
|
|
|
|
|
|
|
/* If there's only one fork, switch back to non-fork mode. */
|
|
|
|
if (fork_list->next == NULL)
|
|
|
|
delete_fork (inferior_ptid);
|
2006-01-04 20:34:58 +01:00
|
|
|
}
|
|
|
|
|
2008-12-28 17:14:57 +01:00
|
|
|
/* The current inferior_ptid is being detached, but there are other
|
|
|
|
viable forks to debug. Detach and delete it and context-switch to
|
|
|
|
the first available. */
|
|
|
|
|
2009-07-03 00:24:07 +02:00
|
|
|
void
|
2008-12-28 17:14:57 +01:00
|
|
|
linux_fork_detach (char *args, int from_tty)
|
|
|
|
{
|
|
|
|
/* OK, inferior_ptid is the one we are detaching from. We need to
|
|
|
|
delete it from the fork_list, and switch to the next available
|
|
|
|
fork. */
|
|
|
|
|
|
|
|
if (ptrace (PTRACE_DETACH, PIDGET (inferior_ptid), 0, 0))
|
|
|
|
error (_("Unable to detach %s"), target_pid_to_str (inferior_ptid));
|
|
|
|
|
|
|
|
delete_fork (inferior_ptid);
|
|
|
|
|
|
|
|
/* There should still be a fork - if there's only one left,
|
|
|
|
delete_fork won't remove it, because we haven't updated
|
|
|
|
inferior_ptid yet. */
|
|
|
|
gdb_assert (fork_list);
|
|
|
|
|
|
|
|
fork_load_infrun_state (fork_list);
|
|
|
|
|
|
|
|
if (from_tty)
|
|
|
|
printf_filtered (_("[Switching to %s]\n"),
|
|
|
|
target_pid_to_str (inferior_ptid));
|
|
|
|
|
|
|
|
/* If there's only one fork, switch back to non-fork mode. */
|
|
|
|
if (fork_list->next == NULL)
|
|
|
|
delete_fork (inferior_ptid);
|
|
|
|
}
|
|
|
|
|
2010-05-14 08:38:44 +02:00
|
|
|
static void
|
|
|
|
inferior_call_waitpid_cleanup (void *fp)
|
|
|
|
{
|
|
|
|
struct fork_info *oldfp = fp;
|
|
|
|
|
2010-05-18 04:47:45 +02:00
|
|
|
if (oldfp)
|
|
|
|
{
|
2011-01-09 04:08:57 +01:00
|
|
|
/* Switch back to inferior_ptid. */
|
2010-05-18 04:47:45 +02:00
|
|
|
remove_breakpoints ();
|
|
|
|
fork_load_infrun_state (oldfp);
|
|
|
|
insert_breakpoints ();
|
|
|
|
}
|
2010-05-14 08:38:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
inferior_call_waitpid (ptid_t pptid, int pid)
|
|
|
|
{
|
|
|
|
struct objfile *waitpid_objf;
|
|
|
|
struct value *waitpid_fn = NULL;
|
2010-05-18 04:47:45 +02:00
|
|
|
struct value *argv[4], *retv;
|
2010-05-14 08:38:44 +02:00
|
|
|
struct gdbarch *gdbarch = get_current_arch ();
|
|
|
|
struct fork_info *oldfp = NULL, *newfp = NULL;
|
2010-05-18 04:47:45 +02:00
|
|
|
struct cleanup *old_cleanup;
|
2010-05-14 08:38:44 +02:00
|
|
|
int ret = -1;
|
|
|
|
|
|
|
|
if (!ptid_equal (pptid, inferior_ptid))
|
|
|
|
{
|
|
|
|
/* Switch to pptid. */
|
|
|
|
oldfp = find_fork_ptid (inferior_ptid);
|
|
|
|
gdb_assert (oldfp != NULL);
|
|
|
|
newfp = find_fork_ptid (pptid);
|
2011-03-05 02:12:05 +01:00
|
|
|
gdb_assert (newfp != NULL);
|
2010-05-14 08:38:44 +02:00
|
|
|
fork_save_infrun_state (oldfp, 1);
|
|
|
|
remove_breakpoints ();
|
|
|
|
fork_load_infrun_state (newfp);
|
|
|
|
insert_breakpoints ();
|
|
|
|
}
|
|
|
|
|
2010-05-18 04:47:45 +02:00
|
|
|
old_cleanup = make_cleanup (inferior_call_waitpid_cleanup, oldfp);
|
|
|
|
|
2010-05-14 08:38:44 +02:00
|
|
|
/* Get the waitpid_fn. */
|
|
|
|
if (lookup_minimal_symbol ("waitpid", NULL, NULL) != NULL)
|
|
|
|
waitpid_fn = find_function_in_inferior ("waitpid", &waitpid_objf);
|
|
|
|
if (!waitpid_fn && lookup_minimal_symbol ("_waitpid", NULL, NULL) != NULL)
|
|
|
|
waitpid_fn = find_function_in_inferior ("_waitpid", &waitpid_objf);
|
|
|
|
if (!waitpid_fn)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
/* Get the argv. */
|
|
|
|
argv[0] = value_from_longest (builtin_type (gdbarch)->builtin_int, pid);
|
|
|
|
argv[1] = value_from_pointer (builtin_type (gdbarch)->builtin_data_ptr, 0);
|
|
|
|
argv[2] = value_from_longest (builtin_type (gdbarch)->builtin_int, 0);
|
|
|
|
argv[3] = 0;
|
|
|
|
|
2010-05-18 04:47:45 +02:00
|
|
|
retv = call_function_by_hand (waitpid_fn, 3, argv);
|
|
|
|
if (value_as_long (retv) < 0)
|
|
|
|
goto out;
|
2010-05-14 08:38:44 +02:00
|
|
|
|
|
|
|
ret = 0;
|
|
|
|
|
|
|
|
out:
|
2010-05-18 04:47:45 +02:00
|
|
|
do_cleanups (old_cleanup);
|
2010-05-14 08:38:44 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2006-01-04 20:34:58 +01:00
|
|
|
/* Fork list <-> user interface. */
|
|
|
|
|
|
|
|
static void
|
2009-07-03 00:24:07 +02:00
|
|
|
delete_checkpoint_command (char *args, int from_tty)
|
2006-01-04 20:34:58 +01:00
|
|
|
{
|
2010-05-18 04:47:45 +02:00
|
|
|
ptid_t ptid, pptid;
|
2010-05-14 08:38:44 +02:00
|
|
|
struct fork_info *fi;
|
2006-01-04 20:34:58 +01:00
|
|
|
|
|
|
|
if (!args || !*args)
|
gdb/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
2009-07-02 23:57:28 +02:00
|
|
|
error (_("Requires argument (checkpoint id to delete)"));
|
2006-01-04 20:34:58 +01:00
|
|
|
|
|
|
|
ptid = fork_id_to_ptid (parse_and_eval_long (args));
|
|
|
|
if (ptid_equal (ptid, minus_one_ptid))
|
gdb/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
2009-07-02 23:57:28 +02:00
|
|
|
error (_("No such checkpoint id, %s"), args);
|
2006-01-04 20:34:58 +01:00
|
|
|
|
|
|
|
if (ptid_equal (ptid, inferior_ptid))
|
2009-07-03 00:24:07 +02:00
|
|
|
error (_("\
|
|
|
|
Please switch to another checkpoint before deleting the current one"));
|
2006-01-04 20:34:58 +01:00
|
|
|
|
2006-01-15 20:07:17 +01:00
|
|
|
if (ptrace (PTRACE_KILL, PIDGET (ptid), 0, 0))
|
2009-02-05 19:54:50 +01:00
|
|
|
error (_("Unable to kill pid %s"), target_pid_to_str (ptid));
|
2006-01-04 20:34:58 +01:00
|
|
|
|
2010-05-14 08:38:44 +02:00
|
|
|
fi = find_fork_ptid (ptid);
|
|
|
|
gdb_assert (fi);
|
2010-05-18 04:47:45 +02:00
|
|
|
pptid = fi->parent_ptid;
|
2010-05-14 08:38:44 +02:00
|
|
|
|
2006-01-04 20:34:58 +01:00
|
|
|
if (from_tty)
|
|
|
|
printf_filtered (_("Killed %s\n"), target_pid_to_str (ptid));
|
|
|
|
|
|
|
|
delete_fork (ptid);
|
2010-05-14 08:38:44 +02:00
|
|
|
|
|
|
|
/* If fi->parent_ptid is not a part of lwp but it's a part of checkpoint
|
|
|
|
list, waitpid the ptid.
|
|
|
|
If fi->parent_ptid is a part of lwp and it is stoped, waitpid the
|
|
|
|
ptid. */
|
2010-05-18 04:47:45 +02:00
|
|
|
if ((!find_thread_ptid (pptid) && find_fork_ptid (pptid))
|
|
|
|
|| (find_thread_ptid (pptid) && is_stopped (pptid)))
|
2010-05-14 08:38:44 +02:00
|
|
|
{
|
2010-05-18 04:47:45 +02:00
|
|
|
if (inferior_call_waitpid (pptid, PIDGET (ptid)))
|
2010-05-14 08:38:44 +02:00
|
|
|
warning (_("Unable to wait pid %s"), target_pid_to_str (ptid));
|
|
|
|
}
|
2006-01-04 20:34:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-07-03 00:24:07 +02:00
|
|
|
detach_checkpoint_command (char *args, int from_tty)
|
2006-01-04 20:34:58 +01:00
|
|
|
{
|
|
|
|
ptid_t ptid;
|
|
|
|
|
|
|
|
if (!args || !*args)
|
gdb/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
2009-07-02 23:57:28 +02:00
|
|
|
error (_("Requires argument (checkpoint id to detach)"));
|
2006-01-04 20:34:58 +01:00
|
|
|
|
|
|
|
ptid = fork_id_to_ptid (parse_and_eval_long (args));
|
|
|
|
if (ptid_equal (ptid, minus_one_ptid))
|
gdb/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
2009-07-02 23:57:28 +02:00
|
|
|
error (_("No such checkpoint id, %s"), args);
|
2006-01-04 20:34:58 +01:00
|
|
|
|
|
|
|
if (ptid_equal (ptid, inferior_ptid))
|
gdb/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
2009-07-02 23:57:28 +02:00
|
|
|
error (_("\
|
|
|
|
Please switch to another checkpoint before detaching the current one"));
|
2006-01-04 20:34:58 +01:00
|
|
|
|
2006-01-15 20:07:17 +01:00
|
|
|
if (ptrace (PTRACE_DETACH, PIDGET (ptid), 0, 0))
|
2006-01-04 20:34:58 +01:00
|
|
|
error (_("Unable to detach %s"), target_pid_to_str (ptid));
|
|
|
|
|
|
|
|
if (from_tty)
|
|
|
|
printf_filtered (_("Detached %s\n"), target_pid_to_str (ptid));
|
|
|
|
|
|
|
|
delete_fork (ptid);
|
|
|
|
}
|
|
|
|
|
2009-07-03 00:24:07 +02:00
|
|
|
/* Print information about currently known checkpoints. */
|
2006-01-04 20:34:58 +01:00
|
|
|
|
|
|
|
static void
|
2009-07-03 00:24:07 +02:00
|
|
|
info_checkpoints_command (char *arg, int from_tty)
|
2006-01-04 20:34:58 +01:00
|
|
|
{
|
* defs.h (strlen_paddr, paddr, paddr_nz): Remove.
(paddress): Add GDBARCH parameter.
* utils.c (strlen_paddr, paddr, paddr_nz): Remove.
(paddress): Add GDBARCH parameter, use it instead of current_gdbarch.
* ui-out.h (ui_out_field_core_addr): Add GDBARCH parameter.
* ui-out.c (ui_out_field_core_addr): Add GDBARCH parameter,
use it instead of current_gdbarch.
Update calls to ui_out_field_core_addr to pass architecture:
* ada-lang.c (print_one_exception): Update.
* breakpoint.c (print_one_breakpoint_location,
print_one_exception_catchpoint): Update.
* disasm.c (dump_insns): Update.
* darwin-nat-info.c (darwin_debug_regions_recurse): Update.
* mi/mi-main.c (mi_cmd_data_read_memory): Update.
* mi/mi-symbol-cmds.c: Include "objfiles.h".
(mi_cmd_symbol_list_lines): Update.
* stack.c (print_frame_info, print_frame): Update.
Update callers of paddress to pass architecture:
* ada-tasks.c (info_task): Update.
* ada-valprint.c (ada_val_print_1): Update.
* annotate.c (annotate_source, annotate_frame_begin): Update.
* breakpoint.c (insert_bp_location, describe_other_breakpoints,
mention): Update.
* cli/cli-cmds.c (edit_command, list_command, print_disassembly):
Update.
* corefile.c (memory_error): Update.
* c-valprint.c (print_function_pointer_address, c_val_print): Update.
* disasm.c (dis_asm_print_address): Update.
* exec.c (print_section_info): Update.
* f-valprint.c (f_val_print): Update.
* infcmd.c: Include "arch-utils.h".
(jump_command, program_info): Update.
* linux-fork.c: Include "arch-utils.h".
(info_forks_command): Update.
* m2-valprint.c (print_function_pointer_address,
print_unpacked_pointer, print_variable_at_address,
m2_val_print): Update.
* m32r-rom.c (m32r_load_section, m32r_load, m32r_upload_command):
Update.
* printcmd.c (print_address, print_address_demangle, address_info):
Update.
* p-valprint.c (pascal_val_print): Update.
* source.c: Include "arch-utils.h".
(line_info): Update.
* stack.c (frame_info, print_block_frame_labels): Update.
* symfile.c (add_symbol_file_command, list_overlays_command): Update.
* symmisc.c (dump_msymbols, dump_psymtab, dump_symtab_1,
print_symbol, print_partial_symbols, maintenance_info_psymtabs,
maintenance_check_symtabs): Update.
* symtab.c (find_pc_sect_symtab): Update.
* target.c (deprecated_debug_xfer_memory): Update.
* tracepoint.c (scope_info): Update.
* tui/tui-stack.c (tui_make_status_line): Update.
* valprint.c (val_print_string): Update.
Update callers of paddr_nz to use paddress instead (keeping
user-visible output identical):
* alpha-tdep.c (alpha_heuristic_proc_start): Update.
* amd64-tdep.c (fixup_riprel, amd64_displaced_step_copy_insn,
amd64_displaced_step_fixup): Update.
* arch-utils.c (simple_displaced_step_copy_insn): Update.
* auxv.c (fprint_target_auxv): Update.
* breakpoint.c (insert_single_step_breakpoint): Update.
* buildsym.c (finish_block): Update.
* cli/cli-dump.c (restore_section_callback): Update.
* fbsd-nat.c (fbsd_find_memory_regions): Update.
* frame.c (frame_unwind_register_value): Update.
* gcore.c (gcore_create_callback): Update.
* hppa-tdep.c (hppa_frame_cache, hppa_skip_trampoline_code): Update.
* i386-tdep.c (i386_displaced_step_fixup, i386_record_modrm,
i386_record_lea_modrm_addr, i386_record_lea_modrm,
i386_process_record): Update.
* ia64-tdep.c (ia64_frame_this_id, ia64_sigtramp_frame_this_id,
ia64_libunwind_frame_this_id, ia64_libunwind_sigtramp_frame_this_id,
ia64_dummy_id, ia64_access_reg, ia64_access_rse_reg): Update.
* infrun.c (displaced_step_prepare, displaced_step_fixup,
handle_inferior_event, insert_step_resume_breakpoint_at_sal,
insert_longjmp_resume_breakpoint): Update.
* linux-nat.c (linux_nat_find_memory_regions): Update.
* linux-record.c (record_linux_system_call): Update.
* mips-tdep.c (heuristic_proc_start, mips_eabi_push_dummy_call,
mips_n32n64_push_dummy_call, mips_o32_push_dummy_call,
mips_o64_push_dummy_call): Update.
* monitor.c (monitor_error, monitor_remove_breakpoint): Update.
* record.c (record_arch_list_add_mem, record_wait,
record_xfer_partial): Update.
* remote-mips.c (mips_fetch_word, mips_check_lsi_error,
mips_common_breakpoint): Update.
* remote-sim.c (gdbsim_xfer_inferior_memory): Update.
* rs6000-tdep.c (ppc_displaced_step_fixup): Update.
* solib-som.c (som_current_sos): Update.
* symfile.c (load_progress, generic_load): Update.
* symfile-mem.c (add_vsyscall_page): Update.
* valops.c (value_fetch_lazy): Update.
* windows-tdep.c (windows_xfer_shared_library): Update.
Update callers of paddr_nz to use paddress instead (changing
user-visible output to make it more correct):
* dwarf2loc.c (locexpr_describe_location): Update.
* ia64-tdep.c (ia64_memory_insert_breakpoint,
ia64_memory_remove_breakpoint): Update.
* jv-valprint.c (java_value_print): Update.
* m32c-tdep.c (m32c_m16c_address_to_pointer): Update.
* monitor.c (monitor_read_memory): Update.
Update callers of paddr to use paddress instead (changing
user-visible output to make it more correct):
* arm-tdep.c (arm_push_dummy_call): Update.
* breakpoint.c (insert_bp_location, create_thread_event_breakpoint,
create_breakpoint): Update.
* darwin-nat-info.c (darwin_debug_regions): Update.
* dcache.c (dcache_info): Update.
* dsrec.c (load_srec, make_srec): Update.
* dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program,
dwarf2_frame_cache): Update.
* gcore.c (gcore_copy_callback): Update.
* gnu-nat.c (gnu_xfer_memory): Update.
* mips-linux-nat.c (mips_show_dr): Update.
* monitor.c (monitor_write_memory, monitor_insert_breakpoint,
monitor_remove_breakpoint): Update.
* remote.c (compare_sections_command): Update.
* remote-m32r-sdi.c (m32r_xfer_memory, m32r_insert_breakpoint,
m32r_remove_breakpoint, m32r_insert_watchpoint,
m32r_remove_watchpoint): Update.
* sol-thread.c (info_cb): Update.
* symfile.c (load_progress): Update.
Update callers of paddress or paddr_nz to use hex_string instead
(changes output of internal/error/debug messages only):
* dwarf2read.c (dump_die_shallow): Update.
* frame.c (fprint_field, fprint_frame, frame_pc_unwind,
get_frame_func, create_new_frame): Update.
* hppa-tdep.c (find_unwind_entry, unwind_command): Update.
* ia64-tdep.c (get_kernel_table, ia64_find_proc_info_x,
ia64_get_dyn_info_list): Update.
* maint.c (maintenance_translate_address): Update.
* mi/mi-cmd-var.c (mi_cmd_var_create): Update.
* target.c (target_flash_erase): Update.
Update callers of paddr/paddr_nz to use phex/phex_nz instead,
using an appropriate address size. Remove use of strlen_paddr.
* exec.c (exec_files_info): Update.
* i386-nat.c (i386_show_dr): Update.
* remote.c (remote_flash_erase): Update.
* m32r-rom.c (m32r_load_section): Update.
* monitor.c (monitor_vsprintf, monitor_store_register): Update.
* remote.c (remote_check_symbols, remote_search_memory): Update.
* remote-mips.c (mips_request, mips_common_breakpoint): Update.
* scm-valprint.c (scm_ipruk, scm_scmval_print): Update.
* sh64-tdep.c (sh64_show_media_regs, sh64_show_compact_regs): Update.
* sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs,
sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs,
sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs,
sh_dsp_show_regs): Update.
* xcoffsolib.c (sharedlibrary_command): Update.
* maint.c (maint_print_section_info): Add ADDR_SIZE parameter.
Use hex_string_custom instead of paddr.
(print_bfd_section_info): Pass address size.
(print_objfile_section_info): Likewise.
* annotate.h (annotate_source): Add GDBARCH parameter.
(annotate_frame_begin): Likewise.
* annotate.c (annotate_source): Add GDBARCH parameter.
(annotate_frame_begin): Likewise.
* source.c (identify_source_line): Update call to annotate_source.
* stack.c (print_frame_info, print_frame): Update call to
annotate_frame_begin.
* breakpoint.c (describe_other_breakpoints): Add GDBARCH parameter.
(create_breakpoint, create_ada_exception_breakpoint): Update call.
* stack.c (print_block_frame_labels): Add GDBARCH parameter.
(print_frame_label_vars): Update call.
* symmisc.c (print_partial_symbols): Add GDBARCH parameter.
(dump_psymtab): Update call to print_partial_symbols.
(struct print_symbol_args): Add GDBARCH member.
(dump_symtab_1): Set print_symbol_args architecture member.
(print_symbol): Use it.
* windows-tdep.h (windows_xfer_shared_library): Add GDBARCH
parameter.
* windows-tdep.c (windows_xfer_shared_library): Likewise.
* i386-cygwin-tdep.c (struct cpms_data): Add GDBARCH member.
(core_process_module_section): Pass architecture from cpms_data to
windows_xfer_shared_library.
(windows_core_xfer_shared_libraries): Initialize cmps_data
architecture member.
* windows-nat.c (windows_xfer_shared_libraries): Pass architecture
to windows_xfer_shared_library.
* defs.h (print_address): Add GDBARCH parameter.
* printcmd.c (print_address): Add GDBARCH parameter.
(print_scalar_formatted, do_examine): Update call.
* findcmd.c (find_command): Update call.
* tracepoint.c: Include "arch-utils.h".
(trace_find_line_command): Update call.
* tui/tui-disasm.c (tui_disassemble): Update call.
* value.h (print_address_demangle): Add GDBARCH parameter.
* printcmd.c (print_address_demangle): Add GDBARCH parameter.
* c-valprint.c (print_function_pointer_address, c_val_print):
Update call.
* f-valprint.c (f_val_print): Update call.
* gnu-v3-abi.c (gnuv3_print_method_ptr): Update call.
* jv-valprint.c (java_val_print): Update call.
* m2-valprint.c (print_function_pointer_address, m2_val_print):
Update call.
* p-valprint.c (pascal_val_print): Update call.
* disasm.c (gdb_disassemble_info): Install architecture into
di.application_data field.
testsuite/ChangeLog:
* gdb.threads/tls-shared.exp: Update to locexpr_describe_location
change to prefix TLS offset in hex with 0x.
doc/ChangeLog:
* gdbint.texinfo (Item Output Functions): Update signature
for ui_out_field_core_addr.
2009-07-02 19:21:10 +02:00
|
|
|
struct gdbarch *gdbarch = get_current_arch ();
|
2006-01-04 20:34:58 +01:00
|
|
|
struct symtab_and_line sal;
|
|
|
|
struct fork_info *fp;
|
|
|
|
ULONGEST pc;
|
2006-04-28 01:03:42 +02:00
|
|
|
int requested = -1;
|
|
|
|
struct fork_info *printed = NULL;
|
|
|
|
|
|
|
|
if (arg && *arg)
|
|
|
|
requested = (int) parse_and_eval_long (arg);
|
2006-01-04 20:34:58 +01:00
|
|
|
|
|
|
|
for (fp = fork_list; fp; fp = fp->next)
|
|
|
|
{
|
2006-04-28 01:03:42 +02:00
|
|
|
if (requested > 0 && fp->num != requested)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
printed = fp;
|
2006-01-04 20:34:58 +01:00
|
|
|
if (ptid_equal (fp->ptid, inferior_ptid))
|
|
|
|
{
|
|
|
|
printf_filtered ("* ");
|
2009-05-05 15:24:49 +02:00
|
|
|
pc = regcache_read_pc (get_current_regcache ());
|
2006-01-04 20:34:58 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
printf_filtered (" ");
|
gdb/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
2009-07-02 23:57:28 +02:00
|
|
|
pc = regcache_read_pc (fp->savedregs);
|
2006-01-04 20:34:58 +01:00
|
|
|
}
|
|
|
|
printf_filtered ("%d %s", fp->num, target_pid_to_str (fp->ptid));
|
|
|
|
if (fp->num == 0)
|
|
|
|
printf_filtered (_(" (main process)"));
|
|
|
|
printf_filtered (_(" at "));
|
* defs.h (strlen_paddr, paddr, paddr_nz): Remove.
(paddress): Add GDBARCH parameter.
* utils.c (strlen_paddr, paddr, paddr_nz): Remove.
(paddress): Add GDBARCH parameter, use it instead of current_gdbarch.
* ui-out.h (ui_out_field_core_addr): Add GDBARCH parameter.
* ui-out.c (ui_out_field_core_addr): Add GDBARCH parameter,
use it instead of current_gdbarch.
Update calls to ui_out_field_core_addr to pass architecture:
* ada-lang.c (print_one_exception): Update.
* breakpoint.c (print_one_breakpoint_location,
print_one_exception_catchpoint): Update.
* disasm.c (dump_insns): Update.
* darwin-nat-info.c (darwin_debug_regions_recurse): Update.
* mi/mi-main.c (mi_cmd_data_read_memory): Update.
* mi/mi-symbol-cmds.c: Include "objfiles.h".
(mi_cmd_symbol_list_lines): Update.
* stack.c (print_frame_info, print_frame): Update.
Update callers of paddress to pass architecture:
* ada-tasks.c (info_task): Update.
* ada-valprint.c (ada_val_print_1): Update.
* annotate.c (annotate_source, annotate_frame_begin): Update.
* breakpoint.c (insert_bp_location, describe_other_breakpoints,
mention): Update.
* cli/cli-cmds.c (edit_command, list_command, print_disassembly):
Update.
* corefile.c (memory_error): Update.
* c-valprint.c (print_function_pointer_address, c_val_print): Update.
* disasm.c (dis_asm_print_address): Update.
* exec.c (print_section_info): Update.
* f-valprint.c (f_val_print): Update.
* infcmd.c: Include "arch-utils.h".
(jump_command, program_info): Update.
* linux-fork.c: Include "arch-utils.h".
(info_forks_command): Update.
* m2-valprint.c (print_function_pointer_address,
print_unpacked_pointer, print_variable_at_address,
m2_val_print): Update.
* m32r-rom.c (m32r_load_section, m32r_load, m32r_upload_command):
Update.
* printcmd.c (print_address, print_address_demangle, address_info):
Update.
* p-valprint.c (pascal_val_print): Update.
* source.c: Include "arch-utils.h".
(line_info): Update.
* stack.c (frame_info, print_block_frame_labels): Update.
* symfile.c (add_symbol_file_command, list_overlays_command): Update.
* symmisc.c (dump_msymbols, dump_psymtab, dump_symtab_1,
print_symbol, print_partial_symbols, maintenance_info_psymtabs,
maintenance_check_symtabs): Update.
* symtab.c (find_pc_sect_symtab): Update.
* target.c (deprecated_debug_xfer_memory): Update.
* tracepoint.c (scope_info): Update.
* tui/tui-stack.c (tui_make_status_line): Update.
* valprint.c (val_print_string): Update.
Update callers of paddr_nz to use paddress instead (keeping
user-visible output identical):
* alpha-tdep.c (alpha_heuristic_proc_start): Update.
* amd64-tdep.c (fixup_riprel, amd64_displaced_step_copy_insn,
amd64_displaced_step_fixup): Update.
* arch-utils.c (simple_displaced_step_copy_insn): Update.
* auxv.c (fprint_target_auxv): Update.
* breakpoint.c (insert_single_step_breakpoint): Update.
* buildsym.c (finish_block): Update.
* cli/cli-dump.c (restore_section_callback): Update.
* fbsd-nat.c (fbsd_find_memory_regions): Update.
* frame.c (frame_unwind_register_value): Update.
* gcore.c (gcore_create_callback): Update.
* hppa-tdep.c (hppa_frame_cache, hppa_skip_trampoline_code): Update.
* i386-tdep.c (i386_displaced_step_fixup, i386_record_modrm,
i386_record_lea_modrm_addr, i386_record_lea_modrm,
i386_process_record): Update.
* ia64-tdep.c (ia64_frame_this_id, ia64_sigtramp_frame_this_id,
ia64_libunwind_frame_this_id, ia64_libunwind_sigtramp_frame_this_id,
ia64_dummy_id, ia64_access_reg, ia64_access_rse_reg): Update.
* infrun.c (displaced_step_prepare, displaced_step_fixup,
handle_inferior_event, insert_step_resume_breakpoint_at_sal,
insert_longjmp_resume_breakpoint): Update.
* linux-nat.c (linux_nat_find_memory_regions): Update.
* linux-record.c (record_linux_system_call): Update.
* mips-tdep.c (heuristic_proc_start, mips_eabi_push_dummy_call,
mips_n32n64_push_dummy_call, mips_o32_push_dummy_call,
mips_o64_push_dummy_call): Update.
* monitor.c (monitor_error, monitor_remove_breakpoint): Update.
* record.c (record_arch_list_add_mem, record_wait,
record_xfer_partial): Update.
* remote-mips.c (mips_fetch_word, mips_check_lsi_error,
mips_common_breakpoint): Update.
* remote-sim.c (gdbsim_xfer_inferior_memory): Update.
* rs6000-tdep.c (ppc_displaced_step_fixup): Update.
* solib-som.c (som_current_sos): Update.
* symfile.c (load_progress, generic_load): Update.
* symfile-mem.c (add_vsyscall_page): Update.
* valops.c (value_fetch_lazy): Update.
* windows-tdep.c (windows_xfer_shared_library): Update.
Update callers of paddr_nz to use paddress instead (changing
user-visible output to make it more correct):
* dwarf2loc.c (locexpr_describe_location): Update.
* ia64-tdep.c (ia64_memory_insert_breakpoint,
ia64_memory_remove_breakpoint): Update.
* jv-valprint.c (java_value_print): Update.
* m32c-tdep.c (m32c_m16c_address_to_pointer): Update.
* monitor.c (monitor_read_memory): Update.
Update callers of paddr to use paddress instead (changing
user-visible output to make it more correct):
* arm-tdep.c (arm_push_dummy_call): Update.
* breakpoint.c (insert_bp_location, create_thread_event_breakpoint,
create_breakpoint): Update.
* darwin-nat-info.c (darwin_debug_regions): Update.
* dcache.c (dcache_info): Update.
* dsrec.c (load_srec, make_srec): Update.
* dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program,
dwarf2_frame_cache): Update.
* gcore.c (gcore_copy_callback): Update.
* gnu-nat.c (gnu_xfer_memory): Update.
* mips-linux-nat.c (mips_show_dr): Update.
* monitor.c (monitor_write_memory, monitor_insert_breakpoint,
monitor_remove_breakpoint): Update.
* remote.c (compare_sections_command): Update.
* remote-m32r-sdi.c (m32r_xfer_memory, m32r_insert_breakpoint,
m32r_remove_breakpoint, m32r_insert_watchpoint,
m32r_remove_watchpoint): Update.
* sol-thread.c (info_cb): Update.
* symfile.c (load_progress): Update.
Update callers of paddress or paddr_nz to use hex_string instead
(changes output of internal/error/debug messages only):
* dwarf2read.c (dump_die_shallow): Update.
* frame.c (fprint_field, fprint_frame, frame_pc_unwind,
get_frame_func, create_new_frame): Update.
* hppa-tdep.c (find_unwind_entry, unwind_command): Update.
* ia64-tdep.c (get_kernel_table, ia64_find_proc_info_x,
ia64_get_dyn_info_list): Update.
* maint.c (maintenance_translate_address): Update.
* mi/mi-cmd-var.c (mi_cmd_var_create): Update.
* target.c (target_flash_erase): Update.
Update callers of paddr/paddr_nz to use phex/phex_nz instead,
using an appropriate address size. Remove use of strlen_paddr.
* exec.c (exec_files_info): Update.
* i386-nat.c (i386_show_dr): Update.
* remote.c (remote_flash_erase): Update.
* m32r-rom.c (m32r_load_section): Update.
* monitor.c (monitor_vsprintf, monitor_store_register): Update.
* remote.c (remote_check_symbols, remote_search_memory): Update.
* remote-mips.c (mips_request, mips_common_breakpoint): Update.
* scm-valprint.c (scm_ipruk, scm_scmval_print): Update.
* sh64-tdep.c (sh64_show_media_regs, sh64_show_compact_regs): Update.
* sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs,
sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs,
sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs,
sh_dsp_show_regs): Update.
* xcoffsolib.c (sharedlibrary_command): Update.
* maint.c (maint_print_section_info): Add ADDR_SIZE parameter.
Use hex_string_custom instead of paddr.
(print_bfd_section_info): Pass address size.
(print_objfile_section_info): Likewise.
* annotate.h (annotate_source): Add GDBARCH parameter.
(annotate_frame_begin): Likewise.
* annotate.c (annotate_source): Add GDBARCH parameter.
(annotate_frame_begin): Likewise.
* source.c (identify_source_line): Update call to annotate_source.
* stack.c (print_frame_info, print_frame): Update call to
annotate_frame_begin.
* breakpoint.c (describe_other_breakpoints): Add GDBARCH parameter.
(create_breakpoint, create_ada_exception_breakpoint): Update call.
* stack.c (print_block_frame_labels): Add GDBARCH parameter.
(print_frame_label_vars): Update call.
* symmisc.c (print_partial_symbols): Add GDBARCH parameter.
(dump_psymtab): Update call to print_partial_symbols.
(struct print_symbol_args): Add GDBARCH member.
(dump_symtab_1): Set print_symbol_args architecture member.
(print_symbol): Use it.
* windows-tdep.h (windows_xfer_shared_library): Add GDBARCH
parameter.
* windows-tdep.c (windows_xfer_shared_library): Likewise.
* i386-cygwin-tdep.c (struct cpms_data): Add GDBARCH member.
(core_process_module_section): Pass architecture from cpms_data to
windows_xfer_shared_library.
(windows_core_xfer_shared_libraries): Initialize cmps_data
architecture member.
* windows-nat.c (windows_xfer_shared_libraries): Pass architecture
to windows_xfer_shared_library.
* defs.h (print_address): Add GDBARCH parameter.
* printcmd.c (print_address): Add GDBARCH parameter.
(print_scalar_formatted, do_examine): Update call.
* findcmd.c (find_command): Update call.
* tracepoint.c: Include "arch-utils.h".
(trace_find_line_command): Update call.
* tui/tui-disasm.c (tui_disassemble): Update call.
* value.h (print_address_demangle): Add GDBARCH parameter.
* printcmd.c (print_address_demangle): Add GDBARCH parameter.
* c-valprint.c (print_function_pointer_address, c_val_print):
Update call.
* f-valprint.c (f_val_print): Update call.
* gnu-v3-abi.c (gnuv3_print_method_ptr): Update call.
* jv-valprint.c (java_val_print): Update call.
* m2-valprint.c (print_function_pointer_address, m2_val_print):
Update call.
* p-valprint.c (pascal_val_print): Update call.
* disasm.c (gdb_disassemble_info): Install architecture into
di.application_data field.
testsuite/ChangeLog:
* gdb.threads/tls-shared.exp: Update to locexpr_describe_location
change to prefix TLS offset in hex with 0x.
doc/ChangeLog:
* gdbint.texinfo (Item Output Functions): Update signature
for ui_out_field_core_addr.
2009-07-02 19:21:10 +02:00
|
|
|
fputs_filtered (paddress (gdbarch, pc), gdb_stdout);
|
2006-01-04 20:34:58 +01:00
|
|
|
|
|
|
|
sal = find_pc_line (pc, 0);
|
|
|
|
if (sal.symtab)
|
2011-03-09 13:48:56 +01:00
|
|
|
printf_filtered (_(", file %s"), lbasename (sal.symtab->filename));
|
2006-01-04 20:34:58 +01:00
|
|
|
if (sal.line)
|
|
|
|
printf_filtered (_(", line %d"), sal.line);
|
|
|
|
if (!sal.symtab && !sal.line)
|
|
|
|
{
|
|
|
|
struct minimal_symbol *msym;
|
|
|
|
|
|
|
|
msym = lookup_minimal_symbol_by_pc (pc);
|
|
|
|
if (msym)
|
|
|
|
printf_filtered (", <%s>", SYMBOL_LINKAGE_NAME (msym));
|
|
|
|
}
|
|
|
|
|
|
|
|
putchar_filtered ('\n');
|
|
|
|
}
|
2006-04-28 01:03:42 +02:00
|
|
|
if (printed == NULL)
|
|
|
|
{
|
|
|
|
if (requested > 0)
|
gdb/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
2009-07-02 23:57:28 +02:00
|
|
|
printf_filtered (_("No checkpoint number %d.\n"), requested);
|
2006-04-28 01:03:42 +02:00
|
|
|
else
|
gdb/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
2009-07-02 23:57:28 +02:00
|
|
|
printf_filtered (_("No checkpoints.\n"));
|
2006-04-28 01:03:42 +02:00
|
|
|
}
|
2006-01-04 20:34:58 +01:00
|
|
|
}
|
|
|
|
|
gdb/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
2009-07-02 23:57:28 +02:00
|
|
|
/* The PID of the process we're checkpointing. */
|
|
|
|
static int checkpointing_pid = 0;
|
2006-01-04 20:34:58 +01:00
|
|
|
|
gdb/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
2009-07-02 23:57:28 +02:00
|
|
|
int
|
|
|
|
linux_fork_checkpointing_p (int pid)
|
2006-01-04 20:34:58 +01:00
|
|
|
{
|
gdb/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
2009-07-02 23:57:28 +02:00
|
|
|
return (checkpointing_pid == pid);
|
2006-01-04 20:34:58 +01:00
|
|
|
}
|
|
|
|
|
2011-09-15 14:47:07 +02:00
|
|
|
/* Callback for iterate over threads. Used to check whether
|
|
|
|
the current inferior is multi-threaded. Returns true as soon
|
|
|
|
as it sees the second thread of the current inferior. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
inf_has_multiple_thread_cb (struct thread_info *tp, void *data)
|
|
|
|
{
|
|
|
|
int *count_p = (int *) data;
|
|
|
|
|
|
|
|
if (current_inferior ()->pid == ptid_get_pid (tp->ptid))
|
|
|
|
(*count_p)++;
|
|
|
|
|
|
|
|
/* Stop the iteration if multiple threads have been detected. */
|
|
|
|
return *count_p > 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return true if the current inferior is multi-threaded. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
inf_has_multiple_threads (void)
|
|
|
|
{
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
iterate_over_threads (inf_has_multiple_thread_cb, &count);
|
|
|
|
return (count > 1);
|
|
|
|
}
|
|
|
|
|
2006-01-04 20:34:58 +01:00
|
|
|
static void
|
|
|
|
checkpoint_command (char *args, int from_tty)
|
|
|
|
{
|
2008-09-11 16:27:34 +02:00
|
|
|
struct objfile *fork_objf;
|
|
|
|
struct gdbarch *gdbarch;
|
2006-01-04 20:34:58 +01:00
|
|
|
struct target_waitstatus last_target_waitstatus;
|
|
|
|
ptid_t last_target_ptid;
|
|
|
|
struct value *fork_fn = NULL, *ret;
|
|
|
|
struct fork_info *fp;
|
|
|
|
pid_t retpid;
|
|
|
|
struct cleanup *old_chain;
|
2008-04-24 12:21:45 +02:00
|
|
|
|
2011-09-15 14:47:07 +02:00
|
|
|
if (!target_has_execution)
|
|
|
|
error (_("The program is not being run."));
|
|
|
|
|
|
|
|
/* Ensure that the inferior is not multithreaded. */
|
|
|
|
update_thread_list ();
|
|
|
|
if (inf_has_multiple_threads ())
|
|
|
|
error (_("checkpoint: can't checkpoint multiple threads."));
|
|
|
|
|
2006-01-04 20:34:58 +01:00
|
|
|
/* Make the inferior fork, record its (and gdb's) state. */
|
|
|
|
|
|
|
|
if (lookup_minimal_symbol ("fork", NULL, NULL) != NULL)
|
2008-09-11 16:27:34 +02:00
|
|
|
fork_fn = find_function_in_inferior ("fork", &fork_objf);
|
2006-01-04 20:34:58 +01:00
|
|
|
if (!fork_fn)
|
|
|
|
if (lookup_minimal_symbol ("_fork", NULL, NULL) != NULL)
|
2008-09-11 16:27:34 +02:00
|
|
|
fork_fn = find_function_in_inferior ("fork", &fork_objf);
|
2006-01-04 20:34:58 +01:00
|
|
|
if (!fork_fn)
|
|
|
|
error (_("checkpoint: can't find fork function in inferior."));
|
|
|
|
|
2008-09-11 16:27:34 +02:00
|
|
|
gdbarch = get_objfile_arch (fork_objf);
|
|
|
|
ret = value_from_longest (builtin_type (gdbarch)->builtin_int, 0);
|
gdb/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
2009-07-02 23:57:28 +02:00
|
|
|
|
|
|
|
/* Tell linux-nat.c that we're checkpointing this inferior. */
|
|
|
|
old_chain = make_cleanup_restore_integer (&checkpointing_pid);
|
|
|
|
checkpointing_pid = PIDGET (inferior_ptid);
|
|
|
|
|
2006-01-04 20:34:58 +01:00
|
|
|
ret = call_function_by_hand (fork_fn, 0, &ret);
|
|
|
|
do_cleanups (old_chain);
|
|
|
|
if (!ret) /* Probably can't happen. */
|
|
|
|
error (_("checkpoint: call_function_by_hand returned null."));
|
|
|
|
|
|
|
|
retpid = value_as_long (ret);
|
|
|
|
get_last_target_status (&last_target_ptid, &last_target_waitstatus);
|
|
|
|
if (from_tty)
|
|
|
|
{
|
|
|
|
int parent_pid;
|
|
|
|
|
2009-07-03 00:24:07 +02:00
|
|
|
printf_filtered (_("checkpoint: fork returned pid %ld.\n"),
|
2006-01-04 20:34:58 +01:00
|
|
|
(long) retpid);
|
|
|
|
if (info_verbose)
|
|
|
|
{
|
|
|
|
parent_pid = ptid_get_lwp (last_target_ptid);
|
|
|
|
if (parent_pid == 0)
|
|
|
|
parent_pid = ptid_get_pid (last_target_ptid);
|
2009-07-03 00:24:07 +02:00
|
|
|
printf_filtered (_(" gdb says parent = %ld.\n"),
|
2006-01-04 20:34:58 +01:00
|
|
|
(long) parent_pid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fp = find_fork_pid (retpid);
|
|
|
|
if (!fp)
|
|
|
|
error (_("Failed to find new fork"));
|
|
|
|
fork_save_infrun_state (fp, 1);
|
2010-05-14 08:38:44 +02:00
|
|
|
fp->parent_ptid = last_target_ptid;
|
2006-01-04 20:34:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
linux_fork_context (struct fork_info *newfp, int from_tty)
|
|
|
|
{
|
|
|
|
/* Now we attempt to switch processes. */
|
2008-12-18 22:35:23 +01:00
|
|
|
struct fork_info *oldfp;
|
2006-01-04 20:34:58 +01:00
|
|
|
|
2008-12-18 22:35:23 +01:00
|
|
|
gdb_assert (newfp != NULL);
|
2006-01-04 20:34:58 +01:00
|
|
|
|
2008-12-18 22:35:23 +01:00
|
|
|
oldfp = find_fork_ptid (inferior_ptid);
|
|
|
|
gdb_assert (oldfp != NULL);
|
2006-01-04 20:34:58 +01:00
|
|
|
|
|
|
|
fork_save_infrun_state (oldfp, 1);
|
2008-04-24 12:21:45 +02:00
|
|
|
remove_breakpoints ();
|
2006-01-04 20:34:58 +01:00
|
|
|
fork_load_infrun_state (newfp);
|
2008-04-24 12:21:45 +02:00
|
|
|
insert_breakpoints ();
|
2006-01-04 20:34:58 +01:00
|
|
|
|
2009-07-03 00:24:07 +02:00
|
|
|
printf_filtered (_("Switching to %s\n"),
|
2006-01-04 20:34:58 +01:00
|
|
|
target_pid_to_str (inferior_ptid));
|
|
|
|
|
|
|
|
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
|
|
|
|
}
|
|
|
|
|
gdb/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
2009-07-02 23:57:28 +02:00
|
|
|
/* Switch inferior process (checkpoint) context, by checkpoint id. */
|
2006-01-04 20:34:58 +01:00
|
|
|
static void
|
|
|
|
restart_command (char *args, int from_tty)
|
|
|
|
{
|
|
|
|
struct fork_info *fp;
|
|
|
|
|
|
|
|
if (!args || !*args)
|
|
|
|
error (_("Requires argument (checkpoint id to restart)"));
|
|
|
|
|
|
|
|
if ((fp = find_fork_id (parse_and_eval_long (args))) == NULL)
|
|
|
|
error (_("Not found: checkpoint id %s"), args);
|
|
|
|
|
|
|
|
linux_fork_context (fp, from_tty);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_initialize_linux_fork (void)
|
|
|
|
{
|
|
|
|
init_fork_list ();
|
|
|
|
|
|
|
|
/* Checkpoint command: create a fork of the inferior process
|
|
|
|
and set it aside for later debugging. */
|
|
|
|
|
|
|
|
add_com ("checkpoint", class_obscure, checkpoint_command, _("\
|
|
|
|
Fork a duplicate process (experimental)."));
|
|
|
|
|
gdb/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
2009-07-02 23:57:28 +02:00
|
|
|
/* Restart command: restore the context of a specified checkpoint
|
|
|
|
process. */
|
2006-01-04 20:34:58 +01:00
|
|
|
|
|
|
|
add_com ("restart", class_obscure, restart_command, _("\
|
|
|
|
restart <n>: restore program context from a checkpoint.\n\
|
|
|
|
Argument 'n' is checkpoint ID, as displayed by 'info checkpoints'."));
|
|
|
|
|
2006-04-28 01:03:42 +02:00
|
|
|
/* Delete checkpoint command: kill the process and remove it from
|
2009-07-03 00:24:07 +02:00
|
|
|
the fork list. */
|
2006-01-04 20:34:58 +01:00
|
|
|
|
2009-07-03 00:24:07 +02:00
|
|
|
add_cmd ("checkpoint", class_obscure, delete_checkpoint_command, _("\
|
gdb/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
2009-07-02 23:57:28 +02:00
|
|
|
Delete a checkpoint (experimental)."),
|
2006-04-28 01:03:42 +02:00
|
|
|
&deletelist);
|
2006-01-04 20:34:58 +01:00
|
|
|
|
2009-07-03 00:24:07 +02:00
|
|
|
/* Detach checkpoint command: release the process to run independently,
|
2006-01-04 20:34:58 +01:00
|
|
|
and remove it from the fork list. */
|
|
|
|
|
2009-07-03 00:24:07 +02:00
|
|
|
add_cmd ("checkpoint", class_obscure, detach_checkpoint_command, _("\
|
gdb/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
2009-07-02 23:57:28 +02:00
|
|
|
Detach from a checkpoint (experimental)."),
|
2006-10-28 00:23:21 +02:00
|
|
|
&detachlist);
|
2006-01-04 20:34:58 +01:00
|
|
|
|
2009-07-03 00:24:07 +02:00
|
|
|
/* Info checkpoints command: list all forks/checkpoints
|
2006-01-04 20:34:58 +01:00
|
|
|
currently under gdb's control. */
|
|
|
|
|
2009-07-03 00:24:07 +02:00
|
|
|
add_info ("checkpoints", info_checkpoints_command,
|
gdb/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): If we're staying attached
to the child process, enable event reporting on it. Don't handle
checkpoints here. Instead, add the child fork to the lwp thread
and inferior lists without clobbering the previous inferior. Let
the thread_db layer learn about a new child process, even if
following the parent.
(linux_nat_switch_fork): Delete lwps of the current inferior only,
instead of clearing the whole list. Use thread_change_ptid to
give the core the illusion the new checkpoint is still the same
inferior. Clear the register cache.
(linux_handle_extended_wait): Handle checkpoints here.
(linux_multi_process): Turn on.
* linux-fork.c (struct fork_info) <pc>: Remove field.
(init_fork_list): Do not delete the checkpoint from the inferior
list (it is not there).
(fork_load_infrun_state): Don't switch inferior_ptid here. Pass
the new checkpoint's ptid to linux_nat_switch_fork.
(fork_save_infrun_state): Make static. Don't stop the pc field of
fork_info, it's gone.
(linux_fork_mourn_inferior): Don't delete the checkpoint from the
inferior list, it's not there.
(linux_fork_detach): Ditto.
(delete_fork_command): Replace mention of fork/checkpoint by
checkpoint only.
(detach_fork_command): Likewise. Don't delete the checkpoint from
the inferior list.
(info_forks_command): Adjust.
(restore_detach_fork): Delete.
(checkpointing_pid): New.
(linux_fork_checkpointing_p): New.
(save_detach_fork): Delete.
(checkpoint_command): Delete temp_detach_fork. Don't remove
breakpoints, that's a nop. Store the pid of the process we're
checkpointing, and use make_cleanup_restore_integer to restore it.
Don't reinsert breakpoints here.
(process_command, fork_command): Delete.
(restart_command): Update comments to only mention checkpoints,
not forks.
(_initialize_linux_fork): Delete "fork", "process", "info forks"
commands.
* linux-fork.h (fork_save_infrun_state, fork_list): Delete
declarations.
(linux_fork_checkpointing_p): Declare.
* cli/cli-cmds.c (killlist): New.
* cli/cli-cmds.h (killlist): Declare.
* gdbcmd.h (killlist): Declare.
* inferior.c: Include "gdbthread.h".
(detach_inferior_command, kill_inferior_command)
(inferior_command): New.
(info_inferiors_command): Allow specifying a specific inferior id.
(_initialize_inferiors): Register "inferior", "kill inferior" and
"detach inferior" commands.
* infcmd.c (_initialize_infcmd): Make "kill" a prefix command.
* gdbthread.h (any_thread_of_process): Declare.
* thread.c (any_thread_of_process): New.
* NEWS: Mention multi-inferior debugging. Mention 'info
inferiors', 'inferior', 'detach inferior' and 'kill inferior' as
new commands.
(Removed commands): New section, mentioning that 'info forks',
'fork', 'process', 'delete fork' and 'detach fork' are now gone.
gdb/testsuite/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.base/multi-forks.exp: Only run detach-on-fork tests on
linux. Adjust to use "inferior", "info inferiors", "detach
inferior" and "kill inferior" instead of "restart", "info fork",
"detach fork" and "delete fork".
* gdb.base/ending-run.exp: Spell out "info".
* gdb.base/help.exp: Adjust to use test_prefix_command_help for
the "kill" command.
gdb/doc/
2009-07-02 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Debugging multiple inferiors): Document the
"inferior", "detach inferior" and "kill inferior" commands.
(Debugging Programs with Multiple Processes): Adjust to mention
generic "inferior" commands. Delete mention of "detach fork" and
"delete fork". Cross reference to "Debugging multiple inferiors"
section.
2009-07-02 23:57:28 +02:00
|
|
|
_("IDs of currently known checkpoints."));
|
2006-01-04 20:34:58 +01:00
|
|
|
}
|