Commit Graph

5858 Commits

Author SHA1 Message Date
Greg Clayton f0246d1518 <rdar://problem/12331741>
Dynamic type code must be efficient and fast. Now it is.

Added ObjC v1 support for getting the complete list of ISA values.

The main flow of the AppleObjCRuntime subclasses is now they must override "virtual bool UpdateISAToDescriptorMap_Impl();". This function will update the complete list of ISA values and create ClassDescriptorSP objects for each one. Now we have the complete list of valid ISA values which we can use for verification when doing dynamic typing.

Refactored a bunch of stuff so that the AppleObjCRuntime subclasses don't have to implement as many functions as they used to.

llvm-svn: 165730
2012-10-11 18:07:21 +00:00
Greg Clayton b29e6c6e84 Patch from Andrew Kaylor that fixes Linux default host triple values.
llvm-svn: 165728
2012-10-11 17:38:58 +00:00
Micah Villmow 083189730e Add in the first iteration of support for llvm/clang/lldb to allow variable per address space pointer sizes to be optimized correctly.
llvm-svn: 165726
2012-10-11 17:21:41 +00:00
Jason Molenda 3f9fa52ca7 When OptionValueFileSpec is given a filename starting
with ~, we need to realpath it.  Fixes the case where

settings set target.expr-prefix ~/lldb.prefix.header

wouldn't read this prefix header file.  <rdar://problem/12475676> 

llvm-svn: 165704
2012-10-11 06:05:54 +00:00
Jason Molenda 22f2fff3ff Change the scratch buffer for x86 assembly instructions in AssemblyParse_x86 from
malloc'ed heap to an llvm SmallVector.

llvm-svn: 165703
2012-10-11 06:04:37 +00:00
Enrico Granata 10de09044e <rdar://problem/12462744> Implement a new SBDeclaration class to wrap an lldb_private::Declaration - make a GetDeclaration() API on SBValue to return a declaration. This will only work for vroot variables as they are they only objects for which we currently provide a valid Declaration
llvm-svn: 165672
2012-10-10 22:54:17 +00:00
Jason Molenda 64dc7798a4 Move the scratch buffer allocation for x86 instructions from being allocated each instruction,
to once in the AssemblyParse_x86 ctor.
an instruction

llvm-svn: 165662
2012-10-10 21:37:00 +00:00
Jim Ingham 4f465cff8a Change the Thread constructor over to take a Process& rather than a ProcessSP. We can't create Threads with a NULL ProcessSP, so it makes no sense to use the SP.
Then make the Thread a Broadcaster, and get it to broadcast when the selected frame is changed (but only from the Command Line) and when Thread::ReturnFromFrame 
changes the stack.
Made the Driver use this notification to print the new thread status rather than doing it in the command.
Fixed a few places where people were setting their broadcaster class by hand rather than using the static broadcaster class call.

<rdar://problem/12383087>

llvm-svn: 165640
2012-10-10 18:32:14 +00:00
Jim Ingham 71bf299581 Don't make regexp commands as regular commands - they are "short cuts" and users should be able to override them with "unalias" but you can't unalias normal commands.
llvm-svn: 165630
2012-10-10 16:51:31 +00:00
Jason Molenda a72778119e Free the opcode_data malloc'ed memory instead of leaking it - thanks for catching that, Chris.
llvm-svn: 165597
2012-10-10 03:47:23 +00:00
Jason Molenda a8399a8cf1 Change the x86 unwinder from using edis as its disassembler
API (to get the length of x86 instructions) to using the LLVM-MC
disassembler.
<rdar://problem/12411000>

llvm-svn: 165587
2012-10-10 01:45:33 +00:00
Greg Clayton 64809ce783 Someone was using vi and left a little something in the code.
llvm-svn: 165580
2012-10-10 00:58:07 +00:00
Sean Callanan 2cc1fbfc9b Switched AppleObjCRuntimeV2::CreateClassDescriptor
over to simply update its cache and then look up
the descriptor in the cache.  This is fine because
the cache now builds much faster (since descriptors
are minimal).

Metaclasses aren't in the cache, so I switched
the Describe method for class descriptors from using
GetClassDescriptor to manually creating an automatic
ClassDescriptorV2.

llvm-svn: 165579
2012-10-10 00:46:46 +00:00
Sean Callanan 156d16cb04 Thinned the AppleObjCRuntimeV2's class descriptors.
The following are now derived lazily:

- The name of the class (cached);
- the instance size of the class (not cached);

The following have been removed entirely:

- Whether the class is realized.  This is an
  implementation detail.
- The contents of the objc_class object.  That
  object can be read as needed.
- Whether the class is valid.  The fact that
  we vended a class to begin with means it's
  valid.  We will only give up looking parts
  of it up if they are not in the format we
  expect.

llvm-svn: 165567
2012-10-09 23:45:42 +00:00
Enrico Granata a5d3ba008b <rdar://problem/12462575> Refactoring a block of shared code in the NSString data formatter
llvm-svn: 165557
2012-10-09 22:44:18 +00:00
Sean Callanan 880ee17fb8 Cleanup in the AppleObjCRuntimeV2 to make descriptors
lighter-weight so that the cache can be populated
faster.

- I Added a ProcessWP to the runtime so I can
  take it out of the individual descriptors, saving
  space;
- I made the constructors for the descriptors
  private so that only the runtime can invoke them; 
  and
- I removed the constructor that takes a ValueObject
  since the logic for using a ValueObject is in the
  runtime.

llvm-svn: 165549
2012-10-09 21:21:35 +00:00
Jason Molenda 0a72520f22 Patch from Dan Malea to fix a build break I introduced yesterday.
Thanks again Dan!

llvm-svn: 165519
2012-10-09 18:40:44 +00:00
Greg Clayton 77fbc8176d Changes to clean up the runtime and how the ISA caches are managed.
llvm-svn: 165516
2012-10-09 17:51:53 +00:00
Greg Clayton 85c2a72f2a Fixed the redo.py script to emit correct arch and compiler options after dotest.py was switched over to use argparse.
llvm-svn: 165507
2012-10-09 16:54:55 +00:00
Jason Molenda bb860bd264 Add a parameter to Symbols::DownloadObjectAndSymbolFile() to control
whether we try to call an external program to load symbols unconditionally,
or if we check the user's preferences before calling it.

ProcessMachCore now sets CanJIT to false - we can't execute code in a core file.

DynamicLoaderDarwinKernel::OSKextLoadedKextSummary::LoadImageUsingMemoryModule changed
to load the kernel from an on-disk file if at all possible.
Don't load the kext binaries out of memory from the remote systems - their linkedit doesn't
seem to be in a good state and we'll error out down in SymbolVendorMacOSX if we try to use
the in-memory images.
Call Symbols::DownloadObjectAndSymbolFile to get the kext/kernel binary -- the external
program may be able to give us a file path on the local filesystem instead of reading
the binary / dSYM over a network drive every time.  Fall back to calling 
Target::GetSharedModule() like before if DownloadObjectAndSymbolFile fails.

llvm-svn: 165471
2012-10-09 01:17:11 +00:00
Greg Clayton 13d4dfd3f2 Fix a build warning and a dangerous possible crasher.
llvm-svn: 165460
2012-10-08 23:50:19 +00:00
Greg Clayton 9ba42d11aa Make DebugMapModule destructor virtual since it inherits from Module.
llvm-svn: 165441
2012-10-08 22:48:57 +00:00
Greg Clayton 3a18e31945 Added a new "module" log channel which covers module creation, deletion, and common module list actions.
Also added a new option for "log enable" which is "--stack" which will print out a stack backtrace for each log line.

This was used to track down the leaking module issue I fixed last week.

llvm-svn: 165438
2012-10-08 22:41:53 +00:00
Greg Clayton ae23ed336b Checking in fixes that I used to track down a leaking module. The heap module can now search the vm regions with the --vm-regions options to any of the heap functions. This is currently slow and often will time out when run on a large program since our user expression timeout is set to 500000 usec. We need to add an API to LLDB where we can specify the timeout for an expression.
llvm-svn: 165437
2012-10-08 22:39:38 +00:00
Enrico Granata beea93c130 <rdar://problem/12200505> Fixing a logical error in SBProcess, where the get_process_thread_list function was creating invalid threads_access instances, and hence failing to correctly fill in the list
llvm-svn: 165421
2012-10-08 19:06:11 +00:00
Enrico Granata f75c976928 Silly me! There was a closing ) missing from one of the lines - and Python complained about syntax errors on the next line. It being a Friday afternoon made the rest
llvm-svn: 165420
2012-10-08 19:01:10 +00:00
Enrico Granata 944b4c4c1b Retrying to apply Vishal's patch - hopefully this time it won't break Jason's build
llvm-svn: 165410
2012-10-08 17:32:55 +00:00
Micah Villmow 8468dbecf2 Move TargetData to DataLayout.
llvm-svn: 165396
2012-10-08 16:28:57 +00:00
Jason Molenda 53667f5da1 In DynamicLoaderDarwinKernel::OSKextLoadedKextSummary::LoadImageUsingMemoryModule(),
if we have a kernel binary, set the target's architecture to match.

Include the target's architecture in the ModuleSpec when we're searching for the 
kext binaries on the local system -- otherwise we won't get a specific slice of
a fat file picked out for us and we won't use the returned Module correctly.

Remove the redundant attempt to find a file on the local filesystem from this method.


In ProcessGDBRemote::CheckForKernel(), if we have a kernel binary in memory, mark
the canJIT as false.  There is no jitting code in kernel debug sessions.

llvm-svn: 165357
2012-10-06 02:02:26 +00:00
Jason Molenda cc62f28735 Revert Vishal's patch that Enrico commited, at least for the weekend. With it applied,
starting lldb I get

% ./lldb -x
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/tmp/build/Debug/LLDB.framework/Versions/A/Resources/Python/lldb/__init__.py", line 9008
    raise TypeError("No array item of type %s" % str(type(key)))
        ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
(lldb)


I did a clean build and still got the problem so I'm backing this out until Enrico can
look at it.

llvm-svn: 165356
2012-10-06 01:46:12 +00:00
Jim Ingham 215341c25b Make the error message from regex commands use the command's syntax string if it exists rather than a generic but
not at all helpful message about not matching some unknown regex...

llvm-svn: 165349
2012-10-06 00:27:04 +00:00
Enrico Granata ffe2d52a06 patch from Vishal Patel to improve our lldb.value wrapper
llvm-svn: 165348
2012-10-06 00:06:18 +00:00
Enrico Granata cd29fefbff <rdar://problem/12442990> Fix the implementation of lldb.value.__eq__
llvm-svn: 165344
2012-10-05 23:20:58 +00:00
Enrico Granata e3fcd2bb53 <rdar://problem/12426557> Fixing the NSIndexSet data formatter
llvm-svn: 165341
2012-10-05 22:58:46 +00:00
Jason Molenda 675e45c770 Remove "k" as an alias for "kill". It doesn't ask for confirmation and
it's too easy to type by mistake when typing "l" (read: I did this once).

llvm-svn: 165340
2012-10-05 22:56:23 +00:00
Jason Molenda 48d88919d7 Remove two more cases of "-w write" being specified
to watch var set/exp -- that's now the default in the
shipped lldb.

llvm-svn: 165333
2012-10-05 20:28:11 +00:00
Jason Molenda 80f1663a9c Improve shortened examples of the watchpoint commands.
Document "f <n>" selects frame n.  
"t <n>" selects thread n but this was just added to TOT
so most people won't have access to an lldb that accepts it.

llvm-svn: 165332
2012-10-05 20:25:53 +00:00
Jim Ingham 067df8090a Remove the bt alias I inadvertently added back in in my last checkin.
llvm-svn: 165330
2012-10-05 19:48:19 +00:00
Jim Ingham ca36cd16e4 Add one-shot breakpoints (-o option to "break set") and a tbreak alias for our gdb friends.
llvm-svn: 165328
2012-10-05 19:16:31 +00:00
Jim Ingham 874f43cadc Fix a test failure caused by checkin 165274.
llvm-svn: 165327
2012-10-05 19:14:57 +00:00
Jason Molenda 766e7277ed one more small fix for the gdb-comes-first column order
llvm-svn: 165301
2012-10-05 05:31:01 +00:00
Jason Molenda 4cddfedf53 Change the "bt" command alias defined in CommandInterpreter::LoadCommandDictionary.
It is now a regex command alias that more faithfully emulates gdb's
behavior, most importantly, "bt 5" will backtrace 5 frames of the
currently selected thread.  "bt all" still backtraces all threads
(unlike gdb) and for users who have learned to use "bt -c 5", that
form is still accepted.

llvm-svn: 165300
2012-10-05 05:29:32 +00:00
Jason Molenda a8805d3809 Symbols::LocateMacOSXFilesUsingDebugSymbols() - perform tilde
expansion on the dSYM path we find if it starts with a tilde.

llvm-svn: 165299
2012-10-05 04:57:34 +00:00
Jason Molenda 840e2819c6 typeo
llvm-svn: 165297
2012-10-05 04:29:13 +00:00
Jason Molenda 293e210a59 typeo
llvm-svn: 165296
2012-10-05 04:28:53 +00:00
Jason Molenda 74f29358b1 Update the intro paragraph of text describing the table below to
reflect that the columns were just swapped.

llvm-svn: 165295
2012-10-05 04:28:33 +00:00
Jason Molenda c8fd91603a Swap the columns in the lldb & gdb command comparison table. I
often hear feedback from people that having the lldb commands on
the left hand side is non-intuitive -- they say "I want a *gdb* to
*lldb* table, not a *lldb* to *gdb* table".  It doesn't seem odious
to go from the right-hand column to the left hand column but I've
heard this same feedback enough that it's also pointless to keep
the format lldb-first, gdb-second when it was an arbitrary choice
to begin with.

llvm-svn: 165294
2012-10-05 04:26:06 +00:00
Enrico Granata 70fd574c2e <rdar://problem/12099999> renaming SBStream::Printf to Print in the scripting world in order to avoid supporting varargs through SWIG
llvm-svn: 165274
2012-10-04 23:54:09 +00:00
Enrico Granata 4d6cd886f5 A tweak to the previous commit to ensure that we don't try to use -> on a NULL pointer (should not happen but better be safe than sorry)
llvm-svn: 165272
2012-10-04 23:17:01 +00:00
Enrico Granata e6f1b76fef <rdar://problem/12413390> Fixing an issue where synthetic ValueObjects do not properly resolve their value
llvm-svn: 165271
2012-10-04 23:13:00 +00:00
Jason Molenda ccd41e55f1 Ran the sources through the compiler with -Wshadow warnings
enabled after we'd found a few bugs that were caused by shadowed
local variables; the most important issue this turned up was
a common mistake of trying to obtain a mutex lock for the scope
of a code block by doing

        Mutex::Locker(m_map_mutex);

This doesn't assign the lock object to a local variable; it is
a temporary that has its dtor called immediately.  Instead,

        Mutex::Locker locker(m_map_mutex);

does what is intended.  For some reason -Wshadow happened to
highlight these as shadowed variables.

I also fixed a few obivous and easy shadowed variable issues
across the code base but there are a couple dozen more that
should be fixed when someone has a free minute.
<rdar://problem/12437585>

llvm-svn: 165269
2012-10-04 22:47:07 +00:00
Sean Callanan bfeb28087a Removed a directive to delete the test subdirectories
from LLVM and Clang.  This made "svn update" very
unpleasant if the original repository was fetched by
build-llvm.pl.

llvm-svn: 165268
2012-10-04 22:37:53 +00:00
Sean Callanan 48954c95a7 Made the i386 ABI mark EBP as non-volatile,
because the unwinders typically can find its
value.

llvm-svn: 165266
2012-10-04 22:24:27 +00:00
Jim Ingham 2f355a7fca ClangASTContext::GetIndexOfChildWithName - increment the child index we plan to return as we iterate through the ivars.
<rdar://problem/12433299>

llvm-svn: 165264
2012-10-04 22:22:16 +00:00
Sean Callanan 464a5b57f9 Fixed an assertion in the SymbolFile resulting
from a NULL ObjCInterfaceDecl.

llvm-svn: 165261
2012-10-04 22:06:29 +00:00
Enrico Granata 476b9ee82b <rdar://problem/12424824> Making sure that we correctly update our synthetic children provider for NSDictionary - providing better support for dynamic types by letting the filter recalculate itself when the type of the object changes
llvm-svn: 165260
2012-10-04 21:46:06 +00:00
Enrico Granata 7b8c0389e1 <rdar://problem/12424824> Making sure that we correctly update our synthetic children provider for NSArray - the same work will need to be done for NSDictionary
llvm-svn: 165252
2012-10-04 21:04:46 +00:00
Jason Molenda 31a6961c13 Patch submitted by Dan Malea -- I introduced a dependency between
ProcessGDBRemote and DynamicLoaderDarwinKernel and a patch was needed
to get this building on Linux.  Thanks!

llvm-svn: 165193
2012-10-04 02:16:06 +00:00
Jason Molenda 593dd76044 Remove a few debug printf's that were left in ProcessKDP.
llvm-svn: 165192
2012-10-04 02:06:30 +00:00
Enrico Granata f175ad152c <rdar://problem/12099592> Adding back a bunch of code-running summaries
llvm-svn: 165186
2012-10-03 23:53:45 +00:00
Jim Ingham a0cc6b24be Don't turn on the debugserver log by default.
llvm-svn: 165176
2012-10-03 22:31:30 +00:00
Enrico Granata 83805259e1 <rdar://problem/12408181> Fixing a bug where we would try to look for types in a module, and then fail to look for them anywhere else because the same SymbolContext was being passed everywhere
llvm-svn: 165169
2012-10-03 21:31:35 +00:00
Sean Callanan 7505079a1f An API in Clang got renamed; fixing LLDB to match.
llvm-svn: 165144
2012-10-03 19:23:27 +00:00
Jason Molenda 5e8534efe7 The kernel loading code is now isolated in the DynamicLoaderDarwinKernel;
remove the duplicates of this code in ProcessGDBRemote and ProcessKDP.
These two Process plugins will hardcode their DynamicLoader name to be
the DynamicLoaderDarwinKernel so the correct DynamicLoader is picked,
and return the kernel load address as the ImageInfosAddress.
<rdar://problem/12417038> 

llvm-svn: 165080
2012-10-03 01:29:34 +00:00
Jason Molenda 743e439608 Change DynamicLoaderDarwinKernel::OSKextLoadedKextSummary to use
the Symbols::LocateExecutableObjectFile method to locate kexts and
kernels instead of copying them out of the memory of the remote
system.  This is the fix for <rdar://problem/12416384>.

Fix a variable shadowing problem in
Symbols::LocateMacOSXFilesUsingDebugSymbols which caused the symbol
rich executable binaries to not be found even if they were listed
in the dSYM Info.plist.

Change Symbols::DownloadObjectAndSymbolFile to ignore dsymForUUID's
negative cache - this is typically being called by the user and we
should try even if there's a incorrect entry in the negative cache.

llvm-svn: 165061
2012-10-02 22:23:42 +00:00
Greg Clayton 548e9a3e61 <rdar://problem/11791234>
Shared libraries on MacOSX were not properly being removed from the shared
module list when re-running a debug session due to an error in:

Module::MatchesModuleSpec()

llvm-svn: 164991
2012-10-02 06:04:17 +00:00
Jason Molenda 68b3607fa2 Handle KASLR kernel loading for kernel corefiles.
Reduce the amount of output that DynamicLoaderDarwinKernel
prints for each kext it loads.
<rdar://problem/7714201> 

llvm-svn: 164985
2012-10-02 03:49:41 +00:00
Enrico Granata 83c85e4193 <rdar://problem/12349509> Renaming the structure that we use for NSDictionary children
llvm-svn: 164973
2012-10-01 21:49:10 +00:00
Enrico Granata e00af8093c <rdar://problem/12406088> Fixing a crasher with adding a regex command, due to accessing a shared pointer without first checking for NULL
llvm-svn: 164950
2012-10-01 17:19:37 +00:00
Jason Molenda d1fae144ba Add the RelocateOrLoadKernel and LoadKernel methods to ProcessGDBRemote::DoRemoteConnect().
When attaching to a remote system that does not look like a typical vendor system, and no
executable binary was specified to lldb, check a couple of fixed locations where kernels
running in ASLR mode (slid in memory to a random address) store their load addr when booted
in debug mode, and relocate the symbols or load the kernel wholesale from the host computer
if we can find it.  

<rdar://problem/7714201>

llvm-svn: 164888
2012-09-29 08:03:33 +00:00
Jason Molenda 4bd4e7e3ba Add support for debugging KASLR kernels via kdp (the kernel being
loaded at a random offset).

To get the kernel's UUID and load address I need to send a kdp
packet so I had to implement the kernel relocation (and attempt to
find the kernel if none was provided to lldb already) in ProcessKDP
-- but this code really properly belongs in DynamicLoaderDarwinKernel.

I also had to add an optional Stream to ConnectRemote so
ProcessKDP::DoConnectRemote can print feedback about the remote kernel's
UUID, load address, and notify the user if we auto-loaded the kernel via
the UUID.

<rdar://problem/7714201>

llvm-svn: 164881
2012-09-29 04:02:01 +00:00
Sean Callanan eb918cd789 Now in the presence of an Objective-C version 2
runtime, we read method signatures for both class
and instance methods out of the runtime data.

(lldb) fr var str
(NSString *) str = 0x0000000105000180 @"Hello from '/Volumes/Data/projects/lldb/test/lang/objc/foundation/a.out'"
(lldb) expr str.length
(unsigned long long) $0 = 72
(lldb) expr [NSString stringWithCString:"Hello world!" encoding:1]
(id) $1 = 0x0000000105100050
(lldb) po $1
$1 = 0x0000000105100050 Hello world!

(lldb) fr var array1
(NSArray *) array1 = 0x000000010010a6e0 @"3 objects"
(lldb) expr array1.count
(unsigned long long) $0 = 3
(lldb) expr [array1 objectAtIndex:2]
(id) $1 = 0x00000001000025d0
(lldb) po $1
$1 = 0x00000001000025d0 array1 object3

Notice that both regular and property-style notation
work.  I still need to add explicit support for
properties with non-default setters/getters.

This information is only queried if an Objective-C
object does not have debug information for a complete
type available.  Otherwise we query debug information
as usual.

llvm-svn: 164878
2012-09-29 01:53:36 +00:00
Enrico Granata 6d39077fe7 <rdar://problem/12378910> Fix a bunch of other places where similar problems could happen
llvm-svn: 164871
2012-09-29 00:47:43 +00:00
Enrico Granata 60b81dff85 <rdar://problem/12378910> Fixing a potential crasher in the data formatters where we fail to check for NULL or empty class name
llvm-svn: 164870
2012-09-29 00:45:53 +00:00
Enrico Granata 21dfcd9d41 Implementing plugins that provide commands.
This checkin adds the capability for LLDB to load plugins from external dylibs that can provide new commands
It exports an SBCommand class from the public API layer, and a new SBCommandPluginInterface

There is a minimal load-only plugin manager built into the debugger, which can be accessed via Debugger::LoadPlugin.

Plugins are loaded from two locations at debugger startup (LLDB.framework/Resources/PlugIns and ~/Library/Application Support/LLDB/PlugIns) and more can be (re)loaded via the "plugin load" command

For an example of how to make a plugin, refer to the fooplugin.cpp file in examples/plugins/commands

Caveats:
	Currently, the new API objects and features are not exposed via Python.
	The new commands can only be "parsed" (i.e. not raw) and get their command line via a char** parameter (we do not expose our internal Args object)
	There is no unloading feature, which can potentially lead to leaks if you overwrite the commands by reloading the same or different plugins
	There is no API exposed for option parsing, which means you may need to use getopt or roll-your-own

llvm-svn: 164865
2012-09-28 23:57:51 +00:00
Greg Clayton 3852b3e189 <rdar://problem/12398225>
Improve performance of StringExtractor::GetHexS8().

llvm-svn: 164852
2012-09-28 21:51:54 +00:00
Sean Callanan d473424d53 Fixed a bug where if something went wrong while
constructing the ObjCInterfaceDecl for an ISA,
we'd continue and try to use that Decl anyway,
possibly causing a crash.

llvm-svn: 164844
2012-09-28 20:47:47 +00:00
Filipe Cabecinhas e26391a43f Fix a bug introduced in an earlier revision: actually return the StopReason, when we have a StopInfo object.
llvm-svn: 164825
2012-09-28 15:55:43 +00:00
Jason Molenda f49306a2c6 Recognize the eax/ebp/eip etc version of x86 register
names in addition to the rax/rbp/rip register names when
deciding whether a register is volatile or not.

llvm-svn: 164812
2012-09-28 05:46:55 +00:00
Jason Molenda 65c28cb47a Fix the extra space char being emitted in this message when breakpoints resolve -
1 location  added to breakpoint 2

llvm-svn: 164810
2012-09-28 01:50:47 +00:00
Sean Callanan 21b51062db Improved the runtime reading to also get data
out of the metaclass, so as to enumerate class
methods for an object.

llvm-svn: 164808
2012-09-27 23:47:51 +00:00
Greg Clayton b5f0feabae Wrapped up the work I am going to do for now for the "add-dsym" or "target symfile add" command.
We can now do:

Specify a path to a debug symbols file:
(lldb) add-dsym <path-to-dsym>

Go and download the dSYM file for the "libunc.dylib" module in your target:
(lldb) add-dsym --shlib libunc.dylib

Go and download the dSYM given a UUID:
(lldb) add-dsym --uuid <UUID>

Go and download the dSYM file for the current frame:
(lldb) add-dsym --frame

llvm-svn: 164806
2012-09-27 22:26:11 +00:00
Jason Molenda 47d114ac01 Patch from Dan Malea to get the Bourne shells scripts to run cleanly on Ubuntu.
llvm-svn: 164801
2012-09-27 21:26:57 +00:00
Sean Callanan 2885a7088d Fixed some bugs in the runtime reader code. Also
added a parser for method signatures in the
Objective-C @encode format.

llvm-svn: 164792
2012-09-27 20:38:15 +00:00
Greg Clayton 6f485f3f77 Ashok Thirumurthi patch to enable the latest and greatest DWARF forms from the DWARF 4 specification.
llvm-svn: 164779
2012-09-27 16:48:25 +00:00
Filipe Cabecinhas ebca38a4c5 Fixed a typo.
llvm-svn: 164777
2012-09-27 15:31:38 +00:00
Greg Clayton c8f814d1df Added the ability to download a symboled executable and symbol file given a UUID.
llvm-svn: 164753
2012-09-27 03:13:55 +00:00
Jason Molenda c36b184fa2 Change the kdp-remote alias to require a hostname (instead of allowing a zero-length hostname to be specified).
llvm-svn: 164752
2012-09-27 02:47:55 +00:00
Jim Ingham 1f51e60b74 Implement returning integer values in "thread return" for arm, x86_64 and i386. Also returns
floats & doubles on x86_64.

<rdar://problem/8356523>

llvm-svn: 164741
2012-09-27 01:15:29 +00:00
Greg Clayton 91e407ea07 If we are attached to a platform, then make sure that we can verify that a process exists when attaching by "pid" before we try and do a lengthy command that could take a while to timeout.
llvm-svn: 164738
2012-09-27 00:03:39 +00:00
Greg Clayton e86fd74901 Added "k" as an alias to "process kill" since the new "kdb-remote" will now conflict with it.
llvm-svn: 164737
2012-09-27 00:02:27 +00:00
Jason Molenda e5b55eadda Add examples of using the kdp-remote and gdb-remote commands to connect to
gdb-remote protocol and kdp protocol systems.

llvm-svn: 164730
2012-09-26 22:42:25 +00:00
Greg Clayton 30c0a1cf94 Add convenience aliases to allow easy attaching to a remote gdb server or kdp (darwin kernel) server with the new "gdb-remote" regex alias and "kdp-remote" regex alias commands.
llvm-svn: 164729
2012-09-26 22:26:47 +00:00
Sean Callanan 4ca7389925 Added support for the DebugClang configuration to the
testsuite.

llvm-svn: 164723
2012-09-26 21:16:15 +00:00
Filipe Cabecinhas df461db533 Patch by Matt, to get lldb to build with the updated llvm+clang versions (via Makefiles).
llvm-svn: 164703
2012-09-26 16:27:06 +00:00
Filipe Cabecinhas 563a9521e4 Make lldb more C++11 friendly.
llvm-svn: 164702
2012-09-26 16:27:04 +00:00
Sean Callanan f601503ae6 Fixed a bug in the path remapper that caused
a crash if the path to be remaped was NULL.

<rdar://problem/12371888>

llvm-svn: 164653
2012-09-26 01:28:11 +00:00
Jim Ingham 11c8108d57 Add an API to figure out whether a breakpoint is internal or not.
llvm-svn: 164648
2012-09-25 23:55:19 +00:00
Jason Molenda c74198dedd The iOSSimulator platform should create a PlatformDarwin with
is_host == true so PlatformDarwin knows it can do same-host
operations like process lookup.  <rdar://problem/12296249> 

llvm-svn: 164647
2012-09-25 23:32:06 +00:00
Greg Clayton 984fee5b8f Added process attach options and also use the SBLaunchInfo and SBAttachInfo.
llvm-svn: 164619
2012-09-25 18:27:12 +00:00
Greg Clayton 97d5cf05eb <rdar://problem/9959501>
More KDP debugging process. We can not set breakpoints, hit them, resume, step and detach while running.

llvm-svn: 164584
2012-09-25 02:40:06 +00:00
Enrico Granata 64e15fc956 Making sure we do not try to compare a NULL string - which would cause us to crash
llvm-svn: 164574
2012-09-24 23:30:10 +00:00
Sean Callanan 771f1de241 Added a new Xcode build configuration, DebugClang,
which builds a Debug+Asserts build of Clang and
links LLDB against it.  The Debug configuration
builds Clang with Release+Asserts, for faster
linking and smaller memory footprint when debugging
the build LLDB.

llvm-svn: 164573
2012-09-24 23:21:18 +00:00
Sean Callanan c2bd8c2158 Removed some debugging cruft.
llvm-svn: 164572
2012-09-24 23:11:56 +00:00
Jason Molenda bdde850228 Fix string comparisons in ABIMacOSX_i386::RegisterIsCalleeSaved so
that volatile registers are correctly reported for this ABI.
We were incorrectly passing up volatile registers from callee
frames.

llvm-svn: 164564
2012-09-24 22:51:04 +00:00
Sean Callanan 3d654b3044 Brought LLDB top-of-tree into sync with LLVM/Clang
top-of-tree.  Removed all local patches and llvm.zip.

The intent is that fron now on top-of-tree will
always build against LLVM/Clang top-of-tree, and
that problems building will be resolved as they
occur.  Stable release branches of LLDB can be
constructed as needed and linked to specific release
branches of LLVM/Clang.

llvm-svn: 164563
2012-09-24 22:25:51 +00:00
Sean Callanan 32a5ba5b47 Made TestHiddenIvars an expected failure with
"frame variable".  "expr" finds hidden ivars
correctly.

llvm-svn: 164558
2012-09-24 21:34:40 +00:00
Jim Ingham 43de0f95ed Remove a couple of debugging printf's from the testsuite.
llvm-svn: 164544
2012-09-24 18:11:54 +00:00
Jim Ingham 493dffe2b1 Missed a few places where I didn't delete the obsolete (commented out) version of the breakpoint creation.
llvm-svn: 164436
2012-09-22 00:14:47 +00:00
Jim Ingham 63dfc725a7 Fix all the test case breakages caused by folks writing tests all over the place that depended explicitly
on the output of "break set".  Please don't do this sort of thing!!!!!

llvm-svn: 164433
2012-09-22 00:05:11 +00:00
Jim Ingham 1391cc7d51 Change the new breakpoint creation output (primarily from "break set") to something more useful.
<rdar://problem/11333623>

llvm-svn: 164432
2012-09-22 00:04:04 +00:00
Enrico Granata 165f8af8c5 Initial commit of a new testsuite feature: test categories.
This feature allows us to group test cases into logical groups (categories), and to only run a subset of test cases based on these categories.

Each test-case can have a new method getCategories(self): which returns a list of strings that are the categories to which the test case belongs.
If a test-case does not provide its own categories, we will look for categories in the class that contains the test case.
If that fails too, the default implementation looks for a .category file, which contains a comma separated list of strings.
The test suite will recurse look for .categories up until the top level directory (which we guarantee will have an empty .category file).

The driver dotest.py has a new --category <foo> option, which can be repeated, and specifies which categories of tests you want to run.
(example: ./dotest.py --category objc --category expression)

All tests that do not belong to any specified category will be skipped. Other filtering options still exist and should not interfere with category filtering.
A few tests have been categorized. Feel free to categorize others, and to suggest new categories that we could want to use.

All categories need to be validly defined in dotest.py, or the test suite will refuse to run when you use them as arguments to --category.

In the end, failures will be reported on a per-category basis, as well as in the usual format.

This is the very first stage of this feature. Feel free to chime in with ideas for improvements!

llvm-svn: 164403
2012-09-21 19:10:53 +00:00
Greg Clayton 7925fbbadb Full KDP process control with per CPU resume and step.
llvm-svn: 164378
2012-09-21 16:31:20 +00:00
Sean Callanan 3e633a290e Fixed an oddity in the Objective-C class descriptors
where the descriptor took a pointer to an object and
expected the Initialize function to dereference that
pointer and extract the isa value.  This caused one
of our tests to fail.

llvm-svn: 164353
2012-09-21 02:09:51 +00:00
Greg Clayton 4b1b8b3e1d <rdar://problem/9959501>
KDP -- now with rudimentary process control (continue only) and read + write registers (which means we can see stack frames) for x86_64, i386 and ARM.

llvm-svn: 164352
2012-09-21 01:55:30 +00:00
Enrico Granata eacb4911a0 Fixing a logic error where we would incorrectly show the newly crafted function not found error for a Python function in some cases where the function actually existed and had an empty docstring
llvm-svn: 164334
2012-09-20 23:23:55 +00:00
Sean Callanan 2cb5e527f6 Fixed a problem where persistent variables did
not correctly store the contents of Objective-C
classes.  This was due to a combination of
factors:

  1) Types were only being completed if we were
     looking inside them for specific ivars
     (using FindExternalVisibleDeclsByName). 
     We now look the complete type up at every
     FindExternalLexicalDecls.

  2) Even if the types were completed properly,
     ValueObjectConstResult overrode the type
     of every ValueObject using the complete type
     for its class from the debug information.
     Superclasses of complete classes are not
     guaranteed to be complete.  Although "frame
     variable" uses the debug information,
     the expression parser does now piece together
     complete types at every level (as described
     in Bullet 1), so I provided a way for the
     expression parser to prevent overriding.

  3) Type sizes were being miscomputed by
     ClangASTContext.  It ignored the ISA pointer
     and only counted fields.  We now correctly
     count the ISA in the size of an object.

<rdar://problem/12315386>

llvm-svn: 164333
2012-09-20 23:21:16 +00:00
Greg Clayton dcadc5cfb7 Re-adding this previously removed file.
llvm-svn: 164331
2012-09-20 23:08:52 +00:00
Greg Clayton b85248da95 This file is causing problems. I am going to remove it and try re-adding it.
llvm-svn: 164328
2012-09-20 23:08:12 +00:00
Greg Clayton bb011f73f5 Show the size of what we are dematerializing in the output log for "lldb expr".
llvm-svn: 164327
2012-09-20 23:07:44 +00:00
Greg Clayton 0c9773c6d5 Compile shared libraries with dSYM files when requested on darwin. Prior to this, we never had dSYM files for shared libraries unless it was a dylib only Makefile.
llvm-svn: 164322
2012-09-20 21:43:11 +00:00
Greg Clayton 48e0c2c82d <rdar://problem/12315386>
Test suite to catch fragile base class ivar issues.

llvm-svn: 164321
2012-09-20 21:38:45 +00:00
Sean Callanan d0dcae08e5 More work for reading the Objective-C runtime.
We can now read the relevant data structures for
the method list, and use a callback mechanism to
report their details to the AppleObjCTypeVendor,
which constructs appropriate Clang types.

llvm-svn: 164310
2012-09-20 17:01:52 +00:00
Jason Molenda 944cc67eba Bump to lldb-168, debugserver-193.
llvm-svn: 164291
2012-09-20 06:42:30 +00:00
Jason Molenda 5c4210be8e Update the LLDB_DISABLE_PYTHON ifdef in FormatManager::LoadObjCFormatters to
get FormatManager.cpp to build on no-python platforms again.

llvm-svn: 164284
2012-09-20 06:06:59 +00:00
Greg Clayton 9e6cffc9fd A patch that allows for mach-o architectures to be specified as "<number>-<number>" where the first number is the cpu type and the second is the cpu subtype. Also added code to allow use of mach-o architectures that aren't in our tables so that symbolication and static file introspection (crashlogs) can work with them.
llvm-svn: 164258
2012-09-19 22:25:17 +00:00
Greg Clayton a150de05f3 Don't get everything when resolving the symbol context of the ObjC Class symbol, just the module + symbol.
llvm-svn: 164257
2012-09-19 22:23:30 +00:00
Sean Callanan 39def1f7c0 Fix to the project file, to prevent it from using
an out-of-date compiler in certain cases.

llvm-svn: 164255
2012-09-19 22:10:40 +00:00
Filipe Cabecinhas 3e6ff11220 Fix some type-related swig bugs on FreeBSD on x86_64 (and maybe other OS/arch).
llvm-svn: 164227
2012-09-19 15:22:05 +00:00
Sean Callanan 43dd07ec3e Updated AppleObjCV2Runtime to load the class
data structures more rapidly.  Also added fields
for the other data structures in a class.

I also fixed a problem where I accidentally used
hasExternalLexicalStorage() instead of
hasExternalVisibleStorage() to mark an
incomplete object.

llvm-svn: 164197
2012-09-19 03:23:13 +00:00
Greg Clayton aa4d45314c Added auto LLDB import to the crashlog script.
llvm-svn: 164192
2012-09-19 01:59:34 +00:00
Greg Clayton 9944cd7f7a <rdar://problem/11752499>
Improve error messages when memory read/write fails.

llvm-svn: 164188
2012-09-19 01:46:31 +00:00
Greg Clayton 6f4d8af713 <rdar://problem/12125274>
Intentionally leak the module list to avoid unnecessary freeing of modules + object files + symbol files when the program is exiting.

llvm-svn: 164184
2012-09-18 23:50:22 +00:00
Jason Molenda dfa424c593 Allow for numeric cputype-cpusubtype specifications where the subtype is 0. Use errno to
detect strtoul parse failure instead of return value of 0.  <rdar://problem/12198994>

llvm-svn: 164183
2012-09-18 23:27:18 +00:00
Enrico Granata fac939e918 <rdar://problem/12188843> Fixing a problem where a Python command created in the same module where the target function is defined causes the help string not to come out
llvm-svn: 164172
2012-09-18 21:53:02 +00:00
Sean Callanan 27c658bd18 Objective-C runtime class descriptors can now
populate Clang ObjCInterfaceDecls with their
ivars, methods, and properties.  The default
implementation does nothing.  I have also made
sure that AppleObjCRuntimeV2 creates 
ObjCInterfaceDecls that actually get queried
appropriately.

llvm-svn: 164164
2012-09-18 20:36:30 +00:00
Enrico Granata 5d31103974 <rdar://problem/11398693> Making sure we do not attempt to run code on zombie objects when attempting to format them
llvm-svn: 164156
2012-09-18 18:34:14 +00:00
Greg Clayton 813ddfcdd0 <rdar://problem/12219840>
Don't leak mach ports when calling "mach_thread_self()".

llvm-svn: 164152
2012-09-18 18:19:49 +00:00
Enrico Granata 63d2a23618 Fix a potential issue where data formatters can get confused over malformed UUIDs
llvm-svn: 164151
2012-09-18 18:15:27 +00:00
Enrico Granata 69277bac23 <rdar://problem/12161825> Rephrase formatter for NSIndexSet in terms of indexes instead of objects
llvm-svn: 164149
2012-09-18 18:06:37 +00:00
Greg Clayton 43e0af06b4 Stop using the "%z" size_t modifier and cast all size_t values to uint64_t. Some platforms don't support this modification.
llvm-svn: 164148
2012-09-18 18:04:04 +00:00
Enrico Granata 97fca507f4 <rdar://problem/11988289> Making C++ synthetic children provider for NSDictionary and related classes
llvm-svn: 164144
2012-09-18 17:43:16 +00:00
Enrico Granata dfc88a0338 Making ClangExpression hold on to a WP to the Process instead of a SP. This fix should enable us to have per-process maps of ClangExpressions without fear of keeping the process alive forever
llvm-svn: 164082
2012-09-18 00:08:47 +00:00
Jim Ingham a1b536a231 Remove a spurious control character coming from trying to save files in Xcode with emacs' ^x^s.
llvm-svn: 164081
2012-09-18 00:00:25 +00:00
Enrico Granata ee23ae264b Make the Class Descriptors able to fetch the class name for unrealized classes
llvm-svn: 164050
2012-09-17 19:51:33 +00:00
Sean Callanan 9b44493304 Re-applied Enrico's patch that I so rudely
stomped on.

llvm-svn: 164049
2012-09-17 19:30:47 +00:00
Enrico Granata 2e2aa6470a Stop validating the vtable_ptr since it's not actually guaranteed to be correct
llvm-svn: 164048
2012-09-17 19:26:37 +00:00
Jason Molenda 38f8bbecba Update LLDB_DISABLE_PYTHON #ifdefs in FormatManager.cpp to get it
building on no-Python systems again.

llvm-svn: 163961
2012-09-15 01:59:02 +00:00
Sean Callanan c09d9d898d More runtime work. We now successfully traverse
the dynamic and static runtime class tables to
construct our isa table.  This is putting the runtime
in contact with unrealized classes, which we need
to deal with in order to get accurate information.
That's the next piece of work.

<rdar://problem/10986023>

llvm-svn: 163957
2012-09-15 01:05:12 +00:00
Enrico Granata 01fd9804cb Fixing a potential crasher where the new C++ synthetic children can return a NULL FrontEnd and cause LLDB to crash. This patch introduces a dummy front-end which the ValueObjectSynthetic can use lacking a real FrontEnd
llvm-svn: 163946
2012-09-14 22:41:44 +00:00
Jim Ingham 6fe2dc79b7 Remove a duplicate frame_sp local that was shadowing the one we copied the incoming SBFrame into.
<rdar://problem/12304255>

llvm-svn: 163943
2012-09-14 22:16:10 +00:00
Jim Ingham 94b092461d SBThread::StepOut and SBThread::StepOutOfFrame should both run all threads.
llvm-svn: 163938
2012-09-14 21:07:14 +00:00
Jim Ingham 43d886ec90 "thread step-out" should run all threads by default.
llvm-svn: 163937
2012-09-14 21:04:15 +00:00
Jim Ingham f76ab67c55 Use the frame index passed into "thread until" rather than using the selected frame.
llvm-svn: 163936
2012-09-14 20:48:14 +00:00
Jim Ingham c02e334422 SBThread::StepOverUntil should run all threads. It is running to breakpoints, so running one thread is likely to cause the target to stall.
llvm-svn: 163924
2012-09-14 18:57:14 +00:00
Sean Callanan 903259fea2 Extended the "watchpoint set variable" code to
support watchpoints on globals.

<rdar://problem/12297238>

llvm-svn: 163913
2012-09-14 17:20:18 +00:00
Filipe Cabecinhas 3e9e081d35 Fixed some problems with SWIG bindings.
This may (but shouldn't) break Linux (but I tested and it still worked on FreeBSD).

The same shell scripts are now used on Xcode and Makefiles, for generating
the SWIG bindings.
Some compatibility fixes were applied, too (python path, bash-isms, etc).

llvm-svn: 163912
2012-09-14 17:09:15 +00:00
Filipe Cabecinhas d685840a5e Don't force libc++ and c++11 on everyone.
Make the flags part of configure and make invocations, for now.

llvm-svn: 163911
2012-09-14 17:09:06 +00:00
Greg Clayton c1b1f1ea26 <rdar://problem/11374963>
When attaching on ARM hosted debuggers we were incorrectly setting the triple to "arm-apple-ios". This was happening because in the post attach code, we would lookup the process info through the platform, and if successful, we would get the architecture of the process. This code uses sysctl() calls, but we can only get the CPU type, not the subtype, so we would get ARM for CPU type and nothing for the cpu subtype, so this would map to "arm-apple-ios". I fixed the code to get the cpu subtype from "hw.cpusubtype" which is what we really want for ARM, and not the architecture is already correct. "add-dsym" then works like a charm. I also improved the command output when the architecture changes to show the entire triple instead of just the arch name.

llvm-svn: 163868
2012-09-14 02:41:36 +00:00
Jim Ingham cb640dd8a0 Make the unwinding of the stack part of "thread return" work, and add the thread return command.
llvm-svn: 163867
2012-09-14 02:14:15 +00:00
Sean Callanan 5527442d11 Updated the demangler to take the fix for a crasher.
<rdar://problem/12293231>

llvm-svn: 163864
2012-09-14 00:52:49 +00:00
Sean Callanan a199e82cb9 Fixed the #defines for YES and NO, and centralized
them in one place rather than having them replicated
across all the potential function wrappers.

<rdar://problem/12293880>

llvm-svn: 163857
2012-09-13 23:35:30 +00:00
Enrico Granata 058049cdea Fixing a typo
llvm-svn: 163852
2012-09-13 23:06:00 +00:00
Greg Clayton a12993c930 Fixed an error with a static enum definition where it wasn't NULL terminate and could crash.
llvm-svn: 163851
2012-09-13 23:03:20 +00:00
Sean Callanan cd8b7cd0df Made the help for the -n option on
"target image lookup" a bit better
documented by indicating that it takes
symbols OR functions.

<rdar://problem/12281325>

llvm-svn: 163839
2012-09-13 21:11:40 +00:00
Enrico Granata 147a1fe15f Making sure to create the count attribute in synthetic children providers for libcxx at the right time
llvm-svn: 163823
2012-09-13 18:47:25 +00:00
Enrico Granata b2698cdf59 <rdar://problem/11086338> Implementing support for synthetic children generated by running C++ code instead of Python scripts ; Adding a bunch of value-generating APIs to our private code layer ; Providing synthetic children for NSArray
llvm-svn: 163818
2012-09-13 18:27:09 +00:00
Filipe Cabecinhas d40ca2f581 Make lldb play nicer with C++11 and fix a (maybe impossible to come by) bug.
llvm-svn: 163800
2012-09-13 14:46:00 +00:00
Greg Clayton f453907a6d Modified the command template to include best practices.
llvm-svn: 163773
2012-09-13 05:35:34 +00:00
Enrico Granata f5ba52dc80 Fixing a potential crasher related to running regular expressions against a NULL pointer
llvm-svn: 163742
2012-09-12 21:40:49 +00:00
Filipe Cabecinhas 2e098efd4d Patches to make our llvm revision more C++11 friendly.
llvm-svn: 163725
2012-09-12 17:06:07 +00:00
Filipe Cabecinhas 7d4c68a6ae Make TestAddDsymCommand not fail since bundles were accepted as add-dsym arguments.
llvm-svn: 163712
2012-09-12 14:43:45 +00:00
Greg Clayton 103f02820d <rdar://problem/11374963>
Partial fix for the above radar where we now resolve dsym mach-o files within the dSYM bundle when using "add-dsym" through the platform.

llvm-svn: 163676
2012-09-12 02:03:59 +00:00
Greg Clayton a3606adf90 Don't allow an extra entry to slip into the heap results and also add a better output format
llvm-svn: 163675
2012-09-12 02:02:32 +00:00
Greg Clayton b28179bb80 Added some documentation and an accessor for the target with an explanation of why to not use "lldb.target".
llvm-svn: 163671
2012-09-12 00:47:53 +00:00
Jim Ingham 4413758c89 Start at getting "thread return" working. Doesn't work yet.
llvm-svn: 163670
2012-09-12 00:40:39 +00:00
Jim Ingham 02430574d5 Add "info func" to the list.
llvm-svn: 163669
2012-09-12 00:38:19 +00:00
Sean Callanan 2aaba00a6b Updated the project file to reflect the added
and deleted classes.

llvm-svn: 163652
2012-09-11 21:50:14 +00:00
Sean Callanan bc47dfcba2 This patch is part of ongoing work to extract type
information from the Objective-C runtime.

This patch takes the old AppleObjCSymbolVendor and
replaces it with an AppleObjCTypeVendor, which is
much more lightweight.  Specifically, the SymbolVendor
needs to pretend that there is a backing symbol file
for the Types it vends, whereas a TypeVendor only
vends bare ClangASTTypes.  These ClangASTTypes only
need to exist in an ASTContext.

The ClangASTSource now falls back to the runtime's
TypeVendor (if one exists) if the debug information
doesn't find a complete type for a particular
Objective-C interface.  The runtime's TypeVendor
maintains an ASTContext full of types it knows about,
and re-uses the ISA-based type query information used
by the ValueObjects.

Currently, the runtime's TypeVendor doesn't provide
useful answers because we haven't yet implemented a
way to iterate across all ISAs contained in the target
process's runtime.  That's the next step.

llvm-svn: 163651
2012-09-11 21:44:01 +00:00
Filipe Cabecinhas d0b87d81a1 Some more typing-related fixes.
llvm-svn: 163641
2012-09-11 18:11:16 +00:00
Filipe Cabecinhas dd39395f83 Make size_t known before including cxxabi.h (FreeBSD fix)
llvm-svn: 163640
2012-09-11 18:11:12 +00:00
Filipe Cabecinhas ae78ce43c9 Use c++11 and libc++ and it's headers, instead of gnu's libstdcpp
Unbreaks the build on FreeBSD

People that are using Linux: if you have any problems with this patch
please let me know, and tell us how you are compiling lldb with the
makefiles.

llvm-svn: 163639
2012-09-11 18:11:09 +00:00
Filipe Cabecinhas b4cb0be3b7 Some more typing-related fixes.
llvm-svn: 163638
2012-09-11 18:11:07 +00:00
Greg Clayton 4b963415c2 Added "heap" command to get info on all allocations on the heap. Currently only objective C objects are supported since they are easy to detect.
llvm-svn: 163637
2012-09-11 18:10:27 +00:00
Filipe Cabecinhas bc6e85cb53 Change the NULL to a 0 since we need a uint32_t
llvm-svn: 163625
2012-09-11 16:09:27 +00:00
Jason Molenda 521d32dd96 Remove LLDB_DISABLE_PYTHON ifndef around FormatManager::LoadObjCFormatters() prototype,
it is unconditionally present now.

ObjectContainerBSDArchive::CreateInstance %z8.8x is not a valid printf arg specifier, %8.8zx would work
for size_t arg but this arg is addr_t.  use %8.8llx and cast up to uint64_t.

ObjectFile::FindPlugin ditto.

DynamicRegisterInfo::SetRegisterInfo ifdef this function out if LLDB_DISABLE_PYTHON.

llvm-svn: 163599
2012-09-11 06:35:15 +00:00
Greg Clayton 85fb1b93f3 <rdar://problem/11935492>
Fixed an issue where if we call "Process::Destroy()" and the process is running, if we try to stop it and get "exited" back as the stop reason, we will still deliver the exited event.

llvm-svn: 163591
2012-09-11 02:33:37 +00:00
Greg Clayton 0e3ab7ac5b Fixed some logging messages.
llvm-svn: 163590
2012-09-11 02:28:49 +00:00
Greg Clayton a4475f22fc Print the stack size followed by the full stack info.
llvm-svn: 163589
2012-09-11 02:25:20 +00:00
Jim Ingham a39ad077c9 Initialize a variable to quite a compiler warning.
llvm-svn: 163576
2012-09-11 00:09:25 +00:00
Jim Ingham 45350374f1 Typed too fast adding lockers. Actually put them in a locker.
llvm-svn: 163575
2012-09-11 00:08:52 +00:00
Jim Ingham 927bfa3fd9 Shortcut ThreadPlanStepRange::MischiefManaged - if we have pushed new plans and they are not done, then we aren't done either.
<rdar://problem/12259124>

llvm-svn: 163572
2012-09-10 23:42:44 +00:00
Sean Callanan 3ff3199e61 Fixed a bug where the LLDB_VERSION wasn't properly
truncated during install-headers.

<rdar://problem/12268130>

llvm-svn: 163559
2012-09-10 22:43:22 +00:00
Greg Clayton 6b152ff550 Added a python example that will compute which functions in a process are hogging the stack.
llvm-svn: 163543
2012-09-10 20:55:08 +00:00
Jim Ingham 41f2b940c9 Fixed a few places where we were doing:
uint32_t size = ThreadList.GetSize();
for (i=0; i < size; ++i)

without grabbing the thread list mutex.

llvm-svn: 163541
2012-09-10 20:50:15 +00:00
Greg Clayton bded106120 Playing around with "objc_refs" over the weekend and improved it to work on a large ObjC program without running into expression timeouts. Now we get a full list of ObjC classes using a runtime function and then qsort the result. Also added code that can count all instances of each ObjC on the heap and also the total byte sizes for the object allocations.
llvm-svn: 163520
2012-09-10 17:22:45 +00:00
Sean Callanan 2201905b6c Fixed a problem where watchpoint conditions would
run code when it didn't really need to run.

<rdar://problem/12145006>

llvm-svn: 163450
2012-09-08 01:51:48 +00:00
Greg Clayton 88344b7133 Don't allocate memory when enumerting stack. We now have fixed size buffers to avoid this issue.
llvm-svn: 163441
2012-09-08 01:16:16 +00:00
Sean Callanan 6e4100ead8 Fixed a crash in the testsuite because the wrong
type was being completed.

llvm-svn: 163440
2012-09-08 00:49:45 +00:00
Jim Ingham c635500dbb Fiddle with the heuristic about where to set the stop point in a nested inline stack when we get there by breakpoint. If we hit a user breakpoint, I set the stop point to the bottom-most frame 'cause that's what we did before.
<rdar://problem/12258999> Setting breakpoint in always inline function is stopping in function above it

llvm-svn: 163439
2012-09-08 00:26:49 +00:00
Jim Ingham 3a4599f6cb A bunch of test cases for inlined stepping.
llvm-svn: 163436
2012-09-07 23:58:16 +00:00
Greg Clayton 93bfb29ada Make file + line breakpoints even more efficient by using our SearchFilter objects correctly now that we sometimes don't check for inlined breakpoints.
llvm-svn: 163435
2012-09-07 23:48:57 +00:00
Jim Ingham 625fca7c5a Save and restore the current inlined depth over function calls.
llvm-svn: 163433
2012-09-07 23:36:43 +00:00
Jim Ingham 6cd41da75d Add SetCurrentInlinedDepth API.
In GetFramesUpTo, don't adjust the number of frames for the inlined depth if the number of frames in UINT32_MAX.

llvm-svn: 163432
2012-09-07 23:35:54 +00:00
Greg Clayton ba1fad8420 Added a quick example to show how disasembly output can be customized.
llvm-svn: 163421
2012-09-07 21:18:45 +00:00
Greg Clayton 0662d966dc Train LLDB to deal with bad linker N_SO entries that point to our source files for debug map + DWARF in .o file debugging.
llvm-svn: 163417
2012-09-07 20:29:13 +00:00
Greg Clayton e2186ed6d9 Patch from Andrew Kaylor for linux:
The attached patch fixes a problem with performing an attach from the SBTarget API on Linux (and other systems that use ProcessPOSIX).
 
When Process::Attach was called from SBTarget, it resulted in a call to a form of the DoAttachWithID function that wasn't implemented in ProcessPOSIX, and so it fell back to the default implementation (which just returns an error).  It didn't seem necessary to use the attach_info parameter for this case, so I just implemented it as a call to the simpler version of the function.
 
In debugging this problem, I also found that SBTarget wasn't checking the return value from the Attach call, causing it to hang when the attach fails.

llvm-svn: 163399
2012-09-07 17:51:47 +00:00
Greg Clayton 542e407581 Patch from Andrew Kaylor for linux:
The attached patch adds support for debugging 32-bit processes when running a 64-bit lldb on an x86_64 Linux system.
 
Making this work required two basic changes:
 
1)      Getting lldb to report that it could debug 32-bit processes
2)      Changing an assumption about how ptrace works when debugging cross-platform
 
For the first change, I took a conservative approach and only enabled this for x86_64 Linux platforms.  It may be that the change I made in Host.cpp could be extended to other 64-bit Linux platforms, but I'm not familiar enough with the other platforms to know for sure.
 
For the second change, the Linux ProcessMonitor class was assuming that ptrace(PTRACE_[PEEK|POKE]DATA...) would read/write a "word" based on the child process word size.  However, the ptrace documentation says that the "word" size read or written is "determined by the OS variant."  I verified experimentally that when ptracing a 32-bit child from a 64-bit parent a 64-bit word is read or written.

llvm-svn: 163398
2012-09-07 17:49:29 +00:00
Jim Ingham f02a2e96b8 Ensure that the ShouldStopHere plans get called even when doing "virtual" steps.
llvm-svn: 163366
2012-09-07 01:11:44 +00:00
Jim Ingham 7da851a3e2 For now, treat breakpoint hits like regular stops when calculation InlinedStackDepth.
llvm-svn: 163365
2012-09-07 01:11:08 +00:00
Enrico Granata c30a73adf6 Fixing a constness issue in an otherwise trivial patch
llvm-svn: 163352
2012-09-06 22:02:28 +00:00
Enrico Granata 6b09d42335 Restoring an API as deprecated which was removed in a previous commit
llvm-svn: 163351
2012-09-06 21:58:25 +00:00
Jim Ingham 9786eeeb6f When you reach the bottom of the inlined stack, don't say you can do a virtual step.
llvm-svn: 163341
2012-09-06 19:24:57 +00:00
Jim Ingham 46ef1807fc Include a useful bit of log output in the "step" as well as the "process" logs.
llvm-svn: 163340
2012-09-06 19:24:17 +00:00
Enrico Granata 5c5ae47a8f Patch from Daniel Malea to fix the build on Linux. Thanks
llvm-svn: 163332
2012-09-06 17:10:14 +00:00
Jason Molenda 9a9422a4ff For the eEncodingIEEE754 registers in RegisterValue::SetType,
only accept the first matching type based on lldb's sizeofs.
<rdar://problem/12222109>

llvm-svn: 163285
2012-09-06 02:17:36 +00:00
Sean Callanan 4ed61b001c Disable the "pretty stack trace" signal handler,
which can conflict with accurate crash reporting
in multithreaded contexts.

llvm-svn: 163282
2012-09-06 01:39:02 +00:00
Greg Clayton 946f890b78 <rdar://problem/12237556>
Fixed an issue where we didn't parse N_SO stab pairs where the first N_SO was a relative path.

llvm-svn: 163259
2012-09-05 22:30:51 +00:00
Enrico Granata 9b034c1558 Patch for clang to include the UTF conversion routines that LLDB needs
llvm-svn: 163250
2012-09-05 21:37:27 +00:00
Greg Clayton dbc6c0bbc9 <rdar://problem/12211320>
When the vendor and OS are not specified in a triple, only let unspecified vendor and OS fields matchs for the current host platform.

llvm-svn: 163248
2012-09-05 21:19:23 +00:00
Jim Ingham e7e6ffc600 Turn on the "fancy inlined stepping."
llvm-svn: 163246
2012-09-05 21:14:28 +00:00
Jim Ingham cb95f34818 If the ThreadList ShouldStop restarts the target, don't resume it again.
llvm-svn: 163245
2012-09-05 21:13:56 +00:00
Jim Ingham bad39e47cd Move calculating the CurrentInlinedDepth to AFTER the synchronous breakpoint callback gets a chance to run.
If the stopped event comes in with the Restarted bit set, don't try to hand that to the plans, but just return ShouldStop = false.  There's nothing useful the plans can do, since the target is already running.

llvm-svn: 163244
2012-09-05 21:12:49 +00:00
Enrico Granata d4439aa9ed Implementing an Options class for EvaluateExpression() in order to make the signature more compact and make it easy to 'just run an expression'
llvm-svn: 163239
2012-09-05 20:41:26 +00:00
Greg Clayton 3f839a3cee <rdar://problem/12100588>
Don't crash when we can't resolve our stub to a symbol.

llvm-svn: 163189
2012-09-05 01:38:55 +00:00
Greg Clayton a28d2030e9 Fix the log channel used in Process.cpp.
llvm-svn: 163183
2012-09-05 00:37:58 +00:00
Enrico Granata 1364311f4d Making the right thing with regards to disabling summaries on LLDB_DISABLE_PYTHON builds
llvm-svn: 163170
2012-09-04 22:04:50 +00:00
Greg Clayton 69fd4be5fb Modified patch from Matt Kopec that fixes a process launch issue on linux where we wouldn't acquire the process run lock.
llvm-svn: 163163
2012-09-04 20:29:05 +00:00
Enrico Granata 39cf67e573 <rdar://problem/12068655> Make sure [NSDate distantPast] is formatted correctly
llvm-svn: 163162
2012-09-04 20:02:39 +00:00
Enrico Granata 7a204359dc Editing a comment to make sure people know not to blame CFString.py for CFString summary errors
llvm-svn: 163157
2012-09-04 19:18:17 +00:00
Enrico Granata f519628a10 Adding to files that were missing in the previous commit
llvm-svn: 163156
2012-09-04 18:48:21 +00:00
Enrico Granata 3467d80ba3 <rdar://problem/11485744> Implement important data formatters in C++. Have the Objective-C language runtime plugin expose class descriptors objects akin to the objc_runtime.py Pythonic implementation. Rewrite the data formatters for some core Cocoa classes in C++ instead of Python.
llvm-svn: 163155
2012-09-04 18:47:54 +00:00
Greg Clayton 5ec9645f83 Patch from Filipe Cabecinhas that uses argparse in dotest.py instead of a hand coded option. I made a few modifications:
Changed the '-A' option to also have a long option of '--arch'. This is now specified multiple times to get multiple architectures.

Old: -A i386^x86_64
New: -A i386 -A x86_64
     --arch i386 --arch x86_64
     
Changed the '-C' option to also have a long option of '--compiler'. This is now specified multiple times to get multiple compiler.

Old: -C clang^gcc
New: -C clang -C gcc
     --compiler clang --compiler gcc
llvm-svn: 163141
2012-09-04 15:42:49 +00:00
Greg Clayton dcbfd19e88 Patch from info from Daniel Malea that should fix the build on linux after fixes committed with revision 162860.
llvm-svn: 163139
2012-09-04 14:55:50 +00:00
Greg Clayton 7143f00ae9 Improved "objc_refs" a bit to be able to find all instances of a class'
superclasses on top of finding the exact class. The current attempt is still
too slow, but it lays the groundwork.

llvm-svn: 163135
2012-09-04 14:09:21 +00:00
Jim Ingham 513c6bb88c Initial check-in of "fancy" inlined stepping. Doesn't do anything useful unless you switch LLDB_FANCY_INLINED_STEPPING to true. With that
on, basic inlined stepping works, including step-over of inlined functions.  But for some as yet mysterious reason i386 debugging gets an
assert and dies immediately.  So for now its off.

llvm-svn: 163044
2012-09-01 01:02:41 +00:00
Greg Clayton 4c05410f8f Made it so changes to the prompt via "settings set prompt" get noticed by the command line.
Added the ability for OptionValueString objects to take flags. The only flag is currently for parsing escape sequences. Not the prompt string can have escape characters translate which will allow colors in the prompt.

Added functions to Args that will parse the escape sequences in a string, and also re-encode the escape sequences for display. This was looted from other parts of LLDB (the Debugger::FormatString() function).

llvm-svn: 163043
2012-09-01 00:38:36 +00:00
Greg Clayton c373ca5c74 <rdar://problem/12069589>
Fixed an issue where not all text would always be seen when running any of the functions in heap.py in Xcode. Now we put the text directly into the command result object and skip STDIO since we have issues with STDIO right now in python scripts.

Also fixed an issue with the "--stack-history" option where MallocStackLoggingNoCompact was assumed to have to be enabled... It doesn't, just MallocStackLogging.

llvm-svn: 163042
2012-09-01 00:34:35 +00:00
Jim Ingham fcb59bcfc6 Add a convenience function to get the range containing a given PC specified as load address + Target.
llvm-svn: 163038
2012-08-31 23:49:32 +00:00
Jason Molenda d204afaee8 Make the tab character in the thread frame lines optional.
llvm-svn: 163037
2012-08-31 23:27:24 +00:00
Greg Clayton 7036425c59 <rdar://problem/12202862>
Added a fix for incorrect dynamic typing. Before when asking if a C++ class could be dynamic, we would answer yes for incomplete C++ classes. This turned out to have issues where if a class was not virtual, yet had its first ivar be an instance of a virtual class, we would incorrectly say that a class was virtual and we would downcast it to be a pointer to the first ivar. We now ask the class to complete itself prior to answering the question. We need to test the effects on memory of this change prior to submission. It is the safest and best fix, but it does have a potential downside of higher memory consumption.

llvm-svn: 163014
2012-08-31 18:56:24 +00:00
Greg Clayton facebca6ba Fix indentation.
llvm-svn: 163011
2012-08-31 18:11:06 +00:00
Greg Clayton 97e44a0cc7 Added command lists that can be executed on launch, stop, crash and exit. Added code to auto import the lldb module that we can use on many stand alone modules.
llvm-svn: 162972
2012-08-31 02:55:56 +00:00
Greg Clayton c769722a16 Added an example that show correct usage of the async process event API.
llvm-svn: 162967
2012-08-31 01:11:17 +00:00
Greg Clayton 0274766be5 Added the ability to verify the LLDB API on MacOSX using a script. Usage is:
./verify_api.py --library ./LLDB.framework/LLDB --api-regex lldb --arch x86_64 /Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB

So you specify a library with the "--library" option, then you specify an API regular expression that you want to match the executables against with "--api-regex <regex>", here we specify "lldb" to catch all undefined external API functions from the binary we want to test, then we specify the architectures to check with "--arch <arch>" (this can be specified more than once), and you give one or more executables.

llvm-svn: 162941
2012-08-30 21:21:24 +00:00
Greg Clayton 0b0b512fd6 OptionValueFileSpec had an accessor to read the contents of the file and return the data. This can end up being used to get the string contents of a text file and could end up not being NULL terminated. I added accessors to get the file contents raw, or with a null terminator. Added the needed calls to make this happen in the FileSpec and File classes.
llvm-svn: 162921
2012-08-30 18:15:10 +00:00
Sean Callanan e635db4923 Fixed a potential crash in PlatformLinux if
ModuleList::GetSharedModule() returned NULL.

<rdar://problem/12182971>

llvm-svn: 162871
2012-08-29 22:34:39 +00:00
Greg Clayton 1f7460716b <rdar://problem/11757916>
Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes:
- Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file". 
- modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly
- Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was.
- modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile()

Cleaned up header includes a bit as well.

llvm-svn: 162860
2012-08-29 21:13:06 +00:00
Jason Molenda e5ad3859eb Instead of using re.split and requiring two spaces between the "regname: regvalue" pairs,
use re.findall and specify the regexp of regname: regvalue that we're interested in.
<rdar://problem/12188752> 

llvm-svn: 162806
2012-08-28 23:46:12 +00:00
Johnny Chen 1083b0dea6 rdar://problem/11374963
Fix a subtle ArchSpec::cores_match() logic issue which prevents the add-dsym command
to add a debug symbol file to one of the target's current modules.

llvm-svn: 162802
2012-08-28 22:53:40 +00:00