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

Enable cross OS DBI build #35021

Merged
merged 5 commits into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,6 @@ linker
# ln -s $(pwd)/src/libraries/Common/src src/coreclr/src/System.Private.CoreLib/common
src/coreclr/src/System.Private.CoreLib/shared
src/coreclr/src/System.Private.CoreLib/common

# The debug directory should not be ignored
!src/coreclr/src/debug
6 changes: 1 addition & 5 deletions src/coreclr/crosscomponents.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ endif()
if(NOT CLR_CMAKE_HOST_LINUX AND NOT FEATURE_CROSSBITNESS)
list (APPEND CLR_CROSS_COMPONENTS_LIST
mscordaccore
mscordbi
)
if (CLR_CMAKE_HOST_OS STREQUAL CLR_CMAKE_TARGET_OS)
list (APPEND CLR_CROSS_COMPONENTS_LIST
mscordbi
)
endif (CLR_CMAKE_HOST_OS STREQUAL CLR_CMAKE_TARGET_OS)
endif()
16 changes: 11 additions & 5 deletions src/coreclr/src/debug/debug-pal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@ if(CLR_CMAKE_HOST_WIN32)
add_definitions(-DWIN32_LEAN_AND_MEAN)
include_directories(../../inc) #needed for warning control

set(TWO_WAY_PIPE_SOURCES
win/diagnosticsipc.cpp
win/twowaypipe.cpp
win/processdescriptor.cpp
)
if(CLR_CMAKE_TARGET_WIN32)
set(TWO_WAY_PIPE_SOURCES
win/diagnosticsipc.cpp
win/twowaypipe.cpp
win/processdescriptor.cpp
)
else(CLR_CMAKE_TARGET_WIN32)
set(TWO_WAY_PIPE_SOURCES
dummy/twowaypipe.cpp
)
endif(CLR_CMAKE_TARGET_WIN32)
endif(CLR_CMAKE_HOST_WIN32)

if(CLR_CMAKE_HOST_UNIX)
Expand Down
76 changes: 76 additions & 0 deletions src/coreclr/src/debug/debug-pal/dummy/twowaypipe.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#include <windows.h>
#include "twowaypipe.h"
sdmaclea marked this conversation as resolved.
Show resolved Hide resolved

// This file contains a dummy implementation of the simple IPC mechanism - bidirectional named pipe.
// It is used for the cross OS DBI where IPC is not supported.


// Creates a server side of the pipe.
// Id is used to create pipes names and uniquely identify the pipe on the machine.
// true - success, false - failure (use GetLastError() for more details)
bool TwoWayPipe::CreateServer(const ProcessDescriptor& pd)
{
return false;
}


// Connects to a previously opened server side of the pipe.
// Id is used to locate the pipe on the machine.
// true - success, false - failure (use GetLastError() for more details)
bool TwoWayPipe::Connect(const ProcessDescriptor& pd)
{
return false;
}

// Waits for incoming client connections, assumes GetState() == Created
// true - success, false - failure (use GetLastError() for more details)
bool TwoWayPipe::WaitForConnection()
{
return false;
}

// Reads data from pipe. Returns number of bytes read or a negative number in case of an error.
// use GetLastError() for more details
int TwoWayPipe::Read(void *buffer, DWORD bufferSize)
{
return -1;
}

// Writes data to pipe. Returns number of bytes written or a negative number in case of an error.
// use GetLastError() for more details
int TwoWayPipe::Write(const void *data, DWORD dataSize)
{
return -1;
}

// Disconnect server or client side of the pipe.
// true - success, false - failure (use GetLastError() for more details)
bool TwoWayPipe::Disconnect()
{
return false;
}

// Connects to a one sided pipe previously created by CreateOneWayPipe.
// In order to successfully connect id and inbound flag should be the same.
HANDLE TwoWayPipe::OpenOneWayPipe(DWORD id, bool inbound)
{
return NULL;
}


// Creates a one way pipe, id and inboud flag are used for naming.
// Created pipe is supposed to be connected to by OpenOneWayPipe.
HANDLE TwoWayPipe::CreateOneWayPipe(DWORD id, bool inbound)
{
return NULL;
}

// Used by debugger side (RS) to cleanup the target (LS) named pipes
// and semaphores when the debugger detects the debuggee process exited.
void TwoWayPipe::CleanupTargetProcess()
{
}
2 changes: 1 addition & 1 deletion src/coreclr/src/debug/di/cordb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#endif

//********** Globals. *********************************************************
#ifndef TARGET_UNIX
#ifndef HOST_UNIX
HINSTANCE g_hInst; // Instance handle to this piece of code.
#endif

Expand Down
12 changes: 8 additions & 4 deletions src/coreclr/src/dlls/mscordbi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if(CLR_CMAKE_HOST_LINUX)
list(APPEND MSCORDBI_SOURCES ${PAL_REDEFINES_FILE})
endif(CLR_CMAKE_HOST_LINUX)

if(CLR_CMAKE_TARGET_WIN32)
if(CLR_CMAKE_HOST_WIN32)
add_definitions(-DFX_VER_INTERNALNAME_STR=mscordbi.dll)

list(APPEND MSCORDBI_SOURCES
Expand All @@ -35,11 +35,11 @@ if(CLR_CMAKE_TARGET_WIN32)
preprocess_file(${DEF_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/mscordbi.def)

list(APPEND MSCORDBI_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/mscordbi.def)
else(CLR_CMAKE_TARGET_WIN32)
else(CLR_CMAKE_HOST_WIN32)
set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/mscordbi_unixexports.src)
set(EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/mscordbi.exports)
generate_exports_file(${DEF_SOURCES} ${EXPORTS_FILE})
endif(CLR_CMAKE_TARGET_WIN32)
endif(CLR_CMAKE_HOST_WIN32)

if(CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD)
# This option is necessary to ensure that the overloaded new/delete operators defined inside
Expand Down Expand Up @@ -79,9 +79,13 @@ set(COREDBI_LIBRARIES
)

if(CLR_CMAKE_HOST_WIN32)
if(CLR_CMAKE_TARGET_WIN32)
set(COREDBI_TARGET_WIN32_LIBRARIES mdwinmd_dbi)
endif(CLR_CMAKE_TARGET_WIN32)

list(APPEND COREDBI_LIBRARIES
mdhotdata-staticcrt
mdwinmd_dbi
${COREDBI_TARGET_WIN32_LIBRARIES}
kernel32.lib
advapi32.lib
ole32.lib
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/src/md/hotdata/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ add_library_clr(mdhotdata_crossgen ${MDHOTDATA_SOURCES})
set_target_properties(mdhotdata_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE)
target_precompile_header(TARGET mdhotdata_crossgen HEADER external.h)

if(CLR_CMAKE_TARGET_WIN32)
if(CLR_CMAKE_HOST_WIN32)
add_library_clr(mdhotdata-staticcrt ${MDHOTDATA_SOURCES})
target_precompile_header(TARGET mdhotdata-staticcrt HEADER external.h)
endif(CLR_CMAKE_TARGET_WIN32)
endif(CLR_CMAKE_HOST_WIN32)