summaryrefslogtreecommitdiff
path: root/simpleperf/read_dex_file.h
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2018-03-26 17:34:00 -0700
committerYabin Cui <yabinc@google.com>2018-03-28 17:16:27 -0700
commit516a87cd05e6f7dcf2c45fd8ba6d1d0e1e1e7bdd (patch)
tree642ab8433692d1862900ac93c7a24fc131ef4822 /simpleperf/read_dex_file.h
parent81ed0ea0e64d536287e823431f4999f183cc3cf1 (diff)
downloadextras-516a87cd05e6f7dcf2c45fd8ba6d1d0e1e1e7bdd.tar.gz
simpleperf: support showing symbols for interpreted java code.
To convert from a dex_pc (returned by libunwindstack) to a symbol name, we need below things: 1. The mapping info of the vdex file containing the dex_pc. 2. The offsets of dex files in the vdex file. So make below changes: 1. Record none executable maps when profiling java code. 2. Refactor dso code to add a new type for dex file, using DexFileDso to store dex file offsets in a vdex file, and load symbols from that vdex file. 3. Add read_dex_file.cpp to read java symbols using libdexfile. 4. Change the format of file section in record_file_format.h, to store dex file offsets in vdex files. Bug: http://b/73126888 Bug: http://b/77236599 Test: Run simpleperf to profile several apps manually, can see Test: callstacks of both java code and native code. Test: Run simpleperf_unit_test. Change-Id: I08005a03beb3df1a70db034bc463f555934856ba
Diffstat (limited to 'simpleperf/read_dex_file.h')
-rw-r--r--simpleperf/read_dex_file.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/simpleperf/read_dex_file.h b/simpleperf/read_dex_file.h
new file mode 100644
index 00000000..cd01f586
--- /dev/null
+++ b/simpleperf/read_dex_file.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SIMPLE_PERF_READ_DEX_FILE_H_
+#define SIMPLE_PERF_READ_DEX_FILE_H_
+
+#include <inttypes.h>
+
+#include <string>
+#include <vector>
+
+struct DexFileSymbol {
+ uint64_t offset;
+ uint64_t len;
+ std::string name;
+};
+
+bool ReadSymbolsFromDexFile(const std::string& file_path,
+ const std::vector<uint64_t>& dex_file_offsets,
+ std::vector<DexFileSymbol>* symbols);
+
+#endif // SIMPLE_PERF_READ_DEX_FILE_H_