mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-02 18:10:57 +02:00
fix(tools): clean gdbinit files generation
This commit is contained in:
@@ -29,7 +29,7 @@ def get_prefix_map_gdbinit_path(prog_path: str) -> Any:
|
|||||||
with open(desc_path, encoding='utf-8') as f:
|
with open(desc_path, encoding='utf-8') as f:
|
||||||
project_desc = json.load(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:
|
def main() -> None:
|
||||||
|
@@ -45,13 +45,10 @@ function(__generate_prefix_map compile_options_var)
|
|||||||
get_filename_component(compiler_sysroot "${compiler_sysroot}/.." REALPATH)
|
get_filename_component(compiler_sysroot "${compiler_sysroot}/.." REALPATH)
|
||||||
list(APPEND compile_options "-fdebug-prefix-map=${compiler_sysroot}=/TOOLCHAIN")
|
list(APPEND compile_options "-fdebug-prefix-map=${compiler_sysroot}=/TOOLCHAIN")
|
||||||
string(APPEND gdbinit_file_lines "set substitute-path /TOOLCHAIN ${compiler_sysroot}\n")
|
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()
|
else()
|
||||||
set(gdbinit_file_lines "# There is no prefix map defined for the project.\n")
|
set(gdbinit_file_lines "# There is no prefix map defined for the project.\n")
|
||||||
endif()
|
endif()
|
||||||
# Write prefix_map_gdbinit file even it is empty.
|
# Write prefix_map file even it is empty.
|
||||||
file(MAKE_DIRECTORY ${gdbinit_dir})
|
file(MAKE_DIRECTORY ${gdbinit_dir})
|
||||||
file(WRITE "${gdbinit_path}" "${gdbinit_file_lines}")
|
file(WRITE "${gdbinit_path}" "${gdbinit_file_lines}")
|
||||||
idf_build_set_property(GDBINIT_FILES_PREFIX_MAP "${gdbinit_path}")
|
idf_build_set_property(GDBINIT_FILES_PREFIX_MAP "${gdbinit_path}")
|
||||||
|
@@ -351,7 +351,6 @@ function(__project_info test_components)
|
|||||||
include(${sdkconfig_cmake})
|
include(${sdkconfig_cmake})
|
||||||
idf_build_get_property(COMPONENT_KCONFIGS KCONFIGS)
|
idf_build_get_property(COMPONENT_KCONFIGS KCONFIGS)
|
||||||
idf_build_get_property(COMPONENT_KCONFIGS_PROJBUILD KCONFIG_PROJBUILDS)
|
idf_build_get_property(COMPONENT_KCONFIGS_PROJBUILD KCONFIG_PROJBUILDS)
|
||||||
idf_build_get_property(debug_prefix_map_gdbinit DEBUG_PREFIX_MAP_GDBINIT)
|
|
||||||
|
|
||||||
__generate_gdbinit()
|
__generate_gdbinit()
|
||||||
idf_build_get_property(gdbinit_files_prefix_map GDBINIT_FILES_PREFIX_MAP)
|
idf_build_get_property(gdbinit_files_prefix_map GDBINIT_FILES_PREFIX_MAP)
|
||||||
|
@@ -29,7 +29,6 @@
|
|||||||
"build_component_paths" : ${build_component_paths_json},
|
"build_component_paths" : ${build_component_paths_json},
|
||||||
"build_component_info" : ${build_component_info_json},
|
"build_component_info" : ${build_component_info_json},
|
||||||
"all_component_info" : ${all_component_info_json},
|
"all_component_info" : ${all_component_info_json},
|
||||||
"debug_prefix_map_gdbinit": "${debug_prefix_map_gdbinit}",
|
|
||||||
"gdbinit_files": {
|
"gdbinit_files": {
|
||||||
"01_symbols": "${gdbinit_files_symbols}",
|
"01_symbols": "${gdbinit_files_symbols}",
|
||||||
"02_prefix_map": "${gdbinit_files_prefix_map}",
|
"02_prefix_map": "${gdbinit_files_prefix_map}",
|
||||||
|
@@ -125,7 +125,7 @@ def action_extensions(base_actions: dict, project_path: str) -> dict:
|
|||||||
espcoredump_kwargs['chip_rev'] = chip_rev_to_int(chip_rev)
|
espcoredump_kwargs['chip_rev'] = chip_rev_to_int(chip_rev)
|
||||||
|
|
||||||
# for reproducible builds
|
# 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:
|
if extra_gdbinit_file:
|
||||||
espcoredump_kwargs['extra_gdbinit_file'] = 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_args.append(f'-x={gdb_x_list[gdb_x_index]}')
|
||||||
gdb_x_list.pop(gdb_x_index)
|
gdb_x_list.pop(gdb_x_index)
|
||||||
continue
|
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
|
continue
|
||||||
gdb_args.append(f'-x={path}')
|
gdb_args.append(f'-x={path}')
|
||||||
# append user-defined gdbinit files
|
# append user-defined gdbinit files
|
||||||
|
@@ -63,7 +63,7 @@ def test_reproducible_builds(app_name: str, idf_py: IdfPyFunc, test_app_copy: Pa
|
|||||||
'--batch',
|
'--batch',
|
||||||
'--quiet',
|
'--quiet',
|
||||||
'-x',
|
'-x',
|
||||||
f'{build_first}/prefix_map_gdbinit',
|
f'{build_first}/gdbinit/prefix_map',
|
||||||
'-ex',
|
'-ex',
|
||||||
'set logging enabled',
|
'set logging enabled',
|
||||||
'-ex',
|
'-ex',
|
||||||
|
Reference in New Issue
Block a user