Globs of changes. See the ChangeLog for details. Most related to

using the new mmalloc package.
This commit is contained in:
Fred Fish 1992-03-15 01:09:14 +00:00
parent 0750528ab6
commit 318bf84ffe
28 changed files with 1996 additions and 931 deletions

View file

@ -1,3 +1,97 @@
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,
state.c, state.h: Removed.
* .gdbinit: Add ../malloc, ../libiberty, and ../bfd to list of
directories searched for source files.
* Makefile.in (GNU_MALLOC, MALLOC_CFLAGS, MALLOCSRC): Removed
* Makefile.in (MMALLOC_DIR, MMALLOC_DEP, MMALLOC_LIB,
MMALLOC_DISABLE, MMALLOC_CHECK, MMALLOC_CFLAGS): Add
* Makefile.in (CFLAGS): Replace MALLOC_CFLAGS with MMALLOC_CFLAGS.
* Makefile.in (CLIBS, CDEPS): Add MMALLOC_LIB
* Makefile.in (ADD_FILES, ADD_DEPS): Remove GNU_MALLOC.
* Makefile.in (SFILES_MAINDIR): Remove stat.c mmap-alloc.c, mmap-
sbrk.c
* Makefile.in (HFILES): Remove state.h
* Makefile.in (POSSLIBS_MAINDIR): Remove MALLOCSRC.
* Makefile.in (OBS): Remove state.o mmap-alloc.o mmap-sbrk.o
* Makefile.in (saber_gdb): Remove mcheck, mtrace. Add MMALLOC_DIR.
* Makefile.in (clean): Remove all object files.
* c-exp.y: Define malloc to xmalloc and realloc to xrealloc.
* cplus-dem.c: Remove prototypes definitions that are now done in
def.h.
* dbxread.c (throughout): Change from using per-objfile
xmalloc/xrealloc/free functions to xmmalloc/xmrealloc/mfree.
* defs.h: Remove prototypes for mmap_* functions. Add prototypes
for xmmalloc, xmrealloc, mfree, mmcheck, mmtrace, mmalloc_attach,
mmalloc_detach, mmalloc_setkey, msavestring, and mstrsave, nomem.
* depend: Remove dependencies for state.o, state.h.
* dwarfread.c: Add declaration for warning_pre_print.
* dwarfread.c (dwarfwarn): Use warning_pre_print.
* dwarfread.c (throughout): Change from using per-objfile
xmalloc/xrealloc/free functions to xmmalloc/xmrealloc/mfree.
* gdbtypes.c (lookup_fundamental_type): Fix init_type calls to
use supplied objfile.
* i386-xdep.c (print_387_status): Change to use warning() rather
than printfs.
* i387-tdep.c (print_387_control_word): Change to use warning()
rather than printfs.
* infrun.c (wait_for_inferior): Remove unreachable abort() call
that some compilers grumble about.
* language.c (throughout): Add declaration for warning_pre_print
and using warning() instead of printfs.
* m2-exp.y: Define malloc to xmalloc and realloc to xrealloc.
* main.c (main): Add declaration for warning_pre_print and set it
similarly to error_pre_print. Add declarations for
mapped_symbol_files and readnow_symbol_files. Add appropriate
definitions to long_options[].
* minsyms.c: Trivial fix to comment.
* objfiles.c (allocate_objfile): Substantially rewritten for
using mapped symbol files.
* objfiles.c (throughout): Change from using per-objfile
xmalloc/xrealloc/free functions to xmmalloc/xmrealloc/mfree.
* objfiles.c (open_mapped_file, mapped_to_address): Add functions.
* source.c (throughout): Change from using per-objfile
xmalloc/xrealloc/free functions to xmmalloc/xmrealloc/mfree.
* source.c (open_source_file): Use mstrsave to save file name in
mapped symbol region for objfile.
* symfile.c: Remove include for state.h.
include to local form.
* symfile.c (symbol_file_add_digested): Remove.
* symfile.c (symbol_file_add): Substantially rewritten for mapped
symbol files.
* symfile.h: Remove malloc/xrealloc/xmalloc/xrealloc/free members
from objfile structure. Add malloc descriptor pointer (md).
* symfile.h (OBJF_DUMPABLE): Changed name to OBJF_MAPPED.
* symm-xdep.c (print_fpu_status): Use warning() rather than
printfs.
* symmisc.c (free_symtab_block): Now takes and uses current
objfile pointer.
* symmisc.c (throughout): Change from using per-objfile
xmalloc/xrealloc/free functions to xmmalloc/xmrealloc/mfree.
* symtab.c (cplus_mangled_symbol): Cast return value to avoid
Sun compiler grumblings when PTR is char *.
* symtab.c (lookup_symbol): Cast return value of iterate_over_
msymbols() to correct pointer type.
* utils.c (warning_pre_print): Initialize to "\nwarning: ".
* utils.c (fatal, fatal_dump_core): Ensure that the fatal
error always starts on a line of it's own.
* utils.c (init_malloc, malloc_botch, xmalloc, xrealloc):
Rewrite for new mapped malloc package use.
* utils.c (mmalloc, mrealloc, mfree): Stubs for configurations
that don't want to use the mapped malloc package; pass arguments
on to traditional malloc package functions.
* utils.c (nomem): Add for fatal virtual memory exhausted aborts.
* utils.c (xmmalloc, xmrealloc, xmalloc, xrealloc): Like mmalloc,
mrealloc, malloc, and realloc but get fatal error if runs out
of memory.
* utils.c (msavestring, mstrsave): Save a string in a specific
mapped malloc region.
* utils.c (print_spaces): Use xmalloc to get the buffer.
* xm-amix.h, xm-i386v4.h, xm-sun3os4.h, xm-sun4os4.h: Add defines
for MMAP_BASE_ADDRESS and MMAP_INCREMENT.
* config/i386v4.mh: Insignificant reorganization.
Sat Mar 14 11:44:47 1992 Fred Fish (fnf@cygnus.com)
* xcoffread.c: Only enable compilation of debugging functions

View file

@ -96,18 +96,24 @@ MAKEINFO=makeinfo
#CC-LD=gcc -static
CC-LD=${CC}
# define this to be "gmalloc.o" if you want to use the gnu malloc routine
# (useful for debugging memory allocation problems in gdb). To use your
# system malloc, uncomment the following two lines.
#GNU_MALLOC =
#MALLOC_CFLAGS = -DNO_MALLOC_CHECK
GNU_MALLOC = gmalloc.o mcheck.o mtrace.o
MALLOC_CFLAGS =
# Where is the "include" directory? Traditionally ../include or ./include
INCLUDE_DIR = ${srcdir}/../include
INCLUDE_DEP = $$(INCLUDE_DIR)
# Where is the source dir for the MMALLOC library? Traditionally ../mmalloc
# or ./mmalloc (When we want the binary library built from it, we use
# ${MMALLOC_DIR}${subdir}.)
# Note that mmalloc can still be used on systems without mmap().
# To use your system malloc, comment out the following defines.
MMALLOC_DIR = ${srcdir}/../mmalloc
MMALLOC_DEP = $$(MMALLOC_DIR)
MMALLOC_LIB = ./../mmalloc${subdir}/libmmalloc.a
# To use your system malloc, uncomment MMALLOC_DISABLE.
#MMALLOC_DISABLE = -DNO_MMALLOC
# To use mmalloc but disable corruption checking, uncomment MMALLOC_CHECK
#MMALLOC_CHECK = -DNO_MMALLOC_CHECK
MMALLOC_CFLAGS = ${MMALLOC_CHECK} ${MMALLOC_DISABLE}
# Where is the source dir for the BFD library? Traditionally ../bfd or ./bfd
# (When we want the binary library built from it, we use ${BFD_DIR}${subdir}.)
BFD_DIR = ${srcdir}/../bfd
@ -134,7 +140,7 @@ GLOBAL_CFLAGS = ${MINUS_G} ${TM_CFLAGS} ${XM_CFLAGS}
# CFLAGS is the aggregate of several individual *_CFLAGS macros.
# USER_CFLAGS is specifically reserved for setting from the command line
# when running make. I.E. "make USER_CFLAGS=-Wmissing-prototypes".
CFLAGS = ${GLOBAL_CFLAGS} ${PROFILE_CFLAGS} ${MALLOC_CFLAGS} ${INCLUDE_CFLAGS} ${USER_CFLAGS}
CFLAGS = ${GLOBAL_CFLAGS} ${PROFILE_CFLAGS} ${MMALLOC_CFLAGS} ${INCLUDE_CFLAGS} ${USER_CFLAGS}
# None of the things in CFLAGS will do any harm, and on some systems
# (e.g. SunOS4) it is important to use the M_CFLAGS.
LDFLAGS = $(CFLAGS)
@ -151,11 +157,13 @@ LIBIBERTY = ./../libiberty${subdir}/libiberty.a
# Libraries and corresponding dependencies for compiling gdb.
# {X,T}M_CLIBS, defined in *config files, have host- and target-dependent libs.
# TERMCAP comes after readline, since readline depends on it.
CLIBS = ${BFD_LIB} ${RL_LIB} ${TERMCAP} ${LIBIBERTY} ${XM_CLIBS} ${TM_CLIBS}
CDEPS = ${XM_CDEPS} ${TM_CDEPS} ${BFD_LIB} ${LIBIBERTY} ${RL_LIB}
CLIBS = ${BFD_LIB} ${RL_LIB} ${TERMCAP} ${MMALLOC_LIB} ${LIBIBERTY} \
${XM_CLIBS} ${TM_CLIBS}
CDEPS = ${XM_CDEPS} ${TM_CDEPS} ${BFD_LIB} ${MMALLOC_LIB} ${LIBIBERTY} \
${RL_LIB} ${MMALLOC_LIB}
ADD_FILES = ${REGEX} ${ALLOCA} ${GNU_MALLOC} ${XM_ADD_FILES} ${TM_ADD_FILES}
ADD_DEPS = ${REGEX1} ${ALLOCA1} ${GNU_MALLOC} ${XM_ADD_FILES} ${TM_ADD_FILES}
ADD_FILES = ${REGEX} ${ALLOCA} ${XM_ADD_FILES} ${TM_ADD_FILES}
ADD_DEPS = ${REGEX1} ${ALLOCA1} ${XM_ADD_FILES} ${TM_ADD_FILES}
VERSION = 4.4.5
DIST=gdb
@ -178,8 +186,8 @@ SFILES_MAINDIR = \
utils.c valarith.c valops.c valprint.c values.c c-exp.y m2-exp.y \
signame.c cplus-dem.c mem-break.c target.c inftarg.c \
dbxread.c coffread.c elfread.c dwarfread.c xcoffread.c \
ieee-float.c language.c parse.c buildsym.c state.c objfiles.c \
minsyms.c mmap-alloc.c mmap-sbrk.c
ieee-float.c language.c parse.c buildsym.c objfiles.c \
minsyms.c
# Source files in subdirectories (which will be handled separately by
# 'make gdb.tar.Z').
@ -224,16 +232,13 @@ SFILES_KGDB = $(SFILES) stuff.c kdb-start.c
HFILES= breakpoint.h buildsym.h command.h defs.h environ.h \
expression.h frame.h gdbcmd.h gdbcore.h gdbtypes.h \
ieee-float.h inferior.h minimon.h partial-stab.h \
signals.h signame.h symfile.h symtab.h state.h solib.h \
signals.h signame.h symfile.h symtab.h solib.h \
target.h terminal.h tm-68k.h tm-i960.h tm-sunos.h tm-sysv4.h \
xm-m68k.h xm-sysv4.h language.h parser-defs.h value.h
REMOTE_EXAMPLES = m68k-stub.c i386-stub.c rem-multi.shar
MALLOCSRC = gmalloc.c mcheck.c mtrace.c mtrace.awk \
gmalloc.h
POSSLIBS_MAINDIR = regex.c regex.h alloca.c $(MALLOCSRC)
POSSLIBS_MAINDIR = regex.c regex.h alloca.c
POSSLIBS = $(POSSLIBS_MAINDIR)
TESTS = testbpt.c testfun.c testrec.c testreg.c testregs.c
@ -267,7 +272,7 @@ OBS = main.o blockframe.o breakpoint.o findvar.o stack.o source.o \
command.o utils.o expprint.o environ.o version.o gdbtypes.o \
copying.o $(DEPFILES) signame.o cplus-dem.o mem-break.o target.o \
inftarg.o ieee-float.o putenv.o parse.o language.o $(YYOBJ) \
buildsym.o state.o objfiles.o minsyms.o mmap-alloc.o mmap-sbrk.o \
buildsym.o objfiles.o minsyms.o \
dbxread.o coffread.o elfread.o dwarfread.o xcoffread.o # mipsread.o
RAPP_OBS = rgdb.o rudp.o rserial.o serial.o udp.o $(XDEPFILES)
@ -330,9 +335,8 @@ saber_gdb: $(SFILES) $(DEPFILES) copying.c version.c
#load ${LIBIBERTY_DIR}/*.c
#load ${BFD_DIR}/*.c
#load ${READLINE_DIR}/*.c
#load ${MMALLOC_DIR}/*.c
#load -ltermcap
##void mcheck(a) void (*a)(); { }
##void mtrace() { }
@ -532,8 +536,8 @@ make-proto-gdb-1: ${TARFILES} ${TARDIRS} gdb.info
chmod og=u `find . -print`
clean:
rm -f ${OBS} ${TSOBS} ${NTSOBS} ${ADD_FILES}
rm -f init.c init.o version.c
rm -f *.o ${ADD_FILES}
rm -f init.c version.c
rm -f gdb core gdb.tar gdb.tar.Z make.log
rm -f gdb[0-9]
$(MAKE) subdir_do DO=clean "DODIRS=$(SUBDIRS)"

View file

@ -39,6 +39,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "value.h"
#include "language.h"
/* Ensure that if the generated parser contains any calls to malloc/realloc,
that they get mapped to xmalloc/xrealloc. */
#define malloc xmalloc
#define realloc xrealloc
/* These MUST be included in any grammar file!!!!
Please choose unique names! */
#define yymaxdepth c_maxdepth

File diff suppressed because it is too large Load diff

View file

@ -78,18 +78,6 @@ extern char *cplus_demangle (const char *type, int mode);
extern char *cplus_demangle ();
#endif
#ifdef __STDC__
/* GDB prototypes these as void* in defs.h, so we better too, at least
as long as we're including defs.h. */
/* FIXME extern void *xmalloc (int);
extern void *xrealloc (char *, int); */
extern void free (void *);
#else
extern char *xmalloc ();
extern char *xrealloc ();
extern void free ();
#endif
static char **typevec = 0;
static int ntypes = 0;
static int typevec_size = 0;

View file

@ -31,9 +31,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
fledged symbol table by going back and reading the symbols
for real. dbx_psymtab_to_symtab() is the function that does this */
#include <stdio.h>
#include <string.h>
#include "defs.h"
#include <string.h>
#ifdef USG
#include <sys/types.h>
@ -453,9 +452,9 @@ dbx_symfile_read (sf, addr, mainline)
/* Free up any memory we allocated for ourselves. */
if (!mainline) {
(*sf->objfile->free) (info->stringtab); /* Stringtab is only saved for mainline */
mfree (sf->objfile->md, info->stringtab); /* Stringtab is only saved for mainline */
}
(*sf->objfile->free) (info);
mfree (sf->objfile->md, info);
sf->sym_private = NULL; /* Zap pointer to our (now gone) info struct */
if (!have_partial_symbols ()) {
@ -510,7 +509,7 @@ dbx_symfile_init (sf)
unsigned char size_temp[4];
/* Allocate struct to keep track of the symfile */
sf->sym_private = (*sf->objfile->xmalloc) (sizeof (*info));
sf->sym_private = xmmalloc (sf->objfile->md, sizeof (*info));
info = (struct dbx_symfile_info *)sf->sym_private;
/* FIXME POKING INSIDE BFD DATA STRUCTURES */
@ -536,7 +535,7 @@ dbx_symfile_init (sf)
if (info->stringtab_size >= 0)
{
/* Yes, this should be malloc, not xmalloc. We check its result. */
info->stringtab = (char *) (*sf->objfile->malloc) (info->stringtab_size);
info->stringtab = (char *) mmalloc (sf->objfile->md, info->stringtab_size);
/* Caller is responsible for freeing the string table. No cleanup. */
}
else
@ -628,9 +627,9 @@ init_psymbol_list (total_symbols, objfile)
{
/* Free any previously allocated psymbol lists. */
if (objfile -> global_psymbols.list)
(*objfile -> free) (objfile -> global_psymbols.list);
mfree (objfile -> md, objfile -> global_psymbols.list);
if (objfile -> static_psymbols.list)
(*objfile -> free) (objfile -> static_psymbols.list);
mfree (objfile -> md, objfile -> static_psymbols.list);
/* Current best guess is that there are approximately a twentieth
of the total symbols (in a debugging file) are global or static
@ -638,9 +637,9 @@ init_psymbol_list (total_symbols, objfile)
objfile -> global_psymbols.size = total_symbols / 10;
objfile -> static_psymbols.size = total_symbols / 10;
objfile -> global_psymbols.next = objfile -> global_psymbols.list = (struct partial_symbol *)
(*objfile -> xmalloc) (objfile -> global_psymbols.size * sizeof (struct partial_symbol));
xmmalloc (objfile -> md, objfile -> global_psymbols.size * sizeof (struct partial_symbol));
objfile -> static_psymbols.next = objfile -> static_psymbols.list = (struct partial_symbol *)
(*objfile -> xmalloc) (objfile -> static_psymbols.size * sizeof (struct partial_symbol));
xmmalloc (objfile -> md, objfile -> static_psymbols.size * sizeof (struct partial_symbol));
}
/* Initialize the list of bincls to contain none and have some
@ -653,7 +652,7 @@ init_bincl_list (number, objfile)
{
bincls_allocated = number;
next_bincl = bincl_list = (struct header_file_location *)
(*objfile -> xmalloc) (bincls_allocated * sizeof(struct header_file_location));
xmmalloc (objfile -> md, bincls_allocated * sizeof(struct header_file_location));
}
/* Add a bincl to the list. */
@ -669,7 +668,7 @@ add_bincl_to_list (pst, name, instance)
int offset = next_bincl - bincl_list;
bincls_allocated *= 2;
bincl_list = (struct header_file_location *)
(*pst->objfile->xrealloc) ((char *)bincl_list,
xmrealloc (pst->objfile->md, (char *)bincl_list,
bincls_allocated * sizeof (struct header_file_location));
next_bincl = bincl_list + offset;
}
@ -703,7 +702,7 @@ static void
free_bincl_list (objfile)
struct objfile *objfile;
{
(*objfile -> free) (bincl_list);
mfree (objfile -> md, bincl_list);
bincls_allocated = 0;
}
@ -975,7 +974,21 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
&& pst->n_static_syms == 0) {
/* Throw away this psymtab, it's empty. We can't deallocate it, since
it is on the obstack, but we can forget to chain it on the list. */
;
struct partial_symtab *prev_pst;
/* First, snip it out of the psymtab chain */
if (pst->objfile->psymtabs == pst)
pst->objfile->psymtabs = pst->next;
else
for (prev_pst = pst->objfile->psymtabs; prev_pst; prev_pst = pst->next)
if (prev_pst->next == pst)
prev_pst->next = pst->next;
/* Next, put it on a free list for recycling */
pst->next = pst->objfile->free_psymtabs;
pst->objfile->free_psymtabs = pst;
}
}
@ -1100,8 +1113,8 @@ dbx_psymtab_to_symtab (pst)
#endif
{
#ifdef BROKEN_LARGE_ALLOCA
stringtab = (char *) (*pst->objfile->xmalloc) (stsize);
make_cleanup (pst->objfile->free, stringtab);
stringtab = (char *) xmalloc (stsize);
make_cleanup (free, stringtab);
#else
stringtab = (char *) alloca (stsize);
#endif
@ -1567,7 +1580,7 @@ process_one_symbol (type, desc, valu, name, offset)
{
int i;
struct symbol *sym =
(struct symbol *) (*our_objfile -> xmalloc) (sizeof (struct symbol));
(struct symbol *) xmmalloc (our_objfile -> md, sizeof (struct symbol));
bzero (sym, sizeof *sym);
SYMBOL_NAME (sym) = savestring (name, strlen (name));
SYMBOL_CLASS (sym) = LOC_BLOCK;

View file

@ -107,39 +107,33 @@ cplus_demangle PARAMS ((const char *, int));
extern char *
cplus_mangle_opname PARAMS ((char *, int));
/* From mmap-*.c */
/* From libmmalloc.a (memory mapped malloc library) */
extern PTR
mmap_malloc PARAMS ((long));
mmalloc_attach PARAMS ((int, PTR));
extern PTR
mmap_realloc PARAMS ((PTR, long));
mmalloc_detach PARAMS ((PTR));
extern PTR
mmap_xmalloc PARAMS ((long));
mmalloc PARAMS ((PTR, long));
extern PTR
mmap_xrealloc PARAMS ((PTR, long));
mrealloc PARAMS ((PTR, PTR, long));
extern void
mmap_free PARAMS ((PTR));
mfree PARAMS ((PTR, PTR));
extern int
mmalloc_setkey PARAMS ((PTR, int, PTR));
extern PTR
mmap_sbrk PARAMS ((int));
extern PTR
mmap_base PARAMS ((void));
extern PTR
mmap_page_align PARAMS ((PTR));
extern PTR
mmap_remap PARAMS ((PTR, long, int, long));
mmalloc_getkey PARAMS ((PTR, int));
/* From utils.c */
extern void
init_malloc PARAMS ((void));
init_malloc PARAMS ((PTR));
extern void
request_quit PARAMS ((int));
@ -500,9 +494,15 @@ local_hex_string_custom PARAMS ((int, char *)); /* language.c */
extern char *
savestring PARAMS ((const char *, int));
extern char *
msavestring PARAMS ((void *, const char *, int));
extern char *
strsave PARAMS ((const char *));
extern char *
mstrsave PARAMS ((void *, const char *));
extern char *
concat PARAMS ((char *, ...));
@ -510,7 +510,28 @@ extern PTR
xmalloc PARAMS ((long));
extern PTR
xrealloc PARAMS ((char *, long));
xrealloc PARAMS ((PTR, long));
extern PTR
xmmalloc PARAMS ((PTR, long));
extern PTR
xmrealloc PARAMS ((PTR, PTR, long));
extern PTR
mmalloc PARAMS ((PTR, long));
extern PTR
mrealloc PARAMS ((PTR, PTR, long));
extern void
mfree PARAMS ((PTR, PTR));
extern int
mmcheck PARAMS ((PTR, void (*) (void)));
extern int
mmtrace PARAMS ((void));
extern int
parse_escape PARAMS ((char **));
@ -526,6 +547,9 @@ fatal ();
extern NORETURN void /* Not specified as volatile in ... */
exit PARAMS ((int)); /* 4.10.4.3 */
extern NORETURN void /* Does not return to the caller. */
nomem PARAMS ((long));
extern NORETURN void /* Does not return to the caller. */
return_to_top_level PARAMS ((void));
@ -553,9 +577,10 @@ freeargv PARAMS ((char **));
/* For now, we can't include <stdlib.h> because it conflicts with
"../include/getopt.h". (FIXME)
However, since any prototypes for any functions defined in the ANSI
specific, defined in any header files in an ANSI conforming environment,
must match those in the ANSI standard, we can just duplicate them here
However, if a function is defined in the ANSI C standard and a prototype
for that function is defined and visible in any header file in an ANSI
conforming environment, then that prototype must match the definition in
the ANSI standard. So we can just duplicate them here without conflict,
since they must be the same in all conforming ANSI environments. If
these cause problems, then the environment is not ANSI conformant. */
@ -570,6 +595,7 @@ extern double
atof PARAMS ((const char *nptr)); /* 4.10.1.1 */
#ifndef MALLOC_INCOMPATIBLE
extern PTR
malloc PARAMS ((size_t size)); /* 4.10.3.3 */
@ -577,8 +603,9 @@ extern PTR
realloc PARAMS ((void *ptr, size_t size)); /* 4.10.3.4 */
extern void
free PARAMS ((void *)); /* 4.10.3.2 */
#endif
free PARAMS ((void *)); /* 4.10.3.2 */
#endif /* MALLOC_INCOMPATIBLE */
extern void
qsort PARAMS ((void *base, size_t nmemb, /* 4.10.5.2 */

View file

@ -172,8 +172,6 @@ mipsread.o : mipsread.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.statu
symfile.h buildsym.h ${srcdir}/../include/coff/mips.h \
${srcdir}/../bfd/libaout.h ${srcdir}/../include/aout/aout64.h ${srcdir}/../include/aout/stab_gnu.h \
${srcdir}/../include/aout/stab.def ${srcdir}/../include/coff/ecoff-ext.h partial-stab.h
mmap-alloc.o : mmap-alloc.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm.h config.status
mmap-sbrk.o : mmap-sbrk.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm.h config.status
news-xdep.o : news-xdep.c
Onindy.o : ${srcdir}/nindy-share/Onindy.c ${srcdir}/nindy-share/ttycntl.h \
${srcdir}/nindy-share/block_io.h ${srcdir}/../include/wait.h ${srcdir}/nindy-share/env.h \
@ -261,16 +259,13 @@ sparc-xdep.o : sparc-xdep.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.s
stack.o : stack.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm.h config.status value.h symtab.h \
${srcdir}/../include/obstack.h gdbtypes.h expression.h language.h frame.h gdbcmd.h \
command.h gdbcore.h ${srcdir}/../include/bfd.h target.h breakpoint.h
state.o : state.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm.h config.status symtab.h \
${srcdir}/../include/obstack.h ${srcdir}/../include/bfd.h symfile.h state.h
sun3-xdep.o : sun3-xdep.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm.h config.status \
inferior.h symtab.h ${srcdir}/../include/obstack.h breakpoint.h frame.h value.h \
gdbtypes.h expression.h gdbcore.h ${srcdir}/../include/bfd.h
sun386-xdep.o : sun386-xdep.c
symfile.o : symfile.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm.h config.status symtab.h \
${srcdir}/../include/obstack.h gdbtypes.h gdbcore.h ${srcdir}/../include/bfd.h frame.h \
target.h value.h expression.h symfile.h gdbcmd.h command.h breakpoint.h \
state.h
target.h value.h expression.h symfile.h gdbcmd.h command.h breakpoint.h
symm-tdep.o : symm-tdep.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm.h config.status frame.h \
inferior.h symtab.h ${srcdir}/../include/obstack.h breakpoint.h value.h gdbtypes.h \
expression.h gdbcore.h ${srcdir}/../include/bfd.h

View file

@ -98,11 +98,11 @@ typedef unsigned int DIEREF; /* Reference to a DIE */
extern CORE_ADDR startup_file_start; /* From blockframe.c */
extern CORE_ADDR startup_file_end; /* From blockframe.c */
extern CORE_ADDR entry_scope_lowpc; /* From blockframe.c */
extern CORE_ADDR entry_scope_highpc; /* From blockframc.c */
extern CORE_ADDR entry_scope_highpc; /* From blockframe.c */
extern CORE_ADDR main_scope_lowpc; /* From blockframe.c */
extern CORE_ADDR main_scope_highpc; /* From blockframc.c */
extern CORE_ADDR main_scope_highpc; /* From blockframe.c */
extern int info_verbose; /* From main.c; nonzero => verbose */
extern char *warning_pre_print; /* From utils.c */
/* The DWARF debugging information consists of two major pieces,
one is a block of DWARF Information Entries (DIE's) and the other
@ -534,7 +534,7 @@ dwarfwarn (va_alist)
va_start (ap);
fmt = va_arg (ap, char *);
warning_setup ();
fprintf (stderr, "DWARF warning (ref 0x%x): ", curdie -> dieref);
fprintf (stderr, "warning: DWARF ref 0x%x: ", curdie -> dieref);
if (curdie -> at_name)
{
fprintf (stderr, "'%s': ", curdie -> at_name);
@ -1915,7 +1915,7 @@ psymtab_to_symtab_1 (pst)
{
if (pst->readin)
{
warning ("Psymtab for %s already read in. Shouldn't happen.",
warning ("psymtab for %s already read in. Shouldn't happen.",
pst -> filename);
}
else
@ -1983,7 +1983,7 @@ dwarf_psymtab_to_symtab (pst)
{
if (pst -> readin)
{
warning ("Psymtab for %s already read in. Shouldn't happen.",
warning ("psymtab for %s already read in. Shouldn't happen.",
pst -> filename);
}
else
@ -2046,11 +2046,11 @@ init_psymbol_list (objfile, total_symbols)
if (objfile -> global_psymbols.list)
{
(*objfile -> free) (objfile -> global_psymbols.list);
mfree (objfile -> md, objfile -> global_psymbols.list);
}
if (objfile -> static_psymbols.list)
{
(*objfile -> free) (objfile -> static_psymbols.list);
mfree (objfile -> md, objfile -> static_psymbols.list);
}
/* Current best guess is that there are approximately a twentieth
@ -2061,11 +2061,11 @@ init_psymbol_list (objfile, total_symbols)
objfile -> static_psymbols.size = total_symbols / 10;
objfile -> global_psymbols.next =
objfile -> global_psymbols.list = (struct partial_symbol *)
(*objfile -> xmalloc) (objfile -> global_psymbols.size
xmmalloc (objfile -> md, objfile -> global_psymbols.size
* sizeof (struct partial_symbol));
objfile -> static_psymbols.next =
objfile -> static_psymbols.list = (struct partial_symbol *)
(*objfile -> xmalloc) (objfile -> static_psymbols.size
xmmalloc (objfile -> md, objfile -> static_psymbols.size
* sizeof (struct partial_symbol));
}

View file

@ -810,141 +810,141 @@ lookup_fundamental_type (objfile, typeid)
type = init_type (TYPE_CODE_INT,
TARGET_INT_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED,
"boolean", (struct objfile *) NULL);
"boolean", objfile);
break;
case FT_STRING:
type = init_type (TYPE_CODE_PASCAL_ARRAY,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
0,
"string", (struct objfile *) NULL);
"string", objfile);
break;
case FT_CHAR:
type = init_type (TYPE_CODE_INT,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
0,
"char", (struct objfile *) NULL);
"char", objfile);
break;
case FT_SIGNED_CHAR:
type = init_type (TYPE_CODE_INT,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_SIGNED,
"signed char", (struct objfile *) NULL);
"signed char", objfile);
break;
case FT_UNSIGNED_CHAR:
type = init_type (TYPE_CODE_INT,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED,
"unsigned char", (struct objfile *) NULL);
"unsigned char", objfile);
break;
case FT_SHORT:
type = init_type (TYPE_CODE_INT,
TARGET_SHORT_BIT / TARGET_CHAR_BIT,
0,
"short", (struct objfile *) NULL);
"short", objfile);
break;
case FT_SIGNED_SHORT:
type = init_type (TYPE_CODE_INT,
TARGET_SHORT_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_SIGNED,
"signed short", (struct objfile *) NULL);
"signed short", objfile);
break;
case FT_UNSIGNED_SHORT:
type = init_type (TYPE_CODE_INT,
TARGET_SHORT_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED,
"unsigned short", (struct objfile *) NULL);
"unsigned short", objfile);
break;
case FT_INTEGER:
type = init_type (TYPE_CODE_INT,
TARGET_INT_BIT / TARGET_CHAR_BIT,
0,
"int", (struct objfile *) NULL);
"int", objfile);
break;
case FT_SIGNED_INTEGER:
type = init_type (TYPE_CODE_INT,
TARGET_INT_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_SIGNED,
"signed int", (struct objfile *) NULL);
"signed int", objfile);
break;
case FT_UNSIGNED_INTEGER:
type = init_type (TYPE_CODE_INT,
TARGET_INT_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED,
"unsigned int", (struct objfile *) NULL);
"unsigned int", objfile);
break;
case FT_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_BIT / TARGET_CHAR_BIT,
0,
"long", (struct objfile *) NULL);
"long", objfile);
break;
case FT_SIGNED_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_SIGNED,
"signed long", (struct objfile *) NULL);
"signed long", objfile);
break;
case FT_UNSIGNED_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED,
"unsigned long", (struct objfile *) NULL);
"unsigned long", objfile);
break;
case FT_LONG_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
0,
"long long", (struct objfile *) NULL);
"long long", objfile);
break;
case FT_SIGNED_LONG_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_SIGNED,
"signed long long", (struct objfile *) NULL);
"signed long long", objfile);
break;
case FT_UNSIGNED_LONG_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED,
"unsigned long long",
(struct objfile *) NULL);
objfile);
break;
case FT_FLOAT:
type = init_type (TYPE_CODE_FLT,
TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
0,
"float", (struct objfile *) NULL);
"float", objfile);
break;
case FT_DBL_PREC_FLOAT:
type = init_type (TYPE_CODE_FLT,
TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
0,
"double", (struct objfile *) NULL);
"double", objfile);
break;
case FT_EXT_PREC_FLOAT:
type = init_type (TYPE_CODE_FLT,
TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
0,
"long double", (struct objfile *) NULL);
"long double", objfile);
break;
case FT_COMPLEX:
type = init_type (TYPE_CODE_FLT,
TARGET_COMPLEX_BIT / TARGET_CHAR_BIT,
0,
"complex", (struct objfile *) NULL);
"complex", objfile);
break;
case FT_DBL_PREC_COMPLEX:
type = init_type (TYPE_CODE_FLT,
TARGET_DOUBLE_COMPLEX_BIT / TARGET_CHAR_BIT,
0,
"double complex", (struct objfile *) NULL);
"double complex", objfile);
break;
case FT_EXT_PREC_COMPLEX:
type = init_type (TYPE_CODE_FLT,
TARGET_DOUBLE_COMPLEX_BIT / TARGET_CHAR_BIT,
0,
"long double complex",
(struct objfile *) NULL);
objfile);
break;
}
/* Install the newly created type in the objfile's fundamental_types

View file

@ -160,13 +160,13 @@ print_387_status (status, ep)
printf (" %g\n", val);
}
if (ep->r0)
printf ("warning: reserved0 is %s\n", local_hex_string(ep->r0));
warning ("reserved0 is %s\n", local_hex_string(ep->r0));
if (ep->r1)
printf ("warning: reserved1 is %s\n", local_hex_string(ep->r1));
warning ("reserved1 is %s\n", local_hex_string(ep->r1));
if (ep->r2)
printf ("warning: reserved2 is %s\n", local_hex_string(ep->r2));
warning ("reserved2 is %s\n", local_hex_string(ep->r2));
if (ep->r3)
printf ("warning: reserved3 is %s\n", local_hex_string(ep->r3));
warning ("reserved3 is %s\n", local_hex_string(ep->r3));
}
#ifndef U_FPSTATE

View file

@ -97,7 +97,7 @@ print_387_control_word (control)
printf (";");
}
printf ("\n");
if (control & 0xe080) printf ("warning: reserved bits on: %s\n",
if (control & 0xe080) warning ("reserved bits on: %s\n",
local_hex_string(control & 0xe080));
}

View file

@ -652,7 +652,7 @@ child_create_inferior (exec_file, allargs, env)
correct program, and are poised at the first instruction of the
new program. */
#ifdef SOLIB_CREATE_INFERIOR_HOOK
SOLIB_CREATE_INFERIOR_HOOK ();
SOLIB_CREATE_INFERIOR_HOOK (pid);
#endif
/* Should this perhaps just be a "proceed" call? FIXME */
@ -1232,7 +1232,7 @@ wait_for_inferior ()
goto step_over_function;
tmp = SKIP_TRAMPOLINE_CODE (stop_pc);
if (tmp != NULL)
if (tmp != 0)
stop_func_start = tmp;
if (find_pc_function (stop_func_start) != 0)
@ -1316,7 +1316,7 @@ step_into_function:
step_range_end = sal.end;
goto save_pc;
}
abort(); /* We never fall through here */
/* We never fall through here */
}
if (trap_expected

View file

@ -85,6 +85,7 @@ set_type_range PARAMS ((void));
/* Forward declaration */
extern const struct language_defn unknown_language_defn;
extern char *warning_pre_print;
/* The current (default at startup) state of type and range checking.
(If the modes are set to "auto", though, these are changed based
@ -755,7 +756,7 @@ binop_type_check(arg1,arg2,op)
if ((numeric_type(t1) && pointer_type(t2)) ||
(pointer_type(t1) && numeric_type(t2)))
{
printf("warning: combining pointer and integer.\n");
warning ("combining pointer and integer.\n");
break;
}
case BINOP_MUL:
@ -780,7 +781,7 @@ binop_type_check(arg1,arg2,op)
else if ((pointer_type(t1) && integral_type(t2)) ||
(integral_type(t1) && pointer_type(t2)))
{
printf("warning: combining integer and pointer.\n");
warning ("combining integer and pointer.\n");
break;
}
else if (!simple_type(t1) || !simple_type(t2))
@ -809,7 +810,7 @@ binop_type_check(arg1,arg2,op)
type_op_error ("A pointer can only be assigned an integer.",op);
else if (pointer_type(t1) && integral_type(t2))
{
printf("warning: combining integer and pointer.");
warning ("combining integer and pointer.");
break;
}
else if (!simple_type(t1) || !simple_type(t2))
@ -834,7 +835,7 @@ binop_type_check(arg1,arg2,op)
case UNOP_IND:
if (integral_type(t1))
{
printf("warning: combining pointer and integer.\n");
warning ("combining pointer and integer.\n");
break;
}
else if (!pointer_type(t1))
@ -906,9 +907,7 @@ op_error (fmt,op,fatal)
error (fmt,op_string(op));
else
{
printf("warning: ");
printf(fmt,op_string(op));
printf("\n");
warning (fmt,op_string(op));
}
}
@ -917,7 +916,7 @@ op_error (fmt,op,fatal)
the rest of the arguments should be its arguments. If
[type|range]_check is [type|range]_check_on, then return_to_top_level()
is called in the style of error (). Otherwise, the message is prefixed
by "warning: " and we do not return to the top level. */
by the value of warning_pre_print and we do not return to the top level. */
void
type_error (va_alist)
@ -927,7 +926,7 @@ type_error (va_alist)
char *string;
if (type_check==type_check_warn)
fprintf(stderr,"warning: ");
fprintf(stderr,warning_pre_print);
else
target_terminal_ours();
@ -948,7 +947,7 @@ range_error (va_alist)
char *string;
if (range_check==range_check_warn)
fprintf(stderr,"warning: ");
fprintf(stderr,warning_pre_print);
else
target_terminal_ours();

View file

@ -40,6 +40,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "value.h"
#include "parser-defs.h"
/* Ensure that if the generated parser contains any calls to malloc/realloc,
that they get mapped to xmalloc/xrealloc. */
#define malloc xmalloc
#define realloc xrealloc
/* These MUST be included in any grammar file!!!!
Please choose unique names! */
#define yymaxdepth m2_maxdepth

View file

@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License
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"
#include "gdbcmd.h"
#include "symtab.h"
@ -180,6 +179,10 @@ extern char *version;
extern char *error_pre_print;
/* Message to be printed before the warning message, when a warning occurs. */
extern char *warning_pre_print;
extern char lang_frame_mismatch_warn[]; /* language.c */
/* Whether GDB's stdin is on a terminal. */
@ -254,6 +257,9 @@ static char dirbuf[1024];
void (*window_hook) PARAMS ((FILE *, char *));
extern int frame_file_full_name;
extern int mapped_symbol_files;
extern int readnow_symbol_files;
int epoch_interface;
int xgdb_verbose;
@ -323,7 +329,7 @@ catch_errors (func, args, errstring)
saved_cleanup_chain = save_cleanups ();
saved_error_pre_print = error_pre_print;
bcopy (to_top_level, saved, sizeof (jmp_buf));
memcpy ((char *)saved, (char *)to_top_level, sizeof (jmp_buf));
error_pre_print = errstring;
if (setjmp (to_top_level) == 0)
@ -334,7 +340,7 @@ catch_errors (func, args, errstring)
restore_cleanups (saved_cleanup_chain);
error_pre_print = saved_error_pre_print;
bcopy (saved, to_top_level, sizeof (jmp_buf));
memcpy ((char *)to_top_level, (char *)saved, sizeof (jmp_buf));
return val;
}
@ -345,7 +351,7 @@ disconnect (signo)
int signo;
{
kill_inferior_fast ();
signal (SIGHUP, SIG_DFL);
signal (signo, SIG_DFL);
kill (getpid (), SIGHUP);
}
@ -407,7 +413,7 @@ main (argc, argv)
register int i;
/* This needs to happen before the first use of malloc. */
init_malloc ();
init_malloc ((PTR) NULL);
#if defined (ALIGN_STACK_ON_STARTUP)
i = (int) &count & 0x3;
@ -457,6 +463,10 @@ main (argc, argv)
with no equivalent). */
static struct option long_options[] =
{
{"readnow", no_argument, &readnow_symbol_files, 1},
{"r", no_argument, &readnow_symbol_files, 1},
{"mapped", no_argument, &mapped_symbol_files, 1},
{"m", no_argument, &mapped_symbol_files, 1},
{"quiet", no_argument, &quiet, 1},
{"q", no_argument, &quiet, 1},
{"nx", no_argument, &inhibit_gdbinit, 1},
@ -636,6 +646,7 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
}
error_pre_print = "\n\n";
warning_pre_print = "\n\nwarning: ";
/* Now perform all the actions indicated by the arguments. */
if (cdarg != NULL)
@ -683,6 +694,7 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
if (!quiet)
printf_filtered ("\n");
error_pre_print = "\n";
warning_pre_print = "\nwarning: ";
/* Set the initial language. */
{
@ -721,6 +733,7 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
/* Error messages should no longer be distinguished with extra output. */
error_pre_print = 0;
warning_pre_print = "warning: ";
{
struct stat homebuf, cwdbuf;
@ -745,8 +758,8 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
zero in case one of them fails (this guarantees that they
won't match if either exists). */
bzero (&homebuf, sizeof (struct stat));
bzero (&cwdbuf, sizeof (struct stat));
memset (&homebuf, 0, sizeof (struct stat));
memset (&cwdbuf, 0, sizeof (struct stat));
stat (homeinit, &homebuf);
stat (gdbinit, &cwdbuf); /* We'll only need this if
@ -1585,6 +1598,20 @@ validate_comname (comname)
}
}
#ifdef IBM6000
lowercase (char *str)
{
while (*str) {
/* isupper(), tolower() are function calls in AIX. */
if ( *str >= 'A' && *str <= 'Z')
*str = *str + 'a' - 'A';
++str;
}
}
#endif
static void
define_command (comname, from_tty)
char *comname;
@ -1596,6 +1623,14 @@ define_command (comname, from_tty)
validate_comname (comname);
#ifdef IBM6000
/* If the rest of the commands will be case insensetive, this one
should behave in the same manner. */
lowercase (comname);
#endif
/* Look it up, and verify that we got an exact match. */
c = lookup_cmd (&tem, cmdlist, "", -1, 1);
if (c && 0 != strcmp (comname, c->name))
@ -2085,14 +2120,16 @@ initialize_history()
{
char *tmpenv;
if (tmpenv = getenv ("HISTSIZE"))
tmpenv = getenv ("HISTSIZE");
if (tmpenv)
history_size = atoi (tmpenv);
else if (!history_size)
history_size = 256;
stifle_history (history_size);
if (tmpenv = getenv ("GDBHISTFILE"))
tmpenv = getenv ("GDBHISTFILE");
if (tmpenv)
history_filename = savestring (tmpenv, strlen(tmpenv));
else if (!history_filename) {
/* We include the current directory so that if the user changes

View file

@ -78,7 +78,7 @@ compact_minimal_symbols PARAMS ((struct minimal_symbol *, int));
/* Call the function specified by FUNC for each currently available minimal
symbol, for as long as this function continues to return NULL. If the
function ever returns non-NULL, then the iteration over the minimal
symbols is terminated,, the result is returned to the caller.
symbols is terminated and the result is returned to the caller.
The function called has full control over the form and content of the
information returned via the non-NULL result, which may be as simple as a

View file

@ -26,70 +26,140 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "symtab.h"
#include "symfile.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <obstack.h>
/* Prototypes for local functions */
static int
open_mapped_file PARAMS ((char *basefile, long mtime, int mapped));
static CORE_ADDR
map_to_address PARAMS ((void));
/* Externally visible variables that are owned by this module. */
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. */
struct objfile *
allocate_objfile (abfd, filename, dumpable)
allocate_objfile (abfd, filename, mapped)
bfd *abfd;
char *filename;
int dumpable;
int mapped;
{
struct objfile *objfile;
struct objfile *objfile = NULL;
int fd;
void *md;
CORE_ADDR mapto;
/* First, if the objfile is to be dumpable, we must malloc the structure
itself using the mmap version, and arrange that all memory allocation
for the objfile uses the mmap routines. Otherwise, just use the
old sbrk'd malloc routines. */
mapped |= mapped_symbol_files;
if (dumpable)
#if !defined(NO_MMALLOC) && defined(HAVE_MMAP)
/* If we can support mapped symbol files, try to open/reopen the mapped file
that corresponds to the file from which we wish to read symbols. If the
objfile is to be mapped, we must malloc the structure itself using the
mmap version, and arrange that all memory allocation for the objfile uses
the mmap routines. If we are reusing an existing mapped file, from which
we get our objfile pointer, we have to make sure that we update the
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);
if (fd >= 0)
{
objfile = (struct objfile *) mmap_xmalloc (sizeof (struct objfile));
(void) memset (objfile, 0, sizeof (struct objfile));
objfile -> malloc = mmap_malloc;
objfile -> realloc = mmap_realloc;
objfile -> xmalloc = mmap_xmalloc;
objfile -> xrealloc = mmap_xrealloc;
objfile -> free = mmap_free;
objfile -> flags |= OBJF_DUMPABLE;
if (((mapto = map_to_address ()) == NULL) ||
((md = mmalloc_attach (fd, (void *) mapto)) == NULL))
{
close (fd);
}
else if ((objfile = (struct objfile *) mmalloc_getkey (md, 0)) != NULL)
{
objfile -> md = md;
/* Update pointers to functions to *our* copies */
obstack_chunkfun (&objfile -> psymbol_obstack, xmmalloc);
obstack_freefun (&objfile -> psymbol_obstack, mfree);
obstack_chunkfun (&objfile -> symbol_obstack, xmmalloc);
obstack_freefun (&objfile -> symbol_obstack, mfree);
obstack_chunkfun (&objfile -> type_obstack, xmmalloc);
obstack_freefun (&objfile -> type_obstack, mfree);
/* Update memory corruption handler function addresses */
init_malloc (objfile -> md);
}
else
{
objfile = (struct objfile *) xmmalloc (md, sizeof (struct objfile));
(void) memset (objfile, 0, sizeof (struct objfile));
objfile -> md = md;
objfile -> flags |= OBJF_MAPPED;
mmalloc_setkey (objfile -> md, 0, objfile);
obstack_full_begin (&objfile -> psymbol_obstack, 0, 0,
xmmalloc, mfree, objfile -> md,
OBSTACK_MMALLOC_LIKE);
obstack_full_begin (&objfile -> symbol_obstack, 0, 0,
xmmalloc, mfree, objfile -> md,
OBSTACK_MMALLOC_LIKE);
obstack_full_begin (&objfile -> type_obstack, 0, 0,
xmmalloc, mfree, objfile -> md,
OBSTACK_MMALLOC_LIKE);
/* Set up to detect internal memory corruption */
init_malloc (objfile -> md);
}
}
else
if (mapped && (objfile == NULL))
{
warning ("symbol table for '%s' will not be mapped", filename);
}
#else /* defined(NO_MMALLOC) || !defined(HAVE_MMAP) */
if (mapped)
{
warning ("this version of gdb does not support mapped symbol tables.");
/* Turn off the global flag so we don't try to do mapped symbol tables
any more, which shuts up gdb unless the user specifically gives the
"mapped" keyword again. */
mapped_symbol_files = 0;
}
#endif /* !defined(NO_MMALLOC) && defined(HAVE_MMAP) */
/* If we don't support mapped symbol files, didn't ask for the file to be
mapped, or failed to open the mapped file for some reason, then revert
back to an unmapped objfile. */
if (objfile == NULL)
{
objfile = (struct objfile *) xmalloc (sizeof (struct objfile));
(void) memset (objfile, 0, sizeof (struct objfile));
objfile -> malloc = (PTR (*) PARAMS ((long))) malloc;
objfile -> realloc = (PTR (*) PARAMS ((PTR, long))) realloc;
objfile -> xmalloc = xmalloc;
objfile -> xrealloc = xrealloc;
objfile -> free = free;
objfile -> md = NULL;
obstack_full_begin (&objfile -> psymbol_obstack, 0, 0, xmalloc, free,
(void *) 0, 0);
obstack_full_begin (&objfile -> symbol_obstack, 0, 0, xmalloc, free,
(void *) 0, 0);
obstack_full_begin (&objfile -> type_obstack, 0, 0, xmalloc, free,
(void *) 0, 0);
}
/* Now, malloc a fresh copy of the filename string using the malloc
specified as appropriate for the objfile. */
/* Now, malloc a fresh copy of the filename string. */
objfile -> name = (*objfile -> xmalloc) (strlen (filename) + 1);
objfile -> name = xmmalloc (objfile -> md, strlen (filename) + 1);
strcpy (objfile -> name, filename);
objfile -> obfd = abfd;
objfile -> mtime = bfd_get_mtime (abfd);
/* Set up the various obstacks to use the memory allocation/free
functions that are appropriate for this objfile. */
obstack_full_begin (&objfile -> psymbol_obstack, 0, 0,
objfile -> xmalloc, objfile -> free);
obstack_full_begin (&objfile -> symbol_obstack, 0, 0,
objfile -> xmalloc, objfile -> free);
obstack_full_begin (&objfile -> type_obstack, 0, 0,
objfile -> xmalloc, objfile -> free);
/* Push this file onto the head of the linked list of other such files. */
objfile -> next = object_files;
@ -111,7 +181,7 @@ free_objfile (objfile)
if (objfile -> name)
{
(*objfile -> free) (objfile -> name);
mfree (objfile -> md, objfile -> name);
}
if (objfile -> obfd)
{
@ -156,10 +226,9 @@ free_objfile (objfile)
#endif
/* The last thing we do is free the objfile struct itself, using the
free() that is appropriate for the objfile. */
/* The last thing we do is free the objfile struct itself */
(*objfile -> free) (objfile);
mfree (objfile -> md, objfile);
}
@ -337,3 +406,118 @@ iterate_over_psymtabs (func, arg1, arg2, arg3)
}
return (result);
}
/* Look for a mapped symbol file that corresponds to BASEFILE 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.
If found, then return an open file descriptor for the file, otherwise
return -1.
This routine is responsible for implementing the policy that generates
the name of the mapped symbol file from the name of a file containing
symbols that gdb would like to read. */
static int
open_mapped_file (basefile, mtime, mapped)
char *basefile;
long mtime;
int mapped;
{
int fd;
char *symfilename;
struct stat sbuf;
/* 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);
/* Check to see if the desired file already exists and is more recent than
the corresponding base file (specified by the passed MTIME parameter).
The open will fail if the file does not already exist. */
if ((fd = open (symfilename, O_RDWR)) >= 0)
{
if (fstat (fd, &sbuf) != 0)
{
close (fd);
perror_with_name (symfilename);
}
else if (sbuf.st_mtime > mtime)
{
return (fd);
}
else
{
close (fd);
fd = -1;
}
}
/* Either the file does not already exist, or the base file has changed
since it was created. In either case, if the user has specified use of
a mapped file, then create a new mapped file, truncating any existing
one.
In the case where there is an existing file, but it is out of date, and
the user did not specify mapped, the existing file is just silently
ignored. Perhaps we should warn about this case (FIXME?).
By default the file is rw for everyone, with the user's umask taking
care of turning off the permissions the user wants off. */
if (mapped)
{
fd = open (symfilename, O_RDWR | O_CREAT | O_TRUNC, 0666);
}
return (fd);
}
/* Return the base address at which we would like the next objfile's
mapped data to start.
For now, we use the kludge that the configuration specifies a base
address to which it is safe to map the first mmalloc heap, and an
increment to add to this address for each successive heap. There are
a lot of issues to deal with here to make this work reasonably, including:
Avoid memory collisions with existing mapped address spaces
Reclaim address spaces when their mmalloc heaps are unmapped
When mmalloc heaps are shared between processes they have to be
mapped at the same addresses in each
Once created, a mmalloc heap that is to be mapped back in must be
mapped at the original address. I.E. each objfile will expect to
be remapped at it's original address. This becomes a problem if
the desired address is already in use.
etc, etc, etc.
*/
static CORE_ADDR
map_to_address ()
{
#if defined(MMAP_BASE_ADDRESS) && defined (MMAP_INCREMENT)
static CORE_ADDR next = MMAP_BASE_ADDRESS;
CORE_ADDR mapto = next;
next += MMAP_INCREMENT;
return (mapto);
#else
return (0);
#endif
}

View file

@ -17,10 +17,9 @@ You should have received a copy of the GNU General Public License
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"
#include "symtab.h"
#include "param.h"
#include "expression.h"
#include "language.h"
#include "command.h"
#include "gdbcmd.h"
@ -36,14 +35,45 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <fcntl.h>
#include "gdbcore.h"
#include "regex.h"
#include "symfile.h"
/* Prototypes for local functions. */
static int
open_source_file PARAMS ((struct symtab *));
static int
get_filename_and_charpos PARAMS ((struct symtab *, char **));
static void
reverse_search_command PARAMS ((char *, int));
static void
forward_search_command PARAMS ((char *, int));
static void
line_info PARAMS ((char *, int));
static void
list_command PARAMS ((char *, int));
static void
ambiguous_line_spec PARAMS ((struct symtabs_and_lines *));
static void
source_info PARAMS ((void));
static void
show_directories PARAMS ((void));
static void
find_source_lines PARAMS ((struct symtab *, int));
/* If we use this declaration, it breaks because of fucking ANSI "const" stuff
on some systems. We just have to not declare it at all, have it default
to int, and possibly botch on a few systems. Thanks, ANSIholes... */
/* extern char *strstr(); */
extern void set_next_address ();
/* Path of directories to search for source files.
Same format as the PATH environment variable's value. */
@ -63,7 +93,7 @@ int current_source_line;
and friends should be rewritten to count characters and see where
things are wrapping, but that would be a fair amount of work. */
unsigned lines_to_list = 10;
int lines_to_list = 10;
/* Line number of last line printed. Default for various commands.
current_source_line is usually, but not always, the same as this. */
@ -79,8 +109,8 @@ static int first_line_listed;
symtab. Sigh. Behavior specification: If it is called with a
non-zero argument, that is the symtab to select. If it is not,
first lookup "main"; if it exists, use the symtab and line it
defines. If not, take the last symtab in the symtab_list (if it
exists) or the last symtab in the psymtab_list (if *it* exists). If
defines. If not, take the last symtab in the symtab lists (if it
exists) or the last symtab in the psymtab lists (if *it* exists). If
none of this works, report an error. */
void
@ -91,6 +121,7 @@ select_source_symtab (s)
struct symtab_and_line sal;
struct partial_symtab *ps;
struct partial_symtab *cs_pst = 0;
struct objfile *ofp;
if (s)
{
@ -116,35 +147,47 @@ select_source_symtab (s)
current_source_line = 1;
for (s = symtab_list; s; s = s->next)
for (ofp = object_files; ofp != NULL; ofp = ofp -> next)
{
char *name = s->filename;
int len = strlen (name);
if (! (len > 2 && !strcmp (&name[len - 2], ".h")))
current_source_symtab = s;
for (s = ofp -> symtabs; s; s = s->next)
{
char *name = s -> filename;
int len = strlen (name);
if (! (len > 2 && (strcmp (&name[len - 2], ".h") == 0)))
{
current_source_symtab = s;
}
}
}
if (current_source_symtab)
return;
/* Howabout the partial symtab list? */
/* Howabout the partial symbol tables? */
if (partial_symtab_list)
for (ofp = object_files; ofp != NULL; ofp = ofp -> next)
{
ps = partial_symtab_list;
while (ps)
for (ps = ofp -> psymtabs; ps != NULL; ps = ps -> next)
{
char *name = ps->filename;
char *name = ps -> filename;
int len = strlen (name);
if (! (len > 2 && !strcmp (&name[len - 2], ".h")))
cs_pst = ps;
ps = ps->next;
if (! (len > 2 && (strcmp (&name[len - 2], ".h") == 0)))
{
cs_pst = ps;
}
}
if (cs_pst)
if (cs_pst->readin)
fatal ("Internal: select_source_symtab: readin pst found and no symtabs.");
else
current_source_symtab = PSYMTAB_TO_SYMTAB (cs_pst);
}
if (cs_pst)
{
if (cs_pst -> readin)
{
fatal ("Internal: select_source_symtab: readin pst found and no symtabs.");
}
else
{
current_source_symtab = PSYMTAB_TO_SYMTAB (cs_pst);
}
}
if (current_source_symtab)
return;
@ -166,18 +209,22 @@ void
forget_cached_source_info ()
{
register struct symtab *s;
register struct objfile *objfile;
for (s = symtab_list; s; s = s->next)
for (objfile = object_files; objfile != NULL; objfile = objfile -> next)
{
if (s->line_charpos != 0)
for (s = objfile -> symtabs; s != NULL; s = s -> next)
{
free (s->line_charpos);
s->line_charpos = 0;
}
if (s->fullname != 0)
{
free (s->fullname);
s->fullname = 0;
if (s -> line_charpos != NULL)
{
mfree (objfile -> md, s -> line_charpos);
s -> line_charpos = NULL;
}
if (s -> fullname != NULL)
{
mfree (objfile -> md, s -> fullname);
s -> fullname = NULL;
}
}
}
}
@ -231,15 +278,14 @@ mod_path (dirname, which_path)
do
{
extern char *index ();
char *name = dirname;
register char *p;
struct stat st;
{
char *colon = index (name, ':');
char *space = index (name, ' ');
char *tab = index (name, '\t');
char *colon = strchr (name, ':');
char *space = strchr (name, ' ');
char *tab = strchr (name, '\t');
if (colon == 0 && space == 0 && tab == 0)
p = dirname = name + strlen (name);
else
@ -293,7 +339,7 @@ mod_path (dirname, which_path)
if (name[0] == '~')
name = tilde_expand (name);
else if (name[0] != '/' && name[0] != '$')
name = concat (current_directory, "/", name);
name = concat (current_directory, "/", name, NULL);
else
name = savestring (name, p - name);
make_cleanup (free, name);
@ -323,7 +369,7 @@ mod_path (dirname, which_path)
goto skip_dup; /* Same dir twice in one cmd */
strcpy (p, &p[len+1]); /* Copy from next \0 or : */
}
p = index (p, ':');
p = strchr (p, ':');
if (p != 0)
++p;
else
@ -338,15 +384,15 @@ mod_path (dirname, which_path)
c = old[prefix];
old[prefix] = '\0';
temp = concat (old, ":", name);
temp = concat (old, ":", name, NULL);
old[prefix] = c;
*which_path = concat (temp, "", &old[prefix]);
*which_path = concat (temp, "", &old[prefix], NULL);
prefix = strlen (temp);
free (temp);
}
else
{
*which_path = concat (name, (old[0]? ":" : old), old);
*which_path = concat (name, (old[0]? ":" : old), old, NULL);
prefix = strlen (name);
}
free (old);
@ -431,7 +477,7 @@ openp (path, try_cwd_first, string, mode, prot, filename_opened)
fd = -1;
for (p = path; p; p = p1 ? p1 + 1 : 0)
{
p1 = (char *) index (p, ':');
p1 = (char *) strchr (p, ':');
if (p1)
len = p1 - p;
else
@ -478,7 +524,7 @@ openp (path, try_cwd_first, string, mode, prot, filename_opened)
*filename_opened = concat (current_directory,
'/' == current_directory[strlen(current_directory)-1]? "": "/",
filename);
filename, NULL);
}
return fd;
@ -486,13 +532,15 @@ openp (path, try_cwd_first, string, mode, prot, filename_opened)
/* Open a source file given a symtab S. Returns a file descriptor
or negative number for error. */
int
static int
open_source_file (s)
struct symtab *s;
{
char *path = source_path;
char *p;
int result;
char *fullname;
/* Quick way out if we already know its full name */
if (s->fullname)
@ -501,7 +549,7 @@ open_source_file (s)
if (result >= 0)
return result;
/* Didn't work -- free old one, try again. */
free (s->fullname);
mfree (s->objfile->md, s->fullname);
s->fullname = NULL;
}
@ -525,7 +573,21 @@ open_source_file (s)
}
}
return openp (path, 0, s->filename, O_RDONLY, 0, &s->fullname);
result = openp (path, 0, s->filename, O_RDONLY, 0, &s->fullname);
if (result < 0)
{
/* Didn't work. Try using just the basename. */
p = basename (s->filename);
if (p != s->filename)
result = openp(path, 0, p, O_RDONLY,0, &s->fullname);
}
if (result >= 0)
{
fullname = s -> fullname;
s -> fullname = mstrsave (s -> objfile -> md, s -> fullname);
free (fullname);
}
return result;
}
@ -543,12 +605,19 @@ find_source_lines (s, desc)
register char *data, *p, *end;
int nlines = 0;
int lines_allocated = 1000;
int *line_charpos = (int *) xmalloc (lines_allocated * sizeof (int));
int *line_charpos;
long exec_mtime;
line_charpos = (int *) xmmalloc (s -> objfile -> md,
lines_allocated * sizeof (int));
if (fstat (desc, &st) < 0)
perror_with_name (s->filename);
if (exec_bfd && bfd_get_mtime(exec_bfd) < st.st_mtime)
printf ("Source file is more recent than executable.\n");
if (exec_bfd) {
exec_mtime = bfd_get_mtime(exec_bfd);
if (exec_mtime && exec_mtime < st.st_mtime)
printf ("Source file is more recent than executable.\n");
}
#ifdef BROKEN_LARGE_ALLOCA
data = (char *) xmalloc (st.st_size);
@ -571,19 +640,24 @@ find_source_lines (s, desc)
if (nlines == lines_allocated)
{
lines_allocated *= 2;
line_charpos = (int *) xrealloc (line_charpos,
sizeof (int) * lines_allocated);
line_charpos =
(int *) xmrealloc (s -> objfile -> md, (char *) line_charpos,
sizeof (int) * lines_allocated);
}
line_charpos[nlines++] = p - data;
}
}
s->nlines = nlines;
s->line_charpos = (int *) xrealloc (line_charpos, nlines * sizeof (int));
s->line_charpos =
(int *) xmrealloc (s -> objfile -> md, (char *) line_charpos,
nlines * sizeof (int));
}
/* Return the character position of a line LINE in symtab S.
Return 0 if anything is invalid. */
#if 0 /* Currently unused */
int
source_line_charpos (s, line)
struct symtab *s;
@ -618,13 +692,16 @@ source_charpos_line (s, chr)
line = s->nlines;
return line;
}
#endif /* 0 */
/* Get full pathname and line number positions for a symtab.
Return nonzero if line numbers may have changed.
Set *FULLNAME to actual name of the file as found by `openp',
or to 0 if the file is not found. */
int
static int
get_filename_and_charpos (s, fullname)
struct symtab *s;
char **fullname;
@ -781,7 +858,7 @@ list_command (arg, from_tty)
int linenum_beg = 0;
char *p;
if (symtab_list == 0 && partial_symtab_list == 0)
if (!have_full_symbols () && !have_partial_symbols())
error ("No symbol table is loaded. Use the \"file\" command.");
/* Pull in a current source symtab if necessary */
@ -889,11 +966,11 @@ list_command (arg, from_tty)
error ("No source file for address %s.", local_hex_string(sal.pc));
sym = find_pc_function (sal.pc);
if (sym)
printf ("%s is in %s (%s, line %d).\n",
printf ("%s is in %s (%s:%d).\n",
local_hex_string(sal.pc),
SYMBOL_NAME (sym), sal.symtab->filename, sal.line);
else
printf ("%s is in %s, line %d.\n",
printf ("%s is at %s:%d.\n",
local_hex_string(sal.pc),
sal.symtab->filename, sal.line);
}
@ -978,11 +1055,13 @@ line_info (arg, from_tty)
printf ("Line %d of \"%s\" is at pc %s but contains no code.\n",
sal.line, sal.symtab->filename, local_hex_string(start_pc));
else
printf ("Line %d of \"%s\" starts at pc %s",
sal.line, sal.symtab->filename,
local_hex_string(start_pc));
printf (" and ends at %s.\n",
local_hex_string(end_pc));
{
printf ("Line %d of \"%s\" starts at pc %s",
sal.line, sal.symtab->filename,
local_hex_string(start_pc));
printf (" and ends at %s.\n",
local_hex_string(end_pc));
}
/* x/i should display this line's code. */
set_next_address (start_pc);
/* Repeating "info line" should do the following line. */

View file

@ -18,7 +18,6 @@ You should have received a copy of the GNU General Public License
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"
#include "symtab.h"
#include "gdbtypes.h"
@ -29,7 +28,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "symfile.h"
#include "gdbcmd.h"
#include "breakpoint.h"
#include "state.h"
#include <obstack.h>
#include <assert.h>
@ -43,6 +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 */
/* External variables and functions referenced. */
@ -59,9 +58,6 @@ load_command PARAMS ((char *, int));
static void
add_symbol_file_command PARAMS ((char *, int));
static struct objfile *
symbol_file_add_digested PARAMS ((sfd *, int));
static void
cashier_psymtab PARAMS ((struct partial_symtab *));
@ -428,48 +424,10 @@ syms_from_objfile (objfile, addr, mainline, verbo)
/* We're done reading the symbol file; finish off complaints. */
clear_complaints(0, verbo);
/* Setup the breakpoint(s) for trapping longjmp(), as it may have been
defined by this new file. */
create_longjmp_breakpoint();
}
/* Reload a predigested symbol file from a dumped state file.
FIXME: For now, we load only the first dumped objfile that we
find, for two reasons. (1) Our custom malloc and mmap'd sbrk
implementation only supports one mmap'd objfile at a time, so we
can only create state files with one dumped objfile in them and
would have no way to deal with multiple dumped objfiles when reading
the state file back in even if we could create them. (2) We currently
have no way to select a specific objfile to load from a state file
containing a dump of more than one objfile, so we just select the
first one we encounter. */
static struct objfile *
symbol_file_add_digested (asfd, from_tty)
sfd *asfd;
int from_tty;
{
struct objfile *objfile;
bfd *sym_bfd;
/* First locate and map in the dumped symbol information */
objfile = objfile_from_statefile (asfd);
/* Push this file onto the head of the linked list of other such files. */
objfile -> next = object_files;
object_files = objfile;
#if 0 /* FIXME: Things to deal with... */
objfile -> obfd = abfd;
objfile -> mtime = bfd_get_mtime (abfd);
obstack_full_begin (&objfile -> psymbol_obstack, 0, 0, xmalloc, free);
obstack_full_begin (&objfile -> symbol_obstack, 0, 0, xmalloc, free);
obstack_full_begin (&objfile -> type_obstack, 0, 0, xmalloc, free);
#endif
/* Fixup all the breakpoints that may have been redefined by this
symbol file. */
breakpoint_re_set ();
}
/* Process a symbol file, as either the main file or as a dynamically
@ -486,17 +444,17 @@ symbol_file_add_digested (asfd, from_tty)
Upon failure, jumps back to command level (never returns). */
struct objfile *
symbol_file_add (name, from_tty, addr, mainline, dumpable)
symbol_file_add (name, from_tty, addr, mainline, mapped)
char *name;
int from_tty;
CORE_ADDR addr;
int mainline;
int dumpable;
int mapped;
{
struct objfile *objfile;
bfd *sym_bfd;
objfile = symfile_open (name, dumpable);
objfile = symfile_open (name, mapped);
sym_bfd = objfile->obfd;
/* There is a distinction between having no symbol table
@ -510,25 +468,39 @@ symbol_file_add (name, from_tty, addr, mainline, dumpable)
error ("%s has no symbol-table", name);
}
if ((have_full_symbols () || have_partial_symbols ())
&& mainline
&& from_tty
&& !query ("Load new symbol table from \"%s\"? ", name))
error ("Not confirmed.");
/* If the objfile uses a mapped symbol file, and we have a psymtab for
it, then skip reading any symbols at this time. */
if (from_tty || info_verbose)
if ((objfile -> psymtabs != NULL) && (objfile -> flags & OBJF_MAPPED))
{
printf_filtered ("Reading symbols from %s...", name);
wrap_here ("");
fflush (stdout);
if (from_tty || info_verbose)
{
printf_filtered ("Mapped symbols for %s.\n", name);
fflush (stdout);
}
}
syms_from_objfile (objfile, addr, mainline, from_tty);
if (from_tty || info_verbose)
else
{
printf_filtered ("done.\n");
fflush (stdout);
if ((have_full_symbols () || have_partial_symbols ())
&& mainline
&& from_tty
&& !query ("Load new symbol table from \"%s\"? ", name))
error ("Not confirmed.");
if (from_tty || info_verbose)
{
printf_filtered ("Reading symbols from %s...", name);
wrap_here ("");
fflush (stdout);
}
syms_from_objfile (objfile, addr, mainline, from_tty);
if (from_tty || info_verbose)
{
printf_filtered ("done.\n");
fflush (stdout);
}
}
return (objfile);
}
@ -546,8 +518,7 @@ symbol_file_command (args, from_tty)
struct cleanup *cleanups;
struct objfile *objfile;
struct partial_symtab *psymtab;
sfd *sym_sfd;
int dumpable = 0;
int mapped = 0;
int readnow = 0;
dont_repeat ();
@ -575,16 +546,16 @@ symbol_file_command (args, from_tty)
{
if ((argv = buildargv (args)) == NULL)
{
fatal ("virtual memory exhausted.", 0);
nomem (0);
}
cleanups = make_cleanup (freeargv, (char *) argv);
name = *argv;
while (*++argv != NULL)
{
if (!strcmp (*argv, "dumpable"))
if (!strcmp (*argv, "mapped"))
{
dumpable = 1;
mapped = 1;
}
else if (!strcmp (*argv, "readnow"))
{
@ -594,25 +565,19 @@ symbol_file_command (args, from_tty)
if (name != NULL)
{
if ((sym_sfd = sfd_fopen (name, "r")) != NULL)
/* 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)
{
(void) symbol_file_add_digested (sym_sfd, from_tty);
}
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,
dumpable);
if (readnow)
for (psymtab = objfile -> psymtabs;
psymtab != NULL;
psymtab = psymtab -> next)
{
for (psymtab = objfile -> psymtabs;
psymtab != NULL;
psymtab = psymtab -> next)
{
(void) psymtab_to_symtab (psymtab);
}
(void) psymtab_to_symtab (psymtab);
}
}
}
@ -626,9 +591,9 @@ symbol_file_command (args, from_tty)
In case of trouble, error() is called. */
static struct objfile *
symfile_open (name, dumpable)
symfile_open (name, mapped)
char *name;
int dumpable;
int mapped;
{
bfd *sym_bfd;
int desc;
@ -662,7 +627,7 @@ symfile_open (name, dumpable)
name, bfd_errmsg (bfd_error));
}
objfile = allocate_objfile (sym_bfd, name, dumpable);
objfile = allocate_objfile (sym_bfd, name, mapped);
return objfile;
}
@ -778,6 +743,14 @@ reread_symbols ()
the_big_top:
for (objfile = object_files; objfile; objfile = objfile->next) {
if (objfile->obfd) {
#ifdef IBM6000
/* If this object is from a shared library, then you should
stat on the library name, not member name. */
if (objfile->obfd->my_archive)
res = stat (objfile->obfd->my_archive->filename, &new_statbuf);
else
#endif
res = stat (objfile->name, &new_statbuf);
if (res != 0) {
/* FIXME, should use print_sys_errmsg but it's not filtered. */

View file

@ -1,5 +1,5 @@
/* Definitions for reading symbol files into GDB.
Copyright (C) 1990, 1991 Free Software Foundation, Inc.
Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
This file is part of GDB.
@ -17,52 +17,133 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined (SYMFILE_H)
#define SYMFILE_H
/* This file requires that you first include "bfd.h". */
struct psymbol_allocation_list {
struct partial_symbol *list;
struct partial_symbol *next;
int size;
};
/* Structure for keeping track of object files.
/* Master structure for keeping track of each input file from which
gdb reads symbols. One of these is allocated for each such file we
access, e.g. the exec_file, symbol_file, and any shared library object
files. */
One of these is allocated for each object file we access, e.g. the
exec_file, symbol_file, and any shared library object files. */
struct objfile
{
/* All struct objfile's are chained together by their next pointers.
The global variable "object_files" points to the first link in this
chain. */
struct objfile {
/* All struct objfile's are chained together by their next pointers. */
struct objfile *next;
/* Each objfile points to a chain of struct symtabs derived from this
object file. They are chained by their objfile_chain pointers, and
each one points back to this struct objfile. */
/* The object file's name. Malloc'd; free it if you free this struct. */
char *name;
/* Some flag bits for this objfile. */
unsigned short flags;
/* Each objfile points to a linked list of symtabs derived from this file,
one symtab structure for each compilation unit (source file). Each link
in the symtab list contains a backpointer to this objfile. */
struct symtab *symtabs;
/* Ditto for psymtabs. */
/* Each objfile points to a linked list of partial symtabs derived from
this file, one partial symtab structure for each compilation unit
(source file). */
struct partial_symtab *psymtabs;
/* The object file's name. Malloc'd; free it if you free this struct. */
char *name;
/* List of freed partial symtabs, available for re-use */
struct partial_symtab *free_psymtabs;
/* The object file's BFD. Can be null, in which case bfd_open (name) and
put the result here. */
bfd *obfd;
/* The modification timestamp of the object file, as of the last time
we read its symbols. */
long mtime;
/* Obstacks to hold objects that should be freed when we load a new symbol
table from this object file. */
struct obstack psymbol_obstack; /* Partial symbols */
struct obstack symbol_obstack; /* Full symbols */
struct obstack type_obstack; /* Types */
/* Vectors of all partial symbols read in from file. The actual data
is stored in the psymbol_obstack. */
struct psymbol_allocation_list global_psymbols;
struct psymbol_allocation_list static_psymbols;
/* Each file contains a pointer to an array of minimal symbols for all
global symbols that are defined within the file. The array is terminated
by a "null symbol", one that has a NULL pointer for the name and a zero
value for the address. This makes it easy to walk through the array
when passed a pointer to somewhere in the middle of it. There is also
a count of the number of symbols, which does include the terminating
null symbol. The array itself, as well as all the data that it points
to, should be allocated on the symbol_obstack for this file. */
struct minimal_symbol *msymbols;
int minimal_symbol_count;
/* For object file formats which don't specify fundamental types, gdb
can create such types. For now, it maintains a vector of pointers
to these internally created fundamental types on a per objfile basis,
however it really should ultimately keep them on a per-compilation-unit
basis, to account for linkage-units that consist of a number of
compilation units that may have different fundamental types, such as
linking C modules with ADA modules, or linking C modules that are
compiled with 32-bit ints with C modules that are compiled with 64-bit
ints (not inherently evil with a smarter linker). */
struct type **fundamental_types;
/* The mmalloc() malloc-descriptor for this objfile if we are using
the memory mapped malloc() package to manage storage for this objfile's
data. NULL if we are not. */
void *md;
};
/* Defines for the objfile flag word. */
/* Gdb can arrange to allocate storage for all objects related to a
particular objfile in a designated section of it's address space,
managed at a low level by mmap() and using a special version of
malloc that handles malloc/free/realloc on top of the mmap() interface.
This allows the "internal gdb state" for a particular objfile to be
dumped to a gdb state file and subsequently reloaded at a later time. */
#define OBJF_MAPPED (1 << 0) /* Objfile data is mmap'd */
/* Structure to keep track of symbol reading functions for various
object file types. */
struct sym_fns {
/* sym_name
is the name, or name prefix, of the BFD "target type" that this
/* is the name, or name prefix, of the BFD "target type" that this
set of functions handles. E.g. "a.out" or "sunOs" or "coff" or "elf". */
char *sym_name;
/* sym_namelen
counts how many bytes of sym_name should be checked against the
/* counts how many bytes of sym_name should be checked against the
BFD target type of the file being read. If an exact match is
desired, specify the number of characters in sym_name plus 1 for the
NUL. If a prefix match is desired, specify the number of characters in
@ -70,19 +151,18 @@ struct sym_fns {
int sym_namelen;
/* sym_new_init
initializes anything that is global to the entire
/* initializes anything that is global to the entire
symbol table. It is called during symbol_file_add, when
we begin debugging an entirely new program. */
void (*sym_new_init) ();
void (*sym_new_init) PARAMS ((void));
/* sym_init (sf)
reads any initial information from a symbol file, and
initializes the struct sym_fns SF in preparation for sym_read().
It is called every time we read a symbol file for any reason. */
void (*sym_init) ();
void (*sym_init) PARAMS ((struct sym_fns *));
/* sym_read (sf, addr, mainline)
reads a symbol file into a psymtab (or possibly a symtab).
@ -93,86 +173,133 @@ struct sym_fns {
symbol file (e.g. shared library or dynamically loaded file)
is being read. */
void (*sym_read) ();
void (*sym_read) PARAMS ((struct sym_fns *, CORE_ADDR, int));
/* sym_bfd
is the accessor for the symbol file being read. */
/* is the accessor for the symbol file being read. */
bfd *sym_bfd;
bfd *sym_bfd;
/* sym_private
is where information can be shared among sym_init and sym_read.
/* is where information can be shared among sym_init and sym_read.
It is typically a pointer to malloc'd memory. */
char *sym_private; /* Should be void * */
/* next
finds the next struct sym_fns. They are allocated and initialized
/* is the "struct objfile" for the object file being read. */
struct objfile *objfile;
/* finds the next struct sym_fns. They are allocated and initialized
in whatever module implements the functions pointed to; an
initializer calls add_symtab_fns to add them to the global chain. */
struct sym_fns *next;
/* objfile
is the "struct objfile" for the object file being read. */
struct objfile *objfile;
};
extern void extend_psymbol_list();
extern void
extend_psymbol_list PARAMS ((struct psymbol_allocation_list *,
struct objfile *));
/* Add any kind of symbol to a psymbol_allocation_list. */
#define ADD_PSYMBOL_VT_TO_LIST(NAME, NAMELENGTH, NAMESPACE, CLASS, LIST, VALUE, VT)\
#define ADD_PSYMBOL_VT_TO_LIST(NAME,NAMELENGTH,NAMESPACE,CLASS,LIST,VALUE,VT) \
do { \
register struct partial_symbol *psym; \
if ((LIST).next >= (LIST).list + (LIST).size) \
extend_psymbol_list(&(LIST)); \
extend_psymbol_list (&(LIST),objfile); \
psym = (LIST).next++; \
\
SYMBOL_NAME (psym) = (char *) obstack_alloc (psymbol_obstack, \
SYMBOL_NAME (psym) = (char *) obstack_alloc (&objfile->psymbol_obstack, \
(NAMELENGTH) + 1); \
strncpy (SYMBOL_NAME (psym), (NAME), (NAMELENGTH)); \
memcpy (SYMBOL_NAME (psym), (NAME), (NAMELENGTH)); \
SYMBOL_NAME (psym)[(NAMELENGTH)] = '\0'; \
SYMBOL_NAMESPACE (psym) = (NAMESPACE); \
SYMBOL_CLASS (psym) = (CLASS); \
VT (psym) = (VALUE); \
} while (0);
#ifdef DEBUG
/* Since one arg is a struct, we have to pass in a ptr and deref it (sigh) */
#define ADD_PSYMBOL_TO_LIST(name, namelength, namespace, class, list, value) \
add_psymbol_to_list (name, namelength, namespace, class, &list, value)
#define ADD_PSYMBOL_ADDR_TO_LIST(name, namelength, namespace, class, list, value) \
add_psymbol_addr_to_list (name, namelength, namespace, class, &list, value)
#else /* !DEBUG */
/* Add a symbol with an integer value to a psymtab. */
#define ADD_PSYMBOL_TO_LIST(name, namelength, namespace, class, list, value) \
ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, list, value, SYMBOL_VALUE)
/* Add a symbol with a CORE_ADDR value to a psymtab. */
#define ADD_PSYMBOL_ADDR_TO_LIST(name, namelength, namespace, class, list, value)\
ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, list, value, SYMBOL_VALUE_ADDRESS)
#endif /* DEBUG */
/* Functions */
extern struct symtab *allocate_symtab ();
extern struct objfile *allocate_objfile ();
extern void free_objfile ();
extern int free_named_symtabs ();
extern void fill_in_vptr_fieldno ();
extern void add_symtab_fns ();
extern void syms_from_objfile ();
extern void
sort_pst_symbols PARAMS ((struct partial_symtab *));
/* Functions for dealing with the misc "function" vector, really a misc
address<->symbol mapping vector for things we don't have debug symbols
for. */
extern struct symtab *
allocate_symtab PARAMS ((char *, struct objfile *));
extern void init_misc_bunches ();
extern void prim_record_misc_function ();
extern void discard_misc_bunches ();
extern void condense_misc_bunches ();
extern struct objfile *
allocate_objfile PARAMS ((bfd *, char *, int));
extern void
free_objfile PARAMS ((struct objfile *));
extern void
free_all_objfiles PARAMS ((void));
extern int
free_named_symtabs PARAMS ((char *));
extern void
fill_in_vptr_fieldno PARAMS ((struct type *));
extern void
add_symtab_fns PARAMS ((struct sym_fns *));
extern void
syms_from_objfile PARAMS ((struct objfile *, CORE_ADDR, int, int));
extern struct partial_symtab *
start_psymtab_common PARAMS ((struct objfile *, CORE_ADDR, char *, CORE_ADDR,
struct partial_symbol *,
struct partial_symbol *));
/* Sorting your symbols for fast lookup or alphabetical printing. */
extern void sort_block_syms ();
extern void sort_symtab_syms ();
extern void sort_all_symtab_syms ();
extern void sort_block_syms ();
extern void
sort_block_syms PARAMS ((struct block *));
extern void
sort_symtab_syms PARAMS ((struct symtab *));
extern void
sort_all_symtab_syms PARAMS ((void));
/* Make a copy of the string at PTR with SIZE characters in the symbol obstack
(and add a null character at the end in the copy).
Returns the address of the copy. */
extern char *obsavestring ();
extern char *
obsavestring PARAMS ((char *, int, struct obstack *));
/* Concatenate strings S1, S2 and S3; return the new string.
Space is found in the symbol_obstack. */
extern char *obconcat ();
extern char *
obconcat PARAMS ((struct obstack *obstackp, const char *, const char *,
const char *));
/* Variables */
@ -183,18 +310,20 @@ extern struct objfile *symfile_objfile;
/* Where execution starts in symfile */
CORE_ADDR entry_point;
extern CORE_ADDR entry_point;
/* Root of object file struct chain. */
struct objfile *object_files;
extern struct objfile *object_files;
/* Vectors of all partial symbols read in from file. */
/* Traverse all object files. ALL_OBJFILES_SAFE works even if you delete
the objfile during the traversal. */
extern struct psymbol_allocation_list {
struct partial_symbol *list, *next;
int size;
} global_psymbols, static_psymbols;
#define ALL_OBJFILES(obj) \
for (obj = object_files; 0 != obj; obj = obj->next)
#define ALL_OBJFILES_SAFE(obj,nxt) \
for (obj = object_files; obj? (nxt=obj->next, 1): 0; obj = nxt)
/* Support for complaining about things in the symbol file that aren't
catastrophic.
@ -214,7 +343,65 @@ struct complaint {
extern struct complaint complaint_root[1];
/* Externally visible variables defined in symfile.c */
/* The object file that the main symbol table was loaded from (e.g. the
argument to the "symbol-file" or "file" command). */
extern struct objfile *symfile_objfile;
/* Where execution starts in symfile */
extern CORE_ADDR entry_point;
/* Root of object file struct chain. */
extern struct objfile *object_files;
/* Functions that handle complaints. (in symfile.c) */
void complain();
void clear_complaints();
extern void
complain PARAMS ((struct complaint *, char *));
extern void
clear_complaints PARAMS ((int sym_reading, int noisy));
/* From symfile.c */
extern struct partial_symtab *
allocate_psymtab PARAMS ((char *, struct objfile *));
/* From minsyms.c */
extern PTR
iterate_over_msymbols PARAMS ((PTR (*func) (struct objfile *,
struct minimal_symbol *,
PTR arg1, PTR arg2, PTR arg3),
PTR arg1, PTR arg2, PTR arg3));
/* From objfiles.c */
extern PTR
iterate_over_objfiles PARAMS ((PTR (*func) (struct objfile *,
PTR arg1, PTR arg2, PTR arg3),
PTR arg1, PTR arg2, PTR arg3));
extern PTR
iterate_over_symtabs PARAMS ((PTR (*func) (struct objfile *, struct symtab *,
PTR arg1, PTR arg2, PTR arg3),
PTR arg1, PTR arg2, PTR arg3));
extern PTR
iterate_over_psymtabs PARAMS ((PTR (*func) (struct objfile *,
struct partial_symtab *,
PTR arg1, PTR arg2, PTR arg3),
PTR arg1, PTR arg2, PTR arg3));
/* From dwarfread.c */
extern void
dwarf_build_psymtabs PARAMS ((int, char *, CORE_ADDR, int, unsigned int,
unsigned int, unsigned int, unsigned int,
struct objfile *));
#endif /* !defined(SYMFILE_H) */

View file

@ -291,13 +291,13 @@ struct pt_regset ep;
printf (" %g\n", val);
}
if (ep.pr_fpu.fpu_rsvd1)
printf ("warning: rsvd1 is 0x%x\n", ep.pr_fpu.fpu_rsvd1);
warning ("rsvd1 is 0x%x\n", ep.pr_fpu.fpu_rsvd1);
if (ep.pr_fpu.fpu_rsvd2)
printf ("warning: rsvd2 is 0x%x\n", ep.pr_fpu.fpu_rsvd2);
warning ("rsvd2 is 0x%x\n", ep.pr_fpu.fpu_rsvd2);
if (ep.pr_fpu.fpu_rsvd3)
printf ("warning: rsvd3 is 0x%x\n", ep.pr_fpu.fpu_rsvd3);
warning ("rsvd3 is 0x%x\n", ep.pr_fpu.fpu_rsvd3);
if (ep.pr_fpu.fpu_rsvd5)
printf ("warning: rsvd5 is 0x%x\n", ep.pr_fpu.fpu_rsvd5);
warning ("rsvd5 is 0x%x\n", ep.pr_fpu.fpu_rsvd5);
}

View file

@ -1,5 +1,5 @@
/* Do various things to symbol tables (other than lookup), for GDB.
Copyright 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
This file is part of GDB.
@ -18,9 +18,9 @@ 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"
#include "symtab.h"
#include "gdbtypes.h"
#include "bfd.h"
#include "symfile.h"
#include "breakpoint.h"
@ -28,21 +28,99 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "obstack.h"
#include <string.h>
#ifndef DEV_TTY
#define DEV_TTY "/dev/tty"
#endif
/* Prototypes for local functions */
static PTR
dump_symtab PARAMS ((struct objfile *, struct symtab *, PTR, PTR, PTR));
static PTR
dump_psymtab PARAMS ((struct objfile *, struct partial_symtab *, PTR, PTR,
PTR));
static PTR
dump_msymbols PARAMS ((struct objfile *, PTR, PTR, PTR));
static PTR
dump_objfile PARAMS ((struct objfile *, PTR, PTR, PTR));
static void
printobjfiles_command PARAMS ((void));
static int
block_depth PARAMS ((struct block *));
static void
print_partial_symbol PARAMS ((struct partial_symbol *, int, char *, FILE *));
static void
printpsyms_command PARAMS ((char *, int));
static void
print_symbol PARAMS ((struct symbol *, int, FILE *));
static void
printsyms_command PARAMS ((char *, int));
static void
free_symtab_block PARAMS ((struct objfile *, struct block *));
static void
printmsyms_command PARAMS ((char *, int));
static void
dump_symtab_lines PARAMS ((struct symtab *));
static void
dump_symtabs PARAMS ((struct symtab *));
static void
dump_last_symtab PARAMS ((struct symtab *));
static void
dump_blockvector PARAMS ((struct blockvector *));
static void
dump_block PARAMS ((struct block *));
static char *
dump_addrclass PARAMS ((int));
static char *
dump_namespace PARAMS ((int));
static void
dump_symbol PARAMS ((struct symbol *));
static void
dump_type PARAMS ((struct type *));
static void
dump_linetable PARAMS ((struct linetable *));
static void
dump_strtbl PARAMS ((void));
/* Free a struct block <- B and all the symbols defined in that block. */
static void
free_symtab_block (b)
free_symtab_block (objfile, b)
struct objfile *objfile;
struct block *b;
{
register int i, n;
n = BLOCK_NSYMS (b);
for (i = 0; i < n; i++)
{
free (SYMBOL_NAME (BLOCK_SYM (b, i)));
free (BLOCK_SYM (b, i));
mfree (objfile -> md, SYMBOL_NAME (BLOCK_SYM (b, i)));
mfree (objfile -> md, BLOCK_SYM (b, i));
}
free (b);
mfree (objfile -> md, b);
}
/* Free all the storage associated with the struct symtab <- S.
@ -75,9 +153,9 @@ free_symtab (s)
bv = BLOCKVECTOR (s);
n = BLOCKVECTOR_NBLOCKS (bv);
for (i = 0; i < n; i++)
free_symtab_block (BLOCKVECTOR_BLOCK (bv, i));
free_symtab_block (s -> objfile, BLOCKVECTOR_BLOCK (bv, i));
/* Free the blockvector itself. */
free (bv);
mfree (s -> objfile -> md, bv);
/* Also free the linetable. */
case free_linetable:
@ -85,73 +163,202 @@ free_symtab (s)
or by some other symtab, except for our linetable.
Free that now. */
if (LINETABLE (s))
free (LINETABLE (s));
mfree (s -> objfile -> md, LINETABLE (s));
break;
}
/* If there is a single block of memory to free, free it. */
if (s->free_ptr)
free (s->free_ptr);
if (s -> free_ptr != NULL)
mfree (s -> objfile -> md, s -> free_ptr);
/* Free source-related stuff */
if (s->line_charpos)
free (s->line_charpos);
if (s->fullname)
free (s->fullname);
free (s);
if (s -> line_charpos != NULL)
mfree (s -> objfile -> md, s -> line_charpos);
if (s -> fullname != NULL)
mfree (s -> objfile -> md, s -> fullname);
mfree (s -> objfile -> md, s);
}
static int block_depth ();
static void print_symbol ();
static void print_partial_symbol ();
void
printsyms_command (filename)
char *filename;
static PTR
dump_objfile (objfile, arg1, arg2, arg3)
struct objfile *objfile;
PTR arg1;
PTR arg2;
PTR arg3;
{
FILE *outfile;
register struct symtab *s;
struct symtab *symtab;
struct partial_symtab *psymtab;
printf_filtered ("\nObject file %s: ", objfile -> name);
printf_filtered ("Objfile at %x, bfd at %x, %d minsyms\n\n",
objfile, objfile -> obfd, objfile->minimal_symbol_count);
if (objfile -> psymtabs)
{
printf_filtered ("Psymtabs:\n");
for (psymtab = objfile -> psymtabs;
psymtab != NULL;
psymtab = psymtab -> next)
{
printf_filtered ("%s at %x, ", psymtab -> filename, psymtab);
if (psymtab -> objfile != objfile)
{
printf_filtered ("NOT ON CHAIN! ");
}
wrap_here (" ");
}
printf_filtered ("\n\n");
}
if (objfile -> symtabs)
{
printf_filtered ("Symtabs:\n");
for (symtab = objfile -> symtabs;
symtab != NULL;
symtab = symtab->next)
{
printf_filtered ("%s at %x, ", symtab -> filename, symtab);
if (symtab -> objfile != objfile)
{
printf_filtered ("NOT ON CHAIN! ");
}
wrap_here (" ");
}
printf_filtered ("\n\n");
}
return (NULL);
}
static PTR
dump_msymbols (objfile, arg1, arg2, arg3)
struct objfile *objfile;
PTR arg1;
PTR arg2;
PTR arg3;
{
FILE *outfile = (FILE *) arg1;
char *symname = (char *) arg2;
struct minimal_symbol *msymbol;
int index;
char ms_type;
/* Print minimal symbols from this objfile unless a specific linkage
unit file was requested, in which case we only print the symbols
for that one. */
if (symname == NULL || (strcmp (symname, objfile -> name) == 0))
{
fprintf_filtered (outfile, "\nObject file %s:\n\n", objfile -> name);
for (index = 0, msymbol = objfile -> msymbols;
msymbol -> name != NULL; msymbol++, index++)
{
switch (msymbol -> type)
{
case mst_unknown:
ms_type = 'u';
break;
case mst_text:
ms_type = 't';
break;
case mst_data:
ms_type = 'd';
break;
case mst_bss:
ms_type = 'b';
break;
case mst_abs:
ms_type = 'a';
break;
default:
ms_type = '?';
break;
}
fprintf_filtered (outfile, "[%2d] %c %#10x %s\n", index, ms_type,
msymbol -> address, msymbol -> name);
}
if (objfile -> minimal_symbol_count != index)
{
warning ("internal error: minimal symbol count %d != %d",
objfile -> minimal_symbol_count, index);
}
fprintf_filtered (outfile, "\n");
}
return (NULL);
}
static PTR
dump_psymtab (objfile, psymtab, arg1, arg2, arg3)
struct objfile *objfile;
struct partial_symtab *psymtab;
PTR arg1;
PTR arg2;
PTR arg3;
{
FILE *outfile = (FILE *) arg1;
char *symname = (char *) arg2;
/* If source file name is specified, reject all but that one. */
if (symname == NULL || (strcmp (symname, psymtab -> filename) == 0))
{
fprintf_filtered (outfile, "\nPartial symtab for source file %s ",
psymtab -> filename);
fprintf_filtered (outfile, "(object 0x%x)\n\n", psymtab);
fprintf (outfile, " Read from object file %s (0x%x)\n",
objfile -> name, objfile);
if (psymtab -> readin)
{
fprintf_filtered (outfile,
" Full symtab was read (at 0x%x by function at 0x%x)\n",
psymtab -> symtab, psymtab -> read_symtab);
}
fprintf_filtered (outfile, " Relocate symbols by 0x%x\n",
psymtab -> addr);
fprintf_filtered (outfile, " Symbols cover text addresses 0x%x-0x%x\n",
psymtab -> textlow, psymtab -> texthigh);
fprintf_filtered (outfile, " Depends on %d other partial symtabs.\n",
psymtab -> number_of_dependencies);
if (psymtab -> n_global_syms > 0)
{
print_partial_symbol (objfile -> global_psymbols.list
+ psymtab -> globals_offset,
psymtab -> n_global_syms, "Global", outfile);
}
if (psymtab -> n_static_syms > 0)
{
print_partial_symbol (objfile -> static_psymbols.list
+ psymtab -> statics_offset,
psymtab -> n_static_syms, "Static", outfile);
}
fprintf_filtered (outfile, "\n");
}
return (NULL);
}
static PTR
dump_symtab (objfile, symtab, arg1, arg2, arg3)
struct objfile *objfile;
struct symtab *symtab;
PTR arg1;
PTR arg2;
PTR arg3;
{
FILE *outfile = (FILE *) arg1;
char *symname = (char *) arg2;
register int i, j;
int len, blen;
register struct linetable *l;
struct blockvector *bv;
register struct block *b;
int depth;
struct cleanup *cleanups;
extern int fclose();
char *symname;
if (filename == 0)
error_no_arg ("file to write symbol data in");
/* If a second arg is supplied, it is a source file name to match on */
symname = strchr (filename, ' ');
if (symname)
*symname++ = '\0';
filename = tilde_expand (filename);
make_cleanup (free, filename);
outfile = fopen (filename, "w");
if (outfile == 0)
perror_with_name (filename);
cleanups = make_cleanup (fclose, outfile);
immediate_quit++;
for (s = symtab_list; s; s = s->next)
if (symname == NULL || (strcmp (symname, symtab -> filename) == 0))
{
/* If source file name is specified, reject all but that one. */
if (symname)
if (0 != strncmp (symname, s->filename, strlen (symname)))
continue;
fprintf (outfile, "Symtab for file %s\n", s->filename);
fprintf (outfile, "Read from object file %s (%x)\n", s->objfile->name,
s->objfile);
fprintf (outfile, "\nSymtab for file %s\n", symtab->filename);
fprintf (outfile, "Read from object file %s (%x)\n", objfile->name,
objfile);
/* First print the line table. */
l = LINETABLE (s);
l = LINETABLE (symtab);
if (l) {
fprintf (outfile, "\nLine table:\n\n");
len = l->nitems;
@ -161,7 +368,7 @@ printsyms_command (filename)
}
/* Now print the block info. */
fprintf (outfile, "\nBlockvector:\n\n");
bv = BLOCKVECTOR (s);
bv = BLOCKVECTOR (symtab);
len = BLOCKVECTOR_NBLOCKS (bv);
for (i = 0; i < len; i++)
{
@ -181,10 +388,54 @@ printsyms_command (filename)
print_symbol (BLOCK_SYM (b, j), depth + 1, outfile);
}
}
fprintf (outfile, "\n");
}
return (NULL);
}
fprintf (outfile, "\n\n");
static void
printsyms_command (args, from_tty)
char *args;
int from_tty;
{
char **argv;
FILE *outfile;
struct cleanup *cleanups;
char *symname = NULL;
char *filename = DEV_TTY;
dont_repeat ();
if (args == NULL)
{
error ("printsyms takes an output file name and optional symbol file name");
}
else if ((argv = buildargv (args)) == NULL)
{
nomem (0);
}
cleanups = make_cleanup (freeargv, (char *) argv);
if (argv[0] != NULL)
{
filename = argv[0];
/* If a second arg is supplied, it is a source file name to match on */
if (argv[1] != NULL)
{
symname = argv[1];
}
}
filename = tilde_expand (filename);
make_cleanup (free, filename);
outfile = fopen (filename, "w");
if (outfile == 0)
perror_with_name (filename);
make_cleanup (fclose, (char *) outfile);
immediate_quit++;
iterate_over_symtabs (dump_symtab, (PTR) outfile, (PTR) symname, (PTR) NULL);
immediate_quit--;
do_cleanups (cleanups);
}
@ -301,23 +552,38 @@ print_symbol (symbol, depth, outfile)
fprintf (outfile, "\n");
}
void
printpsyms_command (filename)
char *filename;
static void
printpsyms_command (args, from_tty)
char *args;
int from_tty;
{
char **argv;
FILE *outfile;
struct partial_symtab *p;
struct cleanup *cleanups;
extern int fclose();
char *symname;
char *symname = NULL;
char *filename = DEV_TTY;
if (filename == 0)
error_no_arg ("file to write partial symbol data in");
dont_repeat ();
/* If a second arg is supplied, it is a source file name to match on */
symname = strchr (filename, ' ');
if (symname)
*symname++ = '\0';
if (args == NULL)
{
error ("printpsyms takes an output file name and optional symbol file name");
}
else if ((argv = buildargv (args)) == NULL)
{
nomem (0);
}
cleanups = make_cleanup (freeargv, (char *) argv);
if (argv[0] != NULL)
{
filename = argv[0];
/* If a second arg is supplied, it is a source file name to match on */
if (argv[1] != NULL)
{
symname = argv[1];
}
}
filename = tilde_expand (filename);
make_cleanup (free, filename);
@ -325,50 +591,21 @@ printpsyms_command (filename)
outfile = fopen (filename, "w");
if (outfile == 0)
perror_with_name (filename);
make_cleanup (fclose, outfile);
cleanups = make_cleanup (fclose, outfile);
immediate_quit++;
for (p = partial_symtab_list; p; p = p->next)
{
/* If source file name is specified, reject all but that one. */
if (symname)
if (0 != strncmp (symname, p->filename, strlen (symname)))
continue;
fprintf_filtered (outfile, "Partial symtab for source file %s ",
p->filename);
fprintf_filtered (outfile, "(object 0x%x)\n\n", p);
fprintf (outfile, " Read from object file %s (0x%x)\n", p->objfile->name,
p->objfile);
if (p->readin)
fprintf_filtered (outfile, " Full symtab was read (at 0x%x by function at 0x%x)\n",
p->symtab, p->read_symtab);
fprintf_filtered (outfile, " Relocate symbols by 0x%x\n", p->addr);
fprintf_filtered (outfile, " Symbols cover text addresses 0x%x-0x%x\n",
p->textlow, p->texthigh);
fprintf_filtered (outfile, " Depends on %d other partial symtabs.\n",
p->number_of_dependencies);
if (p->n_global_syms > 0)
print_partial_symbol (global_psymbols.list + p->globals_offset,
p->n_global_syms, "Global", outfile);
if (p->n_static_syms > 0)
print_partial_symbol (static_psymbols.list + p->statics_offset,
p->n_static_syms, "Static", outfile);
fprintf_filtered (outfile, "\n\n");
}
iterate_over_psymtabs (dump_psymtab, (PTR) outfile, (PTR) symname,
(PTR) NULL);
immediate_quit--;
do_cleanups (cleanups);
}
static void
print_partial_symbol (p, count, what, outfile)
struct partial_symbol *p;
int count;
char *what;
FILE *outfile;
struct partial_symbol *p;
int count;
char *what;
FILE *outfile;
{
fprintf_filtered (outfile, " %s partial symbols:\n", what);
@ -444,6 +681,222 @@ FILE *outfile;
}
}
static void
printmsyms_command (args, from_tty)
char *args;
int from_tty;
{
char **argv;
FILE *outfile;
struct cleanup *cleanups;
char *filename = DEV_TTY;
char *symname = NULL;
dont_repeat ();
if (args == NULL)
{
error ("printmsyms takes an output file name and optional symbol file name");
}
else if ((argv = buildargv (args)) == NULL)
{
nomem (0);
}
cleanups = make_cleanup (freeargv, argv);
if (argv[0] != NULL)
{
filename = argv[0];
/* If a second arg is supplied, it is a source file name to match on */
if (argv[1] != NULL)
{
symname = argv[1];
}
}
filename = tilde_expand (filename);
make_cleanup (free, filename);
outfile = fopen (filename, "w");
if (outfile == 0)
perror_with_name (filename);
make_cleanup (fclose, outfile);
immediate_quit++;
iterate_over_objfiles (dump_msymbols, (PTR) outfile, (PTR) symname,
(PTR) NULL);
immediate_quit--;
fprintf_filtered (outfile, "\n\n");
do_cleanups (cleanups);
}
static void
printobjfiles_command ()
{
dont_repeat ();
immediate_quit++;
iterate_over_objfiles (dump_objfile, (PTR) NULL, (PTR) NULL, (PTR) NULL);
immediate_quit--;
}
/* Debugging functions from xcoffread.c originally. Some are redundant
and should probably disappear. */
static void
dump_strtbl ()
{
#if 0 /* We don't know its length FIXME */
int ii;
printf ("===STRING TABLE DUMP...\n\n");
for ( ii=0; ii < strtbl_len; ++ii )
printf ("%c", isprint (*(strtbl+ii)) ? *(strtbl+ii) : ' ');
printf ("\n");
#endif
}
static void
dump_linetable (ltb)
struct linetable *ltb;
{
int ii;
for (ii=0; ii < ltb->nitems; ++ii)
printf ("line: %d, addr: 0x%x\n", ltb->item[ii].line, ltb->item[ii].pc);
}
static void
dump_type (typeP)
struct type *typeP;
{
printf ("0x%x: name: %s\n", typeP, typeP->name ? typeP->name : "(nil)");
}
static void
dump_symbol (pp)
struct symbol *pp;
{
printf (" sym: %s\t%s,\t%s\ttype: 0x%x, val: 0x%x end: 0x%x\n",
pp->name, dump_namespace (pp->namespace),
dump_addrclass (pp->class), pp->type,
SYMBOL_CLASS(pp) == LOC_BLOCK ? BLOCK_START(SYMBOL_BLOCK_VALUE(pp))
: pp->value.value,
SYMBOL_CLASS(pp) == LOC_BLOCK ? BLOCK_END(SYMBOL_BLOCK_VALUE(pp)) : 0);
}
static char *
dump_namespace (ns)
int ns;
{
static char *ns_name [] = {
"UNDEF_NS", "VAR_NS", "STRUCT_NS", "LABEL_NS"};
switch (ns) {
case UNDEF_NAMESPACE:
case VAR_NAMESPACE:
case STRUCT_NAMESPACE:
case LABEL_NAMESPACE:
return ns_name[ns];
}
return "***ERROR***";
}
static char *
dump_addrclass (ac)
int ac; /* address class */
{
static char *ac_name [] = {
"LOC_UNDEF",
"LOC_CONST",
"LOC_STATIC",
"LOC_REGISTER",
"LOC_ARG",
"LOC_REF_ARG",
"LOC_REGPARM",
"LOC_LOCAL",
"LOC_TYPEDEF",
"LOC_LABEL",
"LOC_BLOCK",
"LOC_CONST_BYTES",
"LOC_LOCAL_ARG",
};
switch (ac) {
case LOC_UNDEF:
case LOC_CONST:
case LOC_STATIC:
case LOC_REGISTER:
case LOC_ARG:
case LOC_REF_ARG:
case LOC_REGPARM:
case LOC_LOCAL:
case LOC_TYPEDEF:
case LOC_LABEL:
case LOC_BLOCK:
case LOC_CONST_BYTES:
case LOC_LOCAL_ARG:
return ac_name [ac];
}
return "***ERROR***";
}
static void
dump_block (pp)
struct block *pp;
{
int ii;
printf ("BLOCK..: start: 0x%x, end: 0x%x\n", pp->startaddr, pp->endaddr);
for (ii=0; ii < pp->nsyms; ++ii)
dump_symbol (pp->sym[ii]);
}
static void
dump_blockvector (pp)
struct blockvector *pp;
{
int ii;
for (ii=0; ii < pp->nblocks; ++ii)
dump_block (pp->block [ii]);
}
static void
dump_last_symtab (pp)
struct symtab *pp;
{
for ( ; pp; pp = pp->next) {
if ( pp->next == 0 ) {
printf ("SYMTAB NAME: %s\n", pp->filename);
dump_blockvector (pp->blockvector);
}
}
}
static void
dump_symtabs (pp)
struct symtab *pp;
{
for ( ; pp; pp = pp->next) {
printf ("SYMTAB NAME: %s\n", pp->filename ? pp->filename : "(nil)");
/* if (pp->linetable)
dump_linetable (pp->linetable); */
dump_blockvector (pp->blockvector);
}
}
static void
dump_symtab_lines (pp)
struct symtab *pp;
{
for ( ; pp; pp = pp->next) {
printf ("SYMTAB NAME: %s\n", pp->filename ? pp->filename : "(nil)");
if (pp->linetable)
dump_linetable (pp->linetable);
/* dump_blockvector (pp->blockvector); */
}
}
/* Return the nexting depth of a block within other blocks in its symtab. */
static int
@ -454,112 +907,28 @@ block_depth (block)
while (block = BLOCK_SUPERBLOCK (block)) i++;
return i;
}
static void
printobjfiles_command ()
{
struct objfile *objfile;
struct symtab *symtab;
struct partial_symtab *psymtab;
int first;
for (objfile = object_files; objfile; objfile = objfile->next) {
printf_filtered ("\nObject file %s: ", objfile->name);
printf_filtered ("Objfile at %x, bfd at %x\n\n", objfile, objfile->obfd);
if (objfile->psymtabs) {
printf_filtered ("Psymtabs:\n");
for (psymtab = objfile->psymtabs;
psymtab;
psymtab = psymtab->objfile_chain) {
printf_filtered ("%s at %x, ", psymtab->filename, psymtab);
if (psymtab->objfile != objfile)
printf_filtered ("NOT ON CHAIN! ");
wrap_here (" ");
}
printf_filtered ("\n\n");
}
if (objfile->symtabs) {
printf_filtered ("Symtabs:\n");
for (symtab = objfile->symtabs;
symtab;
symtab = symtab->objfile_chain) {
printf_filtered ("%s at %x, ", symtab->filename, symtab);
if (symtab->objfile != objfile)
printf_filtered ("NOT ON CHAIN! ");
wrap_here (" ");
}
printf_filtered ("\n\n");
}
}
/* Now check for psymtabs that aren't owned by an objfile. */
first = 1;
for (psymtab = partial_symtab_list; psymtab; psymtab = psymtab->next) {
for (objfile = object_files; objfile; objfile = objfile->next) {
if (psymtab->objfile == objfile)
goto next;
}
if (first)
printf_filtered ("Psymtabs that aren't owned by any objfile:\n");
first = 0;
printf_filtered (" %s at %x, psymtab->objfile %x\n", psymtab->filename,
psymtab, psymtab->objfile);
next: ;
}
/* Now check for symtabs that aren't owned by an objfile. */
first = 1;
for (symtab = symtab_list; symtab; symtab = symtab->next) {
for (objfile = object_files; objfile; objfile = objfile->next) {
if (symtab->objfile == objfile)
goto next2;
}
if (first)
printf_filtered ("Symtabs that aren't owned by any objfile:\n");
first = 0;
printf_filtered (" %s at %x, symtab->objfile %x\n", symtab->filename,
symtab, symtab->objfile);
next2: ;
}
}
struct cplus_struct_type cplus_struct_default;
void
allocate_cplus_struct_type (type)
struct type *type;
{
if (!HAVE_CPLUS_STRUCT (type))
{
int nfields = TYPE_NFIELDS (type);
TYPE_CPLUS_SPECIFIC (type) = (struct cplus_struct_type *)
obstack_alloc (symbol_obstack, sizeof (struct cplus_struct_type));
*(TYPE_CPLUS_SPECIFIC(type)) = cplus_struct_default;
}
}
/* Increase the space allocated for LISTP. */
void
extend_psymbol_list(listp)
extend_psymbol_list (listp, objfile)
register struct psymbol_allocation_list *listp;
struct objfile *objfile;
{
int new_size;
if (listp->size == 0)
{
new_size = 255;
listp->list = (struct partial_symbol *)
xmalloc (new_size * sizeof (struct partial_symbol));
xmmalloc (objfile -> md, new_size * sizeof (struct partial_symbol));
}
else
{
new_size = listp->size * 2;
listp->list = (struct partial_symbol *)
xrealloc (listp->list, new_size * sizeof (struct partial_symbol));
xmrealloc (objfile -> md, (char *) listp->list,
new_size * sizeof (struct partial_symbol));
}
/* Next assumes we only went one over. Should be good if
program works correctly */
@ -585,9 +954,9 @@ add_psymbol_to_list (name, namelength, namespace, class, listp, psymval)
register struct partial_symbol *psym;
if (listp -> next >= listp -> list + listp -> size)
extend_psymbol_list (listp);
extend_psymbol_list (listp, objfile);
psym = listp -> next++;
SYMBOL_NAME (psym) = (char *) obstack_alloc (psymbol_obstack,
SYMBOL_NAME (psym) = (char *) obstack_alloc (&objfile->psymbol_obstack,
namelength + 1);
memcpy (SYMBOL_NAME (psym), name, namelength);
SYMBOL_NAME (psym)[namelength] = '\0';
@ -612,9 +981,9 @@ add_psymbol_addr_to_list (name, namelength, namespace, class, listp, psymval)
register struct partial_symbol *psym;
if (listp -> next >= listp -> list + listp -> size)
extend_psymbol_list (listp);
extend_psymbol_list (listp, objfile);
psym = listp -> next++;
SYMBOL_NAME (psym) = (char *) obstack_alloc (psymbol_obstack,
SYMBOL_NAME (psym) = (char *) obstack_alloc (&objfile->psymbol_obstack,
namelength + 1);
memcpy (SYMBOL_NAME (psym), name, namelength);
SYMBOL_NAME (psym)[namelength] = '\0';
@ -628,15 +997,15 @@ add_psymbol_addr_to_list (name, namelength, namespace, class, listp, psymval)
void
_initialize_symmisc ()
{
symtab_list = (struct symtab *) 0;
partial_symtab_list = (struct partial_symtab *) 0;
add_com ("printsyms", class_obscure, printsyms_command,
"Print dump of current symbol definitions to file OUTFILE.\n\
add_com ("printmsyms", class_obscure, printmsyms_command,
"Print dump of current minimal symbol definitions to file OUTFILE.\n\
If a SOURCE file is specified, dump only that file's symbols.");
add_com ("printpsyms", class_obscure, printpsyms_command,
"Print dump of current partial symbol definitions to file OUTFILE.\n\
If a SOURCE file is specified, dump only that file's partial symbols.");
add_com ("printsyms", class_obscure, printsyms_command,
"Print dump of current symbol definitions to file OUTFILE.\n\
If a SOURCE file is specified, dump only that file's symbols.");
add_com ("printobjfiles", class_obscure, printobjfiles_command,
"Print dump of current object file definitions.");
}

View file

@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License
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"
#include "symtab.h"
#include "gdbtypes.h"
@ -342,6 +341,40 @@ find_pc_psymbol (psymtab, pc)
}
/* Function called via iterate_over_msymbols() that tests a minimal symbol
to see if the minimal symbol's name is a C++ mangled name that matches
a user visible name. The user visible name (pname) is passed as arg1
and the number of leading characters that must match in both the mangled
name and the user name (matchcount) is passed as arg2. Returns a pointer
to the minimal symbol if it matches, NULL otherwise. */
static PTR
cplus_mangled_symbol (objfile, msymbol, arg1, arg2, arg3)
struct objfile *objfile;
struct minimal_symbol *msymbol;
PTR arg1;
PTR arg2;
PTR arg3;
{
char *pname = (char *) arg1;
int matchcount = (int) arg2;
char *demangled;
struct minimal_symbol *foundit = NULL;
if (strncmp (msymbol -> name, pname, matchcount) == 0)
{
if ((demangled = cplus_demangle (msymbol -> name, -1)) != NULL)
{
if (strcmp (demangled, pname) == 0)
{
foundit = msymbol;
}
free (demangled);
}
}
return ((PTR) foundit);
}
/* 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.
@ -483,50 +516,30 @@ lookup_symbol (name, block, namespace, is_a_field_of_this, symtab)
if (namespace == VAR_NAMESPACE)
{
msymbol = lookup_minimal_symbol (name, (struct objfile *) NULL);
/* Look for a mangled C++ name for NAME. */
if (msymbol == NULL)
{
int name_len = strlen (name);
#if 0 /* FIXME: Needs to be fixed to use new minimal symbol tables */
for (ind = misc_function_count; --ind >= 0; )
/* Assume orginal name is prefix of mangled name. */
if (!strncmp (misc_function_vector[ind].name, name, name_len))
{
char *demangled =
cplus_demangle(misc_function_vector[ind].name, -1);
if (demangled != NULL)
{
int cond = strcmp (demangled, name);
free (demangled);
if (!cond)
break;
}
}
/* Loop terminates on no match with ind == -1. */
#endif
/* Look for a mangled C++ name for NAME. */
msymbol = (struct minimal_symbol *)
iterate_over_msymbols (cplus_mangled_symbol, (PTR) name,
(PTR) strlen (name), (PTR) NULL);
}
if (msymbol != NULL)
{
s = find_pc_symtab (msymbol -> address);
/* If S is zero, there are no debug symbols for this file.
/* If S is NULL, there are no debug symbols for this file.
Skip this stuff and check for matching static symbols below. */
if (s)
if (s != NULL)
{
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
sym = lookup_block_symbol (block, msymbol -> name, namespace);
#if 0 /* defined(IBM6000) */
/* we kept static functions in misc_function_vector as well as
/* We kept static functions in minimal symbol table as well as
in static scope. We want to find them in the symbol table. */
if (!sym) {
block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
sym = lookup_block_symbol (block, misc_function_vector[ind].name,
namespace);
sym = lookup_block_symbol (block, msymbol -> name,
namespace);
}
#endif
/* sym == 0 if symbol was found in the minimal symbol table
but not in the symtab.

View file

@ -33,3 +33,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef __GNUC__
# define NORETURN /**/
#endif
/* If you expect to use the mmalloc package to obtain mapped symbol files,
for now you have to specify some parameters that determine how gdb places
the mappings in it's address space. See the comments in map_to_address()
for details. This is expected to only be a short term solution. Yes it
is a kludge.
FIXME: Make this more automatic. */
#define MMAP_BASE_ADDRESS 0xC2000000 /* First mapping here */
#define MMAP_INCREMENT 0x01000000 /* Increment to next mapping */

View file

@ -33,3 +33,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef __GNUC__
# define NORETURN /**/
#endif
/* If you expect to use the mmalloc package to obtain mapped symbol files,
for now you have to specify some parameters that determine how gdb places
the mappings in it's address space. See the comments in map_to_address()
for details. This is expected to only be a short term solution. Yes it
is a kludge.
FIXME: Make this more automatic. */
#define MMAP_BASE_ADDRESS 0x81000000 /* First mapping here */
#define MMAP_INCREMENT 0x01000000 /* Increment to next mapping */

View file

@ -30,3 +30,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* SunOS 4.x has memory mapped files. */
#define HAVE_MMAP
/* If you expect to use the mmalloc package to obtain mapped symbol files,
for now you have to specify some parameters that determine how gdb places
the mappings in it's address space. See the comments in map_to_address()
for details. This is expected to only be a short term solution. Yes it
is a kludge.
FIXME: Make this more automatic. */
#define MMAP_BASE_ADDRESS 0xE0000000 /* First mapping here */
#define MMAP_INCREMENT 0x01000000 /* Increment to next mapping */

View file

@ -30,3 +30,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* SunOS 4.x has memory mapped files. */
#define HAVE_MMAP
/* If you expect to use the mmalloc package to obtain mapped symbol files,
for now you have to specify some parameters that determine how gdb places
the mappings in it's address space. See the comments in map_to_address()
for details. This is expected to only be a short term solution. Yes it
is a kludge.
FIXME: Make this more automatic. */
#define MMAP_BASE_ADDRESS 0xE0000000 /* First mapping here */
#define MMAP_INCREMENT 0x01000000 /* Increment to next mapping */