This patch expands the tree item that corresponds to the selected thread
by default in the Threads window. Additionally, the tree root item is
always expanded, which is the process in the Threads window.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I have been meaning to get to this for a while, thanks for taking this on! It would be great if we can actually select the selected stack frame as well when this the process view is initialized. Same kind of code as with the selected thread. See inline comments.
lldb/source/Core/IOHandlerCursesGUI.cpp | ||
---|---|---|
3382–3384 | Remove parens for single statement if due to LLVM coding guidelines. | |
3971–3973 | Remove parens for single statement if due to LLVM coding guidelines. |
Including the inlined comments for showing and selecting the selected frame.
lldb/source/Core/IOHandlerCursesGUI.cpp | ||
---|---|---|
3971–3973 | It would be great if we can also select the currently selected stack frame here. Something like: if (selected_thread && selected_thread->GetID() == thread->GetID()) { item[i].Expand(); StackFrameSP selected_frame = thread->GetSelectedFrame(); if (selected_frame) { // Add all frames and select the right one... } } |
lldb/source/Core/IOHandlerCursesGUI.cpp | ||
---|---|---|
3971–3973 | @clayborg I didn't implement selection in this patch because my implementation didn't look great and I thought selection could be refactored to to make handling easier. I haven't looked at this in more details yet, but I was thinking that maybe instead of having linear selection, we would have it hierarchical. |
lldb/source/Core/IOHandlerCursesGUI.cpp | ||
---|---|---|
3973 | yeah, we need one frame item to be selected at all times so it indicates the current thread/frame that is selected within LLDB. So a great solution would be to expand the selected thread and show all frames within the selected thread. Add code to select the current frame after as we can re-use this code as we step along in our program. If we add a command line window that allows LLDB commands, if the user types "frame select 12", the view should update to indicate which frame is selected. Also if the user types "thread select 5", the view should update accordingly. |
lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py | ||
---|---|---|
39 | create a method self.exit_gui to dedup some code, as you'll end up doing a lot of them as you write your tests def exit_gui(self): self.child.send(chr(27).encode()) self.expect_prompt() you can also create a method start_gui def start_gui(self): self.child.sendline("gui") self.child.send(chr(27).encode()) you could also later create a base class lldbgui_testcase similar to lldbvscode_testcase, where you can put all needed common code |
lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py | ||
---|---|---|
39 | Okay. I will do for all tests in a separate patch. |
Many minor things, but looking good! I look forward to seeing this get checked in
lldb/source/Core/IOHandlerCursesGUI.cpp | ||
---|---|---|
3364–3365 | Don't make this pure virtual unless all subclasses must implement this. I see a few implementations below that do nothing, so just make a default implementation so classes that don't need this don't have to implement it. Also renamed to TreeDelegateUpdateSelection to stay consistent with the other delegate methods. | |
3382–3383 | We might want to opt into this? We don't want all variables in a variable view to be expanded by default. But we do want the process tree to always expand, so we need to be able to opt in in the tree delegates. | |
3612–3613 | I assume we want this method to update both m_selected_row_idx and m_selected_item right? If so, make sure we switch to references on line 1611 above so both do get updated. | |
3797–3801 | Remove and make a default implementation in the base class and don't make it pure virtual | |
3883–3887 | Remove and make a default implementation in the base class and don't make it pure virtual | |
3942–3943 | See comment below where you used to set m_need_to_set_default_selection to false. | |
4000 | This just sets the local variable "selected_item" to a value. Make sure we switch to using references on 1611 as mentioned before. | |
4002 | You can remove this and just always set this in the TreeDelegateGenerateChildren | |
4015 | Maybe renamed to m_update_selection so this variable is a bit shorter? |
This change has caused various GUI related tests to fail randomly.
https://lab.llvm.org/buildbot/#/builders/96/builds/10100
This also causes random failures of one of the most resource sufficient buildbot here:
https://lab.llvm.org/buildbot/#/builders/68/builds/16275
https://lab.llvm.org/buildbot/#/builders/68/builds/16300
@teemperor
Referring to your comment on skipping TestGuiBasicDebug.py this may have caused it.
I suspect this change as culprit behind failure of various GUI tests randomly on various LLDB buildbots. I have reverted this change to see if its the real culprit.
Don't make this pure virtual unless all subclasses must implement this. I see a few implementations below that do nothing, so just make a default implementation so classes that don't need this don't have to implement it. Also renamed to TreeDelegateUpdateSelection to stay consistent with the other delegate methods.