diff options
Diffstat (limited to 'outdbg.c')
-rw-r--r-- | outdbg.c | 95 |
1 files changed, 89 insertions, 6 deletions
@@ -27,17 +27,24 @@ struct Section { FILE *dbgf; efunc dbgef; +struct ofmt of_dbg; static void dbg_init(FILE *fp, efunc errfunc, ldfunc ldef, evalfunc eval) { + (void) eval; + dbgf = fp; dbgef = errfunc; dbgsect = NULL; (void) ldef; fprintf(fp,"NASM Output format debug dump\n"); + of_dbg.current_dfmt->init(&of_dbg,0,fp,errfunc); + } -static void dbg_cleanup(void) +static void dbg_cleanup(int debuginfo) { + (void) debuginfo; + of_dbg.current_dfmt->cleanup(); while (dbgsect) { struct Section *tmp = dbgsect; dbgsect = dbgsect->next; @@ -84,7 +91,8 @@ static long dbg_section_names (char *name, int pass, int *bits) } static void dbg_deflabel (char *name, long segment, long offset, - int is_global, char *special) { + int is_global, char *special) +{ fprintf(dbgf,"deflabel %s := %08lx:%08lx %s (%d)%s%s\n", name, segment, offset, is_global == 2 ? "common" : is_global ? "global" : "local", @@ -93,7 +101,8 @@ static void dbg_deflabel (char *name, long segment, long offset, } static void dbg_out (long segto, void *data, unsigned long type, - long segment, long wrt) { + long segment, long wrt) +{ long realbytes = type & OUT_SIZMASK; long ldata; int id; @@ -135,25 +144,99 @@ static void dbg_out (long segto, void *data, unsigned long type, } } -static long dbg_segbase(long segment) { +static long dbg_segbase(long segment) +{ return segment; } -static int dbg_directive (char *directive, char *value, int pass) { +static int dbg_directive (char *directive, char *value, int pass) +{ fprintf(dbgf, "directive [%s] value [%s] (pass %d)\n", directive, value, pass); return 1; } -static void dbg_filename (char *inname, char *outname, efunc error) { +static void dbg_filename (char *inname, char *outname, efunc error) +{ standard_extension (inname, outname, ".dbg", error); } +static int dbg_set_info(enum geninfo type, char **val) +{ + (void) type; + (void) val; + return 0; +} +char *types[] = { + "unknown", "label", "byte","word","dword","float","qword","tbyte" +}; +void dbgdbg_init(struct ofmt * of, void * id, FILE * fp, efunc error) +{ + (void) of; + (void) id; + (void) fp; + (void) error; + fprintf(fp," With debug info\n"); +} +static void dbgdbg_cleanup(void) +{ +} + +static void dbgdbg_linnum (const char *lnfname, long lineno, long segto) +{ + fprintf(dbgf,"dbglinenum %s(%ld) := %08lx\n", + lnfname,lineno,segto); +} +static void dbgdbg_deflabel (char *name, long segment, + long offset, int is_global, char *special) +{ + fprintf(dbgf,"dbglabel %s := %08lx:%08lx %s (%d)%s%s\n", + name, + segment, offset, + is_global == 2 ? "common" : is_global ? "global" : "local", + is_global, + special ? ": " : "", special); +} +static void dbgdbg_define(const char *type, const char *params) +{ + fprintf(dbgf,"dbgdirective [%s] value [%s]\n",type, params); +} +static void dbgdbg_output (int output_type, void *param) +{ + (void) output_type; + (void) param; +} +static void dbgdbg_typevalue(long type) +{ + fprintf(dbgf,"new type: %s(%lX)\n", + types[TYM_TYPE(type) >> 3], TYM_ELEMENTS(type) ); +} +static struct dfmt debug_debug_form = { + "Trace of all info passed to debug stage", + "debug", + dbgdbg_init, + dbgdbg_linnum, + dbgdbg_deflabel, + dbgdbg_define, + dbgdbg_typevalue, + dbgdbg_output, + dbgdbg_cleanup, +}; + +static struct dfmt *debug_debug_arr[3] = { + &debug_debug_form, + &null_debug_form, + NULL +}; struct ofmt of_dbg = { "Trace of all info passed to output stage", "dbg", NULL, + debug_debug_arr, + &null_debug_form, + NULL, dbg_init, + dbg_set_info, dbg_out, dbg_deflabel, dbg_section_names, |