Merge branch 'patch0000004e' of https://github.com/torusrxxx/x64dbg into torusrxxx-patch0000004e
This commit is contained in:
parent
c680cadfde
commit
31d6823a30
|
@ -393,7 +393,7 @@ void CPUDisassembly::setupRightClickContextMenu()
|
|||
|
||||
MenuBuilder* labelMenu = new MenuBuilder(this);
|
||||
labelMenu->addAction(makeShortcutAction(tr("Label Current Address"), SLOT(setLabelSlot()), "ActionSetLabel"));
|
||||
QAction* labelAddress = makeAction(tr("Label"), SLOT(setLabelAddressSlot()));
|
||||
QAction* labelAddress = makeShortcutAction(tr("Label"), SLOT(setLabelAddressSlot()), "ActionSetLabelOperand");
|
||||
|
||||
labelMenu->addAction(labelAddress, [this, labelAddress](QMenu*)
|
||||
{
|
||||
|
|
|
@ -25,8 +25,9 @@ CustomizeMenuDialog::CustomizeMenuDialog(QWidget* parent) :
|
|||
builder = i.builder;
|
||||
id = builder->getId();
|
||||
}
|
||||
else
|
||||
else //invalid or unsupported type.Continue
|
||||
continue;
|
||||
//Get localized string for the name of individual views
|
||||
if(id == "CPUDisassembly")
|
||||
viewName = tr("Disassembler");
|
||||
else if(id == "CPUDump")
|
||||
|
@ -41,6 +42,8 @@ CustomizeMenuDialog::CustomizeMenuDialog(QWidget* parent) :
|
|||
viewName = tr("Graph");
|
||||
else if(id == "XrefBrowseDialog")
|
||||
viewName = tr("Xref Browser");
|
||||
else if(id == "StructWidget")
|
||||
viewName = tr("Struct");
|
||||
else if(id == "CPUStack")
|
||||
viewName = tr("Stack");
|
||||
else if(id == "SourceView")
|
||||
|
@ -59,16 +62,20 @@ CustomizeMenuDialog::CustomizeMenuDialog(QWidget* parent) :
|
|||
viewName = tr("View");
|
||||
else
|
||||
continue;
|
||||
// Add Parent Node
|
||||
QTreeWidgetItem* parentItem = new QTreeWidgetItem(ui->treeWidget);
|
||||
parentItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
parentItem->setText(0, viewName);
|
||||
// Add Children nodes
|
||||
for(size_t j = 0; j < i.count; j++)
|
||||
{
|
||||
// Get localized name of menu item by communicating with the menu
|
||||
QString text;
|
||||
if(i.type == 0)
|
||||
text = builder->getText(j);
|
||||
else if(i.type == 1)
|
||||
text = mainMenuList->at(int(j + 1))->text();
|
||||
// Add a child node only if it has a non-empty name
|
||||
if(!text.isEmpty())
|
||||
{
|
||||
QTreeWidgetItem* menuItem = new QTreeWidgetItem(parentItem, 0);
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include "CachedFontMetrics.h"
|
||||
#include "QBeaEngine.h"
|
||||
#include "GotoDialog.h"
|
||||
#include "XrefBrowseDialog.h"
|
||||
#include "LineEditDialog.h"
|
||||
#include <vector>
|
||||
#include <QPainter>
|
||||
#include <QScrollBar>
|
||||
|
@ -902,7 +904,7 @@ static void initVec(std::vector<T> & vec, size_t size, T value)
|
|||
|
||||
void DisassemblerGraphView::renderFunction(Function & func)
|
||||
{
|
||||
puts("Starting renderFunction");
|
||||
//puts("Starting renderFunction");
|
||||
|
||||
//Create render nodes
|
||||
this->blocks.clear();
|
||||
|
@ -911,7 +913,7 @@ void DisassemblerGraphView::renderFunction(Function & func)
|
|||
this->blocks[block.entry] = DisassemblerBlock(block);
|
||||
this->prepareGraphNode(this->blocks[block.entry]);
|
||||
}
|
||||
puts("Create render nodes");
|
||||
//puts("Create render nodes");
|
||||
|
||||
//Populate incoming lists
|
||||
for(auto & blockIt : this->blocks)
|
||||
|
@ -920,14 +922,14 @@ void DisassemblerGraphView::renderFunction(Function & func)
|
|||
for(auto & edge : block.block.exits)
|
||||
this->blocks[edge].incoming.push_back(block.block.entry);
|
||||
}
|
||||
puts("Populate incoming lists");
|
||||
//puts("Populate incoming lists");
|
||||
|
||||
//Construct acyclic graph where each node is used as an edge exactly once
|
||||
std::unordered_set<duint> visited;
|
||||
visited.insert(func.entry);
|
||||
std::queue<duint> queue;
|
||||
queue.push(this->blocks[func.entry].block.entry);
|
||||
auto changed = true;
|
||||
bool changed = true;
|
||||
|
||||
int best_edges;
|
||||
duint best_parent;
|
||||
|
@ -988,7 +990,7 @@ void DisassemblerGraphView::renderFunction(Function & func)
|
|||
changed = true;
|
||||
}
|
||||
}
|
||||
puts("Construct acyclic graph where each node is used as an edge exactly once");
|
||||
//puts("Construct acyclic graph where each node is used as an edge exactly once");
|
||||
|
||||
//Compute graph layout from bottom up
|
||||
this->computeGraphLayout(this->blocks[func.entry]);
|
||||
|
@ -1039,7 +1041,7 @@ void DisassemblerGraphView::renderFunction(Function & func)
|
|||
for(DisassemblerBlock & block : blockVec)
|
||||
blocks[block.block.entry] = block;*/
|
||||
|
||||
puts("Compute graph layout from bottom up");
|
||||
//puts("Compute graph layout from bottom up");
|
||||
|
||||
//Prepare edge routing
|
||||
EdgesVector horiz_edges, vert_edges;
|
||||
|
@ -1063,7 +1065,7 @@ void DisassemblerGraphView::renderFunction(Function & func)
|
|||
DisassemblerBlock & block = blockIt.second;
|
||||
edge_valid[block.row][block.col + 1] = false;
|
||||
}
|
||||
puts("Prepare edge routing");
|
||||
//puts("Prepare edge routing");
|
||||
|
||||
//Perform edge routing
|
||||
for(auto & blockIt : this->blocks)
|
||||
|
@ -1081,7 +1083,7 @@ void DisassemblerGraphView::renderFunction(Function & func)
|
|||
start.edges.push_back(this->routeEdge(horiz_edges, vert_edges, edge_valid, start, end, color));
|
||||
}
|
||||
}
|
||||
puts("Perform edge routing");
|
||||
//puts("Perform edge routing");
|
||||
|
||||
//Compute edge counts for each row and column
|
||||
std::vector<int> col_edge_count, row_edge_count;
|
||||
|
@ -1097,7 +1099,7 @@ void DisassemblerGraphView::renderFunction(Function & func)
|
|||
col_edge_count[col] = int(vert_edges[row][col].size());
|
||||
}
|
||||
}
|
||||
puts("Compute edge counts for each row and column");
|
||||
//puts("Compute edge counts for each row and column");
|
||||
|
||||
//Compute row and column sizes
|
||||
std::vector<int> col_width, row_height;
|
||||
|
@ -1113,7 +1115,7 @@ void DisassemblerGraphView::renderFunction(Function & func)
|
|||
if(int(block.height) > row_height[block.row])
|
||||
row_height[block.row] = int(block.height);
|
||||
}
|
||||
puts("Compute row and column sizes");
|
||||
//puts("Compute row and column sizes");
|
||||
|
||||
//Compute row and column positions
|
||||
std::vector<int> col_x, row_y;
|
||||
|
@ -1141,7 +1143,7 @@ void DisassemblerGraphView::renderFunction(Function & func)
|
|||
this->row_edge_y[this->blocks[func.entry].row_count] = y;
|
||||
this->width = x + 16 + (8 * col_edge_count[this->blocks[func.entry].col_count]);
|
||||
this->height = y + 16 + (8 * row_edge_count[this->blocks[func.entry].row_count]);
|
||||
puts("Compute row and column positions");
|
||||
//puts("Compute row and column positions");
|
||||
|
||||
//Compute node positions
|
||||
for(auto & blockIt : this->blocks)
|
||||
|
@ -1158,7 +1160,7 @@ void DisassemblerGraphView::renderFunction(Function & func)
|
|||
}
|
||||
block.y = row_y[block.row];
|
||||
}
|
||||
puts("Compute node positions");
|
||||
//puts("Compute node positions");
|
||||
|
||||
//Precompute coordinates for edges
|
||||
for(auto & blockIt : this->blocks)
|
||||
|
@ -1201,7 +1203,7 @@ void DisassemblerGraphView::renderFunction(Function & func)
|
|||
edge.arrow = pts;
|
||||
}
|
||||
}
|
||||
puts("Precompute coordinates for edges");
|
||||
//puts("Precompute coordinates for edges");
|
||||
|
||||
//Adjust scroll bars for new size
|
||||
auto areaSize = this->viewport()->size();
|
||||
|
@ -1230,7 +1232,7 @@ void DisassemblerGraphView::renderFunction(Function & func)
|
|||
this->analysis.update_id = this->update_id = func.update_id;
|
||||
this->ready = true;
|
||||
this->viewport()->update(0, 0, areaSize.width(), areaSize.height());
|
||||
puts("Finished");
|
||||
//puts("Finished");
|
||||
}
|
||||
|
||||
void DisassemblerGraphView::updateTimerEvent()
|
||||
|
@ -1491,14 +1493,17 @@ void DisassemblerGraphView::setupContextMenu()
|
|||
|
||||
mMenuBuilder->addAction(mToggleOverview = makeShortcutAction(DIcon("comment.png"), tr("&Comment"), SLOT(setCommentSlot()), "ActionSetComment"));
|
||||
mMenuBuilder->addAction(mToggleOverview = makeShortcutAction(DIcon("label.png"), tr("&Label"), SLOT(setLabelSlot()), "ActionSetLabel"));
|
||||
mMenuBuilder->addAction(mToggleOverview = makeShortcutAction(tr("&Save as image"), SLOT(saveImageSlot()), "ActionGraphSaveImage"));
|
||||
mMenuBuilder->addAction(mToggleOverview = makeShortcutAction(DIcon("graph.png"), tr("&Overview"), SLOT(toggleOverviewSlot()), "ActionGraphToggleOverview"));
|
||||
mMenuBuilder->addAction(mToggleSyncOrigin = makeShortcutAction(DIcon("lock.png"), tr("&Sync with origin"), SLOT(toggleSyncOriginSlot()), "ActionGraphSyncOrigin"));
|
||||
mMenuBuilder->addAction(makeShortcutAction(DIcon("sync.png"), tr("&Refresh"), SLOT(refreshSlot()), "ActionRefresh"));
|
||||
MenuBuilder* gotoMenu = new MenuBuilder(this);
|
||||
gotoMenu->addAction(makeShortcutAction(DIcon("geolocation-goto.png"), tr("Expression"), SLOT(gotoExpressionSlot()), "ActionGotoExpression"));
|
||||
gotoMenu->addAction(makeShortcutAction(DIcon("cbp.png"), tr("Origin"), SLOT(gotoOriginSlot()), "ActionGotoOrigin"));
|
||||
mMenuBuilder->addMenu(makeMenu(DIcon("goto.png"), tr("Go to")), gotoMenu);
|
||||
mMenuBuilder->addAction(makeShortcutAction(DIcon("xrefs.png"), tr("Xrefs..."), SLOT(xrefSlot()), "ActionXrefs"));
|
||||
mMenuBuilder->addSeparator();
|
||||
mMenuBuilder->addAction(mToggleOverview = makeShortcutAction(DIcon("graph.png"), tr("&Overview"), SLOT(toggleOverviewSlot()), "ActionGraphToggleOverview"));
|
||||
mMenuBuilder->addAction(mToggleSyncOrigin = makeShortcutAction(DIcon("lock.png"), tr("&Sync with origin"), SLOT(toggleSyncOriginSlot()), "ActionGraphSyncOrigin"));
|
||||
mMenuBuilder->addAction(makeShortcutAction(DIcon("sync.png"), tr("&Refresh"), SLOT(refreshSlot()), "ActionRefresh"));
|
||||
mMenuBuilder->addAction(mToggleOverview = makeShortcutAction(tr("&Save as image"), SLOT(saveImageSlot()), "ActionGraphSaveImage"));
|
||||
mMenuBuilder->addSeparator();
|
||||
|
||||
mMenuBuilder->loadFromConfig();
|
||||
}
|
||||
|
@ -1690,3 +1695,17 @@ restart:
|
|||
|
||||
this->refreshSlot();
|
||||
}
|
||||
|
||||
void DisassemblerGraphView::xrefSlot()
|
||||
{
|
||||
XREF_INFO mXrefInfo;
|
||||
if(!DbgIsDebugging())
|
||||
return;
|
||||
DbgXrefGet(this->get_cursor_pos(), &mXrefInfo);
|
||||
if(!mXrefInfo.refcount)
|
||||
return;
|
||||
if(!mXrefDlg)
|
||||
mXrefDlg = new XrefBrowseDialog(this);
|
||||
mXrefDlg->setup(this->get_cursor_pos(), "graph");
|
||||
mXrefDlg->showNormal();
|
||||
}
|
||||
|
|
|
@ -15,13 +15,13 @@
|
|||
#include <algorithm>
|
||||
#include <QMutex>
|
||||
#include "Bridge.h"
|
||||
#include "LineEditDialog.h"
|
||||
#include "RichTextPainter.h"
|
||||
#include "QBeaEngine.h"
|
||||
|
||||
class MenuBuilder;
|
||||
class CachedFontMetrics;
|
||||
class GotoDialog;
|
||||
class XrefBrowseDialog;
|
||||
|
||||
class DisassemblerGraphView : public QAbstractScrollArea
|
||||
{
|
||||
|
@ -48,10 +48,7 @@ public:
|
|||
|
||||
void addPoint(int row, int col, int index = 0)
|
||||
{
|
||||
Point point;
|
||||
point.row = row;
|
||||
point.col = col;
|
||||
point.index = 0;
|
||||
Point point = {row, col, 0};
|
||||
this->points.push_back(point);
|
||||
if(int(this->points.size()) > 1)
|
||||
this->points[this->points.size() - 2].index = index;
|
||||
|
@ -145,16 +142,6 @@ public:
|
|||
duint true_path = 0;
|
||||
duint false_path = 0;
|
||||
bool terminal = false;
|
||||
|
||||
void print() const
|
||||
{
|
||||
puts("----BLOCK---");
|
||||
printf("header_text: %s\n", header_text.ToQString().toUtf8().constData());
|
||||
puts("exits:");
|
||||
for(auto exit : exits)
|
||||
printf("%X ", exit);
|
||||
puts("\n--ENDBLOCK--");
|
||||
}
|
||||
};
|
||||
|
||||
struct DisassemblerBlock
|
||||
|
@ -163,11 +150,6 @@ public:
|
|||
explicit DisassemblerBlock(Block & block)
|
||||
: block(block) {}
|
||||
|
||||
void print() const
|
||||
{
|
||||
block.print();
|
||||
}
|
||||
|
||||
Block block;
|
||||
std::vector<DisassemblerEdge> edges;
|
||||
std::vector<duint> incoming;
|
||||
|
@ -275,6 +257,7 @@ public slots:
|
|||
void saveImageSlot();
|
||||
void setCommentSlot();
|
||||
void setLabelSlot();
|
||||
void xrefSlot();
|
||||
|
||||
private:
|
||||
QString status;
|
||||
|
@ -339,6 +322,7 @@ private:
|
|||
std::unordered_map<duint, duint> currentBlockMap;
|
||||
QBeaEngine disasm;
|
||||
GotoDialog* mGoto;
|
||||
XrefBrowseDialog* mXrefDlg;
|
||||
protected:
|
||||
#include "ActionHelpers.h"
|
||||
};
|
||||
|
|
|
@ -1591,6 +1591,13 @@ QString RegistersView::helpRegister(REGISTER_NAME reg)
|
|||
case LastError:
|
||||
//TODO: display help message of the specific error instead of this very generic message.
|
||||
return tr("The value of GetLastError(). This value is stored in the TEB.");
|
||||
#ifdef _WIN64
|
||||
case GS:
|
||||
return tr("The TEB of the current thread can be accessed as an offset of segment register GS (x64).\r\nThe TEB can be used to get a lot of information on the process without calling Win32 API.");
|
||||
#else //x86
|
||||
case FS:
|
||||
return tr("The TEB of the current thread can be accessed as an offset of segment register FS (x86).\r\nThe TEB can be used to get a lot of information on the process without calling Win32 API.");
|
||||
#endif //_WIN64
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -162,6 +162,7 @@ void StructWidget::setupContextMenu()
|
|||
});
|
||||
mMenuBuilder->addAction(makeAction(DIcon("eraser.png"), tr("Clear"), SLOT(clearSlot())));
|
||||
mMenuBuilder->addAction(makeShortcutAction(DIcon("sync.png"), tr("&Refresh"), SLOT(refreshSlot()), "ActionRefresh"));
|
||||
mMenuBuilder->loadFromConfig();
|
||||
}
|
||||
|
||||
void StructWidget::on_treeWidget_customContextMenuRequested(const QPoint & pos)
|
||||
|
|
|
@ -226,6 +226,7 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
|
|||
insertMenuBuilderBools(&guiBool, "SourceView", 10); //Source
|
||||
insertMenuBuilderBools(&guiBool, "DisassemblerGraphView", 50); //Graph
|
||||
insertMenuBuilderBools(&guiBool, "XrefBrowseDialog", 10); //XrefBrowseDialog
|
||||
insertMenuBuilderBools(&guiBool, "StructWidget", 8); //StructWidget
|
||||
insertMenuBuilderBools(&guiBool, "File", 50); //Main Menu : File
|
||||
insertMenuBuilderBools(&guiBool, "Debug", 50); //Main Menu : Debug
|
||||
insertMenuBuilderBools(&guiBool, "Option", 50); //Main Menu : Option
|
||||
|
@ -396,6 +397,7 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
|
|||
defaultShortcuts.insert("ActionBinaryPasteIgnoreSize", Shortcut(tr("Actions -> Binary Paste (Ignore Size)"), "Ctrl+Shift+V"));
|
||||
defaultShortcuts.insert("ActionUndoSelection", Shortcut(tr("Actions -> Undo Selection"), "Ctrl+Backspace"));
|
||||
defaultShortcuts.insert("ActionSetLabel", Shortcut(tr("Actions -> Set Label"), ":"));
|
||||
defaultShortcuts.insert("ActionSetLabelOperand", Shortcut(tr("Actions -> Set Label for the Operand"), "Alt+;"));
|
||||
defaultShortcuts.insert("ActionSetComment", Shortcut(tr("Actions -> Set Comment"), ";"));
|
||||
defaultShortcuts.insert("ActionToggleFunction", Shortcut(tr("Actions -> Toggle Function"), "Shift+F"));
|
||||
defaultShortcuts.insert("ActionToggleArgument", Shortcut(tr("Actions -> Toggle Argument"), "Shift+A"));
|
||||
|
|
Loading…
Reference in New Issue