aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2015-01-08 15:53:09 +0200
committerEli Zaretskii2015-01-08 15:53:09 +0200
commitad83cdacb6808377e2ef4f96e60ffb68dbf01cd9 (patch)
treeb8e07e06c561c7accbf0b37e1229052683e93303
parentdaa18b5e85559ccea84bd9e8a5f8ac57cfa73189 (diff)
downloademacs-ad83cdacb6808377e2ef4f96e60ffb68dbf01cd9.tar.gz
emacs-ad83cdacb6808377e2ef4f96e60ffb68dbf01cd9.zip
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.
-rw-r--r--src/.gdbinit18
-rw-r--r--src/ChangeLog5
2 files changed, 19 insertions, 4 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index 0f2138284a0..1a2a973e694 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -70,6 +70,16 @@ define xgettype
70 set $type = (enum Lisp_Type) (USE_LSB_TAG ? $bugfix & (1 << GCTYPEBITS) - 1 : (EMACS_UINT) $bugfix >> VALBITS) 70 set $type = (enum Lisp_Type) (USE_LSB_TAG ? $bugfix & (1 << GCTYPEBITS) - 1 : (EMACS_UINT) $bugfix >> VALBITS)
71end 71end
72 72
73# Access the name of a symbol
74define xsymname
75 if (CHECK_LISP_OBJECT_TYPE)
76 set $bugfix = $arg0.i
77 else
78 set $bugfix = $arg0
79 end
80 set $symname = ((struct Lisp_Symbol *) ((char *)lispsym + $bugfix))->name
81end
82
73# Set up something to print out s-expressions. 83# Set up something to print out s-expressions.
74# We save and restore print_output_debug_flag to prevent the w32 port 84# We save and restore print_output_debug_flag to prevent the w32 port
75# from calling OutputDebugString, which causes GDB to display each 85# from calling OutputDebugString, which causes GDB to display each
@@ -1073,8 +1083,8 @@ end
1073 1083
1074define xprintsym 1084define xprintsym
1075 xgetptr $arg0 1085 xgetptr $arg0
1076 set $sym = (struct Lisp_Symbol *) $ptr 1086 xsymname $ptr
1077 xgetptr $sym->name 1087 xgetptr $symname
1078 set $sym_name = (struct Lisp_String *) $ptr 1088 set $sym_name = (struct Lisp_String *) $ptr
1079 xprintstr $sym_name 1089 xprintstr $sym_name
1080end 1090end
@@ -1258,8 +1268,8 @@ tbreak init_sys_modes
1258commands 1268commands
1259 silent 1269 silent
1260 xgetptr globals.f_Vinitial_window_system 1270 xgetptr globals.f_Vinitial_window_system
1261 set $tem = (struct Lisp_Symbol *) $ptr 1271 xsymname $ptr
1262 xgetptr $tem->name 1272 xgetptr $symname
1263 set $tem = (struct Lisp_String *) $ptr 1273 set $tem = (struct Lisp_String *) $ptr
1264 set $tem = (char *) $tem->data 1274 set $tem = (char *) $tem->data
1265 # If we are running in synchronous mode, we want a chance to look 1275 # If we are running in synchronous mode, we want a chance to look
diff --git a/src/ChangeLog b/src/ChangeLog
index 21bdc81d797..4365222ff7b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
12015-01-08 Eli Zaretskii <eliz@gnu.org> 12015-01-08 Eli Zaretskii <eliz@gnu.org>
2 2
3 * .gdbinit (xsymname): New subroutine.
4 (xprintsym, initial-tbreak): Use it to access the name of a symbol
5 in a way that doesn't cause GDB to barf when it tries to
6 dereference a NULL pointer.
7
3 * xdisp.c (next_element_from_c_string): Use Lisp integer zero as 8 * xdisp.c (next_element_from_c_string): Use Lisp integer zero as
4 the object. 9 the object.
5 (set_cursor_from_row, try_cursor_movement, dump_glyph) 10 (set_cursor_from_row, try_cursor_movement, dump_glyph)