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

Unified Diff: handler/win/crashy_test_program.cc

Issue 1428803006: win: Implement CrashpadClient::StartHandler() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback; add a test Created 5 years, 1 month 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/main.cc ('k') | snapshot/win/end_to_end_test.py » ('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/handler/win/crashy_test_program.cc b/handler/win/crashy_test_program.cc
index 6650404859e54574d88dd2b70e5ef698c528e249..15c7b613af21dbcf3c3b768e4a0baa70b45d8dab 100644
--- a/handler/win/crashy_test_program.cc
+++ b/handler/win/crashy_test_program.cc
@@ -12,16 +12,23 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#include <stdlib.h>
#include <windows.h>
#include <winternl.h>
+#include <string>
+#include <map>
+#include <vector>
+
// ntstatus.h conflicts with windows.h so define this locally.
#ifndef STATUS_NO_SUCH_FILE
#define STATUS_NO_SUCH_FILE static_cast<NTSTATUS>(0xC000000F)
#endif
#include "base/basictypes.h"
+#include "base/files/file_path.h"
#include "base/logging.h"
+#include "base/strings/utf_string_conversions.h"
#include "client/crashpad_client.h"
#include "tools/tool_support.h"
#include "util/win/critical_section_with_debug_info.h"
@@ -88,19 +95,31 @@ void SomeCrashyFunction() {
}
int CrashyMain(int argc, char* argv[]) {
- if (argc != 2) {
+ CrashpadClient client;
+
+ if (argc == 2) {
+ if (!client.SetHandler(argv[1])) {
+ LOG(ERROR) << "SetHandler";
+ return EXIT_FAILURE;
+ }
+ } else if (argc == 3) {
+ if (!client.StartHandler(base::FilePath(base::UTF8ToUTF16(argv[1])),
+ base::FilePath(base::UTF8ToUTF16(argv[2])),
+ std::string(),
+ std::map<std::string, std::string>(),
+ std::vector<std::string>())) {
+ LOG(ERROR) << "StartHandler";
+ return EXIT_FAILURE;
+ }
+ } else {
fprintf(stderr, "Usage: %s <server_pipe_name>\n", argv[0]);
- return 1;
+ fprintf(stderr, " %s <handler_path> <database_path>\n", argv[0]);
+ return EXIT_FAILURE;
}
- CrashpadClient client;
- if (!client.SetHandler(argv[1])) {
- LOG(ERROR) << "SetHandler";
- return 1;
- }
if (!client.UseHandler()) {
LOG(ERROR) << "UseHandler";
- return 1;
+ return EXIT_FAILURE;
}
AllocateMemoryOfVariousProtections();
@@ -112,7 +131,7 @@ int CrashyMain(int argc, char* argv[]) {
SomeCrashyFunction();
- return 0;
+ return EXIT_SUCCESS;
}
} // namespace
« no previous file with comments | « handler/main.cc ('k') | snapshot/win/end_to_end_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698