Commit Graph

377 Commits

Author SHA1 Message Date
Jim Ingham 8d94ba0fb1 This change introduces a "ExpressionExecutionThread" to the ThreadList.
Turns out that most of the code that runs expressions (e.g. the ObjC runtime grubber) on
behalf of the expression parser was using the currently selected thread.  But sometimes,
e.g. when we are evaluating breakpoint conditions/commands, we don't select the thread
we're running on, we instead set the context for the interpreter, and explicitly pass
that to other callers.  That wasn't getting communicated to these utility expressions, so
they would run on some other thread instead, and that could cause a variety of subtle and
hard to reproduce problems.  

I also went through the commands and cleaned up the use of GetSelectedThread.  All those
uses should have been trying the thread in the m_exe_ctx belonging to the command object
first.  It would actually have been pretty hard to get misbehavior in these cases, but for
correctness sake it is good to make this usage consistent.

<rdar://problem/24978569>

llvm-svn: 263326
2016-03-12 02:45:34 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 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
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 e8e7bfbf16 Use correct format identifiers to print something meaningful.
llvm-svn: 256769
2016-01-04 19:17:14 +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 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
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
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
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
Adrian McCarthy fe06b5ad04 Fix hang in global static initialization
Differential Revision: http://reviews.llvm.org/D15092

llvm-svn: 254338
2015-11-30 22:18:43 +00:00
Ewan Crawford 8b244e21d7 [RS] Support RenderScript struct allocations
This patch adds functionality for dumping allocations of struct elements. This involves:

    + Jitting the runtime for details on all the struct fields.

    + Finding the name of the struct type by looking for a global variable of the same type, which will have been reflected back to the java host code.

    + Using this struct type name to pass into expression evaluation for pretty printing the data for the dump command.

llvm-svn: 254294
2015-11-30 10:29:49 +00:00
Sean Callanan aa4d7596f4 Newer versions of the ObjC runtime have an extra field in objc_opt_t.
llvm-svn: 253732
2015-11-20 22:59:57 +00:00
Aidan Dodds 74b396d9cb Allow renderscript runtime to read MIPS target arguments.
llvm-svn: 252914
2015-11-12 17:39:42 +00:00
Enrico Granata 1dfcd650c8 Change the way we read data from the ObjC runtime
llvm-svn: 252272
2015-11-06 03:04:56 +00:00
Chaoren Lin 2a7a94a655 Completely avoid building Apple simulator on non-Darwin platforms.
Summary:
This is a resubmission of r252179, but correctly ignores the source
files for other platforms.

Reviewers: granata.enrico, tberghammer, zturner, jingham

Subscribers: lldb-commits

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

llvm-svn: 252205
2015-11-05 20:45:29 +00:00
Jason Molenda eba832bea6 Explicitly cast size_t var to (uint64_t) when printf format is PRIx64.
llvm-svn: 251585
2015-10-29 00:13:42 +00:00
Eugene Zelenko 222b937c55 Fix Clang-tidy modernize-use-override warnings in source/Plugins/LanguageRuntime and Platform; other minor fixes.
llvm-svn: 251374
2015-10-27 00:45:06 +00:00
Ewan Crawford 018f5a7e0b [RenderScript] Add option to break on a specific kernel invocation
Adds option -c <x,y,z> to the 'language renderscript kernel breakpoint set' command.

Breaks only on the invocation of the kernel with specified coordinate.
Implemented by adding a callback to the kernel breakpoint which checks the coordinates of every invocation.

llvm-svn: 251293
2015-10-26 14:04:37 +00:00
Sylvestre Ledru 4cfc919861 Fix a build issue on Debian unstable. The compiler rejected the convertion to ‘bool’ from ‘std::nullptr_t’
llvm-svn: 251276
2015-10-26 08:49:04 +00:00