Commit | Line | Data |
---|---|---|
329aa188 | 1 | # Copyright (C) 1992, 93, 94, 95, 96, 97, 1998, 2000, 01, 2004 |
e3efab9c GM |
2 | # Free Software Foundation, Inc. |
3 | # | |
4 | # This file is part of GNU Emacs. | |
5 | # | |
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) | |
9 | # any later version. | |
10 | # | |
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. | |
15 | # | |
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. | |
20 | ||
7faa0236 RS |
21 | # Force loading of symbols, enough to give us gdb_valbits etc. |
22 | set main | |
23 | ||
39d10e52 RS |
24 | # Find lwlib source files too. |
25 | dir ../lwlib | |
892d8fcd | 26 | #dir /gd/gnu/lesstif-0.89.9/lib/Xm |
39d10e52 | 27 | |
056515d8 KH |
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. | |
32 | handle 2 noprint pass | |
33 | ||
3266f62b GM |
34 | # Don't pass SIGALRM to Emacs. This makes problems when |
35 | # debugging. | |
36 | handle SIGALRM ignore | |
37 | ||
0e73312b | 38 | # $valmask and $tagmask are mask values set up by the xreload macro below. |
329aa188 | 39 | |
0e73312b RS |
40 | # Use $bugfix so that the value isn't a constant. |
41 | # Using a constant runs into GDB bugs sometimes. | |
329aa188 | 42 | define xgetptr |
0e73312b RS |
43 | set $bugfix = $arg0 |
44 | set $ptr = (gdb_use_union ? $bugfix.u.val : $bugfix & $valmask) | gdb_data_seg_bits | |
329aa188 SM |
45 | end |
46 | ||
47 | define xgetint | |
0e73312b RS |
48 | set $bugfix = $arg0 |
49 | set $int = gdb_use_union ? $bugfix.s.val : (gdb_use_lsb ? $bugfix : $bugfix << gdb_gctypebits) >> gdb_gctypebits | |
329aa188 SM |
50 | end |
51 | ||
52 | define xgettype | |
0e73312b RS |
53 | set $bugfix = $arg0 |
54 | set $type = gdb_use_union ? $bugfix.s.type : (enum Lisp_Type) (gdb_use_lsb ? $bugfix & $tagmask : $bugfix >> gdb_valbits) | |
329aa188 | 55 | end |
b74f15c6 | 56 | |
a6ffc6a2 JB |
57 | # Set up something to print out s-expressions. |
58 | define pr | |
329aa188 | 59 | set debug_print ($) |
a6ffc6a2 | 60 | end |
a6ffc6a2 JB |
61 | document pr |
62 | Print the emacs s-expression which is $. | |
63 | Works only when an inferior emacs is executing. | |
64 | end | |
65 | ||
6c5d0c52 KS |
66 | # Print out s-expressions |
67 | define pp | |
68 | set $tmp = $arg0 | |
69 | set debug_print ($tmp) | |
70 | end | |
71 | document pp | |
72 | Print the argument as an emacs s-expression | |
73 | Works only when an inferior emacs is executing. | |
74 | end | |
75 | ||
decf4020 KS |
76 | # Print out current buffer point and boundaries |
77 | define ppt | |
78 | set $b = current_buffer | |
79 | set $t = $b->text | |
80 | printf "BUF PT: %d", $b->pt | |
81 | if ($b->pt != $b->pt_byte) | |
82 | printf "[%d]", $b->pt_byte | |
83 | end | |
84 | printf " of 1..%d", $t->z | |
85 | if ($t->z != $t->z_byte) | |
86 | printf "[%d]", $t->z_byte | |
87 | end | |
88 | if ($b->begv != 1 || $b->zv != $t->z) | |
89 | printf " NARROW=%d..%d", $b->begv, $b->zv | |
90 | if ($b->begv != $b->begv_byte || $b->zv != $b->zv_byte) | |
91 | printf " [%d..%d]", $b->begv_byte, $b->zv_byte | |
92 | end | |
93 | end | |
94 | printf " GAP: %d", $t->gpt | |
95 | if ($t->gpt != $t->gpt_byte) | |
96 | printf "[%d]", $t->gpt_byte | |
97 | end | |
98 | printf " SZ=%d\n", $t->gap_size | |
99 | end | |
100 | document ppt | |
101 | Print point, beg, end, narrow, and gap for current buffer. | |
102 | end | |
103 | ||
afca296c KS |
104 | # Print out iterator given as first arg |
105 | define pitx | |
106 | set $it = $arg0 | |
107 | printf "cur=%d", $it->current.pos.charpos | |
108 | if ($it->current.pos.charpos != $it->current.pos.bytepos) | |
109 | printf "[%d]", $it->current.pos.bytepos | |
110 | end | |
111 | printf " start=%d", $it->start.pos.charpos | |
112 | if ($it->start.pos.charpos != $it->start.pos.bytepos) | |
113 | printf "[%d]", $it->start.pos.bytepos | |
114 | end | |
115 | printf " stop=%d ", $it->stop_charpos | |
116 | output $it->what | |
117 | if ($it->what == IT_CHARACTER) | |
118 | if ($it->len == 1 && $it->c >= ' ' && it->c < 255) | |
119 | printf "['%c']", $it->c | |
120 | else | |
121 | printf "[%d,%d]", $it->c, $it->len | |
122 | end | |
123 | end | |
124 | printf " next=" | |
125 | output $it->method | |
126 | printf "\n" | |
127 | printf "vpos=%d hpos=%d", $it->vpos, $it->hpos, | |
128 | printf " y=%d lvy=%d", $it->current_y, $it->last_visible_y | |
129 | printf " x=%d lvx=%d", $it->current_x, $it->last_visible_x | |
130 | printf " a+d=%d+%d=%d", $it->ascent, $it->descent, $it->ascent+$it->descent | |
131 | printf " max=%d+%d=%d", $it->max_ascent, $it->max_descent, $it->max_ascent+$it->max_descent | |
132 | printf "\n" | |
133 | end | |
134 | document pitx | |
135 | Pretty print a display iterator. | |
136 | Take one arg, an iterator object or pointer. | |
137 | end | |
138 | ||
139 | define pit | |
140 | pitx it | |
141 | end | |
142 | document pit | |
143 | Pretty print the display iterator it. | |
144 | end | |
145 | ||
146 | define prowx | |
147 | set $row = $arg0 | |
148 | printf "y=%d x=%d pwid=%d", $row->y, $row->x, $row->pixel_width | |
149 | printf " a+d=%d+%d=%d", $row->ascent, $row->height-$row->ascent, $row->height | |
150 | printf " phys=%d+%d=%d", $row->phys_ascent, $row->phys_height-$row->phys_ascent, $row->phys_height | |
151 | printf " vis=%d", $row->visible_height | |
152 | printf " L=%d T=%d R=%d", $row->used[0], $row->used[1], $row->used[2] | |
153 | printf "\n" | |
154 | printf "start=%d end=%d", $row->start.pos.charpos, $row->end.pos.charpos | |
155 | if ($row->enabled_p) | |
156 | printf " ENA" | |
157 | end | |
158 | if ($row->displays_text_p) | |
159 | printf " DISP" | |
160 | end | |
161 | if ($row->mode_line_p) | |
162 | printf " MODEL" | |
163 | end | |
164 | if ($row->continued_p) | |
165 | printf " CONT" | |
166 | end | |
167 | if ($row-> truncated_on_left_p) | |
168 | printf " TRUNC:L" | |
169 | end | |
170 | if ($row-> truncated_on_right_p) | |
171 | printf " TRUNC:R" | |
172 | end | |
173 | if ($row->starts_in_middle_of_char_p) | |
174 | printf " STARTMID" | |
175 | end | |
176 | if ($row->ends_in_middle_of_char_p) | |
177 | printf " ENDMID" | |
178 | end | |
179 | if ($row->ends_in_newline_from_string_p) | |
180 | printf " ENDNLFS" | |
181 | end | |
182 | if ($row->ends_at_zv_p) | |
183 | printf " ENDZV" | |
184 | end | |
185 | if ($row->overlapped_p) | |
186 | printf " OLAPD" | |
187 | end | |
188 | if ($row->overlapping_p) | |
189 | printf " OLAPNG" | |
190 | end | |
191 | printf "\n" | |
192 | end | |
193 | document prowx | |
194 | Pretty print information about glyph_row. | |
195 | Takes one argument, a row object or pointer. | |
196 | end | |
197 | ||
198 | define prow | |
199 | prowx row | |
200 | end | |
201 | document prow | |
202 | Pretty print information about glyph_row in row. | |
203 | end | |
204 | ||
205 | ||
206 | define pcursorx | |
207 | set $cp = $arg0 | |
208 | printf "y=%d x=%d vpos=%d hpos=%d", $cp->y, $cp->x, $cp->vpos, $cp->hpos | |
209 | end | |
210 | document pcursorx | |
211 | Pretty print a window cursor | |
212 | end | |
213 | ||
214 | define pcursor | |
215 | printf "output: " | |
216 | pcursorx output_cursor | |
217 | printf "\n" | |
218 | end | |
219 | document pcursor | |
220 | Pretty print the output_cursor | |
221 | end | |
222 | ||
223 | define pwinx | |
224 | set $w = $arg0 | |
225 | xgetint $w->sequence_number | |
226 | if ($w->mini_p != Qnil) | |
227 | printf "Mini " | |
228 | end | |
229 | printf "Window %d ", $int | |
230 | xgetptr $w->buffer | |
231 | set $tem = (struct buffer *) $ptr | |
232 | xgetptr $tem->name | |
233 | printf "%s", ((struct Lisp_String *) $ptr)->data | |
234 | printf "\n" | |
235 | xgetptr $w->start | |
236 | set $tem = (struct Lisp_Marker *) $ptr | |
237 | printf "start=%d end:", $tem->charpos | |
238 | if ($w->window_end_valid != Qnil) | |
239 | xgetint $w->window_end_pos | |
240 | printf "pos=%d", $int | |
241 | xgetint $w->window_end_vpos | |
242 | printf " vpos=%d", $int | |
243 | else | |
244 | printf "invalid" | |
245 | end | |
246 | printf " vscroll=%d", $w->vscroll | |
247 | if ($w->force_start != Qnil) | |
248 | printf " FORCE_START" | |
249 | end | |
250 | if ($w->must_be_updated_p) | |
251 | printf " MUST_UPD" | |
252 | end | |
253 | printf "\n" | |
254 | printf "cursor: " | |
255 | pcursorx $w->cursor | |
256 | printf " phys: " | |
257 | pcursorx $w->phys_cursor | |
258 | if ($w->phys_cursor_on_p) | |
259 | printf " ON" | |
260 | else | |
261 | printf " OFF" | |
262 | end | |
263 | printf " blk=" | |
264 | if ($w->last_cursor_off_p != $w->cursor_off_p) | |
265 | if ($w->last_cursor_off_p) | |
266 | printf "ON->" | |
267 | else | |
268 | printf "OFF->" | |
269 | end | |
270 | end | |
271 | if ($w->cursor_off_p) | |
272 | printf "ON" | |
273 | else | |
274 | printf "OFF" | |
275 | end | |
276 | printf "\n" | |
277 | end | |
278 | document pwinx | |
279 | Pretty print a window structure. | |
280 | Takes one argument, a pointer to a window structure | |
281 | end | |
282 | ||
283 | define pwin | |
284 | pwinx w | |
285 | end | |
286 | document pwin | |
287 | Pretty print window structure w. | |
288 | end | |
289 | ||
290 | ||
a6ffc6a2 | 291 | define xtype |
329aa188 SM |
292 | xgettype $ |
293 | output $type | |
294 | echo \n | |
295 | if $type == Lisp_Misc | |
296 | xmisctype | |
297 | else | |
298 | if $type == Lisp_Vectorlike | |
299 | xvectype | |
300 | end | |
301 | end | |
a6ffc6a2 | 302 | end |
e065a56e | 303 | document xtype |
ba1e23bf | 304 | Print the type of $, assuming it is an Emacs Lisp value. |
3fe8bda5 | 305 | If the first type printed is Lisp_Vector or Lisp_Misc, |
329aa188 | 306 | a second line gives the more precise type. |
3fe8bda5 RS |
307 | end |
308 | ||
309 | define xvectype | |
329aa188 SM |
310 | xgetptr $ |
311 | set $size = ((struct Lisp_Vector *) $ptr)->size | |
fc80da24 | 312 | output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~gdb_array_mark_flag |
329aa188 | 313 | echo \n |
3fe8bda5 RS |
314 | end |
315 | document xvectype | |
329aa188 | 316 | Print the size or vector subtype of $, assuming it is a vector or pseudovector. |
3fe8bda5 RS |
317 | end |
318 | ||
319 | define xmisctype | |
329aa188 SM |
320 | xgetptr $ |
321 | output (enum Lisp_Misc_Type) (((struct Lisp_Free *) $ptr)->type) | |
322 | echo \n | |
3fe8bda5 RS |
323 | end |
324 | document xmisctype | |
325 | Print the specific type of $, assuming it is some misc type. | |
e065a56e | 326 | end |
a6ffc6a2 JB |
327 | |
328 | define xint | |
329aa188 SM |
329 | xgetint $ |
330 | print $int | |
a6ffc6a2 | 331 | end |
e065a56e | 332 | document xint |
ba1e23bf | 333 | Print $, assuming it is an Emacs Lisp integer. This gets the sign right. |
e065a56e | 334 | end |
a6ffc6a2 JB |
335 | |
336 | define xptr | |
329aa188 SM |
337 | xgetptr $ |
338 | print (void *) $ptr | |
a6ffc6a2 | 339 | end |
e065a56e | 340 | document xptr |
ba1e23bf | 341 | Print the pointer portion of $, assuming it is an Emacs Lisp value. |
e065a56e | 342 | end |
a6ffc6a2 | 343 | |
a6ffc6a2 | 344 | define xmarker |
329aa188 SM |
345 | xgetptr $ |
346 | print (struct Lisp_Marker *) $ptr | |
a6ffc6a2 | 347 | end |
e065a56e | 348 | document xmarker |
ba1e23bf | 349 | Print $ as a marker pointer, assuming it is an Emacs Lisp marker value. |
e065a56e | 350 | end |
a6ffc6a2 | 351 | |
a6a3acf0 | 352 | define xoverlay |
329aa188 SM |
353 | xgetptr $ |
354 | print (struct Lisp_Overlay *) $ptr | |
a6a3acf0 KH |
355 | end |
356 | document xoverlay | |
357 | Print $ as a overlay pointer, assuming it is an Emacs Lisp overlay value. | |
358 | end | |
359 | ||
360 | define xmiscfree | |
329aa188 SM |
361 | xgetptr $ |
362 | print (struct Lisp_Free *) $ptr | |
a6a3acf0 KH |
363 | end |
364 | document xmiscfree | |
365 | Print $ as a misc free-cell pointer, assuming it is an Emacs Lisp Misc value. | |
366 | end | |
367 | ||
368 | define xintfwd | |
329aa188 SM |
369 | xgetptr $ |
370 | print (struct Lisp_Intfwd *) $ptr | |
a6a3acf0 KH |
371 | end |
372 | document xintfwd | |
373 | Print $ as an integer forwarding pointer, assuming it is an Emacs Lisp Misc value. | |
374 | end | |
375 | ||
376 | define xboolfwd | |
329aa188 SM |
377 | xgetptr $ |
378 | print (struct Lisp_Boolfwd *) $ptr | |
a6a3acf0 KH |
379 | end |
380 | document xboolfwd | |
381 | Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value. | |
382 | end | |
383 | ||
384 | define xobjfwd | |
329aa188 SM |
385 | xgetptr $ |
386 | print (struct Lisp_Objfwd *) $ptr | |
a6a3acf0 KH |
387 | end |
388 | document xobjfwd | |
389 | Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value. | |
390 | end | |
391 | ||
029c56f6 | 392 | define xbufobjfwd |
329aa188 SM |
393 | xgetptr $ |
394 | print (struct Lisp_Buffer_Objfwd *) $ptr | |
a6a3acf0 | 395 | end |
029c56f6 | 396 | document xbufobjfwd |
a6a3acf0 KH |
397 | Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value. |
398 | end | |
399 | ||
a0371857 | 400 | define xkbobjfwd |
329aa188 SM |
401 | xgetptr $ |
402 | print (struct Lisp_Kboard_Objfwd *) $ptr | |
cd39e946 | 403 | end |
a0371857 KH |
404 | document xkbobjfwd |
405 | Print $ as a kboard-local object forwarding pointer, assuming it is an Emacs Lisp Misc value. | |
cd39e946 KH |
406 | end |
407 | ||
029c56f6 | 408 | define xbuflocal |
329aa188 SM |
409 | xgetptr $ |
410 | print (struct Lisp_Buffer_Local_Value *) $ptr | |
a6a3acf0 | 411 | end |
029c56f6 | 412 | document xbuflocal |
a6a3acf0 KH |
413 | Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value. |
414 | end | |
415 | ||
a6ffc6a2 | 416 | define xsymbol |
cfcde636 KS |
417 | set $sym = $ |
418 | xgetptr $sym | |
329aa188 | 419 | print (struct Lisp_Symbol *) $ptr |
cfcde636 | 420 | xprintsym $sym |
329aa188 | 421 | echo \n |
a6ffc6a2 | 422 | end |
e065a56e JB |
423 | document xsymbol |
424 | Print the name and address of the symbol $. | |
ba1e23bf | 425 | This command assumes that $ is an Emacs Lisp symbol value. |
e065a56e | 426 | end |
a6ffc6a2 JB |
427 | |
428 | define xstring | |
329aa188 SM |
429 | xgetptr $ |
430 | print (struct Lisp_String *) $ptr | |
0001e968 | 431 | xprintstr $ |
329aa188 | 432 | echo \n |
a6ffc6a2 | 433 | end |
a6ffc6a2 | 434 | document xstring |
e065a56e | 435 | Print the contents and address of the string $. |
ba1e23bf | 436 | This command assumes that $ is an Emacs Lisp string value. |
a6ffc6a2 JB |
437 | end |
438 | ||
439 | define xvector | |
329aa188 SM |
440 | xgetptr $ |
441 | print (struct Lisp_Vector *) $ptr | |
fc80da24 | 442 | output ($->size > 50) ? 0 : ($->contents[0])@($->size & ~gdb_array_mark_flag) |
ef15f270 | 443 | echo \n |
a6ffc6a2 | 444 | end |
a6ffc6a2 | 445 | document xvector |
e065a56e | 446 | Print the contents and address of the vector $. |
ba1e23bf | 447 | This command assumes that $ is an Emacs Lisp vector value. |
a6ffc6a2 JB |
448 | end |
449 | ||
14a8902a | 450 | define xprocess |
329aa188 SM |
451 | xgetptr $ |
452 | print (struct Lisp_Process *) $ptr | |
453 | output *$ | |
454 | echo \n | |
14a8902a RS |
455 | end |
456 | document xprocess | |
457 | Print the address of the struct Lisp_process which the Lisp_Object $ points to. | |
458 | end | |
459 | ||
ec558adc | 460 | define xframe |
329aa188 SM |
461 | xgetptr $ |
462 | print (struct frame *) $ptr | |
a6ffc6a2 | 463 | end |
ec558adc | 464 | document xframe |
ba1e23bf | 465 | Print $ as a frame pointer, assuming it is an Emacs Lisp frame value. |
e065a56e | 466 | end |
a6ffc6a2 | 467 | |
14a8902a | 468 | define xcompiled |
329aa188 SM |
469 | xgetptr $ |
470 | print (struct Lisp_Vector *) $ptr | |
471 | output ($->contents[0])@($->size & 0xff) | |
14a8902a RS |
472 | end |
473 | document xcompiled | |
474 | Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled value. | |
475 | end | |
476 | ||
477 | define xwindow | |
329aa188 SM |
478 | xgetptr $ |
479 | print (struct window *) $ptr | |
480 | printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top | |
14a8902a RS |
481 | end |
482 | document xwindow | |
483 | Print $ as a window pointer, assuming it is an Emacs Lisp window value. | |
484 | Print the window's position as "WIDTHxHEIGHT+LEFT+TOP". | |
485 | end | |
486 | ||
029c56f6 | 487 | define xwinconfig |
329aa188 SM |
488 | xgetptr $ |
489 | print (struct save_window_data *) $ptr | |
a6a3acf0 | 490 | end |
029c56f6 | 491 | document xwinconfig |
a6a3acf0 KH |
492 | Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value. |
493 | end | |
494 | ||
14a8902a | 495 | define xsubr |
329aa188 SM |
496 | xgetptr $ |
497 | print (struct Lisp_Subr *) $ptr | |
498 | output *$ | |
499 | echo \n | |
a6a3acf0 | 500 | end |
14a8902a RS |
501 | document xsubr |
502 | Print the address of the subr which the Lisp_Object $ points to. | |
503 | end | |
504 | ||
505 | define xchartable | |
329aa188 SM |
506 | xgetptr $ |
507 | print (struct Lisp_Char_Table *) $ptr | |
508 | printf "Purpose: " | |
509 | xprintsym $->purpose | |
510 | printf " %d extra slots", ($->size & 0x1ff) - 388 | |
511 | echo \n | |
14a8902a RS |
512 | end |
513 | document xchartable | |
514 | Print the address of the char-table $, and its purpose. | |
515 | This command assumes that $ is an Emacs Lisp char-table value. | |
516 | end | |
517 | ||
518 | define xboolvector | |
329aa188 SM |
519 | xgetptr $ |
520 | print (struct Lisp_Bool_Vector *) $ptr | |
fc80da24 | 521 | output ($->size > 256) ? 0 : ($->data[0])@((($->size & ~gdb_array_mark_flag) + 7)/ 8) |
329aa188 | 522 | echo \n |
14a8902a RS |
523 | end |
524 | document xboolvector | |
525 | Print the contents and address of the bool-vector $. | |
526 | This command assumes that $ is an Emacs Lisp bool-vector value. | |
527 | end | |
528 | ||
529 | define xbuffer | |
329aa188 SM |
530 | xgetptr $ |
531 | print (struct buffer *) $ptr | |
532 | xgetptr $->name | |
533 | output ((struct Lisp_String *) $ptr)->data | |
534 | echo \n | |
14a8902a RS |
535 | end |
536 | document xbuffer | |
537 | Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value. | |
538 | Print the name of the buffer. | |
a6a3acf0 KH |
539 | end |
540 | ||
3266f62b | 541 | define xhashtable |
329aa188 SM |
542 | xgetptr $ |
543 | print (struct Lisp_Hash_Table *) $ptr | |
3266f62b GM |
544 | end |
545 | document xhashtable | |
546 | Set $ as a hash table pointer, assuming it is an Emacs Lisp hash table value. | |
547 | end | |
548 | ||
a6ffc6a2 | 549 | define xcons |
329aa188 SM |
550 | xgetptr $ |
551 | print (struct Lisp_Cons *) $ptr | |
552 | output/x *$ | |
553 | echo \n | |
a6ffc6a2 | 554 | end |
e065a56e | 555 | document xcons |
ba1e23bf | 556 | Print the contents of $, assuming it is an Emacs Lisp cons. |
e065a56e | 557 | end |
a6ffc6a2 | 558 | |
6f493884 | 559 | define nextcons |
329aa188 SM |
560 | p $.cdr |
561 | xcons | |
6f493884 RS |
562 | end |
563 | document nextcons | |
564 | Print the contents of the next cell in a list. | |
565 | This assumes that the last thing you printed was a cons cell contents | |
566 | (type struct Lisp_Cons) or a pointer to one. | |
567 | end | |
a6ffc6a2 | 568 | define xcar |
329aa188 SM |
569 | xgetptr $ |
570 | xgettype $ | |
571 | print/x ($type == Lisp_Cons ? ((struct Lisp_Cons *) $ptr)->car : 0) | |
a6ffc6a2 | 572 | end |
e065a56e | 573 | document xcar |
ba1e23bf | 574 | Print the car of $, assuming it is an Emacs Lisp pair. |
e065a56e | 575 | end |
a6ffc6a2 JB |
576 | |
577 | define xcdr | |
329aa188 SM |
578 | xgetptr $ |
579 | xgettype $ | |
580 | print/x ($type == Lisp_Cons ? ((struct Lisp_Cons *) $ptr)->cdr : 0) | |
a6ffc6a2 | 581 | end |
e065a56e | 582 | document xcdr |
ba1e23bf | 583 | Print the cdr of $, assuming it is an Emacs Lisp pair. |
e065a56e | 584 | end |
a6ffc6a2 | 585 | |
df86e57e | 586 | define xfloat |
329aa188 SM |
587 | xgetptr $ |
588 | print ((struct Lisp_Float *) $ptr)->data | |
df86e57e JB |
589 | end |
590 | document xfloat | |
591 | Print $ assuming it is a lisp floating-point number. | |
592 | end | |
593 | ||
b2367490 | 594 | define xscrollbar |
329aa188 SM |
595 | xgetptr $ |
596 | print (struct scrollbar *) $ptr | |
b2367490 JB |
597 | output *$ |
598 | echo \n | |
599 | end | |
dec5f4e3 | 600 | document xscrollbar |
b2367490 JB |
601 | Print $ as a scrollbar pointer. |
602 | end | |
603 | ||
0001e968 SM |
604 | define xprintstr |
605 | set $data = $arg0->data | |
606 | output ($arg0->size > 1000) ? 0 : ($data[0])@($arg0->size_byte < 0 ? $arg0->size & ~gdb_array_mark_flag : $arg0->size_byte) | |
607 | end | |
608 | ||
24b4d1bc | 609 | define xprintsym |
329aa188 SM |
610 | xgetptr $arg0 |
611 | set $sym = (struct Lisp_Symbol *) $ptr | |
612 | xgetptr $sym->xname | |
613 | set $sym_name = (struct Lisp_String *) $ptr | |
0001e968 | 614 | xprintstr $sym_name |
24b4d1bc GM |
615 | end |
616 | document xprintsym | |
617 | Print argument as a symbol. | |
618 | end | |
619 | ||
620 | define xbacktrace | |
621 | set $bt = backtrace_list | |
177c0ea7 | 622 | while $bt |
329aa188 | 623 | xgettype (*$bt->function) |
3176a27e | 624 | if $type == Lisp_Symbol |
329aa188 SM |
625 | xprintsym (*$bt->function) |
626 | echo \n | |
3176a27e GM |
627 | else |
628 | printf "0x%x ", *$bt->function | |
629 | if $type == Lisp_Vectorlike | |
329aa188 SM |
630 | xgetptr (*$bt->function) |
631 | set $size = ((struct Lisp_Vector *) $ptr)->size | |
fc80da24 | 632 | output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~gdb_array_mark_flag |
3176a27e GM |
633 | else |
634 | printf "Lisp type %d", $type | |
635 | end | |
636 | echo \n | |
637 | end | |
24b4d1bc GM |
638 | set $bt = $bt->next |
639 | end | |
640 | end | |
641 | document xbacktrace | |
642 | Print a backtrace of Lisp function calls from backtrace_list. | |
177c0ea7 | 643 | Set a breakpoint at Fsignal and call this to see from where |
3176a27e | 644 | an error was signaled. |
24b4d1bc GM |
645 | end |
646 | ||
647 | define xreload | |
329aa188 SM |
648 | set $tagmask = (((long)1 << gdb_gctypebits) - 1) |
649 | set $valmask = gdb_use_lsb ? ~($tagmask) : ((long)1 << gdb_valbits) - 1 | |
24b4d1bc GM |
650 | end |
651 | document xreload | |
652 | When starting Emacs a second time in the same gdb session under | |
329aa188 | 653 | FreeBSD 2.2.5, gdb 4.13, $valmask have lost |
be9e8331 DL |
654 | their values. (The same happens on current (2000) versions of GNU/Linux |
655 | with gdb 5.0.) | |
c71ea231 | 656 | This function reloads them. |
24b4d1bc | 657 | end |
329aa188 | 658 | xreload |
24b4d1bc | 659 | |
6c5d0c52 KS |
660 | # Flush display (X only) |
661 | define ff | |
662 | set x_flush (0) | |
663 | end | |
664 | document ff | |
665 | Flush pending X window display updates to screen. | |
666 | Works only when an inferior emacs is executing. | |
667 | end | |
668 | ||
669 | ||
be9e8331 DL |
670 | define hook-run |
671 | xreload | |
672 | end | |
673 | ||
e869a29d RS |
674 | # Call xreload if a new Emacs executable is loaded. |
675 | define hookpost-run | |
676 | xreload | |
677 | end | |
678 | ||
e065a56e | 679 | set print pretty on |
df86e57e | 680 | set print sevenbit-strings |
a6ffc6a2 | 681 | |
e5d77022 | 682 | show environment DISPLAY |
6f5d1a4f | 683 | show environment TERM |
6f5d1a4f | 684 | set args -geometry 80x40+0+0 |
e5d77022 | 685 | |
a6ffc6a2 | 686 | # Don't let abort actually run, as it will make |
7f692070 | 687 | # stdio stop working and therefore the `pr' command above as well. |
a6ffc6a2 JB |
688 | break abort |
689 | ||
690 | # If we are running in synchronous mode, we want a chance to look around | |
691 | # before Emacs exits. Perhaps we should put the break somewhere else | |
692 | # instead... | |
998ee976 | 693 | break x_error_quitter |
ab5796a9 MB |
694 | |
695 | # arch-tag: 12f34321-7bfa-4240-b77a-3cd3a1696dfe |