of the duty of having SWIG docstring features and multiline string literals
embedded within.
lldb.swig now %include .../SBTarget.i, instead of .../SBTarget.h. Will create
other interface files and transition them over.
Also update modify-python-lldb.py to better handle the trailing blank line right
before the ending '"""' Python docstring delimiter.
llvm-svn: 135355
- you can use a Python script to write a summary string for data-types, in one of
three ways:
-P option and typing the script a line at a time
-s option and passing a one-line Python script
-F option and passing the name of a Python function
these options all work for the "type summary add" command
your Python code (if provided through -P or -s) is wrapped in a function
that accepts two parameters: valobj (a ValueObject) and dict (an LLDB
internal dictionary object). if you use -F and give a function name,
you're expected to define the function on your own and with the right
prototype. your function, however defined, must return a Python string
- test case for the Python summary feature
- a few quirks:
Python summaries cannot have names, and cannot use regex as type names
both issues will be fixed ASAP
major redesign of type summary code:
- type summary working with strings and type summary working with Python code
are two classes, with a common base class SummaryFormat
- SummaryFormat classes now are able to actively format objects rather than
just aggregating data
- cleaner code to print descriptions for summaries
the public API now exports a method to easily navigate a ValueObject hierarchy
New InputReaderEZ and PriorityPointerPair classes
Several minor fixes and improvements
llvm-svn: 135238
Add logic to modify-python-lldb to correct swig's transformation of 'char **argv' and 'char **envp'
to 'char argv' and 'char envp' by morphing them into the 'list argv' and 'list envp' (as a list of
Python strings).
llvm-svn: 135114
Add a usage example of SBEvent APIs.
o SBEvent.h and SBListener.h:
Add method docstrings for SBEvent.h and SBListener.h, and example usage of SBEvent into
the class docstring of SBEvent.
o lldb.swig:
Add typemap for SBEvent::SBEvent (uint32_t event, const char *cstr, uint32_t cstr_len)
so that we can use, in Python, obj2 = lldb.SBEvent(0, "abc") to create an SBEvent.
llvm-svn: 134766
A few of the auto-generated method docstrings don't look right, and may need to be fixed
by either overwriting the auto-gened docstrings or some post-processing steps.
llvm-svn: 134246
Previously the IsValid pattern matched only function signatures of
the form:
def IsValid(*args): ...
However under SWIG 1.3.40 on Linux the signature reads:
def IsValid(self): ...
The new pattern matches both signature types by matching only up to
the left paren.
llvm-svn: 132968
If two SBAddress's have the same module and file address, they are considered equal.
Add a test snippet 'sa1 == sa2' to exercise the rich comparison methods for SBAddress.
llvm-svn: 132807
- The Swig post-processing scripts are now run.
- edit-swig-python-wrapper-file.py has been modified so it can be run
from the Makefile.
- The issue that prompted me to pass -classic to swig is fixed by this,
so -classic isn't passed anymore.
Python shouldn't complain anymore about a missing method 'FindDebuggerByID'
on the SBDebugger object whenever lldb is run.
llvm-svn: 132383
method definition before other method definitions. Instead, do without it and process
the class with IsValid() method definition in all possible states.
llvm-svn: 132016
into the mainline LLDB codebase. MCJIT introduces
API improvements and better architectural support.
This commit adds a new subsystem, the
ProcessDataAllocator, which is responsible for
performing static data allocations on behalf of the
IR transformer. MCJIT currently does not support
the relocations required to store the constant pool
in the same allocation as the function body, so we
allocate a heap region separately and redirect
static data references from the expression to that
heap region in a new IR modification pass.
This patch also fixes bugs in the IR
transformations that were exposed by the transition
to the MCJIT. Finally, the patch also pulls in a
more recent revision of LLVM so that the MCJIT is
available for use.
llvm-svn: 131923
the "payload_length" argument for the "payload" packet data. This meant we
could end up sending random extra data with a packet depending on how the
packet was constructed.
Fixed GDBRemoteRegisterContext to properly save and restore all registers.
Previous fixes had been added to work around the "payload_length" issues fixed
above and aren't needed anymore.
Fix logging in GDBRemoteCommunication to make sure we log the correct packet
data being sent by using the packet length when dumping the packet contents.
Added register definitions for 'arm-lldb' in the "disasm-gdb-remote.pl" script
so if you have a register dump from the GDB remote that doesn't include the
qRegisterInfo packets, you can manually tell the script which registers are
which.
llvm-svn: 131715
packet output from "log enable gdb-remote packets". This should help people
track down and see what is going wrong more easily when you have log output
that includes GDB remote packets.
llvm-svn: 131713
object.__nonzero__(self) is called to implement truth value testing and the built-in operation bool(),
via a simple delegation to self.IsValid().
Change tests under python_api/lldbutil to utilize this mechanism.
llvm-svn: 131494
unambiguous iteration support. So that we could, for example:
...
REGs = lldbutil.get_GPRs(frame)
print "Number of general purpose registers: %d" % len(REGs)
for reg in REGs:
print "%s => %s" %(reg.GetName(), reg.GetValue())
...
llvm-svn: 131418
the breakpoint ID and provides the semantics needed for '==' and '!='. And
modify LLDBIteratorTestCase.lldb_iter_2() to use '==' between two SBBreakpoint's.
llvm-svn: 130531
This is so that the objects which support the iteration protocol are immediately obvious
from looking at the lldb.py file.
SBTarget supports two types of iterations: module and breakpoint. For an SBTarget instance,
you will need to issue either:
for m in target.module_iter()
or
for b in target.breakpoint_iter()
For other single iteration protocol objects, just use, for example:
for thread in process:
ID = thread.GetThreadID()
for frame in thread:
frame.Disassemble()
....
llvm-svn: 130442
i.e., with 'SBStream &description' first, followed by 'DescriptionLevel level'.
Modify lldbutil.py so that get_description() for a target or breakpoint location
can just take the lldb object itself without specifying an option to mean option
lldb.eDescriptionLevelBrief. Modify TestTargetAPI.py to exercise this logic path.
llvm-svn: 130147
set by default when dumping registers. If you want to see all of the register
sets you can use the "--all" option:
(lldb) register read --all
If you want to just see some register sets, you can currently specify them
by index:
(lldb) register read --set 0 --set 2
We need to get shorter register set names soon so we can specify the register
sets by name without having to type too much. I will make this change soon.
You can also have any integer encoded registers resolve the address values
back to any code or data from the object files using the "--lookup" option.
Below is sample output when stopped in the libc function "puts" with some
const strings in registers:
Process 8973 stopped
* thread #1: tid = 0x2c03, 0x00007fff828fa30f libSystem.B.dylib`puts + 1, stop reason = instruction step into
frame #0: 0x00007fff828fa30f libSystem.B.dylib`puts + 1
(lldb) register read --lookup
General Purpose Registers:
rax = 0x0000000100000e98 "----------------------------------------------------------------------"
rbx = 0x0000000000000000
rcx = 0x0000000000000001
rdx = 0x0000000000000000
rdi = 0x0000000100000e98 "----------------------------------------------------------------------"
rsi = 0x0000000100800000
rbp = 0x00007fff5fbff710
rsp = 0x00007fff5fbff280
r8 = 0x0000000000000040
r9 = 0x0000000000000000
r10 = 0x0000000000000000
r11 = 0x0000000000000246
r12 = 0x0000000000000000
r13 = 0x0000000000000000
r14 = 0x0000000000000000
r15 = 0x0000000000000000
rip = 0x00007fff828fa30f libSystem.B.dylib`puts + 1
rflags = 0x0000000000000246
cs = 0x0000000000000027
fs = 0x0000000000000000
gs = 0x0000000000000000
As we can see, we see two constant strings and the PC (register "rip") is
showing the code it resolves to.
I fixed the register "--format" option to work as expected.
Added a setting to disable skipping the function prologue when setting
breakpoints as a target settings variable:
(lldb) settings set target.skip-prologue false
Updated the user settings controller boolean value handler funciton to be able
to take the default value so it can correctly respond to the eVarSetOperationClear
operation.
Did some usability work on the OptionValue classes.
Fixed the "image lookup" command to correctly respond to the "--verbose"
option and display the detailed symbol context information when looking up
line table entries and functions by name. This previously was only working
for address lookups.
llvm-svn: 129977
This allows you to have a platform selected, then specify a triple using
"i386" and have the remaining triple items (vendor, os, and environment) set
automatically.
Many interpreter commands take the "--arch" option to specify an architecture
triple, so now the command options needed to be able to get to the current
platform, so the Options class now take a reference to the interpreter on
construction.
Modified the build LLVM building in the Xcode project to use the new
Xcode project level user definitions:
LLVM_BUILD_DIR - a path to the llvm build directory
LLVM_SOURCE_DIR - a path to the llvm sources for the llvm that will be used to build lldb
LLVM_CONFIGURATION - the configuration that lldb is built for (Release,
Release+Asserts, Debug, Debug+Asserts).
I also changed the LLVM build to not check if "lldb/llvm" is a symlink and
then assume it is a real llvm build directory versus the unzipped llvm.zip
package, so now you can actually have a "lldb/llvm" directory in your lldb
sources.
llvm-svn: 129112
public types and public enums. This was done to keep the SWIG stuff from
parsing all sorts of enums and types that weren't needed, and allows us to
abstract our API better.
llvm-svn: 128239
The makefile build uses scripts/generate-vers.pl to build an appropriate
LLDB_vers.c file. The declarations for these symbols now carry a liblldb_core
prefix so update the script to generate the correct names.
llvm-svn: 128135
overlap in the SWIG integration which has now been fixed by introducing
callbacks for initializing SWIG for each language (python only right now).
There was also a breakpoint command callback that called into SWIG which has
been abtracted into a callback to avoid cross over as well.
Added a new binary: lldb-platform
This will be the start of the remote platform that will use as much of the
Host functionality to do its job so it should just work on all platforms.
It is pretty hollowed out for now, but soon it will implement a platform
using the GDB remote packets as the transport.
llvm-svn: 128053
Currently it has only test cases for SBThread.GetStopDescription() API.
Also modified lldb.swig to add typemap for (char *dst, size_t dst_len)
which occurs for SBThread::GetStopDescription() C++ API. For Python
scripting:
# Due to the typemap magic (see lldb.swig), we pass in an (int)length to GetStopDescription
# and expect to get a Python string as the result object!
# The 100 is just an arbitrary number specifying the buffer size.
stop_description = thread.GetStopDescription(100)
llvm-svn: 127173
the SBProcess.ReadMemory() API, which, due to SWIG typemap'ing, expects 3 arguments (the location
to read from, the size in bytes to read, and an SBError object), and returns the result as a
Python string object.
On SnowLeopard where this has been tested, the SWIG script needs to be pampered (use the exact
same parameter names as in SBProcess.h) in order for this to work.
llvm-svn: 126736
Anytime we had a valid python list that was trying to go from Python down into
our C++ API, it was allocating too little memory and it ended up smashing
whatever was next to the allocated memory.
Added typemap conversions for "void *, size_t" so we can get
SBProcess::ReadMemory() working. Also added a typemap for "const void *, size_t"
so we can get SBProcess::WriteMemory() to work.
Fixed an issue in the DWARF parser where we weren't correctly calculating the
DeclContext for all types and classes. We now should be a lot more accurate.
Fixes include: enums should now be setting their parent decl context correctly.
We saw a lot of examples where enums in classes were not being properly
namespace scoped. Also, classes within classes now get properly scoped.
Fixed the objective C runtime pointer checkers to let "nil" pointers through
since these are accepted by compiled code. We also now don't call "abort()"
when a pointer doesn't validate correctly since this was wreaking havoc on
the process due to the way abort() works. We now just dereference memory
which should give us an exception from which we can easily and reliably
recover.
llvm-svn: 123428
exist within the same process (one script interpreter object per debugger object). The
python script interpreter objects are all using the same global Python script interpreter;
they use separate dictionaries to keep their data separate, and mutex's to prevent any object
attempting to use the global Python interpreter when another object is already using it.
llvm-svn: 123415
very minor changes, changing how we get the target
type from a TypedefType, adding a parameter to
EnumDecl::Create(), and other minor tweaks.
llvm-svn: 121663
version); change include statements to use Python.h in the Python framework
on Mac OS X systems; leave it using regular Python.h on other systems.
Note: I think this *ought* to work properly on Linux systems, but I don't have
a system to test it on...
llvm-svn: 117612
it logs the function calls, their arguments and the return values. This is not
complete or polished, but I am committing it now, at the request of someone who
really wants to use it, even though it's not really done. It currently does not
attempt to log all the functions, just the most important ones. I will be
making further adjustments to the API logging code over the next few days/weeks.
(Suggestions for improvements are welcome).
Update the Python build scripts to re-build the swig C++ file whenever
the python-extensions.swig file is modified.
Correct the help for 'log enable' command (give it the correct number & type of
arguments).
llvm-svn: 117349
Inside the lldb module, there's no need (and as a matter of fact, incorrect) to specify the 'lldb'
module name.
Comment out the call to lldb.SBDebugger.Initialize() within the test driver itself, since it is
already done when we import the lldb.py module.
llvm-svn: 116485
function. It will inspect NAME and do the following:
- if the name contains '(' or starts with "-[" or "+[" then a full name search
will happen to match full function names with args (C++ demangled names) or
full objective C method prototypes.
- if the name contains "::" and no '(', then it is assumed to be a qualified
function name that is in a namespace or class. For "foo::bar::baz" we will
search for any functions with the basename or method name of "baz", then
filter the results to only those that contain "foo::bar::baz". This allows
setting breakpoint on C++ functions and methods without having to fully
qualify all of the types that would appear in C++ mangled names.
- if the name contains ":" (not "::"), then NAME is assumed to be an ObjC
selector.
_ otherwise, we assume just a plain function basename.
Now that "--name" is our "auto" mode, I introduced the new "--basename" option
("breakpoint set --basename NAME") to allow for function names that aren't
methods or selectors, just basenames. This can also be used to ignore C++
namespaces and class hierarchies for class methods.
Fixed clang enumeration promotion types to be correct.
llvm-svn: 116293
ScriptInterpreterPython class and made a simple callback function that
ScriptInterpreterPython::BreakpointCallbackFunction() now calls so we don't
include any internal API stuff into the cpp file that is generated by SWIG.
Fixed a few build warnings in debugserver.
llvm-svn: 115926
tricks to get types to resolve. I did this by correctly including the correct
files: stdint.h and all lldb-*.h files first before including the API files.
This allowed me to remove all of the hacks that were in the lldb.swig file
and it also allows all of the #defines in lldb-defines.h and enumerations
in lldb-enumerations.h to appear in the lldb.py module. This will make the
python script code a lot more readable.
Cleaned up the "process launch" command to not execute a "process continue"
command, it now just does what it should have with the internal API calls
instead of executing another command line command.
Made the lldb_private::Process set the state to launching and attaching if
WillLaunch/WillAttach return no error respectively.
llvm-svn: 115902
Temporarily commenting out the deprecated LaunchProcess() method.
SWIG is not able to handle the overloaded functions.
o dotest.py/lldbtest.py:
Add an '-w' option to insert some wait time between consecutive test cases.
o TestClassTypes.py:
Make the breakpoint_creation_by_filespec_python() test method more robust and
more descriptive by printing out a more insightful assert message.
o lldb.swig: Coaches swig to treat StateType as an int type, instead of a C++ class.
llvm-svn: 115899
This gets us the new clang::CXXRecordDecl improvments in clang so that when we
add fields, methods and other things to the clang::CXXRecordDecl, the correct
bits are automatically set by clang::CXXRecordDecl itself instead of having
SEMA and our lldb_private::ClangASTContext functions that create types for
DWARF do it all manually. This allows the clang::ASTContext deep copying of
types to work correctly and it means that the expression parser can now
evaluate expressions in the context of a class method correctly. Previously
when a class was copied from the DWARF generated ASTContext over into the
expression ASTContext, we were losing CXXRecordDecl bits in the conversion
which caused all classes to think they were at offset zero because the the
bools for empty, POD, and others would end up being incorrect.
llvm-svn: 115023
an auto-generated Python function, and pass the stoppoint context frame and
breakpoint location as parameters to the function (named 'frame' and 'bp_loc'),
to be used inside the breakpoint command Python code, if desired.
llvm-svn: 114849
- Sema is now exported (and there was much rejoicing.)
- Storage classes are now centrally defined.
Also fixed some bugs that the new LLVM picked up.
llvm-svn: 114622
into python-extensions.swig, which gets included into lldb.swig, and
adds them back into the classes when swig generates it's C++ file. This
keeps the Python stuff out of the general API classes.
Also fixed a small bug in the copy constructor for SBSymbolContext.
llvm-svn: 114602
o Fixed a crasher when getting it via SBTarget.GetExecutable().
>>> filespec = target.GetExecutable()
Segmentation fault
o And renamed SBFileSpec::GetFileName() to GetFilename() to be consistent with FileSpec::GetFilename().
llvm-svn: 112308
with the only exception of launching the process from SBTarget which is under
investigation.
o build-swig-Python.sh should also checks the timestamp of ${swig_input_file}
for update eligibility. Also, once an update is in order, there's no need
to check the remaining header files for timestamps.
o Coaches swig to treat StopReason as an int type, instead of a C++ class.
llvm-svn: 112210
involved watching for the objective C built-in types in DWARF and making sure
when we convert the DWARF types into clang types that we use the appropriate
ASTContext types.
Added a way to find and dump types in lldb (something equivalent to gdb's
"ptype" command):
image lookup --type <TYPENAME>
This only works for looking up types by name and won't work with variables.
It also currently dumps out verbose internal information. I will modify it
to dump more appropriate user level info in my next submission.
Hookup up the "FindTypes()" functions in the SymbolFile and SymbolVendor so
we can lookup types by name in one or more images.
Fixed "image lookup --address <ADDRESS>" to be able to correctly show all
symbol context information, but it will only show this extra information when
the new "--verbose" flag is used.
Updated to latest LLVM to get a few needed fixes.
llvm-svn: 110089
Fixed the llvm build for Mac OS X builds to look in llvm/lib/Release+Asserts
output directory for all configurations (Debug, Release, BuildAndIntegration).
llvm-svn: 108289
enabled LLVM make style building and made this compile LLDB on Mac OS X. We
can now iterate on this to make the build work on both linux and macosx.
llvm-svn: 108009
Also fixed our build to define NDEBUG; code that
uses LLVM headers without NDEBUG is
binary-incompatible with libraries built with
NDEBUG.
llvm-svn: 107853
Add functions to look up debugger by id
Add global variable to lldb python module, to hold debugger id
Modify embedded Python interpreter to update the global variable with the
id of its current debugger.
Modify the char ** typemap definition in lldb.swig to accept 'None' (for NULL)
as a valid value.
The point of all this is so that, when you drop into the embedded interpreter
from the command interpreter (or when doing Python-based breakpoint commands),
there is a way for the Python side to find/get the correct debugger
instance ( by checking debugger_unique_id, then calling
SBDebugger::FindDebuggerWithID on it).
llvm-svn: 107287
other script files around, so they can be run from outside Xcode. Also,
check the current OS, and only try to use the framework structure stuff on
Darwin systems.
llvm-svn: 106132
We need to put this in LLDB since we need to vend this in our API
because our public API uses shared pointers to our private objects.
Removed a deprecated file: include/lldb/Host/Types.h
Added the new SharingPtr.cpp/.h files into source/Utility.
Added a shell script build phase that fixes up all headers in the
LLDB.framework.
llvm-svn: 105895