AllocationData::DisplayId AllocationData::display = AllocationData::DisplayId::malloc;
+bool AccumulatedTraceData::isHideUnmanagedStackParts = false;
+
namespace {
template <typename Base>
while (find(opNewIpIndices.begin(), opNewIpIndices.end(), node.ipIndex) != opNewIpIndices.end()) {
node = findTrace(node.parentIndex);
}
+
+ if (isHideUnmanagedStackParts) {
+ while (node.ipIndex) {
+ const auto& ip = findIp(node.ipIndex);
+
+ if (ip.isManaged)
+ {
+ break;
+ }
+
+ node = findTrace(node.parentIndex);
+ }
+ }
+
traces.push_back(node);
} else if (reader.mode() == 'i') {
if (pass != FirstPass) {
}
InstructionPointer ip;
reader >> ip.instructionPointer;
+ reader >> ip.isManaged;
reader >> ip.moduleIndex;
reader >> ip.moduleOffset;
uint64_t moduleOffset = 0;
Frame frame;
std::vector<Frame> inlined;
+ int isManaged;
bool compareWithoutAddress(const InstructionPointer& other) const
{
std::vector<AllocationInfo> allocationInfos;
AddressRangesMap addressRangeInfos;
+
+ static bool isHideUnmanagedStackParts;
};
#endif // ACCUMULATEDTRACEDATA_H
#include <KAboutData>
#include <KLocalizedString>
+#include "../accumulatedtracedata.h"
#include "../allocationdata.h"
#include "mainwindow.h"
parser.addOption(showPrivateCleanOption);
parser.addOption(showSharedOption);
+ QCommandLineOption hideUnmanagedStackPartsOption(QStringLiteral("hide-unmanaged-stacks"), QStringLiteral("Hide unmanaged parts of call stacks"));
+ parser.addOption(hideUnmanagedStackPartsOption);
+
parser.process(app);
aboutData.processCommandLine(&parser);
bool isShowPrivateDirty = parser.isSet(showPrivateDirtyOption);
bool isShowPrivateClean = parser.isSet(showPrivateCleanOption);
bool isShowShared = parser.isSet(showSharedOption);
+ bool isHideUnmanagedStackParts = parser.isSet(hideUnmanagedStackPartsOption);
if ((isShowMalloc ? 1 : 0)
+ (isShowPrivateDirty ? 1 : 0)
AllocationData::display = AllocationData::DisplayId::shared;
}
+ if (isHideUnmanagedStackParts) {
+ AccumulatedTraceData::isHideUnmanagedStackParts = true;
+ }
+
auto createWindow = []() -> MainWindow* {
auto window = new MainWindow;
window->setAttribute(Qt::WA_DeleteOnClose);
const auto& trace = data.findTrace(traceIndex);
const auto& ip = data.findIp(trace.ipIndex);
- auto location = data.stringCache.location(trace.ipIndex, ip, isUntrackedLocation);
- rows = addRow(rows, location, *stats);
- for (const auto& inlined : ip.inlined) {
- auto inlinedLocation = data.stringCache.frameLocation(inlined, ip, isUntrackedLocation);
- rows = addRow(rows, inlinedLocation, *stats);
- }
+ if (!(AccumulatedTraceData::isHideUnmanagedStackParts && !ip.isManaged)) {
+ auto location = data.stringCache.location(trace.ipIndex, ip, isUntrackedLocation);
+ rows = addRow(rows, location, *stats);
+ for (const auto& inlined : ip.inlined) {
+ auto inlinedLocation = data.stringCache.frameLocation(inlined, ip, isUntrackedLocation);
+ rows = addRow(rows, inlinedLocation, *stats);
+ }
+ }
if (data.isStopIndex(ip.frame.functionIndex)) {
break;
}
if (isManaged) {
size_t functionIndex = intern(m_managedNames[instructionPointer]);
- fprintf(stdout, "i %llx 0 0 %zx\n", (1ull << 63) | instructionPointer, functionIndex);
+ fprintf(stdout, "i %llx 1 0 0 %zx\n", (1ull << 63) | instructionPointer, functionIndex);
} else {
const auto ip = resolve(instructionPointer);
- fprintf(stdout, "i %zx %zx %zx", instructionPointer, ip.moduleIndex, ip.frame.moduleOffset);
+ fprintf(stdout, "i %zx 0 %zx %zx", instructionPointer, ip.moduleIndex, ip.frame.moduleOffset);
if (ip.frame.functionIndex || ip.frame.fileIndex) {
fprintf(stdout, " %zx", ip.frame.functionIndex);
if (ip.frame.fileIndex) {
void* managedStack[Trace::MAX_SIZE];
int managedStackSize = 0;
- managedStack[managedStackSize++] = (void *) (uintptr_t) -1;
+ handleIP((void *) (uintptr_t) -1, false);
while (stackIter != nullptr && managedStackSize < Trace::MAX_SIZE) {
void *ip = reinterpret_cast<void *>(stackIter->m_funcId);