aboutsummaryrefslogtreecommitdiff
path: root/gdb/lin-lwp.c
AgeCommit message (Collapse)AuthorFilesLines
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.
2000-09-09* lin-lwp.c (normal_mask, blocked_mask): New variables.Mark Kettenis1-14/+62
(lin_lwp_wait): Block SIGCHLD here if it isn't already blocked. (lin_lwp_mourn_inferior): Restore the origional signal mask, and reset the mask of blocked signals. (_initialize_lin_lwp): Don't block SIGCHLD here, but do initialize suspend_mask and blocked_mask. This makes us pass gdb.base/sigall.exp for Linux/x86 now. (lin_thread_get_thread_signals): Treat the LinuxThreads "cancel" signal similarly to SIGCHLD in the generic code. Avoids GDB being terminated by a Real-time signal.
2000-09-03* config/i386/nm-linux.h (PREPARE_TO_PROCEED, ATTCH_LWP,Mark Kettenis1-0/+1048
GET_THREAD_SIGNALS): New defines. * config/i386/linux.mh (NATDEPFILES): Remove lin-thread.o and linux-threads.o. Add proc-service.o, thread-db.o and lin-lwp.o. * proc-service.c: New file. * thread-db.c: New file. * lin-lwp.c: New file.