1
0
Fork 0

GUI: resolved issue #94 + re-enabled autocomments + fixed spelling mistake

This commit is contained in:
Mr. eXoDia 2014-06-24 00:16:41 +02:00
parent 2cb45f1d7a
commit 5f23a25f95
5 changed files with 38 additions and 13 deletions

View File

@ -702,6 +702,13 @@ BRIDGE_IMPEXP void DbgClearAutoFunctionRange(duint start, duint end)
_dbg_sendmessage(DBG_DELETE_AUTO_FUNCTION_RANGE, (void*)start, (void*)end);
}
BRIDGE_IMPEXP bool DbgGetStringAt(duint addr, char* text)
{
if(_dbg_sendmessage(DBG_GET_STRING_AT, (void*)addr, text))
return true;
return false;
}
//GUI
BRIDGE_IMPEXP void GuiDisasmAt(duint addr, duint cip)
{

View File

@ -53,6 +53,7 @@ BRIDGE_IMPEXP int BridgeGetDbgVersion();
#define MAX_BREAKPOINT_SIZE 256
#define MAX_SCRIPT_LINE_SIZE 2048
#define MAX_THREAD_NAME_SIZE 256
#define MAX_STRING_SIZE 512
#define TYPE_VALUE 1
#define TYPE_MEMORY 2
@ -155,6 +156,7 @@ enum DBGMSG
DBG_DELETE_AUTO_BOOKMARK_RANGE, // param1=duint start, param2=duint end
DBG_SET_AUTO_FUNCTION_AT, // param1=duint addr, param2=const char* text
DBG_DELETE_AUTO_FUNCTION_RANGE, // param1=duint start, param2=duint end
DBG_GET_STRING_AT // param1=duint addr, param2=unused
};
enum SCRIPTLINETYPE
@ -548,6 +550,7 @@ BRIDGE_IMPEXP bool DbgSetAutoBookmarkAt(duint addr);
BRIDGE_IMPEXP void DbgClearAutoBookmarkRange(duint start, duint end);
BRIDGE_IMPEXP bool DbgSetAutoFunctionAt(duint start, duint end);
BRIDGE_IMPEXP void DbgClearAutoFunctionRange(duint start, duint end);
BRIDGE_IMPEXP bool DbgGetStringAt(duint addr, char* text);
//Gui defines
#define GUI_PLUGIN_MENU 0

View File

@ -289,7 +289,6 @@ extern "C" DLL_EXPORT bool _dbg_addrinfoget(duint addr, SEGMENTREG segment, ADDR
}
else //no line number
{
/*
DISASM_INSTR instr;
std::string temp_string;
ADDRINFO newinfo;
@ -398,7 +397,6 @@ extern "C" DLL_EXPORT bool _dbg_addrinfoget(duint addr, SEGMENTREG segment, ADDR
retval=true;
}
}
*/
}
}
}
@ -982,7 +980,22 @@ extern "C" DLL_EXPORT uint _dbg_sendmessage(DBGMSG type, void* param1, void* par
functiondelrange((uint)param1, (uint)param2);
}
break;
case DBG_GET_STRING_AT:
{
STRING_TYPE strtype;
char string[512]="";
if(disasmgetstringat((uint)param1, &strtype, string, string, 500))
{
if(strtype==str_ascii)
sprintf((char*)param2, "\"%s\"", string);
else //unicode
sprintf((char*)param2, "L\"%s\"", string);
return true;
}
return false;
}
break;
}
return 0;
}

View File

@ -1095,7 +1095,7 @@ CMDRESULT cbDebugInit(int argc, char* argv[])
return STATUS_ERROR;
if(!FileExists(arg1))
{
dputs("file does not exsist!");
dputs("file does not exist!");
return STATUS_ERROR;
}
HANDLE hFile=CreateFileA(arg1, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);

View File

@ -436,6 +436,8 @@ void RegistersView::drawRegister(QPainter *p,REGISTER_NAME reg, uint_t value)
// do we have a label ?
char label_text[MAX_LABEL_SIZE]="";
char module_text[MAX_MODULE_SIZE]="";
char string_text[MAX_STRING_SIZE]="";
bool hasString=DbgGetStringAt(value, string_text);
bool hasLabel=DbgGetLabelAt(value, SEG_DEFAULT, label_text);
bool hasModule=DbgGetModuleAt(value, module_text);
bool isCharacter=false;
@ -443,7 +445,11 @@ void RegistersView::drawRegister(QPainter *p,REGISTER_NAME reg, uint_t value)
x += valueText.length() * mCharWidth;
x += 5 * mCharWidth; //5 spaces
QString newText = "";
if(hasLabel && hasModule)
if(hasString)
{
newText=string_text;
}
else if(hasLabel && hasModule)
{
newText="<"+QString(module_text)+"."+QString(label_text)+">";
}
@ -451,7 +457,7 @@ void RegistersView::drawRegister(QPainter *p,REGISTER_NAME reg, uint_t value)
{
newText=QString(module_text)+"."+valueText;
}
else if(hasLabel )
else if(hasLabel)
{
newText="<"+QString(label_text)+">";
}
@ -481,7 +487,7 @@ void RegistersView::drawRegister(QPainter *p,REGISTER_NAME reg, uint_t value)
}
}
// are there additional informations?
if(hasLabel || hasModule || isCharacter)
if(hasString || hasLabel || hasModule || isCharacter)
{
width = newText.length() * mCharWidth;
p->setPen(ConfigColor("RegistersExtraInfoColor"));
@ -613,17 +619,13 @@ void RegistersView::displayCustomContextMenuSlot(QPoint pos)
if(DbgMemIsValidReadPtr(addr))
{
wMenu.addAction(wCM_FollowInDump);
//wMenu.addAction(wCM_FollowInDisassembly);
wMenu.addAction(wCM_FollowInDisassembly);
}
}
wMenu.addAction(wCM_CopyToClipboard);
wMenu.exec(this->mapToGlobal(pos));
}
else if(DbgIsDebugging())
else
{
wMenu.addSeparator();
#ifdef _WIN64