1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
/* dumps.c - print data about symbols and modules for linker */
/* Copyright (C) 1994 Bruce Evans */
#include "syshead.h"
#include "const.h"
#include "obj.h"
#include "type.h"
#include "globvar.h"
#include <string.h>
/* print list of modules and whether they are loaded */
PUBLIC void dumpmods()
{
struct modstruct *modptr;
char *s, *d;
int i;
for (modptr = modfirst; modptr != NUL_PTR; modptr = modptr->modnext)
{
for(s=d=modptr->filename; *s ; s++)
if( *s == '/' ) d=s+1;
if( memcmp(d, "libc", 4) == 0 && !modptr->loadflag ) continue;
putstr(modptr->modname);
i = strlen(modptr->modname);
while(i<16) putbyte(' '),i++;
putbyte( modptr->loadflag ? '+':'-' );
putstr(d);
if( modptr->archentry )
{
putbyte('(');
putstr(modptr->archentry);
putbyte(')');
}
putbyte('\n');
}
}
/* print data about symbols (in loaded modules only) */
PUBLIC void dumpsyms()
{
flags_t flags;
struct modstruct *modptr;
struct symstruct **symparray;
struct symstruct *symptr;
char uflag;
for (modptr = modfirst; modptr != NUL_PTR; modptr = modptr->modnext)
if (modptr->loadflag)
{
for (symparray = modptr->symparray;
(symptr = *symparray) != NUL_PTR; ++symparray)
if (symptr->modptr == modptr)
{
uflag = FALSE;
if (((flags = symptr->flags) & (C_MASK | I_MASK)) == I_MASK)
uflag = TRUE;
putbstr(20, uflag ? "" : modptr->modname);
putstr(" ");
putbstr(20, symptr->name);
putstr(" ");
putbyte(hexdigit[flags & SEGM_MASK]);
putstr(" ");
if (uflag)
putstr(" ");
else
#ifdef LONG_OFFSETS
put08lx(symptr->value);
#else
put08x(symptr->value);
#endif
if( flags & (E_MASK|C_MASK) )
putstr(flags & A_MASK ? " A" : " R");
else
putstr(flags & A_MASK ? " a" : " r");
if (uflag)
putstr(" U");
if (flags & C_MASK)
putstr(" C");
if (flags & N_MASK)
putstr(" N");
putbyte('\n');
}
}
putstr("Total memory used: ");
#ifdef LONG_OFFSETS
put08lx(memory_used());
#else
put08x(memory_used());
#endif
putbyte('\n');
}
|