aboutsummaryrefslogtreecommitdiff
path: root/gdb/lin-lwp.c
AgeCommit message (Collapse)AuthorFilesLines
2003-10-082003-10-08 Jeff Johnston <jjohnstn@redhat.com>Jeff Johnston1-2/+5
* lin-lwp.c (stop_and_resume_callback): Set the resumed flag for any lwp we resume. (running_callback): Add lwps that have pending status events against them to be considered running.
2003-09-07 * lin-lwp.c (detach_callback): Don't call stop_wait_callback.Daniel Jacobowitz1-2/+96
(stop_wait_callback): Handle !lp->signalled also. (lin_lwp_has_pending, flush_callback): New functions. (lin_lwp_wait): Call flush_callback. * linux-proc.c (linux_proc_add_line_to_sigset): New function. (linux_proc_pending_signals): New function. * linux-nat.h (linux_proc_pending_signals): Add prototype.
2003-08-28 * lin-lwp.c (wait_lwp): New function, copied fromDaniel Jacobowitz1-78/+74
stop_wait_callback. Clean up. (stop_wait_callback): Use wait_lwp.
2003-08-17 * lin-lwp.c (child_wait): Call linux_record_stopped_pid.Daniel Jacobowitz1-0/+1
2003-08-17 * Makefile.in (i386-linux-nat.o): Update dependencies.Daniel Jacobowitz1-0/+20
* config/i386/nm-linux.h (LINUX_CHILD_POST_STARTUP_INFERIOR): Define. * config/nm-linux.h (CHILD_POST_STARTUP_INFERIOR, CHILD_POST_ATTACH) (CHILD_FOLLOW_FORK, KILL_INFERIOR): Define. * i386-linux-nat.c: Include "linux-nat.h". (child_post_startup_inferior): New function. * i386-nat.c (child_post_startup_inferior): Wrap in #ifdef. * infptrace.c (kill_inferior): Wrap in #ifdef. * lin-lwp.c (lin_lwp_attach_lwp): Call child_post_attach after attaching to each LWP. (child_wait, lin_lwp_wait): Call linux_handle_extended_wait. (init_lin_lwp_ops): Fill in some more operations. * linux-nat.h (linux_enable_event_reporting) (linux_handle_extended_wait, linux_child_post_startup_inferior): New prototypes. * linux-nat.c (linux_enable_event_reporting): New function. (child_post_attach, linux_child_post_startup_inferior) (child_post_startup_inferior, child_follow_fork) (linux_handle_extended_wait, kill_inferior): New functions.
2003-06-192003-06-19 Michael Snyder <msnyder@redhat.com>Michael Snyder1-37/+2
* linux-nat.h: New file. * linux-nat.c: Include linux-nat.h. * lin-lwp.c: Include linux-nat.h. Move struct lwp_info def to linux-nat.h. * linux-proc.c: Include linux-nat.h. (linux_make_note_section): Iterate over lwps instead of threads. (linux_do_thread_registers): Use lwp instead of merged pid. * config/nm-linux.h: Move miscelaneous def'ns to linux-nat.h. * Makefile.in (lin-lwp.o, linux-proc.o, linux-nat.o): Add dependency on linux_nat_h.
2003-06-19 * arch-utils.c (default_prepare_to_proceed): Remove.Daniel Jacobowitz1-40/+0
(generic_prepare_to_proceed): Remove. * arch-utils.h (default_prepare_to_proceed): Remove prototype. (generic_prepare_to_proceed): Remove prototype. * gdbarch.sh (PREPARE_TO_PROCEED): Remove. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * hppa-tdep.c (hppa_prepare_to_proceed): Remove dangling prototype. * hppah-nat.c (hppa_switched_threads): Remove. * infrun.c (prepare_to_proceed): New static function, copied from generic_prepare_to_proceed. Remove select_it argument. (proceed): Call prepare_to_proceed. * infttrace.c (old_gdb_pid, reported_pid, reported_bpt): Remove variables. (ptrace_wait): Don't set the removed variables. (hppa_switched_threads): Remove. * lin-lwp.c (lin_lwp_prepare_to_proceed): Remove. * config/nm-linux.h (PREPARE_TO_PROCEED): Don't define. (lin_lwp_prepare_to_proceed): Remove prototype. * config/i386/nm-x86-64linux.h (PREPARE_TO_PROCEED): Don't undefine. * config/pa/nm-hppah.h (PREPARE_TO_PROCEED): Don't define.
2003-06-18 * config/nm-linux.h (linux_record_stopped_pid): New prototype.Daniel Jacobowitz1-0/+40
* lin-lwp.c (child_wait): Call linux_record_stopped_pid. (lin_lwp_wait): Likewise. Update comments. * linux-nat.c (struct simple_pid_list, add_to_pid_list) (pull_pid_from_list, linux_record_stopped_pid): New.
2003-06-042003-06-04 Jeff Johnston <jjohnstn@redhat.com>Jeff Johnston1-12/+164
* acconfig.h: Add HAVE_TKILL_SYSCALL definition check. * config.in: Regenerated. * configure.in: Add test for syscall function and check for __NR_tkill macro in <syscall.h> to set HAVE_TKILL_SYSCALL. * configure: Regenerated. * lin-lwp.c [HAVE_TKILL_SYSCALL]: Include <unistd.h> and <sys/syscall.h>. (kill_lwp): New function that uses tkill syscall or uses kill, depending on whether threading model is nptl or not. All callers of kill() changed to use kill_lwp(). (lin_lwp_wait): Make special check when WIFEXITED occurs to see if all threads have already exited in the nptl model. (stop_and_resume_callback): New callback function used by the lin_lwp_wait thread exit handling code. (stop_wait_callback): Check for threads already having exited and delete such threads fromt the lwp list when discovered. (stop_callback): Don't assert retcode of kill call. Roland McGrath <roland@redhat.com> * i386-linux-nat.c (ps_get_thread_area): New function needed by nptl libthread_db.
2003-03-282003-03-28 Jeff Johnston <jjohnstn@redhat.com>Jeff Johnston1-120/+111
* thread.c: Reindented. * lin-lwp.c: Ditto. * linux-proc.c: Ditto.
2003-01-13 * lin-lwp.c (struct private_thread_info, find_lwp_callback): Remove.Daniel Jacobowitz1-40/+0
(resume_callback): Remove dead code.
2003-01-09 * lin-lwp.c (child_wait): Ignore exit statuses for processes otherDaniel Jacobowitz1-1/+20
than inferior_ptid. (lin_lwp_wait): Ignore exit statuses for unknown LWPs.
2003-01-06chael Snyder <msnyder@redhat.com>Michael Snyder1-31/+187
* lin-lwp.c: Added or elaborated on "debug lin-lwp" info. qCVS: Committing in .
2002-12-09 * lin-lwp.c (strsignal): Make extern declaration match that of glibc.Kevin Buettner1-1/+1
2002-12-042002-12-03 Andrew Cagney <ac131313@redhat.com>Andrew Cagney1-28/+4
* sparc-nat.c (fetch_inferior_registers) (store_inferior_registers): Add comment on problem of LWP vs threads. From 2002-11-21 Daniel Jacobowitz <drow@mvista.com> * lin-lwp.c (lin_lwp_fetch_registers): Remove. (lin_lwp_store_registers): Remove. (init_lin_lwp_ops): Use fetch_inferior_registers and store_inferior_registers directly. * sparc-nat.c (fetch_inferior_registers): Honor LWP ID. (store_inferior_registers): Likewise. Fix PR gdb/725.
2002-11-26 * acconfig.h (HAVE_PREAD64): Add.Daniel Jacobowitz1-1/+3
* configure.in: Check for pread64. * config.in: Regenerated. * configure: Regenerated. * lin-lwp.c (lin_lwp_xfer_memory): Call linux_proc_xfer_memory. * linux-proc.c (linux_proc_xfer_memory): New function. * config/nm-linux.h (linux_proc_xfer_memory): Add prototype.
2002-10-31 * lin-lwp.c (lin_lwp_resume): Remove resume_all test for !step.Daniel Jacobowitz1-5/+2
2002-08-27 * Makefile.in (osabi.o, i387-tdep.o, i386-linux-nat.o, lin-lwp.o,Tom Tromey1-0/+1
ax-gdb.o, signals.o, jv-valprint.o, c-valprint.o, cp-abi.o): Update dependencies. * i387-tdep.c: Include gdb_string.h. * osabi.c: Likewise. * i386-linux-nat.c: Likewise. * lin-lwp.c: Likewise. * ax-gdb.c: Likewise. * signals/signals.c: Likewise. * jv-valprint.c: Likewise. * p-lang.c: Likewise. * c-valprint.c: Likewise. * cp-abi.c: Likewise.
2002-03-31* lin-lwp.c (child_wait): Check SAVE_ERRNO instead of ERRNO inMark Kettenis1-1/+1
while statement.
2002-03-27s/strerror/safe_strerror/Andrew Cagney1-4/+4
2002-02-24* lin-lwp.c, thread-db.c, defs.h, cris-tdep.c: Replace ``Linux''Andrew Cagney1-25/+27
with either ``GNU/Linux'' or ``Linux kernel''. Fix PR gdb/378.
2001-11-21Fix two ``attach'' related bugs involving threads.Kevin Buettner1-0/+18
2001-10-14Fix attaching to cloned processes. This fixes PR gdb/61.Mark Kettenis1-19/+103
* lin-lwp.c (struct lwp_info): Add new member `cloned'. (is_cloned) Removed. (lin_lwp_attach_lwp): Don't call stop_wait_callback. Instead call waitpid explicitly. Mark the LWP as cloned if waitpid fails and retry with __WCLONE flag. (lin_lwp_attach): Likewise. Warn if attaching to a cloned process. (detach_callback): Replace use of is_cloned with explicit check on LWP id and process id. (stop_wait_callback): Replace use of is_cloned with check if LWP is marked as cloned. [CHILD_WAIT] (child_wait): New function. (lin_lwp_wait): Replace use of is_cloned with check if LWP is marked as cloned. Mark newly detected LWPs as cloned if detected by waitpid with __WCLONE flag. (kill_wait_callback): Replace use of is_cloned with check if LWP is marked as cloned. * config/i386/nm-linux.h (struct target_waitstatus): Add forward declaration. (child_wait): Add prototype. (CHILD_WAIT): Define.
2001-07-13* lin-lwp.c (lin_lwp_wait): Avoid check for resumed LWPs if thereMark Kettenis1-2/+3
are no registered LWPs yet.
2001-07-12* lin-lwp.c (stop_wait_callback): Add support for flushingMark Kettenis1-14/+25
signals. Use that in favour of the old code to get rid of superfluous SIGINTs. (lin_lwp_wait): Use the new support in stop_wait_callback to flush all but one SIGINT.
2001-07-07* lin-lwp.c (status_to_str): New function.Mark Kettenis1-13/+28
(lin_lwp_wait): Use it to print debug messages where appropriate.
2001-07-06* lin-lwp.c (count_events_callback): Fix formatting. Turn checkMark Kettenis1-68/+72
commented with "paranoia" into gdb_assert. (select_event_lwp_callback): Likewise. (cancel_breakpoints_callback): Bail out early if LP is the event LWP. Add comment about backup up breakpoints. Fix formatting and debug message. (select_event_lwp): Make solely repsonsible for switching event LWP. Fix formatting and remove bogus "ERROR" debug message. Don't backup breakpoints from here. (lin_lwp_wait): Don't touch LP->status, let select_event_lwp handle that. Only call select_event_lwp if we're not waiting for a specific LWP, i.e. when PID == -1. Backup breakpoints from here.
2001-07-062001-06-12 Michael Snyder <msnyder@redhat.com>Michael Snyder1-40/+213
* lin-lwp.c: Prevent thread starvation by using a monte carlo method to choose which of several event threads to handle next. (stop_wait_callback): Defer pushback of breakpoint events until later; add SIGTRAP events to the queue of unhandled events. Keep calling waitpid until SIGSTOP retrieved. If more than one non-SIGSTOP event is retrieved, push them back onto the process queue using kill. (count_events_callback, select_singlestep_lwp_callback, select_event_lwp_callback, cancel_breakpoints_callback, select_event_lwp): New functions. Implement monte carlo method for selecting which of several SIGTRAP threads to handle next. Push back the breakpoint event for all threads other than the selected one. (lin_lwp_wait): Call select_event_lwp to decide which of several sigtrapped lwps to handle next. (resume_callback): Disable code that attempts to handle step_resume breakpoints. Let core gdb handle this.
2001-06-07* lin-lwp.c (struct lwp_info): Add member `resumed'.Mark Kettenis1-12/+60
(iterate_over_lwps): Make sure we can handle CALLBACK deleting the LWP it's called for. (lin_lwp_attach): Mark LWP as resumed to make sure the fake SIGSTOP is reported. (resume_clear_callback): New function. (resume_set_callback): New function. (lin_lwp_resume): Mark all LWP's that we're going to resume as resumed, and unmark all others. (status_callback): Only report a pending wait status if we pretend that LP has been resumed. (resumed_callback): New function. (lin_lwp_wait): Add assertions to check that LWP's are properly marked as resumed. Partially revert 2001-05-25 patch by Michael Snyder: do not resume all threads. Add comment explaining the problems associated with this bit of code.
2001-06-06* arch-utils.c (generic_prepare_to_proceed): Allow for havingJonathan Larmour1-1/+4
stopped due to a Ctrl-C as well as breakpoints. * hppa-tdep.c (hppa_prepare_to_proceed): Add FIXME as this may not support thread switches after Ctrl-C. * lin-lwp.c (lin_lwp_prepare_to_proceed): Ditto. * linux-thread.c (linuxthreads_prepare_to_proceed): Ditto. * m3-nat.c (mach3_prepare_to_proceed): Ditto.
2001-05-302001-05-25 Michael Snyder <msnyder@redhat.com>Michael Snyder1-4/+22
* lin-lwp.c (lin_lwp_attach_lwp): Call stop_wait_callback, to consume the SIGSTOP generated by PTRACE_ATTACH. (stop_wait_callback): If a SIGTRAP or a SIGINT event is consumed, try again to get the SIGSTOP event. (lin_lwp_wait): Resume all threads when ignoring a signal. This will insure that newly attached threads get resumed.
2001-05-302001-05-25 Michael Snyder <msnyder@redhat.com>Michael Snyder1-1/+10
* lin-lwp.c (stop_wait_callback): Discard redundant SIGINT events.
2001-05-15Fix warnings resulting from fact that GET_LWP() now returns a long ratherKevin Buettner1-5/+5
than an int.
2001-05-15Redefine ptid_t to be a struct rather than an int.Kevin Buettner1-12/+4
2001-05-10Revert a couple of small changes that inadvertently came in via theKevin Buettner1-2/+2
2001-05-03 patch.
2001-05-10Minor ptid_t changes for the upcoming phase 3 ptid patch.Kevin Buettner1-2/+2
2001-05-06Consolidate save_inferior_ptid/restore_inferior_ptid implementation toKevin Buettner1-22/+1
one source file.
2001-05-06Implement attach/detach for multi-threaded programs on Linux.Mark Kettenis1-27/+85
* thread-db.c (keep_thread_db): Adjust comment. (deactivate_target): Removed. (thread_db_new_objfile): Don't call deactivate_target. Implement guts of deactivate_target inline instead. (attach_thread): Call ATTACH_LWP unconditionally if defined. (thread_db_attach): New function. (thread_db_detach): Don't call deactivate_target. Do necessary cleanup inline instead. Set inferior_ptid to LWP corresponding to the current user-level thread. (thread_db_kill): Set inferior_ptid to LWP corresponding to the current user-level thread. (thread_db_create_inferior): Deactivate target vector if KEEP_THREAD_DB is zero. (thread_db_mourn_inferior): Don't call deactivate_target. Do necessary cleanup inline instead. (init_thread_db_ops): Initialize to_attach field to thread_db_attach. * lin-lwp.c (lin_lwp_mourn_inferior): Remove prototype. (stop_wait_callback): Add prototype. (init_lwp_list): Add comment about when to re-initialize the LWP list. (lin_lwp_attach_lwp): Only call ptrace for cloned processes. Avoid adding publicates to the LWP list. Only mark an LWP as signalled if it doesn't correspond to a cloned process. (lin_lwp_attach): Add initial process to the LWP list. Make sure it's stopped and fake a SIGSTOP. (detach_callback): New function. (lin_lwp_detach): Implement. (lin_lwp_create_inferior): Don't re-initialize LWP list here. Call child_ops.to_create_inferior directly instead of via target_beneath local. (lin_lwp_mourn_inferior): Call child_ops.to_mourn_inferior directly instead of via target_beneath local.
2001-05-04Phase 1 of the ptid_t changes.Kevin Buettner1-104/+116
2001-05-012001-05-01 Michael Snyder <msnyder@redhat.com>Michael Snyder1-14/+23
* lin-lwp.c: Change printf to fprintf_unfiltered.
2001-04-302001-04-30 Michael Snyder <msnyder@redhat.com>Michael Snyder1-33/+39
* thread-db.c: Revert 2001-04-26 change for debugging output. * lin-lwp.c: Ditto. * lin-lwp.c: Add set/show debug lin-lwp command. Use this command to turn extra debugging output on / off.
2001-04-302001-04-30 Michael Snyder <msnyder@redhat.com>Michael Snyder1-28/+33
* thread-db.c: Revert 2001-04-26 change for debugging output. * lin-lwp.c: Ditto.
2001-04-262001-04-26 Michael Snyder <msnyder@redhat.com>Michael Snyder1-33/+28
* thread-db.c (_initialize_thread_db): Add set/show command "debug-linux-threads" for debugging output. * lin-lwp.c (various): Use global "debug_linux_threads to turn on extra debugging output.
2001-04-262001-04-26 Michael Snyder <msnyder@redhat.com>Michael Snyder1-6/+6
* lin-lwp.c: Minor cleanups in comments.
2001-04-062001-04-06 David Smith <dsmith@redhat.com>David Smith1-1/+5
* arch-utils.c (default_prepare_to_proceed) (generic_prepare_to_proceed): Added new functions. * arch-utils.h: New function declarations for default_prepare_to_proceed() and generic_prepare_to_proceed(). * gdbarch.sh: Added PREPARE_TO_PROCEED. * gdbarch.c: Regenerated. * gdbarch.h: Regenerated. * inferior.h: Added get_last_target_status() declaration. * infrun.c (get_last_target_status): Added new function. (handle_inferior_event): Saves last pid and waitstatus, which will get returned by get_last_target_status(). * hppa-tdep.c (prepare_to_proceed): Added comment stating that prepare_to_proceed() is potentially redundant since default_prepare_to_proceed() has been added. * linux-thread.c (prepare_to_proceed): Ditto. * lin-lwp.c (prepare_to_proceed): Ditto. * m3-nat.c (prepare_to_proceed): Ditto.
2001-03-30* lin-lwp.c (lin_lwp_resume): Don't mark LWP as not stopped untilMark Kettenis1-4/+4
we're absolutely sure we're going to resume it.
2001-03-01Create new file regcache.h. Update all uses.Andrew Cagney1-1/+2
2001-01-24* lin-lwp.c (lin_lwp_xfer_memory): Add attrib argument.J.T. Conklin1-1/+2
* thread-db.c (thread_db_xfer_memory): Likewise.
2000-12-15Replace free() with xfree().Kevin Buettner1-3/+3
2000-09-18* lin-lwp.c (stop_wait_callback): Remove bogus assertions in theMark Kettenis1-8/+13
code that deals with exiting/signalled threads. Replace with code similar to what's done in lin_lwp_wait.