1
0
Fork 0

DBG: more expression functions

This commit is contained in:
mrexodia 2016-07-09 18:23:45 +02:00
parent e0497818c0
commit 4657786726
No known key found for this signature in database
GPG Key ID: D72F9A4FAA0073B4
4 changed files with 30 additions and 6 deletions

View File

@ -1,6 +1,7 @@
#include "expressionfunctions.h" #include "expressionfunctions.h"
#include "threading.h" #include "threading.h"
#include "exprfunc.h" #include "exprfunc.h"
#include "module.h"
std::unordered_map<String, ExpressionFunctions::Function> ExpressionFunctions::mFunctions; std::unordered_map<String, ExpressionFunctions::Function> ExpressionFunctions::mFunctions;
@ -38,7 +39,14 @@ void ExpressionFunctions::Init()
using namespace Exprfunc; using namespace Exprfunc;
//undocumented //undocumented
RegisterEasy("srcline", srcline); RegisterEasy("src.line", srcline);
RegisterEasy("src.disp", srcdisp);
RegisterEasy("mod.party", modparty);
RegisterEasy("mod.base", ModBaseFromAddr);
RegisterEasy("mod.size", ModSizeFromAddr);
RegisterEasy("mod.hash", ModHashFromAddr);
RegisterEasy("mod.entry", ModEntryFromAddr);
} }
bool ExpressionFunctions::Register(const String & name, int argc, CBEXPRESSIONFUNCTION cbFunction) bool ExpressionFunctions::Register(const String & name, int argc, CBEXPRESSIONFUNCTION cbFunction)

View File

@ -1,14 +1,27 @@
#include "exprfunc.h" #include "exprfunc.h"
#include "symbolinfo.h" #include "symbolinfo.h"
#include "module.h"
namespace Exprfunc namespace Exprfunc
{ {
duint srcline(duint addr) duint srcline(duint addr)
{ {
int line = 0; int line = 0;
DWORD displacement = 0; if(!SymGetSourceLine(addr, nullptr, &line, nullptr))
if(!SymGetSourceLine(addr, nullptr, &line, &displacement) || displacement)
return 0; return 0;
return line; return line;
} }
}
duint srcdisp(duint addr)
{
DWORD disp;
if(!SymGetSourceLine(addr, nullptr, nullptr, &disp))
return 0;
return disp;
}
duint modparty(duint addr)
{
return ModGetParty(addr);
}
}

View File

@ -5,4 +5,7 @@
namespace Exprfunc namespace Exprfunc
{ {
duint srcline(duint addr); duint srcline(duint addr);
duint srcdisp(duint addr);
duint modparty(duint addr);
} }

View File

@ -1538,10 +1538,10 @@ void MainWindow::clickFavouriteTool()
void MainWindow::on_actionStepIntoSource_triggered() void MainWindow::on_actionStepIntoSource_triggered()
{ {
DbgCmdExec("TraceIntoConditional srcline(cip)"); DbgCmdExec("TraceIntoConditional src.line(cip) && !src.disp(cip)");
} }
void MainWindow::on_actionStepOverSource_triggered() void MainWindow::on_actionStepOverSource_triggered()
{ {
DbgCmdExec("TraceOverConditional srcline(cip)"); DbgCmdExec("TraceOverConditional src.line(cip) && !src.disp(cip)");
} }