Skip to content

Commit

Permalink
Merge pull request #3333 from ynwarcs/symbol-commands-from-callstack-…
Browse files Browse the repository at this point in the history
…view

Add symbol loading commands to the callstack view context menu.
  • Loading branch information
mrexodia committed Apr 14, 2024
2 parents 2d2a218 + c69b49d commit 4d63170
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/gui/Src/Gui/CallStackView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ void CallStackView::setupContextMenu()
{
return !getCellContent(getInitialSelection(), ColFrom).isEmpty() && isSelectionValid();
});
QAction* loadSymbolsForThread = makeAction(DIcon("pdb"), tr("Download Symbols for This Thread"), SLOT(loadSymbolsForThreadSlot()));
mMenuBuilder->addAction(loadSymbolsForThread, [this](QMenu*)
{
return isSelectionValid();
});
mFollowFrom->setShortcutContext(Qt::WidgetShortcut);
mFollowFrom->setShortcut(QKeySequence("enter"));
connect(this, SIGNAL(enterPressedSignal()), this, SLOT(followFromSlot()));
Expand Down Expand Up @@ -265,6 +270,28 @@ void CallStackView::renameThreadSlot()
DbgCmdExec(QString("setthreadname %1, \"%2\"").arg(ToHexString(threadId)).arg(DbgCmdEscape(threadName)));
}

void CallStackView::loadSymbolsForThreadSlot()
{
char module[MAX_MODULE_SIZE] = "";
duint firstRowForThread = 1;
const duint threadId = getCellUserdata(getInitialSelection(), ColThread);
for(duint row = getInitialSelection(); row > 0; --row)
{
if(getCellUserdata(row, ColThread) != threadId)
{
firstRowForThread = row + 1;
break;
}
}
for(duint row = firstRowForThread; row < getRowCount(); ++row)
{
if(getCellUserdata(row, ColThread) != threadId)
break;
if(DbgGetModuleAt(getCellUserdata(row, ColFrom), module))
DbgCmdExec(QString("symdownload \"%0\"").arg(module));
}
}

void CallStackView::followInThreadsSlot()
{
QStringList threadIDName = getCellContent(getInitialSelection(), ColThread).split(" - ");
Expand Down
1 change: 1 addition & 0 deletions src/gui/Src/Gui/CallStackView.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ protected slots:
void showSuspectedCallStackSlot();
void followInThreadsSlot();
void renameThreadSlot();
void loadSymbolsForThreadSlot();

private:
enum
Expand Down

0 comments on commit 4d63170

Please sign in to comment.