Mercurial > hg-old > index.cgi
comparison lwasm/pass1.c @ 372:90de73ba0cac
Created a useful debug framework and adjusted lw_expr_print() to return a "static" dynamic string
author | lost@starbug |
---|---|
date | Thu, 22 Apr 2010 18:19:06 -0600 |
parents | 6b33faa21a0a |
children | d99322ef6f21 |
comparison
equal
deleted
inserted
replaced
371:9c24d9d485b9 | 372:90de73ba0cac |
---|---|
74 as -> context = strtol(p1, NULL, 10); | 74 as -> context = strtol(p1, NULL, 10); |
75 } | 75 } |
76 lw_free(line); | 76 lw_free(line); |
77 continue; | 77 continue; |
78 } | 78 } |
79 printf("%s\n", line); | 79 debug_message(as, 75, "Read line: %s", line); |
80 | 80 |
81 cl = lw_alloc(sizeof(line_t)); | 81 cl = lw_alloc(sizeof(line_t)); |
82 memset(cl, 0, sizeof(line_t)); | 82 memset(cl, 0, sizeof(line_t)); |
83 cl -> prev = as -> line_tail; | 83 cl -> prev = as -> line_tail; |
84 cl -> insn = -1; | 84 cl -> insn = -1; |
250 | 250 |
251 if (!as -> skipcond && !as -> inmacro) | 251 if (!as -> skipcond && !as -> inmacro) |
252 { | 252 { |
253 if (cl -> sym && cl -> symset == 0) | 253 if (cl -> sym && cl -> symset == 0) |
254 { | 254 { |
255 printf("Register symbol %s:", cl -> sym); | 255 debug_message(as, 50, "Register symbol %s: %s", cl -> sym, lw_expr_print(cl -> addr)); |
256 lw_expr_print(cl -> addr, stderr); | |
257 printf("\n"); | |
258 | 256 |
259 // register symbol at line address | 257 // register symbol at line address |
260 if (!register_symbol(as, cl, cl -> sym, cl -> addr, symbol_flag_none)) | 258 if (!register_symbol(as, cl, cl -> sym, cl -> addr, symbol_flag_none)) |
261 { | 259 { |
262 // symbol error | 260 // symbol error |
263 // lwasm_register_error(as, cl, "Bad symbol '%s'", cl -> sym); | 261 // lwasm_register_error(as, cl, "Bad symbol '%s'", cl -> sym); |
264 } | 262 } |
265 } | 263 } |
266 | 264 debug_message(as, 40, "Line address: %s", lw_expr_print(cl -> addr)); |
267 lw_expr_print(cl -> addr, stderr); | |
268 printf("\n"); | |
269 } | 265 } |
270 | 266 |
271 nextline: | 267 nextline: |
272 lw_free(line); | 268 lw_free(line); |
273 | 269 |