[Lldb-commits] [lldb] Colorize output when searching for symbols in lldb (PR #69422)

via lldb-commits lldb-commits at lists.llvm.org
Sun Nov 12 23:12:36 PST 2023


=?utf-8?q?José?= L. Junior <josejunior at 10xengineers.ai>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/69422 at github.com>


taalhaataahir0102 wrote:

Hi David! We are working on host level physical machine. We've tried the configurations but the issue is still the same (Also others like `ninja check-llvm`, `ninja check-clang` etc. are working perfectly fine)

Initially a lot of test cases were failing:
```
********************
Failed Tests (47):
  lldb-shell :: Breakpoint/breakpoint-command.test
  lldb-shell :: Breakpoint/dummy-target.test
  lldb-shell :: Driver/CommandOnCrashMultiThreaded.test
  lldb-shell :: Driver/TestConvenienceVariables.test
  lldb-shell :: Expr/TestExited.test
  lldb-shell :: Expr/TestIRMemoryMap.test
  lldb-shell :: Process/TestEnvironment.test
  lldb-shell :: Register/x86-64-fp-read.test
  lldb-shell :: Register/x86-64-fp-write.test
  lldb-shell :: Register/x86-64-gp-read.test
  lldb-shell :: Register/x86-64-gp-write.test
  lldb-shell :: Register/x86-64-read.test
  lldb-shell :: Register/x86-64-write.test
  lldb-shell :: Register/x86-64-ymm-read.test
  lldb-shell :: Register/x86-64-ymm-write.test
  lldb-shell :: Register/x86-fp-write.test
  lldb-shell :: Register/x86-mm-xmm-read.test
  lldb-shell :: Register/x86-mm-xmm-write.test
  lldb-shell :: Register/x86-multithread-read.test
  lldb-shell :: Register/x86-multithread-write.test
  lldb-shell :: Settings/TestFrameFormatMangling.test
  lldb-shell :: Settings/TestFrameFormatNameWithArgs.test
  lldb-shell :: Subprocess/clone-follow-child-softbp.test
  lldb-shell :: Subprocess/clone-follow-child-wp.test
  lldb-shell :: Subprocess/clone-follow-child.test
  lldb-shell :: Subprocess/clone-follow-parent-softbp.test
  lldb-shell :: Subprocess/clone-follow-parent-wp.test
  lldb-shell :: Subprocess/clone-follow-parent.test
  lldb-shell :: Subprocess/fork-follow-child-softbp.test
  lldb-shell :: Subprocess/fork-follow-child-wp.test
  lldb-shell :: Subprocess/fork-follow-child.test
  lldb-shell :: Subprocess/fork-follow-parent-softbp.test
  lldb-shell :: Subprocess/fork-follow-parent-wp.test
  lldb-shell :: Subprocess/fork-follow-parent.test
  lldb-shell :: Subprocess/vfork-follow-child-softbp.test
  lldb-shell :: Subprocess/vfork-follow-child-wp.test
  lldb-shell :: Subprocess/vfork-follow-child.test
  lldb-shell :: Subprocess/vfork-follow-parent-softbp.test
  lldb-shell :: Subprocess/vfork-follow-parent-wp.test
  lldb-shell :: Subprocess/vfork-follow-parent.test
  lldb-shell :: SymbolFile/DWARF/clang-gmodules-type-lookup.c
  lldb-shell :: SymbolFile/DWARF/debug-types-expressions.test
  lldb-shell :: SymbolFile/NativePDB/lookup-by-types.cpp
  lldb-shell :: SymbolFile/OnDemand/source-breakpoint.test
  lldb-shell :: SymbolFile/OnDemand/symbolic-breakpoint.test
  lldb-shell :: Watchpoint/ExpressionLanguage.test
  lldb-shell :: Watchpoint/SetErrorCases.test


Testing Time: 258.26s

Total Discovered Tests: 2889
  Unsupported      :  374 (12.95%)
  Passed           : 1782 (61.68%)
  Expectedly Failed:   20 (0.69%)
  Unresolved       :  666 (23.05%)
  Failed           :   47 (1.63%)

2 warning(s) in tests
FAILED: tools/lldb/test/CMakeFiles/check-lldb /home/talha/llvm-latest/build/tools/lldb/test/CMakeFiles/check-lldb 
cd /home/talha/llvm-latest/build/tools/lldb/test && /usr/bin/python3.10 /home/talha/llvm-latest/build/./bin/llvm-lit -v /home/talha/llvm-latest/build/tools/lldb/test
ninja: build stopped: subcommand failed.
```
For the failed tests, we ran them manually. For instance for lldb-shell :: Breakpoint/breakpoint-command.test:

```
./bin/llvm-lit ../llvm-project/lldb/test/Shell/Breakpoint/breakpoint-command.test -a
llvm-lit: /home/talha/llvm-latest/llvm-project/llvm/utils/lit/lit/llvm/config.py:488: note: using clang: /home/talha/llvm-latest/build/bin/clang
llvm-lit: /home/talha/llvm-latest/llvm-project/llvm/utils/lit/lit/llvm/config.py:488: note: using ld.lld: /home/talha/llvm-latest/build/bin/ld.lld
llvm-lit: /home/talha/llvm-latest/llvm-project/llvm/utils/lit/lit/llvm/config.py:488: note: using lld-link: /home/talha/llvm-latest/build/bin/lld-link
llvm-lit: /home/talha/llvm-latest/llvm-project/llvm/utils/lit/lit/llvm/config.py:488: note: using ld64.lld: /home/talha/llvm-latest/build/bin/ld64.lld
llvm-lit: /home/talha/llvm-latest/llvm-project/llvm/utils/lit/lit/llvm/config.py:488: note: using wasm-ld: /home/talha/llvm-latest/build/bin/wasm-ld
llvm-lit: /home/talha/llvm-latest/llvm-project/lldb/test/Shell/lit.cfg.py:113: warning: Could not set a default per-test timeout. Requires the Python psutil module but it could not be found. Try installing it via pip or via your operating system's package manager.
-- Testing: 1 tests, 1 workers --
FAIL: lldb-shell :: Breakpoint/breakpoint-command.test (1 of 1)
******************** TEST 'lldb-shell :: Breakpoint/breakpoint-command.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
Cleaning breakpoint-command.test.tmp.out-dummy-target.o
Cleaning breakpoint-command.test.tmp.out



compiling dummy-target.c -> breakpoint-command.test.tmp.out-dummy-target.o
  STDOUT:




linking breakpoint-command.test.tmp.out-dummy-target.o -> breakpoint-command.test.tmp.out
  STDOUT:

  STDERR:
    /usr/bin/ld: cannot find -lstdc++: No such file or directory
    clang++: error: linker command failed with exit code 1 (use -v to see invocation)


--
Command Output (stderr):
--
RUN: at line 3: '/usr/bin/python3.10' /home/talha/llvm-latest/llvm-project/lldb/test/Shell/helper/build.py --compiler=any --arch=64 --tools-dir=/home/talha/llvm-latest/build/./bin --libs-dir=/home/talha/llvm-latest/build/./lib /home/talha/llvm-latest/llvm-project/lldb/test/Shell/Breakpoint/Inputs/dummy-target.c -o /home/talha/llvm-latest/build/tools/lldb/test/Shell/Breakpoint/Output/breakpoint-command.test.tmp.out
+ /usr/bin/python3.10 /home/talha/llvm-latest/llvm-project/lldb/test/Shell/helper/build.py --compiler=any --arch=64 --tools-dir=/home/talha/llvm-latest/build/./bin --libs-dir=/home/talha/llvm-latest/build/./lib /home/talha/llvm-latest/llvm-project/lldb/test/Shell/Breakpoint/Inputs/dummy-target.c -o /home/talha/llvm-latest/build/tools/lldb/test/Shell/Breakpoint/Output/breakpoint-command.test.tmp.out

--

********************
********************
Failed Tests (1):
  lldb-shell :: Breakpoint/breakpoint-command.test


Testing Time: 0.36s

Total Discovered Tests: 1
  Failed: 1 (100.00%)

1 warning(s) in tests
```
We figured out that we were missing a development package for the C++ standard library, we had to install the package 
`apt-get install libstdc++-12-dev`

Now just 4 API tests are failing:

```
********************
Failed Tests (4):
  lldb-api :: commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py
  lldb-api :: commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py
  lldb-api :: commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py
  lldb-api :: functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py


Testing Time: 201.62s

Total Discovered Tests: 2889
  Unsupported      :  376 (13.01%)
  Passed           : 2488 (86.12%)
  Expectedly Failed:   20 (0.69%)
  Unresolved       :    1 (0.03%)
  Failed           :    4 (0.14%)

2 warning(s) in tests
FAILED: tools/lldb/test/CMakeFiles/check-lldb /home/talha/llvm-latest/build/tools/lldb/test/CMakeFiles/check-lldb 
cd /home/talha/llvm-latest/build/tools/lldb/test && /usr/bin/python3.10 /home/talha/llvm-latest/build/./bin/llvm-lit -v /home/talha/llvm-latest/build/tools/lldb/test
ninja: build stopped: subcommand failed.
```
After manually running the failed tests, here is the output:

```
./bin/llvm-lit ../llvm-project/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py -a
llvm-lit: /home/talha/llvm-latest/llvm-project/lldb/test/API/lit.cfg.py:174: warning: Could not set a default per-test timeout. Requires the Python psutil module but it could not be found. Try installing it via pip or via your operating system's package manager.
-- Testing: 1 tests, 1 workers --
FAIL: lldb-api :: commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py (1 of 1)
******************** TEST 'lldb-api :: commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/talha/llvm-latest/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env ARCHIVER=/usr/bin/ar --env OBJCOPY=/usr/bin/objcopy --env LLVM_LIBS_DIR=/home/talha/llvm-latest/build/./lib --env LLVM_INCLUDE_DIR=/home/talha/llvm-latest/build/include --env LLVM_TOOLS_DIR=/home/talha/llvm-latest/build/./bin --arch x86_64 --build-dir /home/talha/llvm-latest/build/lldb-test-build.noindex --lldb-module-cache-dir /home/talha/llvm-latest/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/talha/llvm-latest/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/talha/llvm-latest/build/./bin/lldb --compiler /home/talha/llvm-latest/build/./bin/clang --dsymutil /home/talha/llvm-latest/build/./bin/dsymutil --llvm-tools-dir /home/talha/llvm-latest/build/./bin --lldb-libs-dir /home/talha/llvm-latest/build/./lib /home/talha/llvm-latest/llvm-project/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content -p TestDbgInfoContentDequeFromStdModule.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 18.0.0git
Skipping the following test categories: ['dsym', 'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
UNSUPPORTED: LLDB (/home/talha/llvm-latest/build/bin/clang-x86_64) :: test_dsym (TestDbgInfoContentDequeFromStdModule.TestDbgInfoContentDeque) (test case does not fall in any category of interest for this run) 
FAIL: LLDB (/home/talha/llvm-latest/build/bin/clang-x86_64) :: test_dwarf (TestDbgInfoContentDequeFromStdModule.TestDbgInfoContentDeque)
FAIL: LLDB (/home/talha/llvm-latest/build/bin/clang-x86_64) :: test_dwo (TestDbgInfoContentDequeFromStdModule.TestDbgInfoContentDeque)
======================================================================
FAIL: test_dwarf (TestDbgInfoContentDequeFromStdModule.TestDbgInfoContentDeque)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/talha/llvm-latest/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1781, in test_method
    return attrvalue(self)
  File "/home/talha/llvm-latest/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 166, in wrapper
    return func(*args, **kwargs)
  File "/home/talha/llvm-latest/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 166, in wrapper
    return func(*args, **kwargs)
  File "/home/talha/llvm-latest/llvm-project/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py", line 52, in test
    self.expect_expr("a.size()", result_type=size_type, result_value="3")
  File "/home/talha/llvm-latest/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2593, in expect_expr
    value_check.check_value(self, eval_result, str(eval_result))
  File "/home/talha/llvm-latest/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 302, in check_value
    test_base.assertSuccess(val.GetError())
  File "/home/talha/llvm-latest/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2628, in assertSuccess
    self.fail(self._formatMessage(msg, "'{}' is not success".format(error)))
AssertionError: 'error: Couldn't look up symbols:
  std::deque<Foo, std::allocator<Foo>>::size() const
' is not success
Config=x86_64-/home/talha/llvm-latest/build/bin/clang
======================================================================
FAIL: test_dwo (TestDbgInfoContentDequeFromStdModule.TestDbgInfoContentDeque)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/talha/llvm-latest/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1781, in test_method
    return attrvalue(self)
  File "/home/talha/llvm-latest/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 166, in wrapper
    return func(*args, **kwargs)
  File "/home/talha/llvm-latest/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 166, in wrapper
    return func(*args, **kwargs)
  File "/home/talha/llvm-latest/llvm-project/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py", line 52, in test
    self.expect_expr("a.size()", result_type=size_type, result_value="3")
  File "/home/talha/llvm-latest/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2593, in expect_expr
    value_check.check_value(self, eval_result, str(eval_result))
  File "/home/talha/llvm-latest/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 302, in check_value
    test_base.assertSuccess(val.GetError())
  File "/home/talha/llvm-latest/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2628, in assertSuccess
    self.fail(self._formatMessage(msg, "'{}' is not success".format(error)))
AssertionError: 'error: Couldn't look up symbols:
  std::deque<Foo, std::allocator<Foo>>::size() const
' is not success
Config=x86_64-/home/talha/llvm-latest/build/bin/clang
----------------------------------------------------------------------
Ran 3 tests in 0.679s

RESULT: FAILED (0 passes, 2 failures, 0 errors, 1 skipped, 0 expected failures, 0 unexpected successes)

--

********************
********************
Failed Tests (1):
  lldb-api :: commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py


Testing Time: 0.99s

Total Discovered Tests: 1
  Failed: 1 (100.00%)

1 warning(s) in tests

```
 For all 3 API command test, the error is same i.e., 

```
AssertionError: 'error: Couldn't look up symbols:
  std::deque<Foo, std::allocator<Foo>>::size() const
' is not success
```

And for the last one:

```
./bin/llvm-lit ../llvm-project/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py -a
llvm-lit: /home/talha/llvm-latest/llvm-project/lldb/test/API/lit.cfg.py:174: warning: Could not set a default per-test timeout. Requires the Python psutil module but it could not be found. Try installing it via pip or via your operating system's package manager.
-- Testing: 1 tests, 1 workers --
FAIL: lldb-api :: functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py (1 of 1)
******************** TEST 'lldb-api :: functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/talha/llvm-latest/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env ARCHIVER=/usr/bin/ar --env OBJCOPY=/usr/bin/objcopy --env LLVM_LIBS_DIR=/home/talha/llvm-latest/build/./lib --env LLVM_INCLUDE_DIR=/home/talha/llvm-latest/build/include --env LLVM_TOOLS_DIR=/home/talha/llvm-latest/build/./bin --arch x86_64 --build-dir /home/talha/llvm-latest/build/lldb-test-build.noindex --lldb-module-cache-dir /home/talha/llvm-latest/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/talha/llvm-latest/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/talha/llvm-latest/build/./bin/lldb --compiler /home/talha/llvm-latest/build/./bin/clang --dsymutil /home/talha/llvm-latest/build/./bin/dsymutil --llvm-tools-dir /home/talha/llvm-latest/build/./bin --lldb-libs-dir /home/talha/llvm-latest/build/./lib /home/talha/llvm-latest/llvm-project/lldb/test/API/functionalities/process_save_core_minidump -p TestProcessSaveCoreMinidump.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 18.0.0git
Skipping the following test categories: ['dsym', 'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
UNSUPPORTED: LLDB (/home/talha/llvm-latest/build/bin/clang-x86_64) :: test_save_linux_mini_dump_dsym (TestProcessSaveCoreMinidump.ProcessSaveCoreMinidumpTestCase) (test case does not fall in any category of interest for this run) 
FAIL: LLDB (/home/talha/llvm-latest/build/bin/clang-x86_64) :: test_save_linux_mini_dump_dwarf (TestProcessSaveCoreMinidump.ProcessSaveCoreMinidumpTestCase)
FAIL: LLDB (/home/talha/llvm-latest/build/bin/clang-x86_64) :: test_save_linux_mini_dump_dwo (TestProcessSaveCoreMinidump.ProcessSaveCoreMinidumpTestCase)
======================================================================
FAIL: test_save_linux_mini_dump_dwarf (TestProcessSaveCoreMinidump.ProcessSaveCoreMinidumpTestCase)
   Test that we can save a Linux mini dump.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/talha/llvm-latest/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1781, in test_method
    return attrvalue(self)
  File "/home/talha/llvm-latest/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 166, in wrapper
    return func(*args, **kwargs)
  File "/home/talha/llvm-latest/llvm-project/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py", line 94, in test_save_linux_mini_dump
    self.runCmd(
  File "/home/talha/llvm-latest/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2116, in runCmd
    self.assertTrue(self.res.Succeeded(), msg if (msg) else CMD_MSG(cmd))
AssertionError: False is not True : Command 'process save-core --plugin-name=minidump  --style=full '/home/talha/llvm-latest/build/lldb-test-build.noindex/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.test_save_linux_mini_dump_dwarf/core.full.dmp'
Error output:
error: Failed to save core file for process: no ObjectFile plugins were able to save a core for this process
' did not return successfully
Config=x86_64-/home/talha/llvm-latest/build/bin/clang
======================================================================
FAIL: test_save_linux_mini_dump_dwo (TestProcessSaveCoreMinidump.ProcessSaveCoreMinidumpTestCase)
   Test that we can save a Linux mini dump.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/talha/llvm-latest/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1781, in test_method
    return attrvalue(self)
  File "/home/talha/llvm-latest/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 166, in wrapper
    return func(*args, **kwargs)
  File "/home/talha/llvm-latest/llvm-project/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py", line 94, in test_save_linux_mini_dump
    self.runCmd(
  File "/home/talha/llvm-latest/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2116, in runCmd
    self.assertTrue(self.res.Succeeded(), msg if (msg) else CMD_MSG(cmd))
AssertionError: False is not True : Command 'process save-core --plugin-name=minidump  --style=full '/home/talha/llvm-latest/build/lldb-test-build.noindex/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.test_save_linux_mini_dump_dwo/core.full.dmp'
Error output:
error: Failed to save core file for process: no ObjectFile plugins were able to save a core for this process
' did not return successfully
Config=x86_64-/home/talha/llvm-latest/build/bin/clang
----------------------------------------------------------------------
Ran 3 tests in 1.476s

RESULT: FAILED (0 passes, 2 failures, 0 errors, 1 skipped, 0 expected failures, 0 unexpected successes)

--

********************
********************
Failed Tests (1):
  lldb-api :: functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py


Testing Time: 1.79s

Total Discovered Tests: 1
  Failed: 1 (100.00%)

1 warning(s) in tests

```

We are unable to solve these issues. Not sure if we are missing some other dependencies to pass these tests (plus isn't there any file which mention these required dependencies? Would have been much more easier 🙂).
Also there are a lot of unsupported tests as well on our system. Is this an issue as well?

https://github.com/llvm/llvm-project/pull/69422


More information about the lldb-commits mailing list