add retdec namespace to pdbparser.

This commit is contained in:
Peter Matula 2018-01-09 12:02:56 +01:00
parent e0d2426ee5
commit e99e26d3a7
13 changed files with 38 additions and 21 deletions

View File

@ -47,7 +47,7 @@ class DebugFormat
void loadPdbTypes();
void loadPdbGlobalVariables();
void loadPdbFunctions();
retdec::config::Type loadPdbType(pdbparser::PDBTypeDef* type);
retdec::config::Type loadPdbType(retdec::pdbparser::PDBTypeDef* type);
void loadDwarf();
void loadDwarfTypes();
@ -65,7 +65,7 @@ class DebugFormat
/// Underlying binary file representation.
retdec::loader::Image* _inFile = nullptr;
/// Underlying PDB representation.
pdbparser::PDBFile* _pdbFile = nullptr;
retdec::pdbparser::PDBFile* _pdbFile = nullptr;
/// Underlying DWARF representation.
retdec::dwarfparser::DwarfFile* _dwarfFile = nullptr;
/// Demangler.

View File

@ -12,6 +12,7 @@
#include "retdec/pdbparser/pdb_types.h"
#include "retdec/pdbparser/pdb_utils.h"
namespace retdec {
namespace pdbparser {
// =================================================================
@ -233,6 +234,7 @@ class PDBFile
};
} // namespace pdbparser
} // namespace pdbparser
} // namespace retdec
#endif

View File

@ -9,6 +9,7 @@
#include "retdec/pdbparser/pdb_utils.h"
namespace retdec {
namespace pdbparser {
// pdb_info.h
@ -3804,5 +3805,6 @@ typedef struct _LineInfoHeader
// =================================================================
} // namespace pdbparser
} // namespace retdec
#endif

View File

@ -11,6 +11,7 @@
#include "retdec/pdbparser/pdb_types.h"
#include "retdec/pdbparser/pdb_utils.h"
namespace retdec {
namespace pdbparser {
class PDBSymbols;
@ -203,5 +204,6 @@ class PDBSymbols
};
} // namespace pdbparser
} // namespace retdec
#endif

View File

@ -12,6 +12,7 @@
#include "retdec/pdbparser/pdb_info.h"
#include "retdec/pdbparser/pdb_utils.h"
namespace retdec {
namespace pdbparser {
// PDB type definition
@ -634,6 +635,7 @@ class PDBTypes
PDBTypeDefNameMap types_byname; // Map of fully defined types (key is type name)
};
} // namespace pdbparser
} // namespace pdbparser
} // namespace retdec
#endif

View File

@ -11,6 +11,7 @@
#include <string>
#include <vector>
namespace retdec {
namespace pdbparser {
// =================================================================
@ -147,6 +148,7 @@ PDB_PBYTE RecordValue(PDB_PBYTE pbData, PDB_PDWORD pdValue); // Get numeric val
void print_dwords(PDB_DWORD *data, int len); // Print list of dwords (hexadecomally)
void print_bytes(PDB_BYTE *data, int len); // Print list of bytes (hexadecomally)
} // namespace pdbparser
} // namespace pdbparser
} // namespace retdec
#endif

View File

@ -38,11 +38,11 @@ DebugFormat::DebugFormat(
_inFile(inFile),
_demangler(demangler)
{
_pdbFile = new pdbparser::PDBFile();
_pdbFile = new retdec::pdbparser::PDBFile();
auto s = _pdbFile->load_pdb_file(pdbFile.c_str());
_dwarfFile = new retdec::dwarfparser::DwarfFile(_inFile->getFileFormat()->getPathToFile(), _inFile->getFileFormat());
if (s == pdbparser::PDB_STATE_OK)
if (s == retdec::pdbparser::PDB_STATE_OK)
{
LOG << "\n*** DebugFormat::DebugFormat(): PDB" << std::endl;
_pdbFile->initialize(imageBase);

View File

@ -78,7 +78,7 @@ void DebugFormat::loadPdbFunctions()
if (f.second == nullptr)
continue;
pdbparser::PDBFunction *pfnc = f.second;
retdec::pdbparser::PDBFunction *pfnc = f.second;
retdec::config::Function fnc(pfnc->getNameWithOverloadIndex());
@ -106,13 +106,13 @@ void DebugFormat::loadPdbFunctions()
for (auto& a : pfnc->arguments)
{
retdec::config::Storage storage;
if (a.location == pdbparser::PDBLVLOC_REGISTER) // in register
if (a.location == retdec::pdbparser::PDBLVLOC_REGISTER) // in register
{
storage = retdec::config::Storage::inRegister(a.register_num);
}
else // in register-relative stack
{
auto num = a.location == pdbparser::PDBLVLOC_BPREL32 ? 22 /*CV_REG_EBP*/ : a.register_num;
auto num = a.location == retdec::pdbparser::PDBLVLOC_BPREL32 ? 22 /*CV_REG_EBP*/ : a.register_num;
storage = retdec::config::Storage::onStack(a.offset, num);
}
@ -133,13 +133,13 @@ void DebugFormat::loadPdbFunctions()
}
retdec::config::Storage storage;
if (lv.location == pdbparser::PDBLVLOC_REGISTER) // in register
if (lv.location == retdec::pdbparser::PDBLVLOC_REGISTER) // in register
{
storage = retdec::config::Storage::inRegister(lv.register_num);
}
else // in register-relative stack
{
auto num = lv.location == pdbparser::PDBLVLOC_BPREL32 ? 22 /*CV_REG_EBP*/ : lv.register_num;
auto num = lv.location == retdec::pdbparser::PDBLVLOC_BPREL32 ? 22 /*CV_REG_EBP*/ : lv.register_num;
storage = retdec::config::Storage::onStack(lv.offset, num);
}
@ -158,7 +158,7 @@ void DebugFormat::loadPdbFunctions()
* @param type PDB type.
* @return Common type representation.
*/
retdec::config::Type DebugFormat::loadPdbType(pdbparser::PDBTypeDef* type)
retdec::config::Type DebugFormat::loadPdbType(retdec::pdbparser::PDBTypeDef* type)
{
if (type == nullptr)
{

View File

@ -1,11 +1,11 @@
/**
* @file src/pdbparser/doxygen.h
* @brief Doxygen documentation of the pdbparser namespace.
* @brief Doxygen documentation of the retdec::pdbparser namespace.
* @copyright AVG Technologies s.r.o, All Rights Reserved
*/
// As there is no better place to comment this namespace, we do this in the
// present file.
/// @namespace pdbparser A library for parsing a processing files with PDB
/// debugging information.
/// @namespace retdec::pdbparser A library for parsing a processing files with
/// PDB debugging information.

View File

@ -12,8 +12,8 @@
using namespace std;
namespace pdbparser
{
namespace retdec {
namespace pdbparser {
// =================================================================
// PUBLIC METHODS
@ -528,3 +528,4 @@ void PDBFile::parse_sections(int image_base)
}
} // namespace pdbparser
} // namespace retdec

View File

@ -13,6 +13,7 @@
using namespace std;
namespace retdec {
namespace pdbparser {
// =================================================================
@ -847,4 +848,5 @@ void PDBSymbols::dump_symbol(PSYM Sym)
puts("");
}
} // namespace pdbparser
} // namespace pdbparser
} // namespace retdec

View File

@ -16,6 +16,7 @@
using namespace std;
namespace retdec {
namespace pdbparser {
// =================================================================
@ -1287,4 +1288,5 @@ PDBTypes::~PDBTypes(void)
}
}
} // namespace pdbparser
} // namespace pdbparser
} // namespace retdec

View File

@ -10,6 +10,7 @@
#include "retdec/pdbparser/pdb_info.h"
#include "retdec/pdbparser/pdb_utils.h"
namespace retdec {
namespace pdbparser {
PDB_PBYTE RecordValue(PDB_PBYTE pbData, PDB_PDWORD pdValue)
@ -91,4 +92,5 @@ void print_bytes(PDB_BYTE *data, int len)
}
}
} // namespace pdbparser
} // namespace pdbparser
} // namespace retdec