mirror of
https://github.com/x64dbg/x64dbg.git
synced 2024-11-27 14:50:24 +00:00
Translate the DBG (initial work)
This commit is contained in:
parent
6c82cc95c7
commit
3282b0d4ea
@ -1,7 +1,10 @@
|
||||
@echo off
|
||||
echo Run this to update translation templates after the source is modified. Be sure to set Qt path in setenv.bat
|
||||
|
||||
call setenv.bat x64
|
||||
lupdate src/gui/x64dbg.pro
|
||||
lrelease src/gui/x64dbg.pro
|
||||
del src\gui\Translations\x64dbg.qm
|
||||
@echo off
|
||||
echo Run this to update translation templates after the source is modified. Be sure to set Qt path in setenv.bat
|
||||
|
||||
call setenv.bat x64
|
||||
lupdate src/gui/x64dbg.pro
|
||||
lrelease src/gui/x64dbg.pro
|
||||
lupdate src/dbg/x64dbg_dbg_translations.pro
|
||||
lrelease src/dbg/x64dbg_dbg_translations.pro
|
||||
del src\gui\Translations\x64dbg.qm
|
||||
del src\gui\Translations\x64dbg_dbg.qm
|
@ -2,6 +2,7 @@
|
||||
|
||||
GUIGUIINIT _gui_guiinit;
|
||||
GUISENDMESSAGE _gui_sendmessage;
|
||||
GUITRANSLATEDBG _gui_translate_dbg;
|
||||
|
||||
DBGDBGINIT _dbg_dbginit;
|
||||
DBGMEMFINDBASEADDR _dbg_memfindbaseaddr;
|
||||
|
@ -7,10 +7,12 @@
|
||||
//GUI typedefs
|
||||
typedef int (*GUIGUIINIT)(int, char**);
|
||||
typedef void* (*GUISENDMESSAGE)(GUIMSG type, void* param1, void* param2);
|
||||
typedef const char* (*GUITRANSLATEDBG)(const char* source);
|
||||
|
||||
//GUI functions
|
||||
extern GUIGUIINIT _gui_guiinit;
|
||||
extern GUISENDMESSAGE _gui_sendmessage;
|
||||
extern GUITRANSLATEDBG _gui_translate_dbg;
|
||||
|
||||
//DBG typedefs
|
||||
typedef const char* (*DBGDBGINIT)();
|
||||
|
@ -65,6 +65,7 @@ BRIDGE_IMPEXP const wchar_t* BridgeInit()
|
||||
LOADLIBRARY(gui_lib);
|
||||
LOADEXPORT(_gui_guiinit);
|
||||
LOADEXPORT(_gui_sendmessage);
|
||||
LOADEXPORT(_gui_translate_dbg);
|
||||
|
||||
//DBG Load
|
||||
LOADLIBRARY(dbg_lib);
|
||||
@ -1482,6 +1483,11 @@ BRIDGE_IMPEXP void GuiFoldDisassembly(duint startAddress, duint length)
|
||||
_gui_sendmessage(GUI_FOLD_DISASSEMBLY, (void*)startAddress, (void*)length);
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP const char* GuiTranslateDbg(const char* Source)
|
||||
{
|
||||
return _gui_translate_dbg(Source);
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
hInst = hinstDLL;
|
||||
|
@ -997,6 +997,7 @@ typedef struct
|
||||
|
||||
//GUI functions
|
||||
//code page is utf8
|
||||
BRIDGE_IMPEXP const char* GuiTranslateDbg(const char* Source);
|
||||
BRIDGE_IMPEXP void GuiDisasmAt(duint addr, duint cip);
|
||||
BRIDGE_IMPEXP void GuiSetDebugState(DBGSTATE state);
|
||||
BRIDGE_IMPEXP void GuiAddLogMessage(const char* msg);
|
||||
|
@ -42,6 +42,9 @@
|
||||
#ifndef DLL_IMPORT
|
||||
#define DLL_IMPORT __declspec(dllimport)
|
||||
#endif //DLL_IMPORT
|
||||
#ifndef QT_TRANSLATE_NOOP
|
||||
#define QT_TRANSLATE_NOOP(context, source) source
|
||||
#endif //QT_TRANSLATE_NOOP
|
||||
|
||||
//defines
|
||||
#define deflen 1024
|
||||
|
@ -6,6 +6,15 @@
|
||||
#include "console.h"
|
||||
#include "taskthread.h"
|
||||
|
||||
static void GuiAddLogMessageAsync(const char* msg)
|
||||
{
|
||||
static StringConcatTaskThread_<void(*)(const std::string &)> task([](const std::string & msg)
|
||||
{
|
||||
GuiAddLogMessage(msg.c_str());
|
||||
});
|
||||
task.WakeUp(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Print a line with text, terminated with a newline to the console.
|
||||
\param text The text to print.
|
||||
@ -13,10 +22,18 @@
|
||||
void dputs(const char* Text)
|
||||
{
|
||||
// Only append the newline if the caller didn't
|
||||
if(Text[strlen(Text) - 1] != '\n')
|
||||
dprintf("%s\n", Text);
|
||||
const char* TranslatedText = GuiTranslateDbg(Text);
|
||||
size_t textlen = strlen(TranslatedText);
|
||||
if(TranslatedText[textlen - 1] != '\n')
|
||||
{
|
||||
Memory<char*> buffer(textlen + 2, "dputs");
|
||||
memcpy(buffer(), TranslatedText, textlen);
|
||||
buffer()[textlen] = '\n';
|
||||
buffer()[textlen + 1] = '\0';
|
||||
GuiAddLogMessageAsync(buffer());
|
||||
}
|
||||
else
|
||||
dprintf("%s", Text);
|
||||
GuiAddLogMessageAsync(TranslatedText);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -32,16 +49,6 @@ void dprintf(const char* Format, ...)
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
void GuiAddLogMessageAsync(const char* msg)
|
||||
{
|
||||
static StringConcatTaskThread_<void (*)(const std::string &)> task([](const std::string & msg)
|
||||
{
|
||||
GuiAddLogMessage(msg.c_str());
|
||||
});
|
||||
task.WakeUp(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Print a formatted string to the console.
|
||||
\param format The printf format to use (see documentation of printf for more information).
|
||||
@ -50,7 +57,7 @@ void GuiAddLogMessageAsync(const char* msg)
|
||||
void dprintf_args(const char* Format, va_list Args)
|
||||
{
|
||||
char buffer[16384];
|
||||
vsnprintf_s(buffer, _TRUNCATE, Format, Args);
|
||||
vsnprintf_s(buffer, _TRUNCATE, GuiTranslateDbg(Format), Args);
|
||||
|
||||
GuiAddLogMessageAsync(buffer);
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ void cbDebuggerPaused()
|
||||
DWORD currentThreadId = ThreadGetId(hActiveThread);
|
||||
if(currentThreadId != PrevThreadId)
|
||||
{
|
||||
dprintf("Thread switched from %X to %X !\n", PrevThreadId, currentThreadId);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Thread switched from %X to %X !\n"), PrevThreadId, currentThreadId);
|
||||
PrevThreadId = currentThreadId;
|
||||
}
|
||||
// Watchdog
|
||||
@ -385,7 +385,7 @@ void DebugUpdateGui(duint disasm_addr, bool stack)
|
||||
else
|
||||
sprintf(modtext, "Module: %s - ", modname);
|
||||
char title[1024] = "";
|
||||
sprintf(title, "File: %s - PID: %X - %sThread: %X", szBaseFileName, fdProcessInfo->dwProcessId, modtext, ThreadGetId(hActiveThread));
|
||||
sprintf(title, GuiTranslateDbg(QT_TRANSLATE_NOOP("DBG", "File: %s - PID: %X - %sThread: %X")), szBaseFileName, fdProcessInfo->dwProcessId, modtext, ThreadGetId(hActiveThread));
|
||||
GuiUpdateWindowTitle(title);
|
||||
GuiUpdateAllViews();
|
||||
GuiFocusView(GUI_DISASSEMBLY);
|
||||
@ -445,22 +445,22 @@ static void printSoftBpInfo(const BREAKPOINT & bp)
|
||||
if(symbolicname.length())
|
||||
{
|
||||
if(*bp.name)
|
||||
dprintf("%s breakpoint \"%s\" at %s (" fhex ")!\n", bptype, bp.name, symbolicname.c_str(), bp.addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "%s breakpoint \"%s\" at %s ( %p )!\n"), bptype, bp.name, symbolicname.c_str(), bp.addr);
|
||||
else
|
||||
dprintf("%s breakpoint at %s (" fhex ")!\n", bptype, symbolicname.c_str(), bp.addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "%s breakpoint at %s ( %p )!\n"), bptype, symbolicname.c_str(), bp.addr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(*bp.name)
|
||||
dprintf("%s breakpoint \"%s\" at " fhex "!\n", bptype, bp.name, bp.addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "%s breakpoint \"%s\" at %p!\n"), bptype, bp.name, bp.addr);
|
||||
else
|
||||
dprintf("%s breakpoint at " fhex "!\n", bptype, bp.addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "%s breakpoint at %p!\n"), bptype, bp.addr);
|
||||
}
|
||||
}
|
||||
|
||||
static void printHwBpInfo(const BREAKPOINT & bp)
|
||||
{
|
||||
auto bpsize = "";
|
||||
const char* bpsize = "";
|
||||
switch(TITANGETSIZE(bp.titantype)) //size
|
||||
{
|
||||
case UE_HARDWARE_SIZE_1:
|
||||
@ -478,35 +478,38 @@ static void printHwBpInfo(const BREAKPOINT & bp)
|
||||
break;
|
||||
#endif //_WIN64
|
||||
}
|
||||
auto bptype = "";
|
||||
char* bptype;
|
||||
switch(TITANGETTYPE(bp.titantype)) //type
|
||||
{
|
||||
case UE_HARDWARE_EXECUTE:
|
||||
bptype = "execute";
|
||||
bptype = _strdup(GuiTranslateDbg(QT_TRANSLATE_NOOP("DBG", "execute")));
|
||||
bpsize = "";
|
||||
break;
|
||||
case UE_HARDWARE_READWRITE:
|
||||
bptype = "read/write";
|
||||
bptype = _strdup(GuiTranslateDbg(QT_TRANSLATE_NOOP("DBG", "read/write")));
|
||||
break;
|
||||
case UE_HARDWARE_WRITE:
|
||||
bptype = "write";
|
||||
bptype = _strdup(GuiTranslateDbg(QT_TRANSLATE_NOOP("DBG", "write")));
|
||||
break;
|
||||
default:
|
||||
bptype = _strdup(" ");
|
||||
}
|
||||
auto symbolicname = SymGetSymbolicName(bp.addr);
|
||||
if(symbolicname.length())
|
||||
{
|
||||
if(*bp.name)
|
||||
dprintf("Hardware breakpoint (%s%s) \"%s\" at %s (" fhex ")!\n", bpsize, bptype, bp.name, symbolicname.c_str(), bp.addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Hardware breakpoint (%s%s) \"%s\" at %s (%p)!\n"), bpsize, bptype, bp.name, symbolicname.c_str(), bp.addr);
|
||||
else
|
||||
dprintf("Hardware breakpoint (%s%s) at %s (" fhex ")!\n", bpsize, bptype, symbolicname.c_str(), bp.addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Hardware breakpoint (%s%s) at %s (%p)!\n"), bpsize, bptype, symbolicname.c_str(), bp.addr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(*bp.name)
|
||||
dprintf("Hardware breakpoint (%s%s) \"%s\" at " fhex "!\n", bpsize, bptype, bp.name, bp.addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Hardware breakpoint (%s%s) \"%s\" at %p!\n"), bpsize, bptype, bp.name, bp.addr);
|
||||
else
|
||||
dprintf("Hardware breakpoint (%s%s) at " fhex "!\n", bpsize, bptype, bp.addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Hardware breakpoint (%s%s) at %p!\n"), bpsize, bptype, bp.addr);
|
||||
}
|
||||
free(bptype);
|
||||
}
|
||||
|
||||
static void printMemBpInfo(const BREAKPOINT & bp, const void* ExceptionAddress)
|
||||
@ -531,16 +534,16 @@ static void printMemBpInfo(const BREAKPOINT & bp, const void* ExceptionAddress)
|
||||
if(symbolicname.length())
|
||||
{
|
||||
if(*bp.name)
|
||||
dprintf("Memory breakpoint%s \"%s\" at %s (" fhex ", " fhex ")!\n", bptype, bp.name, symbolicname.c_str(), bp.addr, ExceptionAddress);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Memory breakpoint%s \"%s\" at %s (%p, %p)!\n"), bptype, bp.name, symbolicname.c_str(), bp.addr, ExceptionAddress);
|
||||
else
|
||||
dprintf("Memory breakpoint%s at %s (" fhex ", " fhex ")!\n", bptype, symbolicname.c_str(), bp.addr, ExceptionAddress);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Memory breakpoint%s at %s (%p, %p)!\n"), bptype, symbolicname.c_str(), bp.addr, ExceptionAddress);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(*bp.name)
|
||||
dprintf("Memory breakpoint%s \"%s\" at " fhex " (" fhex ")!\n", bptype, bp.name, bp.addr, ExceptionAddress);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Memory breakpoint%s \"%s\" at %p (%p)!\n"), bptype, bp.name, bp.addr, ExceptionAddress);
|
||||
else
|
||||
dprintf("Memory breakpoint%s at " fhex " (" fhex ")!\n", bptype, bp.addr, ExceptionAddress);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Memory breakpoint%s at %p (%p)!\n"), bptype, bp.addr, ExceptionAddress);
|
||||
}
|
||||
}
|
||||
|
||||
@ -746,7 +749,7 @@ void cbRunToUserCodeBreakpoint(void* ExceptionAddress)
|
||||
hActiveThread = ThreadGetHandle(((DEBUG_EVENT*)GetDebugData())->dwThreadId);
|
||||
auto CIP = GetContextDataEx(hActiveThread, UE_CIP);
|
||||
auto symbolicname = SymGetSymbolicName(CIP);
|
||||
dprintf("User code reached at %s (" fhex ")!", symbolicname.c_str(), CIP);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "User code reached at %s (%p)!"), symbolicname.c_str(), CIP);
|
||||
// lock
|
||||
lock(WAITID_RUN);
|
||||
// Trace record
|
||||
@ -850,17 +853,17 @@ bool cbSetModuleBreakpoints(const BREAKPOINT* bp)
|
||||
{
|
||||
if(oldbytes != bp->oldbytes)
|
||||
{
|
||||
dprintf("Breakpoint " fhex " has been disabled because the bytes don't match! Expected: %02X %02X, Found: %02X %02X\n",
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Breakpoint %p has been disabled because the bytes don't match! Expected: %02X %02X, Found: %02X %02X\n"),
|
||||
bp->addr,
|
||||
((unsigned char*)&bp->oldbytes)[0], ((unsigned char*)&bp->oldbytes)[1],
|
||||
((unsigned char*)&oldbytes)[0], ((unsigned char*)&oldbytes)[1]);
|
||||
BpEnable(bp->addr, BPNORMAL, false);
|
||||
}
|
||||
else if(!SetBPX(bp->addr, bp->titantype, (void*)cbUserBreakpoint))
|
||||
dprintf("Could not set breakpoint " fhex "! (SetBPX)\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Could not set breakpoint %p! (SetBPX)\n"), bp->addr);
|
||||
}
|
||||
else
|
||||
dprintf("MemRead failed on breakpoint address" fhex "!\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "MemRead failed on breakpoint address%p!\n"), bp->addr);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -869,7 +872,7 @@ bool cbSetModuleBreakpoints(const BREAKPOINT* bp)
|
||||
duint size = 0;
|
||||
MemFindBaseAddr(bp->addr, &size);
|
||||
if(!SetMemoryBPXEx(bp->addr, size, bp->titantype, !bp->singleshoot, (void*)cbMemoryBreakpoint))
|
||||
dprintf("Could not set memory breakpoint " fhex "! (SetMemoryBPXEx)\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Could not set memory breakpoint %p! (SetMemoryBPXEx)\n"), bp->addr);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -885,9 +888,9 @@ bool cbSetModuleBreakpoints(const BREAKPOINT* bp)
|
||||
TITANSETDRX(titantype, drx);
|
||||
BpSetTitanType(bp->addr, BPHARDWARE, titantype);
|
||||
if(!SetHardwareBreakPoint(bp->addr, drx, TITANGETTYPE(bp->titantype), TITANGETSIZE(bp->titantype), (void*)cbHardwareBreakpoint))
|
||||
dprintf("Could not set hardware breakpoint " fhex "! (SetHardwareBreakPoint)\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Could not set hardware breakpoint %p! (SetHardwareBreakPoint)\n"), bp->addr);
|
||||
else
|
||||
dprintf("Set hardware breakpoint on " fhex "!\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Set hardware breakpoint on %p!\n"), bp->addr);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -910,15 +913,15 @@ static bool cbRemoveModuleBreakpoints(const BREAKPOINT* bp)
|
||||
{
|
||||
case BPNORMAL:
|
||||
if(!DeleteBPX(bp->addr))
|
||||
dprintf("Could not delete breakpoint " fhex "! (DeleteBPX)\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Could not delete breakpoint %p! (DeleteBPX)\n"), bp->addr);
|
||||
break;
|
||||
case BPMEMORY:
|
||||
if(!RemoveMemoryBPX(bp->addr, 0))
|
||||
dprintf("Could not delete memory breakpoint " fhex "! (RemoveMemoryBPX)\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Could not delete memory breakpoint %p! (RemoveMemoryBPX)\n"), bp->addr);
|
||||
break;
|
||||
case BPHARDWARE:
|
||||
if(!DeleteHardwareBreakPoint(TITANGETDRX(bp->titantype)))
|
||||
dprintf("Could not delete hardware breakpoint " fhex "! (DeleteHardwareBreakPoint)\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Could not delete hardware breakpoint %p! (DeleteHardwareBreakPoint)\n"), bp->addr);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1010,7 +1013,7 @@ void cbTOCNDStep()
|
||||
else
|
||||
{
|
||||
auto steps = dbgcleartracecondition();
|
||||
dprintf("Trace finished after %" fext "u steps!\n", steps);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Trace finished after %u steps!\n"), steps);
|
||||
cbRtrFinalStep();
|
||||
}
|
||||
}
|
||||
@ -1027,7 +1030,7 @@ void cbTICNDStep()
|
||||
else
|
||||
{
|
||||
auto steps = dbgcleartracecondition();
|
||||
dprintf("Trace finished after %" fext "u steps!\n", steps);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Trace finished after %u steps!\n"), steps);
|
||||
cbRtrFinalStep();
|
||||
}
|
||||
}
|
||||
@ -1040,7 +1043,7 @@ void cbTIBTStep()
|
||||
if(!traceCondition)
|
||||
{
|
||||
_dbg_dbgtraceexecute(CIP);
|
||||
dprintf("Bad tracing state.\n");
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Bad tracing state.\n"));
|
||||
cbRtrFinalStep();
|
||||
return;
|
||||
}
|
||||
@ -1048,7 +1051,7 @@ void cbTIBTStep()
|
||||
{
|
||||
_dbg_dbgtraceexecute(CIP);
|
||||
auto steps = dbgcleartracecondition();
|
||||
dprintf("Trace finished after %" fext "u steps!\n", steps);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Trace finished after %u steps!\n"), steps);
|
||||
cbRtrFinalStep();
|
||||
return;
|
||||
}
|
||||
@ -1065,7 +1068,7 @@ void cbTOBTStep()
|
||||
if(!traceCondition)
|
||||
{
|
||||
_dbg_dbgtraceexecute(CIP);
|
||||
dprintf("Bad tracing state.\n");
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Bad tracing state.\n"));
|
||||
cbRtrFinalStep();
|
||||
return;
|
||||
}
|
||||
@ -1073,7 +1076,7 @@ void cbTOBTStep()
|
||||
{
|
||||
_dbg_dbgtraceexecute(CIP);
|
||||
auto steps = dbgcleartracecondition();
|
||||
dprintf("Trace finished after %" fext "u steps!\n", steps);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Trace finished after %u steps!\n"), steps);
|
||||
cbRtrFinalStep();
|
||||
return;
|
||||
}
|
||||
@ -1090,7 +1093,7 @@ void cbTIITStep()
|
||||
if(!traceCondition)
|
||||
{
|
||||
_dbg_dbgtraceexecute(CIP);
|
||||
dprintf("Bad tracing state.\n");
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Bad tracing state.\n"));
|
||||
cbRtrFinalStep();
|
||||
return;
|
||||
}
|
||||
@ -1098,7 +1101,7 @@ void cbTIITStep()
|
||||
{
|
||||
_dbg_dbgtraceexecute(CIP);
|
||||
auto steps = dbgcleartracecondition();
|
||||
dprintf("Trace finished after %" fext "u steps!\n", steps);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Trace finished after %u steps!\n"), steps);
|
||||
cbRtrFinalStep();
|
||||
return;
|
||||
}
|
||||
@ -1115,7 +1118,7 @@ void cbTOITStep()
|
||||
if(!traceCondition)
|
||||
{
|
||||
_dbg_dbgtraceexecute(CIP);
|
||||
dprintf("Bad tracing state.\n");
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Bad tracing state.\n"));
|
||||
cbRtrFinalStep();
|
||||
return;
|
||||
}
|
||||
@ -1123,7 +1126,7 @@ void cbTOITStep()
|
||||
{
|
||||
_dbg_dbgtraceexecute(CIP);
|
||||
auto steps = dbgcleartracecondition();
|
||||
dprintf("Trace finished after %" fext "u steps!\n", steps);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Trace finished after %u steps!\n"), steps);
|
||||
cbRtrFinalStep();
|
||||
return;
|
||||
}
|
||||
@ -1138,8 +1141,8 @@ static void cbCreateProcess(CREATE_PROCESS_DEBUG_INFO* CreateProcessInfo)
|
||||
|
||||
char DebugFileName[deflen] = "";
|
||||
if(!GetFileNameFromHandle(CreateProcessInfo->hFile, DebugFileName) && !GetFileNameFromProcessHandle(CreateProcessInfo->hProcess, DebugFileName))
|
||||
strcpy_s(DebugFileName, "??? (GetFileNameFromHandle failed)");
|
||||
dprintf("Process Started: " fhex " %s\n", base, DebugFileName);
|
||||
strcpy_s(DebugFileName, GuiTranslateDbg(QT_TRANSLATE_NOOP("DBG", "??? (GetFileNameFromHandle failed)")));
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Process Started: %p %s\n"), base, DebugFileName);
|
||||
|
||||
//update memory map
|
||||
MemUpdateMap();
|
||||
@ -1181,10 +1184,10 @@ static void cbCreateProcess(CREATE_PROCESS_DEBUG_INFO* CreateProcessInfo)
|
||||
TLSGrabCallBackDataW(StringUtils::Utf8ToUtf16(DebugFileName).c_str(), 0, &NumberOfCallBacks);
|
||||
if(NumberOfCallBacks)
|
||||
{
|
||||
dprintf("TLS Callbacks: %d\n", NumberOfCallBacks);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "TLS Callbacks: %d\n"), NumberOfCallBacks);
|
||||
Memory<duint*> TLSCallBacks(NumberOfCallBacks * sizeof(duint), "cbCreateProcess:TLSCallBacks");
|
||||
if(!TLSGrabCallBackDataW(StringUtils::Utf8ToUtf16(DebugFileName).c_str(), TLSCallBacks(), &NumberOfCallBacks))
|
||||
dputs("Failed to get TLS callback addresses!");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Failed to get TLS callback addresses!"));
|
||||
else
|
||||
{
|
||||
duint ImageBase = GetPE32DataW(StringUtils::Utf8ToUtf16(DebugFileName).c_str(), 0, UE_IMAGEBASE);
|
||||
@ -1194,21 +1197,21 @@ static void cbCreateProcess(CREATE_PROCESS_DEBUG_INFO* CreateProcessInfo)
|
||||
duint callbackVA = TLSCallBacks()[i] - ImageBase + pDebuggedBase;
|
||||
if(MemIsValidReadPtr(callbackVA))
|
||||
{
|
||||
sprintf_s(command, "bp " fhex ",\"TLS Callback %d\",ss", callbackVA, i + 1);
|
||||
sprintf_s(command, "bp %p,\"TLS Callback %d\",ss", callbackVA, i + 1);
|
||||
cmddirectexec(command);
|
||||
}
|
||||
else
|
||||
invalidCount++;
|
||||
}
|
||||
if(invalidCount)
|
||||
dprintf("%d invalid TLS callback addresses...\n", invalidCount);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "%d invalid TLS callback addresses...\n"), invalidCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(settingboolget("Events", "EntryBreakpoint"))
|
||||
{
|
||||
sprintf_s(command, "bp " fhex ",\"entry breakpoint\",ss", (duint)CreateProcessInfo->lpStartAddress);
|
||||
sprintf_s(command, "bp %p,\"entry breakpoint\",ss", (duint)CreateProcessInfo->lpStartAddress);
|
||||
cmddirectexec(command);
|
||||
}
|
||||
|
||||
@ -1259,7 +1262,7 @@ static void cbCreateProcess(CREATE_PROCESS_DEBUG_INFO* CreateProcessInfo)
|
||||
|
||||
static void cbExitProcess(EXIT_PROCESS_DEBUG_INFO* ExitProcess)
|
||||
{
|
||||
dprintf("Process stopped with exit code 0x%X\n", ExitProcess->dwExitCode);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Process stopped with exit code 0x%X\n"), ExitProcess->dwExitCode);
|
||||
PLUG_CB_EXITPROCESS callbackInfo;
|
||||
callbackInfo.ExitProcess = ExitProcess;
|
||||
plugincbcall(CB_EXITPROCESS, &callbackInfo);
|
||||
@ -1281,7 +1284,7 @@ static void cbCreateThread(CREATE_THREAD_DEBUG_INFO* CreateThread)
|
||||
if(settingboolget("Events", "ThreadEntry"))
|
||||
{
|
||||
char command[256] = "";
|
||||
sprintf(command, "bp " fhex ",\"Thread %X\",ss", (duint)CreateThread->lpStartAddress, dwThreadId);
|
||||
sprintf(command, "bp %p,\"Thread %X\",ss", (duint)CreateThread->lpStartAddress, dwThreadId);
|
||||
cmddirectexec(command);
|
||||
}
|
||||
|
||||
@ -1290,7 +1293,7 @@ static void cbCreateThread(CREATE_THREAD_DEBUG_INFO* CreateThread)
|
||||
callbackInfo.dwThreadId = dwThreadId;
|
||||
plugincbcall(CB_CREATETHREAD, &callbackInfo);
|
||||
|
||||
dprintf("Thread %X created, Entry: " fhex "\n", dwThreadId, CreateThread->lpStartAddress);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Thread %X created, Entry: %p\n"), dwThreadId, CreateThread->lpStartAddress);
|
||||
|
||||
if(settingboolget("Events", "ThreadStart"))
|
||||
{
|
||||
@ -1330,7 +1333,7 @@ static void cbExitThread(EXIT_THREAD_DEBUG_INFO* ExitThread)
|
||||
plugincbcall(CB_EXITTHREAD, &callbackInfo);
|
||||
HistoryClear();
|
||||
ThreadExit(dwThreadId);
|
||||
dprintf("Thread %X exit\n", dwThreadId);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Thread %X exit\n"), dwThreadId);
|
||||
|
||||
if(settingboolget("Events", "ThreadEnd"))
|
||||
{
|
||||
@ -1414,7 +1417,7 @@ static void cbLoadDll(LOAD_DLL_DEBUG_INFO* LoadDll)
|
||||
if(settingboolget("Events", "EntryBreakpoint"))
|
||||
{
|
||||
bAlreadySetEntry = true;
|
||||
sprintf(command, "bp " fhex ",\"entry breakpoint\",ss", pDebuggedBase + pDebuggedEntry);
|
||||
sprintf(command, "bp %p,\"entry breakpoint\",ss", pDebuggedBase + pDebuggedEntry);
|
||||
cmddirectexec(command);
|
||||
}
|
||||
}
|
||||
@ -1426,7 +1429,7 @@ static void cbLoadDll(LOAD_DLL_DEBUG_INFO* LoadDll)
|
||||
TLSGrabCallBackDataW(StringUtils::Utf8ToUtf16(DLLDebugFileName).c_str(), 0, &NumberOfCallBacks);
|
||||
if(NumberOfCallBacks)
|
||||
{
|
||||
dprintf("TLS Callbacks: %d\n", NumberOfCallBacks);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "TLS Callbacks: %d\n"), NumberOfCallBacks);
|
||||
Memory<duint*> TLSCallBacks(NumberOfCallBacks * sizeof(duint), "cbLoadDll:TLSCallBacks");
|
||||
if(!TLSGrabCallBackDataW(StringUtils::Utf8ToUtf16(DLLDebugFileName).c_str(), TLSCallBacks(), &NumberOfCallBacks))
|
||||
dputs("Failed to get TLS callback addresses!");
|
||||
@ -1440,16 +1443,16 @@ static void cbLoadDll(LOAD_DLL_DEBUG_INFO* LoadDll)
|
||||
if(MemIsValidReadPtr(callbackVA))
|
||||
{
|
||||
if(bIsDebuggingThis)
|
||||
sprintf(command, "bp " fhex ",\"TLS Callback %d\",ss", callbackVA, i + 1);
|
||||
sprintf(command, "bp %p,\"TLS Callback %d\",ss", callbackVA, i + 1);
|
||||
else
|
||||
sprintf(command, "bp " fhex ",\"TLS Callback %d (%s)\",ss", callbackVA, i + 1, modname);
|
||||
sprintf(command, "bp %p,\"TLS Callback %d (%s)\",ss", callbackVA, i + 1, modname);
|
||||
cmddirectexec(command);
|
||||
}
|
||||
else
|
||||
invalidCount++;
|
||||
}
|
||||
if(invalidCount)
|
||||
dprintf("%d invalid TLS callback addresses...\n", invalidCount);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "%d invalid TLS callback addresses...\n"), invalidCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1460,12 +1463,12 @@ static void cbLoadDll(LOAD_DLL_DEBUG_INFO* LoadDll)
|
||||
if(oep)
|
||||
{
|
||||
char command[256] = "";
|
||||
sprintf(command, "bp " fhex ",\"DllMain (%s)\",ss", oep + (duint)base, modname);
|
||||
sprintf(command, "bp %p,\"DllMain (%s)\",ss", oep + (duint)base, modname);
|
||||
cmddirectexec(command);
|
||||
}
|
||||
}
|
||||
|
||||
dprintf("DLL Loaded: " fhex " %s\n", base, DLLDebugFileName);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "DLL Loaded: %p %s\n"), base, DLLDebugFileName);
|
||||
|
||||
//plugin callback
|
||||
PLUG_CB_LOADDLL callbackInfo;
|
||||
@ -1527,7 +1530,7 @@ static void cbUnloadDll(UNLOAD_DLL_DEBUG_INFO* UnloadDll)
|
||||
BpEnumAll(cbRemoveModuleBreakpoints, modname, duint(base));
|
||||
GuiUpdateBreakpointsView();
|
||||
SafeSymUnloadModule64(fdProcessInfo->hProcess, (DWORD64)base);
|
||||
dprintf("DLL Unloaded: " fhex " %s\n", base, modname);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "DLL Unloaded: %p %s\n"), base, modname);
|
||||
|
||||
if(bBreakOnNextDll || settingboolget("Events", "DllUnload"))
|
||||
{
|
||||
@ -1566,7 +1569,7 @@ static void cbOutputDebugString(OUTPUT_DEBUG_STRING_INFO* DebugString)
|
||||
if(str != lastDebugText) //fix for every string being printed twice
|
||||
{
|
||||
if(str != "\n")
|
||||
dprintf("DebugString: \"%s\"\n", StringUtils::Escape(str).c_str());
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "DebugString: \"%s\"\n"), StringUtils::Escape(str).c_str());
|
||||
lastDebugText = str;
|
||||
}
|
||||
else
|
||||
@ -1648,7 +1651,7 @@ static void cbException(EXCEPTION_DEBUG_INFO* ExceptionData)
|
||||
if(MemRead((duint)nameInfo.szName, ThreadName(), MAX_THREAD_NAME_SIZE - 1))
|
||||
{
|
||||
String ThreadNameEscaped = StringUtils::Escape(ThreadName());
|
||||
dprintf("SetThreadName(%X, \"%s\")\n", nameInfo.dwThreadID, ThreadNameEscaped.c_str());
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "SetThreadName(%X, \"%s\")\n"), nameInfo.dwThreadID, ThreadNameEscaped.c_str());
|
||||
ThreadSetName(nameInfo.dwThreadID, ThreadNameEscaped.c_str());
|
||||
}
|
||||
}
|
||||
@ -1659,9 +1662,9 @@ static void cbException(EXCEPTION_DEBUG_INFO* ExceptionData)
|
||||
if(ExceptionData->dwFirstChance) //first chance exception
|
||||
{
|
||||
if(exceptionName.size())
|
||||
dprintf("First chance exception on " fhex " (%.8X, %s)!\n", addr, ExceptionCode, exceptionName.c_str());
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "First chance exception on %p (%.8X, %s)!\n"), addr, ExceptionCode, exceptionName.c_str());
|
||||
else
|
||||
dprintf("First chance exception on " fhex " (%.8X)!\n", addr, ExceptionCode);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "First chance exception on %p (%.8X)!\n"), addr, ExceptionCode);
|
||||
SetNextDbgContinueStatus(DBG_EXCEPTION_NOT_HANDLED);
|
||||
if(bSkipExceptions || dbgisignoredexception(ExceptionCode))
|
||||
return;
|
||||
@ -1669,9 +1672,9 @@ static void cbException(EXCEPTION_DEBUG_INFO* ExceptionData)
|
||||
else //lock the exception
|
||||
{
|
||||
if(exceptionName.size())
|
||||
dprintf("Last chance exception on " fhex " (%.8X, %s)!\n", addr, ExceptionCode, exceptionName.c_str());
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Last chance exception on %p (%.8X, %s)!\n"), addr, ExceptionCode, exceptionName.c_str());
|
||||
else
|
||||
dprintf("Last chance exception on " fhex " (%.8X)!\n", addr, ExceptionCode);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Last chance exception on %p (%.8X)!\n"), addr, ExceptionCode);
|
||||
SetNextDbgContinueStatus(DBG_CONTINUE);
|
||||
}
|
||||
|
||||
@ -1701,12 +1704,12 @@ bool cbDeleteAllBreakpoints(const BREAKPOINT* bp)
|
||||
return true;
|
||||
if(!BpDelete(bp->addr, BPNORMAL))
|
||||
{
|
||||
dprintf("Delete breakpoint failed (BpDelete): " fhex "\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Delete breakpoint failed (BpDelete): %p\n"), bp->addr);
|
||||
return false;
|
||||
}
|
||||
if(bp->enabled && !DeleteBPX(bp->addr))
|
||||
{
|
||||
dprintf("Delete breakpoint failed (DeleteBPX): " fhex "\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Delete breakpoint failed (DeleteBPX): %p\n"), bp->addr);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -1721,12 +1724,12 @@ bool cbEnableAllBreakpoints(const BREAKPOINT* bp)
|
||||
{
|
||||
if(!MemIsValidReadPtr(bp->addr))
|
||||
return true;
|
||||
dprintf("Could not enable breakpoint " fhex " (SetBPX)\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Could not enable breakpoint %p (SetBPX)\n"), bp->addr);
|
||||
return false;
|
||||
}
|
||||
if(!BpEnable(bp->addr, BPNORMAL, true))
|
||||
{
|
||||
dprintf("Could not enable breakpoint " fhex " (BpEnable)\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Could not enable breakpoint %p (BpEnable)\n"), bp->addr);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -1739,12 +1742,12 @@ bool cbDisableAllBreakpoints(const BREAKPOINT* bp)
|
||||
|
||||
if(!BpEnable(bp->addr, BPNORMAL, false))
|
||||
{
|
||||
dprintf("Could not disable breakpoint " fhex " (BpEnable)\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Could not disable breakpoint %p (BpEnable)\n"), bp->addr);
|
||||
return false;
|
||||
}
|
||||
if(!DeleteBPX(bp->addr))
|
||||
{
|
||||
dprintf("Could not disable breakpoint " fhex " (DeleteBPX)\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Could not disable breakpoint %p (DeleteBPX)\n"), bp->addr);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -1757,7 +1760,7 @@ bool cbEnableAllHardwareBreakpoints(const BREAKPOINT* bp)
|
||||
DWORD drx = 0;
|
||||
if(!GetUnusedHardwareBreakPointRegister(&drx))
|
||||
{
|
||||
dprintf("Did not enable hardware breakpoint " fhex " (all slots full)\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Did not enable hardware breakpoint %p (all slots full)\n"), bp->addr);
|
||||
return true;
|
||||
}
|
||||
int titantype = bp->titantype;
|
||||
@ -1765,12 +1768,12 @@ bool cbEnableAllHardwareBreakpoints(const BREAKPOINT* bp)
|
||||
BpSetTitanType(bp->addr, BPHARDWARE, titantype);
|
||||
if(!BpEnable(bp->addr, BPHARDWARE, true))
|
||||
{
|
||||
dprintf("Could not enable hardware breakpoint " fhex " (BpEnable)\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Could not enable hardware breakpoint %p (BpEnable)\n"), bp->addr);
|
||||
return false;
|
||||
}
|
||||
if(!SetHardwareBreakPoint(bp->addr, drx, TITANGETTYPE(bp->titantype), TITANGETSIZE(bp->titantype), (void*)cbHardwareBreakpoint))
|
||||
{
|
||||
dprintf("Could not enable hardware breakpoint " fhex " (SetHardwareBreakPoint)\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Could not enable hardware breakpoint %p (SetHardwareBreakPoint)\n"), bp->addr);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -1782,12 +1785,12 @@ bool cbDisableAllHardwareBreakpoints(const BREAKPOINT* bp)
|
||||
return true;
|
||||
if(!BpEnable(bp->addr, BPHARDWARE, false))
|
||||
{
|
||||
dprintf("Could not disable hardware breakpoint " fhex " (BpEnable)\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Could not disable hardware breakpoint %p (BpEnable)\n"), bp->addr);
|
||||
return false;
|
||||
}
|
||||
if(bp->enabled && !DeleteHardwareBreakPoint(TITANGETDRX(bp->titantype)))
|
||||
{
|
||||
dprintf("Could not disable hardware breakpoint " fhex " (DeleteHardwareBreakPoint)\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Could not disable hardware breakpoint %p (DeleteHardwareBreakPoint)\n"), bp->addr);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -1801,12 +1804,12 @@ bool cbEnableAllMemoryBreakpoints(const BREAKPOINT* bp)
|
||||
MemFindBaseAddr(bp->addr, &size);
|
||||
if(!BpEnable(bp->addr, BPMEMORY, true))
|
||||
{
|
||||
dprintf("Could not enable memory breakpoint " fhex " (BpEnable)\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Could not enable memory breakpoint %p (BpEnable)\n"), bp->addr);
|
||||
return false;
|
||||
}
|
||||
if(!SetMemoryBPXEx(bp->addr, size, bp->titantype, !bp->singleshoot, (void*)cbMemoryBreakpoint))
|
||||
{
|
||||
dprintf("Could not enable memory breakpoint " fhex " (SetMemoryBPXEx)\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Could not enable memory breakpoint %p (SetMemoryBPXEx)\n"), bp->addr);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -1818,12 +1821,12 @@ bool cbDisableAllMemoryBreakpoints(const BREAKPOINT* bp)
|
||||
return true;
|
||||
if(!BpEnable(bp->addr, BPMEMORY, false))
|
||||
{
|
||||
dprintf("Could not disable memory breakpoint " fhex " (BpEnable)\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Could not disable memory breakpoint %p (BpEnable)\n"), bp->addr);
|
||||
return false;
|
||||
}
|
||||
if(!RemoveMemoryBPX(bp->addr, 0))
|
||||
{
|
||||
dprintf("Could not disable memory breakpoint " fhex " (RemoveMemoryBPX)\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Could not disable memory breakpoint %p (RemoveMemoryBPX)\n"), bp->addr);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -1845,9 +1848,9 @@ bool cbBreakpointList(const BREAKPOINT* bp)
|
||||
type = "GP";
|
||||
bool enabled = bp->enabled;
|
||||
if(*bp->name)
|
||||
dprintf("%d:%s:" fhex ":\"%s\"\n", enabled, type, bp->addr, bp->name);
|
||||
dprintf("%d:%s:%p:\"%s\"\n", enabled, type, bp->addr, bp->name);
|
||||
else
|
||||
dprintf("%d:%s:" fhex "\n", enabled, type, bp->addr);
|
||||
dprintf("%d:%s:%p\n", enabled, type, bp->addr);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1859,12 +1862,12 @@ bool cbDeleteAllMemoryBreakpoints(const BREAKPOINT* bp)
|
||||
MemFindBaseAddr(bp->addr, &size);
|
||||
if(!BpDelete(bp->addr, BPMEMORY))
|
||||
{
|
||||
dprintf("Delete memory breakpoint failed (BpDelete): " fhex "\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Delete memory breakpoint failed (BpDelete): %p\n"), bp->addr);
|
||||
return false;
|
||||
}
|
||||
if(bp->enabled && !RemoveMemoryBPX(bp->addr, size))
|
||||
{
|
||||
dprintf("Delete memory breakpoint failed (RemoveMemoryBPX): " fhex "\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Delete memory breakpoint failed (RemoveMemoryBPX): %p\n"), bp->addr);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -1876,12 +1879,12 @@ bool cbDeleteAllHardwareBreakpoints(const BREAKPOINT* bp)
|
||||
return true;
|
||||
if(!BpDelete(bp->addr, BPHARDWARE))
|
||||
{
|
||||
dprintf("Delete hardware breakpoint failed (BpDelete): " fhex "\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Delete hardware breakpoint failed (BpDelete): %p\n"), bp->addr);
|
||||
return false;
|
||||
}
|
||||
if(bp->enabled && !DeleteHardwareBreakPoint(TITANGETDRX(bp->titantype)))
|
||||
{
|
||||
dprintf("Delete hardware breakpoint failed (DeleteHardwareBreakPoint): " fhex "\n", bp->addr);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Delete hardware breakpoint failed (DeleteHardwareBreakPoint): %p\n"), bp->addr);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -2229,7 +2232,7 @@ static void debugLoopFunction(void* lpParameter, bool attach)
|
||||
if(!fdProcessInfo)
|
||||
{
|
||||
fdProcessInfo = &g_pi;
|
||||
dprintf("Error starting process (CreateProcess, %s)!\n", ErrorCodeToName(GetLastError()).c_str());
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Error starting process (CreateProcess, %s)!\n"), ErrorCodeToName(GetLastError()).c_str());
|
||||
unlock(WAITID_STOP);
|
||||
return;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ int RefFind(duint Address, duint Size, CBREF Callback, void* UserData, bool Sile
|
||||
if(!regionBase || !regionSize)
|
||||
{
|
||||
if(!Silent)
|
||||
dprintf("Invalid memory page 0x%p\n", Address);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Invalid memory page 0x%p\n"), Address);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -47,9 +47,9 @@ int RefFind(duint Address, duint Size, CBREF Callback, void* UserData, bool Sile
|
||||
|
||||
// Determine the full module name
|
||||
if(ModNameFromAddr(scanStart, moduleName, true))
|
||||
sprintf_s(fullName, "%s (Region %s)", Name, moduleName);
|
||||
sprintf_s(fullName, GuiTranslateDbg(QT_TRANSLATE_NOOP("DBG", "%s (Region %s)")), Name, moduleName);
|
||||
else
|
||||
sprintf_s(fullName, "%s (Region %p)", Name, scanStart);
|
||||
sprintf_s(fullName, GuiTranslateDbg(QT_TRANSLATE_NOOP("DBG", "%s (Region %p)")), Name, scanStart);
|
||||
|
||||
// Initialize disassembler
|
||||
Capstone cp;
|
||||
@ -61,7 +61,7 @@ int RefFind(duint Address, duint Size, CBREF Callback, void* UserData, bool Sile
|
||||
|
||||
RefFindInRange(scanStart, scanSize, Callback, UserData, Silent, refInfo, cp, true, [](int percent)
|
||||
{
|
||||
GuiReferenceSetCurrentTaskProgress(percent, "Region Search");
|
||||
GuiReferenceSetCurrentTaskProgress(percent, GuiTranslateDbg(QT_TRANSLATE_NOOP("DBG", "Region Search")));
|
||||
GuiReferenceSetProgress(percent);
|
||||
}, disasmText);
|
||||
}
|
||||
@ -73,7 +73,7 @@ int RefFind(duint Address, duint Size, CBREF Callback, void* UserData, bool Sile
|
||||
if(!modInfo)
|
||||
{
|
||||
if(!Silent)
|
||||
dprintf("Couldn't locate module for 0x%p\n", Address);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Couldn't locate module for 0x%p\n"), Address);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -102,7 +102,7 @@ int RefFind(duint Address, duint Size, CBREF Callback, void* UserData, bool Sile
|
||||
|
||||
RefFindInRange(scanStart, scanSize, Callback, UserData, Silent, refInfo, cp, true, [](int percent)
|
||||
{
|
||||
GuiReferenceSetCurrentTaskProgress(percent, "Module Search");
|
||||
GuiReferenceSetCurrentTaskProgress(percent, GuiTranslateDbg(QT_TRANSLATE_NOOP("DBG", "Module Search")));
|
||||
GuiReferenceSetProgress(percent);
|
||||
}, disasmText);
|
||||
}
|
||||
@ -115,7 +115,7 @@ int RefFind(duint Address, duint Size, CBREF Callback, void* UserData, bool Sile
|
||||
if(!modList.size())
|
||||
{
|
||||
if(!Silent)
|
||||
dprintf("Couldn't get module list");
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Couldn't get module list"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -124,7 +124,7 @@ int RefFind(duint Address, duint Size, CBREF Callback, void* UserData, bool Sile
|
||||
Capstone cp;
|
||||
|
||||
// Determine the full module
|
||||
sprintf_s(fullName, "All Modules (%s)", Name);
|
||||
sprintf_s(fullName, GuiTranslateDbg(QT_TRANSLATE_NOOP("DBG", "All Modules (%s)")), Name);
|
||||
|
||||
// Allow an "initialization" notice
|
||||
refInfo.refcount = 0;
|
||||
@ -168,7 +168,7 @@ int RefFindInRange(duint scanStart, duint scanSize, CBREF Callback, void* UserDa
|
||||
if(!MemRead(scanStart, data(), scanSize))
|
||||
{
|
||||
if(!Silent)
|
||||
dprintf("Error reading memory in reference search\n");
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Error reading memory in reference search\n"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -438,17 +438,17 @@ extern "C" DLL_EXPORT const char* _dbg_dbginit()
|
||||
if(sizeof(TITAN_ENGINE_CONTEXT_t) != sizeof(REGISTERCONTEXT))
|
||||
return "Invalid REGISTERCONTEXT alignment!";
|
||||
|
||||
dputs("Initializing wait objects...");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Initializing wait objects..."));
|
||||
waitinitialize();
|
||||
dputs("Initializing debugger...");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Initializing debugger..."));
|
||||
dbginit();
|
||||
dputs("Initializing debugger functions...");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Initializing debugger functions..."));
|
||||
dbgfunctionsinit();
|
||||
dputs("Setting JSON memory management functions...");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Setting JSON memory management functions..."));
|
||||
json_set_alloc_funcs(json_malloc, json_free);
|
||||
dputs("Initializing capstone...");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Initializing capstone..."));
|
||||
Capstone::GlobalInitialize();
|
||||
dputs("Initializing Yara...");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Initializing Yara..."));
|
||||
if(yr_initialize() != ERROR_SUCCESS)
|
||||
return "Failed to initialize Yara!";
|
||||
dputs("Getting directory information...");
|
||||
@ -474,24 +474,24 @@ extern "C" DLL_EXPORT const char* _dbg_dbginit()
|
||||
if(FileHelper::ReadAllText(StringUtils::sprintf("%s\\..\\mnemdb.json", dir), mnemonicHelpData))
|
||||
{
|
||||
if(MnemonicHelp::loadFromText(mnemonicHelpData.c_str()))
|
||||
dputs("Mnemonic help database loaded!");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Mnemonic help database loaded!"));
|
||||
else
|
||||
dputs("Failed to load mnemonic help database...");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Failed to load mnemonic help database..."));
|
||||
}
|
||||
else
|
||||
dputs("Failed to read mnemonic help database...");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Failed to read mnemonic help database..."));
|
||||
|
||||
// Load error codes
|
||||
if(ErrorCodeInit(StringUtils::sprintf("%s\\..\\errordb.txt", dir)))
|
||||
dputs("Error codes database loaded!");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Error codes database loaded!"));
|
||||
else
|
||||
dputs("Failed to load error codes...");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Failed to load error codes..."));
|
||||
|
||||
// Load exception codes
|
||||
if(ExceptionCodeInit(StringUtils::sprintf("%s\\..\\exceptiondb.txt", dir)))
|
||||
dputs("Exception codes database loaded!");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Exception codes database loaded!"));
|
||||
else
|
||||
dputs("Failed to load exception codes...");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Failed to load exception codes..."));
|
||||
|
||||
// Create database directory in the local debugger folder
|
||||
DbSetPath(StringUtils::sprintf("%s\\db", dir).c_str(), nullptr);
|
||||
@ -521,45 +521,45 @@ extern "C" DLL_EXPORT const char* _dbg_dbginit()
|
||||
|
||||
if(strstr(szSymbolCachePath, "http://") || strstr(szSymbolCachePath, "https://"))
|
||||
{
|
||||
if(Script::Gui::MessageYesNo("It is strongly discouraged to use symbol servers in your path directly (use the store option instead).\n\nDo you want me to fix this?"))
|
||||
if(Script::Gui::MessageYesNo(GuiTranslateDbg(QT_TRANSLATE_NOOP("DBG", "It is strongly discouraged to use symbol servers in your path directly (use the store option instead).\n\nDo you want me to fix this?"))))
|
||||
{
|
||||
strcpy_s(szSymbolCachePath, szLocalSymbolPath);
|
||||
BridgeSettingSet("Symbols", "CachePath", ".\\symbols");
|
||||
}
|
||||
}
|
||||
}
|
||||
dprintf("Symbol Path: %s\n", szSymbolCachePath);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Symbol Path: %s\n"), szSymbolCachePath);
|
||||
SetCurrentDirectoryW(StringUtils::Utf8ToUtf16(dir).c_str());
|
||||
dputs("Allocating message stack...");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Allocating message stack..."));
|
||||
gMsgStack = MsgAllocStack();
|
||||
if(!gMsgStack)
|
||||
return "Could not allocate message stack!";
|
||||
dputs("Initializing global script variables...");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Initializing global script variables..."));
|
||||
varinit();
|
||||
dputs("Registering debugger commands...");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Registering debugger commands..."));
|
||||
registercommands();
|
||||
dputs("Registering GUI command handler...");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Registering GUI command handler..."));
|
||||
ExpressionFunctions::Init();
|
||||
dputs("Registering expression functions...");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Registering expression functions..."));
|
||||
SCRIPTTYPEINFO info;
|
||||
strcpy_s(info.name, "Default");
|
||||
strcpy_s(info.name, GuiTranslateDbg(QT_TRANSLATE_NOOP("DBG", "Default")));
|
||||
info.id = 0;
|
||||
info.execute = DbgCmdExec;
|
||||
info.completeCommand = nullptr;
|
||||
GuiRegisterScriptLanguage(&info);
|
||||
dputs("Registering Script DLL command handler...");
|
||||
strcpy_s(info.name, "Script DLL");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Registering Script DLL command handler..."));
|
||||
strcpy_s(info.name, GuiTranslateDbg(QT_TRANSLATE_NOOP("DBG", "Script DLL")));
|
||||
info.execute = DbgScriptDllExec;
|
||||
GuiRegisterScriptLanguage(&info);
|
||||
dputs("Starting command loop...");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Starting command loop..."));
|
||||
hCommandLoopThread = CreateThread(0, 0, DbgCommandLoopThread, 0, 0, 0);
|
||||
char plugindir[deflen] = "";
|
||||
strcpy_s(plugindir, dir);
|
||||
strcat_s(plugindir, "\\plugins");
|
||||
CreateDirectoryW(StringUtils::Utf8ToUtf16(plugindir).c_str(), 0);
|
||||
dputs("Loading plugins...");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Loading plugins..."));
|
||||
pluginload(plugindir);
|
||||
dputs("Handling command line...");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Handling command line..."));
|
||||
//handle command line
|
||||
int argc = 0;
|
||||
wchar_t** argv = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||
@ -572,12 +572,12 @@ extern "C" DLL_EXPORT const char* _dbg_dbginit()
|
||||
else if(argc == 5 && !_wcsicmp(argv[1], L"-a") && !_wcsicmp(argv[3], L"-e")) //4 arguments (JIT)
|
||||
DbgCmdExec(StringUtils::Utf16ToUtf8(StringUtils::sprintf(L"attach .%s, .%s", argv[2], argv[4])).c_str()); //attach pid, event
|
||||
LocalFree(argv);
|
||||
dputs("Reading notes file...");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Reading notes file..."));
|
||||
notesFile = String(dir) + "\\notes.txt";
|
||||
String text;
|
||||
FileHelper::ReadAllText(notesFile, text);
|
||||
GuiSetGlobalNotes(text.c_str());
|
||||
dputs("Initialization successful!");
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Initialization successful!"));
|
||||
bIsStopped = false;
|
||||
return nullptr;
|
||||
}
|
||||
|
100
src/dbg/x64dbg_dbg_translations.pro
Normal file
100
src/dbg/x64dbg_dbg_translations.pro
Normal file
@ -0,0 +1,100 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# This file is only used by lupdate to generate translations for the dbg
|
||||
# Do not compile this project
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
SOURCES += \
|
||||
x64_dbg.cpp \
|
||||
debugger.cpp \
|
||||
reference.cpp \
|
||||
_dbgfunctions.cpp \
|
||||
_exports.cpp \
|
||||
_global.cpp \
|
||||
_plugins.cpp \
|
||||
_scriptapi_argument.cpp \
|
||||
_scriptapi_assembler.cpp \
|
||||
_scriptapi_bookmark.cpp \
|
||||
_scriptapi_comment.cpp \
|
||||
_scriptapi_debug.cpp \
|
||||
_scriptapi_flag.cpp \
|
||||
_scriptapi_function.cpp \
|
||||
_scriptapi_gui.cpp \
|
||||
_scriptapi_label.cpp \
|
||||
_scriptapi_memory.cpp \
|
||||
_scriptapi_misc.cpp \
|
||||
_scriptapi_module.cpp \
|
||||
_scriptapi_pattern.cpp \
|
||||
_scriptapi_register.cpp \
|
||||
_scriptapi_stack.cpp \
|
||||
_scriptapi_symbol.cpp \
|
||||
addrinfo.cpp \
|
||||
argument.cpp \
|
||||
assemble.cpp \
|
||||
bookmark.cpp \
|
||||
breakpoint.cpp \
|
||||
command.cpp \
|
||||
commandline.cpp \
|
||||
commandparser.cpp \
|
||||
comment.cpp \
|
||||
console.cpp \
|
||||
database.cpp \
|
||||
datainst_helper.cpp \
|
||||
dbghelp_safe.cpp \
|
||||
debugger_commands.cpp \
|
||||
disasm_fast.cpp \
|
||||
disasm_helper.cpp \
|
||||
encodemap.cpp \
|
||||
error.cpp \
|
||||
exception.cpp \
|
||||
exhandlerinfo.cpp \
|
||||
expressionfunctions.cpp \
|
||||
expressionparser.cpp \
|
||||
exprfunc.cpp \
|
||||
filehelper.cpp \
|
||||
function.cpp \
|
||||
handles.cpp \
|
||||
historycontext.cpp \
|
||||
instruction.cpp \
|
||||
jit.cpp \
|
||||
label.cpp \
|
||||
log.cpp \
|
||||
loop.cpp \
|
||||
main.cpp \
|
||||
memory.cpp \
|
||||
mnemonichelp.cpp \
|
||||
module.cpp \
|
||||
msgqueue.cpp \
|
||||
murmurhash.cpp \
|
||||
patches.cpp \
|
||||
patternfind.cpp \
|
||||
plugin_loader.cpp \
|
||||
simplescript.cpp \
|
||||
stackinfo.cpp \
|
||||
stringformat.cpp \
|
||||
stringutils.cpp \
|
||||
symbolinfo.cpp \
|
||||
tcpconnections.cpp \
|
||||
thread.cpp \
|
||||
threading.cpp \
|
||||
TraceRecord.cpp \
|
||||
value.cpp \
|
||||
variable.cpp \
|
||||
watch.cpp \
|
||||
xrefs.cpp \
|
||||
analysis/advancedanalysis.cpp \
|
||||
analysis/analysis.cpp \
|
||||
analysis/analysis_nukem.cpp \
|
||||
analysis/AnalysisPass.cpp \
|
||||
analysis/CodeFollowPass.cpp \
|
||||
analysis/controlflowanalysis.cpp \
|
||||
analysis/exceptiondirectoryanalysis.cpp \
|
||||
analysis/FunctionPass.cpp \
|
||||
analysis/linearanalysis.cpp \
|
||||
analysis/LinearPass.cpp \
|
||||
analysis/recursiveanalysis.cpp \
|
||||
analysis/xrefsanalysis.cpp
|
||||
|
||||
TRANSLATIONS += \
|
||||
../gui/Translations/x64dbg_dbg.ts
|
@ -663,3 +663,19 @@ __declspec(dllexport) void* _gui_sendmessage(GUIMSG type, void* param1, void* pa
|
||||
{
|
||||
return Bridge::getBridge()->processMessage(type, param1, param2);
|
||||
}
|
||||
|
||||
static char translateBuffer[4096] = {0};
|
||||
|
||||
__declspec(dllexport) const char* _gui_translate_dbg(const char* source)
|
||||
{
|
||||
if(translationsReady)
|
||||
{
|
||||
QByteArray translatedUtf8 = QCoreApplication::translate("DBG", source).toUtf8();
|
||||
translateBuffer[translatedUtf8.size()] = 0; // Set the string terminator first.
|
||||
memcpy(translateBuffer, translatedUtf8.constData(), std::min((size_t)translatedUtf8.size(), sizeof(translateBuffer) - 1)); // Then copy the string safely.
|
||||
return translateBuffer; // Don't need to free this memory. But this pointer should be used immediately to reduce race condition.
|
||||
//Use a thread-local buffer is probably better.
|
||||
}
|
||||
else // Translators are not initialized yet.
|
||||
return source;
|
||||
}
|
||||
|
@ -10,7 +10,8 @@
|
||||
#ifdef BUILD_LIB
|
||||
extern "C" __declspec(dllexport) int _gui_guiinit(int argc, char* argv[]);
|
||||
extern "C" __declspec(dllexport) void* _gui_sendmessage(GUIMSG type, void* param1, void* param2);
|
||||
extern "C" __declspec(dllexport) const char* _gui_translate_dbg(const char* source);
|
||||
#endif
|
||||
|
||||
|
||||
#endif // EXPORTS_H
|
||||
#endif // EXPORTS_Hb
|
||||
|
@ -51,6 +51,7 @@ bool MyApplication::notify(QObject* receiver, QEvent* event)
|
||||
|
||||
static Configuration* mConfiguration;
|
||||
char currentLocale[MAX_SETTING_SIZE] = "";
|
||||
bool translationsReady = false;
|
||||
|
||||
static bool isValidLocale(const QString & locale)
|
||||
{
|
||||
@ -100,6 +101,12 @@ int main(int argc, char* argv[])
|
||||
if(x64dbgTranslator.load(QString("x64dbg_%1").arg(currentLocale), path))
|
||||
application.installTranslator(&x64dbgTranslator);
|
||||
|
||||
QTranslator x64dbg_dbg_Translator;
|
||||
if(x64dbg_dbg_Translator.load(QString("x64dbg_dbg_%1").arg(currentLocale), path))
|
||||
application.installTranslator(&x64dbg_dbg_Translator);
|
||||
|
||||
translationsReady = true;
|
||||
|
||||
// initialize capstone
|
||||
Capstone::GlobalInitialize();
|
||||
|
||||
|
@ -22,6 +22,7 @@ public:
|
||||
|
||||
int main(int argc, char* argv[]);
|
||||
extern char currentLocale[MAX_SETTING_SIZE];
|
||||
extern bool translationsReady;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
class x64GlobalFilter : public QAbstractNativeEventFilter
|
||||
|
Loading…
Reference in New Issue
Block a user