comparison lwasm/symbol.c @ 433:b1adf549d181

Add some debugging instrumentation for tracking an expression bug There's no reason not to keep the instrumentation so into the repo it goes.
author William Astle <lost@l-w.ca>
date Mon, 23 Jan 2017 22:54:19 -0700
parents 8764142b3192
children
comparison
equal deleted inserted replaced
432:58cafa61ab40 433:b1adf549d181
250 struct symtabe * lookup_symbol(asmstate_t *as, line_t *cl, char *sym) 250 struct symtabe * lookup_symbol(asmstate_t *as, line_t *cl, char *sym)
251 { 251 {
252 int local = 0; 252 int local = 0;
253 struct symtabe *s; 253 struct symtabe *s;
254 int cdir; 254 int cdir;
255
256 debug_message(as, 100, "Look up symbol %s", sym);
255 257
256 // check if this is a local symbol 258 // check if this is a local symbol
257 if (strchr(sym, '@') || strchr(sym, '?')) 259 if (strchr(sym, '@') || strchr(sym, '?'))
258 local = 1; 260 local = 1;
259 261
281 cdir = (cl -> context < s -> context) ? -1 : 1; 283 cdir = (cl -> context < s -> context) ? -1 : 1;
282 } 284 }
283 } 285 }
284 286
285 if (!cdir) 287 if (!cdir)
288 {
289 debug_message(as, 100, "Found symbol %s: %s, %s", sym, s -> symbol, lw_expr_print(s -> value));
286 return s; 290 return s;
291 }
287 292
288 if (cdir < 0) 293 if (cdir < 0)
289 s = s -> left; 294 s = s -> left;
290 else 295 else
291 s = s -> right; 296 s = s -> right;
292 } 297 }
298 debug_message(as, 100, "Symbol not found %s", sym);
293 return NULL; 299 return NULL;
294 } 300 }
295 301
296 struct listinfo 302 struct listinfo
297 { 303 {