summaryrefslogtreecommitdiff
path: root/simpleperf/OfflineUnwinder.cpp
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2018-03-20 15:29:03 -0700
committerYabin Cui <yabinc@google.com>2018-03-21 11:25:08 -0700
commitcdc11a390138765046c8d730708b86c63aa3c488 (patch)
tree922d8d40634818769985fff131605ae35fbf6c26 /simpleperf/OfflineUnwinder.cpp
parentdd4f07b1396db2b95d9dddad03b743eaca462c53 (diff)
downloadextras-cdc11a390138765046c8d730708b86c63aa3c488.tar.gz
simpleperf: support profiling jited java code.
1. For each jit symfile, generate a Mmap2Record with a special flag PROT_JIT_SYMFILE_MAP. 2. Call ReadMmapEventData() before dumping jit Mmap2Records, to keep the order of samples and mmap records. 3. Handle finding symbols from maps with PROT_JIT_SYMFILE_MAP flags. 4. Pass PROT_JIT_SYMFILE_MAP flag to libunwindstack, to unwind through jited methods. Bug: http://b/73127105 Test: run simpleperf manually. Test: run simpleperf_unit_test. Change-Id: I2b2f77ff457f7eb2f10193e987a181e4791a29ee
Diffstat (limited to 'simpleperf/OfflineUnwinder.cpp')
-rw-r--r--simpleperf/OfflineUnwinder.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/simpleperf/OfflineUnwinder.cpp b/simpleperf/OfflineUnwinder.cpp
index 9d561447..ebb0be9f 100644
--- a/simpleperf/OfflineUnwinder.cpp
+++ b/simpleperf/OfflineUnwinder.cpp
@@ -23,6 +23,7 @@
#include <unwindstack/MachineArm64.h>
#include <unwindstack/MachineX86.h>
#include <unwindstack/MachineX86_64.h>
+#include <unwindstack/Maps.h>
#include <unwindstack/Regs.h>
#include <unwindstack/RegsArm.h>
#include <unwindstack/RegsArm64.h>
@@ -38,6 +39,10 @@
#include "read_apk.h"
#include "thread_tree.h"
+static_assert(simpleperf::map_flags::PROT_JIT_SYMFILE_MAP == PROT_JIT_SYMFILE_MAP, "");
+static_assert(simpleperf::map_flags::PROT_JIT_SYMFILE_MAP ==
+ unwindstack::MAPS_FLAGS_JIT_SYMFILE_MAP, "");
+
namespace simpleperf {
static unwindstack::Regs* GetBacktraceRegs(const RegSet& regs) {
@@ -154,7 +159,7 @@ bool OfflineUnwinder::UnwindCallChain(const ThreadEntry& thread, const RegSet& r
}
}
}
- bt_map.flags = PROT_READ | PROT_EXEC;
+ bt_map.flags = PROT_READ | PROT_EXEC | map->flags;
}
cached_map.map.reset(BacktraceMap::CreateOffline(thread.pid, bt_maps));
if (!cached_map.map) {