Commit Graph

1420 Commits

Author SHA1 Message Date
Greg Clayton 90ba81150e <rdar://problem/12649160>
Added the ability to debug through your process exec'ing itself to the same architecture.

llvm-svn: 169340
2012-12-05 00:16:59 +00:00
Jason Molenda 011aea45a9 Fix comment in ABIMacOSX_i386::RegisterIsCalleeSaved to say that
these are the *non-volatile* registers on Darwin/i386, not the
volatile registers.
Recognize the sp, pc, fp generic reg names as well.

llvm-svn: 169316
2012-12-04 22:08:50 +00:00
Sean Callanan 2f505a1c56 Cache the names for Objective-C classes if we know
them while making our initial run through the
Objective-C runtime's class tables.

<rdar://problem/12799087>

llvm-svn: 169299
2012-12-04 20:52:38 +00:00
Daniel Malea 48947c7bbf A few more build fixes for gcc 4.6:
- use const char* instead of char* as needed in ObjC language runtime plugin
- use int to iterate through enum (operator++ on enum not defined)
- use initializer list instead of inline initialization of const field

llvm-svn: 169185
2012-12-04 00:23:45 +00:00
Jason Molenda 65d57a3d2a Don't re-add kexts and the kernel each time we get a notification
that kexts were newly added.

The Darwin userland dynamic loader provides lldb with a list of 
newly-added or newly-removed binaries but in the kernel case we
only know that something has changed.  DynamicLoaderDarwinKernel
really needs to maintain its own persistent list of kexts that 
it has been notified about (most importantly, it will not detect
kext unlods) but for now we'll at least avoid re-adding an already
present kext.

<rdar://problem/12658487>, <rdar://problem/12658487> 

llvm-svn: 169082
2012-12-01 06:13:29 +00:00
Jason Molenda dabdcc040d Read full 64 bits of kernel address when locating a
64-bit kernel in ProcessGDBRemote.
<rdar://problem/12657369>

llvm-svn: 169080
2012-12-01 04:46:58 +00:00
Daniel Malea d01b2953fa Resolve printf formatting warnings on Linux:
- use macros from inttypes.h for format strings instead of OS-specific types

Patch from Matt Kopec!

llvm-svn: 168945
2012-11-29 21:49:15 +00:00
Sean Callanan ea09a44ceb Don't return decorated (i.e., const or pointer)
versions of UnknownAnyTy for ObjectiveC value types.
<unknown type>* makes no sense and can cause the
parser to behave very oddly.

<rdar://problem/12518999>

llvm-svn: 168844
2012-11-29 00:50:56 +00:00
Greg Clayton 3e9031e83e <rdar://problem/12636970>
Properly detect the if unnamed bitfields are supported by clang if the major calng version is higher than 425.

llvm-svn: 168734
2012-11-27 22:18:23 +00:00
Greg Clayton 3d51b9f957 <rdar://problem/12106825>
Allow the expression parser to see more than just data symbols. We now accept any symbol that has an address. We take precautions to only accept symbols by their mangled or demangled names only if the demangled name was not synthesized. If the demangled name is synthesized, then we now mark symbols accordingly and only compare against the mangled original name. 

llvm-svn: 168668
2012-11-27 01:52:16 +00:00
Greg Clayton 37c36e486e <rdar://problem/12636970>
Detect the new fixed clang that properly supports bitfields in objc classes.

llvm-svn: 168655
2012-11-27 00:59:26 +00:00
Han Ming Ong 84145857b4 <rdar://problem/12723044> For 'process plugin packet send…', we just send it async by default
There is no good reason not to use async.

llvm-svn: 168606
2012-11-26 20:42:03 +00:00
Daniel Malea a35970a6f6 Fix Linux bug that leaves lldb in invalid state after expression evaluation times out.
- Handle EINVAL return code from ptrace(GETSIGINFO, ...): not an error, but 'group-stop' state on Linux
- propagate SIGSTOP to inferior in above case
- this commit resolves the failure in expression_command/timeout testcase

Thanks to Sean Callanan & Matt Kopec for helping debug this problem

llvm-svn: 168523
2012-11-23 18:09:58 +00:00
Daniel Malea 8b9e71e6ef Remove call to StopMonitor() from ProcessMonitor::Detach()
- StopMonitor() is called anyways from ProcessMonitor destructor later
- resolves hang in TestEvents.py

Patch by Matt Kopec!

llvm-svn: 168503
2012-11-22 18:21:05 +00:00
Han Ming Ong ab3b8b22a1 <rdar://problem/12720514> Sub-TLF: Provide service to profile the inferior
This allows client to query profiling states on the inferior.

llvm-svn: 168228
2012-11-17 00:21:04 +00:00
Greg Clayton d97ec1c0ce <rdar://problem/12238339>
Make sure architectures are obeyed for skinny mach files.

llvm-svn: 168205
2012-11-16 21:36:10 +00:00
Jason Molenda c78555c540 Change RegisterContextLLDB's unwind logging to report which stack frame
finally was able to restore a register, instead of just reporting the
frames that couldn't supply the reg.

llvm-svn: 168139
2012-11-16 06:15:40 +00:00
Jason Molenda aff2a269e3 A change in how we search for saved register values unintentionally
allowed volatile registers to be returned up the stack.  That leads
to unexpected/incorrect values provided to the user and we need to
avoid that.
<rdar://problem/12714247>

llvm-svn: 168123
2012-11-16 01:03:31 +00:00
Greg Clayton 824e7c0dfb <rdar://problem/12125010>
Handle universal BSD archives correctly when parsing DWARF in .o files with debug map.

llvm-svn: 168075
2012-11-15 19:37:18 +00:00
Greg Clayton fbea0f64e2 <rdar://problem/11782181>
Fixed an issue where lldb was setting breakpoints on too many methods when a partial function name with namespaces or class qualifiers was used. For example setting a breakpoint of "Foo::dealloc" was accidentally settings breakpoints on all objective C functions whose selector was "dealloc"...

llvm-svn: 168053
2012-11-15 18:05:43 +00:00
Sean Callanan e0b23b5198 In cases where the Objective-C ivar symbols are stripped out,
expressions that refer to ivars will not work because Clang
emits IR that refers to them to get the ivar offsets. 
However, it is possible to search the runtime for these values.

I have added support for reading the relevant tables to the
Objective-C runtime, and extended ClangExpressionDeclMap to
query that information if and only if it doesn't find the symbols
in the binary.

Also added a testcase.

<rdar://problem/12628122>

llvm-svn: 168018
2012-11-15 02:02:04 +00:00
Greg Clayton d091afe620 Fixed an error in the ELF parser that was comparing a bool to 4 causing 32 bit ELF relocations to get parsed incorrectly.
llvm-svn: 167773
2012-11-12 22:53:16 +00:00
Greg Clayton 65ec1032df <rdar://problem/12153915>
When uniquing classes against one another we can't depend on any or all of the artificial functions (default ctor, dtor, copy ctor, move ctor, etc) being in each definition. Now we treat those separately and handle those to the best of our ability.

llvm-svn: 167752
2012-11-12 21:27:20 +00:00
Daniel Malea d4c5be61f2 Fix libstdc++ build
- Add missing operator= definition for DelayedAddObjCClassProperty
- needed to be compatible with libstdc++ vector implementation

llvm-svn: 167747
2012-11-12 21:02:14 +00:00
Sean Callanan 467ab7b8d0 Fixed a potential crash in the Darwin platform.
llvm-svn: 167732
2012-11-12 18:00:29 +00:00
Jason Molenda e424a9b5ca Add support for libdispatch version 4 structure layout for finding
GCD queue names of threads to
ProcessGDBRemote::GetDispatchQueueNameForThread()
May need tweaking once this version is rolled out but visual
inspection looks fine.
<rdar://problem/12333100> 

llvm-svn: 167667
2012-11-10 06:54:30 +00:00
Jason Molenda b9371a6961 Don't assume that Modules have directories. They may be in-memory-only
things like our favorite "cl_kernels" and so module_directory here
can be NULL.

llvm-svn: 167666
2012-11-10 06:52:37 +00:00
Greg Clayton 644c62f28f Remove a debugging printf that was left in the code.
llvm-svn: 167637
2012-11-09 22:24:38 +00:00
Filipe Cabecinhas a4342a2bd7 Removed use of non-standard escape character '\%'
llvm-svn: 167636
2012-11-09 21:39:05 +00:00
Enrico Granata 2ffcf43a13 Adding support for loading the scripting resource as part of a framework, lacking the dSYM bundle, or if the bundle has no Pythonic resources whatsoever
Solving an issue where "command script import" would fail to pick the file indicated by the user as a result of something with the same name being in an earlier position in sys.path

llvm-svn: 167570
2012-11-08 02:44:10 +00:00
Enrico Granata 1759848be0 <rdar://problem/12586350>
This commit does three things:
(a) introduces a new notification model for adding/removing/changing modules to a ModuleList, and applies it to the Target's ModuleList, so that we make sure to always trigger the right set of actions
whenever modules come and go in a target. Certain spots in the code still need to "manually" notify the Target for several reasons, so this is a work in progress
(b) adds a new capability to the Platforms: locating a scripting resources associated to a module. A scripting resource is a Python file that can load commands, formatters, ... and any other action
of interest corresponding to the loading of a module. At the moment, this is only implemented on Mac OS X and only for files inside .dSYM bundles - the next step is going to be letting
the frameworks themselves hold their scripting resources. Implementors of platforms for other systems are free to implement "the right thing" for their own worlds
(c) hooking up items (a) and (b) so that targets auto-load the scripting resources as the corresponding modules get loaded in a target. This has a few caveats at the moment:
 - the user needs to manually add the .py file to the dSYM (soon, it will also work in the framework itself)
 - if two modules with the same name show up during the lifetime of an LLDB session, the second one won't be able to load its scripting resource, but will otherwise work just fine

llvm-svn: 167569
2012-11-08 02:22:02 +00:00
Jason Molenda c56bd08373 Fix a crasher in
DynamicLoaderDarwinKernel::OSKextLoadedKextSummary::LoadImageUsingMemoryModule
where it assumed that a kernel had been found in memory, when that may not be
the case when we're attaching to a device early in the boot process.
<rdar://problem/12638140> 

llvm-svn: 167564
2012-11-08 00:19:28 +00:00
Greg Clayton 84afacd253 <rdar://problem/12645617>
<rdar://problem/12153915>  (partial fix)

Remove an assert and place an error message instead so we don't crash when we run into a type tag that we don't recognize. We will now emit a warning so that hopefully we can get a bug report that has example code that shows what we are missing.

Also fixed a case when trying to unique one type to another where we would confuse concrete instances of methods with their definitions and end up not correctly registering the types.

llvm-svn: 167557
2012-11-07 23:09:32 +00:00
Sean Callanan 439265aba4 Logging improvements for the Objective-C runtime.
Also fixed a bug where the Objective-C runtime
would not properly report that it found a class if
(a) it had to build the ObjCInterfaceDecl for the
class and (b) logging was enabled.

<rdar://problem/12641180>

llvm-svn: 167516
2012-11-07 01:27:50 +00:00
Greg Clayton 9f078b773d Added unnamed bitfields to our bitfield test.
llvm-svn: 167473
2012-11-06 18:22:59 +00:00
Greg Clayton 6421cccff8 Make sure to check the module is valid after trying to find a shared module.
llvm-svn: 167471
2012-11-06 17:50:15 +00:00
Greg Clayton 88bc7f35b8 <rdar://problem/12582031>
Unnamed bitfields cause struct layout problems

Synthesize unnamed bitfields when required. Most compilers don't mention unnamed bitfields in the DWARF, so we need to create them to keep clang happy with the types we create from the DWARF. We currently can't do this for ObjC since the DW_AT_bit_offset value for any direct ivars of ObjC classes as the values for these attributes are bogus. A bug has been filed on Clang to fix this, and another bug has been filed on LLDB to make sure we fix the DWARF parser once the clang fix is in by looking the the DW_AT_producer in the compile unit attributes and finding the compiler version and only enabling it for newer versions of clang.

llvm-svn: 167424
2012-11-06 00:20:41 +00:00
Jason Molenda ba813dc03c Add new ArchSpec methods, IsCompatibleMatch() and IsExactMatch().
The operator== method is a synonym for IsExactMatch().  

The essential difference between these two is that IsCompatibleMatch()
will say that armv7 and armv7s are compatible and return true.
IsExactMatch() will say that armv7 and armv7s are not a match.

An armv7s cpu can run either generic armv7 binaries or armv7s binaries
(the latter being tuned for it).  When we're picking the slice of a 
universal Mach-O file to load in an armv7s Target, we need to be able to
first look for an exact cpu subtype match (armv7s == armv7s) and failing
that, looking for a slice with a compatible architecture.

Update ObjectContainerUniversalMachO::GetObjectFile to prefer an exact
match of the cpu type, falling back to a compatible match if necessary.

<rdar://problem/12593515>

llvm-svn: 167365
2012-11-04 03:20:05 +00:00
Greg Clayton 2508b9b8d3 <rdar://problem/12585314>
LLDB now provides base class offsets (virtual and non virtual) to Clang's record layout. We previously were told this wasn't necessary, but it is when pragma pack gets involved.

llvm-svn: 167262
2012-11-01 23:20:02 +00:00
Greg Clayton da2455bd45 Avoid a crash when trying to parse a line table in the DWARF parser.
llvm-svn: 167236
2012-11-01 17:28:37 +00:00
Jim Ingham 455fa5ccc6 There seems to be some odd corner case where we shut down the ProcessGDBRemote, but we haven't managed to shut down the async thread. That causes the ProcessGDBRemote::AsyncThread to crash when it wakes up. So I changed StartAsyncThread and StopAsyncThread to be callable multiple times (only the first one does anything) so that we can just shut it down unequivocally in the ProcessGDBRemote destructor.
<rdar://problem/12602981>

llvm-svn: 167197
2012-11-01 01:15:33 +00:00
Greg Clayton 4a6591da25 Patch for issue found by Carlo Kok. Fixed a type issue where an ';' was incorrectly following an if statement. There actually isn't a need for the if statement, so it was removed.
llvm-svn: 167160
2012-10-31 19:05:35 +00:00
Sean Callanan 4ac7ec7341 Fixed a crash when we couldn't create a
CXXMethodDecl but tried to manipulate it
anyway.

<rdar://problem/12601996>

llvm-svn: 167095
2012-10-31 02:01:58 +00:00
Jason Molenda e2db91b8b0 Fix the bit pattern for vst1 in EmulateInstructionARM::GetThumbOpcodeForInstruction
so it is recognized correctly.  The second patch needed for <rdar://problem/10652166>.

llvm-svn: 167094
2012-10-31 02:00:46 +00:00
Greg Clayton c280746b8c <rdar://problem/12602978>
RegisterContextKDP_i386 was not correctly writing registers due to missing "virtual" keywords. Added the virtual keywords and made the functions pure virtual to ensure subclasses can't get away without implementing these functions.

llvm-svn: 167066
2012-10-30 23:57:32 +00:00
Jim Ingham 2cffda3ff8 Change a couple of raw printf's to expression log output.
llvm-svn: 167060
2012-10-30 23:34:07 +00:00
Jim Ingham 3b1c97aa74 Patch from Matt Kopec <matt.kopec@intel.com> to handle stepping into multiply-nested inlined code.
llvm-svn: 167028
2012-10-30 17:44:49 +00:00
Greg Clayton 9cb25c412a Use the "data()" accessor on the std::vector<clang_type_t> in case it is empty.
llvm-svn: 167024
2012-10-30 17:02:18 +00:00
Greg Clayton 35a4cc5ea7 <rdar://problem/12500785>
I tracked down a leak that could happen when detaching from a process where the lldb_private::Process objects would stay around forever. This was caused by a eStateDetached event that was queued up on the lldb_private::Process private state thread listener. Since process events contain shared pointers to the process, this is dangerous if they don't get consume or cleared as having the lldb_private::Process class contain a collection of things that have a shared pointer to yourself is obviously bad. 

To fix this I modified the Process::Finalize() function to clear this list. The actual thing that was holding onto the ModuleSP and thus the static archive, was a stack frame. Since the process wasn't going away, it still had thread objects and they still had frames. I modified the Thread::Destroy() to clear the stack frames to ensure this further doesn't happen.

llvm-svn: 166964
2012-10-29 20:52:08 +00:00
Jim Ingham 629e7a9846 Fix an incorrect comment...
llvm-svn: 166959
2012-10-29 19:24:56 +00:00