Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows createdump support #35381

Merged
merged 5 commits into from
Apr 25, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Code review feedback
  • Loading branch information
mikem8361 committed Apr 24, 2020
commit 038b7b3a4208ae15c17c7f852a8086238b43dfe9
4 changes: 0 additions & 4 deletions src/coreclr/src/debug/createdump/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ remove_definitions(-D_UNICODE)

if(CLR_CMAKE_HOST_WIN32)

# Use static crt
add_definitions(-MT)

set(CREATEDUMP_SOURCES
main.cpp
createdumpwindows.cpp
Expand All @@ -25,7 +22,6 @@ if(CLR_CMAKE_HOST_WIN32)
target_link_libraries(createdump
kernel32.lib
${STATIC_MT_CRT_LIB}
${STATIC_MT_CPP_LIB}
advapi32.lib
version.lib
dbghelp.lib
Expand Down
38 changes: 8 additions & 30 deletions src/coreclr/src/vm/eepolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,36 +498,14 @@ void SafeExitProcess(UINT exitCode, BOOL fAbort = FALSE, ShutdownCompleteAction
// Watson code
CONTRACT_VIOLATION(ThrowsViolation);

EEPolicy::ExitProcessViaShim(exitCode, fAbort);
}
}

// This is a helper to exit the process after coordinating with the shim. It is used by
// SafeExitProcess above, as well as from CorHost2::ExitProcess when we know that we must
// exit the process without doing further work to shutdown this runtime. This first attempts
// to call back to the Shim to shutdown any other runtimes within the process.
//
// IMPORTANT NOTE: exercise extreme caution when adding new calls to this method. It is highly
// likely that you want to call SafeExitProcess, or EEPolicy::HandleExitProcess instead of this.
// This function only exists to factor some common code out of the methods mentioned above.

//static
void EEPolicy::ExitProcessViaShim(UINT exitCode, BOOL fAbort)
{
LIMITED_METHOD_CONTRACT;

// We must call back to the Shim in order to exit the process, as this may be just one
// runtime in a process with many. We need to give the other runtimes a chance to exit
// cleanly. If we can't make the call, or if the call fails for some reason, then we
// simply exit the process here, which is rude to the others, but the best we can do.

if (fAbort)
{
CrashDumpAndTerminateProcess(exitCode);
}
else
{
ExitProcess(exitCode);
if (fAbort)
{
CrashDumpAndTerminateProcess(exitCode);
}
else
{
ExitProcess(exitCode);
}
}
}

Expand Down
6 changes: 0 additions & 6 deletions src/coreclr/src/vm/eepolicy.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,7 @@ class EEPolicy

static void LogFatalError(UINT exitCode, UINT_PTR address, LPCWSTR pMessage, PEXCEPTION_POINTERS pExceptionInfo, LPCWSTR errorSource, LPCWSTR argExceptionString=NULL);

// IMPORTANT NOTE: only the following two functions should be calling ExitProcessViaShim.
// - CorHost2::ExitProcess
// - SafeExitProcess
friend class CorHost2;
friend void SafeExitProcess(UINT exitCode, BOOL fAbort, ShutdownCompleteAction sca);

static void ExitProcessViaShim(UINT exitCode, BOOL fAbort);
};

void InitEEPolicy();
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/vm/excep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4222,7 +4222,7 @@ LONG WatsonLastChance( // EXCEPTION_CONTINUE_SEARCH, _CONTINUE_

#ifdef HOST_WINDOWS

// Crash dump generating program arguments. Initialized in PROCAbortInitialize().
// Crash dump generating program arguments if enabled.
LPCWSTR g_createDumpCommandLine = nullptr;

static void
Expand Down