From: Yabin Cui Date: Thu, 7 Jul 2016 17:56:47 +0000 (-0700) Subject: simpleperf: add --symfs option for record command. X-Git-Tag: android-x86-8.1-r1~68^2~140^2^2~19^2~59^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=faa512630a79455bde7b5b56929ea371c6f612bd;p=android-x86%2Fsystem-extras.git 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 --- 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 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& 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", "/"})); }