first draft of the script window
This commit is contained in:
parent
346dafc46c
commit
1a33da40af
|
@ -9,6 +9,11 @@ static char szDumpPath[MAX_PATH]="";
|
|||
|
||||
static LONG WINAPI UnhandledException(EXCEPTION_POINTERS* pExceptionPointers)
|
||||
{
|
||||
unsigned int ExceptionCode=pExceptionPointers->ExceptionRecord->ExceptionCode;
|
||||
|
||||
if(ExceptionCode==0x40010006)
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
|
||||
char szFileName[MAX_PATH];
|
||||
#ifdef _WIN64
|
||||
const char* szAppName = "x64_dbg";
|
||||
|
@ -39,15 +44,13 @@ static LONG WINAPI UnhandledException(EXCEPTION_POINTERS* pExceptionPointers)
|
|||
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
|
||||
hDumpFile, MiniDumpWithDataSegs, &ExpParam, NULL, NULL);
|
||||
|
||||
char szMessage[256]="";
|
||||
|
||||
unsigned int ExceptionCode=pExceptionPointers->ExceptionRecord->ExceptionCode;
|
||||
/*char szMessage[256]="";
|
||||
|
||||
sprintf(szMessage, "Exception code: 0x%.8X\n\nCrash dump written to:\n%s", ExceptionCode, szFileName);
|
||||
|
||||
MessageBoxA(0, szMessage, "Fatal Exception!", MB_ICONERROR|MB_SYSTEMMODAL);
|
||||
|
||||
ExitProcess(ExceptionCode);
|
||||
ExitProcess(ExceptionCode);*/
|
||||
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
|
@ -66,7 +69,7 @@ extern "C" __declspec(dllexport) BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD
|
|||
if(len)
|
||||
szDumpPath[len]=0;
|
||||
strcat(szDumpPath, "\\crashdumps");
|
||||
AddVectoredExceptionHandler(1, UnhandledException);
|
||||
AddVectoredExceptionHandler(0, UnhandledException);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -218,7 +218,7 @@ BOOL CALLBACK SymRegisterCallbackProc64(HANDLE hProcess, ULONG ActionCode, ULONG
|
|||
{
|
||||
case CBA_EVENT:
|
||||
evt=(PIMAGEHLP_CBA_EVENT)CallbackData;
|
||||
printf("%s", (PTSTR)evt->desc);
|
||||
dprintf("%s", (PTSTR)evt->desc);
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
|
@ -358,14 +358,13 @@ static void cbCreateProcess(CREATE_PROCESS_DEBUG_INFO* CreateProcessInfo)
|
|||
sprintf(dbpath, "%s\\%s", sqlitedb_basedir, sqlitedb);
|
||||
dprintf("Database file: %s\n", dbpath);
|
||||
dbinit();
|
||||
|
||||
//SymSetOptions(SYMOPT_DEBUG|SYMOPT_LOAD_LINES);
|
||||
SymSetOptions(SYMOPT_DEBUG|SYMOPT_LOAD_LINES);
|
||||
SymInitialize(fdProcessInfo->hProcess, 0, false); //initialize symbols
|
||||
//SymRegisterCallback64(fdProcessInfo->hProcess, SymRegisterCallbackProc64, 0);
|
||||
SymRegisterCallback64(fdProcessInfo->hProcess, SymRegisterCallbackProc64, 0);
|
||||
SymLoadModuleEx(fdProcessInfo->hProcess, CreateProcessInfo->hFile, DebugFileName, 0, (DWORD64)base, 0, 0, 0);
|
||||
IMAGEHLP_MODULE64 modInfo;
|
||||
memset(&modInfo, 0, sizeof(modInfo));
|
||||
modInfo.SizeOfStruct=sizeof(IMAGEHLP_MODULE64);
|
||||
modInfo.SizeOfStruct=sizeof(modInfo);
|
||||
if(SymGetModuleInfo64(fdProcessInfo->hProcess, (DWORD64)base, &modInfo))
|
||||
modload((uint)base, modInfo.ImageSize, modInfo.ImageName);
|
||||
bpenumall(0); //update breakpoint list
|
||||
|
|
|
@ -51,7 +51,8 @@ SOURCES += \
|
|||
Src/Gui/BreakpointsView.cpp \
|
||||
Src/Utils/Breakpoints.cpp \
|
||||
Src/BasicView/InfoBox.cpp \
|
||||
Src/Gui/CPUDump.cpp
|
||||
Src/Gui/CPUDump.cpp \
|
||||
Src/BasicView/ScriptView.cpp
|
||||
|
||||
|
||||
HEADERS += \
|
||||
|
@ -83,7 +84,8 @@ HEADERS += \
|
|||
Src/Gui/BreakpointsView.h \
|
||||
Src/Utils/Breakpoints.h \
|
||||
Src/BasicView/InfoBox.h \
|
||||
Src/Gui/CPUDump.h
|
||||
Src/Gui/CPUDump.h \
|
||||
Src/BasicView/ScriptView.h
|
||||
|
||||
INCLUDEPATH += \
|
||||
Src \
|
||||
|
|
|
@ -110,7 +110,7 @@ QString Disassembly::paintContent(QPainter* painter, int_t rowBase, int rowOffse
|
|||
|
||||
// Highlight if selected
|
||||
if(wIsSelected)
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(QColor(192,192,192)));
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(QColor("#C0C0C0")));
|
||||
|
||||
switch(col)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
#include "ScriptView.h"
|
||||
|
||||
ScriptView::ScriptView(StdTable *parent) : StdTable(parent)
|
||||
{
|
||||
enableMultiSelection(false);
|
||||
|
||||
int charwidth=QFontMetrics(this->font()).width(QChar(' '));
|
||||
|
||||
addColumnAt(8+charwidth*4, "Line", false);
|
||||
addColumnAt(8+charwidth*60, "Text", false);
|
||||
addColumnAt(8+charwidth*40, "Info", false);
|
||||
|
||||
const char* sample_script[5]={"var test,123", "mov test,$pid", "mov eax,pid", "estep", "mov test,eax"};
|
||||
|
||||
setRowCount(5);
|
||||
|
||||
for(int i=0; i<5; i++)
|
||||
{
|
||||
setCellContent(i, 1, sample_script[i]);
|
||||
}
|
||||
}
|
||||
|
||||
QString ScriptView::paintContent(QPainter* painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h)
|
||||
{
|
||||
bool wIsSelected=isSelected(rowBase, rowOffset);
|
||||
// Highlight if selected
|
||||
if(wIsSelected)
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(QColor("#C0C0C0")));
|
||||
QString returnString;
|
||||
switch(col)
|
||||
{
|
||||
case 0: //line number
|
||||
{
|
||||
int line=rowOffset+1;
|
||||
returnString=returnString.sprintf("%.4d", line);
|
||||
painter->save();
|
||||
if(line==3)
|
||||
{
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(QColor("#000000")));
|
||||
painter->setPen(QPen(QColor("#FFFFFF"))); //black address
|
||||
}
|
||||
else
|
||||
{
|
||||
if(wIsSelected)
|
||||
painter->setPen(QPen(QColor("#000000"))); //black address
|
||||
else
|
||||
painter->setPen(QPen(QColor("#808080")));
|
||||
}
|
||||
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, returnString);
|
||||
painter->restore();
|
||||
returnString="";
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: //command
|
||||
{
|
||||
returnString=getCellContent(rowOffset, col);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: //info
|
||||
{
|
||||
returnString=getCellContent(rowOffset, col);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return returnString;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef SCRIPTVIEW_H
|
||||
#define SCRIPTVIEW_H
|
||||
|
||||
#include <QtGui>
|
||||
#include "StdTable.h"
|
||||
#include "Bridge.h"
|
||||
|
||||
class ScriptView : public StdTable
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ScriptView(StdTable *parent = 0);
|
||||
// Reimplemented Functions
|
||||
QString paintContent(QPainter* painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h);
|
||||
};
|
||||
|
||||
#endif // SCRIPTVIEW_H
|
|
@ -24,21 +24,13 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||
//Accept drops
|
||||
setAcceptDrops(true);
|
||||
|
||||
// Memory Map View
|
||||
mMemMapView = new QMdiSubWindow();
|
||||
mMemMapView->setWindowTitle("Memory Map");
|
||||
mMemMapView->setWidget(new MemoryMapView());
|
||||
mMemMapView->setWindowIcon(QIcon(":/icons/images/memory-map.png"));
|
||||
mMemMapView->hide();
|
||||
mMemMapView->setGeometry(10, 10, 625, 500);
|
||||
|
||||
// Log View
|
||||
mLogView = new QMdiSubWindow();
|
||||
mLogView->setWindowTitle("Log");
|
||||
mLogView->setWidget(new LogView());
|
||||
mLogView->setWindowIcon(QIcon(":/icons/images/alphabet/L.png"));
|
||||
mLogView->hide();
|
||||
mLogView->setGeometry(20, 20, 800, 300);
|
||||
mLogView->setGeometry(10, 10, 800, 300);
|
||||
|
||||
// Breakpoints
|
||||
mBreakpointsView = new QMdiSubWindow();
|
||||
|
@ -48,6 +40,22 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||
mBreakpointsView->hide();
|
||||
mBreakpointsView->setGeometry(20, 20, 800, 300);
|
||||
|
||||
// Memory Map View
|
||||
mMemMapView = new QMdiSubWindow();
|
||||
mMemMapView->setWindowTitle("Memory Map");
|
||||
mMemMapView->setWidget(new MemoryMapView());
|
||||
mMemMapView->setWindowIcon(QIcon(":/icons/images/memory-map.png"));
|
||||
mMemMapView->hide();
|
||||
mMemMapView->setGeometry(30, 30, 625, 500);
|
||||
|
||||
// Script view
|
||||
mScriptView = new QMdiSubWindow();
|
||||
mScriptView->setWindowTitle("Script");
|
||||
mScriptView->setWidget(new ScriptView());
|
||||
mScriptView->setWindowIcon(QIcon(":/icons/images/script-code.png"));
|
||||
mScriptView->hide();
|
||||
mScriptView->setGeometry(40, 40, 625, 500);
|
||||
|
||||
mdiArea = new QMdiArea;
|
||||
mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
|
@ -64,9 +72,11 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||
|
||||
//Add subWindow to Main QMdiArea here
|
||||
mdiArea->addSubWindow(mSubWindow);
|
||||
mdiArea->addSubWindow(mMemMapView);
|
||||
mdiArea->addSubWindow(mLogView);
|
||||
mdiArea->addSubWindow(mBreakpointsView);
|
||||
mdiArea->addSubWindow(mMemMapView);
|
||||
mdiArea->addSubWindow(mScriptView);
|
||||
|
||||
|
||||
setCentralWidget(mdiArea);
|
||||
|
||||
|
@ -103,6 +113,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||
connect(ui->actioneStepInto,SIGNAL(triggered()),this,SLOT(execeStepInto()));
|
||||
connect(ui->actioneRun,SIGNAL(triggered()),this,SLOT(execeRun()));
|
||||
connect(ui->actioneRtr,SIGNAL(triggered()),this,SLOT(execeRtr()));
|
||||
connect(ui->actionScript,SIGNAL(triggered()),this,SLOT(displayScriptWidget()));
|
||||
|
||||
connect(Bridge::getBridge(), SIGNAL(updateWindowTitle(QString)), this, SLOT(updateWindowTitleSlot(QString)));
|
||||
connect(Bridge::getBridge(), SIGNAL(updateCPUTitle(QString)), this, SLOT(updateCPUTitleSlot(QString)));
|
||||
|
@ -177,6 +188,12 @@ void MainWindow::displayLogWidget()
|
|||
mLogView->setFocus();
|
||||
}
|
||||
|
||||
void MainWindow::displayScriptWidget()
|
||||
{
|
||||
mScriptView->widget()->show();
|
||||
mScriptView->setFocus();
|
||||
}
|
||||
|
||||
void MainWindow::displayAboutWidget()
|
||||
{
|
||||
#ifdef _WIN64
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "GotoDialog.h"
|
||||
#include "StatusLabel.h"
|
||||
#include "BreakpointsView.h"
|
||||
#include "ScriptView.h"
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
|
@ -33,6 +34,7 @@ public slots:
|
|||
void setFocusToCommandBar();
|
||||
void displayMemMapWidget();
|
||||
void displayLogWidget();
|
||||
void displayScriptWidget();
|
||||
void displayAboutWidget();
|
||||
void execClose();
|
||||
void execRun();
|
||||
|
@ -63,6 +65,7 @@ private:
|
|||
QMdiSubWindow* mMemMapView;
|
||||
QMdiSubWindow* mLogView;
|
||||
QMdiSubWindow* mBreakpointsView;
|
||||
QMdiSubWindow* mScriptView;
|
||||
|
||||
StatusLabel* mStatusLabel;
|
||||
StatusLabel* mLastLogLabel;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
<addaction name="actionMemoryMap"/>
|
||||
<addaction name="actionLog"/>
|
||||
<addaction name="actionBreakpoints"/>
|
||||
<addaction name="actionScript"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuDebug">
|
||||
<property name="title">
|
||||
|
@ -108,6 +109,7 @@
|
|||
<addaction name="actionLog"/>
|
||||
<addaction name="actionBreakpoints"/>
|
||||
<addaction name="actionMemoryMap"/>
|
||||
<addaction name="actionScript"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionScylla"/>
|
||||
</widget>
|
||||
|
@ -366,6 +368,21 @@
|
|||
<string>Ctrl+Shift+F9</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionScript">
|
||||
<property name="icon">
|
||||
<iconset resource="../../resource.qrc">
|
||||
<normaloff>:/icons/images/script-code.png</normaloff>:/icons/images/script-code.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Script</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Script</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Alt+S</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 568 B |
|
@ -21,5 +21,6 @@
|
|||
<file>images/alphabet/B.png</file>
|
||||
<file>images/compile-warning.png</file>
|
||||
<file>images/compile.png</file>
|
||||
<file>images/script-code.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Loading…
Reference in New Issue