forked from qt-creator/qt-creator
Debugger: Populate parts of Modules view with LLDB backend
Shared objects seem to get reported twice by LLDB. Ignore that for now. Change-Id: I1d49200a54f10ea8a2768e4dd623541a3d4f80e7 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -516,7 +516,7 @@ try:
|
|||||||
result += ",file=\"%s\"" % frame.line_entry.file
|
result += ",file=\"%s\"" % frame.line_entry.file
|
||||||
result += "}},"
|
result += "}},"
|
||||||
|
|
||||||
result += "],current-thread-id=\"%s\"}" % lldb.process.GetSelectedThread().id
|
result += "],current-thread-id=\"%s\"}" % lldb.process.selected_thread.id
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def stackData(options):
|
def stackData(options):
|
||||||
@@ -560,6 +560,23 @@ try:
|
|||||||
result += threadsData(parseOptions(threadOptions))
|
result += threadsData(parseOptions(threadOptions))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def listModules():
|
||||||
|
result = "modules={"
|
||||||
|
for module in lldb.target.modules:
|
||||||
|
result += "{file=\"%s\"" % module.file.fullpath
|
||||||
|
result += ",name=\"%s\"" % module.file.basename
|
||||||
|
#result += ",addrsize=\"%s\"" % module.addr_size
|
||||||
|
#result += ",triple=\"%s\"" % module.triple
|
||||||
|
#result += ",sections={"
|
||||||
|
#for section in module.sections:
|
||||||
|
# result += "[name=\"%s\"" % section.name
|
||||||
|
# result += ",addr=\"%s\"" % section.addr
|
||||||
|
# result += ",size=\"%s\"]," % section.size
|
||||||
|
#result += "}"
|
||||||
|
result += "},"
|
||||||
|
result += "]"
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
except:
|
except:
|
||||||
#warn("LOADING LLDB FAILED")
|
#warn("LOADING LLDB FAILED")
|
||||||
|
|||||||
@@ -440,28 +440,23 @@ void LldbEngine::loadAllSymbols()
|
|||||||
|
|
||||||
void LldbEngine::reloadModules()
|
void LldbEngine::reloadModules()
|
||||||
{
|
{
|
||||||
//postCommand("qdebug('listmodules')", CB(handleListModules));
|
postCommand("script listModules()", CB(handleListModules));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LldbEngine::handleListModules(const LldbResponse &response)
|
void LldbEngine::handleListModules(const LldbResponse &response)
|
||||||
{
|
{
|
||||||
GdbMi out;
|
GdbMi all = parseFromString(response.data, "modules");
|
||||||
out.fromString(response.data.trimmed());
|
GdbMi mods = all.findChild("modules");
|
||||||
Modules modules;
|
Modules modules;
|
||||||
foreach (const GdbMi &item, out.children()) {
|
foreach (const GdbMi &item, mods.children()) {
|
||||||
Module module;
|
Module module;
|
||||||
module.moduleName = _(item.findChild("name").data());
|
module.modulePath = QString::fromUtf8(item.findChild("file").data());
|
||||||
QString path = _(item.findChild("value").data());
|
module.moduleName = QString::fromUtf8(item.findChild("name").data());
|
||||||
int pos = path.indexOf(_("' from '"));
|
module.symbolsRead = Module::UnknownReadState;
|
||||||
if (pos != -1) {
|
module.startAddress = 0;
|
||||||
path = path.mid(pos + 8);
|
// item.findChild("loaded_addr").data().toULongLong(0, 0);
|
||||||
if (path.size() >= 2)
|
module.endAddress = 0; // FIXME: End address not easily available.
|
||||||
path.chop(2);
|
//modulesHandler()->updateModule(module);
|
||||||
} else if (path.startsWith(_("<module '"))
|
|
||||||
&& path.endsWith(_("' (built-in)>"))) {
|
|
||||||
path = _("(builtin)");
|
|
||||||
}
|
|
||||||
module.modulePath = path;
|
|
||||||
modules.append(module);
|
modules.append(module);
|
||||||
}
|
}
|
||||||
modulesHandler()->setModules(modules);
|
modulesHandler()->setModules(modules);
|
||||||
@@ -823,11 +818,11 @@ void LldbEngine::updateData(DataKind kind)
|
|||||||
CB(handleUpdateData));
|
CB(handleUpdateData));
|
||||||
}
|
}
|
||||||
|
|
||||||
GdbMi LldbEngine::parseFromString(QByteArray out)
|
GdbMi LldbEngine::parseFromString(QByteArray out, const QByteArray &firstTopLevel)
|
||||||
{
|
{
|
||||||
GdbMi all;
|
GdbMi all;
|
||||||
|
|
||||||
int pos = out.indexOf("data=");
|
int pos = out.indexOf(firstTopLevel + "=");
|
||||||
if (pos == -1) {
|
if (pos == -1) {
|
||||||
showMessage(_("UNEXPECTED LOCALS OUTPUT:" + out));
|
showMessage(_("UNEXPECTED LOCALS OUTPUT:" + out));
|
||||||
return all;
|
return all;
|
||||||
@@ -852,8 +847,7 @@ GdbMi LldbEngine::parseFromString(QByteArray out)
|
|||||||
void LldbEngine::handleUpdateData(const LldbResponse &response)
|
void LldbEngine::handleUpdateData(const LldbResponse &response)
|
||||||
{
|
{
|
||||||
//qDebug() << " LOCALS: '" << response.data << "'";
|
//qDebug() << " LOCALS: '" << response.data << "'";
|
||||||
GdbMi all = parseFromString(response.data);
|
GdbMi all = parseFromString(response.data, "data");
|
||||||
|
|
||||||
GdbMi vars = all.findChild("data");
|
GdbMi vars = all.findChild("data");
|
||||||
if (vars.isValid()) {
|
if (vars.isValid()) {
|
||||||
const bool partial = response.cookie.toBool();
|
const bool partial = response.cookie.toBool();
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ private:
|
|||||||
const char *callbackName = 0,
|
const char *callbackName = 0,
|
||||||
const QVariant &cookie = QVariant());
|
const QVariant &cookie = QVariant());
|
||||||
void postDirectCommand(const QByteArray &command);
|
void postDirectCommand(const QByteArray &command);
|
||||||
GdbMi parseFromString(QByteArray out);
|
GdbMi parseFromString(QByteArray out, const QByteArray &firstTopLevel);
|
||||||
|
|
||||||
QQueue<LldbCommand> m_commands;
|
QQueue<LldbCommand> m_commands;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user