public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix PR gdb/15911, cleanup print_stack_frame somewhat.
@ 2013-08-30 15:50 Pedro Alves
  2013-08-30 15:50 ` [PATCH 3/3] cleanup print_frame_info Pedro Alves
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Pedro Alves @ 2013-08-30 15:50 UTC (permalink / raw)
  To: gdb-patches

This series fixes PR gdb/15911, a bug related to print_stack_frame,
and then, after noticing we end up with 3 boolean parameters in the
same function, merges print_what with two other arguments, in attempt
to restore karma lost for adding another boolean parameter...

---

Pedro Alves (3):
      PR gdb/15911: "info threads" changes the default source and line (for "break", "list")
      print_stack_frame&friends: merge print_level, print_args and print_what.
      cleanup print_frame_info.


 gdb/mi/mi-cmd-stack.c |    8 +++++---
 gdb/mi/mi-interp.c    |    3 ++-
 gdb/mi/mi-main.c      |    6 ++++--
 3 files changed, 11 insertions(+), 6 deletions(-)

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/3] print_stack_frame&friends: merge print_level, print_args and print_what.
  2013-08-30 15:50 [PATCH 0/3] Fix PR gdb/15911, cleanup print_stack_frame somewhat Pedro Alves
  2013-08-30 15:50 ` [PATCH 3/3] cleanup print_frame_info Pedro Alves
@ 2013-08-30 15:50 ` Pedro Alves
  2013-09-06  8:46   ` Jan Kratochvil
  2013-08-30 16:09 ` [PATCH 1/3] PR gdb/15911: "info threads" changes the default source and line (for "break", "list") Pedro Alves
  2 siblings, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2013-08-30 15:50 UTC (permalink / raw)
  To: gdb-patches

Looking at print_frame_info, I noticed things like:

  location_print = (print_what == LOCATION
		    || print_what == LOC_AND_ADDRESS
		    || print_what == SRC_AND_LOC);
...
   source_print = (print_what == SRC_LINE || print_what == SRC_AND_LOC);
...

which hint that print_what could actually be a set of bit flags.  Then
we have print_level and print_args as separate parameters, but those
also specify print formatting, so, if we make print_what a set of bit
flags, those could be merged in as well.  That's what this patch does.

In print_frame_info, there's a SRC_LINE check that looks like:

   if (source_print && sal.symtab)
     {
       int done = 0;
       int mid_statement = ((print_what == SRC_LINE)
 			   && frame_show_address (frame, sal));

Now, with "print source" a single bit (SRC_LINE == PF_SRC_LINE;
SRC_AND_LOC == PF_SRC_LINE | PF_LOCATION; etc.), what to replace that
check with?  Check for the non-existence of other flags?  I think
that'd be brittle.  What we need is yet another flag that callers pass
in when they want that mid_statement bit to trigger -- that's what the
new PF_SRC_ADDRESS is for.

(After writing this, I found out that Cagney had already hinted at
this merge when adding print_level/print_args:
<https://sourceware.org/ml/gdb-patches/2004-04/msg00585.html>)

gdb/
2013-08-30  Pedro Alves  <palves@redhat.com>

	* frame.h (enum print_what) <SRC_LINE, LOCATION, SRC_AND_LOC,
	LOC_AND_ADDRESS>: Delete.
	<PF_LOCATION, PF_LOC_LEVEL, PF_LOC_ADDRESS, PF_LOC_ARGS,
	PF_SRC_LINE, PF_SRC_ADDRESS>: New values.
	* stack.c (print_stack_frame): Remove print_level parameter.
	Adjust.
	(print_frame_info, print_frame): Remove print_level and print_args
	parameters.  Adjust.
	(backtrace_command_1, select_and_print_frame, frame_command)
	(current_frame_command, up_command, down_command): Adjust.
	* ada-tasks.c (task_command_1): Adjust.
	* bsd-kvm.c (bsd_kvm_open, bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd):
	Adjust.
	* corelow.c (core_open): Adjust.
	* infcmd.c (finish_command, kill_command): Adjust.
	* inferior.c (inferior_command): Adjust.
	* infrun.c (normal_stop): Adjust.
	* linux-fork.c (linux_fork_context): Adjust.
	* record-full.c (record_full_goto_entry, record_full_restore):
	Adjust.
	* remote-mips.c (common_open): Adjust.
	* thread.c (print_thread_info, restore_selected_frame): Adjust.
	(restore_selected_frame, do_captured_thread_select): Adjust.
	* tracepoint.c (tfind_1): Adjust.
	* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames)
	(mi_cmd_stack_info_frame): Adjust.
	* mi/mi-interp.c (mi_on_normal_stop): Adjust.
	* mi/mi-main.c (mi_cmd_exec_return, mi_cmd_trace_find): Adjust.
---
 gdb/mi/mi-cmd-stack.c |    8 +++++---
 gdb/mi/mi-interp.c    |    3 ++-
 gdb/mi/mi-main.c      |    6 ++++--
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index dfb6719..b2507d0 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -1275,6 +1275,7 @@ task_command_1 (char *taskno_str, int from_tty, struct inferior *inf)
   const int taskno = value_as_long (parse_and_eval (taskno_str));
   struct ada_task_info *task_info;
   struct ada_tasks_inferior_data *data = get_ada_tasks_inferior_data (inf);
+  enum print_what print_what;
 
   if (taskno <= 0 || taskno > VEC_length (ada_task_info_s, data->task_list))
     error (_("Task ID %d not known.  Use the \"info tasks\" command to\n"
@@ -1307,11 +1308,12 @@ task_command_1 (char *taskno_str, int from_tty, struct inferior *inf)
            taskno);
 
   switch_to_thread (task_info->ptid);
-  ada_find_printable_frame (get_selected_frame (NULL));
   printf_filtered (_("[Switching to task %d]\n"), taskno);
-  print_stack_frame (get_selected_frame (NULL),
-                     frame_relative_level (get_selected_frame (NULL)),
-		     SRC_AND_LOC, 1);
+  print_what = PF_SRC_LINE | PF_LOCATION;
+  ada_find_printable_frame (get_selected_frame (NULL));
+  if (frame_relative_level (get_selected_frame (NULL)))
+    print_what |= PF_LOC_LEVEL;
+  print_stack_frame (get_selected_frame (NULL), print_what, 1);
 }
 
 
diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c
index d1e7ca8..a646e53 100644
--- a/gdb/bsd-kvm.c
+++ b/gdb/bsd-kvm.c
@@ -100,7 +100,8 @@ bsd_kvm_open (char *filename, int from_tty)
   target_fetch_registers (get_current_regcache (), -1);
 
   reinit_frame_cache ();
-  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
+  print_stack_frame (get_selected_frame (NULL), 0,
+		     PF_LOCATION | PF_SRC_LINE, 1);
 }
 
 static void
@@ -286,7 +287,8 @@ bsd_kvm_proc_cmd (char *arg, int fromtty)
   target_fetch_registers (get_current_regcache (), -1);
 
   reinit_frame_cache ();
-  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
+  print_stack_frame (get_selected_frame (NULL), 0,
+		     PF_LOCATION | PF_SRC_LINE, 1);
 }
 
 #endif
@@ -306,7 +308,8 @@ bsd_kvm_pcb_cmd (char *arg, int fromtty)
   target_fetch_registers (get_current_regcache (), -1);
 
   reinit_frame_cache ();
-  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
+  print_stack_frame (get_selected_frame (NULL), 0,
+		     PF_LOCATION | PF_SRC_LINE, 1);
 }
 
 static int
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 7a5aaab..d7bc5ed 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -453,7 +453,8 @@ core_open (char *filename, int from_tty)
 
   /* Now, set up the frame cache, and print the top of stack.  */
   reinit_frame_cache ();
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+  print_stack_frame (get_selected_frame (NULL),
+		     PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
 }
 
 static void
diff --git a/gdb/frame.h b/gdb/frame.h
index a5e1629..95f0285 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -595,18 +595,37 @@ extern struct gdbarch *frame_unwind_arch (struct frame_info *frame);
 extern struct gdbarch *frame_unwind_caller_arch (struct frame_info *frame);
 
 
-/* Values for the source flag to be used in print_frame_info_base().  */
+/* Bit flags to be used with print_stack_frame, print_frame_info and
+   friends.  */
+
 enum print_what
   { 
-    /* Print only the source line, like in stepi.  */
-    SRC_LINE = -1, 
-    /* Print only the location, i.e. level, address (sometimes)
-       function, args, file, line, line num.  */
-    LOCATION,
-    /* Print both of the above.  */
-    SRC_AND_LOC, 
-    /* Print location only, but always include the address.  */
-    LOC_AND_ADDRESS 
+    /* Print the location, i.e. level (if requested), address
+       (sometimes), function, args (if requested), file, line, line
+       num.  */
+    PF_LOCATION = 1 << 0,
+
+    /* Print frame level before the location (e.g., #0).  */
+    PF_LOC_LEVEL = 1 << 1,
+
+    /* Always print address in addition to the location.  If not
+       specified, the address is printed if there's no symtab for the
+       location or if the location points in the middle of a
+       statement.  */
+    PF_LOC_ADDRESS = 1 << 2,
+
+    /* Print function arguments.  */
+    PF_LOC_ARGS = 1 << 3,
+
+    /* Print the source line, if possible.  If not possible (e.g.,
+       after a stepi in code that has no debug info), print the
+       location instead.  */
+    PF_SRC_LINE = 1 << 4,
+
+    /* Print address before the source line if PC points to the middle
+       of a statement.  Only valid if PF_SRC_LINE is also
+       specified.  */
+    PF_SRC_ADDRESS = 1 << 5,
   };
 
 /* Allocate zero initialized memory from the frame cache obstack.
@@ -659,12 +678,12 @@ extern CORE_ADDR get_pc_function_start (CORE_ADDR);
 
 extern struct frame_info *find_relative_frame (struct frame_info *, int *);
 
-extern void print_stack_frame (struct frame_info *, int print_level,
+extern void print_stack_frame (struct frame_info *,
 			       enum print_what print_what,
 			       int set_current_sal);
 
-extern void print_frame_info (struct frame_info *, int print_level,
-			      enum print_what print_what, int args,
+extern void print_frame_info (struct frame_info *,
+			      enum print_what print_what,
 			      int set_current_sal);
 
 extern struct frame_info *block_innermost_frame (const struct block *);
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 242aac1..327ba1d 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1765,7 +1765,8 @@ finish_command (char *arg, int from_tty)
       if (from_tty)
 	{
 	  printf_filtered (_("Run till exit from "));
-	  print_stack_frame (get_selected_frame (NULL), 1, LOCATION, 0);
+	  print_stack_frame (get_selected_frame (NULL),
+			     PF_LOCATION | PF_LOC_LEVEL, 0);
 	}
 
       proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT, 1);
@@ -1790,7 +1791,8 @@ finish_command (char *arg, int from_tty)
       else
 	printf_filtered (_("Run till exit from "));
 
-      print_stack_frame (get_selected_frame (NULL), 1, LOCATION, 0);
+      print_stack_frame (get_selected_frame (NULL),
+			 PF_LOCATION | PF_LOC_LEVEL, 0);
     }
 
   if (execution_direction == EXEC_REVERSE)
@@ -2334,7 +2336,8 @@ kill_command (char *arg, int from_tty)
       if (target_has_stack)
 	{
 	  printf_filtered (_("In %s,\n"), target_longname);
-	  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+	  print_stack_frame (get_selected_frame (NULL),
+			     PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
 	}
     }
   bfd_cache_close_all ();
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 28a5200..39fe745 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -739,7 +739,8 @@ inferior_command (char *args, int from_tty)
   else if (inf->pid != 0)
     {
       ui_out_text (current_uiout, "\n");
-      print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+      print_stack_frame (get_selected_frame (NULL),
+			 PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
     }
 }
 
diff --git a/gdb/infrun.c b/gdb/infrun.c
index d09c977..c24183a 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -6056,7 +6056,7 @@ normal_stop (void)
       if (stop_print_frame && !batch_silent)
 	{
 	  int bpstat_ret;
-	  int source_flag;
+	  enum print_what print_what;
 	  int do_frame_printing = 1;
 	  struct thread_info *tp = inferior_thread ();
 
@@ -6071,34 +6071,32 @@ normal_stop (void)
 		  && frame_id_eq (tp->control.step_frame_id,
 				  get_frame_id (get_current_frame ()))
 		  && step_start_function == find_pc_function (stop_pc))
-		source_flag = SRC_LINE;		/* Finished step, just
-						   print source line.  */
+		print_what = PF_SRC_LINE;  /* Finished step.  */
 	      else
-		source_flag = SRC_AND_LOC;	/* Print location and
-						   source line.  */
+		print_what = PF_LOCATION | PF_SRC_LINE;
 	      break;
 	    case PRINT_SRC_AND_LOC:
-	      source_flag = SRC_AND_LOC;	/* Print location and
-						   source line.  */
+	      print_what = PF_LOCATION | PF_SRC_LINE;
 	      break;
 	    case PRINT_SRC_ONLY:
-	      source_flag = SRC_LINE;
+	      print_what = PF_SRC_LINE;
 	      break;
 	    case PRINT_NOTHING:
-	      source_flag = SRC_LINE;	/* something bogus */
+	      print_what = PF_SRC_LINE;	/* something bogus */
 	      do_frame_printing = 0;
 	      break;
 	    default:
 	      internal_error (__FILE__, __LINE__, _("Unknown value."));
 	    }
 
-	  /* The behavior of this routine with respect to the source
-	     flag is:
-	     SRC_LINE: Print only source line
-	     LOCATION: Print only location
-	     SRC_AND_LOC: Print location and source line.  */
+	  /* If only printing source, then make sure to print the
+	     address if the program landed in the middle of a
+	     statement.  */
+	  if (print_what == PF_SRC_LINE)
+	    print_what |= PF_SRC_ADDRESS;
+
 	  if (do_frame_printing)
-	    print_stack_frame (get_selected_frame (NULL), 0, source_flag, 1);
+	    print_stack_frame (get_selected_frame (NULL), print_what, 1);
 
 	  /* Display the auto-display expressions.  */
 	  do_displays ();
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 3774a7f..f1821c8 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -731,7 +731,8 @@ linux_fork_context (struct fork_info *newfp, int from_tty)
   printf_filtered (_("Switching to %s\n"),
 		   target_pid_to_str (inferior_ptid));
 
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+  print_stack_frame (get_selected_frame (NULL),
+		     PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
 }
 
 /* Switch inferior process (checkpoint) context, by checkpoint id.  */
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 6101341..edc2c1f 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -158,8 +158,9 @@ mi_cmd_stack_list_frames (char *command, char **argv, int argc)
 	{
 	  QUIT;
 	  /* Print the location and the address always, even for level 0.
-	     If args is 0, don't print the arguments.  */
-	  print_frame_info (fi, 1, LOC_AND_ADDRESS, 0 /* args */, 0);
+	     Don't print the arguments.  */
+	  print_frame_info (fi, PF_LOCATION | PF_LOC_LEVEL | PF_LOC_ADDRESS,
+			    0);
 	}
     }
 
@@ -691,5 +692,6 @@ mi_cmd_stack_info_frame (char *command, char **argv, int argc)
   if (argc > 0)
     error (_("-stack-info-frame: No arguments allowed"));
 
-  print_frame_info (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 0, 1);
+  print_frame_info (get_selected_frame (NULL),
+		    PF_LOCATION | PF_LOC_LEVEL | PF_LOC_ADDRESS, 1);
 }
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 80cc005..be7d360 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -448,7 +448,8 @@ mi_on_normal_stop (struct bpstats *bs, int print_frame)
 	  get_last_target_status (&last_ptid, &last);
 	  bpstat_print (bs, last.kind);
 
-	  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
+	  print_stack_frame (get_selected_frame (NULL),
+			     PF_LOCATION | PF_SRC_LINE, 1);
 	  current_uiout = saved_uiout;
 	}
 
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index e8c4744..a176c59 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -194,7 +194,8 @@ mi_cmd_exec_return (char *command, char **argv, int argc)
 
   /* Because we have called return_command with from_tty = 0, we need
      to print the frame here.  */
-  print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 1);
+  print_stack_frame (get_selected_frame (NULL),
+		     PF_LOCATION | PF_LOC_LEVEL | PF_LOC_ADDRESS, 1);
 }
 
 void
@@ -2484,7 +2485,8 @@ mi_cmd_trace_find (char *command, char **argv, int argc)
     error (_("Invalid mode '%s'"), mode);
 
   if (has_stack_frames () || get_traceframe_number () >= 0)
-    print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 1);
+    print_stack_frame (get_selected_frame (NULL),
+		       PF_LOCATION | PF_LOC_LEVEL | PF_LOC_ADDRESS, 1);
 }
 
 void
diff --git a/gdb/record-full.c b/gdb/record-full.c
index f9af408..e90b5e9 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -2004,7 +2004,8 @@ record_full_goto_entry (struct record_full_entry *p)
 
   registers_changed ();
   reinit_frame_cache ();
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+  print_stack_frame (get_selected_frame (NULL),
+		     PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
 }
 
 /* The "to_goto_record_begin" target method.  */
@@ -2590,7 +2591,8 @@ record_full_restore (void)
   printf_filtered (_("Restored records from core file %s.\n"),
 		   bfd_get_filename (core_bfd));
 
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+  print_stack_frame (get_selected_frame (NULL),
+		     PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
 }
 
 /* bfdcore_write -- write bytes into a core file section.  */
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index bf6cce5..7817bc7 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -1661,7 +1661,8 @@ seen from the board via TFTP, specify that name as the third parameter.\n"));
   reinit_frame_cache ();
   registers_changed ();
   stop_pc = regcache_read_pc (get_current_regcache ());
-  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
+  print_stack_frame (get_selected_frame (NULL), 0,
+		     PF_LOCATION | PF_SRC_LINE, 1);
   xfree (serial_port_name);
 
   do_cleanups (cleanup);
diff --git a/gdb/stack.c b/gdb/stack.c
index cd4ac7a..f8ad24a 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -95,8 +95,8 @@ const char *print_entry_values = print_entry_values_default;
 static void print_frame_local_vars (struct frame_info *, int,
 				    struct ui_file *);
 
-static void print_frame (struct frame_info *frame, int print_level,
-			 enum print_what print_what,  int print_args,
+static void print_frame (struct frame_info *frame,
+			 enum print_what print_what,
 			 struct symtab_and_line sal);
 
 static void set_last_displayed_sal (int valid,
@@ -146,29 +146,30 @@ frame_show_address (struct frame_info *frame,
   return get_frame_pc (frame) != sal.pc;
 }
 
-/* Show or print a stack frame FRAME briefly.  The output is format
-   according to PRINT_LEVEL and PRINT_WHAT printing the frame's
-   relative level, function name, argument list, and file name and
-   line number.  If the frame's PC is not at the beginning of the
-   source line, the actual PC is printed at the beginning.  */
+/* Show or print a stack frame FRAME briefly.  The output is formatted
+   according to PRINT_WHAT, printing the frame's relative level,
+   function name, argument list, file name and line number.  If the
+   frame's PC is not at the beginning of the source line, the actual
+   PC is printed at the beginning.  */
 
 void
-print_stack_frame (struct frame_info *frame, int print_level,
-		   enum print_what print_what,
+print_stack_frame (struct frame_info *frame, enum print_what print_what,
 		   int set_current_sal)
 {
   volatile struct gdb_exception e;
 
-  /* For mi, alway print location and address.  */
+  /* For mi, alway print location and address, and no source line.  */
   if (ui_out_is_mi_like_p (current_uiout))
-    print_what = LOC_AND_ADDRESS;
+    {
+      print_what |= PF_LOCATION | PF_LOC_ADDRESS;
+      print_what &= ~PF_SRC_LINE;
+    }
 
   TRY_CATCH (e, RETURN_MASK_ERROR)
     {
-      int center = (print_what == SRC_LINE || print_what == SRC_AND_LOC);
+      int center = (print_what & PF_SRC_LINE) != 0;
 
-      print_frame_info (frame, print_level, print_what, 1 /* print_args */,
-			set_current_sal);
+      print_frame_info (frame, print_what | PF_LOC_ARGS, set_current_sal);
       if (set_current_sal)
 	set_current_sal_from_frame (frame, center);
     }
@@ -770,20 +771,11 @@ do_gdb_disassembly (struct gdbarch *gdbarch,
     }
 }
 
-/* Print information about frame FRAME.  The output is format according
-   to PRINT_LEVEL and PRINT_WHAT and PRINT_ARGS.  The meaning of
-   PRINT_WHAT is:
-   
-   SRC_LINE: Print only source line.
-   LOCATION: Print only location.
-   LOC_AND_SRC: Print location and source line.
-
-   Used in "where" output, and to emit breakpoint or step
-   messages.  */
+/* Print information about frame FRAME.  The output is formatted
+   according to PRINT_WHAT.  */
 
 void
-print_frame_info (struct frame_info *frame, int print_level,
-		  enum print_what print_what, int print_args,
+print_frame_info (struct frame_info *frame, enum print_what print_what,
 		  int set_current_sal)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -798,6 +790,7 @@ print_frame_info (struct frame_info *frame, int print_level,
     {
       struct cleanup *uiout_cleanup
 	= make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
+      int print_level = (print_what & PF_LOC_LEVEL) != 0;
 
       annotate_frame_begin (print_level ? frame_relative_level (frame) : 0,
 			    gdbarch, get_frame_pc (frame));
@@ -847,14 +840,12 @@ print_frame_info (struct frame_info *frame, int print_level,
      to get the line containing FRAME->pc.  */
   find_frame_sal (frame, &sal);
 
-  location_print = (print_what == LOCATION 
-		    || print_what == LOC_AND_ADDRESS
-		    || print_what == SRC_AND_LOC);
+  location_print = (print_what & PF_LOCATION) != 0;
 
   if (location_print || !sal.symtab)
-    print_frame (frame, print_level, print_what, print_args, sal);
+    print_frame (frame, print_what, sal);
 
-  source_print = (print_what == SRC_LINE || print_what == SRC_AND_LOC);
+  source_print = (print_what & PF_SRC_LINE) != 0;
 
   /* If disassemble-next-line is set to auto or on and doesn't have
      the line debug messages for $pc, output the next instruction.  */
@@ -867,7 +858,7 @@ print_frame_info (struct frame_info *frame, int print_level,
   if (source_print && sal.symtab)
     {
       int done = 0;
-      int mid_statement = ((print_what == SRC_LINE)
+      int mid_statement = ((print_what & PF_SRC_ADDRESS) != 0
 			   && frame_show_address (frame, sal));
 
       if (annotation_level)
@@ -1126,8 +1117,7 @@ find_frame_funname (struct frame_info *frame, char **funname,
 }
 
 static void
-print_frame (struct frame_info *frame, int print_level,
-	     enum print_what print_what, int print_args,
+print_frame (struct frame_info *frame, enum print_what print_what,
 	     struct symtab_and_line sal)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -1140,6 +1130,8 @@ print_frame (struct frame_info *frame, int print_level,
   struct symbol *func;
   CORE_ADDR pc = 0;
   int pc_p;
+  int print_level = ((print_what & PF_LOC_LEVEL) != 0);
+  int print_args = ((print_what & PF_LOC_ARGS) != 0);
 
   pc_p = get_frame_pc_if_available (frame, &pc);
 
@@ -1164,7 +1156,8 @@ print_frame (struct frame_info *frame, int print_level,
   if (opts.addressprint)
     if (!sal.symtab
 	|| frame_show_address (frame, sal)
-	|| print_what == LOC_AND_ADDRESS)
+	|| ((print_what & PF_LOCATION) != 0
+	    && (print_what & PF_LOC_ADDRESS) != 0))
       {
 	annotate_frame_address ();
 	if (pc_p)
@@ -1791,7 +1784,7 @@ backtrace_command_1 (char *count_exp, int show_locals, int no_filters,
 	     hand, perhaps the code does or could be fixed to make sure
 	     the frame->prev field gets set to NULL in that case).  */
 
-	  print_frame_info (fi, 1, LOCATION, 1, 0);
+	  print_frame_info (fi, PF_LOCATION | PF_LOC_LEVEL | PF_LOC_ARGS, 0);
 	  if (show_locals)
 	    {
 	      struct frame_id frame_id = get_frame_id (fi);
@@ -2188,7 +2181,7 @@ select_and_print_frame (struct frame_info *frame)
 {
   select_frame (frame);
   if (frame)
-    print_stack_frame (frame, 1, SRC_AND_LOC, 1);
+    print_stack_frame (frame, PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
 }
 \f
 /* Return the symbol-block in which the selected frame is executing.
@@ -2266,7 +2259,8 @@ static void
 frame_command (char *level_exp, int from_tty)
 {
   select_frame_command (level_exp, from_tty);
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+  print_stack_frame (get_selected_frame (NULL),
+		     PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
 }
 
 /* The XDB Compatibility command to print the current frame.  */
@@ -2274,7 +2268,8 @@ frame_command (char *level_exp, int from_tty)
 static void
 current_frame_command (char *level_exp, int from_tty)
 {
-  print_stack_frame (get_selected_frame (_("No stack.")), 1, SRC_AND_LOC, 1);
+  print_stack_frame (get_selected_frame (_("No stack.")),
+		     PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
 }
 
 /* Select the frame up one or COUNT_EXP stack levels from the
@@ -2305,7 +2300,8 @@ static void
 up_command (char *count_exp, int from_tty)
 {
   up_silently_base (count_exp);
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+  print_stack_frame (get_selected_frame (NULL),
+		     PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
 }
 
 /* Select the frame down one or COUNT_EXP stack levels from the previously
@@ -2344,7 +2340,8 @@ static void
 down_command (char *count_exp, int from_tty)
 {
   down_silently_base (count_exp);
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+  print_stack_frame (get_selected_frame (NULL),
+		     PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
 }
 \f
 
diff --git a/gdb/thread.c b/gdb/thread.c
index 498e547..4038d8a 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -923,13 +923,17 @@ print_thread_info (struct ui_out *uiout, char *requested_threads, int pid)
 	ui_out_text (uiout, "(running)\n");
       else
 	{
+	  enum print_what print_what;
+
 	  /* The switch below puts us at the top of the stack (leaf
 	     frame).  */
 	  switch_to_thread (tp->ptid);
-	  print_stack_frame (get_selected_frame (NULL),
-			     /* For MI output, print frame level.  */
-			     ui_out_is_mi_like_p (uiout),
-			     LOCATION, 0);
+
+	  print_what = PF_LOCATION;
+	  /* For MI output, print frame level.  */
+	  if (ui_out_is_mi_like_p (uiout))
+	    print_what |= PF_LOC_LEVEL;
+	  print_stack_frame (get_selected_frame (NULL), print_what, 0);
 	}
 
       if (ui_out_is_mi_like_p (uiout))
@@ -1082,7 +1086,8 @@ restore_selected_frame (struct frame_id a_frame_id, int frame_level)
       /* For MI, we should probably have a notification about
 	 current frame change.  But this error is not very
 	 likely, so don't bother for now.  */
-      print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+      print_stack_frame (get_selected_frame (NULL),
+			 PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
     }
 }
 
@@ -1467,7 +1472,8 @@ do_captured_thread_select (struct ui_out *uiout, void *tidstr)
   else
     {
       ui_out_text (uiout, "\n");
-      print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+      print_stack_frame (get_selected_frame (NULL),
+			 PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
     }
 
   /* Since the current thread may have changed, see if there is any
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index c086587..deabf28 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2440,11 +2440,13 @@ tfind_1 (enum trace_find_type type, int num,
 
       if (frame_id_eq (old_frame_id,
 		       get_frame_id (get_current_frame ())))
-	print_what = SRC_LINE;
+	print_what = PF_SRC_LINE | PF_SRC_ADDRESS;
       else
-	print_what = SRC_AND_LOC;
+	print_what = PF_LOCATION | PF_SRC_LINE;
 
-      print_stack_frame (get_selected_frame (NULL), 1, print_what, 1);
+      print_what |= PF_LOC_LEVEL;
+
+      print_stack_frame (get_selected_frame (NULL), print_what, 1);
       do_displays ();
     }
 }

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/3] cleanup print_frame_info.
  2013-08-30 15:50 [PATCH 0/3] Fix PR gdb/15911, cleanup print_stack_frame somewhat Pedro Alves
@ 2013-08-30 15:50 ` Pedro Alves
  2013-08-30 15:50 ` [PATCH 2/3] print_stack_frame&friends: merge print_level, print_args and print_what Pedro Alves
  2013-08-30 16:09 ` [PATCH 1/3] PR gdb/15911: "info threads" changes the default source and line (for "break", "list") Pedro Alves
  2 siblings, 0 replies; 6+ messages in thread
From: Pedro Alves @ 2013-08-30 15:50 UTC (permalink / raw)
  To: gdb-patches

This "regardless" comment is confusing.  It was not clear to me what
"this" was referring to.  Looking back in history, the comment appears
already in the initial cvs import, and at that time, this branch was
only printing the level, so the comment must be referring to the level
printing.  SOURCE refers to the old 'source' parameter, before it was
replaced with print_what.  Whatever the original meaning, it's gone
and the comment is just distrating.

I had initially thought that the "regardless" comment might be
referring to the ui_out_is_mi_like_p check.  But, given the
investigation above, it isn't.

print_stack_frame unconditionally sets print_what to
PF_LOCATION|PF_LOC_ADDRESS for MI, so replacing with the proper
print_what check will have the same effect for MI (I ran tests with
assertions in place to look for cases I might have missed), and I
think it's cleaner/simpler/'less suprising' this way.

Tested on x86_64 Fedora 17.

gdb/
2013-08-30  Pedro Alves  <palves@redhat.com>

	* stack.c (print_frame_info): Remove comment.  Check print_what
	instead of whether the uiout is MI-like.
---
 0 files changed

diff --git a/gdb/stack.c b/gdb/stack.c
index f8ad24a..5313771 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -795,15 +795,13 @@ print_frame_info (struct frame_info *frame, enum print_what print_what,
       annotate_frame_begin (print_level ? frame_relative_level (frame) : 0,
 			    gdbarch, get_frame_pc (frame));
 
-      /* Do this regardless of SOURCE because we don't have any source
-         to list for this frame.  */
       if (print_level)
         {
           ui_out_text (uiout, "#");
           ui_out_field_fmt_int (uiout, 2, ui_left, "level",
 				frame_relative_level (frame));
         }
-      if (ui_out_is_mi_like_p (uiout))
+      if ((print_what & PF_LOC_ADDRESS) != 0)
         {
           annotate_frame_address ();
           ui_out_field_core_addr (uiout, "addr",

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] PR gdb/15911: "info threads" changes the default source and line (for "break", "list")
  2013-08-30 15:50 [PATCH 0/3] Fix PR gdb/15911, cleanup print_stack_frame somewhat Pedro Alves
  2013-08-30 15:50 ` [PATCH 3/3] cleanup print_frame_info Pedro Alves
  2013-08-30 15:50 ` [PATCH 2/3] print_stack_frame&friends: merge print_level, print_args and print_what Pedro Alves
@ 2013-08-30 16:09 ` Pedro Alves
  2013-09-17 18:39   ` Pedro Alves
  2 siblings, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2013-08-30 16:09 UTC (permalink / raw)
  To: gdb-patches

"info threads" changes the default source for "break" and "list", to
whatever the location of the first/bottom thread in the thread list
is...

 (gdb) b start
 (gdb) c
 ...
 (gdb) list
 *lists "start"*
 (gdb) b 23
 Breakpoint 3 at 0x400614: file test.c, line 23.
 (gdb) info threads
   Id   Target Id         Frame
 * 2    Thread 0x7ffff7fcb700 (LWP 1760) "test" start (arg=0x0) at test.c:23
   1    Thread 0x7ffff7fcc740 (LWP 1748) "test" 0x000000323dc08e60 in pthread_join (threadid=140737353922304, thread_return=0x0) at pthread_join.c:93
 (gdb) b 23
 Breakpoint 4 at 0x323dc08d90: file pthread_join.c, line 23.
                                    ^^^^^^^^^^^^^^^
 (gdb) list
 93          lll_wait_tid (pd->tid);
 94
 95
 96        /* Restore cancellation mode.  */
 97        CANCEL_RESET (oldtype);
 98
 99        /* Remove the handler.  */
 100       pthread_cleanup_pop (0);
 101
 102

The issue is that print_stack_frame always sets the current sal to the
frame's sal.  print_frame_info (which print_stack_frame calls to do
most of the work) also sets the last displayed sal, but only if
print_what isn't LOCATION.  Now the call in question, from within
thread.c:print_thread_info, does pass in LOCATION as print_what, but
print_stack_frame doesn't have the same check print_frame_info has.
We could consider adding it, but setting these globals depending on
print_what isn't very clean, IMO.  What we have is two logically
distinct operations mixed in the same function(s):

  #1 - print frame, in the format specified by {print_what,
    print_level and print_args}.

  #2 - We're displaying a frame to the user, and I want the default
    sal to point here, because the program stopped here, or the user
    did some context-changing command (up, down, etc.).

So I added a new parameter to print_stack_frame & friends for point
#2, and went through all calls in the tree adjusting as necessary.

Tested on x86_64 Fedora 17.

gdb/
2013-08-30  Pedro Alves  <palves@redhat.com>

	PR gdb/15911
	* ada-tasks.c (task_command_1): Adjust call to print_stack_frame.
	* bsd-kvm.c (bsd_kvm_open, bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd):
	* corelow.c (core_open):
	* frame.h (print_stack_frame, print_frame_info): New
	'set_current_sal' parameter.
	* infcmd.c (finish_command, kill_command): Adjust call to
	print_stack_frame.
	* inferior.c (inferior_command): Likewise.
	* infrun.c (normal_stop): Likewise.
	* linux-fork.c (linux_fork_context): Likewise.
	* record-full.c (record_full_goto_entry, record_full_restore):
	Likewise.
	* remote-mips.c (common_open): Likewise.
	* stack.c (print_stack_frame): New 'set_current_sal' parameter.
	Use it.
	(print_frame_info): New 'set_current_sal' parameter.  Set the last
	displayed sal depending on the new paremeter instead of looking at
	print_what.
	(backtrace_command_1, select_and_print_frame, frame_command)
	(current_frame_command, up_command, down_command): Adjust call to
	print_stack_frame.
	* thread.c (print_thread_info, restore_selected_frame)
	(do_captured_thread_select): Adjust call to print_stack_frame.
	* tracepoint.c (tfind_1): Likewise.
	* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames)
	(mi_cmd_stack_info_frame): Likewise.
	* mi/mi-interp.c (mi_on_normal_stop): Likewise.
	* mi/mi-main.c (mi_cmd_exec_return, mi_cmd_trace_find): Likewise.

	gdb/testsuite/
	* gdb.threads/info-threads-cur-sal-2.c: New file.
	* gdb.threads/info-threads-cur-sal.c: New file.
	* gdb.threads/info-threads-cur-sal.exp: New file.
---
 gdb/mi/mi-cmd-stack.c |    4 ++--
 gdb/mi/mi-interp.c    |    2 +-
 gdb/mi/mi-main.c      |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 3aa6667..dfb6719 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -1311,7 +1311,7 @@ task_command_1 (char *taskno_str, int from_tty, struct inferior *inf)
   printf_filtered (_("[Switching to task %d]\n"), taskno);
   print_stack_frame (get_selected_frame (NULL),
                      frame_relative_level (get_selected_frame (NULL)),
-		     SRC_AND_LOC);
+		     SRC_AND_LOC, 1);
 }
 
 
diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c
index b47578b..d1e7ca8 100644
--- a/gdb/bsd-kvm.c
+++ b/gdb/bsd-kvm.c
@@ -100,7 +100,7 @@ bsd_kvm_open (char *filename, int from_tty)
   target_fetch_registers (get_current_regcache (), -1);
 
   reinit_frame_cache ();
-  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
 }
 
 static void
@@ -286,7 +286,7 @@ bsd_kvm_proc_cmd (char *arg, int fromtty)
   target_fetch_registers (get_current_regcache (), -1);
 
   reinit_frame_cache ();
-  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
 }
 
 #endif
@@ -306,7 +306,7 @@ bsd_kvm_pcb_cmd (char *arg, int fromtty)
   target_fetch_registers (get_current_regcache (), -1);
 
   reinit_frame_cache ();
-  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
 }
 
 static int
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 8371b58..7a5aaab 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -453,7 +453,7 @@ core_open (char *filename, int from_tty)
 
   /* Now, set up the frame cache, and print the top of stack.  */
   reinit_frame_cache ();
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
 }
 
 static void
diff --git a/gdb/frame.h b/gdb/frame.h
index 5e2400d..a5e1629 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -660,10 +660,12 @@ extern CORE_ADDR get_pc_function_start (CORE_ADDR);
 extern struct frame_info *find_relative_frame (struct frame_info *, int *);
 
 extern void print_stack_frame (struct frame_info *, int print_level,
-			       enum print_what print_what);
+			       enum print_what print_what,
+			       int set_current_sal);
 
 extern void print_frame_info (struct frame_info *, int print_level,
-			      enum print_what print_what, int args);
+			      enum print_what print_what, int args,
+			      int set_current_sal);
 
 extern struct frame_info *block_innermost_frame (const struct block *);
 
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 154cde2..242aac1 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1765,7 +1765,7 @@ finish_command (char *arg, int from_tty)
       if (from_tty)
 	{
 	  printf_filtered (_("Run till exit from "));
-	  print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
+	  print_stack_frame (get_selected_frame (NULL), 1, LOCATION, 0);
 	}
 
       proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT, 1);
@@ -1790,7 +1790,7 @@ finish_command (char *arg, int from_tty)
       else
 	printf_filtered (_("Run till exit from "));
 
-      print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
+      print_stack_frame (get_selected_frame (NULL), 1, LOCATION, 0);
     }
 
   if (execution_direction == EXEC_REVERSE)
@@ -2334,7 +2334,7 @@ kill_command (char *arg, int from_tty)
       if (target_has_stack)
 	{
 	  printf_filtered (_("In %s,\n"), target_longname);
-	  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+	  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
 	}
     }
   bfd_cache_close_all ();
diff --git a/gdb/inferior.c b/gdb/inferior.c
index d5866e1..28a5200 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -739,7 +739,7 @@ inferior_command (char *args, int from_tty)
   else if (inf->pid != 0)
     {
       ui_out_text (current_uiout, "\n");
-      print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+      print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
     }
 }
 
diff --git a/gdb/infrun.c b/gdb/infrun.c
index dc1036d..d09c977 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -6098,7 +6098,7 @@ normal_stop (void)
 	     LOCATION: Print only location
 	     SRC_AND_LOC: Print location and source line.  */
 	  if (do_frame_printing)
-	    print_stack_frame (get_selected_frame (NULL), 0, source_flag);
+	    print_stack_frame (get_selected_frame (NULL), 0, source_flag, 1);
 
 	  /* Display the auto-display expressions.  */
 	  do_displays ();
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 4100cb1..3774a7f 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -731,7 +731,7 @@ linux_fork_context (struct fork_info *newfp, int from_tty)
   printf_filtered (_("Switching to %s\n"),
 		   target_pid_to_str (inferior_ptid));
 
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
 }
 
 /* Switch inferior process (checkpoint) context, by checkpoint id.  */
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 7bf9ab8..6101341 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -159,7 +159,7 @@ mi_cmd_stack_list_frames (char *command, char **argv, int argc)
 	  QUIT;
 	  /* Print the location and the address always, even for level 0.
 	     If args is 0, don't print the arguments.  */
-	  print_frame_info (fi, 1, LOC_AND_ADDRESS, 0 /* args */ );
+	  print_frame_info (fi, 1, LOC_AND_ADDRESS, 0 /* args */, 0);
 	}
     }
 
@@ -691,5 +691,5 @@ mi_cmd_stack_info_frame (char *command, char **argv, int argc)
   if (argc > 0)
     error (_("-stack-info-frame: No arguments allowed"));
 
-  print_frame_info (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 0);
+  print_frame_info (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 0, 1);
 }
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 038132f..80cc005 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -448,7 +448,7 @@ mi_on_normal_stop (struct bpstats *bs, int print_frame)
 	  get_last_target_status (&last_ptid, &last);
 	  bpstat_print (bs, last.kind);
 
-	  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
+	  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
 	  current_uiout = saved_uiout;
 	}
 
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index e6e98b6..e8c4744 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -194,7 +194,7 @@ mi_cmd_exec_return (char *command, char **argv, int argc)
 
   /* Because we have called return_command with from_tty = 0, we need
      to print the frame here.  */
-  print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS);
+  print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 1);
 }
 
 void
@@ -2484,7 +2484,7 @@ mi_cmd_trace_find (char *command, char **argv, int argc)
     error (_("Invalid mode '%s'"), mode);
 
   if (has_stack_frames () || get_traceframe_number () >= 0)
-    print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS);
+    print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 1);
 }
 
 void
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 1c4e68b..f9af408 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -2004,7 +2004,7 @@ record_full_goto_entry (struct record_full_entry *p)
 
   registers_changed ();
   reinit_frame_cache ();
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
 }
 
 /* The "to_goto_record_begin" target method.  */
@@ -2590,7 +2590,7 @@ record_full_restore (void)
   printf_filtered (_("Restored records from core file %s.\n"),
 		   bfd_get_filename (core_bfd));
 
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
 }
 
 /* bfdcore_write -- write bytes into a core file section.  */
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 081fbd0..bf6cce5 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -1661,7 +1661,7 @@ seen from the board via TFTP, specify that name as the third parameter.\n"));
   reinit_frame_cache ();
   registers_changed ();
   stop_pc = regcache_read_pc (get_current_regcache ());
-  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
   xfree (serial_port_name);
 
   do_cleanups (cleanup);
diff --git a/gdb/stack.c b/gdb/stack.c
index 16a03eb..cd4ac7a 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -154,7 +154,8 @@ frame_show_address (struct frame_info *frame,
 
 void
 print_stack_frame (struct frame_info *frame, int print_level,
-		   enum print_what print_what)
+		   enum print_what print_what,
+		   int set_current_sal)
 {
   volatile struct gdb_exception e;
 
@@ -166,8 +167,10 @@ print_stack_frame (struct frame_info *frame, int print_level,
     {
       int center = (print_what == SRC_LINE || print_what == SRC_AND_LOC);
 
-      print_frame_info (frame, print_level, print_what, 1 /* print_args */);
-      set_current_sal_from_frame (frame, center);
+      print_frame_info (frame, print_level, print_what, 1 /* print_args */,
+			set_current_sal);
+      if (set_current_sal)
+	set_current_sal_from_frame (frame, center);
     }
 }
 
@@ -780,7 +783,8 @@ do_gdb_disassembly (struct gdbarch *gdbarch,
 
 void
 print_frame_info (struct frame_info *frame, int print_level,
-		  enum print_what print_what, int print_args)
+		  enum print_what print_what, int print_args,
+		  int set_current_sal)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
   struct symtab_and_line sal;
@@ -905,7 +909,7 @@ print_frame_info (struct frame_info *frame, int print_level,
 	do_gdb_disassembly (get_frame_arch (frame), -1, sal.pc, sal.end);
     }
 
-  if (print_what != LOCATION)
+  if (set_current_sal)
     {
       CORE_ADDR pc;
 
@@ -1787,7 +1791,7 @@ backtrace_command_1 (char *count_exp, int show_locals, int no_filters,
 	     hand, perhaps the code does or could be fixed to make sure
 	     the frame->prev field gets set to NULL in that case).  */
 
-	  print_frame_info (fi, 1, LOCATION, 1);
+	  print_frame_info (fi, 1, LOCATION, 1, 0);
 	  if (show_locals)
 	    {
 	      struct frame_id frame_id = get_frame_id (fi);
@@ -2184,7 +2188,7 @@ select_and_print_frame (struct frame_info *frame)
 {
   select_frame (frame);
   if (frame)
-    print_stack_frame (frame, 1, SRC_AND_LOC);
+    print_stack_frame (frame, 1, SRC_AND_LOC, 1);
 }
 \f
 /* Return the symbol-block in which the selected frame is executing.
@@ -2262,7 +2266,7 @@ static void
 frame_command (char *level_exp, int from_tty)
 {
   select_frame_command (level_exp, from_tty);
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
 }
 
 /* The XDB Compatibility command to print the current frame.  */
@@ -2270,7 +2274,7 @@ frame_command (char *level_exp, int from_tty)
 static void
 current_frame_command (char *level_exp, int from_tty)
 {
-  print_stack_frame (get_selected_frame (_("No stack.")), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (_("No stack.")), 1, SRC_AND_LOC, 1);
 }
 
 /* Select the frame up one or COUNT_EXP stack levels from the
@@ -2301,7 +2305,7 @@ static void
 up_command (char *count_exp, int from_tty)
 {
   up_silently_base (count_exp);
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
 }
 
 /* Select the frame down one or COUNT_EXP stack levels from the previously
@@ -2340,7 +2344,7 @@ static void
 down_command (char *count_exp, int from_tty)
 {
   down_silently_base (count_exp);
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
 }
 \f
 
diff --git a/gdb/testsuite/gdb.threads/info-threads-cur-sal-2.c b/gdb/testsuite/gdb.threads/info-threads-cur-sal-2.c
new file mode 100644
index 0000000..2c29686
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/info-threads-cur-sal-2.c
@@ -0,0 +1,23 @@
+/* Copyright 2013 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <stddef.h>
+
+void *
+start (void *arg)
+{
+  /* "list" should show this line.  */
+  return NULL;
+}
diff --git a/gdb/testsuite/gdb.threads/info-threads-cur-sal.c b/gdb/testsuite/gdb.threads/info-threads-cur-sal.c
new file mode 100644
index 0000000..ae0005b
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/info-threads-cur-sal.c
@@ -0,0 +1,35 @@
+/* Clean exit of the thread group leader should not break GDB.
+
+   Copyright 2007-2013 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <pthread.h>
+#include <assert.h>
+#include <unistd.h>
+
+extern void *start (void *arg);
+
+int
+main (void)
+{
+  pthread_t thread;
+  int i;
+
+  i = pthread_create (&thread, NULL, start, NULL);
+  assert (i == 0);
+  pthread_join (thread, NULL);
+
+  return 0;
+}
diff --git a/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp b/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp
new file mode 100644
index 0000000..f18ae0c
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp
@@ -0,0 +1,57 @@
+# Copyright (C) 2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile info-threads-cur-sal.c info-threads-cur-sal-2.c
+
+set executable ${testfile}
+
+if {[gdb_compile_pthreads \
+	 "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile2}" \
+	 "${binfile}" executable {debug}] != "" } {
+    return -1
+}
+
+clean_restart ${executable}
+
+if ![runto_main] {
+    return -1
+}
+
+gdb_breakpoint "start"
+gdb_continue_to_breakpoint "start"
+
+set line [gdb_get_line_number "should show this line" "${srcfile2}"]
+
+gdb_test "list $line" \
+    "\"list\" should show this line.*" \
+    "list before info threads"
+
+# There used to be a bug where "info threads" would set the current
+# SAL to the location of the last thread displayed.
+gdb_test "info threads" \
+    "\r\n\[ \t\]*Id\[ \t\]+Target\[ \t\]+Id\[ \t\]+Frame\[ \t\]*\r\n\\* 2 *Thread \[^\r\n\]* at \[^\r\n\]*\r\n  1 *Thread \[^\r\n\]* .* \[^\r\n\]*" \
+    "info threads before break"
+
+# Check that "break" is still operating on the same file by default.
+gdb_test "break $line" ".*${srcfile2}.*" "break on line"
+
+gdb_test "info threads" \
+    "\r\n\[ \t\]*Id\[ \t\]+Target\[ \t\]+Id\[ \t\]+Frame\[ \t\]*\r\n\\* 2 *Thread \[^\r\n\]* at \[^\r\n\]*\r\n  1 *Thread \[^\r\n\]* .* \[^\r\n\]*" \
+    "info threads before list"
+
+# And that so is "list".
+gdb_test "list $line" \
+    "\"list\" should show this line.*" \
+    "list after info threads"
diff --git a/gdb/thread.c b/gdb/thread.c
index 52626ff..498e547 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -929,7 +929,7 @@ print_thread_info (struct ui_out *uiout, char *requested_threads, int pid)
 	  print_stack_frame (get_selected_frame (NULL),
 			     /* For MI output, print frame level.  */
 			     ui_out_is_mi_like_p (uiout),
-			     LOCATION);
+			     LOCATION, 0);
 	}
 
       if (ui_out_is_mi_like_p (uiout))
@@ -1082,7 +1082,7 @@ restore_selected_frame (struct frame_id a_frame_id, int frame_level)
       /* For MI, we should probably have a notification about
 	 current frame change.  But this error is not very
 	 likely, so don't bother for now.  */
-      print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+      print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
     }
 }
 
@@ -1467,7 +1467,7 @@ do_captured_thread_select (struct ui_out *uiout, void *tidstr)
   else
     {
       ui_out_text (uiout, "\n");
-      print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+      print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
     }
 
   /* Since the current thread may have changed, see if there is any
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 7dbe54b..c086587 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2444,7 +2444,7 @@ tfind_1 (enum trace_find_type type, int num,
       else
 	print_what = SRC_AND_LOC;
 
-      print_stack_frame (get_selected_frame (NULL), 1, print_what);
+      print_stack_frame (get_selected_frame (NULL), 1, print_what, 1);
       do_displays ();
     }
 }

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] print_stack_frame&friends: merge print_level, print_args and print_what.
  2013-08-30 15:50 ` [PATCH 2/3] print_stack_frame&friends: merge print_level, print_args and print_what Pedro Alves
@ 2013-09-06  8:46   ` Jan Kratochvil
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Kratochvil @ 2013-09-06  8:46 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Fri, 30 Aug 2013 17:50:19 +0200, Pedro Alves wrote:
[...]
> --- a/gdb/bsd-kvm.c
> +++ b/gdb/bsd-kvm.c
> @@ -100,7 +100,8 @@ bsd_kvm_open (char *filename, int from_tty)
>    target_fetch_registers (get_current_regcache (), -1);
>  
>    reinit_frame_cache ();
> -  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
> +  print_stack_frame (get_selected_frame (NULL), 0,
> +		     PF_LOCATION | PF_SRC_LINE, 1);

The "0," part is excessive, it will fail the build.


>  }
>  
>  static void
> @@ -286,7 +287,8 @@ bsd_kvm_proc_cmd (char *arg, int fromtty)
>    target_fetch_registers (get_current_regcache (), -1);
>  
>    reinit_frame_cache ();
> -  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
> +  print_stack_frame (get_selected_frame (NULL), 0,
> +		     PF_LOCATION | PF_SRC_LINE, 1);

Likewise.


>  }
>  
>  #endif
> @@ -306,7 +308,8 @@ bsd_kvm_pcb_cmd (char *arg, int fromtty)
>    target_fetch_registers (get_current_regcache (), -1);
>  
>    reinit_frame_cache ();
> -  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
> +  print_stack_frame (get_selected_frame (NULL), 0,
> +		     PF_LOCATION | PF_SRC_LINE, 1);

Likewise.


>  }
>  
>  static int
[...]
> --- a/gdb/frame.h
> +++ b/gdb/frame.h
> @@ -595,18 +595,37 @@ extern struct gdbarch *frame_unwind_arch (struct frame_info *frame);
>  extern struct gdbarch *frame_unwind_caller_arch (struct frame_info *frame);
>  
>  
> -/* Values for the source flag to be used in print_frame_info_base().  */
> +/* Bit flags to be used with print_stack_frame, print_frame_info and
> +   friends.  */
> +
>  enum print_what
>    { 
> -    /* Print only the source line, like in stepi.  */
> -    SRC_LINE = -1, 
> -    /* Print only the location, i.e. level, address (sometimes)
> -       function, args, file, line, line num.  */
> -    LOCATION,
> -    /* Print both of the above.  */
> -    SRC_AND_LOC, 
> -    /* Print location only, but always include the address.  */
> -    LOC_AND_ADDRESS 
> +    /* Print the location, i.e. level (if requested), address
> +       (sometimes), function, args (if requested), file, line, line
> +       num.  */
> +    PF_LOCATION = 1 << 0,
> +
> +    /* Print frame level before the location (e.g., #0).  */
> +    PF_LOC_LEVEL = 1 << 1,
> +
> +    /* Always print address in addition to the location.  If not
> +       specified, the address is printed if there's no symtab for the
> +       location or if the location points in the middle of a
> +       statement.  */
> +    PF_LOC_ADDRESS = 1 << 2,
> +
> +    /* Print function arguments.  */
> +    PF_LOC_ARGS = 1 << 3,
> +
> +    /* Print the source line, if possible.  If not possible (e.g.,
> +       after a stepi in code that has no debug info), print the
> +       location instead.  */
> +    PF_SRC_LINE = 1 << 4,
> +
> +    /* Print address before the source line if PC points to the middle
> +       of a statement.  Only valid if PF_SRC_LINE is also
> +       specified.  */

In such case print_frame could gdb_assert that.


> +    PF_SRC_ADDRESS = 1 << 5,
>    };
>  
>  /* Allocate zero initialized memory from the frame cache obstack.
[...]
> --- a/gdb/stack.c
> +++ b/gdb/stack.c
[...]
> @@ -146,29 +146,30 @@ frame_show_address (struct frame_info *frame,
>    return get_frame_pc (frame) != sal.pc;
>  }
>  
> -/* Show or print a stack frame FRAME briefly.  The output is format
> -   according to PRINT_LEVEL and PRINT_WHAT printing the frame's
> -   relative level, function name, argument list, and file name and
> -   line number.  If the frame's PC is not at the beginning of the
> -   source line, the actual PC is printed at the beginning.  */
> +/* Show or print a stack frame FRAME briefly.  The output is formatted
> +   according to PRINT_WHAT, printing the frame's relative level,
> +   function name, argument list, file name and line number.  If the
> +   frame's PC is not at the beginning of the source line, the actual
> +   PC is printed at the beginning.  */
>  
>  void
> -print_stack_frame (struct frame_info *frame, int print_level,
> -		   enum print_what print_what,
> +print_stack_frame (struct frame_info *frame, enum print_what print_what,
>  		   int set_current_sal)
>  {
>    volatile struct gdb_exception e;
>  
> -  /* For mi, alway print location and address.  */
> +  /* For mi, alway print location and address, and no source line.  */
>    if (ui_out_is_mi_like_p (current_uiout))
> -    print_what = LOC_AND_ADDRESS;
> +    {
> +      print_what |= PF_LOCATION | PF_LOC_ADDRESS;
> +      print_what &= ~PF_SRC_LINE;

Why not to clear also PF_SRC_ADDRESS?


> +    }
>  
>    TRY_CATCH (e, RETURN_MASK_ERROR)
>      {
> -      int center = (print_what == SRC_LINE || print_what == SRC_AND_LOC);
> +      int center = (print_what & PF_SRC_LINE) != 0;
>  
> -      print_frame_info (frame, print_level, print_what, 1 /* print_args */,
> -			set_current_sal);
> +      print_frame_info (frame, print_what | PF_LOC_ARGS, set_current_sal);
>        if (set_current_sal)
>  	set_current_sal_from_frame (frame, center);
>      }


Thanks,
Jan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] PR gdb/15911: "info threads" changes the default source and line (for "break", "list")
  2013-08-30 16:09 ` [PATCH 1/3] PR gdb/15911: "info threads" changes the default source and line (for "break", "list") Pedro Alves
@ 2013-09-17 18:39   ` Pedro Alves
  0 siblings, 0 replies; 6+ messages in thread
From: Pedro Alves @ 2013-09-17 18:39 UTC (permalink / raw)
  To: gdb-patches

I checked this one in, as below, fixing the bug.  I noticed a pasto
in one of the tests' sources (description still referred to the test
I copied from).

I'll be back to patches 2 and 3 later.

-------
Subject: [PATCH] PR gdb/15911: "info threads" changes the default source and
 line (for "break", "list")

"info threads" changes the default source for "break" and "list", to
whatever the location of the first/bottom thread in the thread list
is...

 (gdb) b start
 (gdb) c
 ...
 (gdb) list
 *lists "start"*
 (gdb) b 23
 Breakpoint 3 at 0x400614: file test.c, line 23.
 (gdb) info threads
   Id   Target Id         Frame
 * 2    Thread 0x7ffff7fcb700 (LWP 1760) "test" start (arg=0x0) at test.c:23
   1    Thread 0x7ffff7fcc740 (LWP 1748) "test" 0x000000323dc08e60 in pthread_join (threadid=140737353922304, thread_return=0x0) at pthread_join.c:93
 (gdb) b 23
 Breakpoint 4 at 0x323dc08d90: file pthread_join.c, line 23.
                                    ^^^^^^^^^^^^^^^
 (gdb) list
 93          lll_wait_tid (pd->tid);
 94
 95
 96        /* Restore cancellation mode.  */
 97        CANCEL_RESET (oldtype);
 98
 99        /* Remove the handler.  */
 100       pthread_cleanup_pop (0);
 101
 102

The issue is that print_stack_frame always sets the current sal to the
frame's sal.  print_frame_info (which print_stack_frame calls to do
most of the work) also sets the last displayed sal, but only if
print_what isn't LOCATION.  Now the call in question, from within
thread.c:print_thread_info, does pass in LOCATION as print_what, but
print_stack_frame doesn't have the same check print_frame_info has.
We could consider adding it, but setting these globals depending on
print_what isn't very clean, IMO.  What we have is two logically
distinct operations mixed in the same function(s):

  #1 - print frame, in the format specified by {print_what,
    print_level and print_args}.

  #2 - We're displaying a frame to the user, and I want the default
    sal to point here, because the program stopped here, or the user
    did some context-changing command (up, down, etc.).

So I added a new parameter to print_stack_frame & friends for point
#2, and went through all calls in the tree adjusting as necessary.

Tested on x86_64 Fedora 17.

gdb/
2013-09-17  Pedro Alves  <palves@redhat.com>

	PR gdb/15911
	* ada-tasks.c (task_command_1): Adjust call to print_stack_frame.
	* bsd-kvm.c (bsd_kvm_open, bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd):
	* corelow.c (core_open):
	* frame.h (print_stack_frame, print_frame_info): New
	'set_current_sal' parameter.
	* infcmd.c (finish_command, kill_command): Adjust call to
	print_stack_frame.
	* inferior.c (inferior_command): Likewise.
	* infrun.c (normal_stop): Likewise.
	* linux-fork.c (linux_fork_context): Likewise.
	* record-full.c (record_full_goto_entry, record_full_restore):
	Likewise.
	* remote-mips.c (common_open): Likewise.
	* stack.c (print_stack_frame): New 'set_current_sal' parameter.
	Use it.
	(print_frame_info): New 'set_current_sal' parameter.  Set the last
	displayed sal depending on the new paremeter instead of looking at
	print_what.
	(backtrace_command_1, select_and_print_frame, frame_command)
	(current_frame_command, up_command, down_command): Adjust call to
	print_stack_frame.
	* thread.c (print_thread_info, restore_selected_frame)
	(do_captured_thread_select): Adjust call to print_stack_frame.
	* tracepoint.c (tfind_1): Likewise.
	* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames)
	(mi_cmd_stack_info_frame): Likewise.
	* mi/mi-interp.c (mi_on_normal_stop): Likewise.
	* mi/mi-main.c (mi_cmd_exec_return, mi_cmd_trace_find): Likewise.

	gdb/testsuite/
	* gdb.threads/info-threads-cur-sal-2.c: New file.
	* gdb.threads/info-threads-cur-sal.c: New file.
	* gdb.threads/info-threads-cur-sal.exp: New file.
---
 gdb/ada-tasks.c                                    |  2 +-
 gdb/bsd-kvm.c                                      |  6 +--
 gdb/corelow.c                                      |  2 +-
 gdb/frame.h                                        |  6 ++-
 gdb/infcmd.c                                       |  6 +--
 gdb/inferior.c                                     |  2 +-
 gdb/infrun.c                                       |  2 +-
 gdb/linux-fork.c                                   |  2 +-
 gdb/mi/mi-cmd-stack.c                              |  4 +-
 gdb/mi/mi-interp.c                                 |  2 +-
 gdb/mi/mi-main.c                                   |  4 +-
 gdb/record-full.c                                  |  4 +-
 gdb/remote-mips.c                                  |  2 +-
 gdb/stack.c                                        | 26 +++++-----
 gdb/testsuite/gdb.threads/info-threads-cur-sal-2.c | 23 +++++++++
 gdb/testsuite/gdb.threads/info-threads-cur-sal.c   | 33 +++++++++++++
 gdb/testsuite/gdb.threads/info-threads-cur-sal.exp | 57 ++++++++++++++++++++++
 gdb/thread.c                                       |  6 +--
 gdb/tracepoint.c                                   |  2 +-
 19 files changed, 155 insertions(+), 36 deletions(-)
 create mode 100644 gdb/testsuite/gdb.threads/info-threads-cur-sal-2.c
 create mode 100644 gdb/testsuite/gdb.threads/info-threads-cur-sal.c
 create mode 100644 gdb/testsuite/gdb.threads/info-threads-cur-sal.exp

diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 3aa6667..dfb6719 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -1311,7 +1311,7 @@ task_command_1 (char *taskno_str, int from_tty, struct inferior *inf)
   printf_filtered (_("[Switching to task %d]\n"), taskno);
   print_stack_frame (get_selected_frame (NULL),
                      frame_relative_level (get_selected_frame (NULL)),
-		     SRC_AND_LOC);
+		     SRC_AND_LOC, 1);
 }
 
 
diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c
index b47578b..d1e7ca8 100644
--- a/gdb/bsd-kvm.c
+++ b/gdb/bsd-kvm.c
@@ -100,7 +100,7 @@ bsd_kvm_open (char *filename, int from_tty)
   target_fetch_registers (get_current_regcache (), -1);
 
   reinit_frame_cache ();
-  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
 }
 
 static void
@@ -286,7 +286,7 @@ bsd_kvm_proc_cmd (char *arg, int fromtty)
   target_fetch_registers (get_current_regcache (), -1);
 
   reinit_frame_cache ();
-  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
 }
 
 #endif
@@ -306,7 +306,7 @@ bsd_kvm_pcb_cmd (char *arg, int fromtty)
   target_fetch_registers (get_current_regcache (), -1);
 
   reinit_frame_cache ();
-  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
 }
 
 static int
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 8371b58..7a5aaab 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -453,7 +453,7 @@ core_open (char *filename, int from_tty)
 
   /* Now, set up the frame cache, and print the top of stack.  */
   reinit_frame_cache ();
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
 }
 
 static void
diff --git a/gdb/frame.h b/gdb/frame.h
index 5e2400d..a5e1629 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -660,10 +660,12 @@ extern CORE_ADDR get_pc_function_start (CORE_ADDR);
 extern struct frame_info *find_relative_frame (struct frame_info *, int *);
 
 extern void print_stack_frame (struct frame_info *, int print_level,
-			       enum print_what print_what);
+			       enum print_what print_what,
+			       int set_current_sal);
 
 extern void print_frame_info (struct frame_info *, int print_level,
-			      enum print_what print_what, int args);
+			      enum print_what print_what, int args,
+			      int set_current_sal);
 
 extern struct frame_info *block_innermost_frame (const struct block *);
 
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 154cde2..242aac1 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1765,7 +1765,7 @@ finish_command (char *arg, int from_tty)
       if (from_tty)
 	{
 	  printf_filtered (_("Run till exit from "));
-	  print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
+	  print_stack_frame (get_selected_frame (NULL), 1, LOCATION, 0);
 	}
 
       proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT, 1);
@@ -1790,7 +1790,7 @@ finish_command (char *arg, int from_tty)
       else
 	printf_filtered (_("Run till exit from "));
 
-      print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
+      print_stack_frame (get_selected_frame (NULL), 1, LOCATION, 0);
     }
 
   if (execution_direction == EXEC_REVERSE)
@@ -2334,7 +2334,7 @@ kill_command (char *arg, int from_tty)
       if (target_has_stack)
 	{
 	  printf_filtered (_("In %s,\n"), target_longname);
-	  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+	  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
 	}
     }
   bfd_cache_close_all ();
diff --git a/gdb/inferior.c b/gdb/inferior.c
index d5866e1..28a5200 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -739,7 +739,7 @@ inferior_command (char *args, int from_tty)
   else if (inf->pid != 0)
     {
       ui_out_text (current_uiout, "\n");
-      print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+      print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
     }
 }
 
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 57618ae..9e4323c 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -6102,7 +6102,7 @@ normal_stop (void)
 	     LOCATION: Print only location
 	     SRC_AND_LOC: Print location and source line.  */
 	  if (do_frame_printing)
-	    print_stack_frame (get_selected_frame (NULL), 0, source_flag);
+	    print_stack_frame (get_selected_frame (NULL), 0, source_flag, 1);
 
 	  /* Display the auto-display expressions.  */
 	  do_displays ();
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 4100cb1..3774a7f 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -731,7 +731,7 @@ linux_fork_context (struct fork_info *newfp, int from_tty)
   printf_filtered (_("Switching to %s\n"),
 		   target_pid_to_str (inferior_ptid));
 
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
 }
 
 /* Switch inferior process (checkpoint) context, by checkpoint id.  */
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 7bf9ab8..6101341 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -159,7 +159,7 @@ mi_cmd_stack_list_frames (char *command, char **argv, int argc)
 	  QUIT;
 	  /* Print the location and the address always, even for level 0.
 	     If args is 0, don't print the arguments.  */
-	  print_frame_info (fi, 1, LOC_AND_ADDRESS, 0 /* args */ );
+	  print_frame_info (fi, 1, LOC_AND_ADDRESS, 0 /* args */, 0);
 	}
     }
 
@@ -691,5 +691,5 @@ mi_cmd_stack_info_frame (char *command, char **argv, int argc)
   if (argc > 0)
     error (_("-stack-info-frame: No arguments allowed"));
 
-  print_frame_info (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 0);
+  print_frame_info (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 0, 1);
 }
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 038132f..80cc005 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -448,7 +448,7 @@ mi_on_normal_stop (struct bpstats *bs, int print_frame)
 	  get_last_target_status (&last_ptid, &last);
 	  bpstat_print (bs, last.kind);
 
-	  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
+	  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
 	  current_uiout = saved_uiout;
 	}
 
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index e6e98b6..e8c4744 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -194,7 +194,7 @@ mi_cmd_exec_return (char *command, char **argv, int argc)
 
   /* Because we have called return_command with from_tty = 0, we need
      to print the frame here.  */
-  print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS);
+  print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 1);
 }
 
 void
@@ -2484,7 +2484,7 @@ mi_cmd_trace_find (char *command, char **argv, int argc)
     error (_("Invalid mode '%s'"), mode);
 
   if (has_stack_frames () || get_traceframe_number () >= 0)
-    print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS);
+    print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 1);
 }
 
 void
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 1c4e68b..f9af408 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -2004,7 +2004,7 @@ record_full_goto_entry (struct record_full_entry *p)
 
   registers_changed ();
   reinit_frame_cache ();
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
 }
 
 /* The "to_goto_record_begin" target method.  */
@@ -2590,7 +2590,7 @@ record_full_restore (void)
   printf_filtered (_("Restored records from core file %s.\n"),
 		   bfd_get_filename (core_bfd));
 
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
 }
 
 /* bfdcore_write -- write bytes into a core file section.  */
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 081fbd0..bf6cce5 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -1661,7 +1661,7 @@ seen from the board via TFTP, specify that name as the third parameter.\n"));
   reinit_frame_cache ();
   registers_changed ();
   stop_pc = regcache_read_pc (get_current_regcache ());
-  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
   xfree (serial_port_name);
 
   do_cleanups (cleanup);
diff --git a/gdb/stack.c b/gdb/stack.c
index 16a03eb..cd4ac7a 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -154,7 +154,8 @@ frame_show_address (struct frame_info *frame,
 
 void
 print_stack_frame (struct frame_info *frame, int print_level,
-		   enum print_what print_what)
+		   enum print_what print_what,
+		   int set_current_sal)
 {
   volatile struct gdb_exception e;
 
@@ -166,8 +167,10 @@ print_stack_frame (struct frame_info *frame, int print_level,
     {
       int center = (print_what == SRC_LINE || print_what == SRC_AND_LOC);
 
-      print_frame_info (frame, print_level, print_what, 1 /* print_args */);
-      set_current_sal_from_frame (frame, center);
+      print_frame_info (frame, print_level, print_what, 1 /* print_args */,
+			set_current_sal);
+      if (set_current_sal)
+	set_current_sal_from_frame (frame, center);
     }
 }
 
@@ -780,7 +783,8 @@ do_gdb_disassembly (struct gdbarch *gdbarch,
 
 void
 print_frame_info (struct frame_info *frame, int print_level,
-		  enum print_what print_what, int print_args)
+		  enum print_what print_what, int print_args,
+		  int set_current_sal)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
   struct symtab_and_line sal;
@@ -905,7 +909,7 @@ print_frame_info (struct frame_info *frame, int print_level,
 	do_gdb_disassembly (get_frame_arch (frame), -1, sal.pc, sal.end);
     }
 
-  if (print_what != LOCATION)
+  if (set_current_sal)
     {
       CORE_ADDR pc;
 
@@ -1787,7 +1791,7 @@ backtrace_command_1 (char *count_exp, int show_locals, int no_filters,
 	     hand, perhaps the code does or could be fixed to make sure
 	     the frame->prev field gets set to NULL in that case).  */
 
-	  print_frame_info (fi, 1, LOCATION, 1);
+	  print_frame_info (fi, 1, LOCATION, 1, 0);
 	  if (show_locals)
 	    {
 	      struct frame_id frame_id = get_frame_id (fi);
@@ -2184,7 +2188,7 @@ select_and_print_frame (struct frame_info *frame)
 {
   select_frame (frame);
   if (frame)
-    print_stack_frame (frame, 1, SRC_AND_LOC);
+    print_stack_frame (frame, 1, SRC_AND_LOC, 1);
 }
 \f
 /* Return the symbol-block in which the selected frame is executing.
@@ -2262,7 +2266,7 @@ static void
 frame_command (char *level_exp, int from_tty)
 {
   select_frame_command (level_exp, from_tty);
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
 }
 
 /* The XDB Compatibility command to print the current frame.  */
@@ -2270,7 +2274,7 @@ frame_command (char *level_exp, int from_tty)
 static void
 current_frame_command (char *level_exp, int from_tty)
 {
-  print_stack_frame (get_selected_frame (_("No stack.")), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (_("No stack.")), 1, SRC_AND_LOC, 1);
 }
 
 /* Select the frame up one or COUNT_EXP stack levels from the
@@ -2301,7 +2305,7 @@ static void
 up_command (char *count_exp, int from_tty)
 {
   up_silently_base (count_exp);
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
 }
 
 /* Select the frame down one or COUNT_EXP stack levels from the previously
@@ -2340,7 +2344,7 @@ static void
 down_command (char *count_exp, int from_tty)
 {
   down_silently_base (count_exp);
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
 }
 \f
 
diff --git a/gdb/testsuite/gdb.threads/info-threads-cur-sal-2.c b/gdb/testsuite/gdb.threads/info-threads-cur-sal-2.c
new file mode 100644
index 0000000..2c29686
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/info-threads-cur-sal-2.c
@@ -0,0 +1,23 @@
+/* Copyright 2013 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <stddef.h>
+
+void *
+start (void *arg)
+{
+  /* "list" should show this line.  */
+  return NULL;
+}
diff --git a/gdb/testsuite/gdb.threads/info-threads-cur-sal.c b/gdb/testsuite/gdb.threads/info-threads-cur-sal.c
new file mode 100644
index 0000000..8a8c8b9
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/info-threads-cur-sal.c
@@ -0,0 +1,33 @@
+/* Copyright 2007-2013 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <pthread.h>
+#include <assert.h>
+#include <unistd.h>
+
+extern void *start (void *arg);
+
+int
+main (void)
+{
+  pthread_t thread;
+  int i;
+
+  i = pthread_create (&thread, NULL, start, NULL);
+  assert (i == 0);
+  pthread_join (thread, NULL);
+
+  return 0;
+}
diff --git a/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp b/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp
new file mode 100644
index 0000000..f18ae0c
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp
@@ -0,0 +1,57 @@
+# Copyright (C) 2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile info-threads-cur-sal.c info-threads-cur-sal-2.c
+
+set executable ${testfile}
+
+if {[gdb_compile_pthreads \
+	 "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile2}" \
+	 "${binfile}" executable {debug}] != "" } {
+    return -1
+}
+
+clean_restart ${executable}
+
+if ![runto_main] {
+    return -1
+}
+
+gdb_breakpoint "start"
+gdb_continue_to_breakpoint "start"
+
+set line [gdb_get_line_number "should show this line" "${srcfile2}"]
+
+gdb_test "list $line" \
+    "\"list\" should show this line.*" \
+    "list before info threads"
+
+# There used to be a bug where "info threads" would set the current
+# SAL to the location of the last thread displayed.
+gdb_test "info threads" \
+    "\r\n\[ \t\]*Id\[ \t\]+Target\[ \t\]+Id\[ \t\]+Frame\[ \t\]*\r\n\\* 2 *Thread \[^\r\n\]* at \[^\r\n\]*\r\n  1 *Thread \[^\r\n\]* .* \[^\r\n\]*" \
+    "info threads before break"
+
+# Check that "break" is still operating on the same file by default.
+gdb_test "break $line" ".*${srcfile2}.*" "break on line"
+
+gdb_test "info threads" \
+    "\r\n\[ \t\]*Id\[ \t\]+Target\[ \t\]+Id\[ \t\]+Frame\[ \t\]*\r\n\\* 2 *Thread \[^\r\n\]* at \[^\r\n\]*\r\n  1 *Thread \[^\r\n\]* .* \[^\r\n\]*" \
+    "info threads before list"
+
+# And that so is "list".
+gdb_test "list $line" \
+    "\"list\" should show this line.*" \
+    "list after info threads"
diff --git a/gdb/thread.c b/gdb/thread.c
index 52626ff..498e547 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -929,7 +929,7 @@ print_thread_info (struct ui_out *uiout, char *requested_threads, int pid)
 	  print_stack_frame (get_selected_frame (NULL),
 			     /* For MI output, print frame level.  */
 			     ui_out_is_mi_like_p (uiout),
-			     LOCATION);
+			     LOCATION, 0);
 	}
 
       if (ui_out_is_mi_like_p (uiout))
@@ -1082,7 +1082,7 @@ restore_selected_frame (struct frame_id a_frame_id, int frame_level)
       /* For MI, we should probably have a notification about
 	 current frame change.  But this error is not very
 	 likely, so don't bother for now.  */
-      print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+      print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
     }
 }
 
@@ -1467,7 +1467,7 @@ do_captured_thread_select (struct ui_out *uiout, void *tidstr)
   else
     {
       ui_out_text (uiout, "\n");
-      print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+      print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
     }
 
   /* Since the current thread may have changed, see if there is any
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 7dbe54b..c086587 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2444,7 +2444,7 @@ tfind_1 (enum trace_find_type type, int num,
       else
 	print_what = SRC_AND_LOC;
 
-      print_stack_frame (get_selected_frame (NULL), 1, print_what);
+      print_stack_frame (get_selected_frame (NULL), 1, print_what, 1);
       do_displays ();
     }
 }
-- 
1.7.11.7

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-09-17 18:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-30 15:50 [PATCH 0/3] Fix PR gdb/15911, cleanup print_stack_frame somewhat Pedro Alves
2013-08-30 15:50 ` [PATCH 3/3] cleanup print_frame_info Pedro Alves
2013-08-30 15:50 ` [PATCH 2/3] print_stack_frame&friends: merge print_level, print_args and print_what Pedro Alves
2013-09-06  8:46   ` Jan Kratochvil
2013-08-30 16:09 ` [PATCH 1/3] PR gdb/15911: "info threads" changes the default source and line (for "break", "list") Pedro Alves
2013-09-17 18:39   ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).