aboutsummaryrefslogtreecommitdiff
path: root/src/client/windows/crash_generation
diff options
context:
space:
mode:
authorhansl@google.com <hansl@google.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-05-12 17:51:21 +0000
committerhansl@google.com <hansl@google.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-05-12 17:51:21 +0000
commit8cf0a52becf937650056dad55769a2d85d30f75d (patch)
treef34e673b59f35403ede177faf851e327fce5135e /src/client/windows/crash_generation
parentAdding prebuilt dump_syms.exe. (diff)
downloadbreakpad-8cf0a52becf937650056dad55769a2d85d30f75d.tar.xz
Moved exception_handler_test to the more aptly named exception_handler_death_test. It doesn't test anything else than death and exit.
Created the exception_handler_test that test the generation of dump and the dumps themselves. Moved all dump analysis code from minidump to its right class DumpAnalysis. The class is used by both minidump_test and exception_handler_test. The tests are way simpler that way (ie. no handling of HANDLE). minidump_test now uses the minidump_generator class instead of using Win32. It works well and pass all tests. exception_handler now passes both the exception and assertion infos to the client to generate the dump. If one is NULL it's going to be handled correctly. crash_generation_client can now RequestDump with both exception and assertion info. minidump_generator returns both the mini and full dump string pointers, and output both (or either) depending on which was generated. All original interfaces and method signature are still there, but call the new functions if possible. Review URL: http://codereview.chromium.org/1994015 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@596 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/windows/crash_generation')
-rw-r--r--src/client/windows/crash_generation/crash_generation_client.cc29
-rw-r--r--src/client/windows/crash_generation/crash_generation_client.h9
-rw-r--r--src/client/windows/crash_generation/minidump_generator.cc22
-rw-r--r--src/client/windows/crash_generation/minidump_generator.h20
4 files changed, 54 insertions, 26 deletions
diff --git a/src/client/windows/crash_generation/crash_generation_client.cc b/src/client/windows/crash_generation/crash_generation_client.cc
index 197807ab..5e4e3cb9 100644
--- a/src/client/windows/crash_generation/crash_generation_client.cc
+++ b/src/client/windows/crash_generation/crash_generation_client.cc
@@ -271,7 +271,8 @@ bool CrashGenerationClient::IsRegistered() const {
return crash_event_ != NULL;
}
-bool CrashGenerationClient::RequestDump(EXCEPTION_POINTERS* ex_info) {
+bool CrashGenerationClient::RequestDump(EXCEPTION_POINTERS* ex_info,
+ MDRawAssertionInfo* assert_info) {
if (!IsRegistered()) {
return false;
}
@@ -279,33 +280,23 @@ bool CrashGenerationClient::RequestDump(EXCEPTION_POINTERS* ex_info) {
exception_pointers_ = ex_info;
thread_id_ = GetCurrentThreadId();
- assert_info_.line = 0;
- assert_info_.type = 0;
- assert_info_.expression[0] = 0;
- assert_info_.file[0] = 0;
- assert_info_.function[0] = 0;
-
- return SignalCrashEventAndWait();
-}
-
-bool CrashGenerationClient::RequestDump(MDRawAssertionInfo* assert_info) {
- if (!IsRegistered()) {
- return false;
- }
-
- exception_pointers_ = NULL;
-
if (assert_info) {
memcpy(&assert_info_, assert_info, sizeof(assert_info_));
} else {
memset(&assert_info_, 0, sizeof(assert_info_));
}
- thread_id_ = GetCurrentThreadId();
-
return SignalCrashEventAndWait();
}
+bool CrashGenerationClient::RequestDump(EXCEPTION_POINTERS* ex_info) {
+ return RequestDump(ex_info, NULL);
+}
+
+bool CrashGenerationClient::RequestDump(MDRawAssertionInfo* assert_info) {
+ return RequestDump(NULL, assert_info);
+}
+
bool CrashGenerationClient::SignalCrashEventAndWait() {
assert(crash_event_);
assert(crash_generated_);
diff --git a/src/client/windows/crash_generation/crash_generation_client.h b/src/client/windows/crash_generation/crash_generation_client.h
index 81b0e6ca..01d13dde 100644
--- a/src/client/windows/crash_generation/crash_generation_client.h
+++ b/src/client/windows/crash_generation/crash_generation_client.h
@@ -27,8 +27,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef CLIENT_WINDOWS_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H__
-#define CLIENT_WINDOWS_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H__
+#ifndef CLIENT_WINDOWS_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H_
+#define CLIENT_WINDOWS_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H_
#include <windows.h>
#include <dbghelp.h>
@@ -73,6 +73,9 @@ class CrashGenerationClient {
// Returns true if the registration is successful; false otherwise.
bool Register();
+ bool RequestDump(EXCEPTION_POINTERS* ex_info,
+ MDRawAssertionInfo* assert_info);
+
// Requests the crash server to generate a dump with the given
// exception information.
//
@@ -156,4 +159,4 @@ class CrashGenerationClient {
} // namespace google_breakpad
-#endif // CLIENT_WINDOWS_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H__
+#endif // CLIENT_WINDOWS_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H_
diff --git a/src/client/windows/crash_generation/minidump_generator.cc b/src/client/windows/crash_generation/minidump_generator.cc
index c03b191a..37bd55e4 100644
--- a/src/client/windows/crash_generation/minidump_generator.cc
+++ b/src/client/windows/crash_generation/minidump_generator.cc
@@ -68,6 +68,23 @@ bool MinidumpGenerator::WriteMinidump(HANDLE process_handle,
MINIDUMP_TYPE dump_type,
bool is_client_pointers,
wstring* dump_path) {
+ // Just call the full WriteMinidump with NULL as the full_dump_path.
+ return this->WriteMinidump(process_handle, process_id, thread_id,
+ requesting_thread_id, exception_pointers,
+ assert_info, dump_type, is_client_pointers,
+ dump_path, NULL);
+}
+
+bool MinidumpGenerator::WriteMinidump(HANDLE process_handle,
+ DWORD process_id,
+ DWORD thread_id,
+ DWORD requesting_thread_id,
+ EXCEPTION_POINTERS* exception_pointers,
+ MDRawAssertionInfo* assert_info,
+ MINIDUMP_TYPE dump_type,
+ bool is_client_pointers,
+ wstring* dump_path,
+ wstring* full_dump_path) {
MiniDumpWriteDumpType write_dump = GetWriteDump();
if (!write_dump) {
return false;
@@ -223,6 +240,9 @@ bool MinidumpGenerator::WriteMinidump(HANDLE process_handle,
if (result && dump_path) {
*dump_path = dump_file_path;
}
+ if (result && full_memory_dump && full_dump_path) {
+ *full_dump_path = full_dump_file_path;
+ }
return result;
}
@@ -275,7 +295,7 @@ bool MinidumpGenerator::GenerateDumpFilePath(wstring* file_path) {
UUID id = {0};
UuidCreateType create_uuid = GetCreateUuid();
- if(!create_uuid) {
+ if (!create_uuid) {
return false;
}
diff --git a/src/client/windows/crash_generation/minidump_generator.h b/src/client/windows/crash_generation/minidump_generator.h
index 8ab6a8f6..5f9e4b54 100644
--- a/src/client/windows/crash_generation/minidump_generator.h
+++ b/src/client/windows/crash_generation/minidump_generator.h
@@ -27,8 +27,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef CLIENT_WINDOWS_CRASH_GENERATION_MINIDUMP_GENERATION_H__
-#define CLIENT_WINDOWS_CRASH_GENERATION_MINIDUMP_GENERATION_H__
+#ifndef CLIENT_WINDOWS_CRASH_GENERATION_MINIDUMP_GENERATOR_H_
+#define CLIENT_WINDOWS_CRASH_GENERATION_MINIDUMP_GENERATOR_H_
#include <windows.h>
#include <dbghelp.h>
@@ -61,6 +61,20 @@ class MinidumpGenerator {
bool is_client_pointers,
std::wstring* dump_path);
+ // Writes the minidump with the given parameters. Stores the dump file
+ // path in the dump_path (and full_dump_path) parameter if dump
+ // generation succeeds. full_dump_path and dump_path can be NULL.
+ bool WriteMinidump(HANDLE process_handle,
+ DWORD process_id,
+ DWORD thread_id,
+ DWORD requesting_thread_id,
+ EXCEPTION_POINTERS* exception_pointers,
+ MDRawAssertionInfo* assert_info,
+ MINIDUMP_TYPE dump_type,
+ bool is_client_pointers,
+ std::wstring* dump_path,
+ std::wstring* full_dump_path);
+
private:
// Function pointer type for MiniDumpWriteDump, which is looked up
// dynamically.
@@ -118,4 +132,4 @@ class MinidumpGenerator {
} // namespace google_breakpad
-#endif // CLIENT_WINDOWS_CRASH_GENERATION_MINIDUMP_GENERATION_H__
+#endif // CLIENT_WINDOWS_CRASH_GENERATION_MINIDUMP_GENERATOR_H_