This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Change backtrace_command_1 calling to use flags


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1cf7e64086d1490649dc56e1c0505be91c600218

commit 1cf7e64086d1490649dc56e1c0505be91c600218
Author: Tom Tromey <tom@tromey.com>
Date:   Sun Apr 23 11:02:52 2017 -0600

    Change backtrace_command_1 calling to use flags
    
    The next patch will add more flags to backtrace_command_1; and rather
    than add another boolean argument, this patch changes it to accept a
    flags value.
    
    gdb/ChangeLog
    2018-03-26  Tom Tromey  <tom@tromey.com>
    
    	* stack.c (backtrace_command_1): Remove "show_locals" parameter,
    	add "flags".
    	(backtrace_command): Remove "fulltrace", add "flags".

Diff:
---
 gdb/ChangeLog |  6 ++++++
 gdb/stack.c   | 17 +++++++----------
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 532826c..ed1d9dd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
 2018-03-26  Tom Tromey  <tom@tromey.com>
 
+	* stack.c (backtrace_command_1): Remove "show_locals" parameter,
+	add "flags".
+	(backtrace_command): Remove "fulltrace", add "flags".
+
+2018-03-26  Tom Tromey  <tom@tromey.com>
+
 	* stack.c (backtrace_command): Rewrite command line parsing.
 
 2018-03-26  Simon Marchi  <simon.marchi@ericsson.com>
diff --git a/gdb/stack.c b/gdb/stack.c
index 13af659..76695ff 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1692,8 +1692,8 @@ info_frame_command (const char *addr_exp, int from_tty)
    frames.  */
 
 static void
-backtrace_command_1 (const char *count_exp, int show_locals, int no_filters,
-		     int from_tty)
+backtrace_command_1 (const char *count_exp, frame_filter_flags flags,
+		     int no_filters, int from_tty)
 {
   struct frame_info *fi;
   int count;
@@ -1775,11 +1775,9 @@ backtrace_command_1 (const char *count_exp, int show_locals, int no_filters,
 
   if (! no_filters)
     {
-      frame_filter_flags flags = PRINT_LEVEL | PRINT_FRAME_INFO | PRINT_ARGS;
       enum ext_lang_frame_args arg_type;
 
-      if (show_locals)
-	flags |= PRINT_LOCALS;
+      flags |= PRINT_LEVEL | PRINT_FRAME_INFO | PRINT_ARGS;
       if (from_tty)
 	flags |= PRINT_MORE_FRAMES;
 
@@ -1809,7 +1807,7 @@ backtrace_command_1 (const char *count_exp, int show_locals, int no_filters,
 	     the frame->prev field gets set to NULL in that case).  */
 
 	  print_frame_info (fi, 1, LOCATION, 1, 0);
-	  if (show_locals)
+	  if ((flags & PRINT_LOCALS) != 0)
 	    {
 	      struct frame_id frame_id = get_frame_id (fi);
 
@@ -1850,8 +1848,8 @@ backtrace_command_1 (const char *count_exp, int show_locals, int no_filters,
 static void
 backtrace_command (const char *arg, int from_tty)
 {
-  bool fulltrace = false;
   bool filters = true;
+  frame_filter_flags flags = 0;
 
   if (arg)
     {
@@ -1868,7 +1866,7 @@ backtrace_command (const char *arg, int from_tty)
 	  if (subset_compare (this_arg.c_str (), "no-filters"))
 	    filters = false;
 	  else if (subset_compare (this_arg.c_str (), "full"))
-	    fulltrace = true;
+	    flags |= PRINT_LOCALS;
 	  else
 	    {
 	      /* Not a recognized argument, so stop.  */
@@ -1881,8 +1879,7 @@ backtrace_command (const char *arg, int from_tty)
 	arg = NULL;
     }
 
-  backtrace_command_1 (arg, fulltrace /* show_locals */,
-		       !filters /* no frame-filters */, from_tty);
+  backtrace_command_1 (arg, flags, !filters /* no frame-filters */, from_tty);
 }
 
 /* Iterate over the local variables of a block B, calling CB with


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]