From df02b91e699dc9f07f277d91a4977e56a4493453 Mon Sep 17 00:00:00 2001 From: "Thomas (nezza-_-) Roth" Date: Sun, 10 Dec 2017 19:12:22 +0100 Subject: [PATCH] VisualNavbar: Use maps if no sections are available. (#199) --- src/widgets/VisualNavbar.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/widgets/VisualNavbar.cpp b/src/widgets/VisualNavbar.cpp index 86e4aea1..e3654718 100644 --- a/src/widgets/VisualNavbar.cpp +++ b/src/widgets/VisualNavbar.cpp @@ -162,6 +162,23 @@ void VisualNavbar::fetchData() } } + // If the file does not contain any sections we get the segments + // from the memory maps instead. + // It treats each map on its own, so overlapping maps will be shown + // seperated. + if (sections.count() == 0) + { + QJsonArray maps = Core()->cmdj("omj").array(); + for(QJsonValue mapValue : maps) + { + QJsonObject map = mapValue.toObject(); + MappedSegment mappedSegment; + mappedSegment.address_from = map["from"].toVariant().toULongLong(); + mappedSegment.address_to = map["to"].toVariant().toULongLong(); + mappedSegments.append(mappedSegment); + } + } + totalMappedSize = 0; for(auto &mappedSegment : mappedSegments) { @@ -379,12 +396,15 @@ QList VisualNavbar::sectionsForAddress(RVA address) QString VisualNavbar::toolTipForAddress(RVA address) { - QString ret = "Address: " + RAddressString(address) + "\n"; - ret += "Sections: \n"; + QString ret = "Address: " + RAddressString(address); auto sections = sectionsForAddress(address); - for(auto section : sections) + if(sections.count()) { - ret += " " + section + "\n"; + ret += "\nSections: \n"; + for(auto section : sections) + { + ret += " " + section + "\n"; + } } return ret; }