Commit Graph

89 Commits

Author SHA1 Message Date
Johnny Chen b8f7603526 Add swig docstrings for SBFrame.h.
Add post-processing step to remove the trailing blank lines from the docstrings of lldb.py.

llvm-svn: 134360
2011-07-03 01:43:29 +00:00
Johnny Chen ed48137734 Refine the post-processing phase of lldb.py to remove some more doxygen/c++-comment residues.
llvm-svn: 134326
2011-07-02 20:01:09 +00:00
Johnny Chen b9a2c32219 Add some documentation blocks to SBTarget.h and use swig docstring feature to
take advantage of them.  Update modify-python-lldb.py to remove some 'residues'
resulting from swigification.

llvm-svn: 134269
2011-07-01 22:14:07 +00:00
Johnny Chen 61abb2aea7 Add docstrings for some API classes and auto-generates docstrings for the methods of them.
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
2011-07-01 18:39:47 +00:00
Johnny Chen ee481783cb Add module docstring to the auto-generated lldb.py file.
llvm-svn: 134192
2011-06-30 21:29:50 +00:00
Peter Collingbourne 059640b521 Generalise pattern for matching IsValid signature
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
2011-06-14 03:55:41 +00:00
Johnny Chen e2b5cfd826 Add rich comparison methods for the SBAddress object.
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
2011-06-09 22:04:56 +00:00
Greg Clayton 8672996e4d Update the handle many of the packets that our current LLDB debugserver
handles. Also fixed a case where the packet wouldn't be dumped if it returned
the unimplemented packet.

llvm-svn: 132498
2011-06-02 22:21:38 +00:00
Johnny Chen 755faf7744 Make it clear that the Python script modify-python-lldb.py is responsible for post-processing
the SWIG-generated lldb.py module by adding comments in the post-processed file in order to
facilitate reading of the code.

llvm-svn: 132417
2011-06-01 19:21:08 +00:00
Johnny Chen 2ced507a1e Fix comment.
llvm-svn: 132412
2011-06-01 18:40:11 +00:00
Charles Davis 4ce288e3e4 Fix remaining Python issues leftover from my previous patch.
- 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
2011-06-01 02:33:12 +00:00
Johnny Chen bf9cf5ec1e Use the with statement to simplify the build script.
llvm-svn: 132221
2011-05-27 21:58:22 +00:00
Johnny Chen 624ddf2f20 Added comment.
llvm-svn: 132019
2011-05-24 22:57:42 +00:00
Johnny Chen 2f1ee9a09c Comment change.
llvm-svn: 132018
2011-05-24 22:53:03 +00:00
Johnny Chen 93e7b3a8bd Fix a potential bug resulting from the wrong assumption that SWIG puts out the __init__
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
2011-05-24 22:29:49 +00:00
Johnny Chen 685b2b080f Update comment.
llvm-svn: 132002
2011-05-24 21:05:16 +00:00
Sean Callanan 79763a42ab This commit integrates support for the LLVM MCJIT
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
2011-05-23 21:40:23 +00:00
Greg Clayton 5fe15d2d52 Fixed an issue in GDBRemoteCommunicationClient where we weren't listening to
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
2011-05-20 03:15:54 +00:00
Greg Clayton e51dc6f32a Added a perl script to disassemble, into human readable form, the GDB remote
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
2011-05-20 02:00:47 +00:00
Johnny Chen 112f5696fb Add truth value testing to those lldb Python objects with the IsValid() method definitions.
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
2011-05-17 22:14:39 +00:00
Johnny Chen fac7b3aae6 Add implementation of built-in function len() for those lldb containers with
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
2011-05-16 20:31:18 +00:00
Sean Callanan d12cf8bbc9 Updated to use the latest LLVM/Clang, to pick up JIT
changes.

llvm-svn: 131391
2011-05-15 22:34:38 +00:00
Johnny Chen d71670c04a Add implementation of '==' and '!=' for SBFileSpec and SBModule. Modify a test case to take advantage of 'ths_module == that_module'.
llvm-svn: 130709
2011-05-02 19:05:52 +00:00
Johnny Chen 17bae4c5e6 Fix a typo in comment.
llvm-svn: 130698
2011-05-02 17:53:04 +00:00
Johnny Chen f1c95f8bcb Update comments.
llvm-svn: 130533
2011-04-29 19:22:24 +00:00
Johnny Chen 31e4be06c4 Fix a bug introduced in my previous checkin, where the state was not properly
restored after parsing "SBTarget".  Indentation matters in Python. :-)

llvm-svn: 130532
2011-04-29 19:19:13 +00:00
Johnny Chen 0f023fa4af Add the Python rich comparison methods for SBBreakpoint, where GetID() returns
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
2011-04-29 19:03:02 +00:00
Johnny Chen 51cc833af7 Fix a typo.
llvm-svn: 130461
2011-04-28 23:53:16 +00:00
Johnny Chen fbc0d27144 Move the iteration protocol of lldb objects to the auto-generated lldb Python module.
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
2011-04-28 21:31:18 +00:00
Johnny Chen fc87e2dd5c Make SBBreakpointLocation::GetDescription() API to be consistent with SBTarget,
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
2011-04-25 20:23:05 +00:00
Greg Clayton 385aa28cf6 Did some work on the "register read" command to only show the first register
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
2011-04-22 03:55:06 +00:00
Sean Callanan 1b1bf6e982 Updated LLVM to pick up fixes to the ARM instruction
tables.

llvm-svn: 129500
2011-04-14 02:01:31 +00:00
Greg Clayton eb0103f2d0 Modified the ArchSpec to take an optional "Platform *" when setting the triple.
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
2011-04-07 22:46:35 +00:00
Sean Callanan 6d5b79fc2a Updated LLDB to use a recent LLVM/Clang, pulling
in stability fixes for the ARM and Thumb disassemblers.

llvm-svn: 128316
2011-03-26 00:52:28 +00:00
Greg Clayton e0d378b334 Fixed the LLDB build so that we can have private types, private enums and
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
2011-03-24 21:19:54 +00:00
Stephen Wilson e9b1491d49 Update autogen'd LLDB_vers.c.
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
2011-03-23 02:07:56 +00:00
Johnny Chen de8241c255 Fix compile warnings wrt LLDBWrapPython.cpp.
llvm-svn: 128124
2011-03-23 00:26:08 +00:00
Greg Clayton fc36f79170 Abtracted the innards of lldb-core away from the SB interface. There was some
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
2011-03-22 01:14:58 +00:00
Sean Callanan e6935b6bdf Updated LLVM/Clang to the latest release, to pick
up AVX disassembly support.

llvm-svn: 127695
2011-03-15 20:57:04 +00:00
Sean Callanan fb0b7583a7 Updated to LLVM/Clang revision 127600.
llvm-svn: 127634
2011-03-15 00:17:19 +00:00
Johnny Chen 40fa548ee7 There's no sense checking for < 0 with a return type of size_t:
size_t
SBProcess::ReadMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);

llvm-svn: 127292
2011-03-08 23:46:33 +00:00
Johnny Chen 2f6f7ba879 Add TestThreadAPI.py file to house the Python SBThread API test cases.
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
2011-03-07 21:28:57 +00:00
Johnny Chen 37f99fdb73 Add TestProcessAPI.py which exercises some Python SBProcess API. In particular, this tests
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
2011-03-01 02:20:14 +00:00
Jim Ingham 6b90ba414a Look for swig in /usr/bin and /usr/local/bin.
llvm-svn: 126732
2011-03-01 01:39:04 +00:00
Sean Callanan 78e3760fde Updated Clang to a version that supports propagating
the "virtual" flag when importing a C++ function
declaration.  Made changes to LLDB to support other
changes in Clang.

llvm-svn: 124355
2011-01-27 04:42:51 +00:00
Sean Callanan 2c777c4afb Updated to revision 123723 of LLVM, to bring in
support for minimal type import functionality.

llvm-svn: 123787
2011-01-18 23:32:05 +00:00
Greg Clayton ca512b397c Fixed an error in the type map for "char **" that was a bad memory smasher.
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
2011-01-14 04:54:56 +00:00
Caroline Tice 2f88aadff1 Split up the Python script interpreter code to allow multiple script interpreter objects to
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
2011-01-14 00:29:16 +00:00
Johnny Chen 4b33209a04 Patch by Stephen Wilson to make Swig happy building on linux.
Pass the test suite on Mac OS X Snow Leopard.

llvm-svn: 121924
2010-12-16 00:01:06 +00:00
Sean Callanan 481144790c Updated to latest Clang revision. This involved
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
2010-12-13 01:26:27 +00:00