This commit is contained in:
Stu Grossman 1991-08-22 22:50:50 +00:00
parent aa69ff846c
commit 61a7292f6f
4 changed files with 58 additions and 56 deletions

View File

@ -689,6 +689,7 @@ static bfd *symfile_bfd;
/* FIXME! Addr and Mainline are not used yet -- this will not work for
shared libraries or add_file! */
/* ARGSUSED */
void
coff_symfile_read (sf, addr, mainline)
struct sym_fns *sf;
@ -756,19 +757,13 @@ coff_symfile_read (sf, addr, mainline)
/* Go over the misc symbol bunches and install them in vector. */
condense_misc_bunches (0);
condense_misc_bunches (!mainline);
/* Make a default for file to list. */
select_source_symtab (0); /* FIXME, this might be too slow, see dbxread */
}
void
coff_symfile_discard ()
{
/* There seems to be nothing to do here. */
}
void
coff_new_init ()
{
@ -1322,6 +1317,12 @@ init_lineno (chan, offset, size)
{
int val;
linetab_offset = offset;
linetab_size = size;
if (size == 0)
return 0;
if (lseek (chan, offset, 0) < 0)
return -1;
@ -1331,8 +1332,6 @@ init_lineno (chan, offset, size)
if (val != size)
return -1;
linetab_offset = offset;
linetab_size = size;
make_cleanup (free, linetab); /* Be sure it gets de-allocated. */
return 0;
}
@ -1935,6 +1934,7 @@ read_struct_type (index, length, lastsym)
Also defines the symbols that represent the values of the type. */
/* Currently assumes it's sizeof (int) and doesn't use length. */
/* ARGSUSED */
static struct type *
read_enum_type (index, length, lastsym)
int index;
@ -2033,8 +2033,7 @@ static struct sym_fns coff_sym_fns =
#else /* not TDESC */
"coff", 4,
#endif /* not TDESC */
coff_new_init, coff_symfile_init,
coff_symfile_read, coff_symfile_discard
coff_new_init, coff_symfile_init, coff_symfile_read,
};
void

View File

@ -249,8 +249,7 @@ cplus_demangle (type, arg_mode)
/* destructor */
if (type[0] == '_' && type[1] == CPLUS_MARKER && type[2] == '_')
{
int n = (strlen (type) - 3)*2 + 3 + 2 + 1;
char *tem = (char *) xmalloc (n);
char *tem = (char *) xmalloc ((strlen (type) - 3)*2 + 3 + 2 + 1);
strcpy (tem, type + 3);
strcat (tem, "::~");
strcat (tem, type + 3);
@ -260,8 +259,7 @@ cplus_demangle (type, arg_mode)
/* static data member */
if (*type != '_' && (p = strchr (type, CPLUS_MARKER)) != NULL)
{
int n = strlen (type) + 2;
char *tem = (char *) xmalloc (n);
char *tem = (char *) xmalloc (strlen (type) + 2);
memcpy (tem, type, p - type);
strcpy (tem + (p - type), "::");
strcpy (tem + (p - type) + 2, p + 1);
@ -270,8 +268,7 @@ cplus_demangle (type, arg_mode)
/* virtual table "_vt$" */
if (type[0] == '_' && type[1] == 'v' && type[2] == 't' && type[3] == CPLUS_MARKER)
{
int n = strlen (type + 4) + 14 + 1;
char *tem = (char *) xmalloc (n);
char *tem = (char *) xmalloc (strlen (type + 4) + 14 + 1);
strcpy (tem, type + 4);
strcat (tem, " virtual table");
return tem;

View File

@ -4,19 +4,19 @@
This file is part of GDB.
GDB is free software; you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GDB is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GDB; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <stdio.h>
#include "defs.h"
@ -53,7 +53,10 @@ static void clear_symtab_users_once();
struct sym_fns *symtab_fns = NULL;
/* Saves the sym_fns of the current symbol table, so we can call
the right sym_discard function when we free it. */
the right XXX_new_init function when we free it. FIXME. This
should be extended to calling the new_init function for each
existing symtab or psymtab, since the main symbol file and
subsequent added symbol files can have different types. */
static struct sym_fns *symfile_fns;
@ -87,6 +90,15 @@ long /* really time_t */ symfile_mtime = 0;
struct psymbol_allocation_list global_psymbols = {0}, static_psymbols = {0};
/* Flag for whether user will be reloading symbols multiple times.
Defaults to ON for VxWorks, otherwise OFF. */
#ifdef SYMBOL_RELOADING_DEFAULT
int symbol_reloading = SYMBOL_RELOADING_DEFAULT;
#else
int symbol_reloading = 0;
#endif
/* Structure to manage complaints about symbol file contents. */
struct complaint complaint_root[1] = {
@ -364,15 +376,7 @@ psymtab_to_symtab (pst)
(*pst->read_symtab) (pst);
}
/* Search through list for correct name. */
for (result = symtab_list; result; result = result->next)
if (!strcmp (result->filename, pst->filename))
{
pst->symtab = result; /* Remember where it was. */
return result;
}
return 0;
return pst->symtab;
}
/* Process a symbol file, as either the main file or as a dynamically
@ -422,7 +426,7 @@ symbol_file_add (name, from_tty, addr, mainline)
if (from_tty)
{
printf_filtered ("Reading symbol data from %s...", name);
printf_filtered ("Reading symbols from %s...", name);
wrap_here ("");
fflush (stdout);
}
@ -607,31 +611,22 @@ load_command (arg, from_tty)
target_load (arg, from_tty);
}
/* This function runs the add_syms command of our current target. */
void
add_symbol_file_command (args, from_tty)
char *args;
int from_tty;
{
/* Getting new symbols may change our opinion about what is
frameless. */
reinit_frame_cache ();
target_add_syms (args, from_tty);
}
/* This function allows the addition of incrementally linked object files. */
/* This function allows the addition of incrementally linked object files.
It does not modify any state in the target, only in the debugger. */
/* ARGSUSED */
void
add_syms_addr_command (arg_string, from_tty)
char* arg_string;
add_symbol_file_command (arg_string, from_tty)
char *arg_string;
int from_tty;
{
char *name;
CORE_ADDR text_addr;
/* Getting new symbols may change our opinion about what is
frameless. */
reinit_frame_cache ();
if (arg_string == 0)
error ("add-symbol-file takes a file name and an address");
@ -709,9 +704,10 @@ fill_in_vptr_fieldno (type)
/* Functions to handle complaints during symbol reading. */
/* How many complaints about a particular thing should be printed before
we stop whining about it? */
we stop whining about it? Default is no whining at all, since so many
systems have ill-constructed symbol files. */
static unsigned stop_whining = 1;
static unsigned stop_whining = 0;
/* Print a complaint about the input symbols, and link the complaint block
into a chain for later handling. Result is 1 if the complaint was
@ -864,6 +860,10 @@ free_named_symtabs (name)
struct blockvector *bv;
int blewit = 0;
/* We only wack things if the symbol-reload switch is set. */
if (!symbol_reloading)
return 0;
/* Some symbol formats have trouble providing file names... */
if (name == 0 || *name == '\0')
return 0;
@ -957,6 +957,13 @@ for access from GDB.");
&setlist),
&showlist);
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);
obstack_init (symbol_obstack);
obstack_init (psymbol_obstack);
}

View File

@ -1015,7 +1015,6 @@ value_headof (arg, btype, dtype)
/* Now search through the virtual function table. */
entry = value_ind (vtbl);
entry_type = VALUE_TYPE (entry);
nelems = longest_to_int (value_as_long (value_field (entry, 2)));
for (i = 1; i <= nelems; i++)
{
@ -1372,8 +1371,8 @@ modify_field (addr, fieldval, bitpos, bitsize)
/* Reject values too big to fit in the field in question,
otherwise adjoining fields may be corrupted. */
if ((0 != fieldval & ~((1<<bitsize)-1))
&& bitsize < 8 * sizeof (fieldval))
if (bitsize < (8 * sizeof (fieldval))
&& 0 != (fieldval & ~((1<<bitsize)-1)))
error ("Value %d does not fit in %d bits.", fieldval, bitsize);
bcopy (addr, &oword, sizeof oword);