Commit Graph

4037 Commits

Author SHA1 Message Date
Jason Molenda 9b837a1e42 Add support for Platform plugins to have settings.
Add two initial settings for the PlatformDarwinKernel plugin,

plugin.platform.darwin-kernel.search-locally-for-kexts [true|false]
plugin.platform.darwin-kernel.kext-directories [directory list]

llvm-svn: 178846
2013-04-05 05:06:39 +00:00
Jason Molenda 8c1157ccc4 Change CommandObjectPlatform commands to get the current platform
from the current Target, if there is one, else back off to getting
the currently selected platform from the Debugger (as it ws doing
previously.)

Remove code from DynamicLoaderDarwinKernel that was setting the platform
in both the Target and in the Debugger.

llvm-svn: 178836
2013-04-05 02:59:09 +00:00
Sean Callanan 5a1af4e63a Factored out memory access into the target process
from IRExecutionUnit into a superclass called
IRMemoryMap.  IRMemoryMap handles all reading and
writing, ensuring that areas are kept track of and
memory is properly cached (and deleted).

Also fixed several cases where we would simply leak
binary data in the target process over time.  Now
the expression objects explicitly own their
IRExecutionUnit and delete it when they go away.  This
is why I had to modify ClangUserExpression,
ClangUtilityFunction, and ClangFunction.

As a side effect of this, I am removing the JIT
mutex for an IRMemoryMap.  If it turns out that we
need this mutex, I'll add it in then, but right now
it's just adding complexity.

This is part of a more general project to make
expressions fully reusable.  The next step is to
make materialization and dematerialization use
the IRMemoryMap API rather than writing and
reading directly from the process's memory. 
This will allow the IR interpreter to use the
same data, but in the host's memory, without having
to use a different set of pointers.

llvm-svn: 178832
2013-04-05 02:22:57 +00:00
Jason Molenda 1c627543f1 Add a new PlatformDarwinKernel for kernel debugging. This Platform
plugin will index the kext bundles on the local filesystem when
created.  During a kernel debug session, when the DynamicLoader
plugin needs to locate a kext by name like
"com.apple.com.apple.filesystems.autofs", the Platform can quickly
look for a UUID match in those kernel debug kit directories it
previously indexed.

I'm still working on profiling the performance impact of the inital
kext bundle scan; there will likely need to be a switch to enable
or disable this plugin's scan.

This only affects Mac kernel debugging and the code is only built
on Apple systems because of some use of low-level CoreFoundation
to parse plists.

<rdar://problem/13503583> 

llvm-svn: 178827
2013-04-05 01:03:25 +00:00
Greg Clayton 85d0c57bb3 <rdar://problem/13449987>
Show thread name and dispatch queue by default in the thread display.

llvm-svn: 178790
2013-04-04 20:40:35 +00:00
Greg Clayton b7ad58a0df <rdar://problem/13457391>
LLDB now can use a single dash for all long options for all commands form the command line and from the command interpreter. This involved just switching all calls from getopt_long() to getopt_long_only().

llvm-svn: 178789
2013-04-04 20:35:24 +00:00
Jason Molenda 14aef12e24 Change EnumerateDirectory from using readdir() to using readdir_r()
so it can be re-entered while iterating over a directory safely.

llvm-svn: 178738
2013-04-04 03:19:27 +00:00
Jim Ingham fce1dad042 The SBValue impl class's GetSP can now fetch the dynamic type or the synthetic
children - which it may have to compute.  Thus it needs to take the API lock.

<rdar://problem/13560869>

llvm-svn: 178734
2013-04-04 02:23:41 +00:00
Jim Ingham 3495127549 Change the default for "use-fast-stepping" to on.
<rdar://problem/11319574>

llvm-svn: 178732
2013-04-04 01:38:54 +00:00
Enrico Granata e98184322a <rdar://problem/13563697>
The __NSArrayI synthetic children provider was running expressions to generate children, which is inefficient for large amounts of data
Reimplementing to use a faster algorithm

llvm-svn: 178729
2013-04-04 01:12:12 +00:00
Greg Clayton 9ff5aae5b0 <rdar://problem/12897145>
Changes to lldb made the following fail when it used to work:

% cd /tmp
% lldb ls
error: unable to find executable for '/tmp/ls'

Resolving an executable with no relative path was broken, now its fixed.

llvm-svn: 178719
2013-04-04 00:15:09 +00:00
Greg Clayton d6e6ddd636 Revert code I didn't mean to check in.
llvm-svn: 178718
2013-04-04 00:07:32 +00:00
Greg Clayton abcbfe5369 More support for version 4 of DWARF.
llvm-svn: 178717
2013-04-04 00:00:36 +00:00
Greg Clayton 7b619fc159 Playing around with making performance test cases run from within python.
llvm-svn: 178708
2013-04-03 22:59:27 +00:00
Greg Clayton bc43cab51d <rdar://problem/13384801>
Make lldb_private::RegularExpression thread safe everywhere. This was done by removing the m_matches array from the lldb_private::RegularExpression class and putting it into the new lldb_private::RegularExpression::Match class. When executing a regular expression you now have the option to create a lldb_private::RegularExpression::Match object and pass a pointer in if you want to get parenthesized matching. If you don't want any matching, you pass in NULL. The lldb_private::RegularExpression::Match object is initialized with the number of matches you desire. Any matching strings are now extracted from the lldb_private::RegularExpression::Match objects. This makes the regular expression objects thread safe and as a result many more regex objects were turned into static objects that end up using a local lldb_private::RegularExpression::Match object when executing.

llvm-svn: 178702
2013-04-03 21:37:16 +00:00
Rafael Espindola f24933f65e Fix build.
This should fix the build breakage caused by the api change in 178663.

llvm-svn: 178700
2013-04-03 21:29:21 +00:00
Greg Clayton a75f0ca30e <rdar://problem/13561911>
Modify LLDB to handle DW_FORM_ref_addr attributes for DWARF3 and DWARF4.

llvm-svn: 178696
2013-04-03 21:09:33 +00:00
Jason Molenda c01e1b72ad #include clang's AST/DeclCXX.h to pick up CXXRecordDecl definition,
needed for some versions of clang.

llvm-svn: 178692
2013-04-03 20:32:17 +00:00
Greg Clayton 43fe217b11 <rdar://problem/13506727>
Symbol table function names should support lookups like symbols with debug info. 

To fix this I:
- Gutted the way FindFunctions is used, there used to be way too much smarts only in the DWARF plug-in
- Made it more efficient by chopping the name up once and using simpler queries so that SymbolFile and Symtab plug-ins don't need to do as much
- Filter the results at a higher level
- Make the lldb_private::Symtab able to chop up C++ mangled names and make as much sense out of them as possible and also be able to search by basename, fullname, method name, and selector name.

llvm-svn: 178608
2013-04-03 02:00:15 +00:00
Enrico Granata eb8bd925c6 <rdar://problem/13563403>
Reimplemented the NSDictionary synthetic children provider for added performance.
Instead of generating pairs by running an expression, we now create a pair type using clang-level APIs and fill in a buffer with the pointers to key and value
This strategy takes the time required to dump a 10k items __NSDictionaryM from ~45s to <4s

llvm-svn: 178601
2013-04-03 01:25:29 +00:00
Jim Ingham 298f378f6a Allow partial matching for alias commands as well as regular commands.
<rdar://problem/13552724>

llvm-svn: 178597
2013-04-03 00:25:49 +00:00
Sean Callanan e29f61d85e Improved reporting of faults on i386.
<rdar://problem/13558979>

llvm-svn: 178596
2013-04-03 00:08:22 +00:00
Enrico Granata 23ab35aed2 Fixing a silly bug that would cause string summaries not to show up :-)
llvm-svn: 178590
2013-04-02 23:07:55 +00:00
Enrico Granata d83bfce6d4 <rdar://problem/13415737>
Fixing a bug where LLDB was not handling correctly CFStrings that have an explicit length but no NULL terminator
The data formatter was showing garbled data as part of the summary
The fix is to explicitly figure out the explicit length if we need to (bitfields tell us when that is the case) and use that as a size delimiter

llvm-svn: 178577
2013-04-02 21:25:34 +00:00
Greg Clayton 1afa68ed14 <rdar://problem/13516463>
Don't crash when there is no register context for a thread with kernel debugging. The kernel debugging uses the OperatingSystemPlugin that may behave badly when trying to get thread state, so be prepared to have invalid register contexts in threads.

llvm-svn: 178574
2013-04-02 20:32:37 +00:00
Sean Callanan cbf87cc8d6 Added "rb" and "rbr" aliases to fix regressions
when we changed "rb" to "rbreak".

<rdar://problem/13552724>

llvm-svn: 178573
2013-04-02 20:21:34 +00:00
Sean Callanan eeb4384924 Enabled blocks support in the expression parser.
Note: although it is now possible to declare blocks
and call them inside the same expression, we do not
generate correct block descriptors so these blocks
cannot be passed to functions like dispatch_async.

<rdar://problem/12578656>

llvm-svn: 178509
2013-04-01 22:12:37 +00:00
Daniel Malea 335bf6fb76 Fix bug in ProcessPOSIX::IsAlive() exposed by r178324
- process in 'unloaded' state was (incorrectly) considered to be alive by POSIX plugin
- above caused a regression in TestProcessLaunch cases

llvm-svn: 178493
2013-04-01 19:48:37 +00:00
Daniel Malea d659dc16cc Avoid hang in attach-by-name test case
- Check that process attach succeeded before attempting to WaitForProcessToStop (observed to cause hangs on Linux)
- Update comment in TestHelloWorld case -- attaching by name still broken

llvm-svn: 178491
2013-04-01 19:47:00 +00:00
Sean Callanan 6447c47541 Elide all artificial copy constructors, because
they are probably trivial.  This means that we
don't confuse Clang about whether a class is
trivially copy constructible.  It can figure
that out itself as long as we don't explicitly
feed it the constructors.

If the class is trivially copy-constructible,
this can change the ABI that Clang uses to call
functions that return that class (e.g., by making
the object be returned in a register), so this
is quite important for correctness.

<rdar://problem/13457741>

llvm-svn: 178411
2013-03-30 03:06:45 +00:00
Sean Callanan e55bc8a9c1 Fixed the way ClangASTImporter deports types from
ASTContexts that will not stay around.  Before, we
did this in a very half-hearted way.  Now we maintain
work queues of all Decls that need to be completed
before the source ASTContext can go away; we then
expunge their origins completely.

<rdar://problem/13511875>

llvm-svn: 178410
2013-03-30 02:31:21 +00:00
Sean Callanan 42f26b488b Disable warnings from Clang correctly, by directly
manipulating the diagnostics engine.

<rdar://problem/13508470>

llvm-svn: 178399
2013-03-30 01:26:06 +00:00
Greg Clayton a7d8c21b8f <rdar://problem/13131838>
Platform select documents a -S option but doesn't accept it, now it does.

llvm-svn: 178384
2013-03-29 23:18:38 +00:00
Jim Ingham bb03b8f45d 1 breakpoint is a breakpoint not a breakpoints.
rdar://problem/13536544

llvm-svn: 178367
2013-03-29 21:01:03 +00:00
Sean Callanan 3abb976dc9 Fixed a crash if the Objective-C runtime module
wasn't loaded into the underlying process or
couldn't be found.

<rdar://problem/13533671>

llvm-svn: 178363
2013-03-29 19:46:09 +00:00
Greg Clayton 7d2ef16cb3 <rdar://problem/12022060>
Enable tab completion for regular expression commands.

llvm-svn: 178348
2013-03-29 17:03:23 +00:00
Jim Ingham 8af3b9ca67 Rationalize how we do Halt-ing before Destroy and Detach.
<rdar://problem/13527167>

llvm-svn: 178325
2013-03-29 01:18:12 +00:00
Jim Ingham dcb1d856d7 “process launch” should “detach” not “kill” if the current process was one we attached to.
“process attach” should ask the same questions as process launch if there is a current process.
“process connect” then “process launch” or “process attach” should actually work.

<rdar://problem/13524210>
<rdar://problem/13524208>
<rdar://problem/13488919>

llvm-svn: 178324
2013-03-29 00:56:30 +00:00
Greg Clayton 3faf47c462 <rdar://problem/11730263>
PC relative loads are missing disassembly comments when disassembled in a live process.

This issue was because some sections, like __TEXT and __DATA in libobjc.A.dylib, were being moved when they were put into the dyld shared cache. This could also affect any other system that slides sections individually.

The solution is to keep track of wether the bytes we will disassemble are from an executable file (file address), or from a live process (load address). We now do the right thing based off of this input in all cases.

llvm-svn: 178315
2013-03-28 23:42:53 +00:00
Enrico Granata 320dcf6876 <rdar://problem/12410225>
By default, omit the children for a char[] and just show the string contents
Can be overridden by appropriate command-line flags

llvm-svn: 178292
2013-03-28 21:36:58 +00:00
Enrico Granata 6eca3559d6 Hardening the vector iterator synthetic child(ren) provider against item-not-in-cluster asserts
llvm-svn: 178265
2013-03-28 18:50:54 +00:00
Greg Clayton ca5ce187fa Be sure to take the mutex when the destructor is called in case other threads are using these lists and those other threads have the mutex locked.
llvm-svn: 178262
2013-03-28 18:41:44 +00:00
Greg Clayton ac358da589 <rdar://problem/13527167>
Partial fix for the above radar.

Call ThreadList::Clear() in the ThreadList destructor so if any other threads currently have the thread list mutex, we won't destroy the list for them while they are using it. ThreadList::Clear() takes the mutex and clears the thread list contents.

llvm-svn: 178257
2013-03-28 18:33:53 +00:00
Ashok Thirumurthi 4f5f39ac4c Introduces extended register sets whose availability can vary with the target processor.
- Includes a stub for AVX support in the x86-64 register context and a failing test for register sets that are unavailable.

Thanks to Greg Clayton for his review feedback.

llvm-svn: 178252
2013-03-28 17:27:40 +00:00
Ashok Thirumurthi 0118635979 Fix the Linux build issues introduced by r178191.
- All Linux logging channels now use a single global instance of lldb_private::Log, to handle the case of logging during process tear down.
- Also removed a single use of LogSP in FreeBSD and fixed a typo in a comment while reading through ProcessKDPLog.

Reviewed by Daniel Malea.

llvm-svn: 178242
2013-03-28 16:02:31 +00:00
Enrico Granata 198125a8ff <rdar://problem/13412986>
Holding the Python lock while we call the Python C API to post-process objects returned from the OS plugins
This should avoid issues where some Python objects get invalidated while we are in the middle of processing them and we end up with an invalid Python state and a crash

llvm-svn: 178206
2013-03-28 00:27:30 +00:00
Jim Ingham 5cb9a184e0 Protect against the case where the current inlined depth is wrong, and leads us to think we can't even get the
frame at index 0.  We should ALWAYS be able to get that.

<rdar://problem/13497571>

llvm-svn: 178205
2013-03-28 00:13:30 +00:00
Jim Ingham 23460c369c Use the error from ValidatePlan.
llvm-svn: 178204
2013-03-28 00:08:00 +00:00
Jim Ingham 7d7931de4a RunThreadPlan should make sure the plan passed in is valid before running it.
<rdar://problem/13485541>

llvm-svn: 178202
2013-03-28 00:05:34 +00:00
Jim Ingham ea06f3bf4c Return a useful error message from ValidatePlan if the expression can't be made for some reason.
llvm-svn: 178201
2013-03-28 00:04:05 +00:00