gdb smob cleanups
[deliverable/binutils-gdb.git] / gdb / guile / scm-symtab.c
1 /* Scheme interface to symbol tables.
2
3 Copyright (C) 2008-2014 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 /* See README file in this directory for implementation notes, coding
21 conventions, et.al. */
22
23 #include "defs.h"
24 #include "symtab.h"
25 #include "source.h"
26 #include "objfiles.h"
27 #include "block.h"
28 #include "guile-internal.h"
29
30 /* A <gdb:symtab> smob. */
31
32 typedef struct
33 {
34 /* This always appears first.
35 eqable_gdb_smob is used so that symtabs are eq?-able.
36 Also, a symtab object is associated with an objfile. eqable_gdb_smob
37 lets us track the lifetime of all symtabs associated with an objfile.
38 When an objfile is deleted we need to invalidate the symtab object. */
39 eqable_gdb_smob base;
40
41 /* The GDB symbol table structure.
42 If this is NULL the symtab is invalid. This can happen when the
43 underlying objfile is freed. */
44 struct symtab *symtab;
45 } symtab_smob;
46
47 /* A <gdb:sal> smob.
48 A smob describing a gdb symtab-and-line object.
49 A sal is associated with an objfile. All access must be gated by checking
50 the validity of symtab_scm.
51 TODO: Sals are not eq?-able at the moment, or even comparable. */
52
53 typedef struct
54 {
55 /* This always appears first. */
56 gdb_smob base;
57
58 /* The <gdb:symtab> object of the symtab.
59 We store this instead of a pointer to the symtab_smob because it's not
60 clear GC will know the symtab_smob is referenced by us otherwise, and we
61 need quick access to symtab_smob->symtab to know if this sal is valid. */
62 SCM symtab_scm;
63
64 /* The GDB symbol table and line structure.
65 This object is ephemeral in GDB, so keep our own copy.
66 The symtab pointer in this struct is not usable: If the symtab is deleted
67 this pointer will not be updated. Use symtab_scm instead to determine
68 if this sal is valid. */
69 struct symtab_and_line sal;
70 } sal_smob;
71
72 static const char symtab_smob_name[] = "gdb:symtab";
73 /* "symtab-and-line" is pretty long, and "sal" is short and unique. */
74 static const char sal_smob_name[] = "gdb:sal";
75
76 /* The tags Guile knows the symbol table smobs by. */
77 static scm_t_bits symtab_smob_tag;
78 static scm_t_bits sal_smob_tag;
79
80 static const struct objfile_data *stscm_objfile_data_key;
81 \f
82 /* Administrivia for symtab smobs. */
83
84 /* Helper function to hash a symbol_smob. */
85
86 static hashval_t
87 stscm_hash_symtab_smob (const void *p)
88 {
89 const symtab_smob *st_smob = p;
90
91 return htab_hash_pointer (st_smob->symtab);
92 }
93
94 /* Helper function to compute equality of symtab_smobs. */
95
96 static int
97 stscm_eq_symtab_smob (const void *ap, const void *bp)
98 {
99 const symtab_smob *a = ap;
100 const symtab_smob *b = bp;
101
102 return (a->symtab == b->symtab
103 && a->symtab != NULL);
104 }
105
106 /* Return the struct symtab pointer -> SCM mapping table.
107 It is created if necessary. */
108
109 static htab_t
110 stscm_objfile_symtab_map (struct symtab *symtab)
111 {
112 struct objfile *objfile = symtab->objfile;
113 htab_t htab = objfile_data (objfile, stscm_objfile_data_key);
114
115 if (htab == NULL)
116 {
117 htab = gdbscm_create_eqable_gsmob_ptr_map (stscm_hash_symtab_smob,
118 stscm_eq_symtab_smob);
119 set_objfile_data (objfile, stscm_objfile_data_key, htab);
120 }
121
122 return htab;
123 }
124
125 /* The smob "mark" function for <gdb:symtab>. */
126
127 static SCM
128 stscm_mark_symtab_smob (SCM self)
129 {
130 return SCM_BOOL_F;
131 }
132
133 /* The smob "free" function for <gdb:symtab>. */
134
135 static size_t
136 stscm_free_symtab_smob (SCM self)
137 {
138 symtab_smob *st_smob = (symtab_smob *) SCM_SMOB_DATA (self);
139
140 if (st_smob->symtab != NULL)
141 {
142 htab_t htab = stscm_objfile_symtab_map (st_smob->symtab);
143
144 gdbscm_clear_eqable_gsmob_ptr_slot (htab, &st_smob->base);
145 }
146
147 /* Not necessary, done to catch bugs. */
148 st_smob->symtab = NULL;
149
150 return 0;
151 }
152
153 /* The smob "print" function for <gdb:symtab>. */
154
155 static int
156 stscm_print_symtab_smob (SCM self, SCM port, scm_print_state *pstate)
157 {
158 symtab_smob *st_smob = (symtab_smob *) SCM_SMOB_DATA (self);
159
160 gdbscm_printf (port, "#<%s ", symtab_smob_name);
161 gdbscm_printf (port, "%s",
162 st_smob->symtab != NULL
163 ? symtab_to_filename_for_display (st_smob->symtab)
164 : "<invalid>");
165 scm_puts (">", port);
166
167 scm_remember_upto_here_1 (self);
168
169 /* Non-zero means success. */
170 return 1;
171 }
172
173 /* Low level routine to create a <gdb:symtab> object. */
174
175 static SCM
176 stscm_make_symtab_smob (void)
177 {
178 symtab_smob *st_smob = (symtab_smob *)
179 scm_gc_malloc (sizeof (symtab_smob), symtab_smob_name);
180 SCM st_scm;
181
182 st_smob->symtab = NULL;
183 st_scm = scm_new_smob (symtab_smob_tag, (scm_t_bits) st_smob);
184 gdbscm_init_eqable_gsmob (&st_smob->base, st_scm);
185
186 return st_scm;
187 }
188
189 /* Return non-zero if SCM is a symbol table smob. */
190
191 static int
192 stscm_is_symtab (SCM scm)
193 {
194 return SCM_SMOB_PREDICATE (symtab_smob_tag, scm);
195 }
196
197 /* (symtab? object) -> boolean */
198
199 static SCM
200 gdbscm_symtab_p (SCM scm)
201 {
202 return scm_from_bool (stscm_is_symtab (scm));
203 }
204
205 /* Create a new <gdb:symtab> object that encapsulates SYMTAB. */
206
207 SCM
208 stscm_scm_from_symtab (struct symtab *symtab)
209 {
210 htab_t htab;
211 eqable_gdb_smob **slot;
212 symtab_smob *st_smob, st_smob_for_lookup;
213 SCM st_scm;
214
215 /* If we've already created a gsmob for this symtab, return it.
216 This makes symtabs eq?-able. */
217 htab = stscm_objfile_symtab_map (symtab);
218 st_smob_for_lookup.symtab = symtab;
219 slot = gdbscm_find_eqable_gsmob_ptr_slot (htab, &st_smob_for_lookup.base);
220 if (*slot != NULL)
221 return (*slot)->containing_scm;
222
223 st_scm = stscm_make_symtab_smob ();
224 st_smob = (symtab_smob *) SCM_SMOB_DATA (st_scm);
225 st_smob->symtab = symtab;
226 gdbscm_fill_eqable_gsmob_ptr_slot (slot, &st_smob->base);
227
228 return st_scm;
229 }
230
231 /* Returns the <gdb:symtab> object in SELF.
232 Throws an exception if SELF is not a <gdb:symtab> object. */
233
234 static SCM
235 stscm_get_symtab_arg_unsafe (SCM self, int arg_pos, const char *func_name)
236 {
237 SCM_ASSERT_TYPE (stscm_is_symtab (self), self, arg_pos, func_name,
238 symtab_smob_name);
239
240 return self;
241 }
242
243 /* Returns a pointer to the symtab smob of SELF.
244 Throws an exception if SELF is not a <gdb:symtab> object. */
245
246 static symtab_smob *
247 stscm_get_symtab_smob_arg_unsafe (SCM self, int arg_pos, const char *func_name)
248 {
249 SCM st_scm = stscm_get_symtab_arg_unsafe (self, arg_pos, func_name);
250 symtab_smob *st_smob = (symtab_smob *) SCM_SMOB_DATA (st_scm);
251
252 return st_smob;
253 }
254
255 /* Return non-zero if symtab ST_SMOB is valid. */
256
257 static int
258 stscm_is_valid (symtab_smob *st_smob)
259 {
260 return st_smob->symtab != NULL;
261 }
262
263 /* Throw a Scheme error if SELF is not a valid symtab smob.
264 Otherwise return a pointer to the symtab_smob object. */
265
266 static symtab_smob *
267 stscm_get_valid_symtab_smob_arg_unsafe (SCM self, int arg_pos,
268 const char *func_name)
269 {
270 symtab_smob *st_smob
271 = stscm_get_symtab_smob_arg_unsafe (self, arg_pos, func_name);
272
273 if (!stscm_is_valid (st_smob))
274 {
275 gdbscm_invalid_object_error (func_name, arg_pos, self,
276 _("<gdb:symtab>"));
277 }
278
279 return st_smob;
280 }
281
282 /* Helper function for stscm_del_objfile_symtabs to mark the symtab
283 as invalid. */
284
285 static int
286 stscm_mark_symtab_invalid (void **slot, void *info)
287 {
288 symtab_smob *st_smob = (symtab_smob *) *slot;
289
290 st_smob->symtab = NULL;
291 return 1;
292 }
293
294 /* This function is called when an objfile is about to be freed.
295 Invalidate the symbol table as further actions on the symbol table
296 would result in bad data. All access to st_smob->symtab should be
297 gated by stscm_get_valid_symtab_smob_arg_unsafe which will raise an
298 exception on invalid symbol tables. */
299
300 static void
301 stscm_del_objfile_symtabs (struct objfile *objfile, void *datum)
302 {
303 htab_t htab = datum;
304
305 if (htab != NULL)
306 {
307 htab_traverse_noresize (htab, stscm_mark_symtab_invalid, NULL);
308 htab_delete (htab);
309 }
310 }
311 \f
312 /* Symbol table methods. */
313
314 /* (symtab-valid? <gdb:symtab>) -> boolean
315 Returns #t if SELF still exists in GDB. */
316
317 static SCM
318 gdbscm_symtab_valid_p (SCM self)
319 {
320 symtab_smob *st_smob
321 = stscm_get_symtab_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
322
323 return scm_from_bool (stscm_is_valid (st_smob));
324 }
325
326 /* (symtab-filename <gdb:symtab>) -> string */
327
328 static SCM
329 gdbscm_symtab_filename (SCM self)
330 {
331 symtab_smob *st_smob
332 = stscm_get_valid_symtab_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
333 struct symtab *symtab = st_smob->symtab;
334
335 return gdbscm_scm_from_c_string (symtab_to_filename_for_display (symtab));
336 }
337
338 /* (symtab-fullname <gdb:symtab>) -> string */
339
340 static SCM
341 gdbscm_symtab_fullname (SCM self)
342 {
343 symtab_smob *st_smob
344 = stscm_get_valid_symtab_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
345 struct symtab *symtab = st_smob->symtab;
346
347 return gdbscm_scm_from_c_string (symtab_to_fullname (symtab));
348 }
349
350 /* (symtab-objfile <gdb:symtab>) -> <gdb:objfile> */
351
352 static SCM
353 gdbscm_symtab_objfile (SCM self)
354 {
355 symtab_smob *st_smob
356 = stscm_get_valid_symtab_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
357 const struct symtab *symtab = st_smob->symtab;
358
359 return ofscm_scm_from_objfile (symtab->objfile);
360 }
361
362 /* (symtab-global-block <gdb:symtab>) -> <gdb:block>
363 Return the GLOBAL_BLOCK of the underlying symtab. */
364
365 static SCM
366 gdbscm_symtab_global_block (SCM self)
367 {
368 symtab_smob *st_smob
369 = stscm_get_valid_symtab_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
370 const struct symtab *symtab = st_smob->symtab;
371 const struct blockvector *blockvector;
372 const struct block *block;
373
374 blockvector = BLOCKVECTOR (symtab);
375 block = BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK);
376
377 return bkscm_scm_from_block (block, symtab->objfile);
378 }
379
380 /* (symtab-static-block <gdb:symtab>) -> <gdb:block>
381 Return the STATIC_BLOCK of the underlying symtab. */
382
383 static SCM
384 gdbscm_symtab_static_block (SCM self)
385 {
386 symtab_smob *st_smob
387 = stscm_get_valid_symtab_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
388 const struct symtab *symtab = st_smob->symtab;
389 const struct blockvector *blockvector;
390 const struct block *block;
391
392 blockvector = BLOCKVECTOR (symtab);
393 block = BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK);
394
395 return bkscm_scm_from_block (block, symtab->objfile);
396 }
397 \f
398 /* Administrivia for sal (symtab-and-line) smobs. */
399
400 /* The smob "mark" function for <gdb:sal>. */
401
402 static SCM
403 stscm_mark_sal_smob (SCM self)
404 {
405 sal_smob *s_smob = (sal_smob *) SCM_SMOB_DATA (self);
406
407 return s_smob->symtab_scm;
408 }
409
410 /* The smob "free" function for <gdb:sal>. */
411
412 static size_t
413 stscm_free_sal_smob (SCM self)
414 {
415 sal_smob *s_smob = (sal_smob *) SCM_SMOB_DATA (self);
416
417 /* Not necessary, done to catch bugs. */
418 s_smob->symtab_scm = SCM_UNDEFINED;
419
420 return 0;
421 }
422
423 /* The smob "print" function for <gdb:sal>. */
424
425 static int
426 stscm_print_sal_smob (SCM self, SCM port, scm_print_state *pstate)
427 {
428 sal_smob *s_smob = (sal_smob *) SCM_SMOB_DATA (self);
429 symtab_smob *st_smob = (symtab_smob *) SCM_SMOB_DATA (s_smob->symtab_scm);
430
431 gdbscm_printf (port, "#<%s ", symtab_smob_name);
432 scm_write (s_smob->symtab_scm, port);
433 if (s_smob->sal.line != 0)
434 gdbscm_printf (port, " line %d", s_smob->sal.line);
435 scm_puts (">", port);
436
437 scm_remember_upto_here_1 (self);
438
439 /* Non-zero means success. */
440 return 1;
441 }
442
443 /* Low level routine to create a <gdb:sal> object. */
444
445 static SCM
446 stscm_make_sal_smob (void)
447 {
448 sal_smob *s_smob
449 = (sal_smob *) scm_gc_malloc (sizeof (sal_smob), sal_smob_name);
450 SCM s_scm;
451
452 s_smob->symtab_scm = SCM_BOOL_F;
453 memset (&s_smob->sal, 0, sizeof (s_smob->sal));
454 s_scm = scm_new_smob (sal_smob_tag, (scm_t_bits) s_smob);
455 gdbscm_init_gsmob (&s_smob->base);
456
457 return s_scm;
458 }
459
460 /* Return non-zero if SCM is a <gdb:sal> object. */
461
462 static int
463 stscm_is_sal (SCM scm)
464 {
465 return SCM_SMOB_PREDICATE (sal_smob_tag, scm);
466 }
467
468 /* (sal? object) -> boolean */
469
470 static SCM
471 gdbscm_sal_p (SCM scm)
472 {
473 return scm_from_bool (stscm_is_sal (scm));
474 }
475
476 /* Create a new <gdb:sal> object that encapsulates SAL. */
477
478 SCM
479 stscm_scm_from_sal (struct symtab_and_line sal)
480 {
481 SCM st_scm, s_scm;
482 sal_smob *s_smob;
483
484 st_scm = SCM_BOOL_F;
485 if (sal.symtab != NULL)
486 st_scm = stscm_scm_from_symtab (sal.symtab);
487
488 s_scm = stscm_make_sal_smob ();
489 s_smob = (sal_smob *) SCM_SMOB_DATA (s_scm);
490 s_smob->symtab_scm = st_scm;
491 s_smob->sal = sal;
492
493 return s_scm;
494 }
495
496 /* Returns the <gdb:sal> object in SELF.
497 Throws an exception if SELF is not a <gdb:sal> object. */
498
499 static SCM
500 stscm_get_sal_arg (SCM self, int arg_pos, const char *func_name)
501 {
502 SCM_ASSERT_TYPE (stscm_is_sal (self), self, arg_pos, func_name,
503 sal_smob_name);
504
505 return self;
506 }
507
508 /* Returns a pointer to the sal smob of SELF.
509 Throws an exception if SELF is not a <gdb:sal> object. */
510
511 static sal_smob *
512 stscm_get_sal_smob_arg (SCM self, int arg_pos, const char *func_name)
513 {
514 SCM s_scm = stscm_get_sal_arg (self, arg_pos, func_name);
515 sal_smob *s_smob = (sal_smob *) SCM_SMOB_DATA (s_scm);
516
517 return s_smob;
518 }
519
520 /* Return non-zero if the symtab in S_SMOB is valid. */
521
522 static int
523 stscm_sal_is_valid (sal_smob *s_smob)
524 {
525 symtab_smob *st_smob;
526
527 /* If there's no symtab that's ok, the sal is still valid. */
528 if (gdbscm_is_false (s_smob->symtab_scm))
529 return 1;
530
531 st_smob = (symtab_smob *) SCM_SMOB_DATA (s_smob->symtab_scm);
532
533 return st_smob->symtab != NULL;
534 }
535
536 /* Throw a Scheme error if SELF is not a valid sal smob.
537 Otherwise return a pointer to the sal_smob object. */
538
539 static sal_smob *
540 stscm_get_valid_sal_smob_arg (SCM self, int arg_pos, const char *func_name)
541 {
542 sal_smob *s_smob = stscm_get_sal_smob_arg (self, arg_pos, func_name);
543
544 if (!stscm_sal_is_valid (s_smob))
545 {
546 gdbscm_invalid_object_error (func_name, arg_pos, self,
547 _("<gdb:sal>"));
548 }
549
550 return s_smob;
551 }
552 \f
553 /* sal methods */
554
555 /* (sal-valid? <gdb:sal>) -> boolean
556 Returns #t if the symtab for SELF still exists in GDB. */
557
558 static SCM
559 gdbscm_sal_valid_p (SCM self)
560 {
561 sal_smob *s_smob = stscm_get_sal_smob_arg (self, SCM_ARG1, FUNC_NAME);
562
563 return scm_from_bool (stscm_sal_is_valid (s_smob));
564 }
565
566 /* (sal-pc <gdb:sal>) -> address */
567
568 static SCM
569 gdbscm_sal_pc (SCM self)
570 {
571 sal_smob *s_smob = stscm_get_valid_sal_smob_arg (self, SCM_ARG1, FUNC_NAME);
572 const struct symtab_and_line *sal = &s_smob->sal;
573
574 return gdbscm_scm_from_ulongest (sal->pc);
575 }
576
577 /* (sal-last <gdb:sal>) -> address
578 Returns #f if no ending address is recorded. */
579
580 static SCM
581 gdbscm_sal_last (SCM self)
582 {
583 sal_smob *s_smob = stscm_get_valid_sal_smob_arg (self, SCM_ARG1, FUNC_NAME);
584 const struct symtab_and_line *sal = &s_smob->sal;
585
586 if (sal->end > 0)
587 return gdbscm_scm_from_ulongest (sal->end - 1);
588 return SCM_BOOL_F;
589 }
590
591 /* (sal-line <gdb:sal>) -> integer
592 Returns #f if no line number is recorded. */
593
594 static SCM
595 gdbscm_sal_line (SCM self)
596 {
597 sal_smob *s_smob = stscm_get_valid_sal_smob_arg (self, SCM_ARG1, FUNC_NAME);
598 const struct symtab_and_line *sal = &s_smob->sal;
599
600 if (sal->line > 0)
601 return scm_from_int (sal->line);
602 return SCM_BOOL_F;
603 }
604
605 /* (sal-symtab <gdb:sal>) -> <gdb:symtab>
606 Returns #f if no symtab is recorded. */
607
608 static SCM
609 gdbscm_sal_symtab (SCM self)
610 {
611 sal_smob *s_smob = stscm_get_valid_sal_smob_arg (self, SCM_ARG1, FUNC_NAME);
612 const struct symtab_and_line *sal = &s_smob->sal;
613
614 return s_smob->symtab_scm;
615 }
616
617 /* (find-pc-line address) -> <gdb:sal> */
618
619 static SCM
620 gdbscm_find_pc_line (SCM pc_scm)
621 {
622 ULONGEST pc_ull;
623 struct symtab_and_line sal;
624 volatile struct gdb_exception except;
625
626 init_sal (&sal); /* -Wall */
627
628 gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "U", pc_scm, &pc_ull);
629
630 TRY_CATCH (except, RETURN_MASK_ALL)
631 {
632 CORE_ADDR pc = (CORE_ADDR) pc_ull;
633
634 sal = find_pc_line (pc, 0);
635 }
636 GDBSCM_HANDLE_GDB_EXCEPTION (except);
637
638 return stscm_scm_from_sal (sal);
639 }
640 \f
641 /* Initialize the Scheme symbol support. */
642
643 static const scheme_function symtab_functions[] =
644 {
645 { "symtab?", 1, 0, 0, gdbscm_symtab_p,
646 "\
647 Return #t if the object is a <gdb:symtab> object." },
648
649 { "symtab-valid?", 1, 0, 0, gdbscm_symtab_valid_p,
650 "\
651 Return #t if the symtab still exists in GDB.\n\
652 Symtabs are deleted when the corresponding objfile is freed." },
653
654 { "symtab-filename", 1, 0, 0, gdbscm_symtab_filename,
655 "\
656 Return the symtab's source file name." },
657
658 { "symtab-fullname", 1, 0, 0, gdbscm_symtab_fullname,
659 "\
660 Return the symtab's full source file name." },
661
662 { "symtab-objfile", 1, 0, 0, gdbscm_symtab_objfile,
663 "\
664 Return the symtab's objfile." },
665
666 { "symtab-global-block", 1, 0, 0, gdbscm_symtab_global_block,
667 "\
668 Return the symtab's global block." },
669
670 { "symtab-static-block", 1, 0, 0, gdbscm_symtab_static_block,
671 "\
672 Return the symtab's static block." },
673
674 { "sal?", 1, 0, 0, gdbscm_sal_p,
675 "\
676 Return #t if the object is a <gdb:sal> (symtab-and-line) object." },
677
678 { "sal-valid?", 1, 0, 0, gdbscm_sal_valid_p,
679 "\
680 Return #t if the symtab for the sal still exists in GDB.\n\
681 Symtabs are deleted when the corresponding objfile is freed." },
682
683 { "sal-symtab", 1, 0, 0, gdbscm_sal_symtab,
684 "\
685 Return the sal's symtab." },
686
687 { "sal-line", 1, 0, 0, gdbscm_sal_line,
688 "\
689 Return the sal's line number, or #f if there is none." },
690
691 { "sal-pc", 1, 0, 0, gdbscm_sal_pc,
692 "\
693 Return the sal's address." },
694
695 { "sal-last", 1, 0, 0, gdbscm_sal_last,
696 "\
697 Return the last address specified by the sal, or #f if there is none." },
698
699 { "find-pc-line", 1, 0, 0, gdbscm_find_pc_line,
700 "\
701 Return the sal corresponding to the address, or #f if there isn't one.\n\
702 \n\
703 Arguments: address" },
704
705 END_FUNCTIONS
706 };
707
708 void
709 gdbscm_initialize_symtabs (void)
710 {
711 symtab_smob_tag
712 = gdbscm_make_smob_type (symtab_smob_name, sizeof (symtab_smob));
713 scm_set_smob_mark (symtab_smob_tag, stscm_mark_symtab_smob);
714 scm_set_smob_free (symtab_smob_tag, stscm_free_symtab_smob);
715 scm_set_smob_print (symtab_smob_tag, stscm_print_symtab_smob);
716
717 sal_smob_tag = gdbscm_make_smob_type (sal_smob_name, sizeof (sal_smob));
718 scm_set_smob_mark (sal_smob_tag, stscm_mark_sal_smob);
719 scm_set_smob_free (sal_smob_tag, stscm_free_sal_smob);
720 scm_set_smob_print (sal_smob_tag, stscm_print_sal_smob);
721
722 gdbscm_define_functions (symtab_functions, 1);
723
724 /* Register an objfile "free" callback so we can properly
725 invalidate symbol tables, and symbol table and line data
726 structures when an object file that is about to be deleted. */
727 stscm_objfile_data_key
728 = register_objfile_data_with_cleanup (NULL, stscm_del_objfile_symtabs);
729 }
This page took 0.053396 seconds and 4 git commands to generate.