Add an architecture object to the Unix server.
* arch.h: New header file.
* server.h (struct arch): New forward struct declaration.
(struct child_process): Add an 'arch' member to the process.
* thread-db.c: #include arch.h.
* linux-target.c: #include arch.h.
(allocate_empty_arch): New function.
(x86_make_arch): New function.
(MAKE_ARCH): New #definition.
(linux_attach): Initialize process's architecture.

Provide arch-independent framework for breakpoints.
* server.h (struct arch_bp_table): New forward struct declaration.
(struct child_process): New member: 'breakpoint_table'.
* linux-target.c (linux_attach): Initialize process's breakpoint
table, if the architecture defines a breakpoint table constructor.
* arch.h (struct arch): Add fields pointing to breakpoint functions.

Provide a module implementing breakpoints for architectures that
support a simple software breakpoint model ("patch these bytes
into the instruction stream").
* stock-breakpoints.h, stock-breakpoints.c: New files.
* linux-target.c: If STOCK_BREAKPOINTS is #defined, then #include
"stock-breakpoints.h".
* Makefile.am (EXTRA_rda_SOURCES): Add stock-breakpoints.c.
* Makefile.in: Updated.

Define x86 breakpoint functions using the stock-breakpoints.c
model.
* configure.in: When configuring for an x86 target, include
stock-breakpoints.o in the mix, and #define STOCK_BREAKPOINTS.
* configure: Regenerated.
* config.in (STOCK_BREAKPOINTS): Provide #definition template.
* linux-target.c (stock_table_to_x86, x86_table_to_stock,
stock_bp_to_x86, x86_bp_to_stock, x86_make_bp_table, x86_set_bp,
x86_delete_bp, x86_bp_hit_p): New functions.
(x86_make_arch): Register the latter four as our breakpoint
methods.

Use the libthread_db event interface to communicate with the
thread library, if the old signal-based interface is not
supported.
* thread-db.c: #include <assert.h>.
(thread_db_event_str): New function.
(get_target_int_by_name, set_target_int_by_name, get_thread_signals)
(cancel_signal, restart_signal, debug_signal): Move these to just
before thread_db_dlopen; get_thread_signals is a subroutine of that.
(using_thread_db_events, create_notification, death_notification,
create_event_breakpoint, death_event_breakpoint): New global vars.
(get_event_notification, set_event_breakpoint)
(insert_thread_db_event_breakpoints)
(delete_thread_db_event_breakpoints, request_thread_db_events)
(hit_thread_db_event_breakpoint): New functions.
(thread_db_open): Call get_thread_signals, and if that fails, call
request_thread_db_events.
(struct event_list): Add 'thread_db_event' member.
(add_pending_event): Initialize it.
(delete_pending_event, handle_thread_db_events): New functions.
(find_new_threads_callback): If we're using the event interface,
enable event reporting on each new thread we find.
(select_pending_event): Return a value to indicate whether we
selected any event at all.
(continue_all_threads): Send a restart signal only if we're using
the signal-based interface.
(thread_db_check_child_state): If we're using the libthread_db
event interface to communicate with the inferior thread library,
check for those events here.  If select_pending_event says it
didn't find anything interesting, that means we consumed all the
reportable events; continue the program silently.
* ptrace-target.c: #include <sys/types.h> and <linux/unistd.h>.
(tkill): Generate code for this syscall.
(stop_lwp): Use tkill instead of kill.

* thread-db.c (thread_db_check_child_state): Call stop_all_threads
before calling update_thread_list, so RDA will have to compete for
CPU with fewer running threads.

* thread-db.c (wait_all_threads): Move calls to
select_pending_event and send_pending_signals from here...
(thread_db_check_child_state): To here.

* thread-db.c (ignore_thread_signal): New function.
(thread_db_check_child_state): Call it, instead of writing it out.

* thread-db.c (thread_db_open): Return 0 on success, -1 on
failure, like most of the other int-valued functions in this file,
and like most system calls.

* thread-db.c (struct gdbserv_thread): Doc fixes.

* thread-db.c: #include "gdbserv-utils.h", to get prototypes for
the 'struct gdbserv_reg' manipulation functions.

* thread-db.c (thread_db_noisy): Initialize to 1.

* thread-db.c (thread_debug_name): New function.
(find_new_threads_callback): If noisy, report new threads.
(stop_thread): If noisy, report stopping threads.
(select_pending_event): If noisy, report what we selected.
(wait_all_threads): If noisy, report before each thread we wait
for.

* thread-db.c (stop_all_threads): Doc fixes.

* aclocal.m4: Regenerated.
* Makefile.am (AM_CFLAGS): Add '-Wall'.
* Makefile.in: Update.
* gdbserv-thread-db.h (stop_lwp, handle_waitstatus, ps_pdread,
ps_pdwrite): Add declarations for these functions to
gdbserv-thread-db.h.
* linux-target.c: #include <string.h>, <sys/types.h>, and
<sys/wait.h> to get declarations for system functions used in this
file.
* linux-target.c (x86_make_arch): Use allocate_empty_arch.
* linux-target.c (linux_set_reg): Delete unused variables.
* ptrace-target.c (ptrace_read_user, ptrace_check_child_state):
Same.
* thread-db.c (continue_all_threads, thread_db_attach): Same.
* linux-target.c (linux_set_reg): Delete unused variables.
* ptrace-target.c (ptrace_read_user, ptrace_check_child_state):
Same.
* thread-db.c (continue_all_threads, thread_db_attach): Same.
* linux-target.c (linux_get_reg): When register REGNO doesn't exist,
provide zeros for its value; don't use an uninitialized pointer.
* linux-target.c (decr_pc_after_break): Fix printf format
directive to match arguments.
* ptrace-target.c (ptrace_singlestep_program): Same.
(ptrace_continue_program): Same.
* server.c (invalid_speed): Same.
* thread-db.c (thread_db_open, wait_all_threads)
(thread_db_check_child_state, thread_db_get_thread_reg)
(thread_db_set_thread_reg): Same.
* server.c (main): Initialize infd, outfd, and speed.
(tty_raw): Use proper name for speed_t "zero baud" value.
* stock-breakpoints.c: #include all headers necessary to get
prototypes for functions used in this file.
* thread-db.c: Same.
* stock-breakpoints.c: #include all headers necessary to get
prototypes for functions used in this file.
* thread-db.c: Same.
* stock-breakpoints.c: #include all headers necessary to get
prototypes for functions used in this file.
* thread-db.c: Same.
* stock-breakpoints.c: #include all headers necessary to get
prototypes for functions used in this file.
* thread-db.c: Same.
* stock-breakpoints.c (stock_bp_make_table): Bother to return the
breakpoint table constructed.
* ptrace-target.c (stop_lwp): Use tkill when possible; otherwise,
fall back gracefully to using kill.
* thread-db.c (delete_pending_event): Fix bounds-check assertion.
Separate management of kernel-level LWPs from that of libpthread /
libthread_db-level threads.
* lwp-pool.c, lwp-pool.h: New files.
* thread-db.c: #include "lwp-ctrl.h" and "lwp-pool.h".
(struct gdbserv_thread): Delete members 'attached', 'stopped',
'waited', and 'stepping'.  This structure is now just a
'td_thrinfo_t' and a list link.  Describe some quirks in the
meanings of certain 'ti' fields.
(thread_list_lookup_by_lid): Move later in file, so we can use
information directly from our proc handle.  Be skeptical of ZOMBIE
or UNKNOWN threads whose LWP ID is equal to the PID in the proc
handle.
(thread_debug_name): Move later in file, so we can use
thread_db_state_str.
(attach_thread): Use lwp pool functions to attach.  Attach to
zombies.  When using signal-based communication, send the thread
the restart signal immediately.
(find_new_threads_callback): Go ahead and attach to all threads.
The LWP pool functions tolerate attaching to a given LWP more than
once.
(update_thread_list): Take the process as an argument.  If the
focus thread has disappeared, set process->focus_thread to NULL.
(thread_db_thread_next): Pass the process to update_thread_list.
(stop_thread, stop_all_threads, add_pending_event,
delete_pending_event, select_pending_event, send_pending_signals,
wait_all_threads, continue_all_threads): Deleted.
(handle_thread_db_event): Renamed from handle_thread_db_events.
Take the process structure as an argument, and check only for a
thread-db event notification from process->event_thread.  Use LWP
pool functions.
(continue_thread, singlestep_thread): Use LWP pool functions.
(thread_db_continue_program, thread_db_singlestep_program,
thread_db_continue_thread, thread_db_singlestep_thread): Use LWP
pool functions, and update process->focus_thread appropriately.
(thread_db_check_child_state): Use the LWP pool functions.  Rather
than stopping all LWP's, choosing the most interesting events, and
then arranging to re-create all the other wait statuses we got,
just pick the first event we get from lwp_pool_waitpid (either on
the focus thread, if there is one, or on any thread) and report
that.  Use the new handle_thread_db_event function.
(struct event_list, pending_events, pending_events_listsize,
pending_events_top): Deleted; replaced by LWP pool code.
(thread_db_attach): Tell the LWP pool about the PID we're
attaching to.  Clear the focus thread.
* server.h (struct process): New member: 'focus_thread'.
* gdbserv-thread-db.h (continue_lwp, singlestep_lwp, attach_lwp,
stop_lwp): Move declarations from here...
* lwp-ctrl.h: ... to here.  New file.
(kill_lwp): Renamed from stop_lwp; allow caller to specify any
signal.
* ptrace-target.c: #include "lwp-ctrl.h".
(continue_lwp, singlestep_lwp, attach_lwp, stop_lwp): Move
function comments to lwp-ctrl.h, and expand.
* configure.in: Whenever we select 'thread-db.o', select
'lwp-pool.o' as well.
* configure: Regenerated.

* thread-db.c (thread_db_check_child_state): Remove extraneous
call to handle_waitstatus.  Remove extra check for exited main
thread.

* thread-db.c (thread_db_thread_info): List the type and state
before the PID, and mention whether the LWP's PID is equal to that
of the main thread, since ZOMBIE and UNKNOWN threads whose LWP's
PID is equal are probably actually exited threads.

* thread-db.c (add_thread_to_list): Zero out entire structure.

* thread-db.c (thread_db_state_str, thread_db_type_str): Remove
spaces from names; we don't always want them, and the caller can
use printf formatting directives to arrange things as they please.

* ptrace-target.c (continue_lwp, singlestep_lwp, attach_lwp,
stop_lwp): Change arguments from 'lwpid_t' to 'pid_t'.  lwpid_t is
strictly a thread-db type; these are functions that use system
calls, which all expect pid_t.  Rename arguments from 'lwpid' to
'pid'.

* ptrace-target.c: #define _GNU_SOURCE to get declaration for
strsignal.
(kill_lwp): Enhance error reporting.
* lwp-pool.c (wait_flags_str): Return "0" when FLAGS == 0, not the
empty string.
* lwp-pool.h (lwp_pool_singlestep_lwp, lwp_pool_continue_lwp): Doc
fixes.