summaryrefslogtreecommitdiff
path: root/simpleperf/dso.h
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2015-07-21 11:24:48 -0700
committerYabin Cui <yabinc@google.com>2015-07-21 11:24:48 -0700
commitba50c4bba1c3ea7e98a475a3d2ae2e6c24ee81f2 (patch)
tree8aa964840533f82ae71d3f4e08bd1b7705dc4831 /simpleperf/dso.h
parentdece0f92f30bb6dbfd988907cda2bab15be2d732 (diff)
downloadextras-ba50c4bba1c3ea7e98a475a3d2ae2e6c24ee81f2.tar.gz
Simpleperf: load symbols from dso file only when necessary.
Bug: 22630113 Change-Id: I12bb24ec02ba3ddb94bcb2a26ae2d6e7b445ed4d
Diffstat (limited to 'simpleperf/dso.h')
-rw-r--r--simpleperf/dso.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/simpleperf/dso.h b/simpleperf/dso.h
index ba105c1c..8b83000b 100644
--- a/simpleperf/dso.h
+++ b/simpleperf/dso.h
@@ -36,11 +36,22 @@ struct SymbolComparator {
const std::unique_ptr<SymbolEntry>& symbol2);
};
+enum DsoType {
+ DSO_KERNEL,
+ DSO_KERNEL_MODULE,
+ DSO_ELF_FILE,
+};
+
struct DsoEntry {
+ DsoType type;
std::string path;
std::set<std::unique_ptr<SymbolEntry>, SymbolComparator> symbols;
+ DsoEntry(DsoType type, const std::string& path);
const SymbolEntry* FindSymbol(uint64_t offset_in_dso);
+
+ private:
+ bool is_loaded;
};
class DsoFactory {
@@ -50,12 +61,14 @@ class DsoFactory {
bool SetSymFsDir(const std::string& symfs_dir);
void SetVmlinux(const std::string& vmlinux);
void SetBuildIds(const std::vector<std::pair<std::string, BuildId>>& build_ids);
- std::unique_ptr<DsoEntry> LoadKernel();
- std::unique_ptr<DsoEntry> LoadKernelModule(const std::string& dso_path);
- std::unique_ptr<DsoEntry> LoadDso(const std::string& dso_path);
+ std::unique_ptr<DsoEntry> CreateDso(DsoType dso_type, const std::string& dso_path = "");
+ bool LoadDso(DsoEntry* dso);
private:
DsoFactory();
+ bool LoadKernel(DsoEntry* dso);
+ bool LoadKernelModule(DsoEntry* dso);
+ bool LoadElfFile(DsoEntry* dso);
BuildId GetExpectedBuildId(const std::string& filename);
bool demangle_;