Commit Graph

3361 Commits

Author SHA1 Message Date
Greg Clayton fc6d50e120 Fixed an indentation issue that only shows up when dumping .o files that use linked addresses (DWARF in .o files with debug map).
llvm-svn: 165740
2012-10-11 20:42:53 +00:00
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
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 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
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
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
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
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
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 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 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