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