Changes to implement the -mapped and -readnow options for commands that
read symbol tables.
This commit is contained in:
parent
afbdd10672
commit
b0246b3bec
11 changed files with 572 additions and 614 deletions
|
@ -1,3 +1,35 @@
|
|||
Wed Mar 18 08:39:52 1992 Fred Fish (fnf@cygnus.com)
|
||||
|
||||
* Makefile.in (VERSION): Roll 4.4.6.
|
||||
* exec.c (exec_file_command): Add code to ignore optional args
|
||||
passed in by file_command() for use in symbol_file_command().
|
||||
* main.c (main): Document -mapped and -readnow in help summary.
|
||||
* objfiles.c (open_mapped_file): Cosmetic change, arg renamed.
|
||||
* objfiles.c (allocate_objfile): Filename arg removed. Changes
|
||||
to get filename from bfd with bfd_get_filename(). Test mapto
|
||||
against 0, not NULL. Use mstrsave() to make copy of filename.
|
||||
* remote-mm.c (mm_load): Symbol_file_add() takes an additional
|
||||
arg.
|
||||
* remote-vx.c (vx_load_command, add_symbol_stub):
|
||||
Symbol_file_add() takes an additional arg.
|
||||
* solib.c (symbol_add_stub): Symbol_file_add() takes an
|
||||
additional arg.
|
||||
* symfile.c (symfile_open): Renamed to symfile_bfd_open and
|
||||
changed to return a bfd not an objfile pointer.
|
||||
* symfile.c (syms_from_objfile): Eliminate local copy of bfd.
|
||||
* symfile.c (symbol_file_add): Takes an additional arg (readnow).
|
||||
Change to eliminate local bfd and use symfile_bfd_open() plus
|
||||
allocate_objfile(). Add code to implement readnow option.
|
||||
* symfile.c (symbol_file_command): Changes to option handling,
|
||||
readnow functionality moved to symbol_file_add().
|
||||
* symfile.c (symfile_init): Eliminate local copy of bfd.
|
||||
* symfile.c (add_symbol_file_command): Changes to parse mapped
|
||||
and readnow options.
|
||||
* symfile.h (allocate_objfile): Arg removed from prototype.
|
||||
* symtab.h (symbol_file_add): Arg added to prototype.
|
||||
* xcoffexec.c (map_vmap): Allocate_objfile() takes an additional
|
||||
arg.
|
||||
|
||||
Sat Mar 14 16:38:47 1992 Fred Fish (fnf@cygnus.com)
|
||||
|
||||
* gmalloc.c, gmalloc.h mcheck.c mmap-alloc.c mmap-sbrk.c mtrace.c,
|
||||
|
|
|
@ -165,7 +165,7 @@ CDEPS = ${XM_CDEPS} ${TM_CDEPS} ${BFD_LIB} ${MMALLOC_LIB} ${LIBIBERTY} \
|
|||
ADD_FILES = ${REGEX} ${ALLOCA} ${XM_ADD_FILES} ${TM_ADD_FILES}
|
||||
ADD_DEPS = ${REGEX1} ${ALLOCA1} ${XM_ADD_FILES} ${TM_ADD_FILES}
|
||||
|
||||
VERSION = 4.4.5
|
||||
VERSION = 4.4.6
|
||||
DIST=gdb
|
||||
|
||||
LINT=/usr/5bin/lint
|
||||
|
|
|
@ -591,7 +591,9 @@ Options available are:\n\
|
|||
-exec=EXECFILE Use EXECFILE as the executable.\n\
|
||||
-se=FILE Use FILE as symbol file and executable file.\n\
|
||||
-core=COREFILE Analyze the core dump COREFILE.\n\
|
||||
-b BAUDRATE Set serial port baud rate used for remote debugging\n\
|
||||
-b BAUDRATE Set serial port baud rate used for remote debugging.\n\
|
||||
-mapped Use mapped symbol files if supported on this system.\n\
|
||||
-readnow Fully read symbol files on first access.\n\
|
||||
", stderr);
|
||||
#ifdef ADDITIONAL_OPTION_HELP
|
||||
fputs (ADDITIONAL_OPTION_HELP, stderr);
|
||||
|
|
|
@ -34,7 +34,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
/* Prototypes for local functions */
|
||||
|
||||
static int
|
||||
open_mapped_file PARAMS ((char *basefile, long mtime, int mapped));
|
||||
open_mapped_file PARAMS ((char *filename, long mtime, int mapped));
|
||||
|
||||
static CORE_ADDR
|
||||
map_to_address PARAMS ((void));
|
||||
|
@ -44,13 +44,14 @@ map_to_address PARAMS ((void));
|
|||
struct objfile *object_files; /* Linked list of all objfiles */
|
||||
int mapped_symbol_files; /* Try to use mapped symbol files */
|
||||
|
||||
/* Allocate a new objfile struct, fill it in as best we can, and return it.
|
||||
It is also linked into the list of all known object files. */
|
||||
/* Given a pointer to an initialized bfd (ABFD) and a flag that indicates
|
||||
whether or not an objfile is to be mapped (MAPPED), allocate a new objfile
|
||||
struct, fill it in as best we can, link it into the list of all known
|
||||
objfiles, and return a pointer to the new objfile struct. */
|
||||
|
||||
struct objfile *
|
||||
allocate_objfile (abfd, filename, mapped)
|
||||
allocate_objfile (abfd, mapped)
|
||||
bfd *abfd;
|
||||
char *filename;
|
||||
int mapped;
|
||||
{
|
||||
struct objfile *objfile = NULL;
|
||||
|
@ -71,10 +72,11 @@ allocate_objfile (abfd, filename, mapped)
|
|||
pointers to the alloc/free functions in the obstack, in case these
|
||||
functions have moved within the current gdb. */
|
||||
|
||||
fd = open_mapped_file (filename, bfd_get_mtime (abfd), mapped);
|
||||
fd = open_mapped_file (bfd_get_filename (abfd), bfd_get_mtime (abfd),
|
||||
mapped);
|
||||
if (fd >= 0)
|
||||
{
|
||||
if (((mapto = map_to_address ()) == NULL) ||
|
||||
if (((mapto = map_to_address ()) == 0) ||
|
||||
((md = mmalloc_attach (fd, (void *) mapto)) == NULL))
|
||||
{
|
||||
close (fd);
|
||||
|
@ -115,7 +117,8 @@ allocate_objfile (abfd, filename, mapped)
|
|||
|
||||
if (mapped && (objfile == NULL))
|
||||
{
|
||||
warning ("symbol table for '%s' will not be mapped", filename);
|
||||
warning ("symbol table for '%s' will not be mapped",
|
||||
bfd_get_filename (abfd));
|
||||
}
|
||||
|
||||
#else /* defined(NO_MMALLOC) || !defined(HAVE_MMAP) */
|
||||
|
@ -151,13 +154,12 @@ allocate_objfile (abfd, filename, mapped)
|
|||
|
||||
}
|
||||
|
||||
/* Now, malloc a fresh copy of the filename string. */
|
||||
|
||||
objfile -> name = xmmalloc (objfile -> md, strlen (filename) + 1);
|
||||
strcpy (objfile -> name, filename);
|
||||
/* Update the per-objfile information that comes from the bfd, ensuring
|
||||
that any data that is reference is saved in the per-objfile data
|
||||
region. */
|
||||
|
||||
objfile -> obfd = abfd;
|
||||
|
||||
objfile -> name = mstrsave (objfile -> md, bfd_get_filename (abfd));
|
||||
objfile -> mtime = bfd_get_mtime (abfd);
|
||||
|
||||
/* Push this file onto the head of the linked list of other such files. */
|
||||
|
@ -408,10 +410,10 @@ iterate_over_psymtabs (func, arg1, arg2, arg3)
|
|||
}
|
||||
|
||||
|
||||
/* Look for a mapped symbol file that corresponds to BASEFILE and is more
|
||||
/* Look for a mapped symbol file that corresponds to FILENAME and is more
|
||||
recent than MTIME. If MAPPED is nonzero, the user has asked that gdb
|
||||
use a mapped symbol file for this base file, so create a new one if
|
||||
one does not currently exist.
|
||||
use a mapped symbol file for this file, so create a new one if one does
|
||||
not currently exist.
|
||||
|
||||
If found, then return an open file descriptor for the file, otherwise
|
||||
return -1.
|
||||
|
@ -421,8 +423,8 @@ iterate_over_psymtabs (func, arg1, arg2, arg3)
|
|||
symbols that gdb would like to read. */
|
||||
|
||||
static int
|
||||
open_mapped_file (basefile, mtime, mapped)
|
||||
char *basefile;
|
||||
open_mapped_file (filename, mtime, mapped)
|
||||
char *filename;
|
||||
long mtime;
|
||||
int mapped;
|
||||
{
|
||||
|
@ -433,7 +435,7 @@ open_mapped_file (basefile, mtime, mapped)
|
|||
/* For now, all we do is look in the local directory for a file with
|
||||
the name of the base file and an extension of ".syms" */
|
||||
|
||||
symfilename = concat ("./", basename (basefile), ".syms", (char *) NULL);
|
||||
symfilename = concat ("./", basename (filename), ".syms", (char *) NULL);
|
||||
|
||||
/* Check to see if the desired file already exists and is more recent than
|
||||
the corresponding base file (specified by the passed MTIME parameter).
|
||||
|
|
|
@ -1082,7 +1082,7 @@ int from_tty;
|
|||
/* You may need to do an init_target_mm() */
|
||||
/* init_target_mm(?,?,?,?,?,?,?,?); */
|
||||
immediate_quit--;
|
||||
/* (void) symbol_file_add (arg_string, from_tty, text_addr, 0); */
|
||||
/* (void) symbol_file_add (arg_string, from_tty, text_addr, 0, 0); */
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -715,7 +715,7 @@ vx_load_command (arg_string, from_tty)
|
|||
immediate_quit--;
|
||||
|
||||
/* FIXME, for now we ignore data_addr and bss_addr. */
|
||||
(void) symbol_file_add (arg_string, from_tty, text_addr, 0);
|
||||
(void) symbol_file_add (arg_string, from_tty, text_addr, 0, 0);
|
||||
}
|
||||
|
||||
#ifdef FIXME /* Not ready for prime time */
|
||||
|
@ -1039,7 +1039,7 @@ add_symbol_stub (arg)
|
|||
struct ldfile *pLoadFile = (struct ldfile *)arg;
|
||||
|
||||
printf("\t%s: ", pLoadFile->name);
|
||||
(void) symbol_file_add (pLoadFile->name, 0, pLoadFile->txt_addr, 0);
|
||||
(void) symbol_file_add (pLoadFile->name, 0, pLoadFile->txt_addr, 0, 0);
|
||||
printf ("ok\n");
|
||||
return 1;
|
||||
}
|
||||
|
|
262
gdb/solib.c
262
gdb/solib.c
|
@ -18,17 +18,19 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <link.h>
|
||||
#include <sys/param.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <a.out.h>
|
||||
|
||||
#include "defs.h"
|
||||
#include "symtab.h"
|
||||
#include "bfd.h"
|
||||
#include "symfile.h"
|
||||
#include "gdbcore.h"
|
||||
#include "command.h"
|
||||
#include "target.h"
|
||||
|
@ -36,10 +38,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#include "regex.h"
|
||||
#include "inferior.h"
|
||||
|
||||
extern char *getenv ();
|
||||
extern char *elf_interpreter (); /* Interpreter name from exec file */
|
||||
extern char *re_comp ();
|
||||
|
||||
#define MAX_PATH_SIZE 256 /* FIXME: Should be dynamic */
|
||||
|
||||
/* On SVR4 systems, for the initial implementation, use main() as the
|
||||
|
@ -76,8 +74,6 @@ static CORE_ADDR flag_addr;
|
|||
#define LM_NAME(so) ((so) -> lm.l_name)
|
||||
static struct r_debug debug_copy;
|
||||
char shadow_contents[BREAKPOINT_MAX]; /* Stash old bkpt addr contents */
|
||||
extern CORE_ADDR proc_base_address ();
|
||||
extern int proc_address_to_fd ();
|
||||
|
||||
#endif /* !SVR4_SHARED_LIBS */
|
||||
|
||||
|
@ -90,6 +86,7 @@ struct so_list {
|
|||
char symbols_loaded; /* flag: symbols read in yet? */
|
||||
char from_tty; /* flag: print msgs? */
|
||||
bfd *so_bfd; /* bfd for so_name */
|
||||
struct objfile *objfile; /* objfile for loaded lib */
|
||||
struct section_table *sections;
|
||||
struct section_table *sections_end;
|
||||
};
|
||||
|
@ -98,6 +95,50 @@ static struct so_list *so_list_head; /* List of known shared objects */
|
|||
static CORE_ADDR debug_base; /* Base of dynamic linker structures */
|
||||
static CORE_ADDR breakpoint_addr; /* Address where end bkpt is set */
|
||||
|
||||
/* Local function prototypes */
|
||||
|
||||
static void
|
||||
special_symbol_handling PARAMS ((struct so_list *));
|
||||
|
||||
static void
|
||||
sharedlibrary_command PARAMS ((char *, int));
|
||||
|
||||
static int
|
||||
enable_break PARAMS ((void));
|
||||
|
||||
static int
|
||||
disable_break PARAMS ((void));
|
||||
|
||||
static void
|
||||
info_sharedlibrary_command PARAMS ((void));
|
||||
|
||||
static int
|
||||
symbol_add_stub PARAMS ((char *));
|
||||
|
||||
static struct so_list *
|
||||
find_solib PARAMS ((struct so_list *));
|
||||
|
||||
static struct link_map *
|
||||
first_link_map_member PARAMS ((void));
|
||||
|
||||
static CORE_ADDR
|
||||
locate_base PARAMS ((void));
|
||||
|
||||
static int
|
||||
look_for_base PARAMS ((int, CORE_ADDR));
|
||||
|
||||
static CORE_ADDR
|
||||
bfd_lookup_symbol PARAMS ((bfd *, char *));
|
||||
|
||||
static void
|
||||
solib_map_sections PARAMS ((struct so_list *));
|
||||
|
||||
#ifndef SVR4_SHARED_LIBS
|
||||
|
||||
static void
|
||||
solib_add_common_symbols PARAMS ((struct rtc_symb *, struct objfile *));
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
|
@ -179,56 +220,69 @@ solib_map_sections (so)
|
|||
}
|
||||
|
||||
/* Read all dynamically loaded common symbol definitions from the inferior
|
||||
and add them to the misc_function_vector. */
|
||||
and add them to the minimal symbol table for the shared library objfile. */
|
||||
|
||||
#ifndef SVR4_SHARED_LIBS
|
||||
|
||||
static void
|
||||
solib_add_common_symbols (rtc_symp)
|
||||
solib_add_common_symbols (rtc_symp, objfile)
|
||||
struct rtc_symb *rtc_symp;
|
||||
struct objfile *objfile;
|
||||
{
|
||||
struct rtc_symb inferior_rtc_symb;
|
||||
struct nlist inferior_rtc_nlist;
|
||||
extern void discard_misc_bunches();
|
||||
int len;
|
||||
char *name;
|
||||
char *origname;
|
||||
|
||||
init_misc_bunches ();
|
||||
make_cleanup (discard_misc_bunches, 0);
|
||||
init_minimal_symbol_collection ();
|
||||
make_cleanup (discard_minimal_symbols, 0);
|
||||
|
||||
while (rtc_symp)
|
||||
{
|
||||
read_memory((CORE_ADDR)rtc_symp,
|
||||
&inferior_rtc_symb,
|
||||
sizeof(inferior_rtc_symb));
|
||||
read_memory((CORE_ADDR)inferior_rtc_symb.rtc_sp,
|
||||
&inferior_rtc_nlist,
|
||||
sizeof(inferior_rtc_nlist));
|
||||
if (inferior_rtc_nlist.n_type == N_COMM)
|
||||
{
|
||||
/* FIXME: The length of the symbol name is not available, but in the
|
||||
current implementation the common symbol is allocated immediately
|
||||
behind the name of the symbol. */
|
||||
int len = inferior_rtc_nlist.n_value - inferior_rtc_nlist.n_un.n_strx;
|
||||
char *name, *origname;
|
||||
read_memory ((CORE_ADDR) rtc_symp,
|
||||
(char *) &inferior_rtc_symb,
|
||||
sizeof (inferior_rtc_symb));
|
||||
read_memory ((CORE_ADDR) inferior_rtc_symb.rtc_sp,
|
||||
(char *) &inferior_rtc_nlist,
|
||||
sizeof(inferior_rtc_nlist));
|
||||
if (inferior_rtc_nlist.n_type == N_COMM)
|
||||
{
|
||||
/* FIXME: The length of the symbol name is not available, but in the
|
||||
current implementation the common symbol is allocated immediately
|
||||
behind the name of the symbol. */
|
||||
len = inferior_rtc_nlist.n_value - inferior_rtc_nlist.n_un.n_strx;
|
||||
|
||||
origname = name = xmalloc (len);
|
||||
read_memory((CORE_ADDR)inferior_rtc_nlist.n_un.n_name, name, len);
|
||||
origname = name = xmalloc (len);
|
||||
read_memory ((CORE_ADDR) inferior_rtc_nlist.n_un.n_name, name, len);
|
||||
|
||||
/* Don't enter the symbol twice if the target is re-run. */
|
||||
/* Don't enter the symbol twice if the target is re-run. */
|
||||
|
||||
#ifdef NAMES_HAVE_UNDERSCORE
|
||||
if (*name == '_')
|
||||
name++;
|
||||
if (*name == '_')
|
||||
{
|
||||
name++;
|
||||
}
|
||||
#endif
|
||||
if (lookup_misc_func (name) < 0)
|
||||
prim_record_misc_function (obsavestring (name, strlen (name)),
|
||||
inferior_rtc_nlist.n_value,
|
||||
mf_bss);
|
||||
free (origname);
|
||||
}
|
||||
rtc_symp = inferior_rtc_symb.rtc_next;
|
||||
/* FIXME: Do we really want to exclude symbols which happen
|
||||
to match symbols for other locations in the inferior's
|
||||
address space, even when they are in different linkage units? */
|
||||
if (lookup_minimal_symbol (name, (struct objfile *) NULL) == NULL)
|
||||
{
|
||||
name = obsavestring (name, strlen (name),
|
||||
&objfile -> symbol_obstack);
|
||||
prim_record_minimal_symbol (name, inferior_rtc_nlist.n_value,
|
||||
mst_bss);
|
||||
}
|
||||
free (origname);
|
||||
}
|
||||
rtc_symp = inferior_rtc_symb.rtc_next;
|
||||
}
|
||||
|
||||
condense_misc_bunches (1);
|
||||
/* Install any minimal symbols that have been collected as the current
|
||||
minimal symbols for this objfile. */
|
||||
|
||||
install_minimal_symbols (objfile);
|
||||
}
|
||||
|
||||
#endif /* SVR4_SHARED_LIBS */
|
||||
|
@ -259,9 +313,9 @@ DESCRIPTION
|
|||
*/
|
||||
|
||||
static CORE_ADDR
|
||||
DEFUN (bfd_lookup_symbol, (abfd, symname),
|
||||
bfd *abfd AND
|
||||
char *symname)
|
||||
bfd_lookup_symbol (abfd, symname)
|
||||
bfd *abfd;
|
||||
char *symname;
|
||||
{
|
||||
unsigned int storage_needed;
|
||||
asymbol *sym;
|
||||
|
@ -270,7 +324,6 @@ DEFUN (bfd_lookup_symbol, (abfd, symname),
|
|||
unsigned int i;
|
||||
struct cleanup *back_to;
|
||||
CORE_ADDR symaddr = 0;
|
||||
enum misc_function_type mf_type;
|
||||
|
||||
storage_needed = get_symtab_upper_bound (abfd);
|
||||
|
||||
|
@ -321,9 +374,9 @@ DESCRIPTION
|
|||
*/
|
||||
|
||||
static int
|
||||
DEFUN (look_for_base, (fd, baseaddr),
|
||||
int fd AND
|
||||
CORE_ADDR baseaddr)
|
||||
look_for_base (fd, baseaddr)
|
||||
int fd;
|
||||
CORE_ADDR baseaddr;
|
||||
{
|
||||
bfd *interp_bfd;
|
||||
CORE_ADDR address;
|
||||
|
@ -401,15 +454,18 @@ DESCRIPTION
|
|||
For SunOS, the job is almost trivial, since the dynamic linker and
|
||||
all of it's structures are statically linked to the executable at
|
||||
link time. Thus the symbol for the address we are looking for has
|
||||
already been added to the misc function vector at the time the symbol
|
||||
file's symbols were read, and all we have to do is look it up there.
|
||||
already been added to the minimal symbol table for the executable's
|
||||
objfile at the time the symbol file's symbols were read, and all we
|
||||
have to do is look it up there. Note that we explicitly do NOT want
|
||||
to find the copies in the shared library.
|
||||
|
||||
The SVR4 version is much more complicated because the dynamic linker
|
||||
and it's structures are located in the shared C library, which gets
|
||||
run as the executable's "interpreter" by the kernel. We have to go
|
||||
to a lot more work to discover the address of DEBUG_BASE. Because
|
||||
of this complexity, we cache the value we find and return that value
|
||||
on subsequent invocations.
|
||||
on subsequent invocations. Note there is no copy in the executable
|
||||
symbol tables.
|
||||
|
||||
Note that we can assume nothing about the process state at the time
|
||||
we need to find this address. We may be stopped on the first instruc-
|
||||
|
@ -425,13 +481,17 @@ locate_base ()
|
|||
|
||||
#ifndef SVR4_SHARED_LIBS
|
||||
|
||||
int i;
|
||||
struct minimal_symbol *msymbol;
|
||||
CORE_ADDR address = 0;
|
||||
|
||||
i = lookup_misc_func (DEBUG_BASE);
|
||||
if (i >= 0 && misc_function_vector[i].address != 0)
|
||||
/* For SunOS, we want to limit the search for DEBUG_BASE to the executable
|
||||
being debugged, since there is a duplicate named symbol in the shared
|
||||
library. We don't want the shared library versions. */
|
||||
|
||||
msymbol = lookup_minimal_symbol (DEBUG_BASE, symfile_objfile);
|
||||
if ((msymbol != NULL) && (msymbol -> address != 0))
|
||||
{
|
||||
address = misc_function_vector[i].address;
|
||||
address = msymbol -> address;
|
||||
}
|
||||
return (address);
|
||||
|
||||
|
@ -461,19 +521,19 @@ first_link_map_member ()
|
|||
|
||||
#ifndef SVR4_SHARED_LIBS
|
||||
|
||||
read_memory (debug_base, &dynamic_copy, sizeof (dynamic_copy));
|
||||
read_memory (debug_base, (char *) &dynamic_copy, sizeof (dynamic_copy));
|
||||
if (dynamic_copy.ld_version >= 2)
|
||||
{
|
||||
/* It is a version that we can deal with, so read in the secondary
|
||||
structure and find the address of the link map list from it. */
|
||||
read_memory ((CORE_ADDR) dynamic_copy.ld_un.ld_2, &ld_2_copy,
|
||||
read_memory ((CORE_ADDR) dynamic_copy.ld_un.ld_2, (char *) &ld_2_copy,
|
||||
sizeof (struct link_dynamic_2));
|
||||
lm = ld_2_copy.ld_loaded;
|
||||
}
|
||||
|
||||
#else /* SVR4_SHARED_LIBS */
|
||||
|
||||
read_memory (debug_base, &debug_copy, sizeof (struct r_debug));
|
||||
read_memory (debug_base, (char *) &debug_copy, sizeof (struct r_debug));
|
||||
lm = debug_copy.r_map;
|
||||
|
||||
#endif /* !SVR4_SHARED_LIBS */
|
||||
|
@ -483,7 +543,7 @@ first_link_map_member ()
|
|||
|
||||
/*
|
||||
|
||||
GLOBAL FUNCTION
|
||||
LOCAL FUNCTION
|
||||
|
||||
find_solib -- step through list of shared objects
|
||||
|
||||
|
@ -504,7 +564,7 @@ DESCRIPTION
|
|||
in <link.h>.
|
||||
*/
|
||||
|
||||
struct so_list *
|
||||
static struct so_list *
|
||||
find_solib (so_list_ptr)
|
||||
struct so_list *so_list_ptr; /* Last lm or NULL for first one */
|
||||
{
|
||||
|
@ -568,7 +628,8 @@ find_solib (so_list_ptr)
|
|||
so_list_head = new;
|
||||
}
|
||||
so_list_next = new;
|
||||
read_memory ((CORE_ADDR) lm, &(new -> lm), sizeof (struct link_map));
|
||||
read_memory ((CORE_ADDR) lm, (char *) &(new -> lm),
|
||||
sizeof (struct link_map));
|
||||
/* For the SVR4 version, there is one entry that has no name
|
||||
(for the inferior executable) since it is not a shared object. */
|
||||
if (LM_NAME (new) != 0)
|
||||
|
@ -591,8 +652,8 @@ symbol_add_stub (arg)
|
|||
{
|
||||
register struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */
|
||||
|
||||
symbol_file_add (so -> so_name, so -> from_tty,
|
||||
(unsigned int) LM_ADDR (so), 0);
|
||||
so -> objfile = symbol_file_add (so -> so_name, so -> from_tty,
|
||||
(unsigned int) LM_ADDR (so), 0, 0, 0);
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
@ -644,10 +705,12 @@ solib_add (arg_string, from_tty, target)
|
|||
}
|
||||
else
|
||||
{
|
||||
so -> symbols_loaded = 1;
|
||||
so -> from_tty = from_tty;
|
||||
catch_errors (symbol_add_stub, (char *) so,
|
||||
"Error while reading shared library symbols:\n");
|
||||
|
||||
special_symbol_handling (so);
|
||||
so -> symbols_loaded = 1;
|
||||
so -> from_tty = from_tty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -737,7 +800,7 @@ info_sharedlibrary_command ()
|
|||
"Shared Object Library");
|
||||
header_done++;
|
||||
}
|
||||
printf ("%-12s", local_hex_string_custom (LM_ADDR (so), "08"));
|
||||
printf ("%-12s", local_hex_string_custom ((int) LM_ADDR (so), "08"));
|
||||
printf ("%-12s", local_hex_string_custom (so -> lmend, "08"));
|
||||
printf ("%-12s", so -> symbols_loaded ? "Yes" : "No");
|
||||
printf ("%s\n", so -> so_name);
|
||||
|
@ -848,18 +911,14 @@ disable_break ()
|
|||
breakpoint address. Remove the breakpoint by writing the original
|
||||
contents back. */
|
||||
|
||||
read_memory (debug_addr, &debug_copy, sizeof (debug_copy));
|
||||
|
||||
/* Get common symbol definitions for the loaded object. */
|
||||
if (debug_copy.ldd_cp)
|
||||
solib_add_common_symbols (debug_copy.ldd_cp);
|
||||
read_memory (debug_addr, (char *) &debug_copy, sizeof (debug_copy));
|
||||
|
||||
/* Set `in_debugger' to zero now. */
|
||||
|
||||
write_memory (flag_addr, &in_debugger, sizeof (in_debugger));
|
||||
write_memory (flag_addr, (char *) &in_debugger, sizeof (in_debugger));
|
||||
|
||||
breakpoint_addr = (CORE_ADDR) debug_copy.ldd_bp_addr;
|
||||
write_memory (breakpoint_addr, &debug_copy.ldd_bp_inst,
|
||||
write_memory (breakpoint_addr, (char *) &debug_copy.ldd_bp_inst,
|
||||
sizeof (debug_copy.ldd_bp_inst));
|
||||
|
||||
#else /* SVR4_SHARED_LIBS */
|
||||
|
@ -962,18 +1021,18 @@ enable_break ()
|
|||
|
||||
in_debugger = 1;
|
||||
|
||||
write_memory (flag_addr, &in_debugger, sizeof (in_debugger));
|
||||
write_memory (flag_addr, (char *) &in_debugger, sizeof (in_debugger));
|
||||
|
||||
#else /* SVR4_SHARED_LIBS */
|
||||
|
||||
#ifdef BKPT_AT_MAIN
|
||||
|
||||
int i;
|
||||
struct minimal_symbol *msymbol;
|
||||
|
||||
i = lookup_misc_func ("main");
|
||||
if (i >= 0 && misc_function_vector[i].address != 0)
|
||||
msymbol = lookup_minimal_symbol ("main", symfile_objfile);
|
||||
if ((msymbol != NULL) && (msymbol -> address != 0))
|
||||
{
|
||||
breakpoint_addr = misc_function_vector[i].address;
|
||||
breakpoint_addr = msymbol -> address;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1102,19 +1161,64 @@ solib_create_inferior_hook()
|
|||
|
||||
/*
|
||||
|
||||
GLOBAL FUNCTION
|
||||
LOCAL FUNCTION
|
||||
|
||||
special_symbol_handling -- additional shared library symbol handling
|
||||
|
||||
SYNOPSIS
|
||||
|
||||
void special_symbol_handling (struct so_list *so)
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
Once the symbols from a shared object have been loaded in the usual
|
||||
way, we are called to do any system specific symbol handling that
|
||||
is needed.
|
||||
|
||||
For Suns, this consists of grunging around in the dynamic linkers
|
||||
structures to find symbol definitions for "common" symbols and
|
||||
adding them to the minimal symbol table for the corresponding
|
||||
objfile.
|
||||
|
||||
*/
|
||||
|
||||
static void
|
||||
special_symbol_handling (so)
|
||||
struct so_list *so;
|
||||
{
|
||||
#ifndef SVR4_SHARED_LIBS
|
||||
|
||||
/* Read the debugger structure from the inferior, just to make sure
|
||||
we have a current copy. */
|
||||
|
||||
read_memory (debug_addr, (char *) &debug_copy, sizeof (debug_copy));
|
||||
|
||||
/* Get common symbol definitions for the loaded object. */
|
||||
|
||||
if (debug_copy.ldd_cp)
|
||||
{
|
||||
solib_add_common_symbols (debug_copy.ldd_cp, so -> objfile);
|
||||
}
|
||||
|
||||
#endif /* !SVR4_SHARED_LIBS */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
LOCAL FUNCTION
|
||||
|
||||
sharedlibrary_command -- handle command to explicitly add library
|
||||
|
||||
SYNOPSIS
|
||||
|
||||
void sharedlibrary_command (char *args, int from_tty)
|
||||
static void sharedlibrary_command (char *args, int from_tty)
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
sharedlibrary_command (args, from_tty)
|
||||
char *args;
|
||||
int from_tty;
|
||||
|
|
221
gdb/symfile.c
221
gdb/symfile.c
|
@ -41,7 +41,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
|
||||
CORE_ADDR entry_point; /* Where execution starts in symfile */
|
||||
struct sym_fns *symtab_fns = NULL; /* List of all available sym_fns. */
|
||||
int readnow_symbol_files; /* Read full symbols immediately */
|
||||
int readnow_symbol_files; /* Read full symbols immediately */
|
||||
|
||||
/* External variables and functions referenced. */
|
||||
|
||||
|
@ -67,8 +67,8 @@ compare_psymbols PARAMS ((const void *, const void *));
|
|||
static int
|
||||
compare_symbols PARAMS ((const void *, const void *));
|
||||
|
||||
static struct objfile *
|
||||
symfile_open PARAMS ((char *, int));
|
||||
static bfd *
|
||||
symfile_bfd_open PARAMS ((char *));
|
||||
|
||||
static struct sym_fns *
|
||||
symfile_init PARAMS ((struct objfile *));
|
||||
|
@ -352,23 +352,22 @@ syms_from_objfile (objfile, addr, mainline, verbo)
|
|||
{
|
||||
asection *text_sect;
|
||||
struct sym_fns *sf;
|
||||
bfd *sym_bfd = objfile->obfd;
|
||||
|
||||
/* There is a distinction between having no symbol table
|
||||
(we refuse to read the file, leaving the old set of symbols around)
|
||||
and having no debugging symbols in your symbol table (we read
|
||||
the file and end up with a mostly empty symbol table). */
|
||||
|
||||
if (!(bfd_get_file_flags (sym_bfd) & HAS_SYMS))
|
||||
if (!(bfd_get_file_flags (objfile -> obfd) & HAS_SYMS))
|
||||
return;
|
||||
|
||||
/* Save startup file's range of PC addresses to help blockframe.c
|
||||
decide where the bottom of the stack is. */
|
||||
if (bfd_get_file_flags (sym_bfd) & EXEC_P)
|
||||
if (bfd_get_file_flags (objfile -> obfd) & EXEC_P)
|
||||
{
|
||||
/* Executable file -- record its entry point so we'll recognize
|
||||
the startup file because it contains the entry point. */
|
||||
entry_point = bfd_get_start_address (sym_bfd);
|
||||
entry_point = bfd_get_start_address (objfile -> obfd);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -394,8 +393,8 @@ syms_from_objfile (objfile, addr, mainline, verbo)
|
|||
|
||||
/* For mainline, caller didn't know the specified address of the
|
||||
text section. We fix that here. */
|
||||
text_sect = bfd_get_section_by_name (sym_bfd, ".text");
|
||||
addr = bfd_section_vma (sym_bfd, text_sect);
|
||||
text_sect = bfd_get_section_by_name (objfile -> obfd, ".text");
|
||||
addr = bfd_section_vma (objfile -> obfd, text_sect);
|
||||
}
|
||||
|
||||
/* Allow complaints to appear for this new file, and record how
|
||||
|
@ -444,18 +443,20 @@ syms_from_objfile (objfile, addr, mainline, verbo)
|
|||
Upon failure, jumps back to command level (never returns). */
|
||||
|
||||
struct objfile *
|
||||
symbol_file_add (name, from_tty, addr, mainline, mapped)
|
||||
symbol_file_add (name, from_tty, addr, mainline, mapped, readnow)
|
||||
char *name;
|
||||
int from_tty;
|
||||
CORE_ADDR addr;
|
||||
int mainline;
|
||||
int mapped;
|
||||
int readnow;
|
||||
{
|
||||
struct objfile *objfile;
|
||||
bfd *sym_bfd;
|
||||
struct partial_symtab *psymtab;
|
||||
|
||||
objfile = symfile_open (name, mapped);
|
||||
sym_bfd = objfile->obfd;
|
||||
/* Open a bfd for the file, then allocate a new objfile. */
|
||||
|
||||
objfile = allocate_objfile (symfile_bfd_open (name), mapped);
|
||||
|
||||
/* There is a distinction between having no symbol table
|
||||
(we refuse to read the file, leaving the old set of symbols around)
|
||||
|
@ -463,7 +464,7 @@ symbol_file_add (name, from_tty, addr, mainline, mapped)
|
|||
the file and end up with a mostly empty symbol table, but with lots
|
||||
of stuff in the minimal symbol table). */
|
||||
|
||||
if (!(bfd_get_file_flags (sym_bfd) & HAS_SYMS))
|
||||
if (!(bfd_get_file_flags (objfile -> obfd) & HAS_SYMS))
|
||||
{
|
||||
error ("%s has no symbol-table", name);
|
||||
}
|
||||
|
@ -496,6 +497,24 @@ symbol_file_add (name, from_tty, addr, mainline, mapped)
|
|||
|
||||
syms_from_objfile (objfile, addr, mainline, from_tty);
|
||||
|
||||
readnow |= readnow_symbol_files;
|
||||
if (readnow)
|
||||
{
|
||||
if (from_tty || info_verbose)
|
||||
{
|
||||
printf_filtered ("expanding to full symbols...");
|
||||
wrap_here ("");
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
for (psymtab = objfile -> psymtabs;
|
||||
psymtab != NULL;
|
||||
psymtab = psymtab -> next)
|
||||
{
|
||||
(void) psymtab_to_symtab (psymtab);
|
||||
}
|
||||
}
|
||||
|
||||
if (from_tty || info_verbose)
|
||||
{
|
||||
printf_filtered ("done.\n");
|
||||
|
@ -514,10 +533,9 @@ symbol_file_command (args, from_tty)
|
|||
int from_tty;
|
||||
{
|
||||
char **argv;
|
||||
char *name;
|
||||
char *name = NULL;
|
||||
struct cleanup *cleanups;
|
||||
struct objfile *objfile;
|
||||
struct partial_symtab *psymtab;
|
||||
int mapped = 0;
|
||||
int readnow = 0;
|
||||
|
||||
|
@ -549,65 +567,65 @@ symbol_file_command (args, from_tty)
|
|||
nomem (0);
|
||||
}
|
||||
cleanups = make_cleanup (freeargv, (char *) argv);
|
||||
|
||||
name = *argv;
|
||||
while (*++argv != NULL)
|
||||
while (*argv != NULL)
|
||||
{
|
||||
if (!strcmp (*argv, "mapped"))
|
||||
if (strcmp (*argv, "-mapped") == 0)
|
||||
{
|
||||
mapped = 1;
|
||||
}
|
||||
else if (!strcmp (*argv, "readnow"))
|
||||
else if (strcmp (*argv, "-readnow") == 0)
|
||||
{
|
||||
readnow = 1;
|
||||
}
|
||||
else if (**argv == '-')
|
||||
{
|
||||
error ("unknown option `%s'", *argv);
|
||||
}
|
||||
else
|
||||
{
|
||||
name = *argv;
|
||||
}
|
||||
argv++;
|
||||
}
|
||||
|
||||
if (name != NULL)
|
||||
if (name == NULL)
|
||||
{
|
||||
error ("no symbol file name was specified");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Getting new symbols may change our opinion about what is
|
||||
frameless. */
|
||||
reinit_frame_cache ();
|
||||
objfile = symbol_file_add (name, from_tty, (CORE_ADDR)0, 1,
|
||||
mapped);
|
||||
readnow |= readnow_symbol_files;
|
||||
if (readnow)
|
||||
{
|
||||
for (psymtab = objfile -> psymtabs;
|
||||
psymtab != NULL;
|
||||
psymtab = psymtab -> next)
|
||||
{
|
||||
(void) psymtab_to_symtab (psymtab);
|
||||
}
|
||||
}
|
||||
mapped, readnow);
|
||||
}
|
||||
do_cleanups (cleanups);
|
||||
}
|
||||
}
|
||||
|
||||
/* Open NAME and hand it off to BFD for preliminary analysis. Result
|
||||
is newly malloc'd struct objfile *, which includes a newly malloc'd`
|
||||
copy of NAME (tilde-expanded and made absolute).
|
||||
/* Open file specified by NAME and hand it off to BFD for preliminary
|
||||
analysis. Result is a newly initialized bfd *, which includes a newly
|
||||
malloc'd` copy of NAME (tilde-expanded and made absolute).
|
||||
In case of trouble, error() is called. */
|
||||
|
||||
static struct objfile *
|
||||
symfile_open (name, mapped)
|
||||
static bfd *
|
||||
symfile_bfd_open (name)
|
||||
char *name;
|
||||
int mapped;
|
||||
{
|
||||
bfd *sym_bfd;
|
||||
int desc;
|
||||
char *absolute_name;
|
||||
struct objfile *objfile;
|
||||
|
||||
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, 0, &absolute_name);
|
||||
if (desc < 0) {
|
||||
make_cleanup (free, name);
|
||||
perror_with_name (name);
|
||||
}
|
||||
if (desc < 0)
|
||||
{
|
||||
make_cleanup (free, name);
|
||||
perror_with_name (name);
|
||||
}
|
||||
free (name); /* Free 1st new malloc'd copy */
|
||||
name = absolute_name; /* Keep 2nd malloc'd copy in bfd */
|
||||
|
||||
|
@ -616,19 +634,19 @@ symfile_open (name, mapped)
|
|||
{
|
||||
close (desc);
|
||||
make_cleanup (free, name);
|
||||
error ("Could not open `%s' to read symbols: %s",
|
||||
name, bfd_errmsg (bfd_error));
|
||||
error ("\"%s\": can't open to read symbols: %s.", name,
|
||||
bfd_errmsg (bfd_error));
|
||||
}
|
||||
|
||||
if (!bfd_check_format (sym_bfd, bfd_object)) {
|
||||
bfd_close (sym_bfd); /* This also closes desc */
|
||||
make_cleanup (free, name);
|
||||
error ("\"%s\": can't read symbols: %s.",
|
||||
name, bfd_errmsg (bfd_error));
|
||||
}
|
||||
if (!bfd_check_format (sym_bfd, bfd_object))
|
||||
{
|
||||
bfd_close (sym_bfd); /* This also closes desc */
|
||||
make_cleanup (free, name);
|
||||
error ("\"%s\": can't read symbols: %s.", name,
|
||||
bfd_errmsg (bfd_error));
|
||||
}
|
||||
|
||||
objfile = allocate_objfile (sym_bfd, name, mapped);
|
||||
return objfile;
|
||||
return (sym_bfd);
|
||||
}
|
||||
|
||||
/* Link a new symtab_fns into the global symtab_fns list.
|
||||
|
@ -652,24 +670,23 @@ symfile_init (objfile)
|
|||
struct objfile *objfile;
|
||||
{
|
||||
struct sym_fns *sf, *sf2;
|
||||
bfd *sym_bfd = objfile->obfd;
|
||||
|
||||
for (sf = symtab_fns; sf != NULL; sf = sf->next)
|
||||
{
|
||||
if (!strncmp (bfd_get_target (sym_bfd), sf->sym_name, sf->sym_namelen))
|
||||
if (!strncmp (bfd_get_target (objfile -> obfd), sf->sym_name, sf->sym_namelen))
|
||||
{
|
||||
sf2 = (struct sym_fns *)xmalloc (sizeof (*sf2));
|
||||
/* FIXME, who frees this? */
|
||||
*sf2 = *sf;
|
||||
sf2->objfile = objfile;
|
||||
sf2->sym_bfd = sym_bfd;
|
||||
sf2->sym_bfd = objfile -> obfd;
|
||||
sf2->sym_private = 0; /* Not alloc'd yet */
|
||||
(*sf2->sym_init) (sf2);
|
||||
return sf2;
|
||||
}
|
||||
}
|
||||
error ("I'm sorry, Dave, I can't do that. Symbol format `%s' unknown.",
|
||||
bfd_get_target (sym_bfd));
|
||||
bfd_get_target (objfile -> obfd));
|
||||
return 0; /* Appease lint. */
|
||||
}
|
||||
|
||||
|
@ -688,40 +705,80 @@ load_command (arg, from_tty)
|
|||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
add_symbol_file_command (arg_string, from_tty)
|
||||
char *arg_string;
|
||||
add_symbol_file_command (args, from_tty)
|
||||
char *args;
|
||||
int from_tty;
|
||||
{
|
||||
char *name;
|
||||
char *name = NULL;
|
||||
CORE_ADDR text_addr;
|
||||
char *arg;
|
||||
int readnow;
|
||||
int mapped;
|
||||
|
||||
/* 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");
|
||||
|
||||
arg_string = tilde_expand (arg_string);
|
||||
make_cleanup (free, arg_string);
|
||||
|
||||
for( ; *arg_string == ' '; arg_string++ );
|
||||
name = arg_string;
|
||||
for( ; *arg_string && *arg_string != ' ' ; arg_string++ );
|
||||
*arg_string++ = (char) 0;
|
||||
|
||||
if (name[0] == 0)
|
||||
error ("add-symbol-file takes a file name and an address");
|
||||
|
||||
text_addr = parse_and_eval_address (arg_string);
|
||||
|
||||
dont_repeat ();
|
||||
|
||||
if (args == NULL)
|
||||
{
|
||||
error ("add-symbol-file takes a file name and an address");
|
||||
}
|
||||
|
||||
/* Make a copy of the string that we can safely write into. */
|
||||
|
||||
args = strdup (args);
|
||||
make_cleanup (free, args);
|
||||
|
||||
/* Pick off any -option args and the file name. */
|
||||
|
||||
while ((*args != '\000') && (name == NULL))
|
||||
{
|
||||
while (isspace (*args)) {args++;}
|
||||
arg = args;
|
||||
while ((*args != '\000') && !isspace (*args)) {args++;}
|
||||
if (*args != '\000')
|
||||
{
|
||||
*args++ = '\000';
|
||||
}
|
||||
if (*arg != '-')
|
||||
{
|
||||
name = arg;
|
||||
}
|
||||
else if (strcmp (arg, "-mapped") == 0)
|
||||
{
|
||||
mapped = 1;
|
||||
}
|
||||
else if (strcmp (arg, "-readnow") == 0)
|
||||
{
|
||||
readnow = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
error ("unknown option `%s'", arg);
|
||||
}
|
||||
}
|
||||
|
||||
/* After picking off any options and the file name, args should be
|
||||
left pointing at the remainder of the command line, which should
|
||||
be the address expression to evaluate. */
|
||||
|
||||
if ((name == NULL) || (*args == '\000') )
|
||||
{
|
||||
error ("add-symbol-file takes a file name and an address");
|
||||
}
|
||||
name = tilde_expand (name);
|
||||
make_cleanup (free, name);
|
||||
|
||||
text_addr = parse_and_eval_address (args);
|
||||
|
||||
if (!query ("add symbol table from file \"%s\" at text_addr = %s?\n",
|
||||
name, local_hex_string (text_addr)))
|
||||
error ("Not confirmed.");
|
||||
|
||||
(void) symbol_file_add (name, 0, text_addr, 0, 0);
|
||||
/* Getting new symbols may change our opinion about what is
|
||||
frameless. */
|
||||
|
||||
reinit_frame_cache ();
|
||||
|
||||
(void) symbol_file_add (name, 0, text_addr, 0, mapped, readnow);
|
||||
}
|
||||
|
||||
/* Re-read symbols if a symbol-file has changed. */
|
||||
|
|
|
@ -251,7 +251,7 @@ extern struct symtab *
|
|||
allocate_symtab PARAMS ((char *, struct objfile *));
|
||||
|
||||
extern struct objfile *
|
||||
allocate_objfile PARAMS ((bfd *, char *, int));
|
||||
allocate_objfile PARAMS ((bfd *, int));
|
||||
|
||||
extern void
|
||||
free_objfile PARAMS ((struct objfile *));
|
||||
|
|
615
gdb/symtab.h
615
gdb/symtab.h
|
@ -1,5 +1,5 @@
|
|||
/* Symbol table definitions for GDB.
|
||||
Copyright (C) 1986, 1989, 1991 Free Software Foundation, Inc.
|
||||
Copyright (C) 1986, 1989, 1991, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
|
@ -21,13 +21,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#define SYMTAB_H 1
|
||||
#include "obstack.h"
|
||||
|
||||
/* An obstack to hold objects that should be freed
|
||||
when we load a new symbol table.
|
||||
This includes the symbols made by dbxread
|
||||
and the types that are not permanent. */
|
||||
/* See the comment in symfile.c about how current_objfile is used. */
|
||||
|
||||
extern struct obstack *symbol_obstack;
|
||||
extern struct obstack *psymbol_obstack;
|
||||
extern struct objfile *current_objfile;
|
||||
|
||||
/* Some definitions and declarations to go with use of obstacks. */
|
||||
#define obstack_chunk_alloc xmalloc
|
||||
|
@ -41,237 +37,61 @@ extern struct obstack *psymbol_obstack;
|
|||
#define B_BYTES(x) ( 1 + ((x)>>3) )
|
||||
#define B_CLRALL(a,x) bzero (a, B_BYTES(x))
|
||||
|
||||
/* gdb can know one or several symbol tables at the same time;
|
||||
the ultimate intent is to have one for each separately-compiled module.
|
||||
Each such symbol table is recorded by a struct symtab, and they
|
||||
are all chained together. */
|
||||
|
||||
/* In addition, gdb can record any number of miscellaneous undebuggable
|
||||
functions' addresses. In a system that appends _ to function names,
|
||||
the _'s are removed from the names stored in this table. */
|
||||
/* Define a simple structure used to hold some very basic information about
|
||||
all defined global symbols (text, data, bss, abs, etc). The only two
|
||||
required pieces of information are the symbol's name and the address
|
||||
associated with that symbol. In many cases, even if a file was compiled
|
||||
with no special options for debugging at all, as long as was not stripped
|
||||
it will contain sufficient information to build a useful minimal symbol
|
||||
table using this structure. Even when a file contains enough debugging
|
||||
information to build a full symbol table, these minimal symbols are still
|
||||
useful for quickly mapping between names and addresses, and vice versa.
|
||||
They are also sometimes used to figure out what full symbol table entries
|
||||
need to be read in. */
|
||||
|
||||
/* Actually, the misc function list is used to store *all* of the
|
||||
global symbols (text, data, bss, and abs). It is sometimes used
|
||||
to figure out what symtabs to read in. The "type" field is used
|
||||
occasionally. Calling it the misc "function" vector is now a misnomer.
|
||||
|
||||
The misc_info field is available for machine-specific information
|
||||
that can be cached along with a misc function vector entry. The
|
||||
AMD 29000 tdep.c uses it to remember things it has decoded from the
|
||||
instructions in the function header, 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. */
|
||||
|
||||
enum misc_function_type {mf_unknown = 0, mf_text, mf_data, mf_bss, mf_abs};
|
||||
|
||||
struct misc_function
|
||||
struct minimal_symbol
|
||||
{
|
||||
|
||||
/* Name of the symbol. This is a required field. Storage for the name is
|
||||
allocated on the symbol_obstack for the associated objfile. */
|
||||
|
||||
char *name;
|
||||
|
||||
/* Address of the symbol. This is a required field. */
|
||||
|
||||
CORE_ADDR address;
|
||||
char *misc_info; /* Random pointer to misc info. void * but for old C */
|
||||
enum misc_function_type type;
|
||||
};
|
||||
|
||||
/* Address and length of the vector recording all misc function names/addresses. */
|
||||
/* The info field is available for caching machine-specific information that
|
||||
The AMD 29000 tdep.c uses it to remember things it has decoded from the
|
||||
instructions in the function header, 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 allocated 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. */
|
||||
|
||||
struct misc_function *misc_function_vector;
|
||||
int misc_function_count;
|
||||
|
||||
/* Different kinds of data types are distinguished by the `code' field. */
|
||||
char *info;
|
||||
|
||||
enum type_code
|
||||
{
|
||||
TYPE_CODE_UNDEF, /* Not used; catches errors */
|
||||
TYPE_CODE_PTR, /* Pointer type */
|
||||
TYPE_CODE_ARRAY, /* Array type, lower bound zero */
|
||||
TYPE_CODE_STRUCT, /* C struct or Pascal record */
|
||||
TYPE_CODE_UNION, /* C union or Pascal variant part */
|
||||
TYPE_CODE_ENUM, /* Enumeration type */
|
||||
TYPE_CODE_FUNC, /* Function type */
|
||||
TYPE_CODE_INT, /* Integer type */
|
||||
TYPE_CODE_FLT, /* Floating type */
|
||||
TYPE_CODE_VOID, /* Void type (values zero length) */
|
||||
TYPE_CODE_SET, /* Pascal sets */
|
||||
TYPE_CODE_RANGE, /* Range (integers within spec'd bounds) */
|
||||
TYPE_CODE_PASCAL_ARRAY, /* Array with explicit type of index */
|
||||
TYPE_CODE_ERROR, /* Unknown type */
|
||||
/* 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. */
|
||||
|
||||
/* C++ */
|
||||
TYPE_CODE_MEMBER, /* Member type */
|
||||
TYPE_CODE_METHOD, /* Method type */
|
||||
TYPE_CODE_REF, /* C++ Reference types */
|
||||
|
||||
/* Modula-2 */
|
||||
TYPE_CODE_CHAR, /* *real* character type */
|
||||
TYPE_CODE_BOOL /* Builtin Modula-2 BOOLEAN */
|
||||
};
|
||||
|
||||
/* This appears in a type's flags word for an unsigned integer type. */
|
||||
#define TYPE_FLAG_UNSIGNED 1
|
||||
/* This appears in a type's flags word
|
||||
if it is a (pointer to a|function returning a)* built in scalar type.
|
||||
These types are never freed. */
|
||||
#define TYPE_FLAG_PERM 4
|
||||
/* This appears in a type's flags word if it is a stub type (eg. if
|
||||
someone referenced a type that wasn't definined in a source file
|
||||
via (struct sir_not_appearing_in_this_film *)). */
|
||||
#define TYPE_FLAG_STUB 8
|
||||
|
||||
struct type
|
||||
{
|
||||
/* Code for kind of type */
|
||||
enum type_code code;
|
||||
/* Name of this type, or zero if none.
|
||||
This is used for printing only, except by poorly designed C++ code.
|
||||
Type names specified as input are defined by symbols. */
|
||||
char *name;
|
||||
/* Length in bytes of storage for a value of this type */
|
||||
unsigned length;
|
||||
/* For a pointer type, describes the type of object pointed to.
|
||||
For an array type, describes the type of the elements.
|
||||
For a function or method type, describes the type of the value.
|
||||
For a range type, describes the type of the full range.
|
||||
Unused otherwise. */
|
||||
struct type *target_type;
|
||||
|
||||
/* Type that is a pointer to this type.
|
||||
Zero if no such pointer-to type is known yet.
|
||||
The debugger may add the address of such a type
|
||||
if it has to construct one later. */
|
||||
struct type *pointer_type;
|
||||
/* C++: also need a reference type. */
|
||||
struct type *reference_type;
|
||||
/* Type that is a function returning this type.
|
||||
Zero if no such function type is known here.
|
||||
The debugger may add the address of such a type
|
||||
if it has to construct one later. */
|
||||
struct type *function_type;
|
||||
|
||||
/* Flags about this type. */
|
||||
short flags;
|
||||
/* Number of fields described for this type */
|
||||
short nfields;
|
||||
/* For structure and union types, a description of each field.
|
||||
For set and pascal array types, there is one "field",
|
||||
whose type is the domain type of the set or array.
|
||||
For range types, there are two "fields",
|
||||
the minimum and maximum values (both inclusive).
|
||||
For enum types, each possible value is described by one "field".
|
||||
|
||||
Using a pointer to a separate array of fields
|
||||
allows all types to have the same size, which is useful
|
||||
because we can allocate the space for a type before
|
||||
we know what to put in it. */
|
||||
struct field
|
||||
enum minimal_symbol_type
|
||||
{
|
||||
/* Position of this field, counting in bits from start of
|
||||
containing structure. For a function type, this is the
|
||||
position in the argument list of this argument.
|
||||
For a range bound or enum value, this is the value itself. */
|
||||
int bitpos;
|
||||
/* Size of this field, in bits, or zero if not packed.
|
||||
For an unpacked field, the field's type's length
|
||||
says how many bytes the field occupies. */
|
||||
int bitsize;
|
||||
/* In a struct or enum type, type of this field.
|
||||
In a function type, type of this argument.
|
||||
In an array type, the domain-type of the array. */
|
||||
struct type *type;
|
||||
/* Name of field, value or argument.
|
||||
Zero for range bounds and array domains. */
|
||||
char *name;
|
||||
} *fields;
|
||||
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) */
|
||||
} type;
|
||||
|
||||
/* For types with virtual functions, VPTR_BASETYPE is the base class which
|
||||
defined the virtual function table pointer. VPTR_FIELDNO is
|
||||
the field number of that pointer in the structure.
|
||||
|
||||
For types that are pointer to member types, VPTR_BASETYPE
|
||||
is the type that this pointer is a member of.
|
||||
|
||||
Unused otherwise. */
|
||||
struct type *vptr_basetype;
|
||||
|
||||
int vptr_fieldno;
|
||||
|
||||
/* Slot to point to additional language-specific fields of this type. */
|
||||
union type_specific
|
||||
{
|
||||
/* ARG_TYPES is for TYPE_CODE_METHOD and TYPE_CODE_FUNC. */
|
||||
struct type **arg_types;
|
||||
/* CPLUS_STUFF is for TYPE_CODE_STRUCT. */
|
||||
struct cplus_struct_type *cplus_stuff;
|
||||
} type_specific;
|
||||
};
|
||||
|
||||
/* C++ language-specific information for TYPE_CODE_STRUCT and TYPE_CODE_UNION
|
||||
nodes. */
|
||||
struct cplus_struct_type
|
||||
{
|
||||
B_TYPE *virtual_field_bits; /* if base class is virtual */
|
||||
B_TYPE *private_field_bits;
|
||||
B_TYPE *protected_field_bits;
|
||||
|
||||
/* Number of methods described for this type */
|
||||
short nfn_fields;
|
||||
/* Number of base classes this type derives from. */
|
||||
short n_baseclasses;
|
||||
|
||||
/* Number of methods described for this type plus all the
|
||||
methods that it derives from. */
|
||||
int nfn_fields_total;
|
||||
|
||||
/* For classes, structures, and unions, a description of each field,
|
||||
which consists of an overloaded name, followed by the types of
|
||||
arguments that the method expects, and then the name after it
|
||||
has been renamed to make it distinct. */
|
||||
struct fn_fieldlist
|
||||
{
|
||||
/* The overloaded name. */
|
||||
char *name;
|
||||
/* The number of methods with this name. */
|
||||
int length;
|
||||
/* The list of methods. */
|
||||
struct fn_field
|
||||
{
|
||||
/* The return value of the method */
|
||||
struct type *type;
|
||||
/* The argument list */
|
||||
struct type **args;
|
||||
/* The name after it has been processed */
|
||||
char *physname;
|
||||
|
||||
/* For virtual functions. */
|
||||
/* First baseclass that defines this virtual function. */
|
||||
struct type *fcontext;
|
||||
unsigned int is_const : 1;
|
||||
unsigned int is_volatile : 1;
|
||||
unsigned int is_private : 1;
|
||||
unsigned int is_protected : 1;
|
||||
unsigned int is_stub : 1;
|
||||
unsigned int dummy : 3;
|
||||
|
||||
/* Index into that baseclass's virtual function table,
|
||||
minus 2; else if static: VOFFSET_STATIC; else: 0. */
|
||||
unsigned voffset : 24;
|
||||
# define VOFFSET_STATIC 1
|
||||
} *fn_fields;
|
||||
|
||||
} *fn_fieldlists;
|
||||
|
||||
unsigned char via_protected;
|
||||
unsigned char via_public;
|
||||
};
|
||||
/* The default value of TYPE_CPLUS_SPECIFIC(T) points to the
|
||||
this shared static structure. */
|
||||
|
||||
extern struct cplus_struct_type cplus_struct_default;
|
||||
|
||||
extern void allocate_cplus_struct_type ();
|
||||
#define ALLOCATE_CPLUS_STRUCT_TYPE(type) allocate_cplus_struct_type (type)
|
||||
#define HAVE_CPLUS_STRUCT(type) \
|
||||
(TYPE_CPLUS_SPECIFIC(type) != &cplus_struct_default)
|
||||
|
||||
|
||||
/* All of the name-scope contours of the program
|
||||
are represented by `struct block' objects.
|
||||
|
@ -438,7 +258,7 @@ struct symbol
|
|||
symbols whose types we have not parsed yet. For functions, it also
|
||||
contains their memory address, so we can find them from a PC value.
|
||||
Each partial_symbol sits in a partial_symtab, all of which are chained
|
||||
on the partial_symtab_list and which points to the corresponding
|
||||
on a partial symtab list and which points to the corresponding
|
||||
normal symtab once the partial_symtab has been referenced. */
|
||||
|
||||
struct partial_symbol
|
||||
|
@ -542,8 +362,6 @@ struct symtab
|
|||
|
||||
/* Object file from which this symbol information was read. */
|
||||
struct objfile *objfile;
|
||||
/* Chain of all symtabs owned by that objfile. */
|
||||
struct symtab *objfile_chain;
|
||||
|
||||
/* Anything extra for this symtab. This is for target machines
|
||||
with special debugging info of some sort (which cannot just
|
||||
|
@ -557,12 +375,13 @@ struct symtab
|
|||
a partial_symtab. This contains the information on where in the
|
||||
executable the debugging symbols for a specific file are, and a
|
||||
list of names of global symbols which are located in this file.
|
||||
They are all chained on partial_symtab_list.
|
||||
They are all chained on partial symtab lists.
|
||||
|
||||
Even after the source file has been read into a symtab, the
|
||||
partial_symtab remains around. They are allocated on an obstack,
|
||||
psymbol_obstack. FIXME, this is bad for dynamic linking or VxWorks-
|
||||
style execution of a bunch of .o's. */
|
||||
|
||||
struct partial_symtab
|
||||
{
|
||||
/* Chain of all existing partial symtabs. */
|
||||
|
@ -572,8 +391,6 @@ struct partial_symtab
|
|||
|
||||
/* Information about the object file from which symbols should be read. */
|
||||
struct objfile *objfile;
|
||||
/* Chain of psymtabs owned by this objfile */
|
||||
struct partial_symtab *objfile_chain;
|
||||
|
||||
/* Address relative to which the symbols in this file are. Need to
|
||||
relocate by this amount when reading in symbols from the symbol
|
||||
|
@ -606,7 +423,7 @@ struct partial_symtab
|
|||
struct symtab *symtab;
|
||||
/* Pointer to function which will read in the symtab corresponding to
|
||||
this psymtab. */
|
||||
void (*read_symtab) ();
|
||||
void (*read_symtab) PARAMS ((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
|
||||
|
@ -623,14 +440,6 @@ struct partial_symtab
|
|||
(pst)->symtab: \
|
||||
psymtab_to_symtab (pst) )
|
||||
|
||||
/* This is the list of struct symtab's that gdb considers current. */
|
||||
|
||||
struct symtab *symtab_list;
|
||||
|
||||
/* This is the list of struct partial_symtab's that gdb may need to access */
|
||||
|
||||
struct partial_symtab *partial_symtab_list;
|
||||
|
||||
/* This symtab variable specifies the current file for printing source lines */
|
||||
|
||||
struct symtab *current_source_symtab;
|
||||
|
@ -670,86 +479,6 @@ int current_source_line;
|
|||
#define SYMBOL_TYPE(symbol) (symbol)->type
|
||||
#define SYMBOL_LINE(symbol) (symbol)->line
|
||||
|
||||
#define TYPE_NAME(thistype) (thistype)->name
|
||||
#define TYPE_TARGET_TYPE(thistype) (thistype)->target_type
|
||||
#define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
|
||||
#define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
|
||||
#define TYPE_FUNCTION_TYPE(thistype) (thistype)->function_type
|
||||
#define TYPE_LENGTH(thistype) (thistype)->length
|
||||
#define TYPE_FLAGS(thistype) (thistype)->flags
|
||||
#define TYPE_UNSIGNED(thistype) ((thistype)->flags & TYPE_FLAG_UNSIGNED)
|
||||
#define TYPE_CODE(thistype) (thistype)->code
|
||||
#define TYPE_NFIELDS(thistype) (thistype)->nfields
|
||||
#define TYPE_FIELDS(thistype) (thistype)->fields
|
||||
/* C++ */
|
||||
#define TYPE_VPTR_BASETYPE(thistype) (thistype)->vptr_basetype
|
||||
#define TYPE_DOMAIN_TYPE(thistype) (thistype)->vptr_basetype
|
||||
#define TYPE_VPTR_FIELDNO(thistype) (thistype)->vptr_fieldno
|
||||
#define TYPE_FN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->fn_fields
|
||||
#define TYPE_NFN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields
|
||||
#define TYPE_NFN_FIELDS_TOTAL(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields_total
|
||||
#define TYPE_TYPE_SPECIFIC(thistype) (thistype)->type_specific
|
||||
#define TYPE_ARG_TYPES(thistype) (thistype)->type_specific.arg_types
|
||||
#define TYPE_CPLUS_SPECIFIC(thistype) (thistype)->type_specific.cplus_stuff
|
||||
#define TYPE_BASECLASS(thistype,index) (thistype)->fields[index].type
|
||||
#define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
|
||||
#define TYPE_BASECLASS_NAME(thistype,index) (thistype)->fields[index].name
|
||||
#define TYPE_BASECLASS_BITPOS(thistype,index) (thistype)->fields[index].bitpos
|
||||
#define BASETYPE_VIA_PUBLIC(thistype, index) (!TYPE_FIELD_PRIVATE(thistype, index))
|
||||
#define BASETYPE_VIA_VIRTUAL(thistype, index) \
|
||||
B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index))
|
||||
|
||||
#define TYPE_FIELD(thistype, n) (thistype)->fields[n]
|
||||
#define TYPE_FIELD_TYPE(thistype, n) (thistype)->fields[n].type
|
||||
#define TYPE_FIELD_NAME(thistype, n) (thistype)->fields[n].name
|
||||
#define TYPE_FIELD_VALUE(thistype, n) (* (int*) &(thistype)->fields[n].type)
|
||||
#define TYPE_FIELD_BITPOS(thistype, n) (thistype)->fields[n].bitpos
|
||||
#define TYPE_FIELD_BITSIZE(thistype, n) (thistype)->fields[n].bitsize
|
||||
#define TYPE_FIELD_PACKED(thistype, n) (thistype)->fields[n].bitsize
|
||||
|
||||
#define TYPE_FIELD_PRIVATE_BITS(thistype) \
|
||||
TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits
|
||||
#define TYPE_FIELD_PROTECTED_BITS(thistype) \
|
||||
TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits
|
||||
#define TYPE_FIELD_VIRTUAL_BITS(thistype) \
|
||||
TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits
|
||||
#define SET_TYPE_FIELD_PRIVATE(thistype, n) \
|
||||
B_SET (TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits, (n))
|
||||
#define SET_TYPE_FIELD_PROTECTED(thistype, n) \
|
||||
B_SET (TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits, (n))
|
||||
#define SET_TYPE_FIELD_VIRTUAL(thistype, n) \
|
||||
B_SET (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n))
|
||||
#define TYPE_FIELD_PRIVATE(thistype, n) \
|
||||
(TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits == NULL ? 0 \
|
||||
: B_TST(TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits, (n)))
|
||||
#define TYPE_FIELD_PROTECTED(thistype, n) \
|
||||
(TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits == NULL ? 0 \
|
||||
: B_TST(TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits, (n)))
|
||||
#define TYPE_FIELD_VIRTUAL(thistype, n) \
|
||||
B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n))
|
||||
|
||||
#define TYPE_FIELD_STATIC(thistype, n) ((thistype)->fields[n].bitpos == -1)
|
||||
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) ((char *)(thistype)->fields[n].bitsize)
|
||||
|
||||
#define TYPE_FN_FIELDLISTS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists
|
||||
#define TYPE_FN_FIELDLIST(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n]
|
||||
#define TYPE_FN_FIELDLIST1(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].fn_fields
|
||||
#define TYPE_FN_FIELDLIST_NAME(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].name
|
||||
#define TYPE_FN_FIELDLIST_LENGTH(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].length
|
||||
|
||||
#define TYPE_FN_FIELD(thisfn, n) (thisfn)[n]
|
||||
#define TYPE_FN_FIELD_NAME(thisfn, n) (thisfn)[n].name
|
||||
#define TYPE_FN_FIELD_TYPE(thisfn, n) (thisfn)[n].type
|
||||
#define TYPE_FN_FIELD_ARGS(thisfn, n) TYPE_ARG_TYPES ((thisfn)[n].type)
|
||||
#define TYPE_FN_FIELD_PHYSNAME(thisfn, n) (thisfn)[n].physname
|
||||
#define TYPE_FN_FIELD_VIRTUAL_P(thisfn, n) ((thisfn)[n].voffset > 1)
|
||||
#define TYPE_FN_FIELD_STATIC_P(thisfn, n) ((thisfn)[n].voffset == VOFFSET_STATIC)
|
||||
#define TYPE_FN_FIELD_VOFFSET(thisfn, n) ((thisfn)[n].voffset-2)
|
||||
#define TYPE_FN_FIELD_FCONTEXT(thisfn, n) ((thisfn)[n].fcontext)
|
||||
#define TYPE_FN_FIELD_STUB(thisfn, n) ((thisfn)[n].is_stub)
|
||||
#define TYPE_FN_FIELD_PRIVATE(thisfn, n) ((thisfn)[n].is_private)
|
||||
#define TYPE_FN_FIELD_PROTECTED(thisfn, n) ((thisfn)[n].is_protected)
|
||||
|
||||
/* The virtual function table is now an array of structures
|
||||
which have the form { int16 offset, delta; void *pfn; }.
|
||||
|
||||
|
@ -775,93 +504,95 @@ int current_source_line;
|
|||
|
||||
/* Functions that work on the objects described above */
|
||||
|
||||
extern struct symtab *lookup_symtab ();
|
||||
extern struct symbol *lookup_symbol ();
|
||||
extern struct symbol *lookup_block_symbol ();
|
||||
extern int lookup_misc_func ();
|
||||
extern void check_stub_type ();
|
||||
extern void check_stub_method ();
|
||||
extern struct type *lookup_primitive_typename ();
|
||||
extern struct type *lookup_typename ();
|
||||
extern struct type *lookup_unsigned_typename ();
|
||||
extern struct type *lookup_struct ();
|
||||
extern struct type *lookup_union ();
|
||||
extern struct type *lookup_enum ();
|
||||
extern struct type *lookup_struct_elt_type ();
|
||||
extern struct type *lookup_pointer_type ();
|
||||
extern struct type *lookup_function_type ();
|
||||
extern struct type *create_array_type ();
|
||||
extern struct symbol *block_function ();
|
||||
extern struct symbol *find_pc_function ();
|
||||
extern int find_pc_partial_function ();
|
||||
extern void clear_pc_function_cache ();
|
||||
extern struct partial_symtab *lookup_partial_symtab ();
|
||||
extern struct partial_symtab *find_pc_psymtab ();
|
||||
extern struct symtab *find_pc_symtab ();
|
||||
extern struct partial_symbol *find_pc_psymbol ();
|
||||
extern int find_pc_misc_function ();
|
||||
extern int find_pc_line_pc_range ();
|
||||
extern char *type_name_no_tag ();
|
||||
extern int contained_in();
|
||||
extern struct symtab *
|
||||
lookup_symtab PARAMS ((char *));
|
||||
|
||||
/* C++ stuff. */
|
||||
extern struct type *lookup_template_type ();
|
||||
extern struct type *lookup_reference_type ();
|
||||
extern struct type *lookup_member_type ();
|
||||
extern void smash_to_method_type ();
|
||||
void smash_to_member_type (
|
||||
#ifdef __STDC__
|
||||
struct type *, struct type *, struct type *
|
||||
#endif
|
||||
);
|
||||
extern struct type *allocate_stub_method ();
|
||||
/* end of C++ stuff. */
|
||||
extern struct symbol *
|
||||
lookup_symbol PARAMS ((const char *, const struct block *,
|
||||
const enum namespace, int *, struct symtab **));
|
||||
|
||||
extern void reread_symbols ();
|
||||
extern struct symbol *
|
||||
lookup_block_symbol PARAMS ((const struct block *, const char *,
|
||||
const enum namespace));
|
||||
|
||||
extern struct type *builtin_type_void;
|
||||
extern struct type *builtin_type_char;
|
||||
extern struct type *builtin_type_short;
|
||||
extern struct type *builtin_type_int;
|
||||
extern struct type *builtin_type_long;
|
||||
extern struct type *builtin_type_unsigned_char;
|
||||
extern struct type *builtin_type_unsigned_short;
|
||||
extern struct type *builtin_type_unsigned_int;
|
||||
extern struct type *builtin_type_unsigned_long;
|
||||
extern struct type *builtin_type_float;
|
||||
extern struct type *builtin_type_double;
|
||||
extern struct type *builtin_type_long_double;
|
||||
extern struct type *builtin_type_complex;
|
||||
extern struct type *builtin_type_double_complex;
|
||||
/* This type represents a type that was unrecognized in symbol
|
||||
read-in. */
|
||||
extern struct type *builtin_type_error;
|
||||
extern struct type *
|
||||
lookup_struct PARAMS ((char *, struct block *));
|
||||
|
||||
extern struct type *builtin_type_long_long;
|
||||
extern struct type *builtin_type_unsigned_long_long;
|
||||
extern struct type *
|
||||
lookup_union PARAMS ((char *, struct block *));
|
||||
|
||||
/* Modula-2 types */
|
||||
extern struct type *builtin_type_m2_char;
|
||||
extern struct type *builtin_type_m2_int;
|
||||
extern struct type *builtin_type_m2_card;
|
||||
extern struct type *builtin_type_m2_real;
|
||||
extern struct type *builtin_type_m2_bool;
|
||||
extern struct type *
|
||||
lookup_enum PARAMS ((char *, struct block *));
|
||||
|
||||
/* LONG_LONG is defined if the host has "long long". */
|
||||
#ifdef LONG_LONG
|
||||
#define BUILTIN_TYPE_LONGEST builtin_type_long_long
|
||||
#define BUILTIN_TYPE_UNSIGNED_LONGEST builtin_type_unsigned_long_long
|
||||
/* This should not be a typedef, because "unsigned LONGEST" needs
|
||||
to work. */
|
||||
#define LONGEST long long
|
||||
extern struct symbol *
|
||||
block_function PARAMS ((struct block *));
|
||||
|
||||
#else /* not LONG_LONG. */
|
||||
extern struct symbol *
|
||||
find_pc_function PARAMS ((CORE_ADDR));
|
||||
|
||||
#define BUILTIN_TYPE_LONGEST builtin_type_long
|
||||
#define BUILTIN_TYPE_UNSIGNED_LONGEST builtin_type_unsigned_long
|
||||
#define LONGEST long
|
||||
extern int
|
||||
find_pc_partial_function PARAMS ((CORE_ADDR, char **, CORE_ADDR *));
|
||||
|
||||
#endif /* not LONG_LONG. */
|
||||
extern void
|
||||
clear_pc_function_cache PARAMS ((void));
|
||||
|
||||
extern struct partial_symtab *
|
||||
lookup_partial_symtab PARAMS ((char *));
|
||||
|
||||
extern struct partial_symtab *
|
||||
find_pc_psymtab PARAMS ((CORE_ADDR));
|
||||
|
||||
extern struct symtab *
|
||||
find_pc_symtab PARAMS ((CORE_ADDR));
|
||||
|
||||
extern struct partial_symbol *
|
||||
find_pc_psymbol PARAMS ((struct partial_symtab *, CORE_ADDR));
|
||||
|
||||
extern int
|
||||
find_pc_line_pc_range PARAMS ((CORE_ADDR, CORE_ADDR *, CORE_ADDR *));
|
||||
|
||||
extern int
|
||||
contained_in PARAMS ((struct block *, struct block *));
|
||||
|
||||
extern void
|
||||
reread_symbols PARAMS ((void));
|
||||
|
||||
extern int
|
||||
have_partial_symbols PARAMS ((void));
|
||||
|
||||
extern int
|
||||
have_full_symbols PARAMS ((void));
|
||||
|
||||
/* Functions for dealing with the minimal symbol table, really a misc
|
||||
address<->symbol mapping for things we don't have debug symbols for. */
|
||||
|
||||
extern int
|
||||
have_minimal_symbols PARAMS ((void));
|
||||
|
||||
extern void
|
||||
prim_record_minimal_symbol PARAMS ((const char *, CORE_ADDR,
|
||||
enum minimal_symbol_type));
|
||||
|
||||
extern struct minimal_symbol *
|
||||
lookup_minimal_symbol PARAMS ((const char *, struct objfile *));
|
||||
|
||||
extern struct minimal_symbol *
|
||||
lookup_minimal_symbol_by_pc PARAMS ((CORE_ADDR));
|
||||
|
||||
extern PTR
|
||||
iterate_over_msymbols PARAMS ((PTR (*func) (struct objfile *,
|
||||
struct minimal_symbol *,
|
||||
PTR, PTR, PTR),
|
||||
PTR, PTR, PTR));
|
||||
|
||||
extern void
|
||||
init_minimal_symbol_collection PARAMS ((void));
|
||||
|
||||
extern void
|
||||
discard_minimal_symbols PARAMS ((int));
|
||||
|
||||
extern void
|
||||
install_minimal_symbols PARAMS ((struct objfile *));
|
||||
|
||||
struct symtab_and_line
|
||||
{
|
||||
|
@ -881,48 +612,78 @@ struct symtabs_and_lines
|
|||
Second arg nonzero means if pc is on the boundary
|
||||
use the previous statement's line number. */
|
||||
|
||||
struct symtab_and_line find_pc_line ();
|
||||
extern struct symtab_and_line
|
||||
find_pc_line PARAMS ((CORE_ADDR, int));
|
||||
|
||||
/* Given a symtab and line number, return the pc there. */
|
||||
extern CORE_ADDR find_line_pc ();
|
||||
extern int find_line_pc_range ();
|
||||
|
||||
extern CORE_ADDR
|
||||
find_line_pc PARAMS ((struct symtab *, int));
|
||||
|
||||
extern int
|
||||
find_line_pc_range PARAMS ((struct symtab *, int, CORE_ADDR *, CORE_ADDR *));
|
||||
|
||||
extern void
|
||||
resolve_sal_pc PARAMS ((struct symtab_and_line *));
|
||||
|
||||
/* Given a string, return the line specified by it.
|
||||
For commands like "list" and "breakpoint". */
|
||||
|
||||
struct symtabs_and_lines decode_line_spec ();
|
||||
struct symtabs_and_lines decode_line_spec_1 ();
|
||||
struct symtabs_and_lines decode_line_1 ();
|
||||
extern struct symtabs_and_lines
|
||||
decode_line_spec PARAMS ((char *, int));
|
||||
|
||||
extern struct symtabs_and_lines
|
||||
decode_line_spec_1 PARAMS ((char *, int));
|
||||
|
||||
extern struct symtabs_and_lines
|
||||
decode_line_1 PARAMS ((char **, int, struct symtab *, int));
|
||||
|
||||
/* Symmisc.c */
|
||||
void free_symtab ();
|
||||
|
||||
extern void
|
||||
free_symtab PARAMS ((struct symtab *));
|
||||
|
||||
/* Symbol-reading stuff in symfile.c and solib.c. */
|
||||
struct symtab *psymtab_to_symtab ();
|
||||
void clear_solib ();
|
||||
void symbol_file_add ();
|
||||
|
||||
extern struct symtab *
|
||||
psymtab_to_symtab PARAMS ((struct partial_symtab *));
|
||||
|
||||
extern void
|
||||
clear_solib PARAMS ((void));
|
||||
|
||||
extern struct objfile *
|
||||
symbol_file_add PARAMS ((char *, int, CORE_ADDR, int, int, int));
|
||||
|
||||
/* source.c */
|
||||
int identify_source_line ();
|
||||
void print_source_lines ();
|
||||
void forget_cached_source_info (
|
||||
#ifdef __STDC__
|
||||
void
|
||||
#endif
|
||||
);
|
||||
void select_source_symtab (
|
||||
#ifdef __STDC__
|
||||
struct symtab *
|
||||
#endif
|
||||
);
|
||||
|
||||
char **make_symbol_completion_list ();
|
||||
extern int
|
||||
identify_source_line PARAMS ((struct symtab *, int, int));
|
||||
|
||||
/* Maximum and minimum values of built-in types */
|
||||
#define MAX_OF_TYPE(t) \
|
||||
TYPE_UNSIGNED(t) ? UMAX_OF_SIZE(TYPE_LENGTH(t)) : MAX_OF_SIZE(TYPE_LENGTH(t))
|
||||
extern void
|
||||
print_source_lines PARAMS ((struct symtab *, int, int, int));
|
||||
|
||||
#define MIN_OF_TYPE(t) \
|
||||
TYPE_UNSIGNED(t) ? UMIN_OF_SIZE(TYPE_LENGTH(t)) : MIN_OF_SIZE(TYPE_LENGTH(t))
|
||||
extern void
|
||||
forget_cached_source_info PARAMS ((void));
|
||||
|
||||
#endif /* symtab.h not already included. */
|
||||
extern void
|
||||
select_source_symtab PARAMS ((struct symtab *));
|
||||
|
||||
extern char **
|
||||
make_symbol_completion_list PARAMS ((char *));
|
||||
|
||||
/* symtab.c */
|
||||
|
||||
extern struct partial_symtab *
|
||||
find_main_psymtab PARAMS ((void));
|
||||
|
||||
/* blockframe.c */
|
||||
|
||||
extern struct blockvector *
|
||||
blockvector_for_pc PARAMS ((CORE_ADDR, int *));
|
||||
|
||||
/* symfile.c */
|
||||
|
||||
extern enum language
|
||||
deduce_language_from_filename PARAMS ((char *));
|
||||
|
||||
#endif /* !defined(SYMTAB_H) */
|
||||
|
|
|
@ -330,7 +330,7 @@ map_vmap (bfd *bf, bfd *arch)
|
|||
|
||||
obj = lookup_objfile_bfd (bf);
|
||||
if (exec_bfd && !obj) {
|
||||
obj = allocate_objfile (bf, bfd_get_filename (bf), 0);
|
||||
obj = allocate_objfile (bf, 0);
|
||||
syms_from_objfile (obj, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue