summaryrefslogtreecommitdiffstats
path: root/lldb/tools/lldb-mi/MICmdCmdVar.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [LLDB] Remove lldb-miJonas Devlieghere2019-07-181-1460/+0
| | | | | | | | | | | | | | As discussed on the mailing list [1], this patch removes the lldb-mi tool and its tests from the LLDB repository. We moved lldb-mi into a separate repository on GitHub [2] for downstream users or maintainers to build and package. [1] http://lists.llvm.org/pipermail/lldb-dev/2019-July/015103.html [2] https://github.com/lldb-tools/lldb-mi Differential revision: https://reviews.llvm.org/D64255 llvm-svn: 366465
* [NFC] Remove ASCII lines from commentsJonas Devlieghere2019-04-101-81/+0
| | | | | | | | | | | | | | | | | | | | | | | A lot of comments in LLDB are surrounded by an ASCII line to delimit the begging and end of the comment. Its use is not really consistent across the code base, sometimes the lines are longer, sometimes they are shorter and sometimes they are omitted. Furthermore, it looks kind of weird with the 80 column limit, where the comment actually extends past the line, but not by much. Furthermore, when /// is used for Doxygen comments, it looks particularly odd. And when // is used, it incorrectly gives the impression that it's actually a Doxygen comment. I assume these lines were added to improve distinguishing between comments and code. However, given that todays editors and IDEs do a great job at highlighting comments, I think it's worth to drop this for the sake of consistency. The alternative is fixing all the inconsistencies, which would create a lot more churn. Differential revision: https://reviews.llvm.org/D60508 llvm-svn: 358135
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* lldb-mi: -var-update can hang when traversing complex types with pointersTed Woodward2017-08-311-7/+7
| | | | | | | | | | | | | | | | | | | Summary: -var-update calls CMICmdCmdVarUpdate::ExamineSBValueForChange to check if a varObj has been updated. It checks that the varObj is updated, then recurses on all of its children. If a child is a pointer pointing back to a parent node, this will result in an infinite loop, and lldb-mi hanging. The problem is exposed by packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py, but this test is skipped everywhere. This patch changes ExamineSBValueForChange to not traverse children of varObjs that are pointers. Reviewers: ki.stfu, zturner, clayborg, abidh Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D37154 llvm-svn: 312270
* Fix a small issue with -var-update.Hafiz Abid Qadeer2017-06-011-15/+13
| | | | | | | | | | If the variable was a pointer, code was ignoring the change in the pointee. Discussed in http://lists.llvm.org/pipermail/lldb-dev/2017-May/012435.html llvm-svn: 304400
* iwyu fixes on lldbUtility.Zachary Turner2017-04-061-0/+2
| | | | | | | | | | | | | This patch makes adjustments to header file includes in lldbUtility based on recommendations by the iwyu tool (include-what-you-use). The goal here is to make sure that all files include the exact set of headers which are needed for that file only, to eliminate cases of dead includes (e.g. someone deleted some code but forgot to delete the header includes that that code necessitated), and to eliminate the case where header includes are picked up transitively. llvm-svn: 299676
* Enable lldm-mi commands -stack-list-locals -stack-list-variables and ↵Ilia K2017-04-041-1/+1
| | | | | | | | | | | | | | | | -var-create to work only with variables in scope Patch by ayuckhulk Reviewers: abidh, lldb-commits, ki.stfu Reviewed By: ki.stfu Tags: #lldb Differential Revision: https://reviews.llvm.org/D31073 llvm-svn: 299417
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-061-931/+969
| | | | | | | | | | | | | | | | | | | | | | | *** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
* Add a DiagnosticManager replace error streams in the expression parser.Sean Callanan2016-03-191-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to do a better job presenting errors that occur when evaluating expressions. Key to this effort is getting away from a model where all errors are spat out onto a stream where the client has to take or leave all of them. To this end, this patch adds a new class, DiagnosticManager, which contains errors produced by the compiler or by LLDB as an expression is created. The DiagnosticManager can dump itself to a log as well as to a string. Clients will (in the future) be able to filter out the errors they're interested in by ID or present subsets of these errors to the user. This patch is not intended to change the *users* of errors - only to thread DiagnosticManagers to all the places where streams are used. I also attempt to standardize our use of errors a bit, removing trailing newlines and making clients omit 'error:', 'warning:' etc. and instead pass the Severity flag. The patch is testsuite-neutral, with modifications to one part of the MI tests because it relied on "error: error:" being erroneously printed. This patch fixes the MI variable handling and the testcase. <rdar://problem/22864976> llvm-svn: 263859
* Allow variable names to be quoted with -var-list-childrenChuck Ries2015-12-071-1/+1
| | | | | | | | Allow both '-var-list-children var0' and '-var-list-children "var0"' to be used with the -var-list-children command. GDB MI allows for this and it is necessary if the variable name contains spaces, such as var5.std::_Vector_base<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<cahr> > > >. Differential Revision: http://reviews.llvm.org/D15168 llvm-svn: 254941
* Better handle the arguments common to all MI commands.Hafiz Abid Qadeer2015-10-291-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | Summary: I observed that eclipse was passing --thread-group for many other commands then we are currently handling. Looking at the MI documentation, the following link states that each MI command accept the --thread and --frame option. Looking at the GDB implementation, it seems that apart from these 2, --thread-group is also handled the same way. https://sourceware.org/gdb/onlinedocs/gdb/Context-management.html#Context-management So instead of handling those arguments in every comamnds, I have moved them into the base class and removed them from elsewhere. Now any command can use these arguments. The patch seems big but most of the changes are mechanical. Reviewers: ki.stfu Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D14177 llvm-svn: 251636
* [lldb-mi] Fix expansion of anonymous structures and unionsDawn Perchik2015-10-241-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | A variable of type: struct S { union { int i1; unsigned u1; }; union { int i2; unsigned u2; }; }; had been impossible to evaluate in lldb-mi, because MI assigns '??' as the variable name to each of the unnamed unions after "-var-list-children" command. Also '??' incorrectly goes to 'exp' field which is treated by IDE as a structure field name and is displayed in watch window. The patch fixes this returning empty string as type name for unnamed union and assigning $N to variable name, where N is the field number in the parent entity. Patch from evgeny.leviant@gmail.com Reviewed by: clayborg, abidh Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13947 llvm-svn: 251176
* Allow to construct CMIUtilString using std::string directly + cleanup ↵Ilia K2015-09-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CMIUtilString (MI) Summary: Allow to construct CMIUtilString using std::string directly + cleanup CMIUtilString (MI) This patch cleans up lldb-mi code, and serves to simplify the following case: ``` std::string strGoodbye = "!Hello"; CMIUtilString strHello(strGoodbye.substr(1).c_str()); ``` With CMIUtilString(std::string) we can omit .c_str(): ``` std::string strGoodbye = "!Hello"; CMIUtilString strHello(strGoodbye.substr(1)); ``` Also, it removes 2 ctors because they aren't needed: # CMIUtilString::CMIUtilString(const char *const *vpData) # CMIUtilString::CMIUtilString(const char *vpData, size_t nLen) and cleans up CMIUtilString::operator=(const std::string &vrRhs). Reviewers: brucem, abidh Subscribers: lldb-commits, brucem, abidh Differential Revision: http://reviews.llvm.org/D13158 llvm-svn: 248566
* [lldb-mi] Clean up CMICmdArgSet usage.Bruce Mitchener2015-09-151-21/+21
| | | | | | | | | | | | | | | | | | | | | | | Summary: CMICmdArgSet stores a vector of non-const pointers to the arguments that it is validating. It owns them and is responsible for deleting them. We don't need to pass a const reference to the argument to CMICmdArgSet::Add and then take the address and const_cast it when we can just pass the argument pointer in directly. This lets us remove some noise at every call site for CMICmdArgSet::Add and then clean up a couple of bits inside CMICmdArgSet to remove const_casts. Reviewers: abidh, ki.stfu, domipheus Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D12878 llvm-svn: 247677
* [lldb-mi] Use empty arg lists instead of (void).Bruce Mitchener2015-08-041-54/+54
| | | | | | | | | | | | Summary: This brings the code more in line with the usual LLDB style. NFC. Reviewers: abidh, ki.stfu Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11746 llvm-svn: 243967
* [lldb-mi] Fix evaluation for children of created variable object.Dawn Perchik2015-07-311-2/+3
| | | | | | | | | | | | | | Move code in CMICmdCmdVarListChildren::Execute() up so that the child object will always be added when the MI command -var-list-children is entered (instead of only when the print-value was all or simple). This patch fixes evaluation of expressions like varobj.member for a created varobj with children. Reviewed by: abidh Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11659 llvm-svn: 243782
* Escape new line and tabs in the result of variable evaluation.Hafiz Abid Qadeer2015-07-311-1/+1
| | | | | | | | | Expression evaluation error messages may have embedded new lines and tabs. These should be escaped in the result string. Patch by paulmaybee. Reviewed in http://reviews.llvm.org/D11570. llvm-svn: 243741
* [lldb-mi] Remove unused bool results.Bruce Mitchener2015-07-221-60/+48
| | | | | | | | | | | | | | | Summary: Many methods, in particular various 'Add' methods didn't have any actual failure scenarios that were being emitted. This meant that a lot of surrounding code could be simplified. Reviewers: abidh, ki.stfu Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11412 llvm-svn: 242911
* Remove typedefs for MIchar, MIschar, MIuchar.Bruce Mitchener2015-07-031-2/+2
| | | | | | | | | | | | | | | | Summary: This is a start on bringing lldb-mi more in line with the typical LLDB coding style. This just removes the usage of the typedefs and doesn't yet clean up any logic or other issues. (This is to keep the review simple.) Reviewers: abidh, ki.stfu, domipheus Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10917 llvm-svn: 241349
* Fix parsing of print-values arg (MI)Ilia K2015-05-151-60/+9
| | | | | | | | | # Add CMICmdArgValPrintValues argument # Rework -stack-list-arguments/-stack-list-locals/-stack-list-variables/-var-update/-var-list-children commands to use the CMICmdArgValPrintValues argument instead of usage of pair of non-mandatory arguments like: CMICmdArgValNumber(0) || CMICmdArgValLongOptions("no-values") llvm-svn: 237429
* Show error message from failed evaluation when doing -var-createIlia K2015-05-121-1/+10
| | | | | | | | | | | | | | | | | Summary: When -var-create fails, we will now show the error message from the failed evaluation if it is available. Patch from chuckr@microsoft.com Test Plan: I fixed the MiVarTestCase.test_lldbmi_eval test to expect the new error string. All MI tests passing on OS X. Reviewers: abidh, ChuckR Subscribers: greggm, lldb-commits, paulmaybee Differential Revision: http://reviews.llvm.org/D9691 llvm-svn: 237094
* Fix -var-create for undefined variables (MI)Ilia K2015-05-081-1/+1
| | | | llvm-svn: 236825
* Fix -var-list-children command (MI)Ilia K2015-05-081-56/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch incldues the following: # Add from/to arguments in -var-list-children command (MI) ## Handle from and to args ## Don't print children=[] if numchild is 0 ## A bit refactoring ## Add MiVarTestCase.test_lldbmi_var_list_children test # Refactor -var-list-children (MI) ## Remove CMICmdCmdVarListChildren::VecMIValueResult_t ## Add CMICmdCmdVarListChildren::m_miValueList ## Remove CMICmdCmdVarListChildren::m_vecMiValueResult (use CMICmdCmdVarListChildren::m_miValueList instead) ## Print error message if value is invalid: ``` ^error,msg="variable invalid" ``` ## Refactor CMICmdCmdVarListChildren::Acknowledge and remove duplicated code ## Don't print children=[] if numchild is 0 ## Add error checking ## Use CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e for print-values ## Add few more empty-range test cases in MiVarTestCase.test_lldbmi_var_list_children #Improve MiVarTestCase.test_lldbmi_var_list_children test (MI) llvm-svn: 236820
* LLDB-MI: -var-list-children with no children doesn't need a children value ↵Bruce Mitchener2015-04-281-6/+1
| | | | | | | | | | | | | | | | | | | | | | | in the response. Summary: When using GDB with MI, if there aren't children for a variable, it doesn't include a "children" value in the response. LLDB does and sets it to "[]" while variables with children have an unquoted list: children=[...]. This removes the children value entirely when there are no children making this match GDB in behavior. Test Plan: Ran tests on Mac OS X and they passed. Reviewers: abidh, domipheus Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9320 llvm-svn: 235974
* MI support for '-var-create $regname' command.Ilia K2015-04-171-6/+16
| | | | | | | | | | | | | | | | | | Summary: This command is currently processed using expression evaluation, meaning the variable binds to the result of the expression not the register. Therefore any subsequent calls to '-var-assign' will not update the register. Fixed by detecting '$' prefix for registers according to specification. Thanks, Ewan Patch from ewan@codeplay.com Reviewers: EwanCrawford Subscribers: lldb-commits, deepak2427 Differential Revision: http://reviews.llvm.org/D8965 llvm-svn: 235195
* Remove redundant comments from lldb-mi source files.Hafiz Abid Qadeer2015-03-161-10/+0
| | | | | | | Most of lldb-mi files have comments about environement, copyright etc which were neither needed nor uptodate. This commit removes those comments. llvm-svn: 232396
* Fix -var-create and -var-update (MI)Ilia K2015-03-061-164/+84
| | | | | | | | | | | | | | | | | | | | | Summary: This patch includes: * Fix -var-create command for global/static variables * Fix -var-update command: remove m_strValueName/m_eVarInfoFormat/m_bValueChanged{Array,Composite,Normal}Type; clean CMICmdCmdVarUpdate::Execute and CMICmdCmdVarUpdate::Acknowledge; improve CMICmdCmdVarUpdate::MIFormResponse; Complete the value after -var-create using the CMICmdCmdVarCreate::CompleteSBValue to get SBValue::GetValueDidChange work. * Add non-constant version of CMICmnLLDBDebugSessionInfoVarObj::GetValue * Add MiVarTestCase.test_lldbmi_var_update test All tests pass on OS X. Reviewers: abidh, emaste, clayborg Reviewed By: clayborg Subscribers: lldb-commits, emaste, clayborg, abidh Differential Revision: http://reviews.llvm.org/D8110 llvm-svn: 231525
* Added long 'print-values' option for var-update MI command.Ilia K2015-03-041-11/+40
| | | | | | | | | | | | | | | | | | | Summary: The -var-update MI command should take the same print-values options as var-list children, however currently only the integer versions are supported. Added --no-values, --all-values, and --simple-values long options. See: https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Variable-Objects.html#GDB_002fMI-Variable-Objects Patch from ewan@codeplay.com Reviewers: EwanCrawford Subscribers: ki.stfu, lldb-commits Differential Revision: http://reviews.llvm.org/D8008 llvm-svn: 231233
* Fix evaluation commands (MI)Ilia K2015-02-061-17/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: These changes include: * Fix -var-create to be able use current frame '*' (MI) * Fix print-values option in -var-update (MI) * Fix 'variable doesn't exist' error in -var-show-attributes (MI) * Mark print-values option as 'handled-by-cmd' in -var-update (MI) * Fix SBValue::GetValueDidChange if value was changed * Fix lldb-mi: -data-evaluate-expression shows undef vars. Before this fix -data-evaluate-expression perceives undefined variables as strings: ``` (gdb) -data-evaluate-expression undef ^done,value="undef" ``` * Minor fix: -data-evaluate-expression uses IsUnknownValue() * Enable MiEvaluateTestCase test All test pass on OS X. Reviewers: abidh, clayborg Subscribers: lldb-commits, clayborg, abidh Differential Revision: http://reviews.llvm.org/D7463 llvm-svn: 228414
* Add missing options in -var-list-children command.Hafiz Abid Qadeer2015-02-051-10/+43
| | | | | | | | | | | | | The options are checked in the following order. print-values no-values all-values simple-values See the following link for the details of these arguments. https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Variable-Objects.html llvm-svn: 228296
* Fix CLI commands in lldb-mi.Hafiz Abid Qadeer2015-02-031-4/+4
| | | | | | | | | | | | | | This patch fixes execution of CLI commands in MI mode. The CLI commands are executed using "-interpreter-exec" command. The bug was in the CMICmnLLDBDebugSessionInfo class which contained the following members: SBProcess, SBTarget, SBDebugger and SBListener, but CLI commands don't affect them and they aren't updated. Therefore some members can contain incorrect (or obsolete) reference and it can cause an error. My patch removes these members and uses getters that provides the updated instance every time it is used. Patch from Ilia K ki.stfu@gmail.com. Approved by Greg. llvm-svn: 227958
* Make --thread argument optional for various commands.Hafiz Abid Qadeer2015-02-021-3/+3
| | | | | | | | Currently it was marked as mandatory for many commands. Although it is recommended that fronends generate this argument, it is not mandatory. GDB seems to treat it as optional too. llvm-svn: 227798
* Added an Xcode target so we build the "lldb-mi" executable as part of the ↵Greg Clayton2015-01-201-2/+2
| | | | | | | | | | "desktop" and "desktop no xpc" targets. Include paths were switched to be user include paths, if this breaks the linux build we will need to fix the Makefiles/cmake stuff. <rdar://problem/19198581> llvm-svn: 226530
* Reformat lldb-mi using clang-format.Zachary Turner2014-11-171-1141/+1188
| | | | | | Courtesy of dawn@burble.org. llvm-svn: 222150
* Remove unused class variable and its initialization.Eric Christopher2014-09-091-1/+0
| | | | llvm-svn: 217425
* Add new MI commands, features and fixes to the lldb-mi driver.Deepak Panickal2014-08-081-91/+20
| | | | | | | | | | - Can now load an executable directly as an argument. - Fixes towards supporting local debugging. - Fixes for stack-list-arguments, data-evaluate-expression, environment-cd, stack-list-locals, interpreter-exec. - Fix breakpoint event handling. - Support dynamic loading of libraries using the search paths provided by Eclipse. llvm-svn: 215223
* Added support for new MI commands and bug fixes. More details in MIReadme.txt.Deepak Panickal2014-06-241-85/+404
| | | | llvm-svn: 211607
* Initial commit of LLDB Machine Interface Frontend.Deepak Panickal2014-05-161-0/+1244
- Tested with Eclipse, likely to work with other GDB/MI compatible GUIs. - Some but not all MI commands have been implemented. See MIReadme.txt for more info. - Written from scratch, no GPL code, based on LLDB Public API. - Built for Linux, Windows and OSX. Tested on Linux and Windows. - GDB/MI Command Reference, https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI.html llvm-svn: 208972
OpenPOWER on IntegriCloud