Commit Graph

29 Commits

Author SHA1 Message Date
Kate Stone b9c1b51e45 *** This commit represents a complete reformatting of the LLDB source code
*** 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
2016-09-06 20:57:50 +00:00
Zachary Turner 190fadcdb2 Unicode support on Win32.
Win32 API calls that are Unicode aware require wide character
strings, but LLDB uses UTF8 everywhere.  This patch does conversions
wherever necessary when passing strings into and out of Win32 API
calls.

Patch by Cameron
Differential Revision: http://reviews.llvm.org/D17107
Reviewed By: zturner, amccarth

llvm-svn: 264074
2016-03-22 17:58:09 +00:00
Eugene Leviant ec4d04e507 Fix crash in lldb-mi when stack variable name is nullptr. This always happens when execution stops in try scope with unnamed catch clause
llvm-svn: 259189
2016-01-29 12:17:09 +00:00
Bruce Mitchener 3be88564e9 [lldb-mi] Simplify CMICmnLLDBDebugSessionInfo::Shutdown.
Summary:
* SharedDataDestroy couldn't fail, so no need to return a status.
* No need for status, so can remove error message. The error message
  wasn't displayed or used anywhere anyway.

Reviewers: abidh, ki.stfu

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D12879

llvm-svn: 247673
2015-09-15 10:36:08 +00:00
Bruce Mitchener 13ce0fd140 [lldb-mi] No need to call Format with no varargs.
Summary:
There's no need to call CMIUtilString::Format
with a string and no args.

Reviewers: abidh, ki.stfu

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D12796

llvm-svn: 247403
2015-09-11 11:17:30 +00:00
Bruce Mitchener e2453afff6 [lldb-mi] Use empty arg lists instead of (void).
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
2015-08-04 10:24:20 +00:00
Bruce Mitchener 2c674d347e [lldb-mi] Remove unused bool results.
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
2015-07-22 17:07:27 +00:00
Bruce Mitchener c5638f915b [lldb-mi] Fix typo in variable name.
Seperated -> Separated.

Summary: [lldb-mi] Fix typo in variable name.

Reviewers: abidh, ki.stfu

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D10992

llvm-svn: 241586
2015-07-07 14:26:28 +00:00
Bruce Mitchener ae4c026765 [lldb-mi] Fix typos
llvm-svn: 241585
2015-07-07 14:04:40 +00:00
Bruce Mitchener 3b25b479bf Remove typedefs for MIchar, MIschar, MIuchar.
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
2015-07-03 13:45:34 +00:00
Bruce Mitchener 68dc553fda Fix type signature for CMIUtilString::IsAllValidAlphaAndNumeric.
This should take a "const char*" not a "char &".

Summary:
Fix type signature for CMIUtilString::IsAllValidAlphaAndNumeric.

This passes the MI tests on Mac OS X.

Reviewers: ki.stfu, abidh, domipheus

Subscribers: lldb-commits-list

Differential Revision: http://reviews.llvm.org/D10906

llvm-svn: 241322
2015-07-03 07:28:11 +00:00
Hafiz Abid Qadeer ba9614f643 Improve handling of print value argument in -stack-list-* commands.
It was reviewed in http://reviews.llvm.org/D10106.
Patch by paulmaybee.

llvm-svn: 238572
2015-05-29 16:48:40 +00:00
Ilia K 913b2d4fd3 Fix BP address for local symbols if target not launched (MI)
For example:
was:
```
$ bin/lldb-mi ~/p/hello
[...]
-break-insert -f main
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0xffffffffffffffff",func="main",file="hello.cpp",fullname="/Users/IliaK/p/hello.cpp",line="14",pending=["main"],times="0",original-location="main"}
```

now:
```
$ bin/lldb-mi ~/p/hello
[...]
-break-insert -f main
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100000e2d",func="main",file="hello.cpp",fullname="/Users/IliaK/p/hello.cpp",line="14",pending=["main"],times="0",original-location="main"}
```

llvm-svn: 236830
2015-05-08 12:06:17 +00:00
Hafiz Abid Qadeer fda237d09f Add support for -stack-list-variables.
This command is able to list both local variables and stack arguments for a specific thread/frame.
Args are denoted with 'arg="1"'.
Patch from Chuck Ries.

llvm-svn: 236090
2015-04-29 08:18:41 +00:00
Ilia K 94b8ebcacf Add -gdb-set/-gdb-show aggregate-field-names option (MI)
Use this option to print/skip field names (default is on):
```
-var-create var1 * complx
^done,name="var1",numchild="3",value="{i = 3, inner = {l = 3}, complex_ptr = 0x[0-9a-f]+}",type="complex_type",thread-id="1",has_more="0"
-var-create var2 * complx_array
^done,name="var2",numchild="2",value="{[0] = {i = 4, inner = {l = 4}, complex_ptr = 0x[0-9a-f]+}, [1] = {i = 5, inner = {l = 5}, complex_ptr = 0x[0-9a-f]+}}",type="complex_type [2]",thread-id="1",has_more="0"
-gdb-set print aggregate-field-names off
^done
-var-create var3 * complx
^done,name="var3",numchild="3",value="{3,{3},0x[0-9a-f]+}",type="complex_type",thread-id="1",has_more="0"
-var-create var4 * complx_array
^done,name="var4",numchild="2",value="{{4,{4},0x[0-9a-f]+},{5,{5},0x[0-9a-f]+}}",type="complex_type [2]",thread-id="1",has_more="0"
```

llvm-svn: 235807
2015-04-25 20:33:02 +00:00
Ilia K 81bd06d787 Add -gdb-set/-gdb-show expand-aggregates option (MI)
Use this option to expand complex types always:
```
-var-create var1 * complx
^done,name="var1",numchild="3",value="{...}",type="complex_type",thread-id="1",has_more="0"
-var-create var2 * complx_array
^done,name="var2",numchild="2",value="[2]",type="complex_type [2]",thread-id="1",has_more="0"
-gdb-set print expand-aggregates on
^done
-var-create var3 * complx
^done,name="var3",numchild="3",value="{i = 3, inner = {l = 3}, complex_ptr = 0x[0-9a-f]+}",type="complex_type",thread-id="1",has_more="0"
-var-create var4 * complx_array
^done,name="var4",numchild="2",value="{[0] = {i = 4, inner = {l = 4}, complex_ptr = 0x[0-9a-f]+}, [1] = {i = 5, inner = {l = 5}, complex_ptr = 0x[0-9a-f]+}}",type="complex_type [2]",thread-id="1",has_more="0"
```

llvm-svn: 235805
2015-04-25 20:10:02 +00:00
Ilia K aa82b4af84 Add -gdb-set/-gdb-show print char-array-as-string option (MI)
llvm-svn: 235804
2015-04-25 19:44:56 +00:00
Ilia K 58627321f6 Refactor CMICmnLLDBDebuggerHandleEvents/CMICmnLLDBDebugSessionInfo/CMICmnLLDBDebugSessionInfoVarObj (MI)
Summary:
This patch includes the following changes:

# Refactor GetVariableInfo/GetValueStringFormatted/GetValue to use the same code (MI)
Also it expands the variable value format for strings (aka char*):
was:
```
^done,name="v4",numchild="1",value="0x0000000100000f56",type="const char *",thread-id="1",has_more="0"
```
now:
```
^done,name="v4",numchild="1",value="0x0000000100000f56 \"ab\"",type="const char *",thread-id="1",has_more="0"
```

# Expand the variable value format for arrays (according to GDB)
For example:
was:
```
^done,name="v3",numchild="2",value="{...}",type="char [2]",thread-id="1",has_more="0"
```
now:
```
^done,name="v3",numchild="2",value="[2]",type="char [2]",thread-id="1",has_more="0"
```

# Rename MiGdbSetShowTestCase.test_lldbmi_gdb_show_process_stopatentry_default to test_lldbmi_gdb_show_process_stopatentry (MI)

# Fix a comment in MiGdbSetShowTestCase.test_lldbmi_gdb_show_process_stopatentry (MI)

# Refactor CMICmnLLDBUtilSBValue
## Add CMICmnLLDBUtilSBValue::IsPointerType/IsArrayType
## Refactor CMICmnLLDBUtilSBValue::GetValue
## Fix CMICmnLLDBUtilSBValue::IsChildCharType to ignore a number of childs
## Rename CMICmnLLDBUtilSBValue::IsChildCharType to IsFirstChildCharType
## Fix CMICmnLLDBUtilSBValue::GetValueCString to accept char[]

# Minor changes in CMICmnLLDBUtilSBValue::GetValue

# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo family functions (MI)

# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo family functions (MI)
## Remove CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo2
## Improve CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo to accept args

# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo family functions (MI)
## Add vArgInfo arg to CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo
## Move CMICmnLLDBDebugSessionInfo::GetFrameInfo/MIResponseFormFrameInfo to private namespace

# Refactor CMICmnLLDBDebugSessionInfo::GetThreadFrames family functions (MI)
## Remove CMICmnLLDBDebugSessionInfo::GetThreadFrames2
## Improve CMICmnLLDBDebugSessionInfo::GetThreadFrames to accept vnMaxDepth

# Fix vnMaxDepth arg name in CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo (MI)

# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo family functions (MI)
## Merge CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo functions into one

# Don't modify fnName in CMICmnLLDBDebugSessionInfo::GetThreadFrames (MI)

# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo family functions (MI)
## Remove CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo3
## Improve -CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo to accept vnMaxDepth

# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo family functions (MI)
## Remove CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo2
## Add CMICmnLLDBDebugSessionInfo::ThreadInfoFormat_e enum to specify thread format
## Improve CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo to accept veThreadInfoFormat
## Remove vnMaxDepth arg in CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo (not needed because veThreadInfoFormat was added)

# Move CMICmnLLDBDebugSessionInfo::GetThreadFrames to private namespace (MI)

# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo (MI)
## Add CMICmnLLDBDebugSessionInfo::FrameInfoFormat_e enum to specify frame format
## Improve CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo to accept veFrameInfoFormat
## Remove vnMaxDepth arg in CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo (not needed because veFrameInfoFormat was added)

# Remove duplicated level field in CMICmnLLDBDebugSessionInfo::GetThreadFrames (MI)

# Refactor CMICmnLLDBUtilSBValue::GetValue (MI)
## Add CMICmnLLDBUtilSBValue::GetSimpleValue
## Use CMICmnLLDBUtilSBValue::GetSimpleValue in GetVlaue

# Fix CMICmnLLDBDebugSessionInfo::GetThreadFrames (MI)
## Add CMICmnLLDBDebugSessionInfo::FrameInfoFormat_e::eFrameInfoFormat_AllArgumentsInSimpleForm which is used to get stack-args in simple form (i.e. show {...} for composite types). It can be done by calling MIResponseFormVariableInfo with vnMaxDepth=0.
## Improve CMICmnLLDBDebugSessionInfo::GetThreadFrames to accept veFrameInfoFormat
## Remove vnMaxDepth from CMICmnLLDBDebugSessionInfo::GetThreadFrames (we should use veFrameInfoFormat instead)

# Refactor CMICmnLLDBUtilSBValue::GetValue to expand composite types (MI)
## Add CMICmnLLDBUtilSBValue::GetCompositeValue to expand composite types
## Add CMICmnLLDBUtilSBValue::m_pComposite to avoid multiple {...} in the code
## Improve CMICmnLLDBUtilSBValue::GetValue to accept vbExpandAggregates option (default=false)
## Clean up CMICmnLLDBDebugSessionInfo::GetVariableInfo to use CMICmnLLDBUtilSBValue::GetValue
## Remove the wrapping into {} in CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo
## Fix MiStackTestCase.test_lldbmi_stack_list_locals test to expect result without superfluous space ' ' around the '{' or '}' brackets:
was:
```
{name=\"var_c\",value=\"{var_a = 10,var_b = 97 'a',inner_ = { var_d = 30 }}
```
now:
```
{name=\"var_c\",value=\"{var_a = 10,var_b = 97 'a',inner_ = {var_d = 30}}
```
## Fix vwrValue arg name in CMICmnLLDBUtilSBValue::GetSimpleValue (was vrValue)

# Refactor CMICmnLLDBDebugSessionInfo::GetVariableInfo (MI)
## Remove vnMaxDepth/vbIsChildValue/vnDepth args in CMICmnLLDBDebugSessionInfo::GetVariableInfo
## Improve CMICmnLLDBDebugSessionInfo::GetVariableInfo to accept vwrStrValue
## Remove vwrMiValueList arg in CMICmnLLDBDebugSessionInfo::GetVariableInfo (we should use vwrStrValue instead)
## Fix CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo to Escape values
was:
```
{name="p",value="0x0000000000000000 """}
```
now:
```
{name="p",value="0x0000000000000000 \"\""}
```

# Refactor CMICmnLLDBUtilSBValue
## Improve CMICmnLLDBUtilSBValue::GetValue to handle PrintExpandAggregates
## Improve CMICmnLLDBUtilSBValue::GetSimpleValue to handle vbHandleArrayType (use it to specify that array should be represented as simple type, i.e. value="[2]")

# Add spacing between fields in CMICmnLLDBUtilSBValue::GetCompositeValue (MI)
For example:
was:
```
^done,name="var3",numchild="3",value="{i = 3,inner = {l = 3},complex_ptr = 0x00007fff5fbff848}",type="complex_type",thread-id="1",has_more="0"
```
now:
```
^done,name="var3",numchild="3",value="{i = 3, inner = {l = 3}, complex_ptr = 0x00007fff5fbff848}",type="complex_type",thread-id="1",has_more="0"
```

# Fix spacing in MiStackTestCase.test_lldbmi_stack_list_locals test (MI)

Test Plan: ./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi/

Reviewers: abidh

Subscribers: lldb-commits, abidh

Differential Revision: http://reviews.llvm.org/D8913

llvm-svn: 234476
2015-04-09 11:17:54 +00:00
Ilia K 7690fc5428 expose 64 bit addresses through MI
Summary:
This changes all reporting of addresses from lldb-mi to be 64 bit capable. There could have been cases where a 64 bit address was getting truncated to 32 bit format.

Patch from chuckr@microsoft.com

Reviewers: abidh, ChuckR

Reviewed By: abidh

Subscribers: paulmaybee, ki.stfu, zturner, lldb-commits

Differential Revision: http://reviews.llvm.org/D8238

llvm-svn: 232736
2015-03-19 17:27:23 +00:00
Hafiz Abid Qadeer a40780e36c Remove redundant comments from lldb-mi source files.
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
2015-03-16 18:18:18 +00:00
Hafiz Abid Qadeer 095b128671 Fix for http://llvm.org/bugs/show_bug.cgi?id=21744
GetVariableInfo () collected the values of the variable in a list. But it also
tried to generate the name/value pairs for children. This caused generation of
a wrong value string for may items. This function has been fixed to put value in
the list only.

The handling of --print-value related option has been moved to caller.

GetVariableInfo2 and MIResponseFormVariableInfo3 have been removed. They were
almost the duplicate of functions of similar names. I dont see any difference in
the output of -stack-list-locals and -stack-list-arguments. So these functions
just seemed unnecessary.

Char variable was being printed as a string which caused garbage output. This has
been fixed.

Some misc. cleanup.

Test cases have been added that check -stack-list-locals for struct, array and
pointers. Modified other tests which depended on hard coded line numbers.

Reviewed in http://reviews.llvm.org/D7589

llvm-svn: 229102
2015-02-13 11:53:50 +00:00
Ilia K 1a0ec0f15d Fix -stack-list-locals and -stack-list-arguments (MI)
Summary:
These changes include:
* Add eVariableInfoFormat argument for MIResponseFormVariableInfo{,2,3} and GetVariableInfo{,2} functions
* Fix -stack-list-locals and -stack-list-arguments: they ingored print-values
* Enable MiStackTestCase tests for -stack-list-xxx commands

All test pass on OS X.

Reviewers: abidh, clayborg

Reviewed By: abidh

Subscribers: lldb-commits, clayborg, abidh

Differential Revision: http://reviews.llvm.org/D7462

llvm-svn: 228412
2015-02-06 18:08:24 +00:00
Hafiz Abid Qadeer 0d51c1563b Fix CLI commands in lldb-mi.
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
2015-02-03 10:05:54 +00:00
Greg Clayton ee3626ec16 Added an Xcode target so we build the "lldb-mi" executable as part of the "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
2015-01-20 00:04:26 +00:00
Hafiz Abid Qadeer 290ece8278 Fix a bug where global variable can be reported as local.
There was an error in ORing mask which is used for getting a list of variables.
Previously, these constants were unnamed, and possible it become the reason of this
bug. Also added test case for -stack-list-local and -stack-list_arguments.

Patch from Ilia K <ki.stfu@gmail.com>.

llvm-svn: 223674
2014-12-08 18:07:40 +00:00
Zachary Turner 1d6af02e2d Reformat lldb-mi using clang-format.
Courtesy of dawn@burble.org.

llvm-svn: 222150
2014-11-17 18:06:21 +00:00
Deepak Panickal d249928b84 Add new MI commands, features and fixes to the lldb-mi driver.
- 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
2014-08-08 16:47:42 +00:00
Deepak Panickal 877569c2b8 Added support for new MI commands and bug fixes. More details in MIReadme.txt.
llvm-svn: 211607
2014-06-24 16:35:50 +00:00
Deepak Panickal 6f9c468102 Initial commit of LLDB Machine Interface Frontend.
- 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
2014-05-16 10:51:01 +00:00