]> code.delx.au - gnu-emacs/blobdiff - src/.gdbinit
(get_scrap_target_type_list, defer_apple_events)
[gnu-emacs] / src / .gdbinit
index 5ddd47deeea85b88a6caf846760edaae5f51118a..12a9d01402663af6d879ad244d0f11e491dfe8f4 100644 (file)
@@ -1,5 +1,5 @@
-# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998, 2000, 01, 2004, 2005
-#   Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
+#   2004, 2005, 2006 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
@@ -29,7 +29,7 @@ dir ../lwlib
 # This has one unfortunate effect: you can't type C-c
 # at the GDB to stop Emacs, when using X.
 # However, C-z works just as well in that case.
-#handle 2 noprint pass
+handle 2 noprint pass
 
 # Make it work like SIGINT normally does.
 handle SIGTSTP nopass
@@ -58,8 +58,14 @@ define xgettype
 end
 
 # Set up something to print out s-expressions.
+# We save and restore print_output_debug_flag to prevent the w32 port
+# from calling OutputDebugString, which causes GDB to display each
+# character twice (yuk!).
 define pr
+  set $output_debug = print_output_debug_flag
+  set print_output_debug_flag = 0
   set debug_print ($)
+  set print_output_debug_flag = $output_debug
 end
 document pr
 Print the emacs s-expression which is $.
@@ -69,7 +75,10 @@ end
 # Print out s-expressions
 define pp
   set $tmp = $arg0
+  set $output_debug = print_output_debug_flag
+  set print_output_debug_flag = 0
   set safe_debug_print ($tmp)
+  set print_output_debug_flag = $output_debug
 end
 document pp
 Print the argument as an emacs s-expression
@@ -81,7 +90,10 @@ define pp1
   set $tmp = $arg0
   echo $arg0
   printf " = "
+  set $output_debug = print_output_debug_flag
+  set print_output_debug_flag = 0
   set safe_debug_print ($tmp)
+  set print_output_debug_flag = $output_debug
 end
 document pp1
 Print the argument as an emacs s-expression
@@ -94,7 +106,10 @@ end
 # Print value of lisp variable
 define pv
   set $tmp = "$arg0"
+  set $output_debug = print_output_debug_flag
+  set print_output_debug_flag = 0
   set safe_debug_print ( find_symbol_value (intern ($tmp)))
+  set print_output_debug_flag = $output_debug
 end
 document pv
 Print the value of the lisp variable given as argument.
@@ -106,7 +121,10 @@ define pv1
   set $tmp = "$arg0"
   echo $arg0
   printf " = "
+  set $output_debug = print_output_debug_flag
+  set print_output_debug_flag = 0
   set safe_debug_print (find_symbol_value (intern ($tmp)))
+  set print_output_debug_flag = $output_debug
 end
 document pv1
 Print the value of the lisp variable given as argument.
@@ -548,7 +566,16 @@ end
 define xwindow
   xgetptr $
   print (struct window *) $ptr
-  printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top
+  set $window = (struct window *) $ptr
+  xgetint $window->total_cols
+  set $width=$int
+  xgetint $window->total_lines
+  set $height=$int
+  xgetint $window->left_col
+  set $left=$int
+  xgetint $window->top_line
+  set $top=$int
+  printf "%dx%d+%d+%d\n", $width, $height, $left, $top
 end
 document xwindow
 Print $ as a window pointer, assuming it is an Emacs Lisp window value.
@@ -762,15 +789,45 @@ set print sevenbit-strings
 
 show environment DISPLAY
 show environment TERM
-#set args -geometry 80x40+0+0
-
-# Don't let abort actually run, as it will make
-# stdio stop working and therefore the `pr' command above as well.
-break abort
-
-# If we are running in synchronous mode, we want a chance to look around
-# before Emacs exits.  Perhaps we should put the break somewhere else
-# instead...
-break x_error_quitter
-
+set args -geometry 80x40+0+0
+
+# People get bothered when they see messages about non-existent functions...
+xgetptr Vsystem_type
+# $ptr is NULL in temacs
+if ($ptr != 0)
+  set $tem = (struct Lisp_Symbol *) $ptr
+  xgetptr $tem->xname
+  set $tem = (struct Lisp_String *) $ptr
+  set $tem = (char *) $tem->data
+
+  # Don't let abort actually run, as it will make stdio stop working and
+  # therefore the `pr' command above as well.
+  if $tem[0] == 'w' && $tem[1] == 'i' && $tem[2] == 'n' && $tem[3] == 'd'
+    # The windows-nt build replaces abort with its own function.
+    break w32_abort
+  else
+    break abort
+  end
+end
+
+# x_error_quitter is defined only on X.  But window-system is set up
+# only at run time, during Emacs startup, so we need to defer setting
+# the breakpoint.  init_sys_modes is the first function called on
+# every platform after init_display, where window-system is set.
+tbreak init_sys_modes
+commands
+  silent
+  xgetptr Vwindow_system
+  set $tem = (struct Lisp_Symbol *) $ptr
+  xgetptr $tem->xname
+  set $tem = (struct Lisp_String *) $ptr
+  set $tem = (char *) $tem->data
+  # If we are running in synchronous mode, we want a chance to look
+  # around before Emacs exits.  Perhaps we should put the break
+  # somewhere else instead...
+  if $tem[0] == 'x' && $tem[1] == '\0'
+    break x_error_quitter
+  end
+  continue
+end
 # arch-tag: 12f34321-7bfa-4240-b77a-3cd3a1696dfe