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