Skip to content

Commit

Permalink
fix(tools): fix path delimiter in gdbinit for Windows
Browse files Browse the repository at this point in the history
Merges espressif#12683

Signed-off-by: Alexey Lapshin <alexey.lapshin@espressif.com>
  • Loading branch information
MiguelBarro authored and movsb committed Dec 1, 2023
1 parent d5fb083 commit 9e5212c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/idf_py_actions/debug_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,23 +308,23 @@ def generate_gdbinit_files(gdb: str, gdbinit: Optional[str], project_desc: Dict[
raise FatalError('ELF file not found. You need to build & flash the project before running debug targets')

# 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):
os.remove(gdbinit_dir)
elif os.path.isdir(gdbinit_dir):
shutil.rmtree(gdbinit_dir)
os.mkdir(gdbinit_dir)

# 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:
if is_gdb_with_python(gdb):
f.write(GDBINIT_PYTHON_TEMPLATE.format(sys_path=sys.path))
else:
f.write(GDBINIT_PYTHON_NOT_SUPPORTED)

# 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:
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):
Expand All @@ -336,7 +336,7 @@ def generate_gdbinit_files(gdb: str, gdbinit: Optional[str], project_desc: Dict[

# Generate the gdbinit for target connect if no custom gdbinit is present
if not gdbinit:
gdbinit = os.path.join(gdbinit_dir, 'connect')
gdbinit = '/'.join([gdbinit_dir, 'connect'])
with open(gdbinit, 'w') as f:
f.write(GDBINIT_CONNECT)

Expand Down

0 comments on commit 9e5212c

Please sign in to comment.