Skip to content

Commit

Permalink
ARC: west runner: mdb: fix unusable console after flash / debug
Browse files Browse the repository at this point in the history
Currently we try to start MDB (MetaWare Debugger) in background
with ignored sigint no matter if we are planing to do debug
session (via `west debug`) or just run something on HW or on
nSIM (via `west flash`)

That cause really bad user experience as after we do
`west debug` or `west flash` we can't terminate the debugger
from the console. Moreover even if we terminate the debugger
process from separate terminal the console stil would be
broken so we need to do `stty sane` in it to make it usable
again.

Fix all that by proper starting the debugger process.

Signed-off-by: Eugeniy Paltsev <[email protected]>
Signed-off-by: Evgeniy Paltsev <[email protected]>
  • Loading branch information
evgeniy-paltsev authored and mbolivar-nordic committed Feb 1, 2023
1 parent 0dcd692 commit 0206eff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions scripts/west_commands/runners/mdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ def mdb_do_run(mdb_runner, command):
else:
raise ValueError('unsupported cores {}'.format(mdb_runner.cores))

process = mdb_runner.popen_ignore_int(mdb_cmd, cwd=mdb_runner.build_dir)
record_cld_pid(mdb_runner, process)
mdb_runner.call(mdb_cmd, cwd=mdb_runner.build_dir)


class MdbNsimBinaryRunner(ZephyrBinaryRunner):
Expand Down
12 changes: 6 additions & 6 deletions scripts/west_commands/tests/test_mdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def require_patch(program):
@pytest.mark.parametrize('test_case', TEST_NSIM_FLASH_CASES)
@patch('runners.mdb.get_cld_pid', return_value=(False, -1))
@patch('time.sleep', return_value=None)
@patch('runners.mdb.MdbNsimBinaryRunner.popen_ignore_int')
@patch('runners.mdb.MdbNsimBinaryRunner.call')
@patch('runners.core.ZephyrBinaryRunner.require', side_effect=require_patch)
def test_flash_nsim(require, cc, t, gcp, test_case, mdb_nsim):
mdb_nsim(test_case['i']).run('flash')
Expand All @@ -161,7 +161,7 @@ def test_flash_nsim(require, cc, t, gcp, test_case, mdb_nsim):
@pytest.mark.parametrize('test_case', TEST_NSIM_DEBUG_CASES)
@patch('runners.mdb.get_cld_pid', return_value=(False, -1))
@patch('time.sleep', return_value=None)
@patch('runners.mdb.MdbNsimBinaryRunner.popen_ignore_int')
@patch('runners.mdb.MdbNsimBinaryRunner.call')
@patch('runners.core.ZephyrBinaryRunner.require', side_effect=require_patch)
def test_debug_nsim(require, pii, t, gcp, test_case, mdb_nsim):
mdb_nsim(test_case['i']).run('debug')
Expand All @@ -172,7 +172,7 @@ def test_debug_nsim(require, pii, t, gcp, test_case, mdb_nsim):
@patch('runners.mdb.get_cld_pid', return_value=(False, -1))
@patch('time.sleep', return_value=None)
@patch('runners.mdb.MdbNsimBinaryRunner.check_call')
@patch('runners.mdb.MdbNsimBinaryRunner.popen_ignore_int')
@patch('runners.mdb.MdbNsimBinaryRunner.call')
@patch('runners.core.ZephyrBinaryRunner.require', side_effect=require_patch)
def test_multicores_nsim(require, pii, cc, t, gcp, test_case, mdb_nsim):
mdb_nsim(test_case).run('flash')
Expand All @@ -186,7 +186,7 @@ def test_multicores_nsim(require, pii, cc, t, gcp, test_case, mdb_nsim):
@pytest.mark.parametrize('test_case', TEST_HW_FLASH_CASES)
@patch('runners.mdb.get_cld_pid', return_value=(False, -1))
@patch('time.sleep', return_value=None)
@patch('runners.mdb.MdbHwBinaryRunner.popen_ignore_int')
@patch('runners.mdb.MdbHwBinaryRunner.call')
@patch('runners.core.ZephyrBinaryRunner.require', side_effect=require_patch)
def test_flash_hw(require, cc, t, gcp, test_case, mdb_hw):
mdb_hw(test_case['i']).run('flash')
Expand All @@ -196,7 +196,7 @@ def test_flash_hw(require, cc, t, gcp, test_case, mdb_hw):
@pytest.mark.parametrize('test_case', TEST_HW_DEBUG_CASES)
@patch('runners.mdb.get_cld_pid', return_value=(False, -1))
@patch('time.sleep', return_value=None)
@patch('runners.mdb.MdbHwBinaryRunner.popen_ignore_int')
@patch('runners.mdb.MdbHwBinaryRunner.call')
@patch('runners.core.ZephyrBinaryRunner.require', side_effect=require_patch)
def test_debug_hw(require, pii, t, gcp, test_case, mdb_hw):
mdb_hw(test_case['i']).run('debug')
Expand All @@ -207,7 +207,7 @@ def test_debug_hw(require, pii, t, gcp, test_case, mdb_hw):
@patch('runners.mdb.get_cld_pid', return_value=(False, -1))
@patch('time.sleep', return_value=None)
@patch('runners.mdb.MdbHwBinaryRunner.check_call')
@patch('runners.mdb.MdbHwBinaryRunner.popen_ignore_int')
@patch('runners.mdb.MdbHwBinaryRunner.call')
@patch('runners.core.ZephyrBinaryRunner.require', side_effect=require_patch)
def test_multicores_hw(require, pii, cc, t, gcp, test_case, mdb_hw):
mdb_hw(test_case).run('flash')
Expand Down

0 comments on commit 0206eff

Please sign in to comment.