]> granicus.if.org Git - yasm/commitdiff
Fix a couple bugs in CV8 that generate bad debug info.
authorPeter Johnson <peter@tortall.net>
Wed, 29 Mar 2006 07:24:51 +0000 (07:24 -0000)
committerPeter Johnson <peter@tortall.net>
Wed, 29 Mar 2006 07:24:51 +0000 (07:24 -0000)
* cv-symline.c (cv_sym_bc_tobytes): Output sym relocation at correct offset relative to bc start.
(cv8_add_sym_compile): Compile flag "symbol" has list of key/values terminated with 0/0; we
weren't doing this.  Like MASM, just output an empty list.
(cv_generate_sym): Default data type to UBYTE rather than nothing.

* cv8.txt: Document compile flag key/value list.

Thanks to: Brian Gladman for his test setup.

svn path=/trunk/yasm/; revision=1439

modules/dbgfmts/codeview/cv-symline.c
modules/dbgfmts/codeview/cv8.txt

index f077192fb69ed87752f7014b3656e2e0bcb7b8c9..3257046c25cc0934726ffd4b720932e019089cc9 100644 (file)
@@ -272,7 +272,7 @@ cv8_add_sym_compile(yasm_dbgfmt_cv *dbgfmt_cv, yasm_section *sect,
     cv_sym *cvs = yasm_xmalloc(sizeof(cv_sym));
     cvs->dbgfmt_cv = dbgfmt_cv;
     cvs->type = CV8_S_COMPILE;
-    cvs->format = "wwwwZ";
+    cvs->format = "wwwwZh";
     cvs->args[0].i = 3;                /* language (3=Masm) */
 
     /* target processor; 0xD0 = AMD64 */
@@ -287,6 +287,7 @@ cv8_add_sym_compile(yasm_dbgfmt_cv *dbgfmt_cv, yasm_section *sect,
     cvs->args[2].i = 0;                /* flags (assume 0 for now) */
     cvs->args[3].i = 0;                /* creator version number (assume 0 for now) */
     cvs->args[4].p = creator;  /* creator string */
+    cvs->args[5].i = 0;                /* no pairs of key/value */
 
     bc = yasm_bc_create_common(&cv_sym_bc_callback, cvs, 0);
     bc->len = cv_sym_size(cvs);
@@ -431,7 +432,6 @@ cv_generate_line_bc(yasm_bytecode *bc, /*@null@*/ void *d)
     unsigned long line;
     /*@null@*/ yasm_bytecode *nextbc = yasm_bc__next(bc);
     yasm_section *sect = yasm_bc_get_section(bc);
-    cv8_lineset *ls;
 
     if (nextbc && bc->offset == nextbc->offset)
        return 0;
@@ -509,9 +509,6 @@ cv_generate_line_section(yasm_section *sect, /*@null@*/ void *d)
 {
     cv_line_info *info = (cv_line_info *)d;
     yasm_dbgfmt_cv *dbgfmt_cv = info->dbgfmt_cv;
-    /*@null@*/ yasm_bytecode *bc;
-    /*cv_line_state state;*/
-    unsigned long addr_delta;
 
     if (!yasm_section_is_code(sect))
        return 0;       /* not code, so no line data for this section */
@@ -537,19 +534,17 @@ cv_generate_sym(yasm_symrec *sym, void *d)
 {
     cv_line_info *info = (cv_line_info *)d;
     yasm_bytecode *precbc;
-    unsigned long type;
 
     /* only care about labels (for now) */
     if (!yasm_symrec_get_label(sym, &precbc))
        return 0;
 
-    /* TODO: add data types */
+    /* TODO: add data types; until then, just mark everything as UBYTE */
     if (yasm_section_is_code(yasm_bc_get_section(precbc)))
        cv8_add_sym_label(info->dbgfmt_cv, info->debug_symline, sym);
     else
-       cv8_add_sym_data(info->dbgfmt_cv, info->debug_symline, 0, sym,
+       cv8_add_sym_data(info->dbgfmt_cv, info->debug_symline, 0x20, sym,
            yasm_symrec_get_visibility(sym) & YASM_SYM_GLOBAL?1:0);
-
     return 0;
 }
 
@@ -806,7 +801,7 @@ cv8_fileinfo_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d,
     cv8_fileinfo *fi = (cv8_fileinfo *)bc->contents;
     yasm_dbgfmt_cv *dbgfmt_cv = fi->dbgfmt_cv;
     unsigned char *buf = *bufp;
-    yasm_intnum *intn, *cval;
+    yasm_intnum *cval;
     int i;
 
     /* Offset in filename string table */
@@ -1034,7 +1029,6 @@ cv_sym_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d,
     size_t len;
     int arg = 0;
 
-
     /* Total length of record (following this field) - 2 bytes */
     cval = yasm_intnum_create_uint(bc->len-2);
     yasm_arch_intnum_tobytes(dbgfmt_cv->arch, cval, buf, 2, 16, 0, bc, 1, 0);
@@ -1064,8 +1058,8 @@ cv_sym_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d,
                buf += 4;
                break;
            case 'Y':
-               cv_out_sym((yasm_symrec *)cvs->args[arg++].p, 4, bc, &buf, d,
-                          output_value);
+               cv_out_sym((yasm_symrec *)cvs->args[arg++].p, buf-(*bufp), bc,
+                          &buf, d, output_value);
                break;
            case 'T':
                yasm_intnum_set_uint(cval, cvs->args[arg++].i);
index 572b355c500f6ac79e488b956aada945412ccb9a..04f152b230524f132e03d9f6253be34ffcc9a878 100644 (file)
@@ -51,7 +51,15 @@ the end (not included in length).
     4 bytes - version
     2 bytes - ?
     0-terminated string containing creator name
-    2 alignment bytes? (0)
+    pairs of 0-terminated strings - keys/values
+    from CL:
+       cwd - current working directory
+       cl - full path of compiler executable
+       cmd - full args (one long string, double-quoted args if needed)
+       src - relative path to source (from cwd)
+       pdb - full path to pdb file
+    ML doesn't output any pairs
+    pairs list terminated with two empty strings
 0x1105 : Code Label 16:32/64
     4 bytes SECREL of symbol
     2 bytes SECTION of symbol