mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-29 11:53:23 +08:00
[0.2.x] fixed : get symbol name for decorated names
git-svn-id: https://pykd.svn.codeplex.com/svn@80273 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
f0fc6f3f86
commit
d11fd6a958
@ -473,22 +473,7 @@ std::string DiaSymbol::getName()
|
||||
if ( FAILED( hres ) )
|
||||
throw DiaException("Call IDiaSymbol::get_symTag", hres);
|
||||
|
||||
if ( symTag == SymTagPublicSymbol )
|
||||
{
|
||||
std::string retStr = autoBstr( callSymbol(get_name) ).asStr();
|
||||
|
||||
boost::cmatch matchResult;
|
||||
|
||||
if ( boost::regex_match( retStr.c_str(), matchResult, stdcallMatch ) )
|
||||
return std::string( matchResult[1].first, matchResult[1].second );
|
||||
|
||||
if ( boost::regex_match( retStr.c_str(), matchResult, fastcallMatch ) )
|
||||
return std::string( matchResult[1].first, matchResult[1].second );
|
||||
|
||||
return retStr;
|
||||
}
|
||||
|
||||
if( symTag == SymTagData || symTag == SymTagFunction )
|
||||
if( symTag == SymTagData || symTag == SymTagFunction || symTag == SymTagPublicSymbol )
|
||||
{
|
||||
hres = m_symbol->get_undecoratedNameEx( UNDNAME_NAME_ONLY, &bstrName);
|
||||
if ( FAILED( hres ) )
|
||||
|
@ -62,6 +62,8 @@ BOOST_PYTHON_FUNCTION_OVERLOADS( setHardwareBp_, setHardwareBp, 3, 4 );
|
||||
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( CustomStruct_create, CustomStruct::create, 1, 2 );
|
||||
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( findSymbol_, TypeInfo::findSymbol, 1, 2 );
|
||||
|
||||
BOOST_PYTHON_MODULE( pykd )
|
||||
{
|
||||
python::scope().attr("version") = pykdVersion;
|
||||
@ -202,8 +204,8 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
"Return source file name, line and displacement by the specified offset" ) );
|
||||
python::def( "getOffset", &TypeInfo::getOffset,
|
||||
"Return traget virtual address for specified symbol" );
|
||||
python::def( "findSymbol", &TypeInfo::findSymbol,
|
||||
"Find symbol by the target virtual memory offset" );
|
||||
python::def( "findSymbol", &TypeInfo::findSymbol, findSymbol_( python::args( "offset", "safe"),
|
||||
"Find symbol by the target virtual memory offset" ) );
|
||||
python::def( "sizeof", &TypeInfo::getSymbolSize,
|
||||
"Return a size of the type or variable" );
|
||||
python::def("typedVarList", &getTypedVarListByTypeName,
|
||||
|
@ -74,13 +74,30 @@ ULONG64 TypeInfo::getSymbolSize( const std::string &fullName )
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::string TypeInfo::findSymbol( ULONG64 offset )
|
||||
std::string TypeInfo::findSymbol( ULONG64 offset, bool safe)
|
||||
{
|
||||
if ( !safe )
|
||||
{
|
||||
ModulePtr module = Module::loadModuleByOffset( offset );
|
||||
|
||||
return module->getName() + '!' + module->getSymbolNameByVa( offset );
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
ModulePtr module = Module::loadModuleByOffset( offset );
|
||||
|
||||
return module->getName() + '!' + module->getSymbolNameByVa( offset );
|
||||
try {
|
||||
|
||||
return module->getName() + '!' + module->getSymbolNameByVa( offset );
|
||||
|
||||
}
|
||||
catch( DbgException& )
|
||||
{
|
||||
std::stringstream sstr;
|
||||
sstr << module->getName() << '!' << std::hex << ( offset - module->getBase() );
|
||||
return sstr.str();
|
||||
}
|
||||
|
||||
}
|
||||
catch( DbgException& )
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
ULONG64 getSymbolSize( const std::string &symName );
|
||||
|
||||
static
|
||||
std::string findSymbol( ULONG64 offset );
|
||||
std::string findSymbol( ULONG64 offset, bool safe = true );
|
||||
|
||||
static
|
||||
ULONG64 getOffset( const std::string &symbolName );
|
||||
|
Loading…
Reference in New Issue
Block a user