Skip to content

Commit

Permalink
Fixes to properly run idf.py gdb from windows
Browse files Browse the repository at this point in the history
Signed-off-by: GuyBrush <[email protected]>
  • Loading branch information
MiguelBarro committed Nov 28, 2023
1 parent e088c37 commit 7162825
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/idf_py_actions/debug_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def generate_gdbinit_rom_add_symbols(target: str) -> str:
r.append('set confirm on')
r.append('end')
r.append('')
return os.linesep.join(r)
return '\n'.join(r)
raise FatalError(f'{ESP_ROM_INFO_FILE} file not found. Please check IDF integrity.')

def generate_gdbinit_files(gdb: str, gdbinit: Optional[str], project_desc: Dict[str, Any]) -> None:
Expand All @@ -279,23 +279,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 @@ -307,7 +307,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 7162825

Please sign in to comment.