diff options
author | Yabin Cui <yabinc@google.com> | 2015-10-01 19:02:28 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-10-01 19:02:28 +0000 |
commit | 8f9dfc5e5af5c833e78d8caff2cd538ee6807aad (patch) | |
tree | 18f8cdb1ccfcd604d5662c7676dcf3bc79e4d396 /simpleperf | |
parent | 66059d6acd45ad1e674db44f5bd90fc36d5f87e9 (diff) | |
parent | eac5440e1fcff3ba0b5ed0779f962e9405918e06 (diff) | |
download | extras-8f9dfc5e5af5c833e78d8caff2cd538ee6807aad.tar.gz |
am eac5440e: Merge "Simpleperf: warn if it can\'t read kernel symbols addresses."
* commit 'eac5440e1fcff3ba0b5ed0779f962e9405918e06':
Simpleperf: warn if it can't read kernel symbols addresses.
Diffstat (limited to 'simpleperf')
-rw-r--r-- | simpleperf/cmd_help.cpp | 2 | ||||
-rw-r--r-- | simpleperf/darwin_support/darwin_support.cpp | 3 | ||||
-rw-r--r-- | simpleperf/dso.cpp | 15 | ||||
-rw-r--r-- | simpleperf/dwarf_unwind.cpp | 13 | ||||
-rw-r--r-- | simpleperf/dwarf_unwind.h | 2 | ||||
-rw-r--r-- | simpleperf/main.cpp | 2 |
6 files changed, 24 insertions, 13 deletions
diff --git a/simpleperf/cmd_help.cpp b/simpleperf/cmd_help.cpp index cc66376b..72a42365 100644 --- a/simpleperf/cmd_help.cpp +++ b/simpleperf/cmd_help.cpp @@ -60,7 +60,7 @@ void HelpCommand::PrintShortHelp() { "common options:\n" " -h/--help Print this help information.\n" " --log <severity> Set the minimum severity of logging. Possible severities\n" - " include debug, warning, error, fatal. Default is error.\n" + " include debug, warning, error, fatal. Default is warning.\n" "subcommands:\n"); for (auto& cmd_name : GetAllCommandNames()) { std::unique_ptr<Command> cmd = CreateCommandInstance(cmd_name); diff --git a/simpleperf/darwin_support/darwin_support.cpp b/simpleperf/darwin_support/darwin_support.cpp index 0b27a8fe..cdfcdb14 100644 --- a/simpleperf/darwin_support/darwin_support.cpp +++ b/simpleperf/darwin_support/darwin_support.cpp @@ -20,8 +20,7 @@ #include "dwarf_unwind.h" #include "environment.h" -std::vector<uint64_t> UnwindCallChain(const ThreadEntry&, const RegSet&, - const std::vector<char>&) { +std::vector<uint64_t> UnwindCallChain(const ThreadEntry&, const RegSet&, const std::vector<char>&) { return std::vector<uint64_t>(); } diff --git a/simpleperf/dso.cpp b/simpleperf/dso.cpp index 69cbcc3c..13f2bfe3 100644 --- a/simpleperf/dso.cpp +++ b/simpleperf/dso.cpp @@ -150,7 +150,6 @@ struct SymbolComparator { } }; - std::string Dso::GetAccessiblePath() const { return symfs_dir_ + path_; } @@ -228,8 +227,22 @@ bool Dso::LoadKernel() { return false; } } + ProcessKernelSymbols("/proc/kallsyms", std::bind(&KernelSymbolCallback, std::placeholders::_1, this)); + bool allZero = true; + for (auto& symbol : symbols_) { + if (symbol.addr != 0) { + allZero = false; + break; + } + } + if (allZero) { + LOG(WARNING) << "Symbol addresses in /proc/kallsyms are all zero. Check " + "/proc/sys/kernel/kptr_restrict if possible."; + symbols_.clear(); + return false; + } } return true; } diff --git a/simpleperf/dwarf_unwind.cpp b/simpleperf/dwarf_unwind.cpp index cd51a13c..1d0f7ae0 100644 --- a/simpleperf/dwarf_unwind.cpp +++ b/simpleperf/dwarf_unwind.cpp @@ -23,12 +23,12 @@ #include "thread_tree.h" -#define SetUContextReg(dst, perf_regno) \ - do { \ - uint64_t value; \ +#define SetUContextReg(dst, perf_regno) \ + do { \ + uint64_t value; \ if (GetRegValue(regs, perf_regno, &value)) { \ - dst = value; \ - } \ + dst = value; \ + } \ } while (0) static ucontext_t BuildUContextFromRegs(const RegSet& regs __attribute__((unused))) { @@ -94,8 +94,7 @@ static ucontext_t BuildUContextFromRegs(const RegSet& regs __attribute__((unused return ucontext; } -std::vector<uint64_t> UnwindCallChain(const ThreadEntry& thread, - const RegSet& regs, +std::vector<uint64_t> UnwindCallChain(const ThreadEntry& thread, const RegSet& regs, const std::vector<char>& stack) { std::vector<uint64_t> result; if (GetCurrentArch() != GetBuildArch()) { diff --git a/simpleperf/dwarf_unwind.h b/simpleperf/dwarf_unwind.h index f6a58a1e..671013ea 100644 --- a/simpleperf/dwarf_unwind.h +++ b/simpleperf/dwarf_unwind.h @@ -24,6 +24,6 @@ struct ThreadEntry; std::vector<uint64_t> UnwindCallChain(const ThreadEntry& thread, const RegSet& regs, - const std::vector<char>& stack); + const std::vector<char>& stack); #endif // SIMPLE_PERF_DWARF_UNWIND_H_ diff --git a/simpleperf/main.cpp b/simpleperf/main.cpp index 7cc04b82..6b204ecf 100644 --- a/simpleperf/main.cpp +++ b/simpleperf/main.cpp @@ -33,7 +33,7 @@ static std::map<std::string, android::base::LogSeverity> log_severity_map = { int main(int argc, char** argv) { InitLogging(argv, android::base::StderrLogger); std::vector<std::string> args; - android::base::LogSeverity log_severity = android::base::ERROR; + android::base::LogSeverity log_severity = android::base::WARNING; if (argc == 1) { args.push_back("help"); |