Commit | Line | Data |
---|---|---|
acaf905b | 1 | # Copyright (C) 1992-1998, 2000-2012 Free Software Foundation, Inc. |
e3efab9c GM |
2 | # |
3 | # This file is part of GNU Emacs. | |
4 | # | |
5 | # GNU Emacs is free software; you can redistribute it and/or modify | |
6 | # it under the terms of the GNU General Public License as published by | |
684d6f5b | 7 | # the Free Software Foundation; either version 3, or (at your option) |
e3efab9c GM |
8 | # any later version. |
9 | # | |
10 | # GNU Emacs is distributed in the hope that it will be useful, | |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | # GNU General Public License for more details. | |
14 | # | |
15 | # You should have received a copy of the GNU General Public License | |
16 | # along with GNU Emacs; see the file COPYING. If not, write to the | |
4fc5845f LK |
17 | # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | # Boston, MA 02110-1301, USA. | |
e3efab9c | 19 | |
1781b9e9 | 20 | # Force loading of symbols, enough to give us VALBITS etc. |
7faa0236 | 21 | set main |
2d4018aa EZ |
22 | # With some compilers, we need this to give us struct Lisp_Symbol etc.: |
23 | set Fmake_symbol | |
7faa0236 | 24 | |
39d10e52 RS |
25 | # Find lwlib source files too. |
26 | dir ../lwlib | |
892d8fcd | 27 | #dir /gd/gnu/lesstif-0.89.9/lib/Xm |
39d10e52 | 28 | |
056515d8 KH |
29 | # Don't enter GDB when user types C-g to quit. |
30 | # This has one unfortunate effect: you can't type C-c | |
31 | # at the GDB to stop Emacs, when using X. | |
32 | # However, C-z works just as well in that case. | |
33 | handle 2 noprint pass | |
34 | ||
19b9d1de NR |
35 | # Make it work like SIGINT normally does. |
36 | handle SIGTSTP nopass | |
37 | ||
6a7d16fe KS |
38 | # Pass on user signals |
39 | handle SIGUSR1 noprint pass | |
40 | handle SIGUSR2 noprint pass | |
41 | ||
3266f62b GM |
42 | # Don't pass SIGALRM to Emacs. This makes problems when |
43 | # debugging. | |
44 | handle SIGALRM ignore | |
45 | ||
0e73312b RS |
46 | # Use $bugfix so that the value isn't a constant. |
47 | # Using a constant runs into GDB bugs sometimes. | |
6b61353c | 48 | define xgetptr |
1781b9e9 PE |
49 | set $bugfix = CHECK_LISP_OBJECT_TYPE ? $arg0.i : $arg0 |
50 | set $ptr = ($bugfix & VALMASK) | DATA_SEG_BITS | |
6b61353c KH |
51 | end |
52 | ||
53 | define xgetint | |
1781b9e9 PE |
54 | set $bugfix = CHECK_LISP_OBJECT_TYPE ? $arg0.i : $arg0 |
55 | set $int = USE_LSB_TAG ? $bugfix >> INTTYPEBITS : $bugfix << INTTYPEBITS >> INTTYPEBITS | |
6b61353c KH |
56 | end |
57 | ||
58 | define xgettype | |
1781b9e9 PE |
59 | set $bugfix = CHECK_LISP_OBJECT_TYPE ? $arg0.i : $arg0 |
60 | set $type = (enum Lisp_Type) (USE_LSB_TAG ? $bugfix & (1 << GCTYPEBITS) - 1 : $bugfix >> VALBITS) | |
6b61353c | 61 | end |
b74f15c6 | 62 | |
a6ffc6a2 | 63 | # Set up something to print out s-expressions. |
4fccedb5 EZ |
64 | # We save and restore print_output_debug_flag to prevent the w32 port |
65 | # from calling OutputDebugString, which causes GDB to display each | |
66 | # character twice (yuk!). | |
a6ffc6a2 | 67 | define pr |
3723ec07 | 68 | pp $ |
a6ffc6a2 | 69 | end |
a6ffc6a2 JB |
70 | document pr |
71 | Print the emacs s-expression which is $. | |
72 | Works only when an inferior emacs is executing. | |
73 | end | |
74 | ||
6c5d0c52 KS |
75 | # Print out s-expressions |
76 | define pp | |
77 | set $tmp = $arg0 | |
4fccedb5 EZ |
78 | set $output_debug = print_output_debug_flag |
79 | set print_output_debug_flag = 0 | |
1609a963 | 80 | set safe_debug_print ($tmp) |
4fccedb5 | 81 | set print_output_debug_flag = $output_debug |
6c5d0c52 KS |
82 | end |
83 | document pp | |
84 | Print the argument as an emacs s-expression | |
85 | Works only when an inferior emacs is executing. | |
86 | end | |
87 | ||
1609a963 KS |
88 | # Print value of lisp variable |
89 | define pv | |
1609a963 | 90 | set $tmp = "$arg0" |
4fccedb5 EZ |
91 | set $output_debug = print_output_debug_flag |
92 | set print_output_debug_flag = 0 | |
1609a963 | 93 | set safe_debug_print (find_symbol_value (intern ($tmp))) |
4fccedb5 | 94 | set print_output_debug_flag = $output_debug |
1609a963 | 95 | end |
3723ec07 | 96 | document pv |
1609a963 KS |
97 | Print the value of the lisp variable given as argument. |
98 | Works only when an inferior emacs is executing. | |
1609a963 KS |
99 | end |
100 | ||
decf4020 KS |
101 | # Print out current buffer point and boundaries |
102 | define ppt | |
103 | set $b = current_buffer | |
104 | set $t = $b->text | |
105 | printf "BUF PT: %d", $b->pt | |
106 | if ($b->pt != $b->pt_byte) | |
107 | printf "[%d]", $b->pt_byte | |
108 | end | |
109 | printf " of 1..%d", $t->z | |
110 | if ($t->z != $t->z_byte) | |
111 | printf "[%d]", $t->z_byte | |
112 | end | |
113 | if ($b->begv != 1 || $b->zv != $t->z) | |
114 | printf " NARROW=%d..%d", $b->begv, $b->zv | |
115 | if ($b->begv != $b->begv_byte || $b->zv != $b->zv_byte) | |
116 | printf " [%d..%d]", $b->begv_byte, $b->zv_byte | |
117 | end | |
118 | end | |
119 | printf " GAP: %d", $t->gpt | |
120 | if ($t->gpt != $t->gpt_byte) | |
121 | printf "[%d]", $t->gpt_byte | |
122 | end | |
123 | printf " SZ=%d\n", $t->gap_size | |
124 | end | |
125 | document ppt | |
2d5ed88d EZ |
126 | Print current buffer's point and boundaries. |
127 | Prints values of point, beg, end, narrow, and gap for current buffer. | |
decf4020 KS |
128 | end |
129 | ||
be996d82 EZ |
130 | define pitmethod |
131 | set $itmethod = $arg0 | |
132 | # output $itmethod | |
133 | if ($itmethod == 0) | |
134 | printf "GET_FROM_BUFFER" | |
135 | end | |
136 | if ($itmethod == 1) | |
137 | printf "GET_FROM_DISPLAY_VECTOR" | |
138 | end | |
139 | if ($itmethod == 2) | |
140 | printf "GET_FROM_STRING" | |
141 | end | |
142 | if ($itmethod == 3) | |
143 | printf "GET_FROM_C_STRING" | |
144 | end | |
145 | if ($itmethod == 4) | |
146 | printf "GET_FROM_IMAGE" | |
147 | end | |
148 | if ($itmethod == 5) | |
149 | printf "GET_FROM_STRETCH" | |
150 | end | |
151 | if ($itmethod < 0 || $itmethod > 5) | |
152 | output $itmethod | |
153 | end | |
154 | end | |
155 | document pitmethod | |
156 | Pretty print it->method given as first arg | |
157 | end | |
158 | ||
afca296c KS |
159 | # Print out iterator given as first arg |
160 | define pitx | |
161 | set $it = $arg0 | |
162 | printf "cur=%d", $it->current.pos.charpos | |
163 | if ($it->current.pos.charpos != $it->current.pos.bytepos) | |
164 | printf "[%d]", $it->current.pos.bytepos | |
165 | end | |
82d59cb0 KS |
166 | printf " pos=%d", $it->position.charpos |
167 | if ($it->position.charpos != $it->position.bytepos) | |
168 | printf "[%d]", $it->position.bytepos | |
169 | end | |
afca296c KS |
170 | printf " start=%d", $it->start.pos.charpos |
171 | if ($it->start.pos.charpos != $it->start.pos.bytepos) | |
172 | printf "[%d]", $it->start.pos.bytepos | |
173 | end | |
2fde1500 KS |
174 | printf " end=%d", $it->end_charpos |
175 | printf " stop=%d", $it->stop_charpos | |
176 | printf " face=%d", $it->face_id | |
177 | if ($it->multibyte_p) | |
178 | printf " MB" | |
179 | end | |
180 | if ($it->header_line_p) | |
181 | printf " HL" | |
182 | end | |
183 | if ($it->n_overlay_strings > 0) | |
338fa84a | 184 | printf " nov=%d", $it->n_overlay_strings |
2fde1500 KS |
185 | end |
186 | if ($it->sp != 0) | |
187 | printf " sp=%d", $it->sp | |
188 | end | |
2d20eee3 EZ |
189 | # IT_CHARACTER |
190 | if ($it->what == 0) | |
afca296c | 191 | if ($it->len == 1 && $it->c >= ' ' && it->c < 255) |
501b66fa | 192 | printf " ch='%c'", $it->c |
afca296c | 193 | else |
501b66fa | 194 | printf " ch=[%d,%d]", $it->c, $it->len |
2fde1500 KS |
195 | end |
196 | else | |
1e99743b | 197 | printf " " |
be996d82 EZ |
198 | # output $it->what |
199 | if ($it->what == 0) | |
200 | printf "IT_CHARACTER" | |
201 | end | |
202 | if ($it->what == 1) | |
203 | printf "IT_COMPOSITION" | |
204 | end | |
205 | if ($it->what == 2) | |
206 | printf "IT_IMAGE" | |
207 | end | |
208 | if ($it->what == 3) | |
209 | printf "IT_STRETCH" | |
210 | end | |
211 | if ($it->what == 4) | |
212 | printf "IT_EOB" | |
213 | end | |
214 | if ($it->what == 5) | |
215 | printf "IT_TRUNCATION" | |
216 | end | |
217 | if ($it->what == 6) | |
218 | printf "IT_CONTINUATION" | |
219 | end | |
220 | if ($it->what < 0 || $it->what > 6) | |
221 | output $it->what | |
222 | end | |
afca296c | 223 | end |
2d20eee3 EZ |
224 | if ($it->method != 0) |
225 | # !GET_FROM_BUFFER | |
2fde1500 | 226 | printf " next=" |
be996d82 | 227 | pitmethod $it->method |
2d20eee3 EZ |
228 | if ($it->method == 2) |
229 | # GET_FROM_STRING | |
501b66fa KS |
230 | printf "[%d]", $it->current.string_pos.charpos |
231 | end | |
2d20eee3 EZ |
232 | if ($it->method == 4) |
233 | # GET_FROM_IMAGE | |
1e99743b KS |
234 | printf "[%d]", $it->image_id |
235 | end | |
2fde1500 | 236 | end |
afca296c | 237 | printf "\n" |
241ab1c1 EZ |
238 | if ($it->bidi_p) |
239 | printf "BIDI: base_stop=%d prev_stop=%d level=%d\n", $it->base_level_stop, $it->prev_stop, $it->bidi_it.resolved_level | |
240 | end | |
2fde1500 KS |
241 | if ($it->region_beg_charpos >= 0) |
242 | printf "reg=%d-%d ", $it->region_beg_charpos, $it->region_end_charpos | |
243 | end | |
afca296c KS |
244 | printf "vpos=%d hpos=%d", $it->vpos, $it->hpos, |
245 | printf " y=%d lvy=%d", $it->current_y, $it->last_visible_y | |
2fde1500 | 246 | printf " x=%d vx=%d-%d", $it->current_x, $it->first_visible_x, $it->last_visible_x |
28c1e1ca | 247 | printf " w=%d", $it->pixel_width |
afca296c KS |
248 | printf " a+d=%d+%d=%d", $it->ascent, $it->descent, $it->ascent+$it->descent |
249 | printf " max=%d+%d=%d", $it->max_ascent, $it->max_descent, $it->max_ascent+$it->max_descent | |
250 | printf "\n" | |
0058964e | 251 | set $i = 0 |
82d59cb0 | 252 | while ($i < $it->sp && $i < 4) |
0058964e KS |
253 | set $e = $it->stack[$i] |
254 | printf "stack[%d]: ", $i | |
3eb49e71 EZ |
255 | pitmethod $e.method |
256 | printf "[%d]", $e.position.charpos | |
0058964e KS |
257 | printf "\n" |
258 | set $i = $i + 1 | |
259 | end | |
afca296c KS |
260 | end |
261 | document pitx | |
262 | Pretty print a display iterator. | |
263 | Take one arg, an iterator object or pointer. | |
264 | end | |
265 | ||
266 | define pit | |
267 | pitx it | |
268 | end | |
269 | document pit | |
270 | Pretty print the display iterator it. | |
271 | end | |
272 | ||
273 | define prowx | |
274 | set $row = $arg0 | |
275 | printf "y=%d x=%d pwid=%d", $row->y, $row->x, $row->pixel_width | |
276 | printf " a+d=%d+%d=%d", $row->ascent, $row->height-$row->ascent, $row->height | |
277 | printf " phys=%d+%d=%d", $row->phys_ascent, $row->phys_height-$row->phys_ascent, $row->phys_height | |
b12cd789 EZ |
278 | printf " vis=%d\n", $row->visible_height |
279 | printf "used=(LMargin=%d,Text=%d,RMargin=%d) Hash=%d\n", $row->used[0], $row->used[1], $row->used[2], $row->hash | |
afca296c KS |
280 | printf "start=%d end=%d", $row->start.pos.charpos, $row->end.pos.charpos |
281 | if ($row->enabled_p) | |
282 | printf " ENA" | |
283 | end | |
284 | if ($row->displays_text_p) | |
285 | printf " DISP" | |
286 | end | |
287 | if ($row->mode_line_p) | |
288 | printf " MODEL" | |
289 | end | |
290 | if ($row->continued_p) | |
291 | printf " CONT" | |
292 | end | |
293 | if ($row-> truncated_on_left_p) | |
294 | printf " TRUNC:L" | |
295 | end | |
296 | if ($row-> truncated_on_right_p) | |
297 | printf " TRUNC:R" | |
298 | end | |
299 | if ($row->starts_in_middle_of_char_p) | |
300 | printf " STARTMID" | |
301 | end | |
302 | if ($row->ends_in_middle_of_char_p) | |
303 | printf " ENDMID" | |
304 | end | |
305 | if ($row->ends_in_newline_from_string_p) | |
306 | printf " ENDNLFS" | |
307 | end | |
308 | if ($row->ends_at_zv_p) | |
309 | printf " ENDZV" | |
310 | end | |
311 | if ($row->overlapped_p) | |
312 | printf " OLAPD" | |
313 | end | |
314 | if ($row->overlapping_p) | |
315 | printf " OLAPNG" | |
316 | end | |
317 | printf "\n" | |
318 | end | |
319 | document prowx | |
320 | Pretty print information about glyph_row. | |
321 | Takes one argument, a row object or pointer. | |
322 | end | |
323 | ||
324 | define prow | |
325 | prowx row | |
326 | end | |
327 | document prow | |
328 | Pretty print information about glyph_row in row. | |
329 | end | |
330 | ||
331 | ||
332 | define pcursorx | |
333 | set $cp = $arg0 | |
334 | printf "y=%d x=%d vpos=%d hpos=%d", $cp->y, $cp->x, $cp->vpos, $cp->hpos | |
335 | end | |
336 | document pcursorx | |
89955f2e | 337 | Pretty print a window cursor. |
afca296c KS |
338 | end |
339 | ||
340 | define pcursor | |
341 | printf "output: " | |
342 | pcursorx output_cursor | |
343 | printf "\n" | |
344 | end | |
345 | document pcursor | |
89955f2e | 346 | Pretty print the output_cursor. |
afca296c KS |
347 | end |
348 | ||
349 | define pwinx | |
350 | set $w = $arg0 | |
351 | xgetint $w->sequence_number | |
352 | if ($w->mini_p != Qnil) | |
353 | printf "Mini " | |
354 | end | |
355 | printf "Window %d ", $int | |
356 | xgetptr $w->buffer | |
357 | set $tem = (struct buffer *) $ptr | |
c40f8d15 | 358 | xgetptr $tem->name_ |
afca296c KS |
359 | printf "%s", ((struct Lisp_String *) $ptr)->data |
360 | printf "\n" | |
361 | xgetptr $w->start | |
362 | set $tem = (struct Lisp_Marker *) $ptr | |
363 | printf "start=%d end:", $tem->charpos | |
364 | if ($w->window_end_valid != Qnil) | |
365 | xgetint $w->window_end_pos | |
366 | printf "pos=%d", $int | |
367 | xgetint $w->window_end_vpos | |
368 | printf " vpos=%d", $int | |
369 | else | |
370 | printf "invalid" | |
371 | end | |
372 | printf " vscroll=%d", $w->vscroll | |
373 | if ($w->force_start != Qnil) | |
374 | printf " FORCE_START" | |
375 | end | |
376 | if ($w->must_be_updated_p) | |
377 | printf " MUST_UPD" | |
378 | end | |
379 | printf "\n" | |
380 | printf "cursor: " | |
381 | pcursorx $w->cursor | |
382 | printf " phys: " | |
383 | pcursorx $w->phys_cursor | |
384 | if ($w->phys_cursor_on_p) | |
385 | printf " ON" | |
386 | else | |
387 | printf " OFF" | |
388 | end | |
389 | printf " blk=" | |
390 | if ($w->last_cursor_off_p != $w->cursor_off_p) | |
391 | if ($w->last_cursor_off_p) | |
392 | printf "ON->" | |
393 | else | |
394 | printf "OFF->" | |
395 | end | |
396 | end | |
397 | if ($w->cursor_off_p) | |
398 | printf "ON" | |
399 | else | |
400 | printf "OFF" | |
401 | end | |
402 | printf "\n" | |
403 | end | |
404 | document pwinx | |
405 | Pretty print a window structure. | |
89955f2e | 406 | Takes one argument, a pointer to a window structure. |
afca296c KS |
407 | end |
408 | ||
409 | define pwin | |
410 | pwinx w | |
411 | end | |
412 | document pwin | |
413 | Pretty print window structure w. | |
414 | end | |
415 | ||
bc5a45f3 | 416 | define pbiditype |
9443b3c7 EZ |
417 | if ($arg0 == 0) |
418 | printf "UNDEF" | |
419 | end | |
bc5a45f3 EZ |
420 | if ($arg0 == 1) |
421 | printf "L" | |
422 | end | |
423 | if ($arg0 == 2) | |
424 | printf "R" | |
425 | end | |
426 | if ($arg0 == 3) | |
427 | printf "EN" | |
428 | end | |
429 | if ($arg0 == 4) | |
430 | printf "AN" | |
431 | end | |
432 | if ($arg0 == 5) | |
433 | printf "BN" | |
434 | end | |
435 | if ($arg0 == 6) | |
436 | printf "B" | |
437 | end | |
9443b3c7 | 438 | if ($arg0 < 0 || $arg0 > 6) |
bc5a45f3 EZ |
439 | printf "%d??", $arg0 |
440 | end | |
441 | end | |
442 | document pbiditype | |
443 | Print textual description of bidi type given as first argument. | |
444 | end | |
445 | ||
1e99743b KS |
446 | define pgx |
447 | set $g = $arg0 | |
be996d82 | 448 | # CHAR_GLYPH |
a1674f0b EZ |
449 | if ($g.type == 0) |
450 | if ($g.u.ch >= ' ' && $g.u.ch < 127) | |
451 | printf "CHAR[%c]", $g.u.ch | |
1e99743b | 452 | else |
a1674f0b | 453 | printf "CHAR[0x%x]", $g.u.ch |
1e99743b KS |
454 | end |
455 | end | |
be996d82 | 456 | # COMPOSITE_GLYPH |
a1674f0b EZ |
457 | if ($g.type == 1) |
458 | printf "COMP[%d (%d..%d)]", $g.u.cmp.id, $g.slice.cmp.from, $g.slice.cmp.to | |
1e99743b | 459 | end |
0eb025fb | 460 | # GLYPHLESS_GLYPH |
a1674f0b | 461 | if ($g.type == 2) |
0eb025fb | 462 | printf "GLYPHLESS[" |
a1674f0b | 463 | if ($g.u.glyphless.method == 0) |
0eb025fb EZ |
464 | printf "THIN]" |
465 | end | |
a1674f0b | 466 | if ($g.u.glyphless.method == 1) |
0eb025fb EZ |
467 | printf "EMPTY]" |
468 | end | |
a1674f0b | 469 | if ($g.u.glyphless.method == 2) |
0eb025fb EZ |
470 | printf "ACRO]" |
471 | end | |
a1674f0b | 472 | if ($g.u.glyphless.method == 3) |
0eb025fb EZ |
473 | printf "HEX]" |
474 | end | |
475 | end | |
476 | # IMAGE_GLYPH | |
a1674f0b EZ |
477 | if ($g.type == 3) |
478 | printf "IMAGE[%d]", $g.u.img_id | |
1e99743b | 479 | end |
be996d82 | 480 | # STRETCH_GLYPH |
a1674f0b EZ |
481 | if ($g.type == 4) |
482 | printf "STRETCH[%d+%d]", $g.u.stretch.height, $g.u.stretch.ascent | |
1e99743b | 483 | end |
a1674f0b | 484 | xgettype ($g.object) |
1e99743b | 485 | if ($type == Lisp_String) |
a1674f0b | 486 | printf " str=%x[%d]", $g.object, $g.charpos |
1e99743b | 487 | else |
a1674f0b | 488 | printf " pos=%d", $g.charpos |
1e99743b | 489 | end |
bc5a45f3 | 490 | # For characters, print their resolved level and bidi type |
a1674f0b EZ |
491 | if ($g.type == 0) |
492 | printf " blev=%d,btyp=", $g.resolved_level | |
493 | pbiditype $g.bidi_type | |
bc5a45f3 | 494 | end |
a1674f0b | 495 | printf " w=%d a+d=%d+%d", $g.pixel_width, $g.ascent, $g.descent |
be996d82 | 496 | # If not DEFAULT_FACE_ID |
a1674f0b EZ |
497 | if ($g.face_id != 0) |
498 | printf " face=%d", $g.face_id | |
1e99743b | 499 | end |
a1674f0b EZ |
500 | if ($g.voffset) |
501 | printf " vof=%d", $g.voffset | |
1e99743b | 502 | end |
a1674f0b | 503 | if ($g.multibyte_p) |
1e99743b KS |
504 | printf " MB" |
505 | end | |
a1674f0b | 506 | if ($g.padding_p) |
1e99743b KS |
507 | printf " PAD" |
508 | end | |
a1674f0b | 509 | if ($g.glyph_not_available_p) |
1e99743b KS |
510 | printf " N/A" |
511 | end | |
a1674f0b | 512 | if ($g.overlaps_vertically_p) |
1e99743b KS |
513 | printf " OVL" |
514 | end | |
a1674f0b | 515 | if ($g.avoid_cursor_p) |
cb4545ad EZ |
516 | printf " AVOID" |
517 | end | |
a1674f0b | 518 | if ($g.left_box_line_p) |
1e99743b KS |
519 | printf " [" |
520 | end | |
a1674f0b | 521 | if ($g.right_box_line_p) |
1e99743b KS |
522 | printf " ]" |
523 | end | |
a1674f0b EZ |
524 | if ($g.slice.img.x || $g.slice.img.y || $g.slice.img.width || $g.slice.img.height) |
525 | printf " slice=%d,%d,%d,%d" ,$g.slice.img.x, $g.slice.img.y, $g.slice.img.width, $g.slice.img.height | |
1e99743b KS |
526 | end |
527 | printf "\n" | |
528 | end | |
529 | document pgx | |
530 | Pretty print a glyph structure. | |
89955f2e | 531 | Takes one argument, a pointer to a glyph structure. |
1e99743b KS |
532 | end |
533 | ||
534 | define pg | |
535 | set $pgidx = 0 | |
536 | pgx glyph | |
537 | end | |
538 | document pg | |
539 | Pretty print glyph structure glyph. | |
540 | end | |
541 | ||
542 | define pgi | |
543 | set $pgidx = $arg0 | |
544 | pgx (&glyph[$pgidx]) | |
545 | end | |
546 | document pgi | |
547 | Pretty print glyph structure glyph[I]. | |
548 | Takes one argument, a integer I. | |
549 | end | |
550 | ||
551 | define pgn | |
552 | set $pgidx = $pgidx + 1 | |
553 | pgx (&glyph[$pgidx]) | |
554 | end | |
555 | document pgn | |
556 | Pretty print next glyph structure. | |
557 | end | |
558 | ||
559 | define pgrowx | |
560 | set $row = $arg0 | |
561 | set $area = 0 | |
562 | set $xofs = $row->x | |
563 | while ($area < 3) | |
564 | set $used = $row->used[$area] | |
565 | if ($used > 0) | |
566 | set $gl0 = $row->glyphs[$area] | |
567 | set $pgidx = 0 | |
568 | printf "%s: %d glyphs\n", ($area == 0 ? "LEFT" : $area == 2 ? "RIGHT" : "TEXT"), $used | |
569 | while ($pgidx < $used) | |
570 | printf "%3d %4d: ", $pgidx, $xofs | |
571 | pgx $gl0[$pgidx] | |
572 | set $xofs = $xofs + $gl0[$pgidx]->pixel_width | |
573 | set $pgidx = $pgidx + 1 | |
574 | end | |
575 | end | |
576 | set $area = $area + 1 | |
577 | end | |
578 | end | |
579 | document pgrowx | |
580 | Pretty print all glyphs in a row structure. | |
581 | Takes one argument, a pointer to a row structure. | |
582 | end | |
583 | ||
584 | define pgrow | |
585 | pgrowx row | |
586 | end | |
587 | document pgrow | |
588 | Pretty print all glyphs in row structure row. | |
589 | end | |
afca296c | 590 | |
be996d82 EZ |
591 | define pgrowit |
592 | pgrowx it->glyph_row | |
593 | end | |
594 | document pgrowit | |
595 | Pretty print all glyphs in it->glyph_row. | |
596 | end | |
597 | ||
f866d742 | 598 | define prowlims |
0416466c | 599 | printf "edges=(%d,%d),r2l=%d,cont=%d,trunc=(%d,%d),at_zv=%d\n", $arg0->minpos.charpos, $arg0->maxpos.charpos, $arg0->reversed_p, $arg0->continued_p, $arg0->truncated_on_left_p, $arg0->truncated_on_right_p, $arg0->ends_at_zv_p |
f866d742 EZ |
600 | end |
601 | document prowlims | |
602 | Print important attributes of a glyph_row structure. | |
603 | Takes one argument, a pointer to a glyph_row structure. | |
604 | end | |
605 | ||
606 | define pmtxrows | |
607 | set $mtx = $arg0 | |
608 | set $gl = $mtx->rows | |
0416466c EZ |
609 | set $glend = $mtx->rows + $mtx->nrows - 1 |
610 | set $i = 0 | |
f866d742 | 611 | while ($gl < $glend) |
0416466c | 612 | printf "%d: ", $i |
f866d742 EZ |
613 | prowlims $gl |
614 | set $gl = $gl + 1 | |
0416466c | 615 | set $i = $i + 1 |
f866d742 EZ |
616 | end |
617 | end | |
618 | document pmtxrows | |
619 | Print data about glyph rows in a glyph matrix. | |
620 | Takes one argument, a pointer to a glyph_matrix structure. | |
621 | end | |
622 | ||
a6ffc6a2 | 623 | define xtype |
6b61353c KH |
624 | xgettype $ |
625 | output $type | |
626 | echo \n | |
627 | if $type == Lisp_Misc | |
628 | xmisctype | |
629 | else | |
630 | if $type == Lisp_Vectorlike | |
631 | xvectype | |
632 | end | |
633 | end | |
a6ffc6a2 | 634 | end |
e065a56e | 635 | document xtype |
ba1e23bf | 636 | Print the type of $, assuming it is an Emacs Lisp value. |
3fe8bda5 | 637 | If the first type printed is Lisp_Vector or Lisp_Misc, |
6b61353c | 638 | a second line gives the more precise type. |
3fe8bda5 RS |
639 | end |
640 | ||
641 | define xvectype | |
6b61353c | 642 | xgetptr $ |
cc7245e4 | 643 | set $size = ((struct Lisp_Vector *) $ptr)->header.size |
1781b9e9 | 644 | output ($size & PSEUDOVECTOR_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~ARRAY_MARK_FLAG |
6b61353c | 645 | echo \n |
3fe8bda5 RS |
646 | end |
647 | document xvectype | |
89955f2e NR |
648 | Print the size or vector subtype of $. |
649 | This command assumes that $ is a vector or pseudovector. | |
3fe8bda5 RS |
650 | end |
651 | ||
652 | define xmisctype | |
6b61353c KH |
653 | xgetptr $ |
654 | output (enum Lisp_Misc_Type) (((struct Lisp_Free *) $ptr)->type) | |
655 | echo \n | |
3fe8bda5 RS |
656 | end |
657 | document xmisctype | |
2d5ed88d | 658 | Assume that $ is some misc type and print its specific type. |
e065a56e | 659 | end |
a6ffc6a2 JB |
660 | |
661 | define xint | |
6b61353c KH |
662 | xgetint $ |
663 | print $int | |
a6ffc6a2 | 664 | end |
e065a56e | 665 | document xint |
2d5ed88d | 666 | Print $ as an Emacs Lisp integer. This gets the sign right. |
e065a56e | 667 | end |
a6ffc6a2 JB |
668 | |
669 | define xptr | |
6b61353c KH |
670 | xgetptr $ |
671 | print (void *) $ptr | |
a6ffc6a2 | 672 | end |
e065a56e | 673 | document xptr |
2d5ed88d | 674 | Print the pointer portion of an Emacs Lisp value in $. |
e065a56e | 675 | end |
a6ffc6a2 | 676 | |
a6ffc6a2 | 677 | define xmarker |
6b61353c KH |
678 | xgetptr $ |
679 | print (struct Lisp_Marker *) $ptr | |
a6ffc6a2 | 680 | end |
e065a56e | 681 | document xmarker |
2d5ed88d EZ |
682 | Print $ as a marker pointer. |
683 | This command assumes that $ is an Emacs Lisp marker value. | |
e065a56e | 684 | end |
a6ffc6a2 | 685 | |
a6a3acf0 | 686 | define xoverlay |
6b61353c KH |
687 | xgetptr $ |
688 | print (struct Lisp_Overlay *) $ptr | |
a6a3acf0 KH |
689 | end |
690 | document xoverlay | |
89955f2e NR |
691 | Print $ as a overlay pointer. |
692 | This command assumes that $ is an Emacs Lisp overlay value. | |
a6a3acf0 KH |
693 | end |
694 | ||
695 | define xmiscfree | |
6b61353c KH |
696 | xgetptr $ |
697 | print (struct Lisp_Free *) $ptr | |
a6a3acf0 KH |
698 | end |
699 | document xmiscfree | |
89955f2e NR |
700 | Print $ as a misc free-cell pointer. |
701 | This command assumes that $ is an Emacs Lisp Misc value. | |
a6a3acf0 KH |
702 | end |
703 | ||
a6ffc6a2 | 704 | define xsymbol |
cfcde636 KS |
705 | set $sym = $ |
706 | xgetptr $sym | |
6b61353c | 707 | print (struct Lisp_Symbol *) $ptr |
cfcde636 | 708 | xprintsym $sym |
6b61353c | 709 | echo \n |
a6ffc6a2 | 710 | end |
e065a56e JB |
711 | document xsymbol |
712 | Print the name and address of the symbol $. | |
ba1e23bf | 713 | This command assumes that $ is an Emacs Lisp symbol value. |
e065a56e | 714 | end |
a6ffc6a2 JB |
715 | |
716 | define xstring | |
6b61353c KH |
717 | xgetptr $ |
718 | print (struct Lisp_String *) $ptr | |
0001e968 | 719 | xprintstr $ |
6b61353c | 720 | echo \n |
a6ffc6a2 | 721 | end |
a6ffc6a2 | 722 | document xstring |
e065a56e | 723 | Print the contents and address of the string $. |
ba1e23bf | 724 | This command assumes that $ is an Emacs Lisp string value. |
a6ffc6a2 JB |
725 | end |
726 | ||
727 | define xvector | |
6b61353c KH |
728 | xgetptr $ |
729 | print (struct Lisp_Vector *) $ptr | |
1781b9e9 | 730 | output ($->header.size > 50) ? 0 : ($->contents[0])@($->header.size & ~ARRAY_MARK_FLAG) |
ef15f270 | 731 | echo \n |
a6ffc6a2 | 732 | end |
a6ffc6a2 | 733 | document xvector |
e065a56e | 734 | Print the contents and address of the vector $. |
ba1e23bf | 735 | This command assumes that $ is an Emacs Lisp vector value. |
a6ffc6a2 JB |
736 | end |
737 | ||
14a8902a | 738 | define xprocess |
6b61353c KH |
739 | xgetptr $ |
740 | print (struct Lisp_Process *) $ptr | |
741 | output *$ | |
742 | echo \n | |
14a8902a RS |
743 | end |
744 | document xprocess | |
89955f2e NR |
745 | Print the address of the struct Lisp_process to which $ points. |
746 | This command assumes that $ is a Lisp_Object. | |
14a8902a RS |
747 | end |
748 | ||
ec558adc | 749 | define xframe |
6b61353c KH |
750 | xgetptr $ |
751 | print (struct frame *) $ptr | |
28c1e1ca KS |
752 | xgetptr $->name |
753 | set $ptr = (struct Lisp_String *) $ptr | |
754 | xprintstr $ptr | |
755 | echo \n | |
a6ffc6a2 | 756 | end |
ec558adc | 757 | document xframe |
2d5ed88d EZ |
758 | Print $ as a frame pointer. |
759 | This command assumes $ is an Emacs Lisp frame value. | |
e065a56e | 760 | end |
a6ffc6a2 | 761 | |
14a8902a | 762 | define xcompiled |
6b61353c KH |
763 | xgetptr $ |
764 | print (struct Lisp_Vector *) $ptr | |
cc7245e4 | 765 | output ($->contents[0])@($->header.size & 0xff) |
14a8902a RS |
766 | end |
767 | document xcompiled | |
89955f2e NR |
768 | Print $ as a compiled function pointer. |
769 | This command assumes that $ is an Emacs Lisp compiled value. | |
14a8902a RS |
770 | end |
771 | ||
772 | define xwindow | |
6b61353c KH |
773 | xgetptr $ |
774 | print (struct window *) $ptr | |
25d34643 RS |
775 | set $window = (struct window *) $ptr |
776 | xgetint $window->total_cols | |
777 | set $width=$int | |
778 | xgetint $window->total_lines | |
779 | set $height=$int | |
780 | xgetint $window->left_col | |
781 | set $left=$int | |
782 | xgetint $window->top_line | |
783 | set $top=$int | |
784 | printf "%dx%d+%d+%d\n", $width, $height, $left, $top | |
14a8902a RS |
785 | end |
786 | document xwindow | |
787 | Print $ as a window pointer, assuming it is an Emacs Lisp window value. | |
788 | Print the window's position as "WIDTHxHEIGHT+LEFT+TOP". | |
789 | end | |
790 | ||
029c56f6 | 791 | define xwinconfig |
6b61353c KH |
792 | xgetptr $ |
793 | print (struct save_window_data *) $ptr | |
a6a3acf0 | 794 | end |
029c56f6 | 795 | document xwinconfig |
89955f2e NR |
796 | Print $ as a window configuration pointer. |
797 | This command assumes that $ is an Emacs Lisp window configuration value. | |
a6a3acf0 KH |
798 | end |
799 | ||
14a8902a | 800 | define xsubr |
6b61353c KH |
801 | xgetptr $ |
802 | print (struct Lisp_Subr *) $ptr | |
803 | output *$ | |
804 | echo \n | |
a6a3acf0 | 805 | end |
14a8902a RS |
806 | document xsubr |
807 | Print the address of the subr which the Lisp_Object $ points to. | |
808 | end | |
809 | ||
810 | define xchartable | |
6b61353c KH |
811 | xgetptr $ |
812 | print (struct Lisp_Char_Table *) $ptr | |
813 | printf "Purpose: " | |
814 | xprintsym $->purpose | |
cc7245e4 | 815 | printf " %d extra slots", ($->header.size & 0x1ff) - 68 |
6b61353c | 816 | echo \n |
14a8902a RS |
817 | end |
818 | document xchartable | |
819 | Print the address of the char-table $, and its purpose. | |
820 | This command assumes that $ is an Emacs Lisp char-table value. | |
821 | end | |
822 | ||
d1da276f EZ |
823 | define xsubchartable |
824 | xgetptr $ | |
825 | print (struct Lisp_Sub_Char_Table *) $ptr | |
826 | xgetint $->depth | |
827 | set $depth = $int | |
828 | xgetint $->min_char | |
829 | printf "Depth: %d, Min char: %d (0x%x)\n", $depth, $int, $int | |
830 | end | |
831 | document xsubchartable | |
832 | Print the address of the sub-char-table $, its depth and min-char. | |
833 | This command assumes that $ is an Emacs Lisp sub-char-table value. | |
834 | end | |
835 | ||
14a8902a | 836 | define xboolvector |
6b61353c KH |
837 | xgetptr $ |
838 | print (struct Lisp_Bool_Vector *) $ptr | |
1781b9e9 | 839 | output ($->size > 256) ? 0 : ($->data[0])@(($->size + BOOL_VECTOR_BITS_PER_CHAR - 1)/ BOOL_VECTOR_BITS_PER_CHAR) |
6b61353c | 840 | echo \n |
14a8902a RS |
841 | end |
842 | document xboolvector | |
843 | Print the contents and address of the bool-vector $. | |
844 | This command assumes that $ is an Emacs Lisp bool-vector value. | |
845 | end | |
846 | ||
847 | define xbuffer | |
6b61353c KH |
848 | xgetptr $ |
849 | print (struct buffer *) $ptr | |
c40f8d15 | 850 | xgetptr $->name_ |
6b61353c KH |
851 | output ((struct Lisp_String *) $ptr)->data |
852 | echo \n | |
14a8902a RS |
853 | end |
854 | document xbuffer | |
2d5ed88d EZ |
855 | Set $ as a buffer pointer and the name of the buffer. |
856 | This command assumes $ is an Emacs Lisp buffer value. | |
a6a3acf0 KH |
857 | end |
858 | ||
3266f62b | 859 | define xhashtable |
6b61353c KH |
860 | xgetptr $ |
861 | print (struct Lisp_Hash_Table *) $ptr | |
3266f62b GM |
862 | end |
863 | document xhashtable | |
89955f2e NR |
864 | Set $ as a hash table pointer. |
865 | This command assumes that $ is an Emacs Lisp hash table value. | |
3266f62b GM |
866 | end |
867 | ||
a6ffc6a2 | 868 | define xcons |
6b61353c KH |
869 | xgetptr $ |
870 | print (struct Lisp_Cons *) $ptr | |
871 | output/x *$ | |
872 | echo \n | |
a6ffc6a2 | 873 | end |
e065a56e | 874 | document xcons |
2d5ed88d | 875 | Print the contents of $ as an Emacs Lisp cons. |
e065a56e | 876 | end |
a6ffc6a2 | 877 | |
6f493884 | 878 | define nextcons |
b4483658 | 879 | p $.u.cdr |
6b61353c | 880 | xcons |
6f493884 RS |
881 | end |
882 | document nextcons | |
883 | Print the contents of the next cell in a list. | |
89955f2e | 884 | This command assumes that the last thing you printed was a cons cell contents |
6f493884 RS |
885 | (type struct Lisp_Cons) or a pointer to one. |
886 | end | |
a6ffc6a2 | 887 | define xcar |
6b61353c KH |
888 | xgetptr $ |
889 | xgettype $ | |
890 | print/x ($type == Lisp_Cons ? ((struct Lisp_Cons *) $ptr)->car : 0) | |
a6ffc6a2 | 891 | end |
e065a56e | 892 | document xcar |
2d5ed88d | 893 | Assume that $ is an Emacs Lisp pair and print its car. |
e065a56e | 894 | end |
a6ffc6a2 JB |
895 | |
896 | define xcdr | |
6b61353c KH |
897 | xgetptr $ |
898 | xgettype $ | |
b4483658 | 899 | print/x ($type == Lisp_Cons ? ((struct Lisp_Cons *) $ptr)->u.cdr : 0) |
a6ffc6a2 | 900 | end |
e065a56e | 901 | document xcdr |
2d5ed88d | 902 | Assume that $ is an Emacs Lisp pair and print its cdr. |
e065a56e | 903 | end |
a6ffc6a2 | 904 | |
28c1e1ca KS |
905 | define xlist |
906 | xgetptr $ | |
907 | set $cons = (struct Lisp_Cons *) $ptr | |
908 | xgetptr Qnil | |
909 | set $nil = $ptr | |
910 | set $i = 0 | |
911 | while $cons != $nil && $i < 10 | |
912 | p/x $cons->car | |
913 | xpr | |
914 | xgetptr $cons->u.cdr | |
915 | set $cons = (struct Lisp_Cons *) $ptr | |
916 | set $i = $i + 1 | |
917 | printf "---\n" | |
918 | end | |
919 | if $cons == $nil | |
920 | printf "nil\n" | |
921 | else | |
922 | printf "...\n" | |
923 | p $ptr | |
924 | end | |
925 | end | |
926 | document xlist | |
927 | Print $ assuming it is a list. | |
928 | end | |
929 | ||
df86e57e | 930 | define xfloat |
6b61353c | 931 | xgetptr $ |
b4483658 | 932 | print ((struct Lisp_Float *) $ptr)->u.data |
df86e57e JB |
933 | end |
934 | document xfloat | |
935 | Print $ assuming it is a lisp floating-point number. | |
936 | end | |
937 | ||
b2367490 | 938 | define xscrollbar |
6b61353c KH |
939 | xgetptr $ |
940 | print (struct scrollbar *) $ptr | |
b2367490 JB |
941 | output *$ |
942 | echo \n | |
943 | end | |
dec5f4e3 | 944 | document xscrollbar |
b2367490 JB |
945 | Print $ as a scrollbar pointer. |
946 | end | |
947 | ||
28c1e1ca KS |
948 | define xpr |
949 | xtype | |
646b5f55 AS |
950 | if $type == Lisp_Int0 || $type == Lisp_Int1 |
951 | xint | |
28c1e1ca KS |
952 | end |
953 | if $type == Lisp_Symbol | |
954 | xsymbol | |
955 | end | |
956 | if $type == Lisp_String | |
957 | xstring | |
958 | end | |
959 | if $type == Lisp_Cons | |
960 | xcons | |
961 | end | |
962 | if $type == Lisp_Float | |
963 | xfloat | |
964 | end | |
965 | if $type == Lisp_Misc | |
966 | set $misc = (enum Lisp_Misc_Type) (((struct Lisp_Free *) $ptr)->type) | |
967 | if $misc == Lisp_Misc_Free | |
968 | xmiscfree | |
969 | end | |
28c1e1ca KS |
970 | if $misc == Lisp_Misc_Marker |
971 | xmarker | |
972 | end | |
28c1e1ca KS |
973 | if $misc == Lisp_Misc_Overlay |
974 | xoverlay | |
975 | end | |
28c1e1ca KS |
976 | # if $misc == Lisp_Misc_Save_Value |
977 | # xsavevalue | |
978 | # end | |
979 | end | |
980 | if $type == Lisp_Vectorlike | |
cc7245e4 | 981 | set $size = ((struct Lisp_Vector *) $ptr)->header.size |
1781b9e9 | 982 | if ($size & PSEUDOVECTOR_FLAG) |
28c1e1ca KS |
983 | set $vec = (enum pvec_type) ($size & PVEC_TYPE_MASK) |
984 | if $vec == PVEC_NORMAL_VECTOR | |
985 | xvector | |
986 | end | |
987 | if $vec == PVEC_PROCESS | |
988 | xprocess | |
989 | end | |
990 | if $vec == PVEC_FRAME | |
991 | xframe | |
992 | end | |
993 | if $vec == PVEC_COMPILED | |
994 | xcompiled | |
995 | end | |
996 | if $vec == PVEC_WINDOW | |
997 | xwindow | |
998 | end | |
999 | if $vec == PVEC_WINDOW_CONFIGURATION | |
1000 | xwinconfig | |
1001 | end | |
1002 | if $vec == PVEC_SUBR | |
1003 | xsubr | |
1004 | end | |
1005 | if $vec == PVEC_CHAR_TABLE | |
1006 | xchartable | |
1007 | end | |
1008 | if $vec == PVEC_BOOL_VECTOR | |
1009 | xboolvector | |
1010 | end | |
1011 | if $vec == PVEC_BUFFER | |
1012 | xbuffer | |
1013 | end | |
1014 | if $vec == PVEC_HASH_TABLE | |
1015 | xhashtable | |
1016 | end | |
1017 | else | |
1018 | xvector | |
1019 | end | |
1020 | end | |
1021 | end | |
1022 | document xpr | |
1023 | Print $ as a lisp object of any type. | |
1024 | end | |
1025 | ||
0001e968 | 1026 | define xprintstr |
d3332249 | 1027 | set $data = (char *) $arg0->data |
1781b9e9 | 1028 | output ($arg0->size > 1000) ? 0 : ($data[0])@($arg0->size_byte < 0 ? $arg0->size & ~ARRAY_MARK_FLAG : $arg0->size_byte) |
0001e968 SM |
1029 | end |
1030 | ||
24b4d1bc | 1031 | define xprintsym |
6b61353c KH |
1032 | xgetptr $arg0 |
1033 | set $sym = (struct Lisp_Symbol *) $ptr | |
1034 | xgetptr $sym->xname | |
1035 | set $sym_name = (struct Lisp_String *) $ptr | |
0001e968 | 1036 | xprintstr $sym_name |
24b4d1bc GM |
1037 | end |
1038 | document xprintsym | |
1039 | Print argument as a symbol. | |
1040 | end | |
1041 | ||
d5fb9ac8 | 1042 | define xcoding |
1781b9e9 PE |
1043 | set $tmp = (struct Lisp_Hash_Table *) ((Vcoding_system_hash_table & VALMASK) | DATA_SEG_BITS) |
1044 | set $tmp = (struct Lisp_Vector *) (($tmp->key_and_value & VALMASK) | DATA_SEG_BITS) | |
d5fb9ac8 KH |
1045 | set $name = $tmp->contents[$arg0 * 2] |
1046 | print $name | |
1047 | pr | |
1048 | print $tmp->contents[$arg0 * 2 + 1] | |
1049 | pr | |
1050 | end | |
1051 | document xcoding | |
8f924df7 | 1052 | Print the name and attributes of coding system that has ID (argument). |
d5fb9ac8 KH |
1053 | end |
1054 | ||
1055 | define xcharset | |
1781b9e9 PE |
1056 | set $tmp = (struct Lisp_Hash_Table *) ((Vcharset_hash_table & VALMASK) | DATA_SEG_BITS) |
1057 | set $tmp = (struct Lisp_Vector *) (($tmp->key_and_value & VALMASK) | DATA_SEG_BITS) | |
af800dc0 | 1058 | p $tmp->contents[charset_table[$arg0].hash_index * 2] |
d5fb9ac8 KH |
1059 | pr |
1060 | end | |
1061 | document xcharset | |
8f924df7 | 1062 | Print the name of charset that has ID (argument). |
d5fb9ac8 KH |
1063 | end |
1064 | ||
9e067dbc KH |
1065 | define xfontset |
1066 | xgetptr $ | |
1067 | set $tbl = (struct Lisp_Char_Table *) $ptr | |
1068 | print $tbl | |
1069 | xgetint $tbl->extras[0] | |
1070 | printf " ID:%d", $int | |
1071 | xgettype $tbl->extras[1] | |
1072 | xgetptr $tbl->extras[1] | |
1073 | if $type == Lisp_String | |
1074 | set $ptr = (struct Lisp_String *) $ptr | |
1075 | printf " Name:" | |
1076 | xprintstr $ptr | |
1077 | else | |
1078 | xgetptr $tbl->extras[2] | |
1079 | set $ptr = (struct Lisp_Char_Table *) $ptr | |
1080 | xgetptr $ptr->extras[1] | |
1081 | set $ptr = (struct Lisp_String *) $ptr | |
1082 | printf " Realized from:" | |
1083 | xprintstr $ptr | |
1084 | end | |
1085 | echo \n | |
1086 | end | |
1087 | ||
322081f1 KH |
1088 | define xfont |
1089 | xgetptr $ | |
cc7245e4 | 1090 | set $size = (((struct Lisp_Vector *) $ptr)->header.size & 0x1FF) |
322081f1 KH |
1091 | if $size == FONT_SPEC_MAX |
1092 | print (struct font_spec *) $ptr | |
1093 | else | |
1094 | if $size == FONT_ENTITY_MAX | |
1095 | print (struct font_entity *) $ptr | |
1096 | else | |
1097 | print (struct font *) $ptr | |
1098 | end | |
1099 | end | |
1100 | end | |
1101 | document xfont | |
1102 | Print $ assuming it is a list font (font-spec, font-entity, or font-object). | |
1103 | end | |
1104 | ||
24b4d1bc GM |
1105 | define xbacktrace |
1106 | set $bt = backtrace_list | |
177c0ea7 | 1107 | while $bt |
6b61353c | 1108 | xgettype (*$bt->function) |
3176a27e | 1109 | if $type == Lisp_Symbol |
6b61353c | 1110 | xprintsym (*$bt->function) |
c51842ec | 1111 | printf " (0x%x)\n", $bt->args |
3176a27e | 1112 | else |
cf07311b SM |
1113 | xgetptr *$bt->function |
1114 | printf "0x%x ", $ptr | |
3176a27e | 1115 | if $type == Lisp_Vectorlike |
6b61353c | 1116 | xgetptr (*$bt->function) |
cc7245e4 | 1117 | set $size = ((struct Lisp_Vector *) $ptr)->header.size |
1781b9e9 | 1118 | output ($size & PSEUDOVECTOR_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~ARRAY_MARK_FLAG |
3176a27e GM |
1119 | else |
1120 | printf "Lisp type %d", $type | |
1121 | end | |
1122 | echo \n | |
1123 | end | |
24b4d1bc GM |
1124 | set $bt = $bt->next |
1125 | end | |
1126 | end | |
1127 | document xbacktrace | |
1128 | Print a backtrace of Lisp function calls from backtrace_list. | |
177c0ea7 | 1129 | Set a breakpoint at Fsignal and call this to see from where |
3176a27e | 1130 | an error was signaled. |
24b4d1bc GM |
1131 | end |
1132 | ||
8b058d44 EZ |
1133 | define xprintbytestr |
1134 | set $data = (char *) $arg0->data | |
1135 | printf "Bytecode: " | |
1781b9e9 | 1136 | output/u ($arg0->size > 1000) ? 0 : ($data[0])@($arg0->size_byte < 0 ? $arg0->size & ~ARRAY_MARK_FLAG : $arg0->size_byte) |
8b058d44 EZ |
1137 | end |
1138 | document xprintbytestr | |
1139 | Print a string of byte code. | |
1140 | end | |
1141 | ||
1142 | define xwhichsymbols | |
1143 | set $output_debug = print_output_debug_flag | |
1144 | set print_output_debug_flag = 0 | |
1145 | set safe_debug_print (which_symbols ($arg0, $arg1)) | |
1146 | set print_output_debug_flag = $output_debug | |
28c1e1ca | 1147 | end |
8b058d44 | 1148 | document xwhichsymbols |
89955f2e | 1149 | Print symbols which references a given lisp object |
28c1e1ca | 1150 | either as its symbol value or symbol function. |
8b058d44 EZ |
1151 | Call with two arguments: the lisp object and the |
1152 | maximum number of symbols referencing it to produce. | |
28c1e1ca KS |
1153 | end |
1154 | ||
1155 | define xbytecode | |
1156 | set $bt = byte_stack_list | |
1157 | while $bt | |
8b058d44 EZ |
1158 | xgetptr $bt->byte_string |
1159 | set $ptr = (struct Lisp_String *) $ptr | |
1160 | xprintbytestr $ptr | |
1161 | printf "\n0x%x => ", $bt->byte_string | |
1162 | xwhichsymbols $bt->byte_string 5 | |
28c1e1ca KS |
1163 | set $bt = $bt->next |
1164 | end | |
1165 | end | |
1166 | document xbytecode | |
1167 | Print a backtrace of the byte code stack. | |
1168 | end | |
1169 | ||
338fa84a KS |
1170 | # Show Lisp backtrace after normal backtrace. |
1171 | define hookpost-backtrace | |
1172 | set $bt = backtrace_list | |
1173 | if $bt | |
1174 | echo \n | |
1175 | echo Lisp Backtrace:\n | |
1176 | xbacktrace | |
1177 | end | |
1178 | end | |
1179 | ||
6c5d0c52 KS |
1180 | # Flush display (X only) |
1181 | define ff | |
1182 | set x_flush (0) | |
1183 | end | |
1184 | document ff | |
1185 | Flush pending X window display updates to screen. | |
1186 | Works only when an inferior emacs is executing. | |
1187 | end | |
1188 | ||
1189 | ||
e065a56e | 1190 | set print pretty on |
df86e57e | 1191 | set print sevenbit-strings |
a6ffc6a2 | 1192 | |
e5d77022 | 1193 | show environment DISPLAY |
6f5d1a4f | 1194 | show environment TERM |
e5d77022 | 1195 | |
c2c50958 | 1196 | # People get bothered when they see messages about non-existent functions... |
2787bba3 | 1197 | xgetptr globals.f_Vsystem_type |
ea5f3ad4 EZ |
1198 | # $ptr is NULL in temacs |
1199 | if ($ptr != 0) | |
1200 | set $tem = (struct Lisp_Symbol *) $ptr | |
1201 | xgetptr $tem->xname | |
1202 | set $tem = (struct Lisp_String *) $ptr | |
1203 | set $tem = (char *) $tem->data | |
1204 | ||
1205 | # Don't let abort actually run, as it will make stdio stop working and | |
1206 | # therefore the `pr' command above as well. | |
1207 | if $tem[0] == 'w' && $tem[1] == 'i' && $tem[2] == 'n' && $tem[3] == 'd' | |
1208 | # The windows-nt build replaces abort with its own function. | |
1209 | break w32_abort | |
1210 | else | |
1211 | break abort | |
1212 | end | |
feaf060a | 1213 | end |
dd878ee1 | 1214 | |
feaf060a EZ |
1215 | # x_error_quitter is defined only on X. But window-system is set up |
1216 | # only at run time, during Emacs startup, so we need to defer setting | |
1217 | # the breakpoint. init_sys_modes is the first function called on | |
1218 | # every platform after init_display, where window-system is set. | |
1219 | tbreak init_sys_modes | |
1220 | commands | |
1221 | silent | |
2787bba3 | 1222 | xgetptr globals.f_Vinitial_window_system |
913645cd EZ |
1223 | set $tem = (struct Lisp_Symbol *) $ptr |
1224 | xgetptr $tem->xname | |
1225 | set $tem = (struct Lisp_String *) $ptr | |
1226 | set $tem = (char *) $tem->data | |
feaf060a EZ |
1227 | # If we are running in synchronous mode, we want a chance to look |
1228 | # around before Emacs exits. Perhaps we should put the break | |
1229 | # somewhere else instead... | |
913645cd | 1230 | if $tem[0] == 'x' && $tem[1] == '\0' |
2d90e492 | 1231 | break x_error_quitter |
913645cd | 1232 | end |
feaf060a | 1233 | continue |
dd878ee1 | 1234 | end |