forked from qt-creator/qt-creator
Debugger: Move showModule{Sections,Symbols} to DebuggerEngine
A bit closer to where the functions are used. No real change. Change-Id: Icbad68bd31d85caa59980316537ee532faf2d7ef Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -50,9 +50,6 @@ class SavedAction;
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
class Console;
|
||||
class Symbol;
|
||||
class Section;
|
||||
class GlobalDebuggerOptions;
|
||||
|
||||
enum TestCases
|
||||
@@ -64,15 +61,11 @@ enum TestCases
|
||||
// Some convenience.
|
||||
void openTextEditor(const QString &titlePattern, const QString &contents);
|
||||
|
||||
void showModuleSymbols(const QString &moduleName, const QVector<Internal::Symbol> &symbols);
|
||||
void showModuleSections(const QString &moduleName, const QVector<Internal::Section> §ions);
|
||||
|
||||
QSharedPointer<Internal::GlobalDebuggerOptions> globalDebuggerOptions();
|
||||
|
||||
bool isTestRun();
|
||||
|
||||
Utils::SavedAction *action(int code);
|
||||
Console *console();
|
||||
|
||||
bool boolSetting(int code);
|
||||
QString stringSetting(int code);
|
||||
|
@@ -2619,6 +2619,73 @@ QString DebuggerEngine::formatStartParameters() const
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void createNewDock(QWidget *widget)
|
||||
{
|
||||
auto dockWidget = new QDockWidget;
|
||||
dockWidget->setWidget(widget);
|
||||
dockWidget->setWindowTitle(widget->windowTitle());
|
||||
dockWidget->setFeatures(QDockWidget::DockWidgetClosable);
|
||||
dockWidget->show();
|
||||
}
|
||||
|
||||
void DebuggerEngine::showModuleSymbols(const QString &moduleName, const Symbols &symbols)
|
||||
{
|
||||
auto w = new QTreeWidget;
|
||||
w->setUniformRowHeights(true);
|
||||
w->setColumnCount(5);
|
||||
w->setRootIsDecorated(false);
|
||||
w->setAlternatingRowColors(true);
|
||||
w->setSortingEnabled(true);
|
||||
w->setObjectName("Symbols." + moduleName);
|
||||
QStringList header;
|
||||
header.append(tr("Symbol"));
|
||||
header.append(tr("Address"));
|
||||
header.append(tr("Code"));
|
||||
header.append(tr("Section"));
|
||||
header.append(tr("Name"));
|
||||
w->setHeaderLabels(header);
|
||||
w->setWindowTitle(tr("Symbols in \"%1\"").arg(moduleName));
|
||||
for (const Symbol &s : symbols) {
|
||||
auto it = new QTreeWidgetItem;
|
||||
it->setData(0, Qt::DisplayRole, s.name);
|
||||
it->setData(1, Qt::DisplayRole, s.address);
|
||||
it->setData(2, Qt::DisplayRole, s.state);
|
||||
it->setData(3, Qt::DisplayRole, s.section);
|
||||
it->setData(4, Qt::DisplayRole, s.demangled);
|
||||
w->addTopLevelItem(it);
|
||||
}
|
||||
createNewDock(w);
|
||||
}
|
||||
|
||||
void DebuggerEngine::showModuleSections(const QString &moduleName, const Sections §ions)
|
||||
{
|
||||
auto w = new QTreeWidget;
|
||||
w->setUniformRowHeights(true);
|
||||
w->setColumnCount(5);
|
||||
w->setRootIsDecorated(false);
|
||||
w->setAlternatingRowColors(true);
|
||||
w->setSortingEnabled(true);
|
||||
w->setObjectName("Sections." + moduleName);
|
||||
QStringList header;
|
||||
header.append(tr("Name"));
|
||||
header.append(tr("From"));
|
||||
header.append(tr("To"));
|
||||
header.append(tr("Address"));
|
||||
header.append(tr("Flags"));
|
||||
w->setHeaderLabels(header);
|
||||
w->setWindowTitle(tr("Sections in \"%1\"").arg(moduleName));
|
||||
for (const Section &s : sections) {
|
||||
auto it = new QTreeWidgetItem;
|
||||
it->setData(0, Qt::DisplayRole, s.name);
|
||||
it->setData(1, Qt::DisplayRole, s.from);
|
||||
it->setData(2, Qt::DisplayRole, s.to);
|
||||
it->setData(3, Qt::DisplayRole, s.address);
|
||||
it->setData(4, Qt::DisplayRole, s.flags);
|
||||
w->addTopLevelItem(it);
|
||||
}
|
||||
createNewDock(w);
|
||||
}
|
||||
|
||||
// CppDebuggerEngine
|
||||
|
||||
Context CppDebuggerEngine::languageContext() const
|
||||
|
@@ -102,9 +102,11 @@ class LogWindow;
|
||||
class ModulesHandler;
|
||||
class RegisterHandler;
|
||||
class PeripheralRegisterHandler;
|
||||
class StackHandler;
|
||||
class StackFrame;
|
||||
class Section;
|
||||
class SourceFilesHandler;
|
||||
class StackFrame;
|
||||
class StackHandler;
|
||||
class Symbol;
|
||||
class WatchHandler;
|
||||
class WatchTreeView;
|
||||
class DebuggerToolTipContext;
|
||||
@@ -460,6 +462,9 @@ public:
|
||||
|
||||
void openMemoryEditor();
|
||||
|
||||
static void showModuleSymbols(const QString &moduleName, const QVector<Symbol> &symbols);
|
||||
static void showModuleSections(const QString &moduleName, const QVector<Section> §ions);
|
||||
|
||||
void handleExecDetach();
|
||||
void handleExecContinue();
|
||||
void handleExecInterrupt();
|
||||
@@ -546,7 +551,6 @@ protected:
|
||||
bool isNativeMixedActiveFrame() const;
|
||||
void startDying() const;
|
||||
|
||||
protected:
|
||||
ProjectExplorer::IDevice::ConstPtr device() const;
|
||||
DebuggerEngine *companionEngine() const;
|
||||
|
||||
|
@@ -2015,15 +2015,6 @@ void DebuggerPluginPrivate::aboutToShutdown()
|
||||
m_shutdownTimer.start();
|
||||
}
|
||||
|
||||
static void createNewDock(QWidget *widget)
|
||||
{
|
||||
auto dockWidget = new QDockWidget;
|
||||
dockWidget->setWidget(widget);
|
||||
dockWidget->setWindowTitle(widget->windowTitle());
|
||||
dockWidget->setFeatures(QDockWidget::DockWidgetClosable);
|
||||
dockWidget->show();
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::remoteCommand(const QStringList &options)
|
||||
{
|
||||
if (options.isEmpty())
|
||||
@@ -2117,64 +2108,6 @@ QStringList stringListSetting(int code)
|
||||
return action(code)->value().toStringList();
|
||||
}
|
||||
|
||||
void showModuleSymbols(const QString &moduleName, const Symbols &symbols)
|
||||
{
|
||||
auto w = new QTreeWidget;
|
||||
w->setUniformRowHeights(true);
|
||||
w->setColumnCount(5);
|
||||
w->setRootIsDecorated(false);
|
||||
w->setAlternatingRowColors(true);
|
||||
w->setSortingEnabled(true);
|
||||
w->setObjectName("Symbols." + moduleName);
|
||||
QStringList header;
|
||||
header.append(DebuggerPlugin::tr("Symbol"));
|
||||
header.append(DebuggerPlugin::tr("Address"));
|
||||
header.append(DebuggerPlugin::tr("Code"));
|
||||
header.append(DebuggerPlugin::tr("Section"));
|
||||
header.append(DebuggerPlugin::tr("Name"));
|
||||
w->setHeaderLabels(header);
|
||||
w->setWindowTitle(DebuggerPlugin::tr("Symbols in \"%1\"").arg(moduleName));
|
||||
for (const Symbol &s : symbols) {
|
||||
auto it = new QTreeWidgetItem;
|
||||
it->setData(0, Qt::DisplayRole, s.name);
|
||||
it->setData(1, Qt::DisplayRole, s.address);
|
||||
it->setData(2, Qt::DisplayRole, s.state);
|
||||
it->setData(3, Qt::DisplayRole, s.section);
|
||||
it->setData(4, Qt::DisplayRole, s.demangled);
|
||||
w->addTopLevelItem(it);
|
||||
}
|
||||
createNewDock(w);
|
||||
}
|
||||
|
||||
void showModuleSections(const QString &moduleName, const Sections §ions)
|
||||
{
|
||||
auto w = new QTreeWidget;
|
||||
w->setUniformRowHeights(true);
|
||||
w->setColumnCount(5);
|
||||
w->setRootIsDecorated(false);
|
||||
w->setAlternatingRowColors(true);
|
||||
w->setSortingEnabled(true);
|
||||
w->setObjectName("Sections." + moduleName);
|
||||
QStringList header;
|
||||
header.append(DebuggerPlugin::tr("Name"));
|
||||
header.append(DebuggerPlugin::tr("From"));
|
||||
header.append(DebuggerPlugin::tr("To"));
|
||||
header.append(DebuggerPlugin::tr("Address"));
|
||||
header.append(DebuggerPlugin::tr("Flags"));
|
||||
w->setHeaderLabels(header);
|
||||
w->setWindowTitle(DebuggerPlugin::tr("Sections in \"%1\"").arg(moduleName));
|
||||
for (const Section &s : sections) {
|
||||
auto it = new QTreeWidgetItem;
|
||||
it->setData(0, Qt::DisplayRole, s.name);
|
||||
it->setData(1, Qt::DisplayRole, s.from);
|
||||
it->setData(2, Qt::DisplayRole, s.to);
|
||||
it->setData(3, Qt::DisplayRole, s.address);
|
||||
it->setData(4, Qt::DisplayRole, s.flags);
|
||||
w->addTopLevelItem(it);
|
||||
}
|
||||
createNewDock(w);
|
||||
}
|
||||
|
||||
void openTextEditor(const QString &titlePattern0, const QString &contents)
|
||||
{
|
||||
if (dd->m_shuttingDown)
|
||||
|
@@ -2651,7 +2651,7 @@ static void handleShowModuleSymbols(const DebuggerResponse &response,
|
||||
}
|
||||
file.close();
|
||||
file.remove();
|
||||
Internal::showModuleSymbols(modulePath, symbols);
|
||||
DebuggerEngine::showModuleSymbols(modulePath, symbols);
|
||||
} else {
|
||||
AsynchronousMessageBox::critical(GdbEngine::tr("Cannot Read Symbols"),
|
||||
GdbEngine::tr("Cannot read symbols for module \"%1\".").arg(fileName));
|
||||
@@ -2716,7 +2716,7 @@ void GdbEngine::handleShowModuleSections(const DebuggerResponse &response,
|
||||
}
|
||||
}
|
||||
if (!sections.isEmpty())
|
||||
Internal::showModuleSections(moduleName, sections);
|
||||
DebuggerEngine::showModuleSections(moduleName, sections);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -669,7 +669,7 @@ void LldbEngine::requestModuleSymbols(const QString &moduleName)
|
||||
{
|
||||
DebuggerCommand cmd("fetchSymbols");
|
||||
cmd.arg("module", moduleName);
|
||||
cmd.callback = [moduleName](const DebuggerResponse &response) {
|
||||
cmd.callback = [this, moduleName](const DebuggerResponse &response) {
|
||||
const GdbMi &symbols = response.data["symbols"];
|
||||
QString moduleName = response.data["module"].data();
|
||||
Symbols syms;
|
||||
@@ -682,7 +682,7 @@ void LldbEngine::requestModuleSymbols(const QString &moduleName)
|
||||
symbol.demangled = item["demangled"].data();
|
||||
syms.append(symbol);
|
||||
}
|
||||
Internal::showModuleSymbols(moduleName, syms);
|
||||
showModuleSymbols(moduleName, syms);
|
||||
};
|
||||
runCommand(cmd);
|
||||
}
|
||||
|
@@ -369,7 +369,7 @@ void PdbEngine::refreshSymbols(const GdbMi &symbols)
|
||||
symbol.name = item["name"].data();
|
||||
syms.append(symbol);
|
||||
}
|
||||
Internal::showModuleSymbols(moduleName, syms);
|
||||
showModuleSymbols(moduleName, syms);
|
||||
}
|
||||
|
||||
bool PdbEngine::canHandleToolTip(const DebuggerToolTipContext &) const
|
||||
|
@@ -161,7 +161,7 @@ static void blockRecursion(const Overview &overview,
|
||||
// Go backwards in case someone has identical variables in the same scope.
|
||||
// Fixme: loop variables or similar are currently seen in the outer scope
|
||||
for (int s = scope->memberCount() - 1; s >= 0; --s){
|
||||
const Symbol *symbol = scope->memberAt(s);
|
||||
const CPlusPlus::Symbol *symbol = scope->memberAt(s);
|
||||
if (symbol->isDeclaration()) {
|
||||
// Find out about shadowed symbols by bookkeeping
|
||||
// the already seen occurrences in a hash.
|
||||
@@ -197,7 +197,7 @@ QStringList getUninitializedVariables(const Snapshot &snapshot,
|
||||
const Document::Ptr doc = docIt.value();
|
||||
// Look at symbol at line and find its function. Either it is the
|
||||
// function itself or some expression/variable.
|
||||
const Symbol *symbolAtLine = doc->lastVisibleSymbolAt(line, 0);
|
||||
const CPlusPlus::Symbol *symbolAtLine = doc->lastVisibleSymbolAt(line, 0);
|
||||
if (!symbolAtLine)
|
||||
return result;
|
||||
// First figure out the function to do a safety name check
|
||||
|
Reference in New Issue
Block a user