OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 MinidumpLocationDescriptorListAtStart(file_writer.string(), 1); | 63 MinidumpLocationDescriptorListAtStart(file_writer.string(), 1); |
64 ASSERT_TRUE(module_list); | 64 ASSERT_TRUE(module_list); |
65 | 65 |
66 const MinidumpModuleCrashpadInfo* module = | 66 const MinidumpModuleCrashpadInfo* module = |
67 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>( | 67 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>( |
68 file_writer.string(), module_list->children[0]); | 68 file_writer.string(), module_list->children[0]); |
69 ASSERT_TRUE(module); | 69 ASSERT_TRUE(module); |
70 | 70 |
71 EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module->version); | 71 EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module->version); |
72 EXPECT_EQ(0u, module->minidump_module_list_index); | 72 EXPECT_EQ(0u, module->minidump_module_list_index); |
| 73 EXPECT_EQ(0u, module->list_annotations.DataSize); |
| 74 EXPECT_EQ(0u, module->list_annotations.Rva); |
73 EXPECT_EQ(0u, module->simple_annotations.DataSize); | 75 EXPECT_EQ(0u, module->simple_annotations.DataSize); |
74 EXPECT_EQ(0u, module->simple_annotations.Rva); | 76 EXPECT_EQ(0u, module->simple_annotations.Rva); |
75 } | 77 } |
76 | 78 |
77 TEST(MinidumpModuleCrashpadInfoWriter, FullModule) { | 79 TEST(MinidumpModuleCrashpadInfoWriter, FullModule) { |
78 const uint32_t kMinidumpModuleListIndex = 1; | 80 const uint32_t kMinidumpModuleListIndex = 1; |
79 const char kKey[] = "key"; | 81 const char kKey[] = "key"; |
80 const char kValue[] = "value"; | 82 const char kValue[] = "value"; |
| 83 const char kEntry[] = "entry"; |
| 84 std::vector<std::string> vector(1, std::string(kEntry)); |
81 | 85 |
82 StringFileWriter file_writer; | 86 StringFileWriter file_writer; |
83 | 87 |
84 MinidumpModuleCrashpadInfoListWriter module_list_writer; | 88 MinidumpModuleCrashpadInfoListWriter module_list_writer; |
85 | 89 |
86 auto module_writer = | 90 auto module_writer = |
87 make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter()); | 91 make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter()); |
88 module_writer->SetMinidumpModuleListIndex(kMinidumpModuleListIndex); | 92 module_writer->SetMinidumpModuleListIndex(kMinidumpModuleListIndex); |
| 93 auto string_list_writer = |
| 94 make_scoped_ptr(new internal::MinidumpUTF8StringListWriter()); |
| 95 string_list_writer->InitializeFromVector(vector); |
| 96 module_writer->SetListAnnotations(string_list_writer.Pass()); |
89 auto simple_string_dictionary_writer = | 97 auto simple_string_dictionary_writer = |
90 make_scoped_ptr(new MinidumpSimpleStringDictionaryWriter()); | 98 make_scoped_ptr(new MinidumpSimpleStringDictionaryWriter()); |
91 auto simple_string_dictionary_entry_writer = | 99 auto simple_string_dictionary_entry_writer = |
92 make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter()); | 100 make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter()); |
93 simple_string_dictionary_entry_writer->SetKeyValue(kKey, kValue); | 101 simple_string_dictionary_entry_writer->SetKeyValue(kKey, kValue); |
94 simple_string_dictionary_writer->AddEntry( | 102 simple_string_dictionary_writer->AddEntry( |
95 simple_string_dictionary_entry_writer.Pass()); | 103 simple_string_dictionary_entry_writer.Pass()); |
96 module_writer->SetSimpleAnnotations(simple_string_dictionary_writer.Pass()); | 104 module_writer->SetSimpleAnnotations(simple_string_dictionary_writer.Pass()); |
97 EXPECT_TRUE(module_writer->IsUseful()); | 105 EXPECT_TRUE(module_writer->IsUseful()); |
98 module_list_writer.AddModule(module_writer.Pass()); | 106 module_list_writer.AddModule(module_writer.Pass()); |
99 | 107 |
100 EXPECT_TRUE(module_list_writer.WriteEverything(&file_writer)); | 108 EXPECT_TRUE(module_list_writer.WriteEverything(&file_writer)); |
101 ASSERT_EQ(sizeof(MinidumpModuleCrashpadInfoList) + | 109 ASSERT_EQ(sizeof(MinidumpModuleCrashpadInfoList) + |
102 sizeof(MINIDUMP_LOCATION_DESCRIPTOR) + | 110 sizeof(MINIDUMP_LOCATION_DESCRIPTOR) + |
103 sizeof(MinidumpModuleCrashpadInfo) + | 111 sizeof(MinidumpModuleCrashpadInfo) + |
| 112 sizeof(MinidumpRVAList) + |
| 113 sizeof(RVA) + |
104 sizeof(MinidumpSimpleStringDictionary) + | 114 sizeof(MinidumpSimpleStringDictionary) + |
105 sizeof(MinidumpSimpleStringDictionaryEntry) + | 115 sizeof(MinidumpSimpleStringDictionaryEntry) + |
| 116 sizeof(MinidumpUTF8String) + arraysize(kEntry) + 2 + // padding |
106 sizeof(MinidumpUTF8String) + arraysize(kKey) + | 117 sizeof(MinidumpUTF8String) + arraysize(kKey) + |
107 sizeof(MinidumpUTF8String) + arraysize(kValue), | 118 sizeof(MinidumpUTF8String) + arraysize(kValue), |
108 file_writer.string().size()); | 119 file_writer.string().size()); |
109 | 120 |
110 const MinidumpModuleCrashpadInfoList* module_list = | 121 const MinidumpModuleCrashpadInfoList* module_list = |
111 MinidumpLocationDescriptorListAtStart(file_writer.string(), 1); | 122 MinidumpLocationDescriptorListAtStart(file_writer.string(), 1); |
112 ASSERT_TRUE(module_list); | 123 ASSERT_TRUE(module_list); |
113 | 124 |
114 const MinidumpModuleCrashpadInfo* module = | 125 const MinidumpModuleCrashpadInfo* module = |
115 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>( | 126 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>( |
116 file_writer.string(), module_list->children[0]); | 127 file_writer.string(), module_list->children[0]); |
117 ASSERT_TRUE(module); | 128 ASSERT_TRUE(module); |
118 | 129 |
119 EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module->version); | 130 EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module->version); |
120 EXPECT_EQ(kMinidumpModuleListIndex, module->minidump_module_list_index); | 131 EXPECT_EQ(kMinidumpModuleListIndex, module->minidump_module_list_index); |
| 132 EXPECT_NE(0u, module->list_annotations.DataSize); |
| 133 EXPECT_NE(0u, module->list_annotations.Rva); |
121 EXPECT_NE(0u, module->simple_annotations.DataSize); | 134 EXPECT_NE(0u, module->simple_annotations.DataSize); |
122 EXPECT_NE(0u, module->simple_annotations.Rva); | 135 EXPECT_NE(0u, module->simple_annotations.Rva); |
123 | 136 |
| 137 const MinidumpRVAList* list_annotations = |
| 138 MinidumpWritableAtLocationDescriptor<MinidumpRVAList>( |
| 139 file_writer.string(), module->list_annotations); |
| 140 ASSERT_TRUE(list_annotations); |
| 141 |
| 142 ASSERT_EQ(1u, list_annotations->count); |
| 143 EXPECT_EQ(kEntry, MinidumpUTF8StringAtRVAAsString( |
| 144 file_writer.string(), list_annotations->children[0])); |
| 145 |
124 const MinidumpSimpleStringDictionary* simple_annotations = | 146 const MinidumpSimpleStringDictionary* simple_annotations = |
125 MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>( | 147 MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>( |
126 file_writer.string(), module->simple_annotations); | 148 file_writer.string(), module->simple_annotations); |
127 ASSERT_TRUE(simple_annotations); | 149 ASSERT_TRUE(simple_annotations); |
128 | 150 |
129 ASSERT_EQ(1u, simple_annotations->count); | 151 ASSERT_EQ(1u, simple_annotations->count); |
130 EXPECT_EQ(kKey, | 152 EXPECT_EQ(kKey, |
131 MinidumpUTF8StringAtRVAAsString( | 153 MinidumpUTF8StringAtRVAAsString( |
132 file_writer.string(), simple_annotations->entries[0].key)); | 154 file_writer.string(), simple_annotations->entries[0].key)); |
133 EXPECT_EQ(kValue, | 155 EXPECT_EQ(kValue, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 ASSERT_TRUE(module_list); | 220 ASSERT_TRUE(module_list); |
199 | 221 |
200 const MinidumpModuleCrashpadInfo* module_0 = | 222 const MinidumpModuleCrashpadInfo* module_0 = |
201 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>( | 223 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>( |
202 file_writer.string(), module_list->children[0]); | 224 file_writer.string(), module_list->children[0]); |
203 ASSERT_TRUE(module_0); | 225 ASSERT_TRUE(module_0); |
204 | 226 |
205 EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module_0->version); | 227 EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module_0->version); |
206 EXPECT_EQ(kMinidumpModuleListIndex0, module_0->minidump_module_list_index); | 228 EXPECT_EQ(kMinidumpModuleListIndex0, module_0->minidump_module_list_index); |
207 | 229 |
| 230 const MinidumpRVAList* list_annotations_0 = |
| 231 MinidumpWritableAtLocationDescriptor<MinidumpRVAList>( |
| 232 file_writer.string(), module_0->list_annotations); |
| 233 EXPECT_FALSE(list_annotations_0); |
| 234 |
208 const MinidumpSimpleStringDictionary* simple_annotations_0 = | 235 const MinidumpSimpleStringDictionary* simple_annotations_0 = |
209 MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>( | 236 MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>( |
210 file_writer.string(), module_0->simple_annotations); | 237 file_writer.string(), module_0->simple_annotations); |
211 ASSERT_TRUE(simple_annotations_0); | 238 ASSERT_TRUE(simple_annotations_0); |
212 | 239 |
213 ASSERT_EQ(1u, simple_annotations_0->count); | 240 ASSERT_EQ(1u, simple_annotations_0->count); |
214 EXPECT_EQ(kKey0, | 241 EXPECT_EQ(kKey0, |
215 MinidumpUTF8StringAtRVAAsString( | 242 MinidumpUTF8StringAtRVAAsString( |
216 file_writer.string(), simple_annotations_0->entries[0].key)); | 243 file_writer.string(), simple_annotations_0->entries[0].key)); |
217 EXPECT_EQ(kValue0, | 244 EXPECT_EQ(kValue0, |
218 MinidumpUTF8StringAtRVAAsString( | 245 MinidumpUTF8StringAtRVAAsString( |
219 file_writer.string(), simple_annotations_0->entries[0].value)); | 246 file_writer.string(), simple_annotations_0->entries[0].value)); |
220 | 247 |
221 const MinidumpModuleCrashpadInfo* module_1 = | 248 const MinidumpModuleCrashpadInfo* module_1 = |
222 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>( | 249 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>( |
223 file_writer.string(), module_list->children[1]); | 250 file_writer.string(), module_list->children[1]); |
224 ASSERT_TRUE(module_1); | 251 ASSERT_TRUE(module_1); |
225 | 252 |
226 EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module_1->version); | 253 EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module_1->version); |
227 EXPECT_EQ(kMinidumpModuleListIndex1, module_1->minidump_module_list_index); | 254 EXPECT_EQ(kMinidumpModuleListIndex1, module_1->minidump_module_list_index); |
228 | 255 |
| 256 const MinidumpRVAList* list_annotations_1 = |
| 257 MinidumpWritableAtLocationDescriptor<MinidumpRVAList>( |
| 258 file_writer.string(), module_1->list_annotations); |
| 259 EXPECT_FALSE(list_annotations_1); |
| 260 |
229 const MinidumpSimpleStringDictionary* simple_annotations_1 = | 261 const MinidumpSimpleStringDictionary* simple_annotations_1 = |
230 MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>( | 262 MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>( |
231 file_writer.string(), module_1->simple_annotations); | 263 file_writer.string(), module_1->simple_annotations); |
232 EXPECT_FALSE(simple_annotations_1); | 264 EXPECT_FALSE(simple_annotations_1); |
233 | 265 |
234 const MinidumpModuleCrashpadInfo* module_2 = | 266 const MinidumpModuleCrashpadInfo* module_2 = |
235 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>( | 267 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>( |
236 file_writer.string(), module_list->children[2]); | 268 file_writer.string(), module_list->children[2]); |
237 ASSERT_TRUE(module_2); | 269 ASSERT_TRUE(module_2); |
238 | 270 |
239 EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module_2->version); | 271 EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module_2->version); |
240 EXPECT_EQ(kMinidumpModuleListIndex2, module_2->minidump_module_list_index); | 272 EXPECT_EQ(kMinidumpModuleListIndex2, module_2->minidump_module_list_index); |
241 | 273 |
| 274 const MinidumpRVAList* list_annotations_2 = |
| 275 MinidumpWritableAtLocationDescriptor<MinidumpRVAList>( |
| 276 file_writer.string(), module_2->list_annotations); |
| 277 EXPECT_FALSE(list_annotations_2); |
| 278 |
242 const MinidumpSimpleStringDictionary* simple_annotations_2 = | 279 const MinidumpSimpleStringDictionary* simple_annotations_2 = |
243 MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>( | 280 MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>( |
244 file_writer.string(), module_2->simple_annotations); | 281 file_writer.string(), module_2->simple_annotations); |
245 ASSERT_TRUE(simple_annotations_2); | 282 ASSERT_TRUE(simple_annotations_2); |
246 | 283 |
247 ASSERT_EQ(2u, simple_annotations_2->count); | 284 ASSERT_EQ(2u, simple_annotations_2->count); |
248 EXPECT_EQ(kKey2A, | 285 EXPECT_EQ(kKey2A, |
249 MinidumpUTF8StringAtRVAAsString( | 286 MinidumpUTF8StringAtRVAAsString( |
250 file_writer.string(), simple_annotations_2->entries[0].key)); | 287 file_writer.string(), simple_annotations_2->entries[0].key)); |
251 EXPECT_EQ(kValue2A, | 288 EXPECT_EQ(kValue2A, |
252 MinidumpUTF8StringAtRVAAsString( | 289 MinidumpUTF8StringAtRVAAsString( |
253 file_writer.string(), simple_annotations_2->entries[0].value)); | 290 file_writer.string(), simple_annotations_2->entries[0].value)); |
254 EXPECT_EQ(kKey2B, | 291 EXPECT_EQ(kKey2B, |
255 MinidumpUTF8StringAtRVAAsString( | 292 MinidumpUTF8StringAtRVAAsString( |
256 file_writer.string(), simple_annotations_2->entries[1].key)); | 293 file_writer.string(), simple_annotations_2->entries[1].key)); |
257 EXPECT_EQ(kValue2B, | 294 EXPECT_EQ(kValue2B, |
258 MinidumpUTF8StringAtRVAAsString( | 295 MinidumpUTF8StringAtRVAAsString( |
259 file_writer.string(), simple_annotations_2->entries[1].value)); | 296 file_writer.string(), simple_annotations_2->entries[1].value)); |
260 } | 297 } |
261 | 298 |
262 TEST(MinidumpModuleCrashpadInfoWriter, InitializeFromSnapshot) { | 299 TEST(MinidumpModuleCrashpadInfoWriter, InitializeFromSnapshot) { |
263 const char kKey0A[] = "k"; | 300 const char kKey0A[] = "k"; |
264 const char kValue0A[] = "value"; | 301 const char kValue0A[] = "value"; |
265 const char kKey0B[] = "hudson"; | 302 const char kKey0B[] = "hudson"; |
266 const char kValue0B[] = "estuary"; | 303 const char kValue0B[] = "estuary"; |
267 const char kKey2[] = "k"; | 304 const char kKey2[] = "k"; |
268 const char kValue2[] = "different_value"; | 305 const char kValue2[] = "different_value"; |
| 306 const char kEntry3A[] = "list"; |
| 307 const char kEntry3B[] = "erine"; |
269 | 308 |
270 std::vector<const ModuleSnapshot*> module_snapshots; | 309 std::vector<const ModuleSnapshot*> module_snapshots; |
271 | 310 |
272 TestModuleSnapshot module_snapshot_0; | 311 TestModuleSnapshot module_snapshot_0; |
273 std::map<std::string, std::string> annotations_simple_map_0; | 312 std::map<std::string, std::string> annotations_simple_map_0; |
274 annotations_simple_map_0[kKey0A] = kValue0A; | 313 annotations_simple_map_0[kKey0A] = kValue0A; |
275 annotations_simple_map_0[kKey0B] = kValue0B; | 314 annotations_simple_map_0[kKey0B] = kValue0B; |
276 module_snapshot_0.SetAnnotationsSimpleMap(annotations_simple_map_0); | 315 module_snapshot_0.SetAnnotationsSimpleMap(annotations_simple_map_0); |
277 module_snapshots.push_back(&module_snapshot_0); | 316 module_snapshots.push_back(&module_snapshot_0); |
278 | 317 |
279 // module_snapshot_1 is not expected to be written because it would not carry | 318 // module_snapshot_1 is not expected to be written because it would not carry |
280 // any MinidumpModuleCrashpadInfo data. | 319 // any MinidumpModuleCrashpadInfo data. |
281 TestModuleSnapshot module_snapshot_1; | 320 TestModuleSnapshot module_snapshot_1; |
282 module_snapshots.push_back(&module_snapshot_1); | 321 module_snapshots.push_back(&module_snapshot_1); |
283 | 322 |
284 TestModuleSnapshot module_snapshot_2; | 323 TestModuleSnapshot module_snapshot_2; |
285 std::map<std::string, std::string> annotations_simple_map_2; | 324 std::map<std::string, std::string> annotations_simple_map_2; |
286 annotations_simple_map_2[kKey2] = kValue2; | 325 annotations_simple_map_2[kKey2] = kValue2; |
287 module_snapshot_2.SetAnnotationsSimpleMap(annotations_simple_map_2); | 326 module_snapshot_2.SetAnnotationsSimpleMap(annotations_simple_map_2); |
288 module_snapshots.push_back(&module_snapshot_2); | 327 module_snapshots.push_back(&module_snapshot_2); |
289 | 328 |
| 329 TestModuleSnapshot module_snapshot_3; |
| 330 std::vector<std::string> annotations_vector_3; |
| 331 annotations_vector_3.push_back(kEntry3A); |
| 332 annotations_vector_3.push_back(kEntry3B); |
| 333 module_snapshot_3.SetAnnotationsVector(annotations_vector_3); |
| 334 module_snapshots.push_back(&module_snapshot_3); |
| 335 |
290 MinidumpModuleCrashpadInfoListWriter module_list_writer; | 336 MinidumpModuleCrashpadInfoListWriter module_list_writer; |
291 module_list_writer.InitializeFromSnapshot(module_snapshots); | 337 module_list_writer.InitializeFromSnapshot(module_snapshots); |
292 | 338 |
293 StringFileWriter file_writer; | 339 StringFileWriter file_writer; |
294 ASSERT_TRUE(module_list_writer.WriteEverything(&file_writer)); | 340 ASSERT_TRUE(module_list_writer.WriteEverything(&file_writer)); |
295 | 341 |
296 const MinidumpModuleCrashpadInfoList* module_list = | 342 const MinidumpModuleCrashpadInfoList* module_list = |
297 MinidumpLocationDescriptorListAtStart(file_writer.string(), 2); | 343 MinidumpLocationDescriptorListAtStart(file_writer.string(), 3); |
298 ASSERT_TRUE(module_list); | 344 ASSERT_TRUE(module_list); |
299 | 345 |
300 const MinidumpModuleCrashpadInfo* module_0 = | 346 const MinidumpModuleCrashpadInfo* module_0 = |
301 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>( | 347 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>( |
302 file_writer.string(), module_list->children[0]); | 348 file_writer.string(), module_list->children[0]); |
303 ASSERT_TRUE(module_0); | 349 ASSERT_TRUE(module_0); |
304 | 350 |
305 EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module_0->version); | 351 EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module_0->version); |
306 EXPECT_EQ(0u, module_0->minidump_module_list_index); | 352 EXPECT_EQ(0u, module_0->minidump_module_list_index); |
307 | 353 |
| 354 const MinidumpRVAList* list_annotations_0 = |
| 355 MinidumpWritableAtLocationDescriptor<MinidumpRVAList>( |
| 356 file_writer.string(), module_0->list_annotations); |
| 357 EXPECT_FALSE(list_annotations_0); |
| 358 |
308 const MinidumpSimpleStringDictionary* simple_annotations_0 = | 359 const MinidumpSimpleStringDictionary* simple_annotations_0 = |
309 MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>( | 360 MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>( |
310 file_writer.string(), module_0->simple_annotations); | 361 file_writer.string(), module_0->simple_annotations); |
311 ASSERT_TRUE(simple_annotations_0); | 362 ASSERT_TRUE(simple_annotations_0); |
312 | 363 |
313 ASSERT_EQ(annotations_simple_map_0.size(), simple_annotations_0->count); | 364 ASSERT_EQ(annotations_simple_map_0.size(), simple_annotations_0->count); |
314 EXPECT_EQ(kKey0B, | 365 EXPECT_EQ(kKey0B, |
315 MinidumpUTF8StringAtRVAAsString( | 366 MinidumpUTF8StringAtRVAAsString( |
316 file_writer.string(), simple_annotations_0->entries[0].key)); | 367 file_writer.string(), simple_annotations_0->entries[0].key)); |
317 EXPECT_EQ(kValue0B, | 368 EXPECT_EQ(kValue0B, |
318 MinidumpUTF8StringAtRVAAsString( | 369 MinidumpUTF8StringAtRVAAsString( |
319 file_writer.string(), simple_annotations_0->entries[0].value)); | 370 file_writer.string(), simple_annotations_0->entries[0].value)); |
320 EXPECT_EQ(kKey0A, | 371 EXPECT_EQ(kKey0A, |
321 MinidumpUTF8StringAtRVAAsString( | 372 MinidumpUTF8StringAtRVAAsString( |
322 file_writer.string(), simple_annotations_0->entries[1].key)); | 373 file_writer.string(), simple_annotations_0->entries[1].key)); |
323 EXPECT_EQ(kValue0A, | 374 EXPECT_EQ(kValue0A, |
324 MinidumpUTF8StringAtRVAAsString( | 375 MinidumpUTF8StringAtRVAAsString( |
325 file_writer.string(), simple_annotations_0->entries[1].value)); | 376 file_writer.string(), simple_annotations_0->entries[1].value)); |
326 | 377 |
327 const MinidumpModuleCrashpadInfo* module_2 = | 378 const MinidumpModuleCrashpadInfo* module_2 = |
328 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>( | 379 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>( |
329 file_writer.string(), module_list->children[1]); | 380 file_writer.string(), module_list->children[1]); |
330 ASSERT_TRUE(module_2); | 381 ASSERT_TRUE(module_2); |
331 | 382 |
332 EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module_2->version); | 383 EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module_2->version); |
333 EXPECT_EQ(2u, module_2->minidump_module_list_index); | 384 EXPECT_EQ(2u, module_2->minidump_module_list_index); |
334 | 385 |
| 386 const MinidumpRVAList* list_annotations_2 = |
| 387 MinidumpWritableAtLocationDescriptor<MinidumpRVAList>( |
| 388 file_writer.string(), module_2->list_annotations); |
| 389 EXPECT_FALSE(list_annotations_2); |
| 390 |
335 const MinidumpSimpleStringDictionary* simple_annotations_2 = | 391 const MinidumpSimpleStringDictionary* simple_annotations_2 = |
336 MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>( | 392 MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>( |
337 file_writer.string(), module_2->simple_annotations); | 393 file_writer.string(), module_2->simple_annotations); |
338 ASSERT_TRUE(simple_annotations_2); | 394 ASSERT_TRUE(simple_annotations_2); |
339 | 395 |
340 ASSERT_EQ(annotations_simple_map_2.size(), simple_annotations_2->count); | 396 ASSERT_EQ(annotations_simple_map_2.size(), simple_annotations_2->count); |
341 EXPECT_EQ(kKey2, | 397 EXPECT_EQ(kKey2, |
342 MinidumpUTF8StringAtRVAAsString( | 398 MinidumpUTF8StringAtRVAAsString( |
343 file_writer.string(), simple_annotations_2->entries[0].key)); | 399 file_writer.string(), simple_annotations_2->entries[0].key)); |
344 EXPECT_EQ(kValue2, | 400 EXPECT_EQ(kValue2, |
345 MinidumpUTF8StringAtRVAAsString( | 401 MinidumpUTF8StringAtRVAAsString( |
346 file_writer.string(), simple_annotations_2->entries[0].value)); | 402 file_writer.string(), simple_annotations_2->entries[0].value)); |
| 403 |
| 404 const MinidumpModuleCrashpadInfo* module_3 = |
| 405 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>( |
| 406 file_writer.string(), module_list->children[2]); |
| 407 ASSERT_TRUE(module_3); |
| 408 |
| 409 EXPECT_EQ(MinidumpModuleCrashpadInfo::kVersion, module_3->version); |
| 410 EXPECT_EQ(3u, module_3->minidump_module_list_index); |
| 411 |
| 412 const MinidumpRVAList* list_annotations_3 = |
| 413 MinidumpWritableAtLocationDescriptor<MinidumpRVAList>( |
| 414 file_writer.string(), module_3->list_annotations); |
| 415 ASSERT_TRUE(list_annotations_3); |
| 416 |
| 417 ASSERT_EQ(annotations_vector_3.size(), list_annotations_3->count); |
| 418 EXPECT_EQ(kEntry3A, |
| 419 MinidumpUTF8StringAtRVAAsString( |
| 420 file_writer.string(), list_annotations_3->children[0])); |
| 421 EXPECT_EQ(kEntry3B, |
| 422 MinidumpUTF8StringAtRVAAsString( |
| 423 file_writer.string(), list_annotations_3->children[1])); |
| 424 |
| 425 const MinidumpSimpleStringDictionary* simple_annotations_3 = |
| 426 MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>( |
| 427 file_writer.string(), module_3->simple_annotations); |
| 428 EXPECT_FALSE(simple_annotations_3); |
347 } | 429 } |
348 | 430 |
349 } // namespace | 431 } // namespace |
350 } // namespace test | 432 } // namespace test |
351 } // namespace crashpad | 433 } // namespace crashpad |
OLD | NEW |