GDB (xrefs)
Loading...
Searching...
No Matches
scm-symbol.c
Go to the documentation of this file.
1/* Scheme interface to symbols.
2
3 Copyright (C) 2008-2023 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 "block.h"
25#include "frame.h"
26#include "symtab.h"
27#include "objfiles.h"
28#include "value.h"
29#include "guile-internal.h"
30
31/* The <gdb:symbol> smob. */
32
34{
35 /* This always appears first. */
37
38 /* The GDB symbol structure this smob is wrapping. */
39 struct symbol *symbol;
40};
41
42static const char symbol_smob_name[] = "gdb:symbol";
43
44/* The tag Guile knows the symbol smob by. */
45static scm_t_bits symbol_smob_tag;
46
47/* Keywords used in argument passing. */
48static SCM block_keyword;
49static SCM domain_keyword;
50static SCM frame_keyword;
51
52/* This is called when an objfile is about to be freed.
53 Invalidate the symbol as further actions on the symbol would result
54 in bad data. All access to s_smob->symbol should be gated by
55 syscm_get_valid_symbol_smob_arg_unsafe which will raise an exception on
56 invalid symbols. */
58{
59 /* Helper function for syscm_del_objfile_symbols to mark the symbol
60 as invalid. */
61
62 static int
63 syscm_mark_symbol_invalid (void **slot, void *info)
64 {
65 symbol_smob *s_smob = (symbol_smob *) *slot;
66
67 s_smob->symbol = NULL;
68 return 1;
69 }
70
71 void operator() (htab_t htab)
72 {
73 gdb_assert (htab != nullptr);
74 htab_traverse_noresize (htab, syscm_mark_symbol_invalid, NULL);
75 htab_delete (htab);
76 }
77};
78
79static const registry<objfile>::key<htab, syscm_deleter>
81
83{
84 /* Hash table to implement eqable gdbarch symbols. */
85 htab_t htab;
86};
87
89
90/* Administrivia for symbol smobs. */
91
92/* Helper function to hash a symbol_smob. */
93
94static hashval_t
96{
97 const symbol_smob *s_smob = (const symbol_smob *) p;
98
99 return htab_hash_pointer (s_smob->symbol);
100}
101
102/* Helper function to compute equality of symbol_smobs. */
103
104static int
105syscm_eq_symbol_smob (const void *ap, const void *bp)
106{
107 const symbol_smob *a = (const symbol_smob *) ap;
108 const symbol_smob *b = (const symbol_smob *) bp;
109
110 return (a->symbol == b->symbol
111 && a->symbol != NULL);
112}
113
114/* Return the struct symbol pointer -> SCM mapping table.
115 It is created if necessary. */
116
117static htab_t
119{
120 htab_t htab;
121
122 if (symbol->is_objfile_owned ())
123 {
124 struct objfile *objfile = symbol->objfile ();
125
127 if (htab == NULL)
128 {
132 }
133 }
134 else
135 {
136 struct gdbarch *gdbarch = symbol->arch ();
138 if (data == nullptr)
139 {
140 data = syscm_gdbarch_data_key.emplace (gdbarch);
141 data->htab
144 }
145
146 htab = data->htab;
147 }
148
149 return htab;
150}
151
152/* The smob "free" function for <gdb:symbol>. */
153
154static size_t
156{
157 symbol_smob *s_smob = (symbol_smob *) SCM_SMOB_DATA (self);
158
159 if (s_smob->symbol != NULL)
160 {
161 htab_t htab = syscm_get_symbol_map (s_smob->symbol);
162
164 }
165
166 /* Not necessary, done to catch bugs. */
167 s_smob->symbol = NULL;
168
169 return 0;
170}
171
172/* The smob "print" function for <gdb:symbol>. */
173
174static int
175syscm_print_symbol_smob (SCM self, SCM port, scm_print_state *pstate)
176{
177 symbol_smob *s_smob = (symbol_smob *) SCM_SMOB_DATA (self);
178
179 if (pstate->writingp)
180 gdbscm_printf (port, "#<%s ", symbol_smob_name);
181 gdbscm_printf (port, "%s",
182 s_smob->symbol != NULL
183 ? s_smob->symbol->print_name ()
184 : "<invalid>");
185 if (pstate->writingp)
186 scm_puts (">", port);
187
188 scm_remember_upto_here_1 (self);
189
190 /* Non-zero means success. */
191 return 1;
192}
193
194/* Low level routine to create a <gdb:symbol> object. */
195
196static SCM
198{
199 symbol_smob *s_smob = (symbol_smob *)
200 scm_gc_malloc (sizeof (symbol_smob), symbol_smob_name);
201 SCM s_scm;
202
203 s_smob->symbol = NULL;
204 s_scm = scm_new_smob (symbol_smob_tag, (scm_t_bits) s_smob);
205 gdbscm_init_eqable_gsmob (&s_smob->base, s_scm);
206
207 return s_scm;
208}
209
210/* Return non-zero if SCM is a symbol smob. */
211
212int
214{
215 return SCM_SMOB_PREDICATE (symbol_smob_tag, scm);
216}
217
218/* (symbol? object) -> boolean */
219
220static SCM
222{
223 return scm_from_bool (syscm_is_symbol (scm));
224}
225
226/* Return the existing object that encapsulates SYMBOL, or create a new
227 <gdb:symbol> object. */
228
229SCM
231{
232 htab_t htab;
233 eqable_gdb_smob **slot;
234 symbol_smob *s_smob, s_smob_for_lookup;
235 SCM s_scm;
236
237 /* If we've already created a gsmob for this symbol, return it.
238 This makes symbols eq?-able. */
240 s_smob_for_lookup.symbol = symbol;
241 slot = gdbscm_find_eqable_gsmob_ptr_slot (htab, &s_smob_for_lookup.base);
242 if (*slot != NULL)
243 return (*slot)->containing_scm;
244
245 s_scm = syscm_make_symbol_smob ();
246 s_smob = (symbol_smob *) SCM_SMOB_DATA (s_scm);
247 s_smob->symbol = symbol;
249
250 return s_scm;
251}
252
253/* Returns the <gdb:symbol> object in SELF.
254 Throws an exception if SELF is not a <gdb:symbol> object. */
255
256static SCM
257syscm_get_symbol_arg_unsafe (SCM self, int arg_pos, const char *func_name)
258{
259 SCM_ASSERT_TYPE (syscm_is_symbol (self), self, arg_pos, func_name,
261
262 return self;
263}
264
265/* Returns a pointer to the symbol smob of SELF.
266 Throws an exception if SELF is not a <gdb:symbol> object. */
267
268static symbol_smob *
269syscm_get_symbol_smob_arg_unsafe (SCM self, int arg_pos, const char *func_name)
270{
271 SCM s_scm = syscm_get_symbol_arg_unsafe (self, arg_pos, func_name);
272 symbol_smob *s_smob = (symbol_smob *) SCM_SMOB_DATA (s_scm);
273
274 return s_smob;
275}
276
277/* Return non-zero if symbol S_SMOB is valid. */
278
279static int
281{
282 return s_smob->symbol != NULL;
283}
284
285/* Throw a Scheme error if SELF is not a valid symbol smob.
286 Otherwise return a pointer to the symbol smob. */
287
288static symbol_smob *
290 const char *func_name)
291{
292 symbol_smob *s_smob
293 = syscm_get_symbol_smob_arg_unsafe (self, arg_pos, func_name);
294
295 if (!syscm_is_valid (s_smob))
296 {
297 gdbscm_invalid_object_error (func_name, arg_pos, self,
298 _("<gdb:symbol>"));
299 }
300
301 return s_smob;
302}
303
304/* Throw a Scheme error if SELF is not a valid symbol smob.
305 Otherwise return a pointer to the symbol struct. */
306
307struct symbol *
309 const char *func_name)
310{
312 func_name);
313
314 return s_smob->symbol;
315}
316
317
318/* Symbol methods. */
319
320/* (symbol-valid? <gdb:symbol>) -> boolean
321 Returns #t if SELF still exists in GDB. */
322
323static SCM
325{
326 symbol_smob *s_smob
328
329 return scm_from_bool (syscm_is_valid (s_smob));
330}
331
332/* (symbol-type <gdb:symbol>) -> <gdb:type>
333 Return the type of SELF, or #f if SELF has no type. */
334
335static SCM
337{
338 symbol_smob *s_smob
340 const struct symbol *symbol = s_smob->symbol;
341
342 if (symbol->type () == NULL)
343 return SCM_BOOL_F;
344
345 return tyscm_scm_from_type (symbol->type ());
346}
347
348/* (symbol-symtab <gdb:symbol>) -> <gdb:symtab> | #f
349 Return the symbol table of SELF.
350 If SELF does not have a symtab (it is arch-owned) return #f. */
351
352static SCM
354{
355 symbol_smob *s_smob
357 const struct symbol *symbol = s_smob->symbol;
358
359 if (!symbol->is_objfile_owned ())
360 return SCM_BOOL_F;
362}
363
364/* (symbol-name <gdb:symbol>) -> string */
365
366static SCM
368{
369 symbol_smob *s_smob
371 const struct symbol *symbol = s_smob->symbol;
372
374}
375
376/* (symbol-linkage-name <gdb:symbol>) -> string */
377
378static SCM
380{
381 symbol_smob *s_smob
383 const struct symbol *symbol = s_smob->symbol;
384
386}
387
388/* (symbol-print-name <gdb:symbol>) -> string */
389
390static SCM
392{
393 symbol_smob *s_smob
395 const struct symbol *symbol = s_smob->symbol;
396
398}
399
400/* (symbol-addr-class <gdb:symbol>) -> integer */
401
402static SCM
404{
405 symbol_smob *s_smob
407 const struct symbol *symbol = s_smob->symbol;
408
409 return scm_from_int (symbol->aclass ());
410}
411
412/* (symbol-argument? <gdb:symbol>) -> boolean */
413
414static SCM
416{
417 symbol_smob *s_smob
419 const struct symbol *symbol = s_smob->symbol;
420
421 return scm_from_bool (symbol->is_argument ());
422}
423
424/* (symbol-constant? <gdb:symbol>) -> boolean */
425
426static SCM
428{
429 symbol_smob *s_smob
431 const struct symbol *symbol = s_smob->symbol;
432 enum address_class theclass;
433
434 theclass = symbol->aclass ();
435
436 return scm_from_bool (theclass == LOC_CONST || theclass == LOC_CONST_BYTES);
437}
438
439/* (symbol-function? <gdb:symbol>) -> boolean */
440
441static SCM
443{
444 symbol_smob *s_smob
446 const struct symbol *symbol = s_smob->symbol;
447 enum address_class theclass;
448
449 theclass = symbol->aclass ();
450
451 return scm_from_bool (theclass == LOC_BLOCK);
452}
453
454/* (symbol-variable? <gdb:symbol>) -> boolean */
455
456static SCM
458{
459 symbol_smob *s_smob
461 const struct symbol *symbol = s_smob->symbol;
462 enum address_class theclass;
463
464 theclass = symbol->aclass ();
465
466 return scm_from_bool (!symbol->is_argument ()
467 && (theclass == LOC_LOCAL || theclass == LOC_REGISTER
468 || theclass == LOC_STATIC || theclass == LOC_COMPUTED
469 || theclass == LOC_OPTIMIZED_OUT));
470}
471
472/* (symbol-needs-frame? <gdb:symbol>) -> boolean
473 Return #t if the symbol needs a frame for evaluation. */
474
475static SCM
477{
478 symbol_smob *s_smob
480 struct symbol *symbol = s_smob->symbol;
481 int result = 0;
482
484 try
485 {
487 }
488 catch (const gdb_exception &except)
489 {
490 exc = unpack (except);
491 }
492
494 return scm_from_bool (result);
495}
496
497/* (symbol-line <gdb:symbol>) -> integer
498 Return the line number at which the symbol was defined. */
499
500static SCM
502{
503 symbol_smob *s_smob
505 const struct symbol *symbol = s_smob->symbol;
506
507 return scm_from_int (symbol->line ());
508}
509
510/* (symbol-value <gdb:symbol> [#:frame <gdb:frame>]) -> <gdb:value>
511 Return the value of the symbol, or an error in various circumstances. */
512
513static SCM
514gdbscm_symbol_value (SCM self, SCM rest)
515{
516 symbol_smob *s_smob
518 struct symbol *symbol = s_smob->symbol;
519 SCM keywords[] = { frame_keyword, SCM_BOOL_F };
520 int frame_pos = -1;
521 SCM frame_scm = SCM_BOOL_F;
522 frame_smob *f_smob = NULL;
523 struct value *value = NULL;
524
525 gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, keywords, "#O",
526 rest, &frame_pos, &frame_scm);
527 if (!gdbscm_is_false (frame_scm))
528 f_smob = frscm_get_frame_smob_arg_unsafe (frame_scm, frame_pos, FUNC_NAME);
529
530 if (symbol->aclass () == LOC_TYPEDEF)
531 {
532 gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self,
533 _("cannot get the value of a typedef"));
534 }
535
537 try
538 {
540
541 if (f_smob != NULL)
542 {
544 if (frame_info == NULL)
545 error (_("Invalid frame"));
546 }
547
549 error (_("Symbol requires a frame to compute its value"));
550
551 /* TODO: currently, we have no way to recover the block in which SYMBOL
552 was found, so we have no block to pass to read_var_value. This will
553 yield an incorrect value when symbol is not local to FRAME_INFO (this
554 can happen with nested functions). */
556 }
557 catch (const gdb_exception &except)
558 {
559 exc = unpack (except);
560 }
561
564}
565
566/* (lookup-symbol name [#:block <gdb:block>] [#:domain domain])
567 -> (<gdb:symbol> field-of-this?)
568 The result is #f if the symbol is not found.
569 See comment in lookup_symbol_in_language for field-of-this?. */
570
571static SCM
572gdbscm_lookup_symbol (SCM name_scm, SCM rest)
573{
574 char *name;
575 SCM keywords[] = { block_keyword, domain_keyword, SCM_BOOL_F };
576 const struct block *block = NULL;
577 SCM block_scm = SCM_BOOL_F;
578 int domain = VAR_DOMAIN;
579 int block_arg_pos = -1, domain_arg_pos = -1;
580 struct field_of_this_result is_a_field_of_this;
581 struct symbol *symbol = NULL;
582
583 gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#Oi",
584 name_scm, &name, rest,
585 &block_arg_pos, &block_scm,
586 &domain_arg_pos, &domain);
587
588 if (block_arg_pos >= 0)
589 {
590 SCM except_scm;
591
592 block = bkscm_scm_to_block (block_scm, block_arg_pos, FUNC_NAME,
593 &except_scm);
594 if (block == NULL)
595 {
596 xfree (name);
597 gdbscm_throw (except_scm);
598 }
599 }
600 else
601 {
603 try
604 {
606 = get_selected_frame (_("no frame selected"));
608 }
609 catch (const gdb_exception &ex)
610 {
611 xfree (name);
612 exc = unpack (ex);
613 }
615 }
616
617 gdbscm_gdb_exception except {};
618 try
619 {
621 &is_a_field_of_this).symbol;
622 }
623 catch (const gdb_exception &ex)
624 {
625 except = unpack (ex);
626 }
627
628 xfree (name);
630
631 if (symbol == NULL)
632 return SCM_BOOL_F;
633
634 return scm_list_2 (syscm_scm_from_symbol (symbol),
635 scm_from_bool (is_a_field_of_this.type != NULL));
636}
637
638/* (lookup-global-symbol name [#:domain domain]) -> <gdb:symbol>
639 The result is #f if the symbol is not found. */
640
641static SCM
642gdbscm_lookup_global_symbol (SCM name_scm, SCM rest)
643{
644 char *name;
645 SCM keywords[] = { domain_keyword, SCM_BOOL_F };
646 int domain_arg_pos = -1;
647 int domain = VAR_DOMAIN;
648 struct symbol *symbol = NULL;
649 gdbscm_gdb_exception except {};
650
651 gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#i",
652 name_scm, &name, rest,
653 &domain_arg_pos, &domain);
654
655 try
656 {
658 }
659 catch (const gdb_exception &ex)
660 {
661 except = unpack (ex);
662 }
663
664 xfree (name);
666
667 if (symbol == NULL)
668 return SCM_BOOL_F;
669
671}
672
673/* Initialize the Scheme symbol support. */
674
675/* Note: The SYMBOL_ prefix on the integer constants here is present for
676 compatibility with the Python support. */
677
679{
680#define X(SYM) { "SYMBOL_" #SYM, SYM }
681 X (LOC_UNDEF),
682 X (LOC_CONST),
683 X (LOC_STATIC),
684 X (LOC_REGISTER),
685 X (LOC_ARG),
686 X (LOC_REF_ARG),
687 X (LOC_LOCAL),
688 X (LOC_TYPEDEF),
689 X (LOC_LABEL),
690 X (LOC_BLOCK),
694 X (LOC_COMPUTED),
696
697 X (UNDEF_DOMAIN),
698 X (VAR_DOMAIN),
700 X (LABEL_DOMAIN),
703 X (TYPES_DOMAIN),
704#undef X
705
707};
708
710{
711 { "symbol?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_p),
712 "\
713Return #t if the object is a <gdb:symbol> object." },
714
715 { "symbol-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_valid_p),
716 "\
717Return #t if object is a valid <gdb:symbol> object.\n\
718A valid symbol is a symbol that has not been freed.\n\
719Symbols are freed when the objfile they come from is freed." },
720
721 { "symbol-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_type),
722 "\
723Return the type of symbol." },
724
725 { "symbol-symtab", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_symtab),
726 "\
727Return the symbol table (<gdb:symtab>) containing symbol." },
728
729 { "symbol-line", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_line),
730 "\
731Return the line number at which the symbol was defined." },
732
733 { "symbol-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_name),
734 "\
735Return the name of the symbol as a string." },
736
737 { "symbol-linkage-name", 1, 0, 0,
739 "\
740Return the linkage name of the symbol as a string." },
741
742 { "symbol-print-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_print_name),
743 "\
744Return the print name of the symbol as a string.\n\
745This is either name or linkage-name, depending on whether the user\n\
746asked GDB to display demangled or mangled names." },
747
748 { "symbol-addr-class", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_addr_class),
749 "\
750Return the address class of the symbol." },
751
752 { "symbol-needs-frame?", 1, 0, 0,
754 "\
755Return #t if the symbol needs a frame to compute its value." },
756
757 { "symbol-argument?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_argument_p),
758 "\
759Return #t if the symbol is a function argument." },
760
761 { "symbol-constant?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_constant_p),
762 "\
763Return #t if the symbol is a constant." },
764
765 { "symbol-function?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_function_p),
766 "\
767Return #t if the symbol is a function." },
768
769 { "symbol-variable?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_variable_p),
770 "\
771Return #t if the symbol is a variable." },
772
773 { "symbol-value", 1, 0, 1, as_a_scm_t_subr (gdbscm_symbol_value),
774 "\
775Return the value of the symbol.\n\
776\n\
777 Arguments: <gdb:symbol> [#:frame frame]" },
778
779 { "lookup-symbol", 1, 0, 1, as_a_scm_t_subr (gdbscm_lookup_symbol),
780 "\
781Return (<gdb:symbol> field-of-this?) if found, otherwise #f.\n\
782\n\
783 Arguments: name [#:block block] [#:domain domain]\n\
784 name: a string containing the name of the symbol to lookup\n\
785 block: a <gdb:block> object\n\
786 domain: a SYMBOL_*_DOMAIN value" },
787
788 { "lookup-global-symbol", 1, 0, 1,
790 "\
791Return <gdb:symbol> if found, otherwise #f.\n\
792\n\
793 Arguments: name [#:domain domain]\n\
794 name: a string containing the name of the symbol to lookup\n\
795 domain: a SYMBOL_*_DOMAIN value" },
796
798};
799
800void
802{
805 scm_set_smob_free (symbol_smob_tag, syscm_free_symbol_smob);
806 scm_set_smob_print (symbol_smob_tag, syscm_print_symbol_smob);
807
810
811 block_keyword = scm_from_latin1_keyword ("block");
812 domain_keyword = scm_from_latin1_keyword ("domain");
813 frame_keyword = scm_from_latin1_keyword ("frame");
814}
const char *const name
static struct parser_state * pstate
Definition ada-exp.c:101
void xfree(void *)
const struct block * get_frame_block(frame_info_ptr frame, CORE_ADDR *addr_in_block)
Definition blockframe.c:55
void set(unsigned key, void *datum)
Definition registry.h:204
void * get(unsigned key)
Definition registry.h:211
int symbol_read_needs_frame(struct symbol *sym)
Definition findvar.c:388
struct value * read_var_value(struct symbol *var, const struct block *var_block, frame_info_ptr frame)
Definition findvar.c:739
static frame_info_ptr selected_frame
Definition frame.c:1746
frame_info_ptr get_selected_frame(const char *message)
Definition frame.c:1888
void gdbscm_init_eqable_gsmob(eqable_gdb_smob *base, SCM containing_scm)
Definition scm-gsmob.c:162
#define END_FUNCTIONS
void gdbscm_parse_function_args(const char *function_name, int beginning_arg_pos, const SCM *keywords, const char *format,...)
Definition scm-utils.c:528
#define END_INTEGER_CONSTANTS
gdbscm_gdb_exception unpack(const gdb_exception &exc)
htab_t gdbscm_create_eqable_gsmob_ptr_map(htab_hash hash_fn, htab_eq eq_fn)
Definition scm-gsmob.c:213
SCM vlscm_scm_from_value(struct value *value)
Definition scm-value.c:252
void gdbscm_invalid_object_error(const char *subr, int arg_pos, SCM bad_value, const char *error) ATTRIBUTE_NORETURN
frame_smob * frscm_get_frame_smob_arg_unsafe(SCM frame_scm, int arg_pos, const char *func_name)
Definition scm-frame.c:342
SCM tyscm_scm_from_type(struct type *type)
Definition scm-type.c:313
void gdbscm_out_of_range_error(const char *subr, int arg_pos, SCM bad_value, const char *error) ATTRIBUTE_NORETURN
void gdbscm_clear_eqable_gsmob_ptr_slot(htab_t htab, eqable_gdb_smob *base)
Definition scm-gsmob.c:251
#define gdbscm_is_false(scm)
void gdbscm_printf(SCM port, const char *format,...) ATTRIBUTE_PRINTF(2
void gdbscm_define_integer_constants(const scheme_integer_constant *, int is_public)
Definition scm-utils.c:63
const struct block * bkscm_scm_to_block(SCM block_scm, int arg_pos, const char *func_name, SCM *excp)
Definition scm-block.c:345
static SCM scm_new_smob(scm_t_bits tc, scm_t_bits data)
void gdbscm_define_functions(const scheme_function *, int is_public)
Definition scm-utils.c:44
eqable_gdb_smob ** gdbscm_find_eqable_gsmob_ptr_slot(htab_t htab, eqable_gdb_smob *base)
Definition scm-gsmob.c:226
struct frame_info_ptr frscm_frame_smob_to_frame(frame_smob *)
Definition scm-frame.c:365
#define GDBSCM_HANDLE_GDB_EXCEPTION(exception)
void gdbscm_fill_eqable_gsmob_ptr_slot(eqable_gdb_smob **slot, eqable_gdb_smob *base)
Definition scm-gsmob.c:237
scm_t_bits gdbscm_make_smob_type(const char *name, size_t size)
Definition scm-gsmob.c:103
SCM stscm_scm_from_symtab(struct symtab *symtab)
Definition scm-symtab.c:228
void gdbscm_throw(SCM exception) ATTRIBUTE_NORETURN
static scm_t_subr as_a_scm_t_subr(SCM(*func)(void))
#define FUNC_NAME
SCM gdbscm_scm_from_c_string(const char *string)
Definition scm-string.c:45
static scm_t_bits symbol_smob_tag
Definition scm-symbol.c:45
static SCM gdbscm_symbol_addr_class(SCM self)
Definition scm-symbol.c:403
static SCM gdbscm_symbol_function_p(SCM self)
Definition scm-symbol.c:442
static symbol_smob * syscm_get_valid_symbol_smob_arg_unsafe(SCM self, int arg_pos, const char *func_name)
Definition scm-symbol.c:289
static hashval_t syscm_hash_symbol_smob(const void *p)
Definition scm-symbol.c:95
static const char symbol_smob_name[]
Definition scm-symbol.c:42
static htab_t syscm_get_symbol_map(struct symbol *symbol)
Definition scm-symbol.c:118
static SCM gdbscm_symbol_type(SCM self)
Definition scm-symbol.c:336
static SCM gdbscm_symbol_name(SCM self)
Definition scm-symbol.c:367
static SCM syscm_get_symbol_arg_unsafe(SCM self, int arg_pos, const char *func_name)
Definition scm-symbol.c:257
int syscm_is_symbol(SCM scm)
Definition scm-symbol.c:213
static SCM gdbscm_symbol_symtab(SCM self)
Definition scm-symbol.c:353
static SCM gdbscm_symbol_constant_p(SCM self)
Definition scm-symbol.c:427
static size_t syscm_free_symbol_smob(SCM self)
Definition scm-symbol.c:155
static SCM gdbscm_symbol_line(SCM self)
Definition scm-symbol.c:501
static SCM gdbscm_lookup_symbol(SCM name_scm, SCM rest)
Definition scm-symbol.c:572
static SCM gdbscm_symbol_needs_frame_p(SCM self)
Definition scm-symbol.c:476
static const registry< objfile >::key< htab, syscm_deleter > syscm_objfile_data_key
Definition scm-symbol.c:80
void gdbscm_initialize_symbols(void)
Definition scm-symbol.c:801
static SCM domain_keyword
Definition scm-symbol.c:49
static SCM gdbscm_symbol_variable_p(SCM self)
Definition scm-symbol.c:457
static int syscm_eq_symbol_smob(const void *ap, const void *bp)
Definition scm-symbol.c:105
static SCM syscm_make_symbol_smob(void)
Definition scm-symbol.c:197
static SCM gdbscm_symbol_print_name(SCM self)
Definition scm-symbol.c:391
static SCM gdbscm_symbol_linkage_name(SCM self)
Definition scm-symbol.c:379
static SCM block_keyword
Definition scm-symbol.c:48
static SCM gdbscm_symbol_value(SCM self, SCM rest)
Definition scm-symbol.c:514
static symbol_smob * syscm_get_symbol_smob_arg_unsafe(SCM self, int arg_pos, const char *func_name)
Definition scm-symbol.c:269
struct symbol * syscm_get_valid_symbol_arg_unsafe(SCM self, int arg_pos, const char *func_name)
Definition scm-symbol.c:308
static int syscm_is_valid(symbol_smob *s_smob)
Definition scm-symbol.c:280
static const scheme_function symbol_functions[]
Definition scm-symbol.c:709
SCM syscm_scm_from_symbol(struct symbol *symbol)
Definition scm-symbol.c:230
static SCM gdbscm_symbol_argument_p(SCM self)
Definition scm-symbol.c:415
static int syscm_print_symbol_smob(SCM self, SCM port, scm_print_state *pstate)
Definition scm-symbol.c:175
static SCM frame_keyword
Definition scm-symbol.c:50
#define X(SYM)
static SCM gdbscm_symbol_valid_p(SCM self)
Definition scm-symbol.c:324
static const scheme_integer_constant symbol_integer_constants[]
Definition scm-symbol.c:678
static SCM gdbscm_lookup_global_symbol(SCM name_scm, SCM rest)
Definition scm-symbol.c:642
static SCM gdbscm_symbol_p(SCM scm)
Definition scm-symbol.c:221
static const registry< gdbarch >::key< syscm_gdbarch_data > syscm_gdbarch_data_key
Definition scm-symbol.c:88
struct symbol * symbol
Definition symtab.h:1533
Definition block.h:109
struct type * type
Definition symtab.h:2048
const char * natural_name() const
Definition symtab.c:1056
const char * print_name() const
Definition symtab.h:475
const char * linkage_name() const
Definition symtab.h:460
eqable_gdb_smob base
Definition scm-symbol.c:36
struct symbol * symbol
Definition scm-symbol.c:39
address_class aclass() const
Definition symtab.h:1274
struct type * type() const
Definition symtab.h:1331
domain_enum domain() const
Definition symtab.h:1286
bool is_objfile_owned() const
Definition symtab.h:1296
bool is_argument() const
Definition symtab.h:1306
unsigned int line() const
Definition symtab.h:1341
struct objfile * objfile() const
Definition symtab.c:6482
struct symtab * symtab
Definition symtab.h:1457
struct gdbarch * arch
Definition symtab.h:1460
void operator()(htab_t htab)
Definition scm-symbol.c:71
static int syscm_mark_symbol_invalid(void **slot, void *info)
Definition scm-symbol.c:63
Definition value.h:130
struct block_symbol lookup_symbol(const char *name, const struct block *block, domain_enum domain, struct field_of_this_result *is_a_field_of_this)
Definition symtab.c:1964
struct block_symbol lookup_global_symbol(const char *name, const struct block *block, const domain_enum domain)
Definition symtab.c:2613
@ VARIABLES_DOMAIN
Definition symtab.h:948
@ FUNCTIONS_DOMAIN
Definition symtab.h:951
@ TYPES_DOMAIN
Definition symtab.h:954
address_class
Definition symtab.h:968
@ LOC_STATIC
Definition symtab.h:979
@ LOC_BLOCK
Definition symtab.h:1028
@ LOC_LABEL
Definition symtab.h:1022
@ LOC_REGISTER
Definition symtab.h:993
@ LOC_REF_ARG
Definition symtab.h:1001
@ LOC_UNRESOLVED
Definition symtab.h:1057
@ LOC_LOCAL
Definition symtab.h:1013
@ LOC_CONST
Definition symtab.h:975
@ LOC_CONST_BYTES
Definition symtab.h:1033
@ LOC_UNDEF
Definition symtab.h:971
@ LOC_OPTIMIZED_OUT
Definition symtab.h:1062
@ LOC_TYPEDEF
Definition symtab.h:1018
@ LOC_REGPARM_ADDR
Definition symtab.h:1009
@ LOC_COMPUTED
Definition symtab.h:1066
@ LOC_ARG
Definition symtab.h:997
domain_enum
Definition symtab.h:900
@ VAR_DOMAIN
Definition symtab.h:910
@ STRUCT_DOMAIN
Definition symtab.h:916
@ LABEL_DOMAIN
Definition symtab.h:924
@ UNDEF_DOMAIN
Definition symtab.h:905