From e36de1b505b3a482c7db94d3d0c45765dfc6131b Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Mon, 5 Jan 2009 23:48:27 +0100 Subject: [PATCH] Convert parseSharedLibs() from QStrList to QStringList. At this opportunity we change the function so that it passes the result in the return value instead of a by-reference parameter. --- kdbg/dbgdriver.h | 3 +-- kdbg/debugger.cpp | 5 +---- kdbg/debugger.h | 2 +- kdbg/gdbdriver.cpp | 10 ++++++---- kdbg/gdbdriver.h | 2 +- kdbg/typetable.cpp | 10 ++++------ kdbg/typetable.h | 3 +-- kdbg/xsldbgdriver.cpp | 6 +++--- kdbg/xsldbgdriver.h | 2 +- 9 files changed, 19 insertions(+), 24 deletions(-) diff --git a/kdbg/dbgdriver.h b/kdbg/dbgdriver.h index e35adbd..f5f1f7d 100644 --- a/kdbg/dbgdriver.h +++ b/kdbg/dbgdriver.h @@ -19,7 +19,6 @@ class VarTree; class ExprValue; class ExprWnd; class KDebugger; -class QStrList; class QStringList; @@ -492,7 +491,7 @@ public: /** * Parses the output of the DCsharedlibs command. */ - virtual void parseSharedLibs(const char* output, QStrList& shlibs) = 0; + virtual QStringList parseSharedLibs(const char* output) = 0; /** * Parses the output of the DCfindType command. diff --git a/kdbg/debugger.cpp b/kdbg/debugger.cpp index 894efe7..6a09cf1 100644 --- a/kdbg/debugger.cpp +++ b/kdbg/debugger.cpp @@ -1787,11 +1787,8 @@ void KDebugger::evalStructExpression(VarTree* var, ExprWnd* wnd, bool immediate) void KDebugger::handleSharedLibs(const char* output) { - // delete all known libraries - m_sharedLibs.clear(); - // parse the table of shared libraries - m_d->parseSharedLibs(output, m_sharedLibs); + m_sharedLibs = m_d->parseSharedLibs(output); m_sharedLibsListed = true; // get type libraries diff --git a/kdbg/debugger.h b/kdbg/debugger.h index ae4dee2..7d2a367 100644 --- a/kdbg/debugger.h +++ b/kdbg/debugger.h @@ -410,7 +410,7 @@ protected: QString m_programWD; /* working directory of gdb */ QDict m_envVars; /* environment variables set by user */ QStringList m_boolOptions; /* boolean options */ - QStrList m_sharedLibs; /* shared libraries used by program */ + QStringList m_sharedLibs; /* shared libraries used by program */ ProgramTypeTable* m_typeTable; /* known types used by the program */ ProgramConfig* m_programConfig; /* program-specific settings (brkpts etc) */ void saveProgramSettings(); diff --git a/kdbg/gdbdriver.cpp b/kdbg/gdbdriver.cpp index 7282ecf..92b7f53 100644 --- a/kdbg/gdbdriver.cpp +++ b/kdbg/gdbdriver.cpp @@ -2140,17 +2140,18 @@ uint GdbDriver::parseProgramStopped(const char* output, QString& message) return flags; } -void GdbDriver::parseSharedLibs(const char* output, QStrList& shlibs) +QStringList GdbDriver::parseSharedLibs(const char* output) { + QStringList shlibs; if (strncmp(output, "No shared libraries loaded", 26) == 0) - return; + return shlibs; // parse the table of shared libraries // strip off head line output = strchr(output, '\n'); if (output == 0) - return; + return shlibs; output++; /* skip '\n' */ QString shlibName; while (*output != '\0') { @@ -2166,7 +2167,7 @@ void GdbDriver::parseSharedLibs(const char* output, QStrList& shlibs) } } if (*output == '\0') - return; + return shlibs; const char* start = output; output = strchr(output, '\n'); if (output == 0) @@ -2177,6 +2178,7 @@ void GdbDriver::parseSharedLibs(const char* output, QStrList& shlibs) shlibs.append(shlibName); TRACE("found shared lib " + shlibName); } + return shlibs; } bool GdbDriver::parseFindType(const char* output, QString& type) diff --git a/kdbg/gdbdriver.h b/kdbg/gdbdriver.h index 7fa0a9c..c92248a 100644 --- a/kdbg/gdbdriver.h +++ b/kdbg/gdbdriver.h @@ -65,7 +65,7 @@ public: virtual bool parseChangeExecutable(const char* output, QString& message); virtual bool parseCoreFile(const char* output); virtual uint parseProgramStopped(const char* output, QString& message); - virtual void parseSharedLibs(const char* output, QStrList& shlibs); + virtual QStringList parseSharedLibs(const char* output); virtual bool parseFindType(const char* output, QString& type); virtual std::list parseRegisters(const char* output); virtual bool parseInfoLine(const char* output, diff --git a/kdbg/typetable.cpp b/kdbg/typetable.cpp index fc0dd6d..3730f63 100644 --- a/kdbg/typetable.cpp +++ b/kdbg/typetable.cpp @@ -388,18 +388,16 @@ void ProgramTypeTable::registerAlias(const QString& name, TypeInfo* type) m_aliasDict.insert(name, type); } -void ProgramTypeTable::loadLibTypes(const QStrList& libs) +void ProgramTypeTable::loadLibTypes(const QStringList& libs) { - QStrListIterator it = libs; - - for (; it; ++it) + for (QStringList::const_iterator it = libs.begin(); it != libs.end(); ++it) { // look up the library for (std::list::iterator t = typeTables.begin(); t != typeTables.end(); ++t) { - if (t->matchFileName(it)) + if (t->matchFileName(*it)) { - TRACE("adding types for " + QString(it)); + TRACE("adding types for " + *it); loadTypeTable(&*t); } } diff --git a/kdbg/typetable.h b/kdbg/typetable.h index fc68998..1f1d77d 100644 --- a/kdbg/typetable.h +++ b/kdbg/typetable.h @@ -9,7 +9,6 @@ #include #include #include -#include class KConfigBase; @@ -142,7 +141,7 @@ public: /** * Load types belonging to the specified libraries. */ - void loadLibTypes(const QStrList& libs); + void loadLibTypes(const QStringList& libs); /** * Load types belonging to the specified type table diff --git a/kdbg/xsldbgdriver.cpp b/kdbg/xsldbgdriver.cpp index 2c24638..98f65f6 100644 --- a/kdbg/xsldbgdriver.cpp +++ b/kdbg/xsldbgdriver.cpp @@ -1403,10 +1403,10 @@ XsldbgDriver::parseProgramStopped(const char *output, QString & message) return flags; } -void -XsldbgDriver::parseSharedLibs(const char */*output*/, QStrList & /*shlibs*/) +QStringList +XsldbgDriver::parseSharedLibs(const char */*output*/) { - /* empty */ + return QStringList(); } bool diff --git a/kdbg/xsldbgdriver.h b/kdbg/xsldbgdriver.h index 4b20ebc..f27b09d 100644 --- a/kdbg/xsldbgdriver.h +++ b/kdbg/xsldbgdriver.h @@ -75,7 +75,7 @@ class XsldbgDriver:public DebuggerDriver { virtual bool parseCoreFile(const char *output); virtual uint parseProgramStopped(const char *output, QString & message); - virtual void parseSharedLibs(const char *output, QStrList & shlibs); + virtual QStringList parseSharedLibs(const char *output); virtual bool parseFindType(const char *output, QString & type); virtual std::list parseRegisters(const char *output); virtual bool parseInfoLine(const char *output, QString & addrFrom, -- 2.11.4.GIT