fix(tools): fix path delimiter in gdbinit for Windows

Merges https://github.com/espressif/esp-idf/pull/12683

Signed-off-by: Alexey Lapshin <alexey.lapshin@espressif.com>
This commit is contained in:
GuyBrush 2023-11-28 11:26:29 +01:00 committed by BOT
parent 41ca90905e
commit 8b68b39198

View File

@ -307,7 +307,7 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict:
raise FatalError('ELF file not found. You need to build & flash the project before running debug targets') raise FatalError('ELF file not found. You need to build & flash the project before running debug targets')
# Recreate empty 'gdbinit' directory # Recreate empty 'gdbinit' directory
gdbinit_dir = os.path.join(project_desc['build_dir'], 'gdbinit') gdbinit_dir = '/'.join([project_desc['build_dir'], 'gdbinit'])
if os.path.isfile(gdbinit_dir): if os.path.isfile(gdbinit_dir):
os.remove(gdbinit_dir) os.remove(gdbinit_dir)
elif os.path.isdir(gdbinit_dir): elif os.path.isdir(gdbinit_dir):
@ -315,7 +315,7 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict:
os.mkdir(gdbinit_dir) os.mkdir(gdbinit_dir)
# Prepare gdbinit for Python GDB extensions import # Prepare gdbinit for Python GDB extensions import
py_extensions = os.path.join(gdbinit_dir, 'py_extensions') py_extensions = '/'.join([gdbinit_dir, 'py_extensions'])
with open(py_extensions, 'w') as f: with open(py_extensions, 'w') as f:
if is_gdb_with_python(gdb): if is_gdb_with_python(gdb):
f.write(GDBINIT_PYTHON_TEMPLATE.format(sys_path=sys.path)) f.write(GDBINIT_PYTHON_TEMPLATE.format(sys_path=sys.path))
@ -323,7 +323,7 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict:
f.write(GDBINIT_PYTHON_NOT_SUPPORTED) f.write(GDBINIT_PYTHON_NOT_SUPPORTED)
# Prepare gdbinit for related ELFs symbols load # Prepare gdbinit for related ELFs symbols load
symbols = os.path.join(gdbinit_dir, 'symbols') symbols = '/'.join([gdbinit_dir, 'symbols'])
with open(symbols, 'w') as f: with open(symbols, 'w') as f:
boot_elf = get_normalized_path(project_desc['bootloader_elf']) if 'bootloader_elf' in project_desc else None boot_elf = get_normalized_path(project_desc['bootloader_elf']) if 'bootloader_elf' in project_desc else None
if boot_elf and os.path.exists(boot_elf): if boot_elf and os.path.exists(boot_elf):
@ -335,7 +335,7 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict:
# Generate the gdbinit for target connect if no custom gdbinit is present # Generate the gdbinit for target connect if no custom gdbinit is present
if not gdbinit: if not gdbinit:
gdbinit = os.path.join(gdbinit_dir, 'connect') gdbinit = '/'.join([gdbinit_dir, 'connect'])
with open(gdbinit, 'w') as f: with open(gdbinit, 'w') as f:
f.write(GDBINIT_CONNECT) f.write(GDBINIT_CONNECT)