fix(tools): clean gdbinit files generation

This commit is contained in:
Alexey Lapshin
2025-08-25 12:20:44 +07:00
committed by BOT
parent 612b5f88db
commit 2d12315b62
6 changed files with 8 additions and 10 deletions

View File

@@ -29,7 +29,7 @@ def get_prefix_map_gdbinit_path(prog_path: str) -> Any:
with open(desc_path, encoding='utf-8') as f:
project_desc = json.load(f)
return project_desc.get('debug_prefix_map_gdbinit')
return project_desc['gdbinit_files']['02_prefix_map']
def main() -> None:

View File

@@ -45,13 +45,10 @@ function(__generate_prefix_map compile_options_var)
get_filename_component(compiler_sysroot "${compiler_sysroot}/.." REALPATH)
list(APPEND compile_options "-fdebug-prefix-map=${compiler_sysroot}=/TOOLCHAIN")
string(APPEND gdbinit_file_lines "set substitute-path /TOOLCHAIN ${compiler_sysroot}\n")
file(WRITE "${BUILD_DIR}/prefix_map_gdbinit" "${gdbinit_file_lines}") # TODO IDF-11667
idf_build_set_property(DEBUG_PREFIX_MAP_GDBINIT "${gdbinit_path}")
else()
set(gdbinit_file_lines "# There is no prefix map defined for the project.\n")
endif()
# Write prefix_map_gdbinit file even it is empty.
# Write prefix_map file even it is empty.
file(MAKE_DIRECTORY ${gdbinit_dir})
file(WRITE "${gdbinit_path}" "${gdbinit_file_lines}")
idf_build_set_property(GDBINIT_FILES_PREFIX_MAP "${gdbinit_path}")

View File

@@ -351,7 +351,6 @@ function(__project_info test_components)
include(${sdkconfig_cmake})
idf_build_get_property(COMPONENT_KCONFIGS KCONFIGS)
idf_build_get_property(COMPONENT_KCONFIGS_PROJBUILD KCONFIG_PROJBUILDS)
idf_build_get_property(debug_prefix_map_gdbinit DEBUG_PREFIX_MAP_GDBINIT)
__generate_gdbinit()
idf_build_get_property(gdbinit_files_prefix_map GDBINIT_FILES_PREFIX_MAP)

View File

@@ -29,7 +29,6 @@
"build_component_paths" : ${build_component_paths_json},
"build_component_info" : ${build_component_info_json},
"all_component_info" : ${all_component_info_json},
"debug_prefix_map_gdbinit": "${debug_prefix_map_gdbinit}",
"gdbinit_files": {
"01_symbols": "${gdbinit_files_symbols}",
"02_prefix_map": "${gdbinit_files_prefix_map}",

View File

@@ -125,7 +125,7 @@ def action_extensions(base_actions: dict, project_path: str) -> dict:
espcoredump_kwargs['chip_rev'] = chip_rev_to_int(chip_rev)
# for reproducible builds
extra_gdbinit_file = project_desc.get('debug_prefix_map_gdbinit', None)
extra_gdbinit_file = project_desc['gdbinit_files']['02_prefix_map']
if extra_gdbinit_file:
espcoredump_kwargs['extra_gdbinit_file'] = extra_gdbinit_file
@@ -285,7 +285,10 @@ def action_extensions(base_actions: dict, project_path: str) -> dict:
gdb_args.append(f'-x={gdb_x_list[gdb_x_index]}')
gdb_x_list.pop(gdb_x_index)
continue
if name == 'connect' and gdb_x_list: # TODO IDF-11692
# If the user provides a gdbinit file with name not in the "gdbinit_files" list,
# we assume the connection logic is defined within it.
# Otherwise, the configuration may be invalid.
if name == 'connect' and gdb_x_list:
continue
gdb_args.append(f'-x={path}')
# append user-defined gdbinit files

View File

@@ -63,7 +63,7 @@ def test_reproducible_builds(app_name: str, idf_py: IdfPyFunc, test_app_copy: Pa
'--batch',
'--quiet',
'-x',
f'{build_first}/prefix_map_gdbinit',
f'{build_first}/gdbinit/prefix_map',
'-ex',
'set logging enabled',
'-ex',