Move the stable source-line helper to the common ide-sdk test base so the Rust CodeLLDB integration can reuse it. Preserve the rationale for using marker-based lines instead of brittle hard-coded numbers.
AI-Generated: Uses GitHub Copilot Signed-off-by: Enguerrand de Ribaucourt <[email protected]> --- meta/lib/oeqa/selftest/cases/devtool.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index ca76597bbe..99e6531877 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py @@ -3133,6 +3133,20 @@ class DevtoolIdeSdkTests(DevtoolBase): def _sources_workdir_dir(self, src_dir): return os.path.realpath(os.path.join(src_dir, 'oe-workdir')) + def _find_source_break_line(self, tempdir, source_file, marker): + """Find the 1-based line number of `marker` in tempdir/source_file + + Used to set a source-level (file:line) breakpoint at a stable, + self-documenting location instead of hard-coding a line number that + would silently go stale whenever the example source changes. + """ + source_path = os.path.join(tempdir, source_file) + with open(source_path) as f: + for lineno, line in enumerate(f, start=1): + if marker in line: + return lineno + self.fail("Could not find marker %r in %s" % (marker, source_path)) + def _find_multi_script_port(self, recipe_name, script_prefix, example_exe): """Discover the port assigned to a generated 'multi' mode debug-server script (gdbserver_*/lldb_server_*), since each --ide plugin allocates @@ -4876,20 +4890,6 @@ class DevtoolIdeSdkClangTests(DevtoolIdeSdkTests): self.assertTrue(task, f"Configuration '{config_name}' preLaunchTask should not be empty") - def _find_source_break_line(self, tempdir, source_file, marker): - """Find the 1-based line number of `marker` in tempdir/source_file - - Used to set a source-level (file:line) breakpoint at a stable, - self-documenting location instead of hard-coding a line number that - would silently go stale whenever the example source changes. - """ - source_path = os.path.join(tempdir, source_file) - with open(source_path) as f: - for lineno, line in enumerate(f, start=1): - if marker in line: - return lineno - self.fail("Could not find marker %r in %s" % (marker, source_path)) - def _lldb_debug_cpp_example_batch_commands(self, tempdir): """Get a list of lldb --batch '-o' commands to debug the cpp-example-lib example -- 2.53.0
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#248655): https://lists.openembedded.org/g/openembedded-core/message/248655 Mute This Topic: https://lists.openembedded.org/mt/121938798/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
