| OLD | NEW |
| 1 // Copyright (c) 2014, Google Inc. | 1 // Copyright (c) 2014, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 google_breakpad::ProcessResult result = | 121 google_breakpad::ProcessResult result = |
| 122 ProcessMicrodump("", "This is not a valid microdump", &state); | 122 ProcessMicrodump("", "This is not a valid microdump", &state); |
| 123 ASSERT_EQ(google_breakpad::PROCESS_ERROR_NO_THREAD_LIST, result); | 123 ASSERT_EQ(google_breakpad::PROCESS_ERROR_NO_THREAD_LIST, result); |
| 124 } | 124 } |
| 125 | 125 |
| 126 TEST_F(MicrodumpProcessorTest, TestProcess_MissingSymbols) { | 126 TEST_F(MicrodumpProcessorTest, TestProcess_MissingSymbols) { |
| 127 ProcessState state; | 127 ProcessState state; |
| 128 AnalyzeDump("microdump-arm64.dmp", &state, true /* omit_symbols */); | 128 AnalyzeDump("microdump-arm64.dmp", &state, true /* omit_symbols */); |
| 129 | 129 |
| 130 ASSERT_EQ(8U, state.modules()->module_count()); | 130 ASSERT_EQ(8U, state.modules()->module_count()); |
| 131 ASSERT_EQ("aarch64", state.system_info()->cpu); | 131 ASSERT_EQ("arm64", state.system_info()->cpu); |
| 132 ASSERT_EQ("OS 64 VERSION INFO", state.system_info()->os_version); | 132 ASSERT_EQ("OS 64 VERSION INFO", state.system_info()->os_version); |
| 133 ASSERT_EQ(1U, state.threads()->size()); | 133 ASSERT_EQ(1U, state.threads()->size()); |
| 134 ASSERT_EQ(12U, state.threads()->at(0)->frames()->size()); | 134 ASSERT_EQ(12U, state.threads()->at(0)->frames()->size()); |
| 135 | 135 |
| 136 ASSERT_EQ("", | 136 ASSERT_EQ("", |
| 137 state.threads()->at(0)->frames()->at(0)->function_name); | 137 state.threads()->at(0)->frames()->at(0)->function_name); |
| 138 ASSERT_EQ("", | 138 ASSERT_EQ("", |
| 139 state.threads()->at(0)->frames()->at(3)->function_name); | 139 state.threads()->at(0)->frames()->at(3)->function_name); |
| 140 } | 140 } |
| 141 | 141 |
| 142 TEST_F(MicrodumpProcessorTest, TestProcess_UnsupportedArch) { | 142 TEST_F(MicrodumpProcessorTest, TestProcess_UnsupportedArch) { |
| 143 string microdump_contents = | 143 string microdump_contents = |
| 144 "W/google-breakpad(26491): -----BEGIN BREAKPAD MICRODUMP-----\n" | 144 "W/google-breakpad(26491): -----BEGIN BREAKPAD MICRODUMP-----\n" |
| 145 "W/google-breakpad(26491): O A \"unsupported-arch\"\n" | 145 "W/google-breakpad(26491): O A \"unsupported-arch\"\n" |
| 146 "W/google-breakpad(26491): S 0 A48BD840 A48BD000 00002000\n"; | 146 "W/google-breakpad(26491): S 0 A48BD840 A48BD000 00002000\n"; |
| 147 | 147 |
| 148 ProcessState state; | 148 ProcessState state; |
| 149 | 149 |
| 150 google_breakpad::ProcessResult result = | 150 google_breakpad::ProcessResult result = |
| 151 ProcessMicrodump("", microdump_contents, &state); | 151 ProcessMicrodump("", microdump_contents, &state); |
| 152 | 152 |
| 153 ASSERT_EQ(google_breakpad::PROCESS_ERROR_NO_THREAD_LIST, result); | 153 ASSERT_EQ(google_breakpad::PROCESS_ERROR_NO_THREAD_LIST, result); |
| 154 } | 154 } |
| 155 | 155 |
| 156 TEST_F(MicrodumpProcessorTest, TestProcessArm) { | 156 TEST_F(MicrodumpProcessorTest, TestProcessArm) { |
| 157 ProcessState state; | 157 ProcessState state; |
| 158 AnalyzeDump("microdump-arm.dmp", &state, false /* omit_symbols */); | 158 AnalyzeDump("microdump-arm.dmp", &state, false /* omit_symbols */); |
| 159 | 159 |
| 160 ASSERT_EQ(6U, state.modules()->module_count()); | 160 ASSERT_EQ(6U, state.modules()->module_count()); |
| 161 ASSERT_EQ("armv7l", state.system_info()->cpu); | 161 ASSERT_EQ("arm", state.system_info()->cpu); |
| 162 ASSERT_EQ("OS VERSION INFO", state.system_info()->os_version); | 162 ASSERT_EQ("OS VERSION INFO", state.system_info()->os_version); |
| 163 ASSERT_EQ(8U, state.threads()->at(0)->frames()->size()); | 163 ASSERT_EQ(8U, state.threads()->at(0)->frames()->size()); |
| 164 ASSERT_EQ("MicrodumpWriterTest_Setup_Test::TestBody", | 164 ASSERT_EQ("MicrodumpWriterTest_Setup_Test::TestBody", |
| 165 state.threads()->at(0)->frames()->at(0)->function_name); | 165 state.threads()->at(0)->frames()->at(0)->function_name); |
| 166 ASSERT_EQ("testing::Test::Run", | 166 ASSERT_EQ("testing::Test::Run", |
| 167 state.threads()->at(0)->frames()->at(1)->function_name); | 167 state.threads()->at(0)->frames()->at(1)->function_name); |
| 168 ASSERT_EQ("main", | 168 ASSERT_EQ("main", |
| 169 state.threads()->at(0)->frames()->at(6)->function_name); | 169 state.threads()->at(0)->frames()->at(6)->function_name); |
| 170 ASSERT_EQ("breakpad_unittests", | 170 ASSERT_EQ("breakpad_unittests", |
| 171 state.threads()->at(0)->frames()->at(6)->module->code_file()); | 171 state.threads()->at(0)->frames()->at(6)->module->code_file()); |
| 172 } | 172 } |
| 173 | 173 |
| 174 TEST_F(MicrodumpProcessorTest, TestProcessArm64) { | 174 TEST_F(MicrodumpProcessorTest, TestProcessArm64) { |
| 175 ProcessState state; | 175 ProcessState state; |
| 176 AnalyzeDump("microdump-arm64.dmp", &state, false /* omit_symbols */); | 176 AnalyzeDump("microdump-arm64.dmp", &state, false /* omit_symbols */); |
| 177 | 177 |
| 178 ASSERT_EQ(8U, state.modules()->module_count()); | 178 ASSERT_EQ(8U, state.modules()->module_count()); |
| 179 ASSERT_EQ("aarch64", state.system_info()->cpu); | 179 ASSERT_EQ("arm64", state.system_info()->cpu); |
| 180 ASSERT_EQ("OS 64 VERSION INFO", state.system_info()->os_version); | 180 ASSERT_EQ("OS 64 VERSION INFO", state.system_info()->os_version); |
| 181 ASSERT_EQ(9U, state.threads()->at(0)->frames()->size()); | 181 ASSERT_EQ(9U, state.threads()->at(0)->frames()->size()); |
| 182 ASSERT_EQ("MicrodumpWriterTest_Setup_Test::TestBody", | 182 ASSERT_EQ("MicrodumpWriterTest_Setup_Test::TestBody", |
| 183 state.threads()->at(0)->frames()->at(0)->function_name); | 183 state.threads()->at(0)->frames()->at(0)->function_name); |
| 184 ASSERT_EQ("testing::Test::Run", | 184 ASSERT_EQ("testing::Test::Run", |
| 185 state.threads()->at(0)->frames()->at(2)->function_name); | 185 state.threads()->at(0)->frames()->at(2)->function_name); |
| 186 ASSERT_EQ("main", | 186 ASSERT_EQ("main", |
| 187 state.threads()->at(0)->frames()->at(7)->function_name); | 187 state.threads()->at(0)->frames()->at(7)->function_name); |
| 188 ASSERT_EQ("breakpad_unittests", | 188 ASSERT_EQ("breakpad_unittests", |
| 189 state.threads()->at(0)->frames()->at(7)->module->code_file()); | 189 state.threads()->at(0)->frames()->at(7)->module->code_file()); |
| 190 } | 190 } |
| 191 | 191 |
| 192 } // namespace | 192 } // namespace |
| 193 | 193 |
| 194 int main(int argc, char* argv[]) { | 194 int main(int argc, char* argv[]) { |
| 195 ::testing::InitGoogleTest(&argc, argv); | 195 ::testing::InitGoogleTest(&argc, argv); |
| 196 return RUN_ALL_TESTS(); | 196 return RUN_ALL_TESTS(); |
| 197 } | 197 } |
| OLD | NEW |