This is the mail archive of the gdb-patches@sources.redhat.com 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]

[PATCH] Delete stack.c redundant functions


All these functions are doing nothing useful. They were introduced
when the TUI was written, but were never deleted after Stephane Carrez
cleaned up their use in the tui.

I'll commit this in a couple of days.

Elena

gdb/ChangeLog
2003-01-12  Elena Zannoni  <ezannoni@redhat.com>

	* stack.c (print_frame_info, print_stack_frame_base_stub,
	print_stack_frame_base, show_and_print_stack_frame_stub,
	show_and_print_stack_frame, print_only_stack_frame_stub,
	print_only_stack_frame): Delete functions.
	(print_stack_frame_stub): Call print_frame_info instead of
	print_frame_info_base.
	(print_frame_info_base): Rename to print_frame_info.
	(backtrace_command_1): Call print_frame_info, instead of
	print_frame_info_base.
	(current_frame_command): Call print_stack_frame, instead of
	print_only_stack_frame.
	(frame_command): Call print_stack_frame, instead of
	show_and_print_stack_frame.
	(up_command): Ditto.
	(down_command): Ditto.
	* frame.h (print_only_stack_frame): Delete prototype.
	* infrun.c (normal_stop): Call print_stack_frame, instead of
	show_and_print_stack_frame.
	* thread.c (info_threads_command): Call print_stack_frame, instead
	of print_only_stack_frame.


mi/ChangeLog
2003-01-12  Elena Zannoni  <ezannoni@redhat.com>

	* mi-main.c (mi_cmd_exec_return): Use print_stack_frame instead of
	show_and_print_stack_frame.

Index: mi-main.c
===================================================================
RCS file: /cvs/uberbaum/gdb/mi/mi-main.c,v
retrieving revision 1.38
diff -u -p -r1.38 mi-main.c
--- mi-main.c	29 Nov 2002 19:15:16 -0000	1.38
+++ mi-main.c	12 Jan 2003 17:49:14 -0000
@@ -1,5 +1,5 @@
 /* MI Command Set.
-   Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
    Contributed by Cygnus Solutions (a Red Hat company).
 
    This file is part of GDB.
@@ -183,9 +183,9 @@ mi_cmd_exec_return (char *args, int from
 
   /* Because we have called return_command with from_tty = 0, we need
      to print the frame here. */
-  show_and_print_stack_frame (deprecated_selected_frame,
-			      frame_relative_level (deprecated_selected_frame),
-			      LOC_AND_ADDRESS);
+  print_stack_frame (deprecated_selected_frame,
+		     frame_relative_level (deprecated_selected_frame),
+		     LOC_AND_ADDRESS);
 
   return MI_CMD_DONE;
 }

Index: stack.c
===================================================================
RCS file: /cvs/uberbaum/gdb/stack.c,v
retrieving revision 1.59
diff -u -p -r1.59 stack.c
--- stack.c	17 Dec 2002 17:27:45 -0000	1.59
+++ stack.c	12 Jan 2003 17:43:57 -0000
@@ -1,7 +1,7 @@
 /* Print and select stack frames for GDB, the GNU debugger.
 
    Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
-   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software
+   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
    Foundation, Inc.
 
    This file is part of GDB.
@@ -98,10 +98,6 @@ static void print_frame (struct frame_in
 			 int args, 
 			 struct symtab_and_line sal);
 
-static void print_frame_info_base (struct frame_info *, int, int, int);
-
-static void print_stack_frame_base (struct frame_info *, int, int);
-
 static void backtrace_command (char *, int);
 
 struct frame_info *parse_frame_specification (char *);
@@ -127,21 +123,6 @@ struct print_stack_frame_args
     int args;
   };
 
-static int print_stack_frame_base_stub (char *);
-
-/* Show and print the frame arguments.
-   Pass the args the way catch_errors wants them.  */
-static int show_and_print_stack_frame_stub (void *args);
-static int
-show_and_print_stack_frame_stub (void *args)
-{
-  struct print_stack_frame_args *p = (struct print_stack_frame_args *) args;
-
-  print_frame_info (p->fi, p->level, p->source, p->args);
-
-  return 0;
-}
-
 /* Show or print the frame arguments.
    Pass the args the way catch_errors wants them.  */
 static int print_stack_frame_stub (void *args);
@@ -150,83 +131,10 @@ print_stack_frame_stub (void *args)
 {
   struct print_stack_frame_args *p = (struct print_stack_frame_args *) args;
 
-  print_frame_info_base (p->fi, p->level, p->source, p->args);
-  return 0;
-}
-
-/* Print a stack frame briefly.  FRAME_INFI should be the frame info
-   and LEVEL should be its level in the stack (or -1 for level not
-   defined). */
-
-/* Pass the args the way catch_errors wants them.  */
-static int
-print_stack_frame_base_stub (char *args)
-{
-  struct print_stack_frame_args *p = (struct print_stack_frame_args *) args;
-
-  print_frame_info_base (p->fi, p->level, p->source, p->args);
-  return 0;
-}
-
-/* print the frame arguments to the terminal.  
-   Pass the args the way catch_errors wants them.  */
-static int print_only_stack_frame_stub (void *);
-static int
-print_only_stack_frame_stub (void *args)
-{
-  struct print_stack_frame_args *p = (struct print_stack_frame_args *) args;
-
-  print_frame_info_base (p->fi, p->level, p->source, p->args);
+  print_frame_info (p->fi, p->level, p->source, p->args);
   return 0;
 }
 
-/* Print a stack frame briefly.  FRAME_INFI should be the frame info
-   and LEVEL should be its level in the stack (or -1 for level not defined).
-   This prints the level, the function executing, the arguments,
-   and the file name and line number.
-   If the pc is not at the beginning of the source line,
-   the actual pc is printed at the beginning.
-
-   If SOURCE is 1, print the source line as well.
-   If SOURCE is -1, print ONLY the source line.  */
-
-static void
-print_stack_frame_base (struct frame_info *fi, int level, int source)
-{
-  struct print_stack_frame_args args;
-
-  args.fi = fi;
-  args.level = level;
-  args.source = source;
-  args.args = 1;
-
-  catch_errors (print_stack_frame_stub, &args, "", RETURN_MASK_ALL);
-}
-
-/* Show and print a stack frame briefly.  FRAME_INFI should be the frame info
-   and LEVEL should be its level in the stack (or -1 for level not defined).
-   This prints the level, the function executing, the arguments,
-   and the file name and line number.
-   If the pc is not at the beginning of the source line,
-   the actual pc is printed at the beginning.
-
-   If SOURCE is 1, print the source line as well.
-   If SOURCE is -1, print ONLY the source line.  */
-
-void
-show_and_print_stack_frame (struct frame_info *fi, int level, int source)
-{
-  struct print_stack_frame_args args;
-
-  args.fi = fi;
-  args.level = level;
-  args.source = source;
-  args.args = 1;
-
-  catch_errors (show_and_print_stack_frame_stub, &args, "", RETURN_MASK_ALL);
-}
-
-
 /* Show or print a stack frame briefly.  FRAME_INFI should be the frame info
    and LEVEL should be its level in the stack (or -1 for level not defined).
    This prints the level, the function executing, the arguments,
@@ -248,30 +156,7 @@ print_stack_frame (struct frame_info *fi
   args.args = 1;
 
   catch_errors (print_stack_frame_stub, (char *) &args, "", RETURN_MASK_ALL);
-}
-
-/* Print a stack frame briefly.  FRAME_INFI should be the frame info
-   and LEVEL should be its level in the stack (or -1 for level not defined).
-   This prints the level, the function executing, the arguments,
-   and the file name and line number.
-   If the pc is not at the beginning of the source line,
-   the actual pc is printed at the beginning.
-
-   If SOURCE is 1, print the source line as well.
-   If SOURCE is -1, print ONLY the source line.  */
-
-void
-print_only_stack_frame (struct frame_info *fi, int level, int source)
-{
-  struct print_stack_frame_args args;
-
-  args.fi = fi;
-  args.level = level;
-  args.source = source;
-  args.args = 1;
-
-  catch_errors (print_only_stack_frame_stub, &args, "", RETURN_MASK_ALL);
-}
+}  
 
 struct print_args_args
 {
@@ -305,8 +190,8 @@ print_args_stub (PTR args)
    LOCATION: Print only location 
    LOC_AND_SRC: Print location and source line.  */
 
-static void
-print_frame_info_base (struct frame_info *fi, int level, int source, int args)
+void
+print_frame_info (struct frame_info *fi, int level, int source, int args)
 {
   struct symtab_and_line sal;
   int source_print;
@@ -581,16 +466,6 @@ print_frame (struct frame_info *fi, 
   do_cleanups (old_chain);
 }
 
-
-/* Show or print the frame info.  If this is the tui, it will be shown in 
-   the source display */
-void
-print_frame_info (struct frame_info *fi, register int level, int source,
-		  int args)
-{
-  print_frame_info_base (fi, level, source, args);
-}
-
 /* Show the frame info.  If this is the tui, it will be shown in 
    the source display otherwise, nothing is done */
 void
@@ -1098,7 +973,7 @@ backtrace_command_1 (char *count_exp, in
          means further attempts to backtrace would fail (on the other
          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_base (fi, trailing_level + i, 0, 1);
+      print_frame_info (fi, trailing_level + i, 0, 1);
       if (show_locals)
 	print_frame_local_vars (fi, 1, gdb_stdout);
     }
@@ -1598,8 +1473,8 @@ void
 frame_command (char *level_exp, int from_tty)
 {
   select_frame_command (level_exp, from_tty);
-  show_and_print_stack_frame (deprecated_selected_frame,
-			      frame_relative_level (deprecated_selected_frame), 1);
+  print_stack_frame (deprecated_selected_frame,
+		     frame_relative_level (deprecated_selected_frame), 1);
 }
 
 /* The XDB Compatibility command to print the current frame. */
@@ -1609,7 +1484,7 @@ current_frame_command (char *level_exp, 
 {
   if (target_has_stack == 0 || deprecated_selected_frame == 0)
     error ("No stack.");
-  print_only_stack_frame (deprecated_selected_frame,
+  print_stack_frame (deprecated_selected_frame,
 			  frame_relative_level (deprecated_selected_frame), 1);
 }
 
@@ -1646,8 +1521,8 @@ static void
 up_command (char *count_exp, int from_tty)
 {
   up_silently_base (count_exp);
-  show_and_print_stack_frame (deprecated_selected_frame,
-			      frame_relative_level (deprecated_selected_frame), 1);
+  print_stack_frame (deprecated_selected_frame,
+		     frame_relative_level (deprecated_selected_frame), 1);
 }
 
 /* Select the frame down one or COUNT stack levels
@@ -1693,8 +1568,8 @@ static void
 down_command (char *count_exp, int from_tty)
 {
   down_silently_base (count_exp);
-  show_and_print_stack_frame (deprecated_selected_frame,
-			      frame_relative_level (deprecated_selected_frame), 1);
+  print_stack_frame (deprecated_selected_frame,
+		     frame_relative_level (deprecated_selected_frame), 1);
 }
 
 void

Index: frame.h
===================================================================
RCS file: /cvs/uberbaum/gdb/frame.h,v
retrieving revision 1.59
diff -u -p -r1.59 frame.h
--- frame.h	9 Jan 2003 18:53:21 -0000	1.59
+++ frame.h	12 Jan 2003 17:44:56 -0000
@@ -546,8 +546,6 @@ extern void show_and_print_stack_frame (
 
 extern void print_stack_frame (struct frame_info *, int, int);
 
-extern void print_only_stack_frame (struct frame_info *, int, int);
-
 extern void show_stack_frame (struct frame_info *);
 
 extern void print_frame_info (struct frame_info *, int, int, int);

Index: infrun.c
===================================================================
RCS file: /cvs/uberbaum/gdb/infrun.c,v
retrieving revision 1.93
diff -u -p -r1.93 infrun.c
--- infrun.c	9 Jan 2003 18:03:36 -0000	1.93
+++ infrun.c	12 Jan 2003 17:47:53 -0000
@@ -2,7 +2,7 @@
    process.
 
    Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
-   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software
+   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
    Foundation, Inc.
 
    This file is part of GDB.
@@ -3093,7 +3093,7 @@ normal_stop (void)
 	     LOCATION: Print only location
 	     SRC_AND_LOC: Print location and source line */
 	  if (do_frame_printing)
-	    show_and_print_stack_frame (deprecated_selected_frame, -1, source_flag);
+	    print_stack_frame (deprecated_selected_frame, -1, source_flag);
 
 	  /* Display the auto-display expressions.  */
 	  do_displays ();

Index: thread.c
===================================================================
RCS file: /cvs/uberbaum/gdb/thread.c,v
retrieving revision 1.26
diff -u -p -r1.26 thread.c
--- thread.c	20 Dec 2002 03:37:33 -0000	1.26
+++ thread.c	12 Jan 2003 17:47:03 -0000
@@ -1,7 +1,7 @@
 /* Multi-process/thread control for GDB, the GNU debugger.
 
    Copyright 1986, 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    Contributed by Lynx Real-Time Systems, Inc.  Los Gatos, CA.
 
@@ -457,7 +457,7 @@ info_threads_command (char *arg, int fro
 
       switch_to_thread (tp->ptid);
       if (deprecated_selected_frame)
-	print_only_stack_frame (deprecated_selected_frame, -1, 0);
+	print_stack_frame (deprecated_selected_frame, -1, 0);
       else
 	printf_filtered ("[No stack.]\n");
     }


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