Commit Graph

355 Commits

Author SHA1 Message Date
Greg Clayton 25eec2cc75 Fix to only update the offset for concrete registers (ones that don't have 'slice' or 'composite' key/value pairs).
llvm-svn: 197191
2013-12-13 00:35:21 +00:00
Hafiz Abid Qadeer 85a4daf4f6 Adjust PC after hitting breakpoint on remote target.
This commit adds an example python file that can be used with 'target-definition-file' setting for Linux gdbserver.
This file has an extra key 'breakpoint-pc-offset' that LLDB uses to determine how much to change the PC
after hitting the breakpoint.

llvm-svn: 192962
2013-10-18 10:04:33 +00:00
Greg Clayton 312bcbe8b4 <rdar://problem/14972424>
- Made the dynamic register context for the GDB remote plug-in inherit from the generic DynamicRegisterInfo to avoid code duplication
- Finished up the target definition python setting stuff.
- Added a new "slice" key/value pair that can specify that a register is part of another register:
    { 'name':'eax', 'set':0, 'bitsize':32, 'encoding':eEncodingUint, 'format':eFormatHex, 'slice': 'rax[31:0]' },
- Added a new "composite" key/value pair that can specify that a register is made up of two or more registers:
    { 'name':'d0', 'set':0, 'bitsize':64 , 'encoding':eEncodingIEEE754, 'format':eFormatFloat, 'composite': ['s1', 's0'] },
- Added a new "invalidate-regs" key/value pair for when a register is modified, it can invalidate other registers:
    { 'name':'cpsr', 'set':0, 'bitsize':32 , 'encoding':eEncodingUint, 'format':eFormatHex, 'invalidate-regs': ['r8', 'r9', 'r10', 'r11', 'r12', 'r13', 'r14', 'r15']},
    
This now completes the feature that allows a GDB remote target to completely describe itself.

llvm-svn: 192858
2013-10-17 01:10:23 +00:00
Greg Clayton ef8180a3f6 <rdar://problem/14972424>
When debugging with the GDB remote in LLDB, LLDB uses special packets to discover the
registers on the remote server. When those packets aren't supported, LLDB doesn't
know what the registers look like. This checkin implements a setting that can be used
to specify a python file that contains the registers definitions. The setting is:

(lldb) settings set plugin.process.gdb-remote.target-definition-file /path/to/module.py

Inside module there should be a function:

def get_dynamic_setting(target, setting_name):

This dynamic setting function is handed the "target" which is a SBTarget, and the 
"setting_name", which is the name of the dynamic setting to retrieve. For the GDB
remote target definition the setting name is 'gdb-server-target-definition'. The
return value is a dictionary that follows the same format as the OperatingSystem
plugins follow. I have checked in an example file that implements the x86_64 GDB
register set for people to see:

    examples/python/x86_64_target_definition.py
    
This allows LLDB to debug to any archticture that is support and allows users to
define the registers contexts when the discovery packets (qRegisterInfo, qHostInfo)
are not supported by the remote GDB server.

A few benefits of doing this in Python:
1 - The dynamic register context was already supported in the OperatingSystem plug-in
2 - Register contexts can use all of the LLDB enumerations and definitions for things
    like lldb::Format, lldb::Encoding, generic register numbers, invalid registers 
    numbers, etc.
3 - The code that generates the register context can use the program to calculate the
    register context contents (like offsets, register numbers, and more)
4 - True dynamic detection could be used where variables and types could be read from 
    the target program itself in order to determine which registers are available since
    the target is passed into the python function.
    
This is designed to be used instead of XML since it is more dynamic and code flow and
functions can be used to make the dictionary.

llvm-svn: 192646
2013-10-15 00:14:28 +00:00
Enrico Granata 64d2a2853b An example of data formatters that generate a summary for a Unicode UTF encoded string represented as a (pointer,length) pair
llvm-svn: 192206
2013-10-08 17:29:27 +00:00
Enrico Granata d589b344e3 This is an example synthetic provider for libc++ unordered (multi) maps&set
Thanks to Jared Grubb for writing it and sharing it!

llvm-svn: 189964
2013-09-04 17:48:52 +00:00
Greg Clayton 6a23d21289 Added a "sources.py" which adds a command that can print out the source files contained in one or more modules.
Added "mach_o.py" which is a mach-o parser that can dump mach-o file contents and also extract sections. It uses the "file_extract" module and the "dict_utils" module.

llvm-svn: 189959
2013-09-04 17:31:40 +00:00
Sean Callanan f09a3dbf92 Fixed a crash in objc_refs caused by improper
resolution of class_getSuperclass.

<rdar://problem/14662686>

llvm-svn: 188240
2013-08-13 00:53:33 +00:00
Jason Molenda 3f99ade67a Fix typeo in diagnose-unwind.py.
llvm-svn: 186358
2013-07-15 22:40:17 +00:00
Greg Clayton e110ad8fff Enabled the "--debug" option functionality that will SIGSTOP the current process allowing a debugger to attach.
llvm-svn: 186194
2013-07-12 20:08:00 +00:00
Greg Clayton 04bd684074 Added a memory.py module that contains a 'memfind' command which allows you to search memory for a byte pattern.
llvm-svn: 186127
2013-07-11 22:38:00 +00:00
Enrico Granata da504ff00a Tweaks to the Python reference and example command to use the preferred print style and the (finally available :-) SetError API
llvm-svn: 186122
2013-07-11 21:49:38 +00:00
Jason Molenda c95407b0d5 Add the frame content dumper function call to one more place.
llvm-svn: 185906
2013-07-09 05:36:41 +00:00
Jason Molenda 5bd4a4613c Add new information gathering to the lldb & simple backtrace methods:
print five words of memory at the beginning of the stack frame so it's
easier to track where an incorrect saved-fp or saved-pc may have come from.

llvm-svn: 185903
2013-07-09 05:08:14 +00:00
Greg Clayton 96eb9ab047 A bit more cleanup on the process_events.py to use best practices for event handling.
llvm-svn: 185089
2013-06-27 18:08:32 +00:00
Greg Clayton abc18417b6 Update the platform options help strings.
llvm-svn: 185028
2013-06-26 22:24:05 +00:00
Greg Clayton 111db4f94c Fixed the process_events.py example to be able to specify the platform and also use the debugger's listener.
llvm-svn: 185027
2013-06-26 22:23:45 +00:00
Greg Clayton 57d1c4865e Added a regex that can be specified to avoid showing contents on types that match. Also split things up a bit so this can be run as a stand alone script or in lldb.
llvm-svn: 184628
2013-06-22 01:42:49 +00:00
Jason Molenda e445f8fb4d Also report any OS python plugin in use.
llvm-svn: 184487
2013-06-20 22:05:35 +00:00
Jason Molenda 1332988f5a Print the general purpose registers for frame 0.
llvm-svn: 184483
2013-06-20 21:57:34 +00:00
Greg Clayton 694b49f0f8 Cleanup the output a bit by removing old print statements and also printing the number of types found.
llvm-svn: 184389
2013-06-20 01:23:56 +00:00
Greg Clayton d8c3d4b1e9 Implemented a types.py module that allows types to be inspected for padding.
The script was able to point out and save 40 bytes in each lldb_private::Section by being very careful where we need to have virtual destructors and also by re-ordering members.

llvm-svn: 184364
2013-06-19 21:50:28 +00:00
Jason Molenda 8359214427 A few small enhancements to the diagnose-unwind command.
Change the simple-minded stack walk to not depend on lldb to unwind
the first frame.

Collect a list of Modules and Addresses seen while backtracing (with
both methods), display the image list output for all of those modules,
plus disassemble and image show-unwind any additional frames that
the simple backtrace was able to unwind through instead of just the 
lldb unwind algorithm frames.

Remove checks for older lldb's that didn't support -a for disassemble
or specifying the assembler syntax on x86 targets.

llvm-svn: 184280
2013-06-19 04:52:55 +00:00
Greg Clayton 8ccc7f69cd Added the ability options to:
- specify the architecture
- specify the platform
- specify if only external symbols should be dumped
- specify if types in the function signatures should be canonicalized

llvm-svn: 183961
2013-06-14 00:30:23 +00:00
Greg Clayton 4c1306cccc Remove unneeded include.
llvm-svn: 183959
2013-06-13 23:56:47 +00:00
Greg Clayton 1767a73bc8 Added a new makefile setting that can be set in LLDB makefiles: USE_LIBCPP. This will enable libc++ support.
Improved the makefile "clean" to include deleting all ".d.[0-9]+" files.

Added options to the "lldb/examples/lookup" example and made it build using the LLDB_BUILD_DIR. If this is not set, it will default to "/Applications/Xcode.app/Contents/SharedFrameworks" on Darwin.

Added options to the "lldb/examples/function" example and made it build using the LLDB_BUILD_DIR.

llvm-svn: 183949
2013-06-13 21:27:14 +00:00
Greg Clayton 07a1d37b88 Added some new example code that can grab all functions from any executable, and it will print out the function name, range, return type and argument types.
This example shows someone could iterate over all functions and do something intelligent with them, like create function signatures. Then two different builds could be compared to verify the API hasn't changed.

llvm-svn: 183923
2013-06-13 18:03:11 +00:00
Jason Molenda 811d259bb1 Small changes to diagnose_unwind. Correctly provide help text.
Print the lldb version at the top of the output.

llvm-svn: 183289
2013-06-05 02:56:58 +00:00
Enrico Granata a5c0308bde Adding a diagnose-nsstring command
This should help us figure out issues with the NSString data formatter

llvm-svn: 182972
2013-05-30 23:36:47 +00:00
Enrico Granata 083fcdb414 Providing a more interesting command template for LLDB
This one actually exploits the SB API to obtain information about your inferior process

llvm-svn: 181500
2013-05-09 01:32:24 +00:00
Enrico Granata 78f05f13ad Adding some LLDB-specific logic to the tracer (in a separate tracer module) to improve the quality of the output when debugging data formatters
(more improvements are necessary before this is really legible)

llvm-svn: 181367
2013-05-07 21:42:18 +00:00
Enrico Granata c8b36f160c First iteration of a Python tracer module
This module uses Python's sys.settrace() mechanism so setup a hook that can log every significant operation
This is a first step in providing a good debugging experience of Python embedded in LLDB
This module comprises an OO infrastructure that wraps Python's tracing and inspecting mechanisms, plus a very simple logging tracer
Output from this tracer looks like:

call print_keyword_args from <module> @ 243 args are kwargs are {'first_name': 'John', 'last_name': 'Doe'}
running print_keyword_args @ 228 locals are {'kwargs': {'first_name': 'John', 'last_name': 'Doe'}}
running print_keyword_args @ 229 locals are {'key': 'first_name', 'value': 'John', 'kwargs': {'first_name': 'John', 'last_name': 'Doe'}}
first_name = John
running print_keyword_args @ 228 locals are {'key': 'first_name', 'value': 'John', 'kwargs': {'first_name': 'John', 'last_name': 'Doe'}}
running print_keyword_args @ 229 locals are {'key': 'last_name', 'value': 'Doe', 'kwargs': {'first_name': 'John', 'last_name': 'Doe'}}
last_name = Doe
running print_keyword_args @ 228 locals are {'key': 'last_name', 'value': 'Doe', 'kwargs': {'first_name': 'John', 'last_name': 'Doe'}}
return from print_keyword_args value is None locals are {'key': 'last_name', 'value': 'Doe', 'kwargs': {'first_name': 'John', 'last_name': 'Doe'}}

llvm-svn: 181343
2013-05-07 19:49:59 +00:00
Jason Molenda 64dd73e5e1 Print a backtrace line for a pc value even if we can't make an SBAddress
out of it.

llvm-svn: 180835
2013-05-01 01:26:52 +00:00
Jason Molenda 14c84cdb9c Put a try/catch block around the SBAddress setting; don't want to
terminate the command early if we happen to have an invalid load
address.

llvm-svn: 180826
2013-04-30 23:03:56 +00:00
Jason Molenda f7305a6103 Rename unwind_diagnose.py to diagnose_unwind.py. Change
finish-swig-Python-LLDB.sh to create a new lldb.diagnose subdirectory
in the LLDB framework; the first diagnostic command in this directory
is diagnose-unwind.  There may be others added in the future.

Users can load these diagnostic tools into their session with 
"script import lldb.diagnose".

llvm-svn: 180768
2013-04-30 03:03:06 +00:00
Greg Clayton 8d1d25222e Remove a print statement that was left in accidentally.
llvm-svn: 180223
2013-04-24 22:21:02 +00:00
Jason Molenda e005d78241 One line I forgot to remove.
llvm-svn: 180086
2013-04-23 09:49:03 +00:00
Jason Molenda 0f224d2cd4 Update the unwind_diagnose script to work correctly with both
lldb-179 version numberings and the new lldb-300 version numberings.
Remove the pretense that someone might run this from the command
line; this is only used from within a live lldb debug session.  Fix
the loading so it can be loaded via "script import lldb.macosx" or
the script can be loaded individually like "command script import
unwind_diagnose.py"

llvm-svn: 180085
2013-04-23 09:38:10 +00:00
Jason Molenda 535ab8601f Add a new -a / --address argument to image show-unwind to get the
unwind instructions for a function/symbol which contains that
address.

Update the unwind_diagnose.py script to use this instead of doing
image show-unwind by name to avoid cases where there are multiple
name definitions.

llvm-svn: 180079
2013-04-23 04:30:57 +00:00
Jason Molenda caae381b35 Add a new python file to help diagnose backtrace failures in the field.
It will be installed in the LLDB.framework and can be loaded with

  (lldb) script import lldb.macosx

after which a "unwind-diagnose" command will be registered.  Select
the thread which has a bad backtrace and run this command -- a lot
of information about the stack frames, and an alternate backtrace
algorithm, will be used.  The information will often be sufficient
for a remote person to figure out why the backtrace failed.
<rdar://problem/13679300> 

llvm-svn: 180077
2013-04-23 03:40:32 +00:00
Greg Clayton a16cb16a58 <rdar://problem/13477795>
crashlog.py was always subtracting 1 to point to the previous instruction when symbolicating ARM backtraces. Many times the backtraces will include bit zero set to 1 to indicate thumb, so we need to make sure we mask the address and then backup one for non frame zero frames.

llvm-svn: 178812
2013-04-04 23:36:51 +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 927fa01e8c <rdar://problem/13416800>
ptr_refs command frequently doesn't work when run in large applicaton. This was due to the default timeout of 500ms. The timeouts have now been increased and all expression evaluations have been modified.

llvm-svn: 178628
2013-04-03 07:25:30 +00:00
Greg Clayton 2d95f35748 A few more tweaks to the python perf tests. Now there is a MemoryMeasurement.
llvm-svn: 178069
2013-03-26 21:00:29 +00:00
Greg Clayton 52e6378f0f Added a python version of the performance tests. It will be good to see if the overhead of python interferes at all with our performance readings. We can try things out with this script and see how things go.
llvm-svn: 177811
2013-03-23 01:44:48 +00:00
Enrico Granata 6d37cc6501 This checkin removes the last Cocoa formatters that were implemented in Python and reimplements them in C++. The Python Cocoa formatters are not shipped as part of LLDB anymore, but still exist in the source repository for user reference. Python formatters still exist for STL classes and users can still define their own Python formatters
llvm-svn: 177366
2013-03-19 00:27:22 +00:00
Enrico Granata 6a92511a08 NS(Mutable)IndexSet formatter moves from Python to C++
llvm-svn: 177217
2013-03-16 01:18:00 +00:00
Enrico Granata 50b5ee5023 Converting more data formatters to C++ - NSBundle, CFBinaryHeap, NSMachPort and NSNotification
llvm-svn: 177213
2013-03-16 00:50:25 +00:00
Sean Callanan 60e390cbd5 Created a sample "jump" command that handles
GDB-style linespecs.  This command allows changing
the PC without manually looking up the new address.

llvm-svn: 176841
2013-03-12 00:08:40 +00:00
Enrico Granata f58cececaa Initial checkin of a new project: LLDB Performance Testing Infrastructure
This is a very basic implementation of a library that easily allows to drive LLDB.framework to write test cases for performance

This is separate from the LLDB testsuite in test/ in that:
a) this uses C++ instead of Python to avoid measures being affected by SWIG
b) this is in very early development and needs lots of tweaking before it can be considered functionally complete
c) this is not meant to test correctness but to help catch performance regressions

There is a sample application built against the library (in darwin/sketch) that uses the famous sample app Sketch as an inferior to measure certain basic parameters of LLDB's behavior.
The resulting output is a PLIST much like the following:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
	<dict>
		<key>fetch-frames</key>
		<real>0.13161715522222225</real>
	</dict>
	<dict>
		<key>file-line-bkpt</key>
		<real>0.029111678750000002</real>
	</dict>
	<dict>
		<key>fetch-modules</key>
		<real>0.00026376766666666668</real>
	</dict>
	<dict>
		<key>fetch-vars</key>
		<real>0.17820429311111111</real>
	</dict>
	<dict>
		<key>run-expr</key>
		<real>0.029676525769230768</real>
	</dict>
</array>
</plist>

Areas for improvement:
- code cleanups (I will be out of the office for a couple days this coming week, but please keep ideas coming!)
- more metrics and test cases
- better error checking

This toolkit also comprises a simple event-loop-driven controller for LLDB, similar yet much simpler to what the Driver does to implement the lldb command-line tool.

llvm-svn: 176715
2013-03-08 20:29:13 +00:00
Greg Clayton 923bedf52f Added a new module that can dump all line tables for all compile units in any modules that are specified as arguments to the "dump_module_line_tables" command.
I used this to verify that the debug map line tables were the same as previous LLDB releases prior to my change in the DWARF in .o file linking.

llvm-svn: 176610
2013-03-07 02:57:54 +00:00
Enrico Granata 6308f58254 Being explicit about how ignoring optparse's exceptions is not a best principle
llvm-svn: 176059
2013-02-25 23:01:08 +00:00
Greg Clayton fdc2515ce9 Added missing lldb module namespace.
llvm-svn: 176049
2013-02-25 21:20:59 +00:00
Greg Clayton 59c40ff3f9 <rdar://problem/13286937>
Make sure to not look in self.images when we have a symbolicator with a live process.

llvm-svn: 176040
2013-02-25 19:34:57 +00:00
Enrico Granata cd4218f5c1 Using __package__ and __name__ seems redundant - __name__ should always contain the fully qualified module name
llvm-svn: 175856
2013-02-22 02:21:10 +00:00
Jim Ingham 6c00a01526 Mark the command as failed if parsing fails.
llvm-svn: 175776
2013-02-21 18:38:46 +00:00
Enrico Granata e1fb1654c8 Quick fix for the libc++ std::map synthetic children provider
If you try to access any child > 0 without having touched child 0, LLDB won't be able to reconstruct type information from the debug info.
Previously, we would fail.
Now, we simply go fetch child 0 and then come back.

llvm-svn: 174795
2013-02-09 01:44:23 +00:00
Greg Clayton 13fbb99107 Allow the target to give out the size of the red zone for given ABIs.
A bit of cleanup in the heap module. 

llvm-svn: 174129
2013-02-01 00:47:49 +00:00
Greg Clayton e7fc9ccf2e Added the ability to search segments for data. Currently __TEXT, __LINKEDIT and __PAGEZERO are excluded.
Added many more cleanups to the output.

llvm-svn: 174045
2013-01-31 06:38:09 +00:00
Greg Clayton 85e62eca66 expressions + C++11 lambdas == cooooool!!!
C++11 lambdas that don't capture anything can be used as static callback functions!

Heavily modified this python module to be able to not require a dylib in order to traverse the heap allocations.

Re-implemented the ptr_refs, objc_refs, malloc_info and cstr_refs to use complex expressions that use lambdas to do all static callback function work.

llvm-svn: 173989
2013-01-30 22:57:34 +00:00
Enrico Granata 54f279fff6 <rdar://problem/12552374> & <rdar://problem/13100674>
The vtable pointer field is not necessarily a pointer and hence cannot be used for validation

llvm-svn: 173947
2013-01-30 17:44:16 +00:00
Greg Clayton c7bece56fa <rdar://problem/13069948>
Major fixed to allow reading files that are over 4GB. The main problems were that the DataExtractor was using 32 bit offsets as a data cursor, and since we mmap all of our object files we could run into cases where if we had a very large core file that was over 4GB, we were running into the 4GB boundary.

So I defined a new "lldb::offset_t" which should be used for all file offsets.

After making this change, I enabled warnings for data loss and for enexpected implicit conversions temporarily and found a ton of things that I fixed.

Any functions that take an index internally, should use "size_t" for any indexes and also should return "size_t" for any sizes of collections.

llvm-svn: 173463
2013-01-25 18:06:21 +00:00
Greg Clayton 746a28bb55 <rdar://problem/13011717>
Fixed a compilation error that occurs when "lldb.macosx.heap" is imported and "ptr_refs" is used.

llvm-svn: 172876
2013-01-19 00:35:24 +00:00
Greg Clayton a4d8747d0f <rdar://problem/13010007>
Added the ability for OS plug-ins to lazily populate the thread this. The python OS plug-in classes can now implement the following method:

class OperatingSystemPlugin:
  def create_thread(self, tid, context):
    # Return a dictionary for a new thread to create it on demand

This will add a new thread to the thread list if it doesn't already exist. The example code in lldb/examples/python/operating_system.py has been updated to show how this call us used.

Cleaned up the code in PythonDataObjects.cpp/h:
- renamed all classes that started with PythonData* to be Python*. 
- renamed PythonArray to PythonList. Cleaned up the code to use inheritance where
- Centralized the code that does ref counting in the PythonObject class to a single function.
- Made the "bool PythonObject::Reset(PyObject *)" function be virtual so each subclass can correctly check to ensure a PyObject is of the right type before adopting the object.
- Cleaned up all APIs and added new constructors for the Python* classes to they can all construct form:
	- PyObject *
	- const PythonObject &
	- const lldb::ScriptInterpreterObjectSP &

Cleaned up code in ScriptInterpreterPython:
- Made calling python functions safer by templatizing the production of value formats. Python specifies the value formats based on built in C types (long, long long, etc), and code often uses typedefs for uint32_t, uint64_t, etc when passing arguments down to python. We will now always produce correct value formats as the templatized code will "do the right thing" all the time.
- Fixed issues with the ScriptInterpreterPython::Locker where entering the session and leaving the session had a bunch of issues that could cause the "lldb" module globals lldb.debugger, lldb.target, lldb.process, lldb.thread, and lldb.frame to not be initialized.

llvm-svn: 172873
2013-01-18 23:41:08 +00:00
Enrico Granata e1d29e4642 Replacing reference to radar number with svn revision
llvm-svn: 172641
2013-01-16 19:41:57 +00:00
Enrico Granata b5d9d630d8 Greg created a new API on SBProcess to get an ID that is guaranteed to be unique even in situations where underlying platforms would actually duplicate or hardcode PIDs
The Python data formatters use a per-process cache that was previously keying off the PID. Moving that to be based on this new notion of unique ID.

llvm-svn: 172633
2013-01-16 18:34:23 +00:00
Greg Clayton 215dced2f6 <rdar://problem/13011717>
Fixed a compilation error where NULL was being assigned to a uint.

llvm-svn: 172566
2013-01-15 22:13:13 +00:00
Sean Callanan c51cd47549 Made crashlog.py handle cases where a parent
process's name contains spaces.  Thanks to
Justin Seyster for the patch.

<rdar://problem/13002540>

llvm-svn: 172294
2013-01-12 02:11:49 +00:00
Enrico Granata e274088db0 <rdar://problem/12239827>
Making a summary for std::wstring as provided by libstdc++ along with a relevant test case

llvm-svn: 172286
2013-01-12 01:22:57 +00:00
Greg Clayton 89f255e426 Updated documentation on the "register_data_addr" key that can be supplied in the "thread" dictionary return value for the python OS plug-ins.
llvm-svn: 171934
2013-01-09 02:05:38 +00:00
Enrico Granata 0126132e2f Tweaking a comment in the NSURL formatter for correctness - the code was doing the right thing, but the comment was highly misleading
llvm-svn: 170441
2012-12-18 19:22:05 +00:00
Enrico Granata ecbabe6d66 <rdar://problem/12848118>
Making MightHaveChildren() always return true regardless for our own data formatters
This is meant to optimize performance for common most-often-not-empty container classes

llvm-svn: 169759
2012-12-10 19:55:53 +00:00
Enrico Granata 37c3e9104c <rdar://problem/12817233>
Change the wording of NSNumber summary from absurd value to unexpected value when a tagged pointer shows up that does not match our knowledge of the internals

llvm-svn: 169751
2012-12-10 19:23:00 +00:00
Enrico Granata 4fb310e883 Replace printf with result.Printf, so that the plugin shows its output with any configuration of the LLDB I/O streams (esp. useful in graphic environments such as Xcode)
llvm-svn: 167030
2012-10-30 18:01:15 +00:00
Greg Clayton ead45e0174 Allow operating system plug-ins to specify the address for registers so we don't have to create data up front.
llvm-svn: 166701
2012-10-25 17:56:31 +00:00
Enrico Granata 7b3d205ee3 Changing the NSDate data formatter to use GetData().uint64[] instead of relying on SBValue.GetValueAsUnsigned() to reinterpret a double as a uint64_t
llvm-svn: 166610
2012-10-24 19:05:32 +00:00
Enrico Granata 91fe01753d <rdar://problem/12523238> Commit 2 of 3
Adding the new has_children (or MightHaveChildren() in C++) for the existing synthetic children providers
In a few cases, the new call is going to be much more efficient than the previous num_children > 0 check
When the optimization was marginal (e.g. std::vector<>), the choice was to use num_children in order to keep
implementation details in one function instead of duplicating code

Next step is to provide test cases

llvm-svn: 166506
2012-10-23 21:54:53 +00:00
Enrico Granata dbeb0f0e0c Proper copyright notice
llvm-svn: 166443
2012-10-22 22:03:16 +00:00
Greg Clayton c9d645d306 <rdar://problem/12491420>
Added a new setting that allows a python OS plug-in to detect threads and provide registers for memory threads. To enable this you set the setting:

settings set target.process.python-os-plugin-path lldb/examples/python/operating_system.py

Then run your program and see the extra threads. 

llvm-svn: 166244
2012-10-18 22:40:37 +00:00
Greg Clayton ae23ed336b Checking in fixes that I used to track down a leaking module. The heap module can now search the vm regions with the --vm-regions options to any of the heap functions. This is currently slow and often will time out when run on a large program since our user expression timeout is set to 500000 usec. We need to add an API to LLDB where we can specify the timeout for an expression.
llvm-svn: 165437
2012-10-08 22:39:38 +00:00
Enrico Granata e3fcd2bb53 <rdar://problem/12426557> Fixing the NSIndexSet data formatter
llvm-svn: 165341
2012-10-05 22:58:46 +00:00
Enrico Granata 21dfcd9d41 Implementing plugins that provide commands.
This checkin adds the capability for LLDB to load plugins from external dylibs that can provide new commands
It exports an SBCommand class from the public API layer, and a new SBCommandPluginInterface

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

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

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

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

llvm-svn: 164865
2012-09-28 23:57:51 +00:00
Greg Clayton 984fee5b8f Added process attach options and also use the SBLaunchInfo and SBAttachInfo.
llvm-svn: 164619
2012-09-25 18:27:12 +00:00
Greg Clayton aa4d45314c Added auto LLDB import to the crashlog script.
llvm-svn: 164192
2012-09-19 01:59:34 +00:00
Enrico Granata 5d31103974 <rdar://problem/11398693> Making sure we do not attempt to run code on zombie objects when attempting to format them
llvm-svn: 164156
2012-09-18 18:34:14 +00:00
Enrico Granata 63d2a23618 Fix a potential issue where data formatters can get confused over malformed UUIDs
llvm-svn: 164151
2012-09-18 18:15:27 +00:00
Enrico Granata 69277bac23 <rdar://problem/12161825> Rephrase formatter for NSIndexSet in terms of indexes instead of objects
llvm-svn: 164149
2012-09-18 18:06:37 +00:00
Enrico Granata 147a1fe15f Making sure to create the count attribute in synthetic children providers for libcxx at the right time
llvm-svn: 163823
2012-09-13 18:47:25 +00:00
Greg Clayton f453907a6d Modified the command template to include best practices.
llvm-svn: 163773
2012-09-13 05:35:34 +00:00
Greg Clayton a3606adf90 Don't allow an extra entry to slip into the heap results and also add a better output format
llvm-svn: 163675
2012-09-12 02:02:32 +00:00
Greg Clayton b28179bb80 Added some documentation and an accessor for the target with an explanation of why to not use "lldb.target".
llvm-svn: 163671
2012-09-12 00:47:53 +00:00
Greg Clayton 4b963415c2 Added "heap" command to get info on all allocations on the heap. Currently only objective C objects are supported since they are easy to detect.
llvm-svn: 163637
2012-09-11 18:10:27 +00:00
Greg Clayton a4475f22fc Print the stack size followed by the full stack info.
llvm-svn: 163589
2012-09-11 02:25:20 +00:00
Greg Clayton 6b152ff550 Added a python example that will compute which functions in a process are hogging the stack.
llvm-svn: 163543
2012-09-10 20:55:08 +00:00
Greg Clayton bded106120 Playing around with "objc_refs" over the weekend and improved it to work on a large ObjC program without running into expression timeouts. Now we get a full list of ObjC classes using a runtime function and then qsort the result. Also added code that can count all instances of each ObjC on the heap and also the total byte sizes for the object allocations.
llvm-svn: 163520
2012-09-10 17:22:45 +00:00
Greg Clayton 88344b7133 Don't allocate memory when enumerting stack. We now have fixed size buffers to avoid this issue.
llvm-svn: 163441
2012-09-08 01:16:16 +00:00
Greg Clayton ba1fad8420 Added a quick example to show how disasembly output can be customized.
llvm-svn: 163421
2012-09-07 21:18:45 +00:00
Enrico Granata 39cf67e573 <rdar://problem/12068655> Make sure [NSDate distantPast] is formatted correctly
llvm-svn: 163162
2012-09-04 20:02:39 +00:00
Enrico Granata 7a204359dc Editing a comment to make sure people know not to blame CFString.py for CFString summary errors
llvm-svn: 163157
2012-09-04 19:18:17 +00:00
Enrico Granata 3467d80ba3 <rdar://problem/11485744> Implement important data formatters in C++. Have the Objective-C language runtime plugin expose class descriptors objects akin to the objc_runtime.py Pythonic implementation. Rewrite the data formatters for some core Cocoa classes in C++ instead of Python.
llvm-svn: 163155
2012-09-04 18:47:54 +00:00