1
0
Fork 0
* issue 858

* don't pass selection length to the plugin
This commit is contained in:
Torusrxxx 2016-10-18 15:26:19 +00:00 committed by Duncan Ogilvie
parent 27140adfec
commit d0c755e3f8
9 changed files with 64 additions and 5 deletions

View File

@ -989,6 +989,11 @@ BRIDGE_IMPEXP void DbgDelEncodeTypeSegment(duint start)
_dbg_sendmessage(DBG_DELETE_ENCODE_TYPE_SEG, (void*)start, 0);
}
BRIDGE_IMPEXP void DbgSelChanged(int hWindow, duint VA)
{
_dbg_sendmessage(DBG_SELCHANGED, (void*)hWindow, (void*)VA);
}
BRIDGE_IMPEXP const char* GuiTranslateText(const char* Source)
{
EnterCriticalSection(&csTranslate);
@ -1509,6 +1514,11 @@ BRIDGE_IMPEXP void GuiGetActiveView(ACTIVEVIEW* activeView)
_gui_sendmessage(GUI_GET_ACTIVE_VIEW, activeView, nullptr);
}
BRIDGE_IMPEXP void GuiAddInfoLine(const char* infoLine)
{
_gui_sendmessage(GUI_ADD_INFO_LINE, (void*)infoLine, nullptr);
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
hInst = hinstDLL;

View File

@ -228,7 +228,8 @@ typedef enum
DBG_ARGUMENT_OVERLAPS, // param1=FUNCTION* info, param2=unused
DBG_ARGUMENT_ADD, // param1=FUNCTION* info, param2=unused
DBG_ARGUMENT_DEL, // param1=FUNCTION* info, param2=unused
DBG_GET_WATCH_LIST // param1=ListOf(WATCHINFO), param2=unused
DBG_GET_WATCH_LIST, // param1=ListOf(WATCHINFO), param2=unused
DBG_SELCHANGED // param1=hWindow, param2=VA
} DBGMSG;
typedef enum
@ -858,6 +859,7 @@ BRIDGE_IMPEXP bool DbgSetEncodeType(duint addr, duint size, ENCODETYPE type);
BRIDGE_IMPEXP void DbgDelEncodeTypeRange(duint start, duint end);
BRIDGE_IMPEXP void DbgDelEncodeTypeSegment(duint start);
BRIDGE_IMPEXP bool DbgGetWatchList(ListOf(WATCHINFO) list);
BRIDGE_IMPEXP void DbgSelChanged(int hWindow, duint VA);
//Gui defines
#define GUI_PLUGIN_MENU 0
@ -967,7 +969,8 @@ typedef enum
GUI_FOLD_DISASSEMBLY, // param1=duint startAddress param2=duint length
GUI_SELECT_IN_MEMORY_MAP, // param1=duint addr, param2=unused
GUI_GET_ACTIVE_VIEW, // param1=ACTIVEVIEW*, param2=unused
GUI_MENU_SET_ENTRY_CHECKED // param1=int hEntry, param2=bool checked
GUI_MENU_SET_ENTRY_CHECKED, // param1=int hEntry, param2=bool checked
GUI_ADD_INFO_LINE // param1=const char* infoline, param2=unused
} GUIMSG;
//GUI Typedefs
@ -1109,6 +1112,7 @@ BRIDGE_IMPEXP void GuiSetFavouriteToolShortcut(const char* name, const char* sho
BRIDGE_IMPEXP void GuiFoldDisassembly(duint startAddress, duint length);
BRIDGE_IMPEXP void GuiSelectInMemoryMap(duint addr);
BRIDGE_IMPEXP void GuiGetActiveView(ACTIVEVIEW* activeView);
BRIDGE_IMPEXP void GuiAddInfoLine(const char* infoLine);
#ifdef __cplusplus
}

View File

@ -32,6 +32,7 @@
#include "argument.h"
#include "watch.h"
#include "animate.h"
#include "TraceRecord.h"
static bool bOnlyCipAutoComments = false;
static duint cacheCflags = 0;
@ -1272,6 +1273,15 @@ extern "C" DLL_EXPORT duint _dbg_sendmessage(DBGMSG type, void* param1, void* pa
}
break;
case DBG_SELCHANGED:
{
PLUG_CB_SELCHANGED plugSelChanged;
plugSelChanged.hWindow = (int)param1;
plugSelChanged.VA = (duint)param2;
plugincbcall(CB_SELCHANGED, &plugSelChanged);
}
break;
}
return 0;
}

View File

@ -188,6 +188,12 @@ typedef struct
bool stop;
} PLUG_CB_TRACEEXECUTE;
typedef struct
{
int hWindow;
duint VA;
} PLUG_CB_SELCHANGED;
//enums
typedef enum
{
@ -216,6 +222,7 @@ typedef enum
CB_SAVEDB, //PLUG_CB_LOADSAVEDB
CB_FILTERSYMBOL, //PLUG_CB_FILTERSYMBOL
CB_TRACEEXECUTE, //PLUG_CB_TRACEEXECUTE
CB_SELCHANGED, //PLUG_CB_SELCHANGED
CB_LAST
} CBTYPE;

View File

@ -681,6 +681,15 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
}
}
break;
case GUI_ADD_INFO_LINE:
{
if(param1)
{
emit addInfoLine(QString((const char*)param1));
}
}
break;
}
return nullptr;

View File

@ -140,6 +140,7 @@ signals:
void foldDisassembly(duint startAddr, duint length);
void selectInMemoryMap(duint addr);
void getActiveView(ACTIVEVIEW* activeView);
void addInfoLine(const QString & text);
private:
QMutex* mBridgeMutex;

View File

@ -17,9 +17,9 @@ CPUInfoBox::CPUInfoBox(StdTable* parent) : StdTable(parent)
horizontalScrollBar()->setStyleSheet(ConfigHScrollBarStyle());
int height = getHeight();
setMaximumHeight(height);
setMinimumHeight(height);
connect(Bridge::getBridge(), SIGNAL(dbgStateChanged(DBGSTATE)), this, SLOT(dbgStateChanged(DBGSTATE)));
connect(Bridge::getBridge(), SIGNAL(addInfoLine(QString)), this, SLOT(addInfoLine(QString)));
connect(this, SIGNAL(contextMenuSignal(QPoint)), this, SLOT(contextMenuSlot(QPoint)));
connect(this, SIGNAL(doubleClickedSignal()), this, SLOT(doubleClickedSlot()));
curAddr = 0;
@ -59,9 +59,18 @@ QString CPUInfoBox::getInfoLine(int line)
return getCellContent(line, 0);
}
void CPUInfoBox::addInfoLine(const QString & infoLine)
{
auto rowCount = getRowCount();
setRowCount(rowCount + 1);
setCellContent(rowCount, 0, infoLine);
reloadData();
}
void CPUInfoBox::clear()
{
// Set all 3 lines to empty strings
setRowCount(3);
setInfoLine(0, "");
setInfoLine(1, "");
setInfoLine(2, "");
@ -137,6 +146,7 @@ void CPUInfoBox::disasmSelectionChanged(dsint parVA)
return;
// Rather than using clear() or setInfoLine(), only reset the first two cells to reduce flicker
setRowCount(3);
setCellContent(0, 0, "");
setCellContent(1, 0, "");
@ -232,7 +242,7 @@ void CPUInfoBox::disasmSelectionChanged(dsint parVA)
// Set last line
//
// Format: SECTION:VA MODULE:$RVA :#FILE_OFFSET FUNCTION
// Format: SECTION:VA MODULE:$RVA :#FILE_OFFSET FUNCTION,Accessed %u times
QString info;
// Section
@ -273,7 +283,15 @@ void CPUInfoBox::disasmSelectionChanged(dsint parVA)
info += QString("<%1+%2>").arg(label).arg(ToHexString(parVA - start));
}
auto tracedCount = DbgFunctions()->GetTraceRecordHitCount(parVA);
if(tracedCount != 0)
{
info += " , " + tr("Accessed %n time(s)", nullptr, tracedCount);
}
setInfoLine(2, info);
DbgSelChanged(GUI_DISASSEMBLY, parVA);
}
void CPUInfoBox::dbgStateChanged(DBGSTATE state)

View File

@ -24,6 +24,7 @@ public slots:
void copyRva();
void copyOffset();
void doubleClickedSlot();
void addInfoLine(const QString & infoLine);
private:
dsint curAddr;

View File

@ -45,7 +45,6 @@ CPUWidget::CPUWidget(QWidget* parent) : QWidget(parent), ui(new Ui::CPUWidget)
ui->mTopLeftLowerFrameLayout->addWidget(mInfo);
int height = mInfo->getHeight();
ui->mTopLeftLowerFrame->setMinimumHeight(height + 2);
ui->mTopLeftLowerFrame->setMaximumHeight(height + 2);
connect(mDisas, SIGNAL(selectionChanged(dsint)), mInfo, SLOT(disasmSelectionChanged(dsint)));