This patch adds support the command 'source info' as follows:
(lldb) help source info
Display source line information (as specified) based on the current executable's
debug info.
Syntax: source info <cmd-options>
Command Options Usage:
source info [-c <count>] [-s <shlib-name>] [-f <filename>] [-l <linenum>] [-e <linenum>]
source info [-c <count>] [-s <shlib-name>] [-n <symbol>]
source info [-c <count>] [-a <address-expression>]
-a <address-expression> ( --address <address-expression> )
Lookup the address and display the source information for the corresponding
file and line.
-c <count> ( --count <count> )
The number of line entries to display.
-e <linenum> ( --end-line <linenum> )
The line number at which to stop displaying lines.
-f <filename> ( --file <filename> )
The file from which to display source.
-l <linenum> ( --line <linenum> )
The line number at which to start the displaying lines.
-n <symbol> ( --name <symbol> )
The name of a function whose source to display.
-s <shlib-name> ( --shlib <shlib-name> )
Look up the source in the given module or shared library (can be specified
more than once).
For example:
(lldb) source info --file x.h
Lines for file x.h in compilation unit x.cpp in `x
[0x0000000100000d00-0x0000000100000d10): /Users/dawn/tmp/./x.h:10
[0x0000000100000d10-0x0000000100000d1b): /Users/dawn/tmp/./x.h:10
The new options are used to fix the MI command:
-symbol-list-lines <file>
which didn't work for header files because it called:
target modules dump line-table <file>
which only dumps line tables for a compilation unit.
The patch also fixes a bug in the error reporting when no files were supplied to the command. Previously you'd get:
(lldb) target modules dump line-table
error:
Syntax:
error: no source filenames matched any command arguments
Now you get:
error: file option must be specified.
Reviewed by: clayborg, jingham, ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D15593
llvm-svn: 256863
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
Summary: This diff approaches building the project natively on NetBSD with the autoconf/gmake framework.
Patch by Kamil Rytarowski. Thanks!
Reviewers: emaste, clayborg
Subscribers: tberghammer, joerg, brucem, lldb-commits
Differential Revision: http://reviews.llvm.org/D14531
llvm-svn: 253153
Summary:
These changes are still incomplete, but we are almost there.
Changes:
- CMake and gmake code
- SWIG code
- minor code additions
Reviewers: emaste, joerg
Subscribers: youri, akat1, brucem, lldb-commits, joerg
Differential Revision: http://reviews.llvm.org/D14042
llvm-svn: 252403
Summary:
As per the following link, the "--" separator can appear between the options
and parameters of any MI command. Previously this separator was only
handled by the `-data-disassemble` MI command. I have moved the relevant
code into `CMICmdBase` so that any MI command can handle the
aforementioned separator.
https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Input-Syntax.html#GDB_002fMI-Input-Syntax
Reviewers: ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D14197
llvm-svn: 251793
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
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
Previously, lldb did not use type summaries for simple types with no children
(like function pointers). This patch enables MI to use lldb type summaries for
evaluation of all types of objects, so MI own formatters are no longer needed.
Patch from evgeny.leviant@gmail.com
Reviewed by: abidh
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13799
llvm-svn: 251082
In r248047, I attempted to fix a build breakage introduced by using
llvm's regex support from lldb-mi. However, my approach was flawed
when LLVM and lldb are dynamically linked, in which case two copies
of LLVMSupport would end up in memory, causing crashes on lldb start up.
Instead, use LINK_COMPONENTS to make sure lldb-mi has access to the
LLVMSupport symbols without causing duplication in the dynamic library
case.
llvm-svn: 250751
If a string contained characters outside the ASCII range, lldb-mi would
print them as hexadecimal codes. This patch fixes this behaviour by
converting to UTF-8 instead, by having lldb-mi use registered type
summary providers, when they are available. This patch also fixes
incorrect evaluation of some composite types, like std::string, by
having them use a type registered type summary provider.
Based on patch from evgeny.leviant@gmail.com
Reviewed by: ki.stfu, granata.enrico, clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13058
llvm-svn: 249597
This patch adds a --start option to the lldb-mi -exec-run command for
getting process stopped at entry point after launch. It is equivelent
to the -s option in the lldb command line interpreter:
process launch -s
and is therefore not supported on all hosts and/or targets. To check
if the --start option is supported, see if the corresponding feature
"exec-run-start-option" is in the list of options reported by the lldb-mi
"-list-features" command.
Patch from engineer.developer@gmail.com (Kirill Lapshin)
Reviewed by: ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D12977
llvm-svn: 249072
Fix assignment operator in CMIUtilString to not crash the debugger if it
is passed a NULL pointer, which can happen in code like the following:
SBValue val;
CMIUtilString s;
//...
s = val.GetSummary();
Patch from evgeny.leviant@gmail.com
Reviewed by: clayborg, ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13094
llvm-svn: 248597
This fixes -data-info-line and -symbol-list-lines to parse the filename
and line correctly when line entries don't have the optional column
number and the filename contains a Windows drive letter. It also fixes
-symbol-list-lines when code from header files is generated.
Reviewed by: abidh, ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D12115
llvm-svn: 247899
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
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
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
Summary:
This platform-specific code wasn't fully implemented and wasn't
actually needed. There was one call for the log file path and
that has been addressed.
This lets us also remove an error message from MICmnLogMediumFile
as it is no longer used.
Reviewers: ki.stfu, domipheus, abidh
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D12764
llvm-svn: 247388
Summary: Problem was caught on NetBSD.
Reviewers: joerg, sas
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D12654
Change by Kamil Rytarowski <n54@gmx.com>
llvm-svn: 247034
Summary:
For an array declared like "blk[2][3]", this command was showing:
-data-evaluate-expression blk
^done,value="{[0] = [3], [1] = [3]}"
After this fix, it shows:
-data-evaluate-expression blk
^done,value="{[0] = {[0] = 1, [1] = 2, [2] = 3}, [1] = {[0] = 4, [1] = 5, [2] = 6}}"
The code to do the right thing was already available and used by other commands.
So I have just used that and removed the half-baked previous implementation.
Reviewers: ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D12634
llvm-svn: 246965
1. To handle the expression with spaces, this command uses 2 arguments. For a case
like -break-condition 1 i == 5, the first will pick the 'i' and second will
pick the '== 5'. But the second argument was made mandatory which failed in
cases when there was no space in the expression like i==5.
2. The function GetRestOfExpressionNotSurroundedInQuotes has 2 locals with the
same names. It resulted in one hiding the other and this function always
returned empty string.
No regression on Linux. Committed as obvious.
llvm-svn: 246847
Summary:
GetOptInc provides getopt(), getopt_long() and getopt_long_only().
Windows (for defined(_MSC_VER)) doesn't ship with all of the getopt(3) family members and needs all of them. NetBSD requires only getopt_long_only(3).
While there fix the code for clang diagnostics.
Author: Kamil Rytarowski
Reviewers: joerg
Subscribers: labath, zturner, lldb-commits
Differential Revision: http://reviews.llvm.org/D12582
llvm-svn: 246843
Summary:
This also moves the xcode support files to be near or the same
as the ones used for cmake.
The source/API/liblldb.xcodes.exports differs from the
source/API/liblldb.exports in that one contains the actual
symbol names (_ prefixed) while the other contains the symbol
names as they are in the code. The liblldb.exports file is
preprocessed by the cmake scripts into the correct per-platform
file needed (like a linker script on Linux).
This is not enabled on Windows as Windows doesn't use the same
name mangling and so it won't be valid there. Also, this is handled
already in a different way on Windows (via dll exports).
Reviewers: emaste, clayborg, labath, chaoren
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D12599
llvm-svn: 246822
Summary:
This doesn't exist in other LLVM projects any longer and doesn't
do anything.
Reviewers: chaoren, labath
Subscribers: emaste, tberghammer, lldb-commits, danalbert
Differential Revision: http://reviews.llvm.org/D12586
llvm-svn: 246749
Summary:
When calling find_first_of and find_last_of on a single character,
we can instead just call find / rfind and make our intent more
clear.
Reviewers: clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D12518
llvm-svn: 246609
Summary:
find_first_of will look for any of the characters, not the full
string passed in. When looking for "--" then, we must use find
and not find_first_of.
Reviewers: ki.stfu, abidh
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D12517
llvm-svn: 246529
Summary:
(This revision supersedes the abandon: http://reviews.llvm.org/D9716)
Size field is used to let the debugger attribute an address to a specific library when symbols are not available.
For example:
OpenGLESApp4.app!Cube_draw() Line 74 C
OpenGLESApp4.app!-[GameViewController glkView:drawInRect:](GameViewController * self, SEL _cmd, GLKView * view, CGRect rect) Line 89 C++
GLKit!<redacted>
QuartzCore!<redacted>
QuartzCore!<redacted>
QuartzCore!<redacted>
QuartzCore!<redacted>
QuartzCore!<redacted>
UIKit!<redacted>
UIKit!<redacted>
UIKit!<redacted>
UIKit!<redacted>
FrontBoardServices!<redacted>
CoreFoundation!<redacted>
Patch from paulmay@microsoft.com
Reviewers: ChuckR, abidh, ki.stfu
Subscribers: greggm, lldb-commits
Differential Revision: http://reviews.llvm.org/D11574
llvm-svn: 244573
Summary:
* Remove extraneous members that were just storing temporary
values.
* OutOfBand_e parameters don't need to be const as they are
scalars.
* Switch from a map with CMIUtilString values to using a mapping
function. This uses a switch statement which will generate
a warning if a new result class is added.
* Make BuildAsyncRecord a static function rather than a private
member function so that we can construct the result text
correctly and avoid having extra stuff in the header.
Reviewers: abidh, ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D11751
llvm-svn: 243975
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
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
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
Summary:
Currently if the "first child" of the pointer is a char type then the pointer is displayed as a string. This test succeeds incorrectly when the pointer is to a structured type with a char type as its first field. Fix this by switching the test to retrieve the pointee type and checking that it is a char type.
Reviewers: abidh, ChuckR, ki.stfu
Subscribers: greggm, lldb-commits
Differential Revision: http://reviews.llvm.org/D11488
llvm-svn: 243619
The command "-break-insert ns::foo" for function 'foo' in namespace 'ns'
was being parsed as file:function. This patch fixes these cases by adding
checks for '::'. (Note: '::func' is not parsed correctly by lldb due to
llvm.org/pr24271).
Reviewed by: ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D11396
llvm-svn: 243281
Summary:
This removes Authors:, Gotchas:, Changes: and Copyright:.
It leaves a couple of Gotcha: blocks that were not empty.
Reviewers: abidh, ki.stfu, domipheus
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D11452
llvm-svn: 242996