Commit Graph

2960 Commits

Author SHA1 Message Date
Greg Clayton 648267c29c Avoid a missing override warning.
llvm-svn: 247753
2015-09-15 23:59:25 +00:00
Paul Herman d628cbb999 Search variables based on clang::DeclContext and clang::Decl tree
Summary: SymbolFileDWARF now creates VarDecl and BlockDecl and adds them to the Decl tree. Then, in ClangExpressionDeclMap it uses the Decl tree to search for a variable. This fixes lots of variable scoping problems.

Reviewers: sivachandra, chaoren, spyffe, clayborg

Subscribers: tberghammer, jingham, lldb-commits

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

llvm-svn: 247746
2015-09-15 23:44:17 +00:00
Jason Molenda 63bd0db071 Clean up register naming conventions inside lldb.
"gcc" register numbers are now correctly referred to as "ehframe"
register numbers.  In almost all cases, ehframe and dwarf register
numbers are identical (the one exception is i386 darwin where ehframe
regnums were incorrect).

The old "gdb" register numbers, which I incorrectly thought were
stabs register numbers, are now referred to as "Process Plugin"
register numbers.  This is the register numbering scheme that the
remote process controller stub (lldb-server, gdbserver, core file
support, kdp server, remote jtag devices, etc) uses to refer to the
registers.  The process plugin register numbers may not be contiguous
- there are remote jtag devices that have gaps in their register
numbering schemes.

I removed all of the enums for "gdb" register numbers that we had
in lldb - these were meaningless - and I put LLDB_INVALID_REGNUM
in all of the register tables for the Process Plugin regnum slot.

This change is almost entirely mechnical; the one actual change in
here is to ProcessGDBRemote.cpp's ParseRegisters() which parses the
qXfer:features:read:target.xml response.  As it parses register
definitions from the xml, it will assign sequential numbers as the
eRegisterKindLLDB numbers (the lldb register numberings must be
sequential, without any gaps) and if the xml file specifies register
numbers, those will be used as the eRegisterKindProcessPlugin
register numbers (and those may have gaps).  A J-Link jtag device's
target.xml does contain a gap in register numbers, and it only 
specifies the register numbers for the registers after that gap.
The device supports many different ARM boards and probably selects
different part of its register file as appropriate.

http://reviews.llvm.org/D12791
<rdar://problem/22623262> 

llvm-svn: 247741
2015-09-15 23:20:34 +00:00
Jim Ingham 151c032c86 This patch makes Clang-independent base classes for all the expression types that lldb currently vends.
Before we had:

ClangFunction
ClangUtilityFunction
ClangUserExpression

and code all over in lldb that explicitly made Clang-based expressions. This patch adds an Expression 
base class, and three pure virtual implementations for the Expression kinds:

FunctionCaller
UtilityFunction
UserExpression

You can request one of these expression types from the Target using the Get<ExpressionType>ForLanguage. 
The Target will then consult all the registered TypeSystem plugins, and if the type system that matches 
the language can make an expression of that kind, it will do so and return it.

Because all of the real expression types need to communicate with their ExpressionParser in a uniform way, 
I also added a ExpressionTypeSystemHelper class that expressions generically can vend, and a ClangExpressionHelper 
that encapsulates the operations that the ClangExpressionParser needs to perform on the ClangExpression types. 
Then each of the Clang* expression kinds constructs the appropriate helper to do what it needs.

The patch also fixes a wart in the UtilityFunction that to use it you had to create a parallel FunctionCaller 
to actually call the function made by the UtilityFunction. Now the UtilityFunction can be asked to vend a 
FunctionCaller that will run its function. This cleaned up a lot of boiler plate code using UtilityFunctions.

Note, in this patch all the expression types explicitly depend on the LLVM JIT and IR, and all the common 
JIT running code is in the FunctionCaller etc base classes. At some point we could also abstract that dependency 
but I don't see us adding another back end in the near term, so I'll leave that exercise till it is actually necessary.

llvm-svn: 247720
2015-09-15 21:13:50 +00:00
Tamas Berghammer 41b1f73122 Add support for DW_OP_GNU_const_index to dwarf expression
DW_OP_GNU_const_index is a new opcode used when split dwarf is enabled

Differential revision: http://reviews.llvm.org/D12849

llvm-svn: 247672
2015-09-15 10:33:54 +00:00
Bruce Mitchener 500737e694 Use uint64_t for GoArray size.
Summary:
This was int64_t, but all usages of it came from code that was passing
in unsigned values. The usages of the array size, except for one, were
also treating it as an unsigned value.  The usage that treated it as
signed was to try to figure out if it was a complete type or not, but
the callers creating the array didn't seem to be aware of using -1 as
an indicator for an incomplete array.

Reviewers: ribrdb, clayborg

Subscribers: lldb-commits

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

llvm-svn: 247662
2015-09-15 04:33:48 +00:00
Greg Clayton 6c6eab162a Avoid a crash in the test suite where if we have a ObjC "id" type and we ask it for the PointeeType() we would get a CompilerType with a valid TypeSystem, but invalid opaque type, and ClangASTContext::IsClangType() previously would return true saying that it was a valid clang type and it would crash in removing qualifiers from a clang::QualType that was constructed with an NULL opaque type.
llvm-svn: 247641
2015-09-14 23:55:01 +00:00
Ryan Brown 57bee1edfc Add a TypeSystem for Go
Add GoASTContext and DWARFASTParserGo to support go.

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

llvm-svn: 247629
2015-09-14 22:45:11 +00:00
Enrico Granata 170c395e70 Move Objective-C data formatters to the Objective-C language plugin where they belong
llvm-svn: 247627
2015-09-14 22:18:32 +00:00
Enrico Granata ac49453b58 Introduce the notion of an escape helper. Different languages have different notion of what to print in a string and how to escape non-printable things. The escape helper is where this notion is provided to LLDB
This is NFC, other than a code re-org

llvm-svn: 247200
2015-09-09 22:30:24 +00:00
Greg Clayton 13f11bba7d Remove unused function.
llvm-svn: 247197
2015-09-09 22:13:36 +00:00
Enrico Granata a4846c8524 Remove Target::GetBasicType()
I was experimenting with it briefly, and then settled on Target::GetTypeSystem + TypeSystem::GetBasicType, so this API is not necessary to have

Thanks to Ryan Brown for bringing it to my attention

llvm-svn: 247195
2015-09-09 22:00:18 +00:00
Enrico Granata ad650a189c Preparatory work for letting language plugins help the StringPrinter with formatting special characters
llvm-svn: 247189
2015-09-09 20:59:49 +00:00
Tamas Berghammer 3366f0b42f Fix type in include header name
llvm-svn: 247137
2015-09-09 11:28:52 +00:00
Tamas Berghammer bc99ce88f5 Add missing include after rL247131
llvm-svn: 247135
2015-09-09 11:16:32 +00:00
Mohit K. Bhakkad 9514a383c8 [LLDB][MIPS] Added support for the debugging of N32/O32 applications on MIPS64 target.
Patch by Nitesh Jain

Reviewers: clayborg, ovyalov.
Subscribers: jaydeep, bhushan, mohit.bhakkad, sagar, nitesh.jain, lldb-commits.
Differential Revision: http://reviews.llvm.org/D12671

llvm-svn: 247134
2015-09-09 10:32:20 +00:00
Tamas Berghammer eb882fc1f8 Add basic fission support to SymbolFileDWARF
* Create new dwo symbol file class
* Add handling for .dwo sections
* Change indexes in SymbolFileDWARF to store compile unit offset next to
  DIE offset
* Propagate queries from dwarf compile unit to the dwo compile unit
  where applicable

Differential revision: http://reviews.llvm.org/D12291

llvm-svn: 247132
2015-09-09 10:20:48 +00:00
Enrico Granata d3233c1ed7 Data formatter candidate matches can be generated in a number of ways; language-based dynamic type discovery being one of them (for instance, this is what takes an 'id' and discovers that it truly is an __NSArrayI, so it should probably use the NSArray formatter)
This used to be hardcoded in the FormatManager, but in a pluginized world that is not the right way to go

So, move this step to the Language plugin such that appropriate language plugins for a type get a say about adding candidates to the formatters lookup tables

llvm-svn: 247112
2015-09-09 01:10:46 +00:00
Sean Callanan 3820e9cd17 ExpressionVariable now uses llvm::cast() instead of As...() for RTTI.
As part of our overall switch from hand-rolling RTTI to using LLVM-compatible
methods, I've done the same for ExpressionVariable.  The main documentation for
how to do this is in TypeSystem.h, so I've simply referred to that.

llvm-svn: 247085
2015-09-08 22:23:39 +00:00
Enrico Granata b5be2ffae5 Implement a Target::GetTypeSystemForLanguage API, as well as provide helpers on the TypeSystem to get numeric types of specific sizes and signedness
llvm-svn: 247082
2015-09-08 22:09:19 +00:00
Greg Clayton f73034f99a Use LLVM casting for TypeSystem so you can cast it to subclasses.
This will keep our code cleaner and it removes the need for intrusive additions to TypeSystem like:

class TypeSystem
{
    virtual ClangASTContext *
    AsClangASTContext() = 0;
}

As you can now just use the llvm::dyn_cast and other casts.

llvm-svn: 247041
2015-09-08 18:15:05 +00:00
Tamas Berghammer e6408bb064 Fix assertion failure caused by a bug in 128bit register handling in RegisterValue
llvm-svn: 247022
2015-09-08 16:22:23 +00:00
Tamas Berghammer 25b9f7ebd3 Use eAddressClassCode for address lookup for opcodes for stack frames
It is required because of the following edge case on arm:

bx <addr>   Non-tail call in a no return function
[data-pool] Marked with $d mapping symbol

The return address of the function call will point to the data pool but
we have to treat it as code so the StackFrame can calculate the symbols
correctly.

Differential revision: http://reviews.llvm.org/D12556

llvm-svn: 246958
2015-09-07 09:58:09 +00:00
Enrico Granata 964211f25f Add a --language (-l) option to type category {enable|disable} to allow people to turn on and off formatters for a given language
llvm-svn: 246884
2015-09-04 22:07:48 +00:00
Enrico Granata 33e97e63a5 Move the C++ data formatters to the C++ language plugin
llvm-svn: 246873
2015-09-04 21:01:18 +00:00
Sean Callanan bc8ac34e61 This patch separates the generic portion of ClangExpressionVariable, which
stores information about a variable that different parts of LLDB use, from the
compiler-specific portion that only the expression parser cares about.

http://reviews.llvm.org/D12602

llvm-svn: 246871
2015-09-04 20:49:51 +00:00
Pavel Labath a04668ff34 Move GetOptInc to the common namespace
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
2015-09-04 09:06:15 +00:00
Dawn Perchik 009d110de4 Set the default language to use when evaluating to that of the frame's CU.
* Use the frame's context (instead of just the target's) when evaluating,
  so that the language of the frame's CU can be used to select the
  compiler and/or compiler options to use when parsing the expression.
  This allows for modules built with mixed languages to be parsed in
  the context of their frame. 
* Add all C and C++ language variants when determining the language options
  to set.
* Enable C++ language options when language is C or ObjC as a workaround since
  the expression parser uses features of C++ to capture values.
* Enable ObjC language options when language is C++ as a workaround for ObjC
  requirements.
* Disable C++11 language options when language is C++03.
* Add test TestMixedLanguages.py to check that the language being used
  for evaluation is that of the frame.
* Fix test TestExprOptions.py to check for C++11 instead of C++ since C++ has
  to be enabled for C, and remove redundant expr --language test for ObjC.
* Fix TestPersistentPtrUpdate.py to not require C++11 in C.

Reviewed by: clayborg, spyffe, jingham
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D11102

llvm-svn: 246829
2015-09-04 01:02:30 +00:00
Enrico Granata 419d79189f Nuke CXXFormatterFunctions.cpp - split the contents of it across different files, so that things are better organized along the C++/ObjC line
This is preparatory work for moving these formatters into language categories

llvm-svn: 246827
2015-09-04 00:33:51 +00:00
Sean Callanan 30e339749f Jim told me about a cleaner way to include headers from plug-ins.
This is still something I need to fix, but at least it's not so ugly, and it's
consistent with the other code that does that so we will catch it when we purge
all such code.

llvm-svn: 246738
2015-09-03 00:48:23 +00:00
Sean Callanan e33724f371 In preparation for factoring persistent variables into a generic part and a
Clang-specific part, create the ExpressionVariable source/header file and
move ClangExpressionVariable into the Clang expression parser plugin.

It is expected that there are some ugly #include paths... these will be resolved
by either (1) making that code use generic expression variables (once they're
separated appropriately) or (2) moving that code into a plug-in, often
the expression parser plug-in.

llvm-svn: 246737
2015-09-03 00:35:46 +00:00
Tamas Berghammer 89d3f090b2 Fix tab completion for command arguments containing spaces
If a command argument contains a space then it have to be escaped with
backslash signs so the argument parsing logic can parse it properly.
This CL fixes the tab completion code for the arguments to create
complitions with correctly escaped strings.

Differential revision: http://reviews.llvm.org/D12531

llvm-svn: 246639
2015-09-02 10:35:27 +00:00
Pavel Labath 4407b8eba1 Fix Clang-tidy misc-use-override warnings in some files in include/lldb/Interpreter, unify closing inclusion guards
patch by Eugene Zelenko.

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

llvm-svn: 246627
2015-09-02 09:28:35 +00:00
Pavel Labath 6ac50bf19e Fix Clang-tidy misc-use-override warnings in some files in include/lldb/Target, unify closing inclusion guards
patch by Eugene Zelenko.

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

llvm-svn: 246626
2015-09-02 09:24:21 +00:00
Pavel Labath 3a3354eb03 Fix Clang-tidy misc-use-override warnings in include/lldb/API, Breakpoint and Symbol, unify closing inclusion guards
patch by Eugene Zelenko.

llvm-svn: 246624
2015-09-02 09:19:24 +00:00
Jim Ingham aa816b8f3b Move more functionality from the LanguageRuntimes to the Languages.
llvm-svn: 246616
2015-09-02 01:59:14 +00:00
Enrico Granata 28b3831e39 Add a Language::ForAllLanguages helper function
llvm-svn: 246614
2015-09-02 01:31:10 +00:00
Enrico Granata df7e79e646 Move the functions that FormatManager uses to actually load formatters into their own file
These are useful helpers over the low-level API of the FormattersContainer, and since we're actually going to start moving formatters into plugins, it makes sense to simplify things

llvm-svn: 246612
2015-09-02 01:21:31 +00:00
Jim Ingham 0e0984eebb Move things from the LanguageRuntime that obviously belong in the new Language plugin instead.
llvm-svn: 246611
2015-09-02 01:06:46 +00:00
Zachary Turner 7529df9abd Have the Process hold a weak_ptr to the Target.
llvm-svn: 246578
2015-09-01 20:02:29 +00:00
Enrico Granata 980c0484c5 Add support for language plugins to provide data formatters (second attempt)
Historically, data formatters all exist in a global repository (the category map)
On top of that, some formatters can be "hardcoded" when the conditions under which they apply are not expressible as a typename (or typename regex)

This change paves the way to move formatters into per-language buckets such that the C++ plugin is responsible for ownership of the C++ formatters, and so on
The advantages of this are:
a) language formatters only get created when they might apply
b) formatters for a language are clearly owned by the matching language plugin

The current model is one of static instantiation, that is a language knows the full set of formatters it vends and that is only asked-for once, and then handed off to the FormatManager
In a future revision it might be interesting to add similar ability to the language runtimes, and monitor for certain shared library events to add even more library-specific formatters

No formatters are moved as part of this change, so practically speaking this is NFC

llvm-svn: 246568
2015-09-01 18:22:39 +00:00
Sean Callanan 77bc4d12c7 Add a predicate to allow a ClangASTContext to identify Clang types.
llvm-svn: 246562
2015-09-01 17:58:03 +00:00
Chaoren Lin c963a222f1 Make ProcessGDBRemote get a //copy// of platform Unix signals.
Summary: Update to http://reviews.llvm.org/rL243618.

Reviewers: jaydeep, clayborg

Subscribers: labath, tberghammer, lldb-commits

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

llvm-svn: 246557
2015-09-01 16:58:45 +00:00
Pavel Labath f15a16704b Revert "Add support for language plugins to provide data formatters"
This reverts r246515 (and related cmake fixes) as it breaks all libcxx tests.

llvm-svn: 246536
2015-09-01 09:02:54 +00:00
Enrico Granata 2233895a3b Add support for language plugins to provide data formatters
Historically, data formatters all exist in a global repository (the category map)
On top of that, some formatters can be "hardcoded" when the conditions under which they apply are not expressible as a typename (or typename regex)

This change paves the way to move formatters into per-language buckets such that the C++ plugin is responsible for ownership of the C++ formatters, and so on
The advantages of this are:
a) language formatters only get created when they might apply
b) formatters for a language are clearly owned by the matching language plugin

The current model is one of static instantiation, that is a language knows the full set of formatters it vends and that is only asked-for once, and then handed off to the FormatManager
In a future revision it might be interesting to add similar ability to the language runtimes, and monitor for certain shared library events to add even more library-specific formatters

No formatters are moved as part of this change, so practically speaking this is NFC

llvm-svn: 246515
2015-09-01 01:01:48 +00:00
Greg Clayton 261ac3f4b5 Made a new abstract class named "DWARFASTParser" which lives in "source/Plugins/SymbolFile/DWARF":
class DWARFASTParser
{
public:
    virtual ~DWARFASTParser() {}

    virtual lldb::TypeSP
    ParseTypeFromDWARF (const lldb_private::SymbolContext& sc,
                        const DWARFDIE &die,
                        lldb_private::Log *log,
                        bool *type_is_new_ptr) = 0;


    virtual lldb_private::Function *
    ParseFunctionFromDWARF (const lldb_private::SymbolContext& sc,
                            const DWARFDIE &die) = 0;

    virtual bool
    CompleteTypeFromDWARF (const DWARFDIE &die,
                           lldb_private::Type *type,
                           lldb_private::CompilerType &clang_type) = 0;

    virtual lldb_private::CompilerDeclContext
    GetDeclContextForUIDFromDWARF (const DWARFDIE &die) = 0;

    virtual lldb_private::CompilerDeclContext
    GetDeclContextContainingUIDFromDWARF (const DWARFDIE &die) = 0;

};

We have one subclass named DWARFASTParserClang that implements all of the clang specific AST type parsing. This keeps all DWARF parsing in the DWARF plug-in. Moved all of the DWARF parsing code that was in ClangASTContext over into DWARFASTParserClang.

lldb_private::TypeSystem classes no longer have any DWARF parsing functions in them, but they can hand out a DWARFASTParser:

virtual DWARFASTParser *
GetDWARFParser ()
{
    return nullptr;
}

This keeps things clean and makes for easy merging when we have different AST's for different languages.

llvm-svn: 246242
2015-08-28 01:01:03 +00:00
Enrico Granata 5f9d310640 Add a new type of plugin: Language plugin
The Language plugin is menat to answer language-specific questions that are not bound to the existence of a process. Those are still the domain of the LanguageRuntime plugin

The Language plugin will, instead, answer questions such as providing language-specific data formatters or expression evaluation

At the moment, the interface is hollowed out, and empty do-nothing plugins have been setup for ObjC, C++ and ObjC++

llvm-svn: 246212
2015-08-27 21:33:50 +00:00
Enrico Granata db3d58b94a Remove class Language - the only thing it was actually being used for is provided by LanguageRuntime already
llvm-svn: 246177
2015-08-27 18:18:49 +00:00
Greg Clayton 5ce1a84f9a More cleanup to make sure no one plays with DWARFDebugInfoEntry. Clients outside of DWARFDebugInfoEntry of DWARFCompileUnit should use DWARFDIE only.
llvm-svn: 246172
2015-08-27 18:09:44 +00:00
Enrico Granata 6e25aeea96 Add functionality to the platforms to figure out the proper name for a dynamic library on the system given a basename
This will do things like,
given mylibrary,
return

libmylibrary.dylib on OSX
mylibrary.dll on Windows

and so on for other platforms
It is currently implemented for Windows, Darwin, and Linux. Other platforms should fill in accordingly

llvm-svn: 246131
2015-08-27 00:53:57 +00:00
Enrico Granata c0499c9848 Switch data formatters over to using std::function for their callbacks instead of raw function pointers. NFC
llvm-svn: 246130
2015-08-27 00:45:33 +00:00
Greg Clayton 6071e6fc94 Major DWARF cleanup.
Added a new class called DWARFDIE that contains a DWARFCompileUnit and DWARFDebugInfoEntry so that these items always stay together.

There were many places where we just handed out DWARFDebugInfoEntry pointers and then use them with a compile unit that may or may not be the correct one. Clients outside of DWARFCompileUnit and DWARFDebugInfoEntry should all be dealing with DWARFDIE instances instead of playing with DWARFCompileUnit/DWARFDebugInfoEntry pairs manually.

This paves to the way for some modifications that are coming for DWO.

llvm-svn: 246100
2015-08-26 22:57:51 +00:00
Bhushan D. Attarde 7f3daeda9a [MIPS] Avoid breakpoint in delay slot
SUMMARY:
    This patch implements Target::GetBreakableLoadAddress() method that takes an address
    and checks for any reason there is a better address than this to put a breakpoint on.
    If there is then return that address.
    MIPS uses this method to avoid breakpoint in delay slot.
    
    Reviewers: clayborg, jingham
    Subscribers: jingham, mohit.bhakkad, sagar, jaydeep, nitesh.jain, lldb-commits
    Differential Revision: http://http://reviews.llvm.org/D12184

llvm-svn: 246015
2015-08-26 06:04:54 +00:00
Tamas Berghammer 35d9d2dc1e Handle DW_OP_GNU_addr_index in DWARF expressions
Differential revision: http://reviews.llvm.org/D12290

llvm-svn: 245932
2015-08-25 11:46:06 +00:00
Tamas Berghammer c178d4c0ce Add support for DW_FORM_GNU_[addr,str]_index
These are 2 new value currently in experimental status used when split
debug info is enabled.

Differential revision: http://reviews.llvm.org/D12238

llvm-svn: 245931
2015-08-25 11:45:58 +00:00
Greg Clayton 99558cc424 Final bit of type system cleanup that abstracts declaration contexts into lldb_private::CompilerDeclContext and renames ClangType to CompilerType in many accessors and functions.
Create a new "lldb_private::CompilerDeclContext" class that will replace all direct uses of "clang::DeclContext" when used in compiler agnostic code, yet still allow for conversion to clang::DeclContext subclasses by clang specific code. This completes the abstraction of type parsing by removing all "clang::" references from the SymbolFileDWARF. The new "lldb_private::CompilerDeclContext" class abstracts decl contexts found in compiler type systems so they can be used in internal API calls. The TypeSystem is required to support CompilerDeclContexts with new pure virtual functions that start with "DeclContext" in the member function names. Converted all code that used lldb_private::ClangNamespaceDecl over to use the new CompilerDeclContext class and removed the ClangNamespaceDecl.cpp and ClangNamespaceDecl.h files.

Removed direct use of clang APIs from SBType and now use the abstract type systems to correctly explore types.

Bulk renames for things that used to return a ClangASTType which is now CompilerType:

    "Type::GetClangFullType()" to "Type::GetFullCompilerType()"
    "Type::GetClangLayoutType()" to "Type::GetLayoutCompilerType()"
    "Type::GetClangForwardType()" to "Type::GetForwardCompilerType()"
    "Value::GetClangType()" to "Value::GetCompilerType()"
    "Value::SetClangType (const CompilerType &)" to "Value::SetCompilerType (const CompilerType &)"
    "ValueObject::GetClangType ()" to "ValueObject::GetCompilerType()"
    many more renames that are similar.

llvm-svn: 245905
2015-08-24 23:46:31 +00:00
Tamas Berghammer 42ecef3b15 Add absolute load address support for the DynamicLoader plugins
The POSIX linker generally reports the load bias for the loaded
libraries but in some case it is useful to handle a library based on
absolute load address. Example usecases:
* Windows linker uses absolute addresses
* Library list came from different source (e.g. /proc/<pid>/maps)

Differential revision: http://reviews.llvm.org/D12233

llvm-svn: 245834
2015-08-24 10:21:55 +00:00
Tamas Berghammer 9a293accbe Fix type of dw_form_t in dwarf.h
llvm-svn: 245695
2015-08-21 12:14:47 +00:00
Chaoren Lin ee3c206021 Inline fake snprintf to avoid linkage issues on Windows.
Summary:
dllexport doesn't work if linking against a static library with its own
copy of snprintf.

Reviewers: zturner

Subscribers: zturner, lldb-commits

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

llvm-svn: 245610
2015-08-20 20:53:15 +00:00
Sagar Thakur 8536fd1b64 [LLDB] Use llvm::APInt and llvm::APFloat in Scalar and RegisterValue
Eliminated ENABLE_128_BIT_SUPPORT and union ValueData from Scalar.cpp and use llvm::APInt and llvm::APFloat for all integer and floating point types. Also used Scalar in RegisterValue.cpp

Reviewers: tberghammer, ovyalov, clayborg, labath
Subscribers: lldb-commits, nitesh.jain, jaydeep 
Differential: http://reviews.llvm.org/D12100
llvm-svn: 245547
2015-08-20 09:12:46 +00:00
Paul Herman 10bc1a4e83 Fix resolution conflict between global and class static variables in C++
llvm-svn: 245381
2015-08-18 22:46:57 +00:00
Greg Clayton 6dc8d583b9 More abstraction to get almost all clang specific DWARF parsing code into ClangASTContext.
llvm-svn: 245376
2015-08-18 22:32:36 +00:00
Greg Clayton 7b1c497862 Fix inconsistent use of override warnings.
llvm-svn: 245375
2015-08-18 22:31:29 +00:00
Siva Chandra 9851b1f62b [ValueObjectSynthetic and ValueObjectDynamicValue] Override GetDeclaration
Summary:
Returns the declaration of the parent (non-synthetic or static) value.


Reviewers: granata.enrico, clayborg

Subscribers: lldb-commits

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

llvm-svn: 245319
2015-08-18 17:56:06 +00:00
Pavel Labath 083645bc5c Fix Clang-tidy misc-use-override warnings in include/lldb/Expression and include/lldb/Initialization, unify inclusion guards
patch by Eugene Zelenko.

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

llvm-svn: 245283
2015-08-18 09:18:19 +00:00
Pavel Labath 04b7f51250 Fix Clang-tidy misc-use-override warnings in include/lldb/DataFormatters and include/lldb/Host, unify closing inclusion guards
patch by Eugene Zelenko.

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

llvm-svn: 245279
2015-08-18 09:06:31 +00:00
Pavel Labath e6f9abfd91 Fix Clang-tidy misc-use-override warnings in include/lldb/Utility and some files in include/lldb/Target, unify closing inclusion guards
patch by Eugene Zelenko.

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

llvm-svn: 245277
2015-08-18 08:54:26 +00:00
Pavel Labath 280eb8ab4d Fix Clang-tidy misc-use-override warnings in some files in include/lldb/Core, unify closing inclusion guards
patch by Eugene Zelenko

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

llvm-svn: 245275
2015-08-18 08:39:09 +00:00
Pavel Labath bb467f6f04 Revert "[LLDB] Use llvm::APInt and llvm::APFloat in Scalar and RegisterValue"
Reverting as this commit causes an infinite loop.

llvm-svn: 245222
2015-08-17 15:28:05 +00:00
Sagar Thakur ee3443e0d6 [LLDB] Use llvm::APInt and llvm::APFloat in Scalar and RegisterValue
Eliminated ENABLE_128_BIT_SUPPORT and union ValueData from Scalar.cpp and use llvm::APInt and llvm::APFloat for all integer and floating point types. Also used Scalar in RegisterValue.cpp

Reviewers: jaydeep, clayborg, jasonmolenda, ovyalov, emaste
Subscribers: tberghammer, ovyalov, emaste, mohit.bhakkad, nitesh.jain, bhushan
Differential: http://reviews.llvm.org/D10919
llvm-svn: 245216
2015-08-17 12:05:31 +00:00
Jason Molenda a18f7071c2 A messy bit of cleanup: Move towards more descriptive names
for eh_frame and stabs register numberings.  This is not
complete but it's a step in the right direction.  It's almost
entirely mechanical.

lldb informally uses "gcc register numbering" to mean eh_frame.
Why?  Probably because there's a notorious bug with gcc on i386
darwin where the register numbers in eh_frame were incorrect.
In all other cases, eh_frame register numbering is identical to
dwarf.

lldb informally uses "gdb register numbering" to mean stabs.
There are no official definitions of stabs register numbers
for different architectures, so the implementations of gdb
and gcc are the de facto reference source.

There were some incorrect uses of these register number types
in lldb already.  I fixed the ones that I saw as I made
this change.

This commit changes all references to "gcc" and "gdb" register
numbers in lldb to "eh_frame" and "stabs" to make it clear 
what is actually being represented.

lldb cannot parse the stabs debug format, and given that no
one is using stabs any more, it is unlikely that it ever will.
A more comprehensive cleanup would remove the stabs register
numbers altogether - it's unnecessary cruft / complication to
all of our register structures.

In ProcessGDBRemote, when we get register definitions from
the gdb-remote stub, we expect to see "gcc:" (qRegisterInfo)
or "gcc_regnum" (qXfer:features:read: packet to get xml payload).
This patch changes ProcessGDBRemote to also accept "ehframe:"
and "ehframe_regnum" from these remotes.

I did not change GDBRemoteCommunicationServerLLGS or debugserver
to send these new packets.  I don't know what kind of interoperability
constraints we might be working under.  At some point in the future
we should transition to using the more descriptive names.

Throughout lldb we're still using enum names like "gcc_r0" and "gdb_r0",
for eh_frame and stabs register numberings.  These should be cleaned
up eventually too.

The sources link cleanly on macosx native with xcode build.  I
don't think we'll see problems on other platforms but please let
me know if I broke anyone.

llvm-svn: 245141
2015-08-15 01:21:01 +00:00
Greg Clayton 8b4edba9da Move all clang type system DWARF type parsing into ClangASTContext.cpp.
Another step towards isolating all language/AST specific code into the files to further abstract specific implementations of parsing types for a given language.

llvm-svn: 245090
2015-08-14 20:02:05 +00:00
Jaydeep Patil 831435042e [LLDB][MIPS] Handle false positives for MIPS hardware watchpoints
SUMMARY:
    Last 3bits of the watchpoint address are masked by the kernel. For example, n is 
    at 0x120010d00 and m is 0x120010d04. When a watchpoint is set at m, then watch 
    exception is generated even when n is read/written. To handle this case, instruction 
    at PC is emulated to find the base address of the load/store instruction. This address 
    is then appended to the description of the stop-info packet. Client then reads this 
    information to check whether the user has set a watchpoint on this address.
    
    Reviewers: jingham, clayborg
    Subscribers: nitesh.jain, mohit.bhakkad, sagar, bhushan and lldb-commits
    Differential Revision: http://reviews.llvm.org/D11672

llvm-svn: 244864
2015-08-13 03:44:09 +00:00
Enrico Granata 53f2a4aff3 Convert GetNumTemplateArguments() and GetTemplateArgument() to be instance functions on the CompilerType and the TypeSystem
llvm-svn: 244846
2015-08-13 00:24:24 +00:00
Tamas Berghammer ec3f92a5e2 Download symbol file for .oat files on android
On android .oat files (compiled java code) don't have symbol
information but on SDK 23+ it can be generated by the oatdump tool
(based on the dex information).

This CL adds logic to download this information and store it in the
module cache.

Differential revision: http://reviews.llvm.org/D11936

llvm-svn: 244738
2015-08-12 11:10:25 +00:00
Chaoren Lin 4ec3e13c91 Export snprintf to avoid linking error with liblldb on Windows.
Reviewers: zturner, ovyalov

Subscribers: lldb-commits

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

llvm-svn: 244710
2015-08-12 01:22:24 +00:00
Greg Clayton a1e5dc86a6 ClangASTType is now CompilerType.
This is more preparation for multiple different kinds of types from different compilers (clang, Pascal, Go, RenderScript, Swift, etc).

llvm-svn: 244689
2015-08-11 22:53:00 +00:00
Greg Clayton c6f0468937 Added missing files from checking regarding:
http://reviews.llvm.org/D8712

llvm-svn: 244681
2015-08-11 21:49:32 +00:00
Greg Clayton d8d4a57b37 First step in getting LLDB ready to support multiple different type systems.
This is the work done by Ryan Brown from http://reviews.llvm.org/D8712 that makes a TypeSystem class and abstracts types to be able to use a type system.

All tests pass on MacOSX and passed on linux the last time this was submitted. 

llvm-svn: 244679
2015-08-11 21:38:15 +00:00
Oleksiy Vyalov 9dcdd2ee03 Revert r244308 since it's introducing test regressions on Linux:
- TestLldbGdbServer.py both clang & gcc, i386 and x86_64
 - TestConstVariables.py gcc, i386 and x86_64
 - 112 failures clang, i386

llvm-svn: 244514
2015-08-10 21:49:50 +00:00
Jason Molenda 484900bd3b Feedback from Jim: Change the "optimized code" warning to be entirely
contained within Process so that we won't be duplicating the warning
message if other parts of the code want to issue the message.  Change
Process::PrintWarning to be a protected method - the public method
will be the PrintWarningOptimization et al.  Also, Have
Thread::FunctionOptimizationWarning shortcut out if the warnings
have been disabled so that we don't (potentially) compute parts of
the SymbolContext unnecessarily.

llvm-svn: 244436
2015-08-10 07:55:25 +00:00
Sagar Thakur d754890047 [LLDB][MIPS] Fix offsets of all register sets and add MSA regset and FRE=1 mode support
This change :

    - Fixes offsets of all register sets for Mips.
    - Adds MSA register set and FRE=1 mode support for FP register set.
    - Separates lldb register numbers and register infos of freebsd/mips64 from linux/mips64.
    - Re-orders the register numbers of all kinds for mips to be consistent with freebsd order of register numbers.
    - Eliminates ENABLE_128_BIT_SUPPORT and union ValueData from Scalar.cpp and uses llvm::APInt and llvm::APFloat for all integer and floating point types.

Reviewers : emaste, jaydeep, clayborg
Subscribers : emaste, mohit.bhakkad, nitesh.jain, bhushan
Differential : http://reviews.llvm.org/D10919

llvm-svn: 244308
2015-08-07 06:39:38 +00:00
Richard Smith 4cb29abcdb Update lldb's ExternalASTSources to match Clang r244161.
llvm-svn: 244194
2015-08-06 05:13:41 +00:00
Jason Molenda ef7d641617 Second part of indicating when the user is stopped in optimized code.
The first part was in r243508 -- the extent of the UI changes in that
patchset was to add "[opt]" to the frame-format when a stack frame was
built with optimized code.

In this change, when a stack frame built with optimization is selected,
a message will be printed to the async output channel --

opt1.c was compiled with optimization - stepping may behave oddly; variables may not be available.

The warning will be only be printed once per source file in a debug session.
These warnings may be disabled by

settings set target.process.optimization-warnings false

Internally, a new Process::PrintWarning() method has been added for
warnings that we want to print only once to the user.  It takes a type
of warning (currently only eWarningsOptimization) and an object
pointer (CompileUnit*) - the warning will only be printed once for a
given object pointer value.

This is a bit of a prototype of this change -  I think we will be
tweaking it more in the future.  But I wanted to land this and see
how it goes.  Advanced users will find these warnings unnecessary
noise and will quickly disable them - but anyone who maintains a 
debugger knows that debugging optimized code, without realizing it,
is a constant source of confusion and frustation for more typical
debugger users.  

I imagine there will be more of these "warn once per whatever" style
warnings that we will want to add in the future and we'll need to 
come up with a better way for enabling/disabling them.  But I'm not
srue what form that warning settings should take and I didn't want
to code up something that we regret later, so for now I just added
another process setting for this one warning.

<rdar://problem/19281172> 

llvm-svn: 244190
2015-08-06 03:27:10 +00:00
Pavel Labath 7fb4e2d4ac Fix Clang-tidy misc-use-override warnings in some files in include/lldb/Core, unify closing inclusion guards
Patch by Eugene Zelenko

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

llvm-svn: 243738
2015-07-31 08:17:10 +00:00
Zachary Turner 2c1f46dcc6 Convert the ScriptInterpreter system to a plugin-based one.
Previously embedded interpreters were handled as ad-hoc source
files compiled into source/Interpreter.  This made it hard to
disable a specific interpreter, or to add support for other
interpreters and allow the developer to choose which interpreter(s)
were enabled for a particular build.

This patch converts script interpreters over to a plugin-based system.
Script interpreters now live in source/Plugins/ScriptInterpreter, and
the canonical LLDB interpreter, ScriptInterpreterPython, is moved there
as well.

Any new code interfacing with the Python C API must live in this location
from here on out.  Additionally, generic code should never need to
reference or make assumptions about the presence of a specific interpreter
going forward.

Differential Revision: http://reviews.llvm.org/D11431
Reviewed By: Greg Clayton

llvm-svn: 243681
2015-07-30 20:28:07 +00:00
Oleksiy Vyalov abb5a35d05 Make DWARF at_comp_dir symbolic links configurable via plugin.symbol-file.dwarf.comp-dir-symlink-paths setting.
http://reviews.llvm.org/D11586

llvm-svn: 243580
2015-07-29 22:18:16 +00:00
Greg Clayton 0d5b0a8a78 Centralize where we update the source file contents in SourceManager::GetFile() in case APIs are called that don't update the source.
The following functions were the only functions that updates the source file:

SourceManager::File::DisplaySourceLines()
SourceManager::File::FindLinesMatchingRegex()    

But there we API calls that were using the SourceManager::File and asking it questions, like "is line 12 valid" and that might respond incorrectly if the source file had been updated.

<rdar://problem/21269402>

llvm-svn: 243551
2015-07-29 18:37:25 +00:00
Jim Ingham 9d1ccdaf7e Add a function to make a mutex-protected copy of a breakpoint site's
owners list, so the StopInfo machinery can get the list of owners without
some other thread being able to mess up the list by deleting/disabline one of its
locations in the process of doing so.

<rdar://problem/18685197>

llvm-svn: 243541
2015-07-29 17:51:36 +00:00
Jason Molenda 6ab659a922 First part of an attempt to indicate to the user when they are
debugging optimized code.  Adds new methods on Function/SBFunction
to query whether a given function is optimized.  Adds a new
function.is-optimized format entity and changes the default 
frame-format to append "[opt]" if the function was built with
optimization.

The only indication that a binary was built with optimization
that we have right now is the presence of the DW_AT_APPLE_optimized
attribute (DW_FORM_flag value 1) in the DW_TAG_compile_unit.
The absence of this flag may mean that the compile_unit was not
compiled with optimization, or it may mean that the producer 
does not generate this attribute.

Currently this only works for dSYM debugging.  When we create
the CompileUnit with dwarf-in-.o-file debugging we don't have
the attribute value yet so it's not set.  I need to find the
flag value when we do start to read the .o file DWARF and 
set the CompileUnit's status at that point - but haven't 
done it yet.

I'm also going to add a mechanism for issuing warnings to users
such that they're only issued once in a debug session and 
there is away for users to suppress these warnings altogether
via .lldbinit file settings.  But I want to get this changeset
committed now that it's at a useful state.

<rdar://problem/19281172> 

llvm-svn: 243508
2015-07-29 00:42:47 +00:00
Enrico Granata 2646469671 Cleanup a few stale comments in FormattersContainer.h
llvm-svn: 243483
2015-07-28 21:28:33 +00:00
Enrico Granata 2e9f29932d Second attempt at the fix for the recursion in ValueObjectChild::CanUpdateWithInvalidExecutionContext()
This one should prevent the previous issues, and be the one true fix for rdar://21949558

llvm-svn: 243367
2015-07-28 01:45:23 +00:00
Chaoren Lin 4630de80c5 Deprecate `SBValue::TypeIsPointerType`.
Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 243333
2015-07-27 21:51:56 +00:00
Ying Chen f1dfb4d1eb Fix Windows buildbot failure after rev 243301
Summary:
- Visual Studio doesn't support "list initialization inside member initializer list"
- Call inner struct constructor explicitly

Reviewers:
enrico
Subscribers:
lldb-commits

llvm-svn: 243332
2015-07-27 21:47:14 +00:00
Enrico Granata c1b7c09ac4 Add a more tweakable way for ValueObjectPrinter to control pointer expansion. NFC.
llvm-svn: 243301
2015-07-27 18:34:14 +00:00
Greg Clayton 88c05f54a0 Use double-checked locking to avoid locking the Module mutex if we don't need to. This avoid a deadlock we were seeing in Xcode.
<rdar://problem/21512067>

llvm-svn: 243180
2015-07-24 23:38:01 +00:00
Zachary Turner fbf8dad8eb Some fixes to get LLDB compiling with MSVC 2015.
llvm-svn: 243174
2015-07-24 22:32:22 +00:00
Siva Chandra d26eb907bc Add option eTypeOptionHideEmptyAggregates.
Summary:
For certain data structures, when the synthetic child provider returns
zero children, a summary like "Empty instance of <typename>" could be
more appropriate than something like "size=0 {}". This new option helps
hide the trailing "{}".

This is also exposed with a -h option for the command "type summary add".

Reviewers: granata.enrico

Subscribers: lldb-commits

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

llvm-svn: 243166
2015-07-24 21:30:58 +00:00
Pavel Labath f8b5874b63 Revert "Fix an issue where LLDB would run out of stack space ..."
This commit introduced an infinite recursion in
ValueObjectChild::CanUpdateWithInvalidExecutionContext (because FollowParentChain also considers
the current object), which broke nearly all the tests. Ignoring the current object removes the
recursion, but two tests still time out (TestDataFormatterLibcxxList.py and
TestValueObjectRecursion.py) for some reason. Reverting for now.

llvm-svn: 243102
2015-07-24 09:52:25 +00:00
Enrico Granata 636cd262d6 Fix an issue where LLDB would run out of stack space trying to decide if a deeply nested child can be updated in the face of an invalid execution context
The issue is that a child can't really ask the root object, since this decision could actually hinge on whether a dynamic and/or synthetic value is present
To do this, make values vote lazily for whether they are willing to allow this, so that we can navigate up the chain without recursively invoking ourselves

Tentative fix for rdar://21949558

llvm-svn: 243077
2015-07-24 00:57:19 +00:00
Bruce Mitchener 8a67bf7298 Add UNUSED_IF_ASSERT_DISABLED and apply it.
Summary:
This replaces (void)x; usages where they x was subsequently
involved in an assertion with this macro to make the
intent more clear.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 243074
2015-07-24 00:23:29 +00:00
Enrico Granata fe563d5573 Several improvements to the Either<T,U> type
llvm-svn: 243053
2015-07-23 22:17:39 +00:00
Jim Ingham 9b03fa0c69 Most thread plans don't handle eStopReasonInstrumentation stop reasons,
but that wasn't added to the list of reasons they don't explain.  That
would mean we keep stepping after hitting the AsanDie breakpoint rather
than stopping when the Asan event occurred.

<rdar://problem/21925479>

llvm-svn: 243035
2015-07-23 19:55:02 +00:00
Pavel Labath cb213b3831 Fix warnings found by -Wextra-semi
patch by Eugene Zelenko.

llvm-svn: 242875
2015-07-22 08:12:01 +00:00
Pavel Labath c2f33f6754 Make stream::operator<< take "const" void *
Summary:
This enables us to avoid casts to "void *" in some cases and avoids a couple of "casts off const
qualifiers" warnings.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 242874
2015-07-22 07:58:17 +00:00
Enrico Granata ccc025b9fe Add an Either<T,U> type to lldb_utility which represents a type-safe payload of either one type or another, à la Haskell
llvm-svn: 242867
2015-07-22 02:06:37 +00:00
Bruce Mitchener e171da5cb7 Fix typos.
Summary: Fix a bunch of typos.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 242856
2015-07-22 00:16:02 +00:00
Dawn Perchik 23b1decbe7 Add support for specifying a language to use when parsing breakpoints.
Target and breakpoints options were added:
    breakpoint set --language lang --name func
    settings set target.language pascal
These specify the Language to use when interpreting the breakpoint's
expression (note: currently only implemented for breakpoints on
identifiers).  If the breakpoint language is not set, the target.language
setting is used.
This support is required by Pascal, for example, to set breakpoint at 'ns.foo'
for function 'foo' in namespace 'ns'.
Tests on the language were also added to Module::PrepareForFunctionNameLookup
for efficiency.

Reviewed by: clayborg
Subscribers: jingham, lldb-commits
Differential Revision: http://reviews.llvm.org/D11119

llvm-svn: 242844
2015-07-21 22:05:07 +00:00
Pavel Labath 19cbe96a45 [NativeProcessLinux] Integrate MainLoop
Summary:
This commit integrates MainLoop into NativeProcessLinux. By registering a SIGCHLD handler with
the llgs main loop, we can get rid of the special monitor thread in NPL, which saves as a lot of
thread ping-pong when responding to client requests (e.g. qThreadInfo processing time has been
reduced by about 40%). It also makes the code simpler, IMHO.

Reviewers: ovyalov, clayborg, tberghammer, chaoren

Subscribers: lldb-commits

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

This is a resubmission of r242305 after it was reverted due to bad interactions with the stdio
thread.

llvm-svn: 242783
2015-07-21 13:20:32 +00:00
Pavel Labath 7c52f85322 Revert "Add Pipe::WriteWithTimeout method"
I have observed an increased flakyness in the buildbots. I suspect something was relying on the
fact that Pipe::Write had an implicit timeout of 1s, which this commit has removed. Reverting
while I investigate.

llvm-svn: 242767
2015-07-21 11:04:52 +00:00
Pavel Labath d0bf831310 Fix incorrect documentation directives and some parameters
Differential Revision: http://reviews.llvm.org/D11379

Patch by Eugene Zelenko.

llvm-svn: 242765
2015-07-21 09:37:43 +00:00
Pavel Labath 9f0701f8ca Add Pipe::WriteWithTimeout method
Summary:
This commit adds a WriteWithTimeout method to time Pipe class, analogous to the existing
ReadWithTimeout(). It also changes the meaning of passing zero as a timeout value. Previously,
zero was used as an infinite timeout value. Now, the meaning of zero timeout to return the data
avaiable without sleeping (basically, a non-blocking operation). This makes the behaviour of Pipe
consistent with the Communication/Connection classes. For blocking operatios with infinite
timeout, I introduce a special constant for this purpose.

Reviewers: ovyalov, zturner

Subscribers: lldb-commits

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

llvm-svn: 242764
2015-07-21 09:23:34 +00:00
Oleksiy Vyalov 8a578bf5d7 Fix FileSpec::IsSymlink implementation.
http://reviews.llvm.org/D11356

llvm-svn: 242753
2015-07-21 01:28:22 +00:00
Greg Clayton 2e309076f2 More packet performance improvements.
Changed the "jthreads" key/value in the stop reply packets to be "jstopinfo". This JSON only contains threads with valid stop reasons and allows us not to have to ask about other threads via qThreadStopInfo when we are stepping. The "jstopinfo" only gets sent if there are more than one thread since the stop reply packet contains all the info needed for a single thread.

Added a Process::WillPublicStop() in case process subclasses want to do any extra gathering for public stops. For ProcessGDBRemote, we end up sending a jThreadsInfo packet to gather all expedited registers, expedited memory and MacOSX queue information. We only do this for public stops to minimize the packets we send when we have multiple private stops. Multiple private stops happen when a source level single step, step into or step out run the process multiple times while implementing the stepping, and none of these private stops make it out to the UI via notifications because they are private stops. 

llvm-svn: 242593
2015-07-17 23:42:28 +00:00
Tamas Berghammer 022622f1d4 Improve conditional opcode handling in emulation based unwinding
Don't chane the CFI information when a conditional instruction
is emulated (eg.: popeq {r0, pc}) because the CFI for the next
instruction should be the same as the CFI for the current instruction.

Differential revision: http://reviews.llvm.org/D11258

llvm-svn: 242519
2015-07-17 11:44:14 +00:00
Pavel Labath f3898c30e6 [MainLoop] Fix assertion failure
Upon connection termination the waitable handle of an IOObject gets reset to an invalid handle.
This caused a problem since we used the object->GetWaitableHandle as a key to the set of
registered events. The fix is to use something more immutable as a key: we make a copy of the
original waitable handle, instead of holding onto the IOObject.

llvm-svn: 242515
2015-07-17 10:08:38 +00:00
Enrico Granata d07f7550a9 Add StringPrinter support for printing a std::string with embedded NUL bytes
llvm-svn: 242496
2015-07-17 01:03:59 +00:00
Pavel Labath 5abe726911 Revert "[NativeProcessLinux] Integrate MainLoop"
This seems to be causing major slowdows on the android buildbot. Reverting while I investigate.

llvm-svn: 242391
2015-07-16 08:45:03 +00:00
Jaydeep Patil 501a781998 [LLDB][MIPS] Detect MIPS application specific extensions like micromips
SUMMARY:
    The patch detects MIPS application specific extensions (ASE) like micromips by reading 
    ELF header.e_flags and SHT_MIPS_ABIFLAGS section. MIPS triple does not contain ASE 
    information like micromips, mips16, DSP, MSA etc. These can be read from header.e_flags 
    or SHT_MIPS_ABIFLAGS section.
    
    Reviewers: clayborg
    Subscribers: mohit.bhakkad, sagar, lldb-commits
    Differential Revision: http://reviews.llvm.org/D11133

llvm-svn: 242381
2015-07-16 03:51:55 +00:00
Siva Chandra f8877efc8b Add a class ValueObjectConstResultCast.
Summary:
Other changes around the main change include:

1. Add a method Cast to ValueObjectConstResult, ValueObjectConstResultImpl
and ValueObjectConstResultChild.

2. Add an argument |live_address| of type lldb::addr_t to the constructor
of ValueObjectConstResultChild. This is passed on to the backing
ValueObjectConstResultImpl object constructor so that the address of the
child value can be calculated properly.

Reviewers: granata.enrico, clayborg

Subscribers: lldb-commits

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

llvm-svn: 242374
2015-07-16 01:47:12 +00:00
Pavel Labath 827965c33c [NativeProcessLinux] Integrate MainLoop
Summary:
This commit integrates MainLoop into NativeProcessLinux. By registering a SIGCHLD handler with
the llgs main loop, we can get rid of the special monitor thread in NPL, which saves as a lot of
thread ping-pong when responding to client requests (e.g. qThreadInfo processing time has been
reduced by about 40%). It also makes the code simpler, IMHO.

Reviewers: ovyalov, clayborg, tberghammer, chaoren

Subscribers: lldb-commits

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

llvm-svn: 242305
2015-07-15 17:20:01 +00:00
Dawn Perchik 4154ad467b Cleanup; remove trailing spaces.
llvm-svn: 242214
2015-07-14 22:12:43 +00:00
Ewan Crawford 90ff791141 Expression evaluation, a new ThreadPlanCallFunctionUsingABI for executing a function call on target via register manipulation
For Hexagon we want to be able to call functions during debugging, however currently lldb only supports this when there is JIT support. 
Although emulation using IR interpretation is an alternative, it is currently limited in that it can't make function calls.

In this patch we have extended the IR interpreter so that it can execute a function call on the target using register manipulation. 
To do this we need to handle the Call IR instruction, passing arguments to a new thread plan and collecting any return values to pass back into the IR interpreter. 

The new thread plan is needed to call an alternative ABI interface of "ABI::PerpareTrivialCall()", allowing more detailed information about arguments and return values.

Reviewers: jingham, spyffe

Subscribers: emaste, lldb-commits, ted, ADodds, deepak2427

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

llvm-svn: 242137
2015-07-14 10:56:58 +00:00
Kate Stone ea671fbdff Fixed line wrapping for the "long help" content in LLDB commands. Content is now dynamically wrapped for the column width of the current terminal. Lines that begin with whitespace will be indented identically on subsequent lines to maintain formatting.
Existing commands supplying this type of help content have been reworked to take advantage of the changes.  In addition to formatting changes, content was changes for accuracy and clarity purposes.
    
<rdar://problem/21269977>

llvm-svn: 242122
2015-07-14 05:48:36 +00:00
Chaoren Lin 98d0a4b39a Refactor Unix signals.
Summary:
- Consolidate Unix signals selection in UnixSignals.
- Make Unix signals available from platform.
- Add jSignalsInfo packet to retrieve Unix signals from remote platform.
- Get a copy of the platform signal for each remote process.
- Update SB API for signals.
- Update signal utility in test suite.

Reviewers: ovyalov, clayborg

Subscribers: chaoren, jingham, labath, emaste, tberghammer, lldb-commits

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

llvm-svn: 242101
2015-07-14 01:09:28 +00:00
Adrian McCarthy 6c40c5e031 Fix Windows build break related to MainLoop.
llvm-svn: 242079
2015-07-13 22:35:44 +00:00
Pavel Labath 77dc9569c6 Introduce a MainLoop class and switch llgs to use it
Summary:
This is the first part of our effort to make llgs single threaded. Currently, llgs consists of
about three threads and the synchronisation between them is a major source of latency when
debugging linux and android applications.

In order to be able to go single threaded, we must have the ability to listen for events from
multiple sources (primarily, client commands coming over the network and debug events from the
inferior) and perform necessary actions. For this reason I introduce the concept of a MainLoop.
A main loop has the ability to register callback's which will be invoked upon receipt of certain
events. MainLoopPosix has the ability to listen for file descriptors and signals.

For the moment, I have merely made the GDBRemoteCommunicationServerLLGS class use MainLoop
instead of waiting on the network socket directly, but the other threads still remain. In the
followup patches I indend to migrate NativeProcessLinux to this class and remove the remaining
threads.

Reviewers: ovyalov, clayborg, amccarth, zturner, emaste

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 242018
2015-07-13 10:44:55 +00:00
Jason Molenda 20ee21bde6 Add a another packet to the gdb-remote protocol,
jGetLoadedDynamicLibrariesInfos.  This packet is similar to
qXfer:libraries:read except that lldb supplies the number of solibs
that should be reported about, and the start address for the list
of them.  At the initial process launch we'll read the full list
of solibs linked by the process -- at this point we could be using
qXfer:libraries:read -- but on subsequence solib-loaded notifications,
we'll be fetching a smaller number of solibs, often only one or two.

A typical Mac/iOS GUI app may have a couple hundred different 
solibs loaded  - doing all of the loads via memory reads takes 
a couple of megabytes of traffic between lldb and debugserver.
Having debugserver summarize the load addresses of all the solibs
and sending it in JSON requires a couple of hundred kilobytes
of traffic.  It's a significant performance improvement when 
communicating over a slower channel.

This patch leaves all of the logic for loading the libraries
in DynamicLoaderMacOSXDYLD -- it only call over ot ProcesGDBRemote
to get the JSON result.

If the jGetLoadedDynamicLibrariesInfos packet is not implemented,
the normal technique of using memory read packets to get all of
the details from the target will be used.

<rdar://problem/21007465>

llvm-svn: 241964
2015-07-10 23:15:22 +00:00
Pavel Labath d5b310f2a3 Avoid going through Platform when creating a NativeProcessProtocol instance
Summary:
This commit avoids the Platform instance when spawning or attaching to a process in lldb-server.
Instead, I have the server call a (static) method of NativeProcessProtocol directly. The reason
for this is that I believe that NativeProcessProtocol should be decoupled from the Platform
(after all, it always knows which platform it is running on, unlike the rest of lldb).
Additionally, the kind of platform actions a NativeProcessProtocol instance is likely to differ
greatly from the platform actions of the lldb client, so I think the separation makes sense.

After this, the only dependency NativeProcessLinux has on PlatformLinux is the ResolveExecutable
method, which needs additional refactoring.

This is a resubmit of r241672, after it was reverted due to build failueres on non-linux
platforms.

Reviewers: ovyalov, clayborg

Subscribers: lldb-commits

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

llvm-svn: 241796
2015-07-09 11:51:11 +00:00
Greg Clayton ddaf6a7259 Make many mangled functions that might demangle a name be allowed to specify a language to use in order to soon support Pascal and Java demangling. Dawn Perchik will take care of making this so.
llvm-svn: 241751
2015-07-08 22:32:23 +00:00
Sean Callanan c307c27035 Revert r241672, which breaks the OS X build by introducing a dependency on
platform-specific symbols that are not implemented on OS X.

The build error that caused this is

Undefined symbols for architecture x86_64:
  "lldb_private::NativeProcessProtocol::Attach(unsigned long long, lldb_private::NativeProcessProtocol::NativeDelegate&, std::__1::shared_ptr<lldb_private::NativeProcessProtocol>&)", referenced from:
      lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::AttachToProcess(unsigned long long) in liblldb-core.a(GDBRemoteCommunicationServerLLGS.o)
  "lldb_private::NativeProcessProtocol::Launch(lldb_private::ProcessLaunchInfo&, lldb_private::NativeProcessProtocol::NativeDelegate&, std::__1::shared_ptr<lldb_private::NativeProcessProtocol>&)", referenced from:
      lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::LaunchProcess() in liblldb-core.a(GDBRemoteCommunicationServerLLGS.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

llvm-svn: 241688
2015-07-08 16:33:46 +00:00
Pavel Labath 235c8405eb Avoid going through Platform when creating a NativeProcessProtocol instance
Summary:
This commit avoids the Platform instance when spawning or attaching to a process in lldb-server.
Instead, I have the server call a (static) method of NativeProcessProtocol directly. The reason
for this is that I believe that NativeProcessProtocol should be decoupled from the Platform
(after all, it always knows which platform it is running on, unlike the rest of lldb).
Additionally, the kind of platform actions a NativeProcessProtocol instance is likely to differ
greatly from the platform actions of the lldb client, so I think the separation makes sense.

After this, the only dependency NativeProcessLinux has on PlatformLinux is the ResolveExecutable
method, which needs additional refactoring.

Reviewers: ovyalov, clayborg

Subscribers: lldb-commits

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

llvm-svn: 241672
2015-07-08 09:08:53 +00:00
Jim Ingham 763b2b26a0 Add a version of SBTarget::EvaluateExpression that doesn't require
an options (and makes an appropriate defaulted option for you.)

<rdar://problem/20639202>

llvm-svn: 241632
2015-07-07 22:12:17 +00:00
Pavel Labath f805e1905c Fix cmake build after recent JSON changes
I have moved StringExtractor.h into the include/ folder so that it can be properly included by
everyone.

llvm-svn: 241572
2015-07-07 10:08:41 +00:00
Enrico Granata d529d04fd7 Add a summary for vector types
The summary is - quite simply - a one-line printout of the vector elements

We still need synthetic children:
a) as a source of the elements to print in the summary
b) for graphical IDEs that display structure regardless of the summary settings

rdar://5429347

llvm-svn: 241531
2015-07-07 00:20:57 +00:00
Greg Clayton 98424c4460 Make the "lldb/Utility/JSON.h" able to parse JSON into tokens with the new JSONParser class.
Change over existing code to use this new parser so StructuredData can use the tokenizer to parse JSON instead of doing it manually.

This allowed us to easily parse JSON into JSON* objects as well as into StructuredData.

llvm-svn: 241522
2015-07-06 23:40:40 +00:00
Enrico Granata c1f705c229 Add a GetDisplayName() API to SBFrame, SBFunction and SBSymbol
This API is currently a no-op (in the sense that it has the same behavior as the already existing GetName()), but is meant long-term to provide a best-for-visualization version of the name of a function

It is still not hooked up to the command line 'bt' command, nor to the 'gui' mode, but I do have ideas on how to make that work going forward

rdar://21203242

llvm-svn: 241482
2015-07-06 18:28:46 +00:00
Tamas Berghammer 623652a0fd Improve DWARF CFI CIE parsing and remove duplicated code
Previously we handled only a few opcode DWARF CFI opcode when we
were parsing the CIE. With this change we use mostly the same code
what we use for parsing the PDE which cover more opcode.

Differential revision: http://reviews.llvm.org/D10866

llvm-svn: 241332
2015-07-03 09:30:17 +00:00
Enrico Granata d4cb1dddeb When I introduced hard-coded formatters, I made them non-cacheable
This is because - in theory - the formatter could match on not just the type, but also other properties of a ValueObject, so a per-type caching would not be a good thing
On the other hand, that is not always true - sometimes the matching truly is per-type

So, introduce a non-cacheable attribute on formatters that decides whether a formatter should or should not be cached. That way, the few formatters that don't want themselves cached can do so, but most formatters (including most hard-coded ones) can cache themselves just fine

llvm-svn: 241184
2015-07-01 20:06:40 +00:00
Dawn Perchik 53f34c8736 Rename ClangUserExpression members to avoid confusion with language.
The new names clarify that the members have to do with the execution
context and not the language.  For example, m_cplusplus was renamed to
m_in_cplusplus_method.

llvm-svn: 241132
2015-07-01 00:54:02 +00:00
Mohit K. Bhakkad e0d8c422a0 [LLDB][MIPS] Getting correct flags for MIPS
Patch by Nitesh Jain

Reviewers: clayborg, ovyalov, emaste.
Subscribers: jaydeep, bhushan, dsanders, mohit.bhakkad, sagar, labath, tberghammer, lldb-commits.
Differential Revision: http://reviews.llvm.org/D10685

llvm-svn: 241045
2015-06-30 06:29:12 +00:00
Chaoren Lin 0246b6ff2e Rewrite FileSpec::EnumerateDirectory to avoid code duplication.
Reviewers: clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 240983
2015-06-29 19:07:35 +00:00
Greg Clayton db9875f1b8 Fix buildbot failures for:
http://lab.llvm.org:8011/builders/lldb-x86-win7-msvc/builds/6152
http://lab.llvm.org:8011/builders/lldb-x86-windows-msvc/builds/7422

llvm-svn: 240979
2015-06-29 18:42:02 +00:00
Greg Clayton 58c65f0243 Avoid a recursive function call that could run LLDB out of file descriptors in FileSystem::DeleteDirectory(...).
Fixes include:
- use FileSystem::Unlink() instead of a direct call to ::unlink(...) when deleting files when iterating through the current directory
- save directories from current directory in a list and iterate through those _after_ the current directory has been iterated
- Use new FileSpec::ForEachItemInDirectory() instead of manually iterating across directories with opendir()/readdir()/closedir()

We should switch all code over to using FileSpec::ForEachItemInDirectory(...) in the near future and get rid of FileSpec::EnumerateDirectory().

This is a follow up patch to:

http://reviews.llvm.org/D10787

llvm-svn: 240978
2015-06-29 18:29:00 +00:00
Pavel Labath 33b51e87e1 [linux] Use cmake to detect support process_vm_readv (bug #23918)
Summary:
Some old linux versions do not have process_vm_readv function defined. Even older versions do not
have even the __NR_process_vm_readv syscall number. We use cmake to detect these situations and
fallback appropriately: in the first case, we can issue the syscall manually, while it the latter
case, we need to drop fast memory read support completely.

Test Plan: linux test suite passes

Reviewers: ovyalov, Eugene.Zelenko

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 240927
2015-06-29 09:18:17 +00:00
Chaoren Lin ccc06b36c1 timegm in LibcGlue needs to be extern, not static.
Reviewers: vharron

Reviewed By: vharron

Subscribers: lldb-commits

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

llvm-svn: 240894
2015-06-27 23:11:32 +00:00
Greg Clayton 358cf1ea30 Resubmitting 240466 after fixing the linux test suite failures.
A few extras were fixed

- Symbol::GetAddress() now returns an Address object, not a reference. There were places where people were accessing the address of a symbol when the symbol's value wasn't an address symbol. On MacOSX, undefined symbols have a value zero and some places where using the symbol's address and getting an absolute address of zero (since an Address object with no section and an m_offset whose value isn't LLDB_INVALID_ADDRESS is considered an absolute address). So fixing this required some changes to make sure people were getting what they expected. 
- Since some places want to access the address as a reference, I added a few new functions to symbol:
    Address &Symbol::GetAddressRef();
    const Address &Symbol::GetAddressRef() const;

Linux test suite passes just fine now.

<rdar://problem/21494354>

llvm-svn: 240702
2015-06-25 21:46:34 +00:00
Dawn Perchik 1f93e86768 Add const qualifier to Mangled::GuessLanguage
llvm-svn: 240676
2015-06-25 19:14:34 +00:00
Dawn Perchik 6c506bdab2 Rename Mangled::GetLanguage to Mangled::GuessLanguage
The language can not be definitively determined from the mangling, so
this new name helps clarify that fact.  This addresses the concerns raised
in http://reviews.llvm.org/rL226962.
Reviewed by: clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D10723

llvm-svn: 240662
2015-06-25 17:45:53 +00:00
Oleksiy Vyalov 05f75e9ffb Add const versions of SBFrame::GetFunctionName and SBFrame::IsInlined.
http://reviews.llvm.org/D10711

llvm-svn: 240660
2015-06-25 17:41:41 +00:00
Oleksiy Vyalov 6345fe3eb3 Revert rL240435: "Mark SBFrame::GetFunctionName and SBFrame::IsInlined as const.".
llvm-svn: 240565
2015-06-24 18:35:36 +00:00
Ewan Crawford aa7eda7a9e Proper handling of QNonStop packet response.
Turn non-stop mode off if reply to QNonStop packet isn't an OK.

llvm-svn: 240546
2015-06-24 15:14:26 +00:00
Tamas Berghammer 44ff9ccede Improve instruction emulation based stack unwinding on ARM
* Add and fix the emulation of several instruction.
* Disable frame pointer usage on Android.
* Specify return address register for the unwind plan instead of explict
  tracking the value of RA.
* Replace prologue detection heuristics (unreliable in several cases)
  with a logic to follow the branch instructions and restore the CFI
  value based on them. The target address for a branch should have the
  same CFI as the source address (if they are in the same function).
* Handle symbols in ELF files where the symbol size is not specified
  with calcualting their size based on the next symbol (already done
  in MachO files).
* Fix architecture in FuncUnwinders with filling up the inforamtion
  missing from the object file with the architecture of the target.
* Add code to read register wehn the value is set to "IsSame" as it
  meanse the value of a register in the parent frame is the same as the
  value in the current frame.

Differential revision: http://reviews.llvm.org/D10447

llvm-svn: 240533
2015-06-24 11:27:32 +00:00
Greg Clayton 0b90be1c4f Implement the "qSymbol" packet in order to be able to read queue information in debugserver and return the info in the stop reply packets.
A "qSymbol::" is sent when shared libraries have been loaded by hooking into the Process::ModulesDidLoad() function from within ProcessGDBRemote. This function was made virtual so that the ProcessGDBRemote version is called, which then first calls the Process::ModulesDidLoad(), and then it queries for any symbol lookups that the remote GDB server might want to do.

This allows debugserver to request the "dispatch_queue_offsets" symbol so that it can read the queue name, queue kind and queue serial number and include this data as part of the stop reply packet. Previously each thread would have to do 3 memory reads in order to read the queue name.

This is part of reducing the number of packets that are sent between LLDB and the remote GDB server.

<rdar://problem/21494354>

llvm-svn: 240466
2015-06-23 21:27:50 +00:00
Jim Ingham 60c915e96a Fix the handling of the run lock in cases where you needed to run
a hand-called function from the private state thread.  The problem 
was that on the way out of the private state thread, we try to drop
the run lock.  That is appropriate for the main private state thread,
but not the secondary private state thread.  Only the thread that 
spawned them can know whether this is an appropriate thing to do or
not.

<rdar://problem/21375352>

llvm-svn: 240461
2015-06-23 21:02:45 +00:00
Dawn Perchik dc975670c1 Add support for displaying the language in the frame-format string.
Enable ${language} to be specified in the frame-format string to see
the current frame's compile unit language in "frame info".

Test Plan:
debug a C++ program, run to main, and run the lldb commands:
    settings set frame-format "frame lang=${language}\n"
    frame info
you should see:
    frame lang=c++
test case added in:
    ./dotest.py --executable lldb -f SettingsCommandTestCase.test_set_frame_format
Reviewers: clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D10561

llvm-svn: 240440
2015-06-23 18:35:31 +00:00
Oleksiy Vyalov a5d9c1d32f Mark SBFrame::GetFunctionName and SBFrame::IsInlined as const.
llvm-svn: 240435
2015-06-23 18:21:55 +00:00
Jaydeep Patil c60c94528c [LLDB][MIPS] MIPS32 branch emulation and single-stepping
SUMMARY:
    This patch implements
      1. Emulation of MIPS32 branch instructions
      2. Enable single-stepping for MIPS32 instructions
      3. Correction in emulation of MIPS64 branch instructions with delay slot
      4. Adjust breakpoint address when breakpoint is hit in a forbidden slot of compact branch instruction
    
    Reviewers: clayborg
    Subscribers: mohit.bhakkad, sagar, bhushan, lldb-commits, emaste, nitesh.jain
    Differential Revision: http://reviews.llvm.org/D10596

llvm-svn: 240373
2015-06-23 03:37:08 +00:00
Chaoren Lin 7a30608026 Revert "Reduced packet counts to the remote GDB server where possible."
This reverts commit 0cc0745ea9c68d7fdcadc9904cee3f13c96dae60.

Due to breakage on Linux build bot:

http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/3436

llvm-svn: 240371
2015-06-23 03:17:01 +00:00
Greg Clayton ffb2d44ab9 Reduced packet counts to the remote GDB server where possible.
We have been working on reducing the packet count that is sent between LLDB and the debugserver on MacOSX and iOS. Our approach to this was to reduce the packets required when debugging multiple threads. We currently make one qThreadStopInfoXXXX call (where XXXX is the thread ID in hex) per thread except the thread that stopped with a stop reply packet. In order to implement multiple thread infos in a single reply, we need to use structured data, which means JSON. The new jThreadsInfo packet will attempt to retrieve all thread infos in a single packet. The data is very similar to the stop reply packets, but packaged in JSON and uses JSON arrays where applicable. The JSON output looks like:


[
  { "tid":1580681,
    "metype":6,
    "medata":[2,0],
    "reason":"exception",
    "qaddr":140735118423168,
    "registers": {
      "0":"8000000000000000",
      "1":"0000000000000000",
      "2":"20fabf5fff7f0000",
      "3":"e8f8bf5fff7f0000",
      "4":"0100000000000000",
      "5":"d8f8bf5fff7f0000",
      "6":"b0f8bf5fff7f0000",
      "7":"20f4bf5fff7f0000",
      "8":"8000000000000000",
      "9":"61a8db78a61500db",
      "10":"3200000000000000",
      "11":"4602000000000000",
      "12":"0000000000000000",
      "13":"0000000000000000",
      "14":"0000000000000000",
      "15":"0000000000000000",
      "16":"960b000001000000",
      "17":"0202000000000000",
      "18":"2b00000000000000",
      "19":"0000000000000000",
      "20":"0000000000000000"},
    "memory":[
      {"address":140734799804592,"bytes":"c8f8bf5fff7f0000c9a59e8cff7f0000"},
      {"address":140734799804616,"bytes":"00000000000000000100000000000000"}
    ]
  }
]

It contains an array of dicitionaries with all of the key value pairs that are normally in the stop reply packet. Including the expedited registers. Notice that is also contains expedited memory in the "memory" key. Any values in this memory will get included in a new L1 cache in lldb_private::Process where if a memory read request is made and that memory request fits into one of the L1 memory cache blocks, it will use that memory data. If a memory request fails in the L1 cache, it will fall back to the L2 cache which is the same block sized caching we were using before these changes. This allows a process to expedite memory that you are likely to use and it reduces packet count. On MacOSX with debugserver, we expedite the frame pointer backchain for a thread (up to 256 entries) by reading 2 pointers worth of bytes at the frame pointer (for the previous FP and PC), and follow the backchain. Most backtraces on MacOSX and iOS now don't require us to read any memory!

We will try these packets out and if successful, we should port these to lldb-server in the near future. 

<rdar://problem/21494354>

llvm-svn: 240354
2015-06-22 23:12:45 +00:00
Tamas Berghammer 783bfc8caa Fetch object file load address if it isn't specified by the linker
Differential revision: http://reviews.llvm.org/D10490

llvm-svn: 240052
2015-06-18 20:43:56 +00:00
Pavel Labath f5c8132291 Fix misplaced comment
llvm-svn: 240032
2015-06-18 17:56:45 +00:00
Bruce Mitchener 58ef391f3e Fix a variety of typos.
No functional change.

llvm-svn: 239995
2015-06-18 05:27:05 +00:00
Dawn Perchik d0e87eb07e Fix enum LanguageType values and language string table lookups.
Summary:
* Fix enum LanguageType values so that they can be used as indexes
into array language_names and g_languages as assumed by
LanguageRuntime::GetNameForLanguageType,
Language::SetLanguageFromCString and Language::AsCString.
* Add DWARFCompileUnit::LanguageTypeFromDWARF to convert from DWARF
DW_LANG_* values to enum LanguageType values.

Reviewed By: clayborg, abidh
Differential Revision: http://reviews.llvm.org/D10484

llvm-svn: 239963
2015-06-17 22:30:24 +00:00
Pavel Labath df7c69952b [NativeProcessLinux] Use fast memory reads, if the system supports it
Summary:
Memory reads using the ptrace API need to be executed on a designated thread
and in 4-byte increments. The process_vm_read syscall has no such requirements
and it is about 50 times faster. This patch makes lldb-server use the faster
API if the target kernel supports it. Kernel support for this feature is
determined at runtime. Using process_vm_writev in the same manner is more
complicated since this syscall (unlike ptrace) respects page protection settings
and so it cannot be used to set a breakpoint, since code pages are typically
read-only. However, memory writes are not currently a performance bottleneck as
they happen much more rarely.

Test Plan: all tests continue to pass

Reviewers: ovyalov, vharron

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 239924
2015-06-17 18:38:49 +00:00
Enrico Granata 443844c474 Revert r239873 - I actually want to think some more about this
llvm-svn: 239874
2015-06-17 02:11:48 +00:00
Enrico Granata ca201238ae Fix an issue where the oneliner printing of variables would ignore custom formatting
Because vector types use their formats in special ways (i.e. children get generated based on them), this change by itself would cause a regression in printing vector types with some custom formats
Work around that issue by special casing vector types out of this format-passdown mode. I believe there is a more general feature to be designed in this space, but until I see more cases of interest, I am going to leave this as a special case

Fixes rdar://20810062

llvm-svn: 239873
2015-06-17 02:06:24 +00:00
Enrico Granata 55d36e2b83 Add a ThreadSafe adapter over llvm::DenseSet
llvm-svn: 239865
2015-06-16 23:20:12 +00:00
Chaoren Lin 372e9067a7 Rename `FileSpec::IsRelativeToCurrentWorkingDirectory` to `IsRelative`.
Summary:
`IsRelativeToCurrentWorkingDirectory` was misleading, because relative paths
are sometimes appended to other directories, not just the cwd. Plus, the new
name is shorter. Also added `IsAbsolute` for completeness.

Reviewers: clayborg, ovyalov

Reviewed By: ovyalov

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 239419
2015-06-09 17:54:27 +00:00
Pavel Labath c7c30eb528 Revert "Introduce a TypeSystem interface to support adding non-clang languages."
This seems to break expression evaluation on the linux build.

llvm-svn: 239366
2015-06-08 23:38:06 +00:00
Pavel Labath c33ae024a6 Introduce a TypeSystem interface to support adding non-clang languages.
Reviewers: clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D8712
Original Author: Ryan Brown <ribrdb@google.com>

llvm-svn: 239360
2015-06-08 22:27:10 +00:00
Ed Maste f6a1312f1b Improve OSType initialization in elf object file's arch_spec
Setting the OSType in the ArchSpec triple is needed to correctly setup
up the register context plugin. ArchSpec::SetArchitecture, for Mach-O
only, sets the OSType. For ELF it was left to the ObjectFileELF to fill
in the missing OSType.

This change moves the ObjectFileELF logic into ArchSpec.

A new optional 'os' parameter has been added to SetArchitecture.
For ELF, this value is the from the ELF header.e_ident[EI_OSABI].
The default value is 0 or ELFOSABI_NONE.

The real work of determining the OSType was done by the ObjectFileELF
helper function GetOsFromOSABI. This logic has been moved
SetArchitecture.

GetOsFromOSABI has been commented as being deprectated.  It is left in
to support asserts.

For ELF the vendor value returned from SetArchitecture should be
UnknownVendor.  An unneeded resetting in ObjectFileELF has been removed
and replaced with an assert.

This fixes a problem reading a core file on FreeBSD/ARM because the spec
triple was arm-unknown-unknown.

Patch by Tom Rix.

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

llvm-svn: 239148
2015-06-05 13:03:08 +00:00
Chaoren Lin 0c5a9c1476 Delegate path operations to FileSpec.
Summary:
- Added PrependPathComponent utility functions to FileSpec.
- Delegate path operations in ParseCompileUnit to FileSpec.
- Delegate path operations in ParseSupportFiles to FileSpec.

Reviewers: clayborg, vharron, ovyalov

Reviewed By: ovyalov

Subscribers: lldb-commits

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

llvm-svn: 239127
2015-06-05 00:28:06 +00:00
Bruce Mitchener bc46ec7da7 Fix doxygen warnings.
Summary:
Building the doxygen target presented some warnings which are now
addressed by this patch.

Test Plan: Ran doxygen build target and these warnings were no longer present.

Subscribers: lldb-commits

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

llvm-svn: 239055
2015-06-04 16:53:46 +00:00
Enrico Granata d595733617 Fix a bug where trying to Dump() a ValueObject would use the static/non-synthetic version of the value even if the ValueObject one actually called Dump() on turned out to be dynamic and/or synthetic
This was of course overridable by using DumpValueObjectOptions, but the default should be saner and the previous behavior made for a few fun investigations....

rdar://problem/21065149

llvm-svn: 238961
2015-06-03 20:43:54 +00:00
Sagar Thakur ce815e4588 [MIPS][lldb-server] Add 32-bit register context and read/write FP registers on mips64
- Added support for read/write FP registers in FR1 mode.
    - Added 32 bit register context for mips32.

Reviewers: clayborg, tberghammer, jaydeep
Subscribers: emaste, nitesh.jain, bhushan, mohit.bhakkad, lldb-commits
Differential Revision: http://reviews.llvm.org/D10029

llvm-svn: 238914
2015-06-03 10:14:24 +00:00
Greg Clayton 5a27195b1a Fix LLDB so that it can correctly track down dependent shared libraries that use @rpath.
<rdar://problem/8371885>

llvm-svn: 238886
2015-06-02 22:43:29 +00:00
Jim Ingham acbea8fb37 Fix up some comments to be more explicit. Remove some long-commented out code.
llvm-svn: 238862
2015-06-02 20:26:13 +00:00
Chaoren Lin 44145d79cc Working directory FileSpec should use remote path syntax to display correctly.
Summary: Depends on D9728.

Reviewers: ovyalov, zturner, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 238605
2015-05-29 19:52:37 +00:00
Chaoren Lin d3173f34e8 Refactor many file functions to use FileSpec over strings.
Summary:
This should solve the issue of sending denormalized paths over gdb-remote
if we stick to GetPath(false) in GDBRemoteCommunicationClient, and let the
server handle any denormalization.

Reviewers: ovyalov, zturner, vharron, clayborg

Reviewed By: clayborg

Subscribers: tberghammer, emaste, lldb-commits

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

llvm-svn: 238604
2015-05-29 19:52:29 +00:00
Chaoren Lin 0ef0027a0b Implement snprintf for MSVC with correct return value.
Reviewers: zturner

Subscribers: lldb-commits

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

llvm-svn: 238599
2015-05-29 19:34:57 +00:00
Pavel Labath c4e25c9648 Report inferior SIGSEGV as a signal instead of an exception on linux
Summary:
Previously, we reported inferior receiving SIGSEGV (or SIGILL, SIGFPE, SIGBUS) as an "exception"
to LLDB, presumably to match OSX behaviour. Beside the fact that we were basically lying to the
user, this was also causing problems with inferiors which handle SIGSEGV by themselves, since
LLDB was unable to reinject this signal back into the inferior.

This commit changes LLGS to report SIGSEGV as a signal. This has necessitated some changes in the
test-suite, which had previously used eStopReasonException to locate threads that crashed. Now it
uses platform-specific logic, which in the case of linux searches for eStopReasonSignaled with
signal=SIGSEGV.

I have also added the ability to set the description of StopInfoUnixSignal using the description
field of the gdb-remote packet. The linux stub uses this to display additional information about
the segfault (invalid address, address access protected, etc.).

Test Plan: All tests pass on linux and osx.

Reviewers: ovyalov, clayborg, emaste

Subscribers: emaste, lldb-commits

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

llvm-svn: 238549
2015-05-29 10:13:03 +00:00
Greg Clayton aeb3b8b1c0 Change ProcessEventData over to use a std::weak_ptr to a process intead of a std::shared_ptr. Anyone consuming events for a process should have the process around long enough to grab the event and anyone that holds onto an event for too long won't keep the process around.
llvm-svn: 238541
2015-05-29 03:20:37 +00:00
Chaoren Lin 7f9511409b Resubmitting r238459 and r238460 with fix for Linux.
llvm-svn: 238499
2015-05-28 21:19:31 +00:00
Ying Chen b6762734f0 Revert "Move inlined cxa_demangle.cpp to a separate file."
This reverts commit 8cb47a2140f3e93a34597fc9f11c8cd96130076d.

llvm-svn: 238497
2015-05-28 21:06:36 +00:00
Ying Chen fd6c7ad3ce Revert "Allow both MSVC and Itanium mangling schemes."
Cause build break.

This reverts commit 6d986061393f2863fec739e04412281148acc1f3.

llvm-svn: 238496
2015-05-28 21:06:33 +00:00
Sean Callanan 8ebc973133 If we see an external function in the symbols, make
it an extern "C" function instead of a C++ function
so that Clang doesn't emit a mangled function reference.

Also removed the hack in ClangExpressionDeclMap that
works around this.

llvm-svn: 238476
2015-05-28 20:07:44 +00:00
Zachary Turner 386aafa6e3 Remove unused #includes of ScriptInterpreterPython.h
llvm-svn: 238470
2015-05-28 19:57:03 +00:00
Chaoren Lin fd13d97dfd Allow both MSVC and Itanium mangling schemes.
Summary:
LLDB on Windows should now be able to demangle Linux/Android symbols.

Also updated CxaDemangle.cpp to be compatible with MSVC.

Depends on D9949, D9954, D10048.

Reviewers: zturner, emaste, clayborg

Reviewed By: clayborg

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 238460
2015-05-28 19:15:31 +00:00
Chaoren Lin b41354c9d0 Move inlined cxa_demangle.cpp to a separate file.
Summary: In preparation for some changes to make this compatible with MSVC.

Reviewers: emaste, zturner, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 238459
2015-05-28 19:15:15 +00:00
Chaoren Lin 1c614fedf9 Make FileSpec::Dump use FileSpec::GetPath(), not the other way around.
Summary:
Fix FileSpec::Dump() to output denormalized path.

See D9942 for previous discussions.

Reviewers: zturner

Reviewed By: zturner

Subscribers: lldb-commits

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

llvm-svn: 238440
2015-05-28 17:02:45 +00:00
Greg Clayton 424a5dbc73 Added a new API to SBFrame:
lldb::addr_t SBFrame::GetCFA();

This gets the CFA (call frame address) of the frame so it allows us to take an address that is on the stack and figure out which thread it comes from.

Also modified the heap.py module to be able to find out which variable in a frame's stack frame contains an address. This way when ptr_refs finds a match on the stack, it get then report which variable contains the pointer.

llvm-svn: 238393
2015-05-28 03:27:22 +00:00
Greg Clayton 4e1042e1bf Allow expresions to have unique expression prefixes:
expr_options = lldb.SBExpressionOptions()
expr_options.SetPrefix('''
struct Foo {
   int a;
   int b;
   int c;
}
'''
expr_result = frame.EvaluateExpression ("Foo foo = { 1, 2, 3}; foo", expr_options)

This fixed a current issue with ptr_refs, cstr_refs and malloc_info so that they can work. If expressions define their own types and then return expression results that use those types, those types get copied into the target's AST context so they persist and the expression results can be still printed and used in future expressions. Code was added to the expression parser to copy the context in which types are defined if they are used as the expression results. So in the case of types defined by expressions, they get defined in a lldb_expr function and that function and _all_ of its statements get copied. Many types of statements are not supported in this copy (array subscript, lambdas, etc) so this causes expressions to fail as they can't copy the result types. To work around this issue I have added code that allows expressions to specify an expression specific prefix. Then when you evaluate the expression you can pass the "expr_options" and have types that can be correctly copied out into the target. I added this as a way to work around an issue, but I also think it is nice to be allowed to specify an expression prefix that can be reused by many expressions, so this feature is very useful.

<rdar://problem/21130675>

llvm-svn: 238365
2015-05-27 22:32:39 +00:00
Tamas Berghammer 9c9ecce077 Make log options uniform betwwen lldb-platform and lldb-gdbserver
This change also get rid of an unused Debugger instance in
GDBRemoteCommunicationServerLLGS and the command interpreter from
lldb-platform what was used only for enabling logging.

Differential revision: http://reviews.llvm.org/D9876

llvm-svn: 238319
2015-05-27 13:34:04 +00:00
Colin Riley d6aa9bab21 Add a language log category.
Differential Revision: http://reviews.llvm.org/D9994

llvm-svn: 238314
2015-05-27 12:48:14 +00:00
Pavel Labath 4446487d71 Improve LLDB prompt handling
Summary:
There is an issue in lldb where the command prompt can appear at the wrong time. The partial fix
we have in for this is not working all the time and is introducing unnecessary delays. This
change does:
- Change Process:SyncIOHandler to use integer start id's for synchronization to avoid it being
  confused by quick start-stop cycles. I picked this up from a suggested patch by Greg to
  lldb-dev.
- coordinates printing of asynchronous text with the iohandlers. This is also based on a
  (different) Greg's patch, but I have added stronger synchronization to it to avoid races.

Together, these changes solve the prompt problem for me on linux (both with and without libedit).
I think they should behave similarly on Mac and FreeBSD and I think they will not make matters
worse for windows.

Test Plan: Prompt comes out alright. All tests still pass on linux.

Reviewers: clayborg, emaste, zturner

Subscribers: lldb-commits

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

llvm-svn: 238313
2015-05-27 12:40:32 +00:00
Enrico Granata e87764f247 Add support for custom commands to set flags on themselves
This works for Python commands defined via a class (implement get_flags on your class) and C++ plugin commands (which can call SBCommand::GetFlags()/SetFlags())

Flags allow features such as not letting the command run if there's no target, or if the process is not stopped, ...
Commands could always check for these things themselves, but having these accessible via flags makes custom commands more consistent with built-in ones

llvm-svn: 238286
2015-05-27 05:04:35 +00:00
Vince Harron 4c7b8c8476 Changed Flags::clang_type_resolve_state to unsigned for gcc
to work around a very noisy gcc warning

llvm-svn: 238283
2015-05-27 04:54:36 +00:00
Greg Clayton 2a2949cf47 Allow clients to get parsing errors and also fix the ApplePropertyList so it parses the structured data correctly.
llvm-svn: 238280
2015-05-27 03:24:17 +00:00
Greg Clayton ee8f994077 Modify the ApplePropertyList to be able to create StructuredData objects from the plist XML.
llvm-svn: 238260
2015-05-26 22:49:19 +00:00
Greg Clayton d04f0edad9 Added XML to the host layer.
We know have on API we should use for all XML within LLDB in XML.h. This API will be easy back the XML parsing by different libraries in case libxml2 doesn't work on all platforms. It also allows the only place for #ifdef ...XML... to be in XML.h and XML.cpp. The API is designed so it will still compile with or without XML support and there is a static function "bool XMLDocument::XMLEnabled()" that can be called to see if XML is currently supported. All APIs will return errors, false, or nothing when XML isn't enabled.

Converted all locations that used XML over to using the host XML implementation.

Added target.xml support to debugserver. Extended the XML register format to work for LLDB by including extra attributes and elements where needed. This allows the target.xml to replace the qRegisterInfo packets and allows us to fetch all register info in a single packet.

<rdar://problem/21090173>

llvm-svn: 238224
2015-05-26 18:00:51 +00:00
Vince Harron ebf2b2a10b revert files unintentionally checked in
llvm-svn: 238174
2015-05-26 03:10:41 +00:00
Vince Harron 218353d847 Print port number that lldb-server binds to in platform mode
If binding to port 0 is selected, the actual port is printed.

This improves the reliability of platform startup by ensuring that
a free port can be found.

TEST PLAN
./lldb-server platform --listen *:0

Listening for a connection from <port-number>...

Will appear on stdout (with other stuff potentially)

llvm-svn: 238173
2015-05-26 03:08:05 +00:00
Zachary Turner 279a2b7575 Implement PlatformWindows::GetEnvironment.
This fixes a couple of tests that rely on being able to get the
host's environment or spawn an inferior with specific arguments.

llvm-svn: 238042
2015-05-22 19:34:17 +00:00
Greg Clayton e034a04e4f Added a new command in ProcessGDBRemote that can figure out the performance characterisitics of your GDB remote server.
To addess this, attach to any GDB server and when stopped type:

(lldb) process plugin packet speed-test

The default will send a variety of packets with different amounts of data to send/receive and print the performance of each packet type:

Testing sending 1000 packets of various sizes:
qSpeedTest(send=0      , recv=0      ) in 0.057837000 sec for  17289.97 packets/sec (  0.057837 ms per packet) with standard deviation of   0.007705 ms
qSpeedTest(send=0      , recv=4      ) in 0.056162000 sec for  17805.63 packets/sec (  0.056162 ms per packet) with standard deviation of   0.004439 ms
qSpeedTest(send=0      , recv=8      ) in 0.057687000 sec for  17334.93 packets/sec (  0.057687 ms per packet) with standard deviation of   0.008135 ms
qSpeedTest(send=0      , recv=16     ) in 0.058547000 sec for  17080.29 packets/sec (  0.058547 ms per packet) with standard deviation of   0.005884 ms
qSpeedTest(send=0      , recv=32     ) in 0.058289000 sec for  17155.89 packets/sec (  0.058289 ms per packet) with standard deviation of   0.004057 ms
qSpeedTest(send=0      , recv=64     ) in 0.061324000 sec for  16306.83 packets/sec (  0.061324 ms per packet) with standard deviation of   0.010838 ms
qSpeedTest(send=0      , recv=128    ) in 0.065688000 sec for  15223.48 packets/sec (  0.065688 ms per packet) with standard deviation of   0.006997 ms
qSpeedTest(send=0      , recv=256    ) in 0.070621000 sec for  14160.09 packets/sec (  0.070621 ms per packet) with standard deviation of   0.006188 ms
qSpeedTest(send=0      , recv=512    ) in 0.086738000 sec for  11528.97 packets/sec (  0.086738 ms per packet) with standard deviation of   0.007867 ms
qSpeedTest(send=0      , recv=1024   ) in 0.146375000 sec for   6831.77 packets/sec (  0.146375 ms per packet) with standard deviation of   0.010313 ms
qSpeedTest(send=4      , recv=0      ) in 0.057807000 sec for  17298.94 packets/sec (  0.057807 ms per packet) with standard deviation of   0.009702 ms
....

It will then also use various sizes to receive 4MB of data from the GDB server and print out the stats:

Testing receiving 4.0MB of data using varying receive packet sizes:
qSpeedTest(send=0      , recv=32     ) 131072 packets needed to receive 4.0MB in 7.721290000 sec for 0.518048 MB/sec for  16975.40 packets/sec (  0.058909 ms per packet)
qSpeedTest(send=0      , recv=64     )  65536 packets needed to receive 4.0MB in 4.029236000 sec for 0.992744 MB/sec for  16265.12 packets/sec (  0.061481 ms per packet)
qSpeedTest(send=0      , recv=128    )  32768 packets needed to receive 4.0MB in 2.233854000 sec for 1.790627 MB/sec for  14668.82 packets/sec (  0.068172 ms per packet)
qSpeedTest(send=0      , recv=256    )  16384 packets needed to receive 4.0MB in 1.160024000 sec for 3.448204 MB/sec for  14123.84 packets/sec (  0.070802 ms per packet)
qSpeedTest(send=0      , recv=512    )   8192 packets needed to receive 4.0MB in 0.701603000 sec for 5.701230 MB/sec for  11676.12 packets/sec (  0.085645 ms per packet)
qSpeedTest(send=0      , recv=1024   )   4096 packets needed to receive 4.0MB in 0.596786000 sec for 6.702570 MB/sec for   6863.43 packets/sec (  0.145700 ms per packet)

There is a JSON mode so we can use this in the test suite to track GDB server performance for each platform:

(lldb) process plugin packet speed-test --json
{ "packet_speeds" : {
    "num_packets" : 1000,
    "results" : [
     {"send_size" :      0, "recv_size" :      0, "total_time_nsec" :     64516000, "standard_deviation_nsec" :     20566 },
     {"send_size" :      0, "recv_size" :      4, "total_time_nsec" :     59648000, "standard_deviation_nsec" :     10493 },
     {"send_size" :      0, "recv_size" :      8, "total_time_nsec" :     56894000, "standard_deviation_nsec" :      5480 },
     {"send_size" :      0, "recv_size" :     16, "total_time_nsec" :     59422000, "standard_deviation_nsec" :      6557 },
     {"send_size" :      0, "recv_size" :     32, "total_time_nsec" :     61159000, "standard_deviation_nsec" :     12384 },
     {"send_size" :      0, "recv_size" :     64, "total_time_nsec" :     61386000, "standard_deviation_nsec" :      9208 },
     {"send_size" :      0, "recv_size" :    128, "total_time_nsec" :     64768000, "standard_deviation_nsec" :      4737 },
     {"send_size" :      0, "recv_size" :    256, "total_time_nsec" :     71046000, "standard_deviation_nsec" :      5904 },
     {"send_size" :      0, "recv_size" :    512, "total_time_nsec" :     87233000, "standard_deviation_nsec" :      8967 },
     {"send_size" :      0, "recv_size" :   1024, "total_time_nsec" :    146629000, "standard_deviation_nsec" :      9526 },
     {"send_size" :      4, "recv_size" :      0, "total_time_nsec" :     57131000, "standard_deviation_nsec" :      7884 },
     {"send_size" :      4, "recv_size" :      4, "total_time_nsec" :     56772000, "standard_deviation_nsec" :      6064 },
     {"send_size" :      4, "recv_size" :      8, "total_time_nsec" :     57450000, "standard_deviation_nsec" :      6341 },
     {"send_size" :      4, "recv_size" :     16, "total_time_nsec" :     58279000, "standard_deviation_nsec" :      5998 },
     {"send_size" :      4, "recv_size" :     32, "total_time_nsec" :     59995000, "standard_deviation_nsec" :      6294 },
     {"send_size" :      4, "recv_size" :     64, "total_time_nsec" :     61632000, "standard_deviation_nsec" :      7838 },
     {"send_size" :      4, "recv_size" :    128, "total_time_nsec" :     66535000, "standard_deviation_nsec" :      8026 },
     {"send_size" :      4, "recv_size" :    256, "total_time_nsec" :     72754000, "standard_deviation_nsec" :      9519 },
     {"send_size" :      4, "recv_size" :    512, "total_time_nsec" :     87072000, "standard_deviation_nsec" :      9268 },
     {"send_size" :      4, "recv_size" :   1024, "total_time_nsec" :    147221000, "standard_deviation_nsec" :      9702 },
     {"send_size" :      8, "recv_size" :      0, "total_time_nsec" :     57900000, "standard_deviation_nsec" :      7356 },
     {"send_size" :      8, "recv_size" :      4, "total_time_nsec" :     58116000, "standard_deviation_nsec" :      7630 },
     {"send_size" :      8, "recv_size" :      8, "total_time_nsec" :     57745000, "standard_deviation_nsec" :      8541 },
     {"send_size" :      8, "recv_size" :     16, "total_time_nsec" :     59091000, "standard_deviation_nsec" :      7851 },
     {"send_size" :      8, "recv_size" :     32, "total_time_nsec" :     59943000, "standard_deviation_nsec" :      6761 },
     {"send_size" :      8, "recv_size" :     64, "total_time_nsec" :     62097000, "standard_deviation_nsec" :      8580 },
     {"send_size" :      8, "recv_size" :    128, "total_time_nsec" :     69942000, "standard_deviation_nsec" :     16645 },
     {"send_size" :      8, "recv_size" :    256, "total_time_nsec" :     72927000, "standard_deviation_nsec" :     11031 },
     {"send_size" :      8, "recv_size" :    512, "total_time_nsec" :     87221000, "standard_deviation_nsec" :      8002 },
     {"send_size" :      8, "recv_size" :   1024, "total_time_nsec" :    148696000, "standard_deviation_nsec" :     10383 },
     {"send_size" :     16, "recv_size" :      0, "total_time_nsec" :     59890000, "standard_deviation_nsec" :     15160 },
     {"send_size" :     16, "recv_size" :      4, "total_time_nsec" :     56664000, "standard_deviation_nsec" :      4650 },
     {"send_size" :     16, "recv_size" :      8, "total_time_nsec" :     57574000, "standard_deviation_nsec" :      7787 },
     {"send_size" :     16, "recv_size" :     16, "total_time_nsec" :     59312000, "standard_deviation_nsec" :      8104 },
     {"send_size" :     16, "recv_size" :     32, "total_time_nsec" :     59764000, "standard_deviation_nsec" :      7496 },
     {"send_size" :     16, "recv_size" :     64, "total_time_nsec" :     61644000, "standard_deviation_nsec" :      8331 },
     {"send_size" :     16, "recv_size" :    128, "total_time_nsec" :     66476000, "standard_deviation_nsec" :      9251 },
     {"send_size" :     16, "recv_size" :    256, "total_time_nsec" :     72386000, "standard_deviation_nsec" :      8627 },
     {"send_size" :     16, "recv_size" :    512, "total_time_nsec" :     87810000, "standard_deviation_nsec" :     12318 },
     {"send_size" :     16, "recv_size" :   1024, "total_time_nsec" :    146918000, "standard_deviation_nsec" :     11595 },
     {"send_size" :     32, "recv_size" :      0, "total_time_nsec" :     56493000, "standard_deviation_nsec" :      6577 },
     {"send_size" :     32, "recv_size" :      4, "total_time_nsec" :     57069000, "standard_deviation_nsec" :      5931 },
     {"send_size" :     32, "recv_size" :      8, "total_time_nsec" :     57563000, "standard_deviation_nsec" :      8157 },
     {"send_size" :     32, "recv_size" :     16, "total_time_nsec" :     59694000, "standard_deviation_nsec" :      6932 },
     {"send_size" :     32, "recv_size" :     32, "total_time_nsec" :     60852000, "standard_deviation_nsec" :      8010 },
     {"send_size" :     32, "recv_size" :     64, "total_time_nsec" :     61926000, "standard_deviation_nsec" :      8372 },
     {"send_size" :     32, "recv_size" :    128, "total_time_nsec" :     66734000, "standard_deviation_nsec" :      8047 },
     {"send_size" :     32, "recv_size" :    256, "total_time_nsec" :     72000000, "standard_deviation_nsec" :      8103 },
     {"send_size" :     32, "recv_size" :    512, "total_time_nsec" :     88268000, "standard_deviation_nsec" :     12289 },
     {"send_size" :     32, "recv_size" :   1024, "total_time_nsec" :    147946000, "standard_deviation_nsec" :     12122 },
     {"send_size" :     64, "recv_size" :      0, "total_time_nsec" :     58126000, "standard_deviation_nsec" :      5895 },
     {"send_size" :     64, "recv_size" :      4, "total_time_nsec" :     58927000, "standard_deviation_nsec" :      8933 },
     {"send_size" :     64, "recv_size" :      8, "total_time_nsec" :     58163000, "standard_deviation_nsec" :      6663 },
     {"send_size" :     64, "recv_size" :     16, "total_time_nsec" :     59901000, "standard_deviation_nsec" :      8340 },
     {"send_size" :     64, "recv_size" :     32, "total_time_nsec" :     60365000, "standard_deviation_nsec" :      6319 },
     {"send_size" :     64, "recv_size" :     64, "total_time_nsec" :     61776000, "standard_deviation_nsec" :      7461 },
     {"send_size" :     64, "recv_size" :    128, "total_time_nsec" :     66984000, "standard_deviation_nsec" :      6810 },
     {"send_size" :     64, "recv_size" :    256, "total_time_nsec" :     73913000, "standard_deviation_nsec" :      8826 },
     {"send_size" :     64, "recv_size" :    512, "total_time_nsec" :     88134000, "standard_deviation_nsec" :      8356 },
     {"send_size" :     64, "recv_size" :   1024, "total_time_nsec" :    146932000, "standard_deviation_nsec" :      7571 },
     {"send_size" :    128, "recv_size" :      0, "total_time_nsec" :     57616000, "standard_deviation_nsec" :      6158 },
     {"send_size" :    128, "recv_size" :      4, "total_time_nsec" :     59091000, "standard_deviation_nsec" :      7458 },
     {"send_size" :    128, "recv_size" :      8, "total_time_nsec" :     60263000, "standard_deviation_nsec" :     11999 },
     {"send_size" :    128, "recv_size" :     16, "total_time_nsec" :     59238000, "standard_deviation_nsec" :      6102 },
     {"send_size" :    128, "recv_size" :     32, "total_time_nsec" :     60783000, "standard_deviation_nsec" :      6244 },
     {"send_size" :    128, "recv_size" :     64, "total_time_nsec" :     62975000, "standard_deviation_nsec" :      8947 },
     {"send_size" :    128, "recv_size" :    128, "total_time_nsec" :     65742000, "standard_deviation_nsec" :      5907 },
     {"send_size" :    128, "recv_size" :    256, "total_time_nsec" :     72402000, "standard_deviation_nsec" :      6601 },
     {"send_size" :    128, "recv_size" :    512, "total_time_nsec" :     87457000, "standard_deviation_nsec" :      9004 },
     {"send_size" :    128, "recv_size" :   1024, "total_time_nsec" :    148412000, "standard_deviation_nsec" :     10532 },
     {"send_size" :    256, "recv_size" :      0, "total_time_nsec" :     58705000, "standard_deviation_nsec" :      7274 },
     {"send_size" :    256, "recv_size" :      4, "total_time_nsec" :     58818000, "standard_deviation_nsec" :      5453 },
     {"send_size" :    256, "recv_size" :      8, "total_time_nsec" :     59451000, "standard_deviation_nsec" :      6926 },
     {"send_size" :    256, "recv_size" :     16, "total_time_nsec" :     60237000, "standard_deviation_nsec" :      5781 },
     {"send_size" :    256, "recv_size" :     32, "total_time_nsec" :     61456000, "standard_deviation_nsec" :      5591 },
     {"send_size" :    256, "recv_size" :     64, "total_time_nsec" :     62615000, "standard_deviation_nsec" :      7588 },
     {"send_size" :    256, "recv_size" :    128, "total_time_nsec" :     68554000, "standard_deviation_nsec" :      7766 },
     {"send_size" :    256, "recv_size" :    256, "total_time_nsec" :     74557000, "standard_deviation_nsec" :      8748 },
     {"send_size" :    256, "recv_size" :    512, "total_time_nsec" :     87929000, "standard_deviation_nsec" :      9510 },
     {"send_size" :    256, "recv_size" :   1024, "total_time_nsec" :    148522000, "standard_deviation_nsec" :     11394 },
     {"send_size" :    512, "recv_size" :      0, "total_time_nsec" :     59697000, "standard_deviation_nsec" :      7825 },
     {"send_size" :    512, "recv_size" :      4, "total_time_nsec" :     59427000, "standard_deviation_nsec" :      5706 },
     {"send_size" :    512, "recv_size" :      8, "total_time_nsec" :     59538000, "standard_deviation_nsec" :      6863 },
     {"send_size" :    512, "recv_size" :     16, "total_time_nsec" :     61139000, "standard_deviation_nsec" :      7645 },
     {"send_size" :    512, "recv_size" :     32, "total_time_nsec" :     62203000, "standard_deviation_nsec" :      7985 },
     {"send_size" :    512, "recv_size" :     64, "total_time_nsec" :     62577000, "standard_deviation_nsec" :      8118 },
     {"send_size" :    512, "recv_size" :    128, "total_time_nsec" :     68722000, "standard_deviation_nsec" :     10581 },
     {"send_size" :    512, "recv_size" :    256, "total_time_nsec" :     74290000, "standard_deviation_nsec" :      8931 },
     {"send_size" :    512, "recv_size" :    512, "total_time_nsec" :     88635000, "standard_deviation_nsec" :      7771 },
     {"send_size" :    512, "recv_size" :   1024, "total_time_nsec" :    149589000, "standard_deviation_nsec" :     11456 },
     {"send_size" :   1024, "recv_size" :      0, "total_time_nsec" :     63243000, "standard_deviation_nsec" :      6331 },
     {"send_size" :   1024, "recv_size" :      4, "total_time_nsec" :     64381000, "standard_deviation_nsec" :      8372 },
     {"send_size" :   1024, "recv_size" :      8, "total_time_nsec" :     63481000, "standard_deviation_nsec" :      5608 },
     {"send_size" :   1024, "recv_size" :     16, "total_time_nsec" :     65549000, "standard_deviation_nsec" :      8826 },
     {"send_size" :   1024, "recv_size" :     32, "total_time_nsec" :     65485000, "standard_deviation_nsec" :      6822 },
     {"send_size" :   1024, "recv_size" :     64, "total_time_nsec" :     67125000, "standard_deviation_nsec" :      9829 },
     {"send_size" :   1024, "recv_size" :    128, "total_time_nsec" :     72680000, "standard_deviation_nsec" :      7641 },
     {"send_size" :   1024, "recv_size" :    256, "total_time_nsec" :     79206000, "standard_deviation_nsec" :      9854 },
     {"send_size" :   1024, "recv_size" :    512, "total_time_nsec" :     92418000, "standard_deviation_nsec" :      9107 },
     {"send_size" :   1024, "recv_size" :   1024, "total_time_nsec" :    152392000, "standard_deviation_nsec" :     11124 }
    ]
  },
  "download_speed" : {
    "byte_size" : 4194304,
    "results" : [
     {"send_size" :      0, "recv_size" :     32, "total_time_nsec" :   7735630000 },
     {"send_size" :      0, "recv_size" :     64, "total_time_nsec" :   3985169000 },
     {"send_size" :      0, "recv_size" :    128, "total_time_nsec" :   2128791000 },
     {"send_size" :      0, "recv_size" :    256, "total_time_nsec" :   1172077000 },
     {"send_size" :      0, "recv_size" :    512, "total_time_nsec" :    703833000 },
     {"send_size" :      0, "recv_size" :   1024, "total_time_nsec" :    594966000 }
    ]
  }
}

llvm-svn: 237953
2015-05-21 20:52:06 +00:00
Ilia K 38810f430b Fix handling of hijacked events in synchronous mode
Summary:
This patch includes the following changes:
* Fix Target::Launch to handle hijacked event in synchronous mode
* Improve MiStartupOptionsTestCase tests to expect *stopped (MI)
* Add SBProcess::GetStopEventForStopID
* Add ProcessModID::SetStopEventForLastNaturalStopID/GetStopEventForStopID
* Add const qualifier to ProcessModID::GetLastNaturalStopID
* Add SBProcess::GetStopEventForStopID
* Don't broadcast hijacked event in Target::Launch
* Add CMICmnLLDBDebugger::CheckIfNeedToRebroadcastStopEvent/RebroadcastStopEvent

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

Reviewers: zturner, jingham, clayborg, abidh

Reviewed By: clayborg

Subscribers: abidh, zturner, lldb-commits, clayborg, jingham

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

llvm-svn: 237781
2015-05-20 10:15:47 +00:00
Chaoren Lin 70e0cbb3ed Remove trailing slash from dumping directory FileSpec.
Reviewers: domipheus, ovyalov

Reviewed By: ovyalov

Subscribers: lldb-commits

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

llvm-svn: 237741
2015-05-19 23:11:58 +00:00
Enrico Granata 4518586234 A previous patch made it so that ValueObjects could update themselves even in the face of an invalid execution context (which was required for the dynamic and synthetic values of const objects)
It turns out, child values also need similar provisions

This patch simplifies things a bit allowing ValueObject subclasses to just declare whether they can accept an invalid context at update time, and letting the update machinery in the EvaluationPoint to the rest
Also, this lets ValueObjectChild proclaim that its parent chooses whether such blank-slate updates are possible

llvm-svn: 237714
2015-05-19 18:53:13 +00:00
Oleksiy Vyalov 09e9079d5c Use ADB pull to download modules from android target.
http://reviews.llvm.org/D9816

llvm-svn: 237640
2015-05-18 23:44:06 +00:00
Ilia K 055ad9beba Add --move-to-nearest-code / target.move-to-nearest-code options (attempt 2)
This patch initially was committed in r237460 but later it was reverted (r237479) due to 4 new failures:
* TestExitDuringStep.py
* TestNumThreads.py
* TestThreadExit.py
* TestThreadStates.py

This patch also fixes these tests.

llvm-svn: 237566
2015-05-18 13:41:01 +00:00
Enrico Granata bb642e5456 Constant result ValueObjects are - well - constant
And they also do not have a thread/frame attached to them

That makes dynamic and synthetic values attached to them impossible to update - which, among other things, makes it impossible to properly display persistent variables of types that could have such dynamic/persistent values

Fix this by making it so that a ValueObject can control its constantness (hint: dynamic and synthetic values cannot be constant) and whether it wants to let itself be updated when an invalid thread is around

llvm-svn: 237504
2015-05-16 01:27:00 +00:00
Vince Harron a66c695340 Reverting r237460 to fix test failures introduced on OSX & Linux
TestExitDuringStep.py
TestNumThreads.py
TestThreadExit.py
TestThreadStates.py

llvm-svn: 237479
2015-05-15 21:43:26 +00:00
Greg Clayton 1548440c45 OperatingSystem plug-ins need to avoid running code when fetching thread lists. This patch helps with that by making all SBValue objects that are fetched not try to do dynamic type resolution. Objective C can end up running code to fetch a list of all ISA pointers so we can tell when something is dynamic and this running code could cause the OS plug-in to continue the target.
This fix disabled dynamic types, fetches the new threads from the OS plug-in, then restores the setting.

<rdar://problem/20768407> 

llvm-svn: 237465
2015-05-15 18:40:24 +00:00
Ilia K d9f1a78aa0 Add --move-to-nearest-code / target.move-to-nearest-code options
Summary:
This option forces to only set a source line breakpoint when there is an exact-match

This patch includes the following commits:
# Add the -m/--exact-match option in "breakpoint set" command
## Add exact_match arg in BreakpointResolverFileLine ctor
## Add m_exact_match field in BreakpointResolverFileLine
## Add exact_match arg in BreakpointResolverFileRegex ctor
## Add m_exact_match field in BreakpointResolverFileRegex
## Add exact_match arg in Target::CreateSourceRegexBreakpoint
## Add exact_match arg in Target::CreateBreakpoint
## Add -m/--exact-match option in "breakpoint set" command
# Add target.exact-match option to skip BP if source line doesn't match
## Add target.exact-match global option
## Add Target::GetExactMatch
## Refactor Target::CreateSourceRegexBreakpoint to accept LazyBool exact_match (was bool)
## Refactor Target::CreateBreakpoint to accept LazyBool exact_match (was bool)
# Add target.exact-match test in SettingsCommandTestCase
# Add BreakpointOptionsTestCase tests to test --skip-prologue/--exact-match options
# Fix a few typos in lldbutil.check_breakpoint_result func
# Rename --exact-match/m_exact_match/exact_match/GetExactMatch to --move-to-nearest-code/m_move_to_nearest_code/move_to_nearest_code/GetMoveToNearestCode
# Add exact_match field in BreakpointResolverFileLine::GetDescription and BreakpointResolverFileRegex::GetDescription, for example:
was:
```
1: file = '/Users/IliaK/p/llvm/tools/lldb/test/functionalities/breakpoint/breakpoint_command/main.c', line = 12, locations = 1, resolved = 1, hit count = 2
  1.1: where = a.out`main + 20 at main.c:12, address = 0x0000000100000eb4, resolved, hit count = 2
```
now:
```
1: file = '/Users/IliaK/p/llvm/tools/lldb/test/functionalities/breakpoint/breakpoint_command/main.c', line = 12, exact_match = 0, locations = 1, resolved = 1, hit count = 2
  1.1: where = a.out`main + 20 at main.c:12, address = 0x0000000100000eb4, resolved, hit count = 2
```

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

Reviewers: jingham, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, clayborg, jingham

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

llvm-svn: 237460
2015-05-15 18:16:15 +00:00
Ilia K 06d2855fb3 Fix a reason of *stopped notifications due to SIGINT/SIGSTOP signals (MI)
# Add SBProcess::GetInterruptedFromEvent
# Add vrEvent arg in CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStateStopped
  and CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopSignal
# Refactor CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopSignal
## Clean up and fix typos
## Remove vwrbShouldBrk arg
# Fix MiSignalTestCase.test_lldbmi_stopped_when_stopatentry_{local,remote}
  to expect SIGSTOP instead of SIGINT

llvm-svn: 237426
2015-05-15 09:29:09 +00:00
Omair Javaid ea8c25a802 This patch adds support for setting/clearing hardware watchpoints and breakpoints on AArch64 (Arm v8) 64-bit hardware.
http://reviews.llvm.org/D9706

llvm-svn: 237419
2015-05-15 06:29:58 +00:00
Enrico Granata b2d643146f Implement an objc tagged-pointer info command that will provide information about what LLDB thinks an ObjC tagged pointer represents
llvm-svn: 237322
2015-05-14 00:46:47 +00:00
Zachary Turner 1aa755ce77 Remove DoAttachToProcessWithId(lldb::pid_t).
There were two versions of DoAttachToprocessWithId.  One that takes
a pid_t, and the other which takes a pid_t and a ProcessAttachInfo.
There were no callers of the former version, and all of the
implementations of this version were simply forwarding calls to
one version or the other.

llvm-svn: 237281
2015-05-13 19:44:44 +00:00
Jim Ingham f9e1a165dd Add a comment clarifying what func_name_type_mask is.
llvm-svn: 237279
2015-05-13 19:01:15 +00:00
Ewan Crawford 78baa19781 Remote Non-Stop Support
Summary:
 
This patch is the beginnings of support for Non-stop mode in the remote protocol. Letting a user examine stopped threads, while other threads execute freely.

Non-stop mode is enabled using the setting target.non-stop-mode, which sends a QNonStop packet when establishing the remote connection.
Changes are also made to treat the '?' stop reply packet differently in non-stop mode, according to spec https://sourceware.org/gdb/current/onlinedocs/gdb/Remote-Non_002dStop.html#Remote-Non_002dStop.
A setting for querying the remote for default thread on setup is also included.

Handling of '%' async notification packets will be added next.

Reviewers: clayborg

Subscribers: lldb-commits, ADodds, ted, deepak2427

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

llvm-svn: 237239
2015-05-13 09:18:18 +00:00
Vince Harron d7e6a4f2f0 Fixed a ton of gcc compile warnings
Removed some unused variables, added some consts, changed some casts
to const_cast. I don't think any of these changes are very
controversial.

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

llvm-svn: 237218
2015-05-13 00:25:54 +00:00
Ted Woodward 4744ec6da9 Windows: fix bug in getcwd() and add chdir().
Summary:
GetCurrentDirectory() returns the number of characters copied; 0 is a failure, not a success.

Add implementation for chdir().

Reviewers: zturner

Reviewed By: zturner

Subscribers: lldb-commits

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

llvm-svn: 237162
2015-05-12 18:47:33 +00:00
Oleksiy Vyalov 5e30f0e02d Apply LLDB_API modifier to SBPlatform and SBPlatformShellCommand.
llvm-svn: 237084
2015-05-12 02:04:26 +00:00
Vince Harron 8b33567189 Get lldb-server building on android-9
Build lldb-server with an android-9 sysroot.

llvm-svn: 237078
2015-05-12 01:10:56 +00:00
Ted Woodward e76e7e9369 Add Hexagon packet support to ThreadPlanStepRange
Summary:
Hexagon is a VLIW processor. It can execute multiple instructions at once, called a packet. Breakpoints need to be alone in a packet. This patch will make sure that temporary breakpoints used for stepping are set at the start of a packet, which will put the breakpoint in a packet by itself.

Patch by Deepak Panickal of CodePlay and Ted Woodward of Qualcomm.

Reviewers: deepak2427, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 237047
2015-05-11 21:12:33 +00:00
Robert Flack 96ad3de54b Convert mmap options for target in InferiorCallMmap.
Converts the MAP_PRIVATE and MAP_ANON options to the target platform constants
(on which the call runs) rather than using those of the compiled host.

Test Plan:
Run test suite, the following tests requiring memory allocation / JIT support
begin passing when running mac -> linux:
Test11588.py
TestAnonymous.py
TestBreakpointConditions.py
TestCPPStaticMethods.py
TestCStrings.py
TestCallStdStringFunction.py
TestDataFormatterCpp.py
TestDataFormatterStdList.py
TestExprDoesntBlock.py
TestExprHelpExamples.py
TestFunctionTypes.py
TestPrintfAfterUp.py
TestSBValuePersist.py
TestSetValues.py

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

llvm-svn: 236933
2015-05-09 15:53:31 +00:00
Chaoren Lin f34f410e0a Set path syntax for remote executable FileSpec.
Reviewers: ovyalov, zturner

Subscribers: lldb-commits

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

llvm-svn: 236925
2015-05-09 01:21:32 +00:00
Oleksiy Vyalov a9ea07113c Use hard links to link sysroot files within ModuleCache.
http://reviews.llvm.org/D9587

llvm-svn: 236917
2015-05-08 23:54:34 +00:00
Tamas Berghammer f3a243297b Use /data/local/tmp as temp directory on android
If no temp directory specified by the user on android then fall back
to /data/local/tmp what is always present on the device. It removes
the dependency of specifying TMPDIR for executing platform commands
on android.

Differential revision: http://reviews.llvm.org/D9569

llvm-svn: 236843
2015-05-08 12:46:26 +00:00
Pavel Labath 014d32b3bb Have lldb_assert accept bool expressions
Summary:
This changes lldb_assert to accept bool expressions as the parameter, this is because some
objects (such as std::shared_ptr) are convertible to bool, but are not convertible to int, which
leads to surprising errors.

Reviewers: granata.enrico, zturner

Subscribers: lldb-commits

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

llvm-svn: 236819
2015-05-08 09:53:31 +00:00
Aidan Dodds c0c838516d This patch allows LLDB to use the $qXfer:Libraries: packet.
Differential Revision: http://reviews.llvm.org/D9471

llvm-svn: 236817
2015-05-08 09:36:31 +00:00
Zachary Turner 0c779e0440 Remove __attribute__ from VAError.
__attribute__(format(print...)) requires a function which takes
variadic arguments (... style), not a function which takes a va_list.
So following the same thing that VAPrintf does, just remove the
__attribute__ from this function.

llvm-svn: 236788
2015-05-07 22:30:24 +00:00
Zachary Turner 610e52912d Add logging to ProcessWindows.
llvm-svn: 236776
2015-05-07 21:39:33 +00:00
Enrico Granata 4878c87d5e Make it so that changing formats on a synthetic value object causes children to be invalidated and refetched when needed
This is required for supporting vector types formatting

llvm-svn: 236769
2015-05-07 20:33:31 +00:00
Oleksiy Vyalov 919ef9dc37 Use file locks to synchronize access to ModuleCache.
http://reviews.llvm.org/D9056

llvm-svn: 236736
2015-05-07 15:28:49 +00:00
Enrico Granata ba4b8b0917 Add a language objc class-table dump command
This command dumps a bunch of interesting facts about all Objective-C classes known to LLDB in the inferior process

llvm-svn: 236640
2015-05-06 21:01:07 +00:00
Pavel Labath ad5ee04058 Simplify FuncUnwinders::GetEHFrameAugmentedUnwindPlan
Summary:
GetEHFrameAugmentedUnwindPlan duplicated the work of GetEHFrameUnwindPlan in getting the original
plan from DWARF CFI. This changes the function to call GetEHFrameUnwindPlan instead of doing all
the work itself. A copy constructor is added to UnwindPlan to enable plan copying.

Test Plan: No regressions on linux test suite.

Reviewers: jasonmolenda, clayborg

Subscribers: lldb-commits

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

llvm-svn: 236607
2015-05-06 15:54:48 +00:00
Colin Riley c9c55a26bd Add language command and LanguageRuntime plugin changes to allow vending of command objects.
Differential Revision: http://reviews.llvm.org/D9402

llvm-svn: 236443
2015-05-04 18:39:38 +00:00
Chaoren Lin ec53482aef PosixPipes should not be copyable but should be movable.
Summary: This addresses Oleksiy's comment in D9307.

Reviewers: clayborg, ovyalov

Reviewed By: clayborg, ovyalov

Subscribers: lldb-commits

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

llvm-svn: 236320
2015-05-01 16:49:23 +00:00
Sean Callanan 80c9759ef7 Added support for locating and importing functions
(including inline functions) from modules in the
expression parser.  We now have to retain a reference
to the code generator in ClangExpressionDeclMap so
that any imported function bodies can be appropriately
sent to that code generator.

<rdar://problem/19883002>

llvm-svn: 236297
2015-05-01 00:47:29 +00:00
Zachary Turner 26c0a5ea0d Remove the NullLog class introduced in r236174.
Based on list discussions, a different approach is desired for
reducing the visual impact of logging statements on the
readability of the code.  Another mechanism will be added in
a followup patch, but for now, since NullLog is unreferenced,
this patch just removes it.

This patch does *not* remove the other half of r236174, which was
to delete some dead code surrounding logging flags.

llvm-svn: 236259
2015-04-30 21:03:37 +00:00
Zachary Turner c1592658d5 Introduce a NullLog class, which ignores all messages.
The purpose of this class is so that GetLogIfAllCategoriesSet
can always return an instance of some class, whether it be a real
logging class or a "null" class, which ignores messages.  Code
that is littered with if statements that only log if the pointer
is non-null can get very unwieldy very quickly, so this should
help code readability in such circumstances.

Since I'm in this code anyway, I'm also deleting the
PrintfWithFlags methods, as well as all the flags, since they
appear to be dead code that have been superceded by newer
mechanisms and all the flags are simply ignored.

llvm-svn: 236174
2015-04-29 22:55:28 +00:00
Chaoren Lin 66f2e12f7a Expose Close{Read/Write}FileDescriptor for pipes.
llvm-svn: 236136
2015-04-29 18:25:18 +00:00
Chaoren Lin a52f48412d Add file descriptor constructor for PipePosix.
llvm-svn: 236133
2015-04-29 17:36:58 +00:00
Chaoren Lin 3eb4b4589e Remove trap code from disassembly.
Summary:
NativeProcessProtocol uses ReadMemory internally for setting/checking
breakpoints but also for generic memory reads (Handle_m), this change adds a
ReadMemoryWithoutTrap for that purpose. Also fixes a bunch of misuses of addr_t
as size/length.

Test Plan: `disassemble` no longer shows the trap code.

Reviewers: jingham, vharron, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 236132
2015-04-29 17:24:48 +00:00
Ilia K 7f83624222 Add language option in -gdb-show command (MI)
Summary:
Add language option in -gdb-show command + test:
```
$ bin/lldb-mi ~/p/hello
[...]
b main
[...]
r
[...]
(gdb)
-gdb-show language
^done,value="c++"
(gdb)
quit
```

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

Reviewers: abidh, granata.enrico, jingham, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, jingham, granata.enrico, clayborg, abidh

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

llvm-svn: 235983
2015-04-28 12:51:16 +00:00
Chaoren Lin 368c9f6e9b Add an unnamed pipe fail-safe to launching lldb-gdbserver.
Summary:
Currently, launching lldb-gdbserver from platform on Android requires root for
mkfifo() and an explicit TMPDIR variable. This should remove both requirements.

Test Plan: Successfully launched lldb-gdbserver on a non-rooted Android device.

Reviewers: tberghammer, vharron, clayborg

Reviewed By: clayborg

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 235940
2015-04-27 23:20:30 +00:00
Ilia K ce216063ac Add SBLaunchInfo in include/lldb/API/SBDefines.h and fix spacing in scripts/Python/buildSwigPython.py
llvm-svn: 235819
2015-04-26 07:51:14 +00:00
Adrian McCarthy 2304b6ff44 Factor resolution of abbreviations and aliases so that they can be tested directly. http://reviews.llvm.org/D9033
llvm-svn: 235633
2015-04-23 20:00:25 +00:00
Mohit K. Bhakkad e8659b5df6 [LLDB][MIPS] Add MIPS32 and MIPS64 core revisions
Patch by Jaydeep Patil

Added MIPS32 and MIPS64 core revisions. This would be followed by register context and emulate-instruction for MIPS32.

DYLDRendezvous.cpp:
On Linux link map struct does not contain extra load offset field.

Reviewers: clayborg
Subscribers: bhushan, mohit.bhakkad, sagar, lldb-commits.
Differential Revision: http://reviews.llvm.org/D9190

llvm-svn: 235574
2015-04-23 06:36:20 +00:00