summaryrefslogtreecommitdiff
path: root/ld/dumps.c
blob: c9a40d40644e5881dae376609276667c3520f5b9 (plain)
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
/* dumps.c - print data about symbols and modules for linker */

/* Copyright (C) 1994 Bruce Evans */

#include "const.h"
#include "obj.h"
#include "type.h"
#include "globvar.h"

/* print list of modules and whether they are loaded */

PUBLIC void dumpmods()
{
    struct modstruct *modptr;

    for (modptr = modfirst; modptr != NUL_PTR; modptr = modptr->modnext)
    {
	putstr(modptr->loadflag ? "L " : "  ");
	putbstr(20, modptr->modname);
	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
		    putstr(flags & A_MASK ? "  A" : "  R");
		    if (uflag)
			putstr(" U");
		    if (flags & C_MASK)
			putstr(" C");
		    if (flags & N_MASK)
			putstr(" N");
		    putbyte('\n');
		}
	}
}