summaryrefslogtreecommitdiff
path: root/gdb/tracepoint.h
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2013-04-10 14:10:35 +0000
committerPedro Alves <palves@redhat.com>2013-04-10 14:10:35 +0000
commit9ccb9a101beab4a9794bda91cf4fa0fac529a02f (patch)
treea829f1be25a04e4d5673e0fef78b99cc4dba85bb /gdb/tracepoint.h
parentfd3c1b4c0e71d5a18f5d21f3156ac0aa11b04080 (diff)
downloadgdb-9ccb9a101beab4a9794bda91cf4fa0fac529a02f.tar.gz
make -gdb-exit call disconnect_tracing too, and don't lose history if the target errors on "quit"
Gareth mentions in PR gdb/15275: "The MI '-gdb-exit' command mi_cmd_gdb_exit() never calls disconnect_tracing() and therefore exits correctly." It should, so to get out of tfind mode, as quit may detach instead of kill, and we don't want to confuse the memory/register accesses etc. of the detach process. So we should push down the disconnect tracing bits at least to quit_force. But we can't as is, as that would swallow the error thrown by answering "no" to: Trace is running but will stop on detach; detach anyway? (y or n) So to address that, we split disconnect_tracing in two. One part that does the query, and another part that does the rest, and we make quit_force call the latter. Looking at quit_force, it does several things, some of which are a bit independent of the others. It first kills/detaches, and then writes history, and then runs the final cleanups. It seems better to me to do each of these things even if the previous thing throws. E.g., as is, if something throws while detaching, then we skip writing history. Tested on x86_64 Fedora 17. gdb/ 2013-04-10 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (quit_command): Call query_if_trace_running instead of disconnect_tracing. * infcmd.c (detach_command, disconnect_command): Call query_if_trace_running. Adjust. * top.c: Include "tracepoint.h". (quit_target): Delete. Contents moved ... (quit_force): ... here. Wrap each stage of teardown in TRY_CATCH. Call disconnect_tracing before detaching.
Diffstat (limited to 'gdb/tracepoint.h')
-rw-r--r--gdb/tracepoint.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h
index f88394b8de3..18762cae4dc 100644
--- a/gdb/tracepoint.h
+++ b/gdb/tracepoint.h
@@ -387,7 +387,8 @@ extern struct tracepoint *create_tracepoint_from_upload (struct uploaded_tp *utp
extern void merge_uploaded_tracepoints (struct uploaded_tp **utpp);
extern void merge_uploaded_trace_state_variables (struct uploaded_tsv **utsvp);
-extern void disconnect_tracing (int from_tty);
+extern void query_if_trace_running (int from_tty);
+extern void disconnect_tracing (void);
extern void start_tracing (char *notes);
extern void stop_tracing (char *notes);