Commit Graph

8729 Commits

Author SHA1 Message Date
Pavel Labath cc0e87cdae Fix a couple of cornercases in FileSpec + tests
Summary:
This fixes a couple of corner cases in FileSpec, related to AppendPathComponent and
handling of root directory (/) file spec. I add a bunch of unit tests for the new behavior.

Summary of changes:
FileSpec("/bar").GetCString(): before "//bar", after "/bar".
FileSpec("/").CopyByAppendingPathComponent("bar").GetCString(): before "//bar", after "/bar".
FileSpec("C:", ePathSyntaxWindows).CopyByAppendingPathComponent("bar").GetCString(): before "C:/bar", after "C:\bar".

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 263207
2016-03-11 08:44:44 +00:00
Eugene Zelenko a74f37a599 Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes.
llvm-svn: 263174
2016-03-10 23:57:12 +00:00
Marianne Mailhot-Sarrasin 82a827de3b Fixed ValueObject::GetExpressionPath() for paths including anonymous struct/union
When the parent of an expression is anonymous, skip adding '.' or '->' before the expression name.

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

llvm-svn: 263166
2016-03-10 22:10:59 +00:00
Greg Clayton a31baf081b Fixed the python interpreter so that it correctly inherits the top IOHandler's files instead of always using stdin/out/err.
Removed lldb_private::File::Duplicate() and the copy constructor and the assignment operator that used to duplicate the file handles and made them private so no one uses them. Previously the lldb_private::File::Duplicate() function duplicated files that used file descriptors, (int) but not file streams (FILE *), so the lldb_private::File::Duplicate() function only worked some of the time. No one else excep thee ScriptInterpreterPython was using these functions, so that aren't needed nor desired. Previously every time you would drop into the python interpreter we would duplicate files, and now we avoid this file churn.

<rdar://problem/24877720>

llvm-svn: 263161
2016-03-10 20:49:32 +00:00
Aidan Dodds 67dc3e1575 [Renderscript] Add stack argument reading code for Mipsel 3
Fix a problem raised with the previous patches being applied in the wrong order.

Committed on behalf of: Dean De Leo <dean@codeplay.com>

llvm-svn: 263134
2016-03-10 17:50:01 +00:00
Aidan Dodds 6dd4b57987 [Renderscript] Add stack argument reading code for Mipsel 2
This commit implements the reading of stack spilled function arguments for little endian MIPS targets.

Committed on behalf of: Dean De Leo <dean@codeplay.com>

llvm-svn: 263131
2016-03-10 17:37:02 +00:00
Aidan Dodds 17e07c0ab4 [Renderscript] Add stack argument reading code for Mipsel
This commit implements the reading of stack spilled function arguments for little endian MIPS targets.

Committed on behalf of: Dean De Leo <dean@codeplay.com>

llvm-svn: 263130
2016-03-10 17:27:41 +00:00
Aidan Dodds 8433fdbedf [Renderscript] Explicitly set the language to evaluate allocations
Currently it is not specified, and since allocations are usually
requested once we hit a renderscript breakpoint, the language will be
inferred being as renderscript by the ExpressionParser.
Actually allocations attempt to invoke functions part of the RS runtime,
written in C/C++, so evaluating the calls in RenderScript could be
misleading.

In particular, in MIPS, the ABI between C/C++ (mips o32) and
renderscript (arm) might introduce subtle bugs when evaluating such
expressions.

This change explicitly sets the language used to evaluate the allocations
as C++.

Committed on behalf of: Dean De Leo <dean@codeplay.com>

llvm-svn: 263129
2016-03-10 17:23:33 +00:00
Ewan Crawford 7648dd375f Revert "Track expression language from one place in ClangExpressionParser"
r263099 seems to have broken some OSX tests

llvm-svn: 263107
2016-03-10 12:38:55 +00:00
Ewan Crawford 6dc9db5244 Track expression language from one place in ClangExpressionParser
The current expression language is currently tracked in a few places within the ClangExpressionParser constructor. 
This patch adds a private lldb::LanguageType attribute to the ClangExpressionParser class and tracks the expression language from that one place.

Author: Luke Drummond <luke.drummond@codeplay.com>
Differential Revision: http://reviews.llvm.org/D17719

llvm-svn: 263099
2016-03-10 10:31:08 +00:00
Siva Chandra aaae5f87af [DWARFASTParserClang] Start with member offset of 0 for members of union types.
Summary:
GCC does not emit DW_AT_data_member_location for members of a union.
Starting with a 0 value for member locations helps is reading union types
in such cases.

Reviewers: clayborg

Subscribers: ldrumm, lldb-commits

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

llvm-svn: 263085
2016-03-10 01:15:17 +00:00
Enrico Granata 391075c38e Certain hardware architectures have registers of 256 bits in size
This patch extends Scalar such that it can support data living in such registers (e.g. float values living in the XMM registers)

llvm-svn: 263079
2016-03-10 00:14:29 +00:00
Zachary Turner 7e8c7bea79 Fix SymbolFilePDB for discontiguous functions.
Previously line table parsing code assumed that the only gaps would
occur at the end of functions.  In practice this isn't true, so this
patch makes the line table parsing more robust in the face of
functions with non-contiguous byte arrangements.

llvm-svn: 263078
2016-03-10 00:06:26 +00:00
Ted Woodward eee554d86e Fix "ninja check-lldb" crash in IRExecutionUnit.cpp
Summary:
From Adrian McCarthy:

"Running ninja check-lldb now has one crash in a Python process, due to deferencing a null pointer in IRExecutionUnit.cpp:  candidate_sc.symbol is null, which leads to a call with a null this pointer."

Reviewers: zturner, spyffe, amccarth

Subscribers: ted, jingham, lldb-commits

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

llvm-svn: 263066
2016-03-09 22:05:17 +00:00
Jim Ingham 2411167fb5 Add an "offset" option to "break set -n" and "break set -f -l".
That way you can set offset breakpoints that will move as the function they are 
contained in moves (which address breakpoints can't do...)

I don't align the new address to instruction boundaries yet, so you have to get
this right yourself for now.

<rdar://problem/13365575>

llvm-svn: 263049
2016-03-09 18:59:13 +00:00
Enrico Granata 4643c01284 Last round of preliminary cleanup in my refactoring of aliases.
The next step is to actually turn CommandAlias into a full-blown CommandObject citizen.

This is tricky given the current architecture of the CommandInterpreter but I think I have found a reasonable path forward.
The current plan is to make class CommandAlias : public CommandObject, and have all the several GetCommand calls not actually traverse through the alias to the underlying command object
The only times that an alias will be traversed are:
a) execution; when time comes to run an alias, I will just grab the underlying command and options, and make the interpreter execute that according to its current algorithm
b) subcommand traversal; if one has an alias to a multiword command, grabbing a subcommand will see through to the subcommand

Other operations, e.g. command listing, command names, command helps, ..., will all use the alias directly. This will, in turn, lead to the removal of the separate alias dictionary, and just mix user commands and aliases in one map

llvm-svn: 262986
2016-03-09 02:27:57 +00:00
Enrico Granata 7cf3b34d45 Add CommandAlias.cpp to CMakeLists
llvm-svn: 262959
2016-03-08 21:29:49 +00:00
Enrico Granata 937631cfdf Move CommandAlias to its own file; also
Store std::unique_ptr<CommandAlias> instead of instances

llvm-svn: 262958
2016-03-08 21:23:30 +00:00
Adrian Prantl 6aeba89e89 Support floating point values in 128-bit SSE vector registers
The System-V x86_64 ABI requires floating point values to be passed
in 128-but SSE vector registers (xmm0, ...). When printing such a
variable this currently yields an <invalid load address>.

This patch makes LLDB's DWARF expression evaluator accept 128-bit
registers as scalars. It also relaxes the check that the size of the
result of the DWARF expression be equal to the size of the variable to a
greater-than. DWARF defers to the ABI how smaller values are being placed
in a larger register.

Implementation note: I found the code in Value::SetContext() that changes
the m_value_type after the fact to be questionable. I added a sanity check
that the Value's memory buffer has indeed been written to (this is
necessary, because we may have a scalar value in a vector register), but
really I feel like this is the wrong place to be setting it.

Reviewed by Greg Clayton.

http://reviews.llvm.org/D17897
rdar://problem/24944340

llvm-svn: 262947
2016-03-08 18:35:09 +00:00
Tamas Berghammer 77b93ad471 Fix log in Broadcaster causing a crash
llvm-svn: 262925
2016-03-08 13:33:14 +00:00
Tamas Berghammer 65fa0b5169 Try to fix windows build after rL262863
llvm-svn: 262923
2016-03-08 11:43:56 +00:00
Ewan Crawford 1ab4adb1d3 Use c_str() instead of GetCString() to fix build
llvm-svn: 262920
2016-03-08 10:03:23 +00:00
Enrico Granata 443923b72d This is actually a FileSpec, so use .GetCString() instead
llvm-svn: 262914
2016-03-08 05:59:47 +00:00
Enrico Granata c8fd719e21 Use .c_str() here to unbreak the Linux build
llvm-svn: 262913
2016-03-08 05:57:52 +00:00
Enrico Granata 212130ac4d A few more improvements on the way to the command alias refactoring
- move alias help generation to CommandAlias, out of CommandInterpreter
- make alias creation use argument strings instead of OptionArgVectorSP; the former is a more reasonable currency than the latter
- remove m_is_alias from CommandObject, it wasn't actually being used

llvm-svn: 262912
2016-03-08 05:37:15 +00:00
Enrico Granata 002ab61a47 Turn GetAliasOptions() into GetAlias()
Eventually, there will be more things that CommandAlias contains, and I don't want accessors for each of them on the CommandIntepreter
Eventually, we also won't pass around copies of CommandAlias, but that's for a later patch

llvm-svn: 262909
2016-03-08 03:56:12 +00:00
Enrico Granata 4a795920e3 Attempt to fix the Ubuntu buildbot by making FindLongestCommandWord a free template function in lldb_private
llvm-svn: 262905
2016-03-08 03:48:41 +00:00
Jason Molenda 5df5402f94 Unbreak linux build broken by r262901
llvm-svn: 262904
2016-03-08 03:24:13 +00:00
Enrico Granata 5e5503099b Move ProcessAliasOptionsArgs to be a static on CommandAlias; it wasn't using any instance data on the CommandInterpreter anyway
This small step removes one piece of alias machinery from the CommandInterpreter into the CommandAlias

llvm-svn: 262901
2016-03-08 03:00:27 +00:00
Enrico Granata 308f73c5a3 Change the way command aliases are stored. Go from a model where a map holds the alias -> underlying command binding and another map holds the alias -> options, to a model where one single map holds the alias -> (all useful data) combination
Right now, obviously, this is just the pair of (CommandObjectSP,OptionArgVectorSP), so NFC

This is step one of a larger - and tricky - refactoring which will turn command aliases into interesting objects instead of passive storage that the command interpreter does smart things to
This refactoring, in turn, will allow us to do interesting things with aliases, such as intelligent and customizable help

llvm-svn: 262900
2016-03-08 02:49:15 +00:00
Jim Ingham 583bbb1dd4 Change over the broadcaster/listener process to hold shared or weak pointers
to each other.  This should remove some infrequent teardown crashes when the
listener is not the debugger's listener.

Processes now need to take a ListenerSP, not a Listener&.

This required changing over the Process plugin class constructors to take a ListenerSP, instead
of a Listener&.   Other than that there should be no functional change.
 
<rdar://problem/24580184> CrashTracer: [USER] Xcode at …ework: lldb_private::Listener::BroadcasterWillDestruct + 39

llvm-svn: 262863
2016-03-07 21:50:25 +00:00
James Y Knight dc395b9d2b Update after r262737 in clang changed the accessor.
llvm-svn: 262739
2016-03-04 19:30:53 +00:00
Pavel Labath 16d3fd8ba1 Fix warning in IRExecutionUnit.cpp
llvm-svn: 262712
2016-03-04 11:26:56 +00:00
Tamas Berghammer b0b1ea36e7 Add reverse file remapping for breakpoint set
LLDB can remap a source file to a new directory based on the
"target.sorce-map" to handle the usecase when the source code moved
between the compliation and the debugging. Previously the remapping
was only used to display the content of the file. This CL fixes the
scenario when a breakpoint is set based on the new an absolute path
with adding an inverse remapping step before looking up the breakpoint
location.

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

llvm-svn: 262711
2016-03-04 11:26:44 +00:00
Eugene Zelenko 34ede34acd Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes.
llvm-svn: 262570
2016-03-03 00:51:40 +00:00
Zachary Turner 74e08ca05c Add support for reading line tables from PDB files.
PDB is Microsoft's debug information format, and although we
cannot yet generate it, we still must be able to consume it.
Reason for this is that debug information for system libraries
(e.g. kernel32, C Runtime Library, etc) only have debug info
in PDB format, so in order to be able to support debugging
of system code, we must support it.

Currently this code should compile on every platform, but on
non-Windows platforms the PDB plugin will return 0 capabilities,
meaning that for now PDB is only supported on Windows.  This
may change in the future, but the API is designed in such a way
that this will require few (if any) changes on the LLDB side.
In the future we can just flip a switch and everything will
work.

This patch only adds support for line tables.  It does not return
information about functions, types, global variables, or anything
else.  This functionality will be added in a followup patch.

Differential Revision: http://reviews.llvm.org/D17363
Reviewed by: Greg Clayton

llvm-svn: 262528
2016-03-02 22:05:52 +00:00
Tamas Berghammer 45dbfa1f83 Upgrade the arm/thumb architecture used by the disassembler
Previously we were using thumbv7 and armv8.1a what ended up showing a
few undefined instruction when disassembling code. This CL update the
architectures used to armv8.2a and thumbv8.2a (newest available) so we
display all instruction in the disassambly.

llvm-svn: 262482
2016-03-02 12:42:43 +00:00
Eugene Zelenko df37055017 Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes.
llvm-svn: 262450
2016-03-02 02:18:18 +00:00
Eugene Zelenko 896ddd03e9 Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes.
llvm-svn: 262441
2016-03-02 01:09:03 +00:00
Ted Woodward 7071c5fd64 Fix bug with function resolution when using IR Interpreter
Summary: Recent changes to the expression parser broke function name resolution when using the IR interpreter instead of JIT. This patch changes the IRMemoryMap ivar in InterpreterStackFrame to an IRExecutionUnitSP (which is a subclass), allowing InterpreterStackFrame::ResolveConstantValue() to call FindSymbol() on the name of the Value when it's a FunctionVal. It also changes IRExecutionUnit::FindInSymbols() to call GetFileAddress() on the symball if ResolveCallableAddress() fails and there is no valid Process.

Reviewers: spyffe

Subscribers: lldb-commits

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

llvm-svn: 262407
2016-03-01 21:53:26 +00:00
Tamas Berghammer f46c5259bd DWARFExpression: Don't resolve load address in DW_OP_plus
If we have a TargetLoadAddress on the top of the DWARF stack then a
DW_OP_plus or a DW_OP_plus_ucons sholudn't dereference (resolve) it
and then add the value to the dereferenced value but it should offset
the load address by the specified constant.

llvm-svn: 262339
2016-03-01 15:01:05 +00:00
Pavel Labath 109702ccb1 Fix warning in NSDictionary.cpp
llvm-svn: 262322
2016-03-01 11:40:47 +00:00
Jason Molenda cc9e92eb41 Update the on-device arm specific code to match the API changes
that happened in other parts of this file so it builds cleanly
for arm again.

llvm-svn: 262300
2016-03-01 05:34:05 +00:00
Eugene Zelenko 9b0a801797 Fix MSVC build failure in source/Target/Process.cpp.
Will be good idea to introduce macro/constexpr for NULL thread_result_t.

llvm-svn: 262287
2016-03-01 02:08:37 +00:00
Eugene Zelenko da8cf8af35 Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Target/Process.cpp; other minor fixes.
llvm-svn: 262281
2016-03-01 00:55:51 +00:00
Enrico Granata 46d4aa211f When 'help' cannot find a command, produce additional help text that also points the user to the apropos and type lookup commands
This is useful in cases such as, e.g.

(lldb) help NSString
(the user meant type lookup)

or

(lldb) help kill
(the user is looking for process kill)

Fixes rdar://24868537

llvm-svn: 262271
2016-02-29 23:22:53 +00:00
Enrico Granata fe09d5e73a Fix a typo in my previous commit. This would cause mutable NSArrays to show up empty
llvm-svn: 262260
2016-02-29 21:41:19 +00:00
Enrico Granata 7a67ee263f Change the user-visible name for the argument type language to source-language
This makes it so that help language provides help on the language command and help source-language provides the list of source languages one can pass as an option

Fixes rdar://24869942

llvm-svn: 262259
2016-02-29 21:37:01 +00:00
Adrian McCarthy a7ad58b61c NFC: Refactor ProcessWinMiniDump to use a more traditional pimpl idiom.
This is a mechanical refactor.  There should be no functional changes in this commit.

Instead of encapsulating just the Windows-specific data, ProcessWinMiniDump now uses a private implementation class.  This reduces indirections (in the source).  It makes it easier to add private helper methods without touching the header and allows them to have platform-specific types as parameters.  The only trick was that the pimpl class needed a back pointer in order to call a couple methods.

llvm-svn: 262256
2016-02-29 21:15:23 +00:00
Enrico Granata 936499ae4c Add an LLDB data formatter for single-element NSArray and NSDictionary Cocoa containers
Fixes rdar://23715118

llvm-svn: 262254
2016-02-29 21:06:50 +00:00
Eugene Zelenko bbd16815b0 Fix Clang-tidy modernize-use-nullptr warnings in source/Plugins/Language; other minor fixes.
llvm-svn: 262246
2016-02-29 19:41:30 +00:00
Omair Javaid ef77ace9ae Add/Improve complex, vector, aggregate types handling for SysV ARM (hard/soft) ABI.
For details see:

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

llvm-svn: 262218
2016-02-29 13:39:20 +00:00
Pavel Labath 76d76bb006 Fix compiler warnings in the java code
llvm-svn: 262214
2016-02-29 11:44:15 +00:00
Todd Fiala 6993abff14 Revert "Fix bug with register values byte order in expression evaluation."
This reverts commit r262041, which caused asserts starting yesterday on the OS X testbot.

See details in:
https://llvm.org/bugs/show_bug.cgi?id=26758

llvm-svn: 262156
2016-02-27 22:48:50 +00:00
Greg Clayton cc2e27f098 Make LLDB safer to use with respect to the global destructor chain.
llvm-svn: 262090
2016-02-26 23:20:08 +00:00
Eugene Zelenko 4ea4d2ed30 Fix Clang-tidy modernize-use-nullptr warnings in remaining files in source/Plugins/ABI; other minor fixes.
llvm-svn: 262082
2016-02-26 22:26:21 +00:00
Chaoren Lin b6f76b3d47 Register value is not necessarily scalar.
Reviewers: aidan.dodds, mamai

Subscribers: lldb-commits

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

llvm-svn: 262081
2016-02-26 22:12:35 +00:00
Greg Clayton 5cc45e0122 Make sure to #include <atomic> for the std::atomic<bool> that was recently added.
llvm-svn: 262055
2016-02-26 19:41:49 +00:00
Greg Clayton 04df8ee55e Make sure the Target, Process and Thread GetGlobalProperties() static methods are thread safe.
<rdar://problem/22595283>

llvm-svn: 262053
2016-02-26 19:38:18 +00:00
Jim Ingham 406ba45f24 SymbolFileDWARFDebugMap::FindTypes didn't obey the max_matches flag,
but kept looking through .o files even after it had found as many 
matches as were requested.

llvm-svn: 262051
2016-02-26 19:33:11 +00:00
Aidan Dodds 3cdf5516c6 remove unused local string in IRForTarget.cpp
Committed on behalf of: ldrumm <luke.drummond@codeplay.com>

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

llvm-svn: 262043
2016-02-26 18:03:06 +00:00
Aidan Dodds 5ba2b2af6e Fix bug with register values byte order in expression evaluation.
The evaluation of expressions containing register values was broken for targets for which endianness differs from host.

Committed on behalf of: mamai <marianne.mailhot.sarrasin@gmail.com>

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

llvm-svn: 262041
2016-02-26 17:40:50 +00:00
Greg Clayton 860582f78e The IOHandlerProcessSTDIO is the _only_ IOHandler that gets pushed and popped from functions that are run due to something that is NOT input from the user. All other IOHandler objects result from input from the user. An issue rose up where if a command caused the process to resume and stop and process state changed, where state changed Event objects were broadcast, it would cause the IOHandlerProcessSTDIO to have its IOHandlerProcessSTDIO::Cancel() function called. This used to always write a byte to the control pipe (IOHandlerProcessSTDIO::m_pipe) even if the IOHandlerProcessSTDIO::Run() was never called. What would happen is:
(lldb) command_that_steps_process_thousands_of_times

As the "command_that_steps_process_thousands_of_times" could be a python command that resumed the process thousands of times and in doing so the IOHandlerProcessSTDIO would get pushed when the process resumed, and popped when it stoppped, causing the call to IOHandlerProcessSTDIO::Cancel(). Since the IOHandler thread is currently in IOHandlerEditline::Run() for the command interpreter handling the "command_that_steps_process_thousands_of_times" command, IOHandlerProcessSTDIO::Run() would never get called, even though the IOHandlerProcessSTDIO is on the top of the stack. This caused the command pipe to keep getting 1 bytes written each time the IOHandlerProcessSTDIO::Cancel() was called and eventually we will deadlock since the write buffer is full.

The fix here is to make sure we are in IOHandlerProcessSTDIO::Run() before we write anything to the command pipe, and just call SetIsDone(true) if we are not.

<rdar://problem/22361364>

llvm-svn: 262040
2016-02-26 17:36:44 +00:00
Tamas Berghammer 0ed9c497ca Revert part of rL262014 as it caused issues on gcc-i386
llvm-svn: 262023
2016-02-26 15:33:32 +00:00
Aidan Dodds 7f6e9d53a3 Add mips32 software breakpoints into platform::GetSoftwareBreakpointTrapOpcode().
The software breakpoint definitions for mips32 should have been included in my
recent patch that moved the software breakpoint definitions into the base platform
class.

llvm-svn: 262021
2016-02-26 15:11:01 +00:00
Tamas Berghammer 31d315b349 Fix address class lookup for absolute symbols
llvm-svn: 262016
2016-02-26 14:21:27 +00:00
Tamas Berghammer 87a9769e9b Add a set of new plugins to handle Java debugging
The purpose of these plugins is to make LLDB capable of debugging java
code JIT-ed by the android runtime.

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

llvm-svn: 262015
2016-02-26 14:21:23 +00:00
Tamas Berghammer 5b42c7aa25 Add support for DW_OP_push_object_address in dwarf expressions
Additionally fix the type of some dwarf expression where we had a
confusion between scalar and load address types after a dereference.

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

llvm-svn: 262014
2016-02-26 14:21:10 +00:00
Chaoren Lin 6fc5c7f1f5 Clear alias argument vector for 'p' alias.
Summary: This fixes the 'p' command which should be aliased to 'expresion --'.

Reviewers: jingham

Subscribers: lldb-commits

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

llvm-svn: 261969
2016-02-26 03:36:27 +00:00
Jim Ingham 970bb9e0ec Add the "block" keyword to "thread step-in -e", and an alias that uses it: "sif <target function>" - i.e. step-into-function
to allow you to step through a complex calling sequence into a particular function that may span multiple lines.  Also some
test cases for this and the --step-target feature.

llvm-svn: 261953
2016-02-26 01:37:30 +00:00
Eugene Zelenko 2c6bd903ed Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Plugins/ABI; other minor fixes.
llvm-svn: 261952
2016-02-26 01:33:58 +00:00
Greg Clayton cec91ef921 Fix all of the unannotated switch cases to annotate the fall through or do the right thing and break.
llvm-svn: 261950
2016-02-26 01:20:20 +00:00
Eugene Zelenko 50ff9fee00 Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in source/Commands/CommandObjectThread.cpp; other minor fixes.
llvm-svn: 261936
2016-02-25 23:46:36 +00:00
Eugene Zelenko f13e65232d Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in source/Commands/CommandObjectTarget.cpp; other minor fixes.
llvm-svn: 261920
2016-02-25 19:02:39 +00:00
Aidan Dodds b129847aaa Improve readability and performance of ClangExpressionParser::FindFunctionInModule
Committed on behalf of: Luke Drummond

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

llvm-svn: 261861
2016-02-25 13:07:04 +00:00
Tamas Berghammer 31a2f8f9f5 Add support for handling absolute symbols in ELF
Most address represented in lldb as section plus offset and handling of
absolute addresses is problematic in several location because of lack
of necessary information (e.g. Target) or because of performance issues.

This CL change the way ObjectFileELF handle the absolute symbols with
creating a pseudo section for each symbol. With this change all existing
code designed to work with addresses in the form of section plus offset
will work with absolute symbols as well.

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

llvm-svn: 261859
2016-02-25 12:23:43 +00:00
Tamas Berghammer 72ac8a840f Handle the case when a variable is only valid in part of the enclosing scope
DWARF stores this information in the DW_AT_start_scope attribute. This
CL add support for this attribute and also changes the functions
displaying frame variables to only display the variables currently in
scope.

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

llvm-svn: 261858
2016-02-25 12:23:37 +00:00
Eugene Zelenko 73ef3c7fbc Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in source/Commands/CommandObjectType.cpp; other minor fixes.
llvm-svn: 261817
2016-02-25 02:08:17 +00:00
Greg Clayton 479d545ca2 Fix "target modules add -s <filename>" to work if the file doesn't exist locally on the current machine.
<rdar://problem/24807382>

llvm-svn: 261812
2016-02-25 00:56:47 +00:00
Adrian McCarthy 0a750820a3 Get register context for the 32-bit process in a WoW64 process minidump
32-bit processes on 64-bit Windows run in a layer called WoW64 (Windows-on-Windows64). If you capture a mini dump of such a process from a 32-bit debugger, you end up with a register context for the 64-bit WoW64 process rather than the 32-bit one you probably care about.

This detects WoW64 by looking to see if there's a module named wow64.dll loaded. For such processes, it then looks in the 64-bit Thread Environment Block (TEB) to locate a copy of the 32-bit CONTEXT record that the plugin needs for the register context.

Added some rudimentary tests.  I'd like to improve these later once we figure out how to get the exception information from these mini dumps.

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

llvm-svn: 261808
2016-02-25 00:23:27 +00:00
Zachary Turner 47c03462f5 Some fixes for case insensitive paths on Windows.
Paths on Windows are not case-sensitive.  Because of this, if a file
is called main.cpp, you should be able to set a breakpoint on it
by using the name Main.cpp.  In an ideal world, you could just
tell people to match the case, but in practice this can be a real
problem as it requires you to know whether the person who compiled
the program ran "clang++ main.cpp" or "clang++ Main.cpp", both of
which would work, regardless of what the file was actually called.

This fixes http://llvm.org/pr22667

Patch by Petr Hons

Differential Revision: http://reviews.llvm.org/D17492
Reviewed by: zturner

llvm-svn: 261771
2016-02-24 21:26:47 +00:00
Aidan Dodds 577570b4a5 [Renderscript] Change expression strings to use portable format specifiers.
Mips64 tests were failing on windows because the sscanf implementation differs between clang/gcc/msvc such that on windows %lx specifies a 32bits parameter and %llx is for 64bits. For us this meant that 64bit pointers were being truncated to 32bits on their way into a JIT'd expression.

llvm-svn: 261741
2016-02-24 14:17:33 +00:00
Omair Javaid 92a8dedaaa Fix test for homogeneity in case of aggregate consisting of containerized vector types
Details can be found here:

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

llvm-svn: 261734
2016-02-24 12:17:43 +00:00
Chaoren Lin 74a1fc6f87 Fix TestCStrings for Linux with i386 inferiors.
Summary: Temporarily revert part of r261704.

Reviewers: spyffe

Subscribers: lldb-commits

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

llvm-svn: 261718
2016-02-24 03:15:21 +00:00
Eugene Zelenko 3f18ea0e38 Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes.
llvm-svn: 261716
2016-02-24 02:05:55 +00:00
Sean Callanan fed0e758cb When looking for symbols, find load addresses in a more robust way.
IRExecutionUnit previously replicated a bunch of logic that already
existed elsewhere for the purpose of getting a load address for a
symbol.  This approach failed to resolve certain types of symbols.
Instead, we now use functions on SymbolContext to do the address
resolution.

This is a cleanup of IRExecutionUnit::FindInSymbols, and also fixes a
latent bug where we looked at the wrong SymbolContext to determine
whether or not it is external.

<rdar://problem/24770829>

llvm-svn: 261704
2016-02-23 23:09:06 +00:00
Pavel Labath 605b51b84e Work around a stepping bug in arm64 android M
Summary:
On arm64, linux<=4.4 and Android<=M there is a bug, which prevents single-stepping from working when
the system comes back from suspend, because of incorrectly initialized CPUs. This did not really
affect Android<M, because it did not use software suspend, but it is a problem for M, which uses
suspend (doze) quite extensively.  Fortunately, it seems that the first CPU is not affected by
this bug, so this commit implements a workaround by forcing the inferior to execute on the first
cpu whenever we are doing single stepping.

While inside, I have moved the implementations of Resume() and SingleStep() to the thread class
(instead of process).

Reviewers: tberghammer, ovyalov

Subscribers: aemerson, rengolin, tberghammer, danalbert, srhines, lldb-commits

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

llvm-svn: 261636
2016-02-23 13:56:30 +00:00
Pavel Labath 7326c01aaa [linux] Remove all traces of signalfd(2)
Summary:
Signalfd is not used in the code anymore, and given that the same functionality can be achieved
with the new MainLoop class, it's unlikely we will need it in the future. Remove all traces of
it.

Reviewers: tberghammer, ovyalov

Subscribers: tberghammer, danalbert, srhines, lldb-commits

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

llvm-svn: 261631
2016-02-23 12:26:08 +00:00
Saleem Abdulrasool 7ccf1373ac RenderScript: silence some -Wmissing-brace warnings
Silence some -Wmissing-brace warnings on Linux with clang 3.7.

llvm-svn: 261612
2016-02-23 04:56:31 +00:00
Eugene Zelenko 49bcfd802e Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes.
llvm-svn: 261602
2016-02-23 01:43:44 +00:00
Sean Callanan 99cb022400 Fixed a problem where the DWARF for inline functions was mis-parsed.
Inline functions in DWARF have AT_abstract_origin set, but we only handled that
if the functions were C++ methods.  Inline functions -- C or C++ -- have this
also, and as a result they got one FunctionDecl for each inlined instance.  When
going to construct the locals, this meant that the arguments (which did properly
have their abstract origins handled) would get associated with the master
FunctionDecl, and the inlined FunctionDecls would all appear to have no locals.

This manifested as not being able to look up local variables when stopped in an
inline fuunction.  We should have had a test for this, but somewhere along the
line the relevant test case lost its .py file (or it never had one).

This patch fixes this problem and restores the .py file.

<rdar://problem/24712434>

llvm-svn: 261598
2016-02-23 00:51:52 +00:00
Eugene Zelenko 6e3d8e7f06 Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in source/Commands/CommandObjectCommands.cpp; other minor fixes.
llvm-svn: 261593
2016-02-22 23:46:47 +00:00
Eugene Zelenko 435c2c9def Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in source/Commands/CommandObjectPlatform.cpp; other minor fixes.
Add missing break for permissions-string case.

llvm-svn: 261555
2016-02-22 19:02:01 +00:00
Aidan Dodds 933d8db922 Refactor GetSoftwareBreakpointTrapOpcode
This patch aims to reduce the code duplication among all of the platforms in GetSoftwareBreakpointTrapOpcode by pushing all common code into the Platform base class.

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

llvm-svn: 261536
2016-02-22 17:29:56 +00:00
Eugene Zelenko 26cac3af0b Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes.
llvm-svn: 261389
2016-02-20 00:58:29 +00:00
Eugene Zelenko c8ecc2a9fa Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes.
llvm-svn: 261356
2016-02-19 19:33:46 +00:00
Zachary Turner 41331afaef Don't use an atexit handler for cleaning up the temp directory.
Differential Revision: http://reviews.llvm.org/D17420

llvm-svn: 261353
2016-02-19 19:20:44 +00:00
Ewan Crawford 615a807ee8 refactor/cleanup ClangExpressionParser::Parse
This patches does the following:

+ fix return type: ClangExpressionParser::Parse returns unsigned, but was actually returning a signed value, num_errors.
+ use helper clang::TextDiagnosticBuffer::getNumErrors() instead of counting the errors ourself.
+ limit scoping of block-level automatic variables as much as practical.
+ remove reused multipurpose TextDiagnosticBuffer::const_iterator in favour of loop-scoped err, warn, and note variables in the diagnostic printing code.
+ refactor diagnostic printing loops to use a proper loop invariant.

Author: Luke Drummond <luke.drummond@codeplay.com>
Differential Revision: http://reviews.llvm.org/D17273

llvm-svn: 261345
2016-02-19 17:55:10 +00:00
Ewan Crawford 766492fde3 Delete unused function in ClangExpressionParser
[git 65dafa83] introduced the GetBuiltinIncludePath function copied from cfe/lib/Driver/CC1Options.cpp

This function is no longer used in lldb's expression parser and I believe it is safe to remove it.


Author: Luke Drummond <luke.drummond@codeplay.com>
Differential Revision: http://reviews.llvm.org/D17266

llvm-svn: 261328
2016-02-19 14:31:41 +00:00
Tamas Berghammer 73bcca5b3d Stack unwinding emulation: handle adjustment of FP
This change is improving the instruction emulation based unwinding to
handle when the frame pointer is adjusted (increment/decrement) after
it has been initialized. The situation can occur in the prologue of
some function where FP is adjusted before it is copied back to SP.

Example code (thumb, generated by gcc 4.8):
< +0>: push  {r4, r7, lr}
< +2>: sub   sp, #0x14
< +4>: add   r7, sp, #0x0
...
<+50>: adds  r7, #0x14 ; The CL fixes the handling of this instruction
<+52>: mov   sp, r7    ; Previously unwinding from here was broken
<+54>: pop   {r4, r7, pc}

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

llvm-svn: 261318
2016-02-19 10:59:25 +00:00
Jason Molenda 878ae01889 This patch stops lldb from loading a .lldbinit file from the current
working directory by default -- a typical security problem that we
need to be more conservative about.

It adds a new target setting, target.load-cwd-lldbinit which may
be true (always read $cwd/.lldbinit), false (never read $cwd/.lldbinit)
or warn (warn if there is a $cwd/.lldbinit and don't read it).  The
default is set to warn.  If this is met with unhappiness, we can look
at changing the default to true (to match current behavior) on a 
different platform.

This does not affect reading of ~/.lldbinit - that will still be read,
as before.  If you run lldb in your home directory, it will not warn
about the presence of a .lldbinit file there.

I had to add two SB API - SBHostOS::GetUserHomeDirectory and 
SBFileSpec::AppendPathComponent - for the lldb driver code to be
able to get the home directory path in an OS neutral manner.

The warning text is

There is a .lldbinit file in the current directory which is not being read.
To silence this warning without sourcing in the local .lldbinit,
add the following to the lldbinit file in your home directory:
    settings set target.load-cwd-lldbinit false
To allow lldb to source .lldbinit files in the current working directory,
set the value of this variable to true.  Only do so if you understand and
accept the security risk.

<rdar://problem/24199163> 

llvm-svn: 261280
2016-02-19 00:05:17 +00:00
Jim Ingham 7b71c0ba6c Make sure code that is in the middle of figuring out the correct architecture
on attach uses the architecture it has figured out, rather than the Target's
architecture, which may not have been updated to the correct value yet.

<rdar://problem/24632895>

llvm-svn: 261279
2016-02-18 23:58:45 +00:00
Eugene Zelenko 9e85e5a8c9 Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in source/Commands/CommandObjectBreakpoint.cpp; other minor fixes.
llvm-svn: 261272
2016-02-18 22:39:14 +00:00
Enrico Granata c525d3d4c7 Fix a typo in FormatCache.cpp such that the cache would potentially return an invalid format in some cases
llvm-svn: 261246
2016-02-18 19:23:52 +00:00
Eugene Zelenko d70a6e71a9 Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Target; other minor fixes.
llvm-svn: 261242
2016-02-18 18:52:47 +00:00
Ewan Crawford c6bef146ca Fix OSX cmake build
Commit r260721(http://reviews.llvm.org/D17182) introduced the following error when building for OSX using cmake:

Undefined symbols for architecture x86_64:

"_PyInit__lldb", referenced from:
   -exported_symbol[s_list] command line option

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Adding '*' to the regex solves this problem, since it makes the symbol optional.

Reviewers: sivachandra, zturner, labath
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D17384

llvm-svn: 261227
2016-02-18 17:01:40 +00:00
Bhushan D. Attarde 3592a6ec6b [LLDB][MIPS] Provide CPU string to compiler for appropriate code generation for MIPS
SUMMARY:
    This patch implements ArchSpec::GetClangTargetCPU() that provides string representing current architecture as a target CPU.
    This string is then passed to tools like clang so that they generate correct code for that target.
    
    Reviewers: clayborg, zturner
    Subscribers: mohit.bhakkad, sagar, jaydeep, lldb-commits
    Differential Revision: http://reviews.llvm.org/D17022

llvm-svn: 261206
2016-02-18 11:53:28 +00:00
Tamas Berghammer 6b63b14851 Improve the handling of missing elf symtab and missing symbol sizes
* Generate artificial symbol names from eh_fame during symbol parsing
  so these symbols are already present when we calcualte the size of
  the symbols where 0 is specified.
* Fix symbol size calculation for the last symbol in the file where
  it have to last until the end of the parent section.

This is the re-commit of the original change after fixing some test
failures on OSX.

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

llvm-svn: 261205
2016-02-18 11:12:18 +00:00
Aidan Dodds b0be30f71a [Renderscript] Refactor .rs.info parser.
This patch refactors the .rs.info table parser so that its more in line with the current language runtime code.

llvm-svn: 261202
2016-02-18 10:59:46 +00:00
Eugene Zelenko 9394d772c0 Fix Clang-tidy modernize-use-nullptr warnings; other minor fixes.
llvm-svn: 261179
2016-02-18 00:10:17 +00:00
Enrico Granata 984af07ae5 Apple simulator platforms don't have a shared cache to load Objective-C class information from
This code was doing the right thing for the iOS simulator, but not other simulator platforms

Fix it by making the warning not happen for all platforms whose name ends in "-simulator"
Since this code lives in AppleObjCRuntimeV2.cpp, this already only applies to Apple platforms by definition, so I am not too worried about conflicts with other vendors

llvm-svn: 261165
2016-02-17 22:14:41 +00:00
Tamas Berghammer be379e1590 Revert "Use BKPT instead of UDF for arm/thumb breakpoints"
This reverts commit 293c18e067d663e0fe93e6f3d800c2a4bfada2b0.

The BKPT instruction generates SIGBUS instead of SIGTRAP in the Linux
kernel on Nexus 6 - 5.1.1 (kernel version 3.10.40). Revert the CL
until we can figure out how can we hanble the SIGBUS or how to get
back a SIGTRAP using the BKPT instruction.

llvm-svn: 260969
2016-02-16 15:14:36 +00:00
Jason Molenda ebeff4c11e Fix buildbot failure because I got an include path wrong.
llvm-svn: 260932
2016-02-16 04:20:56 +00:00
Jason Molenda 62e0681afb Add -Wimplicit-fallthrough command line option to clang in
the xcode project file to catch switch statements that have a
case that falls through unintentionally.

Define LLVM_FALLTHROUGH to indicate instances where a case has code
and intends to fall through.  This should be in llvm/Support/Compiler.h;
Peter Collingbourne originally checked in there (r237766), then
reverted (r237941) because he didn't have time to mark up all the
'case' statements that were intended to fall through.  I put together
a patch to get this back in llvm http://reviews.llvm.org/D17063 but
it hasn't been approved in the past week.  I added a new
lldb-private-defines.h to hold the definition for now.

Every place in lldb where there is a comment that the fall-through
is intentional, I added LLVM_FALLTHROUGH to silence the warning.
I haven't tried to identify whether the fallthrough is a bug or
not in the other places.

I haven't tried to add this to the cmake option build flags.
This warning will only work for clang.

This build cleanly (with some new warnings) on macosx with clang
under xcodebuild, but if this causes problems for people on other
configurations, I'll back it out.

llvm-svn: 260930
2016-02-16 04:14:33 +00:00
Saleem Abdulrasool 1ee07253c7 Silence some clang warnings
Silences -Wmissing-brace and -Wformat-pedantic warnings from clang on Linux.  NFC.

llvm-svn: 260914
2016-02-15 21:50:28 +00:00
Jim Ingham b6bdfc522c Refinement of r260624. It is possible somebody might try to add to the map
while we are finalizing its elements.  Prevent that.

<rdar://problem/24554920>

llvm-svn: 260909
2016-02-15 20:04:15 +00:00
Saleem Abdulrasool 2f1d3ac99d ExpressionParser: silence some GCC warnings
Silence a -Wreorder warning about order of member initialization and a
-Wqual-cast warning about casting away constness.  NFC.

llvm-svn: 260868
2016-02-15 03:23:14 +00:00
Jason Molenda 5f826bbc51 Additional fix to my change in r259983 to handle the
case where a core file has a kernel binary and a user
process dyld in the same one.  Without this, we were
always picking the dyld and trying to process it as a
kernel.

<rdar://problem/24446112> 

llvm-svn: 260803
2016-02-13 04:15:02 +00:00
Jim Ingham cbf6f9b243 Adding an SBThread::StepInto that takes an end-line, also moved the code that figures
out the address range for the step to SymbolContext.

llvm-svn: 260772
2016-02-13 00:31:47 +00:00
Sean Callanan 2a8fa2a888 Removed many JIT workarounds from IRForTarget.
Since IRExecutionUnit is now capable of looking up symbols, and the JIT is up to
the task of generating the appropriate relocations, we don't need to do all the
work that IRForTarget used to do to fixup symbols at the IR level.

We also don't need to allocate data manually (with its attendant bugs) because
the JIT is capable of doing so without crashing.

We also don't need the awkward lldb.call.realName metadata to determine what
calls are objc_msgSend, because they now just reference objc_msgSend.

To make this work, we ensure that we recognize which symbols are extern "C" and
report them to the compiler as such.  We also report the full Decl of functions
rather than just making up top-level functions with the appropriate types.

This should not break any testcases, but let me know if you run into any issues.

<rdar://problem/22864926>

llvm-svn: 260768
2016-02-13 00:01:46 +00:00
Sean Callanan f45270342c Fix stripping of _ when looking for symbols in IRExecutionUnit.
Previously we would try both versions of a symbol -- the one with _ in it and
the one without -- in all cases, because we didn't know what the current
platform's policy was.  However, stripping _ is only necessary on platforms
where _ is the prefix for global symbols.

There's an API that does this, though, on llvm::DataLayout, so this patch fixes
IRExecutionUnit to use that API to determine whether or not to strip _ from the
symbol or not.

llvm-svn: 260767
2016-02-12 23:55:13 +00:00
Enrico Granata fdecea7f59 Remove an unnecessary include
llvm-svn: 260761
2016-02-12 23:12:27 +00:00
Enrico Granata 75995b5e86 Data formatter support for libc++ std::atomic<T>
On libc++ std::atomic is a fairly simple data type (layout wise, at least), wrapping actual contents in a member variable named "__a_"

All the formatters are doing is "peel away" this intermediate layer and exposing user data as direct children or values of the std::atomic root variable

Fixes rdar://24329405

llvm-svn: 260752
2016-02-12 22:18:24 +00:00
Sean Callanan 8c05fb9fff Disable recognition of "using" declarations at translation-unit level.
Currently CountDeclLevels uses the ASTs which have no distinction between
separate translation units.  If one .o file has a "using" declaration at
translation unit level, that "using" declaration will be in the same translation
unit as functions from other .o files in the same module.  This leads to
erroneous name conflicts as the CountDeclLevels-based function filtering logic
accepts too many fucntions.

In the future we will identify the translation units for top-level Decls more
reliably and restore that functionality.  There's a TODO to that effect in the
code.

llvm-svn: 260747
2016-02-12 21:55:05 +00:00
Sean Callanan 8c62daf250 IRInterpreter now recognizes expressions with constants it doesn't handle.
If an instruction has a constant that IRInterpreter doesn't know how to deal
with (say, an array constant, because we can't materialize it to APInt) then we
used to ignore that and only fail during expression execution.  This is annoying
because if IRInterpreter had just returned false from CanInterpret(), the JIT
would have been used.

Now the IRInterpreter checks constants as part of CanInterpret(), so this should
hopefully no longer be an issue.

llvm-svn: 260735
2016-02-12 21:16:58 +00:00
Sean Callanan b281480203 Centralized symbol lookup in IRExecutionUnit, and fixed the code model.
I'm preparing to remove symbol lookup from IRForTarget, where it constitutes a
dreadful hack working around no-longer-existing JIT bugs.  Thanks to our 
contributors, IRForTarget has a lot of smarts that IRExecutionUnit doesn't have,
so I've cleaned them up a bit and moved them over to IRExecutionUnit.

Also for historical reasons, IRExecutionUnit used the "Small" code model on non-
ELF platforms (namely, OS X).  That's no longer necessary, and we can use the
same code model as everyone else on OS X.  I've fixed that.

llvm-svn: 260734
2016-02-12 21:11:25 +00:00
Siva Chandra 29d9bea93f Adjust for Python-3.
Summary:
This does not yet give us a clean testsuite run but it does help with:
1. Actually building on linux
2. Run the testsuite with over 70% tests passing on linux.

Reviewers: tfiala, labath, zturner

Subscribers: lldb-commits

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

llvm-svn: 260721
2016-02-12 20:30:47 +00:00
Sean Callanan 7b3ef05a37 Objective-C++ is a kind of C++.
llvm-svn: 260715
2016-02-12 19:47:57 +00:00
Sean Callanan 92734d1b2b Make Target::CalculateProcess() return a sensible result.
The Calculate* functions in general should not derive any information that isn't
implicit, but for Target the process pointer is a member so it's fine to return
it for CalculateProcess().

llvm-svn: 260713
2016-02-12 19:45:31 +00:00
Enrico Granata 2543d29048 The data formatters for NSArray, NSDictionary and (only partially) NSSet contain logic to inspect the objects without running code.
However, they also contain fallback logic that - in cases where LLDB can't recognize the specific subclass - actually does run code in order to inspect those objects.

The argument for this logic was that these data types are critical enough that the risk of getting it wrong is outweighed by the advantage of always providing accurate child information.

Practical experience however shows that "po" - a code running data-inspection command - is quite frequently used, and not considered burdensome by users.
As such, this makes the code-running fallback in the data formatters a risk that carries very little actual reward. Also, unlike the time this code was originally written, we now have accurate class information for Objective-C, and thus we are less likely to improperly identify classes.

This commit removes support for the code-running fallback, and aligns the data formatters for NSArray, NSDictionary and NSSet to the general no-code-running behavior of other data formatters.

While it is possible for us to add support for some subclasses that are now no longer covered by static inspection alone, this is beyond the scope of this commit.

llvm-svn: 260664
2016-02-12 07:50:15 +00:00
Greg Clayton 9ddad935b9 Don't crash if we have a DIE that has a DW_AT_ranges attribute and yet the SymbolFileDWARF doesn't have a DebugRanges. If this happens print a nice error message to prompt the user to file a bug and attach the offending DWARF file so we can get the correct compiler fixed.
<rdar://problem/24458016>

llvm-svn: 260626
2016-02-12 00:07:16 +00:00
Jim Ingham 0ea010aecb When calling TypeSystemMap::Clear, objects being destroyed in the process of
clearing the map ended up calling back into the TypeSystemMap to do lookups.  
Not a good idea, and in this case it would cause a deadlock.

You would only see this when replacing the target contents after an exec, and only if you 
had stopped before the exec, evaluated an expression, then continued
on to the point where you did the exec.  

Fixed this by making sure the TypeSystemMap::Clear tears down the TypeSystems in the map before clearing the map.
I also add an expression before exec to the TestExec.py so that we'll catch this
issue if it crops up again in the future.

<rdar://problem/24554920>

llvm-svn: 260624
2016-02-12 00:03:19 +00:00
Greg Clayton 565aaf6194 Removed a bad assertion:
assert(((SymbolFileDWARF*)m_ast.GetSymbolFile())->UserIDMatches(die.GetDIERef().GetUID()) &&
       "Adding incorrect type to forward declaration map");

The problem is that "m_ast.GetSymbolFile()" can return a SymbolFileDWARFDebugMap. The code is doing the right thing if the assertion is ignored.

<rdar://problem/24437972>

llvm-svn: 260618
2016-02-11 23:36:57 +00:00
Adrian McCarthy 6fadea62b5 Improve ReadRegister for RegisterContextWindowsx86
In some circumstances (notably, certain minidumps), the thread CONTEXT does not have values for the
control registers (EIP, ESP, EBP, EFLAGS).  There are flags in the CONTEXT which indicate which
portions are valid, but those flags weren't checked.  The old code would not detect this and give a
garbage value for the register.  The new code will log the problem and return an error.

I consolidated the error checking and logging into a helper function, which makes the big switch
statement easier to read and verify.

Ran tests to ensure this doesn't break anything.  Manually verified that a minidump without info on
the control registers now indicates the problem instead of giving bad information.

Differential Review: http://reviews.llvm.org/D17152

llvm-svn: 260559
2016-02-11 18:24:57 +00:00
Aidan Dodds 72f775253f [Renderscript] Fix typo in mips64 argument reading code.
A typo in the mips64 argument reading code would cause register passed arguments to be truncated to 32bits.

llvm-svn: 260546
2016-02-11 17:17:12 +00:00
Aidan Dodds f478678549 [Renderscript] Refactor target argument reading code.
This patch reworks the function argument reading code, allowing us to annotate arguments with their types.  The type/size information is needed to correctly parse arguments passed on the stack.

llvm-svn: 260525
2016-02-11 15:16:37 +00:00
Omair Javaid 62498ff8f5 Handle floating-point type homogeneous aggregate return values in ABISysV_arm
For details refer to review link given below.

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

llvm-svn: 260512
2016-02-11 11:41:22 +00:00
Jim Ingham b4a5aa239c Revert 260436. I pretty consistently upper-case the letter I use for the
short option as an aid to memory.  Like it's w because of the W in throW.

That helps me remember.  If we are going to take these out we should take them
all out.  But I kind of like them.

llvm-svn: 260452
2016-02-10 22:30:20 +00:00
Sean Callanan 3f9de74ba1 When importing Objective-C protocols, mark them as having external decls.
We already do this for Objective-C interfaces, but we never handled protocols
because the DWARF didn't represent them.  Nowadays, though, we can import them
from modules, and we have to mark them properly.

<rdar://problem/24193009>

llvm-svn: 260445
2016-02-10 22:00:32 +00:00
Enrico Granata 909e2cdc54 No reason for these two letters to be uppercase
llvm-svn: 260436
2016-02-10 21:30:20 +00:00
Greg Clayton ae088e52f3 Now that SymbolFileDWARF supports having types in completely separate .pcm file with "-fmodules -gmodules", each SymbolFileDWARF can reference module DWARF info by looking in other DWARF files. Then if you have 1000 .o files that each reference one or more .pcm files in their debug info, a simple Module::FindTypes(...) call can end up searching the same .pcm file over and over and over. Now all internal FindTypes methods in classes (ModuleList, Module, SymbolFile) now take an extra argument:
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files
    
Each time a SymbolFile::FindTypes() is called, it needs to check the searched_symbol_files list to make sure it hasn't already been asked to find the type and return immediately if it has been checked. This will stop circular dependencies from also crashing LLDB during type queries. 

This has proven to be an issue when debugging large applications on MacOSX that use DWARF in .o files. 

<rdar://problem/24581488>

llvm-svn: 260434
2016-02-10 21:28:13 +00:00
Tamas Berghammer 5bfd4d0008 Revert "Improve the handling of missing elf symtab and missing symbol sizes"
This reverts commit 252dda67782f2cbf838e375bce21ed4191f6d9ce.

The commit caused several test failure on the OSX build bot.

llvm-svn: 260377
2016-02-10 12:10:58 +00:00
Ewan Crawford ea0636b554 [RenderScript] Refactor allocation expressions
Patch refractors RS plugin code specifying how format strings are used to JIT the runtime.

Author: Dean De Leo <dean@codeplay.com>
llvm-svn: 260372
2016-02-10 11:23:27 +00:00
Tamas Berghammer ed844cbc0f Improve the handling of missing elf symtab and missing symbol sizes
* Generate artificial symbol names from eh_fame during symbol parsing
  so these symbols are already present when we calcualte the size of
  the symbols where 0 is specified.
* Fix symbol size calculation for the last symbol in the file where
  it have to last until the end of the parent section.

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

llvm-svn: 260369
2016-02-10 10:43:34 +00:00
Tamas Berghammer 10e9923841 Fix handling of the arm IT instruction in the unwinder
The IT instruction can specify condition code for up to 4 consecutive
instruction and it is used quite often by clang in epilogues causing
an issue when trying to unwind from locations covered by the IT
instruction and for locatins inmediately after the IT instruction.

Changes made to fix it:
* Introduce the concept of conditional instruction block what is a list
  of consecutive instructions with the same condition. We update the
  unwind information during the conditional instruction block and when
  we reach the end of it (first instruction with a differemt condition)
  then we restore the unwind information we had before the condition.
* Fix a bug in the ARM instruction emulator where neither PC nor the
  ITSTATE was advanced when we reached an instruction what we can't
  decode.

After the change we have no regression on android-arm running the
regular test suit and TestStandardUnwind also passes when running it
with clang as the compiler (previously it failed on an IT instruction).

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

llvm-svn: 260368
2016-02-10 10:42:13 +00:00
Tamas Berghammer 1b6dacbb86 Use BKPT instead of UDF for arm/thumb breakpoints
The UDF instruction is deprecated in armv7 and in case of thumb2
instructions set it don't work well together with the IT instruction.

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

llvm-svn: 260367
2016-02-10 10:42:00 +00:00
Jim Ingham c17d6bdbfb This is an idea to make "thread step-in --target" work for the common
case where you have:

1 ->    foo (bar(),
2            baz(),
3            lala());
4

You are sitting on line 1, and want to step into foo, but not bar, baz & lala.  Unfortunately
there are line table entries for lines 1-3, and lldb doesn't know anything about the nesting
of statement in these lines.  So we'll have to use the user's intelligence...  This patch adds:

(lldb) thread step-in -t foo --end-line 4

That tells lldb to keep stepping in till line 4, but stop if you step into foo.  I think I would
remember to use this when faced with some of the long gnarly call sequences in lldb.  But there
might be ways I haven't thought of to make it more convenient.  Jason suggests having "end" as a
special token for --end-line which just means keep going to the end of the function, I really want
to get into this thing...

There should be an SB API and tests, which will come if this seems useful.

llvm-svn: 260352
2016-02-10 03:25:24 +00:00
Adrian McCarthy e286b8d652 Don't dereference the first element of an empty container.
llvm-svn: 260331
2016-02-10 00:06:50 +00:00
Greg Clayton 343f898443 Added code that was commented out during testing to stops template member functions from being added to class definitions (see revision 260308 for details).
<rdar://problem/24483905>
<rdar://problem/24508374>

llvm-svn: 260322
2016-02-09 23:25:54 +00:00
Greg Clayton fb85e6288b Fixed many issues that were causing differing type definition issues to show up when parsing expressions.
1) Turns out we weren't correctly uniquing types for C++. We would search our repository for "lldb_private::Process", but yet store just "Process" in the unique type map. Now we store things correctly and correctly unique types.
2) SymbolFileDWARF::CompleteType() can be called at any time in order to complete a C++ or Objective C class. All public inquiries into the SymbolFile go through SymbolVendor, and SymbolVendor correctly takes the module lock before it call the SymbolFile API call, but when we let CompilerType objects out in the wild, they can complete themselves at any time from the expression parser, so the ValueObjects or (SBValue objects in the public API), and many more places. So we now take the module lock when completing a type to avoid two threads being in the SymbolFileDWARF at the same time.
3) If a class has a template member function like:

    class A
    { 
        <template T>
        void Foo(T t);
    };
    
    The DWARF will _only_ contain a DW_TAG_subprogram for "Foo" if anyone specialized it. This would cause a class definition for A inside a.cpp that used a "int" and "float" overload to look like:
    class A
    {
        void Foo(int t);
        void Foo(double t);
    };
    
    And a version from b.cpp that used a "float" overload to look like:
    class A
    {
        void Foo(float t);
    };

    And a version from c.cpp that use no overloads to look like:    
    
    class A
    {
    };
    
    Then in an expression if you have two variables, one name "a" from a.cpp in liba.dylib, and one named "b" from b.cpp in libb.dylib, you will get conflicting definitions for "A" and your expression will fail. This all stems from the fact that DWARF _only_ emits template specializations, not generic definitions, and they are only emitted if they are used. There are two solutions to this:
    a) When ever you run into ANY class, you must say "just because this class doesn't have templatized member functions, it doesn't mean that any other instances might not have any, so when ever I run into ANY class, I must parse all compile units and parse all instances of class "A" just in case it has member functions that are templatized.". That is really bad because it means you always pull in ALL DWARF that contains most likely exact duplicate definitions of the class "A" and you bloat the memory that the SymbolFileDWARF plug-in uses in LLDB (since you pull in all DIEs from all compile units that contain a "A" definition) uses for little value most of the time.
    b) Modify DWARF to emit generic template member function definitions so that you know from looking at any instance of class "A" wether it has template member functions or not. In order to do this, we would have to have the ability to correctly parse a member function template, but there is a compiler bug: 
    <rdar://problem/24515533> [PR 26553] C++ Debug info should reference DW_TAG_template_type_parameter
    This bugs means that not all of the info needed to correctly make a template member function is in the DWARF. The main source of the problem is if we have DWARF for a template instantiation for "int" like: "void A::Foo<int>(T)" the DWARF comes out as "void A::Foo<int>(int)" (it doesn't mention type "T", it resolves the type to the specialized type to "int"). But if you actually have your function defined as "<template T> void Foo(int t)" and you only use T for local variables inside the function call, we can't correctly make the function prototype up in the clang::ASTContext. 
    
    So the best we can do for now we just omit all member functions that are templatized from the class definition so that "A" never has any template member functions. This means all defintions of "A" look like:
    
    class A
    {
    };
    
    And our expressions will work. You won't be able to call template member fucntions in expressions (not a regression, we weren't able to do this before) and if you are stopped in a templatized member function, we won't know that are are in a method of class "A". All things we should fix, but we need <rdar://problem/24515533> fixed first, followed by:
    
    <rdar://problem/24515624> Classes should always include a template subprogram definition, even when no template member functions are used
    
    before we can do anything about it in LLDB.

This bug mainly fixed the following Apple radar:

<rdar://problem/24483905>

llvm-svn: 260308
2016-02-09 22:36:24 +00:00
Greg Clayton 36ab260b0d Don't complete a class type just to test if it is a class. Code in CompilerType and in clang::QualType knows how to complete a type if it needs to.
llvm-svn: 260299
2016-02-09 22:09:26 +00:00
Jim Ingham cc3a4595f7 Mention the --all-files option in the -p help string.
llvm-svn: 260247
2016-02-09 18:53:49 +00:00
Pavel Labath b625a0e1bc Fix invalid shift operator overload in Scalar
Summary: This also fixes an infinite recursion between lldb_private::operator>> () and Scalar::operator>>= ().

Reviewers: sagar, tberghammer, labath

Subscribers: lldb-commits

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

Patch by Marianne Mailhot-Sarrasin

llvm-svn: 260239
2016-02-09 17:28:01 +00:00
Enrico Granata b1cf558d83 Fix an issue where pressing CTRL+C in the interactive script interpreter causes LLDB to crash
This is because PyThreadState_Get() assumes a non-NULL thread state and crashes otherwise; but PyThreadState_GET is just a shortcut (in non-Python-debugging builds) for the global variable that holds the thread state

The behavior of CTRL+C is slightly more erratic than one would like. CTRL+C in the middle of execution of Python code will cause that execution to be interrupted (e.g. time.sleep(1000)), but a CTRL+C at the prompt will just cause a KeyboardInterrupt and not exit the interpreter - worse, it will only trigger the exception once one presses ENTER.

None of this is optimal, of course, but I don't have a lot of time to appease the Python deities with the proper spells right now, and fixing the crasher is already a good thing in and of itself

llvm-svn: 260199
2016-02-09 05:46:47 +00:00
Bhushan D. Attarde b4fd8bb27e [LLDB][MIPS] Fix TestExpressionInSyscall.py for MIPS
SUMMARY:
    This patch fixes TestExpressionInSyscall.py and solves bug 23659 for MIPS.
    Corrected indentation at couple of places.
    
    Reviewers: clayborg
    Subscribers: mohit.bhakkad, sagar, jaydeep, lldb-commits
    Differential Revision: http://reviews.llvm.org/D16916

llvm-svn: 260072
2016-02-08 04:35:51 +00:00
Jason Molenda 880988af09 ProcessMachCore scans through the core file pages looking for a
user process dyld binary and/or a mach kernel binary image.  By
default, it prefers the kernel if it finds both.

But if it finds two kernel binary images (which can happen when
random things are mapped into memory), it may pick the wrong
kernel image.  

DynamicLoaderDarwinKernel has heuristics to find a kernel in memory;
once we've established that there is a kernel binary in memory,
call over to that class to see if it can find a kernel address via
its search methods.  If it does, use that.

Some minor cleanups to DynamicLoaderDarwinKernel while I was at it.

<rdar://problem/24446112> 

llvm-svn: 259983
2016-02-06 04:55:26 +00:00
Enrico Granata 41571781c0 Per Jim's suggestion, move checks that we're not mixing and matching Debuggers and Commands deeper in the bowels of LLDB
NFC

llvm-svn: 259972
2016-02-06 01:36:07 +00:00
Enrico Granata 0a66e2f135 Fix an issue where certain CommandObjects (or Options thereof) were being created once, bound to a specific CommandInterpreter (and hence a specific Debugger), and then cached for reuse across different Debugger instances
Obviously, if the original Debugger goes away, those commands are holding on to now stale memory, which has the potential to cause crashes

Fixes rdar://24460882

llvm-svn: 259964
2016-02-06 00:43:07 +00:00
Jim Ingham 1f5fcf8afd Fix "thread backtrace -s": option was misparsed because of a missing break.
<rdar://problem/24525106>

llvm-svn: 259962
2016-02-06 00:31:23 +00:00
Siva Chandra 03ff5c8616 Take 2: Use an artifical namespace so that member vars do not hide local vars.
Summary: This relands r259810 with fix for failures on Mac.

Reviewers: spyffe, tfiala

Subscribers: tfiala, lldb-commits

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

llvm-svn: 259902
2016-02-05 19:10:04 +00:00
Omair Javaid 0a76722518 Add support to detect arm hard float ABI based binaries for ABISysV_arm
This patch adds logic to detect if underlying binary is using arm hard float abi and use that information while handling return values in ABISysV_arm.

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

llvm-svn: 259885
2016-02-05 14:37:53 +00:00
Jason Molenda ec504238e4 Add two more addresses to check for the address of the kernel in debug mode;
also add some logging about where lldb is lookin for a kernel as it connects.
<rdar://problem/24454582> 

llvm-svn: 259865
2016-02-05 01:38:56 +00:00
Jason Molenda aa3c37ae79 Add a little logging to ProcessMachCore so it is easier to tell when a user process dyld
or mach kernel binary are found, and if there are multiples of them found within a single
corefile.
<rdar://problem/24446112> 

llvm-svn: 259850
2016-02-04 23:45:17 +00:00
Siva Chandra 77b326f39d Revert "Use an artifical namespace so that member vars do not hide local vars."
Summary:
This reverts commit 8af14b5f9af68c31ac80945e5b5d56f0a14b38e4.
Reverting as it breaks a few tests on Mac.

Reviewers: spyffe

Subscribers: lldb-commits

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

llvm-svn: 259823
2016-02-04 20:08:40 +00:00
Jim Ingham 97c2868362 Make HostThread SetName work on OS X. GetName doesn't currently work, the code that was in
GetName actually got the queue name not the thread name and anyway didn't actually work to do
that.  So I just deleted it with a fixme.

<rdar://problem/24487554>

llvm-svn: 259818
2016-02-04 19:42:32 +00:00
Siva Chandra 375882dddb Use an artifical namespace so that member vars do not hide local vars.
Summary:
While evaluating expressions when stopped in a class method, there was a
problem of member variables hiding local variables. This was happening
because, in the context of a method, clang already knew about member
variables with their name and assumed that they were the only variables
with those names in scope. Consequently, clang never checks with LLDB
about the possibility of local variables with the same name and goes
wrong. This change addresses the problem by using an artificial
namespace "$__lldb_local_vars". All local variables in scope are
declared in the "$__lldb_expr" method as follows:

    using $__lldb_local_vars::<local var 1>;
    using $__lldb_local_vars::<local var 2>;
    ...

This hides the member variables with the same name and forces clang to
enquire about the variables which it thinks are declared in
$__lldb_local_vars. When LLDB notices that clang is enquiring about
variables in $__lldb_local_vars, it looks up local vars and conveys
their information if found. This way, member variables do not hide local
variables, leading to correct evaluation of expressions.

A point to keep in mind is that the above solution does not solve the
problem for one specific case:

    namespace N
    {
        int a;
    }

    class A
    {
    public:
        void Method();
        int a;
    };

    void
    A::Method()
    {
        using N::a;
        ...

        // Since the above solution only touches locals, it does not
        // force clang to enquire about "a" coming from namespace N.
    }

Reviewers: clayborg, spyffe

Subscribers: lldb-commits

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

llvm-svn: 259810
2016-02-04 18:38:35 +00:00
Adrian McCarthy 25bfa7859c Provide arguments for all the format string placeholders!
Log message was wrong because an argument was missing.

llvm-svn: 259793
2016-02-04 15:35:55 +00:00
Ewan Crawford 0d2bfcfb34 [RenderScript] Add command for recalculating allocation details
Patch replaces the --refresh flag removed in r258800 with it's own command, 'language renderscript allocation refresh'.
Since there is no reason this functionality should be tied to another command as an option. 
The command itself simply re-JITs all our cached information about allocations.

llvm-svn: 259773
2016-02-04 09:44:23 +00:00
Jim Ingham a1ca8148a1 Fix a little threading thinko in StartPrivateStateThread - don't pass stack variables
as args to a pthread_create function...

<rdar://problem/24485206>

llvm-svn: 259738
2016-02-04 01:34:33 +00:00
Oleksiy Vyalov e551051a58 Pass socket scheme as part of debug server listen URL.
http://reviews.llvm.org/D16861

llvm-svn: 259714
2016-02-03 22:02:43 +00:00
Davide Italiano f5935a0abc [NetBSD] Remove dead code.
PR:		http://reviews.llvm.org/D16818
llvm-svn: 259686
2016-02-03 20:13:50 +00:00
Jim Ingham ac96dd3335 Remove a stray ;.
llvm-svn: 259685
2016-02-03 19:49:03 +00:00
Jim Ingham 22eeb7227c The SetStopInfo from a Mach Exception was setting the stop
reason to None when we stop due to a trace, then noticed that
we were on a breakpoint that was not valid for the current thread.
That should actually have set it back to trace.

This was pr26441 (<rdar://problem/24470203>)

llvm-svn: 259684
2016-02-03 19:45:31 +00:00
Aidan Dodds 1b6785a1df Add ability to override JIT expr compiler options.
Runtimes should be able to pass custom compilation options to the JIT for their stack frame. This patch adds a custom expression options member class to LanguageOptions, and modifies the clang expression evaluator to check the current runtime for those options. If those options are available on the runtime, they are passed to the clang compiler.

Committed for Luke Drummond.
Differential Revision: http://reviews.llvm.org/D15527

llvm-svn: 259644
2016-02-03 12:33:05 +00:00
Pavel Labath 1b58f5cbbb Fix an off-by-one in SocketTest::DecodeHostAndPort
65535 is still a valid port. This should fix the android failures we were getting when we chose
to connect over 65535 to the remote lldb-server.

llvm-svn: 259638
2016-02-03 11:12:23 +00:00
Ewan Crawford 75f0ff5ba1 [RenderScript] Use LLVM DWARF language enum
A DWARF language vender extension for RenderScript was added to LLVM in r259348(http://reviews.llvm.org/D16409)
We should use this generated enum instead of the hardcoded value.

RenderScript is also based on C99 with some extensions, so we want to use ClangASTContext when RS is detected.

Reviewers:  clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D16766

llvm-svn: 259634
2016-02-03 09:17:03 +00:00
Jim Ingham 39f7353a60 The compiler may use "line number 0" to indicate compiler generated goo that it can't
track a source for.  When we are pushing breakpoints and stepping past function prologues,
also push past code from line 0 immediately following the prologue end.

<rdar://problem/23730696>

llvm-svn: 259611
2016-02-03 00:07:23 +00:00
Siva Chandra b90168ff41 Fix a thinko in StackFrame::GetInScopeVariableList.
Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 259607
2016-02-02 23:49:41 +00:00
Adrian McCarthy 12a8ae23b0 Set correct thread stop info when single-step lands on a breakpoint [Windows]
I don't understand how this worked before, but this fixes the recent test regressions on Windows in TestConsecutiveBreakpoints.py.

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

llvm-svn: 259605
2016-02-02 23:38:08 +00:00
Todd Fiala 015b0cc258 Revert "[NFC] Cleanup RangeMap.h"
This reverts commit r259538.  Caused 92 test failures on
the OS X testbot.

llvm-svn: 259556
2016-02-02 20:26:50 +00:00
Tamas Berghammer 7a2a5ce058 [NFC] Cleanup RangeMap.h
The file contained very similar 4 implementation of the same data
structure with a lot of duplicated code and some minor API differences.
This CL refactor the class to eliminate the duplicated codes and to
unify the APIs.

RangeMap.h also contained a class called AddressDataArray what have very
little added functionality over an std::vector and used only by
ObjectFileMacO The CL moves the class to ObjectFileMachO.cpp as it isn't
belongs into RangeMap.h and shouldn't be used in new places anyway
because of the little added functionality.

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

llvm-svn: 259538
2016-02-02 18:18:13 +00:00
Pavel Labath d2474ff513 Log error message in SBTarget::Launch
llvm-svn: 259514
2016-02-02 15:16:20 +00:00
Tamas Berghammer 8e18fe6e54 Fix single stepping over the IT instruction
The ARM instruction emulator had 2 bugs related to the handling of the
IT instruction causing an error in single stepping:
* We haven't initialized the IT mask from the CPSR so if the last
  instruction of the IT block is a branch and the condition is false
  then the emulator evaluated the branch what resulted in an incorrect
  pc for the next instruction.
* The ITSTATE was advanced before the execution of each instruction. As
  a result the emulator was using the condition of following instruction
  in every case. The ITSTATE should be edvanced after the execution of
  an instruction except after an IT instruction.

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

llvm-svn: 259509
2016-02-02 14:32:11 +00:00
Pavel Labath e03bd650f3 Fix build after clang interface change in r259489
llvm-svn: 259494
2016-02-02 13:07:27 +00:00
Pavel Labath efd04a6c75 Fix single-stepping onto a breakpoint
Summary:
r259344 introduced a bug, where we fail to perform a single step, when the instruction we are
stepping onto contains a breakpoint which is not valid for this thread. This fixes the problem
and add a test case.

Reviewers: tberghammer, emaste

Subscribers: abhishek.aggarwal, lldb-commits, emaste

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

llvm-svn: 259488
2016-02-02 10:40:56 +00:00
Kamil Rytarowski d08778bade NetBSD: Define initial RegisterContextNetBSD_x86_64
Summary: Add basic support, i386 version will be added later.

Reviewers: emaste, joerg, clayborg, tfiala

Subscribers: lldb-commits

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

llvm-svn: 259462
2016-02-02 03:47:44 +00:00
Jim Ingham 59dd7fd153 We try to avoid static objects. These are on the error path for unsupported features
in the socket, so just returning freshly constructed objects is fine.

llvm-svn: 259443
2016-02-02 00:21:39 +00:00
Pavel Labath 061140c680 Remove Timer::Initialize routine
Summary:
I've run into an issue when running unit tests, where the underlying problem turned out to be
that we were creating Timer objects (through several layers of indirection) without calling
Timer::Initialize. Since Timer's thread-local storage was not properly initialized, we were
overwriting gtest's own thread-local storage, causing test failures.

Instead of requiring that every test calls Timer::Initialize(), I remove the function altogether:
The thread-local storage can be initialized on-demand, and the g_file variable initialized to
stdout and never changed, so I have simply removed it.

Reviewers: clayborg, zturner, tberghammer

Subscribers: lldb-commits

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

llvm-svn: 259356
2016-02-01 13:29:41 +00:00
Abhishek Aggarwal c2c8ca1ce3 Set correct ThreadStopInfo in case of trace event
Summary:
 - The patch solves Bug 23478 and Bug 19311. Resolving
   Bug 23478 also resolves Bug 23039.
      Correct ThreadStopInfo is set for Linux and FreeBSD
      platforms.

 - Summary:
      When a trace event is reported, we need to check
      whether the trace event lands at a breakpoint site.

      If it lands at a breakpoint site then set the thread's
      StopInfo with the reason 'breakpoint'. Else, set the reason
      to be 'Trace'.

Change-Id: I0af9765e782fd74bc0cead41548486009f8abb87
Signed-off-by: Abhishek Aggarwal <abhishek.a.aggarwal@intel.com>

Reviewers: jingham, emaste, lldb-commits, clayborg, ovyalov

Subscribers: emaste

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

llvm-svn: 259344
2016-02-01 09:01:42 +00:00
Jim Ingham cbff63adb4 Fixed a couple of places where we were getting the module from a
section and using it w/o checking that it was valid.  This can
cause crashes - usually when tearing down a target.

llvm-svn: 259237
2016-01-29 20:21:33 +00:00
Todd Fiala 0647dbb1d8 Revert "fix up missing header from change r259084."
This change was made based on a bad signal from the
Green Dragon LLDB builder.  This change was not needed.
Reverting out r259114.

llvm-svn: 259216
2016-01-29 18:13:30 +00:00
Eugene Leviant 24785bd0b8 Ignore breakpoints by default in SBFrame::EvaluateExpression
llvm-svn: 259185
2016-01-29 10:48:11 +00:00
Ewan Crawford 36175cc095 [RenderScript] Remove unused RS command
Patch deletes the 'language renderscript module probe' command.
This command was present in the initial commit to help debug the plugin.
However we haven't used it recently and it's functionality is unclear, so can be removed entirely. 

Also add back 'kernel coordinate' command, removed by accident in clang format patch r259056.

llvm-svn: 259181
2016-01-29 10:11:03 +00:00
Chaoren Lin 3b2bec41fd Fix TestDataFormatterScript for Linux.
Summary:
m_function_name will contain a dummy name for the auto-generated function from
the python script on Linux. Check for script name first.

Reviewers: granata.enrico

Subscribers: lldb-commits

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

llvm-svn: 259153
2016-01-29 03:48:08 +00:00
Enrico Granata fa7ae77af4 Fix a bug where type <formatter> list would ignore the -w argument
rdar://24379879

llvm-svn: 259135
2016-01-29 01:12:13 +00:00
Enrico Granata 6cc1998814 Fix a bug where LLDB would not print the name of the function that a scripted summary is bound to
rdar://24380076

llvm-svn: 259131
2016-01-29 00:56:52 +00:00
Todd Fiala d12f3750a3 fix up missing header from change r259084.
llvm-svn: 259114
2016-01-28 23:17:53 +00:00
Eugene Zelenko c33088f41e Remove autoconf support from source directories.
Differential revision: http://reviews.llvm.org/D16662

llvm-svn: 259098
2016-01-28 22:05:24 +00:00
Chaoren Lin edf25990a4 Fix build after rL259070.
llvm-svn: 259086
2016-01-28 20:25:46 +00:00
Manman Ren 98f9bc6456 Update lldb for API change in clang r259070.
llvm-svn: 259084
2016-01-28 19:55:50 +00:00
Enrico Granata 6b7427856a Fix an issue where the type <formatter> list command would not accept a valid argument and instead error out complaining about a malformed regex
rdar://problem/24380025

llvm-svn: 259078
2016-01-28 19:21:38 +00:00
Aidan Dodds b3f7f69d9a [Renderscript] Clang-format the renderscript plugin.
Run clang-format over the renderscript plugin and fix common formatting deviations.

llvm-svn: 259056
2016-01-28 16:39:44 +00:00
Aidan Dodds bdc52ef38b Fix const cast error for MSVC2015 build.
The Visual Studio 2015 build was failing with the following error:
error C2440: 'initializing': cannot convert from 'const char [12]' to 'char *'

This should fix the problem by initializing a non const char array, instead of taking a pointer to const static data.

llvm-svn: 259042
2016-01-28 13:05:21 +00:00
Greg Clayton 17499dde46 A while back in revison 244716 we added support for getting the host OS version info from debugserver. We added keys to "qHostInfo" that were "osmajor", "osminor" and "ospatch", but no one ever parsed those, so I am removing them from debugserver. We accidentally also added a "version" key to qHostInfo instead of "os_version". So now we need to support both "version" and "os_version" in qHostInfo since we have debugserver binaries out in the wild that support this old packet type. I have updated debugserver ot use the correct "os_version" for future compatability or correctness.
<rdar://problem/24378699> 

llvm-svn: 259003
2016-01-28 00:16:11 +00:00
Bhushan D. Attarde df5f0b448c [LLDB][MIPS] A small fix in GetBreakableLoadAddress() for MIPS
SUMMARY:
    Get the load address for the address given by symbol and function.
    Earlier, this was done for function only, this patch does it for symbol too.
    This patch also adds TestAvoidBreakpointInDelaySlot.py to test this change.
    
    Reviewers: clayborg
    Subscribers: labath, zturner, mohit.bhakkad, sagar, jaydeep, lldb-commits
    Differential Revision: http://reviews.llvm.org/D16049

llvm-svn: 258919
2016-01-27 10:16:30 +00:00
Saleem Abdulrasool 329860e495 Revert r258546.
Seems that the patch was rebased on top of another change which obsoleted the
change but wasnt caught.

Thanks to nbjoerg for pointing this out!

llvm-svn: 258821
2016-01-26 17:43:48 +00:00
Benjamin Kramer 79dad1d056 Update for LLVM change
llvm-svn: 258819
2016-01-26 16:45:00 +00:00
Ewan Crawford b649b0053b [RenderScript] Provide option to specify a single allocation to print
Patch replaces the 'renderscript allocation list' command flag --refresh, with a new option --id <ID>.
This new option only prints the details of a single allocation with a given id, rather than printing all the allocations.
Functionality from the removed '--refresh' flag will be moved into its own command in a subsequent commit.

llvm-svn: 258800
2016-01-26 10:41:08 +00:00
Adrian McCarthy c35b91cee2 Set symbol types for function symbols loaded from PE/COFF
This fixes the regression of several tests on Windows after rL258621.

The root problem is that ObjectFilePECOFF was not setting type information for the symbols, and the new CL rejects symbols without type information, breaking functionality like thread step-over.

The fix sets the type information for functions (and creates a TODO for other types).

Along the way, I fixed some typos and formatting that made the code I was debugging harder to understand.

In the long run, we should consider replacing most of ObjectFilePECOFF with the COFF parsing code from LLVM.

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

llvm-svn: 258758
2016-01-26 00:58:09 +00:00
Zachary Turner f9d6d204e8 Fix swig typemap for SBEvent.
This needs to be able to handle bytes, strings, and bytearray objects.
In Python 2 this was easy because bytes and strings are the same thing,
but in Python 3 the 2 cases need to be handled separately.  So as not
to mix raw Python C API code with PythonDataObjects code, I've also
introduced a PythonByteArray class to PythonDataObjects to make the
paradigm used here consistent.

llvm-svn: 258741
2016-01-25 23:21:09 +00:00
Mohit K. Bhakkad 0d9dd7df60 [LLDB] Consider only valid symbols while resolving by address
Reviewers: clayborg.
Subscribers: jaydeep, bhushan, sagar, nitesh.jain, lldb-commits.
Differential Revision: http://reviews.llvm.org/D16397

llvm-svn: 258621
2016-01-23 10:36:06 +00:00
Saleem Abdulrasool c98d969e9f Commands: silence dumb -Wextra warning from GCC
This is a rather unhelpful warning indicating that the ternary operator return
types are mismatched, returning an integer and an enumeral type.  Since the
integeral type is shorter to type, cast the enumeral type to `int`.  Silences
the -Wextra warning from GCC.

llvm-svn: 258548
2016-01-22 20:26:34 +00:00
Saleem Abdulrasool 79e6749da3 Target: fix -Wcast-qual warning
We were unnecessarily stripping the const qualifier on the temporary variable.
Restore the constness to avoid the warning.  NFC.

llvm-svn: 258547
2016-01-22 20:26:32 +00:00
Saleem Abdulrasool 27ea26b7c0 Silence -Wreturn-type warnings
Address a couple of instances of -Wreturn-type warning from GCC.  The switches
are covered, add an llvm_unreachable to the end of the functions to silence the
warning.  NFC.

llvm-svn: 258546
2016-01-22 20:26:30 +00:00
Bhushan D. Attarde b56e5d231f Use "_$" prefix instead of "$" for dynamic checker function inserted by LLDB during expression evaluation
SUMMARY:
    The symbol "$" has a special meaning for MIPS i.e it is marker for temporary symbols for MIPS.
    So this patch uses additional _ prefix for "$__lldb_valid_pointer_check" so that it wont be marked as temporary symbol in case of MIPS.
    
    Reviewers: clayborg, spyffe
    Subscribers: dean, emaste, mohit.bhakkad, sagar, jaydeep, lldb-commits
    Differential http://reviews.llvm.org/D14111

llvm-svn: 258485
2016-01-22 05:02:02 +00:00
Eduard Burtescu d05b899252 [opaque pointer types] [NFC] Fix fallout from DataLayout::getIndexedOffset changes (rL258478).
llvm-svn: 258481
2016-01-22 03:43:23 +00:00
Greg Clayton a5d1f62d2d Always try to read DW_TAG_typedef types from DWO files first if we can.
A lot of C code uses code like:

typedef struct 
{
   int a;
} FooType;
          
This creates debug info with an anonymous struct (a DW_TAG_structure_type with no DW_AT_name) and then a DW_TAG_typedef that points to the anonymous structure type. When a typedef is from a module and clang uses -gmodules and -fmodules, then we can end up trying to resolve an anonymous structure type in a DWO symbol file. This doesn't work very well when the structuture has no name, so we now check if a typedef comes from a module, and we directly resolve the typedef type in the module and copy it over. The version we copy from the module of course is correctly able to find the structure in the DWO symbol file, so this fixes the issues we run into.

<rdar://problem/24092915> 

llvm-svn: 258443
2016-01-21 22:26:13 +00:00
Adrian McCarthy 225d3ea340 Add CalculateSymbolSizes in ObjectFilePECOFF::GetSymtab to ensure that (nearly) all the symbols have sizes.
This fixes the `thread step-over` regression exposed by http://reviews.llvm.org/D16186 , which depends on the symbols having actual sizes.  Nine tests on Windows had started failing as a result.  They all work again with this fix.

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

llvm-svn: 258429
2016-01-21 20:58:12 +00:00
Jason Molenda 1a75b0d14f When ObjectFileMachO reads a Mach-O file for a 32-bit arm cpu,
set the triple's "vendor" field to Apple.  

We don't want to assume a vendor of Apple for all Mach-O files -
this breaks x86_64 EFI debugging where they put non-Apple binaries
in a Mach-O format for ease of handling.

But on armv7, Apple's ABI always uses r7 as the frame pointer
register; if we don't set the Vendor field to Apple, we can pick
up a generic armv7 ABI where the fp is r11 (or r7 for thumb) which
breaks backtracing altogether.

Greg is reluctant for us to make any assumptions about the Vendor
here, but we'll see how this shakes out.  It's such a big problem
on armv7 if we don't know this is using the Apple ABI that it's worth
trying this approach.

<rdar://problem/22137561> 

llvm-svn: 258387
2016-01-21 04:38:05 +00:00
Enrico Granata 35e0639018 Fix a problem where we were not calling fcntl() with the correct arguments for F_DUPFD
On Mac OS X, this was working just fine in debug builds (presumably, because the right value ended up being at the right location for the variadic ABI), but not in Release builds
As a result, we were seeing failures with commands that set their own immediate output stream - only in Release builds, which always makes for a fun little investigation

I have removed those fcntl() calls and replaced them with dup() calls. This fixes the issue in both Debug and Release builds

llvm-svn: 258367
2016-01-20 23:20:10 +00:00
Pavel Labath a975959996 Fix clang warning in RenderScriptRuntime
std::array should have "the same semantics as a struct holding a C-style array T[N] as its only
non-static data member", so the initialization should have one more level of braces. Hopefully,
no compiler will object to that.

llvm-svn: 258306
2016-01-20 12:23:23 +00:00
Ewan Crawford 4f8817c2db [RenderScript] New command for viewing coordinate of current kernel invocation
Patch adds command 'language renderscript kernel coordinate' for printing the kernel index in (x,y,z) format.
This is done by walking the call stack and looking for a function with suffix '.expand', as well as the frame variables containing the coordinate data. 

llvm-svn: 258303
2016-01-20 12:03:29 +00:00
Jason Molenda c197e81d07 Some 32-bit arm corefiles on darwin may have their general purpose
register set indicated by ARM_THREAD_STATE32 (value 9) instead of
the old ARM_THREAD_STATE (value 1); this patch changes lldb to
accept either register set flavor code.

<rdar://problem/24246257>

llvm-svn: 258289
2016-01-20 05:17:13 +00:00
Davide Italiano 13fe2a9517 Placate MVSC after my last commit.
Zachary introduced the 'default' case explicitly to placate a warning in
the Microsoft compiler but that broke clang with -Werror. 
The new code should keep both compilers happy.

llvm-svn: 258212
2016-01-19 22:47:51 +00:00
Davide Italiano 576dc8d27d [Process] Remove dead code. All the switch cases are already covered.
llvm-svn: 258199
2016-01-19 21:59:12 +00:00
Oleksiy Vyalov 8b85b03b06 Implementing the method Target::TargetEventData::Dump (Stream *s) so that its clients can easily dump it out for informational messages.
http://reviews.llvm.org/D16244

Submitting on behalf of vishwesh@google.com.

llvm-svn: 258150
2016-01-19 17:54:47 +00:00
Ravitheja Addepally 15f89c420b Fix for Bug 25338
Summary:
The issue arises because LLDB is not
able to read the vdso library correctly.
The fix adds memory allocation callbacks
to allocate sufficient memory in case the
requested offsets don't fit in the memory
buffer allocated for the ELF.

Reviewers: lldb-commits, clayborg, deepak2427, ovyalov, labath, tberghammer

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

llvm-svn: 258122
2016-01-19 12:55:21 +00:00
Tamas Berghammer 8c6996f737 Unconditionally accept symbol sizes from elf
The ELF symbol table always contain the size of the symbols so we
don't have to try to guess them based on the address of the next
symbol (it is needed for mach-o).

The change fixes an issue when a symbol is removed after a 0 size
symbol (e.g. because the second one is not public) what previously
caused the symbol lookup algorithm to end up with showing the 0 size
symbol even for the later addresses (what are not part of any symbol).
That symbol lookup error can confuse the user and also confuses the
current stack unwinder.

Re-commit this CL after fixing the issue with gcc-4.9.2 on i386 Linux.

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

llvm-svn: 258113
2016-01-19 10:24:51 +00:00
Rafael Espindola a94ae1e05b Update for llvm change. NFC.
llvm-svn: 258080
2016-01-18 20:57:54 +00:00
Tamas Berghammer dcad424cd3 Revert "Unconditionally accept symbol sizes from elf"
It causes issues for i386 when compiling with gcc-4.9.2

This reverts commit e248214a3eab8e244095f97d1996c991cb988cc4.

llvm-svn: 258043
2016-01-18 11:49:18 +00:00
Tamas Berghammer 6b2322fb4c Unconditionally accept symbol sizes from elf
The ELF symbol table always contain the size of the symbols so we
don't have to try to guess them based on the address of the next
symbol (it is needed for mach-o).

The change fixes an issue when a symbol is removed after a 0 size
symbol (e.g. because the second one is not public) what previously
caused the symbol lookup algorithm to end up with showing the 0 size
symbol even for the later addresses (what are not part of any symbol).
That symbol lookup error can confuse the user and also confuses the
current stack unwinder.

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

llvm-svn: 258040
2016-01-18 10:38:34 +00:00
Ewan Crawford 836d965168 [RenderScript] Remove mips specific expressions
Reverts earlier commit r254910, which used function pointers for jitted expressions
to avoid a Mips64 compiler bug. Bug has since been fixed, and compiler longer issues the problem instruction.

Author: Dean De Leo <dean@codeplay.com>
llvm-svn: 258038
2016-01-18 09:16:02 +00:00
Ryan Brown 47d072ca48 Implement missing GoASTContext methods
llvm-svn: 257926
2016-01-15 19:35:48 +00:00
Jim Ingham cc4609a26b The ASAN report fetching code had two latent bugs:
1) It was forward declaring functions without 'extern "C"'.  That used to work
   but only because of another bug in how we passes symbol only function names to the
   compiler and stopped working recently.
2) These forward declarations were in the body of the User Expression, and they actually
   need to go in the prefix file.

<rdar://problem/24177689>

llvm-svn: 257852
2016-01-15 01:03:50 +00:00
Sean Callanan e594268e37 Removed a redundant function call after review.
llvm-svn: 257818
2016-01-14 22:05:26 +00:00
Sean Callanan b0300a4c30 Enable the use of modules in the expression parser by default.
If your program refers to modules (as indicated in DWARF) we will now try to
load these modules and give you access to their types in expressions.  This used
to be gated by a setting ("settings set target.auto-import-clang-modules true")
but that setting defaulted to false.  Now it defaults to true -- but you can
disable it by toggling the setting to false.

llvm-svn: 257812
2016-01-14 21:46:09 +00:00
Sean Callanan 9b0cfe2510 Fixed a crasher when dealing with table entries that have blank names.
This can happen with -gmodules tables when an anonymous struct is referred to.

llvm-svn: 257786
2016-01-14 18:59:49 +00:00
Aidan Dodds e09c44b6ff [RenderScript] Hook kernel invocation.
This patch adds a hook to track kernel invocations and to track all script and allocation objects used.

llvm-svn: 257772
2016-01-14 15:39:28 +00:00
Ewan Crawford d0d85d22f8 Fix ambiguous resolution of clang::ArrayType/llvm::ArrayType in ClangAstContext
Both llvm and clang have an ArrayType class, which can cause resolution to fail when llvm headers that are implicitly included name this type.
source/Symbol/ClangASTContext.cpp has 'using namespace llvm;' and 'using namespace clang;' 

Author: Luke Drummond <luke.drummond@codeplay.com>
Differential Revision: http://reviews.llvm.org/D16155

llvm-svn: 257759
2016-01-14 12:18:09 +00:00
Hans Wennborg 400e1809ad Fix -Wformat-pedantic warning
/work/llvm-3.8/llvm.src/tools/lldb/source/API/SBProcess.cpp:1003:73:
error: format specifies type 'void *' but the argument has type 'lldb_private::Event *' [-Werror,-Wformat-pedantic]
        log->Printf ("SBProcess::%s (event.sp=%p) => %d", __FUNCTION__, event.get(), ret_val);
                                              ~~                        ^~~~~~~~~~~
1 error generated.

llvm-svn: 257692
2016-01-13 22:40:26 +00:00
Zachary Turner a505be4e5d Fix some compiler warnings with MSVC 2015.
llvm-svn: 257671
2016-01-13 21:22:00 +00:00
Zachary Turner 19e2ea8fb6 Fix TestProcessLaunch for Python 3.
There were a number of problems preventing this from working:

1. The SWIG typemaps for converting Python lists to and from C++
   arrays were not updated for Python 3.  So they were doing things
   like PyString_Check instead of using the PythonString from
   PythonDataObjects.
2. ProcessLauncherWindows was ignoring the environment completely.
   So any test that involved launching an inferior with any kind
   of environment variable would have failed.
3. The test itself was using process.GetSTDOUT(), which isn't
   implemented on Windows.  So this was changed to save the
   value of the environment variable in a local variable and
   have the debugger look at the value of the variable.

llvm-svn: 257669
2016-01-13 21:21:49 +00:00
Enrico Granata 744959b9c9 Fix an issue where scripted commands would not actually print any of their output if an immediate output file was set in the result object via a Python file object
Fixes rdar://24130303

llvm-svn: 257644
2016-01-13 18:11:45 +00:00
Tamas Berghammer 808ff186f6 Silence an incorrect dwarf parsing warning
We have a check what warns if the offset of a class member is greater
then or equal to the size of the class. The warning is valid in most
case but it is invalid when the last data member is a 0 size array
because in this case the member offset can be equal to the class size
(subject to alignment limitations).

This CL fixis LLDB to not print out a warning in this special case.

llvm-svn: 257603
2016-01-13 14:58:48 +00:00
Jason Molenda 50018d3cf5 Add a small refinement to the qSymbol:: support in lldb.
This is a packet which allows the remote gdb stub to ask for the address
of a symbol in the process.  lldb sends the packet (offering to provide
addresses for symbol names) after every solib loaded.  I changed lldb so
that once the stub has indicated that it doesn't need any more symbol
addresses, lldb will stop sending the qSymbol:: packet on new solib loads.

This can yield a performance benefit over slower communication links when
there are many solibs involved.

<rdar://problem/23310049> 

llvm-svn: 257569
2016-01-13 04:08:10 +00:00
Stephane Sezer 1307d4c7df Fix build breakage of r257502.
llvm-svn: 257510
2016-01-12 20:22:58 +00:00
Stephane Sezer 87b0fe075e Increase use of svr4 packets to improve performance on POSIX remotes
Summary:
Allows the remote to enumerate the link map when adding and removing
shared libraries, so that lldb doesn't need to read it manually from
the remote's memory.

This provides very large speedups (on the order of 50%) in total
startup time when using the ds2 remote on android or Tizen devices.

Reviewers: ADodds, tberghammer, tfiala

Subscribers: tberghammer, sas, danalbert, llvm-commits, srhines

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

Change by Francis Ricci <fjricci@fb.com>

llvm-svn: 257502
2016-01-12 19:02:41 +00:00
Tamas Berghammer 239132f452 Try to fix the mips64 build after rL257447
llvm-svn: 257469
2016-01-12 10:41:43 +00:00
Ravitheja Addepally 49982f5773 Fix for TestNoreturnUnwind.py on i386
Summary:
The testcase TestNoreturnUnwind.py was failing
because the unwind from the vdso library was not
successful for clang compiler while it was passing
for gcc. It was passing for gcc since the unwind plan
used was the assembly plan and the ebp register was
set by the main function in case of gcc and was not
used by the functions in the call flow to the vdso, whereas
clang did not emit assembly prologue for main and so
 the assembly unwind was failing. Normally in case of
failure of assembly unwind, lldb switches to EH CFI frame
based unwinding, but this was not happening for
the first frame. This patch tries to fix this behaviour by
falling to EH CFI frame based unwinding in case of assembly
unwind failure even for the first frame.
The test is still marked as XFAIL since it relys on the fix
of another bug.

Reviewers: lldb-commits, jingham, zturner, tberghammer, jasonmolenda

Subscribers: jasonmolenda

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

llvm-svn: 257465
2016-01-12 10:08:41 +00:00
Pavel Labath 484f0a31b3 Add clang::Type::Pipe to ClangASTContext
Summary:
Clang recently added support for an OpenCL pipe type. Adding the new type to relevant switches to
avoid warnings.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 257460
2016-01-12 08:51:28 +00:00
Jason Molenda 77f8935218 Changes to lldb and debugserver to reduce extraneous memory reads
at each public stop to improve performance a bit.  Most of the 
information lldb needed was already in the jThreadsInfo response;
complete that information and catch a few cases where we could still
fall back to getting the information via discrete memory reads.


debugserver adds 'associated_with_dispatch_queue' and 'dispatch_queue_t
keys to the jThreadsInfo response for all the threads.  lldb needs the
dispatch_queue_t value.  And associated_with_dispatch_queue helps to
identify which threads definitively don't have any queue information so
lldb doesn't try to do memory reads to get that information just because
it was absent in the jThreadsInfo response.

Remove the queue information from the questionmark (T) packet.  We'll
get the information for all threads via the jThreadsInfo response -
sending the information for the stopping thread (on all the private
stops, plus the less frequent public stop) was unnecessary information
being sent over the wire.

SystemRuntimeMacOSX will try to get information about queues by asking
the Threads for them, instead of reading memory.  

ProcessGDBRemote changes to recognize the new keys being sent in the
jThreadsInfo response.  Changes to ThreadGDBRemote to track the new
information.  Also, when a thread is marked as definitively not 
associated with a libdispatch queue, don't fall back to the system
runtime to try memory reads to find the queue name / kind / ID etc.


<rdar://problem/23309359> 

llvm-svn: 257453
2016-01-12 07:09:16 +00:00
Mohit K. Bhakkad 884fc3e4df [LLDB][MIPS] Fix rL255619: mips 3, 4 and 5 are 64 bit archs
llvm-svn: 257448
2016-01-12 06:03:01 +00:00
Mohit K. Bhakkad 64322c0331 [LLDB][MIPS] Fix ReadRegisterValue for registers with constant 32 bit size regardless of ABI
Reviewers: clayborg, tberghammer.
Subscribers: jaydeep, bhushan, sagar, nitesh.jain, lldb-commits.
Differential Revision: http://reviews.llvm.org/D16060

llvm-svn: 257447
2016-01-12 05:55:03 +00:00
Bhushan D. Attarde 2be2c9a6ce [LLDB][MIPS] Merge emulation of similar instructions for MIPS64
SUMMARY:
    This patch merges emulation of similar instructions into a single function (wherever possible) to remove code duplication.
    
    Reviewers: clayborg
    Subscribers: mohit.bhakkad, sagar, jaydeep, lldb-commits
    Differential Revision: http://reviews.llvm.org/D16051

llvm-svn: 257442
2016-01-12 03:56:58 +00:00
Bhushan D. Attarde def5e7df76 [LLDB][MIPS] Handle PIC calling convention for MIPS64
SUMMARY:
    This patch sets up register r25 with the address of function to be called in PrepareTrivialCall().
    This is required as per MIPS PIC calling convention.
    
    Reviewers: clayborg
    Subscribers: mohit.bhakkad, sagar, jaydeep, lldb-commits
    Differential Revision: http://reviews.llvm.org/D16046

llvm-svn: 257441
2016-01-12 03:48:43 +00:00
Stephane Sezer 8dbcb63866 Get rid of ARM_ELF_SYM_IS_THUMB flag.
Summary:
This was used with the old ARM vs. Thumb detection code but is not
required anymore.

Reviewers: tberghammer, clayborg

Subscribers: fjricci, aemerson, lldb-commits, rengolin

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

llvm-svn: 257429
2016-01-12 01:12:10 +00:00
Zachary Turner 00cdc77ac9 Don't define Bytes and String to be the same number on Py2.
This is causing issues with case labels having the same value.

llvm-svn: 257409
2016-01-11 23:10:32 +00:00
Zachary Turner 7a76845c48 Fix Python 3 issues related to OS plugins.
* lldb::tid_t was being converted incorrectly, so this is updated to use
PythonInteger instead of manual Python Native API calls.
* OSPlugin_RegisterContextData was assuming that the result of
  get_register_data was a string, when in fact it is a bytes.  So this
  method is updated to use PythonBytes to do the work.

llvm-svn: 257398
2016-01-11 22:16:17 +00:00
Zachary Turner 5a72c02be9 Introduce a PythonBytes class into PythonDataObjects.
This class behaves the same as PythonString on Python2, but differently
on Python3.  Unittests are added as well.

llvm-svn: 257397
2016-01-11 22:16:12 +00:00
Dimitry Andric 9a3a6ab3b6 Replace accidental DOS (and mixed) line endings in a few text files
Summary:
Similar to rL256704 and rL256707, fix a few text files which were
accidentally checked in with DOS line endings, or mixed line endings.

Reviewers: jingham, emaste

Subscribers: lldb-commits

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

llvm-svn: 257361
2016-01-11 18:07:47 +00:00
Tamas Berghammer 1966ac36a6 Don't try to parse the line table when it isn't specified
Previously we tried to parse the line table even if a compile unit
had no DW_AT_stmt_list atribute. The problem happens when a compiler
generates debug info for a compile unit but doesn't generate any line
info.

llvm-svn: 257335
2016-01-11 14:56:05 +00:00
Tamas Berghammer e85e6021f0 Make the aarch64 lldb-server capable of debugging arm32 applications
Differential revision: http://reviews.llvm.org/D15533

llvm-svn: 257322
2016-01-11 10:39:09 +00:00
Jim Ingham 22861aeab8 Writing a test case for r257234 I found another place that was
assuming a ValueObject always has a process.  So this is that fix
and the test case.

llvm-svn: 257242
2016-01-09 01:20:30 +00:00
Jim Ingham 7831c3590c Fix a thinko in the asserts in GetDynamicTypeAndAddress. It was requiring that the
process in the incoming value be non-null, but Value Objects created off the target
don't necessarily have a process.  In that case, having the targets the same is good
enough.

<rdar://problem/24097805>

llvm-svn: 257234
2016-01-08 23:44:51 +00:00
Jason Molenda fd4cea53d5 Re-apply r257117 (reverted in r257138 temporarily),
with the one change that ThreadPlanStepOut::ThreadPlanStepOut
will now only advance the return address breakpoint to
the end of a source line, if we have source line debug information.
It will not advance to the end of a Symbol if we lack source line
information.  This, or the recognition of the LEAVE instruction
in r257209, would have fixed the regression that Siva was seeing.
Both were good changes, so I've made both.

Original commit message:

Performance improvement: Change lldb so that it puts a breakpoint
on the first branch instruction after a function return (or the end
of a source line), instead of a breakpoint on the return address,
to skip an extra stop & start of the inferior process.

I changed Process::AdvanceAddressToNextBranchInstruction to not
take an optional InstructionList argument - no callers are providing
a cached InstructionList today, and if this function was going to
do that, the right thing to do would be to fill out / use a
DisassemblerSP which is a disassembler with the InstructionList for
this address range.


http://reviews.llvm.org/D15708
<rdar://problem/23309838> 

llvm-svn: 257210
2016-01-08 21:40:11 +00:00
Jason Molenda dae3c57189 Add support for the LEAVE x86 instruction to AssemblyParse_x86.
llvm-svn: 257209
2016-01-08 21:13:26 +00:00
Stephane Sezer 728384a05e Prevent infinite recursive loop in AppleObjCTrampolineHandler constructor
Summary:
When we construct AppleObjCTrampolineHandler, if m_impl_fn_addr is
invalid, we call CanJIT(). If the gdb remote process does not support
allocating and deallocating memory, this call stack will include a call
to the AppleObjCRuntime constructor. The AppleObjCRuntime constructor
will then call the AppleObjCTrampolineHandler constructor, creating a
recursive call loop that eventually overflows the stack and segfaults.

Avoid this call loop by not constructing the AppleObjCTrampolineHandler
within AppleObjCRuntime until we actually need to use it.

Reviewers: clayborg, jingham

Subscribers: sas, lldb-commits

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

Change by Francis Ricci <fjricci@fb.com>

llvm-svn: 257204
2016-01-08 20:32:35 +00:00
Adrian McCarthy 6788b62f09 Treat an embedded int3/__debugbreak() as a breakpoint on Windows, includes a cross-platform test.
llvm-svn: 257186
2016-01-08 18:28:03 +00:00
Jason Molenda 7cb9d98cf9 Revert r257117 "Performance improvement: Change lldb so that it
puts a breakpoint" it is causing a regression in the TestStepNoDebug
test case on ubuntu 14.04 with gcc 4.9.2.  Thanks for the email
Siva.  I'll recommit when I've figured out the regression.

llvm-svn: 257138
2016-01-08 02:26:03 +00:00
Stephane Sezer 506ecac085 Fix dwarf sequence insertions
Summary:
If two dwarf sequences begin with entries that have identical addresses,
it is possible for the comparator to order the first entry of the new
sequence between the first and second entries of the existing sequence.

This will result in an attempted insertion of the second sequence inside
of the first sequence, which is invalid.

Ensure that insertions only occur in between existing sequences.

Reviewers: andrew.w.kaylor, clayborg

Subscribers: sas, lldb-commits

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

Change by Francis Ricci <fjricci@fb.com>

llvm-svn: 257132
2016-01-08 01:39:14 +00:00
Jason Molenda 26d84e8097 Change the key name for the libdispatch queue serial number from
"qserial" to "qserialnum" because "qserial" looks a lot like the
queue type (either 'serial' or 'concurrent') and can be confusing
to read through.  debugserver passes these up either in the questionmark
("T") packet, or in the response to the jThreadsInfo packet.

llvm-svn: 257121
2016-01-08 00:20:48 +00:00
Jim Ingham 962260c852 Fix a glitch in the Driver's batch mode when used with "attach".
Batch mode is supposed to stop execution and return control to the user when an
exceptional stop occurs (crash, signal or instrumentation).  But attach always stops
with a SIGSTOP on OSX (maybe on Linux too?) which would short circuit the rest of the
commands given.

This change allows a command result object to indicate that it expected to leave the 
process stopped with an exceptional stop reason, and it is okay for batch mode to keep going.

<rdar://problem/22243143>

llvm-svn: 257120
2016-01-08 00:20:47 +00:00
Jason Molenda b4a8b4c401 Performance improvement: Change lldb so that it puts a breakpoint
on the first branch instruction after a function return (or the end
of a source line), instead of a breakpoint on the return address,
to skip an extra stop & start of the inferior process.

I changed Process::AdvanceAddressToNextBranchInstruction to not
take an optional InstructionList argument - no callers are providing
a cached InstructionList today, and if this function was going to
do that, the right thing to do would be to fill out / use a
DisassemblerSP which is a disassembler with the InstructionList for
this address range.


http://reviews.llvm.org/D15708
<rdar://problem/23309838> 

llvm-svn: 257117
2016-01-08 00:06:03 +00:00
Stephane Sezer 6f45529046 Make sure we don't send qModuleInfo packets unnecessarily.
Summary:
Some debug servers don't support it so there's no point in spamming
this.

Reviewers: clayborg

Subscribers: fjricci, lldb-commits

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

llvm-svn: 257116
2016-01-08 00:00:17 +00:00
Siva Chandra 9293fc4185 Better scheme to lookup alternate mangled name when looking up function address.
Summary:
This change is relevant for inferiors compiled with GCC. GCC does not
emit complete debug info for std::basic_string<...>, and consequently, Clang
(the LLDB compiler) does not generate correct mangled names for certain
functions.

This change removes the hard-coded alternate names in
ItaniumABILanguageRuntime.cpp.

Before the hard-coded names were put in ItaniumABILanguageRuntime.cpp, one could
not evaluate std::string methods (ex. std::string::length). After putting in
the hard-coded names, one could evaluate them. However, it did not still
enable one to call methods on, say for example, std::vector<string>.
This change makes that possible.

There is some amount of incompleteness in this change. Consider the
following example:

std::string hello("hello"), world("world");
std::map<std::string, std::string> m;
m[hello] = world;

One can still not evaluate the expression "m[hello]" in LLDB. Will
address this issue in another pass.

Reviewers: jingham, vharron, evgeny777, spyffe, dawn

Subscribers: clayborg, dawn, lldb-commits

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

llvm-svn: 257113
2016-01-07 23:32:34 +00:00
Ewan Crawford 9272a1c5a2 Remove duplicate header added in r256927
r256927 included a duplicate StreamString header file. This patch simply removes the duplicate.

Author: Luke Drummond <luke.drummond@codeplay.com>
Differential Revision: http://reviews.llvm.org/D15948

llvm-svn: 257061
2016-01-07 14:34:52 +00:00
Ewan Crawford 26e52a7074 [RenderScript] Improve file format for saving RS allocations
Updates the file format for storing RS allocations to a file, so that the format now supports struct element types.

The file header will now contain a subheader for every RS element and it's descendants. 
Where an element subheader contains element type details and offsets to the subheaders of that elements fields. 

Patch also improves robustness when loading incorrect files.

llvm-svn: 257045
2016-01-07 10:19:09 +00:00
Aidan Dodds 35e7b1ad2d [Renderscript] Fix stack argument inspection.
Function arguments that were spilled and passed on the stack were incorrectly read.
The value was written back into the output pointer rather then the memory being pointed to.

llvm-svn: 256941
2016-01-06 15:43:52 +00:00
Bhushan D. Attarde 6fd916cd0c Fix build warnings after rL256915
llvm-svn: 256929
2016-01-06 12:08:22 +00:00
Ewan Crawford 070fac02c3 Add LogDump methods to lldb_private::StringList.
This patch eases the printing of iterable string containers.

Author: Luke Drummond <luke.drummond@codeplay.com>
Differential Revision: http://reviews.llvm.org/D15773

llvm-svn: 256927
2016-01-06 11:06:30 +00:00
Bhushan D. Attarde f2be8df54b [LLDB][MIPS32]Merge emulation of similar instructions
SUMMARY:
    This patch merges emulation of similar instructions into a single function (wherever possible) to remove code duplication.
    
    Reviewers: clayborg
    Subscribers: mohit.bhakkad, sagar, jaydeep, lldb-commits
    Differential Revision: http://reviews.llvm.org/D15886

llvm-svn: 256915
2016-01-06 05:44:02 +00:00
Kate Stone 0167e064f3 Addresses an unsigned underflow situation that can occur when dumping an empty command history.
One example where this occurs in practice is starting the Swift REPL and typing ":command history" since REPL commands aren't stored in the LLDB command prompt history.

llvm-svn: 256888
2016-01-06 00:33:07 +00:00
Dawn Perchik 954b40bf63 Add support for "source info" and use it to fix MI's -symbol-list-lines.
This patch adds support the command 'source info' as follows:
    (lldb) help source info
         Display source line information (as specified) based on the current executable's
         debug info.
    
    Syntax: source info <cmd-options>
    
    Command Options Usage:
      source info [-c <count>] [-s <shlib-name>] [-f <filename>] [-l <linenum>] [-e <linenum>]
      source info [-c <count>] [-s <shlib-name>] [-n <symbol>]
      source info [-c <count>] [-a <address-expression>]
    
           -a <address-expression> ( --address <address-expression> )
                Lookup the address and display the source information for the corresponding
                file and line.
    
           -c <count> ( --count <count> )
                The number of line entries to display.
    
           -e <linenum> ( --end-line <linenum> )
                The line number at which to stop displaying lines.
    
           -f <filename> ( --file <filename> )
                The file from which to display source.
    
           -l <linenum> ( --line <linenum> )
                The line number at which to start the displaying lines.
    
           -n <symbol> ( --name <symbol> )
                The name of a function whose source to display.
    
           -s <shlib-name> ( --shlib <shlib-name> )
                Look up the source in the given module or shared library (can be specified
                more than once).
For example:
    (lldb) source info --file x.h
    Lines for file x.h in compilation unit x.cpp in `x
    [0x0000000100000d00-0x0000000100000d10): /Users/dawn/tmp/./x.h:10
    [0x0000000100000d10-0x0000000100000d1b): /Users/dawn/tmp/./x.h:10

The new options are used to fix the MI command:
    -symbol-list-lines <file>
which didn't work for header files because it called:
    target modules dump line-table <file>
which only dumps line tables for a compilation unit.

The patch also fixes a bug in the error reporting when no files were supplied to the command. Previously you'd get:
    (lldb) target modules dump line-table
    error:
    Syntax:
    error: no source filenames matched any command arguments
Now you get:
    error: file option must be specified.

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

llvm-svn: 256863
2016-01-05 19:51:51 +00:00
Pavel Labath ea2cc5e028 Add logging to SBProcess::GetRestartedFromEvent
llvm-svn: 256853
2016-01-05 17:55:35 +00:00
Pavel Labath 2acc48827e Fix a typo in Process.cpp
llvm-svn: 256852
2016-01-05 17:55:32 +00:00
Omair Javaid a7d7f7cf33 Fix for undefined behavior while updating PC value on arm-linux
Differential revision: http://reviews.llvm.org/D15877

llvm-svn: 256847
2016-01-05 16:56:13 +00:00
Sagar Thakur 307a3ba3b3 [LLDB][MIPS] Make register read/write to set/get the size of register according to abi.
Summary:
For O32 abi register size should be 4 bytes.
For N32 and N64 abi register size should be 8 bytes.
This patch will make register read/write to set/get the size of register according to abi.

Reviewers: clayborg, tberghammer
Subscribers: lldb-commits, nitesh.jain, mohit.bhakkad, bhushan, jaydeep
Differential: http://reviews.llvm.org/D15884
llvm-svn: 256834
2016-01-05 14:03:45 +00:00
Ewan Crawford 7093cccf92 Revert r256769
Reverts "Use correct format identifiers to print something meaningful."

Original format specifiers were correct.
Instead use void* casts to remove warnings, since this is what the %p specifier expects.

llvm-svn: 256833
2016-01-05 13:18:46 +00:00
Davide Italiano 6bed719775 [FreeBSD] Use a cast sledgehammer to placate newer versions of clang.
Now lldb can build on FreeBSD with -Werror again.

llvm-svn: 256771
2016-01-04 19:22:35 +00:00
Davide Italiano e8e7bfbf16 Use correct format identifiers to print something meaningful.
llvm-svn: 256769
2016-01-04 19:17:14 +00:00
Davide Italiano 801a35ea5e [Commands] Get rid of unused typedefs.
llvm-svn: 256766
2016-01-04 19:12:25 +00:00
Ed Maste 6558008935 Remove unused variable
Obtained from FreeBSD r292611

llvm-svn: 256724
2016-01-04 02:10:22 +00:00
Ed Maste 81b4c5f236 Strip trailing whitespace
(There are changes in the copies of these four files in the FreeBSD base
system, and I've changed these ones to reduce gratuitous diffs in future
imports.)

llvm-svn: 256723
2016-01-04 01:43:47 +00:00
David Majnemer 48a065d2ea Update LLDB to account for Clang r256463
llvm-svn: 256464
2015-12-27 07:16:55 +00:00
Craig Topper b347df8757 Include IR/DerivedTypes.h instead of IR/Type.h so to match llvm change r256406.
llvm-svn: 256407
2015-12-25 05:18:31 +00:00
Mohit K. Bhakkad f6ef187b9b [LLDB] Fix Read/Write memory to be compatible with both endians
Reviewers: tberghammer.
Subscribers:  jaydeep, bhushan, sagar, nitesh.jain,lldb-commits.
Differential Revision: http://reviews.llvm.org/D15738

llvm-svn: 256331
2015-12-23 12:34:58 +00:00
Adrian McCarthy c2961ab889 Improve error handling for `frame select` command when there are too many arguments.
Bug:  https://llvm.org/bugs/show_bug.cgi?id=25847

It now gives a more specific error message and then returns instead of trying to select the wrong frame.

llvm-svn: 256251
2015-12-22 16:50:28 +00:00
Ed Maste 4d156ae0c8 Remove PC -1 offset from FreeBSD arm64 UpdateAfterBreakpoint
It was a copy-and-paste leftover.

llvm-svn: 256248
2015-12-22 15:57:21 +00:00
Tamas Berghammer cfcdbde3ce Don't pack the structs of the jit debug interface
None of the documentation mentions that the entries are packed structs
and also none of the other implementation I found pack them.

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

llvm-svn: 256244
2015-12-22 15:23:33 +00:00
Enrico Granata c3281bd05c No need for a custom function here; just use what C provides
llvm-svn: 256223
2015-12-22 00:47:36 +00:00
Enrico Granata ef8dde6269 Reduce code duplication
llvm-svn: 256212
2015-12-21 23:10:17 +00:00
Tamas Berghammer fde63cad6b Fix emulation of the thumb str instruction
llvm-svn: 256147
2015-12-21 12:06:36 +00:00
Enrico Granata 36f51e4c97 Add support for seeing through clang::AutoType in ClangASTContext
This allows LLDB to deal correctly with expression result variables declared via the C++11 'auto' keyword

rdar://problem/23960490

llvm-svn: 256051
2015-12-18 22:41:25 +00:00
Enrico Granata 11799e1529 Turns out, many people define structs named Point that do not share the same names that this formatter uses for fields; use the {} syntax to make it so that a failure to parse the summary doesn't cause the entire printout to fail
llvm-svn: 256042
2015-12-18 22:04:47 +00:00
Enrico Granata e242624ca9 Add API to support retrieving the formatters category for a specific language
llvm-svn: 256033
2015-12-18 21:25:24 +00:00
Tamas Berghammer 6517b004b2 Fix the emulation of arm strd instruction
The incorrect instruction emulation caused issues in the stack unwinding
code when strd was used to push 2 register to the stack with writeback.

llvm-svn: 256000
2015-12-18 15:35:08 +00:00
Jim Ingham 277dc3f4d5 Fix formatting for last commit.
llvm-svn: 255973
2015-12-18 02:15:25 +00:00
Jim Ingham a202357197 Make the Language print the description of the Exception Breakpoint resolver. Also
have the breakpoint description print the precondition description if one exists.
No behavior change.

<rdar://problem/22885189>

llvm-svn: 255972
2015-12-18 02:14:04 +00:00
Jason Molenda 545304d323 The lldb side changes to go along with r255711 where a new
"thread-pcs" key is added to the T (questionmark) packet in
gdb-remote protocol so that lldb doesn't need to query the
pc values of every thread before it resumes a process.

The only odd part with this is that I'm sending the pc 
values in big endian order, so we need to know the endianness
of the remote process before we can use them.  All other
register values in gdb-remote protocol are sent in native-endian
format so this requirement doesn't exist.  This addition is a
performance enhancement -- lldb will fall back to querying the
pc of each thread individually if it needs to -- so when
we don't have the byte order for the process yet, we don't
use these values.  Practically speaking, the only way I've 
been able to elicit this condition is for the first
T packet when we attach to a process.

<rdar://problem/21963031> 

llvm-svn: 255942
2015-12-18 00:45:35 +00:00
Ewan Crawford 2e9207150a [RenderScript] Support all RS allocation types
Currently we can just inspect the details of the most common allocation types.
This patch allows us to support all the types defined by the RS runtime in its `RsDataType` enum.
Including handlers, matrices and packed graphical data.

llvm-svn: 255904
2015-12-17 16:40:05 +00:00
Ewan Crawford 37395ad211 Inspect DW_AT_const_value global static const variables
This patch adds support for printing global static const variables which are given a DW_AT_const_value DWARF tag by clang.

Fix for bug https://llvm.org/bugs/show_bug.cgi?id=25653

Reviewers: clayborg, tberghammer
Subscribers: emaste, lldb-commits
Differential Revision: http://reviews.llvm.org/D15576

llvm-svn: 255887
2015-12-17 11:59:47 +00:00
Kate Stone ef8b4e22f7 Set the minimum stack size for private state thread to 8MB
Demangling complex Boost symbols can exhaust the default stack size.  In practice, any thread that calls into LLDB functionality that touches symbols runs this risk.  Guaranteeing a reasonable minimum for our own private state thread addressees some known scenarios debugging processes that make use of cpp-netlib.

llvm-svn: 255868
2015-12-17 01:37:00 +00:00
Greg Clayton 3feddff744 Don't demangle a name when Mangled::GetName() is called with ePreferMangled. Only demangle if this isn't the the value for the "preference" argument indicating the user wants the demangled name. This will stop a lot of symbols from being demangled when parsing the symbol table in ObjectFileMachO.
llvm-svn: 255864
2015-12-17 01:00:50 +00:00
Greg Clayton 8b8874edbc Don't strip types of their typedefs when getting function types.
llvm-svn: 255863
2015-12-17 00:58:41 +00:00
Dawn Perchik bfd96183ef Rework breakpoint language filtering to use the symbol context's language.
This patch reworks the breakpoint filter-by-language patch to use the
symbol context instead of trying to guess the language solely from the
symbol's name. This has the advantage that symbols compiled with debug
info will have their actual language known. Symbols without debug info
will still do the same "guess"ing because Symbol::GetLanguage() is
implemented using Mangled::GuessLanguage(). The recognition of ObjC
names was merged into Mangled::GuessLanguage.

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

llvm-svn: 255808
2015-12-16 19:40:00 +00:00
Siva Chandra d8335e9ab4 Read macro info from .debug_macro section and use it for expression evaluation.
Summary:
DWARF 5 proposes a reinvented .debug_macro section. This change follows
that spec.

Currently, only GCC produces the .debug_macro section and hence
the added test is annottated with expectedFailureClang.

Reviewers: spyffe, clayborg, tberghammer

Subscribers: lldb-commits

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

llvm-svn: 255729
2015-12-16 00:22:08 +00:00
Greg Clayton 0817da881e First pass at LLDBRPC.framework
llvm-svn: 255697
2015-12-15 23:03:22 +00:00
Enrico Granata f85b008de8 Enable the 'type X list' formatters commands to list formatters in language categories
llvm-svn: 255687
2015-12-15 22:20:19 +00:00
Sagar Thakur 40fc2e391a [LLDB][MIPS] Added support for MIPS1, MIPS2, MIPS3, MIPS4 and MIPS5 instruction sets
Patch by Nitesh Jain.

Summary: This Patch will allowed LLDB to debug respective instruction sets binaries.

Reviewers: jaydeep, clayborg
Subscribers: lldb-commits, mohit.bhakkad, sagar, bhushan
Differential: http://reviews.llvm.org/D15487
llvm-svn: 255619
2015-12-15 05:50:55 +00:00
Enrico Granata bd5eab8287 Fix a bug where language categories would hold on to their caches even after changes
llvm-svn: 255603
2015-12-15 02:20:48 +00:00
Eugene Zelenko e65b2cf297 Fix Clang-tidy modernize-use-nullptr and readability-simplify-boolean-expr warnings in some files in source/Target/.
Simplify smart pointers checks in conditions. Other minor fixes.

llvm-svn: 255598
2015-12-15 01:33:19 +00:00
Kamil Rytarowski cec6b45aec Welcome to NetBSD signals
Summary:
Signals 1-32 are matching the default UNIX platform.

There are platform specific ones above 32.

From the `/usr/include/sys/signal.h` header:

```
#define SIGPWR          32      /* power fail/restart (not reset when caught) */
#ifdef _KERNEL
#define SIGRTMIN        33      /* Kernel only; not exposed to userland yet */
#define SIGRTMAX        63      /* Kernel only; not exposed to userland yet */
#endif
```

Reviewers: emaste, joerg

Subscribers: lldb-commits

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

llvm-svn: 255592
2015-12-15 00:50:19 +00:00
Jason Molenda 25d5b10b22 When constructing an address range to "step" or "next" through,
find the largest address range (possibly combining multiple 
LineEntry's for this line number) that is contiguous.

This allows lldb's fast-step stepping algorithm to potentially
run for a longer address range than if we have to stop at every
LineEntry indicating a subexpression in the source line.

http://reviews.llvm.org/D15407
<rdar://problem/23270882> 

llvm-svn: 255590
2015-12-15 00:40:30 +00:00
Kate Stone a11959dbf7 [Editline] Redesign automatic indentation fix command for robustness
The FixIndentationCommand implementation has proven to be fragile across various libedit iterations. This patch reworks the command to use the same basic strategy as when moving between lines in a multi-line edit session: when indentation changes are required, exit line editing completely and restart with amended content. This approach won't be susceptible to subtle behavior differences libedit has introduced over time.

llvm-svn: 255548
2015-12-14 21:43:59 +00:00
Omair Javaid af9a31aff3 Add failure paths to a few JSONNumber members
Differential revision: http://reviews.llvm.org/D15355

llvm-svn: 255499
2015-12-14 14:52:07 +00:00
Dawn Perchik b59257841e Fix scope-based lookup when more than one function is found.
When multiple functions are found by name, lldb removes duplicate entries of
functions with the same type, so the first function in the symbol context list
is chosen, even if it isn't in scope. This patch uses the declaration context
of the execution context to select the function which is in scope.

This fixes cases like the following:

    int func();
    namespace ns {
	int func();
	void here() {
	    // Run to BP here and eval 'p func()';
	    // lldb used to find ::func(), now finds ns::func().
	}
    }

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

llvm-svn: 255439
2015-12-12 19:31:41 +00:00
Jason Molenda a38312a9a4 Fix the L1 cache search in MemoryCache::Read to use the
stl upper_bound method instead of lower_bound - we were
failing to find some cached data in the L1 cache resulting
in extra memory read packets while stepping.

The bug with the existing code looked like this:
If the L1 cache has 8 bytes at address 0x1000 and 8 bytes
at address 0x2000 and we are searching for 4 bytes at 0x2004,
the use of lower_bound would return the end() of the container
and so we would incorrectly treat the memory as uncached.

(the L1 cache is memory seeded from debugserver in the T aka
questionmark packet, where debugserver will send up the stack
memory that likely contains the caller's stack pointer and 
frame pointer values.)

<rdar://problem/23869227> 

llvm-svn: 255421
2015-12-12 03:06:10 +00:00
Oleksiy Vyalov 9497cc2bf8 Remove unused mips typedefs.
llvm-svn: 255419
2015-12-12 02:13:17 +00:00
Ted Woodward 4062601cb9 Remove hardcoded registers from Hexagon ABI
Summary: The Hexagon ABI plugin uses hardcoded registers when setting up function calls. This is OK for the Hexagon simulator, but the register numbers are different on the gdbserver running on hardware. Change the hardcoded registers to LLDB generic registers.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 255374
2015-12-11 21:52:47 +00:00
Eugene Zelenko e2ccd33359 Fix Clang-tidy modernize-use-nullptr and readability-simplify-boolean-expr warnings in source/Target/Target.cpp.
Simplify smart pointers checks in conditions.

llvm-svn: 255364
2015-12-11 19:52:15 +00:00
Sean Callanan d38f4d288f DisassemblerLLVMC now gets the disassembler comments for an instruction
and appends them to our list of comments (which can additionally include
things like decoded addresses).

llvm-svn: 255358
2015-12-11 19:10:04 +00:00
Ewan Crawford cdfb1485be [RenderScript] Support for amd64 RS hooks
Adds support for reading a maximum of six integer arguments from a renderscript hook on X86_64.
Author: Luke Drummond <luke.drummond@codeplay.com>

llvm-svn: 255338
2015-12-11 13:49:21 +00:00
Ted Woodward bff0a21b57 Add Hexagon ABI to System Initialization
Summary: When the Hexagon ABI was added, it was inadvertently left out of initialization/termination. This patch adds it.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 255268
2015-12-10 17:53:07 +00:00
Tamas Berghammer 257e13ae9a Add modules downloaded by ModuleCache to the global ModuleList
Adding the modules to the global module list eleminate issues in the
case when a module is unloaded from the target but some object (e.g.
breakpoint) still referencing them with weak pointers. It also speeds
up the case when we load, unload, load the same shared library because
the global module cache will keep the parsed debug info around between
the 2 load (this scenario happens for some code on android).

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

llvm-svn: 255260
2015-12-10 17:08:23 +00:00
Ewan Crawford 8b59062a32 [RenderScript] Refactor condition deciding when to JIT RS runtime
Patch creates a member function that decides when to JIT all the details about an allocation.
By checking for zero pointers we can avoid the situation where we store uninitialised data from previously inspecting the allocation during creation.

llvm-svn: 255238
2015-12-10 10:20:39 +00:00
Aidan Dodds 49ffb02a58 Differential Revision: http://reviews.llvm.org/D15333
llvm-svn: 255237
2015-12-10 10:11:49 +00:00
Ewan Crawford e69df38282 [RenderScript] Add hook for destroyed allocations
New hook for rsdAllocationDestroy() which is called when allocations are deleted.
LLDB should be aware of this so we can remove the allocation from our internal list.

llvm-svn: 255121
2015-12-09 16:01:58 +00:00
Sagar Thakur 4f58827a57 [LLDB][MIPS] Adding call to IsMSAAvailable() while creating RegisterInfoInterface
This patch will fix the test case test_p_returns_correct_data_size_for_each_qRegisterInfo_attach_llgs_* of TestLldbGdbServer.py on mips. The test fails because we were sending RegisterInfo for msa registers to client even when msa registers are not available. With this commit server will send E45(end of resigters) response if msa registers are not available.

llvm-svn: 255108
2015-12-09 12:31:01 +00:00
Sean Callanan 77decf5f20 When printing warnings, the repeat_key should be
const void * because the data is never accessed,
the pointer is the only useful piece of data.

llvm-svn: 255090
2015-12-09 01:25:01 +00:00
Adrian McCarthy 278a6c952b Fix DoReadMemory for Windows mini dumps.
Differential Revision: http://reviews.llvm.org/D15359

llvm-svn: 255083
2015-12-09 00:29:38 +00:00
Ed Maste a3ad0f1e27 Remove default case in switch which covers all enumeration values
This also conveniently eliminates another warning from the unintentional
use of a trigraph:

warning: trigraph converted to '[' character [-Wtrigraphs]
        default: printf("???(%u)", type);
                          ^
llvm-svn: 255049
2015-12-08 20:50:35 +00:00
Greg Clayton dfc0962196 Change DeclContextFindDeclByName to return a vector of CompilerDecl objects. Opaque pointers should only be used for the decl context object. Also made a default implementation so that GoASTContext doesn't need to override DeclContextFindDeclByName.
llvm-svn: 255038
2015-12-08 18:39:50 +00:00
Tamas Berghammer 372810f5f5 Fix MSVC build after rL255016
llvm-svn: 255017
2015-12-08 14:27:40 +00:00
Tamas Berghammer ccd6cffba3 Modify "platform connect" to connect to processes as well
The standard remote debugging workflow with gdb is to start the
application on the remote host under gdbserver (e.g.: gdbserver :5039
a.out) and then connect to it with gdb.

The same workflow is supported by debugserver/lldb-gdbserver with a very
similar syntax but to access all features of lldb we need to be
connected also to an lldb-platform instance running on the target.

Before this change this had to be done manually with starting a separate
lldb-platform on the target machine and then connecting to it with lldb
before connecting to the process.

This change modifies the behavior of "platform connect" with
automatically connecting to the process instance if it was started by
the remote platform. With this command replacing gdbserver in a gdb
based worflow is usually as simple as replacing the command to execute
gdbserver with executing lldb-platform.

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

llvm-svn: 255016
2015-12-08 14:08:19 +00:00
Tamas Berghammer 4fbd67ac11 Add a new option to Platform::LoadImage to install the image
This change introduce 3 different working mode for Platform::LoadImage
depending on the file specs specified.
* If only a remote file is specified then the remote file is loaded on
  the target (same behavior as before)
* If only a local file is specified then the local file is installed to
  the current working directory and then loaded from there.
* If both local and remote file is specified then the local file is
  installed to the specified location and then loaded from there.

The same options are exposed on the SB API with a new method LoadImage
method while the old signature presers its meaning.

On the command line the installation of the shared library can be specified
with the "--install" option of "process load".

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

llvm-svn: 255014
2015-12-08 13:43:59 +00:00
Bhushan D. Attarde 56222509c3 [LLDB][MIPS] Handle PIC calling convention for MIPS32
SUMMARY:
    - PrepareTrivialCall() to setup register r25 with the address of function to be called.
    - RegisterIsCalleeSaved() to use name of a register instead of its byte_offset.
    
    Reviewers: clayborg
    Subscribers: mohit.bhakkad, sagar, jaydeep, lldb-commits
    Differential Revision: http://reviews.llvm.org/D15273

llvm-svn: 255005
2015-12-08 06:05:57 +00:00
Greg Clayton e6b36cdd4d Trying to submit 254476 one more time. This implement -gmodule debugging support.
It was previously reverted due to issues that showed up only on linux. I was able to reproduce these issues and fix the underlying cause.

So this is the same patch as 254476 with the following two fixes:
- Fix not trying to complete classes that don't have external sources
- Fix ClangASTSource::CompleteType() to check the decl context of types that it finds by basename to ensure we don't complete a type "S" with a type like "std::S". Before this fix ClangASTSource::CompleteType() would accept _any_ type that had a matching basename and copy it into the other type.

<rdar://problem/22992457>

llvm-svn: 254980
2015-12-08 01:02:08 +00:00
Ted Woodward 65a47b31b3 Fix watchpoint check to use watchpoint ranges
Summary: Watchpoints, unlike breakpoints, have an address range. This patch changes WatchpointList::FindByAddress() to match on any address in the watchpoint range, instead of only matching on the watchpoint's base address.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 254931
2015-12-07 19:38:58 +00:00
Ewan Crawford b1651b8d88 [RenderScript] Mips64 allocations workaround
Workaround for Mips64 compiler bug by using function pointers to call 
functions for expression evaluation. This avoids the emission of the JAL instruction, 
which can only jump within a particular range of the PC.

Author: Dean De Leo, dean@codeplay.com
llvm-svn: 254910
2015-12-07 13:50:32 +00:00
Pavel Labath 19da1f16c2 Recommit "Fix race during process interruption"
This is a resubmit of r254403, see that commit's message for context. This fixes an issue in the
original commit, where we would incorrectly interrupt the process if the interrupt request came
just as we were about to send the stopped event to the public.

llvm-svn: 254902
2015-12-07 12:36:52 +00:00