Merge branch 'feature/add_loading_gdbinit_file' into 'master'

feat: Added extra gdbinit file loading for reproducible build

Closes IDF-4415

See merge request espressif/esp-idf!17914
pull/9001/head
Roland Dobai 2022-05-19 16:22:48 +08:00
commit 6755a63f3b
1 zmienionych plików z 16 dodań i 0 usunięć

Wyświetl plik

@ -4,8 +4,10 @@
# SPDX-License-Identifier: Apache-2.0
#
import json
import logging
import os.path
from typing import Any
try:
from esp_coredump import CoreDump
@ -16,6 +18,18 @@ except ImportError:
from esp_coredump.cli_ext import parser
def get_prefix_map_gdbinit_path(prog_path): # type: (str) -> Any
build_dir = os.path.abspath(os.path.dirname(prog_path))
desc_path = os.path.abspath(os.path.join(build_dir, 'project_description.json'))
if not os.path.isfile(desc_path):
raise ValueError(f'{desc_path} does not exist. Please build the app with "idf.py build"')
with open(desc_path, 'r') as f:
project_desc = json.load(f)
return project_desc.get('debug_prefix_map_gdbinit')
def main(): # type: () -> None
args = parser.parse_args()
@ -32,6 +46,8 @@ def main(): # type: () -> None
logging.basicConfig(format='%(levelname)s: %(message)s', level=log_level)
kwargs = {k: v for k, v in vars(args).items() if v is not None}
# pass the extra_gdbinit_file if the build is reproducible
kwargs['extra_gdbinit_file'] = get_prefix_map_gdbinit_path(kwargs['prog'])
del(kwargs['debug'])
del(kwargs['operation'])