2002-04-09 23:17:45 +02:00
|
|
|
/* Inferior process information for the remote server for GDB.
|
2014-01-01 04:54:24 +01:00
|
|
|
Copyright (C) 2002-2014 Free Software Foundation, Inc.
|
2002-04-09 23:17:45 +02:00
|
|
|
|
|
|
|
Contributed by MontaVista Software.
|
|
|
|
|
|
|
|
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
|
2002-04-09 23:17:45 +02: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/>. */
|
2002-04-09 23:17:45 +02:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "server.h"
|
gdb/gdbserver:
* server.h: Move some code to ...
* gdbthread.h: ... here. New.
* Makefile.in (inferiors.o, regcache.o): Depends on gdbthread.h
(remote-utils.o, server.o, target.o tracepoint.o): Likewise.
(nto-low.o, win32-low.o): Likewise.
* inferiors.c, linux-low.h, nto-low.c: Include gdbthread.h.
* regcache.c, remote-utils.c, server.c: Likewise.
* target.c, tracepoint.c, win32-low.c: Likewise.
2012-04-29 08:28:30 +02:00
|
|
|
#include "gdbthread.h"
|
2013-09-05 22:41:55 +02:00
|
|
|
#include "dll.h"
|
2002-04-09 23:17:45 +02:00
|
|
|
|
2009-04-01 Pedro Alves <pedro@codesourcery.com>
Implement the multiprocess extensions, and add linux multiprocess
support.
* server.h (ULONGEST): Declare.
(struct ptid, ptid_t): New.
(minus_one_ptid, null_ptid): Declare.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): Declare.
(struct inferior_list_entry): Change `id' type from unsigned from
to ptid_t.
(struct sym_cache, struct breakpoint, struct
process_info_private): Forward declare.
(struct process_info): Declare.
(current_process): Declare.
(all_processes): Declare.
(initialize_inferiors): Declare.
(add_thread): Adjust to use ptid_t.
(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): Ditto.
(add_process, remove_process, find_thread_pid): Declare.
(find_inferior_id): Adjust to use ptid_t.
(cont_thread, general_thread, step_thread): Change type to ptid_t.
(multi_process): Declare.
(push_event): Adjust to use ptid_t.
(read_ptid, write_ptid): Declare.
(prepare_resume_reply): Adjust to use ptid_t.
(clear_symbol_cache): Declare.
* inferiors.c (all_processes): New.
(null_ptid, minus_one_ptid): New.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): New.
(add_thread): Change unsigned long to ptid. Remove gdb_id
parameter. Adjust.
(thread_id_to_gdb_id, thread_to_gdb_id): Change unsigned long to ptid.
(gdb_id_to_thread): Rename to ...
(find_thread_pid): ... this. Change unsigned long to ptid.
(gdb_id_to_thread_id, find_inferior_id): Change unsigned long to ptid.
(loaded_dll, pull_pid_from_list): Adjust.
(add_process, remove_process, find_process_pid)
(get_thread_process, current_process, initialize_inferiors): New.
* target.h (struct thread_resume) <thread>: Change type to ptid_t.
(struct target_waitstatus) <related_pid>: Ditto.
(struct target_ops) <kill, detach>: Add `pid' argument. Change
return type to int.
(struct target_ops) <join>: Add `pid' argument.
(struct target_ops) <thread_alive>: Change pid's type to ptid_t.
(struct target_ops) <wait>: Add `ptid' field. Change return type
to ptid.
(kill_inferior, detach_inferior, join_inferior): Add `pid' argument.
(mywait): Add `ptid' argument. Change return type to ptid_t.
(target_pid_to_str): Declare.
* target.c (set_desired_inferior): Adjust to use ptids.
(mywait): Add new `ptid' argument. Adjust.
(target_pid_to_str): New.
* mem-break.h (free_all_breakpoints): Declare.
* mem-break.c (breakpoints): Delelete.
(set_breakpoint_at, delete_breakpoint, find_breakpoint_at)
(check_mem_read, check_mem_write, delete_all_breakpoints): Adjust
to use per-process breakpoint list.
(free_all_breakpoints): New.
* remote-utils.c (struct sym_cache) <name>: Drop `const'.
(symbol_cache, all_symbols_looked_up): Delete.
(hexchars): New.
(ishex, unpack_varlen_hex, write_ptid, hex_or_minus_one,
read_ptid): New.
(prepare_resume_reply): Change ptid argument's type from unsigned
long to ptid_t. Adjust. Implement W;process and X;process.
(free_sym_cache, clear_symbol_cache): New.
(look_up_one_symbol): Adjust to per-process symbol cache. *
* server.c (cont_thread, general_thread, step_thread): Change type
to ptid_t.
(attached): Delete.
(multi_process): New.
(last_ptid): Change type to ptid_t.
(struct vstop_notif) <ptid>: Change type to ptid_t.
(queue_stop_reply, push_event): Change `ptid' argument's type to
ptid_t.
(discard_queued_stop_replies): Add `pid' argument.
(start_inferior): Adjust to use ptids. Adjust to mywait interface
changes. Don't reference the `attached' global.
(attach_inferior): Adjust to mywait interface changes.
(handle_query): Adjust to use ptids. Parse GDB's qSupported
features. Handle and report "multiprocess+". Handle
"qAttached:PID".
(handle_v_cont): Adjust to use ptids. Adjust to mywait interface
changes.
(handle_v_kill): New.
(handle_v_stopped): Adjust to use target_pid_to_str.
(handle_v_requests): Allow multiple attaches and runs when
multiprocess extensions are in effect. Handle "vKill".
(myresume): Adjust to use ptids.
(queue_stop_reply_callback): Add `arg' parameter. Handle it.
(handle_status): Adjust to discard_queued_stop_replies interface
change.
(first_thread_of, kill_inferior_callback)
(detach_or_kill_inferior_callback, join_inferiors_callback): New.
(main): Call initialize_inferiors. Adjust to use ptids, killing
and detaching from all inferiors. Handle multiprocess packet
variants.
* linux-low.h: Include gdb_proc_service.h.
(struct process_info_private): New.
(struct linux_target_ops) <pid_of>: Use ptid_get_pid.
<lwpid_of>: Use ptid_get_lwp.
(get_lwp_thread): Adjust.
(struct lwp_info): Add `dead' member.
(find_lwp_pid): Declare.
* linux-low.c (thread_db_active): Delete.
(new_inferior): Adjust comment.
(inferior_pid): Delete.
(linux_add_process): New.
(handle_extended_wait): Adjust.
(add_lwp): Change unsigned long to ptid.
(linux_create_inferior): Add process to processes table. Adjust
to use ptids. Don't set new_inferior here.
(linux_attach_lwp): Rename to ...
(linux_attach_lwp_1): ... this. Add `initial' argument. Handle
it. Adjust to use ptids.
(linux_attach_lwp): New.
(linux_attach): Add process to processes table. Don't set
new_inferior here.
(struct counter): New.
(second_thread_of_pid_p, last_thread_of_process_p): New.
(linux_kill_one_lwp): Add `args' parameter. Handle it. Adjust to
multiple processes.
(linux_kill): Add `pid' argument. Handle it. Adjust to multiple
processes. Remove process from process table.
(linux_detach_one_lwp): Add `args' parameter. Handle it. Adjust
to multiple processes.
(any_thread_of): New.
(linux_detach): Add `pid' argument, and handle it. Remove process
from processes table.
(linux_join): Add `pid' argument. Handle it.
(linux_thread_alive): Change unsighed long argument to ptid_t.
Consider dead lwps as not being alive.
(status_pending_p): Rename `dummy' argument to `arg'. Filter out
threads we're not interested in.
(same_lwp, find_lwp_pid): New.
(linux_wait_for_lwp): Change `pid' argument's type from int to
ptid_t. Adjust.
(linux_wait_for_event): Rename to ...
(linux_wait_for_event_1): ... this. Change `pid' argument's type
from int to ptid_t. Adjust.
(linux_wait_for_event): New.
(linux_wait_1): Add `ptid' argument. Change return type to
ptid_t. Adjust. Use last_thread_of_process_p. Remove processes
that exit from the process table.
(linux_wait): Add `ptid' argument. Change return type to ptid_t.
Adjust.
(mark_lwp_dead): New.
(wait_for_sigstop): Adjust to use ptids. If a process exits while
stopping all threads, mark its main lwp as dead.
(linux_set_resume_request, linux_resume_one_thread): Adjust to use
ptids.
(fetch_register, usr_store_inferior_registers)
(regsets_fetch_inferior_registers)
(regsets_store_inferior_registers, linux_read_memory)
(linux_write_memory): Inline `inferior_pid'.
(linux_look_up_symbols): Adjust to use per-process
`thread_db_active'.
(linux_request_interrupt): Adjust to use ptids.
(linux_read_auxv): Inline `inferior_pid'.
(initialize_low): Don't reference thread_db_active.
* gdb_proc_service.h (struct ps_prochandle) <pid>: Remove.
* proc-service.c (ps_lgetregs): Use find_lwp_pid.
(ps_getpid): Return the pid of the current inferior.
* thread-db.c (proc_handle, thread_agent): Delete.
(thread_db_create_event, thread_db_enable_reporting): Adjust to
per-process data.
(find_one_thread): Change argument type to ptid_t. Adjust to
per-process data.
(maybe_attach_thread): Adjust to per-process data and ptids.
(thread_db_find_new_threads): Ditto.
(thread_db_init): Ditto.
* spu-low.c (spu_create_inferior, spu_attach): Add process to
processes table. Adjust to use ptids.
(spu_kill, spu_detach): Adjust interface. Remove process from
processes table.
(spu_join, spu_thread_alive): Adjust interface.
(spu_wait): Adjust interface. Remove process from processes
table. Adjust to use ptids.
* win32-low.c (current_inferior_tid): Delete.
(current_inferior_ptid): New.
(debug_event_ptid): New.
(thread_rec): Take a ptid. Adjust.
(child_add_thread): Add `pid' argument. Adjust to use ptids.
(child_delete_thread): Ditto.
(do_initial_child_stuff): Add `attached' argument. Add process to
processes table.
(child_fetch_inferior_registers, child_store_inferior_registers):
Adjust.
(win32_create_inferior): Pass 0 to do_initial_child_stuff.
(win32_attach): Pass 1 to do_initial_child_stuff.
(win32_kill): Adjust interface. Remove process from processes
table.
(win32_detach): Ditto.
(win32_join): Adjust interface.
(win32_thread_alive): Take a ptid.
(win32_resume): Adjust to use ptids.
(get_child_debug_event): Ditto.
(win32_wait): Adjust interface. Remove exiting process from
processes table.
2009-04-02 00:50:24 +02:00
|
|
|
struct inferior_list all_processes;
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
struct inferior_list all_threads;
|
|
|
|
|
|
|
|
struct thread_info *current_inferior;
|
|
|
|
|
|
|
|
#define get_thread(inf) ((struct thread_info *)(inf))
|
|
|
|
|
|
|
|
void
|
|
|
|
add_inferior_to_list (struct inferior_list *list,
|
|
|
|
struct inferior_list_entry *new_inferior)
|
|
|
|
{
|
|
|
|
new_inferior->next = NULL;
|
|
|
|
if (list->tail != NULL)
|
|
|
|
list->tail->next = new_inferior;
|
|
|
|
else
|
|
|
|
list->head = new_inferior;
|
|
|
|
list->tail = new_inferior;
|
|
|
|
}
|
|
|
|
|
2009-05-01 00:21:06 +02:00
|
|
|
/* Invoke ACTION for each inferior in LIST. */
|
|
|
|
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
void
|
|
|
|
for_each_inferior (struct inferior_list *list,
|
|
|
|
void (*action) (struct inferior_list_entry *))
|
|
|
|
{
|
|
|
|
struct inferior_list_entry *cur = list->head, *next;
|
|
|
|
|
|
|
|
while (cur != NULL)
|
|
|
|
{
|
|
|
|
next = cur->next;
|
|
|
|
(*action) (cur);
|
|
|
|
cur = next;
|
|
|
|
}
|
|
|
|
}
|
2002-04-09 23:17:45 +02:00
|
|
|
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
void
|
|
|
|
remove_inferior (struct inferior_list *list,
|
|
|
|
struct inferior_list_entry *entry)
|
|
|
|
{
|
|
|
|
struct inferior_list_entry **cur;
|
2002-04-09 23:17:45 +02:00
|
|
|
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
if (list->head == entry)
|
|
|
|
{
|
|
|
|
list->head = entry->next;
|
|
|
|
if (list->tail == entry)
|
|
|
|
list->tail = list->head;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
cur = &list->head;
|
|
|
|
while (*cur && (*cur)->next != entry)
|
|
|
|
cur = &(*cur)->next;
|
|
|
|
|
|
|
|
if (*cur == NULL)
|
|
|
|
return;
|
2002-04-09 23:17:45 +02:00
|
|
|
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
(*cur)->next = entry->next;
|
|
|
|
|
|
|
|
if (list->tail == entry)
|
|
|
|
list->tail = *cur;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-04-01 Pedro Alves <pedro@codesourcery.com>
Implement the multiprocess extensions, and add linux multiprocess
support.
* server.h (ULONGEST): Declare.
(struct ptid, ptid_t): New.
(minus_one_ptid, null_ptid): Declare.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): Declare.
(struct inferior_list_entry): Change `id' type from unsigned from
to ptid_t.
(struct sym_cache, struct breakpoint, struct
process_info_private): Forward declare.
(struct process_info): Declare.
(current_process): Declare.
(all_processes): Declare.
(initialize_inferiors): Declare.
(add_thread): Adjust to use ptid_t.
(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): Ditto.
(add_process, remove_process, find_thread_pid): Declare.
(find_inferior_id): Adjust to use ptid_t.
(cont_thread, general_thread, step_thread): Change type to ptid_t.
(multi_process): Declare.
(push_event): Adjust to use ptid_t.
(read_ptid, write_ptid): Declare.
(prepare_resume_reply): Adjust to use ptid_t.
(clear_symbol_cache): Declare.
* inferiors.c (all_processes): New.
(null_ptid, minus_one_ptid): New.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): New.
(add_thread): Change unsigned long to ptid. Remove gdb_id
parameter. Adjust.
(thread_id_to_gdb_id, thread_to_gdb_id): Change unsigned long to ptid.
(gdb_id_to_thread): Rename to ...
(find_thread_pid): ... this. Change unsigned long to ptid.
(gdb_id_to_thread_id, find_inferior_id): Change unsigned long to ptid.
(loaded_dll, pull_pid_from_list): Adjust.
(add_process, remove_process, find_process_pid)
(get_thread_process, current_process, initialize_inferiors): New.
* target.h (struct thread_resume) <thread>: Change type to ptid_t.
(struct target_waitstatus) <related_pid>: Ditto.
(struct target_ops) <kill, detach>: Add `pid' argument. Change
return type to int.
(struct target_ops) <join>: Add `pid' argument.
(struct target_ops) <thread_alive>: Change pid's type to ptid_t.
(struct target_ops) <wait>: Add `ptid' field. Change return type
to ptid.
(kill_inferior, detach_inferior, join_inferior): Add `pid' argument.
(mywait): Add `ptid' argument. Change return type to ptid_t.
(target_pid_to_str): Declare.
* target.c (set_desired_inferior): Adjust to use ptids.
(mywait): Add new `ptid' argument. Adjust.
(target_pid_to_str): New.
* mem-break.h (free_all_breakpoints): Declare.
* mem-break.c (breakpoints): Delelete.
(set_breakpoint_at, delete_breakpoint, find_breakpoint_at)
(check_mem_read, check_mem_write, delete_all_breakpoints): Adjust
to use per-process breakpoint list.
(free_all_breakpoints): New.
* remote-utils.c (struct sym_cache) <name>: Drop `const'.
(symbol_cache, all_symbols_looked_up): Delete.
(hexchars): New.
(ishex, unpack_varlen_hex, write_ptid, hex_or_minus_one,
read_ptid): New.
(prepare_resume_reply): Change ptid argument's type from unsigned
long to ptid_t. Adjust. Implement W;process and X;process.
(free_sym_cache, clear_symbol_cache): New.
(look_up_one_symbol): Adjust to per-process symbol cache. *
* server.c (cont_thread, general_thread, step_thread): Change type
to ptid_t.
(attached): Delete.
(multi_process): New.
(last_ptid): Change type to ptid_t.
(struct vstop_notif) <ptid>: Change type to ptid_t.
(queue_stop_reply, push_event): Change `ptid' argument's type to
ptid_t.
(discard_queued_stop_replies): Add `pid' argument.
(start_inferior): Adjust to use ptids. Adjust to mywait interface
changes. Don't reference the `attached' global.
(attach_inferior): Adjust to mywait interface changes.
(handle_query): Adjust to use ptids. Parse GDB's qSupported
features. Handle and report "multiprocess+". Handle
"qAttached:PID".
(handle_v_cont): Adjust to use ptids. Adjust to mywait interface
changes.
(handle_v_kill): New.
(handle_v_stopped): Adjust to use target_pid_to_str.
(handle_v_requests): Allow multiple attaches and runs when
multiprocess extensions are in effect. Handle "vKill".
(myresume): Adjust to use ptids.
(queue_stop_reply_callback): Add `arg' parameter. Handle it.
(handle_status): Adjust to discard_queued_stop_replies interface
change.
(first_thread_of, kill_inferior_callback)
(detach_or_kill_inferior_callback, join_inferiors_callback): New.
(main): Call initialize_inferiors. Adjust to use ptids, killing
and detaching from all inferiors. Handle multiprocess packet
variants.
* linux-low.h: Include gdb_proc_service.h.
(struct process_info_private): New.
(struct linux_target_ops) <pid_of>: Use ptid_get_pid.
<lwpid_of>: Use ptid_get_lwp.
(get_lwp_thread): Adjust.
(struct lwp_info): Add `dead' member.
(find_lwp_pid): Declare.
* linux-low.c (thread_db_active): Delete.
(new_inferior): Adjust comment.
(inferior_pid): Delete.
(linux_add_process): New.
(handle_extended_wait): Adjust.
(add_lwp): Change unsigned long to ptid.
(linux_create_inferior): Add process to processes table. Adjust
to use ptids. Don't set new_inferior here.
(linux_attach_lwp): Rename to ...
(linux_attach_lwp_1): ... this. Add `initial' argument. Handle
it. Adjust to use ptids.
(linux_attach_lwp): New.
(linux_attach): Add process to processes table. Don't set
new_inferior here.
(struct counter): New.
(second_thread_of_pid_p, last_thread_of_process_p): New.
(linux_kill_one_lwp): Add `args' parameter. Handle it. Adjust to
multiple processes.
(linux_kill): Add `pid' argument. Handle it. Adjust to multiple
processes. Remove process from process table.
(linux_detach_one_lwp): Add `args' parameter. Handle it. Adjust
to multiple processes.
(any_thread_of): New.
(linux_detach): Add `pid' argument, and handle it. Remove process
from processes table.
(linux_join): Add `pid' argument. Handle it.
(linux_thread_alive): Change unsighed long argument to ptid_t.
Consider dead lwps as not being alive.
(status_pending_p): Rename `dummy' argument to `arg'. Filter out
threads we're not interested in.
(same_lwp, find_lwp_pid): New.
(linux_wait_for_lwp): Change `pid' argument's type from int to
ptid_t. Adjust.
(linux_wait_for_event): Rename to ...
(linux_wait_for_event_1): ... this. Change `pid' argument's type
from int to ptid_t. Adjust.
(linux_wait_for_event): New.
(linux_wait_1): Add `ptid' argument. Change return type to
ptid_t. Adjust. Use last_thread_of_process_p. Remove processes
that exit from the process table.
(linux_wait): Add `ptid' argument. Change return type to ptid_t.
Adjust.
(mark_lwp_dead): New.
(wait_for_sigstop): Adjust to use ptids. If a process exits while
stopping all threads, mark its main lwp as dead.
(linux_set_resume_request, linux_resume_one_thread): Adjust to use
ptids.
(fetch_register, usr_store_inferior_registers)
(regsets_fetch_inferior_registers)
(regsets_store_inferior_registers, linux_read_memory)
(linux_write_memory): Inline `inferior_pid'.
(linux_look_up_symbols): Adjust to use per-process
`thread_db_active'.
(linux_request_interrupt): Adjust to use ptids.
(linux_read_auxv): Inline `inferior_pid'.
(initialize_low): Don't reference thread_db_active.
* gdb_proc_service.h (struct ps_prochandle) <pid>: Remove.
* proc-service.c (ps_lgetregs): Use find_lwp_pid.
(ps_getpid): Return the pid of the current inferior.
* thread-db.c (proc_handle, thread_agent): Delete.
(thread_db_create_event, thread_db_enable_reporting): Adjust to
per-process data.
(find_one_thread): Change argument type to ptid_t. Adjust to
per-process data.
(maybe_attach_thread): Adjust to per-process data and ptids.
(thread_db_find_new_threads): Ditto.
(thread_db_init): Ditto.
* spu-low.c (spu_create_inferior, spu_attach): Add process to
processes table. Adjust to use ptids.
(spu_kill, spu_detach): Adjust interface. Remove process from
processes table.
(spu_join, spu_thread_alive): Adjust interface.
(spu_wait): Adjust interface. Remove process from processes
table. Adjust to use ptids.
* win32-low.c (current_inferior_tid): Delete.
(current_inferior_ptid): New.
(debug_event_ptid): New.
(thread_rec): Take a ptid. Adjust.
(child_add_thread): Add `pid' argument. Adjust to use ptids.
(child_delete_thread): Ditto.
(do_initial_child_stuff): Add `attached' argument. Add process to
processes table.
(child_fetch_inferior_registers, child_store_inferior_registers):
Adjust.
(win32_create_inferior): Pass 0 to do_initial_child_stuff.
(win32_attach): Pass 1 to do_initial_child_stuff.
(win32_kill): Adjust interface. Remove process from processes
table.
(win32_detach): Ditto.
(win32_join): Adjust interface.
(win32_thread_alive): Take a ptid.
(win32_resume): Adjust to use ptids.
(get_child_debug_event): Ditto.
(win32_wait): Adjust interface. Remove exiting process from
processes table.
2009-04-02 00:50:24 +02:00
|
|
|
add_thread (ptid_t thread_id, void *target_data)
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
{
|
2008-12-14 21:51:04 +01:00
|
|
|
struct thread_info *new_thread = xmalloc (sizeof (*new_thread));
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
|
|
|
|
memset (new_thread, 0, sizeof (*new_thread));
|
|
|
|
|
|
|
|
new_thread->entry.id = thread_id;
|
GDBserver disconnected tracing support.
* linux-low.c (linux_remove_process): Delete.
(add_lwp): Don't set last_resume_kind here.
(linux_kill): Use `mourn'.
(linux_detach): Use `thread_db_detach', and `mourn'.
(linux_mourn): New.
(linux_attach_lwp_1): Adjust comment.
(linux_attach): last_resume_kind moved the thread_info; adjust.
(status_pending_p_callback): Adjust.
(linux_wait_for_event_1): Adjust.
(count_events_callback, select_singlestep_lwp_callback)
(select_event_lwp_callback, cancel_breakpoints_callback)
(db_wants_lwp_stopped, linux_wait_1, need_step_over_p)
(proceed_one_lwp): Adjust.
(linux_async): Add debug output.
(linux_thread_stopped): New.
(linux_pause_all): New.
(linux_target_ops): Install linux_mourn, linux_thread_stopped and
linux_pause_all.
* linux-low.h (struct lwp_info): Delete last_resume_kind field.
(thread_db_free): Delete declaration.
(thread_db_detach, thread_db_mourn): Declare.
* thread-db.c (thread_db_init): Use thread_db_mourn.
(thread_db_free): Delete, split in two.
(disable_thread_event_reporting): New.
(thread_db_detach): New.
(thread_db_mourn): New.
* server.h (struct thread_info) <last_resume_kind>: New field.
<attached>: Add comment.
<gdb_detached>: New field.
(handler_func): Change return type to int.
(handle_serial_event, handle_target_event): Ditto.
(gdb_connected): Declare.
(tracing): Delete.
(disconnected_tracing): Declare.
(stop_tracing): Declare.
* server.c (handle_query) <qSupported>: Report support for
disconnected tracing.
(queue_stop_reply_callback): Account for running threads.
(gdb_wants_thread_stopped): New.
(gdb_wants_all_threads_stopped): New.
(gdb_reattached_process): New.
(handle_status): Clear the `gdb_detached' flag of all processes.
In all-stop, stop all threads.
(main): Be sure to leave tfind mode. Handle disconnected tracing.
(process_serial_event): If the remote connection breaks, or if an
exit was forced with "monitor exit", force an event loop exit.
Handle disconnected tracing on detach.
(handle_serial_event): Adjust.
(handle_target_event): If GDB isn't connected, forward events back
to the inferior, unless the last process exited, in which case,
exit gdbserver. Adjust interface.
* remote-utils.c (remote_open): Don't block in accept. Instead
register an event loop source on the listen socket file
descriptor. Refactor bits into ...
(listen_desc): ... this new global.
(gdb_connected): ... this new function.
(enable_async_notification): ... this new function.
(handle_accept_event): ... this new function.
(remote_close): Clear remote_desc.
* inferiors.c (add_thread): Set the new thread's last_resume_kind.
* target.h (struct target_ops) <mourn, thread_stopped, pause_all>:
New fields.
(mourn_inferior): Define.
(target_process_qsupported): Avoid the dangling else problem.
(thread_stopped): Define.
(pause_all): Define.
(target_waitstatus_to_string): Declare.
* target.c (target_waitstatus_to_string): New.
* tracepoint.c (tracing): Make extern.
(disconnected_tracing): New.
(stop_tracing): Make extern. Handle tracing stops due to GDB
disconnecting.
(cmd_qtdisconnected): New.
(cmd_qtstatus): Report disconnected tracing status in trace reply.
(handle_tracepoint_general_set): Handle QTDisconnected.
* event-loop.c (event_handler_func): Change return type to int.
(process_event): Bail out if the event handler wants the event
loop to stop.
(handle_file_event): Ditto.
(start_event_loop): Bail out if the event handler wants the event
loop to stop.
* nto-low.c (nto_target_ops): Adjust.
* spu-low.c (spu_wait): Don't remove the process here.
(spu_target_ops): Adjust.
* win32-low.c (win32_wait): Don't remove the process here.
(win32_target_ops): Adjust.
2010-04-11 18:33:56 +02:00
|
|
|
new_thread->last_resume_kind = resume_continue;
|
2010-04-04 01:14:18 +02:00
|
|
|
new_thread->last_status.kind = TARGET_WAITKIND_IGNORE;
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
|
|
|
|
add_inferior_to_list (&all_threads, & new_thread->entry);
|
2007-07-17 Pedro Alves <pedro_alves@portugalmail.pt>
Daniel Jacobowitz <dan@codesourcery.com>
* config/i386/cygwin.mt (TDEPFILES): Add solib-target.o.
* coff-pe-read.c (read_pe_exported_syms): Delete verbose
printf.
* NEWS: Mention gdbserver DLL support.
* gdb.base/unload.c (dlopen, dlsym, dlclose, dlerror): Define
for __WIN32__.
(SHLIB_NAME): Delete definition. Always pass dlerror to fprintf.
* gdb.base/unload.exp: Use shared library test routines.
* inferiors.c (all_dlls, dlls_changed, get_dll): New.
(add_thread): Minor cleanups.
(clear_inferiors): Move lower in the file. Clear the DLL
list.
(free_one_dll, match_dll, loaded_dll, unloaded_dll, clear_list): New.
* remote-utils.c (prepare_resume_reply): Check dlls_changed.
(xml_escape_text): New.
* server.c (handle_query): Handle qXfer:libraries:read. Report it
for qSupported.
(handle_v_cont): Report errors.
(gdbserver_version): Update.
(main): Correct size of own_buf. Do not report initial DLL events.
* server.h (struct dll_info, all_dlls, dlls_changed, loaded_dll)
(unloaded_dll, xml_escape_text): New.
* win32-low.c (enum target_waitkind): Update comments.
(win32_add_one_solib, get_image_name, winapi_EnumProcessModules)
(winapi_GetModuleInformation, winapi_GetModuleFileNameExA)
(win32_EnumProcessModules, win32_GetModuleInformation)
(win32_GetModuleFileNameExA, load_psapi, psapi_get_dll_name)
(winapi_CreateToolhelp32Snapshot, winapi_Module32First)
(winapi_Module32Next, win32_CreateToolhelp32Snapshot)
(win32_Module32First, win32_Module32Next, load_toolhelp)
(toolhelp_get_dll_name, handle_load_dll, handle_unload_dll): New.
(get_child_debug_event): Handle DLL events.
(win32_wait): Likewise.
2007-07-17 14:51:41 +02:00
|
|
|
|
2002-04-09 23:17:45 +02:00
|
|
|
if (current_inferior == NULL)
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
current_inferior = new_thread;
|
2002-04-09 23:17:45 +02:00
|
|
|
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
new_thread->target_data = target_data;
|
2005-07-13 17:02:49 +02:00
|
|
|
}
|
|
|
|
|
2009-04-01 Pedro Alves <pedro@codesourcery.com>
Implement the multiprocess extensions, and add linux multiprocess
support.
* server.h (ULONGEST): Declare.
(struct ptid, ptid_t): New.
(minus_one_ptid, null_ptid): Declare.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): Declare.
(struct inferior_list_entry): Change `id' type from unsigned from
to ptid_t.
(struct sym_cache, struct breakpoint, struct
process_info_private): Forward declare.
(struct process_info): Declare.
(current_process): Declare.
(all_processes): Declare.
(initialize_inferiors): Declare.
(add_thread): Adjust to use ptid_t.
(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): Ditto.
(add_process, remove_process, find_thread_pid): Declare.
(find_inferior_id): Adjust to use ptid_t.
(cont_thread, general_thread, step_thread): Change type to ptid_t.
(multi_process): Declare.
(push_event): Adjust to use ptid_t.
(read_ptid, write_ptid): Declare.
(prepare_resume_reply): Adjust to use ptid_t.
(clear_symbol_cache): Declare.
* inferiors.c (all_processes): New.
(null_ptid, minus_one_ptid): New.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): New.
(add_thread): Change unsigned long to ptid. Remove gdb_id
parameter. Adjust.
(thread_id_to_gdb_id, thread_to_gdb_id): Change unsigned long to ptid.
(gdb_id_to_thread): Rename to ...
(find_thread_pid): ... this. Change unsigned long to ptid.
(gdb_id_to_thread_id, find_inferior_id): Change unsigned long to ptid.
(loaded_dll, pull_pid_from_list): Adjust.
(add_process, remove_process, find_process_pid)
(get_thread_process, current_process, initialize_inferiors): New.
* target.h (struct thread_resume) <thread>: Change type to ptid_t.
(struct target_waitstatus) <related_pid>: Ditto.
(struct target_ops) <kill, detach>: Add `pid' argument. Change
return type to int.
(struct target_ops) <join>: Add `pid' argument.
(struct target_ops) <thread_alive>: Change pid's type to ptid_t.
(struct target_ops) <wait>: Add `ptid' field. Change return type
to ptid.
(kill_inferior, detach_inferior, join_inferior): Add `pid' argument.
(mywait): Add `ptid' argument. Change return type to ptid_t.
(target_pid_to_str): Declare.
* target.c (set_desired_inferior): Adjust to use ptids.
(mywait): Add new `ptid' argument. Adjust.
(target_pid_to_str): New.
* mem-break.h (free_all_breakpoints): Declare.
* mem-break.c (breakpoints): Delelete.
(set_breakpoint_at, delete_breakpoint, find_breakpoint_at)
(check_mem_read, check_mem_write, delete_all_breakpoints): Adjust
to use per-process breakpoint list.
(free_all_breakpoints): New.
* remote-utils.c (struct sym_cache) <name>: Drop `const'.
(symbol_cache, all_symbols_looked_up): Delete.
(hexchars): New.
(ishex, unpack_varlen_hex, write_ptid, hex_or_minus_one,
read_ptid): New.
(prepare_resume_reply): Change ptid argument's type from unsigned
long to ptid_t. Adjust. Implement W;process and X;process.
(free_sym_cache, clear_symbol_cache): New.
(look_up_one_symbol): Adjust to per-process symbol cache. *
* server.c (cont_thread, general_thread, step_thread): Change type
to ptid_t.
(attached): Delete.
(multi_process): New.
(last_ptid): Change type to ptid_t.
(struct vstop_notif) <ptid>: Change type to ptid_t.
(queue_stop_reply, push_event): Change `ptid' argument's type to
ptid_t.
(discard_queued_stop_replies): Add `pid' argument.
(start_inferior): Adjust to use ptids. Adjust to mywait interface
changes. Don't reference the `attached' global.
(attach_inferior): Adjust to mywait interface changes.
(handle_query): Adjust to use ptids. Parse GDB's qSupported
features. Handle and report "multiprocess+". Handle
"qAttached:PID".
(handle_v_cont): Adjust to use ptids. Adjust to mywait interface
changes.
(handle_v_kill): New.
(handle_v_stopped): Adjust to use target_pid_to_str.
(handle_v_requests): Allow multiple attaches and runs when
multiprocess extensions are in effect. Handle "vKill".
(myresume): Adjust to use ptids.
(queue_stop_reply_callback): Add `arg' parameter. Handle it.
(handle_status): Adjust to discard_queued_stop_replies interface
change.
(first_thread_of, kill_inferior_callback)
(detach_or_kill_inferior_callback, join_inferiors_callback): New.
(main): Call initialize_inferiors. Adjust to use ptids, killing
and detaching from all inferiors. Handle multiprocess packet
variants.
* linux-low.h: Include gdb_proc_service.h.
(struct process_info_private): New.
(struct linux_target_ops) <pid_of>: Use ptid_get_pid.
<lwpid_of>: Use ptid_get_lwp.
(get_lwp_thread): Adjust.
(struct lwp_info): Add `dead' member.
(find_lwp_pid): Declare.
* linux-low.c (thread_db_active): Delete.
(new_inferior): Adjust comment.
(inferior_pid): Delete.
(linux_add_process): New.
(handle_extended_wait): Adjust.
(add_lwp): Change unsigned long to ptid.
(linux_create_inferior): Add process to processes table. Adjust
to use ptids. Don't set new_inferior here.
(linux_attach_lwp): Rename to ...
(linux_attach_lwp_1): ... this. Add `initial' argument. Handle
it. Adjust to use ptids.
(linux_attach_lwp): New.
(linux_attach): Add process to processes table. Don't set
new_inferior here.
(struct counter): New.
(second_thread_of_pid_p, last_thread_of_process_p): New.
(linux_kill_one_lwp): Add `args' parameter. Handle it. Adjust to
multiple processes.
(linux_kill): Add `pid' argument. Handle it. Adjust to multiple
processes. Remove process from process table.
(linux_detach_one_lwp): Add `args' parameter. Handle it. Adjust
to multiple processes.
(any_thread_of): New.
(linux_detach): Add `pid' argument, and handle it. Remove process
from processes table.
(linux_join): Add `pid' argument. Handle it.
(linux_thread_alive): Change unsighed long argument to ptid_t.
Consider dead lwps as not being alive.
(status_pending_p): Rename `dummy' argument to `arg'. Filter out
threads we're not interested in.
(same_lwp, find_lwp_pid): New.
(linux_wait_for_lwp): Change `pid' argument's type from int to
ptid_t. Adjust.
(linux_wait_for_event): Rename to ...
(linux_wait_for_event_1): ... this. Change `pid' argument's type
from int to ptid_t. Adjust.
(linux_wait_for_event): New.
(linux_wait_1): Add `ptid' argument. Change return type to
ptid_t. Adjust. Use last_thread_of_process_p. Remove processes
that exit from the process table.
(linux_wait): Add `ptid' argument. Change return type to ptid_t.
Adjust.
(mark_lwp_dead): New.
(wait_for_sigstop): Adjust to use ptids. If a process exits while
stopping all threads, mark its main lwp as dead.
(linux_set_resume_request, linux_resume_one_thread): Adjust to use
ptids.
(fetch_register, usr_store_inferior_registers)
(regsets_fetch_inferior_registers)
(regsets_store_inferior_registers, linux_read_memory)
(linux_write_memory): Inline `inferior_pid'.
(linux_look_up_symbols): Adjust to use per-process
`thread_db_active'.
(linux_request_interrupt): Adjust to use ptids.
(linux_read_auxv): Inline `inferior_pid'.
(initialize_low): Don't reference thread_db_active.
* gdb_proc_service.h (struct ps_prochandle) <pid>: Remove.
* proc-service.c (ps_lgetregs): Use find_lwp_pid.
(ps_getpid): Return the pid of the current inferior.
* thread-db.c (proc_handle, thread_agent): Delete.
(thread_db_create_event, thread_db_enable_reporting): Adjust to
per-process data.
(find_one_thread): Change argument type to ptid_t. Adjust to
per-process data.
(maybe_attach_thread): Adjust to per-process data and ptids.
(thread_db_find_new_threads): Ditto.
(thread_db_init): Ditto.
* spu-low.c (spu_create_inferior, spu_attach): Add process to
processes table. Adjust to use ptids.
(spu_kill, spu_detach): Adjust interface. Remove process from
processes table.
(spu_join, spu_thread_alive): Adjust interface.
(spu_wait): Adjust interface. Remove process from processes
table. Adjust to use ptids.
* win32-low.c (current_inferior_tid): Delete.
(current_inferior_ptid): New.
(debug_event_ptid): New.
(thread_rec): Take a ptid. Adjust.
(child_add_thread): Add `pid' argument. Adjust to use ptids.
(child_delete_thread): Ditto.
(do_initial_child_stuff): Add `attached' argument. Add process to
processes table.
(child_fetch_inferior_registers, child_store_inferior_registers):
Adjust.
(win32_create_inferior): Pass 0 to do_initial_child_stuff.
(win32_attach): Pass 1 to do_initial_child_stuff.
(win32_kill): Adjust interface. Remove process from processes
table.
(win32_detach): Ditto.
(win32_join): Adjust interface.
(win32_thread_alive): Take a ptid.
(win32_resume): Adjust to use ptids.
(get_child_debug_event): Ditto.
(win32_wait): Adjust interface. Remove exiting process from
processes table.
2009-04-02 00:50:24 +02:00
|
|
|
ptid_t
|
2005-07-13 17:02:49 +02:00
|
|
|
thread_to_gdb_id (struct thread_info *thread)
|
|
|
|
{
|
2009-04-01 Pedro Alves <pedro@codesourcery.com>
Implement the multiprocess extensions, and add linux multiprocess
support.
* server.h (ULONGEST): Declare.
(struct ptid, ptid_t): New.
(minus_one_ptid, null_ptid): Declare.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): Declare.
(struct inferior_list_entry): Change `id' type from unsigned from
to ptid_t.
(struct sym_cache, struct breakpoint, struct
process_info_private): Forward declare.
(struct process_info): Declare.
(current_process): Declare.
(all_processes): Declare.
(initialize_inferiors): Declare.
(add_thread): Adjust to use ptid_t.
(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): Ditto.
(add_process, remove_process, find_thread_pid): Declare.
(find_inferior_id): Adjust to use ptid_t.
(cont_thread, general_thread, step_thread): Change type to ptid_t.
(multi_process): Declare.
(push_event): Adjust to use ptid_t.
(read_ptid, write_ptid): Declare.
(prepare_resume_reply): Adjust to use ptid_t.
(clear_symbol_cache): Declare.
* inferiors.c (all_processes): New.
(null_ptid, minus_one_ptid): New.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): New.
(add_thread): Change unsigned long to ptid. Remove gdb_id
parameter. Adjust.
(thread_id_to_gdb_id, thread_to_gdb_id): Change unsigned long to ptid.
(gdb_id_to_thread): Rename to ...
(find_thread_pid): ... this. Change unsigned long to ptid.
(gdb_id_to_thread_id, find_inferior_id): Change unsigned long to ptid.
(loaded_dll, pull_pid_from_list): Adjust.
(add_process, remove_process, find_process_pid)
(get_thread_process, current_process, initialize_inferiors): New.
* target.h (struct thread_resume) <thread>: Change type to ptid_t.
(struct target_waitstatus) <related_pid>: Ditto.
(struct target_ops) <kill, detach>: Add `pid' argument. Change
return type to int.
(struct target_ops) <join>: Add `pid' argument.
(struct target_ops) <thread_alive>: Change pid's type to ptid_t.
(struct target_ops) <wait>: Add `ptid' field. Change return type
to ptid.
(kill_inferior, detach_inferior, join_inferior): Add `pid' argument.
(mywait): Add `ptid' argument. Change return type to ptid_t.
(target_pid_to_str): Declare.
* target.c (set_desired_inferior): Adjust to use ptids.
(mywait): Add new `ptid' argument. Adjust.
(target_pid_to_str): New.
* mem-break.h (free_all_breakpoints): Declare.
* mem-break.c (breakpoints): Delelete.
(set_breakpoint_at, delete_breakpoint, find_breakpoint_at)
(check_mem_read, check_mem_write, delete_all_breakpoints): Adjust
to use per-process breakpoint list.
(free_all_breakpoints): New.
* remote-utils.c (struct sym_cache) <name>: Drop `const'.
(symbol_cache, all_symbols_looked_up): Delete.
(hexchars): New.
(ishex, unpack_varlen_hex, write_ptid, hex_or_minus_one,
read_ptid): New.
(prepare_resume_reply): Change ptid argument's type from unsigned
long to ptid_t. Adjust. Implement W;process and X;process.
(free_sym_cache, clear_symbol_cache): New.
(look_up_one_symbol): Adjust to per-process symbol cache. *
* server.c (cont_thread, general_thread, step_thread): Change type
to ptid_t.
(attached): Delete.
(multi_process): New.
(last_ptid): Change type to ptid_t.
(struct vstop_notif) <ptid>: Change type to ptid_t.
(queue_stop_reply, push_event): Change `ptid' argument's type to
ptid_t.
(discard_queued_stop_replies): Add `pid' argument.
(start_inferior): Adjust to use ptids. Adjust to mywait interface
changes. Don't reference the `attached' global.
(attach_inferior): Adjust to mywait interface changes.
(handle_query): Adjust to use ptids. Parse GDB's qSupported
features. Handle and report "multiprocess+". Handle
"qAttached:PID".
(handle_v_cont): Adjust to use ptids. Adjust to mywait interface
changes.
(handle_v_kill): New.
(handle_v_stopped): Adjust to use target_pid_to_str.
(handle_v_requests): Allow multiple attaches and runs when
multiprocess extensions are in effect. Handle "vKill".
(myresume): Adjust to use ptids.
(queue_stop_reply_callback): Add `arg' parameter. Handle it.
(handle_status): Adjust to discard_queued_stop_replies interface
change.
(first_thread_of, kill_inferior_callback)
(detach_or_kill_inferior_callback, join_inferiors_callback): New.
(main): Call initialize_inferiors. Adjust to use ptids, killing
and detaching from all inferiors. Handle multiprocess packet
variants.
* linux-low.h: Include gdb_proc_service.h.
(struct process_info_private): New.
(struct linux_target_ops) <pid_of>: Use ptid_get_pid.
<lwpid_of>: Use ptid_get_lwp.
(get_lwp_thread): Adjust.
(struct lwp_info): Add `dead' member.
(find_lwp_pid): Declare.
* linux-low.c (thread_db_active): Delete.
(new_inferior): Adjust comment.
(inferior_pid): Delete.
(linux_add_process): New.
(handle_extended_wait): Adjust.
(add_lwp): Change unsigned long to ptid.
(linux_create_inferior): Add process to processes table. Adjust
to use ptids. Don't set new_inferior here.
(linux_attach_lwp): Rename to ...
(linux_attach_lwp_1): ... this. Add `initial' argument. Handle
it. Adjust to use ptids.
(linux_attach_lwp): New.
(linux_attach): Add process to processes table. Don't set
new_inferior here.
(struct counter): New.
(second_thread_of_pid_p, last_thread_of_process_p): New.
(linux_kill_one_lwp): Add `args' parameter. Handle it. Adjust to
multiple processes.
(linux_kill): Add `pid' argument. Handle it. Adjust to multiple
processes. Remove process from process table.
(linux_detach_one_lwp): Add `args' parameter. Handle it. Adjust
to multiple processes.
(any_thread_of): New.
(linux_detach): Add `pid' argument, and handle it. Remove process
from processes table.
(linux_join): Add `pid' argument. Handle it.
(linux_thread_alive): Change unsighed long argument to ptid_t.
Consider dead lwps as not being alive.
(status_pending_p): Rename `dummy' argument to `arg'. Filter out
threads we're not interested in.
(same_lwp, find_lwp_pid): New.
(linux_wait_for_lwp): Change `pid' argument's type from int to
ptid_t. Adjust.
(linux_wait_for_event): Rename to ...
(linux_wait_for_event_1): ... this. Change `pid' argument's type
from int to ptid_t. Adjust.
(linux_wait_for_event): New.
(linux_wait_1): Add `ptid' argument. Change return type to
ptid_t. Adjust. Use last_thread_of_process_p. Remove processes
that exit from the process table.
(linux_wait): Add `ptid' argument. Change return type to ptid_t.
Adjust.
(mark_lwp_dead): New.
(wait_for_sigstop): Adjust to use ptids. If a process exits while
stopping all threads, mark its main lwp as dead.
(linux_set_resume_request, linux_resume_one_thread): Adjust to use
ptids.
(fetch_register, usr_store_inferior_registers)
(regsets_fetch_inferior_registers)
(regsets_store_inferior_registers, linux_read_memory)
(linux_write_memory): Inline `inferior_pid'.
(linux_look_up_symbols): Adjust to use per-process
`thread_db_active'.
(linux_request_interrupt): Adjust to use ptids.
(linux_read_auxv): Inline `inferior_pid'.
(initialize_low): Don't reference thread_db_active.
* gdb_proc_service.h (struct ps_prochandle) <pid>: Remove.
* proc-service.c (ps_lgetregs): Use find_lwp_pid.
(ps_getpid): Return the pid of the current inferior.
* thread-db.c (proc_handle, thread_agent): Delete.
(thread_db_create_event, thread_db_enable_reporting): Adjust to
per-process data.
(find_one_thread): Change argument type to ptid_t. Adjust to
per-process data.
(maybe_attach_thread): Adjust to per-process data and ptids.
(thread_db_find_new_threads): Ditto.
(thread_db_init): Ditto.
* spu-low.c (spu_create_inferior, spu_attach): Add process to
processes table. Adjust to use ptids.
(spu_kill, spu_detach): Adjust interface. Remove process from
processes table.
(spu_join, spu_thread_alive): Adjust interface.
(spu_wait): Adjust interface. Remove process from processes
table. Adjust to use ptids.
* win32-low.c (current_inferior_tid): Delete.
(current_inferior_ptid): New.
(debug_event_ptid): New.
(thread_rec): Take a ptid. Adjust.
(child_add_thread): Add `pid' argument. Adjust to use ptids.
(child_delete_thread): Ditto.
(do_initial_child_stuff): Add `attached' argument. Add process to
processes table.
(child_fetch_inferior_registers, child_store_inferior_registers):
Adjust.
(win32_create_inferior): Pass 0 to do_initial_child_stuff.
(win32_attach): Pass 1 to do_initial_child_stuff.
(win32_kill): Adjust interface. Remove process from processes
table.
(win32_detach): Ditto.
(win32_join): Adjust interface.
(win32_thread_alive): Take a ptid.
(win32_resume): Adjust to use ptids.
(get_child_debug_event): Ditto.
(win32_wait): Adjust interface. Remove exiting process from
processes table.
2009-04-02 00:50:24 +02:00
|
|
|
return thread->entry.id;
|
2005-07-13 17:02:49 +02:00
|
|
|
}
|
|
|
|
|
2006-10-17 18:02:27 +02:00
|
|
|
struct thread_info *
|
2009-05-24 23:06:53 +02:00
|
|
|
find_thread_ptid (ptid_t ptid)
|
2005-07-13 17:02:49 +02:00
|
|
|
{
|
|
|
|
struct inferior_list_entry *inf = all_threads.head;
|
|
|
|
|
|
|
|
while (inf != NULL)
|
|
|
|
{
|
|
|
|
struct thread_info *thread = get_thread (inf);
|
2009-04-01 Pedro Alves <pedro@codesourcery.com>
Implement the multiprocess extensions, and add linux multiprocess
support.
* server.h (ULONGEST): Declare.
(struct ptid, ptid_t): New.
(minus_one_ptid, null_ptid): Declare.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): Declare.
(struct inferior_list_entry): Change `id' type from unsigned from
to ptid_t.
(struct sym_cache, struct breakpoint, struct
process_info_private): Forward declare.
(struct process_info): Declare.
(current_process): Declare.
(all_processes): Declare.
(initialize_inferiors): Declare.
(add_thread): Adjust to use ptid_t.
(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): Ditto.
(add_process, remove_process, find_thread_pid): Declare.
(find_inferior_id): Adjust to use ptid_t.
(cont_thread, general_thread, step_thread): Change type to ptid_t.
(multi_process): Declare.
(push_event): Adjust to use ptid_t.
(read_ptid, write_ptid): Declare.
(prepare_resume_reply): Adjust to use ptid_t.
(clear_symbol_cache): Declare.
* inferiors.c (all_processes): New.
(null_ptid, minus_one_ptid): New.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): New.
(add_thread): Change unsigned long to ptid. Remove gdb_id
parameter. Adjust.
(thread_id_to_gdb_id, thread_to_gdb_id): Change unsigned long to ptid.
(gdb_id_to_thread): Rename to ...
(find_thread_pid): ... this. Change unsigned long to ptid.
(gdb_id_to_thread_id, find_inferior_id): Change unsigned long to ptid.
(loaded_dll, pull_pid_from_list): Adjust.
(add_process, remove_process, find_process_pid)
(get_thread_process, current_process, initialize_inferiors): New.
* target.h (struct thread_resume) <thread>: Change type to ptid_t.
(struct target_waitstatus) <related_pid>: Ditto.
(struct target_ops) <kill, detach>: Add `pid' argument. Change
return type to int.
(struct target_ops) <join>: Add `pid' argument.
(struct target_ops) <thread_alive>: Change pid's type to ptid_t.
(struct target_ops) <wait>: Add `ptid' field. Change return type
to ptid.
(kill_inferior, detach_inferior, join_inferior): Add `pid' argument.
(mywait): Add `ptid' argument. Change return type to ptid_t.
(target_pid_to_str): Declare.
* target.c (set_desired_inferior): Adjust to use ptids.
(mywait): Add new `ptid' argument. Adjust.
(target_pid_to_str): New.
* mem-break.h (free_all_breakpoints): Declare.
* mem-break.c (breakpoints): Delelete.
(set_breakpoint_at, delete_breakpoint, find_breakpoint_at)
(check_mem_read, check_mem_write, delete_all_breakpoints): Adjust
to use per-process breakpoint list.
(free_all_breakpoints): New.
* remote-utils.c (struct sym_cache) <name>: Drop `const'.
(symbol_cache, all_symbols_looked_up): Delete.
(hexchars): New.
(ishex, unpack_varlen_hex, write_ptid, hex_or_minus_one,
read_ptid): New.
(prepare_resume_reply): Change ptid argument's type from unsigned
long to ptid_t. Adjust. Implement W;process and X;process.
(free_sym_cache, clear_symbol_cache): New.
(look_up_one_symbol): Adjust to per-process symbol cache. *
* server.c (cont_thread, general_thread, step_thread): Change type
to ptid_t.
(attached): Delete.
(multi_process): New.
(last_ptid): Change type to ptid_t.
(struct vstop_notif) <ptid>: Change type to ptid_t.
(queue_stop_reply, push_event): Change `ptid' argument's type to
ptid_t.
(discard_queued_stop_replies): Add `pid' argument.
(start_inferior): Adjust to use ptids. Adjust to mywait interface
changes. Don't reference the `attached' global.
(attach_inferior): Adjust to mywait interface changes.
(handle_query): Adjust to use ptids. Parse GDB's qSupported
features. Handle and report "multiprocess+". Handle
"qAttached:PID".
(handle_v_cont): Adjust to use ptids. Adjust to mywait interface
changes.
(handle_v_kill): New.
(handle_v_stopped): Adjust to use target_pid_to_str.
(handle_v_requests): Allow multiple attaches and runs when
multiprocess extensions are in effect. Handle "vKill".
(myresume): Adjust to use ptids.
(queue_stop_reply_callback): Add `arg' parameter. Handle it.
(handle_status): Adjust to discard_queued_stop_replies interface
change.
(first_thread_of, kill_inferior_callback)
(detach_or_kill_inferior_callback, join_inferiors_callback): New.
(main): Call initialize_inferiors. Adjust to use ptids, killing
and detaching from all inferiors. Handle multiprocess packet
variants.
* linux-low.h: Include gdb_proc_service.h.
(struct process_info_private): New.
(struct linux_target_ops) <pid_of>: Use ptid_get_pid.
<lwpid_of>: Use ptid_get_lwp.
(get_lwp_thread): Adjust.
(struct lwp_info): Add `dead' member.
(find_lwp_pid): Declare.
* linux-low.c (thread_db_active): Delete.
(new_inferior): Adjust comment.
(inferior_pid): Delete.
(linux_add_process): New.
(handle_extended_wait): Adjust.
(add_lwp): Change unsigned long to ptid.
(linux_create_inferior): Add process to processes table. Adjust
to use ptids. Don't set new_inferior here.
(linux_attach_lwp): Rename to ...
(linux_attach_lwp_1): ... this. Add `initial' argument. Handle
it. Adjust to use ptids.
(linux_attach_lwp): New.
(linux_attach): Add process to processes table. Don't set
new_inferior here.
(struct counter): New.
(second_thread_of_pid_p, last_thread_of_process_p): New.
(linux_kill_one_lwp): Add `args' parameter. Handle it. Adjust to
multiple processes.
(linux_kill): Add `pid' argument. Handle it. Adjust to multiple
processes. Remove process from process table.
(linux_detach_one_lwp): Add `args' parameter. Handle it. Adjust
to multiple processes.
(any_thread_of): New.
(linux_detach): Add `pid' argument, and handle it. Remove process
from processes table.
(linux_join): Add `pid' argument. Handle it.
(linux_thread_alive): Change unsighed long argument to ptid_t.
Consider dead lwps as not being alive.
(status_pending_p): Rename `dummy' argument to `arg'. Filter out
threads we're not interested in.
(same_lwp, find_lwp_pid): New.
(linux_wait_for_lwp): Change `pid' argument's type from int to
ptid_t. Adjust.
(linux_wait_for_event): Rename to ...
(linux_wait_for_event_1): ... this. Change `pid' argument's type
from int to ptid_t. Adjust.
(linux_wait_for_event): New.
(linux_wait_1): Add `ptid' argument. Change return type to
ptid_t. Adjust. Use last_thread_of_process_p. Remove processes
that exit from the process table.
(linux_wait): Add `ptid' argument. Change return type to ptid_t.
Adjust.
(mark_lwp_dead): New.
(wait_for_sigstop): Adjust to use ptids. If a process exits while
stopping all threads, mark its main lwp as dead.
(linux_set_resume_request, linux_resume_one_thread): Adjust to use
ptids.
(fetch_register, usr_store_inferior_registers)
(regsets_fetch_inferior_registers)
(regsets_store_inferior_registers, linux_read_memory)
(linux_write_memory): Inline `inferior_pid'.
(linux_look_up_symbols): Adjust to use per-process
`thread_db_active'.
(linux_request_interrupt): Adjust to use ptids.
(linux_read_auxv): Inline `inferior_pid'.
(initialize_low): Don't reference thread_db_active.
* gdb_proc_service.h (struct ps_prochandle) <pid>: Remove.
* proc-service.c (ps_lgetregs): Use find_lwp_pid.
(ps_getpid): Return the pid of the current inferior.
* thread-db.c (proc_handle, thread_agent): Delete.
(thread_db_create_event, thread_db_enable_reporting): Adjust to
per-process data.
(find_one_thread): Change argument type to ptid_t. Adjust to
per-process data.
(maybe_attach_thread): Adjust to per-process data and ptids.
(thread_db_find_new_threads): Ditto.
(thread_db_init): Ditto.
* spu-low.c (spu_create_inferior, spu_attach): Add process to
processes table. Adjust to use ptids.
(spu_kill, spu_detach): Adjust interface. Remove process from
processes table.
(spu_join, spu_thread_alive): Adjust interface.
(spu_wait): Adjust interface. Remove process from processes
table. Adjust to use ptids.
* win32-low.c (current_inferior_tid): Delete.
(current_inferior_ptid): New.
(debug_event_ptid): New.
(thread_rec): Take a ptid. Adjust.
(child_add_thread): Add `pid' argument. Adjust to use ptids.
(child_delete_thread): Ditto.
(do_initial_child_stuff): Add `attached' argument. Add process to
processes table.
(child_fetch_inferior_registers, child_store_inferior_registers):
Adjust.
(win32_create_inferior): Pass 0 to do_initial_child_stuff.
(win32_attach): Pass 1 to do_initial_child_stuff.
(win32_kill): Adjust interface. Remove process from processes
table.
(win32_detach): Ditto.
(win32_join): Adjust interface.
(win32_thread_alive): Take a ptid.
(win32_resume): Adjust to use ptids.
(get_child_debug_event): Ditto.
(win32_wait): Adjust interface. Remove exiting process from
processes table.
2009-04-02 00:50:24 +02:00
|
|
|
if (ptid_equal (thread->entry.id, ptid))
|
2006-10-17 18:02:27 +02:00
|
|
|
return thread;
|
2005-07-13 17:02:49 +02:00
|
|
|
inf = inf->next;
|
|
|
|
}
|
|
|
|
|
2006-10-17 18:02:27 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-04-01 Pedro Alves <pedro@codesourcery.com>
Implement the multiprocess extensions, and add linux multiprocess
support.
* server.h (ULONGEST): Declare.
(struct ptid, ptid_t): New.
(minus_one_ptid, null_ptid): Declare.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): Declare.
(struct inferior_list_entry): Change `id' type from unsigned from
to ptid_t.
(struct sym_cache, struct breakpoint, struct
process_info_private): Forward declare.
(struct process_info): Declare.
(current_process): Declare.
(all_processes): Declare.
(initialize_inferiors): Declare.
(add_thread): Adjust to use ptid_t.
(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): Ditto.
(add_process, remove_process, find_thread_pid): Declare.
(find_inferior_id): Adjust to use ptid_t.
(cont_thread, general_thread, step_thread): Change type to ptid_t.
(multi_process): Declare.
(push_event): Adjust to use ptid_t.
(read_ptid, write_ptid): Declare.
(prepare_resume_reply): Adjust to use ptid_t.
(clear_symbol_cache): Declare.
* inferiors.c (all_processes): New.
(null_ptid, minus_one_ptid): New.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): New.
(add_thread): Change unsigned long to ptid. Remove gdb_id
parameter. Adjust.
(thread_id_to_gdb_id, thread_to_gdb_id): Change unsigned long to ptid.
(gdb_id_to_thread): Rename to ...
(find_thread_pid): ... this. Change unsigned long to ptid.
(gdb_id_to_thread_id, find_inferior_id): Change unsigned long to ptid.
(loaded_dll, pull_pid_from_list): Adjust.
(add_process, remove_process, find_process_pid)
(get_thread_process, current_process, initialize_inferiors): New.
* target.h (struct thread_resume) <thread>: Change type to ptid_t.
(struct target_waitstatus) <related_pid>: Ditto.
(struct target_ops) <kill, detach>: Add `pid' argument. Change
return type to int.
(struct target_ops) <join>: Add `pid' argument.
(struct target_ops) <thread_alive>: Change pid's type to ptid_t.
(struct target_ops) <wait>: Add `ptid' field. Change return type
to ptid.
(kill_inferior, detach_inferior, join_inferior): Add `pid' argument.
(mywait): Add `ptid' argument. Change return type to ptid_t.
(target_pid_to_str): Declare.
* target.c (set_desired_inferior): Adjust to use ptids.
(mywait): Add new `ptid' argument. Adjust.
(target_pid_to_str): New.
* mem-break.h (free_all_breakpoints): Declare.
* mem-break.c (breakpoints): Delelete.
(set_breakpoint_at, delete_breakpoint, find_breakpoint_at)
(check_mem_read, check_mem_write, delete_all_breakpoints): Adjust
to use per-process breakpoint list.
(free_all_breakpoints): New.
* remote-utils.c (struct sym_cache) <name>: Drop `const'.
(symbol_cache, all_symbols_looked_up): Delete.
(hexchars): New.
(ishex, unpack_varlen_hex, write_ptid, hex_or_minus_one,
read_ptid): New.
(prepare_resume_reply): Change ptid argument's type from unsigned
long to ptid_t. Adjust. Implement W;process and X;process.
(free_sym_cache, clear_symbol_cache): New.
(look_up_one_symbol): Adjust to per-process symbol cache. *
* server.c (cont_thread, general_thread, step_thread): Change type
to ptid_t.
(attached): Delete.
(multi_process): New.
(last_ptid): Change type to ptid_t.
(struct vstop_notif) <ptid>: Change type to ptid_t.
(queue_stop_reply, push_event): Change `ptid' argument's type to
ptid_t.
(discard_queued_stop_replies): Add `pid' argument.
(start_inferior): Adjust to use ptids. Adjust to mywait interface
changes. Don't reference the `attached' global.
(attach_inferior): Adjust to mywait interface changes.
(handle_query): Adjust to use ptids. Parse GDB's qSupported
features. Handle and report "multiprocess+". Handle
"qAttached:PID".
(handle_v_cont): Adjust to use ptids. Adjust to mywait interface
changes.
(handle_v_kill): New.
(handle_v_stopped): Adjust to use target_pid_to_str.
(handle_v_requests): Allow multiple attaches and runs when
multiprocess extensions are in effect. Handle "vKill".
(myresume): Adjust to use ptids.
(queue_stop_reply_callback): Add `arg' parameter. Handle it.
(handle_status): Adjust to discard_queued_stop_replies interface
change.
(first_thread_of, kill_inferior_callback)
(detach_or_kill_inferior_callback, join_inferiors_callback): New.
(main): Call initialize_inferiors. Adjust to use ptids, killing
and detaching from all inferiors. Handle multiprocess packet
variants.
* linux-low.h: Include gdb_proc_service.h.
(struct process_info_private): New.
(struct linux_target_ops) <pid_of>: Use ptid_get_pid.
<lwpid_of>: Use ptid_get_lwp.
(get_lwp_thread): Adjust.
(struct lwp_info): Add `dead' member.
(find_lwp_pid): Declare.
* linux-low.c (thread_db_active): Delete.
(new_inferior): Adjust comment.
(inferior_pid): Delete.
(linux_add_process): New.
(handle_extended_wait): Adjust.
(add_lwp): Change unsigned long to ptid.
(linux_create_inferior): Add process to processes table. Adjust
to use ptids. Don't set new_inferior here.
(linux_attach_lwp): Rename to ...
(linux_attach_lwp_1): ... this. Add `initial' argument. Handle
it. Adjust to use ptids.
(linux_attach_lwp): New.
(linux_attach): Add process to processes table. Don't set
new_inferior here.
(struct counter): New.
(second_thread_of_pid_p, last_thread_of_process_p): New.
(linux_kill_one_lwp): Add `args' parameter. Handle it. Adjust to
multiple processes.
(linux_kill): Add `pid' argument. Handle it. Adjust to multiple
processes. Remove process from process table.
(linux_detach_one_lwp): Add `args' parameter. Handle it. Adjust
to multiple processes.
(any_thread_of): New.
(linux_detach): Add `pid' argument, and handle it. Remove process
from processes table.
(linux_join): Add `pid' argument. Handle it.
(linux_thread_alive): Change unsighed long argument to ptid_t.
Consider dead lwps as not being alive.
(status_pending_p): Rename `dummy' argument to `arg'. Filter out
threads we're not interested in.
(same_lwp, find_lwp_pid): New.
(linux_wait_for_lwp): Change `pid' argument's type from int to
ptid_t. Adjust.
(linux_wait_for_event): Rename to ...
(linux_wait_for_event_1): ... this. Change `pid' argument's type
from int to ptid_t. Adjust.
(linux_wait_for_event): New.
(linux_wait_1): Add `ptid' argument. Change return type to
ptid_t. Adjust. Use last_thread_of_process_p. Remove processes
that exit from the process table.
(linux_wait): Add `ptid' argument. Change return type to ptid_t.
Adjust.
(mark_lwp_dead): New.
(wait_for_sigstop): Adjust to use ptids. If a process exits while
stopping all threads, mark its main lwp as dead.
(linux_set_resume_request, linux_resume_one_thread): Adjust to use
ptids.
(fetch_register, usr_store_inferior_registers)
(regsets_fetch_inferior_registers)
(regsets_store_inferior_registers, linux_read_memory)
(linux_write_memory): Inline `inferior_pid'.
(linux_look_up_symbols): Adjust to use per-process
`thread_db_active'.
(linux_request_interrupt): Adjust to use ptids.
(linux_read_auxv): Inline `inferior_pid'.
(initialize_low): Don't reference thread_db_active.
* gdb_proc_service.h (struct ps_prochandle) <pid>: Remove.
* proc-service.c (ps_lgetregs): Use find_lwp_pid.
(ps_getpid): Return the pid of the current inferior.
* thread-db.c (proc_handle, thread_agent): Delete.
(thread_db_create_event, thread_db_enable_reporting): Adjust to
per-process data.
(find_one_thread): Change argument type to ptid_t. Adjust to
per-process data.
(maybe_attach_thread): Adjust to per-process data and ptids.
(thread_db_find_new_threads): Ditto.
(thread_db_init): Ditto.
* spu-low.c (spu_create_inferior, spu_attach): Add process to
processes table. Adjust to use ptids.
(spu_kill, spu_detach): Adjust interface. Remove process from
processes table.
(spu_join, spu_thread_alive): Adjust interface.
(spu_wait): Adjust interface. Remove process from processes
table. Adjust to use ptids.
* win32-low.c (current_inferior_tid): Delete.
(current_inferior_ptid): New.
(debug_event_ptid): New.
(thread_rec): Take a ptid. Adjust.
(child_add_thread): Add `pid' argument. Adjust to use ptids.
(child_delete_thread): Ditto.
(do_initial_child_stuff): Add `attached' argument. Add process to
processes table.
(child_fetch_inferior_registers, child_store_inferior_registers):
Adjust.
(win32_create_inferior): Pass 0 to do_initial_child_stuff.
(win32_attach): Pass 1 to do_initial_child_stuff.
(win32_kill): Adjust interface. Remove process from processes
table.
(win32_detach): Ditto.
(win32_join): Adjust interface.
(win32_thread_alive): Take a ptid.
(win32_resume): Adjust to use ptids.
(get_child_debug_event): Ditto.
(win32_wait): Adjust interface. Remove exiting process from
processes table.
2009-04-02 00:50:24 +02:00
|
|
|
ptid_t
|
|
|
|
gdb_id_to_thread_id (ptid_t gdb_id)
|
2006-10-17 18:02:27 +02:00
|
|
|
{
|
2009-05-24 23:06:53 +02:00
|
|
|
struct thread_info *thread = find_thread_ptid (gdb_id);
|
2006-10-17 18:02:27 +02:00
|
|
|
|
2009-04-01 Pedro Alves <pedro@codesourcery.com>
Implement the multiprocess extensions, and add linux multiprocess
support.
* server.h (ULONGEST): Declare.
(struct ptid, ptid_t): New.
(minus_one_ptid, null_ptid): Declare.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): Declare.
(struct inferior_list_entry): Change `id' type from unsigned from
to ptid_t.
(struct sym_cache, struct breakpoint, struct
process_info_private): Forward declare.
(struct process_info): Declare.
(current_process): Declare.
(all_processes): Declare.
(initialize_inferiors): Declare.
(add_thread): Adjust to use ptid_t.
(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): Ditto.
(add_process, remove_process, find_thread_pid): Declare.
(find_inferior_id): Adjust to use ptid_t.
(cont_thread, general_thread, step_thread): Change type to ptid_t.
(multi_process): Declare.
(push_event): Adjust to use ptid_t.
(read_ptid, write_ptid): Declare.
(prepare_resume_reply): Adjust to use ptid_t.
(clear_symbol_cache): Declare.
* inferiors.c (all_processes): New.
(null_ptid, minus_one_ptid): New.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): New.
(add_thread): Change unsigned long to ptid. Remove gdb_id
parameter. Adjust.
(thread_id_to_gdb_id, thread_to_gdb_id): Change unsigned long to ptid.
(gdb_id_to_thread): Rename to ...
(find_thread_pid): ... this. Change unsigned long to ptid.
(gdb_id_to_thread_id, find_inferior_id): Change unsigned long to ptid.
(loaded_dll, pull_pid_from_list): Adjust.
(add_process, remove_process, find_process_pid)
(get_thread_process, current_process, initialize_inferiors): New.
* target.h (struct thread_resume) <thread>: Change type to ptid_t.
(struct target_waitstatus) <related_pid>: Ditto.
(struct target_ops) <kill, detach>: Add `pid' argument. Change
return type to int.
(struct target_ops) <join>: Add `pid' argument.
(struct target_ops) <thread_alive>: Change pid's type to ptid_t.
(struct target_ops) <wait>: Add `ptid' field. Change return type
to ptid.
(kill_inferior, detach_inferior, join_inferior): Add `pid' argument.
(mywait): Add `ptid' argument. Change return type to ptid_t.
(target_pid_to_str): Declare.
* target.c (set_desired_inferior): Adjust to use ptids.
(mywait): Add new `ptid' argument. Adjust.
(target_pid_to_str): New.
* mem-break.h (free_all_breakpoints): Declare.
* mem-break.c (breakpoints): Delelete.
(set_breakpoint_at, delete_breakpoint, find_breakpoint_at)
(check_mem_read, check_mem_write, delete_all_breakpoints): Adjust
to use per-process breakpoint list.
(free_all_breakpoints): New.
* remote-utils.c (struct sym_cache) <name>: Drop `const'.
(symbol_cache, all_symbols_looked_up): Delete.
(hexchars): New.
(ishex, unpack_varlen_hex, write_ptid, hex_or_minus_one,
read_ptid): New.
(prepare_resume_reply): Change ptid argument's type from unsigned
long to ptid_t. Adjust. Implement W;process and X;process.
(free_sym_cache, clear_symbol_cache): New.
(look_up_one_symbol): Adjust to per-process symbol cache. *
* server.c (cont_thread, general_thread, step_thread): Change type
to ptid_t.
(attached): Delete.
(multi_process): New.
(last_ptid): Change type to ptid_t.
(struct vstop_notif) <ptid>: Change type to ptid_t.
(queue_stop_reply, push_event): Change `ptid' argument's type to
ptid_t.
(discard_queued_stop_replies): Add `pid' argument.
(start_inferior): Adjust to use ptids. Adjust to mywait interface
changes. Don't reference the `attached' global.
(attach_inferior): Adjust to mywait interface changes.
(handle_query): Adjust to use ptids. Parse GDB's qSupported
features. Handle and report "multiprocess+". Handle
"qAttached:PID".
(handle_v_cont): Adjust to use ptids. Adjust to mywait interface
changes.
(handle_v_kill): New.
(handle_v_stopped): Adjust to use target_pid_to_str.
(handle_v_requests): Allow multiple attaches and runs when
multiprocess extensions are in effect. Handle "vKill".
(myresume): Adjust to use ptids.
(queue_stop_reply_callback): Add `arg' parameter. Handle it.
(handle_status): Adjust to discard_queued_stop_replies interface
change.
(first_thread_of, kill_inferior_callback)
(detach_or_kill_inferior_callback, join_inferiors_callback): New.
(main): Call initialize_inferiors. Adjust to use ptids, killing
and detaching from all inferiors. Handle multiprocess packet
variants.
* linux-low.h: Include gdb_proc_service.h.
(struct process_info_private): New.
(struct linux_target_ops) <pid_of>: Use ptid_get_pid.
<lwpid_of>: Use ptid_get_lwp.
(get_lwp_thread): Adjust.
(struct lwp_info): Add `dead' member.
(find_lwp_pid): Declare.
* linux-low.c (thread_db_active): Delete.
(new_inferior): Adjust comment.
(inferior_pid): Delete.
(linux_add_process): New.
(handle_extended_wait): Adjust.
(add_lwp): Change unsigned long to ptid.
(linux_create_inferior): Add process to processes table. Adjust
to use ptids. Don't set new_inferior here.
(linux_attach_lwp): Rename to ...
(linux_attach_lwp_1): ... this. Add `initial' argument. Handle
it. Adjust to use ptids.
(linux_attach_lwp): New.
(linux_attach): Add process to processes table. Don't set
new_inferior here.
(struct counter): New.
(second_thread_of_pid_p, last_thread_of_process_p): New.
(linux_kill_one_lwp): Add `args' parameter. Handle it. Adjust to
multiple processes.
(linux_kill): Add `pid' argument. Handle it. Adjust to multiple
processes. Remove process from process table.
(linux_detach_one_lwp): Add `args' parameter. Handle it. Adjust
to multiple processes.
(any_thread_of): New.
(linux_detach): Add `pid' argument, and handle it. Remove process
from processes table.
(linux_join): Add `pid' argument. Handle it.
(linux_thread_alive): Change unsighed long argument to ptid_t.
Consider dead lwps as not being alive.
(status_pending_p): Rename `dummy' argument to `arg'. Filter out
threads we're not interested in.
(same_lwp, find_lwp_pid): New.
(linux_wait_for_lwp): Change `pid' argument's type from int to
ptid_t. Adjust.
(linux_wait_for_event): Rename to ...
(linux_wait_for_event_1): ... this. Change `pid' argument's type
from int to ptid_t. Adjust.
(linux_wait_for_event): New.
(linux_wait_1): Add `ptid' argument. Change return type to
ptid_t. Adjust. Use last_thread_of_process_p. Remove processes
that exit from the process table.
(linux_wait): Add `ptid' argument. Change return type to ptid_t.
Adjust.
(mark_lwp_dead): New.
(wait_for_sigstop): Adjust to use ptids. If a process exits while
stopping all threads, mark its main lwp as dead.
(linux_set_resume_request, linux_resume_one_thread): Adjust to use
ptids.
(fetch_register, usr_store_inferior_registers)
(regsets_fetch_inferior_registers)
(regsets_store_inferior_registers, linux_read_memory)
(linux_write_memory): Inline `inferior_pid'.
(linux_look_up_symbols): Adjust to use per-process
`thread_db_active'.
(linux_request_interrupt): Adjust to use ptids.
(linux_read_auxv): Inline `inferior_pid'.
(initialize_low): Don't reference thread_db_active.
* gdb_proc_service.h (struct ps_prochandle) <pid>: Remove.
* proc-service.c (ps_lgetregs): Use find_lwp_pid.
(ps_getpid): Return the pid of the current inferior.
* thread-db.c (proc_handle, thread_agent): Delete.
(thread_db_create_event, thread_db_enable_reporting): Adjust to
per-process data.
(find_one_thread): Change argument type to ptid_t. Adjust to
per-process data.
(maybe_attach_thread): Adjust to per-process data and ptids.
(thread_db_find_new_threads): Ditto.
(thread_db_init): Ditto.
* spu-low.c (spu_create_inferior, spu_attach): Add process to
processes table. Adjust to use ptids.
(spu_kill, spu_detach): Adjust interface. Remove process from
processes table.
(spu_join, spu_thread_alive): Adjust interface.
(spu_wait): Adjust interface. Remove process from processes
table. Adjust to use ptids.
* win32-low.c (current_inferior_tid): Delete.
(current_inferior_ptid): New.
(debug_event_ptid): New.
(thread_rec): Take a ptid. Adjust.
(child_add_thread): Add `pid' argument. Adjust to use ptids.
(child_delete_thread): Ditto.
(do_initial_child_stuff): Add `attached' argument. Add process to
processes table.
(child_fetch_inferior_registers, child_store_inferior_registers):
Adjust.
(win32_create_inferior): Pass 0 to do_initial_child_stuff.
(win32_attach): Pass 1 to do_initial_child_stuff.
(win32_kill): Adjust interface. Remove process from processes
table.
(win32_detach): Ditto.
(win32_join): Adjust interface.
(win32_thread_alive): Take a ptid.
(win32_resume): Adjust to use ptids.
(get_child_debug_event): Ditto.
(win32_wait): Adjust interface. Remove exiting process from
processes table.
2009-04-02 00:50:24 +02:00
|
|
|
return thread ? thread->entry.id : null_ptid;
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
}
|
2002-04-20 19:22:48 +02:00
|
|
|
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
static void
|
|
|
|
free_one_thread (struct inferior_list_entry *inf)
|
|
|
|
{
|
|
|
|
struct thread_info *thread = get_thread (inf);
|
|
|
|
free_register_cache (inferior_regcache_data (thread));
|
|
|
|
free (thread);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
remove_thread (struct thread_info *thread)
|
|
|
|
{
|
2013-03-11 09:35:11 +01:00
|
|
|
if (thread->btrace != NULL)
|
|
|
|
target_disable_btrace (thread->btrace);
|
|
|
|
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
remove_inferior (&all_threads, (struct inferior_list_entry *) thread);
|
|
|
|
free_one_thread (&thread->entry);
|
2002-04-09 23:17:45 +02:00
|
|
|
}
|
|
|
|
|
2010-02-02 05:24:26 +01:00
|
|
|
/* Find the first inferior_list_entry E in LIST for which FUNC (E, ARG)
|
|
|
|
returns non-zero. If no entry is found then return NULL. */
|
|
|
|
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
struct inferior_list_entry *
|
|
|
|
find_inferior (struct inferior_list *list,
|
|
|
|
int (*func) (struct inferior_list_entry *, void *), void *arg)
|
|
|
|
{
|
|
|
|
struct inferior_list_entry *inf = list->head;
|
2002-04-09 23:17:45 +02:00
|
|
|
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
while (inf != NULL)
|
2002-04-09 23:17:45 +02:00
|
|
|
{
|
2009-03-22 23:34:04 +01:00
|
|
|
struct inferior_list_entry *next;
|
|
|
|
|
|
|
|
next = inf->next;
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
if ((*func) (inf, arg))
|
|
|
|
return inf;
|
2009-03-22 23:34:04 +01:00
|
|
|
inf = next;
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
}
|
2002-04-20 19:04:09 +02:00
|
|
|
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
2002-04-20 19:04:09 +02:00
|
|
|
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
struct inferior_list_entry *
|
2009-04-01 Pedro Alves <pedro@codesourcery.com>
Implement the multiprocess extensions, and add linux multiprocess
support.
* server.h (ULONGEST): Declare.
(struct ptid, ptid_t): New.
(minus_one_ptid, null_ptid): Declare.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): Declare.
(struct inferior_list_entry): Change `id' type from unsigned from
to ptid_t.
(struct sym_cache, struct breakpoint, struct
process_info_private): Forward declare.
(struct process_info): Declare.
(current_process): Declare.
(all_processes): Declare.
(initialize_inferiors): Declare.
(add_thread): Adjust to use ptid_t.
(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): Ditto.
(add_process, remove_process, find_thread_pid): Declare.
(find_inferior_id): Adjust to use ptid_t.
(cont_thread, general_thread, step_thread): Change type to ptid_t.
(multi_process): Declare.
(push_event): Adjust to use ptid_t.
(read_ptid, write_ptid): Declare.
(prepare_resume_reply): Adjust to use ptid_t.
(clear_symbol_cache): Declare.
* inferiors.c (all_processes): New.
(null_ptid, minus_one_ptid): New.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): New.
(add_thread): Change unsigned long to ptid. Remove gdb_id
parameter. Adjust.
(thread_id_to_gdb_id, thread_to_gdb_id): Change unsigned long to ptid.
(gdb_id_to_thread): Rename to ...
(find_thread_pid): ... this. Change unsigned long to ptid.
(gdb_id_to_thread_id, find_inferior_id): Change unsigned long to ptid.
(loaded_dll, pull_pid_from_list): Adjust.
(add_process, remove_process, find_process_pid)
(get_thread_process, current_process, initialize_inferiors): New.
* target.h (struct thread_resume) <thread>: Change type to ptid_t.
(struct target_waitstatus) <related_pid>: Ditto.
(struct target_ops) <kill, detach>: Add `pid' argument. Change
return type to int.
(struct target_ops) <join>: Add `pid' argument.
(struct target_ops) <thread_alive>: Change pid's type to ptid_t.
(struct target_ops) <wait>: Add `ptid' field. Change return type
to ptid.
(kill_inferior, detach_inferior, join_inferior): Add `pid' argument.
(mywait): Add `ptid' argument. Change return type to ptid_t.
(target_pid_to_str): Declare.
* target.c (set_desired_inferior): Adjust to use ptids.
(mywait): Add new `ptid' argument. Adjust.
(target_pid_to_str): New.
* mem-break.h (free_all_breakpoints): Declare.
* mem-break.c (breakpoints): Delelete.
(set_breakpoint_at, delete_breakpoint, find_breakpoint_at)
(check_mem_read, check_mem_write, delete_all_breakpoints): Adjust
to use per-process breakpoint list.
(free_all_breakpoints): New.
* remote-utils.c (struct sym_cache) <name>: Drop `const'.
(symbol_cache, all_symbols_looked_up): Delete.
(hexchars): New.
(ishex, unpack_varlen_hex, write_ptid, hex_or_minus_one,
read_ptid): New.
(prepare_resume_reply): Change ptid argument's type from unsigned
long to ptid_t. Adjust. Implement W;process and X;process.
(free_sym_cache, clear_symbol_cache): New.
(look_up_one_symbol): Adjust to per-process symbol cache. *
* server.c (cont_thread, general_thread, step_thread): Change type
to ptid_t.
(attached): Delete.
(multi_process): New.
(last_ptid): Change type to ptid_t.
(struct vstop_notif) <ptid>: Change type to ptid_t.
(queue_stop_reply, push_event): Change `ptid' argument's type to
ptid_t.
(discard_queued_stop_replies): Add `pid' argument.
(start_inferior): Adjust to use ptids. Adjust to mywait interface
changes. Don't reference the `attached' global.
(attach_inferior): Adjust to mywait interface changes.
(handle_query): Adjust to use ptids. Parse GDB's qSupported
features. Handle and report "multiprocess+". Handle
"qAttached:PID".
(handle_v_cont): Adjust to use ptids. Adjust to mywait interface
changes.
(handle_v_kill): New.
(handle_v_stopped): Adjust to use target_pid_to_str.
(handle_v_requests): Allow multiple attaches and runs when
multiprocess extensions are in effect. Handle "vKill".
(myresume): Adjust to use ptids.
(queue_stop_reply_callback): Add `arg' parameter. Handle it.
(handle_status): Adjust to discard_queued_stop_replies interface
change.
(first_thread_of, kill_inferior_callback)
(detach_or_kill_inferior_callback, join_inferiors_callback): New.
(main): Call initialize_inferiors. Adjust to use ptids, killing
and detaching from all inferiors. Handle multiprocess packet
variants.
* linux-low.h: Include gdb_proc_service.h.
(struct process_info_private): New.
(struct linux_target_ops) <pid_of>: Use ptid_get_pid.
<lwpid_of>: Use ptid_get_lwp.
(get_lwp_thread): Adjust.
(struct lwp_info): Add `dead' member.
(find_lwp_pid): Declare.
* linux-low.c (thread_db_active): Delete.
(new_inferior): Adjust comment.
(inferior_pid): Delete.
(linux_add_process): New.
(handle_extended_wait): Adjust.
(add_lwp): Change unsigned long to ptid.
(linux_create_inferior): Add process to processes table. Adjust
to use ptids. Don't set new_inferior here.
(linux_attach_lwp): Rename to ...
(linux_attach_lwp_1): ... this. Add `initial' argument. Handle
it. Adjust to use ptids.
(linux_attach_lwp): New.
(linux_attach): Add process to processes table. Don't set
new_inferior here.
(struct counter): New.
(second_thread_of_pid_p, last_thread_of_process_p): New.
(linux_kill_one_lwp): Add `args' parameter. Handle it. Adjust to
multiple processes.
(linux_kill): Add `pid' argument. Handle it. Adjust to multiple
processes. Remove process from process table.
(linux_detach_one_lwp): Add `args' parameter. Handle it. Adjust
to multiple processes.
(any_thread_of): New.
(linux_detach): Add `pid' argument, and handle it. Remove process
from processes table.
(linux_join): Add `pid' argument. Handle it.
(linux_thread_alive): Change unsighed long argument to ptid_t.
Consider dead lwps as not being alive.
(status_pending_p): Rename `dummy' argument to `arg'. Filter out
threads we're not interested in.
(same_lwp, find_lwp_pid): New.
(linux_wait_for_lwp): Change `pid' argument's type from int to
ptid_t. Adjust.
(linux_wait_for_event): Rename to ...
(linux_wait_for_event_1): ... this. Change `pid' argument's type
from int to ptid_t. Adjust.
(linux_wait_for_event): New.
(linux_wait_1): Add `ptid' argument. Change return type to
ptid_t. Adjust. Use last_thread_of_process_p. Remove processes
that exit from the process table.
(linux_wait): Add `ptid' argument. Change return type to ptid_t.
Adjust.
(mark_lwp_dead): New.
(wait_for_sigstop): Adjust to use ptids. If a process exits while
stopping all threads, mark its main lwp as dead.
(linux_set_resume_request, linux_resume_one_thread): Adjust to use
ptids.
(fetch_register, usr_store_inferior_registers)
(regsets_fetch_inferior_registers)
(regsets_store_inferior_registers, linux_read_memory)
(linux_write_memory): Inline `inferior_pid'.
(linux_look_up_symbols): Adjust to use per-process
`thread_db_active'.
(linux_request_interrupt): Adjust to use ptids.
(linux_read_auxv): Inline `inferior_pid'.
(initialize_low): Don't reference thread_db_active.
* gdb_proc_service.h (struct ps_prochandle) <pid>: Remove.
* proc-service.c (ps_lgetregs): Use find_lwp_pid.
(ps_getpid): Return the pid of the current inferior.
* thread-db.c (proc_handle, thread_agent): Delete.
(thread_db_create_event, thread_db_enable_reporting): Adjust to
per-process data.
(find_one_thread): Change argument type to ptid_t. Adjust to
per-process data.
(maybe_attach_thread): Adjust to per-process data and ptids.
(thread_db_find_new_threads): Ditto.
(thread_db_init): Ditto.
* spu-low.c (spu_create_inferior, spu_attach): Add process to
processes table. Adjust to use ptids.
(spu_kill, spu_detach): Adjust interface. Remove process from
processes table.
(spu_join, spu_thread_alive): Adjust interface.
(spu_wait): Adjust interface. Remove process from processes
table. Adjust to use ptids.
* win32-low.c (current_inferior_tid): Delete.
(current_inferior_ptid): New.
(debug_event_ptid): New.
(thread_rec): Take a ptid. Adjust.
(child_add_thread): Add `pid' argument. Adjust to use ptids.
(child_delete_thread): Ditto.
(do_initial_child_stuff): Add `attached' argument. Add process to
processes table.
(child_fetch_inferior_registers, child_store_inferior_registers):
Adjust.
(win32_create_inferior): Pass 0 to do_initial_child_stuff.
(win32_attach): Pass 1 to do_initial_child_stuff.
(win32_kill): Adjust interface. Remove process from processes
table.
(win32_detach): Ditto.
(win32_join): Adjust interface.
(win32_thread_alive): Take a ptid.
(win32_resume): Adjust to use ptids.
(get_child_debug_event): Ditto.
(win32_wait): Adjust interface. Remove exiting process from
processes table.
2009-04-02 00:50:24 +02:00
|
|
|
find_inferior_id (struct inferior_list *list, ptid_t id)
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
{
|
|
|
|
struct inferior_list_entry *inf = list->head;
|
|
|
|
|
|
|
|
while (inf != NULL)
|
|
|
|
{
|
2009-04-01 Pedro Alves <pedro@codesourcery.com>
Implement the multiprocess extensions, and add linux multiprocess
support.
* server.h (ULONGEST): Declare.
(struct ptid, ptid_t): New.
(minus_one_ptid, null_ptid): Declare.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): Declare.
(struct inferior_list_entry): Change `id' type from unsigned from
to ptid_t.
(struct sym_cache, struct breakpoint, struct
process_info_private): Forward declare.
(struct process_info): Declare.
(current_process): Declare.
(all_processes): Declare.
(initialize_inferiors): Declare.
(add_thread): Adjust to use ptid_t.
(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): Ditto.
(add_process, remove_process, find_thread_pid): Declare.
(find_inferior_id): Adjust to use ptid_t.
(cont_thread, general_thread, step_thread): Change type to ptid_t.
(multi_process): Declare.
(push_event): Adjust to use ptid_t.
(read_ptid, write_ptid): Declare.
(prepare_resume_reply): Adjust to use ptid_t.
(clear_symbol_cache): Declare.
* inferiors.c (all_processes): New.
(null_ptid, minus_one_ptid): New.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): New.
(add_thread): Change unsigned long to ptid. Remove gdb_id
parameter. Adjust.
(thread_id_to_gdb_id, thread_to_gdb_id): Change unsigned long to ptid.
(gdb_id_to_thread): Rename to ...
(find_thread_pid): ... this. Change unsigned long to ptid.
(gdb_id_to_thread_id, find_inferior_id): Change unsigned long to ptid.
(loaded_dll, pull_pid_from_list): Adjust.
(add_process, remove_process, find_process_pid)
(get_thread_process, current_process, initialize_inferiors): New.
* target.h (struct thread_resume) <thread>: Change type to ptid_t.
(struct target_waitstatus) <related_pid>: Ditto.
(struct target_ops) <kill, detach>: Add `pid' argument. Change
return type to int.
(struct target_ops) <join>: Add `pid' argument.
(struct target_ops) <thread_alive>: Change pid's type to ptid_t.
(struct target_ops) <wait>: Add `ptid' field. Change return type
to ptid.
(kill_inferior, detach_inferior, join_inferior): Add `pid' argument.
(mywait): Add `ptid' argument. Change return type to ptid_t.
(target_pid_to_str): Declare.
* target.c (set_desired_inferior): Adjust to use ptids.
(mywait): Add new `ptid' argument. Adjust.
(target_pid_to_str): New.
* mem-break.h (free_all_breakpoints): Declare.
* mem-break.c (breakpoints): Delelete.
(set_breakpoint_at, delete_breakpoint, find_breakpoint_at)
(check_mem_read, check_mem_write, delete_all_breakpoints): Adjust
to use per-process breakpoint list.
(free_all_breakpoints): New.
* remote-utils.c (struct sym_cache) <name>: Drop `const'.
(symbol_cache, all_symbols_looked_up): Delete.
(hexchars): New.
(ishex, unpack_varlen_hex, write_ptid, hex_or_minus_one,
read_ptid): New.
(prepare_resume_reply): Change ptid argument's type from unsigned
long to ptid_t. Adjust. Implement W;process and X;process.
(free_sym_cache, clear_symbol_cache): New.
(look_up_one_symbol): Adjust to per-process symbol cache. *
* server.c (cont_thread, general_thread, step_thread): Change type
to ptid_t.
(attached): Delete.
(multi_process): New.
(last_ptid): Change type to ptid_t.
(struct vstop_notif) <ptid>: Change type to ptid_t.
(queue_stop_reply, push_event): Change `ptid' argument's type to
ptid_t.
(discard_queued_stop_replies): Add `pid' argument.
(start_inferior): Adjust to use ptids. Adjust to mywait interface
changes. Don't reference the `attached' global.
(attach_inferior): Adjust to mywait interface changes.
(handle_query): Adjust to use ptids. Parse GDB's qSupported
features. Handle and report "multiprocess+". Handle
"qAttached:PID".
(handle_v_cont): Adjust to use ptids. Adjust to mywait interface
changes.
(handle_v_kill): New.
(handle_v_stopped): Adjust to use target_pid_to_str.
(handle_v_requests): Allow multiple attaches and runs when
multiprocess extensions are in effect. Handle "vKill".
(myresume): Adjust to use ptids.
(queue_stop_reply_callback): Add `arg' parameter. Handle it.
(handle_status): Adjust to discard_queued_stop_replies interface
change.
(first_thread_of, kill_inferior_callback)
(detach_or_kill_inferior_callback, join_inferiors_callback): New.
(main): Call initialize_inferiors. Adjust to use ptids, killing
and detaching from all inferiors. Handle multiprocess packet
variants.
* linux-low.h: Include gdb_proc_service.h.
(struct process_info_private): New.
(struct linux_target_ops) <pid_of>: Use ptid_get_pid.
<lwpid_of>: Use ptid_get_lwp.
(get_lwp_thread): Adjust.
(struct lwp_info): Add `dead' member.
(find_lwp_pid): Declare.
* linux-low.c (thread_db_active): Delete.
(new_inferior): Adjust comment.
(inferior_pid): Delete.
(linux_add_process): New.
(handle_extended_wait): Adjust.
(add_lwp): Change unsigned long to ptid.
(linux_create_inferior): Add process to processes table. Adjust
to use ptids. Don't set new_inferior here.
(linux_attach_lwp): Rename to ...
(linux_attach_lwp_1): ... this. Add `initial' argument. Handle
it. Adjust to use ptids.
(linux_attach_lwp): New.
(linux_attach): Add process to processes table. Don't set
new_inferior here.
(struct counter): New.
(second_thread_of_pid_p, last_thread_of_process_p): New.
(linux_kill_one_lwp): Add `args' parameter. Handle it. Adjust to
multiple processes.
(linux_kill): Add `pid' argument. Handle it. Adjust to multiple
processes. Remove process from process table.
(linux_detach_one_lwp): Add `args' parameter. Handle it. Adjust
to multiple processes.
(any_thread_of): New.
(linux_detach): Add `pid' argument, and handle it. Remove process
from processes table.
(linux_join): Add `pid' argument. Handle it.
(linux_thread_alive): Change unsighed long argument to ptid_t.
Consider dead lwps as not being alive.
(status_pending_p): Rename `dummy' argument to `arg'. Filter out
threads we're not interested in.
(same_lwp, find_lwp_pid): New.
(linux_wait_for_lwp): Change `pid' argument's type from int to
ptid_t. Adjust.
(linux_wait_for_event): Rename to ...
(linux_wait_for_event_1): ... this. Change `pid' argument's type
from int to ptid_t. Adjust.
(linux_wait_for_event): New.
(linux_wait_1): Add `ptid' argument. Change return type to
ptid_t. Adjust. Use last_thread_of_process_p. Remove processes
that exit from the process table.
(linux_wait): Add `ptid' argument. Change return type to ptid_t.
Adjust.
(mark_lwp_dead): New.
(wait_for_sigstop): Adjust to use ptids. If a process exits while
stopping all threads, mark its main lwp as dead.
(linux_set_resume_request, linux_resume_one_thread): Adjust to use
ptids.
(fetch_register, usr_store_inferior_registers)
(regsets_fetch_inferior_registers)
(regsets_store_inferior_registers, linux_read_memory)
(linux_write_memory): Inline `inferior_pid'.
(linux_look_up_symbols): Adjust to use per-process
`thread_db_active'.
(linux_request_interrupt): Adjust to use ptids.
(linux_read_auxv): Inline `inferior_pid'.
(initialize_low): Don't reference thread_db_active.
* gdb_proc_service.h (struct ps_prochandle) <pid>: Remove.
* proc-service.c (ps_lgetregs): Use find_lwp_pid.
(ps_getpid): Return the pid of the current inferior.
* thread-db.c (proc_handle, thread_agent): Delete.
(thread_db_create_event, thread_db_enable_reporting): Adjust to
per-process data.
(find_one_thread): Change argument type to ptid_t. Adjust to
per-process data.
(maybe_attach_thread): Adjust to per-process data and ptids.
(thread_db_find_new_threads): Ditto.
(thread_db_init): Ditto.
* spu-low.c (spu_create_inferior, spu_attach): Add process to
processes table. Adjust to use ptids.
(spu_kill, spu_detach): Adjust interface. Remove process from
processes table.
(spu_join, spu_thread_alive): Adjust interface.
(spu_wait): Adjust interface. Remove process from processes
table. Adjust to use ptids.
* win32-low.c (current_inferior_tid): Delete.
(current_inferior_ptid): New.
(debug_event_ptid): New.
(thread_rec): Take a ptid. Adjust.
(child_add_thread): Add `pid' argument. Adjust to use ptids.
(child_delete_thread): Ditto.
(do_initial_child_stuff): Add `attached' argument. Add process to
processes table.
(child_fetch_inferior_registers, child_store_inferior_registers):
Adjust.
(win32_create_inferior): Pass 0 to do_initial_child_stuff.
(win32_attach): Pass 1 to do_initial_child_stuff.
(win32_kill): Adjust interface. Remove process from processes
table.
(win32_detach): Ditto.
(win32_join): Adjust interface.
(win32_thread_alive): Take a ptid.
(win32_resume): Adjust to use ptids.
(get_child_debug_event): Ditto.
(win32_wait): Adjust interface. Remove exiting process from
processes table.
2009-04-02 00:50:24 +02:00
|
|
|
if (ptid_equal (inf->id, id))
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
return inf;
|
|
|
|
inf = inf->next;
|
2002-04-09 23:17:45 +02:00
|
|
|
}
|
|
|
|
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
return NULL;
|
2002-04-09 23:17:45 +02:00
|
|
|
}
|
2002-04-20 19:04:09 +02:00
|
|
|
|
|
|
|
void *
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
inferior_target_data (struct thread_info *inferior)
|
2002-04-20 19:04:09 +02:00
|
|
|
{
|
|
|
|
return inferior->target_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
set_inferior_target_data (struct thread_info *inferior, void *data)
|
2002-04-20 19:04:09 +02:00
|
|
|
{
|
|
|
|
inferior->target_data = data;
|
|
|
|
}
|
2002-04-20 19:22:48 +02:00
|
|
|
|
|
|
|
void *
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
inferior_regcache_data (struct thread_info *inferior)
|
2002-04-20 19:22:48 +02:00
|
|
|
{
|
|
|
|
return inferior->regcache_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
* gdbserver/proc-service.c: New file.
* gdbserver/acinclude.m4: New file.
* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
proc-service.o, and thread-db.o.
(linux-low.o): Add USE_THREAD_DB.
* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
* gdbserver/aclocal.m4: Regenerated.
* gdbserver/config.in: Regenerated.
* gdbserver/configure: Regenerated.
* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
thread_db.h, and linux/elf.h headrs.
Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
Check for -lthread_db and thread support.
* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
PowerPC, and SuperH.
* gdbserver/i387-fp.c: Constify arguments.
* gdbserver/i387-fp.h: Likewise.
* gdbserver/inferiors.c: (struct thread_info): Renamed from
`struct inferior_info'. Remove PID member. Use generic inferior
list header. All uses updated.
(inferiors, signal_pid): Removed.
(all_threads): New variable.
(get_thread): Define.
(add_inferior_to_list): New function.
(for_each_inferior): New function.
(change_inferior_id): New function.
(add_inferior): Removed.
(remove_inferior): New function.
(add_thread): New function.
(free_one_thread): New function.
(remove_thread): New function.
(clear_inferiors): Use for_each_inferior and free_one_thread.
(find_inferior): New function.
(find_inferior_id): New function.
(inferior_target_data): Update argument type.
(set_inferior_target_data): Likewise.
(inferior_regcache_data): Likewise.
(set_inferior_regcache_data): Likewise.
* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
(all_processes, stopping_threads, using_thrads)
(struct pending_signals, debug_threads, pid_of): New.
(inferior_pid): Replace with macro.
(struct inferior_linux_data): Remove.
(get_stop_pc, add_process): New functions.
(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
Use add_process and add_thread.
(linux_attach_lwp): New function, based on old linux_attach. Use
add_process and add_thread. Set stop_expected for new threads.
(linux_attach): New function.
(linux_kill_one_process): New function.
(linux_kill): Kill all LWPs.
(linux_thread_alive): Use find_inferior_id.
(check_removed_breakpoints, status_pending_p): New functions.
(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
Update. Use WNOHANG. Wait for cloned processes also. Update process
struct for the found process.
(linux_wait_for_event): New function.
(linux_wait): Use it. Support LWPs.
(send_sigstop, wait_for_sigstop, stop_all_processes)
(linux_resume_one_process, linux_continue_one_process): New functions.
(linux_resume): Support LWPs.
(REGISTER_RAW_SIZE): Remove.
(fetch_register): Use register_size instead. Call supply_register.
(usr_store_inferior_registers): Likewise. Call collect_register.
Fix recursive case.
(regsets_fetch_inferior_registers): Improve error message.
(regsets_store_inferior_registers): Add debugging.
(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
(unstopped_p, linux_signal_pid): New functions.
(linux_target_ops): Add linux_signal_pid.
(linux_init_signals): New function.
(initialize_low): Call it. Initialize using_threads.
* gdbserver/regcache.c (inferior_regcache_data): Add valid
flag.
(get_regcache): Fetch registers lazily. Add fetch argument
and update all callers.
(regcache_invalidate_one, regcache_invalidate): New
functions.
(new_register_cache): Renamed from create_register_cache.
Return the new regcache.
(free_register_cache): Change argument to a void *.
(registers_to_string, registers_from_string): Call get_regcache
with fetch flag set.
(register_data): Make static. Pass fetch flag to get_regcache.
(supply_register): Call get_regcache with fetch flag clear.
(collect_register): Call get_regcache with fetch flag set.
(collect_register_as_string): New function.
* gdbserver/regcache.h: Update.
* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
stderr.
Handle input interrupts while waiting for an ACK.
(input_interrupt): Use signal_pid method.
(getpkt): Flush after debug output and use stderr.
(outreg): Use collect_register_as_string.
(new_thread_notify, dead_thread_notify): New functions.
(prepare_resume_reply): Check using_threads. Set thread_from_wait
and general_thread.
(look_up_one_symbol): Flush after debug output.
* gdbserver/server.c (step_thread, server_waiting): New variables.
(start_inferior): Don't use signal_pid. Update call to mywait.
(attach_inferior): Update call to mywait.
(handle_query): Handle qfThreadInfo and qsThreadInfo.
(main): Don't fetch/store registers explicitly. Use
set_desired_inferior. Support proposed ``Hs'' packet. Update
calls to mywait.
* gdbserver/server.h: Update.
(struct inferior_list, struct_inferior_list_entry): New.
* gdbserver/target.c (set_desired_inferior): New.
(write_inferior_memory): Constify.
(mywait): New function.
* gdbserver/target.h: Update.
(struct target_ops): New signal_pid method.
(mywait): Removed macro, added prototype.
* gdbserver/linux-low.h (regset_func): Removed.
(regset_fill_func, regset_store_func): New.
(enum regset_type): New.
(struct regset_info): Add type field. Use new operation types.
(struct linux_target_ops): stop_pc renamed to get_pc.
Add decr_pc_after_break and breakpoint_at.
(get_process, get_thread_proess, get_process_thread)
(strut process_info, all_processes, linux_attach_lwp)
(thread_db_init): New.
* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
(i386_store_fpxregset): Constify.
(target_regsets): Add new kind identifier.
(i386_get_pc): Renamed from i386_stop_pc. Simplify.
(i386_set_pc): Add debugging.
(i386_breakpoint_at): New function.
(the_low_target): Add new members.
* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
(mips_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
(the_low_target): Add new members.
* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
identifier.
2002-06-11 19:32:40 +02:00
|
|
|
set_inferior_regcache_data (struct thread_info *inferior, void *data)
|
2002-04-20 19:22:48 +02:00
|
|
|
{
|
|
|
|
inferior->regcache_data = data;
|
|
|
|
}
|
2007-07-17 Pedro Alves <pedro_alves@portugalmail.pt>
Daniel Jacobowitz <dan@codesourcery.com>
* config/i386/cygwin.mt (TDEPFILES): Add solib-target.o.
* coff-pe-read.c (read_pe_exported_syms): Delete verbose
printf.
* NEWS: Mention gdbserver DLL support.
* gdb.base/unload.c (dlopen, dlsym, dlclose, dlerror): Define
for __WIN32__.
(SHLIB_NAME): Delete definition. Always pass dlerror to fprintf.
* gdb.base/unload.exp: Use shared library test routines.
* inferiors.c (all_dlls, dlls_changed, get_dll): New.
(add_thread): Minor cleanups.
(clear_inferiors): Move lower in the file. Clear the DLL
list.
(free_one_dll, match_dll, loaded_dll, unloaded_dll, clear_list): New.
* remote-utils.c (prepare_resume_reply): Check dlls_changed.
(xml_escape_text): New.
* server.c (handle_query): Handle qXfer:libraries:read. Report it
for qSupported.
(handle_v_cont): Report errors.
(gdbserver_version): Update.
(main): Correct size of own_buf. Do not report initial DLL events.
* server.h (struct dll_info, all_dlls, dlls_changed, loaded_dll)
(unloaded_dll, xml_escape_text): New.
* win32-low.c (enum target_waitkind): Update comments.
(win32_add_one_solib, get_image_name, winapi_EnumProcessModules)
(winapi_GetModuleInformation, winapi_GetModuleFileNameExA)
(win32_EnumProcessModules, win32_GetModuleInformation)
(win32_GetModuleFileNameExA, load_psapi, psapi_get_dll_name)
(winapi_CreateToolhelp32Snapshot, winapi_Module32First)
(winapi_Module32Next, win32_CreateToolhelp32Snapshot)
(win32_Module32First, win32_Module32Next, load_toolhelp)
(toolhelp_get_dll_name, handle_load_dll, handle_unload_dll): New.
(get_child_debug_event): Handle DLL events.
(win32_wait): Likewise.
2007-07-17 14:51:41 +02:00
|
|
|
|
|
|
|
#define clear_list(LIST) \
|
|
|
|
do { (LIST)->head = (LIST)->tail = NULL; } while (0)
|
|
|
|
|
|
|
|
void
|
|
|
|
clear_inferiors (void)
|
|
|
|
{
|
|
|
|
for_each_inferior (&all_threads, free_one_thread);
|
|
|
|
clear_list (&all_threads);
|
2012-02-16 11:38:15 +01:00
|
|
|
|
|
|
|
clear_dlls ();
|
ChangeLog:
* Makefile.in (ppc_linux_tdep_h): New macro.
(powerpc_32l_c, powerpc_altivec32_c, powerpc_altivec32l_c): Likewise.
(powerpc_64l_c, powerpc_altivec64_c, powerpc_altivec64l_c): Likewise.
(powerpc_e500l_c): Likewise.
(ppc-linux-nat.o): Update dependencies.
(ppc-linux-tdep.o): Update dependencies.
(rs6000-tdep.o): Update dependencies.
* ppc-tdep.h (ppc_linux_memory_remove_breakpoint): Remove.
(ppc_linux_svr4_fetch_link_map_offsets): Remove.
(ppc_linux_gregset, ppc_linux_fpregset): Move to ppc-linux-tdep.h
(ppc_supply_reg, ppc_collect_reg): Add prototypes.
(tdesc_powerpc_e500): Remove.
* rs6000.c: Include "features/rs6000/powerpc-altivec32.c"
and "features/rs6000/powerpc-altivec64.c".
(ppc_supply_reg, ppc_collect_reg): Make global.
(variants): Use tdesc_powerpc_32 for "powerpc" and
tdesc_powerpc_altivec64 for "powerpc64".
(_initialize_rs6000_tdep): Initialize AltiVec descriptions.
* ppc-linux-tdep.h: New file.
* ppc-linux-tdep.c: Include "ppc-linux-tdep.c".
Include "features/rs6000/powerpc-32l.c".
Include "features/rs6000/powerpc-altivec32l.c".
Include "features/rs6000/powerpc-64l.c".
Include "features/rs6000/powerpc-altivec64l.c".
Include "features/rs6000/powerpc-e500l.c".
(ppc_linux_supply_gregset): New function.
(ppc_linux_collect_gregset): Handle orig_r3 and trap registers.
(ppc32_linux_gregset): Use ppc_linux_supply_gregset.
(ppc64_linux_gregset): Likewise.
(ppc_linux_sigtramp_cache): Handle orig_r3 and trap registers.
(ppc_linux_trap_reg_p): New function.
(ppc_linux_write_pc): New function.
(ppc_linux_core_read_description): New function.
(ppc_linux_init_abi): Install ppc_linux_write_pc and
ppc_linux_core_read_description. Install orig_r3 and trap
registers if present in the target description.
(_initialize_ppc_linux_tdep): Initialize Linux target descriptions.
* ppc-linux-nat.c: Include "ppc-linux-tdep.h".
(PT_ORIG_R3, PT_TRAP): Define if necessary.
(ppc_register_u_addr): Handle orig_r3 and trap registers.
(fetch_ppc_registers): Likewise.
(store_ppc_registers): Likewise.
(store_register): Likewise.
(ppc_linux_read_description): Check whether AltiVec is supported.
Check whether inferior is 32-bit or 64-bit. Return the appropriate
Linux target description.
* features/Makefile (WHICH): Use rs6000/powerpc-32l and
rs6000/powerpc-altivec32l instead of rs6000/powerpc-32.
Use rs6000/powerpc-64l and rs6000/powerpc-altivec64l instead
of rs6000/powerpc-64. Use rs6000/powerpc-e500l instead of
rs6000/powerpc-e500. Update -expedite variables accordingly.
* features/rs6000/power-spe.xml: Use regnum 73 for "acc".
* features/rs6000/powerpc-32.xml: Do not include power-altivec.xml.
* features/rs6000/powerpc-64.xml: Do not include power-altivec.xml.
* features/rs6000/powerpc-e500.c: Regenerate.
* features/rs6000/powerpc-32.c: Regenerate.
* features/rs6000/powerpc-64.c: Regenerate.
* features/rs6000/power-linux.xml: New file.
* features/rs6000/power64-linux.xml: New file.
* features/rs6000/powerpc-32l.xml: New file.
* features/rs6000/powerpc-altivec32l.xml: New file.
* features/rs6000/powerpc-64l.xml: New file.
* features/rs6000/powerpc-altivec64l.xml: New file.
* features/rs6000/powerpc-e500l.xml: New file.
* features/rs6000/powerpc-32l.c: New (generated) file.
* features/rs6000/powerpc-altivec32l.c: New (generated) file.
* features/rs6000/powerpc-64l.c: New (generated) file.
* features/rs6000/powerpc-altivec64l.c: New (generated) file.
* features/rs6000/powerpc-e500l.xml: New (generated) file.
* regformats/reg-ppc.dat: Remove.
* regformats/reg-ppc64.dat: Remove.
* regformats/rs6000/powerpc-32.dat: Remove.
* regformats/rs6000/powerpc-64.dat: Remove.
* regformats/rs6000/powerpc-e500.dat: Remove.
* regformats/rs6000/powerpc-32l.dat: New (generated) file.
* regformats/rs6000/powerpc-altivec32l.dat: New (generated) file.
* regformats/rs6000/powerpc-64l.dat: New (generated) file.
* regformats/rs6000/powerpc-altivec64l.dat: New (generated) file.
* regformats/rs6000/powerpc-e500l.dat: New (generated) file.
gdbserver/ChangeLog:
* configure.srv (powerpc*-*-linux*): Set srv_regobj to
powerpc-32l.o, powerpc-altivec32l.o, powerpc-e500l.o,
powerpc-64l.o, and powerpc-altivec64l.o.
Remove rs6000/powerpc-32.xml, rs6000/powerpc-64.xml, and
rs6000/powerpc-e500.xml; add rs6000/powerpc-32l.xml,
rs6000/powerpc-altivec32l.xml, rs6000/powerpc-e500l.xml,
rs6000/powerpc-64l.xml, rs6000/powerpc-altivec64l.xml,
rs6000/power-linux.xml, and rs6000/power64-linux.xml
to srv_xmlfiles.
* Makefile.in (reg-ppc.o, reg-ppc.c): Remove, replace by ...
(powerpc-32l.o, powerpc-32l.c): ... these new rules.
(powerpc-32.o, powerpc-32.c): Remove, replace by ...
(powerpc-altivec32l.o, powerpc-altivec32l.c): ... these new rules.
(powerpc-e500.o, powerpc-e500.c): Remove, replace by ...
(powerpc-e500l.o, powerpc-e500l.c): ... these new rules.
(reg-ppc64.o, reg-ppc64.c): Remove, replace by ...
(powerpc-64l.o, powerpc-64l.c): ... these new rules.
(powerpc-64.o, powerpc-64.c): Remove, replace by ...
(powerpc-altivec64l.o, powerpc-altivec64l.c): ... these new rules.
(clean): Update.
* linux-ppc-low.c (init_registers_ppc): Remove, replace by ...
(init_registers_powerpc_32l): ... this new prototype.
(init_registers_powerpc_32): Remove, replace by ...
(init_registers_powerpc_altivec32l): ... this new prototype.
(init_registers_powerpc_e500): Remove, replace by ...
(init_registers_powerpc_e500l): ... this new prototype.
(init_registers_ppc64): Remove, replace by ...
(init_registers_powerpc_64l): ... this new prototype.
(init_registers_powerpc_64): Remove, replace by ...
(init_registers_powerpc_altivec64l): ... this new prototype.
(ppc_num_regs): Set to 73.
(PT_ORIG_R3, PT_TRAP): Define if necessary.
(ppc_regmap, ppc_regmap_e500): Add values for orig_r3 and trap.
(ppc_cannot_store_register): Handle orig_r3 and trap.
(ppc_arch_setup): Update init_registers_... calls.
(ppc_fill_gregset): Handle orig_r3 and trap.
* inferiors.c (clear_inferiors): Reset current_inferior.
2008-05-03 19:16:44 +02:00
|
|
|
|
|
|
|
current_inferior = NULL;
|
2007-07-17 Pedro Alves <pedro_alves@portugalmail.pt>
Daniel Jacobowitz <dan@codesourcery.com>
* config/i386/cygwin.mt (TDEPFILES): Add solib-target.o.
* coff-pe-read.c (read_pe_exported_syms): Delete verbose
printf.
* NEWS: Mention gdbserver DLL support.
* gdb.base/unload.c (dlopen, dlsym, dlclose, dlerror): Define
for __WIN32__.
(SHLIB_NAME): Delete definition. Always pass dlerror to fprintf.
* gdb.base/unload.exp: Use shared library test routines.
* inferiors.c (all_dlls, dlls_changed, get_dll): New.
(add_thread): Minor cleanups.
(clear_inferiors): Move lower in the file. Clear the DLL
list.
(free_one_dll, match_dll, loaded_dll, unloaded_dll, clear_list): New.
* remote-utils.c (prepare_resume_reply): Check dlls_changed.
(xml_escape_text): New.
* server.c (handle_query): Handle qXfer:libraries:read. Report it
for qSupported.
(handle_v_cont): Report errors.
(gdbserver_version): Update.
(main): Correct size of own_buf. Do not report initial DLL events.
* server.h (struct dll_info, all_dlls, dlls_changed, loaded_dll)
(unloaded_dll, xml_escape_text): New.
* win32-low.c (enum target_waitkind): Update comments.
(win32_add_one_solib, get_image_name, winapi_EnumProcessModules)
(winapi_GetModuleInformation, winapi_GetModuleFileNameExA)
(win32_EnumProcessModules, win32_GetModuleInformation)
(win32_GetModuleFileNameExA, load_psapi, psapi_get_dll_name)
(winapi_CreateToolhelp32Snapshot, winapi_Module32First)
(winapi_Module32Next, win32_CreateToolhelp32Snapshot)
(win32_Module32First, win32_Module32Next, load_toolhelp)
(toolhelp_get_dll_name, handle_load_dll, handle_unload_dll): New.
(get_child_debug_event): Handle DLL events.
(win32_wait): Likewise.
2007-07-17 14:51:41 +02:00
|
|
|
}
|
* inferiors.c (change_inferior_id): Delete.
(add_pid_to_list, pull_pid_from_list): New.
* linux-low.c (PTRACE_SETOPTIONS, PTRACE_GETEVENTMSG)
(PTRACE_O_TRACESYSGOOD, PTRACE_O_TRACEFORK, PTRACE_O_TRACEVFORK)
(PTRACE_O_TRACECLONE, PTRACE_O_TRACEEXEC, PTRACE_O_TRACEVFORKDONE)
(PTRACE_O_TRACEEXIT, PTRACE_EVENT_FORK, PTRACE_EVENT_VFORK)
(PTRACE_EVENT_CLONE, PTRACE_EVENT_EXEC, PTRACE_EVENT_VFORK_DONE)
(PTRACE_EVENT_EXIT, __WALL): Provide default definitions.
(stopped_pids, thread_db_active, must_set_ptrace_flags): New variables.
(using_threads): Always set to 1.
(handle_extended_wait): New.
(add_process): Do not set TID.
(linux_create_inferior): Set must_set_ptrace_flags.
(linux_attach_lwp): Remove TID argument. Do not check using_threads.
Use PTRACE_SETOPTIONS. Call new_thread_notify. Update all callers.
(linux_thread_alive): Rename TID argument to LWPID.
(linux_wait_for_process): Handle unknown processes. Do not use TID.
(linux_wait_for_event): Do not use TID or check using_threads. Update
call to dead_thread_notify. Call handle_extended_wait.
(linux_create_inferior): Use PTRACE_SETOPTIONS.
(send_sigstop): Delete sigstop_sent.
(wait_for_sigstop): Avoid TID.
(linux_supports_tracefork_flag, linux_tracefork_child, my_waitpid)
(linux_test_for_tracefork): New.
(linux_lookup_signals): Use thread_db_active and
linux_supports_tracefork_flag.
(initialize_low): Use thread_db_active and linux_test_for_tracefork.
* linux-low.h (get_process_thread): Avoid TID.
(struct process_ifo): Move thread_known and tid to the end. Remove
sigstop_sent.
(linux_attach_lwp, thread_db_init): Update prototypes.
* server.h (change_inferior_id): Delete prototype.
(add_pid_to_list, pull_pid_from_list): New prototypes.
* thread-db.c (thread_db_use_events): New.
(find_first_thread): Rename to...
(find_one_thread): ...this. Update callers and messages. Do not
call fatal. Check thread_db_use_events. Do not call
change_inferior_id or new_thread_notify.
(maybe_attach_thread): Update. Do not call new_thread_notify.
(thread_db_init): Set thread_db_use_events. Check use_events.
* utils.c (fatal, warning): Correct message prefix.
2007-10-23 22:05:03 +02:00
|
|
|
|
2009-04-01 Pedro Alves <pedro@codesourcery.com>
Implement the multiprocess extensions, and add linux multiprocess
support.
* server.h (ULONGEST): Declare.
(struct ptid, ptid_t): New.
(minus_one_ptid, null_ptid): Declare.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): Declare.
(struct inferior_list_entry): Change `id' type from unsigned from
to ptid_t.
(struct sym_cache, struct breakpoint, struct
process_info_private): Forward declare.
(struct process_info): Declare.
(current_process): Declare.
(all_processes): Declare.
(initialize_inferiors): Declare.
(add_thread): Adjust to use ptid_t.
(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): Ditto.
(add_process, remove_process, find_thread_pid): Declare.
(find_inferior_id): Adjust to use ptid_t.
(cont_thread, general_thread, step_thread): Change type to ptid_t.
(multi_process): Declare.
(push_event): Adjust to use ptid_t.
(read_ptid, write_ptid): Declare.
(prepare_resume_reply): Adjust to use ptid_t.
(clear_symbol_cache): Declare.
* inferiors.c (all_processes): New.
(null_ptid, minus_one_ptid): New.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): New.
(add_thread): Change unsigned long to ptid. Remove gdb_id
parameter. Adjust.
(thread_id_to_gdb_id, thread_to_gdb_id): Change unsigned long to ptid.
(gdb_id_to_thread): Rename to ...
(find_thread_pid): ... this. Change unsigned long to ptid.
(gdb_id_to_thread_id, find_inferior_id): Change unsigned long to ptid.
(loaded_dll, pull_pid_from_list): Adjust.
(add_process, remove_process, find_process_pid)
(get_thread_process, current_process, initialize_inferiors): New.
* target.h (struct thread_resume) <thread>: Change type to ptid_t.
(struct target_waitstatus) <related_pid>: Ditto.
(struct target_ops) <kill, detach>: Add `pid' argument. Change
return type to int.
(struct target_ops) <join>: Add `pid' argument.
(struct target_ops) <thread_alive>: Change pid's type to ptid_t.
(struct target_ops) <wait>: Add `ptid' field. Change return type
to ptid.
(kill_inferior, detach_inferior, join_inferior): Add `pid' argument.
(mywait): Add `ptid' argument. Change return type to ptid_t.
(target_pid_to_str): Declare.
* target.c (set_desired_inferior): Adjust to use ptids.
(mywait): Add new `ptid' argument. Adjust.
(target_pid_to_str): New.
* mem-break.h (free_all_breakpoints): Declare.
* mem-break.c (breakpoints): Delelete.
(set_breakpoint_at, delete_breakpoint, find_breakpoint_at)
(check_mem_read, check_mem_write, delete_all_breakpoints): Adjust
to use per-process breakpoint list.
(free_all_breakpoints): New.
* remote-utils.c (struct sym_cache) <name>: Drop `const'.
(symbol_cache, all_symbols_looked_up): Delete.
(hexchars): New.
(ishex, unpack_varlen_hex, write_ptid, hex_or_minus_one,
read_ptid): New.
(prepare_resume_reply): Change ptid argument's type from unsigned
long to ptid_t. Adjust. Implement W;process and X;process.
(free_sym_cache, clear_symbol_cache): New.
(look_up_one_symbol): Adjust to per-process symbol cache. *
* server.c (cont_thread, general_thread, step_thread): Change type
to ptid_t.
(attached): Delete.
(multi_process): New.
(last_ptid): Change type to ptid_t.
(struct vstop_notif) <ptid>: Change type to ptid_t.
(queue_stop_reply, push_event): Change `ptid' argument's type to
ptid_t.
(discard_queued_stop_replies): Add `pid' argument.
(start_inferior): Adjust to use ptids. Adjust to mywait interface
changes. Don't reference the `attached' global.
(attach_inferior): Adjust to mywait interface changes.
(handle_query): Adjust to use ptids. Parse GDB's qSupported
features. Handle and report "multiprocess+". Handle
"qAttached:PID".
(handle_v_cont): Adjust to use ptids. Adjust to mywait interface
changes.
(handle_v_kill): New.
(handle_v_stopped): Adjust to use target_pid_to_str.
(handle_v_requests): Allow multiple attaches and runs when
multiprocess extensions are in effect. Handle "vKill".
(myresume): Adjust to use ptids.
(queue_stop_reply_callback): Add `arg' parameter. Handle it.
(handle_status): Adjust to discard_queued_stop_replies interface
change.
(first_thread_of, kill_inferior_callback)
(detach_or_kill_inferior_callback, join_inferiors_callback): New.
(main): Call initialize_inferiors. Adjust to use ptids, killing
and detaching from all inferiors. Handle multiprocess packet
variants.
* linux-low.h: Include gdb_proc_service.h.
(struct process_info_private): New.
(struct linux_target_ops) <pid_of>: Use ptid_get_pid.
<lwpid_of>: Use ptid_get_lwp.
(get_lwp_thread): Adjust.
(struct lwp_info): Add `dead' member.
(find_lwp_pid): Declare.
* linux-low.c (thread_db_active): Delete.
(new_inferior): Adjust comment.
(inferior_pid): Delete.
(linux_add_process): New.
(handle_extended_wait): Adjust.
(add_lwp): Change unsigned long to ptid.
(linux_create_inferior): Add process to processes table. Adjust
to use ptids. Don't set new_inferior here.
(linux_attach_lwp): Rename to ...
(linux_attach_lwp_1): ... this. Add `initial' argument. Handle
it. Adjust to use ptids.
(linux_attach_lwp): New.
(linux_attach): Add process to processes table. Don't set
new_inferior here.
(struct counter): New.
(second_thread_of_pid_p, last_thread_of_process_p): New.
(linux_kill_one_lwp): Add `args' parameter. Handle it. Adjust to
multiple processes.
(linux_kill): Add `pid' argument. Handle it. Adjust to multiple
processes. Remove process from process table.
(linux_detach_one_lwp): Add `args' parameter. Handle it. Adjust
to multiple processes.
(any_thread_of): New.
(linux_detach): Add `pid' argument, and handle it. Remove process
from processes table.
(linux_join): Add `pid' argument. Handle it.
(linux_thread_alive): Change unsighed long argument to ptid_t.
Consider dead lwps as not being alive.
(status_pending_p): Rename `dummy' argument to `arg'. Filter out
threads we're not interested in.
(same_lwp, find_lwp_pid): New.
(linux_wait_for_lwp): Change `pid' argument's type from int to
ptid_t. Adjust.
(linux_wait_for_event): Rename to ...
(linux_wait_for_event_1): ... this. Change `pid' argument's type
from int to ptid_t. Adjust.
(linux_wait_for_event): New.
(linux_wait_1): Add `ptid' argument. Change return type to
ptid_t. Adjust. Use last_thread_of_process_p. Remove processes
that exit from the process table.
(linux_wait): Add `ptid' argument. Change return type to ptid_t.
Adjust.
(mark_lwp_dead): New.
(wait_for_sigstop): Adjust to use ptids. If a process exits while
stopping all threads, mark its main lwp as dead.
(linux_set_resume_request, linux_resume_one_thread): Adjust to use
ptids.
(fetch_register, usr_store_inferior_registers)
(regsets_fetch_inferior_registers)
(regsets_store_inferior_registers, linux_read_memory)
(linux_write_memory): Inline `inferior_pid'.
(linux_look_up_symbols): Adjust to use per-process
`thread_db_active'.
(linux_request_interrupt): Adjust to use ptids.
(linux_read_auxv): Inline `inferior_pid'.
(initialize_low): Don't reference thread_db_active.
* gdb_proc_service.h (struct ps_prochandle) <pid>: Remove.
* proc-service.c (ps_lgetregs): Use find_lwp_pid.
(ps_getpid): Return the pid of the current inferior.
* thread-db.c (proc_handle, thread_agent): Delete.
(thread_db_create_event, thread_db_enable_reporting): Adjust to
per-process data.
(find_one_thread): Change argument type to ptid_t. Adjust to
per-process data.
(maybe_attach_thread): Adjust to per-process data and ptids.
(thread_db_find_new_threads): Ditto.
(thread_db_init): Ditto.
* spu-low.c (spu_create_inferior, spu_attach): Add process to
processes table. Adjust to use ptids.
(spu_kill, spu_detach): Adjust interface. Remove process from
processes table.
(spu_join, spu_thread_alive): Adjust interface.
(spu_wait): Adjust interface. Remove process from processes
table. Adjust to use ptids.
* win32-low.c (current_inferior_tid): Delete.
(current_inferior_ptid): New.
(debug_event_ptid): New.
(thread_rec): Take a ptid. Adjust.
(child_add_thread): Add `pid' argument. Adjust to use ptids.
(child_delete_thread): Ditto.
(do_initial_child_stuff): Add `attached' argument. Add process to
processes table.
(child_fetch_inferior_registers, child_store_inferior_registers):
Adjust.
(win32_create_inferior): Pass 0 to do_initial_child_stuff.
(win32_attach): Pass 1 to do_initial_child_stuff.
(win32_kill): Adjust interface. Remove process from processes
table.
(win32_detach): Ditto.
(win32_join): Adjust interface.
(win32_thread_alive): Take a ptid.
(win32_resume): Adjust to use ptids.
(get_child_debug_event): Ditto.
(win32_wait): Adjust interface. Remove exiting process from
processes table.
2009-04-02 00:50:24 +02:00
|
|
|
struct process_info *
|
|
|
|
add_process (int pid, int attached)
|
|
|
|
{
|
|
|
|
struct process_info *process;
|
|
|
|
|
|
|
|
process = xcalloc (1, sizeof (*process));
|
|
|
|
|
|
|
|
process->head.id = pid_to_ptid (pid);
|
|
|
|
process->attached = attached;
|
|
|
|
|
|
|
|
add_inferior_to_list (&all_processes, &process->head);
|
|
|
|
|
|
|
|
return process;
|
|
|
|
}
|
|
|
|
|
2009-04-30 20:35:55 +02:00
|
|
|
/* Remove a process from the common process list and free the memory
|
|
|
|
allocated for it.
|
|
|
|
The caller is responsible for freeing private data first. */
|
|
|
|
|
2009-04-01 Pedro Alves <pedro@codesourcery.com>
Implement the multiprocess extensions, and add linux multiprocess
support.
* server.h (ULONGEST): Declare.
(struct ptid, ptid_t): New.
(minus_one_ptid, null_ptid): Declare.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): Declare.
(struct inferior_list_entry): Change `id' type from unsigned from
to ptid_t.
(struct sym_cache, struct breakpoint, struct
process_info_private): Forward declare.
(struct process_info): Declare.
(current_process): Declare.
(all_processes): Declare.
(initialize_inferiors): Declare.
(add_thread): Adjust to use ptid_t.
(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): Ditto.
(add_process, remove_process, find_thread_pid): Declare.
(find_inferior_id): Adjust to use ptid_t.
(cont_thread, general_thread, step_thread): Change type to ptid_t.
(multi_process): Declare.
(push_event): Adjust to use ptid_t.
(read_ptid, write_ptid): Declare.
(prepare_resume_reply): Adjust to use ptid_t.
(clear_symbol_cache): Declare.
* inferiors.c (all_processes): New.
(null_ptid, minus_one_ptid): New.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): New.
(add_thread): Change unsigned long to ptid. Remove gdb_id
parameter. Adjust.
(thread_id_to_gdb_id, thread_to_gdb_id): Change unsigned long to ptid.
(gdb_id_to_thread): Rename to ...
(find_thread_pid): ... this. Change unsigned long to ptid.
(gdb_id_to_thread_id, find_inferior_id): Change unsigned long to ptid.
(loaded_dll, pull_pid_from_list): Adjust.
(add_process, remove_process, find_process_pid)
(get_thread_process, current_process, initialize_inferiors): New.
* target.h (struct thread_resume) <thread>: Change type to ptid_t.
(struct target_waitstatus) <related_pid>: Ditto.
(struct target_ops) <kill, detach>: Add `pid' argument. Change
return type to int.
(struct target_ops) <join>: Add `pid' argument.
(struct target_ops) <thread_alive>: Change pid's type to ptid_t.
(struct target_ops) <wait>: Add `ptid' field. Change return type
to ptid.
(kill_inferior, detach_inferior, join_inferior): Add `pid' argument.
(mywait): Add `ptid' argument. Change return type to ptid_t.
(target_pid_to_str): Declare.
* target.c (set_desired_inferior): Adjust to use ptids.
(mywait): Add new `ptid' argument. Adjust.
(target_pid_to_str): New.
* mem-break.h (free_all_breakpoints): Declare.
* mem-break.c (breakpoints): Delelete.
(set_breakpoint_at, delete_breakpoint, find_breakpoint_at)
(check_mem_read, check_mem_write, delete_all_breakpoints): Adjust
to use per-process breakpoint list.
(free_all_breakpoints): New.
* remote-utils.c (struct sym_cache) <name>: Drop `const'.
(symbol_cache, all_symbols_looked_up): Delete.
(hexchars): New.
(ishex, unpack_varlen_hex, write_ptid, hex_or_minus_one,
read_ptid): New.
(prepare_resume_reply): Change ptid argument's type from unsigned
long to ptid_t. Adjust. Implement W;process and X;process.
(free_sym_cache, clear_symbol_cache): New.
(look_up_one_symbol): Adjust to per-process symbol cache. *
* server.c (cont_thread, general_thread, step_thread): Change type
to ptid_t.
(attached): Delete.
(multi_process): New.
(last_ptid): Change type to ptid_t.
(struct vstop_notif) <ptid>: Change type to ptid_t.
(queue_stop_reply, push_event): Change `ptid' argument's type to
ptid_t.
(discard_queued_stop_replies): Add `pid' argument.
(start_inferior): Adjust to use ptids. Adjust to mywait interface
changes. Don't reference the `attached' global.
(attach_inferior): Adjust to mywait interface changes.
(handle_query): Adjust to use ptids. Parse GDB's qSupported
features. Handle and report "multiprocess+". Handle
"qAttached:PID".
(handle_v_cont): Adjust to use ptids. Adjust to mywait interface
changes.
(handle_v_kill): New.
(handle_v_stopped): Adjust to use target_pid_to_str.
(handle_v_requests): Allow multiple attaches and runs when
multiprocess extensions are in effect. Handle "vKill".
(myresume): Adjust to use ptids.
(queue_stop_reply_callback): Add `arg' parameter. Handle it.
(handle_status): Adjust to discard_queued_stop_replies interface
change.
(first_thread_of, kill_inferior_callback)
(detach_or_kill_inferior_callback, join_inferiors_callback): New.
(main): Call initialize_inferiors. Adjust to use ptids, killing
and detaching from all inferiors. Handle multiprocess packet
variants.
* linux-low.h: Include gdb_proc_service.h.
(struct process_info_private): New.
(struct linux_target_ops) <pid_of>: Use ptid_get_pid.
<lwpid_of>: Use ptid_get_lwp.
(get_lwp_thread): Adjust.
(struct lwp_info): Add `dead' member.
(find_lwp_pid): Declare.
* linux-low.c (thread_db_active): Delete.
(new_inferior): Adjust comment.
(inferior_pid): Delete.
(linux_add_process): New.
(handle_extended_wait): Adjust.
(add_lwp): Change unsigned long to ptid.
(linux_create_inferior): Add process to processes table. Adjust
to use ptids. Don't set new_inferior here.
(linux_attach_lwp): Rename to ...
(linux_attach_lwp_1): ... this. Add `initial' argument. Handle
it. Adjust to use ptids.
(linux_attach_lwp): New.
(linux_attach): Add process to processes table. Don't set
new_inferior here.
(struct counter): New.
(second_thread_of_pid_p, last_thread_of_process_p): New.
(linux_kill_one_lwp): Add `args' parameter. Handle it. Adjust to
multiple processes.
(linux_kill): Add `pid' argument. Handle it. Adjust to multiple
processes. Remove process from process table.
(linux_detach_one_lwp): Add `args' parameter. Handle it. Adjust
to multiple processes.
(any_thread_of): New.
(linux_detach): Add `pid' argument, and handle it. Remove process
from processes table.
(linux_join): Add `pid' argument. Handle it.
(linux_thread_alive): Change unsighed long argument to ptid_t.
Consider dead lwps as not being alive.
(status_pending_p): Rename `dummy' argument to `arg'. Filter out
threads we're not interested in.
(same_lwp, find_lwp_pid): New.
(linux_wait_for_lwp): Change `pid' argument's type from int to
ptid_t. Adjust.
(linux_wait_for_event): Rename to ...
(linux_wait_for_event_1): ... this. Change `pid' argument's type
from int to ptid_t. Adjust.
(linux_wait_for_event): New.
(linux_wait_1): Add `ptid' argument. Change return type to
ptid_t. Adjust. Use last_thread_of_process_p. Remove processes
that exit from the process table.
(linux_wait): Add `ptid' argument. Change return type to ptid_t.
Adjust.
(mark_lwp_dead): New.
(wait_for_sigstop): Adjust to use ptids. If a process exits while
stopping all threads, mark its main lwp as dead.
(linux_set_resume_request, linux_resume_one_thread): Adjust to use
ptids.
(fetch_register, usr_store_inferior_registers)
(regsets_fetch_inferior_registers)
(regsets_store_inferior_registers, linux_read_memory)
(linux_write_memory): Inline `inferior_pid'.
(linux_look_up_symbols): Adjust to use per-process
`thread_db_active'.
(linux_request_interrupt): Adjust to use ptids.
(linux_read_auxv): Inline `inferior_pid'.
(initialize_low): Don't reference thread_db_active.
* gdb_proc_service.h (struct ps_prochandle) <pid>: Remove.
* proc-service.c (ps_lgetregs): Use find_lwp_pid.
(ps_getpid): Return the pid of the current inferior.
* thread-db.c (proc_handle, thread_agent): Delete.
(thread_db_create_event, thread_db_enable_reporting): Adjust to
per-process data.
(find_one_thread): Change argument type to ptid_t. Adjust to
per-process data.
(maybe_attach_thread): Adjust to per-process data and ptids.
(thread_db_find_new_threads): Ditto.
(thread_db_init): Ditto.
* spu-low.c (spu_create_inferior, spu_attach): Add process to
processes table. Adjust to use ptids.
(spu_kill, spu_detach): Adjust interface. Remove process from
processes table.
(spu_join, spu_thread_alive): Adjust interface.
(spu_wait): Adjust interface. Remove process from processes
table. Adjust to use ptids.
* win32-low.c (current_inferior_tid): Delete.
(current_inferior_ptid): New.
(debug_event_ptid): New.
(thread_rec): Take a ptid. Adjust.
(child_add_thread): Add `pid' argument. Adjust to use ptids.
(child_delete_thread): Ditto.
(do_initial_child_stuff): Add `attached' argument. Add process to
processes table.
(child_fetch_inferior_registers, child_store_inferior_registers):
Adjust.
(win32_create_inferior): Pass 0 to do_initial_child_stuff.
(win32_attach): Pass 1 to do_initial_child_stuff.
(win32_kill): Adjust interface. Remove process from processes
table.
(win32_detach): Ditto.
(win32_join): Adjust interface.
(win32_thread_alive): Take a ptid.
(win32_resume): Adjust to use ptids.
(get_child_debug_event): Ditto.
(win32_wait): Adjust interface. Remove exiting process from
processes table.
2009-04-02 00:50:24 +02:00
|
|
|
void
|
|
|
|
remove_process (struct process_info *process)
|
|
|
|
{
|
|
|
|
clear_symbol_cache (&process->symbol_cache);
|
|
|
|
free_all_breakpoints (process);
|
|
|
|
remove_inferior (&all_processes, &process->head);
|
2009-04-30 20:35:55 +02:00
|
|
|
free (process);
|
2009-04-01 Pedro Alves <pedro@codesourcery.com>
Implement the multiprocess extensions, and add linux multiprocess
support.
* server.h (ULONGEST): Declare.
(struct ptid, ptid_t): New.
(minus_one_ptid, null_ptid): Declare.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): Declare.
(struct inferior_list_entry): Change `id' type from unsigned from
to ptid_t.
(struct sym_cache, struct breakpoint, struct
process_info_private): Forward declare.
(struct process_info): Declare.
(current_process): Declare.
(all_processes): Declare.
(initialize_inferiors): Declare.
(add_thread): Adjust to use ptid_t.
(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): Ditto.
(add_process, remove_process, find_thread_pid): Declare.
(find_inferior_id): Adjust to use ptid_t.
(cont_thread, general_thread, step_thread): Change type to ptid_t.
(multi_process): Declare.
(push_event): Adjust to use ptid_t.
(read_ptid, write_ptid): Declare.
(prepare_resume_reply): Adjust to use ptid_t.
(clear_symbol_cache): Declare.
* inferiors.c (all_processes): New.
(null_ptid, minus_one_ptid): New.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): New.
(add_thread): Change unsigned long to ptid. Remove gdb_id
parameter. Adjust.
(thread_id_to_gdb_id, thread_to_gdb_id): Change unsigned long to ptid.
(gdb_id_to_thread): Rename to ...
(find_thread_pid): ... this. Change unsigned long to ptid.
(gdb_id_to_thread_id, find_inferior_id): Change unsigned long to ptid.
(loaded_dll, pull_pid_from_list): Adjust.
(add_process, remove_process, find_process_pid)
(get_thread_process, current_process, initialize_inferiors): New.
* target.h (struct thread_resume) <thread>: Change type to ptid_t.
(struct target_waitstatus) <related_pid>: Ditto.
(struct target_ops) <kill, detach>: Add `pid' argument. Change
return type to int.
(struct target_ops) <join>: Add `pid' argument.
(struct target_ops) <thread_alive>: Change pid's type to ptid_t.
(struct target_ops) <wait>: Add `ptid' field. Change return type
to ptid.
(kill_inferior, detach_inferior, join_inferior): Add `pid' argument.
(mywait): Add `ptid' argument. Change return type to ptid_t.
(target_pid_to_str): Declare.
* target.c (set_desired_inferior): Adjust to use ptids.
(mywait): Add new `ptid' argument. Adjust.
(target_pid_to_str): New.
* mem-break.h (free_all_breakpoints): Declare.
* mem-break.c (breakpoints): Delelete.
(set_breakpoint_at, delete_breakpoint, find_breakpoint_at)
(check_mem_read, check_mem_write, delete_all_breakpoints): Adjust
to use per-process breakpoint list.
(free_all_breakpoints): New.
* remote-utils.c (struct sym_cache) <name>: Drop `const'.
(symbol_cache, all_symbols_looked_up): Delete.
(hexchars): New.
(ishex, unpack_varlen_hex, write_ptid, hex_or_minus_one,
read_ptid): New.
(prepare_resume_reply): Change ptid argument's type from unsigned
long to ptid_t. Adjust. Implement W;process and X;process.
(free_sym_cache, clear_symbol_cache): New.
(look_up_one_symbol): Adjust to per-process symbol cache. *
* server.c (cont_thread, general_thread, step_thread): Change type
to ptid_t.
(attached): Delete.
(multi_process): New.
(last_ptid): Change type to ptid_t.
(struct vstop_notif) <ptid>: Change type to ptid_t.
(queue_stop_reply, push_event): Change `ptid' argument's type to
ptid_t.
(discard_queued_stop_replies): Add `pid' argument.
(start_inferior): Adjust to use ptids. Adjust to mywait interface
changes. Don't reference the `attached' global.
(attach_inferior): Adjust to mywait interface changes.
(handle_query): Adjust to use ptids. Parse GDB's qSupported
features. Handle and report "multiprocess+". Handle
"qAttached:PID".
(handle_v_cont): Adjust to use ptids. Adjust to mywait interface
changes.
(handle_v_kill): New.
(handle_v_stopped): Adjust to use target_pid_to_str.
(handle_v_requests): Allow multiple attaches and runs when
multiprocess extensions are in effect. Handle "vKill".
(myresume): Adjust to use ptids.
(queue_stop_reply_callback): Add `arg' parameter. Handle it.
(handle_status): Adjust to discard_queued_stop_replies interface
change.
(first_thread_of, kill_inferior_callback)
(detach_or_kill_inferior_callback, join_inferiors_callback): New.
(main): Call initialize_inferiors. Adjust to use ptids, killing
and detaching from all inferiors. Handle multiprocess packet
variants.
* linux-low.h: Include gdb_proc_service.h.
(struct process_info_private): New.
(struct linux_target_ops) <pid_of>: Use ptid_get_pid.
<lwpid_of>: Use ptid_get_lwp.
(get_lwp_thread): Adjust.
(struct lwp_info): Add `dead' member.
(find_lwp_pid): Declare.
* linux-low.c (thread_db_active): Delete.
(new_inferior): Adjust comment.
(inferior_pid): Delete.
(linux_add_process): New.
(handle_extended_wait): Adjust.
(add_lwp): Change unsigned long to ptid.
(linux_create_inferior): Add process to processes table. Adjust
to use ptids. Don't set new_inferior here.
(linux_attach_lwp): Rename to ...
(linux_attach_lwp_1): ... this. Add `initial' argument. Handle
it. Adjust to use ptids.
(linux_attach_lwp): New.
(linux_attach): Add process to processes table. Don't set
new_inferior here.
(struct counter): New.
(second_thread_of_pid_p, last_thread_of_process_p): New.
(linux_kill_one_lwp): Add `args' parameter. Handle it. Adjust to
multiple processes.
(linux_kill): Add `pid' argument. Handle it. Adjust to multiple
processes. Remove process from process table.
(linux_detach_one_lwp): Add `args' parameter. Handle it. Adjust
to multiple processes.
(any_thread_of): New.
(linux_detach): Add `pid' argument, and handle it. Remove process
from processes table.
(linux_join): Add `pid' argument. Handle it.
(linux_thread_alive): Change unsighed long argument to ptid_t.
Consider dead lwps as not being alive.
(status_pending_p): Rename `dummy' argument to `arg'. Filter out
threads we're not interested in.
(same_lwp, find_lwp_pid): New.
(linux_wait_for_lwp): Change `pid' argument's type from int to
ptid_t. Adjust.
(linux_wait_for_event): Rename to ...
(linux_wait_for_event_1): ... this. Change `pid' argument's type
from int to ptid_t. Adjust.
(linux_wait_for_event): New.
(linux_wait_1): Add `ptid' argument. Change return type to
ptid_t. Adjust. Use last_thread_of_process_p. Remove processes
that exit from the process table.
(linux_wait): Add `ptid' argument. Change return type to ptid_t.
Adjust.
(mark_lwp_dead): New.
(wait_for_sigstop): Adjust to use ptids. If a process exits while
stopping all threads, mark its main lwp as dead.
(linux_set_resume_request, linux_resume_one_thread): Adjust to use
ptids.
(fetch_register, usr_store_inferior_registers)
(regsets_fetch_inferior_registers)
(regsets_store_inferior_registers, linux_read_memory)
(linux_write_memory): Inline `inferior_pid'.
(linux_look_up_symbols): Adjust to use per-process
`thread_db_active'.
(linux_request_interrupt): Adjust to use ptids.
(linux_read_auxv): Inline `inferior_pid'.
(initialize_low): Don't reference thread_db_active.
* gdb_proc_service.h (struct ps_prochandle) <pid>: Remove.
* proc-service.c (ps_lgetregs): Use find_lwp_pid.
(ps_getpid): Return the pid of the current inferior.
* thread-db.c (proc_handle, thread_agent): Delete.
(thread_db_create_event, thread_db_enable_reporting): Adjust to
per-process data.
(find_one_thread): Change argument type to ptid_t. Adjust to
per-process data.
(maybe_attach_thread): Adjust to per-process data and ptids.
(thread_db_find_new_threads): Ditto.
(thread_db_init): Ditto.
* spu-low.c (spu_create_inferior, spu_attach): Add process to
processes table. Adjust to use ptids.
(spu_kill, spu_detach): Adjust interface. Remove process from
processes table.
(spu_join, spu_thread_alive): Adjust interface.
(spu_wait): Adjust interface. Remove process from processes
table. Adjust to use ptids.
* win32-low.c (current_inferior_tid): Delete.
(current_inferior_ptid): New.
(debug_event_ptid): New.
(thread_rec): Take a ptid. Adjust.
(child_add_thread): Add `pid' argument. Adjust to use ptids.
(child_delete_thread): Ditto.
(do_initial_child_stuff): Add `attached' argument. Add process to
processes table.
(child_fetch_inferior_registers, child_store_inferior_registers):
Adjust.
(win32_create_inferior): Pass 0 to do_initial_child_stuff.
(win32_attach): Pass 1 to do_initial_child_stuff.
(win32_kill): Adjust interface. Remove process from processes
table.
(win32_detach): Ditto.
(win32_join): Adjust interface.
(win32_thread_alive): Take a ptid.
(win32_resume): Adjust to use ptids.
(get_child_debug_event): Ditto.
(win32_wait): Adjust interface. Remove exiting process from
processes table.
2009-04-02 00:50:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
struct process_info *
|
|
|
|
find_process_pid (int pid)
|
|
|
|
{
|
|
|
|
return (struct process_info *)
|
|
|
|
find_inferior_id (&all_processes, pid_to_ptid (pid));
|
|
|
|
}
|
|
|
|
|
2009-05-01 00:21:06 +02:00
|
|
|
/* Return non-zero if INF, a struct process_info, was started by us,
|
|
|
|
i.e. not attached to. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
started_inferior_callback (struct inferior_list_entry *entry, void *args)
|
|
|
|
{
|
|
|
|
struct process_info *process = (struct process_info *) entry;
|
|
|
|
|
|
|
|
return ! process->attached;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return non-zero if there are any inferiors that we have created
|
|
|
|
(as opposed to attached-to). */
|
|
|
|
|
|
|
|
int
|
|
|
|
have_started_inferiors_p (void)
|
|
|
|
{
|
|
|
|
return (find_inferior (&all_processes, started_inferior_callback, NULL)
|
|
|
|
!= NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return non-zero if INF, a struct process_info, was attached to. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
attached_inferior_callback (struct inferior_list_entry *entry, void *args)
|
|
|
|
{
|
|
|
|
struct process_info *process = (struct process_info *) entry;
|
|
|
|
|
|
|
|
return process->attached;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return non-zero if there are any inferiors that we have attached to. */
|
|
|
|
|
|
|
|
int
|
|
|
|
have_attached_inferiors_p (void)
|
|
|
|
{
|
|
|
|
return (find_inferior (&all_processes, attached_inferior_callback, NULL)
|
|
|
|
!= NULL);
|
|
|
|
}
|
|
|
|
|
2009-04-03 22:15:51 +02:00
|
|
|
struct process_info *
|
2009-04-01 Pedro Alves <pedro@codesourcery.com>
Implement the multiprocess extensions, and add linux multiprocess
support.
* server.h (ULONGEST): Declare.
(struct ptid, ptid_t): New.
(minus_one_ptid, null_ptid): Declare.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): Declare.
(struct inferior_list_entry): Change `id' type from unsigned from
to ptid_t.
(struct sym_cache, struct breakpoint, struct
process_info_private): Forward declare.
(struct process_info): Declare.
(current_process): Declare.
(all_processes): Declare.
(initialize_inferiors): Declare.
(add_thread): Adjust to use ptid_t.
(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): Ditto.
(add_process, remove_process, find_thread_pid): Declare.
(find_inferior_id): Adjust to use ptid_t.
(cont_thread, general_thread, step_thread): Change type to ptid_t.
(multi_process): Declare.
(push_event): Adjust to use ptid_t.
(read_ptid, write_ptid): Declare.
(prepare_resume_reply): Adjust to use ptid_t.
(clear_symbol_cache): Declare.
* inferiors.c (all_processes): New.
(null_ptid, minus_one_ptid): New.
(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
(ptid_get_tid, ptid_equal, ptid_is_pid): New.
(add_thread): Change unsigned long to ptid. Remove gdb_id
parameter. Adjust.
(thread_id_to_gdb_id, thread_to_gdb_id): Change unsigned long to ptid.
(gdb_id_to_thread): Rename to ...
(find_thread_pid): ... this. Change unsigned long to ptid.
(gdb_id_to_thread_id, find_inferior_id): Change unsigned long to ptid.
(loaded_dll, pull_pid_from_list): Adjust.
(add_process, remove_process, find_process_pid)
(get_thread_process, current_process, initialize_inferiors): New.
* target.h (struct thread_resume) <thread>: Change type to ptid_t.
(struct target_waitstatus) <related_pid>: Ditto.
(struct target_ops) <kill, detach>: Add `pid' argument. Change
return type to int.
(struct target_ops) <join>: Add `pid' argument.
(struct target_ops) <thread_alive>: Change pid's type to ptid_t.
(struct target_ops) <wait>: Add `ptid' field. Change return type
to ptid.
(kill_inferior, detach_inferior, join_inferior): Add `pid' argument.
(mywait): Add `ptid' argument. Change return type to ptid_t.
(target_pid_to_str): Declare.
* target.c (set_desired_inferior): Adjust to use ptids.
(mywait): Add new `ptid' argument. Adjust.
(target_pid_to_str): New.
* mem-break.h (free_all_breakpoints): Declare.
* mem-break.c (breakpoints): Delelete.
(set_breakpoint_at, delete_breakpoint, find_breakpoint_at)
(check_mem_read, check_mem_write, delete_all_breakpoints): Adjust
to use per-process breakpoint list.
(free_all_breakpoints): New.
* remote-utils.c (struct sym_cache) <name>: Drop `const'.
(symbol_cache, all_symbols_looked_up): Delete.
(hexchars): New.
(ishex, unpack_varlen_hex, write_ptid, hex_or_minus_one,
read_ptid): New.
(prepare_resume_reply): Change ptid argument's type from unsigned
long to ptid_t. Adjust. Implement W;process and X;process.
(free_sym_cache, clear_symbol_cache): New.
(look_up_one_symbol): Adjust to per-process symbol cache. *
* server.c (cont_thread, general_thread, step_thread): Change type
to ptid_t.
(attached): Delete.
(multi_process): New.
(last_ptid): Change type to ptid_t.
(struct vstop_notif) <ptid>: Change type to ptid_t.
(queue_stop_reply, push_event): Change `ptid' argument's type to
ptid_t.
(discard_queued_stop_replies): Add `pid' argument.
(start_inferior): Adjust to use ptids. Adjust to mywait interface
changes. Don't reference the `attached' global.
(attach_inferior): Adjust to mywait interface changes.
(handle_query): Adjust to use ptids. Parse GDB's qSupported
features. Handle and report "multiprocess+". Handle
"qAttached:PID".
(handle_v_cont): Adjust to use ptids. Adjust to mywait interface
changes.
(handle_v_kill): New.
(handle_v_stopped): Adjust to use target_pid_to_str.
(handle_v_requests): Allow multiple attaches and runs when
multiprocess extensions are in effect. Handle "vKill".
(myresume): Adjust to use ptids.
(queue_stop_reply_callback): Add `arg' parameter. Handle it.
(handle_status): Adjust to discard_queued_stop_replies interface
change.
(first_thread_of, kill_inferior_callback)
(detach_or_kill_inferior_callback, join_inferiors_callback): New.
(main): Call initialize_inferiors. Adjust to use ptids, killing
and detaching from all inferiors. Handle multiprocess packet
variants.
* linux-low.h: Include gdb_proc_service.h.
(struct process_info_private): New.
(struct linux_target_ops) <pid_of>: Use ptid_get_pid.
<lwpid_of>: Use ptid_get_lwp.
(get_lwp_thread): Adjust.
(struct lwp_info): Add `dead' member.
(find_lwp_pid): Declare.
* linux-low.c (thread_db_active): Delete.
(new_inferior): Adjust comment.
(inferior_pid): Delete.
(linux_add_process): New.
(handle_extended_wait): Adjust.
(add_lwp): Change unsigned long to ptid.
(linux_create_inferior): Add process to processes table. Adjust
to use ptids. Don't set new_inferior here.
(linux_attach_lwp): Rename to ...
(linux_attach_lwp_1): ... this. Add `initial' argument. Handle
it. Adjust to use ptids.
(linux_attach_lwp): New.
(linux_attach): Add process to processes table. Don't set
new_inferior here.
(struct counter): New.
(second_thread_of_pid_p, last_thread_of_process_p): New.
(linux_kill_one_lwp): Add `args' parameter. Handle it. Adjust to
multiple processes.
(linux_kill): Add `pid' argument. Handle it. Adjust to multiple
processes. Remove process from process table.
(linux_detach_one_lwp): Add `args' parameter. Handle it. Adjust
to multiple processes.
(any_thread_of): New.
(linux_detach): Add `pid' argument, and handle it. Remove process
from processes table.
(linux_join): Add `pid' argument. Handle it.
(linux_thread_alive): Change unsighed long argument to ptid_t.
Consider dead lwps as not being alive.
(status_pending_p): Rename `dummy' argument to `arg'. Filter out
threads we're not interested in.
(same_lwp, find_lwp_pid): New.
(linux_wait_for_lwp): Change `pid' argument's type from int to
ptid_t. Adjust.
(linux_wait_for_event): Rename to ...
(linux_wait_for_event_1): ... this. Change `pid' argument's type
from int to ptid_t. Adjust.
(linux_wait_for_event): New.
(linux_wait_1): Add `ptid' argument. Change return type to
ptid_t. Adjust. Use last_thread_of_process_p. Remove processes
that exit from the process table.
(linux_wait): Add `ptid' argument. Change return type to ptid_t.
Adjust.
(mark_lwp_dead): New.
(wait_for_sigstop): Adjust to use ptids. If a process exits while
stopping all threads, mark its main lwp as dead.
(linux_set_resume_request, linux_resume_one_thread): Adjust to use
ptids.
(fetch_register, usr_store_inferior_registers)
(regsets_fetch_inferior_registers)
(regsets_store_inferior_registers, linux_read_memory)
(linux_write_memory): Inline `inferior_pid'.
(linux_look_up_symbols): Adjust to use per-process
`thread_db_active'.
(linux_request_interrupt): Adjust to use ptids.
(linux_read_auxv): Inline `inferior_pid'.
(initialize_low): Don't reference thread_db_active.
* gdb_proc_service.h (struct ps_prochandle) <pid>: Remove.
* proc-service.c (ps_lgetregs): Use find_lwp_pid.
(ps_getpid): Return the pid of the current inferior.
* thread-db.c (proc_handle, thread_agent): Delete.
(thread_db_create_event, thread_db_enable_reporting): Adjust to
per-process data.
(find_one_thread): Change argument type to ptid_t. Adjust to
per-process data.
(maybe_attach_thread): Adjust to per-process data and ptids.
(thread_db_find_new_threads): Ditto.
(thread_db_init): Ditto.
* spu-low.c (spu_create_inferior, spu_attach): Add process to
processes table. Adjust to use ptids.
(spu_kill, spu_detach): Adjust interface. Remove process from
processes table.
(spu_join, spu_thread_alive): Adjust interface.
(spu_wait): Adjust interface. Remove process from processes
table. Adjust to use ptids.
* win32-low.c (current_inferior_tid): Delete.
(current_inferior_ptid): New.
(debug_event_ptid): New.
(thread_rec): Take a ptid. Adjust.
(child_add_thread): Add `pid' argument. Adjust to use ptids.
(child_delete_thread): Ditto.
(do_initial_child_stuff): Add `attached' argument. Add process to
processes table.
(child_fetch_inferior_registers, child_store_inferior_registers):
Adjust.
(win32_create_inferior): Pass 0 to do_initial_child_stuff.
(win32_attach): Pass 1 to do_initial_child_stuff.
(win32_kill): Adjust interface. Remove process from processes
table.
(win32_detach): Ditto.
(win32_join): Adjust interface.
(win32_thread_alive): Take a ptid.
(win32_resume): Adjust to use ptids.
(get_child_debug_event): Ditto.
(win32_wait): Adjust interface. Remove exiting process from
processes table.
2009-04-02 00:50:24 +02:00
|
|
|
get_thread_process (struct thread_info *thread)
|
|
|
|
{
|
|
|
|
int pid = ptid_get_pid (thread->entry.id);
|
|
|
|
return find_process_pid (pid);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct process_info *
|
|
|
|
current_process (void)
|
|
|
|
{
|
|
|
|
if (current_inferior == NULL)
|
|
|
|
fatal ("Current inferior requested, but current_inferior is NULL\n");
|
|
|
|
|
|
|
|
return get_thread_process (current_inferior);
|
|
|
|
}
|