Skip to content

Commit

Permalink
Merge pull request dotnet#1195 from mikem8361/dactable
Browse files Browse the repository at this point in the history
Generate the dac table RVA using nm at build time.
  • Loading branch information
mikem8361 committed Jul 2, 2015
2 parents 486860e + 09e4d77 commit 8cfd0cd
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 202 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ endif()

set(CLR_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(VM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/vm)
set(GENERATED_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/src/inc)

if(CMAKE_SYSTEM_NAME STREQUAL Linux)
set(CLR_CMAKE_PLATFORM_UNIX 1)
Expand Down
7 changes: 6 additions & 1 deletion src/debug/daccess/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ include_directories(${CLR_DIR}/src/gc)
include_directories(${CLR_DIR}/src/gcdump)

if(CLR_CMAKE_PLATFORM_UNIX)
add_compile_options(-fPIC)
include_directories(${GENERATED_INCLUDE_DIR})
add_compile_options(-fPIC)
endif(CLR_CMAKE_PLATFORM_UNIX)

set(DACCESS_SOURCES
Expand Down Expand Up @@ -54,3 +55,7 @@ convert_to_absolute_path(DACCESS_SOURCES ${DACCESS_SOURCES})
add_precompiled_header(stdafx.h stdafx.cpp DACCESS_SOURCES)

add_library(daccess ${DACCESS_SOURCES})

if(CLR_CMAKE_PLATFORM_UNIX)
add_dependencies(daccess coreclr)
endif(CLR_CMAKE_PLATFORM_UNIX)
19 changes: 8 additions & 11 deletions src/debug/daccess/daccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#include "dwreport.h"
#include "primitives.h"
#include "dbgutil.h"
#ifdef FEATURE_PAL
#include <dactablerva.h>
#endif

#include "dwbucketmanager.hpp"

Expand Down Expand Up @@ -7196,20 +7199,14 @@ HRESULT
ClrDataAccess::GetDacGlobals()
{
#ifdef FEATURE_PAL
PVOID dacTableAddress = nullptr;
ULONG dacTableSize = 0;
DWORD err = PAL_GetDacTableAddress((PVOID)m_globalBase, &dacTableAddress, &dacTableSize);
if (err != ERROR_SUCCESS)
{
return CORDBG_E_MISSING_DEBUGGER_EXPORTS;
}

if (dacTableSize != sizeof(g_dacGlobals))
#ifdef DAC_TABLE_SIZE
if (DAC_TABLE_SIZE != sizeof(g_dacGlobals))
{
return E_INVALIDARG;
}

if (FAILED(ReadFromDataTarget(m_pTarget, (ULONG64)dacTableAddress, (BYTE*)&g_dacGlobals, dacTableSize)))
#endif
ULONG64 dacTableAddress = m_globalBase + DAC_TABLE_RVA;
if (FAILED(ReadFromDataTarget(m_pTarget, dacTableAddress, (BYTE*)&g_dacGlobals, sizeof(g_dacGlobals))))
{
return CORDBG_E_MISSING_DEBUGGER_EXPORTS;
}
Expand Down
1 change: 0 additions & 1 deletion src/debug/ee/dactable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ void DacGlobals::Initialize()
#ifdef FEATURE_SVR_GC
g_dacTable.InitializeSVREntries(baseAddress);
#endif
PAL_PublishDacTableAddress((PVOID)baseAddress, &g_dacTable, sizeof(g_dacTable));
}

// Initializes the non-SVR table entries
Expand Down
9 changes: 8 additions & 1 deletion src/dlls/mscoree/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ endif(WIN32)
target_link_libraries(coreclr ${CORECLR_LIBRARIES})

if(WIN32)

add_dependencies(coreclr dactablegen)

# Add dac table & debug resource to coreclr
Expand All @@ -134,6 +133,14 @@ if(WIN32)
COMMAND $<TARGET_FILE:InjectResource> /bin:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin /dll:$<TARGET_FILE:coreclr> /name:CLRDEBUGINFO
COMMENT Add dactable & debug resources to coreclr
)
else()
add_custom_command(
TARGET coreclr
POST_BUILD
VERBATIM
COMMAND sh ${CLR_DIR}/src/pal/tools/gen-dactable-rva.sh $<TARGET_FILE:coreclr> ${GENERATED_INCLUDE_DIR}/dactablerva.h
COMMENT Generating ${GENERATED_INCLUDE_DIR}/dactablerva.h
)
endif(WIN32)

# add the install targets
Expand Down
26 changes: 0 additions & 26 deletions src/pal/inc/pal.h
Original file line number Diff line number Diff line change
Expand Up @@ -599,32 +599,6 @@ PAL_DeleteExecWatchpoint(
#endif


PALIMPORT
DWORD
PALAPI
PAL_PublishDacTableAddress(
IN PVOID baseAddress,
IN PVOID tableAddress,
IN ULONG tableSize
);

PALIMPORT
DWORD
PALAPI
PAL_GetDacTableAddress(
IN PVOID baseAddress,
OUT PVOID *tableAddress,
OUT PULONG tableSize
);

PALIMPORT
VOID
PALAPI
PAL_CleanupDacTableAddress(
IN PVOID baseAddress
);


/******************* winuser.h Entrypoints *******************************/

PALIMPORT
Expand Down
1 change: 0 additions & 1 deletion src/pal/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ set(SOURCES
misc/interlock.cpp
misc/miscpalapi.cpp
misc/msgbox.cpp
misc/dactableaddress.cpp
misc/strutil.cpp
misc/sysinfo.cpp
misc/time.cpp
Expand Down
161 changes: 0 additions & 161 deletions src/pal/src/misc/dactableaddress.cpp

This file was deleted.

1 change: 1 addition & 0 deletions src/pal/tools/gen-dactable-rva.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nm $1 | grep g_dacTable | cut -f 1 -d' ' | head -n 1 | awk '{ print "#define DAC_TABLE_RVA 0x" $1}' > $2

0 comments on commit 8cfd0cd

Please sign in to comment.