]> git.eshelyaron.com Git - emacs.git/commitdiff
Don’t assume -g3 in .gdbinit
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 28 Aug 2017 15:38:05 +0000 (08:38 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 28 Aug 2017 15:38:29 +0000 (08:38 -0700)
* src/.gdbinit (EMACS_INT_WIDTH, USE_LSB_TAG):
Use reasonable defaults if not in the symbol table.

src/.gdbinit

index b5a974bb38d67d94c8d44bb38a045225421be7b8..21cdca5b2c0c019a5dd437d9630bb0bdba5093fb 100644 (file)
@@ -1303,8 +1303,21 @@ if hasattr(gdb, 'printing'):
 
       # This implementation should work regardless of C compiler, and
       # it should not attempt to run any code in the inferior.
-      EMACS_INT_WIDTH = int(gdb.lookup_symbol("EMACS_INT_WIDTH")[0].value())
-      USE_LSB_TAG = int(gdb.lookup_symbol("USE_LSB_TAG")[0].value())
+
+      # If the macros EMACS_INT_WIDTH and USE_LSB_TAG are not in the
+      # symbol table, guess reasonable defaults.
+      sym = gdb.lookup_symbol ("EMACS_INT_WIDTH")[0]
+      if sym:
+        EMACS_INT_WIDTH = int (sym.value ())
+      else:
+        sym = gdb.lookup_symbol ("EMACS_INT")[0]
+        EMACS_INT_WIDTH = 8 * sym.type.sizeof
+      sym = gdb.lookup_symbol ("USE_LSB_TAG")[0]
+      if sym:
+        USE_LSB_TAG = int (sym.value ())
+      else:
+        USE_LSB_TAG = 1
+
       GCTYPEBITS = 3
       VALBITS = EMACS_INT_WIDTH - GCTYPEBITS
       Lisp_Int0 = 2