mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
win: switch crashpad_handler.exe to /subsystem:windows and add .com
This switches the default behaviour of crashpad_handler.exe to be a /subsystem:windows app, so that normal usage won't cause a console to be popped up. At the same time, creates a copy of crashpad_handler.exe in the output dir named crashpad_handler.com. The .com doesn't affect normal operation, as the way StartHandler() uses CreateProcess() requires a real path to a file. However, when run from a command prompt, .com are found before .exe, so editbin the .com to be to a console app, which will be run in preference to the exe when run as just "crashpad_handler", as one tends to do from a command prompt when debugging. That is: d:\src\crashpad\crashpad\out\Debug>where crashpad_handler d:\src\crashpad\crashpad\out\Debug\crashpad_handler.com d:\src\crashpad\crashpad\out\Debug\crashpad_handler.exe d:\src\crashpad\crashpad\out\Debug>crashpad_handler --help Usage: crashpad_handler [OPTION]... ... d:\src\crashpad\crashpad\out\Debug>crashpad_handler.exe --help <no output> d:\src\crashpad\crashpad\out\Debug>crashpad_handler.com --help Usage: crashpad_handler.com [OPTION]... ... We also use the .com file in test invocations so that output streams will be visible. R=mark@chromium.org Change-Id: I1a27f88472d491b2a1d76e63c45e6415d9f679c0 Reviewed-on: https://chromium-review.googlesource.com/371578 Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
9807cba2f4
commit
660a5e69d6
@ -27,7 +27,7 @@ namespace {
|
||||
void StartAndUseHandler() {
|
||||
ScopedTempDir temp_dir;
|
||||
base::FilePath handler_path = Paths::Executable().DirName().Append(
|
||||
FILE_PATH_LITERAL("crashpad_handler.exe"));
|
||||
FILE_PATH_LITERAL("crashpad_handler.com"));
|
||||
CrashpadClient client;
|
||||
ASSERT_TRUE(client.StartHandler(handler_path,
|
||||
temp_dir.path(),
|
||||
|
@ -89,12 +89,49 @@
|
||||
}],
|
||||
],
|
||||
}],
|
||||
['OS=="win"', {
|
||||
'msvs_settings': {
|
||||
'VCLinkerTool': {
|
||||
'SubSystem': '2', # /SUBSYSTEM:WINDOWS
|
||||
},
|
||||
},
|
||||
}],
|
||||
],
|
||||
},
|
||||
],
|
||||
'conditions': [
|
||||
['OS=="win"', {
|
||||
'targets': [
|
||||
{
|
||||
# Duplicates crashpad_handler.exe to crashpad_handler.com and makes it
|
||||
# a console app.
|
||||
'target_name': 'crashpad_handler_console',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'../third_party/mini_chromium/mini_chromium.gyp:base',
|
||||
'../tools/tools.gyp:crashpad_tool_support',
|
||||
'crashpad_handler',
|
||||
],
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'copy handler exe to com',
|
||||
'inputs': [
|
||||
'<(PRODUCT_DIR)/crashpad_handler.exe',
|
||||
],
|
||||
'outputs': [
|
||||
'<(PRODUCT_DIR)/crashpad_handler.com',
|
||||
],
|
||||
'action': [
|
||||
'copy <(PRODUCT_DIR)\crashpad_handler.exe '
|
||||
'<(PRODUCT_DIR)\crashpad_handler.com >nul && '
|
||||
'editbin -nologo -subsystem:console '
|
||||
'<(PRODUCT_DIR)\crashpad_handler.com',
|
||||
],
|
||||
'msvs_cygwin_shell': '0',
|
||||
'quote_cmd': '0',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'crashy_program',
|
||||
'type': 'executable',
|
||||
|
@ -17,12 +17,16 @@
|
||||
#include "build/build_config.h"
|
||||
#include "tools/tool_support.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
int main(int argc, char* argv[]) {
|
||||
return crashpad::HandlerMain(argc, argv);
|
||||
}
|
||||
#elif defined(OS_WIN)
|
||||
int wmain(int argc, wchar_t* argv[]) {
|
||||
return crashpad::ToolSupport::Wmain(argc, argv, crashpad::HandlerMain);
|
||||
int APIENTRY wWinMain(HINSTANCE, HINSTANCE, wchar_t*, int) {
|
||||
return crashpad::ToolSupport::Wmain(__argc, __wargv, crashpad::HandlerMain);
|
||||
}
|
||||
#endif // OS_MACOSX
|
||||
|
@ -99,7 +99,7 @@ def GetDumpFromProgram(out_dir, pipe_name, executable_name, *args):
|
||||
|
||||
if pipe_name is not None:
|
||||
handler = subprocess.Popen([
|
||||
os.path.join(out_dir, 'crashpad_handler.exe'),
|
||||
os.path.join(out_dir, 'crashpad_handler.com'),
|
||||
'--pipe-name=' + pipe_name,
|
||||
'--database=' + test_database
|
||||
])
|
||||
@ -116,7 +116,7 @@ def GetDumpFromProgram(out_dir, pipe_name, executable_name, *args):
|
||||
list(args))
|
||||
else:
|
||||
subprocess.call([os.path.join(out_dir, executable_name),
|
||||
os.path.join(out_dir, 'crashpad_handler.exe'),
|
||||
os.path.join(out_dir, 'crashpad_handler.com'),
|
||||
test_database] + list(args))
|
||||
|
||||
out = subprocess.check_output([
|
||||
|
Loading…
x
Reference in New Issue
Block a user