Skip to content

Commit

Permalink
fix 32-bit definition file
Browse files Browse the repository at this point in the history
  • Loading branch information
oltolm committed Apr 16, 2023
1 parent eb2d748 commit 7e779bb
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 112 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ add_link_options(
-static-libstdc++
)

link_libraries(ssp)

find_package (WinDbg)

include_directories (
Expand Down
1 change: 1 addition & 0 deletions src/addr2line/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ add_executable (addr2line
target_link_libraries (addr2line PRIVATE
common
mgwhelp_implib
dbghelp
)

install (TARGETS addr2line RUNTIME DESTINATION bin)
1 change: 1 addition & 0 deletions src/catchsegv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ target_link_libraries (catchsegv PRIVATE
getoptW
mgwhelp_implib
winmm
dbghelp
)


Expand Down
1 change: 1 addition & 0 deletions src/drmingw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ target_compile_definitions(drmingw PRIVATE
target_link_libraries (drmingw PRIVATE
common
mgwhelp_implib
dbghelp
)

install (TARGETS drmingw RUNTIME DESTINATION bin)
1 change: 1 addition & 0 deletions src/exchndl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ target_sources (exchndl PRIVATE
target_link_libraries (exchndl PRIVATE
common
mgwhelp_implib
dbghelp
)

set_target_properties (exchndl PROPERTIES
Expand Down
190 changes: 95 additions & 95 deletions src/mgwhelp/mgwhelp32.def
Original file line number Diff line number Diff line change
Expand Up @@ -11,98 +11,98 @@ EXPORTS
SymLoadModuleExW@36 = MgwSymLoadModuleExW@36 == SymLoadModuleExW
UnDecorateSymbolName@16 = MgwUnDecorateSymbolName@16 == UnDecorateSymbolName

EnumDirTree@24 == EnumDirTree
EnumDirTreeW@24 == EnumDirTreeW
EnumerateLoadedModules@12 == EnumerateLoadedModules
EnumerateLoadedModules64@12 == EnumerateLoadedModules64
EnumerateLoadedModulesW64@12 == EnumerateLoadedModulesW64
ExtensionApiVersion@0 == ExtensionApiVersion
FindDebugInfoFile@12 == FindDebugInfoFile
FindDebugInfoFileEx@20 == FindDebugInfoFileEx
FindExecutableImage@12 == FindExecutableImage
FindExecutableImageEx@20 == FindExecutableImageEx
FindExecutableImageExW@20 == FindExecutableImageExW
GetTimestampForLoadedLibrary@4 == GetTimestampForLoadedLibrary
ImageDirectoryEntryToData@16 == ImageDirectoryEntryToData
ImageDirectoryEntryToDataEx@20 == ImageDirectoryEntryToDataEx
ImageNtHeader@4 == ImageNtHeader
ImageRvaToSection@12 == ImageRvaToSection
ImageRvaToVa@16 == ImageRvaToVa
ImagehlpApiVersion@0 == ImagehlpApiVersion
ImagehlpApiVersionEx@4 == ImagehlpApiVersionEx
MakeSureDirectoryPathExists@4 == MakeSureDirectoryPathExists
MapDebugInformation@16 == MapDebugInformation
MiniDumpReadDumpStream@20 == MiniDumpReadDumpStream
MiniDumpWriteDump@28 == MiniDumpWriteDump
SearchTreeForFile@12 == SearchTreeForFile
SearchTreeForFileW@12 == SearchTreeForFileW
StackWalk@36 == StackWalk
StackWalk64@36 == StackWalk64
SymAddSymbol@32 == SymAddSymbol
SymAddSymbolW@32 == SymAddSymbolW
SymEnumLines@28 == SymEnumLines
SymEnumSourceFiles@24 == SymEnumSourceFiles
SymEnumSymbols@24 == SymEnumSymbols
SymEnumSymbolsW@24 == SymEnumSymbolsW
SymEnumTypes@20 == SymEnumTypes
SymEnumTypesW@20 == SymEnumTypesW
SymEnumerateModules@12 == SymEnumerateModules
SymEnumerateModules64@12 == SymEnumerateModules64
SymEnumerateModulesW64@12 == SymEnumerateModulesW64
SymEnumerateSymbols@16 == SymEnumerateSymbols
SymEnumerateSymbols64@20 == SymEnumerateSymbols64
SymFindFileInPath@40 == SymFindFileInPath
SymFindFileInPathW@40 == SymFindFileInPathW
SymFromName@12 == SymFromName
SymFunctionTableAccess@8 == SymFunctionTableAccess
SymFunctionTableAccess64@12 == SymFunctionTableAccess64
SymGetLineFromAddr@16 == SymGetLineFromAddr
SymGetLineNext@8 == SymGetLineNext
SymGetLineNext64@8 == SymGetLineNext64
SymGetLinePrev@8 == SymGetLinePrev
SymGetLinePrev64@8 == SymGetLinePrev64
SymGetModuleBase@8 == SymGetModuleBase
SymGetModuleBase64@12 == SymGetModuleBase64
SymGetModuleInfo@12 == SymGetModuleInfo
SymGetModuleInfo64@16 == SymGetModuleInfo64
SymGetModuleInfoW@12 == SymGetModuleInfoW
SymGetModuleInfoW64@16 == SymGetModuleInfoW64
SymGetOptions@0 == SymGetOptions
SymGetSearchPath@12 == SymGetSearchPath
SymGetSearchPathW@12 == SymGetSearchPathW
SymGetSourceFileToken@24 == SymGetSourceFileToken
SymGetSourceFileTokenW@24 == SymGetSourceFileTokenW
SymGetSymFromAddr@16 == SymGetSymFromAddr
SymGetSymFromAddr64@20 == SymGetSymFromAddr64
SymGetSymFromName@12 == SymGetSymFromName
SymGetSymFromName64@12 == SymGetSymFromName64
SymGetSymNext@8 == SymGetSymNext
SymGetSymNext64@8 == SymGetSymNext64
SymGetSymPrev@8 == SymGetSymPrev
SymGetSymPrev64@8 == SymGetSymPrev64
SymGetTypeFromName@20 == SymGetTypeFromName
SymGetTypeInfo@24 == SymGetTypeInfo
SymLoadModule@24 == SymLoadModule
SymLoadModule64@28 == SymLoadModule64
SymMatchFileName@16 == SymMatchFileName
SymMatchFileNameW@16 == SymMatchFileNameW
SymMatchString@12 == SymMatchString
SymRefreshModuleList@4 == SymRefreshModuleList
SymRegisterCallback@12 == SymRegisterCallback
SymRegisterCallback64@16 == SymRegisterCallback64
SymRegisterCallbackW64@16 == SymRegisterCallbackW64
SymRegisterFunctionEntryCallback@12 == SymRegisterFunctionEntryCallback
SymRegisterFunctionEntryCallback64@16 == SymRegisterFunctionEntryCallback64
SymSearch@44 == SymSearch
SymSearchW@44 == SymSearchW
SymSetContext@12 == SymSetContext
SymSetParentWindow@4 == SymSetParentWindow
SymSetScopeFromAddr@12 == SymSetScopeFromAddr
SymSetSearchPath@8 == SymSetSearchPath
SymSetSearchPathW@8 == SymSetSearchPathW
SymUnDName@12 == SymUnDName
SymUnDName64@12 == SymUnDName64
SymUnloadModule@8 == SymUnloadModule
SymUnloadModule64@12 == SymUnloadModule64
UnmapDebugInformation@4 == UnmapDebugInformation
WinDbgExtensionDllInit@12 == WinDbgExtensionDllInit
EnumDirTree = dbghelp.EnumDirTree
EnumDirTreeW = dbghelp.EnumDirTreeW
EnumerateLoadedModules = dbghelp.EnumerateLoadedModules
EnumerateLoadedModules64 = dbghelp.EnumerateLoadedModules64
EnumerateLoadedModulesW64 = dbghelp.EnumerateLoadedModulesW64
ExtensionApiVersion = dbghelp.ExtensionApiVersion
FindDebugInfoFile = dbghelp.FindDebugInfoFile
FindDebugInfoFileEx = dbghelp.FindDebugInfoFileEx
FindExecutableImage = dbghelp.FindExecutableImage
FindExecutableImageEx = dbghelp.FindExecutableImageEx
FindExecutableImageExW = dbghelp.FindExecutableImageExW
GetTimestampForLoadedLibrary = dbghelp.GetTimestampForLoadedLibrary
ImageDirectoryEntryToData = dbghelp.ImageDirectoryEntryToData
ImageDirectoryEntryToDataEx = dbghelp.ImageDirectoryEntryToDataEx
ImageNtHeader = dbghelp.ImageNtHeader
ImageRvaToSection = dbghelp.ImageRvaToSection
ImageRvaToVa = dbghelp.ImageRvaToVa
ImagehlpApiVersion = dbghelp.ImagehlpApiVersion
ImagehlpApiVersionEx = dbghelp.ImagehlpApiVersionEx
MakeSureDirectoryPathExists = dbghelp.MakeSureDirectoryPathExists
MapDebugInformation = dbghelp.MapDebugInformation
MiniDumpReadDumpStream = dbghelp.MiniDumpReadDumpStream
MiniDumpWriteDump = dbghelp.MiniDumpWriteDump
SearchTreeForFile = dbghelp.SearchTreeForFile
SearchTreeForFileW = dbghelp.SearchTreeForFileW
StackWalk = dbghelp.StackWalk
StackWalk64 = dbghelp.StackWalk64
SymAddSymbol = dbghelp.SymAddSymbol
SymAddSymbolW = dbghelp.SymAddSymbolW
SymEnumLines = dbghelp.SymEnumLines
SymEnumSourceFiles = dbghelp.SymEnumSourceFiles
SymEnumSymbols = dbghelp.SymEnumSymbols
SymEnumSymbolsW = dbghelp.SymEnumSymbolsW
SymEnumTypes = dbghelp.SymEnumTypes
SymEnumTypesW = dbghelp.SymEnumTypesW
SymEnumerateModules = dbghelp.SymEnumerateModules
SymEnumerateModules64 = dbghelp.SymEnumerateModules64
SymEnumerateModulesW64 = dbghelp.SymEnumerateModulesW64
SymEnumerateSymbols = dbghelp.SymEnumerateSymbols
SymEnumerateSymbols64 = dbghelp.SymEnumerateSymbols64
SymFindFileInPath = dbghelp.SymFindFileInPath
SymFindFileInPathW = dbghelp.SymFindFileInPathW
SymFromName = dbghelp.SymFromName
SymFunctionTableAccess = dbghelp.SymFunctionTableAccess
SymFunctionTableAccess64 = dbghelp.SymFunctionTableAccess64
SymGetLineFromAddr = dbghelp.SymGetLineFromAddr
SymGetLineNext = dbghelp.SymGetLineNext
SymGetLineNext64 = dbghelp.SymGetLineNext64
SymGetLinePrev = dbghelp.SymGetLinePrev
SymGetLinePrev64 = dbghelp.SymGetLinePrev64
SymGetModuleBase = dbghelp.SymGetModuleBase
SymGetModuleBase64 = dbghelp.SymGetModuleBase64
SymGetModuleInfo = dbghelp.SymGetModuleInfo
SymGetModuleInfo64 = dbghelp.SymGetModuleInfo64
SymGetModuleInfoW = dbghelp.SymGetModuleInfoW
SymGetModuleInfoW64 = dbghelp.SymGetModuleInfoW64
SymGetOptions = dbghelp.SymGetOptions
SymGetSearchPath = dbghelp.SymGetSearchPath
SymGetSearchPathW = dbghelp.SymGetSearchPathW
SymGetSourceFileToken = dbghelp.SymGetSourceFileToken
SymGetSourceFileTokenW = dbghelp.SymGetSourceFileTokenW
SymGetSymFromAddr = dbghelp.SymGetSymFromAddr
SymGetSymFromAddr64 = dbghelp.SymGetSymFromAddr64
SymGetSymFromName = dbghelp.SymGetSymFromName
SymGetSymFromName64 = dbghelp.SymGetSymFromName64
SymGetSymNext = dbghelp.SymGetSymNext
SymGetSymNext64 = dbghelp.SymGetSymNext64
SymGetSymPrev = dbghelp.SymGetSymPrev
SymGetSymPrev64 = dbghelp.SymGetSymPrev64
SymGetTypeFromName = dbghelp.SymGetTypeFromName
SymGetTypeInfo = dbghelp.SymGetTypeInfo
SymLoadModule = dbghelp.SymLoadModule
SymLoadModule64 = dbghelp.SymLoadModule64
SymMatchFileName = dbghelp.SymMatchFileName
SymMatchFileNameW = dbghelp.SymMatchFileNameW
SymMatchString = dbghelp.SymMatchString
SymRefreshModuleList = dbghelp.SymRefreshModuleList
SymRegisterCallback = dbghelp.SymRegisterCallback
SymRegisterCallback64 = dbghelp.SymRegisterCallback64
SymRegisterCallbackW64 = dbghelp.SymRegisterCallbackW64
SymRegisterFunctionEntryCallback = dbghelp.SymRegisterFunctionEntryCallback
SymRegisterFunctionEntryCallback64 = dbghelp.SymRegisterFunctionEntryCallback64
SymSearch = dbghelp.SymSearch
SymSearchW = dbghelp.SymSearchW
SymSetContext = dbghelp.SymSetContext
SymSetParentWindow = dbghelp.SymSetParentWindow
SymSetScopeFromAddr = dbghelp.SymSetScopeFromAddr
SymSetSearchPath = dbghelp.SymSetSearchPath
SymSetSearchPathW = dbghelp.SymSetSearchPathW
SymUnDName = dbghelp.SymUnDName
SymUnDName64 = dbghelp.SymUnDName64
SymUnloadModule = dbghelp.SymUnloadModule
SymUnloadModule64 = dbghelp.SymUnloadModule64
UnmapDebugInformation = dbghelp.UnmapDebugInformation
WinDbgExtensionDllInit = dbghelp.WinDbgExtensionDllInit
42 changes: 25 additions & 17 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ force_debug ()
add_executable (test_mgwhelp
test_mgwhelp.cpp
)
add_dependencies (test_mgwhelp mgwhelp_implib)
target_link_libraries (test_mgwhelp
mgwhelp_implib
shlwapi
)
add_dependencies (check test_mgwhelp)
add_test (
NAME test_mgwhelp
COMMAND test_mgwhelp
Expand Down Expand Up @@ -45,7 +43,6 @@ add_custom_target (test_mgwhelp_split ALL
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_mgwhelp_split.exe
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_mgwhelp_split.debug
)
add_dependencies (check test_mgwhelp_split)
add_test (
NAME test_mgwhelp_split
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_mgwhelp_split.exe
Expand Down Expand Up @@ -81,7 +78,6 @@ add_custom_target (test_mgwhelp_split_subdir ALL
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_mgwhelp_split_subdir.exe
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/.debug/test_mgwhelp_split_subdir.debug
)
add_dependencies (check test_mgwhelp_split_subdir)
add_test (
NAME test_mgwhelp_split_subdir
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_mgwhelp_split_subdir.exe
Expand All @@ -105,7 +101,6 @@ add_custom_target (test_mgwhelp_stripped ALL
DEPENDS
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_mgwhelp_stripped.exe
)
add_dependencies (check test_mgwhelp_stripped)
add_test (
NAME test_mgwhelp_stripped
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_mgwhelp_stripped.exe
Expand Down Expand Up @@ -185,8 +180,6 @@ if (NOT DEFINED OBJCOPY_VERSION)
endif ()
if (OBJCOPY_VERSION STREQUAL "llvm-objcopy")
set_target_properties (test_mgwhelp_zdebug PROPERTIES EXCLUDE_FROM_ALL ON)
else ()
add_dependencies (check test_mgwhelp_zdebug)
endif ()
if (OBJCOPY_VERSION STREQUAL "llvm-objcopy" OR NOT OBJCOPY_VERSION VERSION_GREATER_EQUAL "2.34")
set_tests_properties (test_mgwhelp_zdebug PROPERTIES DISABLED ON)
Expand All @@ -203,9 +196,7 @@ include_directories (
add_executable (test_exchndl_static_unicode
test_exchndl_static_unicode.cpp
)
add_dependencies (test_exchndl_static_unicode exchndl_implib)
target_link_libraries (test_exchndl_static_unicode exchndl_implib shlwapi)
add_dependencies (check test_exchndl_static_unicode)
add_test (
NAME test_exchndl_static_unicode
COMMAND test_exchndl_static_unicode
Expand All @@ -223,9 +214,7 @@ include_directories (
add_executable (test_exchndl_static_ansi
test_exchndl_static_ansi.cpp
)
add_dependencies (test_exchndl_static_ansi exchndl_implib)
target_link_libraries (test_exchndl_static_ansi exchndl_implib shlwapi)
add_dependencies (check test_exchndl_static_ansi)
add_test (
NAME test_exchndl_static_ansi
COMMAND test_exchndl_static_ansi
Expand All @@ -244,8 +233,6 @@ add_executable (test_exchndl_dynamic_unicode
test_exchndl_dynamic_unicode.cpp
)
target_link_libraries (test_exchndl_dynamic_unicode shlwapi)
add_dependencies (test_exchndl_dynamic_unicode exchndl)
add_dependencies (check test_exchndl_dynamic_unicode)
add_test (
NAME test_exchndl_dynamic_unicode
COMMAND test_exchndl_dynamic_unicode
Expand All @@ -264,8 +251,6 @@ add_executable (test_exchndl_dynamic_ansi
test_exchndl_dynamic_ansi.cpp
)
target_link_libraries (test_exchndl_dynamic_ansi shlwapi)
add_dependencies (test_exchndl_dynamic_ansi exchndl)
add_dependencies (check test_exchndl_dynamic_ansi)
add_test (
NAME test_exchndl_dynamic_ansi
COMMAND test_exchndl_dynamic_ansi
Expand All @@ -280,10 +265,33 @@ add_test (
add_executable (test_addr2line
test_addr2line.cpp
)
add_dependencies (test_addr2line addr2line)
add_dependencies (check test_addr2line)
add_test (
NAME test_addr2line
COMMAND test_addr2line
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)

set(test_targets
test_addr2line
test_exchndl_dynamic_ansi
test_exchndl_dynamic_unicode
test_exchndl_static_ansi
test_exchndl_static_unicode
test_mgwhelp
test_mgwhelp_split
test_mgwhelp_split_subdir
test_mgwhelp_stripped
test_mgwhelp_zdebug
)

add_test(test_build
"${CMAKE_COMMAND}"
--build "${CMAKE_BINARY_DIR}"
--config "$<CONFIG>"
--target ${test_targets}
)

set_tests_properties(test_build PROPERTIES FIXTURES_SETUP test_fixture)
foreach(test_target ${test_targets})
set_tests_properties(${test_target} PROPERTIES FIXTURES_REQUIRED test_fixture)
endforeach()
6 changes: 6 additions & 0 deletions tests/apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ if (MINGW)
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer")
set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -fno-omit-frame-pointer")
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fno-omit-frame-pointer")

add_link_options(
-static
-static-libgcc
-static-libstdc++
)
endif ()

# https://github.com/jrfonseca/drmingw/issues/42
Expand Down
4 changes: 4 additions & 0 deletions tests/test_mgwhelp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ main(int argc, char **argv)
if (!hMgwHelpDll) {
test_line(false, "GetModuleHandleA(\"mgwhelp.dll\")");
} else {
test_line(GetProcAddress(hMgwHelpDll, "SymInitialize") != NULL, "GetProcAddress(\"SymInitialize\")");
test_line(GetProcAddress(hMgwHelpDll, "SymInitialize@12") == NULL, "!GetProcAddress(\"SymInitialize\")");
test_line(GetProcAddress(hMgwHelpDll, "EnumDirTree") != NULL, "GetProcAddress(\"EnumDirTree\")");
test_line(GetProcAddress(hMgwHelpDll, "EnumDirTree@24") == NULL, "!GetProcAddress(\"EnumDirTree\")");
test_line(GetProcAddress(hMgwHelpDll, "SymGetOptions") != NULL, "GetProcAddress(\"SymGetOptions\")");
test_line(GetProcAddress(hMgwHelpDll, "SymGetOptions@0") == NULL, "!GetProcAddress(\"SymGetOptions\")");
}
Expand Down

0 comments on commit 7e779bb

Please sign in to comment.