summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2016-07-07 10:56:47 -0700
committerYabin Cui <yabinc@google.com>2016-07-07 11:56:29 -0700
commitfaa512630a79455bde7b5b56929ea371c6f612bd (patch)
treea33aa10ea235cc42d54737b063cbaf8c120301ef
parent11615de8326ebec451e3011bf2875e811fddfcb2 (diff)
downloadextras-faa512630a79455bde7b5b56929ea371c6f612bd.tar.gz
simpleperf: add --symfs option for record command.
When running record command with -g or --dump-symbols command, files with symbol table and debug information are needed. Similar to report command, we can add --symfs option to record command. Bug: 28911532 Test: run simpleperf_unit_test. Change-Id: I8e2b6320ca29c8de78b4f217cd25e1ea4383150e
-rw-r--r--simpleperf/cmd_record.cpp10
-rw-r--r--simpleperf/cmd_record_test.cpp2
2 files changed, 12 insertions, 0 deletions
diff --git a/simpleperf/cmd_record.cpp b/simpleperf/cmd_record.cpp
index 441c7332..0e6b64e5 100644
--- a/simpleperf/cmd_record.cpp
+++ b/simpleperf/cmd_record.cpp
@@ -129,6 +129,9 @@ class RecordCommand : public Command {
" will be unwound while recording by default. But it may lose\n"
" records as stacking unwinding can be time consuming. Use this\n"
" option to unwind the user's stack after recording.\n"
+"--symfs <dir> Look for files with symbols relative to this directory.\n"
+" This option is used to provide files with symbol table and\n"
+" debug information, which are used by --dump-symbols and -g.\n"
"-t tid1,tid2,... Record events on existing threads. Mutually exclusive with -a.\n"
// clang-format on
),
@@ -463,6 +466,13 @@ bool RecordCommand::ParseOptions(const std::vector<std::string>& args,
}
} else if (args[i] == "--post-unwind") {
post_unwind_ = true;
+ } else if (args[i] == "--symfs") {
+ if (!NextArgumentOrError(args, &i)) {
+ return false;
+ }
+ if (!Dso::SetSymFsDir(args[i])) {
+ return false;
+ }
} else if (args[i] == "-t") {
if (!NextArgumentOrError(args, &i)) {
return false;
diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp
index ed199c95..ebca0101 100644
--- a/simpleperf/cmd_record_test.cpp
+++ b/simpleperf/cmd_record_test.cpp
@@ -299,3 +299,5 @@ TEST(record_cmd, group_option) {
"cpu-cycles:u,cpu-clock:u", "--group",
"cpu-cycles:k,cpu-clock:k"}));
}
+
+TEST(record_cmd, symfs_option) { ASSERT_TRUE(RunRecordCmd({"--symfs", "/"})); }