| OLD | NEW |
| 1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 if (!process_snapshot.InitializeException(exception_information_address)) { | 57 if (!process_snapshot.InitializeException(exception_information_address)) { |
| 58 LOG(WARNING) << "ProcessSnapshotWin::InitializeException failed"; | 58 LOG(WARNING) << "ProcessSnapshotWin::InitializeException failed"; |
| 59 return kFailedTerminationCode; | 59 return kFailedTerminationCode; |
| 60 } | 60 } |
| 61 | 61 |
| 62 // Now that we have the exception information, even if something else fails we | 62 // Now that we have the exception information, even if something else fails we |
| 63 // can terminate the process with the correct exit code. | 63 // can terminate the process with the correct exit code. |
| 64 const unsigned int termination_code = | 64 const unsigned int termination_code = |
| 65 process_snapshot.Exception()->Exception(); | 65 process_snapshot.Exception()->Exception(); |
| 66 | 66 |
| 67 // XXX XXX XXX |
| 68 ScopedFileHandle file(LoggingOpenFileForWrite( |
| 69 base::FilePath(FILE_PATH_LITERAL( |
| 70 "c:\\users\\scott\\desktop\\minidumpwritedump.dmp")), |
| 71 FileWriteMode::kTruncateOrCreate, |
| 72 FilePermissions::kWorldReadable)); |
| 73 MINIDUMP_EXCEPTION_INFORMATION minidump_exception_information; |
| 74 ExceptionInformation exception_information; |
| 75 ProcessReaderWin process_reader; |
| 76 if (!process_reader.Initialize(process, ProcessSuspensionState::kSuspended)) |
| 77 return false; |
| 78 if (!process_reader.ReadMemory(exception_information_address, |
| 79 sizeof(exception_information), |
| 80 &exception_information)) { |
| 81 LOG(WARNING) << "ReadMemory ExceptionInformation failed"; |
| 82 return false; |
| 83 } |
| 84 minidump_exception_information.ThreadId = |
| 85 static_cast<DWORD>(process_snapshot.Exception()->ThreadID()); |
| 86 minidump_exception_information.ExceptionPointers = |
| 87 reinterpret_cast<EXCEPTION_POINTERS*>( |
| 88 exception_information.exception_pointers); |
| 89 minidump_exception_information.ClientPointers = true; |
| 90 MiniDumpWriteDump(process, |
| 91 GetProcessId(process), |
| 92 file.get(), |
| 93 static_cast<MINIDUMP_TYPE>(MiniDumpWithFullMemory | |
| 94 MiniDumpWithHandleData), |
| 95 &minidump_exception_information, |
| 96 nullptr, |
| 97 nullptr); |
| 98 // XXX XXX XXX |
| 99 |
| 67 CrashpadInfoClientOptions client_options; | 100 CrashpadInfoClientOptions client_options; |
| 68 process_snapshot.GetCrashpadOptions(&client_options); | 101 process_snapshot.GetCrashpadOptions(&client_options); |
| 69 if (client_options.crashpad_handler_behavior != TriState::kDisabled) { | 102 if (client_options.crashpad_handler_behavior != TriState::kDisabled) { |
| 70 UUID client_id; | 103 UUID client_id; |
| 71 Settings* const settings = database_->GetSettings(); | 104 Settings* const settings = database_->GetSettings(); |
| 72 if (settings) { | 105 if (settings) { |
| 73 // If GetSettings() or GetClientID() fails, something else will log a | 106 // If GetSettings() or GetClientID() fails, something else will log a |
| 74 // message and client_id will be left at its default value, all zeroes, | 107 // message and client_id will be left at its default value, all zeroes, |
| 75 // which is appropriate. | 108 // which is appropriate. |
| 76 settings->GetClientID(&client_id); | 109 settings->GetClientID(&client_id); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 return termination_code; | 143 return termination_code; |
| 111 } | 144 } |
| 112 | 145 |
| 113 upload_thread_->ReportPending(); | 146 upload_thread_->ReportPending(); |
| 114 } | 147 } |
| 115 | 148 |
| 116 return termination_code; | 149 return termination_code; |
| 117 } | 150 } |
| 118 | 151 |
| 119 } // namespace crashpad | 152 } // namespace crashpad |
| OLD | NEW |