1 /* Do various things to symbol tables (other than lookup), for GDB.
2 Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994
3 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
27 #include "breakpoint.h"
32 #include "gdb_string.h"
35 #define DEV_TTY "/dev/tty"
38 /* Unfortunately for debugging, stderr is usually a macro. This is painful
39 when calling functions that take FILE *'s from the debugger.
40 So we make a variable which has the same value and which is accessible when
41 debugging GDB with itself. Because stdin et al need not be constants,
42 we initialize them in the _initialize_symmisc function at the bottom
48 /* Prototypes for local functions */
51 dump_symtab
PARAMS ((struct objfile
*, struct symtab
*, GDB_FILE
*));
54 dump_psymtab
PARAMS ((struct objfile
*, struct partial_symtab
*, GDB_FILE
*));
57 dump_msymbols
PARAMS ((struct objfile
*, GDB_FILE
*));
60 dump_objfile
PARAMS ((struct objfile
*));
63 block_depth
PARAMS ((struct block
*));
66 print_partial_symbol
PARAMS ((struct partial_symbol
*, int, char *, GDB_FILE
*));
68 struct print_symbol_args
{
69 struct symbol
*symbol
;
74 static int print_symbol
PARAMS ((char *));
77 free_symtab_block
PARAMS ((struct objfile
*, struct block
*));
80 /* Free a struct block <- B and all the symbols defined in that block. */
83 free_symtab_block (objfile
, b
)
84 struct objfile
*objfile
;
89 for (i
= 0; i
< n
; i
++)
91 mfree (objfile
-> md
, SYMBOL_NAME (BLOCK_SYM (b
, i
)));
92 mfree (objfile
-> md
, (PTR
) BLOCK_SYM (b
, i
));
94 mfree (objfile
-> md
, (PTR
) b
);
97 /* Free all the storage associated with the struct symtab <- S.
98 Note that some symtabs have contents malloc'ed structure by structure,
99 while some have contents that all live inside one big block of memory,
100 and some share the contents of another symbol table and so you should
101 not free the contents on their behalf (except sometimes the linetable,
102 which maybe per symtab even when the rest is not).
103 It is s->free_code that says which alternative to use. */
107 register struct symtab
*s
;
110 register struct blockvector
*bv
;
112 switch (s
->free_code
)
115 /* All the contents are part of a big block of memory (an obstack),
116 and some other symtab is in charge of freeing that block.
117 Therefore, do nothing. */
121 /* Here all the contents were malloc'ed structure by structure
122 and must be freed that way. */
123 /* First free the blocks (and their symbols. */
124 bv
= BLOCKVECTOR (s
);
125 n
= BLOCKVECTOR_NBLOCKS (bv
);
126 for (i
= 0; i
< n
; i
++)
127 free_symtab_block (s
-> objfile
, BLOCKVECTOR_BLOCK (bv
, i
));
128 /* Free the blockvector itself. */
129 mfree (s
-> objfile
-> md
, (PTR
) bv
);
130 /* Also free the linetable. */
133 /* Everything will be freed either by our `free_ptr'
134 or by some other symtab, except for our linetable.
137 mfree (s
-> objfile
-> md
, (PTR
) LINETABLE (s
));
141 /* If there is a single block of memory to free, free it. */
142 if (s
-> free_ptr
!= NULL
)
143 mfree (s
-> objfile
-> md
, s
-> free_ptr
);
145 /* Free source-related stuff */
146 if (s
-> line_charpos
!= NULL
)
147 mfree (s
-> objfile
-> md
, (PTR
) s
-> line_charpos
);
148 if (s
-> fullname
!= NULL
)
149 mfree (s
-> objfile
-> md
, s
-> fullname
);
150 mfree (s
-> objfile
-> md
, (PTR
) s
);
156 dump_objfile (objfile
)
157 struct objfile
*objfile
;
159 struct symtab
*symtab
;
160 struct partial_symtab
*psymtab
;
162 printf_filtered ("\nObject file %s: ", objfile
-> name
);
163 printf_filtered ("Objfile at ");
164 gdb_print_address (objfile
, gdb_stdout
);
165 printf_filtered (", bfd at ");
166 gdb_print_address (objfile
->obfd
, gdb_stdout
);
167 printf_filtered (", %d minsyms\n\n",
168 objfile
->minimal_symbol_count
);
170 if (objfile
-> psymtabs
)
172 printf_filtered ("Psymtabs:\n");
173 for (psymtab
= objfile
-> psymtabs
;
175 psymtab
= psymtab
-> next
)
177 printf_filtered ("%s at ",
178 psymtab
-> filename
);
179 gdb_print_address (psymtab
, gdb_stdout
);
180 printf_filtered (", ");
181 if (psymtab
-> objfile
!= objfile
)
183 printf_filtered ("NOT ON CHAIN! ");
187 printf_filtered ("\n\n");
190 if (objfile
-> symtabs
)
192 printf_filtered ("Symtabs:\n");
193 for (symtab
= objfile
-> symtabs
;
195 symtab
= symtab
->next
)
197 printf_filtered ("%s at ", symtab
-> filename
);
198 gdb_print_address (symtab
, gdb_stdout
);
199 printf_filtered (", ");
200 if (symtab
-> objfile
!= objfile
)
202 printf_filtered ("NOT ON CHAIN! ");
206 printf_filtered ("\n\n");
210 /* Print minimal symbols from this objfile. */
213 dump_msymbols (objfile
, outfile
)
214 struct objfile
*objfile
;
217 struct minimal_symbol
*msymbol
;
221 fprintf_filtered (outfile
, "\nObject file %s:\n\n", objfile
-> name
);
222 if (objfile
-> minimal_symbol_count
== 0)
224 fprintf_filtered (outfile
, "No minimal symbols found.\n");
227 for (index
= 0, msymbol
= objfile
-> msymbols
;
228 SYMBOL_NAME (msymbol
) != NULL
; msymbol
++, index
++)
230 switch (msymbol
-> type
)
238 case mst_solib_trampoline
:
263 fprintf_filtered (outfile
, "[%2d] %c %#10lx %s", index
, ms_type
,
264 SYMBOL_VALUE_ADDRESS (msymbol
), SYMBOL_NAME (msymbol
));
265 if (SYMBOL_DEMANGLED_NAME (msymbol
) != NULL
)
267 fprintf_filtered (outfile
, " %s", SYMBOL_DEMANGLED_NAME (msymbol
));
269 #ifdef SOFUN_ADDRESS_MAYBE_MISSING
270 if (msymbol
->filename
)
271 fprintf_filtered (outfile
, " %s", msymbol
->filename
);
273 fputs_filtered ("\n", outfile
);
275 if (objfile
-> minimal_symbol_count
!= index
)
277 warning ("internal error: minimal symbol count %d != %d",
278 objfile
-> minimal_symbol_count
, index
);
280 fprintf_filtered (outfile
, "\n");
284 dump_psymtab (objfile
, psymtab
, outfile
)
285 struct objfile
*objfile
;
286 struct partial_symtab
*psymtab
;
291 fprintf_filtered (outfile
, "\nPartial symtab for source file %s ",
292 psymtab
-> filename
);
293 fprintf_filtered (outfile
, "(object ");
294 gdb_print_address (psymtab
, outfile
);
295 fprintf_filtered (outfile
, ")\n\n");
296 fprintf_unfiltered (outfile
, " Read from object file %s (",
298 gdb_print_address (objfile
, outfile
);
299 fprintf_unfiltered (outfile
, ")\n");
301 if (psymtab
-> readin
)
303 fprintf_filtered (outfile
,
304 " Full symtab was read (at ");
305 gdb_print_address (psymtab
->symtab
, outfile
);
306 fprintf_filtered (outfile
, " by function at ");
307 gdb_print_address ((PTR
)psymtab
->read_symtab
, outfile
);
308 fprintf_filtered (outfile
, ")\n");
311 fprintf_filtered (outfile
, " Relocate symbols by ");
312 for (i
= 0; i
< psymtab
->objfile
->num_sections
; ++i
)
315 fprintf_filtered (outfile
, ", ");
317 print_address_numeric (ANOFFSET (psymtab
->section_offsets
, i
),
321 fprintf_filtered (outfile
, "\n");
323 fprintf_filtered (outfile
, " Symbols cover text addresses ");
324 print_address_numeric (psymtab
->textlow
, 1, outfile
);
325 fprintf_filtered (outfile
, "-");
326 print_address_numeric (psymtab
->texthigh
, 1, outfile
);
327 fprintf_filtered (outfile
, "\n");
328 fprintf_filtered (outfile
, " Depends on %d other partial symtabs.\n",
329 psymtab
-> number_of_dependencies
);
330 for (i
= 0; i
< psymtab
-> number_of_dependencies
; i
++)
332 fprintf_filtered (outfile
, " %d ", i
);
333 gdb_print_address (psymtab
-> dependencies
[i
], outfile
);
334 fprintf_filtered (outfile
, " %s\n",
335 psymtab
-> dependencies
[i
] -> filename
);
337 if (psymtab
-> n_global_syms
> 0)
339 print_partial_symbol (objfile
-> global_psymbols
.list
340 + psymtab
-> globals_offset
,
341 psymtab
-> n_global_syms
, "Global", outfile
);
343 if (psymtab
-> n_static_syms
> 0)
345 print_partial_symbol (objfile
-> static_psymbols
.list
346 + psymtab
-> statics_offset
,
347 psymtab
-> n_static_syms
, "Static", outfile
);
349 fprintf_filtered (outfile
, "\n");
353 dump_symtab (objfile
, symtab
, outfile
)
354 struct objfile
*objfile
;
355 struct symtab
*symtab
;
360 register struct linetable
*l
;
361 struct blockvector
*bv
;
362 register struct block
*b
;
365 fprintf_filtered (outfile
, "\nSymtab for file %s\n", symtab
->filename
);
366 fprintf_filtered (outfile
, "Read from object file %s (", objfile
->name
);
367 gdb_print_address (objfile
, outfile
);
368 fprintf_filtered (outfile
, ")\n");
369 fprintf_filtered (outfile
, "Language: %s\n", language_str (symtab
-> language
));
371 /* First print the line table. */
372 l
= LINETABLE (symtab
);
375 fprintf_filtered (outfile
, "\nLine table:\n\n");
377 for (i
= 0; i
< len
; i
++)
379 fprintf_filtered (outfile
, " line %d at ", l
->item
[i
].line
);
380 print_address_numeric (l
->item
[i
].pc
, 1, outfile
);
381 fprintf_filtered (outfile
, "\n");
384 /* Now print the block info. */
385 fprintf_filtered (outfile
, "\nBlockvector:\n\n");
386 bv
= BLOCKVECTOR (symtab
);
387 len
= BLOCKVECTOR_NBLOCKS (bv
);
388 for (i
= 0; i
< len
; i
++)
390 b
= BLOCKVECTOR_BLOCK (bv
, i
);
391 depth
= block_depth (b
) * 2;
392 print_spaces (depth
, outfile
);
393 fprintf_filtered (outfile
, "block #%03d (object ", i
);
394 gdb_print_address (b
, outfile
);
395 fprintf_filtered (outfile
, ") ");
396 fprintf_filtered (outfile
, "[");
397 print_address_numeric (BLOCK_START (b
), 1, outfile
);
398 fprintf_filtered (outfile
, "..");
399 print_address_numeric (BLOCK_END (b
), 1, outfile
);
400 fprintf_filtered (outfile
, "]");
401 if (BLOCK_SUPERBLOCK (b
))
403 fprintf_filtered (outfile
, " (under ");
404 gdb_print_address (BLOCK_SUPERBLOCK (b
), outfile
);
405 fprintf_filtered (outfile
, ")");
407 if (BLOCK_FUNCTION (b
))
409 fprintf_filtered (outfile
, " %s", SYMBOL_NAME (BLOCK_FUNCTION (b
)));
410 if (SYMBOL_DEMANGLED_NAME (BLOCK_FUNCTION (b
)) != NULL
)
412 fprintf_filtered (outfile
, " %s",
413 SYMBOL_DEMANGLED_NAME (BLOCK_FUNCTION (b
)));
416 if (BLOCK_GCC_COMPILED(b
))
417 fprintf_filtered (outfile
, " gcc%d compiled", BLOCK_GCC_COMPILED(b
));
418 fprintf_filtered (outfile
, "\n");
419 blen
= BLOCK_NSYMS (b
);
420 for (j
= 0; j
< blen
; j
++)
422 struct print_symbol_args s
;
423 s
.symbol
= BLOCK_SYM (b
, j
);
426 catch_errors (print_symbol
, &s
, "Error printing symbol:\n",
430 fprintf_filtered (outfile
, "\n");
434 maintenance_print_symbols (args
, from_tty
)
440 struct cleanup
*cleanups
;
441 char *symname
= NULL
;
442 char *filename
= DEV_TTY
;
443 struct objfile
*objfile
;
451 Arguments missing: an output file name and an optional symbol file name");
453 else if ((argv
= buildargv (args
)) == NULL
)
457 cleanups
= make_cleanup (freeargv
, (char *) argv
);
462 /* If a second arg is supplied, it is a source file name to match on */
469 filename
= tilde_expand (filename
);
470 make_cleanup (free
, filename
);
472 outfile
= gdb_fopen (filename
, FOPEN_WT
);
474 perror_with_name (filename
);
475 make_cleanup (fclose
, (char *) outfile
);
478 ALL_SYMTABS (objfile
, s
)
479 if (symname
== NULL
|| (STREQ (symname
, s
-> filename
)))
480 dump_symtab (objfile
, s
, outfile
);
482 do_cleanups (cleanups
);
485 /* Print symbol ARGS->SYMBOL on ARGS->OUTFILE. ARGS->DEPTH says how
486 far to indent. ARGS is really a struct print_symbol_args *, but is
487 declared as char * to get it past catch_errors. Returns 0 for error,
494 struct symbol
*symbol
= ((struct print_symbol_args
*)args
)->symbol
;
495 int depth
= ((struct print_symbol_args
*)args
)->depth
;
496 GDB_FILE
*outfile
= ((struct print_symbol_args
*)args
)->outfile
;
498 print_spaces (depth
, outfile
);
499 if (SYMBOL_NAMESPACE (symbol
) == LABEL_NAMESPACE
)
501 fprintf_filtered (outfile
, "label %s at ", SYMBOL_SOURCE_NAME (symbol
));
502 print_address_numeric (SYMBOL_VALUE_ADDRESS (symbol
), 1, outfile
);
503 fprintf_filtered (outfile
, "\n");
506 if (SYMBOL_NAMESPACE (symbol
) == STRUCT_NAMESPACE
)
508 if (TYPE_TAG_NAME (SYMBOL_TYPE (symbol
)))
510 LA_PRINT_TYPE (SYMBOL_TYPE (symbol
), "", outfile
, 1, depth
);
514 fprintf_filtered (outfile
, "%s %s = ",
515 (TYPE_CODE (SYMBOL_TYPE (symbol
)) == TYPE_CODE_ENUM
517 : (TYPE_CODE (SYMBOL_TYPE (symbol
)) == TYPE_CODE_STRUCT
518 ? "struct" : "union")),
519 SYMBOL_NAME (symbol
));
520 LA_PRINT_TYPE (SYMBOL_TYPE (symbol
), "", outfile
, 1, depth
);
522 fprintf_filtered (outfile
, ";\n");
526 if (SYMBOL_CLASS (symbol
) == LOC_TYPEDEF
)
527 fprintf_filtered (outfile
, "typedef ");
528 if (SYMBOL_TYPE (symbol
))
530 /* Print details of types, except for enums where it's clutter. */
531 LA_PRINT_TYPE (SYMBOL_TYPE (symbol
), SYMBOL_SOURCE_NAME (symbol
),
533 TYPE_CODE (SYMBOL_TYPE (symbol
)) != TYPE_CODE_ENUM
,
535 fprintf_filtered (outfile
, "; ");
538 fprintf_filtered (outfile
, "%s ", SYMBOL_SOURCE_NAME (symbol
));
540 switch (SYMBOL_CLASS (symbol
))
543 fprintf_filtered (outfile
, "const %ld (0x%lx),",
544 SYMBOL_VALUE (symbol
),
545 SYMBOL_VALUE (symbol
));
548 case LOC_CONST_BYTES
:
549 fprintf_filtered (outfile
, "const %u hex bytes:",
550 TYPE_LENGTH (SYMBOL_TYPE (symbol
)));
553 for (i
= 0; i
< TYPE_LENGTH (SYMBOL_TYPE (symbol
)); i
++)
554 fprintf_filtered (outfile
, " %02x",
555 (unsigned)SYMBOL_VALUE_BYTES (symbol
) [i
]);
556 fprintf_filtered (outfile
, ",");
561 fprintf_filtered (outfile
, "static at ");
562 print_address_numeric (SYMBOL_VALUE_ADDRESS (symbol
), 1,outfile
);
563 fprintf_filtered (outfile
, ",");
567 fprintf_filtered (outfile
, "register %ld,", SYMBOL_VALUE (symbol
));
571 fprintf_filtered (outfile
, "arg at offset 0x%lx,",
572 SYMBOL_VALUE (symbol
));
576 fprintf_filtered (outfile
, "arg at offset 0x%lx from fp,",
577 SYMBOL_VALUE (symbol
));
581 fprintf_filtered (outfile
, "reference arg at 0x%lx,", SYMBOL_VALUE (symbol
));
585 fprintf_filtered (outfile
, "parameter register %ld,", SYMBOL_VALUE (symbol
));
588 case LOC_REGPARM_ADDR
:
589 fprintf_filtered (outfile
, "address parameter register %ld,", SYMBOL_VALUE (symbol
));
593 fprintf_filtered (outfile
, "local at offset 0x%lx,",
594 SYMBOL_VALUE (symbol
));
598 fprintf_filtered (outfile
, "local at 0x%lx from register %d",
599 SYMBOL_VALUE (symbol
), SYMBOL_BASEREG (symbol
));
602 case LOC_BASEREG_ARG
:
603 fprintf_filtered (outfile
, "arg at 0x%lx from register %d,",
604 SYMBOL_VALUE (symbol
), SYMBOL_BASEREG (symbol
));
611 fprintf_filtered (outfile
, "label at ");
612 print_address_numeric (SYMBOL_VALUE_ADDRESS (symbol
), 1, outfile
);
616 fprintf_filtered (outfile
, "block (object ");
617 gdb_print_address (SYMBOL_BLOCK_VALUE (symbol
), outfile
);
618 fprintf_filtered (outfile
, ") starting at ");
619 print_address_numeric (BLOCK_START (SYMBOL_BLOCK_VALUE (symbol
)),
622 fprintf_filtered (outfile
, ",");
625 case LOC_OPTIMIZED_OUT
:
626 fprintf_filtered (outfile
, "optimized out");
630 fprintf_filtered (outfile
, "botched symbol class %x",
631 SYMBOL_CLASS (symbol
));
635 fprintf_filtered (outfile
, "\n");
640 maintenance_print_psymbols (args
, from_tty
)
646 struct cleanup
*cleanups
;
647 char *symname
= NULL
;
648 char *filename
= DEV_TTY
;
649 struct objfile
*objfile
;
650 struct partial_symtab
*ps
;
656 error ("print-psymbols takes an output file name and optional symbol file name");
658 else if ((argv
= buildargv (args
)) == NULL
)
662 cleanups
= make_cleanup (freeargv
, (char *) argv
);
667 /* If a second arg is supplied, it is a source file name to match on */
674 filename
= tilde_expand (filename
);
675 make_cleanup (free
, filename
);
677 outfile
= gdb_fopen (filename
, FOPEN_WT
);
679 perror_with_name (filename
);
680 make_cleanup (fclose
, outfile
);
683 ALL_PSYMTABS (objfile
, ps
)
684 if (symname
== NULL
|| (STREQ (symname
, ps
-> filename
)))
685 dump_psymtab (objfile
, ps
, outfile
);
687 do_cleanups (cleanups
);
691 print_partial_symbol (p
, count
, what
, outfile
)
692 struct partial_symbol
*p
;
698 fprintf_filtered (outfile
, " %s partial symbols:\n", what
);
701 fprintf_filtered (outfile
, " `%s'", SYMBOL_NAME(p
));
702 if (SYMBOL_DEMANGLED_NAME (p
) != NULL
)
704 fprintf_filtered (outfile
, " `%s'", SYMBOL_DEMANGLED_NAME (p
));
706 fputs_filtered (", ", outfile
);
707 switch (SYMBOL_NAMESPACE (p
))
709 case UNDEF_NAMESPACE
:
710 fputs_filtered ("undefined namespace, ", outfile
);
713 /* This is the usual thing -- don't print it */
715 case STRUCT_NAMESPACE
:
716 fputs_filtered ("struct namespace, ", outfile
);
718 case LABEL_NAMESPACE
:
719 fputs_filtered ("label namespace, ", outfile
);
722 fputs_filtered ("<invalid namespace>, ", outfile
);
725 switch (SYMBOL_CLASS (p
))
728 fputs_filtered ("undefined", outfile
);
731 fputs_filtered ("constant int", outfile
);
734 fputs_filtered ("static", outfile
);
737 fputs_filtered ("register", outfile
);
740 fputs_filtered ("pass by value", outfile
);
743 fputs_filtered ("pass by reference", outfile
);
746 fputs_filtered ("register parameter", outfile
);
748 case LOC_REGPARM_ADDR
:
749 fputs_filtered ("register address parameter", outfile
);
752 fputs_filtered ("stack parameter", outfile
);
755 fputs_filtered ("type", outfile
);
758 fputs_filtered ("label", outfile
);
761 fputs_filtered ("function", outfile
);
763 case LOC_CONST_BYTES
:
764 fputs_filtered ("constant bytes", outfile
);
767 fputs_filtered ("shuffled arg", outfile
);
769 case LOC_OPTIMIZED_OUT
:
770 fputs_filtered ("optimized out", outfile
);
773 fputs_filtered ("<invalid location>", outfile
);
776 fputs_filtered (", ", outfile
);
777 /* FIXME-32x64: Need to use SYMBOL_VALUE_ADDRESS, etc.; this
778 could be 32 bits when some of the other fields in the union
780 fprintf_filtered (outfile
, "0x%lx\n", SYMBOL_VALUE (p
));
786 maintenance_print_msymbols (args
, from_tty
)
792 struct cleanup
*cleanups
;
793 char *filename
= DEV_TTY
;
794 char *symname
= NULL
;
795 struct objfile
*objfile
;
801 error ("print-msymbols takes an output file name and optional symbol file name");
803 else if ((argv
= buildargv (args
)) == NULL
)
807 cleanups
= make_cleanup (freeargv
, argv
);
812 /* If a second arg is supplied, it is a source file name to match on */
819 filename
= tilde_expand (filename
);
820 make_cleanup (free
, filename
);
822 outfile
= gdb_fopen (filename
, FOPEN_WT
);
824 perror_with_name (filename
);
825 make_cleanup (fclose
, outfile
);
828 ALL_OBJFILES (objfile
)
829 if (symname
== NULL
|| (STREQ (symname
, objfile
-> name
)))
830 dump_msymbols (objfile
, outfile
);
832 fprintf_filtered (outfile
, "\n\n");
833 do_cleanups (cleanups
);
837 maintenance_print_objfiles (ignore
, from_tty
)
841 struct objfile
*objfile
;
846 ALL_OBJFILES (objfile
)
847 dump_objfile (objfile
);
851 /* Check consistency of psymtabs and symtabs. */
854 maintenance_check_symtabs (ignore
, from_tty
)
858 register struct symbol
*sym
;
859 register struct partial_symbol
*psym
;
860 register struct symtab
*s
= NULL
;
861 register struct partial_symtab
*ps
;
862 struct blockvector
*bv
;
863 register struct objfile
*objfile
;
864 register struct block
*b
;
867 ALL_PSYMTABS (objfile
, ps
)
869 s
= PSYMTAB_TO_SYMTAB(ps
);
872 bv
= BLOCKVECTOR (s
);
873 b
= BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
);
874 psym
= ps
->objfile
->static_psymbols
.list
+ ps
->statics_offset
;
875 length
= ps
->n_static_syms
;
878 sym
= lookup_block_symbol (b
, SYMBOL_NAME (psym
),
879 SYMBOL_NAMESPACE (psym
));
882 printf_filtered ("Static symbol `");
883 puts_filtered (SYMBOL_NAME (psym
));
884 printf_filtered ("' only found in ");
885 puts_filtered (ps
->filename
);
886 printf_filtered (" psymtab\n");
890 b
= BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
);
891 psym
= ps
->objfile
->global_psymbols
.list
+ ps
->globals_offset
;
892 length
= ps
->n_global_syms
;
895 sym
= lookup_block_symbol (b
, SYMBOL_NAME (psym
),
896 SYMBOL_NAMESPACE (psym
));
899 printf_filtered ("Global symbol `");
900 puts_filtered (SYMBOL_NAME (psym
));
901 printf_filtered ("' only found in ");
902 puts_filtered (ps
->filename
);
903 printf_filtered (" psymtab\n");
907 if (ps
->texthigh
< ps
->textlow
)
909 printf_filtered ("Psymtab ");
910 puts_filtered (ps
->filename
);
911 printf_filtered (" covers bad range ");
912 print_address_numeric (ps
->textlow
, 1, stdout
);
913 printf_filtered (" - ");
914 print_address_numeric (ps
->texthigh
, 1, stdout
);
915 printf_filtered ("\n");
918 if (ps
->texthigh
== 0)
920 if (ps
->textlow
< BLOCK_START (b
) || ps
->texthigh
> BLOCK_END (b
))
922 printf_filtered ("Psymtab ");
923 puts_filtered (ps
->filename
);
924 printf_filtered (" covers ");
925 print_address_numeric (ps
->textlow
, 1, stdout
);
926 printf_filtered (" - ");
927 print_address_numeric (ps
->texthigh
, 1, stdout
);
928 printf_filtered (" but symtab covers only ");
929 print_address_numeric (BLOCK_START (b
), 1, stdout
);
930 printf_filtered (" - ");
931 print_address_numeric (BLOCK_END (b
), 1, stdout
);
932 printf_filtered ("\n");
938 /* Return the nexting depth of a block within other blocks in its symtab. */
945 while ((block
= BLOCK_SUPERBLOCK (block
)) != NULL
)
952 #endif /* MAINTENANCE_CMDS */
955 /* Increase the space allocated for LISTP, which is probably
956 global_psymbol_list or static_psymbol_list. This space will eventually
957 be freed in free_objfile(). */
960 extend_psymbol_list (listp
, objfile
)
961 register struct psymbol_allocation_list
*listp
;
962 struct objfile
*objfile
;
965 if (listp
->size
== 0)
968 listp
->list
= (struct partial_symbol
*)
969 xmmalloc (objfile
-> md
, new_size
* sizeof (struct partial_symbol
));
973 new_size
= listp
->size
* 2;
974 listp
->list
= (struct partial_symbol
*)
975 xmrealloc (objfile
-> md
, (char *) listp
->list
,
976 new_size
* sizeof (struct partial_symbol
));
978 /* Next assumes we only went one over. Should be good if
979 program works correctly */
980 listp
->next
= listp
->list
+ listp
->size
;
981 listp
->size
= new_size
;
985 /* Do early runtime initializations. */
987 _initialize_symmisc ()
This page took 0.04899 seconds and 4 git commands to generate.