================
@@ -50,13 +141,12 @@ static constexpr int StackPageSize = 20;
 // s=3,l=3 = [th0->s3, label1, th1->s0]
 static bool FillStackFrames(DAP &dap, lldb::SBThread &thread,
                             lldb::SBFormat &frame_format,
-                            llvm::json::Array &stack_frames, int64_t &offset,
-                            const int64_t start_frame, const int64_t levels,
-                            const bool include_all) {
+                            std::vector<StackFrame> &stack_frames,
+                            uint32_t &offset, const uint32_t start_frame,
+                            const uint32_t levels, const bool include_all) {
   bool reached_end_of_stack = false;
-  for (int64_t i = start_frame;
-       static_cast<int64_t>(stack_frames.size()) < levels; i++) {
-    if (i == -1) {
+  for (uint32_t i = start_frame; stack_frames.size() < levels; i++) {
+    if (i == UINT32_MAX) {
----------------
da-viper wrote:

Yes, it can. I prefer using the UINT32_MAX as overflow is defined behaviour. 

something like 

```cpp
// start_frame is no longer const.
  if (start_frame == UINT32_MAX) {
    stack_frames.emplace_back(
        CreateExtendedStackFrameLabel(thread, frame_format));
    start_frame = 0;
  }
  
  for (uint32_t i = start_frame; stack_frames.size() < levels; i++) {
     ...
  ```
  it would better to refactor how we fill the frames to make it clear what is 
happening but should be in a different PR.
  
  

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