Change dump-classes profman option to dump-classes-and-methods

The new option is called "--dump-classes-and-methods". This option
dumps methods and classes in the profile as a format that is valid
input for the "--create-profile-from" option.

The goal is to be able to store text based profiles that don't
depend on dex indices or checksums.

Test: mm test-art-host-gtest-profile_assistant_test -j40

Bug: 36457259
Bug: 34927277

(cherry picked from commit 09f6c36c0c5ac055bbb5e36991ab60156be1fb46)

Change-Id: I79c4bd8da5c0b4dc9c4c6daed538845792f52299
diff --git a/profman/profile_assistant_test.cc b/profman/profile_assistant_test.cc
index 94f6e70..38254e2 100644
--- a/profman/profile_assistant_test.cc
+++ b/profman/profile_assistant_test.cc
@@ -179,12 +179,12 @@
     return true;
   }
 
-  bool DumpClasses(const std::string& filename, std::string* file_contents) {
+  bool DumpClassesAndMethods(const std::string& filename, std::string* file_contents) {
     ScratchFile class_names_file;
     std::string profman_cmd = GetProfmanCmd();
     std::vector<std::string> argv_str;
     argv_str.push_back(profman_cmd);
-    argv_str.push_back("--dump-classes");
+    argv_str.push_back("--dump-classes-and-methods");
     argv_str.push_back("--profile-file=" + filename);
     argv_str.push_back("--apk=" + GetLibCoreDexFileNames()[0]);
     argv_str.push_back("--dex-location=" + GetLibCoreDexFileNames()[0]);
@@ -208,7 +208,7 @@
                               profile_file.GetFilename(),
                               GetLibCoreDexFileNames()[0]));
     profile_file.GetFile()->ResetOffset();
-    EXPECT_TRUE(DumpClasses(profile_file.GetFilename(), output_file_contents));
+    EXPECT_TRUE(DumpClassesAndMethods(profile_file.GetFilename(), output_file_contents));
     return true;
   }
 
@@ -501,18 +501,16 @@
   std::vector<std::string> class_names = {
     "Ljava/lang/Comparable;",
     "Ljava/lang/Math;",
-    "Ljava/lang/Object;"
+    "Ljava/lang/Object;",
+    "Ljava/lang/Object;-><init>()V"
   };
-  std::string input_file_contents;
-  std::string expected_contents;
+  std::string file_contents;
   for (std::string& class_name : class_names) {
-    input_file_contents += class_name + std::string("\n");
-    expected_contents += DescriptorToDot(class_name.c_str()) +
-        std::string("\n");
+    file_contents += class_name + std::string("\n");
   }
   std::string output_file_contents;
-  ASSERT_TRUE(CreateAndDump(input_file_contents, &output_file_contents));
-  ASSERT_EQ(output_file_contents, expected_contents);
+  ASSERT_TRUE(CreateAndDump(file_contents, &output_file_contents));
+  ASSERT_EQ(output_file_contents, file_contents);
 }
 
 TEST_F(ProfileAssistantTest, TestProfileCreationGenerateMethods) {
@@ -567,8 +565,8 @@
   std::string output_file_contents;
   ASSERT_TRUE(CreateAndDump(input_file_contents, &output_file_contents));
   std::string expected_contents =
-      DescriptorToDot(class_names[1].c_str()) + std::string("\n") +
-      DescriptorToDot(class_names[2].c_str()) + std::string("\n");
+      class_names[1] + std::string("\n") +
+      class_names[2] + std::string("\n");
   ASSERT_EQ(output_file_contents, expected_contents);
 }