This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
(patch) hpjyg20: symtab.c & related
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: (patch) hpjyg20: symtab.c & related
- From: Jimmy Guo <guo at cup dot hp dot com>
- Date: Thu, 11 Nov 1999 12:09:12 -0800 (PST)
***
Patch dependecies: hpjyg05 (config/pa/tm-hppa.h)
hpjyg16 (symtab.c,source.c)
hpjyg19 (breakpoint.c)
***
This patch contains various changes to symtab.c, mainly:
- introduction of multiple functions handling in decode_line_1
(i.e. overloaded C++ funcs or file static C functions)
- addition of codes ifdef'd by FAT_FREE_PSYMTABS to rely on linker
symbol table entries to determine which translation unit's partial
symbol table must be expanded. Here is a more complete overview of
this feature:
We use the partial symbol tables to identify which TU's partial
symbol table must be expanded to get further information about a
symbol. This decision can also be made by consulting the minimal
symbol table, determining the address of the symbol therefrom
and finding out which partial symbol table's address range
(texthigh & textlow) envelops the symbol's address.
If we are successful in using the minimal symbol table to zoom
in on which psymtab to expand, then we could eliminate the
"kernels" of these N partial symbol tables and build just the shell.
- addition of the notion of language case sensitivity to support
debugging Fortran which is case insensitive ... a new pair of GDB
commands is introduced here: set/show case-sensitive (on/off).
ChangeLog:
1999-11-11 Jimmy Guo <guo@cup.hp.com>
* symtab.c: Add support for breakpoint menu of multiple
(overloaded or file static) functions.
(lookup_symtab_1): Replace use of goto with a 2-iteration loop.
(lookup_partial_symtab): Try lookup without filename extensions
if still not found.
(find_pc_sect_psymtab): If find_pc_sect_psymbol failed to find a
psymtab, check textlow and texthigh and return tpst if it houses
pc + 4 (ifdef FAT_FREE_PSYMTABS).
(lookup_symbol): Add case sensitivity handling.
(lookup_transparent_type): Add handling of the case where the
same block hasboth a complete and an opaque version of a type.
(find_main_psymtab): Fall back to linker symbol table to find
the psymtab housing psymbol (ifdef FAT_FREE_PSYMTABS).
(lookup_block_transparent_type): New function.
(find_pc_sect_symtab): If pc is 0 just return NULL.
(find_pc_symtab): Ditto.
(find_pc_sect_line): Detect bogus line number by checking if the
function enclosing val.pc ends before pc (e.g. when the function
has no line number info, say compiler generated functions).
(find_line_symtab): Fallback to psymtab if not found.
(decode_line_1): Add resolve argument (USER_CHOICE or
ALL_SYMBOLS) to control how multiple matches for a symbol are
resolved; set values.nelts to 0 to flag error to the caller;
fallback to minimal symbol table to handle the case when the
file containing the symbol have no debug info; look for multiple
overloads (C++) or static (C) defintions of the function symbol
found (ifdef GDB_TARGET_IS_HPPA).
(decode_line_2): Add resolve argument, handle multiple matches
for a function.
(find_n_block_functions,find_functions,find_functions_in_symtab):
New functions.
(expand_containing_psymtab): New function.
(cplusplus_hint): Removed.
* symtab.h: Enable BYTE_FIELD definition for HP C compiler.
(namespace_enum): Add VAR_OR_STRUCT_NAMESPACE entry.
(DESTRUCTOR_PREFIX_P): Recognize HP aCC destructors.
(how_to_resolve_multiple_symbols enum): Define.
(decode_line_1): Add resolve argument.
* minsyms.c (foreach_text_minsym): New function.
* language.c: Add case sensitivity support and set/show
case-sensitive command.
* language.h (case_mode,case_sensitivity): Define.
(language_defn struct): Add la_case_sensitivity field.
* c-lang.c,ch-lang.c,f-lang.c,jv-lang.c,m2-lang.c,scm-lang.c:
Add case sensitivity enum to language definition vector.
* breakpoint.c: Adjust decode_line_1() calls to include resolve
argument.
(break_at_finish_command): Check error return of decode_line_1
and call error().
(clear_command): Check error return of decode_line_spec and call
error().
* source.c,tracepoint.c: Adjust decode_line_1() calls to include
resolve argument.
* config/pa/tm-hppa.h (FAT_FREE_PSYMTABS): Define.
Index: gdb/symtab.c
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/symtab.c gdb/symtab.c
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/symtab.c Thu Nov 4 10:49:29 1999
--- gdb/symtab.c Thu Nov 11 11:20:51 1999
***************
*** 44,49 ****
--- 44,59 ----
#include "gdb_stat.h"
#include <ctype.h>
+ /* To support breakpoint menus for multiple defintions (overloaded or
+ file-static) functions */
+ #define MAX_NUMBER_OF_OVERLOADED_OR_STATIC_FUNCTION_DEFINITIONS 20
+
+ struct symtab_and_block
+ {
+ struct symtab *symtab;
+ int block_number;
+ };
+
/* Prototype for one function in parser-defs.h,
instead of including that entire file. */
***************
*** 53,66 ****
static int find_methods PARAMS ((struct type *, char *, struct symbol **));
static void completion_list_add_name PARAMS ((char *, char *, int, char *,
char *));
static void build_canonical_line_spec PARAMS ((struct symtab_and_line *,
char *, char ***));
! static struct symtabs_and_lines decode_line_2 PARAMS ((struct symbol *[],
! int, int, char ***));
static void rbreak_command PARAMS ((char *, int));
--- 63,88 ----
static int find_methods PARAMS ((struct type *, char *, struct symbol **));
+ static int
+ find_n_block_functions PARAMS ((struct block *, char *, namespace_enum,
+ int, struct symbol **, int));
+
+ static int
+ find_functions PARAMS ((char *, struct symbol **,
+ struct symtab_and_block *));
+
+ static int
+ find_functions_in_symtab PARAMS ((char *, struct symbol **,
+ struct symtab_and_block *, struct symtab *));
+
static void completion_list_add_name PARAMS ((char *, char *, int, char *,
char *));
static void build_canonical_line_spec PARAMS ((struct symtab_and_line *,
char *, char ***));
! static struct symtabs_and_lines
! decode_line_2 PARAMS ((struct symbol *[], int, int, char ***, struct symtab_and_block[], enum how_to_resolve_multiple_symbols));
static void rbreak_command PARAMS ((char *, int));
***************
*** 87,93 ****
static struct symtab *lookup_symtab_1 PARAMS ((char *));
! static void cplusplus_hint PARAMS ((char *));
static struct symbol *find_active_alias PARAMS ((struct symbol * sym,
CORE_ADDR addr));
--- 109,116 ----
static struct symtab *lookup_symtab_1 PARAMS ((char *));
! struct symbol *lookup_block_transparent_type
! PARAMS ((const struct block *, const char *));
static struct symbol *find_active_alias PARAMS ((struct symbol * sym,
CORE_ADDR addr));
***************
*** 129,148 ****
char *default_main = "main";
- /* While the C++ support is still in flux, issue a possibly helpful hint on
- using the new command completion feature on single quoted demangled C++
- symbols. Remove when loose ends are cleaned up. FIXME -fnf */
-
- static void
- cplusplus_hint (name)
- char *name;
- {
- while (*name == '\'')
- name++;
- printf_filtered ("Hint: try '%s<TAB> or '%s<ESC-?>\n", name, name);
- printf_filtered ("(Note leading single quote.)\n");
- }
-
/* Check for a symtab of a specific name; first in symtabs, then in
psymtabs. *If* there is no '/' in the name, a match after a '/'
in the symtab filename will also work. */
--- 152,157 ----
***************
*** 155,211 ****
register struct partial_symtab *ps;
register char *slash;
register struct objfile *objfile;
! got_symtab:
! /* First, search for an exact match */
! ALL_SYMTABS (objfile, s)
! if (STREQ (name, s->filename))
! return s;
! slash = strchr (name, '/');
! /* Now, search for a matching tail (only if name doesn't have any dirs) */
! if (!slash)
! ALL_SYMTABS (objfile, s)
! {
! char *p = s->filename;
! char *tail = strrchr (p, '/');
! if (tail)
! p = tail + 1;
! if (STREQ (p, name))
! return s;
! }
! /* Same search rules as above apply here, but now we look thru the
! psymtabs. */
! ps = lookup_partial_symtab (name);
! if (!ps)
! return (NULL);
!
! if (ps->readin)
! error ("Internal: readin %s pst for `%s' found when no symtab found.",
! ps->filename, name);
! s = PSYMTAB_TO_SYMTAB (ps);
! if (s)
! return s;
! /* At this point, we have located the psymtab for this file, but
! the conversion to a symtab has failed. This usually happens
! when we are looking up an include file. In this case,
! PSYMTAB_TO_SYMTAB doesn't return a symtab, even though one has
! been created. So, we need to run through the symtabs again in
! order to find the file.
! XXX - This is a crock, and should be fixed inside of the the
! symbol parsing routines. */
! goto got_symtab;
}
/* Lookup the symbol table of a source file named NAME. Try a couple
--- 164,224 ----
register struct partial_symtab *ps;
register char *slash;
register struct objfile *objfile;
+ int i;
! for (i = 0; i < 2; i++)
! {
! /* First, search for an exact match */
! ALL_SYMTABS (objfile, s)
! if (STREQ (name, s->filename))
! return s;
! slash = strchr (name, '/');
! /* Now, search for a matching tail (only if name doesn't have any dirs) */
! if (!slash)
! {
! ALL_SYMTABS (objfile, s)
! {
! char *p = s->filename;
! char *tail = strrchr (p, '/');
! if (tail)
! p = tail + 1;
! if (STREQ (p, name))
! return s;
! }
! }
! /* Same search rules as above apply here, but now we look thru the
! psymtabs. */
! ps = lookup_partial_symtab (name);
! if (!ps)
! return (NULL);
! if (ps->readin)
! error ("Internal: readin %s pst for `%s' found when no symtab found.",
! ps->filename, name);
! s = PSYMTAB_TO_SYMTAB (ps);
! if (s)
! return s;
! /* At this point, we have located the psymtab for this file, but
! the conversion to a symtab has failed. This usually happens
! when we are looking up an include file. In this case,
! PSYMTAB_TO_SYMTAB doesn't return a symtab, even though one has
! been created. So, we need to run through the symtabs again in
! order to find the file.
! XXX - This is a crock, and should be fixed inside of the the
! symbol parsing routines. */
! }
! return NULL;
}
/* Lookup the symbol table of a source file named NAME. Try a couple
***************
*** 216,246 ****
char *name;
{
register struct symtab *s;
- #if 0
- register char *copy;
- #endif
s = lookup_symtab_1 (name);
if (s)
return s;
- #if 0
- /* This screws c-exp.y:yylex if there is both a type "tree" and a symtab
- "tree.c". */
-
- /* If name not found as specified, see if adding ".c" helps. */
- /* Why is this? Is it just a user convenience? (If so, it's pretty
- questionable in the presence of C++, FORTRAN, etc.). It's not in
- the GDB manual. */
-
- copy = (char *) alloca (strlen (name) + 3);
- strcpy (copy, name);
- strcat (copy, ".c");
- s = lookup_symtab_1 (copy);
- if (s)
- return s;
- #endif /* 0 */
-
/* We didn't find anything; die. */
return 0;
}
--- 229,239 ----
***************
*** 255,260 ****
--- 248,254 ----
{
register struct partial_symtab *pst;
register struct objfile *objfile;
+ char *basename, *tail, *p;
ALL_PSYMTABS (objfile, pst)
{
***************
*** 279,284 ****
--- 273,310 ----
return (pst);
}
+ /* RM: DOOM on 10.20 causes psymtabs to have filenames without
+ extensions. Try these too */
+ basename = alloca (strlen (name) + 1);
+ strcpy (basename, name);
+ p = strrchr (basename, '.');
+ if (p)
+ {
+ *p = 0;
+
+ ALL_PSYMTABS (objfile, pst)
+ {
+ if (STREQ (basename, pst->filename))
+ {
+ return (pst);
+ }
+ }
+
+ /* Now, search for a matching tail (only if name doesn't have any dirs) */
+ if (!strchr (basename, '/'))
+ ALL_PSYMTABS (objfile, pst)
+ {
+ p = pst->filename;
+ tail = strrchr (p, '/');
+
+ if (tail)
+ p = tail + 1;
+
+ if (STREQ (p, basename))
+ return (pst);
+ }
+ }
+
return (NULL);
}
***************
*** 422,427 ****
--- 448,477 ----
struct partial_symbol *p;
p = find_pc_sect_psymbol (tpst, pc, section);
+
+ #ifdef FAT_FREE_PSYMTABS
+
+ /* srikanth, in the case of the Wildebeest, the psymtabs could be empty
+ and hence the call to find_pc_sect_psymbol() could fail to find anything.
+ Due potentially to a combination of bugs in compilers, linkers, loaders,
+ editors and debugger engineers :-), sometimes there is an overlap of
+ textlow and texthigh values between and multiple psymtabs. As a result,
+ if we are handed an address equal to the texthigh or textlow, we could
+ end up identifying the wrong psymtab.
+
+ To be absolutely sure of the identity of the psymtab, let us verify that
+ the one we narrow down on, also houses pc + 4.
+ */
+
+ if (p == NULL)
+ {
+ CORE_ADDR pc_plus4 = pc + 4;
+ if (pc_plus4 >= tpst->textlow &&
+ pc_plus4 <= tpst->texthigh)
+ return tpst;
+ }
+ #endif
+
if (p != NULL
&& SYMBOL_VALUE_ADDRESS (p)
== SYMBOL_VALUE_ADDRESS (msymbol))
***************
*** 473,480 ****
pp++)
{
p = *pp;
! if (SYMBOL_NAMESPACE (p) == VAR_NAMESPACE
! && SYMBOL_CLASS (p) == LOC_BLOCK
&& pc >= SYMBOL_VALUE_ADDRESS (p)
&& (SYMBOL_VALUE_ADDRESS (p) > best_pc
|| (psymtab->textlow == 0
--- 523,531 ----
pp++)
{
p = *pp;
! /* No problemo, fuzzy namespace & LOC_BLOCK don't go together */
! if (PSYMBOL_NAMESPACE (p) == VAR_NAMESPACE
! && PSYMBOL_CLASS (p) == LOC_BLOCK
&& pc >= SYMBOL_VALUE_ADDRESS (p)
&& (SYMBOL_VALUE_ADDRESS (p) > best_pc
|| (psymtab->textlow == 0
***************
*** 497,504 ****
pp++)
{
p = *pp;
! if (SYMBOL_NAMESPACE (p) == VAR_NAMESPACE
! && SYMBOL_CLASS (p) == LOC_BLOCK
&& pc >= SYMBOL_VALUE_ADDRESS (p)
&& (SYMBOL_VALUE_ADDRESS (p) > best_pc
|| (psymtab->textlow == 0
--- 548,556 ----
pp++)
{
p = *pp;
! /* No problemo, fuzzy namespace & LOC_BLOCK don't go together */
! if (PSYMBOL_NAMESPACE (p) == VAR_NAMESPACE
! && PSYMBOL_CLASS (p) == LOC_BLOCK
&& pc >= SYMBOL_VALUE_ADDRESS (p)
&& (SYMBOL_VALUE_ADDRESS (p) > best_pc
|| (psymtab->textlow == 0
***************
*** 609,623 ****
register struct symtab *s = NULL;
register struct partial_symtab *ps;
struct blockvector *bv;
! register struct objfile *objfile = NULL;
register struct block *b;
register struct minimal_symbol *msymbol;
/* Search specified block and its superiors. */
while (block != 0)
{
! sym = lookup_block_symbol (block, name, namespace);
if (sym)
{
block_found = block;
--- 661,694 ----
register struct symtab *s = NULL;
register struct partial_symtab *ps;
struct blockvector *bv;
! register struct objfile *objfile = NULL, *objfile2 = NULL;
register struct block *b;
register struct minimal_symbol *msymbol;
+ int do_internal_error_at_end = 0;
+ char *internal_error_str1 = NULL;
+ char *internal_error_str2 = NULL;
+
+ extern enum case_sensitivity_type case_sensitivity;
+ char *copy;
+ int copy_name_len, i;
+
+ copy_name_len = strlen (name);
+ copy = (char *) xmalloc (copy_name_len + 1);
+ if (case_sensitivity == case_sensitive_on)
+ strcpy (copy, name);
+ else
+ {
+ for (i = 0; i < copy_name_len; i++)
+ copy[i] = tolower (name[i]);
+ copy[i] = 0;
+ }
+
/* Search specified block and its superiors. */
while (block != 0)
{
! sym = lookup_block_symbol (block, copy, namespace);
if (sym)
{
block_found = block;
***************
*** 670,676 ****
if (BLOCK_START (b) <= BLOCK_START (block)
&& BLOCK_END (b) > BLOCK_START (block))
{
! sym = lookup_block_symbol (b, name, VAR_NAMESPACE);
if (sym)
{
block_found = b;
--- 741,747 ----
if (BLOCK_START (b) <= BLOCK_START (block)
&& BLOCK_END (b) > BLOCK_START (block))
{
! sym = lookup_block_symbol (b, copy, VAR_NAMESPACE);
if (sym)
{
block_found = b;
***************
*** 690,696 ****
struct value *v = value_of_this (0);
*is_a_field_of_this = 0;
! if (v && check_field (v, name))
{
*is_a_field_of_this = 1;
if (symtab != NULL)
--- 761,767 ----
struct value *v = value_of_this (0);
*is_a_field_of_this = 0;
! if (v && check_field (v, copy))
{
*is_a_field_of_this = 1;
if (symtab != NULL)
***************
*** 708,714 ****
{
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
! sym = lookup_block_symbol (block, name, namespace);
if (sym)
{
block_found = block;
--- 779,785 ----
{
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
! sym = lookup_block_symbol (block, copy, namespace);
if (sym)
{
block_found = block;
***************
*** 726,732 ****
if (namespace == VAR_NAMESPACE)
{
! msymbol = lookup_minimal_symbol (name, NULL, NULL);
if (msymbol != NULL)
{
s = find_pc_sect_symtab (SYMBOL_VALUE_ADDRESS (msymbol),
--- 797,803 ----
if (namespace == VAR_NAMESPACE)
{
! msymbol = lookup_minimal_symbol (copy, NULL, NULL);
if (msymbol != NULL)
{
s = find_pc_sect_symtab (SYMBOL_VALUE_ADDRESS (msymbol),
***************
*** 766,772 ****
}
else if (MSYMBOL_TYPE (msymbol) != mst_text
&& MSYMBOL_TYPE (msymbol) != mst_file_text
! && !STREQ (name, SYMBOL_NAME (msymbol)))
{
/* This is a mangled variable, look it up by its
mangled name. */
--- 837,843 ----
}
else if (MSYMBOL_TYPE (msymbol) != mst_text
&& MSYMBOL_TYPE (msymbol) != mst_file_text
! && !STREQ (copy, SYMBOL_NAME (msymbol)))
{
/* This is a mangled variable, look it up by its
mangled name. */
***************
*** 783,794 ****
ALL_PSYMTABS (objfile, ps)
{
! if (!ps->readin && lookup_partial_symbol (ps, name, 1, namespace))
{
s = PSYMTAB_TO_SYMTAB (ps);
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
! sym = lookup_block_symbol (block, name, namespace);
if (!sym)
{
/* This shouldn't be necessary, but as a last resort
--- 854,865 ----
ALL_PSYMTABS (objfile, ps)
{
! if (!ps->readin && lookup_partial_symbol (ps, copy, 1, namespace))
{
s = PSYMTAB_TO_SYMTAB (ps);
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
! sym = lookup_block_symbol (block, copy, namespace);
if (!sym)
{
/* This shouldn't be necessary, but as a last resort
***************
*** 797,808 ****
* the psymtab gets it wrong in some cases.
*/
block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
! sym = lookup_block_symbol (block, name, namespace);
if (!sym)
! error ("Internal: global symbol `%s' found in %s psymtab but not in symtab.\n\
! %s may be an inlined function, or may be a template function\n\
! (if a template, try specifying an instantiation: %s<type>).",
! name, ps->filename, name, name);
}
if (symtab != NULL)
*symtab = s;
--- 868,909 ----
* the psymtab gets it wrong in some cases.
*/
block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
! sym = lookup_block_symbol (block, copy, namespace);
if (!sym)
! if (ps->symtab == NULL)
! {
! /* CM: This means that the symtab could not be created for
! some reason. Instead of dying, just continue with the
! search */
! continue;
! }
! else
! {
! /* CM: Look through all of the symtabs again just in case
! expanding out this psymtab introduced additional entries
! in other symtabs. This can happen in HP's version of
! template instantiation (CTTI). */
! ALL_SYMTABS (objfile2, s)
! {
! bv = BLOCKVECTOR (s);
! block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
! sym = lookup_block_symbol (block, copy, namespace);
! if (sym)
! {
! block_found = block;
! if (symtab != NULL)
! *symtab = s;
! return fixup_symbol_section (sym, objfile2);
! }
! }
! /* CM: Check other psymtabs just in case this is defined
! elsewhere. Give an error at the end of this function if
! a match was not found. */
! do_internal_error_at_end = 1;
! internal_error_str1 = "global";
! internal_error_str2 = ps->filename;
! continue;
! }
}
if (symtab != NULL)
*symtab = s;
***************
*** 821,827 ****
{
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
! sym = lookup_block_symbol (block, name, namespace);
if (sym)
{
block_found = block;
--- 922,928 ----
{
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
! sym = lookup_block_symbol (block, copy, namespace);
if (sym)
{
block_found = block;
***************
*** 833,844 ****
ALL_PSYMTABS (objfile, ps)
{
! if (!ps->readin && lookup_partial_symbol (ps, name, 0, namespace))
{
s = PSYMTAB_TO_SYMTAB (ps);
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
! sym = lookup_block_symbol (block, name, namespace);
if (!sym)
{
/* This shouldn't be necessary, but as a last resort
--- 934,945 ----
ALL_PSYMTABS (objfile, ps)
{
! if (!ps->readin && lookup_partial_symbol (ps, copy, 0, namespace))
{
s = PSYMTAB_TO_SYMTAB (ps);
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
! sym = lookup_block_symbol (block, copy, namespace);
if (!sym)
{
/* This shouldn't be necessary, but as a last resort
***************
*** 847,858 ****
* the psymtab gets it wrong in some cases.
*/
block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
! sym = lookup_block_symbol (block, name, namespace);
if (!sym)
! error ("Internal: static symbol `%s' found in %s psymtab but not in symtab.\n\
! %s may be an inlined function, or may be a template function\n\
! (if a template, try specifying an instantiation: %s<type>).",
! name, ps->filename, name, name);
}
if (symtab != NULL)
*symtab = s;
--- 948,989 ----
* the psymtab gets it wrong in some cases.
*/
block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
! sym = lookup_block_symbol (block, copy, namespace);
if (!sym)
! if (ps->symtab == NULL)
! {
! /* CM: This means that the symtab could not be created for
! some reason. Instead of dying, just continue with the
! search */
! continue;
! }
! else
! {
! /* CM: Look through all of the symtabs again just in case
! expanding out this psymtab introduced additional entries
! in other symtabs. This can happen in HP's version of
! template instantiation (CTTI). */
! ALL_SYMTABS (objfile2, s)
! {
! bv = BLOCKVECTOR (s);
! block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
! sym = lookup_block_symbol (block, copy, namespace);
! if (sym)
! {
! block_found = block;
! if (symtab != NULL)
! *symtab = s;
! return fixup_symbol_section (sym, objfile2);
! }
! }
! /* CM: Check other psymtabs just in case this is defined
! elsewhere. Give an error at the end of this function if
! a match was not found. */
! do_internal_error_at_end = 1;
! internal_error_str1 = "static";
! internal_error_str2 = ps->filename;
! continue;
! }
}
if (symtab != NULL)
*symtab = s;
***************
*** 879,885 ****
if (namespace == VAR_NAMESPACE)
{
! msymbol = lookup_minimal_symbol (name, NULL, NULL);
if (msymbol != NULL)
{
/* OK, we found a minimal symbol in spite of not
--- 1010,1016 ----
if (namespace == VAR_NAMESPACE)
{
! msymbol = lookup_minimal_symbol (copy, NULL, NULL);
if (msymbol != NULL)
{
/* OK, we found a minimal symbol in spite of not
***************
*** 946,952 ****
*/
else if (MSYMBOL_TYPE (msymbol) != mst_text
&& MSYMBOL_TYPE (msymbol) != mst_file_text
! && !STREQ (name, SYMBOL_NAME (msymbol)))
{
return lookup_symbol (SYMBOL_NAME (msymbol), block,
namespace, is_a_field_of_this, symtab);
--- 1077,1083 ----
*/
else if (MSYMBOL_TYPE (msymbol) != mst_text
&& MSYMBOL_TYPE (msymbol) != mst_file_text
! && !STREQ (copy, SYMBOL_NAME (msymbol)))
{
return lookup_symbol (SYMBOL_NAME (msymbol), block,
namespace, is_a_field_of_this, symtab);
***************
*** 956,961 ****
--- 1087,1098 ----
#endif
+
+ if (do_internal_error_at_end)
+ {
+ error ("Internal: %s symbol `%s' found in %s psymtab but not in symtab.\n%s may be an inlined function, or may be a template function\n(if a template, try specifying an instantiation: %s<type>).", internal_error_str1, name, internal_error_str2, name, name);
+ }
+
if (symtab != NULL)
*symtab = NULL;
return 0;
***************
*** 987,994 ****
if (global) /* This means we can use a binary search. */
{
- do_linear_search = 0;
-
/* Binary search. This search is guaranteed to end with center
pointing at the earliest partial symbol with the correct
name. At that point *all* partial symbols with that name
--- 1124,1129 ----
***************
*** 996,1001 ****
--- 1131,1142 ----
bottom = start;
top = start + length - 1;
+
+ do_linear_search = (top == bottom &&
+ (SYMBOL_LANGUAGE (*top) == language_cplus ||
+ SYMBOL_LANGUAGE (*top) == language_fortran ||
+ SYMBOL_LANGUAGE (*top) == language_java)) ? 1 : 0;
+
while (top > bottom)
{
center = bottom + (top - bottom) / 2;
***************
*** 1003,1008 ****
--- 1144,1150 ----
abort ();
if (!do_linear_search
&& (SYMBOL_LANGUAGE (*center) == language_cplus
+ || SYMBOL_LANGUAGE (*center) == language_fortran
|| SYMBOL_LANGUAGE (*center) == language_java
))
{
***************
*** 1021,1027 ****
abort ();
while (STREQ (SYMBOL_NAME (*top), name))
{
! if (SYMBOL_NAMESPACE (*top) == namespace)
{
return (*top);
}
--- 1163,1177 ----
abort ();
while (STREQ (SYMBOL_NAME (*top), name))
{
! /* do a fuzzy match */
! namespace_enum nm = PSYMBOL_NAMESPACE (*top);
! if ((nm == VAR_OR_STRUCT_NAMESPACE) &&
! (namespace == STRUCT_NAMESPACE ||
! namespace == VAR_NAMESPACE))
! {
! return (*top);
! }
! if (PSYMBOL_NAMESPACE (*top) == namespace)
{
return (*top);
}
***************
*** 1036,1042 ****
{
for (psym = start; psym < start + length; psym++)
{
! if (namespace == SYMBOL_NAMESPACE (*psym))
{
if (SYMBOL_MATCHES_NAME (*psym, name))
{
--- 1186,1195 ----
{
for (psym = start; psym < start + length; psym++)
{
! if ((namespace == PSYMBOL_NAMESPACE (*psym)) ||
! (PSYMBOL_NAMESPACE (*psym) == VAR_OR_STRUCT_NAMESPACE &&
! (namespace == STRUCT_NAMESPACE ||
! namespace == VAR_NAMESPACE)))
{
if (SYMBOL_MATCHES_NAME (*psym, name))
{
***************
*** 1056,1061 ****
--- 1209,1218 ----
up types were just left out. In particular it's assumed here that types
are available in struct_namespace and only at file-static or global blocks. */
+ /* RM: With HP's DOOM, it is possible that the same block has both a
+ * complete and an opaque version of a type. Fixed this routine to
+ * handle this
+ */
struct type *
lookup_transparent_type (name)
***************
*** 1065,1071 ****
register struct symtab *s = NULL;
register struct partial_symtab *ps;
struct blockvector *bv;
! register struct objfile *objfile;
register struct block *block;
/* Now search all the global symbols. Do the symtab's first, then
--- 1222,1228 ----
register struct symtab *s = NULL;
register struct partial_symtab *ps;
struct blockvector *bv;
! register struct objfile *objfile, *objfile2;
register struct block *block;
/* Now search all the global symbols. Do the symtab's first, then
***************
*** 1077,1083 ****
{
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
! sym = lookup_block_symbol (block, name, STRUCT_NAMESPACE);
if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
{
return SYMBOL_TYPE (sym);
--- 1234,1240 ----
{
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
! sym = lookup_block_transparent_type (block, name);
if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
{
return SYMBOL_TYPE (sym);
***************
*** 1091,1097 ****
s = PSYMTAB_TO_SYMTAB (ps);
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
! sym = lookup_block_symbol (block, name, STRUCT_NAMESPACE);
if (!sym)
{
/* This shouldn't be necessary, but as a last resort
--- 1248,1254 ----
s = PSYMTAB_TO_SYMTAB (ps);
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
! sym = lookup_block_transparent_type (block, name);
if (!sym)
{
/* This shouldn't be necessary, but as a last resort
***************
*** 1100,1111 ****
* the psymtab gets it wrong in some cases.
*/
block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
! sym = lookup_block_symbol (block, name, STRUCT_NAMESPACE);
if (!sym)
! error ("Internal: global symbol `%s' found in %s psymtab but not in symtab.\n\
! %s may be an inlined function, or may be a template function\n\
! (if a template, try specifying an instantiation: %s<type>).",
! name, ps->filename, name, name);
}
if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
return SYMBOL_TYPE (sym);
--- 1257,1291 ----
* the psymtab gets it wrong in some cases.
*/
block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
! sym = lookup_block_transparent_type (block, name);
if (!sym)
! if (ps->symtab == NULL)
! {
! /* CM: This means that the symtab could not be created for
! some reason. Instead of dying, just continue with the
! search */
! continue;
! }
! else
! {
! /* CM: Look through all of the symtabs again just in case
! expanding out this psymtab introduced additional entries
! in other symtabs. This can happen in HP's version of
! template instantiation (CTTI). */
! ALL_SYMTABS (objfile2, s)
! {
! bv = BLOCKVECTOR (s);
! block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
! sym = lookup_block_transparent_type (block, name);
! if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
! {
! return SYMBOL_TYPE (sym);
! }
! }
! /* CM: Check other psymtabs just in case this is defined
! elsewhere. */
! continue;
! }
}
if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
return SYMBOL_TYPE (sym);
***************
*** 1124,1130 ****
{
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
! sym = lookup_block_symbol (block, name, STRUCT_NAMESPACE);
if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
{
return SYMBOL_TYPE (sym);
--- 1304,1310 ----
{
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
! sym = lookup_block_transparent_type (block, name);
if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
{
return SYMBOL_TYPE (sym);
***************
*** 1138,1144 ****
s = PSYMTAB_TO_SYMTAB (ps);
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
! sym = lookup_block_symbol (block, name, STRUCT_NAMESPACE);
if (!sym)
{
/* This shouldn't be necessary, but as a last resort
--- 1318,1324 ----
s = PSYMTAB_TO_SYMTAB (ps);
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
! sym = lookup_block_transparent_type (block, name);
if (!sym)
{
/* This shouldn't be necessary, but as a last resort
***************
*** 1147,1163 ****
* the psymtab gets it wrong in some cases.
*/
block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
! sym = lookup_block_symbol (block, name, STRUCT_NAMESPACE);
if (!sym)
! error ("Internal: static symbol `%s' found in %s psymtab but not in symtab.\n\
! %s may be an inlined function, or may be a template function\n\
! (if a template, try specifying an instantiation: %s<type>).",
! name, ps->filename, name, name);
}
if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
return SYMBOL_TYPE (sym);
}
}
return (struct type *) 0;
}
--- 1327,1372 ----
* the psymtab gets it wrong in some cases.
*/
block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
! sym = lookup_block_transparent_type (block, name);
if (!sym)
! if (ps->symtab == NULL)
! {
! /* CM: This means that the symtab could not be created for
! some reason. Instead of dying, just continue with the
! search */
! continue;
! }
! else
! {
! /* CM: Look through all of the symtabs again just in case
! expanding out this psymtab introduced additional entries
! in other symtabs. This can happen in HP's version of
! template instantiation (CTTI). */
! ALL_SYMTABS (objfile2, s)
! {
! bv = BLOCKVECTOR (s);
! block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
! sym = lookup_block_transparent_type (block, name);
! if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
! {
! return SYMBOL_TYPE (sym);
! }
! }
! /* CM: Check other psymtabs just in case this is defined
! elsewhere. */
! continue;
! }
}
if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
return SYMBOL_TYPE (sym);
}
}
+
+ /* RM: We _don't_ want to give error just because we found a type in a
+ psymtab, and didn't find the corresponding _transparent_ type in the
+ symtab (or any of the symtabs). It doesn't mean that we are in error:
+ the transparent type might be in a file without debug information. */
+
return (struct type *) 0;
}
***************
*** 1171,1176 ****
--- 1380,1386 ----
{
register struct partial_symtab *pst;
register struct objfile *objfile;
+ struct minimal_symbol *m;
ALL_PSYMTABS (objfile, pst)
{
***************
*** 1179,1184 ****
--- 1389,1408 ----
return (pst);
}
}
+
+ #ifdef FAT_FREE_PSYMTABS
+
+ /* srikanth, under the new world order, psymtabs could be empty
+ for the Wildebeest. Fall back on the linker symbol table, use the
+ address therefrom to find out which psymtab would have housed the
+ psymbol were one to exist.
+ */
+
+ if ((m = lookup_minimal_symbol_text (default_main, NULL, NULL)))
+ return find_pc_psymtab (SYMBOL_VALUE_ADDRESS (m));
+
+ #endif
+
return (NULL);
}
***************
*** 1232,1237 ****
--- 1456,1462 ----
sym = BLOCK_SYM (block, inc);
if (!do_linear_search
&& (SYMBOL_LANGUAGE (sym) == language_cplus
+ || SYMBOL_LANGUAGE (sym) == language_fortran
|| SYMBOL_LANGUAGE (sym) == language_java
))
{
***************
*** 1379,1384 ****
--- 1604,1739 ----
/* Nothing found, return the main symbol. */
return sym;
}
+
+ /* RM: Just like lookup_block_symbol, but looks for a transparent type
+ * -- i.e. opaque types don't make the cut for lookup.
+ */
+ struct symbol *
+ lookup_block_transparent_type (block, name)
+ register const struct block *block;
+ const char *name;
+ {
+ register int bot, top, inc;
+ register struct symbol *sym;
+ register struct symbol *sym_found = NULL;
+ register int do_linear_search = 1;
+
+ /* If the blocks's symbols were sorted, start with a binary search. */
+
+ if (BLOCK_SHOULD_SORT (block))
+ {
+ /* Reset the linear search flag so if the binary search fails, we
+ won't do the linear search once unless we find some reason to
+ do so, such as finding a C++ symbol during the binary search.
+ Note that for C++ modules, ALL the symbols in a block should
+ end up marked as C++ symbols. */
+
+ do_linear_search = 0;
+ top = BLOCK_NSYMS (block);
+ bot = 0;
+
+ /* Advance BOT to not far before the first symbol whose name is NAME. */
+
+ while (1)
+ {
+ inc = (top - bot + 1);
+ /* No need to keep binary searching for the last few bits worth. */
+ if (inc < 4)
+ {
+ break;
+ }
+ inc = (inc >> 1) + bot;
+ sym = BLOCK_SYM (block, inc);
+ if (!do_linear_search &&
+ (SYMBOL_LANGUAGE (sym) == language_cplus
+ || SYMBOL_LANGUAGE (sym) == language_fortran
+ || SYMBOL_LANGUAGE (sym) == language_java
+ ))
+ {
+ do_linear_search = 1;
+ }
+ if (SYMBOL_NAME (sym)[0] < name[0])
+ {
+ bot = inc;
+ }
+ else if (SYMBOL_NAME (sym)[0] > name[0])
+ {
+ top = inc;
+ }
+ else if (STRCMP (SYMBOL_NAME (sym), name) < 0)
+ {
+ bot = inc;
+ }
+ else
+ {
+ top = inc;
+ }
+ }
+
+ /* Now scan forward until we run out of symbols, find one whose
+ * name is greater than NAME, or find one we want.
+ */
+ /* RM: but first scan backwards, since we may be pointing to a
+ * section of symbols with the same name but different namespace
+ */
+ while (bot > 0)
+ {
+ sym = BLOCK_SYM (block, bot - 1);
+ inc = SYMBOL_NAME (sym)[0] - name[0];
+ if (inc == 0)
+ inc = STRCMP (SYMBOL_NAME (sym), name);
+ if (inc == 0)
+ bot--;
+ else
+ break;
+ }
+
+ top = BLOCK_NSYMS (block);
+ while (bot < top)
+ {
+ sym = BLOCK_SYM (block, bot);
+ inc = SYMBOL_NAME (sym)[0] - name[0];
+ if (inc == 0)
+ {
+ inc = STRCMP (SYMBOL_NAME (sym), name);
+ }
+ if ((inc == 0) && (SYMBOL_NAMESPACE (sym) == STRUCT_NAMESPACE) &&
+ (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym))))
+ {
+ return (sym);
+ }
+ if (inc > 0)
+ {
+ break;
+ }
+ bot++;
+ }
+ }
+
+ /* Here if block isn't sorted, or we fail to find a match during the
+ binary search above. If during the binary search above, we find a
+ symbol which is a C++ symbol, then we have re-enabled the linear
+ search flag which was reset when starting the binary search.
+ */
+ if (do_linear_search)
+ {
+ top = BLOCK_NSYMS (block);
+ bot = 0;
+ while (bot < top)
+ {
+ sym = BLOCK_SYM (block, bot);
+ if ((SYMBOL_NAMESPACE (sym) == STRUCT_NAMESPACE) &&
+ (SYMBOL_MATCHES_NAME (sym, name)) &&
+ (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym))))
+ {
+ sym_found = sym;
+ break;
+ }
+ bot++;
+ }
+ }
+ return (sym_found); /* Will be NULL if not found. */
+ }
/* Return the symbol for the function which contains a specified
***************
*** 1410,1415 ****
--- 1765,1780 ----
register struct objfile *objfile;
CORE_ADDR distance = 0;
+ /* srikanth, 990325, beat it quick if pc == 0 as no program object can be
+ at this address. Currently we attempt to search for the psymbtab that
+ contains address 0 and as it happens the psymtab for the psuedo-file
+ `globals' has its textlow and texthigh set to zero causing the entire
+ global symbol table to be read in. This takes forever ... (yawn)
+ */
+
+ if (pc == 0)
+ return NULL;
+
/* Search all symtabs for the one whose file contains our address, and which
is the smallest of all the ones containing the address. This is designed
to deal with a case like symtab a is at 0x1000-0x2000 and 0x3000-0x4000
***************
*** 1476,1485 ****
/* Might want to error() here (in case symtab is corrupt and
will cause a core dump), but maybe we can successfully
continue, so let's not. */
- /* FIXME-32x64: assumes pc fits in a long */
warning ("\
! (Internal error: pc 0x%lx in read in psymtab, but not in symtab.)\n",
! (unsigned long) pc);
s = PSYMTAB_TO_SYMTAB (ps);
}
return (s);
--- 1841,1849 ----
/* Might want to error() here (in case symtab is corrupt and
will cause a core dump), but maybe we can successfully
continue, so let's not. */
warning ("\
! (Internal error: pc %s in read in psymtab, but not in symtab.)\n",
! longest_local_hex_string ((LONGEST) pc));
s = PSYMTAB_TO_SYMTAB (ps);
}
return (s);
***************
*** 1492,1593 ****
find_pc_symtab (pc)
CORE_ADDR pc;
{
- return find_pc_sect_symtab (pc, find_pc_mapped_section (pc));
- }
-
-
- #if 0
-
- /* Find the closest symbol value (of any sort -- function or variable)
- for a given address value. Slow but complete. (currently unused,
- mainly because it is too slow. We could fix it if each symtab and
- psymtab had contained in it the addresses ranges of each of its
- sections, which also would be required to make things like "info
- line *0x2345" cause psymtabs to be converted to symtabs). */
-
- struct symbol *
- find_addr_symbol (addr, symtabp, symaddrp)
- CORE_ADDR addr;
- struct symtab **symtabp;
- CORE_ADDR *symaddrp;
- {
- struct symtab *symtab, *best_symtab;
- struct objfile *objfile;
- register int bot, top;
- register struct symbol *sym;
- register CORE_ADDR sym_addr;
- struct block *block;
- int blocknum;
-
- /* Info on best symbol seen so far */
-
- register CORE_ADDR best_sym_addr = 0;
- struct symbol *best_sym = 0;
-
- /* FIXME -- we should pull in all the psymtabs, too! */
- ALL_SYMTABS (objfile, symtab)
- {
- /* Search the global and static blocks in this symtab for
- the closest symbol-address to the desired address. */
-
- for (blocknum = GLOBAL_BLOCK; blocknum <= STATIC_BLOCK; blocknum++)
- {
- QUIT;
- block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), blocknum);
- top = BLOCK_NSYMS (block);
- for (bot = 0; bot < top; bot++)
- {
- sym = BLOCK_SYM (block, bot);
- switch (SYMBOL_CLASS (sym))
- {
- case LOC_STATIC:
- case LOC_LABEL:
- sym_addr = SYMBOL_VALUE_ADDRESS (sym);
- break;
! case LOC_INDIRECT:
! sym_addr = SYMBOL_VALUE_ADDRESS (sym);
! /* An indirect symbol really lives at *sym_addr,
! * so an indirection needs to be done.
! * However, I am leaving this commented out because it's
! * expensive, and it's possible that symbolization
! * could be done without an active process (in
! * case this read_memory will fail). RT
! sym_addr = read_memory_unsigned_integer
! (sym_addr, TARGET_PTR_BIT / TARGET_CHAR_BIT);
! */
! break;
!
! case LOC_BLOCK:
! sym_addr = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
! break;
!
! default:
! continue;
! }
!
! if (sym_addr <= addr)
! if (sym_addr > best_sym_addr)
! {
! /* Quit if we found an exact match. */
! best_sym = sym;
! best_sym_addr = sym_addr;
! best_symtab = symtab;
! if (sym_addr == addr)
! goto done;
! }
! }
! }
! }
! done:
! if (symtabp)
! *symtabp = best_symtab;
! if (symaddrp)
! *symaddrp = best_sym_addr;
! return best_sym;
}
! #endif /* 0 */
/* Find the source file and line number for a given PC value and section.
Return a structure containing a symtab pointer, a line number,
--- 1856,1870 ----
find_pc_symtab (pc)
CORE_ADDR pc;
{
! if (pc == 0)
! {
! return NULL;
! }
! return find_pc_sect_symtab (pc, find_pc_mapped_section (pc));
}
!
/* Find the source file and line number for a given PC value and section.
Return a structure containing a symtab pointer, a line number,
***************
*** 1621,1626 ****
--- 1898,1904 ----
struct blockvector *bv;
struct minimal_symbol *msymbol;
struct minimal_symbol *mfunsym;
+ struct symbol *func;
/* Info on best line seen so far, and where it starts, and its file. */
***************
*** 1825,1830 ****
--- 2103,2123 ----
val.end = alt->pc;
else
val.end = BLOCK_END (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK));
+ /* RM: If the function enclosing val.pc ends before pc, then the
+ * line number was probably bogus -- this can happen if the function
+ * enclosing pc has no line number information, as is the case
+ * for compiler generated functions (constructors, for example). The
+ * line number we get back is the last line number of the preceding
+ * function in the text space, which is obviously incorrect.
+ */
+ func = find_pc_function (val.pc);
+ if (func &&
+ (BLOCK_END (SYMBOL_BLOCK_VALUE (func)) < pc))
+ {
+ val.line = 0;
+ val.pc = 0;
+ val.symtab = 0;
+ }
}
val.section = section;
return val;
***************
*** 1895,1900 ****
--- 2188,2197 ----
struct objfile *objfile;
struct symtab *s;
+ struct partial_symtab *ps;
+ struct linetable *l;
+ int ind;
+
if (best_index >= 0)
best = best_linetable->item[best_index].line;
***************
*** 1903,1911 ****
ALL_SYMTABS (objfile, s)
{
- struct linetable *l;
- int ind;
-
if (!STREQ (symtab->filename, s->filename))
continue;
l = LINETABLE (s);
--- 2200,2205 ----
***************
*** 1928,1933 ****
--- 2222,2264 ----
}
}
}
+
+ /* Try the psymtabs if we haven't found it */
+ ALL_PSYMTABS (objfile, ps)
+ {
+ if (!STREQ (symtab->filename, ps->filename))
+ continue;
+ if (ps->readin)
+ continue;
+ s = PSYMTAB_TO_SYMTAB (ps);
+
+ /* guo: (related to lookup_symtab_1() comments)
+ gdb core dumps w/ list.exp 'list list0.h:1' on Linux, at
+ the following 'l = LINETABLE (s)' statement.
+ Need to short-circuit this if psymtab_to_symtab returns NULL. */
+ if (!s)
+ break;
+
+ l = LINETABLE (s);
+ ind = find_line_common (l, line, &exact);
+ if (ind >= 0)
+ {
+ if (exact)
+ {
+ best_index = ind;
+ best_linetable = l;
+ best_symtab = s;
+ goto done;
+ }
+ if (best == 0 || l->item[ind].line < best)
+ {
+ best = l->item[ind].line;
+ best_index = ind;
+ best_linetable = l;
+ best_symtab = s;
+ }
+ }
+ }
}
done:
if (best_index < 0)
***************
*** 2233,2364 ****
return 0;
count = TYPE_NFN_FIELDS_TOTAL (type);
! for (n = 0; n < TYPE_N_BASECLASSES (type); n++)
! count += total_number_of_methods (TYPE_BASECLASS (type, n));
! return count;
}
! /* Recursive helper function for decode_line_1.
! Look for methods named NAME in type T.
Return number of matches.
Put matches in SYM_ARR, which should have been allocated with
! a size of total_number_of_methods (T) * sizeof (struct symbol *).
! Note that this function is g++ specific. */
! static int
! find_methods (t, name, sym_arr)
! struct type *t;
char *name;
struct symbol **sym_arr;
{
int i1 = 0;
! int ibase;
! struct symbol *sym_class;
! char *class_name = type_name_no_tag (t);
!
! /* Ignore this class if it doesn't have a name. This is ugly, but
! unless we figure out how to get the physname without the name of
! the class, then the loop can't do any good. */
! if (class_name
! && (sym_class = lookup_symbol (class_name,
! (struct block *) NULL,
! STRUCT_NAMESPACE,
! (int *) NULL,
! (struct symtab **) NULL)))
! {
! int method_counter;
!
! /* FIXME: Shouldn't this just be CHECK_TYPEDEF (t)? */
! t = SYMBOL_TYPE (sym_class);
! /* Loop over each method name. At this level, all overloads of a name
! are counted as a single name. There is an inner loop which loops over
! each overload. */
! for (method_counter = TYPE_NFN_FIELDS (t) - 1;
! method_counter >= 0;
! --method_counter)
! {
! int field_counter;
! char *method_name = TYPE_FN_FIELDLIST_NAME (t, method_counter);
! char dem_opname[64];
! if (strncmp (method_name, "__", 2) == 0 ||
! strncmp (method_name, "op", 2) == 0 ||
! strncmp (method_name, "type", 4) == 0)
{
! if (cplus_demangle_opname (method_name, dem_opname, DMGL_ANSI))
! method_name = dem_opname;
! else if (cplus_demangle_opname (method_name, dem_opname, 0))
! method_name = dem_opname;
}
-
- if (STREQ (name, method_name))
- /* Find all the overloaded methods with that name. */
- for (field_counter = TYPE_FN_FIELDLIST_LENGTH (t, method_counter) - 1;
- field_counter >= 0;
- --field_counter)
- {
- struct fn_field *f;
- char *phys_name;
-
- f = TYPE_FN_FIELDLIST1 (t, method_counter);
-
- if (TYPE_FN_FIELD_STUB (f, field_counter))
- {
- char *tmp_name;
-
- tmp_name = gdb_mangle_name (t,
- method_counter,
- field_counter);
- phys_name = alloca (strlen (tmp_name) + 1);
- strcpy (phys_name, tmp_name);
- free (tmp_name);
- }
- else
- phys_name = TYPE_FN_FIELD_PHYSNAME (f, field_counter);
-
- /* Destructor is handled by caller, dont add it to the list */
- if (DESTRUCTOR_PREFIX_P (phys_name))
- continue;
-
- sym_arr[i1] = lookup_symbol (phys_name,
- NULL, VAR_NAMESPACE,
- (int *) NULL,
- (struct symtab **) NULL);
- if (sym_arr[i1])
- i1++;
- else
- {
- /* This error message gets printed, but the method
- still seems to be found
- fputs_filtered("(Cannot find method ", gdb_stdout);
- fprintf_symbol_filtered (gdb_stdout, phys_name,
- language_cplus,
- DMGL_PARAMS | DMGL_ANSI);
- fputs_filtered(" - possibly inlined.)\n", gdb_stdout);
- */
- }
- }
}
}
!
! /* Only search baseclasses if there is no match yet, since names in
! derived classes override those in baseclasses.
!
! FIXME: The above is not true; it is only true of member functions
! if they have the same number of arguments (??? - section 13.1 of the
! ARM says the function members are not in the same scope but doesn't
! really spell out the rules in a way I understand. In any case, if
! the number of arguments differ this is a case in which we can overload
! rather than hiding without any problem, and gcc 2.4.5 does overload
! rather than hiding in this case). */
!
! if (i1 == 0)
! for (ibase = 0; ibase < TYPE_N_BASECLASSES (t); ibase++)
! i1 += find_methods (TYPE_BASECLASS (t, ibase), name, sym_arr + i1);
!
return i1;
}
--- 2564,3115 ----
return 0;
count = TYPE_NFN_FIELDS_TOTAL (type);
! for (n = 0; n < TYPE_N_BASECLASSES (type); n++)
! count += total_number_of_methods (TYPE_BASECLASS (type, n));
!
! return count;
! }
!
! /* Recursive helper function for decode_line_1.
! Look for methods named NAME in type T.
! Return number of matches.
! Put matches in SYM_ARR, which should have been allocated with
! a size of total_number_of_methods (T) * sizeof (struct symbol *).
! Note that this function is g++ specific. */
!
! static int
! find_methods (t, name, sym_arr)
! struct type *t;
! char *name;
! struct symbol **sym_arr;
! {
! int i1 = 0;
! int ibase;
! struct symbol *sym_class;
! char *class_name = type_name_no_tag (t);
!
! /* Ignore this class if it doesn't have a name. This is ugly, but
! unless we figure out how to get the physname without the name of
! the class, then the loop can't do any good. */
! if (class_name
! && (sym_class = lookup_symbol (class_name,
! (struct block *) NULL,
! STRUCT_NAMESPACE,
! (int *) NULL,
! (struct symtab **) NULL)))
! {
! int method_counter;
!
! /* FIXME: Shouldn't this just be CHECK_TYPEDEF (t)? */
! t = SYMBOL_TYPE (sym_class);
!
! /* Loop over each method name. At this level, all overloads of a name
! are counted as a single name. There is an inner loop which loops over
! each overload. */
!
! for (method_counter = TYPE_NFN_FIELDS (t) - 1;
! method_counter >= 0;
! --method_counter)
! {
! int field_counter;
! char *method_name = TYPE_FN_FIELDLIST_NAME (t, method_counter);
! char dem_opname[64];
!
! if (strncmp (method_name, "__", 2) == 0 ||
! strncmp (method_name, "op", 2) == 0 ||
! strncmp (method_name, "type", 4) == 0)
! {
! if (cplus_demangle_opname (method_name, dem_opname, DMGL_ANSI))
! method_name = dem_opname;
! else if (cplus_demangle_opname (method_name, dem_opname, 0))
! method_name = dem_opname;
! }
!
! if (STREQ (name, method_name))
! /* Find all the overloaded methods with that name. */
! for (field_counter = TYPE_FN_FIELDLIST_LENGTH (t, method_counter) - 1;
! field_counter >= 0;
! --field_counter)
! {
! struct fn_field *f;
! char *phys_name;
!
! f = TYPE_FN_FIELDLIST1 (t, method_counter);
!
! if (TYPE_FN_FIELD_STUB (f, field_counter))
! {
! char *tmp_name;
!
! tmp_name = gdb_mangle_name (t,
! method_counter,
! field_counter);
! phys_name = alloca (strlen (tmp_name) + 1);
! strcpy (phys_name, tmp_name);
! free (tmp_name);
! }
! else
! phys_name = TYPE_FN_FIELD_PHYSNAME (f, field_counter);
!
! /* Destructor is handled by caller, dont add it to the list */
! if (DESTRUCTOR_PREFIX_P (phys_name))
! continue;
!
! sym_arr[i1] = lookup_symbol (phys_name,
! NULL, VAR_NAMESPACE,
! (int *) NULL,
! (struct symtab **) NULL);
! if (sym_arr[i1])
! i1++;
! else
! {
! /* This error message gets printed, but the method
! still seems to be found
! fputs_filtered("(Cannot find method ", gdb_stdout);
! fprintf_symbol_filtered (gdb_stdout, phys_name,
! language_cplus,
! DMGL_PARAMS | DMGL_ANSI);
! fputs_filtered(" - possibly inlined.)\n", gdb_stdout);
! */
! }
! }
! }
! }
!
! /* Only search baseclasses if there is no match yet, since names in
! derived classes override those in baseclasses.
!
! FIXME: The above is not true; it is only true of member functions
! if they have the same number of arguments (??? - section 13.1 of the
! ARM says the function members are not in the same scope but doesn't
! really spell out the rules in a way I understand. In any case, if
! the number of arguments differ this is a case in which we can overload
! rather than hiding without any problem, and gcc 2.4.5 does overload
! rather than hiding in this case). */
!
! if (i1 == 0)
! for (ibase = 0; ibase < TYPE_N_BASECLASSES (t); ibase++)
! i1 += find_methods (TYPE_BASECLASS (t, ibase), name, sym_arr + i1);
!
! return i1;
! }
!
! /* RM: Modified so that this function now returns only function
! symbols: all callers are only interested in functions, so this is
! the correct thing to do.
!
! Helper function for find_functions().
! Find first N symbols in BLOCK matching symbol NAME in NAMESPACE;
! put the symbols found in SYM_ARR starting at postion PUT_AT.
! Avoid multiple instances of the 'same' symbol ( 'same' ness detected by
! a 'shallow' but fast equality test.)
!
! This function is based on lookup_block_symbol() but does not attempt
! a binary search.
!
! Each symbol which is marked as being a C++
! symbol (language_cplus set) has both the encoded and non-encoded names
! tested for a match. */
!
! int
! find_n_block_functions (block, name, namespace, n, sym_arr, put_at)
! struct block *block;
! char *name;
! namespace_enum namespace;
! int n;
! struct symbol **sym_arr;
! int put_at;
! {
! int i1 = 0;
! register int bot, top;
! register struct symbol *sym;
! int j = 0;
!
! top = BLOCK_NSYMS (block);
! bot = 0;
! while (bot < top)
! {
! sym = BLOCK_SYM (block, bot);
! if (SYMBOL_NAMESPACE (sym) == namespace &&
! SYMBOL_CLASS (sym) == LOC_BLOCK &&
! SYMBOL_MATCHES_NAME (sym, name))
! {
! if (i1 == n)
! {
! /* Already found first 'n' symbols */
! break;
! }
! /* Check if 'sym' is already in 'sym_arr[0]...sym_arr[put_at+i1-1]' */
! /* One scenario this is needed is this:
! Prototype for foo() defined in 'foo.h'; foo() defined in
! 'foo.c' that includes 'foo.h'. Definition of foo() appears
! in the symtabs for both 'foo.h' and 'foo.c'
! */
! for (j = 0; j < (put_at + i1); j++)
! {
! /* fast but shallow equality test first */
! if (sym == sym_arr[j])
! break;
! }
! if (j == (put_at + i1))
! { /* not already present in sym_arr, put it */
! sym_arr[put_at + i1] = sym;
! i1 = i1 + 1;
! }
! }
! bot++;
! }
! return (i1);
! }
!
! #ifdef FAT_FREE_PSYMTABS
!
! static void
! expand_containing_psymtab (m)
! struct minimal_symbol *m;
! {
! struct objfile *objfile;
! struct partial_symtab *pst = NULL;
! CORE_ADDR pc;
!
! if (m)
! pst = find_pc_psymtab (SYMBOL_VALUE_ADDRESS (m));
!
! if (pst && !pst->readin)
! PSYMTAB_TO_SYMTAB (pst);
! }
!
! #endif
!
! /* Helper function for decode_line_1.
! Look for functions named NAME in all the symbol tables.
! Return number of matches.
! Put matches in SYM_ARR, which should have been allocated with
! a size of MAX_NUMBER_OF_OVERLOADED_OR_STATIC_FUNCTION_DEFINITIONS *
! sizeof (struct symbol *).
! Put the corresponding symtabs in SYMTAB_ARR, which should have been
! allocated with a size of
! MAX_NUMBER_OF_OVERLOADED_OR_STATIC_FUNCTION_DEFINITIONS *
! sizeof (struct symtab *).
! */
!
! /* This function is based on lookup_symbol() -- specialized with the
! value of formal parameter BLOCK as NULL, namespace as VAR_NAMESPACE,
! and IS_A_FIELD_OF_THIS as 0.
! Unlike lookup_symbol() this function does not quit after the first match.
! Unlike lookup_symbol() this function does not check for error conditions
! such as a discrepancy between partial_symtab and full_symtab.
! Unlike lookup_symbol() this function does not look for minimal
! symbols; the caller does that if this function returns 0.
! */
!
! int
! find_functions (name, sym_arr, symtab_and_block_arr)
! char *name;
! struct symbol **sym_arr;
! struct symtab_and_block *symtab_and_block_arr;
! {
! int i1 = 0;
! int maxi1 = MAX_NUMBER_OF_OVERLOADED_OR_STATIC_FUNCTION_DEFINITIONS;
! int n_found = 0;
! int lookup_terminated = 0;
! int k;
! register struct symtab *s = NULL;
! register struct partial_symtab *ps;
! struct blockvector *bv;
! register struct objfile *objfile;
! register struct block *block;
! namespace_enum namespace = VAR_NAMESPACE;
!
! /* Initialize sym_arr and symtab_and_block_arr */
! for (k = 0; k < maxi1; k++)
! {
! symtab_and_block_arr[k].symtab = NULL;
! symtab_and_block_arr[k].block_number = -1;
! sym_arr[k] = NULL;
! }
!
! /* Look into the symbol table for the current source file first */
! /* We look for both static and global definitions here to handle
! oveloaded C++ functions.
! */
! s = current_source_symtab;
! if (s)
! {
! int b = 0;
! bv = BLOCKVECTOR (s);
! for (b = 0; b < 2; b++)
! {
! /* We do not want to rely on the #define of GLOBAL/STATIC_BLOCK
! here */
! int block_no = (b == 0) ? GLOBAL_BLOCK : STATIC_BLOCK;
! block = BLOCKVECTOR_BLOCK (bv, block_no);
! n_found = 0;
! n_found = find_n_block_functions (block, name, namespace, maxi1 - i1, sym_arr, i1);
! if (n_found != 0)
! {
! block_found = block;
! for (k = 0; k < n_found; k++)
! {
! if ((i1 + k) == maxi1)
! break;
! symtab_and_block_arr[i1 + k].symtab = s;
! symtab_and_block_arr[i1 + k].block_number = block_no;
! }
! i1 += n_found;
! if (i1 == maxi1)
! {
! lookup_terminated = 1;
! goto lookup_over;
! }
! }
! }
! }
! /* If we found match(es) in the current source file we are done */
! if (i1)
! goto lookup_over;
!
! #ifdef FAT_FREE_PSYMTABS
!
! /* srikanth, in the case of the Wildebeest, the psymtabs are no
! longer populated with psymbols. We need to rely on the linker
! symbol table to lookup the symbol, use its address to decide
! which psymtab would have housed the psymbol, were one to exist.
! The function `foreach_text_minsym' is an iterator, which would
! call its second argument for each matched minimal symbol
! (mst_text and mst_file_text) and pass the match.
! */
!
! foreach_text_minsym (name, expand_containing_psymtab);
!
! #endif
!
! /* Now search all the global symbols. Do the symtab's first, then
! check the psymtab's. If a psymtab indicates the existence
! of the desired name as a global, then do psymtab-to-symtab
! conversion on the fly and return the found symbol.
! */
!
! ALL_SYMTABS (objfile, s)
! {
! bv = BLOCKVECTOR (s);
! block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
! n_found = 0;
! n_found = find_n_block_functions (block, name, namespace, maxi1 - i1, sym_arr, i1);
! if (n_found != 0)
! {
! block_found = block;
! for (k = 0; k < n_found; k++)
! {
! if ((i1 + k) == maxi1)
! break;
! symtab_and_block_arr[i1 + k].symtab = s;
! symtab_and_block_arr[i1 + k].block_number = GLOBAL_BLOCK;
! }
! i1 += n_found;
! if (i1 == maxi1)
! {
! lookup_terminated = 1;
! goto lookup_over;
! }
! }
! }
!
! ALL_PSYMTABS (objfile, ps)
! {
! if (!ps->readin && lookup_partial_symbol (ps, name, 1, namespace))
! {
! s = PSYMTAB_TO_SYMTAB (ps);
! bv = BLOCKVECTOR (s);
! block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
! n_found = 0;
! n_found = find_n_block_functions (block, name, namespace, maxi1 - i1, sym_arr, i1);
! if (n_found != 0)
! {
! block_found = block;
! for (k = 0; k < n_found; k++)
! {
! if ((i1 + k) == maxi1)
! break;
! symtab_and_block_arr[i1 + k].symtab = s;
! symtab_and_block_arr[i1 + k].block_number = GLOBAL_BLOCK;
! }
! i1 += n_found;
! if (i1 == maxi1)
! {
! lookup_terminated = 1;
! goto lookup_over;
! }
! }
! }
! }
! /* If we found any matches in the globalsymbols we are done */
! if (i1)
! goto lookup_over;
!
! /* Now search the static file-level symbols.
! Not strictly correct, but more useful than an error.
! Do the symtab's first, then
! check the psymtab's. If a psymtab indicates the existence
! of the desired name as a file-level static, then do psymtab-to-symtab
! conversion on the fly and return the found symbol.
! */
! ALL_SYMTABS (objfile, s)
! {
! bv = BLOCKVECTOR (s);
! block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
! n_found = 0;
! n_found = find_n_block_functions (block, name, namespace, maxi1 - i1, sym_arr, i1);
! if (n_found != 0)
! {
! block_found = block;
! for (k = 0; k < n_found; k++)
! {
! if (i1 + k == maxi1)
! break;
! symtab_and_block_arr[i1 + k].symtab = s;
! symtab_and_block_arr[i1 + k].block_number = STATIC_BLOCK;
! }
! i1 += n_found;
! if (i1 == maxi1)
! {
! lookup_terminated = 1;
! goto lookup_over;
! }
! }
! }
!
! ALL_PSYMTABS (objfile, ps)
! {
! if (!ps->readin && lookup_partial_symbol (ps, name, 0, namespace))
! {
! s = PSYMTAB_TO_SYMTAB (ps);
! bv = BLOCKVECTOR (s);
! block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
! n_found = 0;
! n_found = find_n_block_functions (block, name, namespace, maxi1 - i1, sym_arr, i1);
! if (n_found != 0)
! {
! block_found = block;
! for (k = 0; k < n_found; k++)
! {
! if (i1 + k == maxi1)
! break;
! symtab_and_block_arr[i1 + k].symtab = s;
! symtab_and_block_arr[i1 + k].block_number = STATIC_BLOCK;
! }
! i1 += n_found;
! if (i1 == maxi1)
! {
! lookup_terminated = 1;
! goto lookup_over;
! }
! }
! }
! }
! /* The caller (decode_line_1) will check for the possibility of the symbol
! being a function that is stored in one of the minimal symbol tables.
! The "minimal symbol table" is built from linker-supplied info.
! */
! lookup_over:
! if (lookup_terminated)
! {
! warning ("\
! (Only %d definitions of function %s matched; use \
! 'info func %s' to find all the matching defintions.\n", maxi1, name, name);
! }
! return i1;
}
! /* Helper function for decode_line_1.
! Look for functions named NAME in SYMTAB_IN.
Return number of matches.
Put matches in SYM_ARR, which should have been allocated with
! a size of MAX_NUMBER_OF_OVERLOADED_OR_STATIC_FUNCTION_DEFINITIONS *
! sizeof (struct symbol *).
! Put the corresponding symtabs in SYMTAB_ARR, which should have been
! allocated with a size of
! MAX_NUMBER_OF_OVERLOADED_OR_STATIC_FUNCTION_DEFINITIONS *
! sizeof (struct symtab *).
! */
! /* This function is based on find_functions()
! Most of the comments above find_functions() apply here as well.
! */
!
! int
! find_functions_in_symtab (name, sym_arr, symtab_and_block_arr,
! symtab_in)
char *name;
struct symbol **sym_arr;
+ struct symtab_and_block *symtab_and_block_arr;
+ struct symtab *symtab_in;
{
int i1 = 0;
! int maxi1 = MAX_NUMBER_OF_OVERLOADED_OR_STATIC_FUNCTION_DEFINITIONS;
! int n_found = 0;
! int lookup_terminated = 0;
! int k;
! register struct symtab *s = NULL;
! struct blockvector *bv;
! register struct block *block;
! namespace_enum namespace = VAR_NAMESPACE;
! /* Initialize sym_arr and symtab_and_block_arr */
! for (k = 0; k < maxi1; k++)
! {
! symtab_and_block_arr[k].symtab = NULL;
! symtab_and_block_arr[k].block_number = -1;
! sym_arr[k] = NULL;
! }
! /* We look for both static and global definitions here to handle
! oveloaded C++ functions.
! */
! s = symtab_in;
! if (s)
! {
! int b = 0;
! bv = BLOCKVECTOR (s);
! for (b = 0; b < 2; b++)
! {
! /* We do not want to rely on the #define of GLOBAL/STATIC_BLOCK
! here */
! int block_no = (b == 0) ? GLOBAL_BLOCK : STATIC_BLOCK;
! block = BLOCKVECTOR_BLOCK (bv, block_no);
! n_found = 0;
! n_found = find_n_block_functions (block, name, namespace, maxi1 - i1, sym_arr, i1);
! if (n_found != 0)
{
! block_found = block;
! for (k = 0; k < n_found; k++)
! {
! if ((i1 + k) == maxi1)
! break;
! symtab_and_block_arr[i1 + k].symtab = s;
! symtab_and_block_arr[i1 + k].block_number = block_no;
! }
! i1 += n_found;
! if (i1 == maxi1)
! {
! lookup_terminated = 1;
! goto lookup_over;
! }
}
}
}
! /* The caller (decode_line_1) will check for the possibility of the symbol
! being a function that is stored in one of the minimal symbol tables.
! The "minimal symbol table" is built from linker-supplied info.
! */
! lookup_over:
! if (lookup_terminated)
! {
! warning ("\
! (Only %d definitions of function %s matched; use \
! 'info func %s' to find all the matching defintions.\n", maxi1, name, name);
! }
return i1;
}
***************
*** 2435,2440 ****
--- 3186,3196 ----
line spec. The array and the line spec strings are allocated on the heap,
it is the callers responsibility to free them.
+ RESOLVE tells us what to do if we find more than one match for a
+ symbol. If it is set to USER_CHOICE, a menu is popped up for the
+ user to choose from. If it is set to ALL_SYMBOLS, all matching
+ symbols are returned.
+
Note that it is possible to return zero for the symtab
if no file is validly specified. Callers must check that.
Also, the line number returned may be invalid. */
***************
*** 2445,2456 ****
can use as appropriate instead of make_symbol_completion_list. */
struct symtabs_and_lines
! decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
char **argptr;
int funfirstline;
struct symtab *default_symtab;
int default_line;
char ***canonical;
{
struct symtabs_and_lines values;
#ifdef HPPA_COMPILER_BUG
--- 3201,3213 ----
can use as appropriate instead of make_symbol_completion_list. */
struct symtabs_and_lines
! decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical, resolve)
char **argptr;
int funfirstline;
struct symtab *default_symtab;
int default_line;
char ***canonical;
+ enum how_to_resolve_multiple_symbols resolve;
{
struct symtabs_and_lines values;
#ifdef HPPA_COMPILER_BUG
***************
*** 2505,2512 ****
int has_if = 0;
int has_comma = 0;
struct symbol **sym_arr;
struct type *t;
- char *saved_arg = *argptr;
extern char *gdb_completer_quote_characters;
INIT_SAL (&val); /* initialize to zeroes */
--- 3262,3269 ----
int has_if = 0;
int has_comma = 0;
struct symbol **sym_arr;
+ struct symtab_and_block *symtab_and_block_arr;
struct type *t;
extern char *gdb_completer_quote_characters;
INIT_SAL (&val); /* initialize to zeroes */
***************
*** 2651,2657 ****
/* ... or Java */
if (is_quoted)
*argptr = *argptr + 1;
! if (p[0] == '.' || p[1] == ':')
{
char *saved_arg2 = *argptr;
char *temp_end;
--- 3408,3414 ----
/* ... or Java */
if (is_quoted)
*argptr = *argptr + 1;
! if (strlen (p) > 1 && (p[0] == '.' || p[1] == ':'))
{
char *saved_arg2 = *argptr;
char *temp_end;
***************
*** 2720,2747 ****
while (*p && *p != ' ' && *p != '\t' && *p != ',' && *p != ':')
p++;
}
! /*
! q = operator_chars (*argptr, &q1);
! if (q1 - q)
! {
! char *opname;
! char *tmp = alloca (q1 - q + 1);
! memcpy (tmp, q, q1 - q);
! tmp[q1 - q] = '\0';
! opname = cplus_mangle_opname (tmp, DMGL_ANSI);
! if (opname == NULL)
! {
! error_begin ();
! printf_filtered ("no mangling for \"%s\"\n", tmp);
! cplusplus_hint (saved_arg);
! return_to_top_level (RETURN_ERROR);
! }
! copy = (char*) alloca (3 + strlen(opname));
! sprintf (copy, "__%s", opname);
! p = q1;
! }
! else
! */
{
copy = (char *) alloca (p - *argptr + 1);
memcpy (copy, *argptr, p - *argptr);
--- 3477,3483 ----
while (*p && *p != ' ' && *p != '\t' && *p != ',' && *p != ':')
p++;
}
!
{
copy = (char *) alloca (p - *argptr + 1);
memcpy (copy, *argptr, p - *argptr);
***************
*** 2805,2811 ****
{
/* There is more than one field with that name
(overloaded). Ask the user which one to use. */
! return decode_line_2 (sym_arr, i1, funfirstline, canonical);
}
else
{
--- 3541,3547 ----
{
/* There is more than one field with that name
(overloaded). Ask the user which one to use. */
! return decode_line_2 (sym_arr, i1, funfirstline, canonical, NULL, resolve);
}
else
{
***************
*** 2819,2835 ****
}
else
tmp = copy;
! error_begin ();
! if (tmp[0] == '~')
! printf_filtered
! ("the class `%s' does not have destructor defined\n",
! SYMBOL_SOURCE_NAME (sym_class));
! else
! printf_filtered
! ("the class %s does not have any method named %s\n",
! SYMBOL_SOURCE_NAME (sym_class), tmp);
! cplusplus_hint (saved_arg);
! return_to_top_level (RETURN_ERROR);
}
}
--- 3555,3563 ----
}
else
tmp = copy;
!
! values.nelts = 0;
! return values;
}
}
***************
*** 2881,2893 ****
if (sym)
goto symbol_found;
/* Couldn't find any interpretation as classes/namespaces, so give up */
! error_begin ();
! /* The quotes are important if copy is empty. */
! printf_filtered
! ("Can't find member of namespace, class, struct, or union named \"%s\"\n", copy);
! cplusplus_hint (saved_arg);
! return_to_top_level (RETURN_ERROR);
}
/* end of C++ */
--- 3609,3623 ----
if (sym)
goto symbol_found;
+ /* RM: try once more, as a minimal symbol -- the file
+ containing the symbol may have no debug information */
+ msymbol = lookup_minimal_symbol (copy, 0, 0);
+ if (msymbol)
+ goto minimal_symbol_found;
+
/* Couldn't find any interpretation as classes/namespaces, so give up */
! values.nelts = 0;
! return values;
}
/* end of C++ */
***************
*** 2918,2926 ****
--- 3648,3713 ----
s = lookup_symtab (copy);
if (s == 0)
{
+ /* RM: We may be debugging a stripped executable with
+ * unstripped shared libraries. Just because we have no
+ * symbols now doesn't mean we'll never have symbols.
+ */
+ #if 0
if (!have_full_symbols () && !have_partial_symbols ())
error (no_symtab_msg);
+ #endif
+
+ /* RM: source file may be in an as yet unloaded shared
+ * library. Just return an empty sal, and let the caller
+ * deal with it.
+ */
+ /* guo: gdb.trace/tracecmd.exp has test for this 'feature'.
+ make it HPPA only.
+ Should really be #if 0 or removed, and fix the test. */
+ #ifndef GDB_TARGET_IS_HPPA
error ("No source file named %s.", copy);
+ #endif
+
+ p++;
+ while (*p == ' ' || *p == '\t')
+ p++;
+ /* RM: do we have a line number? */
+ if (*p == '-' || *p == '+' ||
+ (*p >= '0' && *p <= '9'))
+ {
+ p++;
+ while (*p >= '0' && *p <= '9')
+ p++;
+ *argptr = p;
+ }
+ else
+ {
+ /* Arg token is not digits => try it as a variable name
+ * Find the next token (everything up to end or next
+ * whitespace).
+ */
+ if (*p == '$') /* May be a convenience variable */
+ /* One or two $ chars possible */
+ p = skip_quoted (p + ((p[1] == '$') ? 2 : 1));
+ else if (is_quoted)
+ {
+ p = skip_quoted (p);
+ if (p[-1] != '\'')
+ error ("Unmatched single quote.");
+ }
+ else if (has_parens)
+ {
+ p = pp + 1;
+ }
+ else
+ {
+ p = skip_quoted (p);
+ }
+ *argptr = p;
+ }
+
+ values.nelts = 0;
+ return values;
}
/* Discard the file name from the arg. */
***************
*** 2929,2935 ****
p++;
*argptr = p;
}
! #if 0
/* No one really seems to know why this was added. It certainly
breaks the command line, though, whenever the passed
name is of the form ClassName::Method. This bit of code
--- 3716,3722 ----
p++;
*argptr = p;
}
! #ifdef GDB_TARGET_IS_HPPA
/* No one really seems to know why this was added. It certainly
breaks the command line, though, whenever the passed
name is of the form ClassName::Method. This bit of code
***************
*** 2952,2960 ****
copy = (char *) alloca (p - *argptr + 1);
memcpy (copy, *argptr, p - *argptr);
copy[p - *argptr] = '\000';
! sym = lookup_symbol (copy, 0, VAR_NAMESPACE, 0, &sym_symtab);
! if (sym)
! {
/* Yes, we have a symbol; jump to symbol processing */
/* Code after symbol_found expects S, SYM_SYMTAB, SYM,
and COPY to be set correctly */
--- 3739,3761 ----
copy = (char *) alloca (p - *argptr + 1);
memcpy (copy, *argptr, p - *argptr);
copy[p - *argptr] = '\000';
!
! /* Look for multiple overloaded (in case of C++) or static (both for C
! and C++ definitions of the function symbol found */
! sym = 0;
! i1 = 0; /* counter for the symbol array */
! sym_arr = (struct symbol **)
! alloca (MAX_NUMBER_OF_OVERLOADED_OR_STATIC_FUNCTION_DEFINITIONS
! * sizeof (struct symbol *));
! symtab_and_block_arr = (struct symtab_and_block *)
! alloca (MAX_NUMBER_OF_OVERLOADED_OR_STATIC_FUNCTION_DEFINITIONS
! * sizeof (struct symtab_and_block));
! i1 = find_functions (copy, sym_arr, symtab_and_block_arr);
! if (i1 == 1)
! {
! /* There is exactly one function with that name. */
! sym = sym_arr[0];
! sym_symtab = symtab_and_block_arr[0].symtab;
/* Yes, we have a symbol; jump to symbol processing */
/* Code after symbol_found expects S, SYM_SYMTAB, SYM,
and COPY to be set correctly */
***************
*** 2962,2971 ****
s = (struct symtab *) 0;
goto symbol_found;
}
/* Otherwise fall out from here and go to file/line spec
processing, etc. */
}
! #endif
/* S is specified file's symtab, or 0 if no file specified.
arg no longer contains the file name. */
--- 3763,3779 ----
s = (struct symtab *) 0;
goto symbol_found;
}
+ else if (i1 > 1)
+ {
+ /* There is more than one functions with that name
+ (overloaded or file-statics). Ask the user which one to use. */
+ *argptr = (*p == '\'') ? p + 1 : p;
+ return decode_line_2 (sym_arr, i1, funfirstline, canonical, symtab_and_block_arr, resolve);
+ }
/* Otherwise fall out from here and go to file/line spec
processing, etc. */
}
! #endif /* GDB_TARGET_IS_HPPA */
/* S is specified file's symtab, or 0 if no file specified.
arg no longer contains the file name. */
***************
*** 3154,3159 ****
--- 3962,4011 ----
/* Look up that token as a variable.
If file specified, use that file's per-file block to start with. */
+ #ifdef GDB_TARGET_IS_HPPA
+ /* If a file is specified look for multiple definitions of the
+ function to break at in the file. */
+
+ if (s)
+ {
+ int i1;
+
+ sym = 0;
+ i1 = 0; /* counter for the symbol array */
+
+ sym_arr = (struct symbol **)
+ alloca (MAX_NUMBER_OF_OVERLOADED_OR_STATIC_FUNCTION_DEFINITIONS
+ * sizeof (struct symbol *));
+
+ symtab_and_block_arr = (struct symtab_and_block *)
+ alloca (MAX_NUMBER_OF_OVERLOADED_OR_STATIC_FUNCTION_DEFINITIONS
+ * sizeof (struct symtab_and_block));
+
+ i1 = find_functions_in_symtab (copy, sym_arr, symtab_and_block_arr, s);
+ if (i1 == 1)
+ {
+ /* There is exactly one function with that name. */
+ sym = sym_arr[0];
+ sym_symtab = symtab_and_block_arr[0].symtab;
+ /* Yes, we have a symbol; jump to symbol processing */
+ /* Code after symbol_found expects S, SYM_SYMTAB, SYM,
+ and COPY to be set correctly */
+ *argptr = (*p == '\'') ? p + 1 : p;
+ /* Let 's' stay as it is */
+ goto symbol_found;
+ }
+ else if (i1 > 1)
+ {
+ /* There is more than one functions with that name
+ (overloaded or file-statics). Ask the user which one to use.
+ */
+ *argptr = (*p == '\'') ? p + 1 : p;
+ return decode_line_2 (sym_arr, i1, funfirstline, canonical,
+ symtab_and_block_arr, resolve);
+ }
+ /* Otherwise fall out from here */
+ }
+ #endif /* GDB_TARGET_IS_HPPA */
sym = lookup_symbol (copy,
(s ? BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK)
***************
*** 3234,3244 ****
--- 4086,4111 ----
return values;
}
+ /* RM: We may be debugging a stripped executable with unstripped
+ * shared libraries. Just because we have no symbols now doesn't mean
+ * we'll never have symbols.
+ */
+ #if 0
if (!have_full_symbols () &&
!have_partial_symbols () && !have_minimal_symbols ())
error (no_symtab_msg);
+ #endif
+ /* RM: function may be defined in an as yet unloaded shared
+ * library. Just return an empty sal, and let the caller deal with
+ * it. */
+ /* guo: gdb.trace/tracecmd.exp has test for this 'feature'.
+ Should really be #if 0 or removed, and fix the test. */
+ #ifndef GDB_TARGET_IS_HPPA
error ("Function \"%s\" not defined.", copy);
+ #endif
+
+ values.nelts = 0;
return values; /* for lint */
}
***************
*** 3252,3258 ****
error ("Empty line specification.");
sals = decode_line_1 (&string, funfirstline,
current_source_symtab, current_source_line,
! (char ***) NULL);
if (*string)
error ("Junk at end of line specification: %s", string);
return sals;
--- 4119,4125 ----
error ("Empty line specification.");
sals = decode_line_1 (&string, funfirstline,
current_source_symtab, current_source_line,
! (char ***) NULL, USER_CHOICE);
if (*string)
error ("Junk at end of line specification: %s", string);
return sals;
***************
*** 3261,3278 ****
/* Given a list of NELTS symbols in SYM_ARR, return a list of lines to
operate on (ask user if necessary).
If CANONICAL is non-NULL return a corresponding array of mangled names
! as canonical line specs there. */
static struct symtabs_and_lines
! decode_line_2 (sym_arr, nelts, funfirstline, canonical)
struct symbol *sym_arr[];
int nelts;
int funfirstline;
char ***canonical;
{
struct symtabs_and_lines values, return_values;
! char *args, *arg1;
int i;
char *prompt;
char *symname;
struct cleanup *old_chain;
--- 4128,4157 ----
/* Given a list of NELTS symbols in SYM_ARR, return a list of lines to
operate on (ask user if necessary).
If CANONICAL is non-NULL return a corresponding array of mangled names
! as canonical line specs there.
! If CANONICAL is non-NULL and if SYMTAB_ARR is non-NULL use SYMTAB_ARR
! to find whether the symbols in SYM_ARR are static and if they are then
! return canonical line specs of the form "function:filename".
!
! RESOLVE tells us what to do if with multiple matching symbols. If
! it is set to USER_CHOICE, a menu is popped up for the user to
! choose from. If it is set to ALL_SYMBOLS, all symbols are
! returned.
! */
static struct symtabs_and_lines
! decode_line_2 (sym_arr, nelts, funfirstline, canonical, symtab_and_block_arr, resolve)
struct symbol *sym_arr[];
int nelts;
int funfirstline;
char ***canonical;
+ struct symtab_and_block symtab_and_block_arr[];
+ enum how_to_resolve_multiple_symbols resolve;
{
struct symtabs_and_lines values, return_values;
! char *args = NULL, *arg1;
int i;
+ char buf[2];
char *prompt;
char *symname;
struct cleanup *old_chain;
***************
*** 3293,3299 ****
}
i = 0;
! printf_unfiltered ("[0] cancel\n[1] all\n");
while (i < nelts)
{
INIT_SAL (&return_values.sals[i]); /* initialize to zeroes */
--- 4172,4180 ----
}
i = 0;
! /* Choices are [0],[1],..,[nelts+1] */
! if (resolve == USER_CHOICE)
! printf_filtered ("[0] cancel\n[1] all\n");
while (i < nelts)
{
INIT_SAL (&return_values.sals[i]); /* initialize to zeroes */
***************
*** 3301,3322 ****
if (sym_arr[i] && SYMBOL_CLASS (sym_arr[i]) == LOC_BLOCK)
{
values.sals[i] = find_function_start_sal (sym_arr[i], funfirstline);
! printf_unfiltered ("[%d] %s at %s:%d\n",
(i + 2),
SYMBOL_SOURCE_NAME (sym_arr[i]),
values.sals[i].symtab->filename,
! values.sals[i].line);
}
! else
! printf_unfiltered ("?HERE\n");
i++;
}
! if ((prompt = getenv ("PS2")) == NULL)
{
! prompt = "> ";
}
- args = command_line_input (prompt, 0, "overload-choice");
if (args == 0 || *args == 0)
error_no_arg ("one or more choice numbers");
--- 4182,4219 ----
if (sym_arr[i] && SYMBOL_CLASS (sym_arr[i]) == LOC_BLOCK)
{
values.sals[i] = find_function_start_sal (sym_arr[i], funfirstline);
! if (resolve == USER_CHOICE)
! printf_filtered ("[%d] %s at %s:%d\n",
(i + 2),
SYMBOL_SOURCE_NAME (sym_arr[i]),
values.sals[i].symtab->filename,
! values.sals[i].line,
! (symtab_and_block_arr &&
! symtab_and_block_arr[i].block_number == STATIC_BLOCK) ?
! " (STATIC)" : "");
}
! else if (resolve == USER_CHOICE)
! printf_filtered ("?HERE\n");
i++;
}
! if (resolve == USER_CHOICE)
! {
! if ((prompt = getenv ("PS2")) == NULL)
! {
! /* guo 991019: need to update WDB test (gdb.c++/templates.exp)
! when merge back to WDB tree. */
! prompt = "> ";
! }
!
! args = command_line_input (prompt, 0, "overload-choice");
! }
! else if (resolve == ALL_SYMBOLS)
{
! buf[0] = '1';
! buf[1] = 0;
! args = buf;
}
if (args == 0 || *args == 0)
error_no_arg ("one or more choice numbers");
***************
*** 3345,3354 ****
if (canonical_arr[i] == NULL)
{
symname = SYMBOL_NAME (sym_arr[i]);
! canonical_arr[i] = savestring (symname, strlen (symname));
}
}
}
memcpy (return_values.sals, values.sals,
(nelts * sizeof (struct symtab_and_line)));
return_values.nelts = nelts;
--- 4242,4276 ----
if (canonical_arr[i] == NULL)
{
symname = SYMBOL_NAME (sym_arr[i]);
! if (symtab_and_block_arr && symtab_and_block_arr[i].symtab)
! {
! /* Is this a 'static' function? */
! if (symtab_and_block_arr[i].block_number == STATIC_BLOCK)
! {
! /* This is a static function */
! char *filename, *canonical_name;
!
! filename = values.sals[i].symtab->filename,
! canonical_name = xmalloc (strlen (filename) +
! strlen (symname) + 2);
! strcpy (canonical_name, filename);
! strcat (canonical_name, ":");
! strcat (canonical_name, symname);
! canonical_arr[i] = canonical_name;
! }
! else
! { /* Not a static function */
! canonical_arr[i] = savestring (symname, strlen (symname));
! }
! }
! else
! { /* SYMTAB_AND_BLOCK_ARR is NULL or no SYMTAB */
! canonical_arr[i] = savestring (symname, strlen (symname));
! }
}
}
}
+
memcpy (return_values.sals, values.sals,
(nelts * sizeof (struct symtab_and_line)));
return_values.nelts = nelts;
***************
*** 3370,3375 ****
--- 4292,4322 ----
symname = SYMBOL_NAME (sym_arr[num]);
make_cleanup (free, symname);
canonical_arr[i] = savestring (symname, strlen (symname));
+ if (symtab_and_block_arr && symtab_and_block_arr[i].symtab)
+ {
+ /* Is this a 'static' function? */
+ if (symtab_and_block_arr[i].block_number == STATIC_BLOCK)
+ {
+ /* This is a static function */
+ char *filename, *canonical_name;
+
+ filename = values.sals[i].symtab->filename,
+ canonical_name = xmalloc (strlen (filename) +
+ strlen (symname) + 2);
+ strcpy (canonical_name, filename);
+ strcat (canonical_name, ":");
+ strcat (canonical_name, symname);
+ canonical_arr[i] = canonical_name;
+ }
+ else
+ { /* Not a static function */
+ canonical_arr[i] = savestring (symname, strlen (symname));
+ }
+ }
+ else
+ { /* SYMTAB_AND_BLOCK_ARR is NULL or SYMTAB is NULL */
+ canonical_arr[i] = savestring (symname, strlen (symname));
+ }
}
return_values.sals[i++] = values.sals[num];
values.sals[num].pc = 0;
***************
*** 3664,3674 ****
load the file and go on to the next one */
if (file_matches (ps->filename, files, nfiles)
&& ((regexp == NULL || SYMBOL_MATCHES_REGEXP (*psym))
! && ((kind == VARIABLES_NAMESPACE && SYMBOL_CLASS (*psym) != LOC_TYPEDEF
! && SYMBOL_CLASS (*psym) != LOC_BLOCK)
! || (kind == FUNCTIONS_NAMESPACE && SYMBOL_CLASS (*psym) == LOC_BLOCK)
! || (kind == TYPES_NAMESPACE && SYMBOL_CLASS (*psym) == LOC_TYPEDEF)
! || (kind == METHODS_NAMESPACE && SYMBOL_CLASS (*psym) == LOC_BLOCK))))
{
PSYMTAB_TO_SYMTAB (ps);
keep_going = 0;
--- 4611,4625 ----
load the file and go on to the next one */
if (file_matches (ps->filename, files, nfiles)
&& ((regexp == NULL || SYMBOL_MATCHES_REGEXP (*psym))
! && ((kind == VARIABLES_NAMESPACE
! && PSYMBOL_CLASS (*psym) != LOC_TYPEDEF
! && PSYMBOL_CLASS (*psym) != LOC_BLOCK)
! || (kind == FUNCTIONS_NAMESPACE
! && PSYMBOL_CLASS (*psym) == LOC_BLOCK)
! || (kind == TYPES_NAMESPACE
! && PSYMBOL_CLASS (*psym) == LOC_TYPEDEF)
! || (kind == METHODS_NAMESPACE
! && PSYMBOL_CLASS (*psym) == LOC_BLOCK))))
{
PSYMTAB_TO_SYMTAB (ps);
keep_going = 0;
***************
*** 3714,3719 ****
--- 4665,4673 ----
}
}
}
+
+ /* RM: allow user to quit */
+ QUIT;
}
ALL_SYMTABS (objfile, s)
***************
*** 4164,4169 ****
--- 5118,5124 ----
char *sym_text;
/* Length of sym_text. */
int sym_text_len;
+ int class_qualified;
/* Now look for the symbol we are supposed to complete on.
FIXME: This should be language-specific. */
***************
*** 4259,4264 ****
--- 5214,5220 ----
ALL_MSYMBOLS (objfile, msymbol)
{
QUIT;
+
COMPLETION_LIST_ADD_SYMBOL (msymbol, sym_text, sym_text_len, text, word);
}
***************
*** 4481,4487 ****
sym_return_val[0] = NULL;
/* Look through the partial symtabs for all symbols which begin
! by matching OLOAD_NAME. Make sure we read that symbol table in. */
ALL_PSYMTABS (objfile, ps)
{
--- 5437,5443 ----
sym_return_val[0] = NULL;
/* Look through the partial symtabs for all symbols which begin
! by matching OLOAD_NAME. Add each one that you find to the list. */
ALL_PSYMTABS (objfile, ps)
{
***************
*** 4499,4506 ****
{
/* If interrupted, then quit. */
QUIT;
! /* This will cause the symbol table to be read if it has not yet been */
! s = PSYMTAB_TO_SYMTAB (ps);
}
for (psym = objfile->static_psymbols.list + ps->statics_offset;
--- 5455,5462 ----
{
/* If interrupted, then quit. */
QUIT;
! /* This will cause the symbol table to be read if it has not yet been */
! s = PSYMTAB_TO_SYMTAB (ps);
}
for (psym = objfile->static_psymbols.list + ps->statics_offset;
***************
*** 4509,4516 ****
psym++)
{
QUIT;
! /* This will cause the symbol table to be read if it has not yet been */
! s = PSYMTAB_TO_SYMTAB (ps);
}
}
--- 5465,5472 ----
psym++)
{
QUIT;
! /* This will cause the symbol table to be read if it has not yet been */
! s = PSYMTAB_TO_SYMTAB (ps);
}
}
Index: gdb/symtab.h
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/symtab.h gdb/symtab.h
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/symtab.h Tue Nov 2 16:04:08 1999
--- gdb/symtab.h Thu Nov 11 09:19:20 1999
***************
*** 34,44 ****
--- 34,49 ----
things; also it is a pain to have to "make clean" every time you
want to switch compilers), then GDB dies a horrible death. */
/* GNU C supports enums that are bitfields. Some compilers don't. */
+ /* HPC supports enum bitfields */
#if 0 && defined(__GNUC__) && !defined(BYTE_BITFIELD)
#define BYTE_BITFIELD :8;
#else
+ #if defined(__hpux) && !defined(__GNUC__) && !defined(BYTE_BITFIELD)
+ #define BYTE_BITFIELD :8
+ #else
#define BYTE_BITFIELD /*nothing */
#endif
+ #endif
/* Define a structure for the information that is common to all symbol types,
including minimal symbols, partial symbols, and full symbols. In a
***************
*** 67,73 ****
/* The fact that this is a long not a LONGEST mainly limits the
range of a LOC_CONST. Since LOC_CONST_BYTES exists, I'm not
sure that is a big deal. */
! long ivalue;
struct block *block;
--- 72,78 ----
/* The fact that this is a long not a LONGEST mainly limits the
range of a LOC_CONST. Since LOC_CONST_BYTES exists, I'm not
sure that is a big deal. */
! CORE_ADDR ivalue;
struct block *block;
***************
*** 508,513 ****
--- 513,526 ----
STRUCT_NAMESPACE,
+ /* In doom mode, it is not clear at the psymtab stage whether a type name
+ is a struct/union/enum tag or not. So we end up adding the same symbol
+ under both categories. I am introducing a fuzzy name space here to
+ cut down the number of psymbols - srikanth
+ */
+
+ VAR_OR_STRUCT_NAMESPACE,
+
/* LABEL_NAMESPACE may be used for names of labels (for gotos);
currently it is not used and labels are not recorded at all. */
***************
*** 1101,1109 ****
/* Macro that yields non-zero value iff NAME is the prefix for C++ destructor
names. Note that this macro is g++ specific (FIXME). */
#define DESTRUCTOR_PREFIX_P(NAME) \
! ((NAME)[0] == '_' && is_cplus_marker ((NAME)[1]) && (NAME)[2] == '_')
/* External variables and functions for the objects described above. */
--- 1114,1134 ----
/* Macro that yields non-zero value iff NAME is the prefix for C++ destructor
names. Note that this macro is g++ specific (FIXME). */
+ /* RM: This is probably the wrong place to do this, but we should at
+ least recognize HP aCC destructors too */
#define DESTRUCTOR_PREFIX_P(NAME) \
! (((NAME)[0] == '_' && is_cplus_marker ((NAME)[1]) && (NAME)[2] == '_') \
! || (!(strncmp(NAME, "__dt__", 6))))
!
! /* RM: enum used to choose between various methods of resolving
! * multiple symbols with the same name. Used in decode_line_1().
! */
! enum how_to_resolve_multiple_symbols
! {
! USER_CHOICE,
! ALL_SYMBOLS
! };
/* External variables and functions for the objects described above. */
***************
*** 1408,1414 ****
decode_line_spec_1 PARAMS ((char *, int));
extern struct symtabs_and_lines
! decode_line_1 PARAMS ((char **, int, struct symtab *, int, char ***));
/* Symmisc.c */
--- 1433,1440 ----
decode_line_spec_1 PARAMS ((char *, int));
extern struct symtabs_and_lines
! decode_line_1 PARAMS ((char **, int, struct symtab *, int, char ***,
! enum how_to_resolve_multiple_symbols));
/* Symmisc.c */
Index: gdb/minsyms.c
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/minsyms.c gdb/minsyms.c
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/minsyms.c Wed Nov 10 12:30:56 1999
--- gdb/minsyms.c Thu Nov 11 09:25:44 1999
***************
*** 80,85 ****
--- 80,108 ----
static int
compact_minimal_symbols PARAMS ((struct minimal_symbol *, int));
+ /* srikanth, an iterator for functions in the linker symbol table.
+ Looks up `name' and for each matching symbol, calls `action' and
+ passes the selected symbol. */
+
+ void
+ foreach_text_minsym (name, action)
+ char *name;
+ void (*action) (struct minimal_symbol *);
+ {
+
+ struct objfile *objfile;
+ struct minimal_symbol m, *msymbol = &m;
+ char *mangled_prefix;
+
+ ALL_MSYMBOLS (objfile, msymbol)
+ {
+ if (MSYMBOL_TYPE (msymbol) == mst_text ||
+ MSYMBOL_TYPE (msymbol) == mst_file_text)
+ if (SYMBOL_MATCHES_NAME (msymbol, name))
+ action (msymbol);
+ }
+ }
+
/* Look through all the current minimal symbol tables and find the
first minimal symbol that matches NAME. If OBJF is non-NULL, limit
the search to that objfile. If SFILE is non-NULL, limit the search
Index: gdb/language.c
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/language.c gdb/language.c
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/language.c Fri Oct 29 15:41:44 1999
--- gdb/language.c Thu Nov 11 09:19:17 1999
***************
*** 64,75 ****
--- 64,84 ----
set_range_command PARAMS ((char *, int));
static void
+ show_case_command PARAMS ((char *, int));
+
+ static void
+ set_case_command PARAMS ((char *, int));
+
+ static void
set_range_str PARAMS ((void));
static void
set_type_str PARAMS ((void));
static void
+ set_case_str PARAMS ((void));
+
+ static void
set_lang_str PARAMS ((void));
static void
***************
*** 85,91 ****
set_check PARAMS ((char *, int));
static void
! set_type_range PARAMS ((void));
static void
unk_lang_emit_char PARAMS ((int c, GDB_FILE * stream, int quoter));
--- 94,100 ----
set_check PARAMS ((char *, int));
static void
! set_type_range_case PARAMS ((void));
static void
unk_lang_emit_char PARAMS ((int c, GDB_FILE * stream, int quoter));
***************
*** 122,127 ****
--- 131,138 ----
enum range_check range_check = range_check_off;
enum type_mode type_mode = type_mode_auto;
enum type_check type_check = type_check_off;
+ enum case_mode_type case_mode = case_mode_auto;
+ enum case_sensitivity_type case_sensitivity = case_sensitive_on;
/* The current language and language_mode (see language.h) */
***************
*** 140,146 ****
static unsigned languages_allocsize;
#define DEFAULT_ALLOCSIZE 4
! /* The "set language/type/range" commands all put stuff in these
buffers. This is to make them work as set/show commands. The
user's string is copied here, then the set_* commands look at
them and update them to something that looks nice when it is
--- 151,157 ----
static unsigned languages_allocsize;
#define DEFAULT_ALLOCSIZE 4
! /* The "set language/type/range/case" commands all put stuff in these
buffers. This is to make them work as set/show commands. The
user's string is copied here, then the set_* commands look at
them and update them to something that looks nice when it is
***************
*** 149,154 ****
--- 160,166 ----
static char *language;
static char *type;
static char *range;
+ static char *case_sensitive;
/* Warning issued when current_language and the language of the current
frame do not match. */
***************
*** 232,238 ****
/* Enter manual mode. Set the specified language. */
language_mode = language_mode_manual;
current_language = languages[i];
! set_type_range ();
set_lang_str ();
expected_language = current_language;
return;
--- 244,250 ----
/* Enter manual mode. Set the specified language. */
language_mode = language_mode_manual;
current_language = languages[i];
! set_type_range_case ();
set_lang_str ();
expected_language = current_language;
return;
***************
*** 284,292 ****
else if (STREQ (type, "auto"))
{
type_mode = type_mode_auto;
! set_type_range ();
/* Avoid hitting the set_type_str call below. We
! did it in set_type_range. */
return;
}
else
--- 296,304 ----
else if (STREQ (type, "auto"))
{
type_mode = type_mode_auto;
! set_type_range_case ();
/* Avoid hitting the set_type_str call below. We
! did it in set_type_range_case. */
return;
}
else
***************
*** 334,342 ****
else if (STREQ (range, "auto"))
{
range_mode = range_mode_auto;
! set_type_range ();
/* Avoid hitting the set_range_str call below. We
! did it in set_type_range. */
return;
}
else
--- 346,354 ----
else if (STREQ (range, "auto"))
{
range_mode = range_mode_auto;
! set_type_range_case ();
/* Avoid hitting the set_range_str call below. We
! did it in set_type_range_case. */
return;
}
else
***************
*** 347,358 ****
show_range_command ((char *) 0, from_tty);
}
! /* Set the status of range and type checking based on
! the current modes and the current language.
If SHOW is non-zero, then print out the current language,
type and range checking status. */
static void
! set_type_range ()
{
if (range_mode == range_mode_auto)
--- 359,413 ----
show_range_command ((char *) 0, from_tty);
}
! static void
! show_case_command (ignore, from_tty)
! char *ignore;
! int from_tty;
! {
! if (case_sensitivity != current_language->la_case_sensitivity)
! printf_unfiltered (
! "Warning: the current case sensitivity setting does not match the language.\n");
! }
!
! /* Set command. Change the setting for type checking. */
! static void
! set_case_command (ignore, from_tty)
! char *ignore;
! int from_tty;
! {
! if (STREQ (case_sensitive, "on"))
! {
! case_sensitivity = case_sensitive_on;
! case_mode = case_mode_manual;
! }
! else if (STREQ (case_sensitive, "off"))
! {
! case_sensitivity = case_sensitive_off;
! case_mode = case_mode_manual;
! }
! else if (STREQ (case_sensitive, "auto"))
! {
! case_mode = case_mode_auto;
! set_type_range_case ();
! /* Avoid hitting the set_str_case call below. We
! did it in set_type_range_case. */
! return;
! }
! else
! {
! warning ("Unrecognized case-sensitive setting: \"%s\"", case_sensitive);
! }
!
! set_case_str ();
! show_case_command ((char *) NULL, from_tty);
! }
!
! /* Set the status of range and type checking as well as case sensitivity
! based on the current modes and the current language.
If SHOW is non-zero, then print out the current language,
type and range checking status. */
static void
! set_type_range_case ()
{
if (range_mode == range_mode_auto)
***************
*** 361,368 ****
--- 416,427 ----
if (type_mode == type_mode_auto)
type_check = current_language->la_type_check;
+ if (case_mode == case_mode_auto)
+ case_sensitivity = current_language->la_case_sensitivity;
+
set_type_str ();
set_range_str ();
+ set_case_str ();
}
/* Set current language to (enum language) LANG. Returns previous language. */
***************
*** 381,387 ****
if (languages[i]->la_language == lang)
{
current_language = languages[i];
! set_type_range ();
set_lang_str ();
break;
}
--- 440,446 ----
if (languages[i]->la_language == lang)
{
current_language = languages[i];
! set_type_range_case ();
set_lang_str ();
break;
}
***************
*** 409,415 ****
{
char *tmp = NULL, *prefix = "";
- free (type);
if (type_mode == type_mode_auto)
prefix = "auto; currently ";
--- 468,473 ----
***************
*** 428,440 ****
error ("Unrecognized type check setting.");
}
type = concat (prefix, tmp, NULL);
}
static void
set_range_str ()
{
! char *tmp, *pref = "";
if (range_mode == range_mode_auto)
pref = "auto; currently ";
--- 486,499 ----
error ("Unrecognized type check setting.");
}
+ free (type);
type = concat (prefix, tmp, NULL);
}
static void
set_range_str ()
{
! char *tmp = NULL, *pref = "";
if (range_mode == range_mode_auto)
pref = "auto; currently ";
***************
*** 458,463 ****
--- 517,545 ----
range = concat (pref, tmp, NULL);
}
+ static void
+ set_case_str ()
+ {
+ char *tmp = NULL, *prefix = "";
+
+ if (case_mode == case_mode_auto)
+ prefix = "auto; currently ";
+
+ switch (case_sensitivity)
+ {
+ case case_sensitive_on:
+ tmp = "on";
+ break;
+ case case_sensitive_off:
+ tmp = "off";
+ break;
+ default:
+ error ("Unrecognized case-sensitive setting.");
+ }
+
+ free (case_sensitive);
+ case_sensitive = concat (prefix, tmp, NULL);
+ }
/* Print out the current language settings: language, range and
type checking. If QUIETLY, print only what has changed. */
***************
*** 479,484 ****
--- 561,568 ----
show_type_command ((char *) 0, 1);
printf_unfiltered ("Range checking: %s\n", range);
show_range_command ((char *) 0, 1);
+ printf_unfiltered ("Case sensitivity: %s\n", case_sensitive);
+ show_case_command ((char *) 0, 1);
}
}
***************
*** 1448,1453 ****
--- 1532,1538 ----
&unknown_builtin_types[0],
range_check_off,
type_check_off,
+ case_sensitive_on,
unk_lang_parser,
unk_lang_error,
evaluate_subexp_standard,
***************
*** 1477,1482 ****
--- 1562,1568 ----
&unknown_builtin_types[0],
range_check_off,
type_check_off,
+ case_sensitive_on,
unk_lang_parser,
unk_lang_error,
evaluate_subexp_standard,
***************
*** 1505,1510 ****
--- 1591,1597 ----
&unknown_builtin_types[0],
range_check_off,
type_check_off,
+ case_sensitive_on,
unk_lang_parser,
unk_lang_error,
evaluate_subexp_standard,
***************
*** 1571,1576 ****
--- 1658,1672 ----
set->function.cfunc = set_range_command;
show->function.cfunc = show_range_command;
+ set = add_set_cmd ("case-sensitive", class_support, var_string_noescape,
+ (char *) &case_sensitive,
+ "Set case sensitivity in name search. (on/off/auto)\n\
+ For Fortran the default is off; for other languages the default is on.",
+ &setlist);
+ show = add_show_from_set (set, &showlist);
+ set->function.cfunc = set_case_command;
+ show->function.cfunc = show_case_command;
+
add_language (&unknown_language_defn);
add_language (&local_language_defn);
add_language (&auto_language_defn);
***************
*** 1578,1587 ****
language = savestring ("auto", strlen ("auto"));
range = savestring ("auto", strlen ("auto"));
type = savestring ("auto", strlen ("auto"));
/* Have the above take effect */
! set_language_command (language, 0);
! set_type_command (NULL, 0);
! set_range_command (NULL, 0);
}
--- 1674,1682 ----
language = savestring ("auto", strlen ("auto"));
range = savestring ("auto", strlen ("auto"));
type = savestring ("auto", strlen ("auto"));
+ case_sensitive = savestring ("auto", strlen ("auto"));
/* Have the above take effect */
! set_language (language_auto);
}
Index: gdb/language.h
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/language.h gdb/language.h
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/language.h Fri Oct 29 15:41:45 1999
--- gdb/language.h Thu Nov 11 09:19:17 1999
***************
*** 80,85 ****
--- 80,105 ----
type_check_off, type_check_warn, type_check_on
}
type_check;
+
+ /* case_mode_type ==
+ case_mode_auto: case_sensitivity set upon selection of scope
+ case_mode_manual: case_sensitivity set only by user. */
+
+ extern enum case_mode_type
+ {
+ case_mode_auto, case_mode_manual
+ }
+ case_mode;
+
+ /* case_sensitivity_type ==
+ case_sensitive_on: Case sensitivity in name matching is used
+ case_sensitive_off: Case sensitivity in name matching is not used */
+
+ extern enum case_sensitivity_type
+ {
+ case_sensitive_on, case_sensitive_off
+ }
+ case_sensitivity;
/* Information for doing language dependent formatting of printed values. */
***************
*** 138,143 ****
--- 158,167 ----
/* Default type checking */
enum type_check la_type_check;
+
+ /* Default case sensitivity */
+
+ enum case_sensitivity_type la_case_sensitivity;
/* Parser function. */
Index: gdb/c-lang.c
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/c-lang.c gdb/c-lang.c
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/c-lang.c Wed Nov 10 11:02:27 1999
--- gdb/c-lang.c Wed Nov 10 11:04:38 1999
***************
*** 421,426 ****
--- 421,427 ----
c_builtin_types,
range_check_off,
type_check_off,
+ case_sensitive_on,
c_parse,
c_error,
evaluate_subexp_standard,
***************
*** 472,477 ****
--- 473,479 ----
cplus_builtin_types,
range_check_off,
type_check_off,
+ case_sensitive_on,
c_parse,
c_error,
evaluate_subexp_standard,
***************
*** 500,505 ****
--- 502,508 ----
c_builtin_types,
range_check_off,
type_check_off,
+ case_sensitive_on,
c_parse,
c_error,
evaluate_subexp_standard,
Index: gdb/ch-lang.c
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/ch-lang.c gdb/ch-lang.c
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/ch-lang.c Wed Nov 10 11:02:54 1999
--- gdb/ch-lang.c Wed Nov 10 11:06:24 1999
***************
*** 407,413 ****
value_chill_length (val)
value_ptr val;
{
! LONGEST tmp;
struct type *type = VALUE_TYPE (val);
struct type *ttype;
CHECK_TYPEDEF (type);
--- 407,413 ----
value_chill_length (val)
value_ptr val;
{
! LONGEST tmp = 0;
struct type *type = VALUE_TYPE (val);
struct type *ttype;
CHECK_TYPEDEF (type);
***************
*** 464,470 ****
{
LONGEST tmp = 0;
struct type *type = VALUE_TYPE (val);
! struct type *elttype;
CHECK_TYPEDEF (type);
if (TYPE_CODE (type) == TYPE_CODE_SET)
--- 464,470 ----
{
LONGEST tmp = 0;
struct type *type = VALUE_TYPE (val);
! struct type *elttype = NULL;
CHECK_TYPEDEF (type);
if (TYPE_CODE (type) == TYPE_CODE_SET)
***************
*** 629,634 ****
--- 629,635 ----
chill_builtin_types,
range_check_on,
type_check_on,
+ case_sensitive_on,
chill_parse, /* parser */
chill_error, /* parser error function */
evaluate_subexp_chill,
Index: gdb/f-lang.c
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/f-lang.c gdb/f-lang.c
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/f-lang.c Wed Nov 10 11:02:57 1999
--- gdb/f-lang.c Wed Nov 10 11:07:45 1999
***************
*** 470,475 ****
--- 470,476 ----
f_builtin_types,
range_check_on,
type_check_on,
+ case_sensitive_off,
f_parse, /* parser */
f_error, /* parser error function */
evaluate_subexp_standard,
Index: gdb/jv-lang.c
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/jv-lang.c gdb/jv-lang.c
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/jv-lang.c Wed Nov 10 11:02:59 1999
--- gdb/jv-lang.c Wed Nov 10 11:09:34 1999
***************
*** 268,275 ****
value_ptr utf8_name;
char *nptr;
CORE_ADDR addr;
- struct block *bl;
- int i;
int is_array = 0;
type = check_typedef (VALUE_TYPE (clas));
--- 268,273 ----
***************
*** 1065,1070 ****
--- 1063,1069 ----
c_builtin_types,
range_check_off,
type_check_off,
+ case_sensitive_on,
java_parse,
java_error,
evaluate_subexp_java,
Index: gdb/m2-lang.c
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/m2-lang.c gdb/m2-lang.c
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/m2-lang.c Wed Nov 10 11:03:02 1999
--- gdb/m2-lang.c Wed Nov 10 11:26:42 1999
***************
*** 424,429 ****
--- 424,430 ----
m2_builtin_types,
range_check_on,
type_check_on,
+ case_sensitive_on,
m2_parse, /* parser */
m2_error, /* parser error function */
evaluate_subexp_standard,
Index: gdb/scm-lang.c
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/scm-lang.c gdb/scm-lang.c
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/scm-lang.c Wed Nov 10 11:03:03 1999
--- gdb/scm-lang.c Wed Nov 10 11:27:40 1999
***************
*** 249,254 ****
--- 249,255 ----
c_builtin_types,
range_check_off,
type_check_off,
+ case_sensitive_on,
scm_parse,
c_error,
evaluate_subexp_scm,
Index: gdb/breakpoint.c
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/breakpoint.c gdb/breakpoint.c
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/breakpoint.c Wed Nov 10 10:25:35 1999
--- gdb/breakpoint.c Thu Nov 11 09:21:20 1999
***************
*** 143,149 ****
set_breakpoint_count PARAMS ((int));
static struct expression *
! save_breakpoint_condition PARAMS ((struct expression *));
#if 0
static struct breakpoint *
--- 143,149 ----
set_breakpoint_count PARAMS ((int));
static struct expression *
! save_breakpoint_condition PARAMS ((struct expression *));
#if 0
static struct breakpoint *
***************
*** 221,227 ****
static void create_fork_vfork_event_catchpoint PARAMS ((int tempflag,
char *cond_string,
! enum bptype bp_kind));
static void break_at_finish_at_depth_command_1 PARAMS ((char *arg,
int flag,
--- 221,227 ----
static void create_fork_vfork_event_catchpoint PARAMS ((int tempflag,
char *cond_string,
! enum bptype bp_kind));
static void break_at_finish_at_depth_command_1 PARAMS ((char *arg,
int flag,
***************
*** 1063,1069 ****
val = target_insert_exec_catchpoint (inferior_pid);
break;
default:
! val = -1;
break;
}
if (val < 0)
--- 1063,1069 ----
val = target_insert_exec_catchpoint (inferior_pid);
break;
default:
! val = -1;
break;
}
if (val < 0)
***************
*** 3742,3748 ****
}
/* cover routine for parse_exp_1 */
! int
cover_parse_exp_1 (args)
args_for_parse_exp_1 *args;
{
--- 3742,3748 ----
}
/* cover routine for parse_exp_1 */
! int
cover_parse_exp_1 (args)
args_for_parse_exp_1 *args;
{
***************
*** 3751,3757 ****
}
/* cover routine for decode_line_1 */
! int
cover_decode_line_1 (args)
args_for_decode_line_1 *args;
{
--- 3751,3757 ----
}
/* cover routine for decode_line_1 */
! int
cover_decode_line_1 (args)
args_for_decode_line_1 *args;
{
***************
*** 3759,3765 ****
1,
(struct symtab *) NULL,
0,
! args->canonical_p);
return 1;
}
--- 3759,3766 ----
1,
(struct symtab *) NULL,
0,
! args->canonical_p,
! ALL_SYMBOLS);
return 1;
}
***************
*** 3976,3982 ****
int thread = -1; /* All threads. */
/* Set a breakpoint on the specified hook. */
! sals = decode_line_1 (&hookname, 1, (struct symtab *) NULL, 0, &canonical);
addr_end = hookname;
if (sals.nelts == 0)
--- 3977,3984 ----
int thread = -1; /* All threads. */
/* Set a breakpoint on the specified hook. */
! sals = decode_line_1 (&hookname, 1, (struct symtab *) NULL, 0, &canonical,
! USER_CHOICE);
addr_end = hookname;
if (sals.nelts == 0)
***************
*** 4050,4056 ****
char *cond_string;
{
solib_load_unload_1 (hookname, tempflag, dll_pathname,
! cond_string, bp_catch_load);
}
void
--- 4052,4058 ----
char *cond_string;
{
solib_load_unload_1 (hookname, tempflag, dll_pathname,
! cond_string, bp_catch_load);
}
void
***************
*** 4491,4499 ****
&& (!current_source_symtab
|| (arg && (*arg == '+' || *arg == '-'))))
sals = decode_line_1 (&arg, 1, default_breakpoint_symtab,
! default_breakpoint_line, &canonical);
else
! sals = decode_line_1 (&arg, 1, (struct symtab *) NULL, 0, &canonical);
addr_end = arg;
}
--- 4493,4503 ----
&& (!current_source_symtab
|| (arg && (*arg == '+' || *arg == '-'))))
sals = decode_line_1 (&arg, 1, default_breakpoint_symtab,
! default_breakpoint_line, &canonical,
! USER_CHOICE);
else
! sals = decode_line_1 (&arg, 1, (struct symtab *) NULL, 0, &canonical,
! USER_CHOICE);
addr_end = arg;
}
***************
*** 4864,4873 ****
beg_addr_string = addr_string;
sals = decode_line_1 (&addr_string, 1, (struct symtab *) NULL, 0,
! (char ***) NULL);
free (beg_addr_string);
old_chain = make_cleanup (free, sals.sals);
for (i = 0; (i < sals.nelts); i++)
{
--- 4868,4882 ----
beg_addr_string = addr_string;
sals = decode_line_1 (&addr_string, 1, (struct symtab *) NULL, 0,
! (char ***) NULL, USER_CHOICE);
free (beg_addr_string);
+ /* srikanth, 981001, CLLbs15582 decode_line_1 used not to return
+ if arg is bogus. However this has changed ... */
+ if (sals.nelts == 0)
+ error ("Function \"%s\" not defined.", symbol);
+
old_chain = make_cleanup (free, sals.sals);
for (i = 0; (i < sals.nelts); i++)
{
***************
*** 5230,5236 ****
#ifdef GDB_TARGET_IS_HPPA
&& (!frame)
#endif
! )
b->type = bp_type;
else
b->type = bp_watchpoint;
--- 5239,5245 ----
#ifdef GDB_TARGET_IS_HPPA
&& (!frame)
#endif
! )
b->type = bp_type;
else
b->type = bp_watchpoint;
***************
*** 5410,5419 ****
if (default_breakpoint_valid)
sals = decode_line_1 (&arg, 1, default_breakpoint_symtab,
! default_breakpoint_line, (char ***) NULL);
else
sals = decode_line_1 (&arg, 1, (struct symtab *) NULL,
! 0, (char ***) NULL);
if (sals.nelts != 1)
error ("Couldn't get information on specified line.");
--- 5419,5429 ----
if (default_breakpoint_valid)
sals = decode_line_1 (&arg, 1, default_breakpoint_symtab,
! default_breakpoint_line, (char ***) NULL,
! USER_CHOICE);
else
sals = decode_line_1 (&arg, 1, (struct symtab *) NULL,
! 0, (char ***) NULL, USER_CHOICE);
if (sals.nelts != 1)
error ("Couldn't get information on specified line.");
***************
*** 6419,6424 ****
--- 6429,6439 ----
{
sals = decode_line_spec (arg, 1);
+ /* srikanth, 981001, CLLbs15582, decode_line_spec() used not to
+ return if arg is not found, but now it does.... */
+ if (sals.nelts == 0)
+ error ("Location not found.");
+
default_match = 0;
}
else
***************
*** 6830,6836 ****
input_radix = b->input_radix;
s = b->addr_string;
symbol = s; /* preserve original as decode_line_1 will advance pointer */
! sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0, (char ***) NULL);
for (i = 0; i < sals.nelts; i++)
{
resolve_sal_pc (&sals.sals[i]);
--- 6845,6853 ----
input_radix = b->input_radix;
s = b->addr_string;
symbol = s; /* preserve original as decode_line_1 will advance pointer */
! sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0, (char ***) NULL,
! USER_CHOICE);
!
for (i = 0; i < sals.nelts; i++)
{
resolve_sal_pc (&sals.sals[i]);
***************
*** 7425,7434 ****
sals = decode_line_1 (&string, funfirstline,
default_breakpoint_symtab,
default_breakpoint_line,
! (char ***) NULL);
else
sals = decode_line_1 (&string, funfirstline,
! (struct symtab *) NULL, 0, (char ***) NULL);
if (*string)
error ("Junk at end of line specification: %s", string);
return sals;
--- 7442,7452 ----
sals = decode_line_1 (&string, funfirstline,
default_breakpoint_symtab,
default_breakpoint_line,
! (char ***) NULL, USER_CHOICE);
else
sals = decode_line_1 (&string, funfirstline,
! (struct symtab *) NULL, 0, (char ***) NULL,
! USER_CHOICE);
if (*string)
error ("Junk at end of line specification: %s", string);
return sals;
Index: gdb/source.c
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/source.c gdb/source.c
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/source.c Thu Nov 4 10:49:28 1999
--- gdb/source.c Wed Nov 10 11:34:31 1999
***************
*** 1199,1205 ****
dummy_beg = 1;
else
{
! sals = decode_line_1 (&arg1, 0, 0, 0, 0);
if (!sals.nelts)
return; /* C++ */
--- 1199,1205 ----
dummy_beg = 1;
else
{
! sals = decode_line_1 (&arg1, 0, 0, 0, 0, USER_CHOICE);
if (!sals.nelts)
return; /* C++ */
***************
*** 1232,1240 ****
else
{
if (dummy_beg)
! sals_end = decode_line_1 (&arg1, 0, 0, 0, 0);
else
! sals_end = decode_line_1 (&arg1, 0, sal.symtab, sal.line, 0);
if (sals_end.nelts == 0)
return;
if (sals_end.nelts > 1)
--- 1232,1241 ----
else
{
if (dummy_beg)
! sals_end = decode_line_1 (&arg1, 0, 0, 0, 0, USER_CHOICE);
else
! sals_end = decode_line_1 (&arg1, 0, sal.symtab, sal.line, 0,
! USER_CHOICE);
if (sals_end.nelts == 0)
return;
if (sals_end.nelts > 1)
Index: gdb/tracepoint.c
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/tracepoint.c gdb/tracepoint.c
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/tracepoint.c Wed Nov 10 11:29:50 1999
--- gdb/tracepoint.c Thu Nov 11 09:27:40 1999
***************
*** 64,76 ****
extern void x_command PARAMS ((char *, int));
extern int addressprint; /* Print machine addresses? */
! /* GDB commands implemented in other modules:
! */
extern void output_command PARAMS ((char *, int));
extern void registers_info PARAMS ((char *, int));
! extern void args_info PARAMS ((char *, int));
! extern void locals_info PARAMS ((char *, int));
/* If this definition isn't overridden by the header files, assume
--- 64,75 ----
extern void x_command PARAMS ((char *, int));
extern int addressprint; /* Print machine addresses? */
! /* GDB commands implemented in other modules: */
extern void output_command PARAMS ((char *, int));
extern void registers_info PARAMS ((char *, int));
! extern void args_info PARAMS ((char *, int));
! extern void locals_info PARAMS ((char *, int));
/* If this definition isn't overridden by the header files, assume
***************
*** 154,160 ****
struct collection_list;
static void add_aexpr PARAMS ((struct collection_list *, struct agent_expr *));
static unsigned char *mem2hex (unsigned char *, unsigned char *, int);
! static void add_register PARAMS ((struct collection_list * collection,
unsigned int regno));
static void free_actions_list PARAMS ((char **actions_list));
static void free_actions_list_cleanup_wrapper PARAMS ((void *));
--- 153,159 ----
struct collection_list;
static void add_aexpr PARAMS ((struct collection_list *, struct agent_expr *));
static unsigned char *mem2hex (unsigned char *, unsigned char *, int);
! static void add_register PARAMS ((struct collection_list * collection,
unsigned int regno));
static void free_actions_list PARAMS ((char **actions_list));
static void free_actions_list_cleanup_wrapper PARAMS ((void *));
***************
*** 401,407 ****
printf_filtered ("TRACE %s\n", arg);
addr_start = arg;
! sals = decode_line_1 (&arg, 1, (struct symtab *) NULL, 0, &canonical);
addr_end = arg;
if (!sals.nelts)
return; /* ??? Presumably decode_line_1 has already warned? */
--- 400,407 ----
printf_filtered ("TRACE %s\n", arg);
addr_start = arg;
! sals = decode_line_1 (&arg, 1, (struct symtab *) NULL, 0, &canonical,
! USER_CHOICE);
addr_end = arg;
if (!sals.nelts)
return; /* ??? Presumably decode_line_1 has already warned? */
***************
*** 556,562 ****
{
struct tracepoint *t2;
! if (t == NULL) /* no tracepoint operand */
return;
switch (opcode)
--- 556,562 ----
{
struct tracepoint *t2;
! if (t == NULL) /* no tracepoint operand */
return;
switch (opcode)
***************
*** 716,722 ****
if (*args && strncasecmp (args, "all", 3) == 0)
{
! args += 3; /* skip special argument "all" */
all = 1;
if (*args)
error ("Junk at end of arguments.");
--- 716,722 ----
if (*args && strncasecmp (args, "all", 3) == 0)
{
! args += 3; /* skip special argument "all" */
all = 1;
if (*args)
error ("Junk at end of arguments.");
***************
*** 730,745 ****
{
ALL_TRACEPOINTS (t2)
if (t1 == (struct tracepoint *) -1 || t1 == t2)
! {
! t2->pass_count = count;
! if (modify_tracepoint_hook)
! modify_tracepoint_hook (t2);
! if (from_tty)
! printf_filtered ("Setting tracepoint %d's passcount to %d\n",
! t2->number, count);
! }
}
! if (! all)
t1 = get_tracepoint_by_number (&args, 1);
}
while (*args);
--- 730,745 ----
{
ALL_TRACEPOINTS (t2)
if (t1 == (struct tracepoint *) -1 || t1 == t2)
! {
! t2->pass_count = count;
! if (modify_tracepoint_hook)
! modify_tracepoint_hook (t2);
! if (from_tty)
! printf_filtered ("Setting tracepoint %d's passcount to %d\n",
! t2->number, count);
! }
}
! if (!all)
t1 = get_tracepoint_by_number (&args, 1);
}
while (*args);
***************
*** 1055,1061 ****
struct memrange
{
! int type; /* 0 for absolute memory range, else basereg number */
bfd_signed_vma start;
bfd_signed_vma end;
};
--- 1055,1061 ----
struct memrange
{
! int type; /* 0 for absolute memory range, else basereg number */
bfd_signed_vma start;
bfd_signed_vma end;
};
***************
*** 1215,1221 ****
sprintf_vma (tmp, offset);
printf_filtered ("LOC_STATIC %s: collect %ld bytes at %s.\n",
! SYMBOL_NAME (sym), len, tmp /* address */);
}
add_memrange (collect, -1, offset, len); /* 0 == memory */
break;
--- 1215,1221 ----
sprintf_vma (tmp, offset);
printf_filtered ("LOC_STATIC %s: collect %ld bytes at %s.\n",
! SYMBOL_NAME (sym), len, tmp /* address */ );
}
add_memrange (collect, -1, offset, len); /* 0 == memory */
break;
***************
*** 1320,1326 ****
switch (SYMBOL_CLASS (sym))
{
default:
! warning ("don't know how to trace local symbol %s",
SYMBOL_NAME (sym));
case LOC_LOCAL:
case LOC_STATIC:
--- 1320,1326 ----
switch (SYMBOL_CLASS (sym))
{
default:
! warning ("don't know how to trace local symbol %s",
SYMBOL_NAME (sym));
case LOC_LOCAL:
case LOC_STATIC:
***************
*** 1418,1426 ****
sprintf_vma (tmp2, list->list[i].start);
if (info_verbose)
{
! printf_filtered ("(%d, %s, %ld)\n",
! list->list[i].type,
! tmp2,
(long) (list->list[i].end - list->list[i].start));
}
if (count + 27 > MAX_AGENT_EXPR_LEN)
--- 1418,1426 ----
sprintf_vma (tmp2, list->list[i].start);
if (info_verbose)
{
! printf_filtered ("(%d, %s, %ld)\n",
! list->list[i].type,
! tmp2,
(long) (list->list[i].end - list->list[i].start));
}
if (count + 27 > MAX_AGENT_EXPR_LEN)
***************
*** 1431,1437 ****
end = temp_buf;
}
! sprintf (end, "M%X,%s,%lX",
list->list[i].type,
tmp2,
(long) (list->list[i].end - list->list[i].start));
--- 1431,1437 ----
end = temp_buf;
}
! sprintf (end, "M%X,%s,%lX",
list->list[i].type,
tmp2,
(long) (list->list[i].end - list->list[i].start));
***************
*** 1719,1725 ****
size = bfd_get_section_size_before_reloc (s);
sprintf_vma (tmp1, lma);
sprintf_vma (tmp2, lma + size);
! sprintf (target_buf + strlen (target_buf),
":%s,%s", tmp1, tmp2);
}
if (anysecs)
--- 1719,1725 ----
size = bfd_get_section_size_before_reloc (s);
sprintf_vma (tmp1, lma);
sprintf_vma (tmp2, lma + size);
! sprintf (target_buf + strlen (target_buf),
":%s,%s", tmp1, tmp2);
}
if (anysecs)
***************
*** 1762,1768 ****
char tmp[40];
sprintf_vma (tmp, t->address);
! sprintf (buf, "QTDP:%x:%s:%c:%x:%x", t->number, tmp, /* address */
t->enabled == enabled ? 'E' : 'D',
t->step_count, t->pass_count);
--- 1762,1768 ----
char tmp[40];
sprintf_vma (tmp, t->address);
! sprintf (buf, "QTDP:%x:%s:%c:%x:%x", t->number, tmp, /* address */
t->enabled == enabled ? 'E' : 'D',
t->step_count, t->pass_count);
***************
*** 1788,1794 ****
{
QUIT; /* allow user to bail out with ^C */
sprintf (buf, "QTDP:-%x:%s:%s%c",
! t->number, tmp, /* address */
tdp_actions[ndx],
((tdp_actions[ndx + 1] || stepping_actions)
? '-' : 0));
--- 1788,1794 ----
{
QUIT; /* allow user to bail out with ^C */
sprintf (buf, "QTDP:-%x:%s:%s%c",
! t->number, tmp, /* address */
tdp_actions[ndx],
((tdp_actions[ndx + 1] || stepping_actions)
? '-' : 0));
***************
*** 1804,1810 ****
{
QUIT; /* allow user to bail out with ^C */
sprintf (buf, "QTDP:-%x:%s:%s%s%s",
! t->number, tmp, /* address */
((ndx == 0) ? "S" : ""),
stepping_actions[ndx],
(stepping_actions[ndx + 1] ? "-" : ""));
--- 1804,1810 ----
{
QUIT; /* allow user to bail out with ^C */
sprintf (buf, "QTDP:-%x:%s:%s%s%s",
! t->number, tmp, /* address */
((ndx == 0) ? "S" : ""),
stepping_actions[ndx],
(stepping_actions[ndx + 1] ? "-" : ""));
***************
*** 2139,2145 ****
struct symtabs_and_lines sals;
struct symtab_and_line sal;
struct cleanup *old_chain;
! char startpc_str[40], endpc_str[40];
if (target_is_remote ())
{
--- 2139,2145 ----
struct symtabs_and_lines sals;
struct symtab_and_line sal;
struct cleanup *old_chain;
! char startpc_str[40], endpc_str[40];
if (target_is_remote ())
{
***************
*** 2232,2238 ****
if (target_is_remote ())
{
if (args == 0 || *args == 0)
! { /* XXX FIXME: what should default behavior be? */
printf_filtered ("Usage: tfind range <startaddr>,<endaddr>\n");
return;
}
--- 2232,2238 ----
if (target_is_remote ())
{
if (args == 0 || *args == 0)
! { /* XXX FIXME: what should default behavior be? */
printf_filtered ("Usage: tfind range <startaddr>,<endaddr>\n");
return;
}
***************
*** 2273,2279 ****
if (target_is_remote ())
{
if (args == 0 || *args == 0)
! { /* XXX FIXME: what should default behavior be? */
printf_filtered ("Usage: tfind outside <startaddr>,<endaddr>\n");
return;
}
--- 2273,2279 ----
if (target_is_remote ())
{
if (args == 0 || *args == 0)
! { /* XXX FIXME: what should default behavior be? */
printf_filtered ("Usage: tfind outside <startaddr>,<endaddr>\n");
return;
}
***************
*** 2388,2394 ****
if (args == 0 || *args == 0)
error ("requires an argument (function, line or *addr) to define a scope");
! sals = decode_line_1 (&args, 1, NULL, 0, &canonical);
if (sals.nelts == 0)
return; /* presumably decode_line_1 has already warned */
--- 2388,2394 ----
if (args == 0 || *args == 0)
error ("requires an argument (function, line or *addr) to define a scope");
! sals = decode_line_1 (&args, 1, NULL, 0, &canonical, USER_CHOICE);
if (sals.nelts == 0)
return; /* presumably decode_line_1 has already warned */
Index: gdb/config/pa/tm-hppa.h
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/config/pa/tm-hppa.h gdb/config/pa/tm-hppa.h
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/config/pa/tm-hppa.h Tue Nov 2 16:04:12 1999
--- gdb/config/pa/tm-hppa.h Wed Nov 10 12:06:11 1999
***************
*** 146,152 ****
top byte of the address for all 1's. Sigh.
*/
#define PC_REQUIRES_RUN_BEFORE_USE(pc) \
! (! target_has_stack && (pc & 0xFF000000))
/* return instruction is bv r0(rp) or bv,n r0(rp) */
--- 146,152 ----
top byte of the address for all 1's. Sigh.
*/
#define PC_REQUIRES_RUN_BEFORE_USE(pc) \
! (! target_has_stack && ((pc & 0xFF000000) == 0xFF000000))
/* return instruction is bv r0(rp) or bv,n r0(rp) */
***************
*** 331,337 ****
else \
memcpy ((VALBUF), \
(char *)(REGBUF) + REGISTER_BYTE (28) + \
! (TYPE_LENGTH (TYPE) > 4 ? (8 - TYPE_LENGTH (TYPE)) : (4 - TYPE_LENGTH (TYPE))), \
TYPE_LENGTH (TYPE)); \
}
--- 331,337 ----
else \
memcpy ((VALBUF), \
(char *)(REGBUF) + REGISTER_BYTE (28) + \
! (TYPE_LENGTH (TYPE) > 4 ? (8 - TYPE_LENGTH (TYPE)) : (REGISTER_SIZE - TYPE_LENGTH (TYPE))), \
TYPE_LENGTH (TYPE)); \
}
***************
*** 810,815 ****
--- 810,817 ----
|| (strncmp ((symname), "$PIC", 4) == 0) \
|| ((symname)[0] == '$' && isdigit ((symname)[1])) \
))
+
+ #define FAT_FREE_PSYMTABS
/* Here's how to step off a permanent breakpoint. */
#define SKIP_PERMANENT_BREAKPOINT (hppa_skip_permanent_breakpoint)