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;
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;
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits