Skip to content

Commit ca59812

Browse files
committed
[lldb-dap] Waiting for the test binary to exit prior to dumping logs.
This should ensure we have the full logs prior to dumping the logs. Additionally, printing log dumps to stderr so they are interspersed with assertion failures.
1 parent fbb8929 commit ca59812

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ def packet_type_is(packet, packet_type):
8888

8989

9090
def dump_dap_log(log_file):
91-
print("========= DEBUG ADAPTER PROTOCOL LOGS =========")
91+
print("========= DEBUG ADAPTER PROTOCOL LOGS =========", file=sys.stderr)
9292
if log_file is None:
93-
print("no log file available")
93+
print("no log file available", file=sys.stderr)
9494
else:
9595
with open(log_file, "r") as file:
96-
print(file.read())
97-
print("========= END =========")
96+
print(file.read(), file=sys.stderr)
97+
print("========= END =========", file=sys.stderr)
9898

9999

100100
def read_packet_thread(vs_comm, log_file):
@@ -107,6 +107,10 @@ def read_packet_thread(vs_comm, log_file):
107107
# termination of lldb-dap and stop waiting for new packets.
108108
done = not vs_comm.handle_recv_packet(packet)
109109
finally:
110+
# Wait for the process to fully exit before dumping the log file to
111+
# ensure we have the entire log contents.
112+
if vs_comm.process is not None:
113+
vs_comm.process.wait()
110114
dump_dap_log(log_file)
111115

112116

0 commit comments

Comments
 (0)