[Lldb-commits] [PATCH] D68541: Implement 'up' and 'down' shortcuts in lldb gui

Luboš Luňák via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat Oct 5 12:24:11 PDT 2019


llunak created this revision.
llunak added a reviewer: clayborg.
llunak added a project: LLDB.
Herald added subscribers: lldb-commits, JDevlieghere, abidh.

The attached patch implements 'u' and 'd' keyboard shortcuts in lldb gui, similar to gdb tui's shortcuts.

One obvious problem is that 'd' is already taken. Would something like 'settings set gui.shortcut.<action> <key>' be an acceptable solution for that?


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D68541

Files:
  lldb/source/Core/IOHandler.cpp


Index: lldb/source/Core/IOHandler.cpp
===================================================================
--- lldb/source/Core/IOHandler.cpp
+++ lldb/source/Core/IOHandler.cpp
@@ -3771,6 +3771,8 @@
         {'o', "Step out"},
         {'s', "Step in (source line)"},
         {'S', "Step in (single instruction)"},
+        {'u', "Frame up"},
+        {'d', "Frame down"},
         {',', "Page up"},
         {'.', "Page down"},
         {'\0', nullptr}};
@@ -4395,6 +4397,26 @@
     }
       return eKeyHandled;
 
+    case 'u': // 'u' == frame up
+    case 'd': // 'd' == frame down
+    {
+      ExecutionContext exe_ctx =
+          m_debugger.GetCommandInterpreter().GetExecutionContext();
+      if (exe_ctx.HasThreadScope()) {
+        Thread* thread = exe_ctx.GetThreadPtr();
+        uint32_t frame_idx = thread->GetSelectedFrameIndex();
+        if (frame_idx == UINT32_MAX)
+          frame_idx = 0;
+        if( c == 'u' && frame_idx + 1 < thread->GetStackFrameCount())
+            ++frame_idx;
+        else if (c =='d' && frame_idx > 0)
+            --frame_idx;
+        if( thread->SetSelectedFrameByIndex( frame_idx, true ))
+          exe_ctx.SetFrameSP(thread->GetSelectedFrame());
+      }
+    }
+      return eKeyHandled;
+
     case 'h':
       window.CreateHelpSubwindow();
       return eKeyHandled;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68541.223380.patch
Type: text/x-patch
Size: 1326 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191005/741d0dc2/attachment.bin>


More information about the lldb-commits mailing list