1
0
Fork 0

GUI: resolved issue #28

DBG: disabled auto-comments (too slow)
GUI: added SymbolView (dummy)
This commit is contained in:
mr.exodia 2014-02-17 21:37:49 +01:00
parent 97e42eddb3
commit b393a8b24e
15 changed files with 324 additions and 8 deletions

View File

@ -146,7 +146,7 @@ extern "C" DLL_EXPORT bool _dbg_addrinfoget(duint addr, SEGMENTREG segment, ADDR
sprintf(addrinfo->comment, "%s:%u", filename+len, line.LineNumber);
retval=true;
}
else //no line number
/*else //no line number
{
DISASM_INSTR instr;
disasmget(addr, &instr);
@ -208,7 +208,7 @@ extern "C" DLL_EXPORT bool _dbg_addrinfoget(duint addr, SEGMENTREG segment, ADDR
retval=true;
}
}
}
}*/
}
}
if(addrinfo->flags&flagbookmark)

View File

@ -32,6 +32,15 @@ static CMDRESULT cbCls(int argc, char* argv[])
return STATUS_CONTINUE;
}
static CMDRESULT cbPrintf(int argc, char* argv[])
{
if(argc<2)
dprintf("\n");
else
dprintf("%s", argv[1]);
return STATUS_CONTINUE;
}
static void registercommands()
{
COMMAND* cmd=command_list=cmdinit();
@ -129,6 +138,7 @@ static void registercommands()
cmdnew(cmd, "asm", cbAssemble, true); //assemble instruction
cmdnew(cmd, "dump", cbDebugDump, true); //dump at address
cmdnew(cmd, "printf", cbPrintf, false); //printf
}
static bool cbCommandProvider(char* cmd, int maxlen)

View File

@ -53,7 +53,8 @@ SOURCES += \
Src/BasicView/InfoBox.cpp \
Src/Gui/CPUDump.cpp \
Src/BasicView/ScriptView.cpp \
Src/Gui/CPUStack.cpp
Src/Gui/CPUStack.cpp \
Src/BasicView/SymbolView.cpp
HEADERS += \
@ -87,7 +88,8 @@ HEADERS += \
Src/BasicView/InfoBox.h \
Src/Gui/CPUDump.h \
Src/BasicView/ScriptView.h \
Src/Gui/CPUStack.h
Src/Gui/CPUStack.h \
Src/BasicView/SymbolView.h
INCLUDEPATH += \
Src \
@ -107,7 +109,8 @@ FORMS += \
Src/Gui/CPUWidget.ui \
Src/Gui/GotoDialog.ui \
Src/BasicView/WordEditDialog.ui \
Src/BasicView/LineEditDialog.ui
Src/BasicView/LineEditDialog.ui \
Src/BasicView/SymbolView.ui
INCLUDEPATH += $$PWD/Src/Bridge

View File

@ -0,0 +1,64 @@
#include "SymbolView.h"
#include "ui_SymbolView.h"
SymbolView::SymbolView(QWidget *parent) :
QWidget(parent),
ui(new Ui::SymbolView)
{
ui->setupUi(this);
mainLayout = new QVBoxLayout;
mainLayout->addWidget(ui->mainSplitter);
setLayout(mainLayout);
QFont wFont("Monospace", 8);
wFont.setStyleHint(QFont::Monospace);
wFont.setFixedPitch(true);
mModuleList = new StdTable();
mModuleList->addColumnAt(0, "", false);
mModuleList->setShowHeader(false); //hide header
mModuleList->enableMultiSelection(false);
int charwidth=QFontMetrics(wFont).width(QChar(' '));
mSymbolList = new StdTable();
mSymbolList->addColumnAt(charwidth*2*sizeof(int_t)+8, "Address", true);
mSymbolList->addColumnAt(0, "Symbol", true);
mSymbolList->enableMultiSelection(false);
ui->listSplitter->addWidget(mModuleList);
ui->listSplitter->addWidget(mSymbolList);
// mModuleList : mSymbolList = 1 : 5
ui->listSplitter->setStretchFactor(0, 1);
ui->listSplitter->setStretchFactor(1, 5);
ui->symbolLogEdit->setFont(wFont);
ui->symbolLogEdit->setStyleSheet("QTextEdit { background-color: rgb(255, 251, 240) }");
ui->symbolLogEdit->setUndoRedoEnabled(false);
ui->symbolLogEdit->setReadOnly(true);
// Log : List = 2 : 9
ui->mainSplitter->setStretchFactor(0, 9);
ui->mainSplitter->setStretchFactor(1, 2);
connect(Bridge::getBridge(), SIGNAL(addMsgToSymbolLog(QString)), this, SLOT(addMsgToSymbolLogSlot(QString)));
connect(Bridge::getBridge(), SIGNAL(clearLog()), this, SLOT(clearSymbolLogSlot()));
connect(Bridge::getBridge(), SIGNAL(clearSymbolLog()), this, SLOT(clearSymbolLogSlot()));
}
SymbolView::~SymbolView()
{
delete ui;
}
void SymbolView::addMsgToSymbolLogSlot(QString msg)
{
ui->symbolLogEdit->moveCursor(QTextCursor::End);
ui->symbolLogEdit->insertPlainText(msg);
}
void SymbolView::clearSymbolLogSlot()
{
ui->symbolLogEdit->clear();
}

View File

@ -0,0 +1,34 @@
#ifndef SYMBOLVIEW_H
#define SYMBOLVIEW_H
#include <QWidget>
#include <QVBoxLayout>
#include "StdTable.h"
#include "Bridge.h"
namespace Ui {
class SymbolView;
}
class SymbolView : public QWidget
{
Q_OBJECT
public:
explicit SymbolView(QWidget *parent = 0);
~SymbolView();
public slots:
void addMsgToSymbolLogSlot(QString msg);
void clearSymbolLogSlot();
private:
Ui::SymbolView *ui;
QVBoxLayout* mainLayout;
StdTable* mModuleList;
StdTable* mSymbolList;
};
#endif // SYMBOLVIEW_H

View File

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SymbolView</class>
<widget class="QWidget" name="SymbolView">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>694</width>
<height>605</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QSplitter" name="mainSplitter">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>691</width>
<height>601</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalListLayout">
<property name="spacing">
<number>3</number>
</property>
<item>
<widget class="QSplitter" name="listSplitter">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="handleWidth">
<number>2</number>
</property>
<property name="childrenCollapsible">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalListLayout">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="searchLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Search:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="searchBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="logLayout">
<property name="spacing">
<number>3</number>
</property>
<item>
<widget class="QTextEdit" name="symbolLogEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="symbolProgress">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>15</height>
</size>
</property>
<property name="value">
<number>0</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -59,6 +59,8 @@ signals:
void updateCPUTitle(QString modname);
void setInfoLine(int line, QString text);
void dumpAt(int_t va);
void addMsgToSymbolLog(QString msg);
void clearSymbolLog();
void scriptAdd(int count, const char** lines);
void scriptClear();

View File

@ -40,6 +40,9 @@
<property name="handleWidth">
<number>1</number>
</property>
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<widget class="QSplitter" name="mTopHSplitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -47,6 +50,9 @@
<property name="handleWidth">
<number>1</number>
</property>
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<widget class="QSplitter" name="mTopLeftVSplitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -54,6 +60,9 @@
<property name="handleWidth">
<number>1</number>
</property>
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<widget class="QFrame" name="mTopLeftUpperFrame">
<property name="frameShape">
<enum>QFrame::Box</enum>
@ -138,6 +147,9 @@
<property name="handleWidth">
<number>1</number>
</property>
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<widget class="QFrame" name="mBotLeftFrame">
<property name="frameShape">
<enum>QFrame::Box</enum>

View File

@ -31,19 +31,26 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
mLogView->hide();
mLogView->setGeometry(10, 10, 800, 300);
// Symbol view
mSymbolView = new SymbolView();
mSymbolView->setWindowTitle("Symbol Info");
mSymbolView->setWindowIcon(QIcon(":/icons/images/pdb.png"));
mSymbolView->hide();
mSymbolView->setGeometry(20, 20, 800, 300);
// Breakpoints
mBreakpointsView = new BreakpointsView();
mBreakpointsView->setWindowTitle("Breakpoints");
mBreakpointsView->setWindowIcon(QIcon(":/icons/images/breakpoint.png"));
mBreakpointsView->hide();
mBreakpointsView->setGeometry(20, 20, 800, 300);
mBreakpointsView->setGeometry(30, 30, 800, 300);
// Memory Map View
mMemMapView = new MemoryMapView();
mMemMapView->setWindowTitle("Memory Map");
mMemMapView->setWindowIcon(QIcon(":/icons/images/memory-map.png"));
mMemMapView->hide();
mMemMapView->setGeometry(30, 30, 625, 500);
mMemMapView->setGeometry(40, 40, 625, 500);
// Script view
mScriptView = new ScriptView();
@ -65,6 +72,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
mTabWidget->addTab(mBreakpointsView, mBreakpointsView->windowIcon(), mBreakpointsView->windowTitle());
mTabWidget->addTab(mMemMapView, mMemMapView->windowIcon(), mMemMapView->windowTitle());
mTabWidget->addTab(mScriptView, mScriptView->windowIcon(), mScriptView->windowTitle());
mTabWidget->addTab(mSymbolView, mSymbolView->windowIcon(), mSymbolView->windowTitle());
setCentralWidget(mTabWidget);
@ -103,6 +111,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
connect(ui->actionScript,SIGNAL(triggered()),this,SLOT(displayScriptWidget()));
connect(ui->actionRunSelection,SIGNAL(triggered()),mCpuWidget,SLOT(runSelection()));
connect(ui->actionCpu,SIGNAL(triggered()),this,SLOT(displayCpuWidget()));
connect(ui->actionSymbolInfo,SIGNAL(triggered()),this,SLOT(displaySymbolWidget()));
connect(Bridge::getBridge(), SIGNAL(updateWindowTitle(QString)), this, SLOT(updateWindowTitleSlot(QString)));
connect(Bridge::getBridge(), SIGNAL(updateCPUTitle(QString)), this, SLOT(updateCPUTitleSlot(QString)));
@ -324,3 +333,10 @@ void MainWindow::displayCpuWidget()
mCpuWidget->setFocus();
setTab(mCpuWidget);
}
void MainWindow::displaySymbolWidget()
{
mSymbolView->show();
mSymbolView->setFocus();
setTab(mSymbolView);
}

View File

@ -14,6 +14,7 @@
#include "StatusLabel.h"
#include "BreakpointsView.h"
#include "ScriptView.h"
#include "SymbolView.h"
namespace Ui {
class MainWindow;
@ -52,6 +53,7 @@ public slots:
void execeRun();
void execeRtr();
void displayCpuWidget();
void displaySymbolWidget();
private slots:
void on_actionGoto_triggered();
@ -64,6 +66,7 @@ private:
CPUWidget* mCpuWidget;
MemoryMapView* mMemMapView;
LogView* mLogView;
SymbolView* mSymbolView;
BreakpointsView* mBreakpointsView;
ScriptView* mScriptView;

View File

@ -39,6 +39,7 @@
<addaction name="actionLog"/>
<addaction name="actionBreakpoints"/>
<addaction name="actionScript"/>
<addaction name="actionSymbolInfo"/>
</widget>
<widget class="QMenu" name="menuDebug">
<property name="title">
@ -113,6 +114,7 @@
<addaction name="actionBreakpoints"/>
<addaction name="actionMemoryMap"/>
<addaction name="actionScript"/>
<addaction name="actionSymbolInfo"/>
<addaction name="separator"/>
<addaction name="actionScylla"/>
</widget>
@ -416,6 +418,21 @@
<string>Alt+C</string>
</property>
</action>
<action name="actionSymbolInfo">
<property name="icon">
<iconset resource="../../resource.qrc">
<normaloff>:/icons/images/pdb.png</normaloff>:/icons/images/pdb.png</iconset>
</property>
<property name="text">
<string>Symbol Info</string>
</property>
<property name="toolTip">
<string>Symbol Info</string>
</property>
<property name="shortcut">
<string>Ctrl+Alt+S</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>

View File

@ -14,7 +14,7 @@ StatusLabel::StatusLabel(QStatusBar* parent) : QLabel(parent)
connect(Bridge::getBridge(), SIGNAL(dbgStateChanged(DBGSTATE)), this, SLOT(debugStateChangedSlot(DBGSTATE)));
}
else //last log message
connect(Bridge::getBridge(), SIGNAL(addMsgToLog(QString)), this, SLOT(setText(QString)));
connect(Bridge::getBridge(), SIGNAL(addMsgToLog(QString)), this, SLOT(logUpdate(QString)));
}
void StatusLabel::debugStateChangedSlot(DBGSTATE state)
@ -39,3 +39,11 @@ void StatusLabel::debugStateChangedSlot(DBGSTATE state)
break;
}
}
void StatusLabel::logUpdate(QString message)
{
if(labelText.contains(QChar('\n'))) //newline
labelText="";
labelText+=message;
setText(labelText);
}

View File

@ -13,6 +13,10 @@ public:
public slots:
void debugStateChangedSlot(DBGSTATE state);
void logUpdate(QString message);
private:
QString labelText;
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

View File

@ -25,5 +25,6 @@
<file>images/arrow-run-cursor.png</file>
<file>images/log.png</file>
<file>images/breakpoint.png</file>
<file>images/pdb.png</file>
</qresource>
</RCC>