1 # Copyright (C) 1992, 93, 94, 95, 96, 97, 1998, 2000, 01, 2004
2 # Free Software Foundation, Inc.
4 # This file is part of GNU Emacs.
6 # GNU Emacs is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
11 # GNU Emacs is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GNU Emacs; see the file COPYING. If not, write to the
18 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 # Boston, MA 02111-1307, USA.
21 # Force loading of symbols, enough to give us gdb_valbits etc.
24 # Find lwlib source files too.
26 #dir /gd/gnu/lesstif-0.89.9/lib/Xm
28 # Don't enter GDB when user types C-g to quit.
29 # This has one unfortunate effect: you can't type C-c
30 # at the GDB to stop Emacs, when using X.
31 # However, C-z works just as well in that case.
34 # Don't pass SIGALRM to Emacs. This makes problems when
38 # Set up a mask to use.
39 # This should be EMACS_INT, but in some cases that is a macro.
40 # long ought to work in all cases right now.
43 set $ptr = (gdb_use_union ? $arg0.u.val : $arg0 & $valmask) | gdb_data_seg_bits
47 set $int = gdb_use_union ? $arg0.s.val : (gdb_use_lsb ? $arg0 : $arg0 << gdb_gctypebits) >> gdb_gctypebits
51 set $type = gdb_use_union ? $arg0.s.type : (enum Lisp_Type) (gdb_use_lsb ? $arg0 & $tagmask : $arg0 >> gdb_valbits)
54 # Set up something to print out s-expressions.
59 Print the emacs s-expression which is $.
60 Works only when an inferior emacs is executing.
70 if $type == Lisp_Vectorlike
76 Print the type of $, assuming it is an Emacs Lisp value.
77 If the first type printed is Lisp_Vector or Lisp_Misc,
78 a second line gives the more precise type.
83 set $size = ((struct Lisp_Vector *) $ptr)->size
84 output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size
88 Print the size or vector subtype of $, assuming it is a vector or pseudovector.
93 output (enum Lisp_Misc_Type) (((struct Lisp_Free *) $ptr)->type)
97 Print the specific type of $, assuming it is some misc type.
105 Print $, assuming it is an Emacs Lisp integer. This gets the sign right.
113 Print the pointer portion of $, assuming it is an Emacs Lisp value.
118 print (struct Lisp_Marker *) $ptr
121 Print $ as a marker pointer, assuming it is an Emacs Lisp marker value.
126 print (struct Lisp_Overlay *) $ptr
129 Print $ as a overlay pointer, assuming it is an Emacs Lisp overlay value.
134 print (struct Lisp_Free *) $ptr
137 Print $ as a misc free-cell pointer, assuming it is an Emacs Lisp Misc value.
142 print (struct Lisp_Intfwd *) $ptr
145 Print $ as an integer forwarding pointer, assuming it is an Emacs Lisp Misc value.
150 print (struct Lisp_Boolfwd *) $ptr
153 Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value.
158 print (struct Lisp_Objfwd *) $ptr
161 Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value.
166 print (struct Lisp_Buffer_Objfwd *) $ptr
169 Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
174 print (struct Lisp_Kboard_Objfwd *) $ptr
177 Print $ as a kboard-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
182 print (struct Lisp_Buffer_Local_Value *) $ptr
185 Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value.
190 print (struct Lisp_Symbol *) $ptr
195 Print the name and address of the symbol $.
196 This command assumes that $ is an Emacs Lisp symbol value.
201 print (struct Lisp_String *) $ptr
202 output ($->size > 1000) ? 0 : ($->data[0])@($->size_byte < 0 ? $->size : $->size_byte)
206 Print the contents and address of the string $.
207 This command assumes that $ is an Emacs Lisp string value.
212 print (struct Lisp_Vector *) $ptr
213 output ($->size > 50) ? 0 : ($->contents[0])@($->size)
217 Print the contents and address of the vector $.
218 This command assumes that $ is an Emacs Lisp vector value.
223 print (struct Lisp_Process *) $ptr
228 Print the address of the struct Lisp_process which the Lisp_Object $ points to.
233 print (struct frame *) $ptr
236 Print $ as a frame pointer, assuming it is an Emacs Lisp frame value.
241 print (struct Lisp_Vector *) $ptr
242 output ($->contents[0])@($->size & 0xff)
245 Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled value.
250 print (struct window *) $ptr
251 printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top
254 Print $ as a window pointer, assuming it is an Emacs Lisp window value.
255 Print the window's position as "WIDTHxHEIGHT+LEFT+TOP".
260 print (struct save_window_data *) $ptr
263 Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value.
268 print (struct Lisp_Subr *) $ptr
273 Print the address of the subr which the Lisp_Object $ points to.
278 print (struct Lisp_Char_Table *) $ptr
281 printf " %d extra slots", ($->size & 0x1ff) - 68
285 Print the address of the char-table $, and its purpose.
286 This command assumes that $ is an Emacs Lisp char-table value.
291 print (struct Lisp_Bool_Vector *) $ptr
292 output ($->size > 256) ? 0 : ($->data[0])@(($->size + 7)/ 8)
296 Print the contents and address of the bool-vector $.
297 This command assumes that $ is an Emacs Lisp bool-vector value.
302 print (struct buffer *) $ptr
304 output ((struct Lisp_String *) $ptr)->data
308 Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value.
309 Print the name of the buffer.
314 print (struct Lisp_Hash_Table *) $ptr
317 Set $ as a hash table pointer, assuming it is an Emacs Lisp hash table value.
322 print (struct Lisp_Cons *) $ptr
327 Print the contents of $, assuming it is an Emacs Lisp cons.
335 Print the contents of the next cell in a list.
336 This assumes that the last thing you printed was a cons cell contents
337 (type struct Lisp_Cons) or a pointer to one.
342 print/x ($type == Lisp_Cons ? ((struct Lisp_Cons *) $ptr)->car : 0)
345 Print the car of $, assuming it is an Emacs Lisp pair.
351 print/x ($type == Lisp_Cons ? ((struct Lisp_Cons *) $ptr)->cdr : 0)
354 Print the cdr of $, assuming it is an Emacs Lisp pair.
359 print ((struct Lisp_Float *) $ptr)->data
362 Print $ assuming it is a lisp floating-point number.
367 print (struct scrollbar *) $ptr
372 Print $ as a scrollbar pointer.
377 set $sym = (struct Lisp_Symbol *) $ptr
379 set $sym_name = (struct Lisp_String *) $ptr
380 output ($sym_name->data[0])@($sym_name->size_byte < 0 ? $sym_name->size : $sym_name->size_byte)
383 Print argument as a symbol.
387 set $tmp = (struct Lisp_Hash_Table *) ((Vcoding_system_hash_table & $valmask) | gdb_data_seg_bits)
388 set $tmp = (struct Lisp_Vector *) (($tmp->key_and_value & $valmask) | gdb_data_seg_bits)
389 set $name = $tmp->contents[$arg0 * 2]
392 print $tmp->contents[$arg0 * 2 + 1]
396 Print the name and attributes of coding system that has ID (argument).
400 set $tmp = (struct Lisp_Hash_Table *) ((Vcharset_hash_table & $valmask) | gdb_data_seg_bits)
401 set $tmp = (struct Lisp_Vector *) (($tmp->key_and_value & $valmask) | gdb_data_seg_bits)
402 p $tmp->contents[$arg0->hash_index * 2]
406 Print the name of charset that has ID (argument).
410 set $bt = backtrace_list
412 xgettype (*$bt->function)
413 if $type == Lisp_Symbol
414 xprintsym (*$bt->function)
417 printf "0x%x ", *$bt->function
418 if $type == Lisp_Vectorlike
419 xgetptr (*$bt->function)
420 set $size = ((struct Lisp_Vector *) $ptr)->size
421 output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size
423 printf "Lisp type %d", $type
431 Print a backtrace of Lisp function calls from backtrace_list.
432 Set a breakpoint at Fsignal and call this to see from where
433 an error was signaled.
437 set $tagmask = (((long)1 << gdb_gctypebits) - 1)
438 set $valmask = gdb_use_lsb ? ~($tagmask) : ((long)1 << gdb_valbits) - 1
441 When starting Emacs a second time in the same gdb session under
442 FreeBSD 2.2.5, gdb 4.13, $valmask have lost
443 their values. (The same happens on current (2000) versions of GNU/Linux
445 This function reloads them.
453 # Call xreload if a new Emacs executable is loaded.
459 set print sevenbit-strings
461 show environment DISPLAY
462 show environment TERM
463 set args -geometry 80x40+0+0
465 # Don't let abort actually run, as it will make
466 # stdio stop working and therefore the `pr' command above as well.
469 # If we are running in synchronous mode, we want a chance to look around
470 # before Emacs exits. Perhaps we should put the break somewhere else
472 break x_error_quitter
474 # arch-tag: 12f34321-7bfa-4240-b77a-3cd3a1696dfe