From 0e662bfa7d6b4f3bbfdd972ffb4100278705e8a8 Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Fri, 12 Jun 2026 09:28:30 +0200 Subject: [PATCH] fix(gdbinit): build elf path from EXECUTABLE_NAME, not the target name The EXECUTABLE build property holds a CMake target name, not a filesystem path. Under Build system v1 the target happens to be created as ".elf", so concatenating BUILD_DIR with EXECUTABLE produced a valid elf path by coincidence. Under Build system v2 the target is just "" and the elf is written as ".elf" via CMake's executable suffix, so the same concatenation pointed gdb at a non-existent file. Construct the path explicitly from EXECUTABLE_NAME plus the .elf suffix so the gdbinit consumer no longer depends on the producer naming its target after the output file. --- tools/cmake/gdbinit.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/cmake/gdbinit.cmake b/tools/cmake/gdbinit.cmake index ceda997694f..41b7a889401 100644 --- a/tools/cmake/gdbinit.cmake +++ b/tools/cmake/gdbinit.cmake @@ -38,8 +38,9 @@ function(__generate_gdbinit) set(symbols_gdbinit_path ${gdbinit_dir}/symbols) set(py_extensions_gdbinit_path ${gdbinit_dir}/py_extensions) set(connect_gdbinit_path ${gdbinit_dir}/connect) - idf_build_get_property(PROJECT_EXECUTABLE EXECUTABLE) - set(application_elf ${BUILD_DIR}/${PROJECT_EXECUTABLE}) + # EXECUTABLE is a CMake target name; the on-disk elf is EXECUTABLE_NAME + ".elf". + idf_build_get_property(PROJECT_EXECUTABLE_NAME EXECUTABLE_NAME) + set(application_elf ${BUILD_DIR}/${PROJECT_EXECUTABLE_NAME}.elf) file(MAKE_DIRECTORY ${gdbinit_dir})