summaryrefslogtreecommitdiff
path: root/lldb/source/Core/IOHandlerCursesGUI.cpp
AgeCommit message (Collapse)Author
2021-08-23[LLDB][GUI] Handle extra navigation keys in formsOmar Emara
This patch handles the up and down keys if they weren't handled by the selected field. Moreover, it makes sure the form always absorb the key to take full control until the form is canceled or submitted. Differential Revision: https://reviews.llvm.org/D108414
2021-08-23[LLDB][GUI] Add submit form key combinationOmar Emara
This patch adds a new key ALt+Enter key combination to form windows. Once invoked, the first action is executed without having to navigate to its button. Field exit callbacks are now also invoked on validation to support this aforementioned key combination. One concern for this key combination is its potential use by the window manager of the host. I am not sure if this will be a problem, but it is worth putting in consideration. Differential Revision: https://reviews.llvm.org/D108410
2021-08-23[LLDB][GUI] Add extra keys to text fieldOmar Emara
This patch adds many new keys to the text field and implements new behaviors as follows: ``` case KEY_HOME: case KEY_CTRL_A: MoveCursorToStart(); case KEY_END: case KEY_CTRL_E: MoveCursorToEnd(); case KEY_RIGHT: case KEY_SF: MoveCursorRight(); case KEY_LEFT: case KEY_SR: MoveCursorLeft(); case KEY_BACKSPACE: case KEY_DELETE: RemovePreviousChar(); case KEY_DC: RemoveNextChar(); case KEY_EOL: case KEY_CTRL_K: ClearToEnd(); case KEY_DL: case KEY_CLEAR: Clear(); ``` This patch also refactors scrolling to be dynamic at draw time for easier handing. Differential Revision: https://reviews.llvm.org/D108385
2021-08-19[LLDB][GUI] Handle return key for compound fieldsOmar Emara
This patch handles the return key for compound fields like lists and mapping fields. The return key, if not handled by the field will select the next primary element, skipping secondary elements like remove buttons and the like. Differential Revision: https://reviews.llvm.org/D108331
2021-08-18[LLDB][GUI] Add Process Launch formOmar Emara
This patch adds a process launch form. Additionally, a LazyBoolean field was implemented and numerous utility methods were added to various fields to get the launch form working. Differential Revision: https://reviews.llvm.org/D107869
2021-08-18[LLDB][GUI] Fix text field incorrect key handlingOmar Emara
The isprint libc function was used to determine if the key code represents a printable character. The problem is that the specification leaves the behavior undefined if the key is not representable as an unsigned char, which is the case for many ncurses keys. This patch adds and explicit check for this undefined behavior and make it consistent. The llvm::isPrint function didn't work correctly for some reason, most likely because it takes a char instead of an int, which I guess makes it unsuitable for checking ncurses key codes. Reviewed By: clayborg Differential Revision: https://reviews.llvm.org/D108327
2021-08-17[LLDB][GUI] Add Breakpoints windowOmar Emara
This patch adds a breakpoints window that lists all breakpoints and breakpoints locations. The window is implemented as a tree, where the first level is the breakpoints and the second level is breakpoints locations. The tree delegate was hardcoded to only draw when there is a process, which is not necessary for breakpoints, so the relevant logic was abstracted in the TreeDelegateShouldDraw method. Reviewed By: clayborg Differential Revision: https://reviews.llvm.org/D107386
2021-08-17[LLDB][GUI] Refactor form drawing using subsurfacesOmar Emara
This patch adds a new method SubSurface to the Surface class. The method returns another surface that is a subset of this surface. This is important to further abstract away drawing from the ncurses objects. For instance, fields could previously be drawn on subpads only but can now be drawn on any surface. This is needed to create the file search dialogs and similar functionalities. There is an opportunity to refactor window drawing in general using surfaces, but we shall consider this separately later. Differential Revision: https://reviews.llvm.org/D107761
2021-08-05Revert "[LLDB][GUI] Refactor form drawing using subsurfaces"Jason Molenda
Temporarily revert this patch to unbreak the bots/builds until we can understand what was intended; is_pad() call isn't defined. This reverts commit 2b89f40a411cb9717232df61371b24d73ae84cb8.
2021-08-05[LLDB][GUI] Refactor form drawing using subsurfacesOmar Emara
This patch adds a new method SubSurface to the Surface class. The method returns another surface that is a subset of this surface. This is important to further abstract away drawing from the ncurses objects. For instance, fields could previously be drawn on subpads only but can now be drawn on any surface. This is needed to create the file search dialogs and similar functionalities. There is an opportunity to refactor window drawing in general using surfaces, but we shall consider this separately later. Reviewed By: clayborg Differential Revision: https://reviews.llvm.org/D107182
2021-08-02Revert "Revert "[LLDB][GUI] Expand selected thread tree item by default""Muhammad Omair Javaid
This reverts commit fd18f0e84cca023df6cb19e88c07c0e2059f659b. I reverted this change to see its effect on failing GUI tests on LLDB Arm/AArch64 Linux buildbots. I could not find any evidence against this particular change so reverting it back. Differential Revision: https://reviews.llvm.org/D100243
2021-07-30Revert "[LLDB][GUI] Expand selected thread tree item by default"Muhammad Omair Javaid
This reverts commit fed25ddc1c3de59aa1de27e95b349f86896ccb79. There has been sporadic failures in LLDB AArch64/Arm 32 buildbots since this commit. I am temporarily reverting it see if it fixes the issue. Differential Revision: https://reviews.llvm.org/D100243
2021-07-29[LLDB][GUI] Add Environment Variable FieldOmar Emara
This patch adds an environment variable field. This is usually used as the basic type of a List field. This is needed to create the process launch form. Reviewed By: clayborg Differential Revision: https://reviews.llvm.org/D106999
2021-07-29[LLDB][GUI] Add Create Target formOmar Emara
This patch adds a Create Target form for the LLDB GUI. Additionally, an Arch Field was introduced to input an arch and the file and directory fields now have a required property. Reviewed By: clayborg Differential Revision: https://reviews.llvm.org/D106192
2021-07-26[LLDB][GUI] Add Arch FieldOmar Emara
This patch adds an Arch field that inputs and validates an arch spec. Differential Revision: https://reviews.llvm.org/D106564
2021-07-26[LLDB][GUI] Expand selected thread tree item by defaultOmar Emara
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. Reviewed By: clayborg Differential Revision: https://reviews.llvm.org/D100243
2021-07-26[LLDB][GUI] Resolve paths in file/directory fieldsOmar Emara
This patch resolves the paths in the file/directory fields before performing checks. Those checks are applied on the file system if m_need_to_exist is true, so remote files can set this to false to avoid performing host-side file system checks. Additionally, methods to get a resolved and a direct file specs were added to be used by client code. Reviewed By: clayborg Differential Revision: https://reviews.llvm.org/D106553
2021-07-23[LLDB][GUI] Check fields validity in actionsOmar Emara
This patch adds a virtual method HasError to fields, it can be overridden by fields that have errors. Additionally, a form method CheckFieldsValidity was added to be called by actions that expects all the field to be valid. Differential Revision: https://reviews.llvm.org/D106459
2021-07-23[LLDB][GUI] Add Platform Plugin FieldOmar Emara
This patch adds a new Platform Plugin Field. It is a choices field that lists all the available platform plugins and can retrieve the name of the selected plugin. The default selected plugin is the currently selected one. This patch also allows for arbitrary scrolling to make scrolling easier when setting choices. Differential Revision: https://reviews.llvm.org/D106483
2021-07-21[LLDB][GUI] Add required property to text fieldsOmar Emara
This patch adds a required property to text fields and their derivatives. Additionally, the Process Name and PID fields in the attach form were marked as required. Differential Revision: https://reviews.llvm.org/D106458
2021-07-21[LLDB][GUI] Add Process Plugin FieldOmar Emara
This patch adds a new Process Plugin Field. It is a choices field that lists all the available process plugins and can retrieve the name of the selected plugin or an empty string if the default is selected. The Attach form now uses that field instead of manually creating a choices field. Reviewed By: clayborg Differential Revision: https://reviews.llvm.org/D106467
2021-07-15[LLDB][GUI] Add Process Attach formOmar Emara
This patch adds a form window to attach a process, either by PID or by name. This patch also adds support for dynamic field visibility such that the form delegate can hide or show certain fields based on some conditions. Reviewed By: clayborg Differential Revision: https://reviews.llvm.org/D105655
2021-07-13[lldb] Fix editline unicode on LinuxJan Kratochvil
Based on: [lldb-dev] proposed change to remove conditional WCHAR support in libedit wrapper https://lists.llvm.org/pipermail/lldb-dev/2021-July/016961.html There is already setlocale in lldb/source/Core/IOHandlerCursesGUI.cpp but that does not apply for Editline GUI editing. Unaware how to make automated test for this, it requires pty. Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D105779
2021-07-07[LLDB][GUI] Add initial forms supportOmar Emara
This patch adds initial support for forms for the LLDB GUI. The currently supported form elements are Text fields, Integer fields, Boolean fields, Choices fields, File fields, Directory fields, and List fields. A form can be created by subclassing FormDelegate. In the constructor, field factory methods can be used to add new fields, storing the returned pointer in a member variable. One or more actions can be added using the AddAction method. The method takes a function with an interface void(Window &). This function will be executed whenever the user executes the action. Example form definition: ```lang=cpp class TestFormDelegate : public FormDelegate { public: TestFormDelegate() { m_text_field = AddTextField("Text", "The big brown fox."); m_file_field = AddFileField("File", "/tmp/a"); m_directory_field = AddDirectoryField("Directory", "/tmp/"); m_integer_field = AddIntegerField("Number", 5); std::vector<std::string> choices; choices.push_back(std::string("Choice 1")); choices.push_back(std::string("Choice 2")); choices.push_back(std::string("Choice 3")); choices.push_back(std::string("Choice 4")); choices.push_back(std::string("Choice 5")); m_choices_field = AddChoicesField("Choices", 3, choices); m_bool_field = AddBooleanField("Boolean", true); TextFieldDelegate default_field = TextFieldDelegate("Text", "The big brown fox."); m_text_list_field = AddListField("Text List", default_field); AddAction("Submit", [this](Window &window) { Submit(window); }); } void Submit(Window &window) { SetError("An example error."); } protected: TextFieldDelegate *m_text_field; FileFieldDelegate *m_file_field; DirectoryFieldDelegate *m_directory_field; IntegerFieldDelegate *m_integer_field; BooleanFieldDelegate *m_bool_field; ChoicesFieldDelegate *m_choices_field; ListFieldDelegate<TextFieldDelegate> *m_text_list_field; }; ``` Reviewed By: clayborg Differential Revision: https://reviews.llvm.org/D104395
2021-06-16[lldb] vwprintw -> vw_printw in IOHandlerCursesGUIRaphael Isemann
`vwprintw` is (in theory) using the `arargs.h` va_list while `vw_printw` is using the `stdarg.h` va_list. It seems these days they can be used interchangeably but `vwprintw` is marked as deprecated.
2021-06-15Convert functions that were returning BreakpointOption * to BreakpointOption &.Jim Ingham
This is an NFC cleanup. Many of the API's that returned BreakpointOptions always returned valid ones. Internally the BreakpointLocations usually have null BreakpointOptions, since they use their owner's options until an option is set specifically on the location. So the original code used pointers & unique_ptr everywhere for consistency. But that made the code hard to reason about from the outside. This patch changes the code so that everywhere an API is guaranteed to return a non-null BreakpointOption, it returns it as a reference to make that clear. It also changes the Breakpoint to hold a BreakpointOption member where it previously had a UP. Since we were always filling the UP in the Breakpoint constructor, having the UP wasn't helping anything. Differential Revision: https://reviews.llvm.org/D104162
2021-06-09[lldb] Use C++11 default member initializersJonas Devlieghere
This converts a default constructor's member initializers into C++11 default member initializers. This patch was automatically generated with clang-tidy and the modernize-use-default-member-init check. $ run-clang-tidy.py -header-filter='lldb' -checks='-*,modernize-use-default-member-init' -fix This is a mass-refactoring patch and this commit will be added to .git-blame-ignore-revs. Differential revision: https://reviews.llvm.org/D103483
2021-05-26[lldb][NFC] Use C++ versions of the deprecated C standard library headersRaphael Isemann
The C headers are deprecated so as requested in D102845, this is replacing them all with their (not deprecated) C++ equivalent. Reviewed By: shafik Differential Revision: https://reviews.llvm.org/D103084
2021-04-16Target::ReadMemory read from read-only binary file Section, not memoryJason Molenda
Commiting this patch for Augusto Noronha who is getting set up still. This patch changes Target::ReadMemory so the default behavior when a read is in a Section that is read-only is to fetch the data from the local binary image, instead of reading it from memory. Update all callers to use their old preferences (the old prefer_file_cache bool) using the new API; we should revisit these calls and see if they really intend to read live memory, or if reading from a read-only Section would be equivalent and important for performance-sensitive cases. rdar://30634422 Differential revision: https://reviews.llvm.org/D100338
2021-03-09[lldb][gui] Fix uninitialized variable in SourceFileWindowDelegate.Jordan Rupprecht
After 5419b671375c46299ff1da6c929859040e7beaf5 (which is `[SimplifyCFG] Update FoldTwoEntryPHINode to handle and/or of select and binop equally`), this uninitialized value is detected by msan.
2021-02-24[lldb][NFC] Rename the second ValueObjectManager to ValueObjectUpdater and ↵Raphael Isemann
remove the dead code `ValueObject.h` contains the `ValueObject::ValueObjectManager` type which is just a typedef for the ClusterManager that takes care of the whole ValueObject memory management. However, there is also `ValueObjectManager` defined in the same header which is only used in the curses UI implementation and consists mostly of dead and completely untested code. This code been around since a while (it was added in 2016 as 8369b28da0750129ababae357bea98940800a0e0), so I think we shouldn't just revert the whole patch. Instead this patch just moves the class to its own header that it isn't just hiding in the ValueObject header and renames it to `ValueObjectUpdater` that it at least has a unique name (which I hope also slightly better reflects the purpose of this class). I also deleted all the dead code branches and functions. Reviewed By: #lldb, mib, JDevlieghere Differential Revision: https://reviews.llvm.org/D97287
2021-02-08Reland "[lldb] Make CommandInterpreter's execution context the same as ↵Tatyana Krasnukha
debugger's one"
2020-12-17Revert "[lldb] Make CommandInterpreter's execution context the same as ↵Pavel Labath
debugger's one." This reverts commit a01b26fb51c710a3a8ef88cc83b0701461f5b9ab, because it breaks the "finish" command in some way -- the command does not terminate after it steps out, but continues running the target. The exact blast radius is not clear, but it at least affects the usage of the "finish" command in TestGuiBasicDebug.py. The error is *not* gui-related, as the same issue can be reproduced by running the same steps outside of the gui. There is some kind of a race going on, as the test fails only 20% of the time on the buildbot.
2020-12-12[lldb] Make CommandInterpreter's execution context the same as debugger's one.Tatyana Krasnukha
Currently, the interpreter's context is not updated until a command is executed. This has resulted in the behavior of SB-interface functions and some commands depends on previous user actions. The interpreter's context can stay uninitialized, point to a currently selected target, or point to one of previously selected targets. This patch removes any usages of CommandInterpreter::UpdateExecutionContext. CommandInterpreter::HandleCommand* functions still may override context temporarily, but now they always restore it before exiting. CommandInterpreter saves overriden contexts to the stack, that makes nesting commands possible. Added test reproduces one of the issues. Without this fix, the last assertion fails because interpreter's execution context is empty until running "target list", so, the value of the global property was updated instead of process's local instance. Differential Revision: https://reviews.llvm.org/D92164
2020-09-02[lldb/Gui] zero-initialize children_stop_idJordan Rupprecht
This is currently causing msan warnings in the API tests when run under msan, e.g. `commands/gui/basic/TestGuiBasic.py`. Reviewed By: clayborg Differential Revision: https://reviews.llvm.org/D86825
2020-08-18[lldb][gui] use left/right in the source view to scrollLuboš Luňák
I intentionally decided not to reset the column automatically anywhere, because I don't know where and if at all that should happen. There should be always an indication of being scrolled (too much) to the right, so I'll leave this to whoever has an opinion. Differential Revision: https://reviews.llvm.org/D85290
2020-08-06Remove unused variable "saved_opts".Sterling Augustine
wattr_get is a macro, and the documentation states: "The parameter opts is reserved for future use, applications must supply a null pointer." In practice, passing a variable there is harmless, except that it is unused inside the macro, which causes unused variable warnings. The various places where
2020-08-06[lldb] Fix LLDB compilation with ncurses 6.2 due to wattr_set/get being a macroRaphael Isemann
My ncurses 6.2 arch defines those two functions as macros, so the scope operator doesn't work here.
2020-08-06[lldb][gui] use names for color pairs, instead of magic numbersLuboš Luňák
Differential Revision: https://reviews.llvm.org/D85286
2020-08-06[lldb][gui] use syntax highlighting also in gui modeLuboš Luňák
Use the same functionality as the non-gui mode, the colors just need translating to curses colors. Differential Revision: https://reviews.llvm.org/D85145
2020-08-06[lldb][gui] truncate long lines/names if neededLuboš Luňák
Without this, sources with long lines or variable names may overwrite panel frames, or even overrun to the following line. There's currently no way to scroll left/right in the views, so that should be added to handle these cases. This commit includes fixing constness of some Window functions, and also makes PutCStringTruncated() consistent with the added printf-like variant to take the padding as the first argument (can't add it after the format to the printf-like function). Differential Revision: https://reviews.llvm.org/D85123
2020-08-05[lldb][gui] implement breakpoint removal on breakpoint togglingLuboš Luňák
It says it toggles breakpoints, so if one already exists on the selected location, remove it instead of adding. Differential Revision: https://reviews.llvm.org/D85098
2020-08-05[lldb][gui] implement shift+tab for going back in viewsLuboš Luňák
Also simplify the code for going forward. Differential Revision: https://reviews.llvm.org/D85089
2020-08-05[lldb][gui] implement TerminalSizeChanged()Luboš Luňák
Differential Revision: https://reviews.llvm.org/D85088
2020-08-05[lldb] fix building with panel.h being in /usr/include/ncurses/Luboš Luňák
My openSUSE 15.2 has /usr/include/curses.h as a symlink to /usr/include/ncurses/curses.h , but there's no such symlink for panel.h . Prefer using /usr/include/ncurses for the includes if they are found there by the CMake check. Differential Revision: https://reviews.llvm.org/D85219
2020-08-04[lldb] fix typoLuboš Luňák
2020-07-31[lldb] force full gui redraw on Ctrl+LLuboš Luňák
As is common with curses apps, this allows to redraw everything in case something corrupts the screen. Apparently key modifiers are difficult with curses (curses FAQ it "doesn't do that"), thankfully Ctrl+key are simply control characters, so it's (ascii & 037) => 12. Differential Revision: https://reviews.llvm.org/D84972
2020-07-29[lldb] implement 'up' and 'down' shortcuts in lldb guiLuboš Luňák
Also add a unittest. Differential Revision: https://reviews.llvm.org/D68541
2020-07-29[lldb] change shortcut for 'step out' from 'o' to 'f'Luboš Luňák
This makes it consistent with gdb tui, where 'f' is 'finish'. See the discussion at https://reviews.llvm.org/D68541 . Differential Revision: https://reviews.llvm.org/D68909
2020-07-29[lldb] remove somewhat dangerous 'd'(etach) and 'k'(ill) shortcutsLuboš Luňák
'd' would be much better used for up/down shortcuts, and this also removes the possibility of ruining the whole debugging session by accidentally hitting 'd' or 'k'. Also change menu to have both 'detach and resume' and 'detach suspended' to make it clear which one is which. See discussion at https://reviews.llvm.org/D68541 . Differential Revision: https://reviews.llvm.org/D68908