* inferior.h (target_executing): Delete.
* gdbthread.h (struct thread_info): Add executing_ field.
(set_executing, is_executing): New.
* thread.c (main_thread_executing): New.
(init_thread_list): Clear it and also main_thread_running.
(is_running): Return false if target has no execution.
(any_running, is_executing, set_executing): New.
* top.c: Include "gdbthread.h".
(target_executing): Delete.
(execute_command): Replace target_executing check by any_running.
* event-top.c: Include "gdbthread.h".
(display_gdb_prompt, command_handler): Replace target_executing by
is_running.
* inf-loop.c: Include "gdbthread.h". Don't mark as not executing
here. Replace target_executing by is_running.
* infrun.c (handle_inferior_event): Mark all threads as
not-executing.
* linux-nat.c (linux_nat_resume): Don't mark thread as executing
here.
* stack.c (get_selected_block): Return null if inferior is
executing.
* target.c (target_resume): Mark resumed ptid as executing.
* breakpoint.c (until_break_command): Replace target_executing
check by is_executing.
* remote.c (remote_async_resume): Don't mark inferior as executing
here.
* mi/mi-interp.c (mi_cmd_interpreter_exec): Replace target_executing
by any_running.
* mi/mi-main.c (mi_cmd_exec_interrupt, mi_cmd_execute)
(mi_execute_async_cli_command): Replace target_executing by
is_running.
* frame.c (get_current_frame): Error out if the current thread is
executing.
(has_stack_frames): New.
(get_selected_frame, deprecated_safe_get_selected_frame): Check
has_stack_frames.
* Makefile.in (event-top.o, frame.o, inf-loop.o, top.o): Depend on
$(gdbthread_h).
* gdbthread.h (add_thread_with_info): New.
* linux-thread-db.c: Add some documentation.
(GET_LWP, GET_PID, GET_THREAD, is_lwp, is_thread, BUILD_LWP): Delete.
(struct private_thread_info): Remove th_valid and ti_valid.
Replace ti with tid.
(thread_get_info_callback): Do not add TID to the new ptid. Do
not cache th or ti.
(thread_db_map_id2thr, lwp_from_thread): Delete functions.
(thread_from_lwp): Assert that the LWP is set. Do not add TID to the
new PTID.
(attach_thread): Handle an already-existing thread. Use
add_thread_with_info. Cache the th and tid.
(detach_thread): Verify that private was set. Remove verbose
argument and printing. Update caller.
(thread_db_detach): Do not adjust inferior_ptid.
(clear_lwpid_callback, thread_db_resume, thread_db_kill): Delete.
(check_event, find_new_threads_callback): Do not add TID to the new PTID.
(thread_db_wait): Do not use lwp_from_thread.
(thread_db_pid_to_str): Use the cached TID.
(thread_db_extra_thread_info): Check that private is set.
(same_ptid_callback): Delete.
(thread_db_get_thread_local_address): Do not use it or check
is_thread. Check that private is set. Assume that the thread
handle is already cached.
(init_thread_db_ops): Remove to_resume and to_kill.
* thread.c (add_thread_with_info): New.
(add_thread): Use it.
* linux-nat.c (find_thread_from_lwp): Delete.
(exit_lwp): Do not use it. Check print_thread_events. Print before
deleting the thread.
(GET_PID, GET_LWP, BUILD_LWP, is_lwp): Move to...
* linux-nat.h (GET_PID, GET_LWP, BUILD_LWP, is_lwp): ...here.
* inf-ttrace.c (inf_ttrace_wait): Use print_thread_events and
printf_unfiltered for thread exits.
* procfs.c (procfs_wait): Likewise.
2008-03-21 Pedro Alves <pedro@codesourcery.com>
* gdb.threads/fork-child-threads.exp: Test next over fork.
* gdbthread.h (print_thread_info): Declare.
* thread.c (print_thread_info): New, extracted
from info_threads_command and adjusted to
work for CLI and MI.
(info_threads_command): Use print_thread_info.
* Makefile.in: Update dependencies.
* mi/mi-cmds.c (mi_cmds): Specify a handler
for -thread-info.
* mi/mi-cmds.h (mi_cmd_thread_info): Declare.
* mi/mi-main.c (mi_cmd_thread_info): New.
(mi_cmd_list_features): Include 'thread-info'.
* thread.c (add_thread_silent): Renamed
from add_thread.
(print_thread_events): New variable definition.
(show_print_thread_events): New function.
(_initialize_thread): Add "set print thread-events" and
"show print thread-events" commands.
(add_thread): Announce new thread.
* gdbthread.h (add_thread_silent): Declare.
(print_thread_events): New variable declaration.
* inf-ttrace.c (inf_ttrace_wait): Don't
inform about new thread, as add_thread is always
called too, and will take care of that.
* infrun.c (handle_inferior_event): Likewise.
* procfs.c (procfs_wait): Likewise.
* remote.c (remote_currthread): Likewise.
* sol-thread.c (sol_thread_wait): Likewise.
* win32-nat.c (get_win32_debug_event): Likewise.
* linux-thread-db.c (attach_thread): Likewise.
Remove the verbose parameter.
(check_event): Make detach_thread be verbose
only if print_thread_events is set.
* linux-nat.c (lin_lwp_attach_lwp): Don't inform
about new thread. This is called only from
linux-thread-db.c:attach_thread, which will take care.
Remove the verbose parameter.
* linux-nat.h (lin_lwp_attach_lwp): Adjust prototype.
* infrun.c (trap_expected): Rename
to stepping_over_breakpoint. Document.
(stepping_past_breakpoint): Remove.
(stepping_past_breakpoint_ptdi): Renamed
to deferred_step_ptid.
(struct execution_control_state): Rename
the another_trap field to stepping_over_breakpoint.
(struct inferior_status): Rename the trap_expected
field to stepping_over_breakpoint.
(clear_proceed_status, proceed)
(init_execution_control_state, context_switch)
(handle_inferior_event, currently_stepping)
(keep_going, save_inferior_status)
(restore_inferior_status, prepare_to_proceed): Adjust.
* gdbthread.h (struct thread_info): Rename the
trap_expected field to stepping_over_breakpoint.
* thread.c (load_infrun_state, save_infrun_state):
Adjust.
(stepping_past_breakpoint_ptid): Likewise.
(prepare_to_proceed): Add STEP parameter. Do not check for Ctrl-C.
Only switch threads if we need to single-step over a breakpoint hit
in the previously selected thread. If stepping, remember previous
thread to switch back to in STEPPING_PAST_BREAKPOINT[_PTID]. Call
switch_to_thread instead of copying its contents.
(proceed): Pass STEP to prepare_to_proceed. Always set ONEPROC if
prepare_to_proceed returns true.
(init_wait_for_inferior): Reset STEPPING_PAST_BREAKPOINT.
(context_switch): Call switch_to_thread.
(handle_inferior_event): Switch back to previous thread if requested
in STEPPING_PAST_BREAKPOINT[_PTID] by prepare_to_proceed.
* gdbthread.h (switch_to_thread): Add prototype.
* thread.c (switch_to_thread): Make global.
* infrun.c (struct execution_control_state): Delete field
"stepping_through_sigtramp".
(init_execution_control_state): Do not set same.
(context_switch): Do not pass same to save_infrun_state and
load_infrun_state.
* gdbthread.h (struct thread_info): Delete field
stepping_through_sigtramp.
(save_infrun_state, load_infrun_state): Delete parameter
stepping_through_sigtramp.
* thread.c (load_infrun_state, save_infrun_state): Update.
* gdbthread.h (struct thread_info): Add new fields:
current_line, current_symtab, step_sp, for saved infrun state.
* thread.c (save_infrun_state, load_infrun_state): Save and
restore current_line, current_symtab, and step_sp.
(add_thread): Rather than adding assignments to initialize
the new fields, just use memset (tp, 0, sizeof (*tp).
This way future new fields will not be overlooked.
* infrun.c (handle_inferior_event): Save and restore save_sp,
current_line, and current_symtab when switching threads.
* thread.c (delete_step_resume_breakpoint): New function.
Maintain internal consistency of the thread list while deleting
a step_resume_breakpoint.
* gdbthread.h (delete_step_resume_breakpoint): Export.
* breakpoint.c (bpstat_find_step_resume_breakpoint):
Make thread-aware: don't return a step_resume_breakpoint
for the wrong thread.
* infrun.c (wait_for_inferior): Call delete_step_resume_breakpoint
instead of delete_breakpoint_current_contents.
(fetch_inferior_event): Ditto.
(handle_inferior_event): Call delete_step_resume_breakpoint
instead of delete_breakpoint.
* config/xm-aix4.h (SIGWINCH_HANDLER): Function `aix_resize_window'
must accept a signal number as parameter.
* config/rs6000/xm-rs6000.h (SIGWINCH_HANDLER): Ditto.
* utils.c (initialize_utils): Give a parameter to `SIGWINCH_HANDLER'.
* inferior.h (register_valid): Variable's type is `SIGNED char', not
`char'.
* findvar.c (register_valid): Ditto.
* defs.h (make_cleanup_func): Protect parameter list by `PARAMS'.
* gdbthread.h (unbind_target_thread_vector): Likewise.
multithread debugging.
(remote_get_threadlist) : get a partial list of threads
(remote_threadlist_iterator) : Step through all the threads
(init_remote_threadtests) : Optional builtin unit test commands.
* thread.c (bind_target_thread_vector) : Implementa a more dynamic
way of accessing target specific thread info functions than
FIND_NEW_THREADS.
(target_thread_info) : Function to get extended thread information.
* gdbthread.h : Export internal data structures corresponding to
external detailed thread info response. This is more like a 'ps'
command than what might be expected of host based threads. This
is for embedded systems.
* defs.h: Move _initialize_printcmd, _initialize_stack,
_initialize_blockframe out of here and in to their respective .c files.
* blockframe.c: Move _initialize_blockframe prototype to here.
* printcmd.c: Move _initialize_printcmd prototype to here.
* stack.c: Move _initialize_stack prototype to here.
* source.c, symtab.h: Move _initialize_source prototype to the .c file.
* values.c, value.h: Move _initialize_values prototype to the .c file.
* gdbthread.h, thread.c: Move _initialize_thread prototype to the .c
file.
* breakpoint.c, breakpoint.h: Move _initialize_breakpoint prototype
to the .c file.
* abug-rom.c alpha-nat.c alpha-tdep.c annotate.c ax-gdb.c bcache.c:
Standardize comments for the prototype section of these files.
* configure.in: Look in libc for wctype before looking for it in libc.
The last one is to fix the GNU ld (~2.9.1) + Solaris 2.6 interaction problem
where an empty stub library (libw) causes a core dump when we call vasprintf
(e.g. `info br') in the final linked gdb.
* 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.
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.