diff mbox series

[13/14] oe-selftest: devtool: add test for gdb pretty-printing

Message ID 20251230084720.2371227-14-adrian.freihofer@siemens.com
State Under Review
Headers show
Series IDE SDK Improvements | expand

Commit Message

AdrianF Dec. 30, 2025, 8:46 a.m. UTC
From: Adrian Freihofer <adrian.freihofer@siemens.com>

This extends the existing devtool IDE SDK tests to verify that gdb
pretty-printing is working correctly.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 meta/lib/oeqa/selftest/cases/devtool.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Mathieu Dubois-Briand Dec. 31, 2025, 7:41 a.m. UTC | #1
On Tue Dec 30, 2025 at 9:46 AM CET, Adrian Freihofer via lists.openembedded.org wrote:
> From: Adrian Freihofer <adrian.freihofer@siemens.com>
>
> This extends the existing devtool IDE SDK tests to verify that gdb
> pretty-printing is working correctly.
>
> Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
> ---

Hi Adrian,

We discussed this over IRC, but let's keep a trace of it here.

This patch is probably responsible of the following error in the
autobuilder, during arm hosted selftests:

2025-12-30 16:17:15,120 - oe-selftest - INFO - devtool.DevtoolIdeSdkTests.test_devtool_ide_sdk_code_cmake (subunit.RemotedTestCase)
2025-12-30 16:17:15,121 - oe-selftest - INFO -  ... FAIL
...
AssertionError: Command '/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-1628878/tmp/work/aarch64-linux/gdb-cross-aarch64/16.3/recipe-sysroot-native/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gdb --batch -ex 'set sysroot /srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-1628878/tmp/work/cortexa57-poky-linux/cmake-example/1.0/image' -ex 'python import sys;sys.path.insert(0, '"'"'/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-1628878/tmp/work/cortexa57-poky-linux/cmake-example/1.0/recipe-sysroot/usr/share/gcc-15.2.0/python'"'"');from libstdcxx.v6.printers import register_libstdcxx_printers;register_libstdcxx_printers(None)' -ex 'set substitute-path /usr/include /srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-1628878/tmp/work/cortexa57-poky-linux/cmake-example/1.0/recipe-sysroot/usr/include' -ex 'set substitute-path /usr/src/debug/cmake-example/1.0 /tmp/devtoolqa7jq2nm81' -ex 'set substitute-path /usr/src/debug /srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-1628878/tmp/work/qemuarm64-poky-linux/oe-selftest-image/1.0/rootfs-dbg/usr/src/debug' -ex 'set solib-search-path /srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-1628878/tmp/work/qemuarm64-poky-linux/oe-selftest-image/1.0/rootfs-dbg/lib/.debug:/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-1628878/tmp/work/qemuarm64-poky-linux/oe-selftest-image/1.0/rootfs-dbg/usr/lib/.debug:/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-1628878/tmp/work/qemuarm64-poky-linux/oe-selftest-image/1.0/rootfs-dbg/usr/lib/debug:/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-1628878/tmp/work/qemuarm64-poky-linux/oe-selftest-image/1.0/rootfs-dbg/lib:/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-1628878/tmp/work/qemuarm64-poky-linux/oe-selftest-image/1.0/rootfs-dbg/usr/lib:/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-1628878/tmp/work/qemuarm64-poky-linux/oe-selftest-image/1.0/rootfs/lib:/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-1628878/tmp/work/qemuarm64-poky-linux/oe-selftest-image/1.0/rootfs/usr/lib' -ex 'file /srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-1628878/tmp/work/cortexa57-poky-linux/cmake-example/1.0/image/usr/bin/cmake-example' -ex 'target remote 192.168.7.4:1234' -ex 'break main' -ex 'continue' -ex 'break CppExample::print_json()' -ex 'continue' -ex 'print CppExample::test_string.compare("cpp-example-lib Magic: 123456789")' -ex 'print CppExample::test_string.compare("cpp-example-lib Magic: 123456789aaa")' -ex 'list cpp-example-lib.hpp:14,14' -ex 'list cpp-example.cpp:55,55' -ex 'break cpp-example.cpp:55' -ex 'continue' -ex 'print numbers' -ex 'continue'' returned non-zero exit status 1:
_start () at ../sysdeps/aarch64/dl-start.S:23
23	ENTRY (_start)
Breakpoint 1 at 0xaaaaaaaa1400: file /usr/src/debug/cmake-example/1.0/cpp-example.cpp, line 15.

Breakpoint 1, main (argc=1, argv=0xfffffffffd08) at /usr/src/debug/cmake-example/1.0/cpp-example.cpp:15
15	{
Breakpoint 2 at 0xfffff7f91d70: file /usr/src/debug/cmake-example/1.0/cpp-example-lib.cpp, line 28.

Breakpoint 2, CppExample::print_json (this=0xfffffffffac8) at /usr/src/debug/cmake-example/1.0/cpp-example-lib.cpp:28
28	    jobj = json_object_new_object();
$1 = 0
$2 = -3
14	    inline static const std::string test_string = "cpp-example-lib Magic: 123456789";
55	    std::vector<int> numbers = {1, 2, 3};
No compiled code for line 55 in file "cpp-example.cpp".
Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
[Inferior 1 (process 346) exited normally]
A syntax error in expression, near the end of `numbers'.
The program is not being run.
...
2025-12-30 16:26:11,523 - oe-selftest - INFO - devtool.DevtoolIdeSdkTests.test_devtool_ide_sdk_none_qemu (subunit.RemotedTestCase)
2025-12-30 16:26:11,524 - oe-selftest - INFO -  ... FAIL
...

https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/3070

Thanks,
Mathieu
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index df5c863a85..092ffd5e9e 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -2725,6 +2725,12 @@  class DevtoolIdeSdkTests(DevtoolBase):
         gdb_batch_cmd += " -ex 'print CppExample::test_string.compare(\"cpp-example-lib %s\")'" % magic_string
         gdb_batch_cmd += " -ex 'print CppExample::test_string.compare(\"cpp-example-lib %saaa\")'" % magic_string
         gdb_batch_cmd += " -ex 'list cpp-example-lib.hpp:14,14'"
+
+        # check if resolving std::vector works with python scripts
+        gdb_batch_cmd += " -ex 'list cpp-example.cpp:55,55'"
+        gdb_batch_cmd += " -ex 'break cpp-example.cpp:55'"
+        gdb_batch_cmd += " -ex 'continue'"
+        gdb_batch_cmd += " -ex 'print numbers'"
         gdb_batch_cmd += " -ex 'continue'"
         return gdb_batch_cmd
 
@@ -2734,6 +2740,11 @@  class DevtoolIdeSdkTests(DevtoolBase):
         self.assertIn("$2 = -3", gdb_output)  # test.string.compare longer
         self.assertIn(
             'inline static const std::string test_string = "cpp-example-lib %s";' % magic_string, gdb_output)
+
+        # check if resolving std::vector works with python scripts
+        self.assertRegex(gdb_output, r"55\s+std::vector<int> numbers = \{1, 2, 3\};")
+        self.assertIn("$3 = std::vector of length 3, capacity 3 = {1, 2, 3}", gdb_output)
+
         self.assertIn("exited normally", gdb_output)
 
     def _gdb_cross_debugging_multi(self, qemu, recipe_name, example_exe, magic_string):