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

cmake: gnu: Fix debugging when GDB fails to load because of Python #38749

Merged
merged 1 commit into from
Sep 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions cmake/bintools/gnu/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,23 @@ find_program(CMAKE_NM ${CROSS_COMPILE}nm PATHS ${TOOLCHAIN_HOME} NO_DE
find_program(CMAKE_STRIP ${CROSS_COMPILE}strip PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)

find_program(CMAKE_GDB ${CROSS_COMPILE}gdb PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)

if(CMAKE_GDB)
execute_process(
COMMAND ${CMAKE_GDB} --configuration
OUTPUT_VARIABLE GDB_PY_NO_PY
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULTS_VARIABLE GDB_CFG_ERR
)
if (${GDB_CFG_ERR})
# Failed to execute GDB, likely because of Python deps
find_program(CMAKE_GDB_NO_PY ${CROSS_COMPILE}gdb-no-py PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
if (CMAKE_GDB_NO_PY)
set(CMAKE_GDB ${CMAKE_GDB_NO_PY} CACHE FILEPATH "Path to a program." FORCE)
endif()
endif()
endif()

find_program(CMAKE_GDB gdb-multiarch PATHS ${TOOLCHAIN_HOME} )

# Include bin tool properties
Expand Down