From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20043 invoked by alias); 17 Mar 2010 01:59:36 -0000 Received: (qmail 19895 invoked by uid 22791); 17 Mar 2010 01:59:35 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 17 Mar 2010 01:59:31 +0000 Received: (qmail 1839 invoked from network); 17 Mar 2010 01:59:29 -0000 Received: from unknown (HELO macbook-2.local) (stan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 17 Mar 2010 01:59:29 -0000 Message-ID: <4BA0377C.1040000@codesourcery.com> Date: Wed, 17 Mar 2010 01:59:00 -0000 From: Stan Shebs User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [PATCH] No resuming while tfinding Content-Type: multipart/mixed; boundary="------------050305020407080207070302" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-03/txt/msg00615.txt.bz2 This is a multi-part message in MIME format. --------------050305020407080207070302 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1751 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 * 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. --------------050305020407080207070302 Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0"; name="tfindmode-patch-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="tfindmode-patch-1" Content-length: 3245 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); --------------050305020407080207070302--