This is the mail archive of the gdb-patches@sourceware.cygnus.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]

Patches from gdb-guile (probably obsoleted by libGDB)


Hello,

here are some gdb patches from my guile interface of gdb - some of them
are probably obsoleted by libGDB. However, feel free to include them in
gdb if you want to.

Maybe some of the added annotations and hooks are also useful despite of
libGDB.

Any comments are welcome,
Martin

====[ChangeLog]======
1999-07-12  Martin Baulig  <martin@home-of-linux.org>

	* annotate.h (annotate_frames_invalid_hook): New hook.
	(annotate_frame_source_hook): New hook.

	* annotate.c (annotate_frame_source): New function.

	* stack.c (print_frame_info_base): Call `annotate_frame_source'
	after `annotate_frame_source_begin'.

1999-07-05  Martin Baulig  <martin@home-of-linux.org>

	* annotate.h (annotate_source_hook): New hook.
	(annotate_breakpoint_hook): New hook.
	(annotate_catchpoint_hook): New hook.
	(annotate_watchpoint_hook): New hook.
	(annotate_frame_begin_hook): New hook.
	(annotate_function_call_hook): New hook.
 	(annotate_signal_handler_caller_hook): New hook.
 	(annotate_frame_function_name_hook): New hook.
	(annotate_frame_end_hook): New hook.

	* annotate.c (annotate_frame_function_name): Changed this
 	function to take a `char *' parameter which is the function
	name and a `enum language' parameter.

	* defs.h (quit_confirm_hook): New hook.

	* top.c (quit_confirm): Use the new `quit_confirm_hook'.

	* stack.c (print_frame_info_base): Reflect
	`annotate_frame_function_name' change.

1999-06-29  Martin Baulig  <martin@home-of-linux.org>

	* defs.h (error_hook): Make this accept a `const char *' and
	a `va_list' argument so it is now the same like `warn_hook' etc.

	* utils.c (error): Pass `string' and `args' to the `error_hook'.

======

The patches (cvs diff against gdb-1999-08-30):

======
Index: annotate.c
===================================================================
RCS file: /cvs/gnome/gdb-guile/gdb/annotate.c,v
retrieving revision 1.1.1.2
retrieving revision 1.4
diff -u -u -r1.1.1.2 -r1.4
--- annotate.c	1999/09/05 14:17:31	1.1.1.2
+++ annotate.c	1999/09/05 16:50:32	1.4
@@ -40,6 +40,20 @@
 void (*annotate_signal_hook) PARAMS ((void));
 void (*annotate_exited_hook) PARAMS ((void));
 
+void (*annotate_source_hook) PARAMS ((char *, int, int, int, CORE_ADDR));
+void (*annotate_breakpoint_hook) PARAMS ((int));
+void (*annotate_catchpoint_hook) PARAMS ((int));
+void (*annotate_watchpoint_hook) PARAMS ((int));
+
+void (*annotate_frames_invalid_hook) PARAMS ((void));
+
+void (*annotate_frame_begin_hook) PARAMS ((int, CORE_ADDR));
+void (*annotate_frame_source_hook) PARAMS ((char *, int, int));
+void (*annotate_function_call_hook) PARAMS ((void));
+void (*annotate_signal_handler_caller_hook) PARAMS ((void));
+void (*annotate_frame_function_name_hook) PARAMS ((char *, enum language));
+void (*annotate_frame_end_hook) PARAMS ((void));
+
 static void
 print_value_flags (t)
      struct type *t;
@@ -64,24 +78,39 @@
 annotate_breakpoint (num)
      int num;
 {
-  if (annotation_level > 1)
-    printf_filtered ("\n\032\032breakpoint %d\n", num);
+  if (annotate_breakpoint_hook)
+    annotate_breakpoint_hook (num);
+  else
+    {
+      if (annotation_level > 1)
+	printf_filtered ("\n\032\032breakpoint %d\n", num);
+    }
 }
 
 void
 annotate_catchpoint (num)
      int num;
 {
-  if (annotation_level > 1)
-    printf_filtered ("\n\032\032catchpoint %d\n", num);
+  if (annotate_catchpoint_hook)
+    annotate_catchpoint_hook (num);
+  else
+    {
+      if (annotation_level > 1)
+	printf_filtered ("\n\032\032catchpoint %d\n", num);
+    }
 }
 
 void
 annotate_watchpoint (num)
      int num;
 {
-  if (annotation_level > 1)
-    printf_filtered ("\n\032\032watchpoint %d\n", num);
+  if (annotate_watchpoint_hook)
+    annotate_watchpoint_hook (num);
+  else
+    {
+      if (annotation_level > 1)
+	printf_filtered ("\n\032\032watchpoint %d\n", num);
+    }
 }
 
 void
@@ -211,10 +240,15 @@
 void
 annotate_frames_invalid ()
 {
-  if (annotation_level > 1)
+  if (annotate_frames_invalid_hook)
+    annotate_frames_invalid_hook ();
+  else
     {
-      target_terminal_ours ();
-      printf_unfiltered ("\n\032\032frames-invalid\n");
+      if (annotation_level > 1)
+	{
+	  target_terminal_ours ();
+	  printf_unfiltered ("\n\032\032frames-invalid\n");
+	}
     }
 }
 
@@ -408,16 +442,21 @@
      int mid;
      CORE_ADDR pc;
 {
-  if (annotation_level > 1)
-    printf_filtered ("\n\032\032source ");
+  if (annotate_source_hook)
+    annotate_source_hook (filename, line, character, mid, pc);
   else
-    printf_filtered ("\032\032");
-
-  printf_filtered ("%s:%d:%d:%s:0x", filename,
-		   line, character,
-		   mid ? "middle" : "beg");
-  print_address_numeric (pc, 0, gdb_stdout);
-  printf_filtered ("\n");
+    {
+      if (annotation_level > 1)
+	printf_filtered ("\n\032\032source ");
+      else
+	printf_filtered ("\032\032");
+
+      printf_filtered ("%s:%d:%d:%s:0x", filename,
+		       line, character,
+		       mid ? "middle" : "beg");
+      print_address_numeric (pc, 0, gdb_stdout);
+      printf_filtered ("\n");
+    }
 }
 
 void
@@ -425,26 +464,41 @@
      int level;
      CORE_ADDR pc;
 {
-  if (annotation_level > 1)
+  if (annotate_frame_begin_hook)
+    annotate_frame_begin_hook (level, pc);
+  else
     {
-      printf_filtered ("\n\032\032frame-begin %d 0x", level);
-      print_address_numeric (pc, 0, gdb_stdout);
-      printf_filtered ("\n");
+      if (annotation_level > 1)
+	{
+	  printf_filtered ("\n\032\032frame-begin %d 0x", level);
+	  print_address_numeric (pc, 0, gdb_stdout);
+	  printf_filtered ("\n");
+	}
     }
 }
 
 void
 annotate_function_call ()
 {
-  if (annotation_level > 1)
-    printf_filtered ("\n\032\032function-call\n");
+  if (annotate_function_call_hook)
+    annotate_function_call_hook ();
+  else
+    {
+      if (annotation_level > 1)
+	printf_filtered ("\n\032\032function-call\n");
+    }
 }
 
 void
 annotate_signal_handler_caller ()
 {
-  if (annotation_level > 1)
-    printf_filtered ("\n\032\032signal-handler-caller\n");
+  if (annotate_signal_handler_caller_hook)
+    annotate_signal_handler_caller_hook ();
+  else
+    {
+      if (annotation_level > 1)
+	printf_filtered ("\n\032\032signal-handler-caller\n");
+    }
 }
 
 void
@@ -462,10 +516,17 @@
 }
 
 void
-annotate_frame_function_name ()
+annotate_frame_function_name (funname, funlang)
+     char *funname;
+     enum language funlang;
 {
-  if (annotation_level > 1)
-    printf_filtered ("\n\032\032frame-function-name\n");
+  if (annotate_frame_function_name_hook)
+    annotate_frame_function_name_hook (funname, funlang);
+  else
+    {
+      if (annotation_level > 1)
+	printf_filtered ("\n\032\032frame-function-name\n");
+    }
 }
 
 void
@@ -476,6 +537,15 @@
 }
 
 void
+annotate_frame_source (file, line, mid)
+     char *file;
+     int line, mid;
+{
+  if (annotate_frame_source_hook)
+    annotate_frame_source_hook (file, line, mid);
+}
+
+void
 annotate_frame_source_begin ()
 {
   if (annotation_level > 1)
@@ -520,8 +590,13 @@
 void
 annotate_frame_end ()
 {
-  if (annotation_level > 1)
-    printf_filtered ("\n\032\032frame-end\n");
+  if (annotate_frame_end_hook)
+    annotate_frame_end_hook ();
+  else
+    {
+      if (annotation_level > 1)
+	printf_filtered ("\n\032\032frame-end\n");
+    }
 }
 
 void
Index: annotate.h
===================================================================
RCS file: /cvs/gnome/gdb-guile/gdb/annotate.h,v
retrieving revision 1.1.1.2
retrieving revision 1.4
diff -u -u -r1.1.1.2 -r1.4
--- annotate.h	1999/09/05 14:17:31	1.1.1.2
+++ annotate.h	1999/09/05 16:50:32	1.4
@@ -81,8 +81,9 @@
 extern void annotate_signal_handler_caller PARAMS ((void));
 extern void annotate_frame_address PARAMS ((void));
 extern void annotate_frame_address_end PARAMS ((void));
-extern void annotate_frame_function_name PARAMS ((void));
+extern void annotate_frame_function_name PARAMS ((char *, enum language));
 extern void annotate_frame_args PARAMS ((void));
+extern void annotate_frame_source PARAMS ((char *, int, int));
 extern void annotate_frame_source_begin PARAMS ((void));
 extern void annotate_frame_source_file PARAMS ((void));
 extern void annotate_frame_source_file_end PARAMS ((void));
@@ -102,3 +103,17 @@
 extern void (*annotate_signalled_hook) PARAMS ((void));
 extern void (*annotate_signal_hook) PARAMS ((void));
 extern void (*annotate_exited_hook) PARAMS ((void));
+
+extern void (*annotate_source_hook) PARAMS ((char *, int, int, int, CORE_ADDR));
+extern void (*annotate_breakpoint_hook) PARAMS ((int));
+extern void (*annotate_catchpoint_hook) PARAMS ((int));
+extern void (*annotate_watchpoint_hook) PARAMS ((int));
+
+extern void (*annotate_frames_invalid_hook) PARAMS ((void));
+
+extern void (*annotate_frame_begin_hook) PARAMS ((int, CORE_ADDR));
+extern void (*annotate_frame_source_hook) PARAMS ((char *, int, int));
+extern void (*annotate_function_call_hook) PARAMS ((void));
+extern void (*annotate_signal_handler_caller_hook) PARAMS ((void));
+extern void (*annotate_frame_function_name_hook) PARAMS ((char *, enum language));
+extern void (*annotate_frame_end_hook) PARAMS ((void));
Index: defs.h
===================================================================
RCS file: /cvs/gnome/gdb-guile/gdb/defs.h,v
retrieving revision 1.1.1.2
retrieving revision 1.5
diff -u -u -r1.1.1.2 -r1.5
--- defs.h	1999/09/05 14:18:26	1.1.1.2
+++ defs.h	1999/09/05 16:49:05	1.5
@@ -1176,7 +1176,7 @@
 
 extern void (*set_hook) PARAMS ((struct cmd_list_element *c));
 
-extern NORETURN void (*error_hook) PARAMS ((void)) ATTR_NORETURN;
+extern NORETURN void (*error_hook) PARAMS ((const char *, va_list)) ATTR_NORETURN;
 
 extern void (*error_begin_hook) PARAMS ((void));
 
Index: stack.c
===================================================================
RCS file: /cvs/gnome/gdb-guile/gdb/stack.c,v
retrieving revision 1.1.1.2
retrieving revision 1.4
diff -u -u -r1.1.1.2 -r1.4
--- stack.c	1999/09/05 14:22:30	1.1.1.2
+++ stack.c	1999/09/05 16:58:06	1.4
@@ -498,7 +498,7 @@
 	    annotate_frame_address_end ();
 	    printf_filtered (" in ");
 	  }
-      annotate_frame_function_name ();
+      annotate_frame_function_name (funname, funlang);
       fprintf_symbol_filtered (gdb_stdout, funname ? funname : "??", funlang,
 			       DMGL_ANSI);
       wrap_here ("   ");
@@ -517,7 +517,9 @@
       if (sal.symtab && sal.symtab->filename)
 	{
 	  annotate_frame_source_begin ();
-	  wrap_here ("   ");
+	  annotate_frame_source (sal.symtab->filename, sal.line,
+				 fi->pc != sal.pc);
+          wrap_here ("   ");
 	  printf_filtered (" at ");
 	  annotate_frame_source_file ();
 	  printf_filtered ("%s", sal.symtab->filename);
Index: top.c
===================================================================
RCS file: /cvs/gnome/gdb-guile/gdb/top.c,v
retrieving revision 1.1.1.2
retrieving revision 1.5
diff -u -u -r1.1.1.2 -r1.5
--- top.c	1999/09/05 14:22:57	1.1.1.2
+++ top.c	1999/09/05 16:58:06	1.5
@@ -468,8 +468,8 @@
 /* Takes control from error ().  Typically used to prevent longjmps out of the
    middle of the GUI.  Usually used in conjunction with a catch routine.  */
 
-NORETURN void (*error_hook)
-PARAMS ((void)) ATTR_NORETURN;
+NORETURN void (*error_hook) PARAMS ((const char *, va_list)) ATTR_NORETURN;
+
 
 
 /* Where to go for return_to_top_level (RETURN_ERROR).  */
@@ -3237,6 +3241,8 @@
 /* If necessary, make the user confirm that we should quit.  Return
    non-zero if we should quit, zero if we shouldn't.  */
 
+int (*quit_confirm_hook) PARAMS ((void));
+
 int
 quit_confirm ()
 {
@@ -3244,6 +3250,9 @@
     {
       char *s;
 
+      if (quit_confirm_hook)
+	return quit_confirm_hook ();
+
       /* This is something of a hack.  But there's no reliable way to
          see if a GUI is running.  The `use_windows' variable doesn't
          cut it.  */
@@ -3316,8 +3325,12 @@
      char *args;
      int from_tty;
 {
-  if (!quit_confirm ())
-    error ("Not confirmed.");
+  if (! quit_confirm ())
+    {
+      if (! quit_confirm_hook)
+	error ("Not confirmed.");
+      return;
+    }
   quit_force (args, from_tty);
 }
 
Index: utils.c
===================================================================
RCS file: /cvs/gnome/gdb-guile/gdb/utils.c,v
retrieving revision 1.1.1.2
retrieving revision 1.3
diff -u -u -r1.1.1.2 -r1.3
--- utils.c	1999/09/05 14:23:04	1.1.1.2
+++ utils.c	1999/09/05 16:58:06	1.3
@@ -469,8 +469,8 @@
   va_list args;
   va_start (args, string);
   if (error_hook)
-    (*error_hook) ();
-  else
+    (*error_hook) (string, args);
+  else 
     {
       error_begin ();
       vfprintf_filtered (gdb_stderr, string, args);

======

-- 
Martin Baulig - martin@home-of-linux.org - http://www.home-of-linux.org

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