================
@@ -83,160 +173,63 @@ static bool FillStackFrames(DAP &dap, lldb::SBThread 
&thread,
 
       reached_end_of_stack = FillStackFrames(
           dap, backtrace, frame_format, stack_frames, offset,
-          (start_frame - offset) > 0 ? start_frame - offset : -1, levels,
+          start_frame > offset ? start_frame - offset : UINT32_MAX, levels,
           include_all);
-      if (static_cast<int64_t>(stack_frames.size()) >= levels)
+      if (stack_frames.size() >= levels)
         break;
     }
   }
 
   return reached_end_of_stack;
 }
 
-// "StackTraceRequest": {
-//   "allOf": [ { "$ref": "#/definitions/Request" }, {
-//     "type": "object",
-//     "description": "StackTrace request; value of command field is
-//     'stackTrace'. The request returns a stacktrace from the current 
execution
-//     state.", "properties": {
-//       "command": {
-//         "type": "string",
-//         "enum": [ "stackTrace" ]
-//       },
-//       "arguments": {
-//         "$ref": "#/definitions/StackTraceArguments"
-//       }
-//     },
-//     "required": [ "command", "arguments"  ]
-//   }]
-// },
-// "StackTraceArguments": {
-//   "type": "object",
-//   "description": "Arguments for 'stackTrace' request.",
-//   "properties": {
-//     "threadId": {
-//       "type": "integer",
-//       "description": "Retrieve the stacktrace for this thread."
-//     },
-//     "startFrame": {
-//       "type": "integer",
-//       "description": "The index of the first frame to return; if omitted
-//       frames start at 0."
-//     },
-//     "levels": {
-//       "type": "integer",
-//       "description": "The maximum number of frames to return. If levels is
-//       not specified or 0, all frames are returned."
-//     },
-//     "format": {
-//       "$ref": "#/definitions/StackFrameFormat",
-//       "description": "Specifies details on how to format the stack frames.
-//       The attribute is only honored by a debug adapter if the corresponding
-//       capability `supportsValueFormattingOptions` is true."
-//     }
-//  },
-//   "required": [ "threadId" ]
-// },
-// "StackTraceResponse": {
-//   "allOf": [ { "$ref": "#/definitions/Response" }, {
-//     "type": "object",
-//     "description": "Response to `stackTrace` request.",
-//     "properties": {
-//       "body": {
-//         "type": "object",
-//         "properties": {
-//           "stackFrames": {
-//             "type": "array",
-//             "items": {
-//               "$ref": "#/definitions/StackFrame"
-//             },
-//             "description": "The frames of the stackframe. If the array has
-//             length zero, there are no stackframes available. This means that
-//             there is no location information available."
-//           },
-//           "totalFrames": {
-//             "type": "integer",
-//             "description": "The total number of frames available in the
-//             stack. If omitted or if `totalFrames` is larger than the
-//             available frames, a client is expected to request frames until
-//             a request returns less frames than requested (which indicates
-//             the end of the stack). Returning monotonically increasing
-//             `totalFrames` values for subsequent requests can be used to
-//             enforce paging in the client."
-//           }
-//         },
-//         "required": [ "stackFrames" ]
-//       }
-//     },
-//     "required": [ "body" ]
-//   }]
-// }
-void StackTraceRequestHandler::operator()(
-    const llvm::json::Object &request) const {
-  llvm::json::Object response;
-  FillResponse(request, response);
-  lldb::SBError error;
-  const auto *arguments = request.getObject("arguments");
-  lldb::SBThread thread = dap.GetLLDBThread(*arguments);
-  llvm::json::Array stack_frames;
-  llvm::json::Object body;
+llvm::Expected<protocol::StackTraceResponseBody>
+StackTraceRequestHandler::Run(const protocol::StackTraceArguments &args) const 
{
+  lldb::SBThread thread = dap.GetLLDBThread(args.threadId);
----------------
da-viper wrote:

can we return an error if we do not have a valid thread ?

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

Reply via email to