Page MenuHomePhabricator

Redo of Add terminateCommands to lldb-vscode protocol
ClosedPublic

Authored by wallace on Jun 16 2020, 4:02 PM.

Details

Summary

This redoes https://reviews.llvm.org/D79726 and fixes two things.

  • The logic that determines whether to automatically disconnect during the tear down is not very dumb compared to the original implementation. Each test will determine whether to do that or not.
  • The terminate commands and terminate event were being sent after the disconnect response was sent to the IDE. That was not good, as VSCode stops the debug session as soon as it receives a disconnect response. Now, the terminate event and terminateEvents are being executed before the disconnect response is sent. This ensures that any connection between the IDE and lldb-vscode is alive while the terminate commands are executed. Besides, it also allows displaying the output of the terminate commands on the debug console, as it's still alive.

Diff Detail

Event Timeline

wallace created this revision.Jun 16 2020, 4:02 PM
aadsm accepted this revision.Jun 16 2020, 6:37 PM

Thank you for this! <3

This revision is now accepted and ready to land.Jun 16 2020, 6:37 PM
clayborg added inline comments.Jun 17 2020, 3:29 PM
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
223–224

revert whitespace only change?

wallace updated this revision to Diff 271541.Jun 17 2020, 5:59 PM

remove unwanted changes

This revision was automatically updated to reflect the committed changes.
fhahn added a subscriber: fhahn.Jun 24 2020, 6:06 AM

I noticed that it appears that lldb-api :: tools/lldb-vscode/attach/TestVSCode_attach.py is flaky and I noticed it failing spuriously relatively frequently

For example http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/5519 failed with

FAIL: lldb-api :: tools/lldb-vscode/attach/TestVSCode_attach.py (825 of 2068)
******************** TEST 'lldb-api :: tools/lldb-vscode/attach/TestVSCode_attach.py' FAILED ********************
Script:
--
/usr/bin/python3.6 /home/tcwg-buildslave/worker/lldb-cmake-aarch64/llvm-project/lldb/test/API/dotest.py --arch aarch64 -s /home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/lldb-test-traces -S nm -u CXXFLAGS -u CFLAGS --env ARCHIVER=/usr/bin/ar --env OBJCOPY=/usr/bin/objcopy --env LLVM_LIBS_DIR=/home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/./lib --build-dir /home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/./bin/lldb --compiler /home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/./bin/clang --dsymutil /home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/./bin/dsymutil --filecheck /home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/./bin/FileCheck --lldb-libs-dir /home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/./lib /home/tcwg-buildslave/worker/lldb-cmake-aarch64/llvm-project/lldb/test/API/tools/lldb-vscode/attach -p TestVSCode_attach.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 11.0.0
  clang revision 72131423cc952ccbd6d8e021ff7c04fa22297fe3
  llvm revision 72131423cc952ccbd6d8e021ff7c04fa22297fe3
LLDB library dir: /home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/bin
LLDB import library dir: /home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/./lib
Libc++ tests will not be run because: Compiling with -stdlib=libc++ fails with the error: <stdin>:1:10: fatal error: 'algorithm' file not found
#include <algorithm>
         ^~~~~~~~~~~
1 error generated.

Skipping following debug info categories: ['dsym', 'gmodules']
description: breakpoint 1.1
description: breakpoint 1.1

--
Command Output (stderr):
--

Session logs for test failures/errors/unexpected successes will go into directory '/home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/lldb-test-traces'
PASS: LLDB (/home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/bin/clang-11-aarch64) :: test_by_name (TestVSCode_attach.TestVSCode_attach)
UNSUPPORTED: LLDB (/home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/bin/clang-11-aarch64) :: test_by_name_waitFor (TestVSCode_attach.TestVSCode_attach) (requires one of darwin, macosx, ios, watchos, tvos, bridgeos) 
PASS: LLDB (/home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/bin/clang-11-aarch64) :: test_by_pid (TestVSCode_attach.TestVSCode_attach)
FAIL: LLDB (/home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/bin/clang-11-aarch64) :: test_commands (TestVSCode_attach.TestVSCode_attach)
CLEANUP ERROR: LLDB (/home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/bin/clang-11-aarch64) :: test_commands (TestVSCode_attach.TestVSCode_attach)
PASS: LLDB (/home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/bin/clang-11-aarch64) :: test_terminate_commands (TestVSCode_attach.TestVSCode_attach)
======================================================================
FAIL: test_commands (TestVSCode_attach.TestVSCode_attach)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tcwg-buildslave/worker/lldb-cmake-aarch64/llvm-project/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py", line 174, in test_commands
    self.continue_to_breakpoints(breakpoint_ids)
  File "/home/tcwg-buildslave/worker/lldb-cmake-aarch64/llvm-project/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py", line 226, in continue_to_breakpoints
    self.verify_breakpoint_hit(breakpoint_ids)
  File "/home/tcwg-buildslave/worker/lldb-cmake-aarch64/llvm-project/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py", line 85, in verify_breakpoint_hit
    self.assertTrue(False, "breakpoint not hit")
AssertionError: False is not True : breakpoint not hit
Config=aarch64-/home/tcwg-buildslave/worker/lldb-cmake-aarch64/build/bin/clang-11
----------------------------------------------------------------------
Ran 5 tests in 27.063s

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

--

Not sure if the failure is related to this patch, but it appears to be the most recent change.