mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2025-01-09 00:25:41 +00:00
Don't use CRT in exception handler code (#86). r=bryner
http://groups.google.com/group/airbag-dev/browse_thread/thread/f671277ebd6ea7fd git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@73 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
373c49b416
commit
ed61ae0bbd
|
@ -173,14 +173,9 @@ bool ExceptionHandler::WriteMinidump(const wstring &dump_path,
|
||||||
|
|
||||||
bool ExceptionHandler::WriteMinidumpWithException(DWORD requesting_thread_id,
|
bool ExceptionHandler::WriteMinidumpWithException(DWORD requesting_thread_id,
|
||||||
EXCEPTION_POINTERS *exinfo) {
|
EXCEPTION_POINTERS *exinfo) {
|
||||||
wchar_t dump_file_name[MAX_PATH];
|
|
||||||
WindowsStringUtils::safe_swprintf(dump_file_name, MAX_PATH, L"%s\\%s.dmp",
|
|
||||||
dump_path_.c_str(),
|
|
||||||
next_minidump_id_.c_str());
|
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if (minidump_write_dump_) {
|
if (minidump_write_dump_) {
|
||||||
HANDLE dump_file = CreateFile(dump_file_name,
|
HANDLE dump_file = CreateFile(next_minidump_path_.c_str(),
|
||||||
GENERIC_WRITE,
|
GENERIC_WRITE,
|
||||||
FILE_SHARE_WRITE,
|
FILE_SHARE_WRITE,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -239,6 +234,12 @@ void ExceptionHandler::UpdateNextID() {
|
||||||
GUID id;
|
GUID id;
|
||||||
CoCreateGuid(&id);
|
CoCreateGuid(&id);
|
||||||
next_minidump_id_ = GUIDString::GUIDToWString(&id);
|
next_minidump_id_ = GUIDString::GUIDToWString(&id);
|
||||||
|
|
||||||
|
wchar_t minidump_path[MAX_PATH];
|
||||||
|
WindowsStringUtils::safe_swprintf(minidump_path, MAX_PATH, L"%s\\%s.dmp",
|
||||||
|
dump_path_.c_str(),
|
||||||
|
next_minidump_id_.c_str());
|
||||||
|
next_minidump_path_ = minidump_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace google_airbag
|
} // namespace google_airbag
|
||||||
|
|
|
@ -93,7 +93,10 @@ class ExceptionHandler {
|
||||||
|
|
||||||
// Get and set the minidump path.
|
// Get and set the minidump path.
|
||||||
wstring dump_path() const { return dump_path_; }
|
wstring dump_path() const { return dump_path_; }
|
||||||
void set_dump_path(const wstring &dump_path) { dump_path_ = dump_path; }
|
void set_dump_path(const wstring &dump_path) {
|
||||||
|
dump_path_ = dump_path;
|
||||||
|
UpdateNextID(); // Necessary to put dump_path_ in next_minidump_path_.
|
||||||
|
}
|
||||||
|
|
||||||
// Writes a minidump immediately. This can be used to capture the
|
// Writes a minidump immediately. This can be used to capture the
|
||||||
// execution state independently of a crash. Returns true on success.
|
// execution state independently of a crash. Returns true on success.
|
||||||
|
@ -140,7 +143,8 @@ class ExceptionHandler {
|
||||||
bool WriteMinidumpWithException(DWORD requesting_thread_id,
|
bool WriteMinidumpWithException(DWORD requesting_thread_id,
|
||||||
EXCEPTION_POINTERS *exinfo);
|
EXCEPTION_POINTERS *exinfo);
|
||||||
|
|
||||||
// Generates a new ID and stores it in next_minidump_id_.
|
// Generates a new ID and stores it in next_minidump_id_, and stores the
|
||||||
|
// path of the next minidump to be written in next_minidump_path_.
|
||||||
void UpdateNextID();
|
void UpdateNextID();
|
||||||
|
|
||||||
MinidumpCallback callback_;
|
MinidumpCallback callback_;
|
||||||
|
@ -148,6 +152,7 @@ class ExceptionHandler {
|
||||||
|
|
||||||
wstring dump_path_;
|
wstring dump_path_;
|
||||||
wstring next_minidump_id_;
|
wstring next_minidump_id_;
|
||||||
|
wstring next_minidump_path_;
|
||||||
|
|
||||||
HMODULE dbghelp_module_;
|
HMODULE dbghelp_module_;
|
||||||
MiniDumpWriteDump_type minidump_write_dump_;
|
MiniDumpWriteDump_type minidump_write_dump_;
|
||||||
|
|
Loading…
Reference in a new issue