Skip to content

Commit

Permalink
Merge branch 'contrib/github_pr_12683_v5.1' into 'release/v5.1'
Browse files Browse the repository at this point in the history
fix(tools): fix path delimiter in gdbinit for Windows (v5.1)

See merge request espressif/esp-idf!27575
  • Loading branch information
dobairoland committed Dec 13, 2023
2 parents 6dc9cc8 + 293bd9a commit e3ca11c
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 @@ -256,23 +256,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 @@ -284,7 +284,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 e3ca11c

Please sign in to comment.