[KDGDB] Don't make GDB a separate citizen (#5187)

But add KDGDB compilation only for x86 and x64, since for other
architectures (e.g. ARM) it currently emits the following error:
```
drivers/base/kdgdb/kdgdb.h(149): fatal error C1189: #error:
    "Please define relevant macros for your architecture"
```

For the time being, keep the "GDB" build configuration macro, used for
Gitpod testing... but this needs to be replaced with a more robust solution.
Because of this, rename kdgdb.dll to kdcom.dll, and kdcom.dll to kdser.dll
so that GDB is used by default, and we don't get a file name clash too.

Revert also commit 57cf5cdc5d.
This commit is contained in:
Hermès Bélusca-Maïto
2023-03-20 19:54:20 +01:00
parent d012a8c4a3
commit 912c8ad987
5 changed files with 28 additions and 21 deletions

View File

@@ -4,13 +4,12 @@ add_subdirectory(bootvid)
add_subdirectory(condrv)
if(_WINKD_)
if(GDB)
add_subdirectory(kdcom)
if(ARCH STREQUAL "i386" OR ARCH STREQUAL "amd64")
add_subdirectory(kdgdb)
else()
add_subdirectory(kdcom)
if(NOT ARCH STREQUAL "arm")
add_subdirectory(kdvm)
endif()
endif()
if(NOT ARCH STREQUAL "arm")
add_subdirectory(kdvm)
endif()
else()
add_subdirectory(kdrosdbg)

View File

@@ -11,11 +11,16 @@ add_library(kdcom MODULE
${SOURCE}
kdcom.rc
${CMAKE_CURRENT_BINARY_DIR}/kdcom.def)
add_pch(kdcom kddll.h SOURCE)
set_module_type(kdcom kerneldll ENTRYPOINT 0)
set_subsystem(kdcom native)
add_importlibs(kdcom ntoskrnl hal)
target_link_libraries(kdcom cportlib strtol)
add_dependencies(kdcom psdk bugcodes)
add_pch(kdcom kddll.h SOURCE)
add_cd_file(TARGET kdcom DESTINATION reactos/system32 NO_CAB FOR all)
if(GDB) ## See PR #5187
set(KDCOM_NAME_ON_CD kdser.dll)
else()
set(KDCOM_NAME_ON_CD "$<TARGET_FILE_NAME:kdcom>")
endif()
add_cd_file(TARGET kdcom DESTINATION reactos/system32 NO_CAB NAME_ON_CD KDCOM_NAME_ON_CD FOR all)

View File

@@ -1,5 +1,5 @@
spec2def(kdcom.dll kdgdb.spec ADD_IMPORTLIB)
spec2def(kdgdb.dll kdgdb.spec)
list(APPEND SOURCE
gdb_input.c
@@ -17,14 +17,19 @@ elseif(ARCH STREQUAL "amd64")
list(APPEND SOURCE amd64_sup.c)
endif()
add_library(kdcom MODULE
add_library(kdgdb MODULE
${SOURCE}
kdgdb.rc
${CMAKE_CURRENT_BINARY_DIR}/kdcom.def)
${CMAKE_CURRENT_BINARY_DIR}/kdgdb.def)
add_pch(kdgdb kdgdb.h SOURCE)
set_module_type(kdcom kerneldll ENTRYPOINT 0)
set_subsystem(kdcom native)
add_importlibs(kdcom ntoskrnl hal)
target_link_libraries(kdcom cportlib strtol)
add_pch(kdcom kdgdb.h SOURCE)
add_cd_file(TARGET kdcom DESTINATION reactos/system32 NO_CAB FOR all)
set_module_type(kdgdb kerneldll ENTRYPOINT 0)
set_subsystem(kdgdb native)
add_importlibs(kdgdb ntoskrnl hal)
target_link_libraries(kdgdb cportlib strtol)
if(GDB) ## See PR #5187
set(KDGDB_NAME_ON_CD kdcom.dll)
else()
set(KDGDB_NAME_ON_CD "$<TARGET_FILE_NAME:kdgdb>")
endif()
add_cd_file(TARGET kdgdb DESTINATION reactos/system32 NO_CAB NAME_ON_CD KDGDB_NAME_ON_CD FOR all)

View File

@@ -38,9 +38,6 @@ list(APPEND SOURCE
add_library(fastfat MODULE ${SOURCE} fastfat.rc)
set_module_type(fastfat kernelmodedriver)
target_link_libraries(fastfat ${PSEH_LIB} memcmp)
if(GDB AND NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(fastfat PRIVATE -O0)
endif()
add_importlibs(fastfat ntoskrnl hal)
add_pch(fastfat fatprocs.h SOURCE)
add_cd_file(TARGET fastfat DESTINATION reactos/system32/drivers NO_CAB FOR all)

View File

@@ -64,7 +64,8 @@ set(LTCG FALSE CACHE BOOL
"Whether to build with link-time code generation")
set(GDB FALSE CACHE BOOL
"Whether to compile for debugging with GDB.
"Whether to use by default KDGDB.DLL instead of KDCOM.DLL for debugging with GDB.
Mainly used for cloud-based ReactOS development using Gitpod and Docker.
If you don't use GDB, don't enable this.")
if(CMAKE_BUILD_TYPE STREQUAL "Release")