Add debugger launch to dbgshim for xplat.
authorMike McLaughlin <mikem@microsoft.com>
Wed, 16 Dec 2015 00:42:20 +0000 (16:42 -0800)
committerMike McLaughlin <mikem@microsoft.com>
Fri, 15 Jan 2016 03:00:52 +0000 (19:00 -0800)
commitdac4a490f66ef501fb8d7b246ed3c21a8bcfa485
treee94702f122dd5eecad9a3a6a2795538bddb47f09
parentf06fa2ea19a57631d7bac1fad232888a2c039a9b
Add debugger launch to dbgshim for xplat.

Add the RegisterForRuntimeStartup/UnregisterForRuntimeStartup to dbghim. Executes
the callback when the coreclr runtime starts in the specified process. The callback
is passed the proper ICorDebug instance for the version of the runtime or an error if
something fails. This API works for launch and attach (and even the attach scenario
if the runtime hasn't been loaded yet) equally on both xplat and Windows. The callback
is always called on a separate thread. This API returns immediately.

The callback is invoke when the coreclr runtime module is loaded during early
initialization. The runtime is blocked during initialization until the callback
returns.

HRESULT
RegisterForRuntimeStartup(
    __in DWORD dwProcessId,
    __in PSTARTUP_CALLBACK pfnCallback,
    __in PVOID parameter,
    __out PVOID *ppUnregisterToken)

HRESULT
UnregisterForRuntimeStartup(
    __in PVOID pUnregisterToken)

Most of the work is done for xplat in the PAL_RegisterForRuntimeStartup and
PAL_UnregisterForRuntimeStartup. On Windows, the APIs are implemented on top
of the old dbgshim ones.

Added reference counting to DbgTransportSession so the cleanup can be done after
the transport worker and the main code is finished.

Fix a hang in OSX initializing multiple PALs in the debugging test dbg, dbgshim
and mscordaccore by not calling FILEInitStdHandles() from PAL_InitializeDLL.

Fixed a minor EnumerateCLRs bug in an error path. A ThrowHR instead of returning
the HRESULT.

Better pipe file/dbg transport cleanup. Now also call the dbg transport connection
abort for an unhandled native exception. Added PROCAbort to replace most calls to
abort(). The shutdown handler is called in PROCAbort().

Cleanup debugger transport pipes on CTRL-C termination.

Cleanup process code; remove now useless CProcSharedData.

Added "PROCESS" PAL trace type.
25 files changed:
src/debug/di/dbgtransportmanager.cpp
src/debug/ee/debugger.cpp
src/debug/ee/debugger.h
src/debug/inc/dbgtransportsession.h
src/debug/inc/debug-pal.h [deleted file]
src/debug/shared/dbgtransportsession.cpp
src/dlls/dbgshim/dbgshim.cpp
src/dlls/dbgshim/dbgshim.h
src/dlls/dbgshim/dbgshim.ntdef
src/inc/dacvars.h
src/pal/inc/pal.h
src/pal/inc/rt/palrt.h
src/pal/src/debug/debug.cpp
src/pal/src/exception/machexception.cpp
src/pal/src/exception/signal.cpp
src/pal/src/file/file.cpp
src/pal/src/include/pal/dbgmsg.h
src/pal/src/include/pal/init.h
src/pal/src/include/pal/process.h
src/pal/src/include/pal/procobj.hpp
src/pal/src/init/pal.cpp
src/pal/src/init/sxs.cpp
src/pal/src/misc/dbgmsg.cpp
src/pal/src/misc/miscpalapi.cpp
src/pal/src/thread/process.cpp