CVS: winex/dlls/dbghelp msc.c,1.4,1.5

[email protected] 30 Aug 2007 14:17:51 -0000
Newsgroups gmane.comp.emulators.winex.cvs
Message-ID <[email protected]>
Subject: winex/dlls/dbghelp msc.c,1.4,1.5Update of /var/lib/cvsd/cvsroot/winex/dlls/dbghelp
In directory agravaine:/tmp/cvs-serv19012/dlls/dbghelp

Modified Files:
	msc.c 
Log Message:

- oops, my last checkin put those compiler warnings back... this time they're fixed and i've merged in the improved PDB file dumper from my windows build.


Index: msc.c
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/dlls/dbghelp/msc.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- msc.c	30 Aug 2007 14:17:16 -0000	1.4
+++ msc.c	30 Aug 2007 14:17:49 -0000	1.5
@@ -2074,47 +2074,65 @@
 
     if (0) /* some tool to dump the internal files from a PDB file */
     {
-        int     i, num_files;
-        FILE *  fp;
-        char    filename[MAX_PATH];
+        const struct PDB_DS_HEADER *pdbds = (const struct PDB_DS_HEADER*)image;
+        const struct PDB_JG_HEADER *pdbjg = (const struct PDB_JG_HEADER*)image;
+        int                         i, num_files;
+        int                         block_size;
+        FILE *                      fp;
+        char                        filename[MAX_PATH];
+        int                         blockTotal = 0;
+        int                         numBlocks;
         
 
         switch (pdb_lookup->kind){
-            case PDB_JG: num_files = pdb_lookup->u.jg.toc->num_files; break;
-            case PDB_DS: num_files = pdb_lookup->u.ds.toc->num_files; break;
+            case PDB_JG:
+                num_files = pdb_lookup->u.jg.toc->num_files;
+                block_size = pdbjg->block_size;
+                numBlocks = pdbjg->total_alloc;
+                break;
+
+            case PDB_DS:
+                num_files = pdb_lookup->u.ds.toc->num_files;
+                block_size = pdbds->block_size;
+                numBlocks = pdbds->num_pages;
+                break;
         }
 
 
         for (i = 0; i < num_files; i++)
         {
-            unsigned char* x = pdb_read_file(image, pdb_lookup, i);
+            unsigned char*  x = pdb_read_file(image, pdb_lookup, i);
+            unsigned int    size = pdb_get_file_size(pdb_lookup, i);
 
 
             /* prevent this from reading NULL memory */
             if (x == NULL){
-                WARN("********************** file %d is empty or missing {size = %ld}\n", i, pdb_get_file_size(pdb_lookup, i));
+                WARN("********************** file %d is empty or missing {size = %u}\n", i, size);
 
                 continue;
             }
 
 
-            snprintf(filename, MAX_PATH, "pdbfile_%02d_%ldbytes.bin", i, pdb_get_file_size(pdb_lookup, i));
+            snprintf(filename, MAX_PATH, "pdbfile_%02d_%u_bytes_%d_blocks.bin", i, size, (size + block_size - 1) / block_size);
             fp = fopen(filename, "wb");
+            blockTotal += (size + block_size - 1) / block_size;
 
             if (fp){
-                FIXME("********************** [file %d]: dumping to '%s' {size = %ld}\n", i, filename, pdb_get_file_size(pdb_lookup, i));
-                fwrite(x, 1, pdb_get_file_size(pdb_lookup, i), fp);
+                FIXME("********************** [file %d]: dumping to '%s' {size = %u}\n", i, filename, size);
+                fwrite(x, 1, size, fp);
                 
                 fclose(fp);
             }
 
             else{
                 FIXME("********************** [file %d]: ERROR-> could not open the file '%s' to dump the data to\n", i, filename);
-                dump(x, pdb_get_file_size(pdb_lookup, i));
+                dump(x, size);
             }
 
             pdb_free(x);
         }
+
+        FIXME("********************** %d/%d blocks are used in the file\n", blockTotal, numBlocks);
     }
     return ret;
 }
@@ -2558,7 +2576,7 @@
 
         for (i = 0; i < nDbg; i++){
             TRACE("debugDirectory[%d]:\n"
-                  "     Characteristics =   0x%08x\n"
+                  "     Characteristics =   0x%08lx\n"
                   "     TimeDateStamp =     %ld\n"
                   "     MajorVersion =      %d\n"
                   "     MinorVersion =      %d\n"