Merge branch 'bugfix/debug_ext_ctrl_c' into 'master'

tools: fix waiting on gdb process when interrupted with CTRL+C

Closes IDFGH-10638

See merge request espressif/esp-idf!24836
This commit is contained in:
Roland Dobai 2023-07-20 23:05:53 +08:00
commit f4a1567474

View File

@ -484,11 +484,6 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict:
if task.name in ('gdb', 'gdbgui', 'gdbtui'): if task.name in ('gdb', 'gdbgui', 'gdbtui'):
task.action_args['require_openocd'] = True task.action_args['require_openocd'] = True
def run_gdb(gdb_args: List) -> int:
p = subprocess.Popen(gdb_args)
processes['gdb'] = p
return p.wait()
def gdbtui(action: str, ctx: Context, args: PropertyDict, gdbinit: str, require_openocd: bool) -> None: def gdbtui(action: str, ctx: Context, args: PropertyDict, gdbinit: str, require_openocd: bool) -> None:
""" """
Synchronous GDB target with text ui mode Synchronous GDB target with text ui mode
@ -510,11 +505,11 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict:
args += ['-tui'] args += ['-tui']
if batch: if batch:
args += ['--batch'] args += ['--batch']
t = Thread(target=run_gdb, args=(args,)) p = subprocess.Popen(args)
t.start() processes['gdb'] = p
while True: while True:
try: try:
t.join() p.wait()
break break
except KeyboardInterrupt: except KeyboardInterrupt:
# Catching Keyboard interrupt, as this is used for breaking running program in gdb # Catching Keyboard interrupt, as this is used for breaking running program in gdb