aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/API/SBDebugger.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-09-06*** This commit represents a complete reformatting of the LLDB source codeKate Stone1-1091/+846
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
2016-08-24Add api logging for SBDebugger::SetCurrentPlatformSDKRoot.Jason Molenda1-0/+3
<rdar://problem/27857025> llvm-svn: 279611
2016-08-19Add StructuredData plugin type; showcase with new DarwinLog featureTodd Fiala1-1/+1
Take 2, with missing cmake line fixed. Build tested on Ubuntu 14.04 with clang-3.6. See docs/structured_data/StructuredDataPlugins.md for details. differential review: https://reviews.llvm.org/D22976 reviewers: clayborg, jingham llvm-svn: 279202
2016-08-19Revert "Add StructuredData plugin type; showcase with new DarwinLog feature"Todd Fiala1-1/+1
This reverts commit 1d885845d1451e7b232f53fba2e36be67aadabd8. llvm-svn: 279200
2016-08-19Add StructuredData plugin type; showcase with new DarwinLog featureTodd Fiala1-1/+1
See docs/structured_data/StructuredDataPlugins.md for details. differential review: https://reviews.llvm.org/D22976 reviewers: clayborg, jingham llvm-svn: 279198
2016-05-19second pass over removal of Mutex and ConditionSaleem Abdulrasool1-4/+4
llvm-svn: 270024
2016-05-18remove use of Mutex in favour of std::{,recursive_}mutexSaleem Abdulrasool1-2/+2
This is a pretty straightforward first pass over removing a number of uses of Mutex in favor of std::mutex or std::recursive_mutex. The problem is that there are interfaces which take Mutex::Locker & to lock internal locks. This patch cleans up most of the easy cases. The only non-trivial change is in CommandObjectTarget.cpp where a Mutex::Locker was split into two. llvm-svn: 269877
2016-03-07Change over the broadcaster/listener process to hold shared or weak pointersJim Ingham1-3/+3
to each other. This should remove some infrequent teardown crashes when the listener is not the debugger's listener. Processes now need to take a ListenerSP, not a Listener&. This required changing over the Process plugin class constructors to take a ListenerSP, instead of a Listener&. Other than that there should be no functional change. <rdar://problem/24580184> CrashTracer: [USER] Xcode at …ework: lldb_private::Listener::BroadcasterWillDestruct + 39 llvm-svn: 262863
2015-12-18Add API to support retrieving the formatters category for a specific languageEnrico Granata1-0/+10
llvm-svn: 256033
2015-10-31Fix Clang-tidy modernize-use-nullptr warnings in include/lldb/API and ↵Eugene Zelenko1-134/+92
source/API; other minor fixes. Other fixes should reduce number of readability-redundant-smartptr-get and readability-implicit-bool-cast. llvm-svn: 251733
2015-10-30Fix an error message (the debugger was invalid, not the target.)Jim Ingham1-1/+1
llvm-svn: 251720
2015-10-20Rationalization of includes in the data formatters codeEnrico Granata1-0/+1
llvm-svn: 250798
2015-10-20Added support for the "--repl" argument to LLDB. Sean Callanan1-0/+11
This makes LLDB launch and create a REPL, specifying no target so that the REPL can create one for itself. Also added the "--repl-language" option, which specifies the language to use. Plumbed the relevant arguments and errors through the REPL creation mechanism. llvm-svn: 250773
2015-05-29Don't #include "lldb-python.h" from anywhere.Zachary Turner1-2/+0
Since interaction with the python interpreter is moving towards being more isolated, we won't be able to include this header from normal files anymore, all includes of it should be localized to the python library which will live under source/bindings/API/Python after a future patch. None of the files that were including this header actually depended on it anyway, so it was just a dead include in every single instance. llvm-svn: 238581
2015-03-31Rework LLDB system initialization.Zachary Turner1-28/+33
In an effort to reduce binary size for components not wishing to link against all of LLDB, as well as a parallel effort to reduce link dependencies on Python, this patch splits out the notion of LLDB initialization into "full" and "common" initialization. All code related to initializing the full LLDB suite lives directly in API now. Previously it was only referenced from API, but because it was defined in lldbCore, it would get implicitly linked against by everything including lldb-server, causing a considerable increase in binary size. By moving this to the API layer, it also creates a better layering for the ongoing effort to make the embedded interpreter replacable with one from a different language (or even be completely removeable). One semantic change necessary to get this all working was to remove the notion of a shared debugger refcount. The debugger is either initialized or uninitialized now, and calling Initialize() multiple times will simply have no effect, while the first Terminate() will now shut it down no matter how many times Initialize() was called. This behaves nicely with all of our supported usage patterns though, and allows us to fix a number of nasty hacks from before. Differential Revision: http://reviews.llvm.org/D8462 llvm-svn: 233758
2015-03-19Move LLDB initialization/shutdown to Initialization.Zachary Turner1-3/+3
This creates a new top-level folder called Initialization which is intended to hold code specific to LLDB system initialization. Currently this holds the Initialize() and Terminate() functions, as well as the fatal error handler. This provides a means to break the massive dependency cycle which is caused by the fact that Debugger depends on Initialize and Terminate which then depends on the entire LLDB project. With this structure, it will be possible for applications to invoke lldb_private::Initialize() directly, and have that invoke Debugger::Initialize. llvm-svn: 232768
2014-11-13Fixed "SBTarget SBDebugger::CreateTarget (const char *filename)" to use the ↵Greg Clayton1-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
2014-10-14This adds a "batch mode" to lldb kinda like the gdb batch mode. It will ↵Jim Ingham1-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
2014-10-11Rework the way we pass "run multiple command" options to the various API's thatJim Ingham1-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
2014-10-06Revert r219102 as it caused significant buildbot breakageEd Maste1-4/+0
llvm-svn: 219120
2014-10-06Call SBDebugger::Initialize/Terminate from within Create/Destroy.Matthew Gardiner1-0/+4
The above change permits developers using the lldb C++ API to code applications in a more logical manner. llvm-svn: 219102
2014-09-19Test suite runs better again after recent fixes that would select a platform ↵Greg Clayton1-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
2014-08-27Update LLDB to use LLVM's DynamicLibrary.Zachary Turner1-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
2014-05-19Don't allow two threads to both be in SBDebugger::Create() due to threading ↵Greg Clayton1-0/+9
issues in FormatManager. <rdar://problem/16937126> llvm-svn: 209160
2014-04-04sweep up -Wformat warnings from gccSaleem Abdulrasool1-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
2014-01-27Merging the iohandler branch back into main. Greg Clayton1-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
2013-12-02Fixed internal code to not link against and code from "lldb/API/*". Greg Clayton1-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
2013-11-20Expose SBPlatform through the public API.Greg Clayton1-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
2013-09-05Avoid ambiguity between pid_t and lldb::pid_t.Virgile Bello1-1/+1
llvm-svn: 190066
2013-08-23MingW compilation (windows). Includes various refactoring to improve ↵Virgile Bello1-1/+1
portability. llvm-svn: 189107
2013-05-23Add ${ansi.XX} parsing to lldb prompt, use-color setting, and -no-use-colors ↵Michael Sartain1-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
2013-03-27<rdar://problem/13521159>Greg Clayton1-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
2013-01-28<rdar://problem/12978143>Enrico Granata1-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
2012-12-05Fix Linux build warnings due to redefinition of macros:Daniel Malea1-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
2012-11-30Save and restore terminal state when lldb is suspended with SIGTSTP and ↵Jim Ingham1-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
2012-11-29Resolve printf formatting warnings on Linux:Daniel Malea1-2/+2
- use macros from inttypes.h for format strings instead of OS-specific types Patch from Matt Kopec! llvm-svn: 168945
2012-10-18<rdar://problem/12462048>Greg Clayton1-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
2012-10-04Ran the sources through the compiler with -Wshadow warningsJason Molenda1-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
2012-09-18Stop using the "%z" size_t modifier and cast all size_t values to uint64_t. ↵Greg Clayton1-2/+5
Some platforms don't support this modification. llvm-svn: 164148
2012-09-06Fixing a constness issue in an otherwise trivial patchEnrico Granata1-1/+1
llvm-svn: 163352
2012-09-06Restoring an API as deprecated which was removed in a previous commitEnrico Granata1-0/+6
llvm-svn: 163351
2012-08-22Remove further outdated "settings" code and also implement a few missing things.Greg Clayton1-37/+44
llvm-svn: 162376
2012-08-22Reimplemented the code that backed the "settings" in lldb. There were many ↵Greg Clayton1-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
2012-08-20A baton isn't needed to dispatch input.Filipe Cabecinhas1-3/+3
I also added a typemap to make DispatchInput usable in Python. llvm-svn: 162204
2012-06-07Add API logging for SBDebugger::MemoryPressureDetected.Jim Ingham1-0/+7
llvm-svn: 158159
2012-05-08Print out a notification when the process of a target other than the ↵Jim Ingham1-0/+14
currently selected target stops. llvm-svn: 156433
2012-05-08<rdar://problem/11338654> Fixing a bug where having a summary for a bitfield ↵Enrico Granata1-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
2012-05-08<rdar://problem/11358639>Greg Clayton1-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
2012-05-04Don't expose the pthread_mutex_t underlying the Mutex & Mutex::Locker classes. Jim Ingham1-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
2012-04-11No functionality changes, mostly cleanup.Greg Clayton1-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