OLD | NEW |
1 // Copyright (c) 2006, Google Inc. | 1 // Copyright (c) 2006, 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 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 } | 757 } |
758 | 758 |
759 bool success = WriteMinidumpOnHandlerThread(exinfo, NULL); | 759 bool success = WriteMinidumpOnHandlerThread(exinfo, NULL); |
760 UpdateNextID(); | 760 UpdateNextID(); |
761 return success; | 761 return success; |
762 } | 762 } |
763 | 763 |
764 // static | 764 // static |
765 bool ExceptionHandler::WriteMinidump(const wstring &dump_path, | 765 bool ExceptionHandler::WriteMinidump(const wstring &dump_path, |
766 MinidumpCallback callback, | 766 MinidumpCallback callback, |
767 void* callback_context) { | 767 void* callback_context, |
| 768 MINIDUMP_TYPE dump_type) { |
768 ExceptionHandler handler(dump_path, NULL, callback, callback_context, | 769 ExceptionHandler handler(dump_path, NULL, callback, callback_context, |
769 HANDLER_NONE); | 770 HANDLER_NONE, dump_type, (HANDLE)NULL, NULL); |
770 return handler.WriteMinidump(); | 771 return handler.WriteMinidump(); |
771 } | 772 } |
772 | 773 |
773 // static | 774 // static |
774 bool ExceptionHandler::WriteMinidumpForChild(HANDLE child, | 775 bool ExceptionHandler::WriteMinidumpForChild(HANDLE child, |
775 DWORD child_blamed_thread, | 776 DWORD child_blamed_thread, |
776 const wstring& dump_path, | 777 const wstring& dump_path, |
777 MinidumpCallback callback, | 778 MinidumpCallback callback, |
778 void* callback_context) { | 779 void* callback_context, |
| 780 MINIDUMP_TYPE dump_type) { |
779 EXCEPTION_RECORD ex; | 781 EXCEPTION_RECORD ex; |
780 CONTEXT ctx; | 782 CONTEXT ctx; |
781 EXCEPTION_POINTERS exinfo = { NULL, NULL }; | 783 EXCEPTION_POINTERS exinfo = { NULL, NULL }; |
782 DWORD last_suspend_count = kFailedToSuspendThread; | 784 DWORD last_suspend_count = kFailedToSuspendThread; |
783 HANDLE child_thread_handle = OpenThread(THREAD_GET_CONTEXT | | 785 HANDLE child_thread_handle = OpenThread(THREAD_GET_CONTEXT | |
784 THREAD_QUERY_INFORMATION | | 786 THREAD_QUERY_INFORMATION | |
785 THREAD_SUSPEND_RESUME, | 787 THREAD_SUSPEND_RESUME, |
786 FALSE, | 788 FALSE, |
787 child_blamed_thread); | 789 child_blamed_thread); |
788 // This thread may have died already, so not opening the handle is a | 790 // This thread may have died already, so not opening the handle is a |
(...skipping 10 matching lines...) Expand all Loading... |
799 #elif defined(_M_X64) | 801 #elif defined(_M_X64) |
800 ex.ExceptionAddress = reinterpret_cast<PVOID>(ctx.Rip); | 802 ex.ExceptionAddress = reinterpret_cast<PVOID>(ctx.Rip); |
801 #endif | 803 #endif |
802 exinfo.ExceptionRecord = &ex; | 804 exinfo.ExceptionRecord = &ex; |
803 exinfo.ContextRecord = &ctx; | 805 exinfo.ContextRecord = &ctx; |
804 } | 806 } |
805 } | 807 } |
806 } | 808 } |
807 | 809 |
808 ExceptionHandler handler(dump_path, NULL, callback, callback_context, | 810 ExceptionHandler handler(dump_path, NULL, callback, callback_context, |
809 HANDLER_NONE); | 811 HANDLER_NONE, dump_type, (HANDLE)NULL, NULL); |
810 bool success = handler.WriteMinidumpWithExceptionForProcess( | 812 bool success = handler.WriteMinidumpWithExceptionForProcess( |
811 child_blamed_thread, | 813 child_blamed_thread, |
812 exinfo.ExceptionRecord ? &exinfo : NULL, | 814 exinfo.ExceptionRecord ? &exinfo : NULL, |
813 NULL, child, false); | 815 NULL, child, false); |
814 | 816 |
815 if (last_suspend_count != kFailedToSuspendThread) { | 817 if (last_suspend_count != kFailedToSuspendThread) { |
816 ResumeThread(child_thread_handle); | 818 ResumeThread(child_thread_handle); |
817 } | 819 } |
818 | 820 |
819 CloseHandle(child_thread_handle); | 821 CloseHandle(child_thread_handle); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 | 1066 |
1065 void ExceptionHandler::UnregisterAppMemory(void* ptr) { | 1067 void ExceptionHandler::UnregisterAppMemory(void* ptr) { |
1066 AppMemoryList::iterator iter = | 1068 AppMemoryList::iterator iter = |
1067 std::find(app_memory_info_.begin(), app_memory_info_.end(), ptr); | 1069 std::find(app_memory_info_.begin(), app_memory_info_.end(), ptr); |
1068 if (iter != app_memory_info_.end()) { | 1070 if (iter != app_memory_info_.end()) { |
1069 app_memory_info_.erase(iter); | 1071 app_memory_info_.erase(iter); |
1070 } | 1072 } |
1071 } | 1073 } |
1072 | 1074 |
1073 } // namespace google_breakpad | 1075 } // namespace google_breakpad |
OLD | NEW |