1 /* Symbol table lookup for the GNU debugger, GDB.
2 Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992
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. */
31 #include "call-cmds.h"
33 #include "expression.h"
40 #include <sys/types.h>
46 /* Prototypes for local functions */
49 find_methods
PARAMS ((struct type
*, char *, struct symbol
**));
52 completion_list_add_name
PARAMS ((char *, char *, int));
54 static struct symtabs_and_lines
55 decode_line_2
PARAMS ((struct symbol
*[], int, int));
58 rbreak_command
PARAMS ((char *, int));
61 types_info
PARAMS ((char *, int));
64 functions_info
PARAMS ((char *, int));
67 variables_info
PARAMS ((char *, int));
70 sources_info
PARAMS ((char *, int));
73 list_symbols
PARAMS ((char *, int, int));
76 output_source_filename
PARAMS ((char *, int *));
79 operator_chars
PARAMS ((char *, char **));
82 find_line_common
PARAMS ((struct linetable
*, int, int *));
84 static struct partial_symbol
*
85 lookup_partial_symbol
PARAMS ((struct partial_symtab
*, const char *,
86 int, enum namespace));
88 static struct symtab
*
89 lookup_symtab_1
PARAMS ((char *));
93 /* The single non-language-specific builtin type */
94 struct type
*builtin_type_error
;
96 /* Block in which the most recently searched-for symbol was found.
97 Might be better to make this a parameter to lookup_symbol and
100 const struct block
*block_found
;
102 char no_symtab_msg
[] = "No symbol table is loaded. Use the \"file\" command.";
104 /* While the C++ support is still in flux, issue a possibly helpful hint on
105 using the new command completion feature on single quoted demangled C++
106 symbols. Remove when loose ends are cleaned up. FIXME -fnf */
109 cplusplus_hint (name
)
112 printf ("Hint: try '%s<TAB> or '%s<ESC-?>\n", name
, name
);
113 printf ("(Note leading single quote.)\n");
116 /* Check for a symtab of a specific name; first in symtabs, then in
117 psymtabs. *If* there is no '/' in the name, a match after a '/'
118 in the symtab filename will also work. */
120 static struct symtab
*
121 lookup_symtab_1 (name
)
124 register struct symtab
*s
;
125 register struct partial_symtab
*ps
;
126 register char *slash
;
127 register struct objfile
*objfile
;
131 /* First, search for an exact match */
133 ALL_SYMTABS (objfile
, s
)
134 if (STREQ (name
, s
->filename
))
137 slash
= strchr (name
, '/');
139 /* Now, search for a matching tail (only if name doesn't have any dirs) */
142 ALL_SYMTABS (objfile
, s
)
144 char *p
= s
-> filename
;
145 char *tail
= strrchr (p
, '/');
154 /* Same search rules as above apply here, but now we look thru the
157 ALL_PSYMTABS (objfile
, ps
)
158 if (STREQ (name
, ps
-> filename
))
162 ALL_PSYMTABS (objfile
, ps
)
164 char *p
= ps
-> filename
;
165 char *tail
= strrchr (p
, '/');
179 error ("Internal: readin %s pst for `%s' found when no symtab found.",
180 ps
-> filename
, name
);
182 s
= PSYMTAB_TO_SYMTAB (ps
);
187 /* At this point, we have located the psymtab for this file, but
188 the conversion to a symtab has failed. This usually happens
189 when we are looking up an include file. In this case,
190 PSYMTAB_TO_SYMTAB doesn't return a symtab, even though one has
191 been created. So, we need to run through the symtabs again in
192 order to find the file.
193 XXX - This is a crock, and should be fixed inside of the the
194 symbol parsing routines. */
198 /* Lookup the symbol table of a source file named NAME. Try a couple
199 of variations if the first lookup doesn't work. */
205 register struct symtab
*s
;
208 s
= lookup_symtab_1 (name
);
211 /* If name not found as specified, see if adding ".c" helps. */
213 copy
= (char *) alloca (strlen (name
) + 3);
216 s
= lookup_symtab_1 (copy
);
219 /* We didn't find anything; die. */
223 /* Lookup the partial symbol table of a source file named NAME. This
224 only returns true on an exact match (ie. this semantics are
225 different from lookup_symtab. */
227 struct partial_symtab
*
228 lookup_partial_symtab (name
)
231 register struct partial_symtab
*pst
;
232 register struct objfile
*objfile
;
234 ALL_PSYMTABS (objfile
, pst
)
236 if (STREQ (name
, pst
-> filename
))
244 /* Demangle a GDB method stub type. */
246 gdb_mangle_name (type
, i
, j
)
250 int mangled_name_len
;
252 struct fn_field
*f
= TYPE_FN_FIELDLIST1 (type
, i
);
253 struct fn_field
*method
= &f
[j
];
254 char *field_name
= TYPE_FN_FIELDLIST_NAME (type
, i
);
255 char *physname
= TYPE_FN_FIELD_PHYSNAME (f
, j
);
256 char *newname
= type_name_no_tag (type
);
257 int is_constructor
= STREQ (field_name
, newname
);
258 int is_destructor
= is_constructor
&& DESTRUCTOR_PREFIX_P (physname
);
259 /* Need a new type prefix. */
260 char *const_prefix
= method
->is_const
? "C" : "";
261 char *volatile_prefix
= method
->is_volatile
? "V" : "";
263 #ifndef GCC_MANGLE_BUG
264 int len
= strlen (newname
);
268 mangled_name
= (char*) xmalloc(strlen(physname
)+1);
269 strcpy(mangled_name
, physname
);
273 sprintf (buf
, "__%s%s%d", const_prefix
, volatile_prefix
, len
);
274 mangled_name_len
= ((is_constructor
? 0 : strlen (field_name
))
279 /* Only needed for GNU-mangled names. ANSI-mangled names
280 work with the normal mechanisms. */
281 if (OPNAME_PREFIX_P (field_name
))
283 char *opname
= cplus_mangle_opname (field_name
+ 3, 0);
285 error ("No mangling for \"%s\"", field_name
);
286 mangled_name_len
+= strlen (opname
);
287 mangled_name
= (char *)xmalloc (mangled_name_len
);
289 strncpy (mangled_name
, field_name
, 3);
290 mangled_name
[3] = '\0';
291 strcat (mangled_name
, opname
);
295 mangled_name
= (char *)xmalloc (mangled_name_len
);
297 mangled_name
[0] = '\0';
299 strcpy (mangled_name
, field_name
);
301 strcat (mangled_name
, buf
);
302 strcat (mangled_name
, newname
);
312 sprintf (buf
, "__%s%s", const_prefix
, volatile_prefix
);
315 mangled_name_len
= ((is_constructor
? 0 : strlen (field_name
))
316 + strlen (buf
) + strlen (physname
) + 1);
318 /* Only needed for GNU-mangled names. ANSI-mangled names
319 work with the normal mechanisms. */
320 if (OPNAME_PREFIX_P (field_name
))
322 opname
= cplus_mangle_opname (field_name
+ 3, 0);
325 error ("No mangling for \"%s\"", field_name
);
327 mangled_name_len
+= strlen (opname
);
328 mangled_name
= (char *) xmalloc (mangled_name_len
);
330 strncpy (mangled_name
, field_name
, 3);
331 strcpy (mangled_name
+ 3, opname
);
335 mangled_name
= (char *) xmalloc (mangled_name_len
);
338 mangled_name
[0] = '\0';
342 strcpy (mangled_name
, field_name
);
345 strcat (mangled_name
, buf
);
348 strcat (mangled_name
, physname
);
349 return (mangled_name
);
353 /* Find which partial symtab on contains PC. Return 0 if none. */
355 struct partial_symtab
*
357 register CORE_ADDR pc
;
359 register struct partial_symtab
*pst
;
360 register struct objfile
*objfile
;
362 ALL_PSYMTABS (objfile
, pst
)
364 if (pc
>= pst
->textlow
&& pc
< pst
->texthigh
)
370 /* Find which partial symbol within a psymtab contains PC. Return 0
371 if none. Check all psymtabs if PSYMTAB is 0. */
372 struct partial_symbol
*
373 find_pc_psymbol (psymtab
, pc
)
374 struct partial_symtab
*psymtab
;
377 struct partial_symbol
*best
, *p
;
381 psymtab
= find_pc_psymtab (pc
);
385 best_pc
= psymtab
->textlow
- 1;
387 for (p
= psymtab
->objfile
->static_psymbols
.list
+ psymtab
->statics_offset
;
388 (p
- (psymtab
->objfile
->static_psymbols
.list
+ psymtab
->statics_offset
)
389 < psymtab
->n_static_syms
);
391 if (SYMBOL_NAMESPACE (p
) == VAR_NAMESPACE
392 && SYMBOL_CLASS (p
) == LOC_BLOCK
393 && pc
>= SYMBOL_VALUE_ADDRESS (p
)
394 && SYMBOL_VALUE_ADDRESS (p
) > best_pc
)
396 best_pc
= SYMBOL_VALUE_ADDRESS (p
);
399 if (best_pc
== psymtab
->textlow
- 1)
405 /* Find the definition for a specified symbol name NAME
406 in namespace NAMESPACE, visible from lexical block BLOCK.
407 Returns the struct symbol pointer, or zero if no symbol is found.
408 If SYMTAB is non-NULL, store the symbol table in which the
409 symbol was found there, or NULL if not found.
410 C++: if IS_A_FIELD_OF_THIS is nonzero on entry, check to see if
411 NAME is a field of the current implied argument `this'. If so set
412 *IS_A_FIELD_OF_THIS to 1, otherwise set it to zero.
413 BLOCK_FOUND is set to the block in which NAME is found (in the case of
414 a field of `this', value_of_this sets BLOCK_FOUND to the proper value.) */
417 lookup_symbol (name
, block
, namespace, is_a_field_of_this
, symtab
)
419 register const struct block
*block
;
420 const enum namespace namespace;
421 int *is_a_field_of_this
;
422 struct symtab
**symtab
;
424 register struct symbol
*sym
;
425 register struct symtab
*s
;
426 register struct partial_symtab
*ps
;
427 struct blockvector
*bv
;
428 register struct objfile
*objfile
;
429 register struct block
*b
;
430 register struct minimal_symbol
*msymbol
;
432 extern char *gdb_completer_word_break_characters
;
434 /* Search specified block and its superiors. */
438 sym
= lookup_block_symbol (block
, name
, namespace);
444 /* Search the list of symtabs for one which contains the
445 address of the start of this block. */
446 ALL_SYMTABS (objfile
, s
)
448 bv
= BLOCKVECTOR (s
);
449 b
= BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
);
450 if (BLOCK_START (b
) <= BLOCK_START (block
)
451 && BLOCK_END (b
) > BLOCK_START (block
))
460 block
= BLOCK_SUPERBLOCK (block
);
463 /* Don't need to mess with the psymtabs; if we have a block,
464 that file is read in. If we don't, then we deal later with
465 all the psymtab stuff that needs checking. */
466 if (namespace == VAR_NAMESPACE
&& block
!= NULL
)
469 /* Find the right symtab. */
470 ALL_SYMTABS (objfile
, s
)
472 bv
= BLOCKVECTOR (s
);
473 b
= BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
);
474 if (BLOCK_START (b
) <= BLOCK_START (block
)
475 && BLOCK_END (b
) > BLOCK_START (block
))
477 sym
= lookup_block_symbol (b
, name
, VAR_NAMESPACE
);
490 /* C++: If requested to do so by the caller,
491 check to see if NAME is a field of `this'. */
492 if (is_a_field_of_this
)
494 struct value
*v
= value_of_this (0);
496 *is_a_field_of_this
= 0;
497 if (v
&& check_field (v
, name
))
499 *is_a_field_of_this
= 1;
506 /* Now search all global blocks. Do the symtab's first, then
507 check the psymtab's */
509 ALL_SYMTABS (objfile
, s
)
511 bv
= BLOCKVECTOR (s
);
512 block
= BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
);
513 sym
= lookup_block_symbol (block
, name
, namespace);
523 /* Check for the possibility of the symbol being a global function
524 that is stored in one of the minimal symbol tables. Eventually, all
525 global symbols might be resolved in this way. */
527 if (namespace == VAR_NAMESPACE
)
529 msymbol
= lookup_minimal_symbol (name
, (struct objfile
*) NULL
);
532 s
= find_pc_symtab (SYMBOL_VALUE_ADDRESS (msymbol
));
533 /* If S is NULL, there are no debug symbols for this file.
534 Skip this stuff and check for matching static symbols below. */
537 bv
= BLOCKVECTOR (s
);
538 block
= BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
);
539 sym
= lookup_block_symbol (block
, SYMBOL_NAME (msymbol
),
541 /* We kept static functions in minimal symbol table as well as
542 in static scope. We want to find them in the symbol table. */
544 block
= BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
);
545 sym
= lookup_block_symbol (block
, SYMBOL_NAME (msymbol
),
549 /* sym == 0 if symbol was found in the minimal symbol table
550 but not in the symtab.
551 Return 0 to use the msymbol definition of "foo_".
553 This happens for Fortran "foo_" symbols,
554 which are "foo" in the symtab.
556 This can also happen if "asm" is used to make a
557 regular symbol but not a debugging symbol, e.g.
569 ALL_PSYMTABS (objfile
, ps
)
571 if (!ps
->readin
&& lookup_partial_symbol (ps
, name
, 1, namespace))
573 s
= PSYMTAB_TO_SYMTAB(ps
);
574 bv
= BLOCKVECTOR (s
);
575 block
= BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
);
576 sym
= lookup_block_symbol (block
, name
, namespace);
578 error ("Internal: global symbol `%s' found in %s psymtab but not in symtab", name
, ps
->filename
);
585 /* Now search all per-file blocks.
586 Not strictly correct, but more useful than an error.
587 Do the symtabs first, then check the psymtabs */
589 ALL_SYMTABS (objfile
, s
)
591 bv
= BLOCKVECTOR (s
);
592 block
= BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
);
593 sym
= lookup_block_symbol (block
, name
, namespace);
603 ALL_PSYMTABS (objfile
, ps
)
605 if (!ps
->readin
&& lookup_partial_symbol (ps
, name
, 0, namespace))
607 s
= PSYMTAB_TO_SYMTAB(ps
);
608 bv
= BLOCKVECTOR (s
);
609 block
= BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
);
610 sym
= lookup_block_symbol (block
, name
, namespace);
612 error ("Internal: static symbol `%s' found in %s psymtab but not in symtab", name
, ps
->filename
);
619 /* Now search all per-file blocks for static mangled symbols.
620 Do the symtabs first, then check the psymtabs. */
622 if (namespace == VAR_NAMESPACE
)
624 ALL_SYMTABS (objfile
, s
)
626 bv
= BLOCKVECTOR (s
);
627 block
= BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
);
628 sym
= lookup_block_symbol (block
, name
, VAR_NAMESPACE
);
638 ALL_PSYMTABS (objfile
, ps
)
640 if (!ps
->readin
&& lookup_partial_symbol (ps
, name
, 0, VAR_NAMESPACE
))
642 s
= PSYMTAB_TO_SYMTAB(ps
);
643 bv
= BLOCKVECTOR (s
);
644 block
= BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
);
645 sym
= lookup_block_symbol (block
, name
, VAR_NAMESPACE
);
647 error ("Internal: mangled static symbol `%s' found in %s psymtab but not in symtab", name
, ps
->filename
);
660 /* Look, in partial_symtab PST, for symbol NAME. Check the global
661 symbols if GLOBAL, the static symbols if not */
663 static struct partial_symbol
*
664 lookup_partial_symbol (pst
, name
, global
, namespace)
665 struct partial_symtab
*pst
;
668 enum namespace namespace;
670 struct partial_symbol
*start
, *psym
;
671 struct partial_symbol
*top
, *bottom
, *center
;
672 int length
= (global
? pst
->n_global_syms
: pst
->n_static_syms
);
673 int do_linear_search
= 1;
681 pst
->objfile
->global_psymbols
.list
+ pst
->globals_offset
:
682 pst
->objfile
->static_psymbols
.list
+ pst
->statics_offset
);
684 if (global
) /* This means we can use a binary search. */
686 do_linear_search
= 0;
688 /* Binary search. This search is guaranteed to end with center
689 pointing at the earliest partial symbol with the correct
690 name. At that point *all* partial symbols with that name
691 will be checked against the correct namespace. */
694 top
= start
+ length
- 1;
697 center
= bottom
+ (top
- bottom
) / 2;
698 assert (center
< top
);
699 if (!do_linear_search
&& SYMBOL_LANGUAGE (center
) == language_cplus
)
701 do_linear_search
= 1;
703 if (STRCMP (SYMBOL_NAME (center
), name
) >= 0)
712 assert (top
== bottom
);
713 while (STREQ (SYMBOL_NAME (top
), name
))
715 if (SYMBOL_NAMESPACE (top
) == namespace)
723 /* Can't use a binary search or else we found during the binary search that
724 we should also do a linear search. */
726 if (do_linear_search
)
728 for (psym
= start
; psym
< start
+ length
; psym
++)
730 if (namespace == SYMBOL_NAMESPACE (psym
))
732 if (SYMBOL_MATCHES_NAME (psym
, name
))
743 /* Find the psymtab containing main(). */
744 /* FIXME: What about languages without main() or specially linked
745 executables that have no main() ? */
747 struct partial_symtab
*
750 register struct partial_symtab
*pst
;
751 register struct objfile
*objfile
;
753 ALL_PSYMTABS (objfile
, pst
)
755 if (lookup_partial_symbol (pst
, "main", 1, VAR_NAMESPACE
))
763 /* Search BLOCK for symbol NAME in NAMESPACE.
765 Note that if NAME is the demangled form of a C++ symbol, we will fail
766 to find a match during the binary search of the non-encoded names, but
767 for now we don't worry about the slight inefficiency of looking for
768 a match we'll never find, since it will go pretty quick. Once the
769 binary search terminates, we drop through and do a straight linear
770 search on the symbols. Each symbol which is marked as being a C++
771 symbol (language_cplus set) has both the encoded and non-encoded names
772 tested for a match. */
775 lookup_block_symbol (block
, name
, namespace)
776 register const struct block
*block
;
778 const enum namespace namespace;
780 register int bot
, top
, inc
;
781 register struct symbol
*sym
;
782 register struct symbol
*sym_found
= NULL
;
783 register int do_linear_search
= 1;
785 /* If the blocks's symbols were sorted, start with a binary search. */
787 if (BLOCK_SHOULD_SORT (block
))
789 /* Reset the linear search flag so if the binary search fails, we
790 won't do the linear search once unless we find some reason to
791 do so, such as finding a C++ symbol during the binary search.
792 Note that for C++ modules, ALL the symbols in a block should
793 end up marked as C++ symbols. */
795 do_linear_search
= 0;
796 top
= BLOCK_NSYMS (block
);
799 /* Advance BOT to not far before the first symbol whose name is NAME. */
803 inc
= (top
- bot
+ 1);
804 /* No need to keep binary searching for the last few bits worth. */
809 inc
= (inc
>> 1) + bot
;
810 sym
= BLOCK_SYM (block
, inc
);
811 if (!do_linear_search
&& SYMBOL_LANGUAGE (sym
) == language_cplus
)
813 do_linear_search
= 1;
815 if (SYMBOL_NAME (sym
)[0] < name
[0])
819 else if (SYMBOL_NAME (sym
)[0] > name
[0])
823 else if (STRCMP (SYMBOL_NAME (sym
), name
) < 0)
833 /* Now scan forward until we run out of symbols, find one whose name is
834 greater than NAME, or find one we want. If there is more than one
835 symbol with the right name and namespace, we return the first one.
836 dbxread.c is careful to make sure that if one is a register then it
839 top
= BLOCK_NSYMS (block
);
842 sym
= BLOCK_SYM (block
, bot
);
843 inc
= SYMBOL_NAME (sym
)[0] - name
[0];
846 inc
= STRCMP (SYMBOL_NAME (sym
), name
);
848 if (inc
== 0 && SYMBOL_NAMESPACE (sym
) == namespace)
860 /* Here if block isn't sorted, or we fail to find a match during the
861 binary search above. If during the binary search above, we find a
862 symbol which is a C++ symbol, then we have re-enabled the linear
863 search flag which was reset when starting the binary search.
865 This loop is equivalent to the loop above, but hacked greatly for speed.
867 Note that parameter symbols do not always show up last in the
868 list; this loop makes sure to take anything else other than
869 parameter symbols first; it only uses parameter symbols as a
870 last resort. Note that this only takes up extra computation
873 if (do_linear_search
)
875 top
= BLOCK_NSYMS (block
);
879 sym
= BLOCK_SYM (block
, bot
);
880 if (SYMBOL_NAMESPACE (sym
) == namespace &&
881 SYMBOL_MATCHES_NAME (sym
, name
))
884 if (SYMBOL_CLASS (sym
) != LOC_ARG
&&
885 SYMBOL_CLASS (sym
) != LOC_LOCAL_ARG
&&
886 SYMBOL_CLASS (sym
) != LOC_REF_ARG
&&
887 SYMBOL_CLASS (sym
) != LOC_REGPARM
)
895 return (sym_found
); /* Will be NULL if not found. */
899 /* Return the symbol for the function which contains a specified
900 lexical block, described by a struct block BL. */
906 while (BLOCK_FUNCTION (bl
) == 0 && BLOCK_SUPERBLOCK (bl
) != 0)
907 bl
= BLOCK_SUPERBLOCK (bl
);
909 return BLOCK_FUNCTION (bl
);
912 /* Find the symtab associated with PC. Look through the psymtabs and read in
913 another symtab if necessary. */
917 register CORE_ADDR pc
;
919 register struct block
*b
;
920 struct blockvector
*bv
;
921 register struct symtab
*s
= NULL
;
922 register struct symtab
*best_s
= NULL
;
923 register struct partial_symtab
*ps
;
924 register struct objfile
*objfile
;
928 /* Search all symtabs for one whose file contains our pc */
930 ALL_SYMTABS (objfile
, s
)
932 bv
= BLOCKVECTOR (s
);
933 b
= BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
);
934 if (BLOCK_START (b
) <= pc
935 && BLOCK_END (b
) > pc
937 || BLOCK_END (b
) - BLOCK_START (b
) < distance
))
939 distance
= BLOCK_END (b
) - BLOCK_START (b
);
948 ps
= find_pc_psymtab (pc
);
952 printf_filtered ("(Internal error: pc 0x%x in read in psymtab, but not in symtab.)\n", pc
);
953 s
= PSYMTAB_TO_SYMTAB (ps
);
958 /* Find the source file and line number for a given PC value.
959 Return a structure containing a symtab pointer, a line number,
960 and a pc range for the entire source line.
961 The value's .pc field is NOT the specified pc.
962 NOTCURRENT nonzero means, if specified pc is on a line boundary,
963 use the line that ends there. Otherwise, in that case, the line
964 that begins there is used. */
966 /* The big complication here is that a line may start in one file, and end just
967 before the start of another file. This usually occurs when you #include
968 code in the middle of a subroutine. To properly find the end of a line's PC
969 range, we must search all symtabs associated with this compilation unit, and
970 find the one whose first PC is closer than that of the next line in this
973 FIXME: We used to complain here about zero length or negative length line
974 tables, but there are two problems with this: (1) some symtabs may not have
975 any line numbers due to gcc -g1 compilation, and (2) this function is called
976 during single stepping, when we don't own the terminal and thus can't
977 produce any output. One solution might be to implement a mechanism whereby
978 complaints can be queued until we regain control of the terminal. -fnf
981 struct symtab_and_line
982 find_pc_line (pc
, notcurrent
)
987 register struct linetable
*l
;
990 register struct linetable_entry
*item
;
991 struct symtab_and_line val
;
992 struct blockvector
*bv
;
994 /* Info on best line seen so far, and where it starts, and its file. */
996 struct linetable_entry
*best
= NULL
;
997 CORE_ADDR best_end
= 0;
998 struct symtab
*best_symtab
= 0;
1000 /* Store here the first line number
1001 of a file which contains the line at the smallest pc after PC.
1002 If we don't find a line whose range contains PC,
1003 we will use a line one less than this,
1004 with a range from the start of that file to the first line's pc. */
1005 struct linetable_entry
*alt
= NULL
;
1006 struct symtab
*alt_symtab
= 0;
1008 /* Info on best line seen in this file. */
1010 struct linetable_entry
*prev
;
1012 /* If this pc is not from the current frame,
1013 it is the address of the end of a call instruction.
1014 Quite likely that is the start of the following statement.
1015 But what we want is the statement containing the instruction.
1016 Fudge the pc to make sure we get that. */
1018 if (notcurrent
) pc
-= 1;
1020 s
= find_pc_symtab (pc
);
1030 bv
= BLOCKVECTOR (s
);
1032 /* Look at all the symtabs that share this blockvector.
1033 They all have the same apriori range, that we found was right;
1034 but they have different line tables. */
1036 for (; s
&& BLOCKVECTOR (s
) == bv
; s
= s
->next
)
1038 /* Find the best line in this symtab. */
1043 if (len
<= 0) /* See FIXME above. */
1049 item
= l
->item
; /* Get first line info */
1051 /* Is this file's first line closer than the first lines of other files?
1052 If so, record this file, and its first line, as best alternate. */
1053 if (item
->pc
> pc
&& (!alt
|| item
->pc
< alt
->pc
))
1059 for (i
= 0; i
< len
; i
++, item
++)
1061 /* Return the last line that did not start after PC. */
1068 /* At this point, prev points at the line whose start addr is <= pc, and
1069 item points at the next line. If we ran off the end of the linetable
1070 (pc >= start of the last line), then prev == item. If pc < start of
1071 the first line, prev will not be set. */
1073 /* Is this file's best line closer than the best in the other files?
1074 If so, record this file, and its best line, as best so far. */
1076 if (prev
&& (!best
|| prev
->pc
> best
->pc
))
1080 /* If another line is in the linetable, and its PC is closer
1081 than the best_end we currently have, take it as best_end. */
1082 if (i
< len
&& (best_end
== 0 || best_end
> item
->pc
))
1083 best_end
= item
->pc
;
1090 { /* If we didn't find any line # info, just
1099 val
.symtab
= alt_symtab
;
1100 val
.line
= alt
->line
- 1;
1101 val
.pc
= BLOCK_END (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
));
1107 val
.symtab
= best_symtab
;
1108 val
.line
= best
->line
;
1110 if (best_end
&& (!alt
|| best_end
< alt
->pc
))
1115 val
.end
= BLOCK_END (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
));
1120 /* Find the PC value for a given source file and line number.
1121 Returns zero for invalid line number.
1122 The source file is specified with a struct symtab. */
1125 find_line_pc (symtab
, line
)
1126 struct symtab
*symtab
;
1129 register struct linetable
*l
;
1135 l
= LINETABLE (symtab
);
1136 ind
= find_line_common(l
, line
, &dummy
);
1137 return (ind
>= 0) ? l
->item
[ind
].pc
: 0;
1140 /* Find the range of pc values in a line.
1141 Store the starting pc of the line into *STARTPTR
1142 and the ending pc (start of next line) into *ENDPTR.
1143 Returns 1 to indicate success.
1144 Returns 0 if could not find the specified line. */
1147 find_line_pc_range (symtab
, thisline
, startptr
, endptr
)
1148 struct symtab
*symtab
;
1150 CORE_ADDR
*startptr
, *endptr
;
1152 register struct linetable
*l
;
1154 int exact_match
; /* did we get an exact linenumber match */
1159 l
= LINETABLE (symtab
);
1160 ind
= find_line_common (l
, thisline
, &exact_match
);
1163 *startptr
= l
->item
[ind
].pc
;
1164 /* If we have not seen an entry for the specified line,
1165 assume that means the specified line has zero bytes. */
1166 if (!exact_match
|| ind
== l
->nitems
-1)
1167 *endptr
= *startptr
;
1169 /* Perhaps the following entry is for the following line.
1170 It's worth a try. */
1171 if (ind
+1 < l
->nitems
1172 && l
->item
[ind
+1].line
== thisline
+ 1)
1173 *endptr
= l
->item
[ind
+1].pc
;
1175 *endptr
= find_line_pc (symtab
, thisline
+1);
1182 /* Given a line table and a line number, return the index into the line
1183 table for the pc of the nearest line whose number is >= the specified one.
1184 Return -1 if none is found. The value is >= 0 if it is an index.
1186 Set *EXACT_MATCH nonzero if the value returned is an exact match. */
1189 find_line_common (l
, lineno
, exact_match
)
1190 register struct linetable
*l
;
1191 register int lineno
;
1197 /* BEST is the smallest linenumber > LINENO so far seen,
1198 or 0 if none has been seen so far.
1199 BEST_INDEX identifies the item for it. */
1201 int best_index
= -1;
1210 for (i
= 0; i
< len
; i
++)
1212 register struct linetable_entry
*item
= &(l
->item
[i
]);
1214 if (item
->line
== lineno
)
1220 if (item
->line
> lineno
&& (best
== 0 || item
->line
< best
))
1227 /* If we got here, we didn't get an exact match. */
1234 find_pc_line_pc_range (pc
, startptr
, endptr
)
1236 CORE_ADDR
*startptr
, *endptr
;
1238 struct symtab_and_line sal
;
1239 sal
= find_pc_line (pc
, 0);
1242 return sal
.symtab
!= 0;
1245 /* If P is of the form "operator[ \t]+..." where `...' is
1246 some legitimate operator text, return a pointer to the
1247 beginning of the substring of the operator text.
1248 Otherwise, return "". */
1250 operator_chars (p
, end
)
1255 if (strncmp (p
, "operator", 8))
1259 /* Don't get faked out by `operator' being part of a longer
1261 if (isalpha(*p
) || *p
== '_' || *p
== '$' || *p
== '\0')
1264 /* Allow some whitespace between `operator' and the operator symbol. */
1265 while (*p
== ' ' || *p
== '\t')
1268 /* Recognize 'operator TYPENAME'. */
1270 if (isalpha(*p
) || *p
== '_' || *p
== '$')
1272 register char *q
= p
+1;
1273 while (isalnum(*q
) || *q
== '_' || *q
== '$')
1298 if (p
[1] == '=' || p
[1] == p
[0])
1309 error ("`operator ()' must be specified without whitespace in `()'");
1314 error ("`operator ?:' must be specified without whitespace in `?:'");
1319 error ("`operator []' must be specified without whitespace in `[]'");
1323 error ("`operator %s' not supported", p
);
1330 /* Recursive helper function for decode_line_1.
1331 * Look for methods named NAME in type T.
1332 * Return number of matches.
1333 * Put matches in SYM_ARR (which better be big enough!).
1334 * These allocations seem to define "big enough":
1335 * sym_arr = (struct symbol **) alloca(TYPE_NFN_FIELDS_TOTAL (t) * sizeof(struct symbol*));
1339 find_methods (t
, name
, sym_arr
)
1342 struct symbol
**sym_arr
;
1346 struct symbol
*sym_class
;
1347 char *class_name
= type_name_no_tag (t
);
1348 /* Ignore this class if it doesn't have a name.
1349 This prevents core dumps, but is just a workaround
1350 because we might not find the function in
1351 certain cases, such as
1352 struct D {virtual int f();}
1353 struct C : D {virtual int g();}
1354 (in this case g++ 1.35.1- does not put out a name
1355 for D as such, it defines type 19 (for example) in
1356 the same stab as C, and then does a
1357 .stabs "D:T19" and a .stabs "D:t19".
1359 "break C::f" should not be looking for field f in
1361 but just for the field f in the baseclasses of C
1362 (no matter what their names).
1364 However, I don't know how to replace the code below
1365 that depends on knowing the name of D. */
1367 && (sym_class
= lookup_symbol (class_name
,
1368 (struct block
*)NULL
,
1371 (struct symtab
**)NULL
)))
1374 t
= SYMBOL_TYPE (sym_class
);
1375 for (method_counter
= TYPE_NFN_FIELDS (t
) - 1;
1376 method_counter
>= 0;
1380 struct fn_field
*f
= TYPE_FN_FIELDLIST1 (t
, method_counter
);
1382 char *method_name
= TYPE_FN_FIELDLIST_NAME (t
, method_counter
);
1383 if (STREQ (name
, method_name
))
1384 /* Find all the fields with that name. */
1385 for (field_counter
= TYPE_FN_FIELDLIST_LENGTH (t
, method_counter
) - 1;
1390 if (TYPE_FN_FIELD_STUB (f
, field_counter
))
1391 check_stub_method (t
, method_counter
, field_counter
);
1392 phys_name
= TYPE_FN_FIELD_PHYSNAME (f
, field_counter
);
1393 /* Destructor is handled by caller, dont add it to the list */
1394 if (DESTRUCTOR_PREFIX_P (phys_name
))
1396 sym_arr
[i1
] = lookup_symbol (phys_name
,
1397 SYMBOL_BLOCK_VALUE (sym_class
),
1400 (struct symtab
**) NULL
);
1401 if (sym_arr
[i1
]) i1
++;
1404 fputs_filtered("(Cannot find method ", stdout
);
1405 fprintf_symbol_filtered (stdout
, phys_name
,
1406 language_cplus
, DMGL_PARAMS
);
1407 fputs_filtered(" - possibly inlined.)\n", stdout
);
1412 /* Only search baseclasses if there is no match yet,
1413 * since names in derived classes override those in baseclasses.
1417 for (ibase
= 0; ibase
< TYPE_N_BASECLASSES (t
); ibase
++)
1418 i1
+= find_methods(TYPE_BASECLASS(t
, ibase
), name
,
1423 /* Parse a string that specifies a line number.
1424 Pass the address of a char * variable; that variable will be
1425 advanced over the characters actually parsed.
1429 LINENUM -- that line number in current file. PC returned is 0.
1430 FILE:LINENUM -- that line in that file. PC returned is 0.
1431 FUNCTION -- line number of openbrace of that function.
1432 PC returned is the start of the function.
1433 VARIABLE -- line number of definition of that variable.
1435 FILE:FUNCTION -- likewise, but prefer functions in that file.
1436 *EXPR -- line in which address EXPR appears.
1438 FUNCTION may be an undebuggable function found in minimal symbol table.
1440 If the argument FUNFIRSTLINE is nonzero, we want the first line
1441 of real code inside a function when a function is specified.
1443 DEFAULT_SYMTAB specifies the file to use if none is specified.
1444 It defaults to current_source_symtab.
1445 DEFAULT_LINE specifies the line number to use for relative
1446 line numbers (that start with signs). Defaults to current_source_line.
1448 Note that it is possible to return zero for the symtab
1449 if no file is validly specified. Callers must check that.
1450 Also, the line number returned may be invalid. */
1452 struct symtabs_and_lines
1453 decode_line_1 (argptr
, funfirstline
, default_symtab
, default_line
)
1456 struct symtab
*default_symtab
;
1459 struct symtabs_and_lines values
;
1460 #ifdef HPPA_COMPILER_BUG
1461 /* FIXME: The native HP 9000/700 compiler has a bug which appears
1462 when optimizing this file with target i960-vxworks. I haven't
1463 been able to construct a simple test case. The problem is that
1464 in the second call to SKIP_PROLOGUE below, the compiler somehow
1465 does not realize that the statement val = find_pc_line (...) will
1466 change the values of the fields of val. It extracts the elements
1467 into registers at the top of the block, and does not update the
1468 registers after the call to find_pc_line. You can check this by
1469 inserting a printf at the end of find_pc_line to show what values
1470 it is returning for val.pc and val.end and another printf after
1471 the call to see what values the function actually got (remember,
1472 this is compiling with cc -O, with this patch removed). You can
1473 also examine the assembly listing: search for the second call to
1474 skip_prologue; the LDO statement before the next call to
1475 find_pc_line loads the address of the structure which
1476 find_pc_line will return; if there is a LDW just before the LDO,
1477 which fetches an element of the structure, then the compiler
1480 Setting val to volatile avoids the problem. We must undef
1481 volatile, because the HPPA native compiler does not define
1482 __STDC__, although it does understand volatile, and so volatile
1483 will have been defined away in defs.h. */
1485 volatile struct symtab_and_line val
;
1486 #define volatile /*nothing*/
1488 struct symtab_and_line val
;
1490 register char *p
, *p1
;
1492 register struct symtab
*s
;
1494 register struct symbol
*sym
;
1495 /* The symtab that SYM was found in. */
1496 struct symtab
*sym_symtab
;
1498 register CORE_ADDR pc
;
1499 register struct minimal_symbol
*msymbol
;
1501 struct symbol
*sym_class
;
1504 struct symbol
**sym_arr
;
1506 char *saved_arg
= *argptr
;
1507 extern char *gdb_completer_quote_characters
;
1509 /* Defaults have defaults. */
1511 if (default_symtab
== 0)
1513 default_symtab
= current_source_symtab
;
1514 default_line
= current_source_line
;
1517 /* See if arg is *PC */
1519 if (**argptr
== '*')
1521 if (**argptr
== '*')
1525 pc
= parse_and_eval_address_1 (argptr
);
1526 values
.sals
= (struct symtab_and_line
*)
1527 xmalloc (sizeof (struct symtab_and_line
));
1529 values
.sals
[0] = find_pc_line (pc
, 0);
1530 values
.sals
[0].pc
= pc
;
1534 /* Maybe arg is FILE : LINENUM or FILE : FUNCTION */
1537 is_quoted
= (strchr (gdb_completer_quote_characters
, **argptr
) != NULL
);
1539 for (p
= *argptr
; *p
; p
++)
1541 if (p
[0] == ':' || p
[0] == ' ' || p
[0] == '\t')
1544 while (p
[0] == ' ' || p
[0] == '\t') p
++;
1546 if ((p
[0] == ':') && !is_quoted
)
1552 /* Extract the class name. */
1554 while (p
!= *argptr
&& p
[-1] == ' ') --p
;
1555 copy
= (char *) alloca (p
- *argptr
+ 1);
1556 memcpy (copy
, *argptr
, p
- *argptr
);
1557 copy
[p
- *argptr
] = 0;
1559 /* Discard the class name from the arg. */
1561 while (*p
== ' ' || *p
== '\t') p
++;
1564 sym_class
= lookup_symbol (copy
, 0, STRUCT_NAMESPACE
, 0,
1565 (struct symtab
**)NULL
);
1568 ( TYPE_CODE (SYMBOL_TYPE (sym_class
)) == TYPE_CODE_STRUCT
1569 || TYPE_CODE (SYMBOL_TYPE (sym_class
)) == TYPE_CODE_UNION
))
1571 /* Arg token is not digits => try it as a function name
1572 Find the next token (everything up to end or next whitespace). */
1574 while (*p
&& *p
!= ' ' && *p
!= '\t' && *p
!= ',' && *p
!=':') p
++;
1575 q
= operator_chars (*argptr
, &q1
);
1580 char *tmp
= alloca (q1
- q
+ 1);
1581 memcpy (tmp
, q
, q1
- q
);
1583 opname
= cplus_mangle_opname (tmp
, DMGL_ANSI
);
1586 warning ("no mangling for \"%s\"", tmp
);
1587 cplusplus_hint (saved_arg
);
1588 return_to_top_level ();
1590 copy
= (char*) alloca (3 + strlen(opname
));
1591 sprintf (copy
, "__%s", opname
);
1596 copy
= (char *) alloca (p
- *argptr
+ 1 + (q1
- q
));
1597 memcpy (copy
, *argptr
, p
- *argptr
);
1598 copy
[p
- *argptr
] = '\0';
1601 /* no line number may be specified */
1602 while (*p
== ' ' || *p
== '\t') p
++;
1606 i1
= 0; /* counter for the symbol array */
1607 t
= SYMBOL_TYPE (sym_class
);
1608 sym_arr
= (struct symbol
**) alloca(TYPE_NFN_FIELDS_TOTAL (t
) * sizeof(struct symbol
*));
1610 if (destructor_name_p (copy
, t
))
1612 /* destructors are a special case. */
1613 struct fn_field
*f
= TYPE_FN_FIELDLIST1 (t
, 0);
1614 int len
= TYPE_FN_FIELDLIST_LENGTH (t
, 0) - 1;
1615 /* gcc 1.x puts destructor in last field,
1616 gcc 2.x puts destructor in first field. */
1617 char *phys_name
= TYPE_FN_FIELD_PHYSNAME (f
, len
);
1618 if (!DESTRUCTOR_PREFIX_P (phys_name
))
1620 phys_name
= TYPE_FN_FIELD_PHYSNAME (f
, 0);
1621 if (!DESTRUCTOR_PREFIX_P (phys_name
))
1625 lookup_symbol (phys_name
, SYMBOL_BLOCK_VALUE (sym_class
),
1626 VAR_NAMESPACE
, 0, (struct symtab
**)NULL
);
1627 if (sym_arr
[i1
]) i1
++;
1630 i1
= find_methods (t
, copy
, sym_arr
);
1633 /* There is exactly one field with that name. */
1636 if (sym
&& SYMBOL_CLASS (sym
) == LOC_BLOCK
)
1638 /* Arg is the name of a function */
1639 pc
= BLOCK_START (SYMBOL_BLOCK_VALUE (sym
)) + FUNCTION_START_OFFSET
;
1642 values
.sals
= (struct symtab_and_line
*)xmalloc (sizeof (struct symtab_and_line
));
1644 values
.sals
[0] = find_pc_line (pc
, 0);
1645 values
.sals
[0].pc
= (values
.sals
[0].end
&& values
.sals
[0].pc
!= pc
) ? values
.sals
[0].end
: pc
;
1655 /* There is more than one field with that name
1656 (overloaded). Ask the user which one to use. */
1657 return decode_line_2 (sym_arr
, i1
, funfirstline
);
1663 if (OPNAME_PREFIX_P (copy
))
1665 tmp
= (char *)alloca (strlen (copy
+3) + 9);
1666 strcpy (tmp
, "operator ");
1667 strcat (tmp
, copy
+3);
1672 warning ("the class `%s' does not have destructor defined",
1673 SYMBOL_SOURCE_NAME(sym_class
));
1675 warning ("the class %s does not have any method named %s",
1676 SYMBOL_SOURCE_NAME(sym_class
), tmp
);
1677 cplusplus_hint (saved_arg
);
1678 return_to_top_level ();
1683 /* The quotes are important if copy is empty. */
1684 warning ("can't find class, struct, or union named \"%s\"",
1686 cplusplus_hint (saved_arg
);
1687 return_to_top_level ();
1693 /* Extract the file name. */
1695 while (p
!= *argptr
&& p
[-1] == ' ') --p
;
1696 copy
= (char *) alloca (p
- *argptr
+ 1);
1697 memcpy (copy
, *argptr
, p
- *argptr
);
1698 copy
[p
- *argptr
] = 0;
1700 /* Find that file's data. */
1701 s
= lookup_symtab (copy
);
1704 if (!have_full_symbols () && !have_partial_symbols ())
1705 error (no_symtab_msg
);
1706 error ("No source file named %s.", copy
);
1709 /* Discard the file name from the arg. */
1711 while (*p
== ' ' || *p
== '\t') p
++;
1715 /* S is specified file's symtab, or 0 if no file specified.
1716 arg no longer contains the file name. */
1718 /* Check whether arg is all digits (and sign) */
1721 if (*p
== '-' || *p
== '+') p
++;
1722 while (*p
>= '0' && *p
<= '9')
1725 if (p
!= *argptr
&& (*p
== 0 || *p
== ' ' || *p
== '\t' || *p
== ','))
1727 /* We found a token consisting of all digits -- at least one digit. */
1728 enum sign
{none
, plus
, minus
} sign
= none
;
1730 /* This is where we need to make sure that we have good defaults.
1731 We must guarantee that this section of code is never executed
1732 when we are called with just a function name, since
1733 select_source_symtab calls us with such an argument */
1735 if (s
== 0 && default_symtab
== 0)
1737 select_source_symtab (0);
1738 default_symtab
= current_source_symtab
;
1739 default_line
= current_source_line
;
1742 if (**argptr
== '+')
1743 sign
= plus
, (*argptr
)++;
1744 else if (**argptr
== '-')
1745 sign
= minus
, (*argptr
)++;
1746 val
.line
= atoi (*argptr
);
1753 val
.line
= default_line
+ val
.line
;
1759 val
.line
= default_line
- val
.line
;
1764 break; /* No need to adjust val.line. */
1767 while (*p
== ' ' || *p
== '\t') p
++;
1773 values
.sals
= (struct symtab_and_line
*)xmalloc (sizeof (struct symtab_and_line
));
1774 values
.sals
[0] = val
;
1779 /* Arg token is not digits => try it as a variable name
1780 Find the next token (everything up to end or next whitespace). */
1782 p
= skip_quoted (*argptr
);
1783 copy
= (char *) alloca (p
- *argptr
+ 1);
1784 memcpy (copy
, *argptr
, p
- *argptr
);
1785 copy
[p
- *argptr
] = '\0';
1786 if ((copy
[0] == copy
[p
- *argptr
- 1])
1787 && strchr (gdb_completer_quote_characters
, copy
[0]) != NULL
)
1790 copy
[p
- *argptr
- 1] = '\0';
1793 while (*p
== ' ' || *p
== '\t') p
++;
1796 /* Look up that token as a variable.
1797 If file specified, use that file's per-file block to start with. */
1799 sym
= lookup_symbol (copy
,
1800 (s
? BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), STATIC_BLOCK
)
1801 : get_selected_block ()),
1802 VAR_NAMESPACE
, 0, &sym_symtab
);
1806 if (SYMBOL_CLASS (sym
) == LOC_BLOCK
)
1808 /* Arg is the name of a function */
1809 pc
= BLOCK_START (SYMBOL_BLOCK_VALUE (sym
)) + FUNCTION_START_OFFSET
;
1812 val
= find_pc_line (pc
, 0);
1813 #ifdef PROLOGUE_FIRSTLINE_OVERLAP
1814 /* Convex: no need to suppress code on first line, if any */
1817 /* If SKIP_PROLOGUE left us in mid-line, and the next line is still
1818 part of the same function:
1819 advance to next line,
1820 recalculate its line number (might not be N+1). */
1821 if (val
.pc
!= pc
&& val
.end
&&
1822 lookup_minimal_symbol_by_pc (pc
) == lookup_minimal_symbol_by_pc (val
.end
)) {
1823 pc
= val
.end
; /* First pc of next line */
1824 val
= find_pc_line (pc
, 0);
1828 values
.sals
= (struct symtab_and_line
*)xmalloc (sizeof (struct symtab_and_line
));
1829 values
.sals
[0] = val
;
1832 /* I think this is always the same as the line that
1833 we calculate above, but the general principle is
1834 "trust the symbols more than stuff like
1836 if (SYMBOL_LINE (sym
) != 0)
1837 values
.sals
[0].line
= SYMBOL_LINE (sym
);
1841 else if (SYMBOL_LINE (sym
) != 0)
1843 /* We know its line number. */
1844 values
.sals
= (struct symtab_and_line
*)
1845 xmalloc (sizeof (struct symtab_and_line
));
1847 memset (&values
.sals
[0], 0, sizeof (values
.sals
[0]));
1848 values
.sals
[0].symtab
= sym_symtab
;
1849 values
.sals
[0].line
= SYMBOL_LINE (sym
);
1853 /* This can happen if it is compiled with a compiler which doesn't
1854 put out line numbers for variables. */
1855 error ("Line number not known for symbol \"%s\"", copy
);
1858 msymbol
= lookup_minimal_symbol (copy
, (struct objfile
*) NULL
);
1859 if (msymbol
!= NULL
)
1863 val
.pc
= SYMBOL_VALUE_ADDRESS (msymbol
) + FUNCTION_START_OFFSET
;
1865 SKIP_PROLOGUE (val
.pc
);
1866 values
.sals
= (struct symtab_and_line
*)xmalloc (sizeof (struct symtab_and_line
));
1867 values
.sals
[0] = val
;
1872 if (!have_full_symbols () &&
1873 !have_partial_symbols () && !have_minimal_symbols ())
1874 error (no_symtab_msg
);
1876 error ("Function \"%s\" not defined.", copy
);
1877 return values
; /* for lint */
1880 struct symtabs_and_lines
1881 decode_line_spec (string
, funfirstline
)
1885 struct symtabs_and_lines sals
;
1887 error ("Empty line specification.");
1888 sals
= decode_line_1 (&string
, funfirstline
,
1889 current_source_symtab
, current_source_line
);
1891 error ("Junk at end of line specification: %s", string
);
1895 /* Given a list of NELTS symbols in sym_arr, return a list of lines to
1896 operate on (ask user if necessary). */
1898 static struct symtabs_and_lines
1899 decode_line_2 (sym_arr
, nelts
, funfirstline
)
1900 struct symbol
*sym_arr
[];
1904 struct symtabs_and_lines values
, return_values
;
1905 register CORE_ADDR pc
;
1911 values
.sals
= (struct symtab_and_line
*) alloca (nelts
* sizeof(struct symtab_and_line
));
1912 return_values
.sals
= (struct symtab_and_line
*) xmalloc (nelts
* sizeof(struct symtab_and_line
));
1915 printf("[0] cancel\n[1] all\n");
1918 if (sym_arr
[i
] && SYMBOL_CLASS (sym_arr
[i
]) == LOC_BLOCK
)
1920 /* Arg is the name of a function */
1921 pc
= BLOCK_START (SYMBOL_BLOCK_VALUE (sym_arr
[i
]))
1922 + FUNCTION_START_OFFSET
;
1925 values
.sals
[i
] = find_pc_line (pc
, 0);
1926 values
.sals
[i
].pc
= (values
.sals
[i
].end
&& values
.sals
[i
].pc
!= pc
) ?
1927 values
.sals
[i
].end
: pc
;
1928 printf("[%d] %s at %s:%d\n", (i
+2), SYMBOL_SOURCE_NAME (sym_arr
[i
]),
1929 values
.sals
[i
].symtab
->filename
, values
.sals
[i
].line
);
1931 else printf ("?HERE\n");
1935 if ((prompt
= getenv ("PS2")) == NULL
)
1939 printf("%s ",prompt
);
1942 args
= command_line_input ((char *) NULL
, 0);
1945 error_no_arg ("one or more choice numbers");
1953 while (*arg1
>= '0' && *arg1
<= '9') arg1
++;
1954 if (*arg1
&& *arg1
!= ' ' && *arg1
!= '\t')
1955 error ("Arguments must be choice numbers.");
1960 error ("cancelled");
1963 memcpy (return_values
.sals
, values
.sals
,
1964 (nelts
* sizeof(struct symtab_and_line
)));
1965 return_values
.nelts
= nelts
;
1966 return return_values
;
1969 if (num
> nelts
+ 2)
1971 printf ("No choice number %d.\n", num
);
1976 if (values
.sals
[num
].pc
)
1978 return_values
.sals
[i
++] = values
.sals
[num
];
1979 values
.sals
[num
].pc
= 0;
1983 printf ("duplicate request for %d ignored.\n", num
);
1988 while (*args
== ' ' || *args
== '\t') args
++;
1990 return_values
.nelts
= i
;
1991 return return_values
;
1995 /* Slave routine for sources_info. Force line breaks at ,'s.
1996 NAME is the name to print and *FIRST is nonzero if this is the first
1997 name printed. Set *FIRST to zero. */
1999 output_source_filename (name
, first
)
2003 /* Table of files printed so far. Since a single source file can
2004 result in several partial symbol tables, we need to avoid printing
2005 it more than once. Note: if some of the psymtabs are read in and
2006 some are not, it gets printed both under "Source files for which
2007 symbols have been read" and "Source files for which symbols will
2008 be read in on demand". I consider this a reasonable way to deal
2009 with the situation. I'm not sure whether this can also happen for
2010 symtabs; it doesn't hurt to check. */
2011 static char **tab
= NULL
;
2012 /* Allocated size of tab in elements.
2013 Start with one 256-byte block (when using GNU malloc.c).
2014 24 is the malloc overhead when range checking is in effect. */
2015 static int tab_alloc_size
= (256 - 24) / sizeof (char *);
2016 /* Current size of tab in elements. */
2017 static int tab_cur_size
;
2024 tab
= (char **) xmalloc (tab_alloc_size
* sizeof (*tab
));
2028 /* Is NAME in tab? */
2029 for (p
= tab
; p
< tab
+ tab_cur_size
; p
++)
2030 if (STREQ (*p
, name
))
2031 /* Yes; don't print it again. */
2033 /* No; add it to tab. */
2034 if (tab_cur_size
== tab_alloc_size
)
2036 tab_alloc_size
*= 2;
2037 tab
= (char **) xrealloc ((char *) tab
, tab_alloc_size
* sizeof (*tab
));
2039 tab
[tab_cur_size
++] = name
;
2047 printf_filtered (", ");
2051 fputs_filtered (name
, stdout
);
2055 sources_info (ignore
, from_tty
)
2059 register struct symtab
*s
;
2060 register struct partial_symtab
*ps
;
2061 register struct objfile
*objfile
;
2064 if (!have_full_symbols () && !have_partial_symbols ())
2066 error (no_symtab_msg
);
2069 printf_filtered ("Source files for which symbols have been read in:\n\n");
2072 ALL_SYMTABS (objfile
, s
)
2074 output_source_filename (s
-> filename
, &first
);
2076 printf_filtered ("\n\n");
2078 printf_filtered ("Source files for which symbols will be read in on demand:\n\n");
2081 ALL_PSYMTABS (objfile
, ps
)
2085 output_source_filename (ps
-> filename
, &first
);
2088 printf_filtered ("\n");
2091 /* List all symbols (if REGEXP is NULL) or all symbols matching REGEXP.
2092 If CLASS is zero, list all symbols except functions, type names, and
2094 If CLASS is 1, list only functions.
2095 If CLASS is 2, list only type names.
2096 If CLASS is 3, list only method names.
2098 BPT is non-zero if we should set a breakpoint at the functions
2102 list_symbols (regexp
, class, bpt
)
2107 register struct symtab
*s
;
2108 register struct partial_symtab
*ps
;
2109 register struct blockvector
*bv
;
2110 struct blockvector
*prev_bv
= 0;
2111 register struct block
*b
;
2113 register struct symbol
*sym
;
2114 struct partial_symbol
*psym
;
2115 struct objfile
*objfile
;
2116 struct minimal_symbol
*msymbol
;
2118 static char *classnames
[]
2119 = {"variable", "function", "type", "method"};
2120 int found_in_file
= 0;
2122 static enum minimal_symbol_type types
[]
2123 = {mst_data
, mst_text
, mst_abs
, mst_unknown
};
2124 static enum minimal_symbol_type types2
[]
2125 = {mst_bss
, mst_text
, mst_abs
, mst_unknown
};
2126 enum minimal_symbol_type ourtype
= types
[class];
2127 enum minimal_symbol_type ourtype2
= types2
[class];
2131 /* Make sure spacing is right for C++ operators.
2132 This is just a courtesy to make the matching less sensitive
2133 to how many spaces the user leaves between 'operator'
2134 and <TYPENAME> or <OPERATOR>. */
2136 char *opname
= operator_chars (regexp
, &opend
);
2139 int fix
= -1; /* -1 means ok; otherwise number of spaces needed. */
2140 if (isalpha(*opname
) || *opname
== '_' || *opname
== '$')
2142 /* There should 1 space between 'operator' and 'TYPENAME'. */
2143 if (opname
[-1] != ' ' || opname
[-2] == ' ')
2148 /* There should 0 spaces between 'operator' and 'OPERATOR'. */
2149 if (opname
[-1] == ' ')
2152 /* If wrong number of spaces, fix it. */
2155 char *tmp
= (char*) alloca(opend
-opname
+10);
2156 sprintf(tmp
, "operator%.*s%s", fix
, " ", opname
);
2161 if (0 != (val
= re_comp (regexp
)))
2162 error ("Invalid regexp (%s): %s", val
, regexp
);
2165 /* Search through the partial symtabs *first* for all symbols
2166 matching the regexp. That way we don't have to reproduce all of
2167 the machinery below. */
2169 ALL_PSYMTABS (objfile
, ps
)
2171 struct partial_symbol
*bound
, *gbound
, *sbound
;
2174 if (ps
->readin
) continue;
2176 gbound
= objfile
->global_psymbols
.list
+ ps
->globals_offset
+ ps
->n_global_syms
;
2177 sbound
= objfile
->static_psymbols
.list
+ ps
->statics_offset
+ ps
->n_static_syms
;
2180 /* Go through all of the symbols stored in a partial
2181 symtab in one loop. */
2182 psym
= objfile
->global_psymbols
.list
+ ps
->globals_offset
;
2187 if (bound
== gbound
&& ps
->n_static_syms
!= 0)
2189 psym
= objfile
->static_psymbols
.list
+ ps
->statics_offset
;
2200 /* If it would match (logic taken from loop below)
2201 load the file and go on to the next one */
2202 if ((regexp
== NULL
|| SYMBOL_MATCHES_REGEXP (psym
))
2203 && ((class == 0 && SYMBOL_CLASS (psym
) != LOC_TYPEDEF
2204 && SYMBOL_CLASS (psym
) != LOC_BLOCK
)
2205 || (class == 1 && SYMBOL_CLASS (psym
) == LOC_BLOCK
)
2206 || (class == 2 && SYMBOL_CLASS (psym
) == LOC_TYPEDEF
)
2207 || (class == 3 && SYMBOL_CLASS (psym
) == LOC_BLOCK
)))
2209 PSYMTAB_TO_SYMTAB(ps
);
2217 /* Here, we search through the minimal symbol tables for functions that
2218 match, and call find_pc_symtab on them to force their symbols to
2219 be read. The symbol will then be found during the scan of symtabs
2220 below. If find_pc_symtab fails, set found_misc so that we will
2221 rescan to print any matching symbols without debug info. */
2225 ALL_MSYMBOLS (objfile
, msymbol
)
2227 if (MSYMBOL_TYPE (msymbol
) == ourtype
||
2228 MSYMBOL_TYPE (msymbol
) == ourtype2
)
2230 if (regexp
== NULL
|| SYMBOL_MATCHES_REGEXP (msymbol
))
2232 if (0 == find_pc_symtab (SYMBOL_VALUE_ADDRESS (msymbol
)))
2241 /* Printout here so as to get after the "Reading in symbols"
2242 messages which will be generated above. */
2244 printf_filtered (regexp
2245 ? "All %ss matching regular expression \"%s\":\n"
2246 : "All defined %ss:\n",
2250 ALL_SYMTABS (objfile
, s
)
2253 bv
= BLOCKVECTOR (s
);
2254 /* Often many files share a blockvector.
2255 Scan each blockvector only once so that
2256 we don't get every symbol many times.
2257 It happens that the first symtab in the list
2258 for any given blockvector is the main file. */
2260 for (i
= GLOBAL_BLOCK
; i
<= STATIC_BLOCK
; i
++)
2262 b
= BLOCKVECTOR_BLOCK (bv
, i
);
2263 /* Skip the sort if this block is always sorted. */
2264 if (!BLOCK_SHOULD_SORT (b
))
2265 sort_block_syms (b
);
2266 for (j
= 0; j
< BLOCK_NSYMS (b
); j
++)
2269 sym
= BLOCK_SYM (b
, j
);
2270 if ((regexp
== NULL
|| SYMBOL_MATCHES_REGEXP (sym
))
2271 && ((class == 0 && SYMBOL_CLASS (sym
) != LOC_TYPEDEF
2272 && SYMBOL_CLASS (sym
) != LOC_BLOCK
2273 && SYMBOL_CLASS (sym
) != LOC_CONST
)
2274 || (class == 1 && SYMBOL_CLASS (sym
) == LOC_BLOCK
)
2275 || (class == 2 && SYMBOL_CLASS (sym
) == LOC_TYPEDEF
)
2276 || (class == 3 && SYMBOL_CLASS (sym
) == LOC_BLOCK
)))
2280 /* Set a breakpoint here, if it's a function */
2283 /* There may be more than one function with the
2284 same name but in different files. In order to
2285 set breakpoints on all of them, we must give
2286 both the file name and the function name to
2289 (char *) alloca (strlen (s
->filename
)
2290 + strlen (SYMBOL_NAME(sym
))
2292 strcpy (string
, s
->filename
);
2293 strcat (string
, ":");
2294 strcat (string
, SYMBOL_NAME(sym
));
2295 break_command (string
, 0);
2298 else if (!found_in_file
)
2300 fputs_filtered ("\nFile ", stdout
);
2301 fputs_filtered (s
->filename
, stdout
);
2302 fputs_filtered (":\n", stdout
);
2306 if (class != 2 && i
== STATIC_BLOCK
)
2307 printf_filtered ("static ");
2309 /* Typedef that is not a C++ class */
2311 && SYMBOL_NAMESPACE (sym
) != STRUCT_NAMESPACE
)
2312 c_typedef_print (SYMBOL_TYPE(sym
), sym
, stdout
);
2313 /* variable, func, or typedef-that-is-c++-class */
2314 else if (class < 2 ||
2316 SYMBOL_NAMESPACE(sym
) == STRUCT_NAMESPACE
))
2318 type_print (SYMBOL_TYPE (sym
),
2319 (SYMBOL_CLASS (sym
) == LOC_TYPEDEF
2320 ? "" : SYMBOL_SOURCE_NAME (sym
)),
2323 printf_filtered (";\n");
2327 # if 0 /* FIXME, why is this zapped out? */
2329 c_type_print_base (TYPE_FN_FIELD_TYPE(t
, i
),
2331 c_type_print_varspec_prefix (TYPE_FN_FIELD_TYPE(t
, i
),
2333 sprintf (buf
, " %s::", type_name_no_tag (t
));
2334 cp_type_print_method_args (TYPE_FN_FIELD_ARGS (t
, i
),
2344 /* If there are no eyes, avoid all contact. I mean, if there are
2345 no debug symbols, then print directly from the msymbol_vector. */
2347 if (found_misc
|| class != 1)
2350 ALL_MSYMBOLS (objfile
, msymbol
)
2352 if (MSYMBOL_TYPE (msymbol
) == ourtype
||
2353 MSYMBOL_TYPE (msymbol
) == ourtype2
)
2355 if (regexp
== NULL
|| SYMBOL_MATCHES_REGEXP (msymbol
))
2357 /* Functions: Look up by address. */
2359 (0 == find_pc_symtab (SYMBOL_VALUE_ADDRESS (msymbol
))))
2361 /* Variables/Absolutes: Look up by name */
2362 if (lookup_symbol (SYMBOL_NAME (msymbol
),
2363 (struct block
*) NULL
, VAR_NAMESPACE
,
2364 0, (struct symtab
**) NULL
) == NULL
)
2368 printf_filtered ("\nNon-debugging symbols:\n");
2371 printf_filtered (" %08x %s\n",
2372 SYMBOL_VALUE_ADDRESS (msymbol
),
2373 SYMBOL_SOURCE_NAME (msymbol
));
2383 variables_info (regexp
, from_tty
)
2387 list_symbols (regexp
, 0, 0);
2391 functions_info (regexp
, from_tty
)
2395 list_symbols (regexp
, 1, 0);
2399 types_info (regexp
, from_tty
)
2403 list_symbols (regexp
, 2, 0);
2407 /* Tiemann says: "info methods was never implemented." */
2409 methods_info (regexp
)
2412 list_symbols (regexp
, 3, 0);
2416 /* Breakpoint all functions matching regular expression. */
2418 rbreak_command (regexp
, from_tty
)
2422 list_symbols (regexp
, 1, 1);
2426 /* Return Nonzero if block a is lexically nested within block b,
2427 or if a and b have the same pc range.
2428 Return zero otherwise. */
2431 struct block
*a
, *b
;
2435 return BLOCK_START (a
) >= BLOCK_START (b
)
2436 && BLOCK_END (a
) <= BLOCK_END (b
);
2440 /* Helper routine for make_symbol_completion_list. */
2442 static int return_val_size
;
2443 static int return_val_index
;
2444 static char **return_val
;
2446 #define COMPLETION_LIST_ADD_SYMBOL(symbol, text, len) \
2448 completion_list_add_name (SYMBOL_NAME (symbol), text, len); \
2449 if (SYMBOL_DEMANGLED_NAME (symbol) != NULL) \
2450 completion_list_add_name (SYMBOL_DEMANGLED_NAME (symbol), text, len); \
2453 /* Test to see if the symbol specified by SYMNAME (which is already
2454 demangled for C++ symbols) matches TEXT in the first TEXT_LEN
2455 characters. If so, add it to the current completion list. */
2458 completion_list_add_name (symname
, text
, text_len
)
2466 /* clip symbols that cannot match */
2468 if (strncmp (symname
, text
, text_len
) != 0)
2473 /* Clip any symbol names that we've already considered. (This is a
2474 time optimization) */
2476 for (i
= 0; i
< return_val_index
; ++i
)
2478 if (STREQ (symname
, return_val
[i
]))
2484 /* We have a match for a completion, so add SYMNAME to the current list
2485 of matches. Note that the name is moved to freshly malloc'd space. */
2487 symname
= savestring (symname
, strlen (symname
));
2488 if (return_val_index
+ 3 > return_val_size
)
2490 newsize
= (return_val_size
*= 2) * sizeof (char *);
2491 return_val
= (char **) xrealloc ((char *) return_val
, newsize
);
2493 return_val
[return_val_index
++] = symname
;
2494 return_val
[return_val_index
] = NULL
;
2497 /* Return a NULL terminated array of all symbols (regardless of class) which
2498 begin by matching TEXT. If the answer is no symbols, then the return value
2499 is an array which contains only a NULL pointer.
2501 Problem: All of the symbols have to be copied because readline frees them.
2502 I'm not going to worry about this; hopefully there won't be that many. */
2505 make_symbol_completion_list (text
)
2508 register struct symbol
*sym
;
2509 register struct symtab
*s
;
2510 register struct partial_symtab
*ps
;
2511 register struct minimal_symbol
*msymbol
;
2512 register struct objfile
*objfile
;
2513 register struct block
*b
, *surrounding_static_block
= 0;
2516 struct partial_symbol
*psym
;
2518 text_len
= strlen (text
);
2519 return_val_size
= 100;
2520 return_val_index
= 0;
2521 return_val
= (char **) xmalloc ((return_val_size
+ 1) * sizeof (char *));
2522 return_val
[0] = NULL
;
2524 /* Look through the partial symtabs for all symbols which begin
2525 by matching TEXT. Add each one that you find to the list. */
2527 ALL_PSYMTABS (objfile
, ps
)
2529 /* If the psymtab's been read in we'll get it when we search
2530 through the blockvector. */
2531 if (ps
->readin
) continue;
2533 for (psym
= objfile
->global_psymbols
.list
+ ps
->globals_offset
;
2534 psym
< (objfile
->global_psymbols
.list
+ ps
->globals_offset
2535 + ps
->n_global_syms
);
2538 /* If interrupted, then quit. */
2540 COMPLETION_LIST_ADD_SYMBOL (psym
, text
, text_len
);
2543 for (psym
= objfile
->static_psymbols
.list
+ ps
->statics_offset
;
2544 psym
< (objfile
->static_psymbols
.list
+ ps
->statics_offset
2545 + ps
->n_static_syms
);
2549 COMPLETION_LIST_ADD_SYMBOL (psym
, text
, text_len
);
2553 /* At this point scan through the misc symbol vectors and add each
2554 symbol you find to the list. Eventually we want to ignore
2555 anything that isn't a text symbol (everything else will be
2556 handled by the psymtab code above). */
2558 ALL_MSYMBOLS (objfile
, msymbol
)
2561 COMPLETION_LIST_ADD_SYMBOL (msymbol
, text
, text_len
);
2564 /* Search upwards from currently selected frame (so that we can
2565 complete on local vars. */
2567 for (b
= get_selected_block (); b
!= NULL
; b
= BLOCK_SUPERBLOCK (b
))
2569 if (!BLOCK_SUPERBLOCK (b
))
2571 surrounding_static_block
= b
; /* For elmin of dups */
2574 /* Also catch fields of types defined in this places which match our
2575 text string. Only complete on types visible from current context. */
2577 for (i
= 0; i
< BLOCK_NSYMS (b
); i
++)
2579 sym
= BLOCK_SYM (b
, i
);
2580 COMPLETION_LIST_ADD_SYMBOL (sym
, text
, text_len
);
2581 if (SYMBOL_CLASS (sym
) == LOC_TYPEDEF
)
2583 struct type
*t
= SYMBOL_TYPE (sym
);
2584 enum type_code c
= TYPE_CODE (t
);
2586 if (c
== TYPE_CODE_UNION
|| c
== TYPE_CODE_STRUCT
)
2588 for (j
= TYPE_N_BASECLASSES (t
); j
< TYPE_NFIELDS (t
); j
++)
2590 if (TYPE_FIELD_NAME (t
, j
))
2592 completion_list_add_name (TYPE_FIELD_NAME (t
, j
),
2601 /* Go through the symtabs and check the externs and statics for
2602 symbols which match. */
2604 ALL_SYMTABS (objfile
, s
)
2607 b
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), GLOBAL_BLOCK
);
2608 for (i
= 0; i
< BLOCK_NSYMS (b
); i
++)
2610 sym
= BLOCK_SYM (b
, i
);
2611 COMPLETION_LIST_ADD_SYMBOL (sym
, text
, text_len
);
2615 ALL_SYMTABS (objfile
, s
)
2618 b
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), STATIC_BLOCK
);
2619 /* Don't do this block twice. */
2620 if (b
== surrounding_static_block
) continue;
2621 for (i
= 0; i
< BLOCK_NSYMS (b
); i
++)
2623 sym
= BLOCK_SYM (b
, i
);
2624 COMPLETION_LIST_ADD_SYMBOL (sym
, text
, text_len
);
2628 return (return_val
);
2633 /* Add the type of the symbol sym to the type of the current
2634 function whose block we are in (assumed). The type of
2635 this current function is contained in *TYPE.
2637 This basically works as follows: When we find a function
2638 symbol (N_FUNC with a 'f' or 'F' in the symbol name), we record
2639 a pointer to its type in the global in_function_type. Every
2640 time we come across a parameter symbol ('p' in its name), then
2641 this procedure adds the name and type of that parameter
2642 to the function type pointed to by *TYPE. (Which should correspond
2643 to in_function_type if it was called correctly).
2645 Note that since we are modifying a type, the result of
2646 lookup_function_type() should be memcpy()ed before calling
2647 this. When not in strict typing mode, the expression
2648 evaluator can choose to ignore this.
2650 Assumption: All of a function's parameter symbols will
2651 appear before another function symbol is found. The parameters
2652 appear in the same order in the argument list as they do in the
2656 add_param_to_type (type
,sym
)
2660 int num
= ++(TYPE_NFIELDS(*type
));
2662 if(TYPE_NFIELDS(*type
)-1)
2663 TYPE_FIELDS(*type
) = (struct field
*)
2664 (*current_objfile
->xrealloc
) ((char *)(TYPE_FIELDS(*type
)),
2665 num
*sizeof(struct field
));
2667 TYPE_FIELDS(*type
) = (struct field
*)
2668 (*current_objfile
->xmalloc
) (num
*sizeof(struct field
));
2670 TYPE_FIELD_BITPOS(*type
,num
-1) = num
-1;
2671 TYPE_FIELD_BITSIZE(*type
,num
-1) = 0;
2672 TYPE_FIELD_TYPE(*type
,num
-1) = SYMBOL_TYPE(sym
);
2673 TYPE_FIELD_NAME(*type
,num
-1) = SYMBOL_NAME(sym
);
2678 _initialize_symtab ()
2680 add_info ("variables", variables_info
,
2681 "All global and static variable names, or those matching REGEXP.");
2682 add_info ("functions", functions_info
,
2683 "All function names, or those matching REGEXP.");
2685 /* FIXME: This command has at least the following problems:
2686 1. It prints builtin types (in a very strange and confusing fashion).
2687 2. It doesn't print right, e.g. with
2688 typedef struct foo *FOO
2689 type_print prints "FOO" when we want to make it (in this situation)
2690 print "struct foo *".
2691 I also think "ptype" or "whatis" is more likely to be useful (but if
2692 there is much disagreement "info types" can be fixed). */
2693 add_info ("types", types_info
,
2694 "All type names, or those matching REGEXP.");
2697 add_info ("methods", methods_info
,
2698 "All method names, or those matching REGEXP::REGEXP.\n\
2699 If the class qualifier is omitted, it is assumed to be the current scope.\n\
2700 If the first REGEXP is omitted, then all methods matching the second REGEXP\n\
2703 add_info ("sources", sources_info
,
2704 "Source files in the program.");
2706 add_com ("rbreak", no_class
, rbreak_command
,
2707 "Set a breakpoint for all functions matching REGEXP.");
2709 /* Initialize the one built-in type that isn't language dependent... */
2710 builtin_type_error
= init_type (TYPE_CODE_ERROR
, 0, 0,
2711 "<unknown type>", (struct objfile
*) NULL
);