Commit Graph

7483 Commits

Author SHA1 Message Date
Bruce Mitchener e8433cc179 Simplify find_first_of & find_last_of on single char.
Summary:
When calling find_first_of and find_last_of on a single character,
we can instead just call find / rfind and make our intent more
clear.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 246609
2015-09-01 23:57:17 +00:00
Bruce Mitchener 11deaae8a1 Remove ABIMacOSX_i386::PrepareNormalCall().
Summary:
This was removed from the other ABI plugins long ago. This removes
a warning that was happening in this unused code as a result of
adding 2 new types to Scalar.h (e_uint128 and e_sint128).

Reviewers: clayborg

Subscribers: llvm-commits

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

llvm-svn: 246608
2015-09-01 23:51:30 +00:00
Jim Ingham 5a3bb64fca Fix ProcessKDP.cpp for the change in r246578.
llvm-svn: 246601
2015-09-01 22:56:59 +00:00
Enrico Granata b6f8ca152a std::initializer_list is not safe to return from a function, as copies are not guaranteed to extend the lifetime of the underlying storage
llvm-svn: 246597
2015-09-01 22:24:35 +00:00
Enrico Granata 45a98fffa5 Add logging to a couple of regions of code
llvm-svn: 246580
2015-09-01 20:11:13 +00:00
Zachary Turner 1d397bfe40 Make ProcessWindows not create a strong reference to itself.
llvm-svn: 246579
2015-09-01 20:02:44 +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
Oleksiy Vyalov e7eabbb550 Make remote-android platform to use dynamic local tcp ports when forwarding device ports.
http://reviews.llvm.org/D12510

llvm-svn: 246574
2015-09-01 19:02:14 +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 761844be66 When looking up types, find the first type we can import rather than just taking
the first type we find and failing if it can't be imported.

llvm-svn: 246563
2015-09-01 18:00:35 +00:00
Adrian McCarthy 6c3d03c468 Implement DoReadMemory for Windows mini dumps.
Differential Revision: http://reviews.llvm.org/D12507

llvm-svn: 246558
2015-09-01 16:59:31 +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 7a9495bcd5 [NativeProcessLinux] Fix detach of multithreaded inferiors
When detaching, we need to detach from all threads of the inferior and not just the main one.
Without this, a multi-threaded inferior would usually crash once the server exits.

llvm-svn: 246549
2015-09-01 15:00:51 +00:00
Pavel Labath 86852d3676 [NativeProcessLinux] Fix assertion failure when killing a process
Linux sometimes sends us a PTRACE_EVENT_EXIT when an inferior process gets a SIGKILL. This can be
confusing, since normally we don't expect any events when the inferior is stopped. This commit
adds code to handle this situation (resume the thread and let it exit normally) and avoid an
assertion failure in ResumeThread().

llvm-svn: 246539
2015-09-01 10:59:36 +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
Jason Molenda bf67a30bdd A few small comment fixups with terminology "gcc" -> "eh_frame", "gdb" -> "stabs".
Just noticed these while reading through some code.

llvm-svn: 246530
2015-09-01 05:17:01 +00:00
Enrico Granata d1216d6b12 And of course, typos
llvm-svn: 246519
2015-09-01 01:23:22 +00:00
Enrico Granata fcc353d952 Attempt at fixing the CMake build
llvm-svn: 246518
2015-09-01 01:23:02 +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
Enrico Granata ad91c7cee2 Make FormatEntity be a little bit smarter when printing function arguments
llvm-svn: 246512
2015-09-01 00:19:35 +00:00
Greg Clayton 915272ff54 Stop objects from keeping a strong reference to the process when they should have a weak reference.
llvm-svn: 246488
2015-08-31 21:25:45 +00:00
Adrian McCarthy 23d14b6ade Differential Review: http://reviews.llvm.org/D12363
llvm-svn: 246302
2015-08-28 14:42:03 +00:00
Sylvestre Ledru 79cb0090ff Avoid usage of F_DUPFD_CLOEXEC where not available (e.g. kfreebsd*)
Summary:
kfreebsd doesn't have F_DUPFD_CLOEXEC, so use it conditionally.

Author: Emilio Pozuelo Monfort <pochu@debian.org>
Author: Petr Salinger <Petr.Salinger@seznam.cz>
Author: Gianfranco Costamagna

Reviewers: emaste

Subscribers: emaste

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

llvm-svn: 246294
2015-08-28 12:24:07 +00:00
Mohit K. Bhakkad 16ad032183 [LLDB][MIPS] Aligning code with rL245831
Reviewers: jaydeep
Subscribers: lldb-commits.
Differential Revision: http://reviews.llvm.org/D12427

llvm-svn: 246293
2015-08-28 12:08:26 +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 2996d8236c Include <mutex>
llvm-svn: 246222
2015-08-27 22:14:06 +00:00
Enrico Granata 0f72c8ee4e Fixup one of the CMakeLists
llvm-svn: 246220
2015-08-27 21:55:55 +00:00
Enrico Granata 8f5e331dc2 Added a missing file to the CMakeLists
llvm-svn: 246216
2015-08-27 21:45:59 +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
Stephane Sezer 03439a87cf Silence some MSVC warnings.
Summary:
Just `assert("string" && false)` instead of `assert("string" == NULL)`.

This avoid errors like

    [...]\Core\SourceManager.cpp(647): warning C4130: '==' : logical operation on address of string constant

Reviewers: zturner

Subscribers: lldb-commits

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

llvm-svn: 246123
2015-08-26 23:55:14 +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
Todd Fiala f50b20d819 http://reviews.llvm.org/D12380: remove DWARFCompileUnit printf spam.
llvm-svn: 246091
2015-08-26 22:08:26 +00:00
Enrico Granata 7539b02803 Fix missing override warnings
llvm-svn: 246084
2015-08-26 21:39:52 +00:00
Omair Javaid 3a56363aec Error checking correction in AArch64 hardware watchpoint code
Differential Revision: http://reviews.llvm.org/D12328

llvm-svn: 246045
2015-08-26 18:23:27 +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
Jason Molenda da9765b966 In SendContinuePacketAndWaitForResponse there is a special bit of
code that looks for a second stop-reply packet in response to an
interrupt (control-c).  This is to handle the case where where a
stop packet is making its way up to lldb right as lldb decides to
interrupt the inferior.  If the inferior is running and we interrupt
it, we'd expect a T11 type response meaning that the inferior halted
because of the interrupt.  But if the interrupt gets a T05 type
response instead, meaning that we stopped execution by hitting a
breakpoint or whatever, then the interrupt was received while the
inferior was already paused and so it is treated as a "?" packet
-- the remote stub will send the stop message a second time.

There's a timeout where we wait to get this second stop reply packet
in SendContinuePacketAndWaitForResponse, currently 1ms.  For a slow
remote target, it may take longer than that to send the second stop
reply packet.  If that happens, then lldb will use that second stop
reply packet as the response for the next packet request it makes 
to the remote stub.  The two will be out of sync by one packet for
the rest of the debug session and it's going to go badly from then on.

I've seen times as slow as 46ms, and given the severity of missing that
second stop reply packet, I'm increasing the timeout to 100ms, or 0.1sec.
<rdar://problem/21990791> 

llvm-svn: 246004
2015-08-26 04:07:30 +00:00
Omair Javaid 2441aecd1e Adds support for hardware watchpoints on Arm targets.
http://reviews.llvm.org/D9703

This updated patches correct problems in arm hardware watchpoint support patch posted earlier.

This patch has been tested on samsung chromebook (ARM - Linux) and PandaBoard using basic watchpoint test application.

Also it was tested on Nexus 7 Android device.

On chromebook linux we are able to set and clear all types of watchpoints but on android we end up getting a watchpoint packet error because we are not able to call hardware watchpoint ptrace functions successfully.

llvm-svn: 245961
2015-08-25 18:22:04 +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
Tamas Berghammer b7c64651e4 Fix buffer overflow for fixed_form_sizes
The array is indexed by the value in the DW_FORM filed what can be
bigger then the size of the array. This CL add bound checking to avoid
buffer overflows

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

llvm-svn: 245930
2015-08-25 11:45:46 +00:00
Tamas Berghammer bb9729eb4b Fix source manager regression caused by r245905
llvm-svn: 245928
2015-08-25 10:27:38 +00:00
Sagar Thakur 3024117757 Fix build on mips
Setting and getting register values as bytes instead of depending on the 128 bit integer support in register value.
This patch will fix the build failure in the release branch.

Reviewers: tberghammer, clayborg, hans
Subscribers: bhushan, nitesh.jain, jaydeep, lldb-commits
Differential: http://reviews.llvm.org/D12275
llvm-svn: 245927
2015-08-25 09:52:59 +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
Adrian McCarthy 27785dd530 Reorg code to allow Windows Process Plugins to share some common code.
Differential Revision: http://reviews.llvm.org/D12252

llvm-svn: 245850
2015-08-24 16:00:51 +00:00
Pavel Labath 0f4b17d12c Simplify NativeThreadLinux includes
there is no need to include architecture-specific register contexts when the generic one will
suffice.

llvm-svn: 245839
2015-08-24 13:25:54 +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