2010-04-15 Stan Shebs <stan@codesourcery.com>
authorStan Shebs <shebs@codesourcery.com>
Fri, 16 Apr 2010 01:12:07 +0000 (01:12 +0000)
committerStan Shebs <shebs@codesourcery.com>
Fri, 16 Apr 2010 01:12:07 +0000 (01:12 +0000)
* frame.c: Include tracepoint.h.
(get_current_frame): Allow a trace frame to be an alternate source
of stack frame data.
* tracepoint.c (tfind_1): Don't try to get current stack frame if
it won't succeed.

gdb/ChangeLog
gdb/frame.c
gdb/tracepoint.c

index 1bcef84899eb5f427e0ee96d99fe7bd0ae832dbf..0a8f5b1c78df04abe76645fe978df836e25364c8 100644 (file)
@@ -1,3 +1,11 @@
+2010-04-15  Stan Shebs  <stan@codesourcery.com>
+
+       * frame.c: Include tracepoint.h.
+       (get_current_frame): Allow a trace frame to be an alternate source
+       of stack frame data.
+       * tracepoint.c (tfind_1): Don't try to get current stack frame if
+       it won't succeed.
+
 2010-04-15  Pedro Alves  <pedro@codesourcery.com>
 
        * ppc-linux-tdep.c (bsd_uthread_solib_loaded): Always pass 0 for
index aaa70daf5927d042625fb394ca132a9eebb4dbc3..0b0c5b4448437c52a4fba9ad0aa555b0b5bcdd6f 100644 (file)
@@ -43,6 +43,7 @@
 #include "gdbthread.h"
 #include "block.h"
 #include "inline-frame.h"
+#include  "tracepoint.h"
 
 static struct frame_info *get_prev_frame_1 (struct frame_info *this_frame);
 static struct frame_info *get_prev_frame_raw (struct frame_info *this_frame);
@@ -1144,12 +1145,16 @@ get_current_frame (void)
     error (_("No stack."));
   if (!target_has_memory)
     error (_("No memory."));
-  if (ptid_equal (inferior_ptid, null_ptid))
-    error (_("No selected thread."));
-  if (is_exited (inferior_ptid))
-    error (_("Invalid selected thread."));
-  if (is_executing (inferior_ptid))
-    error (_("Target is executing."));
+  /* Traceframes are effectively a substitute for the live inferior.  */
+  if (get_traceframe_number () < 0)
+    {
+      if (ptid_equal (inferior_ptid, null_ptid))
+       error (_("No selected thread."));
+      if (is_exited (inferior_ptid))
+       error (_("Invalid selected thread."));
+      if (is_executing (inferior_ptid))
+       error (_("Target is executing."));
+    }
 
   if (current_frame == NULL)
     {
index 82221826bdfcd7993a502b02fc0cfe459c514816..bf328fd98ff1587ca8dd81d03a84e50788d8761f 100644 (file)
@@ -1856,11 +1856,19 @@ tfind_1 (enum trace_find_type type, int num,
         int from_tty)
 {
   int target_frameno = -1, target_tracept = -1;
-  struct frame_id old_frame_id;
+  struct frame_id old_frame_id = null_frame_id;
   char *reply;
   struct breakpoint *tp;
 
-  old_frame_id = get_frame_id (get_current_frame ());
+  /* Only try to get the current stack frame if we have a chance of
+     succeeding.  In particular, if we're trying to get a first trace
+     frame while all threads are running, it's not going to succeed,
+     so leave it with a default value and let the frame comparison
+     below (correctly) decide to print out the source location of the
+     trace frame.  */
+  if (!(type == tfind_number && num == -1)
+      && (has_stack_frames () || traceframe_number >= 0))
+    old_frame_id = get_frame_id (get_current_frame ());
 
   target_frameno = target_trace_find (type, num, addr1, addr2,
                                      &target_tracept);
@@ -1873,7 +1881,7 @@ tfind_1 (enum trace_find_type type, int num,
     }
   else if (target_frameno == -1)
     {
-      /* A request for a non-existant trace frame has failed.
+      /* A request for a non-existent trace frame has failed.
         Our response will be different, depending on FROM_TTY:
 
         If FROM_TTY is true, meaning that this command was 
@@ -1952,7 +1960,7 @@ tfind_1 (enum trace_find_type type, int num,
     {
       enum print_what print_what;
 
-      /* NOTE: in immitation of the step command, try to determine
+      /* NOTE: in imitation of the step command, try to determine
          whether we have made a transition from one function to
          another.  If so, we'll print the "stack frame" (ie. the new
          function and it's arguments) -- otherwise we'll just show the
This page took 0.029605 seconds and 4 git commands to generate.