return
self.assertTrue(False, "breakpoint not hit")
- def verify_exception_breakpoint_hit(self, filter_label):
+ def verify_stop_exception_info(self, expected_description):
'''Wait for the process we are debugging to stop, and verify the stop
reason is 'exception' and that the description matches
- 'filter_label'
+ 'expected_description'
'''
stopped_events = self.vscode.wait_for_stopped()
for stopped_event in stopped_events:
if 'description' not in body:
continue
description = body['description']
- if filter_label == description:
+ if expected_description == description:
return True
return False
def continue_to_exception_breakpoint(self, filter_label):
self.vscode.request_continue()
- self.assertTrue(self.verify_exception_breakpoint_hit(filter_label),
+ self.assertTrue(self.verify_stop_exception_info(filter_label),
'verify we got "%s"' % (filter_label))
def continue_to_exit(self, exitCode=0):
--- /dev/null
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
--- /dev/null
+"""
+Test exception behavior in VSCode
+"""
+
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+import lldbvscode_testcase
+
+
+class TestVSCode_exception(lldbvscode_testcase.VSCodeTestCaseBase):
+
+ @skipIfWindows
+ def test_stopped_description(self):
+ '''
+ Test that exception description is shown correctly in stopped
+ event.
+ '''
+ program = self.getBuildArtifact("a.out")
+ print("test_stopped_description called", flush=True)
+ self.build_and_launch(program)
+
+ self.vscode.request_continue()
+ self.assertTrue(self.verify_stop_exception_info("signal SIGABRT"))
--- /dev/null
+#include <signal.h>
+
+int main() {
+ raise(SIGABRT);
+ return 0;
+}
// If no description has been set, then set it to the default thread stopped
// description. If we have breakpoints that get hit and shouldn't be reported
// as breakpoints, then they will set the description above.
- if (ObjectContainsKey(body, "description")) {
+ if (!ObjectContainsKey(body, "description")) {
char description[1024];
if (thread.GetStopDescription(description, sizeof(description))) {
EmplaceSafeString(body, "description", std::string(description));