Commit Graph

4238 Commits

Author SHA1 Message Date
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
Enrico Granata 14b74fd153 <rdar://problem/11669154>
Make a summary format for libc++ STL containers that shows the number of items as before, but also shows the pointer value for pointer-to-container

llvm-svn: 181236
2013-05-06 18:55:52 +00:00
Enrico Granata 36aa5ae625 Converting ScanFormatDescriptor to use std::string instead of a manually managed buffer of bytes
llvm-svn: 181218
2013-05-06 17:18:22 +00:00
Jason Molenda db7d11c7a2 A few small fixes to make things like image list not
print "//mach_kernel" if you are debugging an executable
in the top level directory.

llvm-svn: 181190
2013-05-06 10:21:11 +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 fe806906d4 fix a couple of clang static analyzer warnings.
Most important was a new[] + delete mismatch in ScanFormatDescriptor()
and a couple of possible memory leaks in FileSpec::EnumerateDirectory().

llvm-svn: 181080
2013-05-04 00:39:52 +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
Enrico Granata 3880c4cebd Don’t use the resolved value to calculate the location unless the variable is in a register
This was causing a bunch of test cases to fail in python_api/process since they relied on SBValue::GetLocation()

llvm-svn: 181075
2013-05-03 23:28:47 +00:00
Greg Clayton b23b11300a Unbreak lldb/test/macosx/universal.
llvm-svn: 181074
2013-05-03 23:22:20 +00:00
Jim Ingham a8ca6e2145 Don't check the private state in DoOnRemoval, check whether THIS event caused a restart.
rdar://problem/13788593

llvm-svn: 181068
2013-05-03 23:04:37 +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
Greg Clayton aa49c83cd9 Clear up any deadlocks on Apple builds that were due to the lldb_private::Process.m_private_run_lock variable.
If someone on Linux and/or FreeBSD can try to comment out the " #if defined(__APPLE__)" that surrounds access to "m_private_run_lock" and run the test suite, that would be nice. The new location where the locking/unlocking happens is bulletproof on MacOSX, and I want to verify that it is good on linux as well.

llvm-svn: 181061
2013-05-03 22:25:56 +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
Enrico Granata 4ffff2791f Harden against potential empty nodes in the map
llvm-svn: 181045
2013-05-03 19:07:20 +00:00
Enrico Granata d03a273b96 <rdar://problem/13749871>
Improvements to the std::map data formatter to recognize when invalid memory is being explored and bail out instead of looping for a potentially very long time

llvm-svn: 181044
2013-05-03 19:04:35 +00:00
Ashok Thirumurthi d77e8aefe3 Fixed 'command script import' by eliminating the shadowing of basename.
Reviewed by: Daniel Malea

llvm-svn: 181027
2013-05-03 15:56:59 +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
Jason Molenda 90e536caf7 Remove the initialization/termination of the now-removed OperatingSystemDarwinKernel.
llvm-svn: 180994
2013-05-03 03:55:48 +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
Enrico Granata c3387333ce <rdar://problem/11742979>
SWIG is smart enough to recognize that C++ operators == and != mean __eq__ and __ne__ in Python and do the appropriate translation
But it is not smart enough to recognize that mySBObject == None should return False instead of erroring out
The %pythoncode blocks are meant to provide those extra smarts (and they play some SWIG&Python magic to find the right function to call behind the scenes with no risk of typos :-)
Lastly, SBBreakpoint provides an == but never provided a != operator - common courtesy is to provide both

llvm-svn: 180987
2013-05-03 01:29:27 +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
Enrico Granata bfa9fb134b <rdar://problem/11558812>
Allow command script import to load packages.

e.g.:
egranata$ ./lldb
(lldb) command script import lldb.macosx.crashlog
"crashlog" and "save_crashlog" command installed, use the "--help" option for detailed help
"malloc_info", "ptr_refs", "cstr_refs", and "objc_refs" commands have been installed, use the "--help" options on these commands for detailed help.
The "unwind-diagnose" command has been installed, type "help unwind-diagnose" for detailed help.
(lldb) 

./lldb
(lldb) command script import theFoo
I am happy
(lldb) fbc
àèìòù
(lldb)

egranata$ ls theFoo/
__init__.py theBar.py

egranata$ cat theFoo/__init__.py 
import lldb
import theBar

def __lldb_init_module(debugger, internal_dict):
	print "I am happy"
	debugger.HandleCommand("command script add -f theFoo.theBar.theCommand fbc")
	return None

egranata$ cat theFoo/theBar.py 
#encoding=utf-8

def theCommand(debugger, command, result, internal_dict):
	result.PutCString(u"àèìòù")
	return None

llvm-svn: 180975
2013-05-02 23:57:33 +00:00
Jim Ingham 076b7fc608 If HandleCommands is called with add_to_history set to false, turn on the m_command_source_depth so that when we forget the value for regex & alias commands it still stays off.
<rdar://problem/13795202>

llvm-svn: 180971
2013-05-02 23:15:37 +00:00
Greg Clayton 864fa8c085 <rdar://problem/13788674>
TestPlatformCommand failing on buildbot.

llvm-svn: 180963
2013-05-02 22:07:16 +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
Enrico Granata a9a50ffb02 <rdar://problem/13338477>
clang sugarcoats expressions of the sort *(int (*)[3])foo where foo is an int* saying that their type class is Paren
This checkin updates our lookup tables to properly desugar Paren into the actual type of interest

llvm-svn: 180938
2013-05-02 18:54:54 +00:00
Enrico Granata e55f77aec8 <rdar://problem/13499317>
Enabling Python commands to produce Unicode output via:

result.PutCString(u”whatever”)

llvm-svn: 180930
2013-05-02 17:29:04 +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
Sean Callanan 3fa3e65d3b Since the IR interpreter does not (currently)
support operands with vector types, it now reports
that it cannot interpret expressions that use
vector types.  They get sent to the JIT instead.

<rdar://problem/13733651>

llvm-svn: 180899
2013-05-02 00:33:44 +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 7060f8976c Return zero when we don't support the byte size. Previously is we were asked to read 3, 5, 6, or 7 byte integers, we would set the error, but still return that we read that number of bytes without populating the scalar.
llvm-svn: 180896
2013-05-01 23:41:30 +00:00
Sean Callanan 16f45ca6ba Make our eliding of artificially-generated methods
in debug information more aggressive.  Emitting
classes containing these methods causes crashes in
Clang when dealing with complex code bases.

<rdar://problem/12640887>

llvm-svn: 180895
2013-05-01 23:18:34 +00:00
Sean Callanan 7f13bd7678 Fixed Process::ReadScalarIntegerFromMemory()
to report proper errors when the size is not
correct.

<rdar://problem/13784456>

llvm-svn: 180888
2013-05-01 22:01:40 +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 7f3859538f Revert 180829 as it causes hangs in TestTypeCompletion.py on 2 Linux buildbots:
http://lab.llvm.org:8011/builders/lldb-x86_64-linux/builds/3810
http://lab.llvm.org:8011/builders/lldb-x86_64-debian-clang/builds/2754

llvm-svn: 180870
2013-05-01 19:14:30 +00:00
Daniel Malea 54e39db805 Reverting 180831 as it crashes TestDefaultConstructorForAPIObjects.py
llvm-svn: 180868
2013-05-01 19:11:56 +00:00
Jason Molenda 59d55219cf Change CommandReturnObject::AppendMessage to print an empty line if
AppendMessage("") is called.  This idiom is used in a handful of places
right now (e.g. to put space between different threads in 'bt all') but
the empty newline is being omitted instead of emitted.
<rdar://problem/13753830> 

llvm-svn: 180841
2013-05-01 08:37:52 +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