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