2011-11-30 Kevin Buettner * thread-db.c (TID_MAY_BE_REUSED): Define. (find_new_threads_callback): Detect thread id reuse. 2010-10-14 Kevin Buettner * lwp-pool.c (hash_find): Initialize `do_step' in the newly allocated lwp struct. 2009-11-30 Kevin Buettner * diagnostics.h, diagnostics.c (print_sigint_message): New function. * linux-target.c (linux_process_rcmd): Add monitor commands "interrupt-with-SIGSTOP and interrupt-with-SIGINT". * server.h (struct child_process): Add new field interrupt_with_SIGSTOP. * thread-db.c (thread_db_break_program): Interrupt using either SIGSTOP or SIGINT depending upon user's preference. 2009-11-23 Kevin Buettner * ptrace-target.c (syscall.h): Include. 2007-04-09 Kevin Buettner * linux-target.c (NUM_REGS)[FRV_LINUX_TARGET]: Update. (frv_read_only_register): New function. (reginfo)[FRV_LINUX_TARGET]: Mark as read-only. 2006-10-03 Kevin Buettner * server.h (struct ss_save): Add new field ``restore_action''. * ptrace-target.c (handle_waitstatus): Invoke ``restore_action''. * linux-target.c (LIR_REGNUM) [AM33_2_0_LINUX_TARGET]: Define. (set_singlestep_breakpoint): Add ``restore_action'' parameter. Fix all callers. (am33_set_register, am33_restore_lir): New functions. (am33_opcode_size): Change size of LIW instruction(s) to 0 so that these will be handled explicitly in am33_singlestep. (am33_singlestep): Handle LIW instructions. Revise manner in which Lcc and SETLB instructions are handled. 2006-03-16 Kevin Buettner * server.c (main): Change polling interval for gdbloop_poll() from one second to ten milliseconds. 2005-12-07 Kevin Buettner * ptrace-target.c (ptrace_compute_signal, ptrace_process_signal): Use __SIGRTMIN in place of SIGRTMIN. Use __SIGRTMAX in place of SIGRTMAX. (ptrace_compute_signal): Consolidate logic which computes return value. 2005-12-07 Kevin Buettner * Makefile.am (EXTRA_rda_SOURCES): Add diagnostics.c. * configure.in (TARGET_MODULES): Add diagnostics.o. * Makefile.in, configure: Regenerate. * diagnostics.c: New file. * diagnostics.h (output_O_packet, print_sigstop_message): New functions. * ptrace-target.c (diagnostics.h): Include. (ptrace_break_program): Call print_sigstop_message(). * thread_db.c (thread_db_break_program): Likewise. 2005-12-02 Kevin Buettner * ptrace-target.c (ptrace_break_program): Use SIGSTOP instead of SIGINT to interrupt inferior process. * thread-db.c (thread_db_break_program): Likewise. 2005-12-01 Kevin Buettner * thread-db.c (handle_thread_db_event): Allow underlying target a chance to look at the wait status too. (thread_db_check_child_state): Ensure that there's a thread list to work with when using the thread_db event model. 2005-12-01 Kevin Buettner * linux-target.c (reginfo) [AM33_2_0_LINUX_TARGET]: Don't use ``sizeof (greg_t)'' due to this type not being defined any longer in the headers that linux-target includes. 2005-11-11 Kevin Buettner * lwp-pool.c (clear_all_do_step_flags): New function. (lwp_pool_singlestep_lwp): Use it. 2005-11-10 Kevin Buettner * lwp-pool.c (mark_lwp_as_dead_but_interesting): New function. (wait_and_handle): Replace lines of code implementing guts of new function mark_lwp_as_dead_but_interesting() with call to that function. Make a new call to this function after it has been determined that an lwp has exited without leaving a status. 2005-11-08 Kevin Buettner * lwp-pool.c (struct lwp): Add new member `do_step'. (wait_and_handle): Clear `do_step' when a SIGTRAP is received. (continue_or_step_lwp): New function. (lwp_pool_continue_all, lwp_pool_continue_lwp): Call continue_or_step_lwp() instead of continue_lwp(). (lwp_singlestep_lwp): Set `do_step' after a successful call to singlestep_lwp(). 2005-11-08 Kevin Buettner * linux-target.c (am33_singlestep_okay): Use `pid', not `process->pid' when reading and writing memory since the latter may refer to an already running thread. 2005-11-08 Kevin Buettner * diagnostics.h: New file. * gdbserv-thread-db.h (debug_get_pc): Move declaration to new file diagnostics.h. * linux-target.c (diagnostics.h): Include. (linux_process_rcmd): Add new monitor commands "lwp-pool-noisy", "lwp-pool-quiet", "all-noisy", and "all-quiet". Delete monitor commands "proc-service-noisy" and "proc-service-quiet". * lwp-pool.c (diagnostics.h): Include. (debug_lwp_pool): Remove `static' qualifier. (debug_report_state_change): Add code for printing out the PC value at which program stopped. (debug_report_state_change, wait_and_handle, check_stop_pending) (lwp_pool_waitpid, lwp_pool_stop_all, lwp_pool_continue_all) (lwp_pool_continue_lwp, lwp_pool_attach): Add `serv' argument. Fix all callers. * lwp-pool.h (lwp_pool_attach, lwp_pool_waitpid, lwp_pool_stop_all) (lwp_pool_continue_all, lwp_pool_continue_lwp): Add `serv' argument. (lwp_pool_singlestep_lwp): Revise comment regarding consistency of not passing `serv' parameter. * thread-db.c (diagnostics.h): Include. (proc_service_noisy): Delete this unused global. (attach_thread, continue_thread): Add `serv' parameter. Fix all callers. (update_thread_list, thread_db_singlestep_program): Add diagnostic messages. 2005-11-04 Kevin Buettner * thread-db.c (ALWAYS_UPDATE_THREAD_LIST): Define to be 0. (handle_thread_db_event): Update thread list upon receipt of TD_CREATE or TD_DEATH events. (thread_db_check_child_state): Potentially disable, depending upon value of ALWAYS_UPDATE_THREAD_LIST, the thread list update. (thread_db_check_child_state): Update thread list for signal based event model too. 2005-08-23 Kevin Buettner * configure.in (am33_2.0*linux*): New target. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * config.in: Regenerate. * configure: Regenerate. * gdbserv-thread-db.h (mips_singlestep): Change return type to ``void''. (am33_singlestep): New declaration. * linux-target.c [AM33_2_0_LINUX_TARGET] (GETREGS_SETREGS_REGINFO, SOFTWARE_SINGLESTEP, PC_REGNUM, A0_REGNUM) (A1_REGNUM, A2_REGNUM, A3_REGNUM, LAR_REGNUM, MDR_REGNUM, SP_REGNUM) (NUM_REGS, sign_extend): Define. (PT_A3, PT_A2, PT_D3, PT_D2, PT_MCVF, PT_MCRL, PT_MCRH, PT_MDRQ) (PT_E1, PT_E0, PT_E7, PT_E6, PT_E5, PT_E4, PT_E3, PT_E2, PT_SP) (PT_LAR, PT_LIR, PT_MDR, PT_A1, PT_A0, PT_D1, PT_D0, PT_ORIG_D0) (PT_EPSW, PT_PC): Define. (reginfo): New table. (stock_table_to_am33, am33_table_to_stock, stock_bp_to_am33) (am33_bp_to_stock, am33_make_bp_table, am33_set_bp, am33_delete_bp) (am33_bp_hit_p, am33_make_arch): New functions. (MAKE_ARCH): Define. (am33_singlestep_program, am33_read_byte, am33_read_disp16) (am33_read_disp32, am33_get_register, am33_get_areg, am33_singlestep): New functions. (am33_opcode_size): New table. [MIPS_LINUX_TARGET | MIPS64_LINUX_TARGET] (SOFTWARE_SINGLESTEP): Define. (linux_attach): Set am33 specific ``singlestep_program''. Revise proprocessor condition upon which ``is_ss'' is set. [SOFTWARE_SINGLESTEP] (set_singlestep_breakpoint): New function. (mips_get_reg, mips_poke_instruction): Delete. (mips_singlestep): Adjust return type. Use set_singlestep_breakpoint() where appropriate. * ptrace-target.c (handle_waitstatus): Adjust call to ptrace_set_mem() to account for different type of singlestep breakpoint shadow value. Also, pass the stored breakpoint size. Add diagnostics. (ptrace_attach): Add AM33_2_0_LINUX_TARGET to list of targets needing to clear ``is_ss''. (singlestep_lwp): Add code to call am33 specific singlestep code. * server.h (struct ss_save): Add AM33_2_0_LINUX_TARGET to the list of preprocessor conditions which declare this struct. Revise type of ``ss_val'' from ``int'' to a ``char'' array. Add new field ``ss_size''. (struct child_process): Define fields ``is_ss'' and ``ss_info'' for AM33_2_0_LINUX_TARGET. 2005-08-23 Kevin Buettner * gdbserv-thread-db.h (proc_service_noisy): Declare. * linux-target.c (linux_process_rcmd): Add "monitor" commands for enabling and disabling various types of diagnostic messages. Delete old "monitor 1" and "monitor 0" commands for enabling / disabling just the back-end diagnostics. (decr_pc_after_break): Delete extern declaration for ``thread_db_noisy''. 2005-06-27 Jim Blandy Add support for the Linux NPTL (New POSIX Thread Library) thread implementation. * arch.h, lwp-pool.c, lwp-pool.h, stock-breakpoints.c: * stock-breakpoints.h: New files. * gdbserv-thread-db.h (continue_lwp, singlestep_lwp, attach_lwp) (stop_lwp): Move these ... * lwp-ctrl.h: ... to here (new file). * server.h (struct child_process): Include a pointer to the architecture object, a breakpoint table, and a pointer to the "focus thread". * linux-target.c: Create architecture objects for the i386 and FRV, and describe breakpoints for those architectures. #include "arch.h". [STOCK_BREAKPOINTS]: #include "stock-breakpoints.h". (allocate_empty_arch): New function. [X86_LINUX_TARGET] (stock_table_to_x86, x86_table_to_stock) (stock_bp_to_x86, x86_bp_to_stock, x86_make_bp_table, x86_set_bp) (x86_delete_bp, x86_bp_hit_p, x86_make_arch): New functions. (MAKE_ARCH): #define to call x86_make_arch. [X86_LINUX_TARGET] (stock_table_to_frv, frv_table_to_stock) (stock_bp_to_frv, frv_bp_to_stock, frv_make_bp_table, frv_set_bp) (frv_delete_bp, frv_bp_hit_p, frv_make_arch): New functions. (MAKE_ARCH): #define to call frv_make_arch. (linux_attach): If MAKE_ARCH is #defined, create an architecture object for this process. And if we have an architecture object, make a breakpoint table. * thread-db.c: #include , "arch.h", "lwp-ctrl.h", and "lwp-pool.h". (struct gdbserv_thread): Remove state-tracking flags 'attached', 'stopped', 'waited', and 'stepping'; all that state is handled inside lwp-pool.c now. (add_thread_to_list): Zero the entire newly allocated thread structure. (thread_list_lookup_by_lid): Prefer threads whose ti_lid values are different from that of the main process. (thread_db_state_str, thread_db_type_str): Don't include formatting spaces here. (thread_db_event_str): New function. (thread_debug_name): New function. (get_thread_signals): Return a value indicating success or failure. (ignore_thread_signal): New function. (using_thread_db_events, create_notification, death_notification) (get_event_notification, set_event_breakpoint) (insert_thread_db_event_breakpoints) (delete_thread_db_event_breakpoints, request_thread_db_events) (hit_thread_db_event_breakpoint, handle_thread_db_event): New variables and functions, for using libthread_db's event interface. (thread_db_open): Gather error-handling code next to the operation that might fail. Decide here whether to use the signal-based debugging interface, or the event-based debugging interface. (stop_thread, stop_all_threads, struct event_list, pending_events) (pending_events_listsize, pending_events_top, add_pending_event) (select_pending_event, send_pending_signals, wait_all_threads): Deleted; we now use lwp-pool.c for all this. (attach_thread, continue_thread, continue_all_threads) (singlestep_thread, thread_db_singlestep_program) (thread_db_continue_thread, thread_db_singlestep_thread): Use the lwp-pool.c functions, instead of calling the lwp manipulation functions directly and managing state here. Keep track of the focus thread. (find_new_threads_callback): Always call attach_thread. If we're using libthread_db events, enable event reporting for the new thread. (update_thread_list): Take the current child process as an argument; if the current focus thread disappears, clear the process's focus_thread pointer. (thread_db_thread_next): Pass the current child process to update_thread_list. (thread_db_thread_info): Reformat thread descriptions. Mark threads whose pid is equal to the process ID. (thread_db_check_child_state): Use the lwp-pool functions, instead of calling waitpid and the old stop-all-threads functions. If we have a focus thread, only check for a status on that thread. Check for libthread_db events. Use ignore_thread_signal, instead of writing it out. (thread_db_break_program): New function. (thread_db_attach): Register it as the target's 'break_program' method. Always preload the symbol list with the names we'll need for the signal-based interface, even if we have td_symbol_list. Use lwp_pool_new_stopped to register the initial thread. Clear the focus thread. * ptrace-target.c: #define _GNU_SOURCE and #include and , to get declarations for the functions we need. #include "lwp-ctrl.h". (continue_lwp, singlestep_lwp, attach_lwp): Remove unnecessary 'extern' keywords. Move pre-function comments to lwp-ctrl.h. Take an ordinary 'pid_t', not an 'lwpid_t', since we're calling ptrace / tkill, and that's what they expect; rename arguments accordingly. Preserve value of errno across calls to fprintf when reporting errors. (kill_lwp): All the above, and use tkill system call if available. * configure.in: Whenever we include thread-db.o in TARGET_MODULES, also include lwp-pool.o. On i386 and FRV Linux, use the stock-breakpoints module. * config.in: Add template for STOCK_BREAKPOINTS. * Makefile.am (EXTRA_rda_SOURCES): Include stock-breakpoints.c. * Makefile.in, aclocal.m4, configure: Regenerated. 2005-03-11 Jim Blandy * linux-target.c (linux_get_reg) [GETREGS_SETREGS_REGINFO]: In the NOREGS case, check that reginfo doesn't specify an offset outside our zeroed buffer. 2005-03-10 Jim Blandy Compile with no warnings. * Makefile.am (AM_CFLAGS): Compile with -Wall. * Makefile.in: Regenerated. * gdbserv-thread-db.h (stop_lwp, handle_waitstatus, ps_pdread, ps_pdwrite): Add declarations for these functions to gdbserv-thread-db.h. * linux-target.c: #include , , and to get declarations for system functions used in this file. (linux_get_reg): When register REGNO doesn't exist, provide zeros for its value; don't use an uninitialized pointer. (linux_set_reg): Delete unused variables. (decr_pc_after_break): Fix printf format directive to match arguments. * ptrace-target.c (ptrace_read_user, ptrace_check_child_state, ptrace_attach): Delete unused variables. (ptrace_singlestep_program, ptrace_continue_program): Fix printf format directive to match arguments. * server.c (invalid_speed): Same. (main): Initialize infd, outfd, and speed. (tty_raw): Use proper name for speed_t "zero baud" value. * thread-db.c: #include and "gdbserv-utils.h", to get declarations for functions used in this file. (thread_db_open, wait_all_threads) (thread_db_check_child_state, thread_db_get_thread_reg) (thread_db_set_thread_reg): Fix printf format directive to match arguments. (continue_thread, thread_db_get_thread_reg, continue_all_threads, thread_db_attach): Delete unused variables. * Makefile.in, aclocal.m4: Regenerated with automake 1.9.4. Make config.in generated automatically again. * configure.in: Provide descriptions for all the preprocessor symbols we define. * configure: Regenerated. * config.in: Regenerated using autoheader. * linux-target.c (frv_fdpic_loadmap_addresses): Use '%lx' for unsigned long argument. 2005-02-08 Kevin Buettner * thread-db.c (thread_db_get_thread_reg): Don't allow a successful return without first initializing ``reg''. (thread_db_set_thread_reg): Remove code intended to for thread_db_get_thread_reg(). 2004-12-09 Jim Blandy * aclocal.m4, configure: Regenerated. 2004-11-18 Kevin Buettner * thread-db.c (thread_db_set_thread_reg): Don't allow a successful return without first initializing ``reg''. 2004-10-20 Jim Blandy Use the libthread_db 'td_symbol_list' function to look up all the symbols libthread_db will need when invited to by GDB. * thread-db.c (add_symbol_to_list): Make 'name' argument const. (td_symbol_list_p): New libthread_db function pointer. (thread_db_dlopen): Initialize it. (thread_db_attach): Use td_symbol_list to pre-load our symbol cache with the names of all the symbols libthread_db will ever request. * thread-db.c (thread_db_get_gen): There's no reason to try to open a thread agent until we've at least requested values for all the symbols we know about. * server.c (usage): Don't include the entire pathname in the usage message. 2004-10-19 Jim Blandy * thread-db.c (get_thread_signals): Doc fix. * thread-db.c (enum symbol_cache_defined): Move this definition above that of (struct symbol_cache), and give it a name. (struct symbol_cache): Use that enum as the type of 'defined_p', so the debugger will print symbol cache entries more helpfully. * ptrace-target.c (ptrace_create_child): Don't use sys_nerr to check that errno is in a valid range. The use sys_nerr is deprecated on GNU/Linux, and according to the ISO C standard and POSIX, strerror always returns a valid string, even for invalid errno codes. 2004-10-07 Jim Blandy * Makefile.am (rda_DEPENDENCIES): Add ../lib/librda.la. * Makefile.in: Regenerated. * server.c (main): Check for an error return from gdbsocket_startup. 2004-09-22 Jim Blandy * thread-db.c (thread_db_open, thread_db_get_gen): Doc fixes. * thread-db.c (thread_db_detach, thread_db_set_gen, thread_db_thread_id): Make these functions static. 2004-09-13 Jim Blandy * solaris-target.c (solaris_detach, solaris_attach): Change "linux" to "solaris". 2004-08-11 Corinna Vinschen * linux-target.c (linux_write_reg): Print process->pid in case of an error. 2004-07-19 Kevin Buettner * server.c (main): Set ``server_quit_p'' when debugged process exits or terminates. 2004-06-03 Kevin Buettner * server.c (main): Ensure that thread related realtime signals are ignored. 2004-04-20 Kevin Buettner * thread-db.c (lookup_sym): New function. (thread_db_open): Print diagnostic message for failed dlopen() call. Call lookup_sym() which will print diagnostic for failed dlsym() call. 2004-04-20 Kevin Buettner * server.c (main): Ignore realtime signals. 2004-04-05 Kevin Buettner * linux-target.c (reginfo) [FRV_LINUX_TARGET]: Add support for registers fsr0, acc0-acc7, accg0-accg7, msr0, msr1, gner0, gner1, fner0, and fner1. 2004-03-19 Kevin Buettner * ptrace-target.c (ptrace_exit_program): Cause main loop to exit. * server.c (sys/types.h, sys/stat.h, fcntl.h, string.h, unistd.h) (ctype.h, termios.h): Include. (close_device, tty_raw, invalid_speed, parse_speed): New functions. (speed_table): New static global. (usage): Update usage message. (main): Add support for connecting to serial devices. 2004-03-10 Kevin Buettner * linux-target.c (enum regset): Add constant OTHERREGS. (struct peekuser_pokeuser_reginfo): Add new field, alternate_register_read_write_method. Adjust all initializers accordingly. (frv_fdpic_loadmap_addresses): New function. (PTRACE_GETFDPIC, PTRACE_GETFDPIC_EXEC, PTRACE_GETFDPIC_INTERP): Define. (reginfo) [FRV_LINUX_TARGET]: Use slots 132 and 133 for the loadmap registers. 2004-03-10 Kevin Buettner * configure.in: Add "frv*linux*" to list of targets with thread support. * configure: Regenerate. * Makefile.in: Regenerate using "automake --cygnus --ignore-deps". 2004-03-10 Kevin Buettner * ptrace-target.c (ptrace_create_child): Use vfork() instead of fork(). Use PTRACE_ATTACH to attach to an existing process. * server.c (usage): Update to include text about "-a". (main): Allow use of -a switch to attach to an existing process. 2003-11-14 Kevin Buettner * config.in (FRV_LINUX_TARGET): Add. * configure.in (sys/user.h): Don't check for this header; it's not used. (frv*linux*): Add rudimentary support for FR-V Linux. * linux-target.c (PEEKUSER_POKEUSER_REGINFO, NUM_REGS, PC_REGNUM) (sign_extend, greg_offset_and_size, fpreg_offset_and_size) (noreg_offset_and_size, reginfo) [FRV_LINUX_TARGET]: Define. * configure, Makefile.in: Regenerate. 2003-09-10 Kevin Buettner From Jimi Xenidis : * linux-target.c (reginfo): The MQ register is for IBM POWER (pre-PowerPC) architecture, and is undefined in PPC GNU/Linux environment. 2003-05-09 Kevin Buettner * linux-target.c (mips_singlestep): Don't any consider cop0 or cop1x instructions to be conditional branches. Expand set of cop1 opcodes considered to be conditional branches. 2003-05-08 Kevin Buettner * linux-target.c (mips_singlestep): Don't interpret all coprocessor instructions as conditional branches. 2003-04-10 Kevin Buettner * linux-target.c (NUM_REGS) [MIPS_LINUX_TARGET, MIPS64_LINUX_TARGET]: Bump to 72. (struct peekuser_pokeuser_reginfo) [MIPS_LINUX_TARGET]: Use PROTO_SIZE for ``bad'' and ``cause''. (struct peekuser_pokeuser_reginfo) [MIPS_LINUX_TARGET] [MIPS64_LINUX_TARGET]: Add ``fir'' register. 2003-02-07 Kevin Buettner * gdbserv-thread-db.h (singlestep_lwp): Add ``struct gdbserv *'' argument. Adjust all callers. (mips_singlestep) [MIPS_LINUX_TARGET, MIPS64_LINUX_TARGET]: New function. * linux-target.c (reginfo) [MIPS64_LINUX_TARGET]: Adjust some of the fpregset/gregset related constants in this table. (mips_get_reg): Add ``struct gdbserv *'' argument. Adjust all callers. (mips_addr_as_reg, mips_peek_instruction, mips_poke_instruction): New functions. (mips_singlestep_program): Move bulk of implementation to and call... (mips_singlestep): ...new function. This new function no longer makes any direct PTRACE_PEEKTEXT or PTRACE_POKETEXT operations. Shadow breakpoint information is also stored in a slightly different format. * ptrace-target.c (server.h, ptrace-target.h): Adjust location of #include statements so that gdbserv.h is included first. (handle_waitstatus): Call ptrace_set_mem() instead of invoking ptrace() directly. Also adjust code to use somewhat different shadow breakpoint structs. (ptrace_set_mem, ptrace_get_mem): Remove ``static'' qualifier from function declarators. (singlestep_lwp): Add ``struct gdbserv *'' argument. * ptrace-target.h (ptrace_get_mem, ptrace_set_mem): Declare. * server.c (gdbserv.h): Include. * server.h (struct ss_save): Add field ``in_use''. Change type of field ``ss_addr'' to struct ``gdbserv_reg''. * thread-db.c (wait_all_threads): Revise diagnostic message to print signal number for SIGDEBUG signal. (singlestep_thread): Add ``struct gdbserv *'' argument. Adjust all callers. 2003-01-22 Kevin Buettner * linux-target.c (struct peekuser_pokeuser_reginfo) [MIPS64_LINUX_TARGET, MIPS_LINUX_TARGET]: Disable registers ``cause'' and ``bad'' since they are not writable via ptrace(). 2003-01-19 Alexandre Oliva * linux-target.c: Don't assume asm-mips/ is available, use just asm instead. 2003-01-17 Kevin Buettner * configure.in (mips64*linux*n64, mips64*linux*n32, mips64*linux*o32): Remove cases. Instead, use compiler's preprocessor symbols to test which ABI is being used. * configure: Regenerate. 2003-01-16 Kevin Buettner * config.in (LIBTHREAD_DB_SO): New macro. * configure.in (mips64*linux*): Remove no-threads.o from TARGET_MODULES list. Add thread-db.o to this list. * configure: Regenerate. 2003-01-10 Kevin Buettner * Makefile.in: Regenerate using "automake --cygnus --ignore-deps". Someday, when ``depcomp'' is added to the top level, the --ignore-deps flag can be discarded. 2002-12-18 Kevin Buettner * ptrace-target.h, ptrace-target.c (ptrace_write_user) (ptrace_read_user): Add struct gdbserv argument. * linux-target.c: Fix all callers. * ptrace-target.c (ptrace_write_user, ptrace_read_user): Add debugging printf()s. (ptrace_xfer_mem): Fix debugging printf()s so that they'll print useful results when sizeof (long long) is the same as sizeof (ptrace_xfer_type). (ptrace_xfer_mem): Decode address using gdbserv_host_bytes_from_reg() instead of gdbserv_reg_to_ulong(). 2002-12-02 Kevin Buettner * linux-target.c (linux_get_reg, linux_set_reg, reg_from_regset) (reg_to_regset, get_regset, put_regset reg_from_gregset) (reg_to_gregset, reg_from_fpregset, reg_to_fpregset) (reg_from_xregset, reg_to_xregset): Adjust all calls to gdbserv_host_bytes_to_reg() and gdbserv_host_bytes_from_reg() to account for change in interface. Remove code which is no longer needed due to improvements in the aforementioned functions. (sign_extend): New constant. (FPR_BASE, PC, CAUSE, BADVADDR, MMHI, MMLO, FPC_CSR, FPC_EIR): Make sure these are defined. (PROTO_SIZE): Define. (reginfo) [MIPS_LINUX_TARGET]: Use PROTO_SIZE to initialize table with size (width) of registers to use when communicating with the client. (NUM_REGS, PC_REGNUM, reginfo) [MIPS64_LINUX_TARGET]: Define. 2002-11-19 Michael Snyder * ptrace-target.c: Fix typo in copyright. 2002-08-23 Kevin Buettner * linux-target.c (linux_get_reg, linux_set_reg): Print an error message for out of bound registers. 2002-08-23 Kevin Buettner * linux-target.c (NUM_REGS) [X86_LINUX_TARGET]: Bump to 42. (getregs_setregs_reginfo) [X86_LINUX_TARGET]: Add entry for register ``orig_eax''. (linux_get_reg, linux_set_reg): Make sure ``regno'' value is valid. (linux_detach, linux_attach, decr_pc_after_break): Call fprintf() instead of printf(). (linux_detach, linux_attach): Don't always print informational messages. * ptrace-target.c (handle_waitstatus, ptrace_detach, ptrace_attach): Don't always print informational messages. Use fprintf() instead of printf(). (noop_get_trap_number, noop_compute_signal, noop_exit_program) (noop_signlestep_program, noop_break_program): Delete. (ptrace_flush_i_cache): Renamed from noop_flush_i_cache. Update reference in ptrace_attach(). (continue_lwp, singlestep_lwp, attach_lwp, stop_lwp, ps_pstop) (ps_continue, ps_lstop): Use fprintf() instead of printf(). * server.c (errno.h): Include. (usage): New function. (main): Add option processing code. * server.h (struct child_process): Add new field, ``debug_informational''. * thread-db.c (ps_plog, select_pending_event, send_pending_signals) (wait_all_threads, thread_db_check_child_state): Use fprintf() instead of printf(). (thread_db_detach): Conditionally print informational messages. Use fprintf() instead of printf(). 2002-08-21 Kevin Buettner * Makefile.am, configure.in, dummy-target.c, linux-target.c, ptrace-target.c, ptrace-target.h, server.h, solaris-target.c, thread-db.c: Change ``libremote'' references into ``RDA'' references. * Makefile.in, configure: Regenerate. 2002-08-15 Kevin Buettner * dummy-target.c, gdb_proc_service.h, gdbserv-thread-db.h, linux-target.c, no-threads.c, ptrace-target.c, ptrace-target.h, server.c, server.h, solaris-target.c, thread-db.c: Update copyright notices. 2002-05-16 Kevin Buettner * config.in (GREGSET_T): Renamed from GDB_GREGSET_T. (FPREGSET_T): Renamed from GDB_FPREGSET_T. * configure.in: Likewise. * gdbserv-thread-db.h: Likewise. * linux-target.c: Likewise. * thread-db.c: Likewise. * gdb_proc_service.h: Remove everything that's not absolutely needed. 2002-02-01 Kevin Buettner * configure.in (arm32): Change to ``yes''. * configure: Regenerate. 2002-01-30 Kevin Buettner * linux-target.c (linux_get_reg) [GETREGS_SETREGS_REGINFO]: Add NOREGS support. (linux_set_reg) [GETREGS_SETREGS_REGINFO]: Likewise. 2002-01-28 Kevin Buettner * linux-target.c (write_reg_bytes): Print return status in ptrace failure message. * ptrace-target.c (ptrace_write_user): Enable existing Linux/MIPS related kernel bug workaround when MIPS_LINUX_TARGET is defined (which is in addition to _MIPSEL). 2002-01-28 Kevin Buettner * thread-db.c (struct regset_cache): New struct declaration. (thread_db_map_id2thr_cache_valid, fpregset_cache, gregset_cache): New static globals. (thread_db_map_id2thr, thread_db_invalidate_map_id2thr_cache) (initialize_regset_cache, initialize_regset_caches) (thread_db_flush_regset_cache, thread_db_flush_regset_caches) (thread_db_get_regset, thread_db_set_regset) (thread_db_invalidate_regset_cache, thread_db_invalidate_regset_caches) (thread_db_invalidate_caches, thread_db_getfpregs) (thread_db_set_fpregs, thread_db_getgregs, thread_db_setgregs) (td_thr_getfpregs_wrapper, td_thr_getgregs_wrapper) (td_thr_setfpregs_wrapper, td_thr_setgregs_wrapper): New functions. (update_thread_list, thread_db_get_thread_reg) (thread_db_set_thread_reg): Call thread_db_map_id2thr() instead of td_ta_map_id2thr_p(). (thread_db_get_thread_reg): Call thread_db_getfpregs() instead of td_thr_getfpregs_p(). Call thread_db_getgregs() instead of td_thr_getgregs_p(). (thread_db_set_thread_reg): Likewise. Also, call thread_db_setfpregs() instead of td_thr_setfpregs_p() and call thread_db_setgregs() instead of td_thr_setgregs_p(). (continue_thread, thread_db_continue_program) (thread_db_singlestep_program, thread_db_continue_thread) (singlestep_thread): Call thread_db_flush_regset_caches() at beginning of function and thread_db_invalidate_caches() at end of function. (thread_db_attach): Initialize regset caches. 2002-01-15 Kevin Buettner * config.in (Generated automatically comment): Revise to note that this file was generated automatically at one time, but is no longer. (LINUX_TARGET, SOLARIS_TARGET): Fix comments. (MIPS_LINUX_TARGET): Add. * configure.in (i?86*linux*, powerpc*linux*, arm*linux*, mips*linux*): Eliminate unnecessary duplication. (mips*linux*): Target is MIPS_LINUX_TARGET, not SH_LINUX_TARGET. * gdbserv-thread-db.h (is_gp_reg): New function. (is_fp_reg, is_extended_reg): Revise comments. * linux-target.c (enum regset): Add new constant NOREGS. (is_gp_reg): New function. (PEEKUSER_POKEUSER_REGINFO) [MIPS_LINUX_TARGET]: Define. (SIZEOF_REGMAP, SIZEOF_MAPPEDREG) [MIPS_LINUX_TARGET]: Delete. (NUM_REGS) [MIPS_LINUX_TARGET]: Change from 38 to 70 to account for addition of floating point support. (regmap) [MIPS_LINUX_TARGET]: Delete this array. (is_fp_reg, is_extended_reg) [MIPS_LINUX_TARGET]: Delete. (reginfo) [MIPS_LINUX_TARGET]: Define. (DEBUG): Delete this macro definition. (disp_gdb_mesg, ptrace_get_mem, ptrace_set_mem): Delete function declarations. (linux_get_reg, linux_set_reg) [PEEKUSER_POKEUSER_REGINFO]: Add NOREGS support. (put_regset) [PEEKUSER_POKEUSER_REGINFO]: Add missing return statement. (mips_get_reg): Use read_reg_bytes() to fetch the register. (mips_singlestep_program): Eliminate unused variables ``u_regs_base'', ``temp_reg''. Fix fprintf related format warning. * ptrace-target.h (ptrace_check_child_state): Declare. * thread-db.c (thread_db_get_thread_reg, thread_db_set_thread_reg): Handle case of target not supporting one or more registers. 2001-10-15 Kevin Buettner * gdbserv-thread-db.h (is_extended_reg, reg_to_xregset) (reg_from_xregset): New functions. (debug_get_pc, decr_pc_after_break): Add declaration. * linux-target.c (sys/procfs.h): Include. (MAX_REG_SIZE): New anonymous enum constant. (enum regset): New enum. (getregs_setregs_reginfo, peekuser_pokeuser_reginfo): New structs. (offsetof, fieldsize): New macros. (ARM_LINUX_TARGET, X86_LINUX_TARGET, PPC_LINUX_TARGET): Deleted old data structures defining register maps for these registers. Replaced with new tables using either getregs_setregs_reginfo or peekuser_pokeuser_reginfo structs. Other architectures remain the same, though reoranized somewhat. (linux_next_gg_reg, linux_gg_reg_nr): Revise comments. Use NUM_REGS instead of NUM_G_PACKET_REGS. (get_xregsetsize): New function. (linux_reg_format, linux_sizeof_reg, is_fp_reg, is_extended_reg) [PEEKUSER_POKEUSER_REGINFO, GETREGS_SETREGS_REGINFO]: New functions. (read_reg_bytes, write_reg_bytes, debug_get_reg, debug_get_pc) (linux_get_reg, linux_set_reg, reg_from_regset, reg_to_regset) (reg_from_gregset, reg_to_gregset, reg_from_fpregset, reg_to_fpregset) (reg_from_xregset, reg_to_xregset, get_regset, put_regset, get_gregset) (put_gregset, get_fpregset, put_fpregset, get_xregset, put_xregset) [PEEKUSER_POKEUSER_REGINFO]: New functions. (read_reg_as_ulong, write_reg_as_ulong, debug_get_reg, debug_get_pc) (linux_get_reg, linux_set_reg, regs_from_gregset, regs_to_gregset) (reg_from_fpregset, reg_to_fpregset, reg_from_xregset, reg_to_xregset) (get_gregset, put_gregset, get_fpregset, put_fpregset, get_xregset) (put_xregset) [GETREGS_SETREGS_REGINFO]: New functions. (linux_process_get_regs, linux_process_get_reg, linux_process_set_reg) (linux_process_set_regs, ppc_linux_process_set_reg) (ppc_linux_process_get_reg, ppc_linux_process_set_regs) (ppc_linux_process_get_regs): Deleted. (linux_attach): Reorganize initializations. (generic_linux_set_reg): Renamed to linux_set_reg. (generic_linux_get_reg): Renamed to linux_get_reg. (generic_linux_sizeof_reg): Renamed to linux_sizeof_reg. (generic_linux_gg_reg_nr): Renamed to linux_gg_reg_nr. (generic_linux_next_gg_reg): Renamed to linux_next_gg_reg. (generic_linux_reg_format): Renamed to linux_reg_format. (decr_pc_after_break): Consolidated versions of this function down to two; one for x86 and one for everything else. Also, add ``serv'' parameter and fix all callers. (debug_get_pc, debug_get_reg): Now only three versions of this function, one for PEEKUSER_POKEUSER_REGINFO code, one for GETREGS_SETREGS_REGINFO code, and one for legacy code. Also, debug_get_pc() now takes a ``serv'' parameter. Fixed all callers. (ps_lgetregs): Use new get_gregset() interface. (ps_lsetregs): Use new put_gregset() interface. (ps_lgetfpregs, ps_lsetfpregs, ps_lgetxregsize, ps_lgetxregs) (ps_lsetxregs): Implement. * ptrace-target.c (ptrace_read_user, ptrace_write_user): Make ``buff'' argument of type ``void *'' instead of ``char *''. (ptrace_get_gregs): Add new parameter ``alt_pid''. (ptrace_set_gregs): Likewise. (ptrace_get_fpregs): Add new parameter alt_pid. Also fix call to ptrace() so parameters are in correct order. (ptrace_set_fpregs): Likewise. (ptrace_get_fpxregs, ptrace_set_fpxregs): New functions. * ptrace-target.h (ptrace_write_user, ptrace_read_user) (ptrace_get_gregs, ptrace_set_gregs, ptrace_get_fpregs) (ptrace_set_fpregs, ptrace_get_fpxregs, ptrace_set_fpxregs): Declare. * thread-db.c (td_thr_getxregsize_p, td_thr_getxregs_p) (td_thr_setxregs_p): New function pointers. (thread_db_dlopen): Initialize new function pointers. (send_pending_signals): Add ``process'' parameter so that decr_pc_after_break() can get the ``serv'' argument. Fix all callers. (thread_db_get_thread_reg, thread_db_set_thread_reg): Add xregset support. 2001-10-14 Kevin Buettner * ptrace-target.c (unistd.h): Include. (close_open_files): New function. (ptrace_create_child): In newly forked child process, call close_open_files() before invoking execv(). 2001-10-13 Kevin Buettner * server.c (signal.h): Include. (chld_handler): New function. (main): Establish chld_handler as the SIGCHLD signal handler. Also, wait 1 second instead of 0 seconds to avoid busy waiting. 2001-09-26 Louis Hamilton * configure.in: Use thread-db.c for ARM. * configure: Regenerated. * linux-target.c (ARM_R11, ARM_R12): Added to regmap[]. (ARM_FP, ARM_CPSR): Revised mappings of these ARM registers. (debug_get_reg, debug_get_pc, decr_pc_after_break) [ARM_LINUX_TARGET]: New functions. 2001-09-20 Kevin Buettner * configure.in: Use thread-db.c for Linux/PPC too. * configure: Regenerated. * linux-target.c (linux_read_reg): Add forward declaration. (debug_get_reg, debug_get_pc, decr_pc_after_break) [PPC_LINUX_TARGET]: New functions. 2001-09-20 Kevin Buettner * linux-target.c (SIZEOF_MAPPEDREG) [PPC_LINUX_TARGET]: Add comment. (PC_REGNUM) [PPC_LINUX_TARGET]: Remove FIXME comment. (is_fp_reg) [PPC_LINUX_TARGET]: Revise upper bound on floating point register numbers. (ppc_linux_getset_reg): Rewritten to use regmap[] to fetch ptrace() offsets. This'll handle the (previously unsupported) floating point registers, cr, lr, ctr, and xer. (ppc_linux_process_set_regs, ppc_linux_process_get_regs): Don't hardcode loop upper bound. (ppc_linux_process_get_regs): Revise declarator to match process_get_regs member in struct gdbserv_target. 2001-09-18 Andrew Haley * server.c (main): Work around SIGCHLD problem. 2001-08-05 Michael Chastain * ptrace-target.c (ptrace_write_user): Ignore ESRCH on MIPS, because mips linux kernel 2.4 has a bug where PTRACE_POKEUSER returns -ESRCH even when it succeeds. 2001-08-03 Michael Keezer * configure.in: Add am33_2.0 & mn10300. * config.in: Add AM33_LINUX_TARGET & AM33_2_0_LINUX_TARGET. * linux-target.c: am33_2.0 & mn10300 support. 2001-07-23 David Howells * ptrace-target.c: Added big-endian MIPS support. * linux-target.c: ditto. * server.h: ditto. 2001-06-25 Michael Snyder * ptrace-target.c (ptrace_compute_signal): Implement conversion from native signals to GDB's signal numbering. (ptrace_process_signal): Implement conversion from GDB's signal numbering to native signals. (stop_lwp): Comment out debugging output of SIGSTOP signals. * linix-target.c (linux_fromtarget_break): Call compute_signal. (linux_fromtarget_terminate): Ditto. * thread-db.c (thread_db_check_child_state): Don't do any conversion when passing a signal directly back to the inferior; just copy from stop_signal to signal_to_send. (thread_db_fromtarget_thread_break): Convert signal from native numbering to GDB's numbering. 2001-06-18 Michael Snyder * linux-target.c (generic_linux_set_reg): Fix typo. (decr_pc_after_break): Mute the debugging output. 2001-06-15 Michael Snyder * thread_db.c: Disable noisy debugging output. (select_pending_event): Add new selection criterion, giving preference to a thread that is being single-stepped. This avoids the problem of deciding whether to decrement the pc if we don't know whether a SIGTRAP was caused by stepping or by hitting a breakpoint. 2001-06-14 Michael Snyder * thread-db.c (thread_db_set_gen, thread_db_get_gen): Rewrite syntax for qSymbol messages. * gdb_proc_service.h: New file. * Makefile.am (INCLUDES): Remove $(srcdir)/../../include. * Makefile.in: Regenerate. 2001-05-31 Michael Snyder * thread-db.c (add_thread_to_list): Return explicit value! 2001-05-23 Jackie Smith Cashion * linux-target.c: Change MIPS SIZEOF_MAPPEDREG from 1 to 4. (linux_register_offset): For MIPS return regmap[regnum] instead of SIZEOF_MAPPEDREG * regmap[regnum]. (mips_get_reg): Pass pid as argument to ptrace_read_user instead of gdbserv pointer. 2001-05-22 Michael Snyder * no-threads.c: New file. * configure.in: Use thread-db.c only for specified architectures, (including x86); otherwise default to using no-threads.c. * configure: Regenerate. 2001-05-10 Martin M. Hunt * linux-target.c (is_fp_reg): New function for mips. FP not implemented. Merged changes from symbol branch with appropriate modifications. Mon Mar 26 08:54:41 PST 2001 Brendan Conoboy * configure.in: Added mipsvr4181el* target * configure: regenerate 2001-01-26 Rudy Folden * server.c: Changed name from gdbgeneral_xxx to gdbconnect_xx. 2001-01-24 Rudy Folden * configure: Added mipsel* target. * linux-target.c: Add support for MIPS processor, including single- stepping which doesn't exist in mips ptrace. * ptrace-target.c (ptrace_handle_waitstatus): Added single-stepping instruction restore for mips. (ptrace_attach): Added single stepping initialization code. * server (main): Added generic interfaces, gdbgeneral_startup/shutdown for serial or tcp/ip selection. Also added server_quit_p to X and W for serial support (no socket shutdown). * server.h (child_process): Added mips instruction save area for single-step support. 2001-01-10 Rudy Folden * ptrace-target.c (enum): Added U_REGS_OFFSET to processor dependent enums. 2001-04-26 Michael Snyder * linux-target.c (is_fp_reg): New function. (reg_from_fpregset, reg_to_fpregset): New functions. Support for thread_db_get_thread_reg floating point regs. * thread-db.c (thread_db_get_thread_reg, thread_db_set_thread_reg): Infrastructure for support of floating point regs. (Attach_thread): New function, abstracted from below. (find_new_threads_callback): Call attach_thread. (stop_thread): New function, abstracted from stop_all_threads. (stop_all_threads): Call stop_thread. (continue_thread): Test for lwp == 0 before calling continue_lwp. * ptrace-target.c (stop_lwp): New function. * gdbserv-thread-db.h (reg_to_regnum, reg_from_regnu): Declare. 2001-04-25 Michael Snyder Move all ptrace references out of thread-db.c. * gdbserv-thread-db.h: New file. * thread-db.c (struct ps_prochandle): Move to gdbserv-thread-db.h. (gdb_ps_prochandle_t): Ditto. (gdb_ps_read_buf_t, gdb_ps_write_buf_t, gdb_ps_size_t): Ditto. (ps_pstop, ps_pcontinue): Move to ptrace-target.c. (ps_lstop, ps_lcontinue): Ditto. (ps_pdread, ps_pdwrite, ps_ptread, ps_ptwrite): Ditto. (ps_lgetxregsize): Move to linux-target.c. (ps_lgetxregs, ps_lsetxregs, ps_getpid): Ditto. (ps_lgetregs, ps_lsetregs, ps_lgetfpregs, ps_lsetfpregs): Ditto. (find_new_threads_callback): Abstract attach bits into new function attach_lwp, and move that to ptrace-target.c. (wait_all_threads): Call continue_lwp instead of ptrace. (continue_pid): Rename as continue_lwp, move into ptrace-target.c. (singlestep_pid): Rename as continue_lwp, move into ptrace-target.c. (struct symbol_cache): Change value to a paddr_t. (add_symbol_to_list, lookup_cached_symbol): Ditto. * linux-target.c (ps_lgetregs, ps_lsetregs, ps_lgetfpregs, ps_lsetfpregs, ps_lgetxregsize, ps_lgetxregs, ps_lsetxregs, ps_getpid): Moved to here from thread-db.c. * ptrace-target.c (continue_lwp, singlestep_lwp, attach_lwp, (ps_pstop, ps_pcontinue, ps_lstop, ps_lcontinue, ps_pdread, ps_pdwrite, ps_ptread, ps_ptwrite): Moved here from thread-db.c. (ptrace_handle_waitstatus): Renamed as handle_waitstatus. (ps_lcontinue): Implement (untested). * server.c (main): Check server_quit_p after calling gdbloop_poll. 2001-04-24 Michael Snyder * thread-db.c (continue_pid, continue_thread): New functions. (singlestep_pid, singlestep_thread): New functions. (continue_all_threads): Use new function continue_thread. (thread_db_continue_program): Ditto. (thread_db_singlestep_program): Ditto. (thread_db_continue_thread): Ditto. (thread_db_singlestep_thread): Ditto. * thread-db.c: Remove some debugging printfs. Add activation and handling of the thread debug signal. (get_thread_signals): Get the debug signal as well as the others. Set target flag to activate the debug signal. (set_target_int_by_name): New function. (struct gdbserv_thread): Rename "sigstopped" flag to just "stopped". (stop_all_threads): Mark the event thread "stopped". (wait_all_threads): Mark the event thread "waited". Don't stash the debug signal (throw it away). (continue_all_threads): Always send the restart signal to any thread that has just been attached. (thread_db_check_child_state): Make two calls to waitpid (one with WCLONE, one without) instead of alternating every other time. Add debug_signal to the list of events to ignore. (thread_db_attach): Add "__pthread_threads_debug" to list of symbols. 2001-04-20 Michael Snyder * thread-db.c (thread_db_check_child_state): Add SIGCHLD to the list of signals to ignore. When a thread exits, make sure that the other threads get restarted. 2001-04-19 Michael Snyder * thread-db.c (wait_all_threads): Save exit and term events. Save SIGINT like any other signal event. (send_pending_signals): Don't send SIGINT. (select_pending_event): Give preference to SIGINT. (thread_db_check_child_state): Move special handling of cancel and restart signals to after the stop_all_threads and wait_all_threads calls, so we can catch these signals even if they aren't the first signal we get notification of. 2001-04-19 Michael Snyder Major change to select an event so as to avoid starvation. * thread-db.c (select_pending_event): New function. Choose an event from the list of pending events, and make its thread the event thread. (stop_all_threads): Don't mark the event thread. That will now be done by select_pending_event. (struct signal_list): Rename to event_list. Save the thread and the entire wait status, so that all events (not just signals) can be saved. (add_pending_signal): Rename to add_pending_event. (send_pending_signals): Ignore non-signal events. Ignore the selected event (which will be returned to the debugger). Push back breakpoint events (moved here from wait_all_threads). (wait_all_threads): Remove special handling for SIGTRAP (moved into send_pending_signals). Call select_pending_event. (thread_db_check_child_status): Add initial event to event list. 2001-04-16 Michael Snyder * thread-db.c (thread_db_continue_thread): Handle the signal param. (thread_db_singlestep_thread): Ditto. (thread_db_check_child_state): Handle exit and termination separately. 2001-04-13 Michael Snyder * thread-db.c (find_new_threads_callback): Account for dead threads. (update_thread_list): Keep zombie threads in thread list, but delete them if they've been joined or detached. (stop_all_threads): Don't stop dead threads. (continue_all_threads): Don't continue if not waited. (thread_db_check_child_state): Move handling of terminate and exit earlier. Handle termination or exit of children specially. (thread_db_get_thread_reg): Test for defunct threads. (thread_db_set_thread_reg): Ditto. * ptrace-target.c (ptrace_xfer_mem): Don't be noisy about ptrace errors caused by illegal memory accesses. 2001-04-12 Andrew Cagney * server.c: Include "gdbloop.h". Replace gdbsocket_poll with gdbloop_poll. * ptrace-target.c, linux-target.c, solaris-target.c: * dummy-target.c: Update comments. 2001-04-11 Michael Snyder * thread-db.c (struct gdbserv_thread): Add new flag 'stepping'. (stop_all_threads): Add parameter 'process'. Set the process->event_thread here, instead of in check_child_state. (wait_all_threads): Accept process as a parameter instead of eventpid. Handle SIGTRAP differently if the thread was singlestepping. (thread_db_singlestep_program): Clear flags for event thread. (thread_db_singlestep_thread): Ditto. (thread_db_continue_program): Ditto. (thread_db_continue_thread): Ditto. (thread_db_check_child_state): Cancel the stepping flag. Don't set the event thread, this is now done in stop_all_threads. * linux-target.c (debug_get_reg, debug_get_pc): New functions. Purely for debugging output. Architecture dependent. 2001-04-09 Michael Snyder * thread_db.c (thread_db_continue_thread): Continue the actual thread given, not necessarily the event thread. (thread_db_singlestep_thread): Step the actual thread given, not necessarily the event thread. 2001-04-09 Michael Snyder * thread-db.c (stop_all_threads): Do not send SIGSTOP to a thread if it has already been sigstopped. (thread_db_continue_thread): New function. Continue a single thread. (thread_db_singlestep_thread): New function. Step a single thread. (thread_db_attach): Set up continue_thread, singlestep_thread methods. 2001-04-09 Michael Snyder * linux-target.c (PC_REGNUM): New enum, define. (decr_pc_after_break): New function. Architecture dependent. This version will probably serve for all targets for which DECR_PC_AFTER_BREAK is one. Those for which it is zero will want to define a no-op version of this function. * thread-db.c (first_thread_in_list): New function. (update_thread_list, stop_all_threads, wait_all_threads, continue_all_threads): Use first_thread_in_list in for loops. (wait_all_threads): Handle SIGINT and SIGTRAP specially. Throw away SIGINT for all threads but the event thread. For SIGTRAP in other than the event thread, call decr_pc_after_break (giving the thread a chance to hit the trap again later). (thread_db_continue_program, thread_db_singlestep_program): Continue the event thread before all the others. 2001-04-05 Michael Snyder * thread-db.c (add_pending_signal, send_pending_signals): New functions. Allow wait_all_threads to collect any signals other than SIGSTOP from the threads and defer them. (wait_all_threads): Loop on each thread and call waitpid until we get SIGSTOP. Any other signals are pended by throwing them into a list, and then sending them back to the threads using kill. (thread_db_get_thread_reg): Remove temporary hack for libthread_db bug. (thread_db_set_thread_reg): Ditto. 2001-04-04 Michael Snyder * server.h (struct child_process): Add a 'running' flag. * thread_db.c (continue_all_threads): Take gdbserv as argument. Use it to find the current thread, and don't continue that one (leave it up to the parent method to continue the event thread.) (thread_db_continue_program): Child is running -- set a flag. (thread_db_singlestep_program): Ditto. (thread_db_check_child_state): Return immediately unles the child is running. Because this is a polling routine, we don't want to return any new events unles the child is officially running. Call waitpid with -1 instead of the process->pid, so that we can get events from the threads. Alternately use __WCLONE. (thread_db_get_thread_reg): If thread is not specified, use the event thread (if possible). Temporarily hack around a bug in the thread_db library. (thread_db_set_thread_reg): Ditto. 2001-04-04 Michael Snyder * thread-db.c (continue_all_threads): Zero the attached, stopped, and waited flags only if thread is successfully continued. * linux-target.c: Fix broken endif directive. * configure.in: Test for sys/procfs.h. * config.in: Define HAVE_SYS_PROCFS_H. * configure: Regenerate. * thread-db.c (thread_list_lookup_by_pid): New function. (thread_db_check_child_state): Cache the event thread. (thread_db_fromtarget_thread_break): New function. Call gdbserv_fromtarget_thread_break with the event thread. (thread_db_attach): Take over the fromtarget_break vector. * server.h (struct child_process): Add event_thread field. 2001-04-02 Michael Snyder * thread-db.c: include errno.h for error reporting. (struct gdbserv_thread): Add flag 'waited'. (thread_db_type_str): New function for thread_extra_info. (find_new_threads_callback): Use errno for error reporting. (thread_db_thread_info): New function, for thread_extra_info. (wait_all_threads): New function. Call waitpid on all threads that have been attached or sigstopped. Incomplete -- needs to push back any signals other than SIGSTOP. (continue_all_threads): Send PTRACE_CONT only to threads that have been attached or sigstopped. (check_child_state): Call wait_all_threads. (thread_db_attach): Activate thread_info vector. 2001-03-30 Michael Snyder * linux-target.c (linux_read_reg, linux_write_reg): New functions. Abstract out the code to actually read a register value, so that it can be shared by several methods. (get_gregset): Use sizeof (GREGSET_T). (generic_linux_gg_reg_nr): New function. Support new reg methods. (generic_linux_next_gg_reg): Ditto. (generic_linux_sizeof_reg): Ditto. (generic_linux_reg_format): Ditto. (generic_linux_get_reg): New function. Newer register method, non-thread-aware version. (linux_attach): Use new register method in target vector. * thread-db.c: Remove some developmental ifdef code. (thread_db_get_thread_reg): Fall back on parentvec.get_reg if no thread or no thread_agent available. (thread_db_attach): Replace get_reg vector with get_thread_reg. * ptrace-target.c (ptrace_write_user): For X86 target, skip write-protected location in user/context address space. * linux-target.c (linux_process_get_reg): Use linux_read_reg. (linux_process_set_reg): Use linux_write_reg. (put_gregset): New function. Write child's gregset. (generic_linux_get_reg): Use SIZEOF_MAPPEDREG. (generic_linux_set_reg): New function. Newer register method. (linux_attach): Add set_reg to target vector, not process_set_reg. * thread-db.c (ps_lsetregs): Implement by calling put_gregset. (thread_db_set_thread_reg): New function. Implement set_thread_reg. (thread_db_attach): Add set_thread_reg to target vector. 2001-03-29 Michael Snyder * ptrace-target.c (ptrace_read_user, ptrace_write_user): Accept an explicit pid instead of a struct gdbserv. * linux-target.c: Include gdb_proc_service.h for gregset_t (FIXME: better place to get it from?) (linux_register_offset): Return signed long to facilitate test for -1 error return value. (ppc_linux_xfer_reg, linux_process_get_reg, linux_process_set_reg): Calls to ptrace_read_user and ptrace_write_user now need a pid argument instead of a struct gdbserv. (reg_from_gregset): New function. (reg_to_gregset): New function. (get_gregset): New function. Read child's gregset. * thread-db.c (ps_lgetregs): Implement by calling get_gregset. (thread_db_dlopen, thread_db_open, thread_db_attach): Change sense of return: -1 now means failure, 0 means success. (thread_db_get_thread_reg): Call reg_from_gregset. 2001-03-29 Michael Snyder * thread-db.c: Include signal.h, sys/ptrace.h (FIXME ptrace). (struct symbol_cache): Make value (address) unsigned. (add_symbol_to_list, lookup_cached_symbol): Ditto. (struct gdbserv_thread): Add attached, stopped flags to thread. (add_thread_to_list): Return pointer to new thread in list. (delete_thread_from_list): New function. (ps_pglobal_lookup, ps_pdread, ps_pdwrite, ps_ptread, ps_ptwrite): Muffle debugging output. (find_new_threads_callback): Muffle debugging output. Add thread to list only if it isn't already there. Use ptrace to attach to new threads. (FIXME explicit ptrace). (update_thread_list): New function. Only place where td_ta_thr_iter is called. Builds up the thread list, prunes it of any dead threads. (thread_db_thread_next): Call update_thread_list. (get_thread_signals): Read the values of the cancel and restart signals from the target using hardcoded symbol names. (stop_all_threads): New function. First cut. Deliver SIGSTOP to all threads except the event thread and any new threads that have just been attached. (continue_all_threads): New function. First cut. Deliver PTRACE_CONT to all threads except the main thread. Needs work. (thread_db_continue_program): New function. (thread_db_singlestep_program): New function. (thread_db_get_thread_reg): New function, incomplete. (thread_db_attach): Take over continue_program, singlestep_program. Muffle some debugging output. 2001-03-26 Michael Snyder * thread-db.c: New file. Linux thread debugging layer. * linux-target.c (linux_attach): Call thread_db_attach. * ptrace-target.c: Export ptrace_handle_waitstatus for thread-db.c (FIXME). * configure.in: Add thread-db.c to linux target modules. (GREGSET_T, FPREGSET_T, HAVE_LWPID_T, HAVE_PSADDR_T, HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T, LINUX_TARGET): Define. * config.in (GREGSET_T, FPREGSET_T, HAVE_LWPID_T, HAVE_PSADDR_T, HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T, LINUX_TARGET): Default undefine. * configure: Regenerate. * Makefile.am (INCLUDES): Add $(srcdir)/../../include (devo/include), so that header files can be shared with gdb. (server_LDFLAGS): Add -ldl -rdynamic (FIXME configure). * Makefile.in: Regenerate. 2001-03-22 Andrew Cagney * server.c (main): Pass gdbserver.attach and process to gdbserver_startup instead of gdbserver_poll. 2001-03-16 Michael Snyder * linux-target.c (linux_detach): Pass new parameter to ptrace_detach. Fix file header comment typo. Update copyright. 2001-03-16 Elena Zannoni * dummy-target.c (dummy_detach): Add new parameter. * linux-target.c (linux_detach): Ditto. * ptrace-target.c (ptrace_detach): Ditto. * solaris-target.c (solaris_detach): Ditto. 2001-03-14 Andrew Cagney * ChangeLog: Move to here from ../native. * Makefile.am: Ditto. * aclocal.m4: Ditto. * configure.in: Ditto. * dummy-target.c: Ditto. * linux-target.c: Ditto. * ptrace-target.c: Ditto. * ptrace-target.h: Ditto. * server.c: Ditto. * server.h: Ditto. * solaris-target.c: Ditto. * Makefile.in: Regenerate. * config.in: Ditto. * configure: Ditto. 2001-03-14 Andrew Cagney * Makefile.am (INCLUDES): Update. Headers moved to ../include. * Makefile.in: Regenerate. 2000-11-27 Michael Snyder * ptrace-target.c (ptrace_xfer_mem): Return -1 on error. 2000-11-21 Michael Snyder * ptrace-target.c (noop_flush_i_cache): Comment out superfluous debugging output. * linux-target.c (linux_process_get_reg): Return value of linux_register_offset is unsigned (can't be less than zero). (linux_process_rcmd): Just use '1' and '0' to control debug output. 2000-11-06 Michael Snyder * dummy-target.c (dummy_attach): Fix order of memset args. * linux-target.c (linux_attach): Ditto. * ptrace-target.c (ptrace_attach): Ditto. * solaris-target.c (solaris_attach): Ditto. 2000-10-19 Belinda Brazelle * linux-target.c: Add support for Arm processor. 2000-10-12 Michael Snyder * ptrace-target.c (ptrace_handle_waitstatus): Save exitstatus in process->stop_signal. 2000-09-14 Michael Snyder * linux-target.c: Define regmap etc. for SH target. * configure.in: Add defines for SH target. * configure: Rebuild. 2000-09-13 Michael Snyder * server.h (fromtarget_terminate): New field. Also fix up some overlooked function prototypes in the existing fields. (struct client_process): Rename to struct child_process. * linux-target.c (linux_fromtarget_terminate): New function. Called from main when child terminates abnormally. (linux_process_rcmd): New function. Catches "qRcmd" requests, which are currently used just to turn on debug output. * ptrace-target.c (ptrace_handle_waitstatus): Set stop_signal for the WIFSTOPPED case. (ptrace_process_signal): Return zero instead of the signal number, to let libremote know that we have handled the signal. (ptrace_xfer_memory): Fix off-by-one error. * solaris-target.c (solaris_fromtarget_terminate): New function. * server.c (main): Call fromtarget_terminate for the 'T' case. Do not request a one-second delay from gdbsocket_poll. 2000-09-08 Michael Snyder * solaris-target.c: New file. Just a prototype, doesn't actually work. Used to confirm configurability to multiple targets. * dummy-target.c: New file. Dummy back-end for implementing new targets such as solaris-target.c (above), before actually having a working back-end. The dummy target works just like the sample target in the samples directory. * configure.in: Add AC_SUBST(TARGET_MODULES) to add the appropriate target modules to the Makefile. Add solaris target. * configure: Regenerate. * Makefile.am: Move *-target.c into EXTRA_server_SOURCES. Add TARGET_MODULES to server_LDADD. Define server_DEPENDENCIES. * Makefile.in: Regenerate. * ptrace-target.h: New file. Defines needed only by ptrace. * server.h: Remove ptrace-specific defines to ptrace-target.h. (struct server_vector): New, for target entry points. (struct nativeserver): Rename to struct client_process. * server.c: Use client_process for entry points, and server_vector. * linux-target.c: Include ptrace-target.h. (ppc_linux_get_reg): Rename to ppc_linux_process_get_reg. (ppc_linux_set_reg): Rename to ppc_linux_process_set_reg. (ppc_linux_get_regs): Rename to ppc_linux_process_get_regs. (ppc_linux_set_regs): Rename to ppc_linux_process_set_regs. (linux_get_reg): Rename to linux_process_get_reg. (linux_set_reg): Rename to linux_process_set_reg. (linux_get_regs): Rename to linux_process_get_regs. (linux_set_regs): Rename to linux_process_set_regs. (gdbserver_check_child_state): Rename to linux_check_child_state. (gdbserver_fromtarget_break): Rename to linux_fromtarget_break. (gdbserver_fromtarget_exit): Rename to linux_fromtarget_exit. (struct server_vector gdbserver): New, defines entry points. * ptrace-target.c: Include ptrace-target.h. * aclocal.m4: New file. 2000-09-08 Michael Snyder * linux-target.c (linux_get_reg, linux_set_reg): Remove direct calls to ptrace; instead use service call into ptrace-target.c. (linux_get_regs, linux_set_regs): Remove ifdef PPC; instead use an ifdef in linux_attach to set up the target vector pointers. (linux_attach): If PPC_LINUX_TARGET, use PPC versions of register functions instead of generic ones. Define process_set_reg, so that the "P" command is now handled. 2000-09-07 Michael Snyder * ptrace-target.c (ptrace_read_user, ptrace_write_user): New functions. Exported so that linux-target does not have to call ptrace directly. (ptrace_get_gregs, ptrace_set_gregs, ptrace_get_fpregs, ptrace_set_fpregs): New functions. Exported for use by targets that use these methods. (ptrace_xfer_mem): Use ptrace_arg3_type instead of long. Add address to error messages. * linux-target.c: Start using config macros, port to alpha and ppc. (ppc_linux_xfer_reg, ppc_linux_getset_reg, ppc_linux_get_reg, ppc_linux_set_reg, ppc_linux_get_regs, ppc_linux_set_regs): New functions. Explicit knowledge of ppc linux register layout. (linux_get_reg): Catch undefined regmap offsets. (linux_set_reg): Ditto. (linux_get_regs): Conditionally call ppc_linux_get_regs. (linux_set_regs): Ditto. * configure.in: Add PPC target, and export target defines. * configure: Regenerate. * config.in: Add new target defines. 2000-09-06 Michael Snyder * Makefile.am: Define CC and CFLAGS. * Makefile.in: Regenerate. * configure.in: New file. Detect all manner of things. * config.in: New file. Input file for config.h. * configure: Generate. * ptrace-target.c (ptrace_xfer_type): Move def'n into server.h. (PTRACE_XFER_SIZE): Ditto. * linux-target.c (ptrace_xfer_type): Move def'n into server.h. (ptrace_arg3_type): Ditto. * server.h: Use config macros to determine definitions of ptrace_xfer_type, ptrace_arg1_type, ptrace_arg2_type, ptrace_arg3_type, ptrace_arg4_type. 2000-09-05 Michael Snyder * server.c (main): Detect exit status, and call fromtarget_exit instead of fromtarget_break. * linux-target.c (gdbserver_fromtarget_exit): New function. * ptrace-target.c (ptrace_kill_program, ptrace_sigkill_program): New functions. Send signals to the child. (ptrace_exit_program): New function. 2000-09-05 Michael Snyder * linux-target.c (linux_attach): Activate process_signal vector. (gdbserver_check_child_state): Send real received signal, instead of faking SIGTRAP. * ptrace-target.c (ptrace_break_program): New function. Implement control-c interrupt from host. (ptrace_process_signal): Implement continuation signal. (ptrace_singlestep_program): Ditto. (ptrace_continue_program): Ditto. (ptrace_get_trap_number): New function. Return signal to libremote. (ptrace_compute_signal): Ditto. (ptrace_attach): Activate break_program, process_signal, compute_signal and get_trap_number vectors. server.h (struct nativeserver): add signal_to_send field. Rename stop_sig to stop_signal. 2000-09-05 Michael Snyder * ptrace-target.c (ptrace_singlestep_program): Make ptrace args long. FIXME: needs to be configurable. * linux-target.c (linux_get_reg, linux_set_reg): Make regaddr and regval configurable types. FIXME needs real configury. 2000-09-01 Michael Snyder New directory "native" for native gdbserver in libremote. * server.c: New file. Entry point and main event loop. * server.h: New file. Shared declarations. * linux-target.c: New file. Linux version of libremote native stub. * ptrace-target.c: New file. Ptrace operations for libremote stub. * Makefile.am: New file. Automake source. * Makefile.in: New file. Automake-generated makefile source. Note: this work is incomplete and only partially working.