[Lldb-commits] [PATCH] D76891: [lldb-vscode] fix breakpoint result ordering

walter erquinigo via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 26 15:47:31 PDT 2020


wallace created this revision.
wallace added reviewers: clayborg, aadsm, kusmour, labath.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The DAP specifies the following for the SetBreakpoints request:

  The breakpoints returned are in the same order as the elements of the 'breakpoints' arguments

This was not followed, as lldb-vscode was returning the breakpoints in a different order, because they were first stored into a map, and then traversed. Of course, maps normally don't preserve ordering.

See this log I captured:

  -->
  {"command":"setBreakpoints",
   "arguments":{
     "source":{
       "name":"main.cpp",
       "path":"/Users/wallace/fbsource/xplat/sand/test-projects/buck-cpp/main.cpp"
     },
     "lines":[6,10,11],
     "breakpoints":[{"line":6},{"line":10},{"line":11}],
     "sourceModified":false
   },
   "type":"request",
   "seq":3 
  }
  
  <-- 
  {"body":{
     "breakpoints":[
       {"id":1, "line":11,"source":{"name":"main.cpp","path":"xplat/sand/test-projects/buck-cpp/main.cpp"},"verified":true},
       {"id":2,"line":6,"source":{"name":"main.cpp","path":"xplat/sand/test-projects/buck-cpp/main.cpp"},"verified":true},
       {"id":3,"line":10,"source":{"name":"main.cpp","path":"xplat/sand/test-projects/buck-cpp/main.cpp"},"verified":true}]},
     "command":"setBreakpoints",
     "request_seq":3,
     "seq":0,
     "success":true,
     "type":"response"
  }

As you can see, the order was not respected. This was causing the IDE not to be able to disable/enable breakpoints by clicking on them in the breakpoint view in the lower corner of the Debug tab.

This diff fixes the ordering problem. The traversal + querying was done very fast in O(nlogn) time. I'm keeping the same complexity.

I also updated a couple of tests to account for the ordering.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76891

Files:
  lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.py
  lldb/tools/lldb-vscode/lldb-vscode.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76891.252999.patch
Type: text/x-patch
Size: 6783 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200326/e08b17fe/attachment-0001.bin>


More information about the lldb-commits mailing list