From bbef1cbd2d018cfb2caa91df541dbde85dbcfbbc Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Fri, 5 Jan 2007 21:42:45 +0100 Subject: [PATCH] winedump: Removed cvinclude.h. --- dlls/dbghelp/msc.c | 47 +++++----- include/wine/mscvpdb.h | 121 +++++++++++++++++++----- tools/winedump/cvinclude.h | 187 ------------------------------------- tools/winedump/debug.c | 61 ++++++------ 4 files changed, 154 insertions(+), 262 deletions(-) delete mode 100644 tools/winedump/cvinclude.h diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 624220c3c3b..d4d5edf5f48 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -2295,34 +2295,35 @@ BOOL pdb_fetch_file_info(struct pdb_lookup* pdb_lookup) static BOOL codeview_process_info(const struct process* pcs, const struct msc_debug_info* msc_dbg) { - const CODEVIEW_HEADER_NBxx* cv = (const CODEVIEW_HEADER_NBxx*)msc_dbg->root; + const DWORD* signature = (const DWORD*)msc_dbg->root; BOOL ret = FALSE; struct pdb_lookup pdb_lookup; - TRACE("Processing signature %.4s\n", (const char*)&cv->dwSignature); + TRACE("Processing signature %.4s\n", (const char*)signature); - switch (cv->dwSignature) + switch (*signature) { case CODEVIEW_NB09_SIG: case CODEVIEW_NB11_SIG: { - const CV_DIRECTORY_HEADER* hdr = (const CV_DIRECTORY_HEADER*)(msc_dbg->root + cv->lfoDirectory); - const CV_DIRECTORY_ENTRY* ent; - const CV_DIRECTORY_ENTRY* prev; - const CV_DIRECTORY_ENTRY* next; + const OMFSignature* cv = (const OMFSignature*)msc_dbg->root; + const OMFDirHeader* hdr = (const OMFDirHeader*)(msc_dbg->root + cv->filepos); + const OMFDirEntry* ent; + const OMFDirEntry* prev; + const OMFDirEntry* next; unsigned int i; codeview_init_basic_types(msc_dbg->module); for (i = 0; i < hdr->cDir; i++) { - ent = (const CV_DIRECTORY_ENTRY*)((const BYTE*)hdr + hdr->cbDirHeader + i * hdr->cbDirEntry); - if (ent->subsection == sstGlobalTypes) + ent = (const OMFDirEntry*)((const BYTE*)hdr + hdr->cbDirHeader + i * hdr->cbDirEntry); + if (ent->SubSection == sstGlobalTypes) { - const CV_ENTRY_GLOBAL_TYPES* types; + const OMFGlobalTypes* types; struct codeview_type_parse ctp; - types = (const CV_ENTRY_GLOBAL_TYPES*)(msc_dbg->root + ent->lfo); + types = (const OMFGlobalTypes*)(msc_dbg->root + ent->lfo); ctp.module = msc_dbg->module; ctp.offset = (const DWORD*)(types + 1); ctp.num = types->cTypes; @@ -2337,15 +2338,15 @@ static BOOL codeview_process_info(const struct process* pcs, } } - ent = (const CV_DIRECTORY_ENTRY*)((const BYTE*)hdr + hdr->cbDirHeader); + ent = (const OMFDirEntry*)((const BYTE*)hdr + hdr->cbDirHeader); for (i = 0; i < hdr->cDir; i++, ent = next) { next = (i == hdr->cDir-1) ? NULL : - (const CV_DIRECTORY_ENTRY*)((const BYTE*)ent + hdr->cbDirEntry); + (const OMFDirEntry*)((const BYTE*)ent + hdr->cbDirEntry); prev = (i == 0) ? NULL : - (const CV_DIRECTORY_ENTRY*)((const BYTE*)ent - hdr->cbDirEntry); + (const OMFDirEntry*)((const BYTE*)ent - hdr->cbDirEntry); - if (ent->subsection == sstAlignSym) + if (ent->SubSection == sstAlignSym) { /* * Check the next and previous entry. If either is a @@ -2357,13 +2358,13 @@ static BOOL codeview_process_info(const struct process* pcs, struct codeview_linetab* linetab = NULL; if (next && next->iMod == ent->iMod && - next->subsection == sstSrcModule) + next->SubSection == sstSrcModule) linetab = codeview_snarf_linetab(msc_dbg->module, msc_dbg->root + next->lfo, next->cb, TRUE); if (prev && prev->iMod == ent->iMod && - prev->subsection == sstSrcModule) + prev->SubSection == sstSrcModule) linetab = codeview_snarf_linetab(msc_dbg->module, msc_dbg->root + prev->lfo, prev->cb, TRUE); @@ -2387,7 +2388,7 @@ static BOOL codeview_process_info(const struct process* pcs, case CODEVIEW_NB10_SIG: { - const CODEVIEW_PDB_DATA* pdb = (const CODEVIEW_PDB_DATA*)(cv + 1); + const CODEVIEW_PDB_DATA* pdb = (const CODEVIEW_PDB_DATA*)msc_dbg->root; pdb_lookup.filename = pdb->name; pdb_lookup.kind = PDB_JG; pdb_lookup.u.jg.timestamp = pdb->timestamp; @@ -2398,7 +2399,7 @@ static BOOL codeview_process_info(const struct process* pcs, } case CODEVIEW_RSDS_SIG: { - const CODEVIEW_HEADER_RSDS* rsds = (const CODEVIEW_HEADER_RSDS*)msc_dbg->root; + const OMFSignatureRSDS* rsds = (const OMFSignatureRSDS*)msc_dbg->root; TRACE("Got RSDS type of PDB file: guid=%s unk=%08x name=%s\n", wine_dbgstr_guid(&rsds->guid), rsds->unknown, rsds->name); @@ -2411,14 +2412,14 @@ static BOOL codeview_process_info(const struct process* pcs, break; } default: - ERR("Unknown CODEVIEW signature %08X in module %s\n", - cv->dwSignature, msc_dbg->module->module.ModuleName); + ERR("Unknown CODEVIEW signature %.4s in module %s\n", + (const char*)signature, msc_dbg->module->module.ModuleName); break; } if (ret) { - msc_dbg->module->module.CVSig = cv->dwSignature; - memcpy(msc_dbg->module->module.CVData, cv, + msc_dbg->module->module.CVSig = *signature; + memcpy(msc_dbg->module->module.CVData, msc_dbg->root, sizeof(msc_dbg->module->module.CVData)); } return ret; diff --git a/include/wine/mscvpdb.h b/include/wine/mscvpdb.h index 08366d9723d..064b5facb30 100644 --- a/include/wine/mscvpdb.h +++ b/include/wine/mscvpdb.h @@ -1565,65 +1565,70 @@ extern BOOL coff_process_info(const struct msc_debug_info* msc_dbg); #define sstFileIndex 0x133 #define sstStaticSym 0x134 -typedef struct _CODEVIEW_HEADER_NBxx +/* overall structure information */ +typedef struct OMFSignature { - DWORD dwSignature; - DWORD lfoDirectory; -} CODEVIEW_HEADER_NBxx,* PCODEVIEW_HEADER_NBxx; + char Signature[4]; + long filepos; +} OMFSignature; -typedef struct _CODEVIEW_HEADER_RSDS +typedef struct OMFSignatureRSDS { - DWORD dwSignature; + char Signature[4]; GUID guid; DWORD unknown; CHAR name[1]; -} CODEVIEW_HEADER_RSDS,* PCODEVIEW_HEADER_RSDS; +} OMFSignatureRSDS; typedef struct _CODEVIEW_PDB_DATA { + char Signature[4]; + long filepos; DWORD timestamp; DWORD unknown; CHAR name[1]; } CODEVIEW_PDB_DATA, *PCODEVIEW_PDB_DATA; -typedef struct _CV_DIRECTORY_HEADER +typedef struct OMFDirHeader { WORD cbDirHeader; WORD cbDirEntry; DWORD cDir; DWORD lfoNextDir; DWORD flags; -} CV_DIRECTORY_HEADER, *PCV_DIRECTORY_HEADER; +} OMFDirHeader; -typedef struct _CV_DIRECTORY_ENTRY +typedef struct OMFDirEntry { - WORD subsection; + WORD SubSection; WORD iMod; DWORD lfo; DWORD cb; -} CV_DIRECTORY_ENTRY, *PCV_DIRECTORY_ENTRY; +} OMFDirEntry; -typedef struct _CV_ENTRY_MODULE_SEGINFO +/* sstModule subsection */ + +typedef struct OMFSegDesc { - WORD seg; + WORD Seg; WORD pad; - DWORD offset; + DWORD Off; DWORD cbSeg; -} CV_ENTRY_MODULE_SEGINFO; +} OMFSegDesc; -typedef struct _CV_ENTRY_MODULE +typedef struct OMFModule { WORD ovlNumber; WORD iLib; WORD cSeg; - WORD Style; + char Style[2]; /* - CV_ENTRY_MODULE_SEGINFO SegInfo[cSeg]; + OMFSegDesc SegInfo[cSeg]; p_string Name; */ -} CV_ENTRY_MODULE; +} OMFModule; -typedef struct _CV_ENTRY_GLOBAL_TYPES +typedef struct OMFGlobalTypes { DWORD flags; DWORD cTypes; @@ -1631,4 +1636,76 @@ typedef struct _CV_ENTRY_GLOBAL_TYPES DWORD offset[cTypes]; types_record[]; */ -} CV_ENTRY_GLOBAL_TYPES; +} OMFGlobalTypes; + +/* sstGlobalPub section */ + +/* Header for symbol table */ +typedef struct OMFSymHash +{ + unsigned short symhash; + unsigned short addrhash; + unsigned long cbSymbol; + unsigned long cbHSym; + unsigned long cbHAddr; +} OMFSymHash; + +/* FIXME: to be removed (and using codeview_symbol type above) + * Symbol table entry */ +typedef struct DATASYM32 +{ + unsigned short reclen; + unsigned short rectyp; + unsigned long typind; + unsigned long off; + unsigned short seg; +} DATASYM32; +typedef DATASYM32 PUBSYM32; + +/* sstSegMap section */ + +typedef struct OMFSegMapDesc +{ + unsigned short flags; + unsigned short ovl; + unsigned short group; + unsigned short frame; + unsigned short iSegName; + unsigned short iClassName; + unsigned long offset; + unsigned long cbSeg; +} OMFSegMapDesc; + +typedef struct OMFSegMap +{ + unsigned short cSeg; + unsigned short cSegLog; +/* OMFSegMapDesc rgDesc[0];*/ +} OMFSegMap; + + +/* sstSrcModule section */ + +typedef struct OMFSourceLine +{ + unsigned short Seg; + unsigned short cLnOff; + unsigned long offset[1]; + unsigned short lineNbr[1]; +} OMFSourceLine; + +typedef struct OMFSourceFile +{ + unsigned short cSeg; + unsigned short reserved; + unsigned long baseSrcLn[1]; + unsigned short cFName; + char Name; +} OMFSourceFile; + +typedef struct OMFSourceModule +{ + unsigned short cFile; + unsigned short cSeg; + unsigned long baseSrcFile[1]; +} OMFSourceModule; diff --git a/tools/winedump/cvinclude.h b/tools/winedump/cvinclude.h deleted file mode 100644 index 1aaf365eb5f..00000000000 --- a/tools/winedump/cvinclude.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * CodeView 4 Debug format - declarations - * - * (based on cvinfo.h and cvexefmt.h from the Win32 SDK) - * - * Copyright 2000 John R. Sheets for CodeWeavers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#define sstModule 0x120 -#define sstAlignSym 0x125 -#define sstSrcModule 0x127 -#define sstLibraries 0x128 -#define sstGlobalSym 0x129 -#define sstGlobalPub 0x12a -#define sstGlobalTypes 0x12b -#define sstSegMap 0x12d -#define sstFileIndex 0x133 -#define sstStaticSym 0x134 - -#if 0 -/* Old, crusty value */ -#define S_PUB32 0x0203 -#endif - -#define S_PUB32 0x1009 - -#include "pshpack1.h" - -/* - * CodeView headers - */ - -typedef struct OMFSignature -{ - char Signature[4]; - long filepos; -} OMFSignature; - -typedef struct OMFDirHeader -{ - unsigned short cbDirHeader; - unsigned short cbDirEntry; - unsigned long cDir; - long lfoNextDir; - unsigned long flags; -} OMFDirHeader; - -typedef struct OMFDirEntry -{ - unsigned short SubSection; - unsigned short iMod; - long lfo; - unsigned long cb; -} OMFDirEntry; - - -/* - * sstModule subsection - */ - -typedef struct OMFSegDesc -{ - unsigned short Seg; - unsigned short pad; - unsigned long Off; - unsigned long cbSeg; -} OMFSegDesc; - -/* Must chop off the OMFSegDesc* field, because we need to write this - * struct out to a file. If we write the whole struct out, we'll end up - * with (*OMFSegDesc), not (OMFSegDesc). See OMFModuleFull. - */ -typedef struct OMFModule -{ - unsigned short ovlNumber; - unsigned short iLib; - unsigned short cSeg; - char Style[2]; -} OMFModule; - -/* Full version, with memory pointers, too. Use OMFModule for writing out to - * a file, and OMFModuleFull for reading. If offsetof() were available, we - * could use that instead. - */ -typedef struct OMFModuleFull -{ - unsigned short ovlNumber; - unsigned short iLib; - unsigned short cSeg; - char Style[2]; - OMFSegDesc *SegInfo; - char *Name; -} OMFModuleFull; - - -/* - * sstGlobalPub section - */ - -/* Header for symbol table. - */ -typedef struct OMFSymHash -{ - unsigned short symhash; - unsigned short addrhash; - unsigned long cbSymbol; - unsigned long cbHSym; - unsigned long cbHAddr; -} OMFSymHash; - -/* Symbol table entry. - */ -typedef struct DATASYM32 -{ - unsigned short reclen; - unsigned short rectyp; - unsigned long typind; - unsigned long off; - unsigned short seg; -} DATASYM32; -typedef DATASYM32 PUBSYM32; - -/* - * sstSegMap section - */ - -typedef struct OMFSegMapDesc -{ - unsigned short flags; - unsigned short ovl; - unsigned short group; - unsigned short frame; - unsigned short iSegName; - unsigned short iClassName; - unsigned long offset; - unsigned long cbSeg; -} OMFSegMapDesc; - -typedef struct OMFSegMap -{ - unsigned short cSeg; - unsigned short cSegLog; -/* OMFSegMapDesc rgDesc[0];*/ -} OMFSegMap; - - -/* - * sstSrcModule section - */ - -typedef struct OMFSourceLine -{ - unsigned short Seg; - unsigned short cLnOff; - unsigned long offset[1]; - unsigned short lineNbr[1]; -} OMFSourceLine; - -typedef struct OMFSourceFile -{ - unsigned short cSeg; - unsigned short reserved; - unsigned long baseSrcLn[1]; - unsigned short cFName; - char Name; -} OMFSourceFile; - -typedef struct OMFSourceModule -{ - unsigned short cFile; - unsigned short cSeg; - unsigned long baseSrcFile[1]; -} OMFSourceModule; diff --git a/tools/winedump/debug.c b/tools/winedump/debug.c index d141e9f6fec..37e0b653c28 100644 --- a/tools/winedump/debug.c +++ b/tools/winedump/debug.c @@ -44,7 +44,6 @@ #include "windef.h" #include "winbase.h" #include "winedump.h" -#include "cvinclude.h" #include "wine/mscvpdb.h" /* @@ -99,8 +98,8 @@ * (OMFDirHeader.cDir) */ -extern const IMAGE_NT_HEADERS* PE_nt_headers; -static const void* cv_base /* = 0 */; +extern const IMAGE_NT_HEADERS* PE_nt_headers; +static const void* cv_base /* = 0 */; static int dump_cv_sst_module(const OMFDirEntry* omfde) { @@ -124,7 +123,7 @@ static int dump_cv_sst_module(const OMFDirEntry* omfde) for (i = 0; i < module->cSeg; i++) { - printf (" segment #%2d: offset = [0x%8lx], size = [0x%8lx]\n", + printf (" segment #%2d: offset = [0x%8x], size = [0x%8x]\n", segDesc->Seg, segDesc->Off, segDesc->cbSeg); segDesc++; } @@ -376,8 +375,8 @@ static void dump_codeview_all_modules(const OMFDirHeader *omfdh) printf("Module #%2d (%p)\n", i + 1, &dirEntry[i]); printf(" SubSection: %04X (%s)\n", dirEntry[i].SubSection, str); printf(" iMod: %d\n", dirEntry[i].iMod); - printf(" lfo: %ld\n", dirEntry[i].lfo); - printf(" cb: %lu\n", dirEntry[i].cb); + printf(" lfo: %d\n", dirEntry[i].lfo); + printf(" cb: %u\n", dirEntry[i].cb); switch (dirEntry[i].SubSection) { @@ -402,8 +401,9 @@ static void dump_codeview_all_modules(const OMFDirHeader *omfdh) static void dump_codeview_headers(unsigned long base, unsigned long len) { const OMFDirHeader* dirHeader; - const OMFSignature* signature; + const char* signature; const OMFDirEntry* dirEntry; + const OMFSignature* sig; unsigned i; int modulecount = 0, alignsymcount = 0, srcmodulecount = 0, librariescount = 0; int globalsymcount = 0, globalpubcount = 0, globaltypescount = 0; @@ -415,50 +415,51 @@ static void dump_codeview_headers(unsigned long base, unsigned long len) signature = cv_base; printf(" CodeView Data\n"); + printf(" Signature: %.4s\n", signature); - printf(" Signature: %.4s\n", signature->Signature); - printf(" Filepos: 0x%08lX\n", signature->filepos); - - if (memcmp(signature->Signature, "NB10", 4) == 0) + if (memcmp(signature, "NB10", 4) == 0) { const CODEVIEW_PDB_DATA* pdb_data; - pdb_data = (const void *)(signature + 1); + pdb_data = (const void *)cv_base; - printf(" TimeStamp: %08X (%s)\n", + printf(" Filepos: 0x%08lX\n", pdb_data->filepos); + printf(" TimeStamp: %08X (%s)\n", pdb_data->timestamp, get_time_str(pdb_data->timestamp)); - printf(" Dunno: %08X\n", pdb_data->unknown); - printf(" Filename: %s\n", pdb_data->name); + printf(" Dunno: %08X\n", pdb_data->unknown); + printf(" Filename: %s\n", pdb_data->name); return; } - if (memcmp(signature->Signature, "RSDS", 4) == 0) + if (memcmp(signature, "RSDS", 4) == 0) { - const CODEVIEW_HEADER_RSDS* rsds_data; - char guid_str[40]; + const OMFSignatureRSDS* rsds_data; + char guid_str[40]; - rsds_data = (const void *)signature; - printf(" Signature: %08X\n", - rsds_data->dwSignature); - printf(" Guid: %s\n", + rsds_data = (const void *)cv_base; + printf(" Guid: %s\n", guid_to_string(&rsds_data->guid, guid_str, sizeof(guid_str))); - printf(" Dunno: %08X\n", rsds_data->unknown); - printf(" Filename: %s\n", rsds_data->name); + printf(" Dunno: %08X\n", rsds_data->unknown); + printf(" Filename: %s\n", rsds_data->name); return; } - if (memcmp(signature->Signature, "NB09", 4) != 0 && memcmp(signature->Signature, "NB11", 4) != 0) + if (memcmp(signature, "NB09", 4) != 0 && memcmp(signature, "NB11", 4) != 0) { - printf("Unsupported signature (%.4s), aborting\n", signature->Signature); + printf("Unsupported signature (%.4s), aborting\n", signature); return; } - dirHeader = PRD(Offset(cv_base) + signature->filepos, sizeof(OMFDirHeader)); + sig = cv_base; + + printf(" Filepos: 0x%08lX\n", sig->filepos); + + dirHeader = PRD(Offset(cv_base) + sig->filepos, sizeof(OMFDirHeader)); if (!dirHeader) {printf("Can't get debug header, aborting\n"); return;} printf(" Size of header: 0x%4X\n", dirHeader->cbDirHeader); printf(" Size per entry: 0x%4X\n", dirHeader->cbDirEntry); - printf(" # of entries: 0x%8lX (%ld)\n", dirHeader->cDir, dirHeader->cDir); - printf(" Offset to NextDir: 0x%8lX\n", dirHeader->lfoNextDir); - printf(" Flags: 0x%8lX\n", dirHeader->flags); + printf(" # of entries: 0x%8X (%d)\n", dirHeader->cDir, dirHeader->cDir); + printf(" Offset to NextDir: 0x%8X\n", dirHeader->lfoNextDir); + printf(" Flags: 0x%8X\n", dirHeader->flags); if (!dirHeader->cDir) return;