Commit Graph

36 Commits

Author SHA1 Message Date
Daniel Jacobowitz 2a4b7c459e * lin-lwp.c (lin_lwp_resume): Remove resume_all test for !step. 2002-10-31 21:00:08 +00:00
Tom Tromey 309367d4cc * Makefile.in (osabi.o, i387-tdep.o, i386-linux-nat.o, lin-lwp.o,
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-08-27 22:37:14 +00:00
Mark Kettenis 2d1bfe2ed3 * lin-lwp.c (child_wait): Check SAVE_ERRNO instead of ERRNO in
while statement.
2002-03-31 15:10:38 +00:00
Andrew Cagney dc6728652c s/strerror/safe_strerror/ 2002-03-27 21:35:35 +00:00
Andrew Cagney 8605d56e7a * lin-lwp.c, thread-db.c, defs.h, cris-tdep.c: Replace ``Linux''
with either ``GNU/Linux'' or ``Linux kernel''.
Fix PR gdb/378.
2002-02-24 21:53:02 +00:00
Kevin Buettner da9c7185df Fix two ``attach'' related bugs involving threads. 2001-11-21 21:56:47 +00:00
Mark Kettenis cacab7c477 Fix attaching to cloned processes. This fixes PR gdb/61.
* 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-10-14 11:30:37 +00:00
Mark Kettenis 9a973a8fb2 * lin-lwp.c (lin_lwp_wait): Avoid check for resumed LWPs if there
are no registered LWPs yet.
2001-07-13 12:49:31 +00:00
Mark Kettenis de4ca854d8 * lin-lwp.c (stop_wait_callback): Add support for flushing
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-12 19:37:36 +00:00
Mark Kettenis 58eeadbab5 * lin-lwp.c (status_to_str): New function.
(lin_lwp_wait): Use it to print debug messages where appropriate.
2001-07-07 10:58:37 +00:00
Mark Kettenis 00d4fce629 * lin-lwp.c (count_events_callback): Fix formatting. Turn check
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-06 22:31:47 +00:00
Michael Snyder b1aeb4c5a3 2001-06-12 Michael Snyder <msnyder@redhat.com>
* 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-07-06 19:06:24 +00:00
Mark Kettenis fce0e6e1ed * lin-lwp.c (struct lwp_info): Add member `resumed'.
(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-07 19:31:10 +00:00
Jonathan Larmour 8849f47dd9 * arch-utils.c (generic_prepare_to_proceed): Allow for having
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-06-06 16:31:32 +00:00
Michael Snyder c4365b1915 2001-05-25 Michael Snyder <msnyder@redhat.com>
* 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-30 22:58:37 +00:00
Michael Snyder 5f885618b6 2001-05-25 Michael Snyder <msnyder@redhat.com>
* lin-lwp.c (stop_wait_callback): Discard redundant SIGINT events.
2001-05-30 18:15:45 +00:00
Kevin Buettner b08cfdb65e Fix warnings resulting from fact that GET_LWP() now returns a long rather
than an int.
2001-05-15 00:13:47 +00:00
Kevin Buettner ca6724c16a Redefine ptid_t to be a struct rather than an int. 2001-05-15 00:03:38 +00:00
Kevin Buettner 3d6e28e2e7 Revert a couple of small changes that inadvertently came in via the
2001-05-03 patch.
2001-05-10 01:34:17 +00:00
Kevin Buettner 01263b571c Minor ptid_t changes for the upcoming phase 3 ptid patch. 2001-05-10 01:07:39 +00:00
Kevin Buettner ce696e0556 Consolidate save_inferior_ptid/restore_inferior_ptid implementation to
one source file.
2001-05-06 22:22:03 +00:00
Mark Kettenis c194fbe18b Implement attach/detach for multi-threaded programs on Linux.
* 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-06 17:00:44 +00:00
Kevin Buettner 39f770628a Phase 1 of the ptid_t changes. 2001-05-04 04:15:33 +00:00
Michael Snyder 9085700cc0 2001-05-01 Michael Snyder <msnyder@redhat.com>
* lin-lwp.c: Change printf to fprintf_unfiltered.
2001-05-01 20:39:51 +00:00
Michael Snyder 7ca673cdc5 2001-04-30 Michael Snyder <msnyder@redhat.com>
* 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-30 20:25:07 +00:00
Michael Snyder 540af40015 2001-04-30 Michael Snyder <msnyder@redhat.com>
* thread-db.c: Revert 2001-04-26 change for debugging output.
	* lin-lwp.c:   Ditto.
2001-04-30 18:21:17 +00:00
Michael Snyder 20b8570d73 2001-04-26 Michael Snyder <msnyder@redhat.com>
* 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-26 23:14:20 +00:00
Michael Snyder 4c8de859cc 2001-04-26 Michael Snyder <msnyder@redhat.com>
* lin-lwp.c: Minor cleanups in comments.
2001-04-26 22:35:08 +00:00
David Smith e02bc4cc30 2001-04-06 David Smith <dsmith@redhat.com>
* 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-04-06 17:53:39 +00:00
Mark Kettenis 40564acad4 * lin-lwp.c (lin_lwp_resume): Don't mark LWP as not stopped until
we're absolutely sure we're going to resume it.
2001-03-30 19:45:19 +00:00
Andrew Cagney 4e052eda91 Create new file regcache.h. Update all uses. 2001-03-01 01:39:22 +00:00
J.T. Conklin e5da8f389f * lin-lwp.c (lin_lwp_xfer_memory): Add attrib argument.
* thread-db.c (thread_db_xfer_memory): Likewise.
2001-01-24 00:26:46 +00:00
Kevin Buettner b8c9b27d1e Replace free() with xfree(). 2000-12-15 01:01:51 +00:00
Mark Kettenis e63286713f * lin-lwp.c (stop_wait_callback): Remove bogus assertions in the
code that deals with exiting/signalled threads.  Replace with
code similar to what's done in lin_lwp_wait.
2000-09-18 13:09:12 +00:00
Mark Kettenis 3f07c44bc9 * lin-lwp.c (normal_mask, blocked_mask): New variables.
(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-09 07:54:20 +00:00
Mark Kettenis fb0e1ba780 * config/i386/nm-linux.h (PREPARE_TO_PROCEED, ATTCH_LWP,
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.
2000-09-03 18:41:28 +00:00