================
@@ -29,53 +44,78 @@ ExceptionInfoRequestHandler::Run(const 
ExceptionInfoArguments &args) const {
     return llvm::make_error<DAPError>(
         llvm::formatv("Invalid thread id: {}", args.threadId).str());
 
-  ExceptionInfoResponseBody response;
-  response.breakMode = eExceptionBreakModeAlways;
+  ExceptionInfoResponseBody body;
+  body.breakMode = eExceptionBreakModeAlways;
   const lldb::StopReason stop_reason = thread.GetStopReason();
   switch (stop_reason) {
+  case lldb::eStopReasonInstrumentation:
+    body.exceptionId = "runtime-instrumentation";
+    break;
   case lldb::eStopReasonSignal:
-    response.exceptionId = "signal";
+    body.exceptionId = "signal";
     break;
   case lldb::eStopReasonBreakpoint: {
     const ExceptionBreakpoint *exc_bp =
         dap.GetExceptionBPFromStopReason(thread);
     if (exc_bp) {
-      response.exceptionId = exc_bp->GetFilter();
-      response.description = exc_bp->GetLabel();
+      body.exceptionId = exc_bp->GetFilter();
+      body.description = exc_bp->GetLabel().str() + "\n";
     } else {
-      response.exceptionId = "exception";
+      body.exceptionId = "exception";
     }
   } break;
   default:
-    response.exceptionId = "exception";
+    body.exceptionId = "exception";
   }
 
   lldb::SBStream stream;
-  if (response.description.empty()) {
-    if (thread.GetStopDescription(stream)) {
-      response.description = {stream.GetData(), stream.GetSize()};
-    }
-  }
+  if (thread.GetStopDescription(stream))
+    body.description += {stream.GetData(), stream.GetSize()};
 
   if (lldb::SBValue exception = thread.GetCurrentException()) {
+    body.details = ExceptionDetails{};
+    if (const char *name = exception.GetName())
+      body.details->evaluateName = name;
+    if (const char *typeName = exception.GetDisplayTypeName())
+      body.details->typeName = typeName;
+
     stream.Clear();
-    response.details = ExceptionDetails{};
-    if (exception.GetDescription(stream)) {
-      response.details->message = {stream.GetData(), stream.GetSize()};
-    }
+    if (exception.GetDescription(stream))
+      body.details->message = {stream.GetData(), stream.GetSize()};
 
     if (lldb::SBThread exception_backtrace =
-            thread.GetCurrentExceptionBacktrace()) {
-      stream.Clear();
-      exception_backtrace.GetDescription(stream);
+            thread.GetCurrentExceptionBacktrace())
+      body.details->stackTrace = ThreadSummary(exception_backtrace);
+  }
 
-      for (uint32_t idx = 0; idx < exception_backtrace.GetNumFrames(); idx++) {
-        lldb::SBFrame frame = exception_backtrace.GetFrameAtIndex(idx);
-        frame.GetDescription(stream);
-      }
-      response.details->stackTrace = {stream.GetData(), stream.GetSize()};
+  lldb::SBStructuredData crash_info =
+      dap.target.GetProcess().GetExtendedCrashInformation();
+  stream.Clear();
+  if (crash_info.IsValid() && crash_info.GetDescription(stream))
+    body.description += "\n\nExtended Crash Information:\n" +
+                        std::string(stream.GetData(), stream.GetSize());
+
+  for (uint32_t idx = 0; idx < lldb::eNumInstrumentationRuntimeTypes; idx++) {
+    lldb::InstrumentationRuntimeType type =
+        static_cast<lldb::InstrumentationRuntimeType>(idx);
+    if (!dap.target.GetProcess().IsInstrumentationRuntimePresent(type))
+      continue;
----------------
DrSergei wrote:

nit: we can make separate variable from `dat.target.GetProcess`

https://github.com/llvm/llvm-project/pull/176465
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to