From: Stan Shebs <stan@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] No resuming while tfinding
Date: Wed, 17 Mar 2010 01:59:00 -0000 [thread overview]
Message-ID: <4BA0377C.1040000@codesourcery.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1751 bytes --]
After going in and out of tfind mode about a thousand times in the past
few months :-), it's become apparent that we don't want to allow
resumption while looking at traceframes.
It often works now, to single-step the current thread while looking at a
random trace frame, and it could probably be made to work reliably.
However, it is incredibly confusing - for instance, after that
single-step, are you now looking at the live thread? If so, then you
switched yourself out of tfind mode, and your next print commands are
displaying current state, not trace frame contents. If instead you stay
in tfind mode, then you have the single-step stop printing a source line
that has nothing to do with the trace frame. Quite likely that you just
absent-mindedly typed "s" instead of "tfind" that you really wanted to
go to the next frame... Calling functions in the inferior has similar
issues. Sure, if you have a utility function that prettyprints a piece
of collected data, you'd want to use it---but the function runs on the
target using the live memory data, not the trace frame data! And since
the trace frame is typically incomplete, stuffing the trace frame
contents into live memory is not going to go well... :-)
So I propose that we make an executive decision to disable all the
resumption commands while in tfind mode. Does this make sense to everyone?
Stan
2010-03-16 Stan Shebs <stan@codesourcery.com>
* infcall.c: Include tracepoint.h.
(call_function_by_hand): Disallow calls in tfind mode.
* infcmd.c (ensure_not_tfind_mode): New function.
(continue_1): Call it.
(step_1) Ditto.
(jump_command): Ditto.
(signal_command): Ditto.
(until_command): Ditto.
(finish_command): Ditto.
[-- Attachment #2: tfindmode-patch-1 --]
[-- Type: text/plain, Size: 3245 bytes --]
Index: infcall.c
===================================================================
RCS file: /cvs/src/src/gdb/infcall.c,v
retrieving revision 1.127
diff -p -r1.127 infcall.c
*** infcall.c 28 Feb 2010 17:56:36 -0000 1.127
--- infcall.c 17 Mar 2010 01:34:00 -0000
***************
*** 21,26 ****
--- 21,27 ----
#include "defs.h"
#include "breakpoint.h"
+ #include "tracepoint.h"
#include "target.h"
#include "regcache.h"
#include "inferior.h"
*************** call_function_by_hand (struct value *fun
*** 453,458 ****
--- 454,462 ----
if (!target_has_execution)
noprocess ();
+ if (get_traceframe_number () >= 0)
+ error (_("May not call functions while looking at trace frames."));
+
frame = get_current_frame ();
gdbarch = get_frame_arch (frame);
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.259
diff -p -r1.259 infcmd.c
*** infcmd.c 16 Feb 2010 21:18:46 -0000 1.259
--- infcmd.c 17 Mar 2010 01:34:00 -0000
***************
*** 56,61 ****
--- 56,62 ----
#include "inline-frame.h"
extern void disconnect_or_stop_tracing (int from_tty);
+ extern int get_traceframe_number (void);
/* Functions exported for general use, in inferior.h: */
*************** ensure_valid_thread (void)
*** 648,657 ****
--- 649,671 ----
Cannot execute this command without a live selected thread."));
}
+ /* If the user is looking at trace frames, any resumption of execution
+ is likely to mix up recorded and live target data. So simply
+ disallow those commands. */
+
+ void
+ ensure_not_tfind_mode (void)
+ {
+ if (get_traceframe_number () >= 0)
+ error (_("\
+ Cannot execute this command while looking at trace frames."));
+ }
+
void
continue_1 (int all_threads)
{
ERROR_NO_INFERIOR;
+ ensure_not_tfind_mode ();
if (non_stop && all_threads)
{
*************** step_1 (int skip_subroutines, int single
*** 825,830 ****
--- 839,845 ----
int thread = -1;
ERROR_NO_INFERIOR;
+ ensure_not_tfind_mode ();
ensure_valid_thread ();
ensure_not_running ();
*************** jump_command (char *arg, int from_tty)
*** 1046,1051 ****
--- 1061,1067 ----
int async_exec = 0;
ERROR_NO_INFERIOR;
+ ensure_not_tfind_mode ();
ensure_valid_thread ();
ensure_not_running ();
*************** signal_command (char *signum_exp, int fr
*** 1148,1153 ****
--- 1164,1170 ----
dont_repeat (); /* Too dangerous. */
ERROR_NO_INFERIOR;
+ ensure_not_tfind_mode ();
ensure_valid_thread ();
ensure_not_running ();
*************** until_command (char *arg, int from_tty)
*** 1262,1267 ****
--- 1279,1286 ----
if (!target_has_execution)
error (_("The program is not running."));
+ ensure_not_tfind_mode ();
+
/* Find out whether we must run in the background. */
if (arg != NULL)
async_exec = strip_bg_char (&arg);
*************** finish_command (char *arg, int from_tty)
*** 1546,1551 ****
--- 1565,1572 ----
int async_exec = 0;
+ ensure_not_tfind_mode ();
+
/* Find out whether we must run in the background. */
if (arg != NULL)
async_exec = strip_bg_char (&arg);
next reply other threads:[~2010-03-17 1:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-17 1:59 Stan Shebs [this message]
2010-03-17 13:51 ` Marc Khouzam
2010-03-17 15:19 ` Joel Brobecker
2010-03-17 17:36 ` Michael Snyder
2010-03-17 23:40 ` Stan Shebs
2010-03-17 23:44 ` Pedro Alves
2010-03-17 15:22 ` Pedro Alves
2010-03-17 17:31 ` Stan Shebs
2010-03-18 0:59 ` Stan Shebs
2010-03-18 12:19 ` Pedro Alves
2010-03-18 13:23 ` Pedro Alves
2010-03-18 16:05 ` Tom Tromey
2010-03-18 17:47 ` Stan Shebs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BA0377C.1040000@codesourcery.com \
--to=stan@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox