mirror of
https://github.com/NohamR/Reclass.git
synced 2026-05-10 19:59:21 +00:00
feat: extract typeIndex from PDB symbols and add symbols.importType MCP tool
extractPdbSymbols() was reading S_GDATA32/S_GTHREAD32 records which contain a typeIndex field linking the symbol to its type definition in the TPI stream, but this field was discarded — only name + RVA were kept. This meant loading symbols gave you address resolution but no way to automatically import the type associated with a global variable. Changes: - PdbSymbol now carries typeIndex (0 = no type info / public symbol) - extractPdbSymbols() captures typeIndex from all global data symbols - PdbSymbolSet stores nameToTypeIndex mapping alongside nameToRva - New importTypeForSymbol() follows LF_POINTER/LF_MODIFIER chains to find the underlying UDT/enum and imports it with full recursive children - New symbols.importType MCP tool: given "ntdll!g_pShimEngineModule", resolves its typeIndex, imports the type definition from the PDB, and merges it into the active project - loadPdbIntoStore() helper consolidates the extract+store pattern with type index support
This commit is contained in:
@@ -14,6 +14,7 @@ struct PdbSymbolSet {
|
||||
QString pdbPath;
|
||||
QString moduleName; // canonical lowercase name (e.g. "ntoskrnl")
|
||||
QHash<QString, uint32_t> nameToRva;
|
||||
QHash<QString, uint32_t> nameToTypeIndex; // symbol name → TPI typeIndex (0 = no type info)
|
||||
QVector<QPair<uint32_t, QString>> rvaToName; // sorted by RVA for binary search
|
||||
|
||||
void sortRvaIndex() {
|
||||
@@ -35,6 +36,15 @@ public:
|
||||
int addModule(const QString& moduleName, const QString& pdbPath,
|
||||
const QVector<QPair<QString, uint32_t>>& symbols);
|
||||
|
||||
// Store symbol→typeIndex mapping for a previously-added module.
|
||||
// Called after addModule with the typeIndex data from PdbSymbol records.
|
||||
void addModuleTypeIndices(const QString& moduleName,
|
||||
const QHash<QString, uint32_t>& nameToTypeIndex);
|
||||
|
||||
// Look up the TPI typeIndex for a qualified symbol (e.g. "ntdll!g_pShimEngineModule").
|
||||
// Returns 0 if not found or no type info available.
|
||||
uint32_t typeIndexForSymbol(const QString& qualifiedSymbol) const;
|
||||
|
||||
// Unload symbols for a module.
|
||||
void unloadModule(const QString& moduleName);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user