Skip to content

Commit 5341e26

Browse files
authored
[Dexter] Temporarily print DAP logs on specific exception (#157130)
Buildbot cross-project-tests-sie-ubuntu sees sporadic test failures due to missing "stackTrace" "source" "path". The "path" field is optional for "source" according to DAP, so it's well formed. It works most of the time, and doesn't consistently fail for any one test which is all strangely inconsistent. The failures couldn't be reproduced locally after running the feature_tests in a loop for 3 hours. I haven't been able to work out why the "source" is sometimes missing by just looking at LLDB code. This patch prints the DAP log to stderr when the specific error condition is hit, to help us understand why LLDB is sometimes getting into this state. Dump additional context from FileCheck so this can be seen on the bots (on a failure). This patch will be reverted once we've collected some logs.
1 parent e1acbc3 commit 5341e26

File tree

82 files changed

+94
-83
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+94
-83
lines changed

cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import abc
1111
from collections import defaultdict
1212
import copy
13+
import io
1314
import json
1415
import os
1516
import shlex
@@ -50,6 +51,7 @@ def __init__(self, context):
5051
self.prefix_recv: str = "<-"
5152
self.out_handle = None
5253
self.open = False
54+
self.text = io.StringIO() # In-process copy of the message log.
5355
self.lock = threading.Lock()
5456

5557
def _custom_enter(self):
@@ -91,6 +93,8 @@ def write_message(self, message: dict, incoming: bool):
9193
message_str = json.dumps(
9294
self._colorize_dap_message(message), indent=self.indent
9395
).replace("\\u001b", "\033")
96+
97+
self.text.write(f"{prefix} {message_str}\n")
9498
if self.out_handle is not None and self.open:
9599
with self.lock:
96100
self.out_handle.write(f"{prefix} {message_str}\n")

cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,16 @@ def _post_step_hook(self):
430430
trace_response = self._await_response(trace_req_id)
431431
if not trace_response["success"]:
432432
raise DebuggerException("failed to get stack frames")
433-
stackframes = trace_response["body"]["stackFrames"]
434-
path = stackframes[0]["source"]["path"]
435-
addr = stackframes[0]["instructionPointerReference"]
433+
try:
434+
stackframes = trace_response["body"]["stackFrames"]
435+
path = stackframes[0]["source"]["path"]
436+
addr = stackframes[0]["instructionPointerReference"]
437+
except KeyError as e:
438+
# Temporarily print the DAP log if this fails to aid debugging
439+
# a buildbot failure that doesn't reproduce easily.
440+
print(self.message_logger.text.getvalue(), file=sys.stderr)
441+
raise e
442+
436443
if any(
437444
self._debugger_state.bp_addr_map.get(self.dex_id_to_dap_id[dex_bp_id])
438445
== addr

cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/control/dex-continue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// UNSUPPORTED: system-windows
1010
//
1111
// RUN: %dexter_regression_test_cxx_build %s -o %t
12-
// RUN: %dexter_regression_test_run -v --binary %t -- %s 2>&1 | FileCheck %s
12+
// RUN: %dexter_regression_test_run -v --binary %t -- %s 2>&1 | FileCheck --dump-input-context=999999999 %s
1313

1414
int g = 0;
1515
int c(int) {

cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/control/dex_step_function.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// UNSUPPORTED: system-windows
66
//
77
// RUN: %dexter_regression_test_cxx_build %s -o %t
8-
// RUN: %dexter_regression_test_run -v --binary %t -- %s 2>&1 | FileCheck %s
8+
// RUN: %dexter_regression_test_run -v --binary %t -- %s 2>&1 | FileCheck --dump-input-context=999999999 %s
99

1010
int g = 0;
1111
int c(int) {

cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/penalty/dex_declare_file.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//
88
// RUN: %dexter_regression_test_cxx_build %s -o %t
9-
// RUN: not %dexter_regression_test_run --binary %t -- %s | FileCheck %s
9+
// RUN: not %dexter_regression_test_run --binary %t -- %s | FileCheck --dump-input-context=999999999 %s
1010
// CHECK: dex_declare_file.cpp
1111

1212
int main() {

cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/penalty/expect_program_state.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// UNSUPPORTED: system-darwin
66
//
77
// RUN: %dexter_regression_test_cxx_build %s -o %t
8-
// RUN: not %dexter_regression_test_run --binary %t -- %s | FileCheck %s
8+
// RUN: not %dexter_regression_test_run --binary %t -- %s | FileCheck --dump-input-context=999999999 %s
99
// CHECK: expect_program_state.cpp:
1010

1111
int GCD(int lhs, int rhs)

cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/penalty/expect_step_kinds.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// UNSUPPORTED: system-darwin
66
//
77
// RUN: %dexter_regression_test_cxx_build %s -o %t
8-
// RUN: not %dexter_regression_test_run --binary %t -- %s | FileCheck %s
8+
// RUN: not %dexter_regression_test_run --binary %t -- %s | FileCheck --dump-input-context=999999999 %s
99
// CHECK: expect_step_kinds.cpp:
1010

1111
int abs(int i){

cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/penalty/expect_step_order.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// UNSUPPORTED: system-darwin
66
//
77
// RUN: %dexter_regression_test_cxx_build %s -o %t
8-
// RUN: not %dexter_regression_test_run --binary %t -- %s | FileCheck %s
8+
// RUN: not %dexter_regression_test_run --binary %t -- %s | FileCheck --dump-input-context=999999999 %s
99
// CHECK: expect_step_order.cpp:
1010

1111
int main()

cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/penalty/expect_watch_type.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// expected behaviour.
1111
//
1212
// RUN: %dexter_regression_test_cxx_build %s -o %t
13-
// RUN: not %dexter_regression_test_run --binary %t -- %s | FileCheck %s
13+
// RUN: not %dexter_regression_test_run --binary %t -- %s | FileCheck --dump-input-context=999999999 %s
1414
// CHECK: expect_watch_type.cpp:
1515

1616
template<class T>

cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/penalty/expect_watch_value.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//
88
// RUN: %dexter_regression_test_cxx_build %s -o %t
9-
// RUN: not %dexter_regression_test_run --binary %t -- %s | FileCheck %s
9+
// RUN: not %dexter_regression_test_run --binary %t -- %s | FileCheck --dump-input-context=999999999 %s
1010
// CHECK: expect_watch_value.cpp:
1111

1212
int main()

0 commit comments

Comments
 (0)