]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/symtab.h
Initial creation of sourceware repository
[thirdparty/binutils-gdb.git] / gdb / symtab.h
1 /* Symbol table definitions for GDB.
2 Copyright 1986, 89, 91, 92, 93, 94, 95, 96, 1998
3 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 2 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, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20
21 #if !defined (SYMTAB_H)
22 #define SYMTAB_H 1
23
24 /* Some definitions and declarations to go with use of obstacks. */
25
26 #include "obstack.h"
27 #define obstack_chunk_alloc xmalloc
28 #define obstack_chunk_free free
29 #include "bcache.h"
30
31 /* Don't do this; it means that if some .o's are compiled with GNU C
32 and some are not (easy to do accidentally the way we configure
33 things; also it is a pain to have to "make clean" every time you
34 want to switch compilers), then GDB dies a horrible death. */
35 /* GNU C supports enums that are bitfields. Some compilers don't. */
36 #if 0 && defined(__GNUC__) && !defined(BYTE_BITFIELD)
37 #define BYTE_BITFIELD :8;
38 #else
39 #define BYTE_BITFIELD /*nothing*/
40 #endif
41
42 /* Define a structure for the information that is common to all symbol types,
43 including minimal symbols, partial symbols, and full symbols. In a
44 multilanguage environment, some language specific information may need to
45 be recorded along with each symbol.
46
47 These fields are ordered to encourage good packing, since we frequently
48 have tens or hundreds of thousands of these. */
49
50 struct general_symbol_info
51 {
52 /* Name of the symbol. This is a required field. Storage for the name is
53 allocated on the psymbol_obstack or symbol_obstack for the associated
54 objfile. */
55
56 char *name;
57
58 /* Value of the symbol. Which member of this union to use, and what
59 it means, depends on what kind of symbol this is and its
60 SYMBOL_CLASS. See comments there for more details. All of these
61 are in host byte order (though what they point to might be in
62 target byte order, e.g. LOC_CONST_BYTES). */
63
64 union
65 {
66 /* The fact that this is a long not a LONGEST mainly limits the
67 range of a LOC_CONST. Since LOC_CONST_BYTES exists, I'm not
68 sure that is a big deal. */
69 long ivalue;
70
71 struct block *block;
72
73 char *bytes;
74
75 CORE_ADDR address;
76
77 /* for opaque typedef struct chain */
78
79 struct symbol *chain;
80 }
81 value;
82
83 /* Since one and only one language can apply, wrap the language specific
84 information inside a union. */
85
86 union
87 {
88 struct cplus_specific /* For C++ */
89 /* and Java */
90 {
91 char *demangled_name;
92 } cplus_specific;
93 struct chill_specific /* For Chill */
94 {
95 char *demangled_name;
96 } chill_specific;
97 } language_specific;
98
99 /* Record the source code language that applies to this symbol.
100 This is used to select one of the fields from the language specific
101 union above. */
102
103 enum language language BYTE_BITFIELD;
104
105 /* Which section is this symbol in? This is an index into
106 section_offsets for this objfile. Negative means that the symbol
107 does not get relocated relative to a section.
108 Disclaimer: currently this is just used for xcoff, so don't
109 expect all symbol-reading code to set it correctly (the ELF code
110 also tries to set it correctly). */
111
112 short section;
113
114 /* The bfd section associated with this symbol. */
115
116 asection *bfd_section;
117 };
118
119 extern CORE_ADDR symbol_overlayed_address PARAMS((CORE_ADDR, asection *));
120
121 #define SYMBOL_NAME(symbol) (symbol)->ginfo.name
122 #define SYMBOL_VALUE(symbol) (symbol)->ginfo.value.ivalue
123 #define SYMBOL_VALUE_ADDRESS(symbol) (symbol)->ginfo.value.address
124 #define SYMBOL_VALUE_BYTES(symbol) (symbol)->ginfo.value.bytes
125 #define SYMBOL_BLOCK_VALUE(symbol) (symbol)->ginfo.value.block
126 #define SYMBOL_VALUE_CHAIN(symbol) (symbol)->ginfo.value.chain
127 #define SYMBOL_LANGUAGE(symbol) (symbol)->ginfo.language
128 #define SYMBOL_SECTION(symbol) (symbol)->ginfo.section
129 #define SYMBOL_BFD_SECTION(symbol) (symbol)->ginfo.bfd_section
130
131 #define SYMBOL_CPLUS_DEMANGLED_NAME(symbol) \
132 (symbol)->ginfo.language_specific.cplus_specific.demangled_name
133
134 /* Macro that initializes the language dependent portion of a symbol
135 depending upon the language for the symbol. */
136
137 #define SYMBOL_INIT_LANGUAGE_SPECIFIC(symbol,language) \
138 do { \
139 SYMBOL_LANGUAGE (symbol) = language; \
140 if (SYMBOL_LANGUAGE (symbol) == language_cplus \
141 || SYMBOL_LANGUAGE (symbol) == language_java \
142 ) \
143 { \
144 SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = NULL; \
145 } \
146 else if (SYMBOL_LANGUAGE (symbol) == language_chill) \
147 { \
148 SYMBOL_CHILL_DEMANGLED_NAME (symbol) = NULL; \
149 } \
150 else \
151 { \
152 memset (&(symbol)->ginfo.language_specific, 0, \
153 sizeof ((symbol)->ginfo.language_specific)); \
154 } \
155 } while (0)
156
157 /* Macro that attempts to initialize the demangled name for a symbol,
158 based on the language of that symbol. If the language is set to
159 language_auto, it will attempt to find any demangling algorithm
160 that works and then set the language appropriately. If no demangling
161 of any kind is found, the language is set back to language_unknown,
162 so we can avoid doing this work again the next time we encounter
163 the symbol. Any required space to store the name is obtained from the
164 specified obstack. */
165
166 #define SYMBOL_INIT_DEMANGLED_NAME(symbol,obstack) \
167 do { \
168 char *demangled = NULL; \
169 if (SYMBOL_LANGUAGE (symbol) == language_cplus \
170 || SYMBOL_LANGUAGE (symbol) == language_auto) \
171 { \
172 demangled = \
173 cplus_demangle (SYMBOL_NAME (symbol), DMGL_PARAMS | DMGL_ANSI);\
174 if (demangled != NULL) \
175 { \
176 SYMBOL_LANGUAGE (symbol) = language_cplus; \
177 SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = \
178 obsavestring (demangled, strlen (demangled), (obstack)); \
179 free (demangled); \
180 } \
181 else \
182 { \
183 SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = NULL; \
184 } \
185 } \
186 if (SYMBOL_LANGUAGE (symbol) == language_java) \
187 { \
188 demangled = \
189 cplus_demangle (SYMBOL_NAME (symbol), \
190 DMGL_PARAMS | DMGL_ANSI | DMGL_JAVA); \
191 if (demangled != NULL) \
192 { \
193 SYMBOL_LANGUAGE (symbol) = language_java; \
194 SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = \
195 obsavestring (demangled, strlen (demangled), (obstack)); \
196 free (demangled); \
197 } \
198 else \
199 { \
200 SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = NULL; \
201 } \
202 } \
203 if (demangled == NULL \
204 && (SYMBOL_LANGUAGE (symbol) == language_chill \
205 || SYMBOL_LANGUAGE (symbol) == language_auto)) \
206 { \
207 demangled = \
208 chill_demangle (SYMBOL_NAME (symbol)); \
209 if (demangled != NULL) \
210 { \
211 SYMBOL_LANGUAGE (symbol) = language_chill; \
212 SYMBOL_CHILL_DEMANGLED_NAME (symbol) = \
213 obsavestring (demangled, strlen (demangled), (obstack)); \
214 free (demangled); \
215 } \
216 else \
217 { \
218 SYMBOL_CHILL_DEMANGLED_NAME (symbol) = NULL; \
219 } \
220 } \
221 if (SYMBOL_LANGUAGE (symbol) == language_auto) \
222 { \
223 SYMBOL_LANGUAGE (symbol) = language_unknown; \
224 } \
225 } while (0)
226
227 /* Macro that returns the demangled name for a symbol based on the language
228 for that symbol. If no demangled name exists, returns NULL. */
229
230 #define SYMBOL_DEMANGLED_NAME(symbol) \
231 (SYMBOL_LANGUAGE (symbol) == language_cplus \
232 || SYMBOL_LANGUAGE (symbol) == language_java \
233 ? SYMBOL_CPLUS_DEMANGLED_NAME (symbol) \
234 : (SYMBOL_LANGUAGE (symbol) == language_chill \
235 ? SYMBOL_CHILL_DEMANGLED_NAME (symbol) \
236 : NULL))
237
238 #define SYMBOL_CHILL_DEMANGLED_NAME(symbol) \
239 (symbol)->ginfo.language_specific.chill_specific.demangled_name
240
241 /* Macro that returns the "natural source name" of a symbol. In C++ this is
242 the "demangled" form of the name if demangle is on and the "mangled" form
243 of the name if demangle is off. In other languages this is just the
244 symbol name. The result should never be NULL. */
245
246 #define SYMBOL_SOURCE_NAME(symbol) \
247 (demangle && SYMBOL_DEMANGLED_NAME (symbol) != NULL \
248 ? SYMBOL_DEMANGLED_NAME (symbol) \
249 : SYMBOL_NAME (symbol))
250
251 /* Macro that returns the "natural assembly name" of a symbol. In C++ this is
252 the "mangled" form of the name if demangle is off, or if demangle is on and
253 asm_demangle is off. Otherwise if asm_demangle is on it is the "demangled"
254 form. In other languages this is just the symbol name. The result should
255 never be NULL. */
256
257 #define SYMBOL_LINKAGE_NAME(symbol) \
258 (demangle && asm_demangle && SYMBOL_DEMANGLED_NAME (symbol) != NULL \
259 ? SYMBOL_DEMANGLED_NAME (symbol) \
260 : SYMBOL_NAME (symbol))
261
262 /* Macro that tests a symbol for a match against a specified name string.
263 First test the unencoded name, then looks for and test a C++ encoded
264 name if it exists. Note that whitespace is ignored while attempting to
265 match a C++ encoded name, so that "foo::bar(int,long)" is the same as
266 "foo :: bar (int, long)".
267 Evaluates to zero if the match fails, or nonzero if it succeeds. */
268
269 #define SYMBOL_MATCHES_NAME(symbol, name) \
270 (STREQ (SYMBOL_NAME (symbol), (name)) \
271 || (SYMBOL_DEMANGLED_NAME (symbol) != NULL \
272 && strcmp_iw (SYMBOL_DEMANGLED_NAME (symbol), (name)) == 0))
273
274 /* Macro that tests a symbol for an re-match against the last compiled regular
275 expression. First test the unencoded name, then look for and test a C++
276 encoded name if it exists.
277 Evaluates to zero if the match fails, or nonzero if it succeeds. */
278
279 #define SYMBOL_MATCHES_REGEXP(symbol) \
280 (re_exec (SYMBOL_NAME (symbol)) != 0 \
281 || (SYMBOL_DEMANGLED_NAME (symbol) != NULL \
282 && re_exec (SYMBOL_DEMANGLED_NAME (symbol)) != 0))
283
284 /* Define a simple structure used to hold some very basic information about
285 all defined global symbols (text, data, bss, abs, etc). The only required
286 information is the general_symbol_info.
287
288 In many cases, even if a file was compiled with no special options for
289 debugging at all, as long as was not stripped it will contain sufficient
290 information to build a useful minimal symbol table using this structure.
291 Even when a file contains enough debugging information to build a full
292 symbol table, these minimal symbols are still useful for quickly mapping
293 between names and addresses, and vice versa. They are also sometimes
294 used to figure out what full symbol table entries need to be read in. */
295
296 struct minimal_symbol
297 {
298
299 /* The general symbol info required for all types of symbols.
300
301 The SYMBOL_VALUE_ADDRESS contains the address that this symbol
302 corresponds to. */
303
304 struct general_symbol_info ginfo;
305
306 /* The info field is available for caching machine-specific information
307 so it doesn't have to rederive the info constantly (over a serial line).
308 It is initialized to zero and stays that way until target-dependent code
309 sets it. Storage for any data pointed to by this field should be allo-
310 cated on the symbol_obstack for the associated objfile.
311 The type would be "void *" except for reasons of compatibility with older
312 compilers. This field is optional.
313
314 Currently, the AMD 29000 tdep.c uses it to remember things it has decoded
315 from the instructions in the function header, and the MIPS-16 code uses
316 it to identify 16-bit procedures. */
317
318 char *info;
319
320 #ifdef SOFUN_ADDRESS_MAYBE_MISSING
321 /* Which source file is this symbol in? Only relevant for mst_file_*. */
322 char *filename;
323 #endif
324
325 /* Classification types for this symbol. These should be taken as "advisory
326 only", since if gdb can't easily figure out a classification it simply
327 selects mst_unknown. It may also have to guess when it can't figure out
328 which is a better match between two types (mst_data versus mst_bss) for
329 example. Since the minimal symbol info is sometimes derived from the
330 BFD library's view of a file, we need to live with what information bfd
331 supplies. */
332
333 enum minimal_symbol_type
334 {
335 mst_unknown = 0, /* Unknown type, the default */
336 mst_text, /* Generally executable instructions */
337 mst_data, /* Generally initialized data */
338 mst_bss, /* Generally uninitialized data */
339 mst_abs, /* Generally absolute (nonrelocatable) */
340 /* GDB uses mst_solib_trampoline for the start address of a shared
341 library trampoline entry. Breakpoints for shared library functions
342 are put there if the shared library is not yet loaded.
343 After the shared library is loaded, lookup_minimal_symbol will
344 prefer the minimal symbol from the shared library (usually
345 a mst_text symbol) over the mst_solib_trampoline symbol, and the
346 breakpoints will be moved to their true address in the shared
347 library via breakpoint_re_set. */
348 mst_solib_trampoline, /* Shared library trampoline code */
349 /* For the mst_file* types, the names are only guaranteed to be unique
350 within a given .o file. */
351 mst_file_text, /* Static version of mst_text */
352 mst_file_data, /* Static version of mst_data */
353 mst_file_bss /* Static version of mst_bss */
354 } type BYTE_BITFIELD;
355 };
356
357 #define MSYMBOL_INFO(msymbol) (msymbol)->info
358 #define MSYMBOL_TYPE(msymbol) (msymbol)->type
359
360 \f
361 /* All of the name-scope contours of the program
362 are represented by `struct block' objects.
363 All of these objects are pointed to by the blockvector.
364
365 Each block represents one name scope.
366 Each lexical context has its own block.
367
368 The blockvector begins with some special blocks.
369 The GLOBAL_BLOCK contains all the symbols defined in this compilation
370 whose scope is the entire program linked together.
371 The STATIC_BLOCK contains all the symbols whose scope is the
372 entire compilation excluding other separate compilations.
373 Blocks starting with the FIRST_LOCAL_BLOCK are not special.
374
375 Each block records a range of core addresses for the code that
376 is in the scope of the block. The STATIC_BLOCK and GLOBAL_BLOCK
377 give, for the range of code, the entire range of code produced
378 by the compilation that the symbol segment belongs to.
379
380 The blocks appear in the blockvector
381 in order of increasing starting-address,
382 and, within that, in order of decreasing ending-address.
383
384 This implies that within the body of one function
385 the blocks appear in the order of a depth-first tree walk. */
386
387 struct blockvector
388 {
389 /* Number of blocks in the list. */
390 int nblocks;
391 /* The blocks themselves. */
392 struct block *block[1];
393 };
394
395 #define BLOCKVECTOR_NBLOCKS(blocklist) (blocklist)->nblocks
396 #define BLOCKVECTOR_BLOCK(blocklist,n) (blocklist)->block[n]
397
398 /* Special block numbers */
399
400 #define GLOBAL_BLOCK 0
401 #define STATIC_BLOCK 1
402 #define FIRST_LOCAL_BLOCK 2
403
404 struct block
405 {
406
407 /* Addresses in the executable code that are in this block. */
408
409 CORE_ADDR startaddr;
410 CORE_ADDR endaddr;
411
412 /* The symbol that names this block, if the block is the body of a
413 function; otherwise, zero. */
414
415 struct symbol *function;
416
417 /* The `struct block' for the containing block, or 0 if none.
418
419 The superblock of a top-level local block (i.e. a function in the
420 case of C) is the STATIC_BLOCK. The superblock of the
421 STATIC_BLOCK is the GLOBAL_BLOCK. */
422
423 struct block *superblock;
424
425 /* Version of GCC used to compile the function corresponding
426 to this block, or 0 if not compiled with GCC. When possible,
427 GCC should be compatible with the native compiler, or if that
428 is not feasible, the differences should be fixed during symbol
429 reading. As of 16 Apr 93, this flag is never used to distinguish
430 between gcc2 and the native compiler.
431
432 If there is no function corresponding to this block, this meaning
433 of this flag is undefined. */
434
435 unsigned char gcc_compile_flag;
436
437 /* Number of local symbols. */
438
439 int nsyms;
440
441 /* The symbols. If some of them are arguments, then they must be
442 in the order in which we would like to print them. */
443
444 struct symbol *sym[1];
445 };
446
447 #define BLOCK_START(bl) (bl)->startaddr
448 #define BLOCK_END(bl) (bl)->endaddr
449 #define BLOCK_NSYMS(bl) (bl)->nsyms
450 #define BLOCK_SYM(bl, n) (bl)->sym[n]
451 #define BLOCK_FUNCTION(bl) (bl)->function
452 #define BLOCK_SUPERBLOCK(bl) (bl)->superblock
453 #define BLOCK_GCC_COMPILED(bl) (bl)->gcc_compile_flag
454
455 /* Nonzero if symbols of block BL should be sorted alphabetically.
456 Don't sort a block which corresponds to a function. If we did the
457 sorting would have to preserve the order of the symbols for the
458 arguments. */
459
460 #define BLOCK_SHOULD_SORT(bl) ((bl)->nsyms >= 40 && BLOCK_FUNCTION (bl) == NULL)
461
462 \f
463 /* Represent one symbol name; a variable, constant, function or typedef. */
464
465 /* Different name spaces for symbols. Looking up a symbol specifies a
466 namespace and ignores symbol definitions in other name spaces. */
467
468 typedef enum
469 {
470 /* UNDEF_NAMESPACE is used when a namespace has not been discovered or
471 none of the following apply. This usually indicates an error either
472 in the symbol information or in gdb's handling of symbols. */
473
474 UNDEF_NAMESPACE,
475
476 /* VAR_NAMESPACE is the usual namespace. In C, this contains variables,
477 function names, typedef names and enum type values. */
478
479 VAR_NAMESPACE,
480
481 /* STRUCT_NAMESPACE is used in C to hold struct, union and enum type names.
482 Thus, if `struct foo' is used in a C program, it produces a symbol named
483 `foo' in the STRUCT_NAMESPACE. */
484
485 STRUCT_NAMESPACE,
486
487 /* LABEL_NAMESPACE may be used for names of labels (for gotos);
488 currently it is not used and labels are not recorded at all. */
489
490 LABEL_NAMESPACE,
491
492 /* Searching namespaces. These overlap with VAR_NAMESPACE, providing
493 some granularity with the search_symbols function. */
494
495 /* Everything in VAR_NAMESPACE minus FUNCTIONS_-, TYPES_-, and
496 METHODS_NAMESPACE */
497 VARIABLES_NAMESPACE,
498
499 /* All functions -- for some reason not methods, though. */
500 FUNCTIONS_NAMESPACE,
501
502 /* All defined types */
503 TYPES_NAMESPACE,
504
505 /* All class methods -- why is this separated out? */
506 METHODS_NAMESPACE
507
508 } namespace_enum;
509
510 /* An address-class says where to find the value of a symbol. */
511
512 enum address_class
513 {
514 /* Not used; catches errors */
515
516 LOC_UNDEF,
517
518 /* Value is constant int SYMBOL_VALUE, host byteorder */
519
520 LOC_CONST,
521
522 /* Value is at fixed address SYMBOL_VALUE_ADDRESS */
523
524 LOC_STATIC,
525
526 /* Value is in register. SYMBOL_VALUE is the register number. */
527
528 LOC_REGISTER,
529
530 /* It's an argument; the value is at SYMBOL_VALUE offset in arglist. */
531
532 LOC_ARG,
533
534 /* Value address is at SYMBOL_VALUE offset in arglist. */
535
536 LOC_REF_ARG,
537
538 /* Value is in register number SYMBOL_VALUE. Just like LOC_REGISTER
539 except this is an argument. Probably the cleaner way to handle
540 this would be to separate address_class (which would include
541 separate ARG and LOCAL to deal with FRAME_ARGS_ADDRESS versus
542 FRAME_LOCALS_ADDRESS), and an is_argument flag.
543
544 For some symbol formats (stabs, for some compilers at least),
545 the compiler generates two symbols, an argument and a register.
546 In some cases we combine them to a single LOC_REGPARM in symbol
547 reading, but currently not for all cases (e.g. it's passed on the
548 stack and then loaded into a register). */
549
550 LOC_REGPARM,
551
552 /* Value is in specified register. Just like LOC_REGPARM except the
553 register holds the address of the argument instead of the argument
554 itself. This is currently used for the passing of structs and unions
555 on sparc and hppa. It is also used for call by reference where the
556 address is in a register, at least by mipsread.c. */
557
558 LOC_REGPARM_ADDR,
559
560 /* Value is a local variable at SYMBOL_VALUE offset in stack frame. */
561
562 LOC_LOCAL,
563
564 /* Value not used; definition in SYMBOL_TYPE. Symbols in the namespace
565 STRUCT_NAMESPACE all have this class. */
566
567 LOC_TYPEDEF,
568
569 /* Value is address SYMBOL_VALUE_ADDRESS in the code */
570
571 LOC_LABEL,
572
573 /* In a symbol table, value is SYMBOL_BLOCK_VALUE of a `struct block'.
574 In a partial symbol table, SYMBOL_VALUE_ADDRESS is the start address
575 of the block. Function names have this class. */
576
577 LOC_BLOCK,
578
579 /* Value is a constant byte-sequence pointed to by SYMBOL_VALUE_BYTES, in
580 target byte order. */
581
582 LOC_CONST_BYTES,
583
584 /* Value is arg at SYMBOL_VALUE offset in stack frame. Differs from
585 LOC_LOCAL in that symbol is an argument; differs from LOC_ARG in
586 that we find it in the frame (FRAME_LOCALS_ADDRESS), not in the
587 arglist (FRAME_ARGS_ADDRESS). Added for i960, which passes args
588 in regs then copies to frame. */
589
590 LOC_LOCAL_ARG,
591
592 /* Value is at SYMBOL_VALUE offset from the current value of
593 register number SYMBOL_BASEREG. This exists mainly for the same
594 things that LOC_LOCAL and LOC_ARG do; but we need to do this
595 instead because on 88k DWARF gives us the offset from the
596 frame/stack pointer, rather than the offset from the "canonical
597 frame address" used by COFF, stabs, etc., and we don't know how
598 to convert between these until we start examining prologues.
599
600 Note that LOC_BASEREG is much less general than a DWARF expression.
601 We don't need the generality (at least not yet), and storing a general
602 DWARF expression would presumably take up more space than the existing
603 scheme. */
604
605 LOC_BASEREG,
606
607 /* Same as LOC_BASEREG but it is an argument. */
608
609 LOC_BASEREG_ARG,
610
611 /* Value is at fixed address, but the address of the variable has
612 to be determined from the minimal symbol table whenever the
613 variable is referenced.
614 This happens if debugging information for a global symbol is
615 emitted and the corresponding minimal symbol is defined
616 in another object file or runtime common storage.
617 The linker might even remove the minimal symbol if the global
618 symbol is never referenced, in which case the symbol remains
619 unresolved. */
620
621 LOC_UNRESOLVED,
622
623 /* Value is at a thread-specific location calculated by a
624 target-specific method. */
625
626 LOC_THREAD_LOCAL_STATIC,
627
628 /* The variable does not actually exist in the program.
629 The value is ignored. */
630
631 LOC_OPTIMIZED_OUT,
632
633 /* The variable is static, but actually lives at * (address).
634 * I.e. do an extra indirection to get to it.
635 * This is used on HP-UX to get at globals that are allocated
636 * in shared libraries, where references from images other
637 * than the one where the global was allocated are done
638 * with a level of indirection.
639 */
640
641 LOC_INDIRECT
642
643 };
644
645 /* Linked list of symbol's live ranges. */
646
647 struct range_list
648 {
649 CORE_ADDR start;
650 CORE_ADDR end;
651 struct range_list *next;
652 };
653
654 /* Linked list of aliases for a particular main/primary symbol. */
655 struct alias_list
656 {
657 struct symbol *sym;
658 struct alias_list *next;
659 };
660
661 struct symbol
662 {
663
664 /* The general symbol info required for all types of symbols. */
665
666 struct general_symbol_info ginfo;
667
668 /* Data type of value */
669
670 struct type *type;
671
672 /* Name space code. */
673
674 #ifdef __MFC4__
675 /* FIXME: don't conflict with C++'s namespace */
676 /* would be safer to do a global change for all namespace identifiers. */
677 #define namespace _namespace
678 #endif
679 namespace_enum namespace BYTE_BITFIELD;
680
681 /* Address class */
682
683 enum address_class aclass BYTE_BITFIELD;
684
685 /* Line number of definition. FIXME: Should we really make the assumption
686 that nobody will try to debug files longer than 64K lines? What about
687 machine generated programs? */
688
689 unsigned short line;
690
691 /* Some symbols require an additional value to be recorded on a per-
692 symbol basis. Stash those values here. */
693
694 union
695 {
696 /* Used by LOC_BASEREG and LOC_BASEREG_ARG. */
697 short basereg;
698 }
699 aux_value;
700
701
702 /* Link to a list of aliases for this symbol.
703 Only a "primary/main symbol may have aliases. */
704 struct alias_list *aliases;
705
706 /* List of ranges where this symbol is active. This is only
707 used by alias symbols at the current time. */
708 struct range_list *ranges;
709 };
710
711
712 #define SYMBOL_NAMESPACE(symbol) (symbol)->namespace
713 #define SYMBOL_CLASS(symbol) (symbol)->aclass
714 #define SYMBOL_TYPE(symbol) (symbol)->type
715 #define SYMBOL_LINE(symbol) (symbol)->line
716 #define SYMBOL_BASEREG(symbol) (symbol)->aux_value.basereg
717 #define SYMBOL_ALIASES(symbol) (symbol)->aliases
718 #define SYMBOL_RANGES(symbol) (symbol)->ranges
719 \f
720 /* A partial_symbol records the name, namespace, and address class of
721 symbols whose types we have not parsed yet. For functions, it also
722 contains their memory address, so we can find them from a PC value.
723 Each partial_symbol sits in a partial_symtab, all of which are chained
724 on a partial symtab list and which points to the corresponding
725 normal symtab once the partial_symtab has been referenced. */
726
727 struct partial_symbol
728 {
729
730 /* The general symbol info required for all types of symbols. */
731
732 struct general_symbol_info ginfo;
733
734 /* Name space code. */
735
736 namespace_enum namespace BYTE_BITFIELD;
737
738 /* Address class (for info_symbols) */
739
740 enum address_class aclass BYTE_BITFIELD;
741
742 };
743
744 #define PSYMBOL_NAMESPACE(psymbol) (psymbol)->namespace
745 #define PSYMBOL_CLASS(psymbol) (psymbol)->aclass
746
747 \f
748 /* Source-file information. This describes the relation between source files,
749 ine numbers and addresses in the program text. */
750
751 struct sourcevector
752 {
753 int length; /* Number of source files described */
754 struct source *source[1]; /* Descriptions of the files */
755 };
756
757 /* Each item represents a line-->pc (or the reverse) mapping. This is
758 somewhat more wasteful of space than one might wish, but since only
759 the files which are actually debugged are read in to core, we don't
760 waste much space. */
761
762 struct linetable_entry
763 {
764 int line;
765 CORE_ADDR pc;
766 };
767
768 /* The order of entries in the linetable is significant. They should
769 be sorted by increasing values of the pc field. If there is more than
770 one entry for a given pc, then I'm not sure what should happen (and
771 I not sure whether we currently handle it the best way).
772
773 Example: a C for statement generally looks like this
774
775 10 0x100 - for the init/test part of a for stmt.
776 20 0x200
777 30 0x300
778 10 0x400 - for the increment part of a for stmt.
779
780 */
781
782 struct linetable
783 {
784 int nitems;
785
786 /* Actually NITEMS elements. If you don't like this use of the
787 `struct hack', you can shove it up your ANSI (seriously, if the
788 committee tells us how to do it, we can probably go along). */
789 struct linetable_entry item[1];
790 };
791
792 /* All the information on one source file. */
793
794 struct source
795 {
796 char *name; /* Name of file */
797 struct linetable contents;
798 };
799
800 /* How to relocate the symbols from each section in a symbol file.
801 Each struct contains an array of offsets.
802 The ordering and meaning of the offsets is file-type-dependent;
803 typically it is indexed by section numbers or symbol types or
804 something like that.
805
806 To give us flexibility in changing the internal representation
807 of these offsets, the ANOFFSET macro must be used to insert and
808 extract offset values in the struct. */
809
810 struct section_offsets
811 {
812 CORE_ADDR offsets[1]; /* As many as needed. */
813 };
814
815 #define ANOFFSET(secoff, whichone) (secoff->offsets[whichone])
816
817 /* The maximum possible size of a section_offsets table. */
818
819 #define SIZEOF_SECTION_OFFSETS \
820 (sizeof (struct section_offsets) \
821 + sizeof (((struct section_offsets *) 0)->offsets) * (SECT_OFF_MAX-1))
822
823
824 /* Each source file or header is represented by a struct symtab.
825 These objects are chained through the `next' field. */
826
827 struct symtab
828 {
829
830 /* Chain of all existing symtabs. */
831
832 struct symtab *next;
833
834 /* List of all symbol scope blocks for this symtab. May be shared
835 between different symtabs (and normally is for all the symtabs
836 in a given compilation unit). */
837
838 struct blockvector *blockvector;
839
840 /* Table mapping core addresses to line numbers for this file.
841 Can be NULL if none. Never shared between different symtabs. */
842
843 struct linetable *linetable;
844
845 /* Section in objfile->section_offsets for the blockvector and
846 the linetable. Probably always SECT_OFF_TEXT. */
847
848 int block_line_section;
849
850 /* If several symtabs share a blockvector, exactly one of them
851 should be designed the primary, so that the blockvector
852 is relocated exactly once by objfile_relocate. */
853
854 int primary;
855
856 /* Name of this source file. */
857
858 char *filename;
859
860 /* Directory in which it was compiled, or NULL if we don't know. */
861
862 char *dirname;
863
864 /* This component says how to free the data we point to:
865 free_contents => do a tree walk and free each object.
866 free_nothing => do nothing; some other symtab will free
867 the data this one uses.
868 free_linetable => free just the linetable. FIXME: Is this redundant
869 with the primary field? */
870
871 enum free_code
872 {
873 free_nothing, free_contents, free_linetable
874 }
875 free_code;
876
877 /* Pointer to one block of storage to be freed, if nonzero. */
878 /* This is IN ADDITION to the action indicated by free_code. */
879
880 char *free_ptr;
881
882 /* Total number of lines found in source file. */
883
884 int nlines;
885
886 /* line_charpos[N] is the position of the (N-1)th line of the
887 source file. "position" means something we can lseek() to; it
888 is not guaranteed to be useful any other way. */
889
890 int *line_charpos;
891
892 /* Language of this source file. */
893
894 enum language language;
895
896 /* String that identifies the format of the debugging information, such
897 as "stabs", "dwarf 1", "dwarf 2", "coff", etc. This is mostly useful
898 for automated testing of gdb but may also be information that is
899 useful to the user. */
900
901 char *debugformat;
902
903 /* String of version information. May be zero. */
904
905 char *version;
906
907 /* Full name of file as found by searching the source path.
908 NULL if not yet known. */
909
910 char *fullname;
911
912 /* Object file from which this symbol information was read. */
913
914 struct objfile *objfile;
915
916 };
917
918 #define BLOCKVECTOR(symtab) (symtab)->blockvector
919 #define LINETABLE(symtab) (symtab)->linetable
920
921 \f
922 /* Each source file that has not been fully read in is represented by
923 a partial_symtab. This contains the information on where in the
924 executable the debugging symbols for a specific file are, and a
925 list of names of global symbols which are located in this file.
926 They are all chained on partial symtab lists.
927
928 Even after the source file has been read into a symtab, the
929 partial_symtab remains around. They are allocated on an obstack,
930 psymbol_obstack. FIXME, this is bad for dynamic linking or VxWorks-
931 style execution of a bunch of .o's. */
932
933 struct partial_symtab
934 {
935
936 /* Chain of all existing partial symtabs. */
937
938 struct partial_symtab *next;
939
940 /* Name of the source file which this partial_symtab defines */
941
942 char *filename;
943
944 /* Information about the object file from which symbols should be read. */
945
946 struct objfile *objfile;
947
948 /* Set of relocation offsets to apply to each section. */
949
950 struct section_offsets *section_offsets;
951
952 /* Range of text addresses covered by this file; texthigh is the
953 beginning of the next section. */
954
955 CORE_ADDR textlow;
956 CORE_ADDR texthigh;
957
958 /* Array of pointers to all of the partial_symtab's which this one
959 depends on. Since this array can only be set to previous or
960 the current (?) psymtab, this dependency tree is guaranteed not
961 to have any loops. "depends on" means that symbols must be read
962 for the dependencies before being read for this psymtab; this is
963 for type references in stabs, where if foo.c includes foo.h, declarations
964 in foo.h may use type numbers defined in foo.c. For other debugging
965 formats there may be no need to use dependencies. */
966
967 struct partial_symtab **dependencies;
968
969 int number_of_dependencies;
970
971 /* Global symbol list. This list will be sorted after readin to
972 improve access. Binary search will be the usual method of
973 finding a symbol within it. globals_offset is an integer offset
974 within global_psymbols[]. */
975
976 int globals_offset;
977 int n_global_syms;
978
979 /* Static symbol list. This list will *not* be sorted after readin;
980 to find a symbol in it, exhaustive search must be used. This is
981 reasonable because searches through this list will eventually
982 lead to either the read in of a files symbols for real (assumed
983 to take a *lot* of time; check) or an error (and we don't care
984 how long errors take). This is an offset and size within
985 static_psymbols[]. */
986
987 int statics_offset;
988 int n_static_syms;
989
990 /* Pointer to symtab eventually allocated for this source file, 0 if
991 !readin or if we haven't looked for the symtab after it was readin. */
992
993 struct symtab *symtab;
994
995 /* Pointer to function which will read in the symtab corresponding to
996 this psymtab. */
997
998 void (*read_symtab) PARAMS ((struct partial_symtab *));
999
1000 /* Information that lets read_symtab() locate the part of the symbol table
1001 that this psymtab corresponds to. This information is private to the
1002 format-dependent symbol reading routines. For further detail examine
1003 the various symbol reading modules. Should really be (void *) but is
1004 (char *) as with other such gdb variables. (FIXME) */
1005
1006 char *read_symtab_private;
1007
1008 /* Non-zero if the symtab corresponding to this psymtab has been readin */
1009
1010 unsigned char readin;
1011 };
1012
1013 /* A fast way to get from a psymtab to its symtab (after the first time). */
1014 #define PSYMTAB_TO_SYMTAB(pst) \
1015 ((pst) -> symtab != NULL ? (pst) -> symtab : psymtab_to_symtab (pst))
1016
1017 \f
1018 /* The virtual function table is now an array of structures which have the
1019 form { int16 offset, delta; void *pfn; }.
1020
1021 In normal virtual function tables, OFFSET is unused.
1022 DELTA is the amount which is added to the apparent object's base
1023 address in order to point to the actual object to which the
1024 virtual function should be applied.
1025 PFN is a pointer to the virtual function.
1026
1027 Note that this macro is g++ specific (FIXME). */
1028
1029 #define VTBL_FNADDR_OFFSET 2
1030
1031 /* Macro that yields non-zero value iff NAME is the prefix for C++ operator
1032 names. If you leave out the parenthesis here you will lose!
1033 Currently 'o' 'p' CPLUS_MARKER is used for both the symbol in the
1034 symbol-file and the names in gdb's symbol table.
1035 Note that this macro is g++ specific (FIXME). */
1036
1037 #define OPNAME_PREFIX_P(NAME) \
1038 ((NAME)[0] == 'o' && (NAME)[1] == 'p' && is_cplus_marker ((NAME)[2]))
1039
1040 /* Macro that yields non-zero value iff NAME is the prefix for C++ vtbl
1041 names. Note that this macro is g++ specific (FIXME).
1042 '_vt$' is the old cfront-style vtables; '_VT$' is the new
1043 style, using thunks (where '$' is really CPLUS_MARKER). */
1044
1045 #define VTBL_PREFIX_P(NAME) \
1046 ((NAME)[0] == '_' \
1047 && (((NAME)[1] == 'V' && (NAME)[2] == 'T') \
1048 || ((NAME)[1] == 'v' && (NAME)[2] == 't')) \
1049 && is_cplus_marker ((NAME)[3]))
1050
1051 /* Macro that yields non-zero value iff NAME is the prefix for C++ destructor
1052 names. Note that this macro is g++ specific (FIXME). */
1053
1054 #define DESTRUCTOR_PREFIX_P(NAME) \
1055 ((NAME)[0] == '_' && is_cplus_marker ((NAME)[1]) && (NAME)[2] == '_')
1056
1057 \f
1058 /* External variables and functions for the objects described above. */
1059
1060 /* This symtab variable specifies the current file for printing source lines */
1061
1062 extern struct symtab *current_source_symtab;
1063
1064 /* This is the next line to print for listing source lines. */
1065
1066 extern int current_source_line;
1067
1068 /* See the comment in symfile.c about how current_objfile is used. */
1069
1070 extern struct objfile *current_objfile;
1071
1072 /* True if we are nested inside psymtab_to_symtab. */
1073
1074 extern int currently_reading_symtab;
1075
1076 /* From utils.c. */
1077 extern int demangle;
1078 extern int asm_demangle;
1079
1080 /* symtab.c lookup functions */
1081
1082 /* lookup a symbol table by source file name */
1083
1084 extern struct symtab *
1085 lookup_symtab PARAMS ((char *));
1086
1087 /* lookup a symbol by name (optional block, optional symtab) */
1088
1089 extern struct symbol *
1090 lookup_symbol PARAMS ((const char *, const struct block *,
1091 const namespace_enum, int *, struct symtab **));
1092
1093 /* lookup a symbol by name, within a specified block */
1094
1095 extern struct symbol *
1096 lookup_block_symbol PARAMS ((const struct block *, const char *,
1097 const namespace_enum));
1098
1099 /* lookup a [struct, union, enum] by name, within a specified block */
1100
1101 extern struct type *
1102 lookup_struct PARAMS ((char *, struct block *));
1103
1104 extern struct type *
1105 lookup_union PARAMS ((char *, struct block *));
1106
1107 extern struct type *
1108 lookup_enum PARAMS ((char *, struct block *));
1109
1110 /* lookup the function corresponding to the block */
1111
1112 extern struct symbol *
1113 block_function PARAMS ((struct block *));
1114
1115 /* from blockframe.c: */
1116
1117 /* lookup the function symbol corresponding to the address */
1118
1119 extern struct symbol *
1120 find_pc_function PARAMS ((CORE_ADDR));
1121
1122 /* lookup the function corresponding to the address and section */
1123
1124 extern struct symbol *
1125 find_pc_sect_function PARAMS ((CORE_ADDR, asection *));
1126
1127 /* lookup function from address, return name, start addr and end addr */
1128
1129 extern int
1130 find_pc_partial_function PARAMS ((CORE_ADDR, char **,
1131 CORE_ADDR *, CORE_ADDR *));
1132
1133 extern void
1134 clear_pc_function_cache PARAMS ((void));
1135
1136 extern int
1137 find_pc_sect_partial_function PARAMS ((CORE_ADDR, asection *,
1138 char **, CORE_ADDR *, CORE_ADDR *));
1139
1140 /* from symtab.c: */
1141
1142 /* lookup partial symbol table by filename */
1143
1144 extern struct partial_symtab *
1145 lookup_partial_symtab PARAMS ((char *));
1146
1147 /* lookup partial symbol table by address */
1148
1149 extern struct partial_symtab *
1150 find_pc_psymtab PARAMS ((CORE_ADDR));
1151
1152 /* lookup partial symbol table by address and section */
1153
1154 extern struct partial_symtab *
1155 find_pc_sect_psymtab PARAMS ((CORE_ADDR, asection *));
1156
1157 /* lookup full symbol table by address */
1158
1159 extern struct symtab *
1160 find_pc_symtab PARAMS ((CORE_ADDR));
1161
1162 /* lookup full symbol table by address and section */
1163
1164 extern struct symtab *
1165 find_pc_sect_symtab PARAMS ((CORE_ADDR, asection *));
1166
1167 /* lookup partial symbol by address */
1168
1169 extern struct partial_symbol *
1170 find_pc_psymbol PARAMS ((struct partial_symtab *, CORE_ADDR));
1171
1172 /* lookup partial symbol by address and section */
1173
1174 extern struct partial_symbol *
1175 find_pc_sect_psymbol PARAMS ((struct partial_symtab *, CORE_ADDR, asection *));
1176
1177 extern int
1178 find_pc_line_pc_range PARAMS ((CORE_ADDR, CORE_ADDR *, CORE_ADDR *));
1179
1180 extern int
1181 contained_in PARAMS ((struct block *, struct block *));
1182
1183 extern void
1184 reread_symbols PARAMS ((void));
1185
1186 extern struct type *
1187 lookup_transparent_type PARAMS ((const char *));
1188
1189
1190 /* Macro for name of symbol to indicate a file compiled with gcc. */
1191 #ifndef GCC_COMPILED_FLAG_SYMBOL
1192 #define GCC_COMPILED_FLAG_SYMBOL "gcc_compiled."
1193 #endif
1194
1195 /* Macro for name of symbol to indicate a file compiled with gcc2. */
1196 #ifndef GCC2_COMPILED_FLAG_SYMBOL
1197 #define GCC2_COMPILED_FLAG_SYMBOL "gcc2_compiled."
1198 #endif
1199
1200 /* Functions for dealing with the minimal symbol table, really a misc
1201 address<->symbol mapping for things we don't have debug symbols for. */
1202
1203 extern void prim_record_minimal_symbol PARAMS ((const char *, CORE_ADDR,
1204 enum minimal_symbol_type,
1205 struct objfile *));
1206
1207 extern struct minimal_symbol *prim_record_minimal_symbol_and_info
1208 PARAMS ((const char *, CORE_ADDR,
1209 enum minimal_symbol_type,
1210 char *info, int section,
1211 asection *bfd_section,
1212 struct objfile *));
1213
1214 #ifdef SOFUN_ADDRESS_MAYBE_MISSING
1215 extern CORE_ADDR find_stab_function_addr PARAMS ((char *,
1216 struct partial_symtab *,
1217 struct objfile *));
1218 #endif
1219
1220 extern struct minimal_symbol *
1221 lookup_minimal_symbol PARAMS ((const char *, const char *, struct objfile *));
1222
1223 extern struct minimal_symbol *
1224 lookup_minimal_symbol_text PARAMS ((const char *, const char *, struct objfile *));
1225
1226 struct minimal_symbol *
1227 lookup_minimal_symbol_solib_trampoline PARAMS ((const char *,
1228 const char *,
1229 struct objfile *));
1230
1231 extern struct minimal_symbol *
1232 lookup_minimal_symbol_by_pc PARAMS ((CORE_ADDR));
1233
1234 extern struct minimal_symbol *
1235 lookup_minimal_symbol_by_pc_section PARAMS ((CORE_ADDR, asection *));
1236
1237 extern struct minimal_symbol *
1238 lookup_solib_trampoline_symbol_by_pc PARAMS ((CORE_ADDR));
1239
1240 extern CORE_ADDR
1241 find_solib_trampoline_target PARAMS ((CORE_ADDR));
1242
1243 extern void
1244 init_minimal_symbol_collection PARAMS ((void));
1245
1246 extern void
1247 discard_minimal_symbols PARAMS ((int));
1248
1249 extern void
1250 install_minimal_symbols PARAMS ((struct objfile *));
1251
1252 /* Sort all the minimal symbols in OBJFILE. */
1253
1254 extern void msymbols_sort PARAMS ((struct objfile *objfile));
1255
1256 struct symtab_and_line
1257 {
1258 struct symtab *symtab;
1259 asection *section;
1260 /* Line number. Line numbers start at 1 and proceed through symtab->nlines.
1261 0 is never a valid line number; it is used to indicate that line number
1262 information is not available. */
1263 int line;
1264
1265 CORE_ADDR pc;
1266 CORE_ADDR end;
1267 };
1268
1269 #define INIT_SAL(sal) { \
1270 (sal)->symtab = 0; \
1271 (sal)->section = 0; \
1272 (sal)->line = 0; \
1273 (sal)->pc = 0; \
1274 (sal)->end = 0; \
1275 }
1276
1277 struct symtabs_and_lines
1278 {
1279 struct symtab_and_line *sals;
1280 int nelts;
1281 };
1282
1283
1284 \f
1285 /* Some types and macros needed for exception catchpoints.
1286 Can't put these in target.h because symtab_and_line isn't
1287 known there. This file will be included by breakpoint.c,
1288 hppa-tdep.c, etc. */
1289
1290 /* Enums for exception-handling support */
1291 enum exception_event_kind {
1292 EX_EVENT_THROW,
1293 EX_EVENT_CATCH
1294 };
1295
1296 /* Type for returning info about an exception */
1297 struct exception_event_record {
1298 enum exception_event_kind kind;
1299 struct symtab_and_line throw_sal;
1300 struct symtab_and_line catch_sal;
1301 /* This may need to be extended in the future, if
1302 some platforms allow reporting more information,
1303 such as point of rethrow, type of exception object,
1304 type expected by catch clause, etc. */
1305 };
1306
1307 #define CURRENT_EXCEPTION_KIND (current_exception_event->kind)
1308 #define CURRENT_EXCEPTION_CATCH_SAL (current_exception_event->catch_sal)
1309 #define CURRENT_EXCEPTION_CATCH_LINE (current_exception_event->catch_sal.line)
1310 #define CURRENT_EXCEPTION_CATCH_FILE (current_exception_event->catch_sal.symtab->filename)
1311 #define CURRENT_EXCEPTION_CATCH_PC (current_exception_event->catch_sal.pc)
1312 #define CURRENT_EXCEPTION_THROW_SAL (current_exception_event->throw_sal)
1313 #define CURRENT_EXCEPTION_THROW_LINE (current_exception_event->throw_sal.line)
1314 #define CURRENT_EXCEPTION_THROW_FILE (current_exception_event->throw_sal.symtab->filename)
1315 #define CURRENT_EXCEPTION_THROW_PC (current_exception_event->throw_sal.pc)
1316 \f
1317
1318 /* Given a pc value, return line number it is in. Second arg nonzero means
1319 if pc is on the boundary use the previous statement's line number. */
1320
1321 extern struct symtab_and_line
1322 find_pc_line PARAMS ((CORE_ADDR, int));
1323
1324 /* Same function, but specify a section as well as an address */
1325
1326 extern struct symtab_and_line
1327 find_pc_sect_line PARAMS ((CORE_ADDR, asection *, int));
1328
1329 /* Given an address, return the nearest symbol at or below it in memory.
1330 Optionally return the symtab it's from through 2nd arg, and the
1331 address in inferior memory of the symbol through 3rd arg. */
1332
1333 extern struct symbol *
1334 find_addr_symbol PARAMS ((CORE_ADDR, struct symtab **, CORE_ADDR *));
1335
1336 /* Given a symtab and line number, return the pc there. */
1337
1338 extern int
1339 find_line_pc PARAMS ((struct symtab *, int, CORE_ADDR *));
1340
1341 extern int
1342 find_line_pc_range PARAMS ((struct symtab_and_line,
1343 CORE_ADDR *, CORE_ADDR *));
1344
1345 extern void
1346 resolve_sal_pc PARAMS ((struct symtab_and_line *));
1347
1348 /* Given a string, return the line specified by it. For commands like "list"
1349 and "breakpoint". */
1350
1351 extern struct symtabs_and_lines
1352 decode_line_spec PARAMS ((char *, int));
1353
1354 extern struct symtabs_and_lines
1355 decode_line_spec_1 PARAMS ((char *, int));
1356
1357 extern struct symtabs_and_lines
1358 decode_line_1 PARAMS ((char **, int, struct symtab *, int, char ***));
1359
1360 #if MAINTENANCE_CMDS
1361
1362 /* Symmisc.c */
1363
1364 void
1365 maintenance_print_symbols PARAMS ((char *, int));
1366
1367 void
1368 maintenance_print_psymbols PARAMS ((char *, int));
1369
1370 void
1371 maintenance_print_msymbols PARAMS ((char *, int));
1372
1373 void
1374 maintenance_print_objfiles PARAMS ((char *, int));
1375
1376 void
1377 maintenance_check_symtabs PARAMS ((char *, int));
1378
1379 /* maint.c */
1380
1381 void
1382 maintenance_print_statistics PARAMS ((char *, int));
1383
1384 #endif
1385
1386 extern void
1387 free_symtab PARAMS ((struct symtab *));
1388
1389 /* Symbol-reading stuff in symfile.c and solib.c. */
1390
1391 extern struct symtab *
1392 psymtab_to_symtab PARAMS ((struct partial_symtab *));
1393
1394 extern void
1395 clear_solib PARAMS ((void));
1396
1397 extern struct objfile *
1398 symbol_file_add PARAMS ((char *, int, CORE_ADDR, int, int, int, int, int));
1399
1400 /* source.c */
1401
1402 extern int
1403 identify_source_line PARAMS ((struct symtab *, int, int, CORE_ADDR));
1404
1405 extern void
1406 print_source_lines PARAMS ((struct symtab *, int, int, int));
1407
1408 extern void
1409 forget_cached_source_info PARAMS ((void));
1410
1411 extern void
1412 select_source_symtab PARAMS ((struct symtab *));
1413
1414 extern char **make_symbol_completion_list PARAMS ((char *, char *));
1415
1416 extern struct symbol **
1417 make_symbol_overload_list PARAMS ((struct symbol *));
1418
1419 /* symtab.c */
1420
1421 extern struct partial_symtab *
1422 find_main_psymtab PARAMS ((void));
1423
1424 /* blockframe.c */
1425
1426 extern struct blockvector *
1427 blockvector_for_pc PARAMS ((CORE_ADDR, int *));
1428
1429 extern struct blockvector *
1430 blockvector_for_pc_sect PARAMS ((CORE_ADDR, asection *, int *,
1431 struct symtab *));
1432
1433 /* symfile.c */
1434
1435 extern void
1436 clear_symtab_users PARAMS ((void));
1437
1438 extern enum language
1439 deduce_language_from_filename PARAMS ((char *));
1440
1441 /* symtab.c */
1442
1443 extern int
1444 in_prologue PARAMS ((CORE_ADDR pc, CORE_ADDR func_start));
1445
1446 extern struct symbol *
1447 fixup_symbol_section PARAMS ((struct symbol *, struct objfile *));
1448
1449 /* Symbol searching */
1450
1451 /* When using search_symbols, a list of the following structs is returned.
1452 Callers must free the search list using free_symbol_search! */
1453 struct symbol_search
1454 {
1455 /* The block in which the match was found. Could be, for example,
1456 STATIC_BLOCK or GLOBAL_BLOCK. */
1457 int block;
1458
1459 /* Information describing what was found.
1460
1461 If symtab abd symbol are NOT NULL, then information was found
1462 for this match. */
1463 struct symtab *symtab;
1464 struct symbol *symbol;
1465
1466 /* If msymbol is non-null, then a match was made on something for
1467 which only minimal_symbols exist. */
1468 struct minimal_symbol *msymbol;
1469
1470 /* A link to the next match, or NULL for the end. */
1471 struct symbol_search *next;
1472 };
1473
1474 extern void search_symbols PARAMS ((char *, namespace_enum, int, char **, struct symbol_search **));
1475 extern void free_search_symbols PARAMS ((struct symbol_search *));
1476
1477 #endif /* !defined(SYMTAB_H) */