diff mbox series

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

Message ID 20251231114718.4031606-14-adrian.freihofer@siemens.com
State Changes Requested
Headers show
Series IDE SDK Improvements | expand

Commit Message

AdrianF Dec. 31, 2025, 11: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 | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Mathieu Dubois-Briand Jan. 2, 2026, 2:44 p.m. UTC | #1
On Wed Dec 31, 2025 at 12:46 PM 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,

Thanks for the new version, but it looks like it is still failing:

2026-01-02 10:09:04,822 - oe-selftest - INFO - 11: 2/36 112/655 (365.52s) (0 failed) (devtool.DevtoolIdeSdkTests.test_devtool_ide_sdk_code_cmake)
2026-01-02 10:09:04,822 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/openembedded-core/meta/lib/oeqa/selftest/cases/devtool.py", line 3237, in test_devtool_ide_sdk_code_cmake
    self._verify_launch_json_debugging(tempdir, qemu, recipe_name, example_exe)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/openembedded-core/meta/lib/oeqa/selftest/cases/devtool.py", line 3106, in _verify_launch_json_debugging
    self._verify_launch_config(tempdir, config, tasks, qemu, example_exe,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                               self._gdb_debug_cpp_example, self._gdb_debug_cpp_example_check)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/openembedded-core/meta/lib/oeqa/selftest/cases/devtool.py", line 3206, in _verify_launch_config
    debug_check_func(r.output, DevtoolIdeSdkTests.MAGIC_STRING_ORIG)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/openembedded-core/meta/lib/oeqa/selftest/cases/devtool.py", line 2750, in _gdb_debug_cpp_example_check
    self.assertRegex(gdb_output, r"\$\d+ = std::vector of length 3, capacity 3 = \{1, 2, 3\}")
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/unittest/case.py", line 1369, in assertRegex
    raise self.failureException(msg)
AssertionError: Regex didn't match: '\\$\\d+ = std::vector of length 3, capacity 3 = \\{1, 2, 3\\}' not found in '_start () at ../sysdeps/aarch64/dl-start.S:23\n23\tENTRY (_start)\nBreakpoint 1 at 0xaaaaaaaa1400: file /usr/src/debug/cmake-example/1.0/cpp-example.cpp, line 15.\n\nBreakpoint 1, main (argc=1, argv=0xfffffffffd08) at /usr/src/debug/cmake-example/1.0/cpp-example.cpp:15\n15\t{\nBreakpoint 2 at 0xfffff7f91d70: file /usr/src/debug/cmake-example/1.0/cpp-example-lib.cpp, line 28.\n\nBreakpoint 2, CppExample::print_json (this=0xfffffffffac8) at /usr/src/debug/cmake-example/1.0/cpp-example-lib.cpp:28\n28\t    jobj = json_object_new_object();\n$1 = 0\n$2 = -3\n14\t    inline static const std::string test_string = "cpp-example-lib Magic: 123456789";\n55\t    std::vector<int> numbers = {1, 2, 3};\nBreakpoint 3 at 0xaaaaaaaa1780: file /usr/src/debug/cmake-example/1.0/cpp-example.cpp, line 56.\n\nBreakpoint 3, std::uninitialized_copy<int const*, int*> (__first=<optimized out>, __last=<optimized out>, __result=<optimized out>) at /usr/src/debug/cmake-example/1.0/cpp-example.cpp:56\n56\t    std::cout << "Traversing std::vector<int> numbers:" << std::endl;\nAttempt to use a type name as an expression\n[Inferior 1 (process 346) exited normally]'

And a similar one for devtool.DevtoolIdeSdkTests.test_devtool_ide_sdk_none_qemu.

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

I know debugging this might be a bit tough, as it is arm host only. If
you have doubts about what is failing, I can do some tests next week.

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..3f00ce8ffb 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -2725,6 +2725,14 @@  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
+        # break at line 56, because the line which initializes the vector
+        # may be optimized out by the compiler
+        gdb_batch_cmd += " -ex 'list cpp-example.cpp:55,55'"
+        gdb_batch_cmd += " -ex 'break cpp-example.cpp:56'"
+        gdb_batch_cmd += " -ex 'continue'"
+        gdb_batch_cmd += " -ex 'print numbers'"
         gdb_batch_cmd += " -ex 'continue'"
         return gdb_batch_cmd
 
@@ -2734,6 +2742,10 @@  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.assertRegex(gdb_output, r"\$\d+ = std::vector of length 3, capacity 3 = \{1, 2, 3\}")
         self.assertIn("exited normally", gdb_output)
 
     def _gdb_cross_debugging_multi(self, qemu, recipe_name, example_exe, magic_string):