1
0
Fork 0

DBG+BRIDGE+GUI: nastry hack to force-flush the log on user commands

This commit is contained in:
mrexodia 2017-03-18 16:45:33 +01:00
parent 0a8091bc85
commit e58bc13526
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
9 changed files with 23 additions and 1 deletions

View File

@ -1599,6 +1599,11 @@ BRIDGE_IMPEXP void GuiCloseApplication()
_gui_sendmessage(GUI_CLOSE_APPLICATION, nullptr, nullptr);
}
BRIDGE_IMPEXP void GuiFlushLog()
{
_gui_sendmessage(GUI_FLUSH_LOG, nullptr, nullptr);
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
hInst = hinstDLL;

View File

@ -997,6 +997,7 @@ typedef enum
GUI_MENU_SET_ENTRY_VISIBLE, // param1=int hEntry, param2=bool visible
GUI_MENU_SET_NAME, // param1=int hMenu, param2=const char* name
GUI_MENU_SET_ENTRY_NAME, // param1=int hEntry, param2=const char* name
GUI_FLUSH_LOG, // param1=unused, param2=unused
} GUIMSG;
//GUI Typedefs
@ -1164,6 +1165,7 @@ BRIDGE_IMPEXP void* GuiTypeAddNode(void* parent, const TYPEDESCRIPTOR* type);
BRIDGE_IMPEXP bool GuiTypeClear();
BRIDGE_IMPEXP void GuiUpdateTypeWidget();
BRIDGE_IMPEXP void GuiCloseApplication();
BRIDGE_IMPEXP void GuiFlushLog();
#ifdef __cplusplus
}

View File

@ -469,3 +469,9 @@ bool cbInstrFocusinfo(int argc, char* argv[])
dprintf("activeTitle: %s, activeClass: %s\n", activeView.title, activeView.className);
return true;
}
bool cbInstrFlushlog(int argc, char* argv[])
{
GuiFlushLog();
return true;
}

View File

@ -11,4 +11,5 @@ bool cbInstrCapstone(int argc, char* argv[]);
bool cbInstrVisualize(int argc, char* argv[]);
bool cbInstrMeminfo(int argc, char* argv[]);
bool cbInstrBriefcheck(int argc, char* argv[]);
bool cbInstrFocusinfo(int argc, char* argv[]);
bool cbInstrFocusinfo(int argc, char* argv[]);
bool cbInstrFlushlog(int argc, char* argv[]);

View File

@ -430,6 +430,7 @@ static void registercommands()
dbgcmdnew("briefcheck", cbInstrBriefcheck, true); //check if mnemonic briefs are missing
dbgcmdnew("focusinfo", cbInstrFocusinfo, false);
dbgcmdnew("printstack,logstack", cbInstrPrintStack, true); //print the call stack
dbgcmdnew("flushlog", cbInstrFlushlog, false); //flush the log
};
bool cbCommandProvider(char* cmd, int maxlen)

View File

@ -778,6 +778,10 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
case GUI_CLOSE_APPLICATION:
emit closeApplication();
break;
case GUI_FLUSH_LOG:
emit flushLog();
break;
}
return nullptr;

View File

@ -151,6 +151,7 @@ signals:
void typeClear();
void typeUpdateWidget();
void closeApplication();
void flushLog();
private:
QMutex* mBridgeMutex;

View File

@ -116,6 +116,7 @@ void CommandLineEdit::execute()
{
// Send this string directly to the user
exec(cmd.toUtf8().constData());
DbgCmdExec("flushlog");
}
// Add this line to the history and clear text, regardless if it was executed

View File

@ -31,6 +31,7 @@ LogView::LogView(QWidget* parent) : QTextBrowser(parent), logRedirection(NULL)
connect(Bridge::getBridge(), SIGNAL(addMsgToLog(QByteArray)), this, SLOT(addMsgToLogSlot(QByteArray)));
connect(Bridge::getBridge(), SIGNAL(clearLog()), this, SLOT(clearLogSlot()));
connect(Bridge::getBridge(), SIGNAL(setLogEnabled(bool)), this, SLOT(setLoggingEnabled(bool)));
connect(Bridge::getBridge(), SIGNAL(flushLog()), this, SLOT(flushTimerSlot()));
connect(this, SIGNAL(anchorClicked(QUrl)), this, SLOT(onAnchorClicked(QUrl)));
duint setting;