Commit Graph

72 Commits

Author SHA1 Message Date
Jason Molenda 87feff9dab 1998-10-06 Jason Molenda (jsm@bugshack.cygnus.com)
Eliminate a few warnings from the compiler.
        * breakpoint.h: Add prototype.
        * breakpoint.c (do_enable_breakpoint): cast mem_cnt, i to (void).
        * configure.in: Check if strdup declaration is necessary.
        * configure: Regenerated.
        * defs.h: Add prototypes.
        * gdb_string.h: Only define strdup if necessary.
        * gdbthread.h: Add prototypes.
        * printcmd.c: Add prototyptes.
        (disassemble_command): Remove unused variable 'section'.
        * symtab.c: Add prototypes.
        * symtab.h: Include gnu-regex.h, add prototype.
        * thread.c: Add prototype.
1998-10-06 22:24:40 +00:00
Martin Hunt 4ff5d55a08 Sun Aug 30 00:49:18 1998 Martin M. Hunt <hunt@cygnus.com>
* gdbtk-cmds.c (Gdbtk_Init): Link C variable gdb_context
	with tcl variable gdb_context_id.

	* gdbtk-hooks.c (gdbtk_context_change): Implement new hook called
	context_hook.  Called when threads change.

	* gdbtk.c: Initialize gdb_context.

	* gdbtk.h: Declare gdb_context.

	* infrun (wait_for_inferior): Call context_hook.

	* thread.c (thread_command): Call context_hook.

	* defs.h: Declare context_hook.
1998-08-30 07:53:29 +00:00
David Taylor 022278948f fix for PR 13618 -- gdb incorrectly reports thread information.
If other systems besides nm-sun4sol2 exhibit the problem, they may need
definitions of FIND_NEW_THREADS and a corresponding support function.
1997-10-24 21:04:39 +00:00
Michael Snyder 3780c33708 Wed May 21 16:03:25 1997 Michael Snyder <msnyder@cleaver.cygnus.com>
* procfs.c (init_procinfo): new function, abstracts some code
        shared by create_procinfo and do_attach;
        (procfs_set_inferior_syscall_traps): new function, abstracts
        some code needed by procfs_init_inferior, do_attach, and
        procfs_lwp_creation_handler; (procfs_first_available): new
        function, find any LWP that's runnable; (procfs_thread_alive):
        replace stub function with real implementation;
        (procfs_lwp_creation_handler): fix bug starting new child
        threads; (info_proc): bug fixes and enhancements for the
        "INFO PROCESSES" command; (close_procinfo_file): call new
        function "delete_thread" to cleanup GDB's thread database;
        (proc_init_failed): add new argument "kill", to control whether
        process is killed (so this function can be shared by
        create_procinfo and do_attach); (procfs_exit_handler): handle
        exit from an attached process, and cleanup procinfo handles
        when the process exits; (procfs_resume, procfs_wait): cleanup
        after a thread when it exits; (do_attach, do_detach): handle
        attached processes with multiple threads; plus some general
        improvements in the diagnostic output.
        * sol-thread.c (sol_thread_alive): replace stub with real
        implementation; (thread_to_lwp, lwp_to_thread): enhance to
        handle threads that may have exited; (sol_thread_attach): add
        startup setup stuff; (sol_thread_detach): add unpush_target
        call; (sol_thread_mourn_inferior): add unpush_target call;
        (sol_thread_wait, sol_thread_resume): enhance to deal with
        thread exit cleanly; (sol_thread_new_objfile,
        sol_thread_pid_to_str): detect unsuccessful startup and
        don't crash; plus some general cleanup.
        * thread.c (delete_thread): new function, allows targets to
        notify gdb when a thread is no longer valid.
        * infrun.c (wait_for_inferior): don't try to detect a new
        thread on receiving a TARGET_EXITED event.
1997-05-21 23:33:33 +00:00
Michael Snyder 2847920ae9 Thu May 1 11:44:46 1997 Michael Snyder <msnyder@cleaver.cygnus.com>
* Finalize merge from Hurd folk.
	    Mon Oct 30 16:41:04 1995  Miles Bader  <miles@gnu.ai.mit.edu>
	    * thread.c (thread_apply_command, thread_apply_all_command,
	    thread_command): Make sure TP is alive.
	    (thread_alive): New function.
	    Tue Nov 14 14:31:03 1995  Miles Bader  <miles@gnu.ai.mit.edu>
	    * infrun.c (sig_print_info): Deal better with long signal names.
	    Wed Nov 22 15:23:35 1995  Miles Bader  <miles@gnu.ai.mit.edu>
	    * thread.c (thread_id_to_pid): New function.
	    Fri Dec  1 13:25:25 1995  Miles Bader  <miles@gnu.ai.mit.edu>
	    * gnu-nat.c: (set_thread_cmd_list, show_thread_cmd_list,
	    set_thread_default_cmd_list, show_thread_default_cmd_list):
	    New variables.  (set_thread_cmd, show_thread_cmd,
	    set_thread_default_cmd, show_thread_default_cmd): New functions.
	    Fri Apr 18 15:20:16 1997  Miles Bader  <miles@gnu.ai.mit.edu>
	    * gnu-nat.c (inf_startup): remove TASK parameter.
	    (inf_set_task): replace with new function (inf_set_pid).
	  * gdbthread.h: Add extern decl for thread_cmd_list.
1997-05-01 20:39:06 +00:00
Michael Snyder c889a1eb87 Mon Apr 28 21:25:32 1997 Michael Snyder <msnyder@cleaver.cygnus.com>
* Makefile.in: Add rule for gnu-nat.o and i386gnu-nat.o (Gnu Hurd)
        * config/i386/i386gnu.mh: remove rules for [i386]gnu-nat.o, now
        in Makefile.in (as for other targets); add NATDEPFILE corelow.o to
        satisfy symbol dependancy in solib.c (core_ops).
        * target.[ch] conditionalize Mach-specific signals so that they
        won't show up in non-Mach gdb's!
        * thread.c: add function thread_id_to_pid; change name of static
        function "thread_switch" to "switch_to_thread", to avoid conflict
        with Mach global symbol; move thread_cmd_list to global scope
        so targets can add their own thread commands.
        * infrun.c: sig_print_info: allow for long signal names.
        * gnu-nat.[ch]: tidying up comments.
        * gnu-nat.c: move several functions to static scope, just for tidy;
        remove calls to prune_threads and renumber_threads;
        gnu_wait must not return -1 when inferior exits;
        attach_to_child will modify inferior_pid in a way that allows
        fork_inferior to remain unchanged;
        remove extra arg from startup_inferior;
        move mach-specific thread commands here from thread.c.
1997-04-29 04:27:26 +00:00
Fred Fish b607efe714 See gdb ChangeLog entry with header:
Thu Jul 25 19:41:31 1996  Fred Fish  <fnf@cygnus.com>

for a rather huge set of changes.  I was going to put them here, but it
made cvs dump core.  :-(
1996-07-26 03:01:51 +00:00
Stu Grossman fdfa331511 * Makefile.in, breakpoint.c, corelow.c, fork-child.c, inflow.c,
infrun.c, mac-nat.c, procfs.c, remote.c, sol-thread.c, thread.c,
	win32-nat.c, config/nm-lynx.h:  Rename thread.h to gdbthread.h to
	avoid conflict with Solaris /usr/include/thread.h.
1996-05-09 21:24:20 +00:00
Fred Fish 6c9638b444 Update FSF address. 1995-08-02 03:41:12 +00:00
Jeff Law 43fc25c87e * inftarg.c (child_thread_alive): New function to see if a
particular thread is still running.
        (child_ops): Add child_thread_alive entry.
        * remote.c (remote_thread_alive): New function to see if a
        particular thread is still alive.
        (remote_ops): Add remote_thread_alive.
        * target.c (dummy_target): Add dummy entry for thread_alive.
        (cleanup_target): de_fault thread_alive too.
        (update_current_target): INHERIT thread_alive too.
        (debug_to_thread_alive): New function.
        (setup_target_debug): Add debug_to_thread_alive.
        * target.h (struct target_ops): Add to_thread_alive.
        (target_thread_alive): Define.
        * thread.c (info_threads_command): Don't call kill; use
        target_thread_alive instead.
        * config/nm-lynx.h (CHILD_THREAD_ALIVE): Define.
        * gdbserver/low-lynx.c (mythread_alive): New function.
        (mywait): Don't restart any threads after a new thread notification,
        let the generic code handle it.
        * gdbserver/low-sparc.c (mythread_alive): Dummy version.
        * gdbserver/low-sun3.c (mythread_alive): Likewise.
        * gdbserver/server.c (main): Handle thread_alive requests.
        * gdbserver/server.h (mythread_alive): Declare.
        * corelow.c (core_ops): Add dummy entry for thread_alive.
        * exec.c (exec_ops): Likewise.
        * m3-nat.c (m3_ops): Likewise.
        * monitor.c (monitor_ops): Likewise.
        * procfs.c (procfs_ops): Likewise.
        * remote-arc.c (arc_ops): Likewise.
        * remote-array.c (array_ops): Likewise.
        * remote-e7000.c (e7000_ops): Likewise.
        * remote-es.c (es1800_ops, es1800_child_ops): Likewise.
        * remote-mips.c (mips_ops): Likewise.
        * remote-pa.c (remote_hppro_ops): Likewise.
        * remote-sim.c (gdbsim_ops): Likewise.
        * sparcl-tdep.c (sparclite_ops): Likewise.

More lynx-6100 work
1995-07-13 21:40:22 +00:00
Jeff Law 88a294b1b7 * infrun.c (wait_for_inferior): When switching from one thread to
another, save infrun's state for the old thread and load infrun's
        previous state for the new thread.
        * thread.c (struct thread_info): Add new fields for thread specific
        state saved/restored in infrun.c.
        (add_thread): Initialize new fields.
        (load_infrun_state): New function.
        (save_infrun_state): New function.
        * thread.h (load_infrun_state): Provide external decl.
        (save_infrun_state): Likewise.

More single-stepping patches for lynx-6100.
1995-07-04 17:48:37 +00:00
Jim Kingdon 4cc1b3f79d * gdbserver/remote-utils.c (write_ok): Write "OK", not "Ok", to
match stubs and protocol spec.
	* gdbserver/remote-utils.c (remote_open): Cast to struct sockaddr
	when passing to function which expects that.

	The following changes aren't quite enough to make things work with
	LynxOS (apprently kernel problems).
	* infrun.c (wait_for_inferior): When resuming new thread, pass pid
	not -1 for remote case.
	* thread.c (info_threads_command): Give error if !target_has_stack.
	* infrun.c (start_remote): Call init_thread_list.
	* thread.c (info_threads_command): Don't call kill for remote
	debugging target.
	* target.c (normal_pid_to_str): Print "thread" not "process" for
	remote.
	* remote.c, gdbserver/*: Add 'H', 'S', and 'C' requests, 'X'
	response, and `thread' part of 'T' response.
	* gdbserver/*: If program exits, send packet to GDB before
	exiting.  Handle termination with a signal the same as exiting
	with an exitstatus.
	* remote.c: Don't try to kill program after getting an 'X'
	response.
	* infrun.c (wait_for_inferior): Add comment about kill versus mourn.
1994-12-08 22:54:33 +00:00
Jim Kingdon 16726dd15b The point of these changes is to avoid reading the frame pointer
and stack pointer during stepping, to speed things up.
	A.  Changes to not select a frame until we need a selected frame:
	    * blockframe.c (flush_cached_frames): Call select_frame (NULL, -1).
	    * infrun.c (wait_for_inferior): Move call to select_frame back to
	    normal_stop.  This reverts a change of 13 Apr 94 (it says Jeff
	    Law, but the change was my idea); the only reason for that change
	    was so we could save and restore the selected frame in
	    wait_for_inferior, and now that flush_cached frames clears the
	    selected frame, that should work OK now.
	B.  Changes to not create a current_frame until we need one:
	    * blockframe.c (get_current_frame): If current_frame is NULL, try
	    to create an innermost frame.
	    * sparc-tdep.c (sparc_pop_frame), infcmd.c (run-stack_dummy),
	    infrun.c (wait_for_inferior), thread.c (thread_switch),
	    convex-tdep.c (set_thread_command), a29k-tdep.c (pop_frame),
	    alpha-tdep.c (alpha_pop_frame), convex-xdep.c (core_file_command),
	    h8300-tdep.c (h8300_pop_frame), h8500-tdep.c (h8300_pop_frame),
	    hppa-tdep.c (hppa_pop_frame), i386-tdep.c (i386_pop_frame),
	    i960-tdep.c (pop_frame), m68k-tdep.c
	    (m68k_pop_frame), mips-tdep.c (mips_pop_frame), rs6000-tdep.c
	    (push_dummy_frame, pop_dummy_frame, pop_frame), sh-tdep.c
	    (pop_frame), config/arm/tm-arm.h (POP_FRAME),
	    config/convex/tm-convex.h (POP_FRAME), config/gould/tm-pn.h
	    (POP_FRAME), config/ns32k/tm-merlin.h (POP_FRAME),
	    config/ns32k/tm-umax.h (POP_FRAME), config/tahoe/tm-tahoe.h
	    (POP_FRAME), config/vax/tm-vax.h (POP_FRAME): Don't
	    call create_new_frame.
	    * corelow.c (core_open), altos-xdep.c (core_file_command),
	    arm-xdep.c (core_file_command), gould-xdep.c (core_file_command),
	    m3-nat.c (select_thread), sun386-nat.c (core_file_command),
	    umax-xdep.c (core_file_command): Don't call create_new_frame; do
	    call flush_cached_frames.
	    * blockframe.c (reinit_frame_cache): Don't call create_new_frame
	    or select_frame.
	C.  Changes to get rid of stop_frame_address and instead only
	fetch the frame pointer when we need it.
	    * breakpoint.c (bpstat_stop_status): Remove argument
	    frame_address; use FRAME_FP (get_current_frame ()).
	    * infrun.c (wait_for_inferior): Don't pass frame pointer to
	    bpstat_stop_status.
	    * infrun.c (wait_for_inferior): Use FRAME_FP (get_current_frame
	    ()) instead of stop_frame_address.
	    * infrun.c (save_inferior_status, restore_inferior_status),
	    inferior.h (struct inferior_status): Don't save and restore
	    stop_frame_address.
	    * inferior.h, infcmd.c, thread.c (thread_switch), m3-nat.c
	    (select_thread): Remove stop_frame_address and uses thereof.
	D.  Same thing for the stack pointer.
	    * infrun.c (wait_for_inferior): Remove stop_sp and replace
	    uses thereof with read_sp ().
	E.  Change to eliminate one nasty little spot where we were
	wanting to know the frame pointer from before the current step
	(idea from GDB 3.5, which saved my ass, because my other ideas of
	how to fix it were very baroque).
	    * infrun.c: Remove prev_frame_address.
	    * infrun.c (wait_for_inferior, step_over_function): Use
	    step_frame_address instead of prev_frame_address.
	F.  Same basic idea for the stack pointer.
	    * inferior.h, infcmd.c: New variable step_sp.
	    * infcmd.c (step_1, until_next_command): Set it.
	    * infrun.c: Remove prev_sp and replace uses by step_sp.
	    * infrun.c (wait_for_inferior): If we get out of the step
	    range, then set step_sp to the current stack pointer before we
	    start going again.
1994-10-08 03:41:21 +00:00
Jim Kingdon 89ce0c8f50 gcc -Wall lint:
* thread.c: Include "gdbcmd.h" and <ctype.h>.
	* Makefile.in: Update dependency.
	* thread.c (thread_command): Remove unused variable p.
	* values.c (unpack_double): Use len instead of TYPE_LENGTH (type).
	* valprint.c (print_floating): Correctly check sign bit now that
	we are using unsigned arithmetic.
	* symtab.c (find_pc_line_range): Remove unused variables exact_match,
	ind, and l.
1993-11-10 15:58:48 +00:00
Stu Grossman 5090e82cca * inflow.c (terminal_init_inferior): Temporarily use Lynx PIDGET
macro to set process groups.
	* infptrace.c (child_resume): Temporarily use Lynx PIDGET to
	specify resumption of all threads.
	* infrun.c (wait_for_inferior):  Fix handling of thread-specific
	breakpoints for systems where DECR_PC_AFTER_BREAK > 0 (ie: backup
	PC by the right amount when continuing the thread).
	* thread.c (thread_apply_command):  Add the  `thread apply'
	command to apply a given GDB command to a list of threads.
1993-11-05 19:27:49 +00:00
Stu Grossman de43d7d005 * breakpoint.c (breakpoint_thread_match break_command_1):
Thread-specific breakpoint support.
* breakpoint.h (struct breakpoint):  Add thread id field.
* fork-child.c (fork_inferior):  Move call to init_thread_list()
back a bit so that init_trace_fun can do thread functions.
* hppa-tdep.c (restore_pc_queue):  Add pid to call to target_wait.
* hppab-nat.c (child_resume):  Handle default pid.
* hppah-nat.c (child_resume):  Handle default pid.
* i386lynx-nat.c (child_wait):  New arg pid.
* inflow.c (kill_command):  Reset thread list.
* infptrace.c (child_resume):  Handle default pid.
* infrun.c:  Thread-specific breakpoint support.
* inftarg.c (child_wait):  Add pid arg.
* osfsolib.c (solib_create_inferior_hook):  Add pid to call to
target_resume.
* procfs.c:  Multi-thread support.
* remote-bug.c (bug_wait):  Add pid arg.
* remote-hms.c (hms_wait):  Add pid arg.
* remote-mips.c (mips_wait):  Add pid arg.
* remote-mon.c (monitor_wait):  Add pid arg.
* remote-nindy.c (nindy_wait):  Add pid arg.
* remote-sim.c (gdbsim_wait):  Add pid arg.
* remote-udi.c (udi_wait):  Add pid arg.
* remote-vx.c (vx_wait):  Add pid arg.
* remote-z8k.c (sim_wait):  Add pid arg.
* remote.c (remote_wait):  Add pid arg.
* solib.c (solib_create_inferior_hook):  Add pid to call to
target_resume.
* target.h (struct target_ops):  Add pid arg to to_wait and
to_notice_signals.
* thread.c (valid_thread_id):  New func to validate thread #s.
* (pid_to_thread_id):  New func to do the obvious.
* thread.h:  Prototypes for above.

* coff-solib.c (coff_solib_add):  Use nameoffset field to locate
filename.
1993-10-16 06:42:02 +00:00
Stu Grossman d113e6b28e * corelow.c: Add multi thread/process support for core files with
.reg/XXX pseudo-sections.
* i386lynx-nat.c thread.h thread.c:  Remove unnecessary core file
support.
1993-09-25 00:40:20 +00:00
Jim Kingdon 37c99ddb4e * inferior.h, infrun.c, thread.c, infcmd.c: Remove all uses of
pc_changed.  If it was ever set to a non-zero value, it was before
	GDB 2.8.  It doesn't seem to have any useful function.
1993-09-13 20:54:00 +00:00
K. Richard Pixley 46c28185ab some gcc lint 1993-09-08 20:15:34 +00:00
Jim Kingdon 3082244d35 * thread.c (thread_switch): Define as static.
(add_thread): Cast return value from xmalloc.
1993-08-02 22:13:32 +00:00
Stu Grossman da0baf42e1 Mon Aug 2 11:30:57 1993 Stu Grossman (grossman at cygnus.com)
* i386lynx-nat.c, thread.c, thread.h:  Update copyrights.
1993-08-02 18:33:21 +00:00
Stu Grossman 25286543da Sun Aug 1 22:58:18 1993 Stu Grossman (grossman at cygnus.com)
* Makefile.in (CLIBS):  Reorder to make Lynx ld happy.
	* (HFILES):  New file thread.h.
	* (OBS):  New file thread.c.
	* configure.in:  Host config for Lynx/386.
	* fork-child.c (fork_inferior):  Call init_thread_list().
	* infrun.c (resume):  Add pid to invocation of target_resume().
	* (wait_for_inferior): Pay attention to pid from target_wait().
	Multi-threading code now uses this to determine what to do.
	* inftarg.c (child_wait):  Conditionalize based on CHILD_WAIT macro.
	Use target_pid_to_str() macro throughout when printing pid.
	* inferior.h (child_resume):  Add pid to prototype.
	* hppab-nat.c hppah-nat.c infptrace.c (child_resume):  Pass in pid as
	argument, instead of using inferior_pid.
	* procfs.c (procfs_resume):  Pass in pid as argument.  Ignored for
	now.  Use target_pid_to_str() macro throughout for printing process id.
	* remote-adapt.c (adapt_resume):  Pass in pid as argument.
	* remote-eb.c (eb_resume):  Pass in pid as argument.
	* remote-es.c (es1800_resume):  Pass in pid as argument.
	* remote-hms.c (hms_resume):  Pass in pid as argument.
	* remote-mips.c (mips_resume):  Pass in pid as argument.
	* remote-mm.c (mm_resume):  Pass in pid as argument.
	* remote-monitor.c (monitor_resume):  Pass in pid as argument.
	* remote-nindy.c (nindy_resume):  Pass in pid as argument.
	* remote-sa.sparc.c (remote_resume):  Pass in pid as argument.
	* remote-sim.c (rem_resume):  Pass in pid as argument.
	* remote-sp64sim.c (simif_resume):  Pass in pid as argument.
	* remote-st.c (st2000_resume):  Pass in pid as argument.
	* remote-udi.c (udi_resume):  Pass in pid as argument.
	* remote-vx.c (vx_resume):  Pass in pid as argument.
	* remote-z8k.c (rem_resume):  Pass in pid as argument.
	* remote.c (remote_resume):  Pass in pid as argument.
	* solib.c (solid_create_inferior_hook):  Pass inferior_pid to
	target_resume().
	* target.c (normal_pid_to_str):  New routine to print out process
	ID normally.
	* target.h (struct target_ops):  Add pid to prototype at
	to_resume().  (target_resume):  Add pid argument.
	* (target_pid_to_str):  Default definition for normal type pids.
	* thread.c, thread.c:  New modules for multi thread/process control.
1993-08-02 06:25:36 +00:00