emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master ad83cda: Fix GDB accesses to the 'nil's name.


From: Eli Zaretskii
Subject: [Emacs-diffs] master ad83cda: Fix GDB accesses to the 'nil's name.
Date: Thu, 08 Jan 2015 13:54:00 +0000

branch: master
commit ad83cdacb6808377e2ef4f96e60ffb68dbf01cd9
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix GDB accesses to the 'nil's name.
    
     src/.gdbinit (xsymname): New subroutine.
     (xprintsym, initial-tbreak): Use it to access the name of a symbol
     in a way that doesn't cause GDB to barf when it tries to
     dereference a NULL pointer.
---
 src/.gdbinit  |   18 ++++++++++++++----
 src/ChangeLog |    5 +++++
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/.gdbinit b/src/.gdbinit
index 0f21382..1a2a973 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -70,6 +70,16 @@ define xgettype
   set $type = (enum Lisp_Type) (USE_LSB_TAG ? $bugfix & (1 << GCTYPEBITS) - 1 
: (EMACS_UINT) $bugfix >> VALBITS)
 end
 
+# Access the name of a symbol
+define xsymname
+  if (CHECK_LISP_OBJECT_TYPE)
+    set $bugfix = $arg0.i
+  else
+    set $bugfix = $arg0
+  end
+  set $symname = ((struct Lisp_Symbol *) ((char *)lispsym + $bugfix))->name
+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
@@ -1073,8 +1083,8 @@ end
 
 define xprintsym
   xgetptr $arg0
-  set $sym = (struct Lisp_Symbol *) $ptr
-  xgetptr $sym->name
+  xsymname $ptr
+  xgetptr $symname
   set $sym_name = (struct Lisp_String *) $ptr
   xprintstr $sym_name
 end
@@ -1258,8 +1268,8 @@ tbreak init_sys_modes
 commands
   silent
   xgetptr globals.f_Vinitial_window_system
-  set $tem = (struct Lisp_Symbol *) $ptr
-  xgetptr $tem->name
+  xsymname $ptr
+  xgetptr $symname
   set $tem = (struct Lisp_String *) $ptr
   set $tem = (char *) $tem->data
   # If we are running in synchronous mode, we want a chance to look
diff --git a/src/ChangeLog b/src/ChangeLog
index 21bdc81..4365222 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
 2015-01-08  Eli Zaretskii  <address@hidden>
 
+       * .gdbinit (xsymname): New subroutine.
+       (xprintsym, initial-tbreak): Use it to access the name of a symbol
+       in a way that doesn't cause GDB to barf when it tries to
+       dereference a NULL pointer.
+
        * xdisp.c (next_element_from_c_string): Use Lisp integer zero as
        the object.
        (set_cursor_from_row, try_cursor_movement, dump_glyph)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]