示例#1
0
文件: nm.c 项目: McIkye/tools
char *
otherstring(struct nlist *sym)
{
	static char buf[3];
	char *result;

	result = buf;

	if (N_BIND(sym) == BIND_WEAK)
		*result++ = 'w';
	if (N_AUX(sym) == AUX_OBJECT)
		*result++ = 'o';
	else if (N_AUX(sym) == AUX_FUNC)
		*result++ = 'f';
	*result++ = 0;
	return buf;
}
示例#2
0
文件: sods.c 项目: JabirTech/Source
static void
dump_sym(const struct nlist *np)
{
    char type[8];
    char aux[8];
    char weak;
    char *p;

    switch (np->n_type & ~N_EXT) {
    case N_UNDF:	strcpy(type, "undf");  break;
    case N_ABS:		strcpy(type, "abs");  break;
    case N_TEXT:	strcpy(type, "text");  break;
    case N_DATA:	strcpy(type, "data");  break;
    case N_BSS:		strcpy(type, "bss");  break;
    case N_INDR:	strcpy(type, "indr");  break;
    case N_SIZE:	strcpy(type, "size");  break;
    case N_COMM:	strcpy(type, "comm");  break;
    case N_SETA:	strcpy(type, "seta");  break;
    case N_SETT:	strcpy(type, "sett");  break;
    case N_SETD:	strcpy(type, "setd");  break;
    case N_SETB:	strcpy(type, "setb");  break;
    case N_SETV:	strcpy(type, "setv");  break;
    case N_FN:		strcpy(type, np->n_type&N_EXT ? "fn" : "warn");  break;
    case N_GSYM:	strcpy(type, "gsym");  break;
    case N_FNAME:	strcpy(type, "fname");  break;
    case N_FUN:		strcpy(type, "fun");  break;
    case N_STSYM:	strcpy(type, "stsym");  break;
    case N_LCSYM:	strcpy(type, "lcsym");  break;
    case N_MAIN:	strcpy(type, "main");  break;
    case N_PC:		strcpy(type, "pc");  break;
    case N_RSYM:	strcpy(type, "rsym");  break;
    case N_SLINE:	strcpy(type, "sline");  break;
    case N_DSLINE:	strcpy(type, "dsline");  break;
    case N_BSLINE:	strcpy(type, "bsline");  break;
    case N_SSYM:	strcpy(type, "ssym");  break;
    case N_SO:		strcpy(type, "so");  break;
    case N_LSYM:	strcpy(type, "lsym");  break;
    case N_BINCL:	strcpy(type, "bincl");  break;
    case N_SOL:		strcpy(type, "sol");  break;
    case N_PSYM:	strcpy(type, "psym");  break;
    case N_EINCL:	strcpy(type, "eincl");  break;
    case N_ENTRY:	strcpy(type, "entry");  break;
    case N_LBRAC:	strcpy(type, "lbrac");  break;
    case N_EXCL:	strcpy(type, "excl");  break;
    case N_RBRAC:	strcpy(type, "rbrac");  break;
    case N_BCOMM:	strcpy(type, "bcomm");  break;
    case N_ECOMM:	strcpy(type, "ecomm");  break;
    case N_ECOML:	strcpy(type, "ecoml");  break;
    case N_LENG:	strcpy(type, "leng");  break;
    default:
	snprintf(type, sizeof type, "%#02x", np->n_type);
	break;
    }

    if (np->n_type & N_EXT && type[0] != '0')
	for (p = type;  *p != '\0';  ++p)
	    *p = toupper(*p);

    switch (N_AUX(np)) {
    case 0:		strcpy(aux, "");  break;
    case AUX_OBJECT:	strcpy(aux, "objt");  break;
    case AUX_FUNC:	strcpy(aux, "func");  break;
    default:		snprintf(aux, sizeof aux, "%#01x", N_AUX(np));  break;
    }

    weak = N_BIND(np) == BIND_WEAK ? 'w' : ' ';

    printf("%c%-6s %-4s %8lx", weak, type, aux, np->n_value);
}