Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(54)

Side by Side Diff: client/windows/crash_generation/minidump_generator.h

Issue 1074002: Refactor the Windows MinidumpGenerator interface to get rid of the overloads when generating dumps. (Closed) Base URL: http://google-breakpad.googlecode.com/svn/trunk/src/
Patch Set: Created 11 years, 2 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2008, Google Inc. 1 // Copyright (c) 2008, 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 26 matching lines...) Expand all
37 #include "google_breakpad/common/minidump_format.h" 37 #include "google_breakpad/common/minidump_format.h"
38 38
39 namespace google_breakpad { 39 namespace google_breakpad {
40 40
41 // Abstraction for various objects and operations needed to generate 41 // Abstraction for various objects and operations needed to generate
42 // minidump on Windows. This abstraction is useful to hide all the gory 42 // minidump on Windows. This abstraction is useful to hide all the gory
43 // details for minidump generation and provide a clean interface to 43 // details for minidump generation and provide a clean interface to
44 // the clients to generate minidumps. 44 // the clients to generate minidumps.
45 class MinidumpGenerator { 45 class MinidumpGenerator {
46 public: 46 public:
47 // Creates an instance with the given dump path. 47 // Creates an instance with the given dump path.
Mark Mentovai 2014/01/17 21:58:32 This comment needs to be expanded now. What do the
Cris Neckar 2014/01/17 22:39:51 Done.
48 explicit MinidumpGenerator(const std::wstring& dump_path); 48 MinidumpGenerator(const std::wstring& dump_path,
49 const HANDLE process_handle,
50 const DWORD process_id,
51 const DWORD thread_id,
52 const DWORD requesting_thread_id,
53 EXCEPTION_POINTERS* exception_pointers,
54 MDRawAssertionInfo* assert_info,
55 const MINIDUMP_TYPE dump_type,
56 const bool is_client_pointers);
49 57
50 ~MinidumpGenerator(); 58 ~MinidumpGenerator();
51 59
60 void SetDumpFile(const HANDLE dump_file) { dump_file_ = dump_file; }
61 void SetFullDumpFile(const HANDLE full_dump_file) {
62 full_dump_file_ = full_dump_file;
63 }
64
65 // Generate the name for the dump file that will be written to once
66 // WriteMinidump() is called. Can only be called once and cannot be called
67 // if the dump file is set via SetDumpFile().
68 bool GenerateDumpFile(std::wstring* dump_path);
69
70 // Generate the name for the full dump file that will be written to once
71 // WriteMinidump() is called. Cannot be called unless the minidump type
72 // includes MiniDumpWithFullMemory. Can only be called once and cannot be
73 // called if the dump file is set via SetFullDumpFile().
74 bool GenerateFullDumpFile(std::wstring* full_dump_path);
75
76 void SetAdditionalStreams(
77 MINIDUMP_USER_STREAM_INFORMATION* additional_streams) {
78 additional_streams_ = additional_streams;
79 }
80
81 void SetCallback(MINIDUMP_CALLBACK_INFORMATION* callback_info) {
82 callback_info_ = callback_info;
83 }
84
52 // Writes the minidump with the given parameters. Stores the 85 // Writes the minidump with the given parameters. Stores the
53 // dump file path in the dump_path parameter if dump generation 86 // dump file path in the dump_path parameter if dump generation
54 // succeeds. 87 // succeeds.
55 bool WriteMinidump(HANDLE process_handle, 88 bool WriteMinidump();
56 DWORD process_id,
57 DWORD thread_id,
58 DWORD requesting_thread_id,
59 EXCEPTION_POINTERS* exception_pointers,
60 MDRawAssertionInfo* assert_info,
61 MINIDUMP_TYPE dump_type,
62 bool is_client_pointers,
63 std::wstring* dump_path);
64
65 // Writes the minidump with the given parameters. Stores the dump file
66 // path in the dump_path (and full_dump_path) parameter if dump
67 // generation succeeds. full_dump_path and dump_path can be NULL.
68 bool WriteMinidump(HANDLE process_handle,
69 DWORD process_id,
70 DWORD thread_id,
71 DWORD requesting_thread_id,
72 EXCEPTION_POINTERS* exception_pointers,
73 MDRawAssertionInfo* assert_info,
74 MINIDUMP_TYPE dump_type,
75 bool is_client_pointers,
76 std::wstring* dump_path,
77 std::wstring* full_dump_path);
78
79 // Writes the minidump with the given parameters. Writes the minidump and
80 // full dump to the file handles supplied. This allows the caller to handle
81 // the creation of the files for the dump. The file handles are not closed
82 // by this function.
83 bool WriteMinidump(HANDLE process_handle,
84 DWORD process_id,
85 DWORD thread_id,
86 DWORD requesting_thread_id,
87 EXCEPTION_POINTERS* exception_pointers,
88 MDRawAssertionInfo* assert_info,
89 MINIDUMP_TYPE dump_type,
90 bool is_client_pointers,
91 HANDLE dump_file,
92 HANDLE full_dump_file);
93
94 // Writes the minidump with the given parameters. Allows the user to include
95 // additional streams in the dump that would not otherwise be included.
96 bool WriteMinidump(HANDLE process_handle,
97 DWORD process_id,
98 DWORD thread_id,
99 DWORD requesting_thread_id,
100 EXCEPTION_POINTERS* exception_pointers,
101 MDRawAssertionInfo* assert_info,
102 MINIDUMP_TYPE dump_type,
103 bool is_client_pointers,
104 HANDLE dump_file,
105 HANDLE full_dump_file,
106 MINIDUMP_USER_STREAM_INFORMATION* additional_streams);
107 89
108 private: 90 private:
109 // Function pointer type for MiniDumpWriteDump, which is looked up 91 // Function pointer type for MiniDumpWriteDump, which is looked up
110 // dynamically. 92 // dynamically.
111 typedef BOOL (WINAPI* MiniDumpWriteDumpType)( 93 typedef BOOL (WINAPI* MiniDumpWriteDumpType)(
112 HANDLE hProcess, 94 HANDLE hProcess,
113 DWORD ProcessId, 95 DWORD ProcessId,
114 HANDLE hFile, 96 HANDLE hFile,
115 MINIDUMP_TYPE DumpType, 97 MINIDUMP_TYPE DumpType,
116 CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, 98 CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
(...skipping 25 matching lines...) Expand all
142 124
143 // Pointer to the MiniDumpWriteDump function. 125 // Pointer to the MiniDumpWriteDump function.
144 MiniDumpWriteDumpType write_dump_; 126 MiniDumpWriteDumpType write_dump_;
145 127
146 // Handle to dynamically loaded rpcrt4.dll. 128 // Handle to dynamically loaded rpcrt4.dll.
147 HMODULE rpcrt4_module_; 129 HMODULE rpcrt4_module_;
148 130
149 // Pointer to the UuidCreate function. 131 // Pointer to the UuidCreate function.
150 UuidCreateType create_uuid_; 132 UuidCreateType create_uuid_;
151 133
134 // Handle for the process to dump.
135 HANDLE process_handle_;
136
137 // Process ID for the process to dump.
138 DWORD process_id_;
139
140 // The crashing thread ID.
141 DWORD thread_id_;
142
143 // The thread ID which is requesting the dump.
144 DWORD requesting_thread_id_;
145
146 // Pointer to the exception information for the crash. This may point to an
147 // address in the crashing process so it should not be dereferenced.
148 EXCEPTION_POINTERS* exception_pointers_;
149
150 // Assertion info for the report.
151 MDRawAssertionInfo* assert_info_;
152
153 // Type of minidump to generate.
154 MINIDUMP_TYPE dump_type_;
155
156 // Specifies whether the exception_pointers_ reference memory in the crashing
157 // process.
158 bool is_client_pointers_;
159
152 // Folder path to store dump files. 160 // Folder path to store dump files.
153 std::wstring dump_path_; 161 std::wstring dump_path_;
154 162
163 // The file where the dump will be written.
164 HANDLE dump_file_;
165
166 // The file where the full dump will be written.
167 HANDLE full_dump_file_;
168
169 // Tracks whether the dump file handle is managed externally.
170 bool dump_file_is_internal_;
171
172 // Tracks whether the full dump file handle is managed externally.
173 bool full_dump_file_is_internal_;
174
175 // Additional streams to be written to the dump.
176 MINIDUMP_USER_STREAM_INFORMATION* additional_streams_;
177
178 // The user defined callback for the various stages of the dump process.
179 MINIDUMP_CALLBACK_INFORMATION* callback_info_;
180
155 // Critical section to sychronize action of loading modules dynamically. 181 // Critical section to sychronize action of loading modules dynamically.
156 CRITICAL_SECTION module_load_sync_; 182 CRITICAL_SECTION module_load_sync_;
157 183
158 // Critical section to synchronize action of dynamically getting function 184 // Critical section to synchronize action of dynamically getting function
159 // addresses from modules. 185 // addresses from modules.
160 CRITICAL_SECTION get_proc_address_sync_; 186 CRITICAL_SECTION get_proc_address_sync_;
161 }; 187 };
162 188
163 } // namespace google_breakpad 189 } // namespace google_breakpad
164 190
165 #endif // CLIENT_WINDOWS_CRASH_GENERATION_MINIDUMP_GENERATOR_H_ 191 #endif // CLIENT_WINDOWS_CRASH_GENERATION_MINIDUMP_GENERATOR_H_
OLDNEW
« no previous file with comments | « client/windows/crash_generation/minidump_generator.cc ('k') | client/windows/unittests/minidump_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1004:630ec63f810e-tainted