ref: 61ebd696106ca49e68bfbedbe6c740ed9566aedf
parent: 99dafd2f9338748c5bae866e1697950daf654a89
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Sep 29 17:43:38 EDT 2017
[as] Add dumpstab() This function is very important to debug symbol table problems.
--- a/as/as.h
+++ b/as/as.h
@@ -109,6 +109,7 @@
extern Symbol *tmpsym(TUINT val);
extern void killtmp(void);
extern int toobig(Node *np, int type);
+extern void dumpstab(char *msg);
/* main.c */
extern Symbol *lookup(char *name, int type);
--- a/as/symbol.c
+++ b/as/symbol.c
@@ -43,6 +43,27 @@
Symbol *linesym;
+#ifndef NDEBUG
+void
+dumpstab(char *msg)
+{
+ Symbol **bp, *sym;
+
+ fprintf(stderr, "%s\n", msg);
+ for (bp = hashtbl; bp < &hashtbl[HASHSIZ]; ++bp) {
+ if (*bp == NULL)
+ continue;
+
+ fprintf(stderr, "[%d]", (int) (bp - hashtbl));
+ for (sym = *bp; sym; sym = sym->next) {
+ fprintf(stderr, " -> %s:%0X:%0X",
+ sym->name, sym->flags, sym->argtype);
+ }
+ putc('\n', stderr);
+ }
+}
+#endif
+
Symbol *
lookup(char *name, int type)
{