Mercurial > hg > xemacs-beta
annotate etc/gdbinit.in @ 4935:7ef913bf3c9a
modify gdbinit to track Makefile.in.in, add command for update-elc-2
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Tue, 19 Jan 2010 01:24:21 -0600 |
parents | e9ccbc62f7e7 |
children |
rev | line source |
---|---|
3418 | 1 ## gdb init file for XEmacs -*- ksh -*- |
2 ## This is the source for src/.gdbinit. Edit it, and rerun configure. | |
3 ## (Running config.status is not enough.) | |
4 ## The generated file depends on src/config.h (currently only in one place). | |
5 | |
6 ## To insert comments that will remain in the generated file, we use the | |
7 ## imake XCOMM convention. Lines beginning with "XCOMM " exactly (no | |
8 ## leading whitespace, one trailing ASCII space, case sensitive) will be | |
9 ## transformed to gdb command file comments in the generated file. | |
10 | |
11 XCOMM gdb init file for XEmacs | |
12 XCOMM AUTOMATICALLY GENERATED FROM etc/gdbinit.in BY configure -- DO NOT EDIT. | |
13 XCOMM See etc/gdbinit.in for licensing information and usage hints. | |
14 XCOMM Copyright (C) 1998 Free Software Foundation, Inc. | |
15 | |
16 ## This file is part of XEmacs. | |
17 | |
18 ## XEmacs is free software; you can redistribute it and/or modify it | |
19 ## under the terms of the GNU General Public License as published by the | |
20 ## Free Software Foundation; either version 2, or (at your option) any | |
21 ## later version. | |
22 | |
23 ## XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
24 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
25 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
26 ## for more details. | |
27 | |
28 ## You should have received a copy of the GNU General Public License | |
29 ## along with XEmacs; see the file COPYING. If not, write to | |
30 ## the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
31 ## Boston, MA 02110-1301 USA | |
32 | |
33 ## Author: Martin Buchholz | |
34 | |
35 ## Other contributors you could ask for help: Ivan Golubev, Jerry James, | |
36 ## Stephen Turnbull. | |
37 | |
38 ## Some useful commands for debugging emacs with gdb 4.16 or better. | |
39 ## | |
40 ## Since this file is called `.gdbinit', it will be read by gdb | |
41 ## automatically when gdb is run in the build directory, which is where | |
42 ## developers usually debug their xemacs. You can also source this | |
43 ## file from your ~/.gdbinit, if you like. | |
44 ## | |
45 ## Configure xemacs with --debug, and compile with -g. | |
46 ## | |
47 ## See also the question of the XEmacs FAQ, titled | |
48 ## "How to Debug an XEmacs problem with a debugger". | |
49 ## | |
50 ## This can be used to debug XEmacs no matter how the following are | |
51 ## specified: | |
52 | |
53 ## USE_UNION_TYPE | |
54 | |
55 ## (the above all have configure equivalents) | |
56 | |
57 ## Some functions defined here require a running process, but most | |
58 ## don't. Considerable effort has been expended to this end. | |
59 | |
60 ## See the dbg_ C support code in src/alloc.c that allows the functions | |
61 ## defined in this file to work correctly. | |
62 | |
63 #define NOT_C_CODE | |
64 #include "config.h" | |
65 | |
66 set print union off | |
67 set print pretty off | |
68 | |
69 #ifdef VDB_POSIX | |
70 handle SIGSEGV SIGBUS nostop noprint | |
71 #endif | |
72 | |
73 set $Lisp_Type_Int = -2 | |
4643
e9ccbc62f7e7
Don't rely on GDB understanding the Lisp_Type_{Record,Char} enums, gdbinit.in
Aidan Kehoe <kehoea@parhasard.net>
parents:
3934
diff
changeset
|
74 set $Lisp_Type_Record = 0 |
e9ccbc62f7e7
Don't rely on GDB understanding the Lisp_Type_{Record,Char} enums, gdbinit.in
Aidan Kehoe <kehoea@parhasard.net>
parents:
3934
diff
changeset
|
75 set $Lisp_Type_Char = 2 |
3418 | 76 |
77 define decode_object | |
78 set $obj = (unsigned long) $arg0 | |
79 if $obj & 1 | |
80 ## It's an int | |
81 set $val = $obj >> 1 | |
82 set $type = $Lisp_Type_Int | |
83 else | |
84 set $type = $obj & dbg_typemask | |
4643
e9ccbc62f7e7
Don't rely on GDB understanding the Lisp_Type_{Record,Char} enums, gdbinit.in
Aidan Kehoe <kehoea@parhasard.net>
parents:
3934
diff
changeset
|
85 if $type == $Lisp_Type_Char |
3418 | 86 set $val = ($obj & dbg_valmask) >> dbg_gctypebits |
87 else | |
88 ## It's a record pointer | |
89 set $val = $obj | |
90 end | |
91 end | |
92 | |
4643
e9ccbc62f7e7
Don't rely on GDB understanding the Lisp_Type_{Record,Char} enums, gdbinit.in
Aidan Kehoe <kehoea@parhasard.net>
parents:
3934
diff
changeset
|
93 if $type == $Lisp_Type_Record |
3418 | 94 set $lheader = ((struct lrecord_header *) $val) |
95 set $lrecord_type = ($lheader->type) | |
96 set $imp = ((struct lrecord_implementation *) lrecord_implementations_table[(int) $lrecord_type]) | |
97 else | |
98 set $lrecord_type = -1 | |
99 set $lheader = -1 | |
100 set $imp = -1 | |
101 end | |
102 end | |
103 | |
104 document decode_object | |
105 Usage: decode_object lisp_object | |
106 Extract implementation information from a Lisp Object. | |
107 Defines variables $val, $type and $imp. | |
108 end | |
109 | |
110 define xint | |
111 decode_object $arg0 | |
112 print ((long) $val) | |
113 end | |
114 | |
115 define xtype | |
116 decode_object $arg0 | |
117 if $type == $Lisp_Type_Int | |
118 echo int\n | |
119 else | |
4643
e9ccbc62f7e7
Don't rely on GDB understanding the Lisp_Type_{Record,Char} enums, gdbinit.in
Aidan Kehoe <kehoea@parhasard.net>
parents:
3934
diff
changeset
|
120 if $type == $Lisp_Type_Char |
3418 | 121 echo char\n |
122 else | |
123 printf "record type: %s\n", $imp->name | |
124 end | |
125 end | |
126 end | |
127 | |
128 document xtype | |
129 Usage: xtype lisp_object | |
130 Print the Lisp type of a lisp object. | |
131 end | |
132 | |
133 define lisp-shadows | |
134 run -batch -vanilla -f list-load-path-shadows | |
135 end | |
136 | |
137 document lisp-shadows | |
138 Usage: lisp-shadows | |
139 Run xemacs to check for lisp shadows | |
140 end | |
141 | |
142 define environment-to-run-temacs | |
143 unset env EMACSLOADPATH | |
144 set env EMACSBOOTSTRAPLOADPATH=../lisp/:.. | |
145 set env EMACSBOOTSTRAPMODULEPATH=../modules/:.. | |
146 end | |
147 | |
148 define run-temacs | |
149 environment-to-run-temacs | |
4935
7ef913bf3c9a
modify gdbinit to track Makefile.in.in, add command for update-elc-2
Ben Wing <ben@xemacs.org>
parents:
4643
diff
changeset
|
150 run -nd -no-packages -batch -l ../lisp/loadup.el run-temacs -q |
3418 | 151 end |
152 | |
153 document run-temacs | |
154 Usage: run-temacs | |
155 Run temacs interactively, like xemacs. | |
156 Use this with debugging tools (like purify) that cannot deal with dumping, | |
157 or when temacs builds successfully, but xemacs does not. | |
158 end | |
159 | |
160 define check-xemacs | |
161 run -batch -l ../tests/automated/test-harness.el -f batch-test-emacs ../tests/automated | |
162 end | |
163 | |
164 document check-xemacs | |
165 Usage: check-xemacs | |
166 Run the test suite. Equivalent to 'make check'. | |
167 end | |
168 | |
169 define check-temacs | |
170 environment-to-run-temacs | |
4935
7ef913bf3c9a
modify gdbinit to track Makefile.in.in, add command for update-elc-2
Ben Wing <ben@xemacs.org>
parents:
4643
diff
changeset
|
171 run -nd -no-packages -batch -l ../lisp/loadup.el run-temacs -q -batch -l ../tests/automated/test-harness.el -f batch-test-emacs ../tests/automated |
3418 | 172 end |
173 | |
174 document check-temacs | |
175 Usage: check-temacs | |
176 Run the test suite on temacs. Equivalent to 'make check-temacs'. | |
177 Use this with debugging tools (like purify) that cannot deal with dumping, | |
178 or when temacs builds successfully, but xemacs does not. | |
179 end | |
180 | |
181 define update-elc | |
182 environment-to-run-temacs | |
4935
7ef913bf3c9a
modify gdbinit to track Makefile.in.in, add command for update-elc-2
Ben Wing <ben@xemacs.org>
parents:
4643
diff
changeset
|
183 run -nd -no-packages -batch -l ../lisp/update-elc.el |
3418 | 184 end |
185 | |
186 document update-elc | |
187 Usage: update-elc | |
188 Run the core lisp byte compilation part of the build procedure. | |
189 Use when debugging temacs, not xemacs! | |
190 Use this when temacs builds successfully, but xemacs does not. | |
191 end | |
192 | |
4935
7ef913bf3c9a
modify gdbinit to track Makefile.in.in, add command for update-elc-2
Ben Wing <ben@xemacs.org>
parents:
4643
diff
changeset
|
193 define update-elc-2 |
7ef913bf3c9a
modify gdbinit to track Makefile.in.in, add command for update-elc-2
Ben Wing <ben@xemacs.org>
parents:
4643
diff
changeset
|
194 environment-to-run-temacs |
7ef913bf3c9a
modify gdbinit to track Makefile.in.in, add command for update-elc-2
Ben Wing <ben@xemacs.org>
parents:
4643
diff
changeset
|
195 run -no-packages -batch -no-autoloads -l update-elc-2.el -f batch-update-elc-2 ../lisp |
7ef913bf3c9a
modify gdbinit to track Makefile.in.in, add command for update-elc-2
Ben Wing <ben@xemacs.org>
parents:
4643
diff
changeset
|
196 end |
7ef913bf3c9a
modify gdbinit to track Makefile.in.in, add command for update-elc-2
Ben Wing <ben@xemacs.org>
parents:
4643
diff
changeset
|
197 |
7ef913bf3c9a
modify gdbinit to track Makefile.in.in, add command for update-elc-2
Ben Wing <ben@xemacs.org>
parents:
4643
diff
changeset
|
198 document update-elc-2 |
7ef913bf3c9a
modify gdbinit to track Makefile.in.in, add command for update-elc-2
Ben Wing <ben@xemacs.org>
parents:
4643
diff
changeset
|
199 Usage: update-elc-2 |
7ef913bf3c9a
modify gdbinit to track Makefile.in.in, add command for update-elc-2
Ben Wing <ben@xemacs.org>
parents:
4643
diff
changeset
|
200 Run the post-dump core lisp byte compilation part of the build procedure. |
7ef913bf3c9a
modify gdbinit to track Makefile.in.in, add command for update-elc-2
Ben Wing <ben@xemacs.org>
parents:
4643
diff
changeset
|
201 end |
7ef913bf3c9a
modify gdbinit to track Makefile.in.in, add command for update-elc-2
Ben Wing <ben@xemacs.org>
parents:
4643
diff
changeset
|
202 |
3418 | 203 define dmp |
204 environment-to-run-temacs | |
4935
7ef913bf3c9a
modify gdbinit to track Makefile.in.in, add command for update-elc-2
Ben Wing <ben@xemacs.org>
parents:
4643
diff
changeset
|
205 run -nd -no-packages -batch -l ../lisp/loadup.el dump |
3418 | 206 end |
207 | |
208 document dmp | |
209 Usage: dmp | |
210 Run the dumping part of the build procedure. | |
211 Use when debugging temacs, not xemacs! | |
212 Use this when temacs builds successfully, but xemacs does not. | |
213 end | |
214 | |
215 define ldp | |
216 printf "%s", "Lisp => " | |
217 call debug_print($arg0) | |
218 end | |
219 | |
220 document ldp | |
221 Usage: ldp lisp_object | |
222 Print a Lisp Object value using the Lisp printer. | |
223 Requires a running xemacs process. | |
224 end | |
225 | |
226 define lbt | |
227 call debug_backtrace() | |
228 end | |
229 | |
230 document lbt | |
231 Usage: lbt | |
232 Print the current Lisp stack trace. | |
233 Requires a running xemacs process. | |
234 end | |
235 | |
236 | |
237 define leval | |
238 ldp Feval(Fcar(Fread_from_string(build_string($arg0),Qnil,Qnil))) | |
239 end | |
240 | |
241 document leval | |
242 Usage: leval "SEXP" | |
243 Eval a lisp expression. | |
244 Requires a running xemacs process. | |
245 | |
246 Example: | |
247 (gdb) leval "(+ 1 2)" | |
248 Lisp ==> 3 | |
249 end | |
250 | |
251 | |
252 define wtype | |
253 print $arg0->core.widget_class->core_class.class_name | |
254 end | |
255 | |
256 define xtname | |
257 print XrmQuarkToString(((Object)($arg0))->object.xrm_name) | |
258 end | |
259 | |
260 ## GDB's command language makes you want to ... | |
261 | |
262 define pptype | |
263 set $type_ptr = ($arg0 *) $val | |
264 print $type_ptr | |
265 print *$type_ptr | |
266 end | |
267 | |
268 define pstructtype | |
269 set $type_ptr = (struct $arg0 *) $val | |
270 print $type_ptr | |
271 print *$type_ptr | |
272 end | |
273 | |
274 define pobj | |
275 decode_object $arg0 | |
276 if $type == $Lisp_Type_Int | |
277 printf "Integer: %d\n", $val | |
278 else | |
4643
e9ccbc62f7e7
Don't rely on GDB understanding the Lisp_Type_{Record,Char} enums, gdbinit.in
Aidan Kehoe <kehoea@parhasard.net>
parents:
3934
diff
changeset
|
279 if $type == $Lisp_Type_Char |
3418 | 280 if $val > 32 && $val < 128 |
281 printf "Char: %c\n", $val | |
282 else | |
283 printf "Char: %d\n", $val | |
284 end | |
285 else | |
286 if $lrecord_type == lrecord_type_string | |
287 pptype Lisp_String | |
288 else | |
289 if $lrecord_type == lrecord_type_cons | |
290 pptype Lisp_Cons | |
291 else | |
292 if $lrecord_type == lrecord_type_symbol | |
293 pptype Lisp_Symbol | |
294 printf "Symbol name: %s\n", ((Lisp_String *)$type_ptr->name)->data_ | |
295 else | |
296 if $lrecord_type == lrecord_type_vector | |
297 pptype Lisp_Vector | |
298 printf "Vector of length %d\n", $type_ptr->size | |
299 ##print *($type_ptr->data) @ $type_ptr->size | |
300 else | |
301 if $lrecord_type == lrecord_type_bit_vector | |
302 pptype Lisp_Bit_Vector | |
303 else | |
304 if $lrecord_type == lrecord_type_buffer | |
305 pstructtype buffer | |
306 else | |
307 if $lrecord_type == lrecord_type_char_table | |
308 pptype Lisp_Char_Table | |
309 else | |
310 if $lrecord_type == lrecord_type_char_table_entry | |
311 pptype Lisp_Char_Table_Entry | |
312 else | |
313 if $lrecord_type == lrecord_type_charset | |
314 pptype Lisp_Charset | |
315 else | |
316 if $lrecord_type == lrecord_type_coding_system | |
317 pptype Lisp_Coding_System | |
318 else | |
319 if $lrecord_type == lrecord_type_color_instance | |
320 pptype Lisp_Color_Instance | |
321 else | |
322 if $lrecord_type == lrecord_type_command_builder | |
323 pptype command_builder | |
324 else | |
325 if $lrecord_type == lrecord_type_compiled_function | |
326 pptype Lisp_Compiled_Function | |
327 else | |
328 if $lrecord_type == lrecord_type_console | |
329 pstructtype console | |
330 else | |
331 if $lrecord_type == lrecord_type_database | |
332 pptype Lisp_Database | |
333 else | |
334 if $lrecord_type == lrecord_type_device | |
335 pstructtype device | |
336 else | |
337 if $lrecord_type == lrecord_type_event | |
338 pptype Lisp_Event | |
339 else | |
340 if $lrecord_type == lrecord_type_extent | |
341 pstructtype extent | |
342 else | |
343 if $lrecord_type == lrecord_type_extent_auxiliary | |
344 pstructtype extent_auxiliary | |
345 else | |
346 if $lrecord_type == lrecord_type_extent_info | |
347 pstructtype extent_info | |
348 else | |
349 if $lrecord_type == lrecord_type_face | |
350 pptype Lisp_Face | |
351 else | |
352 if $lrecord_type == lrecord_type_float | |
353 pptype Lisp_Float | |
354 else | |
355 if $lrecord_type == lrecord_type_font_instance | |
356 pptype Lisp_Font_Instance | |
357 else | |
358 if $lrecord_type == lrecord_type_frame | |
359 pstructtype frame | |
360 else | |
361 if $lrecord_type == lrecord_type_glyph | |
362 pptype Lisp_Glyph | |
363 else | |
364 if $lrecord_type == lrecord_type_gui_item | |
365 pptype Lisp_Gui_Item | |
366 else | |
367 if $lrecord_type == lrecord_type_hash_table | |
368 pptype Lisp_Hash_Table | |
369 else | |
370 if $lrecord_type == lrecord_type_image_instance | |
371 pptype Lisp_Image_Instance | |
372 else | |
373 if $lrecord_type == lrecord_type_keymap | |
374 pptype Lisp_Keymap | |
375 else | |
376 if $lrecord_type == lrecord_type_lcrecord_list | |
377 pstructtype lcrecord_list | |
378 else | |
379 if $lrecord_type == lrecord_type_ldap | |
380 pptype Lisp_LDAP | |
381 else | |
382 if $lrecord_type == lrecord_type_lstream | |
383 pstructtype lstream | |
384 else | |
385 if $lrecord_type == lrecord_type_marker | |
386 pptype Lisp_Marker | |
387 else | |
388 if $lrecord_type == lrecord_type_opaque | |
389 pptype Lisp_Opaque | |
390 else | |
391 if $lrecord_type == lrecord_type_opaque_ptr | |
392 pptype Lisp_Opaque_Ptr | |
393 else | |
394 if $lrecord_type == lrecord_type_popup_data | |
395 pptype popup_data | |
396 else | |
397 if $lrecord_type == lrecord_type_process | |
398 pptype Lisp_Process | |
399 else | |
400 if $lrecord_type == lrecord_type_range_table | |
401 pptype Lisp_Range_Table | |
402 else | |
403 if $lrecord_type == lrecord_type_specifier | |
404 pptype Lisp_Specifier | |
405 else | |
406 if $lrecord_type == lrecord_type_subr | |
407 pptype Lisp_Subr | |
408 else | |
409 if $lrecord_type == lrecord_type_symbol_value_buffer_local | |
410 pstructtype symbol_value_buffer_local | |
411 else | |
412 if $lrecord_type == lrecord_type_symbol_value_forward | |
413 pstructtype symbol_value_forward | |
414 else | |
415 if $lrecord_type == lrecord_type_symbol_value_lisp_magic | |
416 pstructtype symbol_value_lisp_magic | |
417 else | |
418 if $lrecord_type == lrecord_type_symbol_value_varalias | |
419 pstructtype symbol_value_varalias | |
420 else | |
421 if $lrecord_type == lrecord_type_timeout | |
422 pptype Lisp_Timeout | |
423 else | |
424 if $lrecord_type == lrecord_type_toolbar_button | |
425 pstructtype toolbar_button | |
426 else | |
427 if $lrecord_type == lrecord_type_tooltalk_message | |
428 pptype Lisp_Tooltalk_Message | |
429 else | |
430 if $lrecord_type == lrecord_type_tooltalk_pattern | |
431 pptype Lisp_Tooltalk_Pattern | |
432 else | |
433 if $lrecord_type == lrecord_type_weak_list | |
434 pstructtype weak_list | |
435 else | |
436 if $lrecord_type == lrecord_type_window | |
437 pstructtype window | |
438 else | |
439 if $lrecord_type == lrecord_type_window_configuration | |
440 pstructtype window_config | |
441 else | |
442 if $lrecord_type == lrecord_type_fc_pattern | |
443 pstructtype fc_pattern | |
444 else | |
3934 | 445 if $lrecord_type == lrecord_type_fc_config |
446 pstructtype fc_config | |
3418 | 447 else |
448 echo Unknown Lisp Object type\n | |
449 print $arg0 | |
450 ## Barf, gag, retch | |
451 end | |
452 end | |
453 end | |
454 end | |
455 end | |
456 end | |
457 end | |
458 end | |
459 end | |
460 end | |
461 end | |
462 end | |
463 end | |
464 end | |
465 end | |
466 end | |
467 end | |
468 end | |
469 end | |
470 ## Repeat after me... gdb sux, gdb sux, gdb sux... | |
471 end | |
472 end | |
473 end | |
474 end | |
475 end | |
476 end | |
477 end | |
478 end | |
479 end | |
480 end | |
481 end | |
482 end | |
483 end | |
484 end | |
485 end | |
486 end | |
487 end | |
488 end | |
489 ## Are we having fun yet?? | |
490 end | |
491 end | |
492 end | |
493 end | |
494 end | |
495 end | |
496 end | |
497 end | |
498 end | |
499 end | |
500 end | |
501 end | |
502 end | |
503 end | |
504 end | |
505 end | |
506 end | |
507 end | |
508 end | |
509 | |
510 document pobj | |
511 Usage: pobj lisp_object | |
512 Print the internal C representation of a Lisp Object. | |
513 end | |
514 | |
515 ## ------------------------------------------------------------- | |
516 ## functions to test the debugging support itself. | |
517 ## If you change this file, make sure the following still work... | |
518 ## ------------------------------------------------------------- | |
519 define test_xtype | |
520 printf "Vemacs_major_version: " | |
521 xtype Vemacs_major_version | |
522 printf "Vhelp_char: " | |
523 xtype Vhelp_char | |
524 printf "Qnil: " | |
525 xtype Qnil | |
526 printf "Qunbound: " | |
527 xtype Qunbound | |
528 printf "Vobarray: " | |
529 xtype Vobarray | |
530 printf "Vall_weak_lists: " | |
531 xtype Vall_weak_lists | |
532 printf "Vxemacs_codename: " | |
533 xtype Vxemacs_codename | |
534 end | |
535 | |
536 define test_pobj | |
537 printf "Vemacs_major_version: " | |
538 pobj Vemacs_major_version | |
539 printf "Vhelp_char: " | |
540 pobj Vhelp_char | |
541 printf "Qnil: " | |
542 pobj Qnil | |
543 printf "Qunbound: " | |
544 pobj Qunbound | |
545 printf "Vobarray: " | |
546 pobj Vobarray | |
547 printf "Vall_weak_lists: " | |
548 pobj Vall_weak_lists | |
549 printf "Vxemacs_codename: " | |
550 pobj Vxemacs_codename | |
551 end | |
552 |