summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBDebugger.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fixed "SBTarget SBDebugger::CreateTarget (const char *filename)" to use the ↵Greg Clayton2014-11-131-6/+3
| | | | | | | | | | | | | | same semantics as other SBDebugger::CreateTarget() functions. The issues were: - If you called this function with any arch other than the default target architecture, creating the target would fail because the Target::GetDefaultArchitecture() would not match the single architecture in the file specified. This caused running the test suite remotely with lldb-platform to fail many many tests due to the bad target. - It would specify the currently selected platform which might not work for the specified platform All other SBDebugger::CreateTarget calls do not assume an architecture or platform and if they aren't specified, they don't auto select the wrong one for you. With this fix, SBTarget SBDebugger::CreateTarget (const char *filename) now behaves like the other SBDebugger::CreateTarget() variants. llvm-svn: 221908
* This adds a "batch mode" to lldb kinda like the gdb batch mode. It will ↵Jim Ingham2014-10-141-1/+3
| | | | | | | | | | | | | | | | quit the debugger after all the commands have been executed except if one of the commands was an execution control command that stopped because of a signal or exception. Also adds a variant of SBCommandInterpreter::HandleCommand that takes an SBExecutionContext. That way you can run an lldb command targeted at a particular target, thread or process w/o having to select same before running the command. Also exposes CommandInterpreter::HandleCommandsFromFile to the SBCommandInterpreter API, since that seemed generally useful. llvm-svn: 219654
* Rework the way we pass "run multiple command" options to the various API's thatJim Ingham2014-10-111-1/+24
| | | | | | | | | | | | | | | do that (RunCommandInterpreter, HandleCommands, HandleCommandsFromFile) to gather the options into an options class. Also expose that to the SB API's. Change the way the "-o" options to the lldb driver are processed so: 1) They are run synchronously - didn't really make any sense to run the asynchronously. 2) The stop on error 3) "quit" in one of the -o commands will not quit lldb - not the command interpreter that was running the -o commands. I added an entry to the run options to stop-on-crash, but I haven't implemented that yet. llvm-svn: 219553
* Revert r219102 as it caused significant buildbot breakageEd Maste2014-10-061-4/+0
| | | | llvm-svn: 219120
* Call SBDebugger::Initialize/Terminate from within Create/Destroy.Matthew Gardiner2014-10-061-0/+4
| | | | | | | The above change permits developers using the lldb C++ API to code applications in a more logical manner. llvm-svn: 219102
* Test suite runs better again after recent fixes that would select a platform ↵Greg Clayton2014-09-191-6/+29
| | | | | | | | | | | | | if a "file a.out" auto selected a different platform than the selected one. Changes include: - fix it so you can select the "host" platform using "platform select host" - change all callbacks that create platforms to returns shared pointers - fix TestImageListMultiArchitecture.py to restore the "host" platform by running "platform select host" - Add a new "PlatformSP Platform::Find(const ConstString &name)" method to get a cached platform - cache platforms that are created and re-use them instead of always creating a new one llvm-svn: 218145
* Update LLDB to use LLVM's DynamicLibrary.Zachary Turner2014-08-271-7/+8
| | | | | | | | | LLDB had implemented its own DynamicLibrary class for plugin support. LLVM has an equivalent mechanism, so this patch deletes the duplicated code in LLDB and updates LLDB to reference the mechanism provided by LLVM. llvm-svn: 216606
* Don't allow two threads to both be in SBDebugger::Create() due to threading ↵Greg Clayton2014-05-191-0/+9
| | | | | | | | issues in FormatManager. <rdar://problem/16937126> llvm-svn: 209160
* sweep up -Wformat warnings from gccSaleem Abdulrasool2014-04-041-62/+67
| | | | | | | This is a purely mechanical change explicitly casting any parameters for printf style conversion. This cleans up the warnings emitted by gcc 4.8 on Linux. llvm-svn: 205607
* Merging the iohandler branch back into main. Greg Clayton2014-01-271-56/+56
| | | | | | | | | | | | The many many benefits include: 1 - Input/Output/Error streams are now handled as real streams not a push style input 2 - auto completion in python embedded interpreter 3 - multi-line input for "script" and "expression" commands now allow you to edit previous/next lines using up and down arrow keys and this makes multi-line input actually a viable thing to use 4 - it is now possible to use curses to drive LLDB (please try the "gui" command) We will need to deal with and fix any buildbot failures and tests and arise now that input/output and error are correctly hooked up in all cases. llvm-svn: 200263
* Fixed internal code to not link against and code from "lldb/API/*". Greg Clayton2013-12-021-1/+37
| | | | | | | | | | lldb_private::Debugger was #including some "lldb/API" header files which causes tools (lldb-platform and lldb-gdbserver) that link against the internals only (no API layer) to fail to link depending on which calls were being used. Also fixed the current working directory so that it gets set correctly for remote test suite runs. Now the remote working directory is set to: "ARCH/TESTNUM/..." where ARCH is the current architecture name and "TESTNUM" is the current test number. Fixed the "lldb-platform" and "lldb-gdbserver" to not warn about mismatched visibility settings by having each have their own exports file which contains nothing. This forces all symbols to not be exported, and also quiets the linker warnings. llvm-svn: 196141
* Expose SBPlatform through the public API.Greg Clayton2013-11-201-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Avoid ambiguity between pid_t and lldb::pid_t.Virgile Bello2013-09-051-1/+1
| | | | llvm-svn: 190066
* MingW compilation (windows). Includes various refactoring to improve ↵Virgile Bello2013-08-231-1/+1
| | | | | | portability. llvm-svn: 189107
* Add ${ansi.XX} parsing to lldb prompt, use-color setting, and -no-use-colors ↵Michael Sartain2013-05-231-0/+16
| | | | | | | | | | command line options. settings set use-color [false|true] settings set prompt "${ansi.bold}${ansi.fg.green}(lldb)${ansi.normal} " also "--no-use-colors" on the command prompt llvm-svn: 182609
* <rdar://problem/13521159>Greg Clayton2013-03-271-24/+24
| | | | | | | | LLDB is crashing when logging is enabled from lldb-perf-clang. This has to do with the global destructor chain as the process and its threads are being torn down. All logging channels now make one and only one instance that is kept in a global pointer which is never freed. This guarantees that logging can correctly continue as the process tears itself down. llvm-svn: 178191
* <rdar://problem/12978143>Enrico Granata2013-01-281-1/+1
| | | | | | | | | | | Data formatters now cache themselves. This commit provides a new formatter cache mechanism. Upon resolving a formatter (summary or synthetic), LLDB remembers the resolution for later faster retrieval. Also moved the data formatters subsystem from the core to its own group and folder for easier management, and done some code reorganization. The ObjC runtime v1 now returns a class name if asked for the dynamic type of an object. This is required for formatters caching to work with the v1 runtime. Lastly, this commit disposes of the old hack where ValueObjects had to remember whether they were queried for formatters with their static or dynamic type. Now the ValueObjectDynamicValue class works well enough that we can use its dynamic value setting for the same purpose. llvm-svn: 173728
* Fix Linux build warnings due to redefinition of macros:Daniel Malea2012-12-051-0/+2
| | | | | | | | | - add new header lldb-python.h to be included before other system headers - short term fix (eventually python dependencies must be cleaned up) Patch by Matt Kopec! llvm-svn: 169341
* Save and restore terminal state when lldb is suspended with SIGTSTP and ↵Jim Ingham2012-11-301-0/+14
| | | | | | | | | resumed with SIGCONT. Readline & gdb have a bunch of code to handle older UNIX'es with other job control mechanisms. I didn't try to replicate that. llvm-svn: 169032
* Resolve printf formatting warnings on Linux:Daniel Malea2012-11-291-2/+2
| | | | | | | | - use macros from inttypes.h for format strings instead of OS-specific types Patch from Matt Kopec! llvm-svn: 168945
* <rdar://problem/12462048>Greg Clayton2012-10-181-9/+5
| | | | | | | | | | <rdar://problem/12068650> More fixes to how we handle paths that are used to create a target. This modification centralizes the location where and how what the user specifies gets resolved. Prior to this fix, the TargetList::CreateTarget variants took a FileSpec object which meant everyone had the opportunity to resolve the path their own way. Now both CreateTarget variants take a "const char *use_exe_path" which allows the TargetList::CreateTarget to centralize where the resolving happens and "do the right thing". llvm-svn: 166186
* Ran the sources through the compiler with -Wshadow warningsJason Molenda2012-10-041-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | enabled after we'd found a few bugs that were caused by shadowed local variables; the most important issue this turned up was a common mistake of trying to obtain a mutex lock for the scope of a code block by doing Mutex::Locker(m_map_mutex); This doesn't assign the lock object to a local variable; it is a temporary that has its dtor called immediately. Instead, Mutex::Locker locker(m_map_mutex); does what is intended. For some reason -Wshadow happened to highlight these as shadowed variables. I also fixed a few obivous and easy shadowed variable issues across the code base but there are a couple dozen more that should be fixed when someone has a free minute. <rdar://problem/12437585> llvm-svn: 165269
* Stop using the "%z" size_t modifier and cast all size_t values to uint64_t. ↵Greg Clayton2012-09-181-2/+5
| | | | | | Some platforms don't support this modification. llvm-svn: 164148
* Fixing a constness issue in an otherwise trivial patchEnrico Granata2012-09-061-1/+1
| | | | llvm-svn: 163352
* Restoring an API as deprecated which was removed in a previous commitEnrico Granata2012-09-061-0/+6
| | | | llvm-svn: 163351
* Remove further outdated "settings" code and also implement a few missing things.Greg Clayton2012-08-221-37/+44
| | | | llvm-svn: 162376
* Reimplemented the code that backed the "settings" in lldb. There were many ↵Greg Clayton2012-08-221-32/+36
| | | | | | | | | | | | | issues with the previous implementation: - no setting auto completion - very manual and error prone way of getting/setting variables - tons of code duplication - useless instance names for processes, threads Now settings can easily be defined like option values. The new settings makes use of the "OptionValue" classes so we can re-use the option value code that we use to set settings in command options. No more instances, just "does the right thing". llvm-svn: 162366
* A baton isn't needed to dispatch input.Filipe Cabecinhas2012-08-201-3/+3
| | | | | | I also added a typemap to make DispatchInput usable in Python. llvm-svn: 162204
* Add API logging for SBDebugger::MemoryPressureDetected.Jim Ingham2012-06-071-0/+7
| | | | llvm-svn: 158159
* Print out a notification when the process of a target other than the ↵Jim Ingham2012-05-081-0/+14
| | | | | | currently selected target stops. llvm-svn: 156433
* <rdar://problem/11338654> Fixing a bug where having a summary for a bitfield ↵Enrico Granata2012-05-081-57/+9
| | | | | | without a format specified would in certain cases crash LLDB - This has also led to refactoring the by-type accessors for the data formatter subsystem. These now belong in our internal layer, and are just invoked by the public API stratum llvm-svn: 156429
* <rdar://problem/11358639>Greg Clayton2012-05-081-1/+1
| | | | | | | | Switch over to the "*-apple-macosx" for desktop and "*-apple-ios" for iOS triples. Also make the selection process for auto selecting platforms based off of an arch much better. llvm-svn: 156354
* Don't expose the pthread_mutex_t underlying the Mutex & Mutex::Locker classes. Jim Ingham2012-05-041-2/+2
| | | | | | | | | | | | | No one was using it and Locker(pthread_mutex_t *) immediately asserts for pthread_mutex_t's that don't come from a Mutex anyway. Rather than try to make that work, we should maintain the Mutex abstraction and not pass around the platform implementation... Make Mutex::Locker::Lock take a Mutex & or a Mutex *, and remove the constructor taking a pthread_mutex_t *. You no longer need to call Mutex::GetMutex to pass your mutex to a Locker (you can't in fact, since I made it private.) llvm-svn: 156221
* No functionality changes, mostly cleanup.Greg Clayton2012-04-111-2/+2
| | | | | | | | Cleaned up the Mutex::Locker and the ReadWriteLock classes a bit. Also cleaned up the GDBRemoteCommunication class to not have so many packet functions. Used the "NoLock" versions of send/receive packet functions when possible for a bit of performance. llvm-svn: 154458
* <rdar://problem/11202426> Greg Clayton2012-04-091-2/+8
| | | | | | Work around a deadlocking issue where "SBDebugger::MemoryPressureDetected ()" is being called and is causing a deadlock. We now just try and get the lock when trying to trim down the unique modules so we don't deadlock debugger GUI programs until we can find the root cause. llvm-svn: 154339
* Platforms can now auto-select themselves if you specify a full target triple ↵Greg Clayton2012-03-201-1/+2
| | | | | | | | when doing a "target create" command. Each platform now knows if it can handle an architecture and a platform can be found using an architecture. Each platform can look at the arch, vendor and OS and know if it should be used or not. llvm-svn: 153104
* Make Debugger::SetLoggingCallback public, and expose it through the SB API. ↵Jim Ingham2012-02-221-0/+11
| | | | | | | | Sometimes it is not convenient to provide a log callback right when the debugger is created. llvm-svn: 151209
* Patch Enrico's changes from r150558 on 2012-02-14 to build even if PythonJason Molenda2012-02-211-0/+4
| | | | | | | | | | | | is not available (LLDB_DISABLE_PYTHON is defined). Change build-swig-Python.sh to emit an empty LLDBPythonWrap.cpp file if this build is LLDB_DISABLE_PYTHON. Change the "Copy to Xcode.app" shell script phase in the lldb.xcodeproj to only do this copying for Mac native builds. llvm-svn: 151035
* Add a logging mode that takes a callback and flush'es to that callback.Jim Ingham2012-02-211-2/+22
| | | | | | Also add SB API's to set this callback, and to enable the log channels. llvm-svn: 151018
* <rdar://problem/10062621>Enrico Granata2012-02-151-0/+146
| | | | | | | | | | | | | | | | | | New public API for handling formatters: creating, deleting, modifying categories, and formatters, and managing type/formatter association. This provides SB classes for each of the main object types involved in providing formatter support: SBTypeCategory SBTypeFilter SBTypeFormat SBTypeSummary SBTypeSynthetic plus, an SBTypeNameSpecifier class that is used on the public API layer to abstract the notion that formatters can be applied to plain type-names as well as to regular expressions For naming consistency, this patch also renames a lot of formatters-related classes. Plus, the changes in how flags are handled that started with summaries is now extended to other classes as well. A new enum (lldb::eTypeOption) is meant to support this on the public side. The patch also adds several new calls to the formatter infrastructure that are used to implement by-index accessing and several other design changes required to accommodate the new API layer. An architectural change is introduced in that backing objects for formatters now become writable. On the public API layer, CoW is implemented to prevent unwanted propagation of changes. Lastly, there are some modifications in how the "default" category is constructed and managed in relation to other categories. llvm-svn: 150558
* SBFrame is now threadsafe using some extra tricks. One issue is that stackGreg Clayton2012-01-301-34/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | frames might go away (the object itself, not the actual logical frame) when we are single stepping due to the way we currently sometimes end up flushing frames when stepping in/out/over. They later will come back to life represented by another object yet they have the same StackID. Now when you get a lldb::SBFrame object, it will track the frame it is initialized with until the thread goes away or the StackID no longer exists in the stack for the thread it was created on. It uses a weak_ptr to both the frame and thread and also stores the StackID. These three items allow us to determine when the stack frame object has gone away (the weak_ptr will be NULL) and allows us to find the correct frame again. In our test suite we had such cases where we were just getting lucky when something like this happened: 1 - stop at breakpoint 2 - get first frame in thread where we stopped 3 - run an expression that causes the program to JIT and run code 4 - run more expressions on the frame from step 2 which was very very luckily still around inside a shared pointer, yet, not part of the current thread (a new stack frame object had appeared with the same stack ID and depth). We now avoid all such issues and properly keep up to date, or we start returning errors when the frame doesn't exist and always responds with invalid answers. Also fixed the UserSettingsController (not going to rewrite this just yet) so that it doesn't crash on shutdown. Using weak_ptr's came in real handy to track when the master controller has already gone away and this allowed me to pull out the previous NotifyOwnerIsShuttingDown() patch as it is no longer needed. llvm-svn: 149231
* rdar://problem/10216227Johnny Chen2011-12-231-1/+1
| | | | | | | | | LLDB (python bindings) Crashing in lldb::SBDebugger::DeleteTarget(lldb::SBTarget&) Need to check the validity of (SBTarget&)target passed to SBDebugger::DeleteTarget() before calling target->Destroy(). llvm-svn: 147213
* <rdar://problem/10584789>Greg Clayton2011-12-151-0/+6
| | | | | | | | | | Added a static memory pressure function in SBDebugger: void SBDebugger::MemoryPressureDetected () This can be called by applications that detect memory pressure to cause LLDB to release cached information. llvm-svn: 146640
* Fixed an issue with the pthread_setspecific() where we weren't NULL-ing outGreg Clayton2011-11-171-1/+1
| | | | | | | | | | | | the thread specific data and were destroying the thread specfic data more than once. Also added the ability to ask a lldb::StateType if it is stopped with an additional paramter of "must_exist" which means that the state must be a stopped state for a process that still exists. This means that eStateExited and eStateUnloaded will no longer return true if "must_exist" is set to true. llvm-svn: 144875
* <rdar://problem/10126482>Greg Clayton2011-11-131-2/+4
| | | | | | | | | | | | | | | Fixed an issues with the SBType and SBTypeMember classes: - Fixed SBType to be able to dump itself from python - Fixed SBType::GetNumberOfFields() to return the correct value for objective C interfaces - Fixed SBTypeMember to be able to dump itself from python - Fixed the SBTypeMember ability to get a field offset in bytes (the value being returned was wrong) - Added the SBTypeMember ability to get a field offset in bits Cleaned up a lot of the Stream usage in the SB API files. llvm-svn: 144493
* Moved lldb::user_id_t values to be 64 bit. This was going to be needed forGreg Clayton2011-10-191-1/+1
| | | | | | | | | | | process IDs, and thread IDs, but was mainly needed for for the UserID's for Types so that DWARF with debug map can work flawlessly. With DWARF in .o files the type ID was the DIE offset in the DWARF for the .o file which is not unique across all .o files, so now the SymbolFileDWARFDebugMap class will make the .o file index part (the high 32 bits) of the unique type identifier so it can uniquely identify the types. llvm-svn: 142534
* Removed lldb::SBSourceManager_impl. We export everything in the lldb namespaceGreg Clayton2011-10-011-0/+5
| | | | | | | and this implemenation that backs our lldb::SBSourceManager should not be exported. llvm-svn: 140930
* Destroy a target when it is deleted.Greg Clayton2011-09-301-0/+1
| | | | llvm-svn: 140845
* After deleting a target, clear the target object and remove orphaned modules.Greg Clayton2011-09-301-0/+2
| | | | llvm-svn: 140843
* Added to the public API to allow symbolication:Greg Clayton2011-09-241-10/+69
| | | | | | | | | | | | | | | | | - New SBSection objects that are object file sections which can be accessed through the SBModule classes. You can get the number of sections, get a section at index, and find a section by name. - SBSections can contain subsections (first find "__TEXT" on darwin, then us the resulting SBSection to find "__text" sub section). - Set load addresses for a SBSection in the SBTarget interface - Set the load addresses of all SBSection in a SBModule in the SBTarget interface - Add a new module the an existing target in the SBTarget interface - Get a SBSection from a SBAddress object This should get us a lot closer to being able to symbolicate using LLDB through the public API. llvm-svn: 140437
OpenPOWER on IntegriCloud