DBG: function to get address from source line
This commit is contained in:
parent
98b6ba41a0
commit
d50d385e01
|
@ -169,6 +169,17 @@ static void _memupdatemap()
|
|||
MemUpdateMap(fdProcessInfo->hProcess);
|
||||
}
|
||||
|
||||
static duint _getaddrfromline(const char* szSourceFile, int line)
|
||||
{
|
||||
LONG displacement = 0;
|
||||
IMAGEHLP_LINE64 lineData;
|
||||
memset(&lineData, 0, sizeof(lineData));
|
||||
lineData.SizeOfStruct = sizeof(lineData);
|
||||
if(!SymGetLineFromName64(fdProcessInfo->hProcess, NULL, szSourceFile, line, &displacement, &lineData))
|
||||
return 0;
|
||||
return (duint)lineData.Address;
|
||||
}
|
||||
|
||||
void dbgfunctionsinit()
|
||||
{
|
||||
_dbgfunctions.AssembleAtEx = _assembleatex;
|
||||
|
@ -203,4 +214,5 @@ void dbgfunctionsinit()
|
|||
_dbgfunctions.SetCmdline = _setcmdline;
|
||||
_dbgfunctions.FileOffsetToVa = valfileoffsettova;
|
||||
_dbgfunctions.VaToFileOffset = valvatofileoffset;
|
||||
_dbgfunctions.GetAddrFromLine = _getaddrfromline;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ typedef bool (*GETCMDLINE)(char* cmdline, size_t* cbsize);
|
|||
typedef bool (*SETCMDLINE)(const char* cmdline);
|
||||
typedef duint (*FILEOFFSETTOVA)(const char* modname, duint offset);
|
||||
typedef duint (*VATOFILEOFFSET)(duint va);
|
||||
typedef duint (*GETADDRFROMLINE)(const char* szSourceFile, int line);
|
||||
|
||||
typedef struct DBGFUNCTIONS_
|
||||
{
|
||||
|
@ -100,6 +101,7 @@ typedef struct DBGFUNCTIONS_
|
|||
SETCMDLINE SetCmdline;
|
||||
FILEOFFSETTOVA FileOffsetToVa;
|
||||
VATOFILEOFFSET VaToFileOffset;
|
||||
GETADDRFROMLINE GetAddrFromLine;
|
||||
} DBGFUNCTIONS;
|
||||
|
||||
#ifdef BUILD_DBG
|
||||
|
|
Loading…
Reference in New Issue