diff options
author | Pedro Alves <palves@redhat.com> | 2010-04-11 16:33:56 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2010-04-11 16:33:56 +0000 |
commit | 8336d594d5107cb86bf1b569962bf1496e2c7c30 (patch) | |
tree | 6e8f6c708234c278bdf701a1356fca739cd51c86 /gdb/gdbserver/target.h | |
parent | 5d267c4c705d1d22e21b0dde92750b3afe699681 (diff) | |
download | gdb-8336d594d5107cb86bf1b569962bf1496e2c7c30.zip gdb-8336d594d5107cb86bf1b569962bf1496e2c7c30.tar.gz gdb-8336d594d5107cb86bf1b569962bf1496e2c7c30.tar.bz2 |
GDBserver disconnected tracing support.
* linux-low.c (linux_remove_process): Delete.
(add_lwp): Don't set last_resume_kind here.
(linux_kill): Use `mourn'.
(linux_detach): Use `thread_db_detach', and `mourn'.
(linux_mourn): New.
(linux_attach_lwp_1): Adjust comment.
(linux_attach): last_resume_kind moved the thread_info; adjust.
(status_pending_p_callback): Adjust.
(linux_wait_for_event_1): Adjust.
(count_events_callback, select_singlestep_lwp_callback)
(select_event_lwp_callback, cancel_breakpoints_callback)
(db_wants_lwp_stopped, linux_wait_1, need_step_over_p)
(proceed_one_lwp): Adjust.
(linux_async): Add debug output.
(linux_thread_stopped): New.
(linux_pause_all): New.
(linux_target_ops): Install linux_mourn, linux_thread_stopped and
linux_pause_all.
* linux-low.h (struct lwp_info): Delete last_resume_kind field.
(thread_db_free): Delete declaration.
(thread_db_detach, thread_db_mourn): Declare.
* thread-db.c (thread_db_init): Use thread_db_mourn.
(thread_db_free): Delete, split in two.
(disable_thread_event_reporting): New.
(thread_db_detach): New.
(thread_db_mourn): New.
* server.h (struct thread_info) <last_resume_kind>: New field.
<attached>: Add comment.
<gdb_detached>: New field.
(handler_func): Change return type to int.
(handle_serial_event, handle_target_event): Ditto.
(gdb_connected): Declare.
(tracing): Delete.
(disconnected_tracing): Declare.
(stop_tracing): Declare.
* server.c (handle_query) <qSupported>: Report support for
disconnected tracing.
(queue_stop_reply_callback): Account for running threads.
(gdb_wants_thread_stopped): New.
(gdb_wants_all_threads_stopped): New.
(gdb_reattached_process): New.
(handle_status): Clear the `gdb_detached' flag of all processes.
In all-stop, stop all threads.
(main): Be sure to leave tfind mode. Handle disconnected tracing.
(process_serial_event): If the remote connection breaks, or if an
exit was forced with "monitor exit", force an event loop exit.
Handle disconnected tracing on detach.
(handle_serial_event): Adjust.
(handle_target_event): If GDB isn't connected, forward events back
to the inferior, unless the last process exited, in which case,
exit gdbserver. Adjust interface.
* remote-utils.c (remote_open): Don't block in accept. Instead
register an event loop source on the listen socket file
descriptor. Refactor bits into ...
(listen_desc): ... this new global.
(gdb_connected): ... this new function.
(enable_async_notification): ... this new function.
(handle_accept_event): ... this new function.
(remote_close): Clear remote_desc.
* inferiors.c (add_thread): Set the new thread's last_resume_kind.
* target.h (struct target_ops) <mourn, thread_stopped, pause_all>:
New fields.
(mourn_inferior): Define.
(target_process_qsupported): Avoid the dangling else problem.
(thread_stopped): Define.
(pause_all): Define.
(target_waitstatus_to_string): Declare.
* target.c (target_waitstatus_to_string): New.
* tracepoint.c (tracing): Make extern.
(disconnected_tracing): New.
(stop_tracing): Make extern. Handle tracing stops due to GDB
disconnecting.
(cmd_qtdisconnected): New.
(cmd_qtstatus): Report disconnected tracing status in trace reply.
(handle_tracepoint_general_set): Handle QTDisconnected.
* event-loop.c (event_handler_func): Change return type to int.
(process_event): Bail out if the event handler wants the event
loop to stop.
(handle_file_event): Ditto.
(start_event_loop): Bail out if the event handler wants the event
loop to stop.
* nto-low.c (nto_target_ops): Adjust.
* spu-low.c (spu_wait): Don't remove the process here.
(spu_target_ops): Adjust.
* win32-low.c (win32_wait): Don't remove the process here.
(win32_target_ops): Adjust.
Diffstat (limited to 'gdb/gdbserver/target.h')
-rw-r--r-- | gdb/gdbserver/target.h | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h index 6ee5009..4cccb29 100644 --- a/gdb/gdbserver/target.h +++ b/gdb/gdbserver/target.h @@ -138,6 +138,10 @@ struct target_ops int (*detach) (int pid); + /* The inferior process has died. Do what is right. */ + + void (*mourn) (struct process_info *proc); + /* Wait for inferior PID to exit. */ void (*join) (int pid); @@ -299,6 +303,12 @@ struct target_ops /* Write PC to REGCACHE. */ void (*write_pc) (struct regcache *regcache, CORE_ADDR pc); + + /* Return true if THREAD is known to be stopped now. */ + int (*thread_stopped) (struct thread_info *thread); + + /* Pause all threads. */ + void (*pause_all) (void); }; extern struct target_ops *the_target; @@ -317,6 +327,9 @@ void set_target_ops (struct target_ops *); #define detach_inferior(pid) \ (*the_target->detach) (pid) +#define mourn_inferior(PROC) \ + (*the_target->mourn) (PROC) + #define mythread_alive(pid) \ (*the_target->thread_alive) (pid) @@ -339,14 +352,27 @@ void set_target_ops (struct target_ops *); (the_target->supports_multi_process ? \ (*the_target->supports_multi_process) () : 0) -#define target_process_qsupported(query) \ - if (the_target->process_qsupported) \ - the_target->process_qsupported (query) +#define target_process_qsupported(query) \ + do \ + { \ + if (the_target->process_qsupported) \ + the_target->process_qsupported (query); \ + } while (0) #define target_supports_tracepoints() \ (the_target->supports_tracepoints \ ? (*the_target->supports_tracepoints) () : 0) +#define thread_stopped(thread) \ + (*the_target->thread_stopped) (thread) + +#define pause_all() \ + do \ + { \ + if (the_target->pause_all) \ + (*the_target->pause_all) (); \ + } while (0) + /* Start non-stop mode, returns 0 on success, -1 on failure. */ int start_non_stop (int nonstop); @@ -363,4 +389,6 @@ void set_desired_inferior (int id); const char *target_pid_to_str (ptid_t); +const char *target_waitstatus_to_string (const struct target_waitstatus *); + #endif /* TARGET_H */ |