Skip to content

Commit 1c8e260

Browse files
committed
testing/esp: replace deprecated smp_gdb by hwthread in appcpu_early_hw_bps
1 parent 6717e76 commit 1c8e260

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

testing/esp/test_bp.py

+18-18
Original file line numberDiff line numberDiff line change
@@ -316,26 +316,28 @@ def appcpu_early_hw_bps(self):
316316
self.gdb.target_reset()
317317
rsn = self.gdb.wait_target_state(dbg.TARGET_STATE_STOPPED, 10)
318318
self.add_bp('call_start_cpu1', hw=True)
319+
for target in self.oocd.targets():
320+
self.oocd.cmd_exec(f"{target} configure -rtos hwthread")
319321
self.resume_exec()
320322
self.gdb.wait_target_state(dbg.TARGET_STATE_STOPPED, 10)
321-
# We stopped when FreRTOS is not running yet, so GDB is connected to
322-
# one core only (most probably core 0) and shows only one thread representing that core.
323-
# Prepare to switch GDB to core 1.
324-
self.gdb.monitor_run("esp32 smp_gdb 1", 5)
325-
try:
326-
# Switch GDB to core 1.
327-
self.gdb.monitor_run("resume", 5)
328-
# Invalidate register cache to re-read them and get proper backtrace
329-
self.gdb.console_cmd_run("maint flush register-cache", 5)
330-
# In this scenario we can not check stop reason for core 1,
331-
# because GDB could be initially connected to core 0.
332-
# So just check the function name we stopped in on core 1.
323+
_,threads_info = self.gdb.get_thread_info()
324+
325+
def check_bp_hit_on_cpu(cpu_num):
326+
for ti in threads_info:
327+
if ti['name'].endswith(f".cpu{cpu_num}"):
328+
self.gdb.console_cmd_run(f"thread {ti['id']}")
329+
break
333330
frame = self.gdb.read_current_frame()
334331
self.assertEqual(frame['func'], 'call_start_cpu1')
335-
finally:
336-
# restore default GDB SMP handling to avoid other tests failures
337-
self.gdb.monitor_run("esp32 smp_gdb -1", 5)
338-
self.gdb.monitor_run("resume", 5)
332+
333+
try:
334+
check_bp_hit_on_cpu(1)
335+
except:
336+
# The breakpoint can trigger on cpu0 first, before the bootloader code is loaded
337+
check_bp_hit_on_cpu(0)
338+
self.resume_exec()
339+
self.gdb.wait_target_state(dbg.TARGET_STATE_STOPPED, 10)
340+
check_bp_hit_on_cpu(1)
339341

340342
class DebuggerBreakpointTestsDual(DebuggerGenericTestAppTestsDual, BreakpointTestsImpl):
341343
""" Test cases for breakpoints in dual core mode
@@ -349,7 +351,6 @@ def setUp(self):
349351
def test_2cores_concurrently_hit_bps(self):
350352
two_cores_concurrently_hit_bps(self)
351353

352-
@skip_for_chip(['esp32', 'esp32p4'], "skipped - OCD-1088, OCD-1089")
353354
def test_appcpu_early_hw_bps(self):
354355
appcpu_early_hw_bps(self)
355356

@@ -363,7 +364,6 @@ def setUp(self):
363364
def test_2cores_concurrently_hit_bps(self):
364365
two_cores_concurrently_hit_bps(self)
365366

366-
@skip_for_chip(['esp32'], "skipped - OCD-1088")
367367
def test_appcpu_early_hw_bps(self):
368368
appcpu_early_hw_bps(self)
369369

0 commit comments

Comments
 (0)