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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 using google_breakpad::LinuxPtraceDumper; | 55 using google_breakpad::LinuxPtraceDumper; |
56 using google_breakpad::MappingInfo; | 56 using google_breakpad::MappingInfo; |
57 using google_breakpad::MappingList; | 57 using google_breakpad::MappingList; |
58 using google_breakpad::MicrodumpExtraInfo; | 58 using google_breakpad::MicrodumpExtraInfo; |
59 using google_breakpad::RawContextCPU; | 59 using google_breakpad::RawContextCPU; |
60 using google_breakpad::ThreadInfo; | 60 using google_breakpad::ThreadInfo; |
61 using google_breakpad::UContextReader; | 61 using google_breakpad::UContextReader; |
62 | 62 |
63 const size_t kLineBufferSize = 2048; | 63 const size_t kLineBufferSize = 2048; |
64 | 64 |
| 65 #if !defined(__LP64__) |
| 66 // The following are only used by DumpFreeSpace, so need to be compiled |
| 67 // in conditionally in the same way. |
| 68 |
65 template <typename Dst, typename Src> | 69 template <typename Dst, typename Src> |
66 Dst saturated_cast(Src src) { | 70 Dst saturated_cast(Src src) { |
67 if (src >= std::numeric_limits<Dst>::max()) | 71 if (src >= std::numeric_limits<Dst>::max()) |
68 return std::numeric_limits<Dst>::max(); | 72 return std::numeric_limits<Dst>::max(); |
69 if (src <= std::numeric_limits<Dst>::min()) | 73 if (src <= std::numeric_limits<Dst>::min()) |
70 return std::numeric_limits<Dst>::min(); | 74 return std::numeric_limits<Dst>::min(); |
71 return static_cast<Dst>(src); | 75 return static_cast<Dst>(src); |
72 } | 76 } |
73 | 77 |
74 int Log2Floor(uint64_t n) { | 78 int Log2Floor(uint64_t n) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 size_t best = invalid; | 119 size_t best = invalid; |
116 for (size_t next = 0; next < mappings.size(); ++next) { | 120 for (size_t next = 0; next < mappings.size(); ++next) { |
117 if (MappingLessThan(mappings[curr], mappings[next]) && | 121 if (MappingLessThan(mappings[curr], mappings[next]) && |
118 (best == invalid || MappingLessThan(mappings[next], mappings[best]))) { | 122 (best == invalid || MappingLessThan(mappings[next], mappings[best]))) { |
119 best = next; | 123 best = next; |
120 } | 124 } |
121 } | 125 } |
122 return best; | 126 return best; |
123 } | 127 } |
124 | 128 |
| 129 #endif // !__LP64__ |
| 130 |
125 class MicrodumpWriter { | 131 class MicrodumpWriter { |
126 public: | 132 public: |
127 MicrodumpWriter(const ExceptionHandler::CrashContext* context, | 133 MicrodumpWriter(const ExceptionHandler::CrashContext* context, |
128 const MappingList& mappings, | 134 const MappingList& mappings, |
129 const MicrodumpExtraInfo& microdump_extra_info, | 135 const MicrodumpExtraInfo& microdump_extra_info, |
130 LinuxDumper* dumper) | 136 LinuxDumper* dumper) |
131 : ucontext_(context ? &context->context : NULL), | 137 : ucontext_(context ? &context->context : NULL), |
132 #if !defined(__ARM_EABI__) && !defined(__mips__) | 138 #if !defined(__ARM_EABI__) && !defined(__mips__) |
133 float_state_(context ? &context->float_state : NULL), | 139 float_state_(context ? &context->float_state : NULL), |
134 #endif | 140 #endif |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 dumper.set_crash_signal(context->siginfo.si_signo); | 590 dumper.set_crash_signal(context->siginfo.si_signo); |
585 dumper.set_crash_thread(context->tid); | 591 dumper.set_crash_thread(context->tid); |
586 } | 592 } |
587 MicrodumpWriter writer(context, mappings, microdump_extra_info, &dumper); | 593 MicrodumpWriter writer(context, mappings, microdump_extra_info, &dumper); |
588 if (!writer.Init()) | 594 if (!writer.Init()) |
589 return false; | 595 return false; |
590 return writer.Dump(); | 596 return writer.Dump(); |
591 } | 597 } |
592 | 598 |
593 } // namespace google_breakpad | 599 } // namespace google_breakpad |
OLD | NEW |