summaryrefslogtreecommitdiffstats
path: root/lldb/scripts/Python/interface
Commit message (Collapse)AuthorAgeFilesLines
...
* Add new Queue, QueueItem, Queuelist, SBQueue, SBQueueItem classes to representJason Molenda2013-12-133-0/+109
| | | | | | | | | libdispatch aka Grand Central Dispatch (GCD) queues. Still fleshing out the documentation and testing of these but the overall API is settling down so it's a good time to check it in. <rdar://problem/15600370> llvm-svn: 197190
* For logical backtrace work, lldb needs to track Module unloads etc & ↵Greg Clayton2013-12-061-0/+3
| | | | | | | | | | symoblicate an address based on a point in time <rdar://problem/15314403> This patch adds a new lldb_private::SectionLoadHistory class that tracks what shared libraries were loaded given a process stop ID. This allows us to keep a history of the sections that were loaded for a time T. Many items in history objects will rely upon the process stop ID in the future. llvm-svn: 196557
* Expose SBPlatform through the public API.Greg Clayton2013-11-205-0/+224
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example code: remote_platform = lldb.SBPlatform("remote-macosx"); remote_platform.SetWorkingDirectory("/private/tmp") debugger.SetSelectedPlatform(remote_platform) connect_options = lldb.SBPlatformConnectOptions("connect://localhost:1111"); err = remote_platform.ConnectRemote(connect_options) if err.Success(): print >> result, 'Connected to remote platform:' print >> result, 'hostname: %s' % (remote_platform.GetHostname()) src = lldb.SBFileSpec("/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework", False) dst = lldb.SBFileSpec() # copy src to platform working directory since "dst" is empty err = remote_platform.Install(src, dst); if err.Success(): print >> result, '%s installed successfully' % (src) else: print >> result, 'error: failed to install "%s": %s' % (src, err) Implemented many calls needed in lldb-platform to be able to install a directory that contains symlinks, file and directories. The remote lldb-platform can now launch GDB servers on the remote system so that remote debugging can be spawned through the remote platform when connected to a remote platform. The API in SBPlatform is subject to change and will be getting many new functions. llvm-svn: 195273
* Add a new SBThread::GetExtendedBacktraceOriginatingIndexID() methodJason Molenda2013-11-161-1/+13
| | | | | | | | | | (and same thing to Thread base class) which can be used when looking at an ExtendedBacktrace thread; it will try to find the IndexID() of the original thread that was executing this backtrace when it was recorded. If lldb can't find a record of that thread, it will return the same value as IndexID() for the ExtendedBacktrace thread. llvm-svn: 194912
* Change SBThread::GetExtendedBacktrace toJason Molenda2013-11-121-2/+2
| | | | | | | SBThread::GetExtendedBacktraceThread to make it more clear what is being returned. llvm-svn: 194531
* This patch does a couple of things. Jim Ingham2013-11-071-0/+7
| | | | | | | | | | | | | | | | | | | | | | It completes the job of using EvaluateExpressionOptions consistently throughout the inferior function calling mechanism in lldb begun in Greg's patch r194009. It removes a handful of alternate calls into the ClangUserExpression/ClangFunction/ThreadPlanCallFunction which were there for convenience. Using the EvaluateExpressionOptions removes the need for them. Using that it gets the --debug option from Greg's patch to work cleanly. It also adds another EvaluateExpressionOption to not trap exceptions when running expressions. You shouldn't use this option unless you KNOW your expression can't throw beyond itself. This is: <rdar://problem/15374885> At present this is only available through the SB API's or python. It fixes a bug where function calls would unset the ObjC & C++ exception breakpoints without checking whether they were set by somebody else already. llvm-svn: 194182
* Rename extended backtrace methods to take out the "ThreadOrigin"Jason Molenda2013-11-062-6/+6
| | | | | | | bit from the method names. <rdar://problem/15314369> llvm-svn: 194122
* Add a new GetThreadOriginExtendedBacktrace method to the Jason Molenda2013-11-061-0/+13
| | | | | | | SystemRuntime and SBThread classes. <rdar://problem/15314369> llvm-svn: 194111
* Add the GetNumThreadOriginExtendedBacktraceTypes andJason Molenda2013-11-052-0/+30
| | | | | | | | | | | GetThreadOriginExtendedBacktraceTypeAtIndex methods to SBProcess. Add documentation for the GetQueueName and GetQueueID methods to SBThread. <rdar://problem/15314369> llvm-svn: 194063
* Fix for a mistake spotted by Enrico with the SBThread::queue_id accessor.Jason Molenda2013-10-221-1/+1
| | | | llvm-svn: 193136
* Expose the Thread::GetQueueID() method through the SBThread API, similar toJason Molenda2013-10-211-0/+6
| | | | | | the existing SBThread::GetQueueName() method. llvm-svn: 193132
* <rdar://problem/14028923>Enrico Granata2013-10-081-0/+3
| | | | | | | Implement SBTarget::CreateValueFromAddress() with a behavior equivalent to SBValue::CreateValueFromAddress() (but without the need to grab an SBValue first just as a starting point to make up another SBValue out of whole cloth) llvm-svn: 192239
* Add missing GetBroadcasterClassName and event types enum to SBThread.iDaniel Malea2013-10-031-0/+16
| | | | llvm-svn: 191933
* Added a 'jump' command, similar to GDBs.Richard Mitton2013-09-121-2/+5
| | | | | | | | | This allows the PC to be directly changed to a different line. It's similar to the example python script in examples/python/jump.py, except implemented as a builtin. Also this version will track the current function correctly even if the target line resolves to multiple addresses. (e.g. debugging a templated function) llvm-svn: 190572
* Don't recommend using bytearray(buf, 'ascii') for binary data read with Jason Molenda2013-08-241-2/+1
| | | | | | SBProcess::ReadMemory - it will fail for anything with the high bit set. llvm-svn: 189154
* Add an SBFrame::FindRegister() method to make it a littleJason Molenda2013-07-261-0/+3
| | | | | | easier to retrieve a register value. llvm-svn: 187184
* Second attempt at getting the PyCallable changes in trunkEnrico Granata2013-07-091-0/+7
| | | | | | Thanks to Daniel Malea for helping test this patch for Linux happiness! llvm-svn: 185965
* Added a way to extract the module specifications from a file. A module ↵Greg Clayton2013-07-083-1/+139
| | | | | | | | | | | | | specification is information that is required to describe a module (executable, shared library, object file, ect). This information includes host path, platform path (remote path), symbol file path, UUID, object name (for objects in .a files for example you could have an object name of "foo.o"), and target triple. Module specification can be used to create a module, or used to add a module to a target. A list of module specifications can be used to enumerate objects in container objects (like universal mach files and BSD archive files). There are two new classes: lldb::SBModuleSpec lldb::SBModuleSpecList The SBModuleSpec wraps up a lldb_private::ModuleSpec, and SBModuleSpecList wraps up a lldb_private::ModuleSpecList. llvm-svn: 185877
* Revert commits that cause broken builds on GCC buildbotsDaniel Malea2013-07-031-7/+0
| | | | | | | | - build fails due to PyCallable template definition inside an extern "C" scope This commit reverts 185240, 184893 and 184608. llvm-svn: 185560
* <rdar://problem/14266411>Enrico Granata2013-06-251-0/+7
| | | | | | | | | | | | The semi-unofficial way of returning a status from a Python command was to return a string (e.g. return "no such variable was found") that LLDB would pick as a clue of an error having happened This checkin changes that: - SBCommandReturnObject now exports a SetError() call, which can take an SBError or a plain C-string - script commands now drop any return value and expect the SBCommandReturnObject ("return object") to be filled in appropriately - if you do nothing, a success will be assumed If your commands were relying on returning a value and having LLDB pick that up as an error, please change your commands to SetError() through the return object or expect changes in behavior llvm-svn: 184893
* Implemented a types.py module that allows types to be inspected for padding.Greg Clayton2013-06-191-0/+3
| | | | | | 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
* Added the ability to get a list of types from a SBModule or SBCompileUnit. ↵Greg Clayton2013-06-182-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Added a SBSection::GetParent() to the API.Greg Clayton2013-06-131-0/+3
| | | | llvm-svn: 183948
* Improvements to the data formatters SB API:Enrico Granata2013-06-111-0/+97
| | | | | | | | - exposing new accessors: formats/format, ..., that allow you to iterate over all formatters e.g. sys_category = lldb.debugger.GetCategory("system").summary['char *'] - ensuring that C++-based synthetic children provider can at least print their description accurately, if nothing else llvm-svn: 183805
* <rdar://problem/13646047>Enrico Granata2013-06-111-0/+40
| | | | | | | Providing a Python helper SBData.CreateDataFromInt() to make an SBData out of a single integer number It tries to use the current target, if any, for endianness and pointer size, and it picks a reasonable size on your behalf - if there is no way it can infer anything reasonable it essentially picks a 64-bit Mac as the reference model llvm-svn: 183793
* Adding properties to the SBBreakpoint classEnrico Granata2013-06-101-0/+20
| | | | llvm-svn: 183707
* <rdar://problem/11742979>Enrico Granata2013-05-0316-2/+98
| | | | | | | | | 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
* <rdar://problem/13499317>Enrico Granata2013-05-021-1/+1
| | | | | | | | Enabling Python commands to produce Unicode output via: result.PutCString(u”whatever”) llvm-svn: 180930
* After discussing with Chris Lattner, we require C++11, so lets get rid of ↵Greg Clayton2013-04-183-3/+3
| | | | | | the macros and just use C++11. llvm-svn: 179805
* Since we use C++11, we should switch over to using std::unique_ptr when ↵Greg Clayton2013-04-183-3/+3
| | | | | | | | 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
* Adding new Python API function to check for stopped threads.Andrew Kaylor2013-04-151-0/+6
| | | | llvm-svn: 179577
* Make sure we expose SetData() through the PythonSean Callanan2013-04-131-0/+3
| | | | | | interface. llvm-svn: 179439
* <rdar://problem/13563628>Enrico Granata2013-04-051-1/+2
| | | | | | | | | | 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
* Modified patch from Prabhat Verma to enable loading core files through the ↵Greg Clayton2013-03-251-0/+20
| | | | | | SBTarget API. llvm-svn: 177932
* - Masking out SBCommandReturnObject::Printf() from the Python layer because ↵Enrico Granata2013-03-251-2/+8
| | | | | | | | | | SWIG and varargs do not get along well. It is replaced by a Print("str") call which is equivalent to Printf("%s","str") - Providing file-like behavior for SBStream with appropriate extension write() and flush() calls, plus documenting that these are only meant and only exist for Python Documenting the file-like behavior on our website llvm-svn: 177877
* <rdar://problem/13421412>Greg Clayton2013-03-141-1/+1
| | | | | | Many "byte size" members and variables were using a mixture of uint32_t and size_t. Switching over to using uint64_t everywhere. llvm-svn: 177091
* Added new properties to lldb.SBModule classes:Greg Clayton2013-03-071-3/+61
| | | | | | | | | | | | | | | | | | "compile_units" returns an array of all compile units in a module as a list() of lldb.SBCompileUnit objects. "compile_unit" returns a compile unit accessor object that allows indexed access, search by full or partial path, or by regex: (lldb) script comp_unit = lldb.target.module['TextEdit'].compile_unit['Document.m'] comp_unit = lldb.target.module['TextEdit'].compile_unit['/path/to/Document.m'] comp_unit = lldb.target.module['TextEdit'].compile_unit[0] comp_unit = lldb.target.module['TextEdit'].compile_unit[1] for comp_unit in lldb.target.module['TextEdit'].compile_unit[re.compile("\.m$")] print comp_unit This helps do quick searches and scripting while debugging. llvm-svn: 176613
* Stop the "module" property from throwing an exception when the module name ↵Greg Clayton2013-03-071-6/+9
| | | | | | was not found in the target module list. llvm-svn: 176611
* Convert from the C-based LLVM Disassembler shim to the full MC Disassembler ↵Jim Ingham2013-03-023-0/+12
| | | | | | | | | | | | API's. Calculate "can branch" using the MC API's rather than our hand-rolled regex'es. As extra credit, allow setting the disassembly flavor for x86 based architectures to intel or att. <rdar://problem/11319574> <rdar://problem/9329275> llvm-svn: 176392
* <rdar://problem/13281528>Greg Clayton2013-02-252-9/+9
| | | | | | Fixed issues with the SBModule "sections" property, and with the SBBlock "ranges" attributes. llvm-svn: 176051
* Fix document typos, indentation in python code, and API examples.Daniel Malea2013-02-121-1/+1
| | | | | | Patch by Bruce Mitchener! llvm-svn: 175002
* Reworked the way Process::RunThreadPlan and the ThreadPlanCallFunction ↵Jim Ingham2013-02-092-2/+8
| | | | | | | | | | | interoperate to fix problems where hitting auto-continue signals while running a thread plan would cause us to lose control of the debug session. <rdar://problem/12993641> llvm-svn: 174793
* Allow the target to give out the size of the red zone for given ABIs.Greg Clayton2013-02-011-0/+3
| | | | | | A bit of cleanup in the heap module. llvm-svn: 174129
* <rdar://problem/13069948>Greg Clayton2013-01-251-14/+14
| | | | | | | | | | | | 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
* <rdar://problem/13010007>Greg Clayton2013-01-181-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* <rdar://problem/13021266>Enrico Granata2013-01-162-0/+33
| | | | | | | Adding FindFirstGlobalVariable to SBModule and SBTarget These calls work like FindGlobalVariables but they only return the first match found and so they can return an SBValue instead of an SBValueList for added convenience of use llvm-svn: 172636
* <rdar://problem/13009943>Greg Clayton2013-01-161-0/+9
| | | | | | | | | | Added a unique integer identifier to processes. Some systems, like JTAG or other simulators, might always assign the same process ID (pid) to the processes that are being debugged. In order for scripts and the APIs to uniquely identify the processes, there needs to be another ID. Now the SBProcess class has: uint32_t SBProcess::GetUniqueID(); This integer ID will help to truly uniquely identify a process and help with appropriate caching that can be associated with a SBProcess object. llvm-svn: 172628
* Separated the "expr --unwind-on-error" behavior into two parts, actual ↵Jim Ingham2013-01-151-0/+8
| | | | | | | | | | | | | | | | errors (i.e. crashes) which continue to be controlled by the --unwind-on-error flag, and --ignore-breakpoint which separately controls behavior when a called function hits a breakpoint. For breakpoints, we don't unwind, we either stop, or ignore the breakpoint, which makes more sense. Also make both these behaviors globally settable through "settings set". Also handle the case where a breakpoint command calls code that ends up re-hitting the breakpoint. We were recursing and crashing. Now we just stop without calling the second command. <rdar://problem/12986644> <rdar://problem/9119325> llvm-svn: 172503
* Add an SBProcess API to get the current StopID, either considering or ↵Jim Ingham2013-01-081-0/+10
| | | | | | | | | | ignoring stops caused by expression evaluation. <rdar://problem/12968562> llvm-svn: 171914
* <rdar://problem/12928282>Greg Clayton2013-01-041-0/+2
| | | | | | | | Added SBTarget::EvaluateExpression() so expressions can be evaluated without needing a process. Also fixed many functions that deal with clang AST types to be able to properly handle the clang::Type::Elaborated types ("struct foo", "class bar"). llvm-svn: 171476
OpenPOWER on IntegriCloud