Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Unified Diff: handler/win/crashy_test_program.cc

Issue 1314093002: Refactor handler/main for Windows, implement CrashHandlerExceptionServer (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@crash-handler-exe
Patch Set: fixes2 Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « handler/win/crash_report_exception_handler.cc ('k') | snapshot/win/exception_snapshot_win_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: handler/win/crashy_test_program.cc
diff --git a/util/thread/thread_win.cc b/handler/win/crashy_test_program.cc
similarity index 51%
copy from util/thread/thread_win.cc
copy to handler/win/crashy_test_program.cc
index c4ac1eb784d1f80bfcb066987a934c0c6df0eb67..07c9cf101278213f36b55e3025b8b1c88ece15a4 100644
--- a/util/thread/thread_win.cc
+++ b/handler/win/crashy_test_program.cc
@@ -12,31 +12,43 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#include "util/thread/thread.h"
+#include "client/crashpad_client.h"
#include "base/logging.h"
+#include "tools/tool_support.h"
namespace crashpad {
+namespace {
-void Thread::Start() {
- DCHECK(!platform_thread_);
- platform_thread_ =
- CreateThread(nullptr, 0, ThreadEntryThunk, this, 0, nullptr);
- PCHECK(platform_thread_);
+void SomeCrashyFunction() {
+ volatile int* foo = reinterpret_cast<volatile int*>(7);
+ *foo = 42;
}
-void Thread::Join() {
- DCHECK(platform_thread_);
- DWORD result = WaitForSingleObject(platform_thread_, INFINITE);
- PCHECK(WAIT_OBJECT_0 == result);
- platform_thread_ = 0;
-}
+int CrashyMain(int argc, char* argv[]) {
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s <server_pipe_name>\n", argv[0]);
+ return 1;
+ }
+
+ CrashpadClient client;
+ if (!client.SetHandler(argv[1])) {
+ LOG(ERROR) << "SetHandler";
+ return 1;
+ }
+ if (!client.UseHandler()) {
+ LOG(ERROR) << "UseHandler";
+ return 1;
+ }
+
+ SomeCrashyFunction();
-// static
-DWORD WINAPI Thread::ThreadEntryThunk(void* argument) {
- Thread* self = reinterpret_cast<Thread*>(argument);
- self->ThreadMain();
return 0;
}
+} // namespace
} // namespace crashpad
+
+int wmain(int argc, wchar_t* argv[]) {
+ return crashpad::ToolSupport::Wmain(argc, argv, crashpad::CrashyMain);
+}
« no previous file with comments | « handler/win/crash_report_exception_handler.cc ('k') | snapshot/win/exception_snapshot_win_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698