OLD | NEW |
1 // Copyright (c) 2009, Google Inc. | 1 // Copyright (c) 2009, 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 } | 413 } |
414 | 414 |
415 static void | 415 static void |
416 ParseModuleStream(CrashedProcess* crashinfo, MMappedRange range) { | 416 ParseModuleStream(CrashedProcess* crashinfo, MMappedRange range) { |
417 const uint32_t num_mappings = | 417 const uint32_t num_mappings = |
418 *(const uint32_t*) range.GetObject(0, sizeof(uint32_t)); | 418 *(const uint32_t*) range.GetObject(0, sizeof(uint32_t)); |
419 for (unsigned i = 0; i < num_mappings; ++i) { | 419 for (unsigned i = 0; i < num_mappings; ++i) { |
420 CrashedProcess::Mapping mapping; | 420 CrashedProcess::Mapping mapping; |
421 const MDRawModule* rawmodule = | 421 const MDRawModule* rawmodule = |
422 (MDRawModule*) range.GetArrayElement(sizeof(uint32_t), | 422 (MDRawModule*) range.GetArrayElement(sizeof(uint32_t), |
423 sizeof(MDRawModule), i); | 423 MD_MODULE_SIZE, i); |
424 mapping.start_address = rawmodule->base_of_image; | 424 mapping.start_address = rawmodule->base_of_image; |
425 mapping.end_address = rawmodule->size_of_image + rawmodule->base_of_image; | 425 mapping.end_address = rawmodule->size_of_image + rawmodule->base_of_image; |
426 | 426 |
427 crashinfo->mappings.push_back(mapping); | 427 crashinfo->mappings.push_back(mapping); |
428 } | 428 } |
429 } | 429 } |
430 | 430 |
431 int | 431 int |
432 main(int argc, char** argv) { | 432 main(int argc, char** argv) { |
433 if (argc != 2) | 433 if (argc != 2) |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 for (unsigned i = 0; i < crashinfo.threads.size(); ++i) { | 594 for (unsigned i = 0; i < crashinfo.threads.size(); ++i) { |
595 const CrashedProcess::Thread& thread = crashinfo.threads[i]; | 595 const CrashedProcess::Thread& thread = crashinfo.threads[i]; |
596 if (!writea(1, thread.stack, thread.stack_length)) | 596 if (!writea(1, thread.stack, thread.stack_length)) |
597 return 1; | 597 return 1; |
598 } | 598 } |
599 | 599 |
600 munmap(const_cast<void*>(bytes), st.st_size); | 600 munmap(const_cast<void*>(bytes), st.st_size); |
601 | 601 |
602 return 0; | 602 return 0; |
603 } | 603 } |
OLD | NEW |