Commit Graph

1935 Commits

Author SHA1 Message Date
Michael Sartain 9f4517a7b0 Fix ObjectFileELF crc32 code used when no build id is present.
Differential Revision: http://llvm-reviews.chandlerc.com/D1081

llvm-svn: 185494
2013-07-03 01:52:14 +00:00
Jim Ingham a1e159a281 Workaround for infinite recursion in InitOSO->GetByteSize->GetSymbolVendor.
llvm-svn: 185491
2013-07-03 01:21:46 +00:00
Daniel Malea 6d858b220b Add SymbolVenderELF to autotools build (for Linux + FreeBSD)
- should resolve the build failures on the linux clang buildbot

llvm-svn: 185448
2013-07-02 17:36:01 +00:00
Ed Maste a02f553e50 Sync parts of FreeBSD Process plugin with Linux
* Use PseudoTerminal to fix stdio handling / passthrough to the inferior
  process.
* Add log messages equivalent to the Linux ones.
* Port changes relating to process creation / termination.

This revision contains changes equivalent to (parts of) SVN revisions
109318 142384 166055 168503 169645 177116 182809.

llvm-svn: 185442
2013-07-02 16:45:16 +00:00
Jason Molenda 54d04f3bec Change the default timeout for KDP communications to be 5 seconds.
<rdar://problem/13793059> 

llvm-svn: 185400
2013-07-02 01:29:59 +00:00
Greg Clayton 7fba2634f5 Recognize "decltype(nullptr)" as a valid DW_AT_name for DW_TAG_unspecified_type tags as meaning the C++11 null pointer type.
llvm-svn: 185382
2013-07-01 21:01:52 +00:00
Michael Sartain a7499c9830 Split symbol support for ELF and Linux.
llvm-svn: 185366
2013-07-01 19:45:50 +00:00
Sylvestre Ledru 594058394e Following the modification introduced in llvm by commit 185311
The build system is currently miss-identifying GNU/kFreeBSD as FreeBSD.
This kind of simplification is sometimes useful, but in general it's not correct. 

As GNU/kFreeBSD is an hybrid system, for kernel-related issues we want to match the
build definitions used for FreeBSD, whereas for userland-related issues we want to
match the definitions used for other systems with Glibc.

The current modification adjusts the build system so that they can be distinguished,
and explicitly adds GNU/kFreeBSD to the build checks in which it belongs.

Fixes bug #16446.

Patch by Robert Millan in the context of Debian.

llvm-svn: 185313
2013-07-01 08:21:36 +00:00
Enrico Granata c76e60b012 Adding support for extracting line table information from .o files that do not have aranges
llvm-svn: 185055
2013-06-27 01:43:09 +00:00
Matt Kopec eb7f2315f4 Remove unneeded limbo state flag.
llvm-svn: 185010
2013-06-26 18:46:08 +00:00
Ed Maste a708a36cea Match printf format specifiers and arguments
llvm-svn: 184854
2013-06-25 14:47:45 +00:00
Ed Maste d66d3ec036 Update comment after Linux->POSIX rename
llvm-svn: 184850
2013-06-25 14:29:15 +00:00
Sean Callanan 70c86e1781 Fixed the instruction emulation so that it doesn't
print to standard output as part of normal
operation.

<rdar://problem/14247606>

llvm-svn: 184797
2013-06-25 00:32:45 +00:00
Han Ming Ong 91ed6b878f <rdar://problem/14182286>
Made sure that temporary object created from HarmonizeThreadIdsForProfileData() doesn’t get passed around without creating an object first.

Reviewed by Greg

llvm-svn: 184769
2013-06-24 18:15:05 +00:00
Ed Maste 5d34af358a Sync FreeBSD files to Linux equivalents, to reduce noise in diff
- Sort functions in the same order
- Match whitespace
- Remove commetned out code
- Make filename in comments match filename

llvm-svn: 184746
2013-06-24 15:09:18 +00:00
Ed Maste 428a6784b7 Update comment to match class name
llvm-svn: 184745
2013-06-24 15:04:47 +00:00
Ed Maste 5a9a6260c6 Eliminate missing virtual destructor warning on FreeBSD
Akin to r181712 (88e529b7) of Linux/ProcessMonitor.cpp

llvm-svn: 184742
2013-06-24 14:55:03 +00:00
Ed Maste 69b76d5d65 Update for Linux->POSIX rename
Revision r147613 (2341d35) renamed this file with s/Linux/POSIX/, but
header guards and comments were not updated to match.

llvm-svn: 184741
2013-06-24 14:51:39 +00:00
Andy Gibbs 4e279ae0c8 Using offsetof to an item within an array is an extension so mark it as such to avoid compiler warnings.
llvm-svn: 184738
2013-06-24 14:05:59 +00:00
Andy Gibbs 70f94f9712 Fix some more mismatched integer types causing compiler warnings.
llvm-svn: 184737
2013-06-24 14:04:57 +00:00
Jim Ingham dee1bc98f9 Add some useful logging for tracking thread matching problems.
llvm-svn: 184619
2013-06-22 00:27:45 +00:00
Han Ming Ong 399289e931 <rdar://problem/13980489>
I added scan type to ‘qGetProfileData’ previously but forgot to update the check to be a substring search.

llvm-svn: 184588
2013-06-21 19:56:59 +00:00
Jim Ingham c575a37ac9 Don't go to the trouble of trying to figure out the implementation function for selectors sent
to nil objects, it won't work anyway.

llvm-svn: 184474
2013-06-20 21:36:52 +00:00
Greg Clayton 0fc4f31e4b Unique types a bit more using the clang type to make sure we don't get multiple copies of the same type due to the debug info having multiple types that get uniqued.
llvm-svn: 184388
2013-06-20 01:23:18 +00:00
Andy Gibbs 897f50c5ba Use LLDB_INVALID_REGNUM at Mike Sartain's suggestion
llvm-svn: 184342
2013-06-19 20:04:56 +00:00
Andy Gibbs 44f4db784b Fix two 'variable is used uninitialised' warnings. Change assert to llvm_unreachable.
llvm-svn: 184334
2013-06-19 19:05:52 +00:00
Andy Gibbs a297a97e09 Sort out a number of mismatched integer types in order to cut down the number of compiler warnings.
llvm-svn: 184333
2013-06-19 19:04:53 +00:00
Greg Clayton f02500c74c Added the ability to get a list of types from a SBModule or SBCompileUnit. Sebastien Metrot wanted this, and sent a hollowed out patch. I filled in the blanks and did the low level implementation. The new functions are:
//------------------------------------------------------------------
/// Get all types matching \a type_mask from debug info in this
/// module.
///
/// @param[in] type_mask
///     A bitfield that consists of one or more bits logically OR'ed
///     together from the lldb::TypeClass enumeration. This allows
///     you to request only structure types, or only class, struct
///     and union types. Passing in lldb::eTypeClassAny will return
///     all types found in the debug information for this module.
///
/// @return
///     A list of types in this module that match \a type_mask
//------------------------------------------------------------------
lldb::SBTypeList
SBModule::GetTypes (uint32_t type_mask)


//------------------------------------------------------------------
/// Get all types matching \a type_mask from debug info in this
/// compile unit.
///
/// @param[in] type_mask
///    A bitfield that consists of one or more bits logically OR'ed
///    together from the lldb::TypeClass enumeration. This allows
///    you to request only structure types, or only class, struct
///    and union types. Passing in lldb::eTypeClassAny will return
///    all types found in the debug information for this compile
///    unit.
///
/// @return
///    A list of types in this compile unit that match \a type_mask
//------------------------------------------------------------------
lldb::SBTypeList
SBCompileUnit::GetTypes (uint32_t type_mask = lldb::eTypeClassAny);

This lets you request types by filling out a mask that contains one or more bits from the lldb::TypeClass enumerations, so you can only get the types you really want.

llvm-svn: 184251
2013-06-18 22:51:05 +00:00
Matt Kopec 246a89562c Add assertion for when no watchpoint found in POSIX watchnotify handler.
Also, ensure x86_64 watchpoint registers are initialized before they are accessed on the POSIX side.

llvm-svn: 184246
2013-06-18 21:58:02 +00:00
Matt Kopec 362f503519 Temporarily disable checking of watchpoint hit on FreeBSD on trace message.
Patch from Ed Maste.

llvm-svn: 184241
2013-06-18 21:35:32 +00:00
Jason Molenda a721731fdd PlatformDarwinKernel was treating its file path arg as a kext bundle id -- but when the user
did a manual "target modules add", it would be a file path.  If the kext bundle lookup fails,
fall back to calling PlatformDarwin's GetSharedModule which will handle a file path correctly.
<rdar://problem/14179858> 

llvm-svn: 184237
2013-06-18 21:23:14 +00:00
Bill Wendling d63d0a8fe3 Update to new API.
llvm-svn: 184177
2013-06-18 07:50:43 +00:00
Greg Clayton 0076e71592 A collection of 3 patches to the COFF file ObjectFile parser from Virgile Bello:
3 patches, aiming to improve PE/COFF support:
- First patch fix symbol reading (invalid header size from sizeof() == 20 != 18, and various bugfixes such as invalid skipping of auxiliary symbols, 4 bytes shift from beginning, etc...).
- Second patch add image_base to section vmaddr offset so that VM addr is in image_base space.
- Third patch add support for DWARF section in PECOFF (taken from ELF counterpart), since they are generated by gcc/clang under windows.

llvm-svn: 184153
2013-06-18 00:08:58 +00:00
Michael Sartain d55eadf0be Add newer Linux AT_ defines from elf.h.
llvm-svn: 184094
2013-06-17 17:44:53 +00:00
Michael Sartain c493bd1f59 Remove extra modules.Append() as it causes dupes in the m_images array. (Used with image list, etc.)
llvm-svn: 184082
2013-06-17 15:35:42 +00:00
Michael Sartain ff5b497c1f Fix unitialized variable in AuxVector::GetEntryName() which crashed in AuxVector::DumpToLog
llvm-svn: 184023
2013-06-15 00:25:52 +00:00
Matt Kopec b96a126b5b Add output of fault address on an address related crash (ie. segfault).
llvm-svn: 183701
2013-06-10 22:14:47 +00:00
Jim Ingham 4e5c821087 Don't retry the Connect when starting up debugserver if the reason for the previous failure was
EINTR.  That means the user was trying to interrupt us, and we should just stop instead.

<rdar://problem/13184758>

llvm-svn: 183577
2013-06-07 22:09:53 +00:00
Ashok Thirumurthi a3dd4899e8 Use std::vector for the array of RegisterInfo structs that describe the register context.
- Ensures that this container is populated once for the lifetime of lldb
--- In particular, static methods can query this data even after the first RegisterContext has been destroyed.
- Uses a singleton function to avoid global constructors.

Thanks to Greg Clayton for the suggestion!

llvm-svn: 183313
2013-06-05 14:12:43 +00:00
Jason Molenda 23399d765c Change UnwindLLDB::SearchForSavedLocationForRegister so that it will allow for
the link register save location being in the link register - in which case we
should iterate down the stack, not recursively try to find the lr in the current
frame over and over.

<rdar://problem/13932954>

llvm-svn: 183282
2013-06-05 00:12:50 +00:00
Greg Clayton 76ea03ea7b Add a more clear explanation of what is missing for core files with no LC_THREAD load commands.
llvm-svn: 183253
2013-06-04 21:48:36 +00:00
Greg Clayton 9645e82ce2 Make sure a core file has thread contexts before we try and load it.
llvm-svn: 183252
2013-06-04 21:34:37 +00:00
Greg Clayton a3f14d8bf1 <rdar://problem/13941992>
Accept mach-o files with bad segments. Many core files are not created correctly and we should still be able to glean any information we can from them.

llvm-svn: 183247
2013-06-04 20:27:06 +00:00
Daniel Malea 6f0a5edb3f More minor FreeBSD fixes.
- link libexecinfo (as libc is missing backtrace())
- enable FreeBSD-specific plugins

Patch by Ed Maste!

llvm-svn: 183233
2013-06-04 15:59:01 +00:00
Matt Kopec edee182bef Fix FreeBSD build due to previous changes to ProcessMonitor::Detach.
llvm-svn: 183150
2013-06-03 19:48:53 +00:00
Jim Ingham 35579dde40 Fix a couple of error message typos.
llvm-svn: 183145
2013-06-03 19:34:01 +00:00
Matt Kopec ef14371d3f Fix various build warnings.
llvm-svn: 183140
2013-06-03 18:00:07 +00:00
Matt Kopec 6f961239ae Fix setting of watchpoints on inferior thread creation for Linux.
llvm-svn: 183139
2013-06-03 17:40:20 +00:00
Ashok Thirumurthi 880728f3eb Matched a vector new with vector delete.
Thanks to Daniel and valgrind.

llvm-svn: 183110
2013-06-03 15:53:40 +00:00
Matt Kopec 085d6cec1a Add ability to attach/detach to multi-threaded inferiors on Linux.
All running threads will be detected and stopped on attach and all threads get resumed on detach.

llvm-svn: 183049
2013-05-31 22:00:07 +00:00
Daniel Malea e376a65182 FreeBSD cmake build fixes.
- missing #include <cstdlib> in Mangled.cpp
- missing include dirs in FreeBSD CMakeLists.txt

Patch by Ed Maste!

llvm-svn: 183032
2013-05-31 19:24:53 +00:00
Greg Clayton 83793fc188 <rdar://problem/13956179>
Cleaned up the thread updating code in the OperatingSystemPython class. It doesn't need to clear the "new_thread_list" anymore as it is always empty. 

It also now assigns the "core_thread_list" to "new_thread_list" if no threads are detected through python.

llvm-svn: 182893
2013-05-29 23:31:14 +00:00
Andrew Kaylor 93132f504f Adding support for stopping all threads of multithreaded inferiors on Linux. Also adding multithreaded test cases.
llvm-svn: 182809
2013-05-28 23:04:25 +00:00
Enrico Granata 2db281e910 <rdar://problem/13863031>
Giving a timeout for the call to NSPrintForDebugger() that happens when you “po” objects

This is a temporary workaround until a more detailed solution to the general problem of canceling actions is found

llvm-svn: 182782
2013-05-28 18:02:49 +00:00
Filipe Cabecinhas f104a830d4 Update countTrailingZeros function usage to match llvm's r182667.
llvm-svn: 182683
2013-05-24 22:24:17 +00:00
Ashok Thirumurthi 780593580f Added a parameter for relocation info to keep lldb in step with llvm due to r182625,
which takes a first step towards symbolization of disassembled instructions.

llvm-svn: 182650
2013-05-24 15:55:54 +00:00
Filipe Cabecinhas 477d86d84d Adds PT_TLS and PT_GNU_EH_FRAME names to DumpELFProgramHeaders
llvm-svn: 182619
2013-05-23 23:01:14 +00:00
Michael Sartain c836ae7d36 ObjectFileELF::GetModuleSpecifications on Linux should work now.
Which means "platform process list" should work and list the architecture.
We are now parsing the elf build-id if it exists, which should allow us to load stripped symbols (looking at that next).

llvm-svn: 182610
2013-05-23 20:57:03 +00:00
Greg Clayton 62f80036be Added a new "lldb" log channel named "os" for the OperatingSystem plug-ins to use.
Added logging for the OS plug-in python objects in OperatingSystemPython so we can see the python dictionary returned from the plug-in when logging is enabled.

llvm-svn: 182530
2013-05-22 23:04:27 +00:00
Greg Clayton a1b5dd9a20 <rdar://problem/13956179>
Fixed ProcessMachCore to be able to locate the main executeable in the core file even if it doesn't start at a core file address range boundary. Prior to this we only checked the first bytes of each range in the core file for mach_kernel or dyld. Now we still do this, but if we don't find the mach_kernel or dyld anywhere, we go through all core file ranges and check every 0x1000 to see if we can find dyld or the mach_kernel.

Now that we can properly detect the mach_kernel at any address, we don't need to call "DynamicLoaderDarwinKernel::SearchForDarwinKernel(Process*)" anymore.

llvm-svn: 182513
2013-05-22 21:00:49 +00:00
Greg Clayton 8caea6db71 <rdar://problem/13455021>
Another fix to make sure that if we aren't able to extract an object file for any reason, we don't crash when trying to parse the debug map info.

llvm-svn: 182441
2013-05-22 00:10:28 +00:00
Greg Clayton 80e6c043e9 <rdar://problem/13455021>
lldb crashes with universal file containing skinny BSD archives when doing DWARF with .o file debugging.

llvm-svn: 182437
2013-05-21 23:36:34 +00:00
Greg Clayton 8cda7f0830 Added a test case that verifies that LLDB can debug across a process exec'ing itself into a new program. This currently is only enabled for Darwin since we exec from 64 bit to 32 bit and vice versa for 'x86_64' targets.
This can easily be adapted for linux and other platforms, but I didn't want to break any buildbots by assuming it will work.

llvm-svn: 182428
2013-05-21 21:55:59 +00:00
Greg Clayton 15fc2be75b <rdar://problem/13892516>
LLDB can now debug across calls to exec when the architecture changes from say i386 to x86_64 (on darwin).

llvm-svn: 182345
2013-05-21 01:00:52 +00:00
Matt Kopec 841a5488fb The Linux process plugin wasn't returning the correct linux signals. This fixes that.
Thus, this patch also negates a previous fix for handling SIGCHLD.

llvm-svn: 182166
2013-05-17 22:21:08 +00:00
Matt Kopec a360d7e7a3 ProcessMonitor improvements for Linux.
-Remove tracing of fork/vfork until we add support for tracing inferiors' children on Linux.
-Add trace exec option for ptrace so that we don't receive legacy SIGTRAP signals on execve calls.
-Add handling of SIGCHLD sent by kernel (for now, deliver the signal to the inferior).

llvm-svn: 182153
2013-05-17 19:27:47 +00:00
Michael Sartain adeab5086e Comment out ObjectFileELF::GetModuleSpecifications() function until I can debug where it's causing tests to fail.
llvm-svn: 182069
2013-05-17 02:00:55 +00:00
Greg Clayton 9e9f219a8c <rdar://problem/13893094>
Show variables that were in the debug info but optimized out. Also display a good error message when one of these variables get used in an expression.

llvm-svn: 182066
2013-05-17 00:55:28 +00:00
Michael Sartain 9f0013d867 Implement ObjectFileELF::GetModuleSpecifications(), and add PlatformLinux code to deal with unknown arch properties.
CR: Greg Clayton
llvm-svn: 182065
2013-05-17 00:20:21 +00:00
Filipe Cabecinhas 22b40f7b0b Fix ObjectFileELF to not use the file_offset twice.
llvm-svn: 182061
2013-05-16 23:29:36 +00:00
Daniel Malea 3be69dac8d Fix Linux 'platform status' command. Its output is now closer to that on Mac OS X
- resolves llvm.org/pr14806

Patch by Matthew Sorrels!

llvm-svn: 182030
2013-05-16 17:52:04 +00:00
Greg Clayton 9aae0a13bf <rdar://problem/13128331>
Fixed "target symbols add" to correctly extract all module specifications from a dSYM file that is supplied and match the symbol file to a current target module using the UUID values if they are available.

This fixes the case where you add a dSYM file (like "foo.dSYM") which is for a renamed executable (like "bar"). In our case it was "mach_kernel.dSYM" which didn't match "mach_kernel.sys". 

llvm-svn: 181916
2013-05-15 19:52:08 +00:00
Greg Clayton dacc4a953d <rdar://problem/13748253>
Combine N_GSYM stab entries with their non-stab counterpart (data symbols) to make the symbol table smaller with less duplicate named symbols.

llvm-svn: 181841
2013-05-14 22:19:37 +00:00
Matt Kopec 04e5d58c8d strncmp was checked incorrectly in the Linux symbol lookup fix.
llvm-svn: 181818
2013-05-14 19:00:41 +00:00
Jason Molenda ddf91778b1 A few more small tweaks to arm core file handling.
Most importantly, have DoReadGPR/DoReadFPU/DoReadEXC return -1
to indicate failure if they're called.  Else these could override
the Error setting for the relevant thread state -- if the core file
didn't include a floating point thread state, for instance, these
functions would clear the Error setting for that register set and 
lldb would display random bytes as those registers' contents.
<rdar://problem/13665075> 

llvm-svn: 181757
2013-05-14 04:50:47 +00:00
Jason Molenda 663d2e1803 Small change to the previous checkin, read in the fpu register context
in one large block - and be sure toget the fpscr value as well when
processing a core file.

llvm-svn: 181756
2013-05-14 03:52:22 +00:00
Jason Molenda 2e7236fa66 Fixes to read the floating point and exception registers sets out
of arm Mach-O core files.
<rdar://problem/13665075>

llvm-svn: 181755
2013-05-14 03:25:58 +00:00
Daniel Malea ca9409dd55 Fix Mac OS X build issue introduced by incorrect using statements
llvm-svn: 181739
2013-05-13 21:52:06 +00:00
Ashok Thirumurthi cdb5b61a2d Prevent convenience registers from being included in "read register" as they are derived registers.
- Also refactors TestRegisters.py because test_convenience_registers_with_process_attach now fails with an assert.

TODO: Cross-reference the skipOnLinux decorator with a bugzilla report after root-causing this issue.
llvm-svn: 181737
2013-05-13 21:45:50 +00:00
Ashok Thirumurthi 1999b6d68c Fixed expression evaluation with convenience registers.
- Also improved test coverage for passing tests to include expr/x
and a sanity check for $eax as the lower half of $rax.

llvm-svn: 181727
2013-05-13 19:56:46 +00:00
Daniel Malea 487dd5dde6 Fixed build break introduced by r181717
- added missing ConstString header
- moved "using lldb*" statements to OS-independent section

llvm-svn: 181724
2013-05-13 19:35:07 +00:00
Greg Clayton daa8cd73a4 <rdar://problem/13875830>
Unblock linux builds. The real fix for this is tracked by the above radar, but this temporary hack should fix things for now.

llvm-svn: 181717
2013-05-13 18:22:55 +00:00
Daniel Malea dd15b78fc1 Fix Linux warning about missing virtual destructor in Operation classes
llvm-svn: 181712
2013-05-13 17:32:07 +00:00
Daniel Malea e5b6468885 Unbreak cmake builds by skipping Darwin kernel plugin on non-Mac platforms
llvm-svn: 181711
2013-05-13 17:30:30 +00:00
Sylvestre Ledru 7a89d6fe8a Also pass the MCRegInfo to createMCAsmInfo. Follow the modification introduced in commit r181680 of llvm
llvm-svn: 181703
2013-05-13 13:41:13 +00:00
Sylvestre Ledru 02240c5c02 Under GNU/Linux, do not build lldbPluginDynamicLoaderDarwinKernel.a. It was breaking the build
llvm-svn: 181695
2013-05-13 10:18:51 +00:00
Sylvestre Ledru f8cec0e0e6 Add a new constructor with ConstString (and not only const char *). Hopefully fixes the build of lldb
llvm-svn: 181694
2013-05-13 09:43:11 +00:00
Jason Molenda 2e56a2545e Update ProcessKDP and ProcessMachCore to use ConstString plugin
names when specifying the DynamicLoaderDarwinKernel.

ProcessGDBRemote wasn't setting the dyld string any more; remove
the remaining code tracking the dyld plugin name altogether from
that process plugin.

llvm-svn: 181658
2013-05-11 03:09:05 +00:00
Jason Molenda 408fa33340 A couple of small fixes to make core file debugging less noisy.
Don't want about being unable to find a needed objective-c runtime
function when we're core file debugging and can't jit anything
anyway.  Don't warn when quitting a debug session on a core file,
the program state can be reconstructed by re-running lldb on the
same core file again.

llvm-svn: 181653
2013-05-11 00:52:25 +00:00
Matt Kopec a189d497f0 Use mangled and demangled names when checking for a function in a namespace and a function in an anonymous namespace, respectively.
llvm-svn: 181645
2013-05-10 22:55:24 +00:00
Greg Clayton 57abc5d6a6 <rdar://problem/13854277>
<rdar://problem/13594769>

Main changes in this patch include:
- cleanup plug-in interface and use ConstStrings for plug-in names
- Modfiied the BSD Archive plug-in to be able to pick out the correct .o file when .a files contain multiple .o files with the same name by using the timestamp
- Modified SymbolFileDWARFDebugMap to properly verify the timestamp on .o files it loads to ensure we don't load updated .o files and cause problems when debugging

The plug-in interface changes:

Modified the lldb_private::PluginInterface class that all plug-ins inherit from:

Changed:

virtual const char * GetPluginName() = 0;

To: 

virtual ConstString GetPluginName() = 0;

Removed:

virtual const char * GetShortPluginName() = 0;

- Fixed up all plug-in to adhere to the new interface and to return lldb_private::ConstString values for the plug-in names. 
- Fixed all plug-ins to return simple names with no prefixes. Some plug-ins had prefixes and most ones didn't, so now they all don't have prefixed names, just simple names like "linux", "gdb-remote", etc.

llvm-svn: 181631
2013-05-10 21:47:16 +00:00
Matt Kopec d608996610 Add temporary fix for calling c++ global/anonymous functions on Linux.
llvm-svn: 181613
2013-05-10 17:53:48 +00:00
Jason Molenda 58a6208976 Scratch that, the problem was elsewhere.
llvm-svn: 181582
2013-05-10 02:18:50 +00:00
Jason Molenda 041e367563 Temporarily roll back r181375 - it is causing an unexpected regression,
I'll revisit this and apply once I figure out how to address that.

llvm-svn: 181581
2013-05-10 02:15:22 +00:00
Jason Molenda ca2ffa7e65 Add an explicit check for a darwin kernel KDP_VERSIONSTRING when
starting a kdp communication session, instead of assuming darwin
kernel for any "non-EFI" kdp session.
<rdar://problem/13854098>

llvm-svn: 181566
2013-05-09 23:52:21 +00:00
Sean Callanan de9ce87f03 Don't completely drop methods we don't want to put
into a CXXRecordDecl on the ground; rather, put
them into the translation unit as functions.

<rdar://problem/13834404>

llvm-svn: 181560
2013-05-09 23:13:13 +00:00
Ashok Thirumurthi acbb1a5db5 Fixed "log enable linux registers" and added a test.
- Eliminated the use of static for methods that read m_register_infos, so that these routines can be implemented in the base class.
- Eliminated m_register_infos in the base class because this is not used when derived classes call UpdateRegisterInfo.
- Also moved the namespace using declarations from headers to source files.

Thanks to Daniel and Samuel for their review feedback.

llvm-svn: 181538
2013-05-09 19:59:47 +00:00
Ashok Thirumurthi a91a561571 Fixed a build failure introduced by r181501.
Patch by Yao Qi.

llvm-svn: 181511
2013-05-09 13:58:54 +00:00
Greg Clayton 6e0ff1a3cb Changed the formerly pure virtual function:
namespace lldb_private {
    class Thread
    {
        virtual lldb::StopInfoSP
        GetPrivateStopReason() = 0;
    };
}

To not be virtual. The lldb_private::Thread now handles the correct caching and will call a new pure virtual function:

namespace lldb_private {
    class Thread
    {
        virtual bool
        CalculateStopInfo() = 0;
    }
}

This function must be overridden by thead lldb_private::Thread subclass and the only thing it needs to do is to set the Thread::StopInfo() with the current stop reason and return true, or return false if there is no stop reason. The  lldb_private::Thread class will take care of calling this function only when it is required. This allows lldb_private::Thread subclasses to be a bit simpler and not all need to duplicate the cache and invalidation settings.

Also renamed:

lldb::StopInfoSP
lldb_private::Thread::GetPrivateStopReason();

To:

lldb::StopInfoSP
lldb_private::Thread::GetPrivateStopInfo();

Also cleaned up a case where the ThreadPlanStepOverBreakpoint might not re-set its breakpoint if the thread disappears (which was happening due to a bug when using the OperatingSystem plug-ins with memory threads and real threads).

llvm-svn: 181501
2013-05-09 01:55:29 +00:00
Jim Ingham 77e82d1ebd Fix the error reporting for ProcessKDP::DoDetach.
llvm-svn: 181493
2013-05-09 00:05:35 +00:00
Matt Kopec 52c8476a47 Fix assertion from previous fix for debian os watchpoints.
Also mark one of the tests as expected fail on Linux due to the debian fix.

llvm-svn: 181448
2013-05-08 16:52:34 +00:00
Matt Kopec 667f12b53d Attempt to fix failing watchpoints for debian os buildbot.
llvm-svn: 181447
2013-05-08 16:10:09 +00:00
Jim Ingham 221d51cf84 Figure out the reply to "PlanExplainsStop" once when we stop and then use the cached
value.  This fixes problems, for instance, with the StepRange plans, where they know that
they explained the stop because they were at their "run to here" breakpoint, then deleted
that breakpoint, so when they got asked again, doh!  I had done this for a couple of plans
in an ad hoc fashion, this just formalizes it.

Also add a "ResumeRequested" in Process so that the code in the completion handlers can
tell the ShouldStop logic they want to resume rather than just directly resuming.  That allows 
us to handle resuming in a more controlled fashion.

Also, SetPublicState can take a "restarted" flag, so that it doesn't drop the run lock when
the target was immediately restarted.
--This line, and those below , will be ignored--

M    test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py
M    include/lldb/Target/ThreadList.h
M    include/lldb/Target/ThreadPlanStepOut.h
M    include/lldb/Target/Thread.h
M    include/lldb/Target/ThreadPlanBase.h
M    include/lldb/Target/ThreadPlanStepThrough.h
M    include/lldb/Target/ThreadPlanStepInstruction.h
M    include/lldb/Target/ThreadPlanStepInRange.h
M    include/lldb/Target/ThreadPlanStepOverBreakpoint.h
M    include/lldb/Target/ThreadPlanStepUntil.h
M    include/lldb/Target/StopInfo.h
M    include/lldb/Target/Process.h
M    include/lldb/Target/ThreadPlanRunToAddress.h
M    include/lldb/Target/ThreadPlan.h
M    include/lldb/Target/ThreadPlanCallFunction.h
M    include/lldb/Target/ThreadPlanStepOverRange.h
M    source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h
M    source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
M    source/Target/StopInfo.cpp
M    source/Target/Process.cpp
M    source/Target/ThreadPlanRunToAddress.cpp
M    source/Target/ThreadPlan.cpp
M    source/Target/ThreadPlanCallFunction.cpp
M    source/Target/ThreadPlanStepOverRange.cpp
M    source/Target/ThreadList.cpp
M    source/Target/ThreadPlanStepOut.cpp
M    source/Target/Thread.cpp
M    source/Target/ThreadPlanBase.cpp
M    source/Target/ThreadPlanStepThrough.cpp
M    source/Target/ThreadPlanStepInstruction.cpp
M    source/Target/ThreadPlanStepInRange.cpp
M    source/Target/ThreadPlanStepOverBreakpoint.cpp
M    source/Target/ThreadPlanStepUntil.cpp
M    lldb.xcodeproj/xcshareddata/xcschemes/Run Testsuite.xcscheme

llvm-svn: 181381
2013-05-08 00:35:16 +00:00
Jason Molenda fa76156064 Add code to ReplaceDSYMSectionsWithExecutableSections() to handle the case where
a new section is added to the executable after the dSYM has been created, e.g.
the CTF segment added to mach_kernel after all other linking and processing has
been finished.
<rdar://problem/13258780> 

llvm-svn: 181375
2013-05-07 22:55:04 +00:00
Andrew Kaylor bf9b4c171a Adding support for process attach by pid on Linux.
llvm-svn: 181374
2013-05-07 22:46:38 +00:00
Matt Kopec e9ea0da82e Add watchpoint support for Linux on 64-bit host.
llvm-svn: 181341
2013-05-07 19:29:28 +00:00
Andrew Kaylor ba4e61d3f5 Reinstating r181091 and r181106 with fix for Linux regressions.
llvm-svn: 181340
2013-05-07 18:35:34 +00:00
Ashok Thirumurthi f5b92402bf Temporarily reverting r181091 and r181106 due to the vast test breakage on the Linux buildbots
while we develop a better understanding of how to manage the thread lists in a platform-independant fashion.

Reviewed by: Daniel Malea

llvm-svn: 181323
2013-05-07 15:01:34 +00:00
Jason Molenda a8ea4bae08 In ProcessKDP, if the remote connection is not EFI,
force this to be a DynamicLoaderDarwinKernel debug
session even if we didn't get back a load address
for the kernel.

llvm-svn: 181264
2013-05-06 23:02:03 +00:00
Jason Molenda 513db4d9f4 Change ProcessKDP::UpdateThreadList's call to FindThreadByProtocolID
to not let it update the thread list or else we'll infinite recurse
call back to UpdateThreadList.

llvm-svn: 181106
2013-05-04 05:51:02 +00:00
Greg Clayton 1b7746e383 After recent OperatingsSystem plug-in changes, the lldb_private::Process and lldb_private::Thread subclasses were changed and the API was not respected properly.
This checkin aims to fix this. The process now has two thread lists: a real thread list for threads that are created by the lldb_private::Process subclass, and the user visible threads. The user visible threads are the same as the real threas when no OS plug-in in used. But when an OS plug-in is used, the user thread can be a combination of real and "memory" threads. Real threads can be placed inside of memory threads so that a thread appears to be different, but is still controlled by the actual real thread. When the thread list needs updating, the lldb_private::Process class will call the: lldb_private::Process::UpdateThreadList() function with the old real thread list, and the function is expected to fill in the new real thread list with the current state of the process. After this function, the process will check if there is an OS plug-in being used, and if so, it will give the old user thread list, the new real thread list and the OS plug-in will create the new user thread list from both of these lists. If there is no OS plug-in, the real thread list is the user thread list.

These changes keep the lldb_private::Process subclasses clean and no changes are required.

llvm-svn: 181091
2013-05-04 01:38:48 +00:00
Jason Molenda c16b4af0d7 Remove the UUID::GetAsCString() method which required a buffer to save the
UUID string in; added UUID::GetAsString() which returns the uuid string in
a std::string.  Updated callers to use the new method.

llvm-svn: 181078
2013-05-03 23:56:12 +00:00
Jason Molenda 60e58967f9 Small adjustment to PlatformDarwinKernel::ExamineKextForMatchingUUID to
help performance -- if the FileSpec we're examining does not contain the
UUID we're looking for, don't bother examining the file any further.

llvm-svn: 181063
2013-05-03 22:28:10 +00:00
Ashok Thirumurthi d36712df8d Refactoring for struct UserArea:
- Decouples RegisterContext_x86_64 from UserArea.
- Restores the original definition of UserArea so that it can be used to generate offsets for use with ptrace.
- Moves UserArea to the 64-bit Linux specialization.

- Also fixes an off-by-one error for the size of m_gpr.
- Also adds a TODO comment noting the need for a mechanism to identify the correct plugin based on the target OS (and architecture).

Reviewed by: Matt Kopec and Samuel Jacob

llvm-svn: 181055
2013-05-03 20:00:17 +00:00
Ashok Thirumurthi 72b4c8dce3 Fixed the build to reflect the removal of OperatingSystem/Darwin-Kernel in r180993.
llvm-svn: 181018
2013-05-03 14:45:11 +00:00
Jason Molenda 9dbe9e630e Add a hard limit to how many frames lldb will unwind in a single
thread before UnwindLLDB::AddOneMoreFrame calls it quits.  We have
a couple of reports of unending backtraces in the field and we
haven't been able to collect any information about what kind of
backtrace is causing this.  We've found on Mac OS X that it's tricky
to get more than around 200k stack frames before a process exceeds
its stack space so we're starting with a hard limit of 300,000 frames.
<rdar://problem/13383069> 

llvm-svn: 180995
2013-05-03 04:48:41 +00:00
Greg Clayton e26dcbddda Remove unused OperatingSystem plugin.
llvm-svn: 180993
2013-05-03 03:05:52 +00:00
Jason Molenda 0faf3311fa Pass down the architecture of the module we're trying to
match when looking at kext on the local filesystem.
<rdar://problem/13785112> 

llvm-svn: 180989
2013-05-03 01:31:44 +00:00
Greg Clayton a80ea12703 <rdar://problem/13751683>
Make sure to handle all thumb variants correctly.

llvm-svn: 180984
2013-05-03 01:05:04 +00:00
Jason Molenda a4ce253819 If the Target's current architecture is incompatible with the kernel
DynamicLoaderDarwinKernel finds in memory, have DynamicLoaderDarwinKernel
re-set the Target's arch based on the kernel's cpu type / cpu subtype.

llvm-svn: 180962
2013-05-02 22:02:57 +00:00
Greg Clayton 4fea4f27e3 Clear the register context if our process is no longer alive.
llvm-svn: 180927
2013-05-02 17:16:00 +00:00
Daniel Malea 5eff59e74c Update CMakeLists with RegisterContext* files added
llvm-svn: 180920
2013-05-02 15:23:53 +00:00
Greg Clayton bca31a3d64 Correctly create the register contexts in RegisterContextThreadMemory.
llvm-svn: 180908
2013-05-02 04:15:24 +00:00
Jim Ingham acff895015 Recommitting r180831 with trivial fix - remember to return errors if you compute.
llvm-svn: 180898
2013-05-02 00:27:30 +00:00
Greg Clayton 160c9d81e0 <rdar://problem/13700260>
<rdar://problem/13723772>

Modified the lldb_private::Thread to work much better with the OperatingSystem plug-ins. Operating system plug-ins can now return have a "core" key/value pair in each thread dictionary for the OperatingSystemPython plug-ins which allows the core threads to be contained with memory threads. It also allows these memory threads to be stepped, resumed, and controlled just as if they were the actual backing threads themselves.

A few things are introduced:
- lldb_private::Thread now has a GetProtocolID() method which returns the thread protocol ID for a given thread. The protocol ID (Thread::GetProtocolID()) is usually the same as the thread id (Thread::GetID()), but it can differ when a memory thread has its own id, but is backed by an actual API thread.
- Cleaned up the Thread::WillResume() code to do the mandatory parts in Thread::ShouldResume(), and let the thread subclasses override the Thread::WillResume() which is now just a notification.
- Cleaned up ClearStackFrames() implementations so that fewer thread subclasses needed to override them
- Changed the POSIXThread class a bit since it overrode Thread::WillResume(). It is doing the wrong thing by calling "Thread::SetResumeState()" on its own, this shouldn't be done by thread subclasses, but the current code might rely on it so I left it in with a TODO comment with an explanation.

llvm-svn: 180886
2013-05-01 21:54:04 +00:00
Ashok Thirumurthi 0f3b9b819a Build fixes for FreeBSD 9.1.
- TODO: Support extended register sets on FreeBSD.

Patch by Samuel Jacob.

llvm-svn: 180879
2013-05-01 20:38:19 +00:00
Ashok Thirumurthi e4a862f794 Platform-specific specialization for the GPR register file.
- Required for platform-independant handling of general purpose registers (i.e. for core dumps).

Thanks to Samuel Jacob for this patch.

llvm-svn: 180878
2013-05-01 20:17:59 +00:00
Daniel Malea 54e39db805 Reverting 180831 as it crashes TestDefaultConstructorForAPIObjects.py
llvm-svn: 180868
2013-05-01 19:11:56 +00:00
Jim Ingham a23f73dbbc Added an option to "process detach" to keep the process stopped, if the process plugin (or in the
case of ProcessGDBRemote the stub we are talking to) know how to do that.

rdar://problem/13680832

llvm-svn: 180831
2013-04-30 23:46:08 +00:00
Jason Molenda cc6dc78046 Make the warning message about not finding the kernel binary clearer
about which kernel binary lldb is referring to.

llvm-svn: 180821
2013-04-30 22:38:28 +00:00
Greg Clayton 46c2b6e605 lldb_private::StopInfo now holds onto a ThreadWP (a std::weak_ptr<lldb_private::Thread>) in case the thread goes away while the stop info still exists.
llvm-svn: 180749
2013-04-29 23:30:46 +00:00
Greg Clayton b5ad4ec7a3 Cleanup logging to use the new "std::string FileSpec::GetPath()" function. Also added a similar function for modules:
std::string
Module::GetSpecificationDescription () const;

This returns the module as "/usr/lib/libfoo.dylib" for normal files (calls "std::string FileSpec::GetPath()" on m_file) but it also might include the object name in case the module is for a .o file in a BSD archive ("/usr/lib/libfoo.a(bar.o)"). Cleaned up necessary logging code to use it.

llvm-svn: 180717
2013-04-29 17:25:54 +00:00
Jason Molenda 92a2ddabd1 Add a final fall-back to PlatformDarwin::GetDeveloperDirectory() which
will run xcode-select --print-path to find the currently selected 
Xcode developer directory.  Mostly useful for when lldb is not being run out
of the /Applications/Xcode.app bundle so it can't locate the iOS or
kernel SDKs.

llvm-svn: 180705
2013-04-29 09:48:26 +00:00
Jason Molenda a7ae4673c7 Add a few new methods to FileSpec to make it a little easier to work
with directories, without increasing the size of the FileSpec object.
GetPath() returns a std::string of the full pathname of the file.
IsDirectory(), IsPipe(), IsRegularFile(), IsSocket(), and IsSymbolicLink()
can be used instead of getting the FileType() and comparing it to an enum.

Update PlatformDarwinKernel to use these new methods.

llvm-svn: 180704
2013-04-29 09:46:43 +00:00
Matt Kopec f92bca3b36 Build fix for systems that do not support NT_X86_XSTATE ptrace support.
Patch by Ashok Thirumurthi.

llvm-svn: 180581
2013-04-25 23:00:45 +00:00
Ashok Thirumurthi 999caf900a Adds 64-bit POSIX support for AVX
- Adds unique enums for ymm registers to the ABI and the POSIX register context.
- Reworks the register context data structures to support a union of FXSAVE and XSAVE
--- Allows the same code base to deal with the FPU independent of the availability of AVX.
- Determine if AVX is supported by attempting to read XSAVE using ptrace.
--- Support an extended register set for avx registers if available.
- Provide a mechanism to assemble/parse register halves into a single ymm buffer for use with RegisterValue.
--- Reworked Read/WriteRegister routines to read/write/parse ymm registers.

Adds tests for ymm register write with read-back, and expressions involving ymm registers.
- Tests vary depending on the availability of an avx register set.

Thanks to Daniel and Matt for their reviews.

llvm-svn: 180572
2013-04-25 20:12:45 +00:00
Filipe Cabecinhas 10a7a59871 More CMake fixes for OS X.
llvm-svn: 180243
2013-04-25 01:36:53 +00:00
Jason Molenda 8214b01da2 Fix one small whitespace alignment mistake.
llvm-svn: 180242
2013-04-25 01:33:46 +00:00
Greg Clayton f4d6de6a53 Added the ability to extract a ModuleSpecList (a new class) from an ObjectFile. This is designed to be used when you have an object file that contains one or more architectures (MacOSX universal (fat) files) and/or one or more objects (BSD archive (.a files)).
There is a new static ObjectFile function you can call:

size_t
ObjectFile::GetModuleSpecifications (const FileSpec &file,
                                     lldb::offset_t file_offset,
                                     ModuleSpecList &specs)

This will fill in "specs" which the details of all the module specs (file + arch + UUID (if there is one) + object name (for BSD archive objects eventually) + file offset to the object in question).

This helps us when a user specifies a file that contains a single architecture, and also helps us when we are given a debug symbol file (like a dSYM file on MacOSX) that contains one or more architectures and we need to be able to match it up to an existing Module that has no debug info.

llvm-svn: 180224
2013-04-24 22:29:28 +00:00
Jason Molenda c0e5b3ba1d Temporarily recognize exc_type EXC_BREAKPOINT with an exc_code of 0
(normally undefined) as indicating a breakpoint hit, in addition
to the normal (EXC_BREAKPOINT, EXC_ARM_BREAKPOINT) pair.
<rdar://problem/13730366> 

llvm-svn: 180216
2013-04-24 20:58:03 +00:00
Sean Callanan bac54a8d54 Fixed a build problem.
llvm-svn: 180212
2013-04-24 19:26:29 +00:00
Sean Callanan 7f5ac65fb9 Added support for pulling Objective-C class symbols
out of the runtime.  This allows calling static methods
on classes whose symbols have been stripped out of the
binary.

<rdar://problem/12042992>

llvm-svn: 180210
2013-04-24 19:07:29 +00:00
Enrico Granata b636be79c0 Changes to the ObjC runtime
llvm-svn: 180199
2013-04-24 17:49:08 +00:00
Greg Clayton 283b265309 <rdar://problem/13298695>
Fixed LLDB to be able to correctly parse template parameters that have no name and no type. This can be triggered by the following LLVM/Clang code:

template <typename T, typename = void>
class SmallVectorTemplateCommon : public SmallVectorBase {

The “typename = void” was emitting DWARF with an empty DW_AT_name and no DW_AT_type. We now correctly infer that no DW_AT_type means “void” and that an empty name is ok.

This means you can now call functions on things that inherit from SmallVectorTemplateCommon.

llvm-svn: 180155
2013-04-23 22:38:02 +00:00
Jason Molenda 704c4a88d8 Also look for kexts in /Library/Extensions if that directory exists.
llvm-svn: 180154
2013-04-23 22:35:28 +00:00
Ashok Thirumurthi 9ba77246ca Added 64-bit POSIX support to write floating-point vector registers.
- Includes tests that write, read and verify vector register content.
            
Reviewed by: Daniel Malea

llvm-svn: 180143
2013-04-23 20:50:34 +00:00
Ashok Thirumurthi c140c631cb Added 64-bit POSIX support to write general-purpose floating-point registers.
- Includes tests that write, verify and restore floating-point register content using SBFrame.

Reviewed by: Daniel Malea

llvm-svn: 180111
2013-04-23 14:59:02 +00:00
Daniel Malea a53cd7e6ce Update CMakeLists.txt as per new file RegisterContextDummy.cpp
llvm-svn: 180061
2013-04-22 22:42:27 +00:00
Matt Kopec 365e3359ab When parsing dwarf, add C functions to the fullname index.
This fixes function type resolution for C functions when requesting full function names.

llvm-svn: 180048
2013-04-22 21:13:22 +00:00
Enrico Granata cbd79b6c84 <rdar://problem/13590152>
Providing a dummy RegisterContext to secure against faulty Python OS plugins that do not return a valid RegisterContext
The RegisterContextDummy exports a PC with a constant 0xFFFFFFFFFFFFFFFF value

llvm-svn: 180033
2013-04-22 18:26:52 +00:00
Greg Clayton d1d06e4744 <rdar://problem/13697881>
Fixed the GDB remote with the python OS plug-in to not show core threads when they aren't desired and also to have the threads "to the right thing" when continuing.

llvm-svn: 179912
2013-04-20 00:27:58 +00:00
Greg Clayton f937fbe47e Make sure file rangle integers are large enough for very large core files.
llvm-svn: 179910
2013-04-20 00:24:34 +00:00
Greg Clayton 03da4cc294 Fixed some linux buildbot warnings.
llvm-svn: 179892
2013-04-19 21:31:16 +00:00
Jason Molenda 44edbf1310 Remove an unneeded local var, a missing return statement in kernel search code, thanks to Greg Clayton for finding these.
llvm-svn: 179822
2013-04-19 00:50:28 +00:00
Filipe Cabecinhas 24cf86f83e Split Linux-specific and OS X specific stuff. Add include_directories
Only add the -std=c++11 flag when needed, don't touch current flags.

llvm-svn: 179821
2013-04-19 00:19:04 +00:00
Greg Clayton febe8e33d7 More fallout unique_ptr changes for from http://lab.llvm.org:8011/builders/lldb-x86_64-linux/builds/3565.
llvm-svn: 179815
2013-04-18 23:25:55 +00:00
Greg Clayton 7b0992d9cd After discussing with Chris Lattner, we require C++11, so lets get rid of the macros and just use C++11.
llvm-svn: 179805
2013-04-18 22:45:39 +00:00
Greg Clayton beb02fd1ea Missed some cases when switching over to using our STD_UNIQUE_PTR macros.
llvm-svn: 179796
2013-04-18 21:01:59 +00:00
Greg Clayton e01e07b6e7 Since we use C++11, we should switch over to using std::unique_ptr when C++11 is being used. To do this, we follow what we have done for shared pointers and we define a STD_UNIQUE_PTR macro that can be used and it will "do the right thing". Due to some API differences in std::unique_ptr and due to the fact that we need to be able to compile without C++11, we can't use move semantics so some code needed to change so that it can compile with either C++.
Anyone wanting to use a unique_ptr or auto_ptr should now use the "STD_UNIQUE_PTR(TYPE)" macro.

llvm-svn: 179779
2013-04-18 18:10:51 +00:00
Daniel Malea ffeb4b605a Fix build on Linux
- add a workaround header to define uuid_t on platforms that need it
- unbreak remote debugging of mac os x apps

llvm-svn: 179710
2013-04-17 19:24:22 +00:00
Daniel Malea f41cfba510 Revert 179694 -- it breaks remote debugging of mac os x targets for some folk
- will commit a different workaround momentarily

llvm-svn: 179705
2013-04-17 18:40:42 +00:00
Daniel Malea 823638639c Fix Linux build of LLDB
- conditionally build mac-specific plugins only on mac (PluginObjectFileMachO, PluginDynamicLoaderDrawinKernel and PluginDynamicLoaderMacOSXDYLD)
- clean up warnings by ignoring deprecated declarations (auto_ptr for example)

llvm-svn: 179694
2013-04-17 17:41:55 +00:00
Jason Molenda 42b69fa89f Fix a pointer arithmetic thinko in ObjectFileMachO::GetLLDBSharedCacheUUID().
llvm-svn: 179643
2013-04-16 22:56:17 +00:00
Jason Molenda c9cb7d2462 Add warning messages for the cases where the inferior process shared cache
differs from lldb's own shared cache, and where the inferior process shared
cache does not match up with the on-disk shared cache file.

Simplify the code where lldb gets its own shared cache uuid a little bit.

llvm-svn: 179633
2013-04-16 21:42:58 +00:00
Greg Clayton ac7decab7c Remove a debug print statement that I left in.
llvm-svn: 179623
2013-04-16 20:56:13 +00:00
Greg Clayton d37d6927c5 <rdar://problem/13468295>
Show an error message when we have a corrupt mach-o file where the LC_SEGMENT or LC_SEGMENT_64 load command have file offsets or file offsets + sizes that extend beyond the end of the file.

llvm-svn: 179605
2013-04-16 16:51:19 +00:00
Jason Molenda 53756c4a89 Update the dyld_all_image_infos size definition in
DynamicLoaderMacOSXDYLD::ReadAllImageInfosStructure for
version 13 of that structure.

llvm-svn: 179584
2013-04-16 06:28:00 +00:00
Jason Molenda 0e0954c85a The dyld_all_image_infos structure, at version 13 and higher, has
a UUID for the shared cache libraries that can be used to confirm
that one process' shared cache is the same as another, or that a
process' in-memory shared cache is a match for a given on-disk
dyld_shared_cache binary file.  Use these UUIDs to catch some
uncommon problems when the shared caches are being changed for debug
purposes.
<rdar://problem/13524467>

llvm-svn: 179583
2013-04-16 06:24:42 +00:00
Jason Molenda d63d3c7d97 Fix some minor code indentation mistakes in ObjectFileMachO.
No code changes in this checkin, only whitespace.

llvm-svn: 179579
2013-04-16 00:18:44 +00:00
Greg Clayton 9594f4c818 Fixed issues with the way ELF symbols are parsed:
- Do not add symbols with no names
- Make sure that symbols from ELF symbol tables know that the byte size is correct. Previously the symbols would calculate their sizes by looking for the next symbol and take symbols that had zero size and make them have invalid sizes.
- Added the ability to dump raw ELF symbols by adding a Dump method to ELFSymbol

Also removed some unused code from lldb_private::Symtab.

llvm-svn: 179466
2013-04-13 23:17:23 +00:00
Jason Molenda 3f805312e6 Handle an edge case where we step into a function whose UnwindPlan
defines a Return Address register (e.g. lr on arm) but the RA register
hasn't been saved anywhere yet -- it is still in a live reg.
<rdar://problem/13503130> 

llvm-svn: 179431
2013-04-13 00:29:13 +00:00
Greg Clayton b3ae876174 <rdar://problem/13491977>
Made some fixes to the OperatingSystemPython class:
- If any thread dictionary contains any "core=N" key/value pairs then the threads obtained from the lldb_private::Process itself will be placed inside the ThreadMemory threads and will be used to get the information for a thread. 
- Cleaned up all the places where a thread inside a thread was causing problems

llvm-svn: 179405
2013-04-12 20:07:46 +00:00
Jason Molenda af97e3feb1 Change the default for PlatformDarwinKernel to be enabled a la
settings set platform.plugin.darwin-kernel.search-locally-for-kexts true

llvm-svn: 179348
2013-04-12 00:23:57 +00:00
Greg Clayton 39da3efdd6 Fixed the thread list so it correctly updates after the first core thread exists.
llvm-svn: 179326
2013-04-11 22:23:34 +00:00
Greg Clayton 973b6c9b00 Static variables inside classes were not being added to the RecordDecl, now they are. This gets us closer to being able to display static variables in classes.
llvm-svn: 179296
2013-04-11 16:57:51 +00:00
Sylvestre Ledru 9eb4b33f85 cmake build of lldb was complaining about missing files.
Example:
CMake Error at cmake/modules/LLVMProcessSources.cmake:89 (message):
  Found unknown source file
  /llvm-toolchain-3.3~svn179293.cmake/tools/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp

llvm-svn: 179295
2013-04-11 16:32:47 +00:00
Jason Molenda f6ce26fb02 When ObjectFileMachO::ParseSections() notices that it has a truncated file, zero out the
SectionList so we don't try to do anything with this file.  Currently we end up crashing
later in the debug session when we read past the end of the file -- this at least gets us
closer with something like ProcessMachCore printing "error: core file has no sections".
<rdar://problem/13468295>

llvm-svn: 179152
2013-04-10 05:58:57 +00:00
Sean Callanan b0640dc2b6 Don't erroneously put FunctionDecls into CXXRecordDecls
if we didn't want to put in a CXXConstructorDecl.  This
prevents malformed classes (i.e., classes with regular C
functions as members) from being generated from type
information (and fixes a crash in the test suite).

<rdar://problem/13550765>

llvm-svn: 179136
2013-04-09 23:22:08 +00:00
Jason Molenda 68f832c2ec Update PlatformDarwinKernel::GetMacDirectoriesToSearch to also try
/Volumes/KernelDebugKit (the default mount point for the Kernel Debug
Kit dmgs).

llvm-svn: 179058
2013-04-08 21:24:40 +00:00
Jason Molenda b861fe5df2 Change the default of 'platform.plugin.darwin-kernel.search-locally-for-kexts'
to 'off' for a week or so while we test the behavior in different environments.

llvm-svn: 178951
2013-04-06 05:25:38 +00:00
Greg Clayton 1c8ef47681 Added support "__attribute__((__vector_size__(B)))" and "__attribute__((ext_vector_type(N)))".
Now we can:
1 - see the return value for functions that return types that use the "ext_vector_size"
2 - dump values that use the vector attributes ("expr $ymm0")
3 - modified the DWARF parser to correctly parse GNU vector types from the DWARF by turning them into clang::Type::ExtVector types instead of just standard arrays

llvm-svn: 178924
2013-04-05 23:27:21 +00:00
Jason Molenda 3b59f5c804 Reorder the Platform plugin settings so that they're now
platform.plugin.darwin-kernel.kext-directories
platform.plugin.darwin-kernel.search-locally-for-kexts

and fix a few FileSpec handling issues for the kext-directories setting.

llvm-svn: 178920
2013-04-05 22:40:42 +00:00
Enrico Granata f15ee4e89f <rdar://problem/13563628>
Introducing a negative cache for ObjCLanguageRuntime::LookupInCompleteClassCache()
This helps speed up the (common) case of us looking for classes that are hidden deep within Cocoa internals and repeatedly failing at finding type information for them.
In order for this to work, we need to clean this cache whenever debug information is added. A new symbols loaded event is added that is triggered with add-dsym (before modules loaded would be triggered for both adding modules and adding symbols).
Interested parties can register for this event. Internally, we make sure to clean the negative cache whenever symbols are added.
Lastly, ClassDescriptor::IsTagged() has been refactored to GetTaggedPointerInfo() that also (optionally) returns info and value bits. In this way, data formatters can share tagged pointer code instead of duplicating the required arithmetic.

llvm-svn: 178897
2013-04-05 18:49:06 +00:00
Jim Ingham 0b55b438b2 Fixme comment.
llvm-svn: 178889
2013-04-05 17:39:29 +00:00
Jason Molenda 9b837a1e42 Add support for Platform plugins to have settings.
Add two initial settings for the PlatformDarwinKernel plugin,

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

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

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

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

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

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

<rdar://problem/13503583> 

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

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

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

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

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

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

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

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

llvm-svn: 178493
2013-04-01 19:48:37 +00:00
Sean Callanan 3abb976dc9 Fixed a crash if the Objective-C runtime module
wasn't loaded into the underlying process or
couldn't be found.

<rdar://problem/13533671>

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

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

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

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

llvm-svn: 178315
2013-03-28 23:42:53 +00:00