This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] C++ patches
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: [PATCH] C++ patches
- From: Daniel Berlin <dan at cgsoftware dot com>
- Date: Wed, 6 Sep 2000 21:35:46 -0700 (PDT)
Here's an update to the C++ patches i sent earlier in august. Sorry it's
taken so long. Life got in the way multiple times.
I've rerun indent on the files this affects, because the formatting has
gotten way out of whack with the GNU standards.
I hope nobody minds, if somebody does, i'll undo the whitespace changes in
my patch
(diff -c3pwBb, remove the unbreaking of lines it did).
Please note we now have one memory leak in lookup_symbol. The demangler
gives us a buffer we never free. I'd need to free it at every exit point
from the function, of which we have 12 right now, all of which end almost
the exact same way (most return fixup_symbol_section(sym), a few just
return sym. Is this incorrect?).
I'm thinking that i'll change it so we just have a label at the end, and
12 gotos, rather than 12 exit points, and do the cleanup of the
buffer there.
It would make it about 50x easier for someone who needed to do something
that requires cleanup when we exit.
If people object to this, i'll take the buffer the demangler gives us,
copy it into some alloca'd memory, and then free it.
I just figured i might as well submit a patch to do some cleanup while i
was in there.
If you want to know what this patch does, or need a baseline since it
includes formatting fixes, please see the earlier message.
--Dan
? config.h
? jv-exp.tab.c
? Makefile
? version.c
? .gdbinit
? msg00199.html
? init.c
? config.status
? f-exp.tab.c
? stamp-h
? c-exp.tab.c
? config.log
? m2-exp.tab.c
? gdb
? p-exp.tab.c
? doc/Makefile
? doc/config.status
? doc/config.log
? gdbserver/Makefile
? gdbserver/config.status
? gdbserver/config.log
? testsuite/Makefile
? testsuite/testrun.log
? testsuite/config.status
? testsuite/testrun.sum
? testsuite/config.log
? testsuite/gdb.asm/Makefile
? testsuite/gdb.asm/config.status
? testsuite/gdb.asm/config.log
? testsuite/gdb.base/Makefile
? testsuite/gdb.base/config.status
? testsuite/gdb.base/config.log
? testsuite/gdb.c++/inherit.ci
? testsuite/gdb.c++/misc.ci
? testsuite/gdb.c++/overload
? testsuite/gdb.c++/anon-union
? testsuite/gdb.c++/ref-types
? testsuite/gdb.c++/Makefile
? testsuite/gdb.c++/derivation
? testsuite/gdb.c++/local
? testsuite/gdb.c++/method
? testsuite/gdb.c++/inherit
? testsuite/gdb.c++/annota2
? testsuite/gdb.c++/overload.ci
? testsuite/gdb.c++/namespace.ci
? testsuite/gdb.c++/config.status
? testsuite/gdb.c++/local.ci
? testsuite/gdb.c++/method.ci
? testsuite/gdb.c++/derivation.ci
? testsuite/gdb.c++/virtfunc
? testsuite/gdb.c++/ambiguous.ci
? testsuite/gdb.c++/misc
? testsuite/gdb.c++/templates.ci
? testsuite/gdb.c++/member-ptr.ci
? testsuite/gdb.c++/config.log
? testsuite/gdb.c++/cplusfuncs
? testsuite/gdb.c++/namespace
? testsuite/gdb.c++/ovldbreak
? testsuite/gdb.c++/cplusfuncs.ci
? testsuite/gdb.c++/virtfunc.ci
? testsuite/gdb.c++/templates
? testsuite/gdb.c++/cttiadd.ci
? testsuite/gdb.chill/Makefile
? testsuite/gdb.chill/config.status
? testsuite/gdb.chill/config.log
? testsuite/gdb.disasm/Makefile
? testsuite/gdb.disasm/config.status
? testsuite/gdb.disasm/config.log
? testsuite/gdb.java/Makefile
? testsuite/gdb.java/config.status
? testsuite/gdb.java/config.log
? testsuite/gdb.mi/Makefile
? testsuite/gdb.mi/config.status
? testsuite/gdb.mi/config.log
? testsuite/gdb.stabs/Makefile
? testsuite/gdb.stabs/config.status
? testsuite/gdb.stabs/config.log
? testsuite/gdb.threads/config.h
? testsuite/gdb.threads/Makefile
? testsuite/gdb.threads/config.status
? testsuite/gdb.threads/config.log
? testsuite/gdb.trace/Makefile
? testsuite/gdb.trace/config.status
? testsuite/gdb.trace/config.log
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.666
diff -c -3 -p -r1.666 ChangeLog
*** ChangeLog 2000/09/06 23:39:15 1.666
--- ChangeLog 2000/09/07 04:25:31
*************** Fri Aug 25 12:03:15 2000 David Taylor
*** 430,436 ****
--- 430,456 ----
* value.h (struct value) <lazy>: Add a comment about its use for
watchpoints.
+
+ 2000-08-10 Daniel Berlin <dberlin@redhat.com>
+ * valops.c (typecmp): Properly handle reference arguments.
+
+ * symtab.h (OPNAME_PREFIX_P): Change operator prefix to correct value.
+
+ * symtab.c (decode_line_1): Properly handle complex templates
+ without quoting.
+ (completion_list_add_name): Fix completion problems
+ with C++ completions.
+ (lookup_partial_symbol): Remove linear search for C++.
+ (lookup_symbol): Record blocks we've already checked. Also,
+ demangle names before searching.
+ (lookup_block_symbol): Stop using linear search for C++.
+ (gdb_mangle_name): Properly handle operators.
+
+ * symfile.c (compare_symbols): Use SYMBOL_SOURCE_NAME instead of
+ SYMBOL_NAME.
+ (compare_psymbols): Same here.
+
2000-08-12 Kevin Buettner <kevinb@redhat.com>
* cxux-nat.c (fetch_inferior_registers): Protoize.
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.18
diff -c -3 -p -r1.18 symfile.c
*** symfile.c 2000/09/02 00:09:06 1.18
--- symfile.c 2000/09/07 04:25:31
*************** extern int hp_cxx_exception_support_init
*** 64,72 ****
int (*ui_load_progress_hook) (const char *section, unsigned long num);
void (*show_load_progress) (const char *section,
! unsigned long section_sent,
! unsigned long section_size,
! unsigned long total_sent,
unsigned long total_size);
void (*pre_add_symbol_hook) (char *);
void (*post_add_symbol_hook) (void);
--- 64,72 ----
int (*ui_load_progress_hook) (const char *section, unsigned long num);
void (*show_load_progress) (const char *section,
! unsigned long section_sent,
! unsigned long section_size,
! unsigned long total_sent,
unsigned long total_size);
void (*pre_add_symbol_hook) (char *);
void (*post_add_symbol_hook) (void);
*************** static void clear_symtab_users_cleanup (
*** 77,94 ****
/* Global variables owned by this file */
int readnow_symbol_files; /* Read full symbols immediately */
! struct complaint oldsyms_complaint =
! {
"Replacing old symbols for `%s'", 0, 0
};
! struct complaint empty_symtab_complaint =
! {
"Empty symbol table found for `%s'", 0, 0
};
! struct complaint unknown_option_complaint =
! {
"Unknown option `%s' ignored", 0, 0
};
--- 77,91 ----
/* Global variables owned by this file */
int readnow_symbol_files; /* Read full symbols immediately */
! struct complaint oldsyms_complaint = {
"Replacing old symbols for `%s'", 0, 0
};
! struct complaint empty_symtab_complaint = {
"Empty symbol table found for `%s'", 0, 0
};
! struct complaint unknown_option_complaint = {
"Unknown option `%s' ignored", 0, 0
};
*************** compare_symbols (const PTR s1p, const PT
*** 212,219 ****
s1 = (struct symbol **) s1p;
s2 = (struct symbol **) s2p;
!
! return (STRCMP (SYMBOL_NAME (*s1), SYMBOL_NAME (*s2)));
}
/*
--- 209,215 ----
s1 = (struct symbol **) s1p;
s2 = (struct symbol **) s2p;
! return (STRCMP (SYMBOL_SOURCE_NAME (*s1), SYMBOL_SOURCE_NAME (*s2)));
}
/*
*************** compare_symbols (const PTR s1p, const PT
*** 241,249 ****
static int
compare_psymbols (const PTR s1p, const PTR s2p)
{
! register char *st1 = SYMBOL_NAME (*(struct partial_symbol **) s1p);
! register char *st2 = SYMBOL_NAME (*(struct partial_symbol **) s2p);
if ((st1[0] - st2[0]) || !st1[0])
{
return (st1[0] - st2[0]);
--- 237,251 ----
static int
compare_psymbols (const PTR s1p, const PTR s2p)
{
! register struct partial_symbol **s1, **s2;
! register char *st1, *st2;
+ s1 = (struct partial_symbol **) s1p;
+ s2 = (struct partial_symbol **) s2p;
+ st1 = SYMBOL_SOURCE_NAME (*s1);
+ st2 = SYMBOL_SOURCE_NAME (*s2);
+
+
if ((st1[0] - st2[0]) || !st1[0])
{
return (st1[0] - st2[0]);
*************** init_entry_point_info (struct objfile *o
*** 413,420 ****
/* Get current entry point address. */
! CORE_ADDR
! entry_point_address (void)
{
return symfile_objfile ? symfile_objfile->ei.entry_point : 0;
}
--- 415,421 ----
/* Get current entry point address. */
! CORE_ADDR entry_point_address (void)
{
return symfile_objfile ? symfile_objfile->ei.entry_point : 0;
}
*************** entry_point_address (void)
*** 429,435 ****
lowest-addressed loadable section. */
void
! find_lowest_section (bfd *abfd, asection *sect, PTR obj)
{
asection **lowest = (asection **) obj;
--- 430,436 ----
lowest-addressed loadable section. */
void
! find_lowest_section (bfd * abfd, asection * sect, PTR obj)
{
asection **lowest = (asection **) obj;
*************** find_lowest_section (bfd *abfd, asection
*** 451,457 ****
extern struct section_addr_info *
build_section_addr_info_from_section_table (const struct section_table *start,
! const struct section_table *end)
{
struct section_addr_info *sap;
const struct section_table *stp;
--- 452,458 ----
extern struct section_addr_info *
build_section_addr_info_from_section_table (const struct section_table *start,
! const struct section_table *end)
{
struct section_addr_info *sap;
const struct section_table *stp;
*************** default_symfile_offsets (struct objfile
*** 512,522 ****
caller. */
for (i = 0; i < MAX_SECTIONS && addrs->other[i].name; i++)
{
! struct other_sections *osp ;
! osp = &addrs->other[i] ;
if (osp->addr == 0)
! continue;
/* Record all sections in offsets */
/* The section_offsets in the objfile are here filled in using
--- 513,523 ----
caller. */
for (i = 0; i < MAX_SECTIONS && addrs->other[i].name; i++)
{
! struct other_sections *osp;
! osp = &addrs->other[i];
if (osp->addr == 0)
! continue;
/* Record all sections in offsets */
/* The section_offsets in the objfile are here filled in using
*************** default_symfile_offsets (struct objfile
*** 528,546 ****
.rodata sections. */
sect = bfd_get_section_by_name (objfile->obfd, ".text");
! if (sect)
objfile->sect_index_text = sect->index;
sect = bfd_get_section_by_name (objfile->obfd, ".data");
! if (sect)
objfile->sect_index_data = sect->index;
sect = bfd_get_section_by_name (objfile->obfd, ".bss");
! if (sect)
objfile->sect_index_bss = sect->index;
sect = bfd_get_section_by_name (objfile->obfd, ".rodata");
! if (sect)
objfile->sect_index_rodata = sect->index;
}
--- 529,547 ----
.rodata sections. */
sect = bfd_get_section_by_name (objfile->obfd, ".text");
! if (sect)
objfile->sect_index_text = sect->index;
sect = bfd_get_section_by_name (objfile->obfd, ".data");
! if (sect)
objfile->sect_index_data = sect->index;
sect = bfd_get_section_by_name (objfile->obfd, ".bss");
! if (sect)
objfile->sect_index_bss = sect->index;
sect = bfd_get_section_by_name (objfile->obfd, ".rodata");
! if (sect)
objfile->sect_index_rodata = sect->index;
}
*************** syms_from_objfile (struct objfile *objfi
*** 591,597 ****
{
/* We will modify the main symbol table, make sure that all its users
will be cleaned up if an error occurs during symbol reading. */
! make_cleanup (clear_symtab_users_cleanup, 0 /*ignore*/);
/* Since no error yet, throw away the old symbol table. */
--- 592,598 ----
{
/* We will modify the main symbol table, make sure that all its users
will be cleaned up if an error occurs during symbol reading. */
! make_cleanup (clear_symtab_users_cleanup, 0 /*ignore */ );
/* Since no error yet, throw away the old symbol table. */
*************** syms_from_objfile (struct objfile *objfi
*** 619,675 ****
{
/* Find lowest loadable section to be used as starting point for
continguous sections. FIXME!! won't work without call to find
! .text first, but this assumes text is lowest section. */
lower_sect = bfd_get_section_by_name (objfile->obfd, ".text");
if (lower_sect == NULL)
bfd_map_over_sections (objfile->obfd, find_lowest_section,
! (PTR) &lower_sect);
if (lower_sect == NULL)
warning ("no loadable sections found in added symbol-file %s",
objfile->name);
! else
! if ((bfd_get_section_flags (objfile->obfd, lower_sect) & SEC_CODE) == 0)
! warning ("Lowest section in %s is %s at %s",
! objfile->name,
! bfd_section_name (objfile->obfd, lower_sect),
! paddr (bfd_section_vma (objfile->obfd, lower_sect)));
if (lower_sect != NULL)
! lower_offset = bfd_section_vma (objfile->obfd, lower_sect);
else
! lower_offset = 0;
!
! /* Calculate offsets for the loadable sections.
! FIXME! Sections must be in order of increasing loadable section
! so that contiguous sections can use the lower-offset!!!
!
! Adjust offsets if the segments are not contiguous.
! If the section is contiguous, its offset should be set to
! the offset of the highest loadable section lower than it
! (the loadable section directly below it in memory).
! this_offset = lower_offset = lower_addr - lower_orig_addr */
! /* Calculate offsets for sections. */
! for (i=0 ; i < MAX_SECTIONS && addrs->other[i].name; i++)
{
if (addrs->other[i].addr != 0)
! {
! sect = bfd_get_section_by_name (objfile->obfd, addrs->other[i].name);
! if (sect)
! {
! addrs->other[i].addr -= bfd_section_vma (objfile->obfd, sect);
! lower_offset = addrs->other[i].addr;
/* This is the index used by BFD. */
! addrs->other[i].sectindex = sect->index ;
! }
! else
{
! warning ("section %s not found in %s", addrs->other[i].name,
objfile->name);
addrs->other[i].addr = 0;
}
! }
! else
! addrs->other[i].addr = lower_offset;
}
}
--- 620,678 ----
{
/* Find lowest loadable section to be used as starting point for
continguous sections. FIXME!! won't work without call to find
! .text first, but this assumes text is lowest section. */
lower_sect = bfd_get_section_by_name (objfile->obfd, ".text");
if (lower_sect == NULL)
bfd_map_over_sections (objfile->obfd, find_lowest_section,
! (PTR) & lower_sect);
if (lower_sect == NULL)
warning ("no loadable sections found in added symbol-file %s",
objfile->name);
! else
! if ((bfd_get_section_flags (objfile->obfd, lower_sect) & SEC_CODE) ==
! 0)
! warning ("Lowest section in %s is %s at %s", objfile->name,
! bfd_section_name (objfile->obfd, lower_sect),
! paddr (bfd_section_vma (objfile->obfd, lower_sect)));
if (lower_sect != NULL)
! lower_offset = bfd_section_vma (objfile->obfd, lower_sect);
else
! lower_offset = 0;
!
! /* Calculate offsets for the loadable sections.
! FIXME! Sections must be in order of increasing loadable section
! so that contiguous sections can use the lower-offset!!!
!
! Adjust offsets if the segments are not contiguous.
! If the section is contiguous, its offset should be set to
! the offset of the highest loadable section lower than it
! (the loadable section directly below it in memory).
! this_offset = lower_offset = lower_addr - lower_orig_addr */
! /* Calculate offsets for sections. */
! for (i = 0; i < MAX_SECTIONS && addrs->other[i].name; i++)
{
if (addrs->other[i].addr != 0)
! {
! sect =
! bfd_get_section_by_name (objfile->obfd, addrs->other[i].name);
! if (sect)
! {
! addrs->other[i].addr -=
! bfd_section_vma (objfile->obfd, sect);
! lower_offset = addrs->other[i].addr;
/* This is the index used by BFD. */
! addrs->other[i].sectindex = sect->index;
! }
! else
{
! warning ("section %s not found in %s", addrs->other[i].name,
objfile->name);
addrs->other[i].addr = 0;
}
! }
! else
! addrs->other[i].addr = lower_offset;
}
}
*************** syms_from_objfile (struct objfile *objfi
*** 705,732 ****
{
struct obj_section *s;
! /* Map section offsets in "addr" back to the object's
! sections by comparing the section names with bfd's
! section names. Then adjust the section address by
! the offset. */ /* for gdb/13815 */
!
ALL_OBJFILE_OSECTIONS (objfile, s)
! {
! CORE_ADDR s_addr = 0;
! int i;
! for (i = 0;
! !s_addr && i < MAX_SECTIONS && addrs->other[i].name;
! i++)
! if (strcmp (s->the_bfd_section->name, addrs->other[i].name) == 0)
! s_addr = addrs->other[i].addr; /* end added for gdb/13815 */
!
! s->addr -= s->offset;
! s->addr += s_addr;
! s->endaddr -= s->offset;
! s->endaddr += s_addr;
! s->offset += s_addr;
! }
}
#endif /* not IBM6000_TARGET */
--- 708,733 ----
{
struct obj_section *s;
! /* Map section offsets in "addr" back to the object's
! sections by comparing the section names with bfd's
! section names. Then adjust the section address by
! the offset. *//* for gdb/13815 */
!
ALL_OBJFILE_OSECTIONS (objfile, s)
! {
! CORE_ADDR s_addr = 0;
! int i;
! for (i = 0; !s_addr && i < MAX_SECTIONS && addrs->other[i].name; i++)
! if (strcmp (s->the_bfd_section->name, addrs->other[i].name) == 0)
! s_addr = addrs->other[i].addr; /* end added for gdb/13815 */
!
! s->addr -= s->offset;
! s->addr += s_addr;
! s->endaddr -= s->offset;
! s->endaddr += s_addr;
! s->offset += s_addr;
! }
}
#endif /* not IBM6000_TARGET */
*************** symbol_file_add (char *name, int from_tt
*** 819,826 ****
if ((have_full_symbols () || have_partial_symbols ())
&& mainline
! && from_tty
! && !query ("Load new symbol table from \"%s\"? ", name))
error ("Not confirmed.");
objfile = allocate_objfile (abfd, flags);
--- 820,826 ----
if ((have_full_symbols () || have_partial_symbols ())
&& mainline
! && from_tty && !query ("Load new symbol table from \"%s\"? ", name))
error ("Not confirmed.");
objfile = allocate_objfile (abfd, flags);
*************** symbol_file_add (char *name, int from_tt
*** 877,884 ****
}
for (psymtab = objfile->psymtabs;
! psymtab != NULL;
! psymtab = psymtab->next)
{
psymtab_to_symtab (psymtab);
}
--- 877,883 ----
}
for (psymtab = objfile->psymtabs;
! psymtab != NULL; psymtab = psymtab->next)
{
psymtab_to_symtab (psymtab);
}
*************** symbol_file_command (char *args, int fro
*** 946,952 ****
symfile_objfile = NULL;
if (from_tty)
! printf_unfiltered ("No symbol file now.\n");
#ifdef HPUXHPPA
RESET_HP_UX_GLOBALS ();
#endif
--- 945,951 ----
symfile_objfile = NULL;
if (from_tty)
! printf_unfiltered ("No symbol file now.\n");
#ifdef HPUXHPPA
RESET_HP_UX_GLOBALS ();
#endif
*************** symbol_file_command (char *args, int fro
*** 962,986 ****
{
if (STREQ (*argv, "-mapped"))
flags |= OBJF_MAPPED;
! else
! if (STREQ (*argv, "-readnow"))
! flags |= OBJF_READNOW;
! else
! if (**argv == '-')
! error ("unknown option `%s'", *argv);
! else
! {
! name = *argv;
! symbol_file_add (name, from_tty, NULL, 1, flags);
#ifdef HPUXHPPA
! RESET_HP_UX_GLOBALS ();
#endif
! /* Getting new symbols may change our opinion about
! what is frameless. */
! reinit_frame_cache ();
! set_initial_language ();
! }
argv++;
}
--- 961,983 ----
{
if (STREQ (*argv, "-mapped"))
flags |= OBJF_MAPPED;
! else if (STREQ (*argv, "-readnow"))
! flags |= OBJF_READNOW;
! else if (**argv == '-')
! error ("unknown option `%s'", *argv);
! else
! {
! name = *argv;
! symbol_file_add (name, from_tty, NULL, 1, flags);
#ifdef HPUXHPPA
! RESET_HP_UX_GLOBALS ();
#endif
! /* Getting new symbols may change our opinion about
! what is frameless. */
! reinit_frame_cache ();
! set_initial_language ();
! }
argv++;
}
*************** symfile_bfd_open (char *name)
*** 1043,1049 ****
name = tilde_expand (name); /* Returns 1st new malloc'd copy */
/* Look down path for it, allocate 2nd new malloc'd copy. */
! desc = openp (getenv ("PATH"), 1, name, O_RDONLY | O_BINARY, 0, &absolute_name);
#if defined(__GO32__) || defined(_WIN32)
if (desc < 0)
{
--- 1040,1047 ----
name = tilde_expand (name); /* Returns 1st new malloc'd copy */
/* Look down path for it, allocate 2nd new malloc'd copy. */
! desc =
! openp (getenv ("PATH"), 1, name, O_RDONLY | O_BINARY, 0, &absolute_name);
#if defined(__GO32__) || defined(_WIN32)
if (desc < 0)
{
*************** generic_load (char *args, int from_tty)
*** 1231,1238 ****
/* Is this really necessary? I guess it gives the user something
to look at during a long download. */
#ifdef UI_OUT
! ui_out_message (uiout, 0, "Loading section %s, size 0x%s lma 0x%s\n",
! sect_name, paddr_nz (size), paddr_nz (lma));
#else
fprintf_unfiltered (gdb_stdout,
"Loading section %s, size 0x%s lma 0x%s\n",
--- 1229,1237 ----
/* Is this really necessary? I guess it gives the user something
to look at during a long download. */
#ifdef UI_OUT
! ui_out_message (uiout, 0,
! "Loading section %s, size 0x%s lma 0x%s\n",
! sect_name, paddr_nz (size), paddr_nz (lma));
#else
fprintf_unfiltered (gdb_stdout,
"Loading section %s, size 0x%s lma 0x%s\n",
*************** generic_load (char *args, int from_tty)
*** 1255,1269 ****
if (validate_download)
{
/* Broken memories and broken monitors manifest
! themselves here when bring new computers to
! life. This doubles already slow downloads. */
/* NOTE: cagney/1999-10-18: A more efficient
! implementation might add a verify_memory()
! method to the target vector and then use
! that. remote.c could implement that method
! using the ``qCRC'' packet. */
char *check = xmalloc (len);
! struct cleanup *verify_cleanups = make_cleanup (free, check);
if (target_read_memory (lma, check, len) != 0)
error ("Download verify read failed at 0x%s",
paddr (lma));
--- 1254,1269 ----
if (validate_download)
{
/* Broken memories and broken monitors manifest
! themselves here when bring new computers to
! life. This doubles already slow downloads. */
/* NOTE: cagney/1999-10-18: A more efficient
! implementation might add a verify_memory()
! method to the target vector and then use
! that. remote.c could implement that method
! using the ``qCRC'' packet. */
char *check = xmalloc (len);
! struct cleanup *verify_cleanups =
! make_cleanup (free, check);
if (target_read_memory (lma, check, len) != 0)
error ("Download verify read failed at 0x%s",
paddr (lma));
*************** generic_load (char *args, int from_tty)
*** 1271,1277 ****
error ("Download verify compare failed at 0x%s",
paddr (lma));
do_cleanups (verify_cleanups);
! }
data_count += len;
lma += len;
buffer += len;
--- 1271,1277 ----
error ("Download verify compare failed at 0x%s",
paddr (lma));
do_cleanups (verify_cleanups);
! }
data_count += len;
lma += len;
buffer += len;
*************** generic_load (char *args, int from_tty)
*** 1284,1295 ****
error ("Canceled the download");
if (show_load_progress != NULL)
! show_load_progress (sect_name, sent, size, total_sent, total_size);
}
while (sent < size);
if (err != 0)
! error ("Memory access error while loading section %s.", sect_name);
do_cleanups (old_chain);
}
--- 1284,1297 ----
error ("Canceled the download");
if (show_load_progress != NULL)
! show_load_progress (sect_name, sent, size, total_sent,
! total_size);
}
while (sent < size);
if (err != 0)
! error ("Memory access error while loading section %s.",
! sect_name);
do_cleanups (old_chain);
}
*************** generic_load (char *args, int from_tty)
*** 1301,1311 ****
CORE_ADDR entry;
entry = bfd_get_start_address (loadfile_bfd);
#ifdef UI_OUT
! ui_out_text (uiout, "Start address ");
! ui_out_field_fmt (uiout, "address", "0x%s" , paddr_nz (entry));
! ui_out_text (uiout, ", load size ");
! ui_out_field_fmt (uiout, "load-size", "%ld" , data_count);
! ui_out_text (uiout, "\n");
#else
fprintf_unfiltered (gdb_stdout,
--- 1303,1313 ----
CORE_ADDR entry;
entry = bfd_get_start_address (loadfile_bfd);
#ifdef UI_OUT
! ui_out_text (uiout, "Start address ");
! ui_out_field_fmt (uiout, "address", "0x%s", paddr_nz (entry));
! ui_out_text (uiout, ", load size ");
! ui_out_field_fmt (uiout, "load-size", "%ld", data_count);
! ui_out_text (uiout, "\n");
#else
fprintf_unfiltered (gdb_stdout,
*************** void
*** 1339,1345 ****
report_transfer_performance (unsigned long data_count, time_t start_time,
time_t end_time)
{
! print_transfer_performance (gdb_stdout, data_count, end_time - start_time, 0);
}
void
--- 1341,1348 ----
report_transfer_performance (unsigned long data_count, time_t start_time,
time_t end_time)
{
! print_transfer_performance (gdb_stdout, data_count, end_time - start_time,
! 0);
}
void
*************** print_transfer_performance (struct ui_fi
*** 1352,1365 ****
ui_out_text (uiout, "Transfer rate: ");
if (time_count > 0)
{
! ui_out_field_fmt (uiout, "transfer-rate", "%ld",
(data_count * 8) / time_count);
ui_out_text (uiout, " bits/sec");
}
else
{
ui_out_field_fmt (uiout, "transferred-bits", "%ld", (data_count * 8));
! ui_out_text (uiout, " bits in <1 sec");
}
if (write_count > 0)
{
--- 1355,1368 ----
ui_out_text (uiout, "Transfer rate: ");
if (time_count > 0)
{
! ui_out_field_fmt (uiout, "transfer-rate", "%ld",
(data_count * 8) / time_count);
ui_out_text (uiout, " bits/sec");
}
else
{
ui_out_field_fmt (uiout, "transferred-bits", "%ld", (data_count * 8));
! ui_out_text (uiout, " bits in <1 sec");
}
if (write_count > 0)
{
*************** print_transfer_performance (struct ui_fi
*** 1371,1381 ****
#else
fprintf_unfiltered (stream, "Transfer rate: ");
if (time_count > 0)
! fprintf_unfiltered (stream, "%ld bits/sec", (data_count * 8) / time_count);
else
fprintf_unfiltered (stream, "%ld bits in <1 sec", (data_count * 8));
if (write_count > 0)
! fprintf_unfiltered (stream, ", %ld bytes/write", data_count / write_count);
fprintf_unfiltered (stream, ".\n");
#endif
}
--- 1374,1386 ----
#else
fprintf_unfiltered (stream, "Transfer rate: ");
if (time_count > 0)
! fprintf_unfiltered (stream, "%ld bits/sec",
! (data_count * 8) / time_count);
else
fprintf_unfiltered (stream, "%ld bits in <1 sec", (data_count * 8));
if (write_count > 0)
! fprintf_unfiltered (stream, ", %ld bytes/write",
! data_count / write_count);
fprintf_unfiltered (stream, ".\n");
#endif
}
*************** add_symbol_file_command (char *args, int
*** 1408,1414 ****
{
char *name;
char *value;
! } sect_opts[SECT_OFF_MAX];
struct section_addr_info section_addrs;
struct cleanup *my_cleanups;
--- 1413,1420 ----
{
char *name;
char *value;
! }
! sect_opts[SECT_OFF_MAX];
struct section_addr_info section_addrs;
struct cleanup *my_cleanups;
*************** add_symbol_file_command (char *args, int
*** 1449,1502 ****
filename = tilde_expand (arg);
my_cleanups = make_cleanup (free, filename);
}
else
! if (argcnt == 1)
! {
! /* The second argument is always the text address at which
! to load the program. */
! sect_opts[section_index].name = ".text";
! sect_opts[section_index].value = arg;
! section_index++;
! }
! else
! {
! /* It's an option (starting with '-') or it's an argument
! to an option */
! if (*arg == '-')
! {
! if (strcmp (arg, "-mapped") == 0)
! flags |= OBJF_MAPPED;
! else
! if (strcmp (arg, "-readnow") == 0)
! flags |= OBJF_READNOW;
! else
! if (strcmp (arg, "-s") == 0)
! {
! if (section_index >= SECT_OFF_MAX)
! error ("Too many sections specified.");
! expecting_sec_name = 1;
! expecting_sec_addr = 1;
! }
! }
! else
! {
! if (expecting_sec_name)
! {
! sect_opts[section_index].name = arg;
! expecting_sec_name = 0;
! }
! else
! if (expecting_sec_addr)
! {
! sect_opts[section_index].value = arg;
! expecting_sec_addr = 0;
! section_index++;
! }
! else
! error ("USAGE: add-symbol-file <filename> <textaddress> [-mapped] [-readnow] [-s <secname> <addr>]*");
! }
! }
argcnt++;
}
--- 1455,1505 ----
filename = tilde_expand (arg);
my_cleanups = make_cleanup (free, filename);
}
+ else if (argcnt == 1)
+ {
+ /* The second argument is always the text address at which
+ to load the program. */
+ sect_opts[section_index].name = ".text";
+ sect_opts[section_index].value = arg;
+ section_index++;
+ }
else
! {
! /* It's an option (starting with '-') or it's an argument
! to an option */
! if (*arg == '-')
! {
! if (strcmp (arg, "-mapped") == 0)
! flags |= OBJF_MAPPED;
! else if (strcmp (arg, "-readnow") == 0)
! flags |= OBJF_READNOW;
! else if (strcmp (arg, "-s") == 0)
! {
! if (section_index >= SECT_OFF_MAX)
! error ("Too many sections specified.");
! expecting_sec_name = 1;
! expecting_sec_addr = 1;
! }
! }
! else
! {
! if (expecting_sec_name)
! {
! sect_opts[section_index].name = arg;
! expecting_sec_name = 0;
! }
! else if (expecting_sec_addr)
! {
! sect_opts[section_index].value = arg;
! expecting_sec_addr = 0;
! section_index++;
! }
! else
! error
! ("USAGE: add-symbol-file <filename> <textaddress> [-mapped] [-readnow] [-s <secname> <addr>]*");
! }
! }
argcnt++;
}
*************** add_symbol_file_command (char *args, int
*** 1505,1521 ****
functions. We have to split this up into separate print
statements because local_hex_string returns a local static
string. */
!
printf_filtered ("add symbol table from file \"%s\" at\n", filename);
for (i = 0; i < section_index; i++)
{
CORE_ADDR addr;
char *val = sect_opts[i].value;
char *sec = sect_opts[i].name;
!
val = sect_opts[i].value;
if (val[0] == '0' && val[1] == 'x')
! addr = strtoul (val+2, NULL, 16);
else
addr = strtoul (val, NULL, 10);
--- 1508,1524 ----
functions. We have to split this up into separate print
statements because local_hex_string returns a local static
string. */
!
printf_filtered ("add symbol table from file \"%s\" at\n", filename);
for (i = 0; i < section_index; i++)
{
CORE_ADDR addr;
char *val = sect_opts[i].value;
char *sec = sect_opts[i].name;
!
val = sect_opts[i].value;
if (val[0] == '0' && val[1] == 'x')
! addr = strtoul (val + 2, NULL, 16);
else
addr = strtoul (val, NULL, 10);
*************** add_symbol_file_command (char *args, int
*** 1524,1538 ****
section_addrs.other[sec_num].name = sec;
section_addrs.other[sec_num].addr = addr;
printf_filtered ("\t%s_addr = %s\n",
! sec,
! local_hex_string ((unsigned long)addr));
sec_num++;
/* The object's sections are initialized when a
! call is made to build_objfile_section_table (objfile).
! This happens in reread_symbols.
! At this point, we don't know what file type this is,
! so we can't determine what section names are valid. */
}
if (from_tty && (!query ("%s", "")))
--- 1527,1540 ----
section_addrs.other[sec_num].name = sec;
section_addrs.other[sec_num].addr = addr;
printf_filtered ("\t%s_addr = %s\n",
! sec, local_hex_string ((unsigned long) addr));
sec_num++;
/* The object's sections are initialized when a
! call is made to build_objfile_section_table (objfile).
! This happens in reread_symbols.
! At this point, we don't know what file type this is,
! so we can't determine what section names are valid. */
}
if (from_tty && (!query ("%s", "")))
*************** reread_symbols (void)
*** 1615,1621 ****
libraries). */
old_cleanups = make_cleanup_free_objfile (objfile);
/* We need to do this whenever any symbols go away. */
! make_cleanup (clear_symtab_users_cleanup, 0 /*ignore*/);
/* Clean up any state BFD has sitting around. We don't need
to close the descriptor but BFD lacks a way of closing the
--- 1617,1623 ----
libraries). */
old_cleanups = make_cleanup_free_objfile (objfile);
/* We need to do this whenever any symbols go away. */
! make_cleanup (clear_symtab_users_cleanup, 0 /*ignore */ );
/* Clean up any state BFD has sitting around. We don't need
to close the descriptor but BFD lacks a way of closing the
*************** reread_symbols (void)
*** 1635,1642 ****
/* Save the offsets, we will nuke them with the rest of the
psymbol_obstack. */
num_offsets = objfile->num_sections;
! offsets = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS);
! memcpy (offsets, objfile->section_offsets, SIZEOF_SECTION_OFFSETS);
/* Nuke all the state that we will re-read. Much of the following
code which sets things to NULL really is necessary to tell
--- 1637,1646 ----
/* Save the offsets, we will nuke them with the rest of the
psymbol_obstack. */
num_offsets = objfile->num_sections;
! offsets =
! (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS);
! memcpy (offsets, objfile->section_offsets,
! SIZEOF_SECTION_OFFSETS);
/* Nuke all the state that we will re-read. Much of the following
code which sets things to NULL really is necessary to tell
*************** reread_symbols (void)
*** 1695,1702 ****
/* We use the same section offsets as from last time. I'm not
sure whether that is always correct for shared libraries. */
objfile->section_offsets = (struct section_offsets *)
! obstack_alloc (&objfile->psymbol_obstack, SIZEOF_SECTION_OFFSETS);
! memcpy (objfile->section_offsets, offsets, SIZEOF_SECTION_OFFSETS);
objfile->num_sections = num_offsets;
/* What the hell is sym_new_init for, anyway? The concept of
--- 1699,1708 ----
/* We use the same section offsets as from last time. I'm not
sure whether that is always correct for shared libraries. */
objfile->section_offsets = (struct section_offsets *)
! obstack_alloc (&objfile->psymbol_obstack,
! SIZEOF_SECTION_OFFSETS);
! memcpy (objfile->section_offsets, offsets,
! SIZEOF_SECTION_OFFSETS);
objfile->num_sections = num_offsets;
/* What the hell is sym_new_init for, anyway? The concept of
*************** allocate_symtab (char *filename, struct
*** 1926,1933 ****
&objfile->symbol_obstack);
symtab->fullname = NULL;
symtab->language = deduce_language_from_filename (filename);
! symtab->debugformat = obsavestring ("unknown", 7,
! &objfile->symbol_obstack);
/* Hook it to the objfile it comes from */
--- 1932,1938 ----
&objfile->symbol_obstack);
symtab->fullname = NULL;
symtab->language = deduce_language_from_filename (filename);
! symtab->debugformat = obsavestring ("unknown", 7, &objfile->symbol_obstack);
/* Hook it to the objfile it comes from */
*************** start_psymtab_common (struct objfile *ob
*** 2261,2267 ****
psymtab = allocate_psymtab (filename, objfile);
psymtab->section_offsets = section_offsets;
psymtab->textlow = textlow;
! psymtab->texthigh = psymtab->textlow; /* default */
psymtab->globals_offset = global_syms - objfile->global_psymbols.list;
psymtab->statics_offset = static_syms - objfile->static_psymbols.list;
return (psymtab);
--- 2266,2272 ----
psymtab = allocate_psymtab (filename, objfile);
psymtab->section_offsets = section_offsets;
psymtab->textlow = textlow;
! psymtab->texthigh = psymtab->textlow; /* default */
psymtab->globals_offset = global_syms - objfile->global_psymbols.list;
psymtab->statics_offset = static_syms - objfile->static_psymbols.list;
return (psymtab);
*************** start_psymtab_common (struct objfile *ob
*** 2272,2279 ****
void
add_psymbol_to_list (char *name, int namelength, namespace_enum namespace,
! enum address_class class,
! struct psymbol_allocation_list *list, long val, /* Value as a long */
CORE_ADDR coreaddr, /* Value as a CORE_ADDR */
enum language language, struct objfile *objfile)
{
--- 2277,2283 ----
void
add_psymbol_to_list (char *name, int namelength, namespace_enum namespace,
! enum address_class class, struct psymbol_allocation_list *list, long val, /* Value as a long */
CORE_ADDR coreaddr, /* Value as a CORE_ADDR */
enum language language, struct objfile *objfile)
{
*************** add_psymbol_to_list (char *name, int nam
*** 2287,2293 ****
/* Create local copy of the partial symbol */
memcpy (buf, name, namelength);
buf[namelength] = '\0';
! SYMBOL_NAME (&psymbol) = bcache (buf, namelength + 1, &objfile->psymbol_cache);
/* val and coreaddr are mutually exclusive, one of them *will* be zero */
if (val != 0)
{
--- 2291,2298 ----
/* Create local copy of the partial symbol */
memcpy (buf, name, namelength);
buf[namelength] = '\0';
! SYMBOL_NAME (&psymbol) =
! bcache (buf, namelength + 1, &objfile->psymbol_cache);
/* val and coreaddr are mutually exclusive, one of them *will* be zero */
if (val != 0)
{
*************** add_psymbol_to_list (char *name, int nam
*** 2304,2310 ****
SYMBOL_INIT_LANGUAGE_SPECIFIC (&psymbol, language);
/* Stash the partial symbol away in the cache */
! psym = bcache (&psymbol, sizeof (struct partial_symbol), &objfile->psymbol_cache);
/* Save pointer to partial symbol in psymtab, growing symtab if needed. */
if (list->next >= list->list + list->size)
--- 2309,2317 ----
SYMBOL_INIT_LANGUAGE_SPECIFIC (&psymbol, language);
/* Stash the partial symbol away in the cache */
! psym =
! bcache (&psymbol, sizeof (struct partial_symbol),
! &objfile->psymbol_cache);
/* Save pointer to partial symbol in psymtab, growing symtab if needed. */
if (list->next >= list->list + list->size)
*************** add_psymbol_to_list (char *name, int nam
*** 2321,2329 ****
void
add_psymbol_with_dem_name_to_list (char *name, int namelength, char *dem_name,
! int dem_namelength, namespace_enum namespace,
! enum address_class class,
! struct psymbol_allocation_list *list, long val, /* Value as a long */
CORE_ADDR coreaddr, /* Value as a CORE_ADDR */
enum language language,
struct objfile *objfile)
--- 2328,2335 ----
void
add_psymbol_with_dem_name_to_list (char *name, int namelength, char *dem_name,
! int dem_namelength,
! namespace_enum namespace, enum address_class class, struct psymbol_allocation_list *list, long val, /* Value as a long */
CORE_ADDR coreaddr, /* Value as a CORE_ADDR */
enum language language,
struct objfile *objfile)
*************** add_psymbol_with_dem_name_to_list (char
*** 2339,2345 ****
memcpy (buf, name, namelength);
buf[namelength] = '\0';
! SYMBOL_NAME (&psymbol) = bcache (buf, namelength + 1, &objfile->psymbol_cache);
buf = alloca (dem_namelength + 1);
memcpy (buf, dem_name, dem_namelength);
--- 2345,2352 ----
memcpy (buf, name, namelength);
buf[namelength] = '\0';
! SYMBOL_NAME (&psymbol) =
! bcache (buf, namelength + 1, &objfile->psymbol_cache);
buf = alloca (dem_namelength + 1);
memcpy (buf, dem_name, dem_namelength);
*************** add_psymbol_with_dem_name_to_list (char
*** 2375,2381 ****
SYMBOL_INIT_LANGUAGE_SPECIFIC (&psymbol, language);
/* Stash the partial symbol away in the cache */
! psym = bcache (&psymbol, sizeof (struct partial_symbol), &objfile->psymbol_cache);
/* Save pointer to partial symbol in psymtab, growing symtab if needed. */
if (list->next >= list->list + list->size)
--- 2382,2390 ----
SYMBOL_INIT_LANGUAGE_SPECIFIC (&psymbol, language);
/* Stash the partial symbol away in the cache */
! psym =
! bcache (&psymbol, sizeof (struct partial_symbol),
! &objfile->psymbol_cache);
/* Save pointer to partial symbol in psymtab, growing symtab if needed. */
if (list->next >= list->list + list->size)
*************** void (*target_overlay_update) (struct ob
*** 2487,2497 ****
SECTION is loaded at an address different from where it will "run". */
int
! section_is_overlay (asection *section)
{
if (overlay_debugging)
! if (section && section->lma != 0 &&
! section->vma != section->lma)
return 1;
return 0;
--- 2496,2505 ----
SECTION is loaded at an address different from where it will "run". */
int
! section_is_overlay (asection * section)
{
if (overlay_debugging)
! if (section && section->lma != 0 && section->vma != section->lma)
return 1;
return 0;
*************** overlay_is_mapped (struct obj_section *o
*** 2555,2569 ****
Returns true if section is an overlay, and is currently mapped. */
int
! section_is_mapped (asection *section)
{
struct objfile *objfile;
struct obj_section *osect;
if (overlay_debugging)
if (section && section_is_overlay (section))
! ALL_OBJSECTIONS (objfile, osect)
! if (osect->the_bfd_section == section)
return overlay_is_mapped (osect);
return 0;
--- 2563,2576 ----
Returns true if section is an overlay, and is currently mapped. */
int
! section_is_mapped (asection * section)
{
struct objfile *objfile;
struct obj_section *osect;
if (overlay_debugging)
if (section && section_is_overlay (section))
! ALL_OBJSECTIONS (objfile, osect) if (osect->the_bfd_section == section)
return overlay_is_mapped (osect);
return 0;
*************** section_is_mapped (asection *section)
*** 2572,2579 ****
/* Function: pc_in_unmapped_range
If PC falls into the lma range of SECTION, return true, else false. */
! CORE_ADDR
! pc_in_unmapped_range (CORE_ADDR pc, asection *section)
{
int size;
--- 2579,2585 ----
/* Function: pc_in_unmapped_range
If PC falls into the lma range of SECTION, return true, else false. */
! CORE_ADDR pc_in_unmapped_range (CORE_ADDR pc, asection * section)
{
int size;
*************** pc_in_unmapped_range (CORE_ADDR pc, asec
*** 2590,2597 ****
/* Function: pc_in_mapped_range
If PC falls into the vma range of SECTION, return true, else false. */
! CORE_ADDR
! pc_in_mapped_range (CORE_ADDR pc, asection *section)
{
int size;
--- 2596,2602 ----
/* Function: pc_in_mapped_range
If PC falls into the vma range of SECTION, return true, else false. */
! CORE_ADDR pc_in_mapped_range (CORE_ADDR pc, asection * section)
{
int size;
*************** pc_in_mapped_range (CORE_ADDR pc, asecti
*** 2609,2616 ****
Returns the address corresponding to PC in the unmapped (load) range.
May be the same as PC. */
! CORE_ADDR
! overlay_unmapped_address (CORE_ADDR pc, asection *section)
{
if (overlay_debugging)
if (section && section_is_overlay (section) &&
--- 2614,2620 ----
Returns the address corresponding to PC in the unmapped (load) range.
May be the same as PC. */
! CORE_ADDR overlay_unmapped_address (CORE_ADDR pc, asection * section)
{
if (overlay_debugging)
if (section && section_is_overlay (section) &&
*************** overlay_unmapped_address (CORE_ADDR pc,
*** 2624,2631 ****
Returns the address corresponding to PC in the mapped (runtime) range.
May be the same as PC. */
! CORE_ADDR
! overlay_mapped_address (CORE_ADDR pc, asection *section)
{
if (overlay_debugging)
if (section && section_is_overlay (section) &&
--- 2628,2634 ----
Returns the address corresponding to PC in the mapped (runtime) range.
May be the same as PC. */
! CORE_ADDR overlay_mapped_address (CORE_ADDR pc, asection * section)
{
if (overlay_debugging)
if (section && section_is_overlay (section) &&
*************** overlay_mapped_address (CORE_ADDR pc, as
*** 2640,2647 ****
Return one of two addresses (relative to the VMA or to the LMA),
depending on whether the section is mapped or not. */
! CORE_ADDR
! symbol_overlayed_address (CORE_ADDR address, asection *section)
{
if (overlay_debugging)
{
--- 2643,2649 ----
Return one of two addresses (relative to the VMA or to the LMA),
depending on whether the section is mapped or not. */
! CORE_ADDR symbol_overlayed_address (CORE_ADDR address, asection * section)
{
if (overlay_debugging)
{
*************** list_overlays_command (char *args, int f
*** 2722,2729 ****
struct obj_section *osect;
if (overlay_debugging)
! ALL_OBJSECTIONS (objfile, osect)
! if (overlay_is_mapped (osect))
{
const char *name;
bfd_vma lma, vma;
--- 2724,2730 ----
struct obj_section *osect;
if (overlay_debugging)
! ALL_OBJSECTIONS (objfile, osect) if (overlay_is_mapped (osect))
{
const char *name;
bfd_vma lma, vma;
*************** the 'overlay manual' command.");
*** 2770,2776 ****
/* First, find a section matching the user supplied argument */
ALL_OBJSECTIONS (objfile, sec)
! if (!strcmp (bfd_section_name (objfile->obfd, sec->the_bfd_section), args))
{
/* Now, check to see if the section is an overlay. */
bfdsec = sec->the_bfd_section;
--- 2771,2778 ----
/* First, find a section matching the user supplied argument */
ALL_OBJSECTIONS (objfile, sec)
! if (!strcmp
! (bfd_section_name (objfile->obfd, sec->the_bfd_section), args))
{
/* Now, check to see if the section is an overlay. */
bfdsec = sec->the_bfd_section;
*************** the 'overlay manual' command.");
*** 2820,2826 ****
/* First, find a section matching the user supplied argument */
ALL_OBJSECTIONS (objfile, sec)
! if (!strcmp (bfd_section_name (objfile->obfd, sec->the_bfd_section), args))
{
if (!sec->ovly_mapped)
error ("Section %s is not mapped", args);
--- 2822,2829 ----
/* First, find a section matching the user supplied argument */
ALL_OBJSECTIONS (objfile, sec)
! if (!strcmp
! (bfd_section_name (objfile->obfd, sec->the_bfd_section), args))
{
if (!sec->ovly_mapped)
error ("Section %s is not mapped", args);
*************** static CORE_ADDR cache_ovly_table_base =
*** 2938,2946 ****
static CORE_ADDR cache_ovly_region_table_base = 0;
#endif
enum ovly_index
! {
! VMA, SIZE, LMA, MAPPED
! };
#define TARGET_LONG_BYTES (TARGET_LONG_BIT / TARGET_CHAR_BIT)
/* Throw away the cached copy of _ovly_table */
--- 2941,2949 ----
static CORE_ADDR cache_ovly_region_table_base = 0;
#endif
enum ovly_index
! {
! VMA, SIZE, LMA, MAPPED
! };
#define TARGET_LONG_BYTES (TARGET_LONG_BIT / TARGET_CHAR_BIT)
/* Throw away the cached copy of _ovly_table */
*************** simple_read_overlay_table (void)
*** 2994,3000 ****
cache_novlys = read_memory_integer (SYMBOL_VALUE_ADDRESS (msym), 4);
else
return 0; /* failure */
! cache_ovly_table = (void *) xmalloc (cache_novlys * sizeof (*cache_ovly_table));
if (cache_ovly_table != NULL)
{
msym = lookup_minimal_symbol ("_ovly_table", 0, 0);
--- 2997,3004 ----
cache_novlys = read_memory_integer (SYMBOL_VALUE_ADDRESS (msym), 4);
else
return 0; /* failure */
! cache_ovly_table =
! (void *) xmalloc (cache_novlys * sizeof (*cache_ovly_table));
if (cache_ovly_table != NULL)
{
msym = lookup_minimal_symbol ("_ovly_table", 0, 0);
*************** simple_read_overlay_table (void)
*** 3002,3009 ****
{
cache_ovly_table_base = SYMBOL_VALUE_ADDRESS (msym);
read_target_long_array (cache_ovly_table_base,
! (int *) cache_ovly_table,
! cache_novlys * 4);
}
else
return 0; /* failure */
--- 3006,3012 ----
{
cache_ovly_table_base = SYMBOL_VALUE_ADDRESS (msym);
read_target_long_array (cache_ovly_table_base,
! (int *) cache_ovly_table, cache_novlys * 4);
}
else
return 0; /* failure */
*************** simple_read_overlay_region_table (void)
*** 3024,3030 ****
simple_free_overlay_region_table ();
msym = lookup_minimal_symbol ("_novly_regions", 0, 0);
if (msym != NULL)
! cache_novly_regions = read_memory_integer (SYMBOL_VALUE_ADDRESS (msym), 4);
else
return 0; /* failure */
cache_ovly_region_table = (void *) xmalloc (cache_novly_regions * 12);
--- 3027,3034 ----
simple_free_overlay_region_table ();
msym = lookup_minimal_symbol ("_novly_regions", 0, 0);
if (msym != NULL)
! cache_novly_regions =
! read_memory_integer (SYMBOL_VALUE_ADDRESS (msym), 4);
else
return 0; /* failure */
cache_ovly_region_table = (void *) xmalloc (cache_novly_regions * 12);
*************** simple_overlay_update_1 (struct obj_sect
*** 3063,3070 ****
size = bfd_get_section_size_before_reloc (osect->the_bfd_section);
for (i = 0; i < cache_novlys; i++)
if (cache_ovly_table[i][VMA] == osect->the_bfd_section->vma &&
! cache_ovly_table[i][LMA] == osect->the_bfd_section->lma /* &&
! cache_ovly_table[i][SIZE] == size */ )
{
read_target_long_array (cache_ovly_table_base + i * TARGET_LONG_BYTES,
(int *) cache_ovly_table[i], 4);
--- 3067,3074 ----
size = bfd_get_section_size_before_reloc (osect->the_bfd_section);
for (i = 0; i < cache_novlys; i++)
if (cache_ovly_table[i][VMA] == osect->the_bfd_section->vma &&
! cache_ovly_table[i][LMA] == osect->the_bfd_section->lma /* &&
! cache_ovly_table[i][SIZE] == size */ )
{
read_target_long_array (cache_ovly_table_base + i * TARGET_LONG_BYTES,
(int *) cache_ovly_table[i], 4);
*************** with the text. SECT is a section name to
*** 3157,3178 ****
c = add_cmd ("add-shared-symbol-files", class_files,
add_shared_symbol_files_command,
! "Load the symbols from shared objects in the dynamic linker's link map.",
&cmdlist);
c = add_alias_cmd ("assf", "add-shared-symbol-files", class_files, 1,
&cmdlist);
c = add_cmd ("load", class_files, load_command,
"Dynamically load FILE into the running program, and record its symbols\n\
! for access from GDB.", &cmdlist);
c->completer = filename_completer;
add_show_from_set
(add_set_cmd ("symbol-reloading", class_support, var_boolean,
(char *) &symbol_reloading,
! "Set dynamic symbol table reloading multiple times in one run.",
! &setlist),
! &showlist);
add_prefix_cmd ("overlay", class_support, overlay_command,
"Commands for debugging overlays.", &overlaylist,
--- 3161,3182 ----
c = add_cmd ("add-shared-symbol-files", class_files,
add_shared_symbol_files_command,
! "Load the symbols from shared objects in the dynamic linker's link map.",
&cmdlist);
c = add_alias_cmd ("assf", "add-shared-symbol-files", class_files, 1,
&cmdlist);
c = add_cmd ("load", class_files, load_command,
"Dynamically load FILE into the running program, and record its symbols\n\
! for access from GDB.",
! &cmdlist);
c->completer = filename_completer;
add_show_from_set
(add_set_cmd ("symbol-reloading", class_support, var_boolean,
(char *) &symbol_reloading,
! "Set dynamic symbol table reloading multiple times in one run.",
! &setlist), &showlist);
add_prefix_cmd ("overlay", class_support, overlay_command,
"Commands for debugging overlays.", &overlaylist,
*************** Usage: set extension-language .foo bar",
*** 3219,3225 ****
"target. Specify zero, or a negative value, to disable\n"
"blocked writes. The actual size of each transfer is also\n"
"limited by the size of the target packet and the memory\n"
! "cache.\n",
! &setlist),
! &showlist);
}
--- 3223,3227 ----
"target. Specify zero, or a negative value, to disable\n"
"blocked writes. The actual size of each transfer is also\n"
"limited by the size of the target packet and the memory\n"
! "cache.\n", &setlist), &showlist);
}
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.15
diff -c -3 -p -r1.15 symtab.c
*** symtab.c 2000/09/04 08:29:25 1.15
--- symtab.c 2000/09/07 04:25:32
*************** struct type *builtin_type_error;
*** 117,123 ****
const struct block *block_found;
! char no_symtab_msg[] = "No symbol table is loaded. Use the \"file\" command.";
/* 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++
--- 117,124 ----
const struct block *block_found;
! char no_symtab_msg[] =
! "No symbol table is loaded. Use the \"file\" command.";
/* 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++
*************** got_symtab:
*** 148,155 ****
/* First, search for an exact match */
! ALL_SYMTABS (objfile, s)
! if (STREQ (name, s->filename))
return s;
slash = strchr (name, '/');
--- 149,155 ----
/* First, search for an exact match */
! ALL_SYMTABS (objfile, s) if (STREQ (name, s->filename))
return s;
slash = strchr (name, '/');
*************** gdb_mangle_name (struct type *type, int
*** 296,301 ****
--- 296,304 ----
char buf[20];
int len = (newname == NULL ? 0 : strlen (newname));
+ if (OPNAME_PREFIX_P (field_name))
+ return physname;
+
is_full_physname_constructor =
((physname[0] == '_' && physname[1] == '_' &&
(isdigit (physname[2]) || physname[2] == 'Q' || physname[2] == 't'))
*************** gdb_mangle_name (struct type *type, int
*** 331,362 ****
sprintf (buf, "__%s%s%d", const_prefix, volatile_prefix, len);
}
mangled_name_len = ((is_constructor ? 0 : strlen (field_name))
! + strlen (buf) + len
! + strlen (physname)
! + 1);
! /* Only needed for GNU-mangled names. ANSI-mangled names
! work with the normal mechanisms. */
! if (OPNAME_PREFIX_P (field_name))
! {
! const char *opname = cplus_mangle_opname (field_name + 3, 0);
! if (opname == NULL)
! error ("No mangling for \"%s\"", field_name);
! mangled_name_len += strlen (opname);
! mangled_name = (char *) xmalloc (mangled_name_len);
!
! strncpy (mangled_name, field_name, 3);
! mangled_name[3] = '\0';
! strcat (mangled_name, opname);
! }
! else
! {
! mangled_name = (char *) xmalloc (mangled_name_len);
! if (is_constructor)
! mangled_name[0] = '\0';
! else
! strcpy (mangled_name, field_name);
! }
strcat (mangled_name, buf);
/* If the class doesn't have a name, i.e. newname NULL, then we just
mangle it using 0 for the length of the class. Thus it gets mangled
--- 334,348 ----
sprintf (buf, "__%s%s%d", const_prefix, volatile_prefix, len);
}
mangled_name_len = ((is_constructor ? 0 : strlen (field_name))
! + strlen (buf) + len + strlen (physname) + 1);
! {
! mangled_name = (char *) xmalloc (mangled_name_len);
! if (is_constructor)
! mangled_name[0] = '\0';
! else
! strcpy (mangled_name, field_name);
! }
strcat (mangled_name, buf);
/* If the class doesn't have a name, i.e. newname NULL, then we just
mangle it using 0 for the length of the class. Thus it gets mangled
*************** gdb_mangle_name (struct type *type, int
*** 373,379 ****
/* Find which partial symtab on contains PC and SECTION. Return 0 if none. */
struct partial_symtab *
! find_pc_sect_psymtab (CORE_ADDR pc, asection *section)
{
register struct partial_symtab *pst;
register struct objfile *objfile;
--- 359,365 ----
/* Find which partial symtab on contains PC and SECTION. Return 0 if none. */
struct partial_symtab *
! find_pc_sect_psymtab (CORE_ADDR pc, asection * section)
{
register struct partial_symtab *pst;
register struct objfile *objfile;
*************** find_pc_sect_psymtab (CORE_ADDR pc, asec
*** 389,396 ****
many partial symbol tables containing the PC, but
we want the partial symbol table that contains the
function containing the PC. */
! if (!(objfile->flags & OBJF_REORDERED) &&
! section == 0) /* can't validate section this way */
return (pst);
msymbol = lookup_minimal_symbol_by_pc_section (pc, section);
--- 375,381 ----
many partial symbol tables containing the PC, but
we want the partial symbol table that contains the
function containing the PC. */
! if (!(objfile->flags & OBJF_REORDERED) && section == 0) /* can't validate section this way */
return (pst);
msymbol = lookup_minimal_symbol_by_pc_section (pc, section);
*************** find_pc_psymtab (CORE_ADDR pc)
*** 430,436 ****
struct partial_symbol *
find_pc_sect_psymbol (struct partial_symtab *psymtab, CORE_ADDR pc,
! asection *section)
{
struct partial_symbol *best = NULL, *p, **pp;
CORE_ADDR best_pc;
--- 415,421 ----
struct partial_symbol *
find_pc_sect_psymbol (struct partial_symtab *psymtab, CORE_ADDR pc,
! asection * section)
{
struct partial_symbol *best = NULL, *p, **pp;
CORE_ADDR best_pc;
*************** find_pc_sect_psymbol (struct partial_sym
*** 447,455 ****
find_pc_partial_function doesn't use a minimal symbol and thus
cache a bad endaddr. */
for (pp = psymtab->objfile->global_psymbols.list + psymtab->globals_offset;
! (pp - (psymtab->objfile->global_psymbols.list + psymtab->globals_offset)
! < psymtab->n_global_syms);
! pp++)
{
p = *pp;
if (SYMBOL_NAMESPACE (p) == VAR_NAMESPACE
--- 432,439 ----
find_pc_partial_function doesn't use a minimal symbol and thus
cache a bad endaddr. */
for (pp = psymtab->objfile->global_psymbols.list + psymtab->globals_offset;
! (pp - (psymtab->objfile->global_psymbols.list +
! psymtab->globals_offset) < psymtab->n_global_syms); pp++)
{
p = *pp;
if (SYMBOL_NAMESPACE (p) == VAR_NAMESPACE
*************** find_pc_sect_psymbol (struct partial_sym
*** 471,479 ****
}
for (pp = psymtab->objfile->static_psymbols.list + psymtab->statics_offset;
! (pp - (psymtab->objfile->static_psymbols.list + psymtab->statics_offset)
! < psymtab->n_static_syms);
! pp++)
{
p = *pp;
if (SYMBOL_NAMESPACE (p) == VAR_NAMESPACE
--- 455,462 ----
}
for (pp = psymtab->objfile->static_psymbols.list + psymtab->statics_offset;
! (pp - (psymtab->objfile->static_psymbols.list +
! psymtab->statics_offset) < psymtab->n_static_syms); pp++)
{
p = *pp;
if (SYMBOL_NAMESPACE (p) == VAR_NAMESPACE
*************** fixup_psymbol_section (struct partial_sy
*** 550,555 ****
--- 533,546 ----
return psym;
}
+ /* We seem to be looking things up in the same block >1 times, because
+ of the global search.*/
+
+ #define BLOCK_LOOKUP_HASH_SIZE 16
+ static const struct block *checked_blocks[BLOCK_LOOKUP_HASH_SIZE];
+
+
+
/* Find the definition for a specified symbol name NAME
in namespace NAMESPACE, visible from lexical block BLOCK.
Returns the struct symbol pointer, or zero if no symbol is found.
*************** fixup_psymbol_section (struct partial_sy
*** 572,602 ****
can probably assume it will never hit the C++ code). */
struct symbol *
! lookup_symbol (const char *name, register const struct block *block,
const namespace_enum namespace, int *is_a_field_of_this,
struct symtab **symtab)
{
register struct symbol *sym;
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;
if (case_sensitivity == case_sensitive_off)
{
char *copy;
int len, i;
! len = strlen (name);
copy = (char *) alloca (len + 1);
! for (i= 0; i < len; i++)
! copy[i] = tolower (name[i]);
copy[len] = 0;
! name = copy;
}
/* Search specified block and its superiors. */
while (block != 0)
--- 563,607 ----
can probably assume it will never hit the C++ code). */
struct symbol *
! lookup_symbol (const char *beforename, const struct block *block,
const namespace_enum namespace, int *is_a_field_of_this,
struct symtab **symtab)
{
register struct symbol *sym;
register struct symtab *s = NULL;
register struct partial_symtab *ps;
! register struct blockvector *bv;
register struct objfile *objfile = NULL;
register struct block *b;
register struct minimal_symbol *msymbol;
+ const char *name = NULL;
if (case_sensitivity == case_sensitive_off)
{
char *copy;
int len, i;
! len = strlen (beforename);
copy = (char *) alloca (len + 1);
! for (i = 0; i < len; i++)
! copy[i] = tolower (beforename[i]);
copy[len] = 0;
! beforename = copy;
}
+ memset (&checked_blocks, 0, sizeof (checked_blocks));
+ /* If we are using C++ language, demangle the name before doing a lookup, so
+ we can always binary search. */
+ if (current_language->la_language == language_cplus)
+ name = cplus_demangle (beforename, DMGL_ANSI | DMGL_PARAMS);
+
+ /* Couldn't demangle, might be a C name. If it's really C++, we have
+ barely have a prayer of finding it anyway, or it being useful, if
+ we can't demangle it, so ....
+ */
+ if (!name)
+ name = beforename;
+
/* Search specified block and its superiors. */
while (block != 0)
*************** lookup_symbol (const char *name, registe
*** 620,626 ****
found:
*symtab = s;
}
-
return fixup_symbol_section (sym, objfile);
}
block = BLOCK_SUPERBLOCK (block);
--- 625,630 ----
*************** lookup_symbol (const char *name, registe
*** 690,697 ****
--- 694,714 ----
ALL_SYMTABS (objfile, s)
{
+ register unsigned long hashval;
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+ /* Check if we already tried here */
+ hashval = hash ((unsigned int *) &block, sizeof (struct block *)) %
+ BLOCK_LOOKUP_HASH_SIZE;
+
+ if ((checked_blocks[hashval] != NULL) && checked_blocks[hashval] == block)
+ {
+ continue;
+ }
+ else
+ {
+ checked_blocks[hashval] = block;
+ }
sym = lookup_block_symbol (block, name, namespace);
if (sym)
{
*************** lookup_symbol (const char *name, registe
*** 783,792 ****
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;
--- 800,810 ----
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;
*************** lookup_symbol (const char *name, registe
*** 833,842 ****
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;
--- 851,861 ----
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;
*************** lookup_symbol (const char *name, registe
*** 944,963 ****
*symtab = NULL;
return 0;
}
!
/* Look, in partial_symtab PST, for symbol NAME. Check the global
symbols if GLOBAL, the static symbols if not */
static struct partial_symbol *
! lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global,
! namespace_enum namespace)
{
struct partial_symbol *temp;
struct partial_symbol **start, **psym;
struct partial_symbol **top, **bottom, **center;
int length = (global ? pst->n_global_syms : pst->n_static_syms);
int do_linear_search = 1;
!
if (length == 0)
{
return (NULL);
--- 963,982 ----
*symtab = NULL;
return 0;
}
!
/* Look, in partial_symtab PST, for symbol NAME. Check the global
symbols if GLOBAL, the static symbols if not */
static struct partial_symbol *
! lookup_partial_symbol (struct partial_symtab *pst, const char *name,
! int global, namespace_enum namespace)
{
struct partial_symbol *temp;
struct partial_symbol **start, **psym;
struct partial_symbol **top, **bottom, **center;
int length = (global ? pst->n_global_syms : pst->n_static_syms);
int do_linear_search = 1;
!
if (length == 0)
{
return (NULL);
*************** lookup_partial_symbol (struct partial_sy
*** 965,971 ****
start = (global ?
pst->objfile->global_psymbols.list + pst->globals_offset :
pst->objfile->static_psymbols.list + pst->statics_offset);
!
if (global) /* This means we can use a binary search. */
{
do_linear_search = 0;
--- 984,990 ----
start = (global ?
pst->objfile->global_psymbols.list + pst->globals_offset :
pst->objfile->static_psymbols.list + pst->statics_offset);
!
if (global) /* This means we can use a binary search. */
{
do_linear_search = 0;
*************** lookup_partial_symbol (struct partial_sy
*** 987,993 ****
{
do_linear_search = 1;
}
! if (STRCMP (SYMBOL_NAME (*center), name) >= 0)
{
top = center;
}
--- 1006,1012 ----
{
do_linear_search = 1;
}
! if (STRCMP (SYMBOL_SOURCE_NAME (*center), name) >= 0)
{
top = center;
}
*************** lookup_partial_symbol (struct partial_sy
*** 1000,1012 ****
abort ();
/* djb - 2000-06-03 - Use SYMBOL_MATCHES_NAME, not a strcmp, so
! we don't have to force a linear search on C++. Probably holds true
! for JAVA as well, no way to check.*/
! while (SYMBOL_MATCHES_NAME (*top,name))
{
if (SYMBOL_NAMESPACE (*top) == namespace)
{
! return (*top);
}
top++;
}
--- 1019,1031 ----
abort ();
/* djb - 2000-06-03 - Use SYMBOL_MATCHES_NAME, not a strcmp, so
! we don't have to force a linear search on C++. Probably holds true
! for JAVA as well, no way to check. */
! while (SYMBOL_MATCHES_NAME (*top, name))
{
if (SYMBOL_NAMESPACE (*top) == namespace)
{
! return (*top);
}
top++;
}
*************** lookup_partial_symbol (struct partial_sy
*** 1016,1022 ****
we should also do a linear search. */
if (do_linear_search)
! {
for (psym = start; psym < start + length; psym++)
{
if (namespace == SYMBOL_NAMESPACE (*psym))
--- 1035,1041 ----
we should also do a linear search. */
if (do_linear_search)
! {
for (psym = start; psym < start + length; psym++)
{
if (namespace == SYMBOL_NAMESPACE (*psym))
*************** lookup_transparent_type (const char *nam
*** 1084,1093 ****
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);
--- 1103,1113 ----
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);
*************** lookup_transparent_type (const char *nam
*** 1131,1140 ****
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);
--- 1151,1161 ----
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);
*************** lookup_block_symbol (register const stru
*** 1190,1198 ****
{
/* 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);
--- 1211,1217 ----
{
/* 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 */
do_linear_search = 0;
top = BLOCK_NSYMS (block);
*************** lookup_block_symbol (register const stru
*** 1210,1231 ****
}
inc = (inc >> 1) + bot;
sym = BLOCK_SYM (block, inc);
! if (!do_linear_search
! && (SYMBOL_LANGUAGE (sym) == language_cplus
! || 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;
}
--- 1229,1247 ----
}
inc = (inc >> 1) + bot;
sym = BLOCK_SYM (block, inc);
! if (!do_linear_search && (SYMBOL_LANGUAGE (sym) == language_java))
{
do_linear_search = 1;
}
! if (SYMBOL_SOURCE_NAME (sym)[0] < name[0])
{
bot = inc;
}
! else if (SYMBOL_SOURCE_NAME (sym)[0] > name[0])
{
top = inc;
}
! else if (STRCMP (SYMBOL_SOURCE_NAME (sym), name) < 0)
{
bot = inc;
}
*************** lookup_block_symbol (register const stru
*** 1247,1265 ****
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) == namespace)
! {
! return (sym);
! }
! if (inc > 0)
! {
! break;
! }
bot++;
}
}
--- 1263,1270 ----
while (bot < top)
{
sym = BLOCK_SYM (block, bot);
! if (SYMBOL_MATCHES_NAME (sym, name))
! return sym;
bot++;
}
}
*************** lookup_block_symbol (register const stru
*** 1294,1311 ****
?!? Is checking the current pc correct? Is this routine
ever called to look up a symbol from another context?
! FIXME: No, it's not correct. If someone sets a
! conditional breakpoint at an address, then the
! breakpoint's `struct expression' should refer to the
! `struct symbol' appropriate for the breakpoint's
! address, which may not be the PC.
!
! Even if it were never called from another context,
! it's totally bizarre for lookup_symbol's behavior to
! depend on the value of the inferior's current PC. We
! should pass in the appropriate PC as well as the
! block. The interface to lookup_symbol should change
! to require the caller to provide a PC. */
if (SYMBOL_ALIASES (sym))
sym = find_active_alias (sym, read_pc ());
--- 1299,1316 ----
?!? Is checking the current pc correct? Is this routine
ever called to look up a symbol from another context?
! FIXME: No, it's not correct. If someone sets a
! conditional breakpoint at an address, then the
! breakpoint's `struct expression' should refer to the
! `struct symbol' appropriate for the breakpoint's
! address, which may not be the PC.
!
! Even if it were never called from another context,
! it's totally bizarre for lookup_symbol's behavior to
! depend on the value of the inferior's current PC. We
! should pass in the appropriate PC as well as the
! block. The interface to lookup_symbol should change
! to require the caller to provide a PC. */
if (SYMBOL_ALIASES (sym))
sym = find_active_alias (sym, read_pc ());
*************** block_function (struct block *bl)
*** 1375,1381 ****
psymtabs and read in another symtab if necessary. */
struct symtab *
! find_pc_sect_symtab (CORE_ADDR pc, asection *section)
{
register struct block *b;
struct blockvector *bv;
--- 1380,1386 ----
psymtabs and read in another symtab if necessary. */
struct symtab *
! find_pc_sect_symtab (CORE_ADDR pc, asection * section)
{
register struct block *b;
struct blockvector *bv;
*************** find_pc_sect_symtab (CORE_ADDR pc, asect
*** 1407,1414 ****
if (BLOCK_START (b) <= pc
&& BLOCK_END (b) > pc
! && (distance == 0
! || BLOCK_END (b) - BLOCK_START (b) < distance))
{
/* For an objfile that has its functions reordered,
find_pc_psymtab will find the proper partial symbol table
--- 1412,1418 ----
if (BLOCK_START (b) <= pc
&& BLOCK_END (b) > pc
! && (distance == 0 || BLOCK_END (b) - BLOCK_START (b) < distance))
{
/* For an objfile that has its functions reordered,
find_pc_psymtab will find the proper partial symbol table
*************** find_pc_sect_symtab (CORE_ADDR pc, asect
*** 1452,1459 ****
will cause a core dump), but maybe we can successfully
continue, so let's not. */
warning ("\
! (Internal error: pc 0x%s in read in psymtab, but not in symtab.)\n",
! paddr_nz (pc));
s = PSYMTAB_TO_SYMTAB (ps);
}
return (s);
--- 1456,1462 ----
will cause a core dump), but maybe we can successfully
continue, so let's not. */
warning ("\
! (Internal error: pc 0x%s in read in psymtab, but not in symtab.)\n", paddr_nz (pc));
s = PSYMTAB_TO_SYMTAB (ps);
}
return (s);
*************** find_pc_symtab (CORE_ADDR pc)
*** 1479,1485 ****
line *0x2345" cause psymtabs to be converted to symtabs). */
struct symbol *
! find_addr_symbol (CORE_ADDR addr, struct symtab **symtabp, CORE_ADDR *symaddrp)
{
struct symtab *symtab, *best_symtab;
struct objfile *objfile;
--- 1482,1489 ----
line *0x2345" cause psymtabs to be converted to symtabs). */
struct symbol *
! find_addr_symbol (CORE_ADDR addr, struct symtab **symtabp,
! CORE_ADDR * symaddrp)
{
struct symtab *symtab, *best_symtab;
struct objfile *objfile;
*************** find_pc_sect_line (CORE_ADDR pc, struct
*** 1666,1672 ****
if (msymbol != NULL)
if (MSYMBOL_TYPE (msymbol) == mst_solib_trampoline)
{
! mfunsym = lookup_minimal_symbol_text (SYMBOL_NAME (msymbol), NULL, NULL);
if (mfunsym == NULL)
/* I eliminated this warning since it is coming out
* in the following situation:
--- 1670,1677 ----
if (msymbol != NULL)
if (MSYMBOL_TYPE (msymbol) == mst_solib_trampoline)
{
! mfunsym =
! lookup_minimal_symbol_text (SYMBOL_NAME (msymbol), NULL, NULL);
if (mfunsym == NULL)
/* I eliminated this warning since it is coming out
* in the following situation:
*************** find_pc_sect_line (CORE_ADDR pc, struct
*** 1677,1688 ****
* so of course we can't find the real func/line info,
* but the "break" still works, and the warning is annoying.
* So I commented out the warning. RT */
! /* warning ("In stub for %s; unable to find real function/line info", SYMBOL_NAME(msymbol)) */ ;
/* fall through */
else if (SYMBOL_VALUE (mfunsym) == SYMBOL_VALUE (msymbol))
/* Avoid infinite recursion */
/* See above comment about why warning is commented out */
! /* warning ("In stub for %s; unable to find real function/line info", SYMBOL_NAME(msymbol)) */ ;
/* fall through */
else
return find_pc_line (SYMBOL_VALUE (mfunsym), 0);
--- 1682,1695 ----
* so of course we can't find the real func/line info,
* but the "break" still works, and the warning is annoying.
* So I commented out the warning. RT */
! /* warning ("In stub for %s; unable to find real function/line info", SYMBOL_NAME(msymbol)) */
! ;
/* fall through */
else if (SYMBOL_VALUE (mfunsym) == SYMBOL_VALUE (msymbol))
/* Avoid infinite recursion */
/* See above comment about why warning is commented out */
! /* warning ("In stub for %s; unable to find real function/line info", SYMBOL_NAME(msymbol)) */
! ;
/* fall through */
else
return find_pc_line (SYMBOL_VALUE (mfunsym), 0);
*************** static struct symtab *find_line_symtab (
*** 1824,1830 ****
If not found, return NULL. */
static struct symtab *
! find_line_symtab (struct symtab *symtab, int line, int *index, int *exact_match)
{
int exact;
--- 1831,1838 ----
If not found, return NULL. */
static struct symtab *
! find_line_symtab (struct symtab *symtab, int line, int *index,
! int *exact_match)
{
int exact;
*************** done:
*** 1906,1912 ****
The source file is specified with a struct symtab. */
int
! find_line_pc (struct symtab *symtab, int line, CORE_ADDR *pc)
{
struct linetable *l;
int ind;
--- 1914,1920 ----
The source file is specified with a struct symtab. */
int
! find_line_pc (struct symtab *symtab, int line, CORE_ADDR * pc)
{
struct linetable *l;
int ind;
*************** find_line_pc (struct symtab *symtab, int
*** 1933,1940 ****
Returns 0 if could not find the specified line. */
int
! find_line_pc_range (struct symtab_and_line sal, CORE_ADDR *startptr,
! CORE_ADDR *endptr)
{
CORE_ADDR startaddr;
struct symtab_and_line found_sal;
--- 1941,1948 ----
Returns 0 if could not find the specified line. */
int
! find_line_pc_range (struct symtab_and_line sal, CORE_ADDR * startptr,
! CORE_ADDR * endptr)
{
CORE_ADDR startaddr;
struct symtab_and_line found_sal;
*************** find_line_common (register struct lineta
*** 2016,2022 ****
}
int
! find_pc_line_pc_range (CORE_ADDR pc, CORE_ADDR *startptr, CORE_ADDR *endptr)
{
struct symtab_and_line sal;
sal = find_pc_line (pc, 0);
--- 2024,2030 ----
}
int
! find_pc_line_pc_range (CORE_ADDR pc, CORE_ADDR * startptr, CORE_ADDR * endptr)
{
struct symtab_and_line sal;
sal = find_pc_line (pc, 0);
*************** find_function_start_sal (struct symbol *
*** 2046,2053 ****
asection *section = SYMBOL_BFD_SECTION (sym);
/* If function is in an unmapped overlay, use its unmapped LMA
address, so that SKIP_PROLOGUE has something unique to work on */
! if (section_is_overlay (section) &&
! !section_is_mapped (section))
pc = overlay_unmapped_address (pc, section);
pc += FUNCTION_START_OFFSET;
--- 2054,2060 ----
asection *section = SYMBOL_BFD_SECTION (sym);
/* If function is in an unmapped overlay, use its unmapped LMA
address, so that SKIP_PROLOGUE has something unique to work on */
! if (section_is_overlay (section) && !section_is_mapped (section))
pc = overlay_unmapped_address (pc, section);
pc += FUNCTION_START_OFFSET;
*************** find_methods (struct type *t, char *name
*** 2208,2215 ****
&& (sym_class = lookup_symbol (class_name,
(struct block *) NULL,
STRUCT_NAMESPACE,
! (int *) NULL,
! (struct symtab **) NULL)))
{
int method_counter;
--- 2215,2221 ----
&& (sym_class = lookup_symbol (class_name,
(struct block *) NULL,
STRUCT_NAMESPACE,
! (int *) NULL, (struct symtab **) NULL)))
{
int method_counter;
*************** find_methods (struct type *t, char *name
*** 2221,2228 ****
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);
--- 2227,2233 ----
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);
*************** find_methods (struct type *t, char *name
*** 2240,2248 ****
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;
--- 2245,2253 ----
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;
*************** build_canonical_line_spec (struct symtab
*** 2323,2330 ****
struct symtab *s = sal->symtab;
if (s == (struct symtab *) NULL
! || s->filename == (char *) NULL
! || canonical == (char ***) NULL)
return;
canonical_arr = (char **) xmalloc (sizeof (char *));
--- 2328,2334 ----
struct symtab *s = sal->symtab;
if (s == (struct symtab *) NULL
! || s->filename == (char *) NULL || canonical == (char ***) NULL)
return;
canonical_arr = (char **) xmalloc (sizeof (char *));
*************** find_toplevel_char (char *s, char c)
*** 2367,2373 ****
else if (*scan == '\\' && *(scan + 1))
scan++;
}
! else if (*scan == c && ! quoted && depth == 0)
return scan;
else if (*scan == '"' || *scan == '\'')
quoted = *scan;
--- 2371,2377 ----
else if (*scan == '\\' && *(scan + 1))
scan++;
}
! else if (*scan == c && !quoted && depth == 0)
return scan;
else if (*scan == '"' || *scan == '\'')
quoted = *scan;
*************** decode_line_1 (char **argptr, int funfir
*** 2473,2478 ****
--- 2477,2483 ----
register struct minimal_symbol *msymbol;
char *copy;
struct symbol *sym_class;
+ int triedonce = 0;
int i1;
int is_quoted;
int is_quote_enclosed;
*************** decode_line_1 (char **argptr, int funfir
*** 2583,2595 ****
}
else
is_quote_enclosed = 0;
for (; *p; p++)
{
if (p[0] == '<')
{
char *temp_end = find_template_name_end (p);
! if (!temp_end)
! error ("malformed template specification in command");
p = temp_end;
}
/* Check for the end of the first half of the linespec. End of line,
--- 2588,2613 ----
}
else
is_quote_enclosed = 0;
+ tryagain:
for (; *p; p++)
{
if (p[0] == '<')
{
char *temp_end = find_template_name_end (p);
! if (!temp_end && !triedonce)
! {
! triedonce = 1;
! is_quote_enclosed = 1;
! p = *argptr;
! if (has_comma)
! *ii = ',';
! s = NULL;
! goto tryagain;
! }
! else if (!temp_end && triedonce)
! {
! error ("malformed template specification in command");
! }
p = temp_end;
}
/* Check for the end of the first half of the linespec. End of line,
*************** decode_line_1 (char **argptr, int funfir
*** 2642,2648 ****
/* First check for "global" namespace specification,
of the form "::foo". If found, skip over the colons
and jump to normal symbol processing */
! if (p[0] == ':'
&& ((*argptr == p) || (p[-1] == ' ') || (p[-1] == '\t')))
saved_arg2 += 2;
--- 2660,2666 ----
/* First check for "global" namespace specification,
of the form "::foo". If found, skip over the colons
and jump to normal symbol processing */
! if (p[0] == ':'
&& ((*argptr == p) || (p[-1] == ' ') || (p[-1] == '\t')))
saved_arg2 += 2;
*************** decode_line_1 (char **argptr, int funfir
*** 2694,2700 ****
/* Arg token is not digits => try it as a function name
Find the next token(everything up to end or next blank). */
if (**argptr
! && strchr (gdb_completer_quote_characters, **argptr) != NULL)
{
p = skip_quoted (*argptr);
*argptr = *argptr + 1;
--- 2712,2719 ----
/* Arg token is not digits => try it as a function name
Find the next token(everything up to end or next blank). */
if (**argptr
! && strchr (gdb_completer_quote_characters,
! **argptr) != NULL)
{
p = skip_quoted (*argptr);
*argptr = *argptr + 1;
*************** decode_line_1 (char **argptr, int funfir
*** 2702,2708 ****
else
{
p = *argptr;
! while (*p && *p != ' ' && *p != '\t' && *p != ',' && *p != ':')
p++;
}
/*
--- 2721,2728 ----
else
{
p = *argptr;
! while (*p && *p != ' ' && *p != '\t' && *p != ','
! && *p != ':')
p++;
}
/*
*************** decode_line_1 (char **argptr, int funfir
*** 2745,2752 ****
sym = 0;
i1 = 0; /* counter for the symbol array */
! sym_arr = (struct symbol **) alloca (total_number_of_methods (t)
! * sizeof (struct symbol *));
if (destructor_name_p (copy, t))
{
--- 2765,2773 ----
sym = 0;
i1 = 0; /* counter for the symbol array */
! sym_arr =
! (struct symbol **) alloca (total_number_of_methods (t) *
! sizeof (struct symbol *));
if (destructor_name_p (copy, t))
{
*************** decode_line_1 (char **argptr, int funfir
*** 2755,2765 ****
if (get_destructor_fn_field (t, &m_index, &f_index))
{
! struct fn_field *f = TYPE_FN_FIELDLIST1 (t, m_index);
sym_arr[i1] =
! lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, f_index),
! NULL, VAR_NAMESPACE, (int *) NULL,
(struct symtab **) NULL);
if (sym_arr[i1])
i1++;
--- 2776,2788 ----
if (get_destructor_fn_field (t, &m_index, &f_index))
{
! struct fn_field *f =
! TYPE_FN_FIELDLIST1 (t, m_index);
sym_arr[i1] =
! lookup_symbol (TYPE_FN_FIELD_PHYSNAME
! (f, f_index), NULL, VAR_NAMESPACE,
! (int *) NULL,
(struct symtab **) NULL);
if (sym_arr[i1])
i1++;
*************** decode_line_1 (char **argptr, int funfir
*** 2778,2784 ****
xmalloc (sizeof (struct symtab_and_line));
values.nelts = 1;
values.sals[0] = find_function_start_sal (sym,
! funfirstline);
}
else
{
--- 2801,2807 ----
xmalloc (sizeof (struct symtab_and_line));
values.nelts = 1;
values.sals[0] = find_function_start_sal (sym,
! funfirstline);
}
else
{
*************** decode_line_1 (char **argptr, int funfir
*** 2790,2796 ****
{
/* 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
{
--- 2813,2820 ----
{
/* 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
{
*************** decode_line_1 (char **argptr, int funfir
*** 2798,2806 ****
if (OPNAME_PREFIX_P (copy))
{
! tmp = (char *) alloca (strlen (copy + 3) + 9);
strcpy (tmp, "operator ");
! strcat (tmp, copy + 3);
}
else
tmp = copy;
--- 2822,2830 ----
if (OPNAME_PREFIX_P (copy))
{
! tmp = (char *) alloca (strlen (copy + 8) + 9);
strcpy (tmp, "operator ");
! strcat (tmp, copy + 8);
}
else
tmp = copy;
*************** decode_line_1 (char **argptr, int funfir
*** 2870,2876 ****
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);
}
--- 2894,2901 ----
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);
}
*************** decode_line_1 (char **argptr, int funfir
*** 2967,2975 ****
{
/* We found a token consisting of all digits -- at least one digit. */
enum sign
! {
! none, plus, minus
! }
sign = none;
/* We might need a canonical line spec if no file was specified. */
--- 2992,3000 ----
{
/* We found a token consisting of all digits -- at least one digit. */
enum sign
! {
! none, plus, minus
! }
sign = none;
/* We might need a canonical line spec if no file was specified. */
*************** decode_line_1 (char **argptr, int funfir
*** 3092,3098 ****
sscanf ((copy[1] == '$') ? copy + 2 : copy + 1, "%d", &index);
valx = access_value_history ((copy[1] == '$') ? -index : index);
if (TYPE_CODE (VALUE_TYPE (valx)) != TYPE_CODE_INT)
! error ("History values used in line specs must have integer values.");
}
else
{
--- 3117,3124 ----
sscanf ((copy[1] == '$') ? copy + 2 : copy + 1, "%d", &index);
valx = access_value_history ((copy[1] == '$') ? -index : index);
if (TYPE_CODE (VALUE_TYPE (valx)) != TYPE_CODE_INT)
! error
! ("History values used in line specs must have integer values.");
}
else
{
*************** decode_line_1 (char **argptr, int funfir
*** 3121,3127 ****
need_canonical = (s == 0) ? 1 : 0;
valx = value_of_internalvar (lookup_internalvar (copy + 1));
if (TYPE_CODE (VALUE_TYPE (valx)) != TYPE_CODE_INT)
! error ("Convenience variables used in line specs must have integer values.");
}
/* Either history value or convenience value from above, in valx */
--- 3147,3154 ----
need_canonical = (s == 0) ? 1 : 0;
valx = value_of_internalvar (lookup_internalvar (copy + 1));
if (TYPE_CODE (VALUE_TYPE (valx)) != TYPE_CODE_INT)
! error
! ("Convenience variables used in line specs must have integer values.");
}
/* Either history value or convenience value from above, in valx */
*************** decode_line_2 (sym_arr, nelts, funfirstl
*** 3331,3337 ****
if (canonical_arr[i] == NULL)
{
symname = SYMBOL_NAME (sym_arr[i]);
! canonical_arr[i] = savestring (symname, strlen (symname));
}
}
}
--- 3358,3365 ----
if (canonical_arr[i] == NULL)
{
symname = SYMBOL_NAME (sym_arr[i]);
! canonical_arr[i] =
! savestring (symname, strlen (symname));
}
}
}
*************** sources_info (char *ignore, int from_tty
*** 3455,3461 ****
}
printf_filtered ("\n\n");
! printf_filtered ("Source files for which symbols will be read in on demand:\n\n");
first = 1;
ALL_PSYMTABS (objfile, ps)
--- 3483,3490 ----
}
printf_filtered ("\n\n");
! printf_filtered
! ("Source files for which symbols will be read in on demand:\n\n");
first = 1;
ALL_PSYMTABS (objfile, ps)
*************** search_symbols (regexp, kind, nfiles, fi
*** 3550,3567 ****
struct minimal_symbol *msymbol;
char *val;
int found_misc = 0;
! static enum minimal_symbol_type types[]
! =
! {mst_data, mst_text, mst_abs, mst_unknown};
! static enum minimal_symbol_type types2[]
! =
! {mst_bss, mst_file_text, mst_abs, mst_unknown};
! static enum minimal_symbol_type types3[]
! =
! {mst_file_data, mst_solib_trampoline, mst_abs, mst_unknown};
! static enum minimal_symbol_type types4[]
! =
! {mst_file_bss, mst_text, mst_abs, mst_unknown};
enum minimal_symbol_type ourtype;
enum minimal_symbol_type ourtype2;
enum minimal_symbol_type ourtype3;
--- 3579,3592 ----
struct minimal_symbol *msymbol;
char *val;
int found_misc = 0;
! static enum minimal_symbol_type types[] =
! { mst_data, mst_text, mst_abs, mst_unknown };
! static enum minimal_symbol_type types2[] =
! { mst_bss, mst_file_text, mst_abs, mst_unknown };
! static enum minimal_symbol_type types3[] =
! { mst_file_data, mst_solib_trampoline, mst_abs, mst_unknown };
! static enum minimal_symbol_type types4[] =
! { mst_file_bss, mst_text, mst_abs, mst_unknown };
enum minimal_symbol_type ourtype;
enum minimal_symbol_type ourtype2;
enum minimal_symbol_type ourtype3;
*************** search_symbols (regexp, kind, nfiles, fi
*** 3630,3637 ****
if (ps->readin)
continue;
! gbound = objfile->global_psymbols.list + ps->globals_offset + ps->n_global_syms;
! sbound = objfile->static_psymbols.list + ps->statics_offset + ps->n_static_syms;
bound = gbound;
/* Go through all of the symbols stored in a partial
--- 3655,3664 ----
if (ps->readin)
continue;
! gbound =
! objfile->global_psymbols.list + ps->globals_offset + ps->n_global_syms;
! sbound =
! objfile->static_psymbols.list + ps->statics_offset + ps->n_static_syms;
bound = gbound;
/* Go through all of the symbols stored in a partial
*************** search_symbols (regexp, kind, nfiles, fi
*** 3658,3668 ****
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;
--- 3685,3701 ----
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;
*************** search_symbols (regexp, kind, nfiles, fi
*** 3685,3691 ****
any matching symbols without debug info.
*/
! if (nfiles == 0 && (kind == VARIABLES_NAMESPACE || kind == FUNCTIONS_NAMESPACE))
{
ALL_MSYMBOLS (objfile, msymbol)
{
--- 3718,3725 ----
any matching symbols without debug info.
*/
! if (nfiles == 0
! && (kind == VARIABLES_NAMESPACE || kind == FUNCTIONS_NAMESPACE))
{
ALL_MSYMBOLS (objfile, msymbol)
{
*************** search_symbols (regexp, kind, nfiles, fi
*** 3702,3708 ****
|| lookup_symbol (SYMBOL_NAME (msymbol),
(struct block *) NULL,
VAR_NAMESPACE,
! 0, (struct symtab **) NULL) == NULL)
found_misc = 1;
}
}
--- 3736,3742 ----
|| lookup_symbol (SYMBOL_NAME (msymbol),
(struct block *) NULL,
VAR_NAMESPACE,
! 0, (struct symtab **) NULL) == NULL)
found_misc = 1;
}
}
*************** search_symbols (regexp, kind, nfiles, fi
*** 3731,3745 ****
sym = BLOCK_SYM (b, j);
if (file_matches (s->filename, files, nfiles)
&& ((regexp == NULL || SYMBOL_MATCHES_REGEXP (sym))
! && ((kind == VARIABLES_NAMESPACE && SYMBOL_CLASS (sym) != LOC_TYPEDEF
! && SYMBOL_CLASS (sym) != LOC_BLOCK
! && SYMBOL_CLASS (sym) != LOC_CONST)
! || (kind == FUNCTIONS_NAMESPACE && SYMBOL_CLASS (sym) == LOC_BLOCK)
! || (kind == TYPES_NAMESPACE && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
! || (kind == METHODS_NAMESPACE && SYMBOL_CLASS (sym) == LOC_BLOCK))))
{
/* match */
! psr = (struct symbol_search *) xmalloc (sizeof (struct symbol_search));
psr->block = i;
psr->symtab = s;
psr->symbol = sym;
--- 3765,3787 ----
sym = BLOCK_SYM (b, j);
if (file_matches (s->filename, files, nfiles)
&& ((regexp == NULL || SYMBOL_MATCHES_REGEXP (sym))
! &&
! ((kind
! == VARIABLES_NAMESPACE
! && SYMBOL_CLASS (sym) != LOC_TYPEDEF
! && SYMBOL_CLASS (sym) != LOC_BLOCK
! && SYMBOL_CLASS (sym) != LOC_CONST)
! || (kind == FUNCTIONS_NAMESPACE
! && SYMBOL_CLASS (sym) == LOC_BLOCK)
! || (kind == TYPES_NAMESPACE
! && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
! || (kind == METHODS_NAMESPACE
! && SYMBOL_CLASS (sym) == LOC_BLOCK))))
{
/* match */
! psr =
! (struct symbol_search *)
! xmalloc (sizeof (struct symbol_search));
psr->block = i;
psr->symtab = s;
psr->symbol = sym;
*************** search_symbols (regexp, kind, nfiles, fi
*** 3783,3789 ****
0, (struct symtab **) NULL) == NULL)
{
/* match */
! psr = (struct symbol_search *) xmalloc (sizeof (struct symbol_search));
psr->block = i;
psr->msymbol = msymbol;
psr->symtab = NULL;
--- 3825,3833 ----
0, (struct symtab **) NULL) == NULL)
{
/* match */
! psr =
! (struct symbol_search *)
! xmalloc (sizeof (struct symbol_search));
psr->block = i;
psr->msymbol = msymbol;
psr->symtab = NULL;
*************** print_symbol_info (namespace_enum kind,
*** 3828,3835 ****
printf_filtered ("static ");
/* Typedef that is not a C++ class */
! if (kind == TYPES_NAMESPACE
! && SYMBOL_NAMESPACE (sym) != STRUCT_NAMESPACE)
typedef_print (SYMBOL_TYPE (sym), sym, gdb_stdout);
/* variable, func, or typedef-that-is-c++-class */
else if (kind < TYPES_NAMESPACE ||
--- 3872,3878 ----
printf_filtered ("static ");
/* Typedef that is not a C++ class */
! if (kind == TYPES_NAMESPACE && SYMBOL_NAMESPACE (sym) != STRUCT_NAMESPACE)
typedef_print (SYMBOL_TYPE (sym), sym, gdb_stdout);
/* variable, func, or typedef-that-is-c++-class */
else if (kind < TYPES_NAMESPACE ||
*************** print_symbol_info (namespace_enum kind,
*** 3838,3845 ****
{
type_print (SYMBOL_TYPE (sym),
(SYMBOL_CLASS (sym) == LOC_TYPEDEF
! ? "" : SYMBOL_SOURCE_NAME (sym)),
! gdb_stdout, 0);
printf_filtered (";\n");
}
--- 3881,3887 ----
{
type_print (SYMBOL_TYPE (sym),
(SYMBOL_CLASS (sym) == LOC_TYPEDEF
! ? "" : SYMBOL_SOURCE_NAME (sym)), gdb_stdout, 0);
printf_filtered (";\n");
}
*************** print_symbol_info (namespace_enum kind,
*** 3848,3855 ****
#if 0
/* Tiemann says: "info methods was never implemented." */
char *demangled_name;
! c_type_print_base (TYPE_FN_FIELD_TYPE (t, block),
! gdb_stdout, 0, 0);
c_type_print_varspec_prefix (TYPE_FN_FIELD_TYPE (t, block),
gdb_stdout, 0);
if (TYPE_FN_FIELD_STUB (t, block))
--- 3890,3896 ----
#if 0
/* Tiemann says: "info methods was never implemented." */
char *demangled_name;
! c_type_print_base (TYPE_FN_FIELD_TYPE (t, block), gdb_stdout, 0, 0);
c_type_print_varspec_prefix (TYPE_FN_FIELD_TYPE (t, block),
gdb_stdout, 0);
if (TYPE_FN_FIELD_STUB (t, block))
*************** print_msymbol_info (struct minimal_symbo
*** 3888,3896 ****
static void
symtab_symbol_info (char *regexp, namespace_enum kind, int from_tty)
{
! static char *classnames[]
! =
! {"variable", "function", "type", "method"};
struct symbol_search *symbols;
struct symbol_search *p;
struct cleanup *old_chain;
--- 3929,3935 ----
static void
symtab_symbol_info (char *regexp, namespace_enum kind, int from_tty)
{
! static char *classnames[] = { "variable", "function", "type", "method" };
struct symbol_search *symbols;
struct symbol_search *p;
struct cleanup *old_chain;
*************** symtab_symbol_info (char *regexp, namesp
*** 3922,3931 ****
else
{
print_symbol_info (kind,
! p->symtab,
! p->symbol,
! p->block,
! last_filename);
last_filename = p->symtab->filename;
}
}
--- 3961,3967 ----
else
{
print_symbol_info (kind,
! p->symtab, p->symbol, p->block, last_filename);
last_filename = p->symtab->filename;
}
}
*************** rbreak_command (char *regexp, int from_t
*** 3993,4001 ****
break_command (string, from_tty);
print_symbol_info (FUNCTIONS_NAMESPACE,
p->symtab,
! p->symbol,
! p->block,
! p->symtab->filename);
}
else
{
--- 4029,4035 ----
break_command (string, from_tty);
print_symbol_info (FUNCTIONS_NAMESPACE,
p->symtab,
! p->symbol, p->block, p->symtab->filename);
}
else
{
*************** contained_in (struct block *a, struct bl
*** 4017,4024 ****
{
if (!a || !b)
return 0;
! return BLOCK_START (a) >= BLOCK_START (b)
! && BLOCK_END (a) <= BLOCK_END (b);
}
--- 4051,4057 ----
{
if (!a || !b)
return 0;
! return BLOCK_START (a) >= BLOCK_START (b) && BLOCK_END (a) <= BLOCK_END (b);
}
*************** make_symbol_completion_list (char *text,
*** 4177,4192 ****
return NULL;
else
{
! /* It is not a quoted string. Break it based on the characters
! which are in symbols. */
! while (p > text)
{
! if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0')
! --p;
! else
break;
}
! sym_text = p;
}
}
--- 4210,4226 ----
return NULL;
else
{
! for (p = text; *p != '\0'; ++p)
{
! if (!isprint (*p))
break;
+ }
+ if (*p != '\0')
+ {
+ sym_text = p;
}
! else
! sym_text = text;
}
}
*************** make_symbol_completion_list (char *text,
*** 4209,4229 ****
for (psym = objfile->global_psymbols.list + ps->globals_offset;
psym < (objfile->global_psymbols.list + ps->globals_offset
! + ps->n_global_syms);
! psym++)
{
/* If interrupted, then quit. */
QUIT;
! COMPLETION_LIST_ADD_SYMBOL (*psym, sym_text, sym_text_len, text, word);
}
for (psym = objfile->static_psymbols.list + ps->statics_offset;
psym < (objfile->static_psymbols.list + ps->statics_offset
! + ps->n_static_syms);
! psym++)
{
QUIT;
! COMPLETION_LIST_ADD_SYMBOL (*psym, sym_text, sym_text_len, text, word);
}
}
--- 4243,4263 ----
for (psym = objfile->global_psymbols.list + ps->globals_offset;
psym < (objfile->global_psymbols.list + ps->globals_offset
! + ps->n_global_syms); psym++)
{
/* If interrupted, then quit. */
QUIT;
! COMPLETION_LIST_ADD_SYMBOL (*psym, sym_text, sym_text_len, text,
! word);
}
for (psym = objfile->static_psymbols.list + ps->statics_offset;
psym < (objfile->static_psymbols.list + ps->statics_offset
! + ps->n_static_syms); psym++)
{
QUIT;
! COMPLETION_LIST_ADD_SYMBOL (*psym, sym_text, sym_text_len, text,
! word);
}
}
*************** make_symbol_completion_list (char *text,
*** 4245,4251 ****
{
if (!BLOCK_SUPERBLOCK (b))
{
! surrounding_static_block = b; /* For elmin of dups */
}
/* Also catch fields of types defined in this places which match our
--- 4279,4285 ----
{
if (!BLOCK_SUPERBLOCK (b))
{
! surrounding_static_block = b; /* For elmin of dups */
}
/* Also catch fields of types defined in this places which match our
*************** make_symbol_completion_list (char *text,
*** 4254,4260 ****
for (i = 0; i < BLOCK_NSYMS (b); i++)
{
sym = BLOCK_SYM (b, i);
! COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
if (SYMBOL_CLASS (sym) == LOC_TYPEDEF)
{
struct type *t = SYMBOL_TYPE (sym);
--- 4288,4295 ----
for (i = 0; i < BLOCK_NSYMS (b); i++)
{
sym = BLOCK_SYM (b, i);
! COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text,
! word);
if (SYMBOL_CLASS (sym) == LOC_TYPEDEF)
{
struct type *t = SYMBOL_TYPE (sym);
*************** make_symbol_completion_list (char *text,
*** 4267,4273 ****
if (TYPE_FIELD_NAME (t, j))
{
completion_list_add_name (TYPE_FIELD_NAME (t, j),
! sym_text, sym_text_len, text, word);
}
}
}
--- 4302,4309 ----
if (TYPE_FIELD_NAME (t, j))
{
completion_list_add_name (TYPE_FIELD_NAME (t, j),
! sym_text, sym_text_len,
! text, word);
}
}
}
*************** in_prologue (CORE_ADDR pc, CORE_ADDR fun
*** 4323,4350 ****
/* We have several sources of information we can consult to figure
this out.
- Compilers usually emit line number info that marks the prologue
! as its own "source line". So the ending address of that "line"
! is the end of the prologue. If available, this is the most
! reliable method.
- The minimal symbols and partial symbols, which can usually tell
! us the starting and ending addresses of a function.
- If we know the function's start address, we can call the
! architecture-defined SKIP_PROLOGUE function to analyze the
! instruction stream and guess where the prologue ends.
- Our `func_start' argument; if non-zero, this is the caller's
! best guess as to the function's entry point. At the time of
! this writing, handle_inferior_event doesn't get this right, so
! it should be our last resort. */
/* Consult the partial symbol table, to find which function
the PC is in. */
! if (! find_pc_partial_function (pc, NULL, &func_addr, &func_end))
{
CORE_ADDR prologue_end;
/* We don't even have minsym information, so fall back to using
func_start, if given. */
! if (! func_start)
return 1; /* We *might* be in a prologue. */
prologue_end = SKIP_PROLOGUE (func_start);
--- 4359,4386 ----
/* We have several sources of information we can consult to figure
this out.
- Compilers usually emit line number info that marks the prologue
! as its own "source line". So the ending address of that "line"
! is the end of the prologue. If available, this is the most
! reliable method.
- The minimal symbols and partial symbols, which can usually tell
! us the starting and ending addresses of a function.
- If we know the function's start address, we can call the
! architecture-defined SKIP_PROLOGUE function to analyze the
! instruction stream and guess where the prologue ends.
- Our `func_start' argument; if non-zero, this is the caller's
! best guess as to the function's entry point. At the time of
! this writing, handle_inferior_event doesn't get this right, so
! it should be our last resort. */
/* Consult the partial symbol table, to find which function
the PC is in. */
! if (!find_pc_partial_function (pc, NULL, &func_addr, &func_end))
{
CORE_ADDR prologue_end;
/* We don't even have minsym information, so fall back to using
func_start, if given. */
! if (!func_start)
return 1; /* We *might* be in a prologue. */
prologue_end = SKIP_PROLOGUE (func_start);
*************** in_prologue (CORE_ADDR pc, CORE_ADDR fun
*** 4364,4376 ****
line, the line number information doesn't always end up this way.
So we must verify that our purported end-of-prologue address is
*within* the function, not at its start or end. */
! if (sal.line == 0
! || sal.end <= func_addr
! || func_end <= sal.end)
{
/* We don't have any good line number info, so use the minsym
! information, together with the architecture-specific prologue
! scanning code. */
CORE_ADDR prologue_end = SKIP_PROLOGUE (func_addr);
return func_addr <= pc && pc < prologue_end;
--- 4400,4410 ----
line, the line number information doesn't always end up this way.
So we must verify that our purported end-of-prologue address is
*within* the function, not at its start or end. */
! if (sal.line == 0 || sal.end <= func_addr || func_end <= sal.end)
{
/* We don't have any good line number info, so use the minsym
! information, together with the architecture-specific prologue
! scanning code. */
CORE_ADDR prologue_end = SKIP_PROLOGUE (func_addr);
return func_addr <= pc && pc < prologue_end;
*************** overload_list_add_symbol (struct symbol
*** 4427,4433 ****
if (sym_return_val_index + 3 > sym_return_val_size)
{
newsize = (sym_return_val_size *= 2) * sizeof (struct symbol *);
! sym_return_val = (struct symbol **) xrealloc ((char *) sym_return_val, newsize);
}
sym_return_val[sym_return_val_index++] = sym;
sym_return_val[sym_return_val_index] = NULL;
--- 4461,4468 ----
if (sym_return_val_index + 3 > sym_return_val_size)
{
newsize = (sym_return_val_size *= 2) * sizeof (struct symbol *);
! sym_return_val =
! (struct symbol **) xrealloc ((char *) sym_return_val, newsize);
}
sym_return_val[sym_return_val_index++] = sym;
sym_return_val[sym_return_val_index] = NULL;
*************** make_symbol_overload_list (struct symbol
*** 4468,4474 ****
sym_return_val_size = 100;
sym_return_val_index = 0;
! sym_return_val = (struct symbol **) xmalloc ((sym_return_val_size + 1) * sizeof (struct symbol *));
sym_return_val[0] = NULL;
/* Look through the partial symtabs for all symbols which begin
--- 4503,4511 ----
sym_return_val_size = 100;
sym_return_val_index = 0;
! sym_return_val =
! (struct symbol **) xmalloc ((sym_return_val_size + 1) *
! sizeof (struct symbol *));
sym_return_val[0] = NULL;
/* Look through the partial symtabs for all symbols which begin
*************** make_symbol_overload_list (struct symbol
*** 4485,4507 ****
for (psym = objfile->global_psymbols.list + ps->globals_offset;
psym < (objfile->global_psymbols.list + ps->globals_offset
! + ps->n_global_syms);
! psym++)
{
/* 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;
psym < (objfile->static_psymbols.list + ps->statics_offset
! + ps->n_static_syms);
! psym++)
{
QUIT;
! /* This will cause the symbol table to be read if it has not yet been */
! s = PSYMTAB_TO_SYMTAB (ps);
}
}
--- 4522,4542 ----
for (psym = objfile->global_psymbols.list + ps->globals_offset;
psym < (objfile->global_psymbols.list + ps->globals_offset
! + ps->n_global_syms); psym++)
{
/* 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;
psym < (objfile->static_psymbols.list + ps->statics_offset
! + ps->n_static_syms); psym++)
{
QUIT;
! /* This will cause the symbol table to be read if it has not yet been */
! s = PSYMTAB_TO_SYMTAB (ps);
}
}
*************** make_symbol_overload_list (struct symbol
*** 4512,4518 ****
{
if (!BLOCK_SUPERBLOCK (b))
{
! surrounding_static_block = b; /* For elimination of dups */
}
/* Also catch fields of types defined in this places which match our
--- 4547,4553 ----
{
if (!BLOCK_SUPERBLOCK (b))
{
! surrounding_static_block = b; /* For elimination of dups */
}
/* Also catch fields of types defined in this places which match our
*************** void
*** 4565,4579 ****
_initialize_symtab (void)
{
add_info ("variables", variables_info,
! "All global and static variable names, or those matching REGEXP.");
if (dbx_commands)
add_com ("whereis", class_info, variables_info,
! "All global and static variable names, or those matching REGEXP.");
add_info ("functions", functions_info,
"All function names, or those matching REGEXP.");
-
/* FIXME: This command has at least the following problems:
1. It prints builtin types (in a very strange and confusing fashion).
2. It doesn't print right, e.g. with
--- 4600,4614 ----
_initialize_symtab (void)
{
add_info ("variables", variables_info,
! "All global and static variable names, or those matching REGEXP.");
if (dbx_commands)
add_com ("whereis", class_info, variables_info,
! "All global and static variable names, or those matching REGEXP.");
add_info ("functions", functions_info,
"All function names, or those matching REGEXP.");
+
/* FIXME: This command has at least the following problems:
1. It prints builtin types (in a very strange and confusing fashion).
2. It doesn't print right, e.g. with
*************** _initialize_symtab (void)
*** 4582,4589 ****
print "struct foo *".
I also think "ptype" or "whatis" is more likely to be useful (but if
there is much disagreement "info types" can be fixed). */
! add_info ("types", types_info,
! "All type names, or those matching REGEXP.");
#if 0
add_info ("methods", methods_info,
--- 4617,4623 ----
print "struct foo *".
I also think "ptype" or "whatis" is more likely to be useful (but if
there is much disagreement "info types" can be fixed). */
! add_info ("types", types_info, "All type names, or those matching REGEXP.");
#if 0
add_info ("methods", methods_info,
*************** If the class qualifier is omitted, it is
*** 4592,4599 ****
If the first REGEXP is omitted, then all methods matching the second REGEXP\n\
are listed.");
#endif
! add_info ("sources", sources_info,
! "Source files in the program.");
add_com ("rbreak", class_breakpoint, rbreak_command,
"Set a breakpoint for all functions matching REGEXP.");
--- 4626,4632 ----
If the first REGEXP is omitted, then all methods matching the second REGEXP\n\
are listed.");
#endif
! add_info ("sources", sources_info, "Source files in the program.");
add_com ("rbreak", class_breakpoint, rbreak_command,
"Set a breakpoint for all functions matching REGEXP.");
*************** are listed.");
*** 4602,4608 ****
{
add_com ("lf", class_info, sources_info, "Source files in the program");
add_com ("lg", class_info, variables_info,
! "All global and static variable names, or those matching REGEXP.");
}
/* Initialize the one built-in type that isn't language dependent... */
--- 4635,4641 ----
{
add_com ("lf", class_info, sources_info, "Source files in the program");
add_com ("lg", class_info, variables_info,
! "All global and static variable names, or those matching REGEXP.");
}
/* Initialize the one built-in type that isn't language dependent... */
Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.13
diff -c -3 -p -r1.13 symtab.h
*** symtab.h 2000/08/07 15:02:48 1.13
--- symtab.h 2000/09/07 04:25:32
***************
*** 49,125 ****
have tens or hundreds of thousands of these. */
struct general_symbol_info
{
! /* Name of the symbol. This is a required field. Storage for the name is
! allocated on the psymbol_obstack or symbol_obstack for the associated
! objfile. */
!
! char *name;
!
! /* Value of the symbol. Which member of this union to use, and what
! it means, depends on what kind of symbol this is and its
! SYMBOL_CLASS. See comments there for more details. All of these
! are in host byte order (though what they point to might be in
! target byte order, e.g. LOC_CONST_BYTES). */
!
! union
! {
! /* 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;
!
! char *bytes;
!
! CORE_ADDR address;
!
! /* for opaque typedef struct chain */
!
! struct symbol *chain;
! }
! value;
!
! /* Since one and only one language can apply, wrap the language specific
! information inside a union. */
!
! union
! {
! struct cplus_specific /* For C++ */
! /* and Java */
! {
! char *demangled_name;
! }
! cplus_specific;
! struct chill_specific /* For Chill */
! {
! char *demangled_name;
! }
! chill_specific;
! }
! language_specific;
!
! /* Record the source code language that applies to this symbol.
! This is used to select one of the fields from the language specific
! union above. */
!
! enum language language BYTE_BITFIELD;
!
! /* Which section is this symbol in? This is an index into
! section_offsets for this objfile. Negative means that the symbol
! does not get relocated relative to a section.
! Disclaimer: currently this is just used for xcoff, so don't
! expect all symbol-reading code to set it correctly (the ELF code
! also tries to set it correctly). */
! short section;
! /* The bfd section associated with this symbol. */
! asection *bfd_section;
! };
extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, asection *);
#define SYMBOL_NAME(symbol) (symbol)->ginfo.name
--- 49,125 ----
have tens or hundreds of thousands of these. */
struct general_symbol_info
+ {
+ /* Name of the symbol. This is a required field. Storage for the name is
+ allocated on the psymbol_obstack or symbol_obstack for the associated
+ objfile. */
+
+ char *name;
+
+ /* Value of the symbol. Which member of this union to use, and what
+ it means, depends on what kind of symbol this is and its
+ SYMBOL_CLASS. See comments there for more details. All of these
+ are in host byte order (though what they point to might be in
+ target byte order, e.g. LOC_CONST_BYTES). */
+
+ union
+ {
+ /* 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;
+
+ char *bytes;
+
+ CORE_ADDR address;
+
+ /* for opaque typedef struct chain */
+
+ struct symbol *chain;
+ }
+ value;
+
+ /* Since one and only one language can apply, wrap the language specific
+ information inside a union. */
+
+ union
{
! struct cplus_specific /* For C++ */
! /* and Java */
! {
! char *demangled_name;
! }
! cplus_specific;
! struct chill_specific /* For Chill */
! {
! char *demangled_name;
! }
! chill_specific;
! }
! language_specific;
!
! /* Record the source code language that applies to this symbol.
! This is used to select one of the fields from the language specific
! union above. */
! enum language language BYTE_BITFIELD;
! /* Which section is this symbol in? This is an index into
! section_offsets for this objfile. Negative means that the symbol
! does not get relocated relative to a section.
! Disclaimer: currently this is just used for xcoff, so don't
! expect all symbol-reading code to set it correctly (the ELF code
! also tries to set it correctly). */
! short section;
+ /* The bfd section associated with this symbol. */
+
+ asection *bfd_section;
+ };
+
extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, asection *);
#define SYMBOL_NAME(symbol) (symbol)->ginfo.name
*************** extern CORE_ADDR symbol_overlayed_addres
*** 168,175 ****
specified obstack. */
#define SYMBOL_INIT_DEMANGLED_NAME(symbol,obstack) \
! do { \
char *demangled = NULL; \
if (SYMBOL_LANGUAGE (symbol) == language_cplus \
|| SYMBOL_LANGUAGE (symbol) == language_auto) \
{ \
--- 168,177 ----
specified obstack. */
#define SYMBOL_INIT_DEMANGLED_NAME(symbol,obstack) \
! do { \
char *demangled = NULL; \
+ if (SYMBOL_LANGUAGE (symbol) == language_unknown) \
+ SYMBOL_LANGUAGE(symbol) = language_auto; \
if (SYMBOL_LANGUAGE (symbol) == language_cplus \
|| SYMBOL_LANGUAGE (symbol) == language_auto) \
{ \
*************** extern CORE_ADDR symbol_overlayed_addres
*** 222,231 ****
SYMBOL_CHILL_DEMANGLED_NAME (symbol) = NULL; \
} \
} \
- if (SYMBOL_LANGUAGE (symbol) == language_auto) \
- { \
- SYMBOL_LANGUAGE (symbol) = language_unknown; \
- } \
} while (0)
/* Macro that returns the demangled name for a symbol based on the language
--- 224,229 ----
*************** extern CORE_ADDR symbol_overlayed_addres
*** 298,379 ****
used to figure out what full symbol table entries need to be read in. */
struct minimal_symbol
! {
! /* The general symbol info required for all types of symbols.
! The SYMBOL_VALUE_ADDRESS contains the address that this symbol
! corresponds to. */
! struct general_symbol_info ginfo;
! /* The info field is available for caching machine-specific information
! so it doesn't have to rederive the info constantly (over a serial line).
! It is initialized to zero and stays that way until target-dependent code
! sets it. Storage for any data pointed to by this field should be allo-
! cated on the symbol_obstack for the associated objfile.
! The type would be "void *" except for reasons of compatibility with older
! compilers. This field is optional.
!
! Currently, the AMD 29000 tdep.c uses it to remember things it has decoded
! from the instructions in the function header, and the MIPS-16 code uses
! it to identify 16-bit procedures. */
! char *info;
#ifdef SOFUN_ADDRESS_MAYBE_MISSING
! /* Which source file is this symbol in? Only relevant for mst_file_*. */
! char *filename;
#endif
! /* Classification types for this symbol. These should be taken as "advisory
! only", since if gdb can't easily figure out a classification it simply
! selects mst_unknown. It may also have to guess when it can't figure out
! which is a better match between two types (mst_data versus mst_bss) for
! example. Since the minimal symbol info is sometimes derived from the
! BFD library's view of a file, we need to live with what information bfd
! supplies. */
!
! enum minimal_symbol_type
! {
! mst_unknown = 0, /* Unknown type, the default */
! mst_text, /* Generally executable instructions */
! mst_data, /* Generally initialized data */
! mst_bss, /* Generally uninitialized data */
! mst_abs, /* Generally absolute (nonrelocatable) */
! /* GDB uses mst_solib_trampoline for the start address of a shared
! library trampoline entry. Breakpoints for shared library functions
! are put there if the shared library is not yet loaded.
! After the shared library is loaded, lookup_minimal_symbol will
! prefer the minimal symbol from the shared library (usually
! a mst_text symbol) over the mst_solib_trampoline symbol, and the
! breakpoints will be moved to their true address in the shared
! library via breakpoint_re_set. */
! mst_solib_trampoline, /* Shared library trampoline code */
! /* For the mst_file* types, the names are only guaranteed to be unique
! within a given .o file. */
! mst_file_text, /* Static version of mst_text */
! mst_file_data, /* Static version of mst_data */
! mst_file_bss /* Static version of mst_bss */
! }
! type BYTE_BITFIELD;
!
! /* Minimal symbols with the same hash key are kept on a linked
! list. This is the link. */
! struct minimal_symbol *hash_next;
! /* Minimal symbols are stored in two different hash tables. This is
! the `next' pointer for the demangled hash table. */
! struct minimal_symbol *demangled_hash_next;
! };
#define MSYMBOL_INFO(msymbol) (msymbol)->info
#define MSYMBOL_TYPE(msymbol) (msymbol)->type
-
/* All of the name-scope contours of the program
are represented by `struct block' objects.
All of these objects are pointed to by the blockvector.
--- 296,377 ----
used to figure out what full symbol table entries need to be read in. */
struct minimal_symbol
! {
!
! /* The general symbol info required for all types of symbols.
! The SYMBOL_VALUE_ADDRESS contains the address that this symbol
! corresponds to. */
! struct general_symbol_info ginfo;
! /* The info field is available for caching machine-specific information
! so it doesn't have to rederive the info constantly (over a serial line).
! It is initialized to zero and stays that way until target-dependent code
! sets it. Storage for any data pointed to by this field should be allo-
! cated on the symbol_obstack for the associated objfile.
! The type would be "void *" except for reasons of compatibility with older
! compilers. This field is optional.
! Currently, the AMD 29000 tdep.c uses it to remember things it has decoded
! from the instructions in the function header, and the MIPS-16 code uses
! it to identify 16-bit procedures. */
! char *info;
#ifdef SOFUN_ADDRESS_MAYBE_MISSING
! /* Which source file is this symbol in? Only relevant for mst_file_*. */
! char *filename;
#endif
! /* Classification types for this symbol. These should be taken as "advisory
! only", since if gdb can't easily figure out a classification it simply
! selects mst_unknown. It may also have to guess when it can't figure out
! which is a better match between two types (mst_data versus mst_bss) for
! example. Since the minimal symbol info is sometimes derived from the
! BFD library's view of a file, we need to live with what information bfd
! supplies. */
!
! enum minimal_symbol_type
! {
! mst_unknown = 0, /* Unknown type, the default */
! mst_text, /* Generally executable instructions */
! mst_data, /* Generally initialized data */
! mst_bss, /* Generally uninitialized data */
! mst_abs, /* Generally absolute (nonrelocatable) */
! /* GDB uses mst_solib_trampoline for the start address of a shared
! library trampoline entry. Breakpoints for shared library functions
! are put there if the shared library is not yet loaded.
! After the shared library is loaded, lookup_minimal_symbol will
! prefer the minimal symbol from the shared library (usually
! a mst_text symbol) over the mst_solib_trampoline symbol, and the
! breakpoints will be moved to their true address in the shared
! library via breakpoint_re_set. */
! mst_solib_trampoline, /* Shared library trampoline code */
! /* For the mst_file* types, the names are only guaranteed to be unique
! within a given .o file. */
! mst_file_text, /* Static version of mst_text */
! mst_file_data, /* Static version of mst_data */
! mst_file_bss /* Static version of mst_bss */
! }
! type BYTE_BITFIELD;
!
! /* Minimal symbols with the same hash key are kept on a linked
! list. This is the link. */
! struct minimal_symbol *hash_next;
! /* Minimal symbols are stored in two different hash tables. This is
! the `next' pointer for the demangled hash table. */
! struct minimal_symbol *demangled_hash_next;
! };
#define MSYMBOL_INFO(msymbol) (msymbol)->info
#define MSYMBOL_TYPE(msymbol) (msymbol)->type
+
/* All of the name-scope contours of the program
are represented by `struct block' objects.
All of these objects are pointed to by the blockvector.
*************** struct minimal_symbol
*** 401,412 ****
the blocks appear in the order of a depth-first tree walk. */
struct blockvector
! {
! /* Number of blocks in the list. */
! int nblocks;
! /* The blocks themselves. */
! struct block *block[1];
! };
#define BLOCKVECTOR_NBLOCKS(blocklist) (blocklist)->nblocks
#define BLOCKVECTOR_BLOCK(blocklist,n) (blocklist)->block[n]
--- 399,410 ----
the blocks appear in the order of a depth-first tree walk. */
struct blockvector
! {
! /* Number of blocks in the list. */
! int nblocks;
! /* The blocks themselves. */
! struct block *block[1];
! };
#define BLOCKVECTOR_NBLOCKS(blocklist) (blocklist)->nblocks
#define BLOCKVECTOR_BLOCK(blocklist,n) (blocklist)->block[n]
*************** struct blockvector
*** 418,464 ****
#define FIRST_LOCAL_BLOCK 2
struct block
! {
! /* Addresses in the executable code that are in this block. */
! CORE_ADDR startaddr;
! CORE_ADDR endaddr;
! /* The symbol that names this block, if the block is the body of a
! function; otherwise, zero. */
! struct symbol *function;
! /* The `struct block' for the containing block, or 0 if none.
! The superblock of a top-level local block (i.e. a function in the
! case of C) is the STATIC_BLOCK. The superblock of the
! STATIC_BLOCK is the GLOBAL_BLOCK. */
! struct block *superblock;
! /* Version of GCC used to compile the function corresponding
! to this block, or 0 if not compiled with GCC. When possible,
! GCC should be compatible with the native compiler, or if that
! is not feasible, the differences should be fixed during symbol
! reading. As of 16 Apr 93, this flag is never used to distinguish
! between gcc2 and the native compiler.
! If there is no function corresponding to this block, this meaning
! of this flag is undefined. */
! unsigned char gcc_compile_flag;
! /* Number of local symbols. */
! int nsyms;
! /* The symbols. If some of them are arguments, then they must be
! in the order in which we would like to print them. */
! struct symbol *sym[1];
! };
#define BLOCK_START(bl) (bl)->startaddr
#define BLOCK_END(bl) (bl)->endaddr
--- 416,462 ----
#define FIRST_LOCAL_BLOCK 2
struct block
! {
! /* Addresses in the executable code that are in this block. */
! CORE_ADDR startaddr;
! CORE_ADDR endaddr;
! /* The symbol that names this block, if the block is the body of a
! function; otherwise, zero. */
! struct symbol *function;
! /* The `struct block' for the containing block, or 0 if none.
! The superblock of a top-level local block (i.e. a function in the
! case of C) is the STATIC_BLOCK. The superblock of the
! STATIC_BLOCK is the GLOBAL_BLOCK. */
! struct block *superblock;
! /* Version of GCC used to compile the function corresponding
! to this block, or 0 if not compiled with GCC. When possible,
! GCC should be compatible with the native compiler, or if that
! is not feasible, the differences should be fixed during symbol
! reading. As of 16 Apr 93, this flag is never used to distinguish
! between gcc2 and the native compiler.
! If there is no function corresponding to this block, this meaning
! of this flag is undefined. */
! unsigned char gcc_compile_flag;
! /* Number of local symbols. */
! int nsyms;
! /* The symbols. If some of them are arguments, then they must be
! in the order in which we would like to print them. */
! struct symbol *sym[1];
! };
#define BLOCK_START(bl) (bl)->startaddr
#define BLOCK_END(bl) (bl)->endaddr
*************** struct block
*** 482,729 ****
namespace and ignores symbol definitions in other name spaces. */
typedef enum
! {
! /* UNDEF_NAMESPACE is used when a namespace has not been discovered or
! none of the following apply. This usually indicates an error either
! in the symbol information or in gdb's handling of symbols. */
!
! UNDEF_NAMESPACE,
! /* VAR_NAMESPACE is the usual namespace. In C, this contains variables,
! function names, typedef names and enum type values. */
! VAR_NAMESPACE,
! /* STRUCT_NAMESPACE is used in C to hold struct, union and enum type names.
! Thus, if `struct foo' is used in a C program, it produces a symbol named
! `foo' in the STRUCT_NAMESPACE. */
! 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. */
! LABEL_NAMESPACE,
! /* Searching namespaces. These overlap with VAR_NAMESPACE, providing
! some granularity with the search_symbols function. */
! /* Everything in VAR_NAMESPACE minus FUNCTIONS_-, TYPES_-, and
! METHODS_NAMESPACE */
! VARIABLES_NAMESPACE,
! /* All functions -- for some reason not methods, though. */
! FUNCTIONS_NAMESPACE,
! /* All defined types */
! TYPES_NAMESPACE,
! /* All class methods -- why is this separated out? */
! METHODS_NAMESPACE
! }
namespace_enum;
/* An address-class says where to find the value of a symbol. */
enum address_class
! {
! /* Not used; catches errors */
!
! LOC_UNDEF,
! /* Value is constant int SYMBOL_VALUE, host byteorder */
! LOC_CONST,
! /* Value is at fixed address SYMBOL_VALUE_ADDRESS */
! LOC_STATIC,
! /* Value is in register. SYMBOL_VALUE is the register number. */
! LOC_REGISTER,
! /* It's an argument; the value is at SYMBOL_VALUE offset in arglist. */
! LOC_ARG,
! /* Value address is at SYMBOL_VALUE offset in arglist. */
! LOC_REF_ARG,
! /* Value is in register number SYMBOL_VALUE. Just like LOC_REGISTER
! except this is an argument. Probably the cleaner way to handle
! this would be to separate address_class (which would include
! separate ARG and LOCAL to deal with FRAME_ARGS_ADDRESS versus
! FRAME_LOCALS_ADDRESS), and an is_argument flag.
! For some symbol formats (stabs, for some compilers at least),
! the compiler generates two symbols, an argument and a register.
! In some cases we combine them to a single LOC_REGPARM in symbol
! reading, but currently not for all cases (e.g. it's passed on the
! stack and then loaded into a register). */
! LOC_REGPARM,
! /* Value is in specified register. Just like LOC_REGPARM except the
! register holds the address of the argument instead of the argument
! itself. This is currently used for the passing of structs and unions
! on sparc and hppa. It is also used for call by reference where the
! address is in a register, at least by mipsread.c. */
! LOC_REGPARM_ADDR,
! /* Value is a local variable at SYMBOL_VALUE offset in stack frame. */
! LOC_LOCAL,
! /* Value not used; definition in SYMBOL_TYPE. Symbols in the namespace
! STRUCT_NAMESPACE all have this class. */
! LOC_TYPEDEF,
! /* Value is address SYMBOL_VALUE_ADDRESS in the code */
! LOC_LABEL,
! /* In a symbol table, value is SYMBOL_BLOCK_VALUE of a `struct block'.
! In a partial symbol table, SYMBOL_VALUE_ADDRESS is the start address
! of the block. Function names have this class. */
! LOC_BLOCK,
! /* Value is a constant byte-sequence pointed to by SYMBOL_VALUE_BYTES, in
! target byte order. */
! LOC_CONST_BYTES,
! /* Value is arg at SYMBOL_VALUE offset in stack frame. Differs from
! LOC_LOCAL in that symbol is an argument; differs from LOC_ARG in
! that we find it in the frame (FRAME_LOCALS_ADDRESS), not in the
! arglist (FRAME_ARGS_ADDRESS). Added for i960, which passes args
! in regs then copies to frame. */
! LOC_LOCAL_ARG,
! /* Value is at SYMBOL_VALUE offset from the current value of
! register number SYMBOL_BASEREG. This exists mainly for the same
! things that LOC_LOCAL and LOC_ARG do; but we need to do this
! instead because on 88k DWARF gives us the offset from the
! frame/stack pointer, rather than the offset from the "canonical
! frame address" used by COFF, stabs, etc., and we don't know how
! to convert between these until we start examining prologues.
! Note that LOC_BASEREG is much less general than a DWARF expression.
! We don't need the generality (at least not yet), and storing a general
! DWARF expression would presumably take up more space than the existing
! scheme. */
! LOC_BASEREG,
! /* Same as LOC_BASEREG but it is an argument. */
! LOC_BASEREG_ARG,
! /* Value is at fixed address, but the address of the variable has
! to be determined from the minimal symbol table whenever the
! variable is referenced.
! This happens if debugging information for a global symbol is
! emitted and the corresponding minimal symbol is defined
! in another object file or runtime common storage.
! The linker might even remove the minimal symbol if the global
! symbol is never referenced, in which case the symbol remains
! unresolved. */
! LOC_UNRESOLVED,
! /* Value is at a thread-specific location calculated by a
! target-specific method. */
! LOC_THREAD_LOCAL_STATIC,
! /* The variable does not actually exist in the program.
! The value is ignored. */
! LOC_OPTIMIZED_OUT,
! /* The variable is static, but actually lives at * (address).
! * I.e. do an extra indirection to get to it.
! * This is used on HP-UX to get at globals that are allocated
! * in shared libraries, where references from images other
! * than the one where the global was allocated are done
! * with a level of indirection.
! */
! LOC_INDIRECT
! };
/* Linked list of symbol's live ranges. */
struct range_list
! {
! CORE_ADDR start;
! CORE_ADDR end;
! struct range_list *next;
! };
/* Linked list of aliases for a particular main/primary symbol. */
struct alias_list
! {
! struct symbol *sym;
! struct alias_list *next;
! };
struct symbol
! {
! /* The general symbol info required for all types of symbols. */
! struct general_symbol_info ginfo;
! /* Data type of value */
! struct type *type;
! /* Name space code. */
#ifdef __MFC4__
! /* FIXME: don't conflict with C++'s namespace */
! /* would be safer to do a global change for all namespace identifiers. */
#define namespace _namespace
#endif
! namespace_enum namespace BYTE_BITFIELD;
! /* Address class */
! enum address_class aclass BYTE_BITFIELD;
! /* Line number of definition. FIXME: Should we really make the assumption
! that nobody will try to debug files longer than 64K lines? What about
! machine generated programs? */
! unsigned short line;
! /* Some symbols require an additional value to be recorded on a per-
! symbol basis. Stash those values here. */
! union
! {
! /* Used by LOC_BASEREG and LOC_BASEREG_ARG. */
! short basereg;
! }
! aux_value;
! /* Link to a list of aliases for this symbol.
! Only a "primary/main symbol may have aliases. */
! struct alias_list *aliases;
! /* List of ranges where this symbol is active. This is only
! used by alias symbols at the current time. */
! struct range_list *ranges;
! };
#define SYMBOL_NAMESPACE(symbol) (symbol)->namespace
--- 480,725 ----
namespace and ignores symbol definitions in other name spaces. */
typedef enum
! {
! /* UNDEF_NAMESPACE is used when a namespace has not been discovered or
! none of the following apply. This usually indicates an error either
! in the symbol information or in gdb's handling of symbols. */
! UNDEF_NAMESPACE,
! /* VAR_NAMESPACE is the usual namespace. In C, this contains variables,
! function names, typedef names and enum type values. */
! VAR_NAMESPACE,
! /* STRUCT_NAMESPACE is used in C to hold struct, union and enum type names.
! Thus, if `struct foo' is used in a C program, it produces a symbol named
! `foo' in the STRUCT_NAMESPACE. */
! 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. */
! LABEL_NAMESPACE,
! /* Searching namespaces. These overlap with VAR_NAMESPACE, providing
! some granularity with the search_symbols function. */
! /* Everything in VAR_NAMESPACE minus FUNCTIONS_-, TYPES_-, and
! METHODS_NAMESPACE */
! VARIABLES_NAMESPACE,
! /* All functions -- for some reason not methods, though. */
! FUNCTIONS_NAMESPACE,
! /* All defined types */
! TYPES_NAMESPACE,
! /* All class methods -- why is this separated out? */
! METHODS_NAMESPACE
! }
namespace_enum;
/* An address-class says where to find the value of a symbol. */
enum address_class
! {
! /* Not used; catches errors */
! LOC_UNDEF,
! /* Value is constant int SYMBOL_VALUE, host byteorder */
! LOC_CONST,
! /* Value is at fixed address SYMBOL_VALUE_ADDRESS */
! LOC_STATIC,
! /* Value is in register. SYMBOL_VALUE is the register number. */
! LOC_REGISTER,
! /* It's an argument; the value is at SYMBOL_VALUE offset in arglist. */
! LOC_ARG,
! /* Value address is at SYMBOL_VALUE offset in arglist. */
! LOC_REF_ARG,
! /* Value is in register number SYMBOL_VALUE. Just like LOC_REGISTER
! except this is an argument. Probably the cleaner way to handle
! this would be to separate address_class (which would include
! separate ARG and LOCAL to deal with FRAME_ARGS_ADDRESS versus
! FRAME_LOCALS_ADDRESS), and an is_argument flag.
! For some symbol formats (stabs, for some compilers at least),
! the compiler generates two symbols, an argument and a register.
! In some cases we combine them to a single LOC_REGPARM in symbol
! reading, but currently not for all cases (e.g. it's passed on the
! stack and then loaded into a register). */
! LOC_REGPARM,
! /* Value is in specified register. Just like LOC_REGPARM except the
! register holds the address of the argument instead of the argument
! itself. This is currently used for the passing of structs and unions
! on sparc and hppa. It is also used for call by reference where the
! address is in a register, at least by mipsread.c. */
! LOC_REGPARM_ADDR,
! /* Value is a local variable at SYMBOL_VALUE offset in stack frame. */
! LOC_LOCAL,
! /* Value not used; definition in SYMBOL_TYPE. Symbols in the namespace
! STRUCT_NAMESPACE all have this class. */
! LOC_TYPEDEF,
! /* Value is address SYMBOL_VALUE_ADDRESS in the code */
! LOC_LABEL,
! /* In a symbol table, value is SYMBOL_BLOCK_VALUE of a `struct block'.
! In a partial symbol table, SYMBOL_VALUE_ADDRESS is the start address
! of the block. Function names have this class. */
! LOC_BLOCK,
! /* Value is a constant byte-sequence pointed to by SYMBOL_VALUE_BYTES, in
! target byte order. */
! LOC_CONST_BYTES,
! /* Value is arg at SYMBOL_VALUE offset in stack frame. Differs from
! LOC_LOCAL in that symbol is an argument; differs from LOC_ARG in
! that we find it in the frame (FRAME_LOCALS_ADDRESS), not in the
! arglist (FRAME_ARGS_ADDRESS). Added for i960, which passes args
! in regs then copies to frame. */
! LOC_LOCAL_ARG,
! /* Value is at SYMBOL_VALUE offset from the current value of
! register number SYMBOL_BASEREG. This exists mainly for the same
! things that LOC_LOCAL and LOC_ARG do; but we need to do this
! instead because on 88k DWARF gives us the offset from the
! frame/stack pointer, rather than the offset from the "canonical
! frame address" used by COFF, stabs, etc., and we don't know how
! to convert between these until we start examining prologues.
! Note that LOC_BASEREG is much less general than a DWARF expression.
! We don't need the generality (at least not yet), and storing a general
! DWARF expression would presumably take up more space than the existing
! scheme. */
! LOC_BASEREG,
! /* Same as LOC_BASEREG but it is an argument. */
! LOC_BASEREG_ARG,
! /* Value is at fixed address, but the address of the variable has
! to be determined from the minimal symbol table whenever the
! variable is referenced.
! This happens if debugging information for a global symbol is
! emitted and the corresponding minimal symbol is defined
! in another object file or runtime common storage.
! The linker might even remove the minimal symbol if the global
! symbol is never referenced, in which case the symbol remains
! unresolved. */
! LOC_UNRESOLVED,
! /* Value is at a thread-specific location calculated by a
! target-specific method. */
! LOC_THREAD_LOCAL_STATIC,
! /* The variable does not actually exist in the program.
! The value is ignored. */
! LOC_OPTIMIZED_OUT,
! /* The variable is static, but actually lives at * (address).
! * I.e. do an extra indirection to get to it.
! * This is used on HP-UX to get at globals that are allocated
! * in shared libraries, where references from images other
! * than the one where the global was allocated are done
! * with a level of indirection.
! */
! LOC_INDIRECT
! };
/* Linked list of symbol's live ranges. */
struct range_list
! {
! CORE_ADDR start;
! CORE_ADDR end;
! struct range_list *next;
! };
/* Linked list of aliases for a particular main/primary symbol. */
struct alias_list
! {
! struct symbol *sym;
! struct alias_list *next;
! };
struct symbol
! {
! /* The general symbol info required for all types of symbols. */
! struct general_symbol_info ginfo;
! /* Data type of value */
! struct type *type;
! /* Name space code. */
#ifdef __MFC4__
! /* FIXME: don't conflict with C++'s namespace */
! /* would be safer to do a global change for all namespace identifiers. */
#define namespace _namespace
#endif
! namespace_enum namespace BYTE_BITFIELD;
! /* Address class */
! enum address_class aclass BYTE_BITFIELD;
! /* Line number of definition. FIXME: Should we really make the assumption
! that nobody will try to debug files longer than 64K lines? What about
! machine generated programs? */
! unsigned short line;
! /* Some symbols require an additional value to be recorded on a per-
! symbol basis. Stash those values here. */
! union
! {
! /* Used by LOC_BASEREG and LOC_BASEREG_ARG. */
! short basereg;
! }
! aux_value;
! /* Link to a list of aliases for this symbol.
! Only a "primary/main symbol may have aliases. */
! struct alias_list *aliases;
! /* List of ranges where this symbol is active. This is only
! used by alias symbols at the current time. */
! struct range_list *ranges;
! };
#define SYMBOL_NAMESPACE(symbol) (symbol)->namespace
*************** struct symbol
*** 742,762 ****
normal symtab once the partial_symtab has been referenced. */
struct partial_symbol
! {
! /* The general symbol info required for all types of symbols. */
! struct general_symbol_info ginfo;
! /* Name space code. */
! namespace_enum namespace BYTE_BITFIELD;
! /* Address class (for info_symbols) */
! enum address_class aclass BYTE_BITFIELD;
! };
#define PSYMBOL_NAMESPACE(psymbol) (psymbol)->namespace
#define PSYMBOL_CLASS(psymbol) (psymbol)->aclass
--- 738,758 ----
normal symtab once the partial_symtab has been referenced. */
struct partial_symbol
! {
! /* The general symbol info required for all types of symbols. */
! struct general_symbol_info ginfo;
! /* Name space code. */
! namespace_enum namespace BYTE_BITFIELD;
! /* Address class (for info_symbols) */
! enum address_class aclass BYTE_BITFIELD;
! };
#define PSYMBOL_NAMESPACE(psymbol) (psymbol)->namespace
#define PSYMBOL_CLASS(psymbol) (psymbol)->aclass
*************** struct partial_symbol
*** 766,775 ****
ine numbers and addresses in the program text. */
struct sourcevector
! {
! int length; /* Number of source files described */
! struct source *source[1]; /* Descriptions of the files */
! };
/* Each item represents a line-->pc (or the reverse) mapping. This is
somewhat more wasteful of space than one might wish, but since only
--- 762,771 ----
ine numbers and addresses in the program text. */
struct sourcevector
! {
! int length; /* Number of source files described */
! struct source *source[1]; /* Descriptions of the files */
! };
/* Each item represents a line-->pc (or the reverse) mapping. This is
somewhat more wasteful of space than one might wish, but since only
*************** struct sourcevector
*** 777,786 ****
waste much space. */
struct linetable_entry
! {
! int line;
! CORE_ADDR pc;
! };
/* The order of entries in the linetable is significant. They should
be sorted by increasing values of the pc field. If there is more than
--- 773,782 ----
waste much space. */
struct linetable_entry
! {
! int line;
! CORE_ADDR pc;
! };
/* The order of entries in the linetable is significant. They should
be sorted by increasing values of the pc field. If there is more than
*************** struct linetable_entry
*** 797,818 ****
*/
struct linetable
! {
! int nitems;
! /* Actually NITEMS elements. If you don't like this use of the
! `struct hack', you can shove it up your ANSI (seriously, if the
! committee tells us how to do it, we can probably go along). */
! struct linetable_entry item[1];
! };
/* All the information on one source file. */
struct source
! {
! char *name; /* Name of file */
! struct linetable contents;
! };
/* How to relocate the symbols from each section in a symbol file.
Each struct contains an array of offsets.
--- 793,814 ----
*/
struct linetable
! {
! int nitems;
! /* Actually NITEMS elements. If you don't like this use of the
! `struct hack', you can shove it up your ANSI (seriously, if the
! committee tells us how to do it, we can probably go along). */
! struct linetable_entry item[1];
! };
/* All the information on one source file. */
struct source
! {
! char *name; /* Name of file */
! struct linetable contents;
! };
/* How to relocate the symbols from each section in a symbol file.
Each struct contains an array of offsets.
*************** struct source
*** 825,833 ****
extract offset values in the struct. */
struct section_offsets
! {
! CORE_ADDR offsets[1]; /* As many as needed. */
! };
#define ANOFFSET(secoff, whichone) \
((whichone == -1) ? \
--- 821,829 ----
extract offset values in the struct. */
struct section_offsets
! {
! CORE_ADDR offsets[1]; /* As many as needed. */
! };
#define ANOFFSET(secoff, whichone) \
((whichone == -1) ? \
*************** struct section_offsets
*** 843,937 ****
These objects are chained through the `next' field. */
struct symtab
! {
! /* Chain of all existing symtabs. */
! struct symtab *next;
! /* List of all symbol scope blocks for this symtab. May be shared
! between different symtabs (and normally is for all the symtabs
! in a given compilation unit). */
! struct blockvector *blockvector;
! /* Table mapping core addresses to line numbers for this file.
! Can be NULL if none. Never shared between different symtabs. */
! struct linetable *linetable;
! /* Section in objfile->section_offsets for the blockvector and
! the linetable. Probably always SECT_OFF_TEXT. */
! int block_line_section;
! /* If several symtabs share a blockvector, exactly one of them
! should be designated the primary, so that the blockvector
! is relocated exactly once by objfile_relocate. */
! int primary;
! /* Name of this source file. */
! char *filename;
! /* Directory in which it was compiled, or NULL if we don't know. */
! char *dirname;
! /* This component says how to free the data we point to:
! free_contents => do a tree walk and free each object.
! free_nothing => do nothing; some other symtab will free
! the data this one uses.
! free_linetable => free just the linetable. FIXME: Is this redundant
! with the primary field? */
! enum free_code
! {
! free_nothing, free_contents, free_linetable
! }
! free_code;
! /* Pointer to one block of storage to be freed, if nonzero. */
! /* This is IN ADDITION to the action indicated by free_code. */
! char *free_ptr;
! /* Total number of lines found in source file. */
! int nlines;
! /* line_charpos[N] is the position of the (N-1)th line of the
! source file. "position" means something we can lseek() to; it
! is not guaranteed to be useful any other way. */
! int *line_charpos;
! /* Language of this source file. */
! enum language language;
! /* String that identifies the format of the debugging information, such
! as "stabs", "dwarf 1", "dwarf 2", "coff", etc. This is mostly useful
! for automated testing of gdb but may also be information that is
! useful to the user. */
! char *debugformat;
! /* String of version information. May be zero. */
! char *version;
! /* Full name of file as found by searching the source path.
! NULL if not yet known. */
! char *fullname;
! /* Object file from which this symbol information was read. */
! struct objfile *objfile;
! };
#define BLOCKVECTOR(symtab) (symtab)->blockvector
#define LINETABLE(symtab) (symtab)->linetable
--- 839,933 ----
These objects are chained through the `next' field. */
struct symtab
! {
! /* Chain of all existing symtabs. */
! struct symtab *next;
! /* List of all symbol scope blocks for this symtab. May be shared
! between different symtabs (and normally is for all the symtabs
! in a given compilation unit). */
! struct blockvector *blockvector;
! /* Table mapping core addresses to line numbers for this file.
! Can be NULL if none. Never shared between different symtabs. */
! struct linetable *linetable;
! /* Section in objfile->section_offsets for the blockvector and
! the linetable. Probably always SECT_OFF_TEXT. */
! int block_line_section;
! /* If several symtabs share a blockvector, exactly one of them
! should be designated the primary, so that the blockvector
! is relocated exactly once by objfile_relocate. */
! int primary;
! /* Name of this source file. */
! char *filename;
! /* Directory in which it was compiled, or NULL if we don't know. */
! char *dirname;
! /* This component says how to free the data we point to:
! free_contents => do a tree walk and free each object.
! free_nothing => do nothing; some other symtab will free
! the data this one uses.
! free_linetable => free just the linetable. FIXME: Is this redundant
! with the primary field? */
! enum free_code
! {
! free_nothing, free_contents, free_linetable
! }
! free_code;
! /* Pointer to one block of storage to be freed, if nonzero. */
! /* This is IN ADDITION to the action indicated by free_code. */
! char *free_ptr;
! /* Total number of lines found in source file. */
! int nlines;
! /* line_charpos[N] is the position of the (N-1)th line of the
! source file. "position" means something we can lseek() to; it
! is not guaranteed to be useful any other way. */
! int *line_charpos;
! /* Language of this source file. */
! enum language language;
! /* String that identifies the format of the debugging information, such
! as "stabs", "dwarf 1", "dwarf 2", "coff", etc. This is mostly useful
! for automated testing of gdb but may also be information that is
! useful to the user. */
! char *debugformat;
! /* String of version information. May be zero. */
! char *version;
! /* Full name of file as found by searching the source path.
! NULL if not yet known. */
! char *fullname;
! /* Object file from which this symbol information was read. */
! struct objfile *objfile;
! };
#define BLOCKVECTOR(symtab) (symtab)->blockvector
#define LINETABLE(symtab) (symtab)->linetable
*************** struct symtab
*** 949,1032 ****
style execution of a bunch of .o's. */
struct partial_symtab
! {
! /* Chain of all existing partial symtabs. */
! struct partial_symtab *next;
! /* Name of the source file which this partial_symtab defines */
! char *filename;
! /* Information about the object file from which symbols should be read. */
! struct objfile *objfile;
! /* Set of relocation offsets to apply to each section. */
! struct section_offsets *section_offsets;
! /* Range of text addresses covered by this file; texthigh is the
! beginning of the next section. */
! CORE_ADDR textlow;
! CORE_ADDR texthigh;
! /* Array of pointers to all of the partial_symtab's which this one
! depends on. Since this array can only be set to previous or
! the current (?) psymtab, this dependency tree is guaranteed not
! to have any loops. "depends on" means that symbols must be read
! for the dependencies before being read for this psymtab; this is
! for type references in stabs, where if foo.c includes foo.h, declarations
! in foo.h may use type numbers defined in foo.c. For other debugging
! formats there may be no need to use dependencies. */
! struct partial_symtab **dependencies;
! int number_of_dependencies;
! /* Global symbol list. This list will be sorted after readin to
! improve access. Binary search will be the usual method of
! finding a symbol within it. globals_offset is an integer offset
! within global_psymbols[]. */
! int globals_offset;
! int n_global_syms;
! /* Static symbol list. This list will *not* be sorted after readin;
! to find a symbol in it, exhaustive search must be used. This is
! reasonable because searches through this list will eventually
! lead to either the read in of a files symbols for real (assumed
! to take a *lot* of time; check) or an error (and we don't care
! how long errors take). This is an offset and size within
! static_psymbols[]. */
! int statics_offset;
! int n_static_syms;
! /* Pointer to symtab eventually allocated for this source file, 0 if
! !readin or if we haven't looked for the symtab after it was readin. */
! struct symtab *symtab;
! /* Pointer to function which will read in the symtab corresponding to
! this psymtab. */
! void (*read_symtab) (struct partial_symtab *);
! /* Information that lets read_symtab() locate the part of the symbol table
! that this psymtab corresponds to. This information is private to the
! format-dependent symbol reading routines. For further detail examine
! the various symbol reading modules. Should really be (void *) but is
! (char *) as with other such gdb variables. (FIXME) */
! char *read_symtab_private;
! /* Non-zero if the symtab corresponding to this psymtab has been readin */
! unsigned char readin;
! };
/* A fast way to get from a psymtab to its symtab (after the first time). */
#define PSYMTAB_TO_SYMTAB(pst) \
--- 945,1028 ----
style execution of a bunch of .o's. */
struct partial_symtab
! {
! /* Chain of all existing partial symtabs. */
! struct partial_symtab *next;
! /* Name of the source file which this partial_symtab defines */
! char *filename;
! /* Information about the object file from which symbols should be read. */
! struct objfile *objfile;
! /* Set of relocation offsets to apply to each section. */
! struct section_offsets *section_offsets;
! /* Range of text addresses covered by this file; texthigh is the
! beginning of the next section. */
! CORE_ADDR textlow;
! CORE_ADDR texthigh;
! /* Array of pointers to all of the partial_symtab's which this one
! depends on. Since this array can only be set to previous or
! the current (?) psymtab, this dependency tree is guaranteed not
! to have any loops. "depends on" means that symbols must be read
! for the dependencies before being read for this psymtab; this is
! for type references in stabs, where if foo.c includes foo.h, declarations
! in foo.h may use type numbers defined in foo.c. For other debugging
! formats there may be no need to use dependencies. */
! struct partial_symtab **dependencies;
! int number_of_dependencies;
! /* Global symbol list. This list will be sorted after readin to
! improve access. Binary search will be the usual method of
! finding a symbol within it. globals_offset is an integer offset
! within global_psymbols[]. */
! int globals_offset;
! int n_global_syms;
! /* Static symbol list. This list will *not* be sorted after readin;
! to find a symbol in it, exhaustive search must be used. This is
! reasonable because searches through this list will eventually
! lead to either the read in of a files symbols for real (assumed
! to take a *lot* of time; check) or an error (and we don't care
! how long errors take). This is an offset and size within
! static_psymbols[]. */
! int statics_offset;
! int n_static_syms;
! /* Pointer to symtab eventually allocated for this source file, 0 if
! !readin or if we haven't looked for the symtab after it was readin. */
! struct symtab *symtab;
! /* Pointer to function which will read in the symtab corresponding to
! this psymtab. */
! void (*read_symtab) (struct partial_symtab *);
! /* Information that lets read_symtab() locate the part of the symbol table
! that this psymtab corresponds to. This information is private to the
! format-dependent symbol reading routines. For further detail examine
! the various symbol reading modules. Should really be (void *) but is
! (char *) as with other such gdb variables. (FIXME) */
! char *read_symtab_private;
! /* Non-zero if the symtab corresponding to this psymtab has been readin */
! unsigned char readin;
! };
/* A fast way to get from a psymtab to its symtab (after the first time). */
#define PSYMTAB_TO_SYMTAB(pst) \
*************** struct partial_symtab
*** 1053,1059 ****
Note that this macro is g++ specific (FIXME). */
#define OPNAME_PREFIX_P(NAME) \
! ((NAME)[0] == 'o' && (NAME)[1] == 'p' && is_cplus_marker ((NAME)[2]))
/* Macro that yields non-zero value iff NAME is the prefix for C++ vtbl
names. Note that this macro is g++ specific (FIXME).
--- 1049,1055 ----
Note that this macro is g++ specific (FIXME). */
#define OPNAME_PREFIX_P(NAME) \
! (!strncmp(NAME,"operator",8))
/* Macro that yields non-zero value iff NAME is the prefix for C++ vtbl
names. Note that this macro is g++ specific (FIXME).
*************** extern void install_minimal_symbols (str
*** 1256,1272 ****
extern void msymbols_sort (struct objfile *objfile);
struct symtab_and_line
! {
! struct symtab *symtab;
! asection *section;
! /* Line number. Line numbers start at 1 and proceed through symtab->nlines.
! 0 is never a valid line number; it is used to indicate that line number
! information is not available. */
! int line;
!
! CORE_ADDR pc;
! CORE_ADDR end;
! };
#define INIT_SAL(sal) { \
(sal)->symtab = 0; \
--- 1252,1268 ----
extern void msymbols_sort (struct objfile *objfile);
struct symtab_and_line
! {
! struct symtab *symtab;
! asection *section;
! /* Line number. Line numbers start at 1 and proceed through symtab->nlines.
! 0 is never a valid line number; it is used to indicate that line number
! information is not available. */
! int line;
!
! CORE_ADDR pc;
! CORE_ADDR end;
! };
#define INIT_SAL(sal) { \
(sal)->symtab = 0; \
*************** struct symtab_and_line
*** 1277,1286 ****
}
struct symtabs_and_lines
! {
! struct symtab_and_line *sals;
! int nelts;
! };
--- 1273,1282 ----
}
struct symtabs_and_lines
! {
! struct symtab_and_line *sals;
! int nelts;
! };
*************** struct symtabs_and_lines
*** 1291,1312 ****
/* Enums for exception-handling support */
enum exception_event_kind
! {
! EX_EVENT_THROW,
! EX_EVENT_CATCH
! };
/* Type for returning info about an exception */
struct exception_event_record
! {
! enum exception_event_kind kind;
! struct symtab_and_line throw_sal;
! struct symtab_and_line catch_sal;
! /* This may need to be extended in the future, if
! some platforms allow reporting more information,
! such as point of rethrow, type of exception object,
! type expected by catch clause, etc. */
! };
#define CURRENT_EXCEPTION_KIND (current_exception_event->kind)
#define CURRENT_EXCEPTION_CATCH_SAL (current_exception_event->catch_sal)
--- 1287,1308 ----
/* Enums for exception-handling support */
enum exception_event_kind
! {
! EX_EVENT_THROW,
! EX_EVENT_CATCH
! };
/* Type for returning info about an exception */
struct exception_event_record
! {
! enum exception_event_kind kind;
! struct symtab_and_line throw_sal;
! struct symtab_and_line catch_sal;
! /* This may need to be extended in the future, if
! some platforms allow reporting more information,
! such as point of rethrow, type of exception object,
! type expected by catch clause, etc. */
! };
#define CURRENT_EXCEPTION_KIND (current_exception_event->kind)
#define CURRENT_EXCEPTION_CATCH_SAL (current_exception_event->catch_sal)
*************** extern struct partial_symbol *fixup_psym
*** 1425,1453 ****
/* When using search_symbols, a list of the following structs is returned.
Callers must free the search list using free_symbol_search! */
struct symbol_search
! {
! /* The block in which the match was found. Could be, for example,
! STATIC_BLOCK or GLOBAL_BLOCK. */
! int block;
!
! /* Information describing what was found.
!
! If symtab abd symbol are NOT NULL, then information was found
! for this match. */
! struct symtab *symtab;
! struct symbol *symbol;
!
! /* If msymbol is non-null, then a match was made on something for
! which only minimal_symbols exist. */
! struct minimal_symbol *msymbol;
!
! /* A link to the next match, or NULL for the end. */
! struct symbol_search *next;
! };
extern void search_symbols (char *, namespace_enum, int, char **,
struct symbol_search **);
extern void free_search_symbols (struct symbol_search *);
! extern struct cleanup *make_cleanup_free_search_symbols (struct symbol_search *);
#endif /* !defined(SYMTAB_H) */
--- 1421,1450 ----
/* When using search_symbols, a list of the following structs is returned.
Callers must free the search list using free_symbol_search! */
struct symbol_search
! {
! /* The block in which the match was found. Could be, for example,
! STATIC_BLOCK or GLOBAL_BLOCK. */
! int block;
!
! /* Information describing what was found.
!
! If symtab abd symbol are NOT NULL, then information was found
! for this match. */
! struct symtab *symtab;
! struct symbol *symbol;
!
! /* If msymbol is non-null, then a match was made on something for
! which only minimal_symbols exist. */
! struct minimal_symbol *msymbol;
!
! /* A link to the next match, or NULL for the end. */
! struct symbol_search *next;
! };
extern void search_symbols (char *, namespace_enum, int, char **,
struct symbol_search **);
extern void free_search_symbols (struct symbol_search *);
! extern struct cleanup *make_cleanup_free_search_symbols (struct symbol_search
! *);
#endif /* !defined(SYMTAB_H) */