Use typedef for EMACS_INT, EMACS_UINT.
[bpt/emacs.git] / src / .gdbinit
index b60c14f..379a14b 100644 (file)
@@ -49,17 +49,26 @@ handle SIGALRM ignore
 # Using a constant runs into GDB bugs sometimes.
 define xgetptr
   set $bugfix = $arg0
 # Using a constant runs into GDB bugs sometimes.
 define xgetptr
   set $bugfix = $arg0
-  set $ptr = (gdb_use_union ? (gdb_use_lsb ? $bugfix.u.val << gdb_gctypebits : $bugfix.u.val) : $bugfix & $valmask) | gdb_data_seg_bits
+  if gdb_use_struct
+    set $bugfix = $bugfix.i
+  end
+  set $ptr = $bugfix & $valmask | gdb_data_seg_bits
 end
 
 define xgetint
   set $bugfix = $arg0
 end
 
 define xgetint
   set $bugfix = $arg0
-  set $int = gdb_use_union ? $bugfix.s.val : (gdb_use_lsb ? $bugfix : $bugfix << gdb_gctypebits) >> gdb_gctypebits
+  if gdb_use_struct
+    set $bugfix = $bugfix.i
+  end
+  set $int = gdb_use_lsb ? $bugfix >> (gdb_gctypebits - 1) : $bugfix << (gdb_gctypebits - 1) >> (gdb_gctypebits - 1)
 end
 
 define xgettype
   set $bugfix = $arg0
 end
 
 define xgettype
   set $bugfix = $arg0
-  set $type = gdb_use_union ? $bugfix.s.type : (enum Lisp_Type) (gdb_use_lsb ? $bugfix & $tagmask : $bugfix >> gdb_valbits)
+  if gdb_use_struct
+    set $bugfix = $bugfix.i
+  end
+  set $type = (enum Lisp_Type) (gdb_use_lsb ? $bugfix & $tagmask : $bugfix >> gdb_valbits)
 end
 
 # Set up something to print out s-expressions.
 end
 
 # Set up something to print out s-expressions.
@@ -67,10 +76,7 @@ end
 # from calling OutputDebugString, which causes GDB to display each
 # character twice (yuk!).
 define pr
 # 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
+  pp $
 end
 document pr
 Print the emacs s-expression which is $.
 end
 document pr
 Print the emacs s-expression which is $.
@@ -90,48 +96,17 @@ Print the argument as an emacs s-expression
 Works only when an inferior emacs is executing.
 end
 
 Works only when an inferior emacs is executing.
 end
 
-# Print out s-expressions from tool bar
-define pp1
-  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 pp1
-Print the argument as an emacs s-expression.
-Works only when an inferior emacs is executing.
-For use on tool bar when debugging in Emacs
-where the variable name would not otherwise
-be recorded in the GUD buffer.
-end
-
 # Print value of lisp variable
 define pv
 # 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.
-Works only when an inferior emacs is executing.
-end
-
-# Print value of lisp variable
-define pv1
   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
   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 pv1
+document pv
 Print the value of the lisp variable given as argument.
 Works only when an inferior emacs is executing.
 Print the value of the lisp variable given as argument.
 Works only when an inferior emacs is executing.
-For use when debugging in Emacs where the variable
-name would not otherwise be recorded in the GUD buffer.
 end
 
 # Print out current buffer point and boundaries
 end
 
 # Print out current buffer point and boundaries
@@ -288,8 +263,8 @@ define pitx
   while ($i < $it->sp && $i < 4)
     set $e = $it->stack[$i]
     printf "stack[%d]: ", $i
   while ($i < $it->sp && $i < 4)
     set $e = $it->stack[$i]
     printf "stack[%d]: ", $i
-    pitmethod $e->method
-    printf "[%d]", $e->position.charpos
+    pitmethod $e.method
+    printf "[%d]", $e.position.charpos
     printf "\n"
     set $i = $i + 1
   end
     printf "\n"
     set $i = $i + 1
   end
@@ -737,60 +712,6 @@ Print $ as a misc free-cell pointer.
 This command assumes that $ is an Emacs Lisp Misc value.
 end
 
 This command assumes that $ is an Emacs Lisp Misc value.
 end
 
-define xintfwd
-  xgetptr $
-  print (struct Lisp_Intfwd *) $ptr
-end
-document xintfwd
-Print $ as an integer forwarding pointer.
-This command assumes that $ is an Emacs Lisp Misc value.
-end
-
-define xboolfwd
-  xgetptr $
-  print (struct Lisp_Boolfwd *) $ptr
-end
-document xboolfwd
-Print $ as a boolean forwarding pointer.
-This command assumes that $ is an Emacs Lisp Misc value.
-end
-
-define xobjfwd
-  xgetptr $
-  print (struct Lisp_Objfwd *) $ptr
-end
-document xobjfwd
-Print $ as an object forwarding pointer.
-This command assumes that $ is an Emacs Lisp Misc value.
-end
-
-define xbufobjfwd
-  xgetptr $
-  print (struct Lisp_Buffer_Objfwd *) $ptr
-end
-document xbufobjfwd
-Print $ as a buffer-local object forwarding pointer.
-This command assumes that $ is an Emacs Lisp Misc value.
-end
-
-define xkbobjfwd
-  xgetptr $
-  print (struct Lisp_Kboard_Objfwd *) $ptr
-end
-document xkbobjfwd
-Print $ as a kboard-local object forwarding pointer.
-This command assumes that $ is an Emacs Lisp Misc value.
-end
-
-define xbuflocal
-  xgetptr $
-  print (struct Lisp_Buffer_Local_Value *) $ptr
-end
-document xbuflocal
-Print $ as a buffer-local-value pointer.
-This command assumes that $ is an Emacs Lisp Misc value.
-end
-
 define xsymbol
   set $sym = $
   xgetptr $sym
 define xsymbol
   set $sym = $
   xgetptr $sym
@@ -1037,7 +958,7 @@ end
 
 define xpr
   xtype
 
 define xpr
   xtype
-  if $type == Lisp_Int
+  if $type == Lisp_Int0 || $type == Lisp_Int1
     xint
   end
   if $type == Lisp_Symbol
     xint
   end
   if $type == Lisp_Symbol
@@ -1057,36 +978,12 @@ define xpr
     if $misc == Lisp_Misc_Free
       xmiscfree
     end
     if $misc == Lisp_Misc_Free
       xmiscfree
     end
-    if $misc == Lisp_Misc_Boolfwd
-      xboolfwd
-    end
     if $misc == Lisp_Misc_Marker
       xmarker
     end
     if $misc == Lisp_Misc_Marker
       xmarker
     end
-    if $misc == Lisp_Misc_Intfwd
-      xintfwd
-    end
-    if $misc == Lisp_Misc_Boolfwd
-      xboolfwd
-    end
-    if $misc == Lisp_Misc_Objfwd
-      xobjfwd
-    end
-    if $misc == Lisp_Misc_Buffer_Objfwd
-      xbufobjfwd
-    end
-    if $misc == Lisp_Misc_Buffer_Local_Value
-      xbuflocal
-    end
-#    if $misc == Lisp_Misc_Some_Buffer_Local_Value
-#      xvalue
-#    end
     if $misc == Lisp_Misc_Overlay
       xoverlay
     end
     if $misc == Lisp_Misc_Overlay
       xoverlay
     end
-    if $misc == Lisp_Misc_Kboard_Objfwd
-      xkbobjfwd
-    end
 #    if $misc == Lisp_Misc_Save_Value
 #      xsavevalue
 #    end
 #    if $misc == Lisp_Misc_Save_Value
 #      xsavevalue
 #    end
@@ -1292,8 +1189,8 @@ define hookpost-backtrace
 end
 
 define xreload
 end
 
 define xreload
-  set $tagmask = (((long)1 << gdb_gctypebits) - 1)
-  set $valmask = gdb_use_lsb ? ~($tagmask) : ((long)1 << gdb_valbits) - 1
+  set $tagmask = ((1 << gdb_gctypebits) - 1)
+  set $valmask = gdb_use_lsb ? ~($tagmask) : ((EMACS_INT) 1 << gdb_valbits) - 1
 end
 document xreload
   When starting Emacs a second time in the same gdb session under
 end
 document xreload
   When starting Emacs a second time in the same gdb session under