aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/API/SBProcess.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-09-06*** This commit represents a complete reformatting of the LLDB source codeKate Stone1-1467/+1228
*** 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-19Add StructuredData plugin type; showcase with new DarwinLog featureTodd Fiala1-3/+28
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-28/+3
This reverts commit 1d885845d1451e7b232f53fba2e36be67aadabd8. llvm-svn: 279200
2016-08-19Add StructuredData plugin type; showcase with new DarwinLog featureTodd Fiala1-3/+28
See docs/structured_data/StructuredDataPlugins.md for details. differential review: https://reviews.llvm.org/D22976 reviewers: clayborg, jingham llvm-svn: 279198
2016-06-23Add MemoryRegionInfo to SB APIHoward Hellyer1-0/+74
Summary: This adds new SB API calls and classes to allow a user of the SB API to obtain a full list of memory regions accessible within the process. Adding this to the API makes it possible use the API for tasks like scanning memory for blocks allocated with a header and footer to track down memory leaks, otherwise just inspecting every address is impractical especially for 64 bit processes. These changes only add the API itself and a base implementation of GetMemoryRegions() to lldb_private::Process::GetMemoryRegions. I will submit separate patches to fill in lldb_private::Process::GetMemoryRegionInfoList and GetMemoryRegionInfo for individual platforms. The original discussion about this is here: http://lists.llvm.org/pipermail/lldb-dev/2016-May/010203.html Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D20565 llvm-svn: 273547
2016-05-26Make sure to try and take the process stop lock when calling:Greg Clayton1-6/+11
uint32_t SBProcess::GetNumQueues(); SBQueue SBProcess::GetQueueAtIndex (size_t index); Otherwise this code will run when the process is running and cause problems. <rdar://problem/26482744> llvm-svn: 270803
2016-05-19second pass over removal of Mutex and ConditionSaleem Abdulrasool1-34/+34
llvm-svn: 270024
2016-01-13Fix -Wformat-pedantic warningHans Wennborg1-1/+2
/work/llvm-3.8/llvm.src/tools/lldb/source/API/SBProcess.cpp:1003:73: error: format specifies type 'void *' but the argument has type 'lldb_private::Event *' [-Werror,-Wformat-pedantic] log->Printf ("SBProcess::%s (event.sp=%p) => %d", __FUNCTION__, event.get(), ret_val); ~~ ^~~~~~~~~~~ 1 error generated. llvm-svn: 257692
2016-01-05Add logging to SBProcess::GetRestartedFromEventPavel Labath1-1/+8
llvm-svn: 256853
2015-12-08Add a new option to Platform::LoadImage to install the imageTamas Berghammer1-2/+13
This change introduce 3 different working mode for Platform::LoadImage depending on the file specs specified. * If only a remote file is specified then the remote file is loaded on the target (same behavior as before) * If only a local file is specified then the local file is installed to the current working directory and then loaded from there. * If both local and remote file is specified then the local file is installed to the specified location and then loaded from there. The same options are exposed on the SB API with a new method LoadImage method while the old signature presers its meaning. On the command line the installation of the shared library can be specified with the "--install" option of "process load". Differential revision: http://reviews.llvm.org/D15152 llvm-svn: 255014
2015-12-02Fix "process load/unload" on androidTamas Berghammer1-2/+4
On android the symbols exposed by libdl (dlopen, dlclose, dlerror) prefixed by "__dl_". This change moves the handling of process load/unload to the platform object and override it for android to handle the special prefix. Differential revision: http://reviews.llvm.org/D11465 llvm-svn: 254504
2015-11-20Enable saving of mini dumps with lldb process save-core.Adrian McCarthy1-0/+25
Also adds SB API to save a core and tests that use it. Differential Revision: http://reviews.llvm.org/D14793 llvm-svn: 253734
2015-11-20Revert "FOO"Adrian McCarthy1-25/+0
Accidentally commited before I was done. This reverts commit 2ec2da4ee52780582d5e9c88b2e982a688fbdbe1. llvm-svn: 253685
2015-11-20FOOAdrian McCarthy1-0/+25
llvm-svn: 253684
2015-09-22Fix typos.Bruce Mitchener1-1/+1
Summary: Another round of minor typo fixes. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13026 llvm-svn: 248243
2015-07-14Refactor Unix signals.Chaoren Lin1-7/+3
Summary: - Consolidate Unix signals selection in UnixSignals. - Make Unix signals available from platform. - Add jSignalsInfo packet to retrieve Unix signals from remote platform. - Get a copy of the platform signal for each remote process. - Update SB API for signals. - Update signal utility in test suite. Reviewers: ovyalov, clayborg Subscribers: chaoren, jingham, labath, emaste, tberghammer, lldb-commits Differential Revision: http://reviews.llvm.org/D11094 llvm-svn: 242101
2015-05-29Refactor many file functions to use FileSpec over strings.Chaoren Lin1-5/+5
Summary: This should solve the issue of sending denormalized paths over gdb-remote if we stick to GetPath(false) in GDBRemoteCommunicationClient, and let the server handle any denormalization. Reviewers: ovyalov, zturner, vharron, clayborg Reviewed By: clayborg Subscribers: tberghammer, emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D9728 llvm-svn: 238604
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-05-20Fix handling of hijacked events in synchronous modeIlia K1-0/+24
Summary: This patch includes the following changes: * Fix Target::Launch to handle hijacked event in synchronous mode * Improve MiStartupOptionsTestCase tests to expect *stopped (MI) * Add SBProcess::GetStopEventForStopID * Add ProcessModID::SetStopEventForLastNaturalStopID/GetStopEventForStopID * Add const qualifier to ProcessModID::GetLastNaturalStopID * Add SBProcess::GetStopEventForStopID * Don't broadcast hijacked event in Target::Launch * Add CMICmnLLDBDebugger::CheckIfNeedToRebroadcastStopEvent/RebroadcastStopEvent Test Plan: ./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi/startup_options/ Reviewers: zturner, jingham, clayborg, abidh Reviewed By: clayborg Subscribers: abidh, zturner, lldb-commits, clayborg, jingham Differential Revision: http://reviews.llvm.org/D9371 llvm-svn: 237781
2015-05-15Fix a reason of *stopped notifications due to SIGINT/SIGSTOP signals (MI)Ilia K1-0/+6
# Add SBProcess::GetInterruptedFromEvent # Add vrEvent arg in CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStateStopped and CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopSignal # Refactor CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopSignal ## Clean up and fix typos ## Remove vwrbShouldBrk arg # Fix MiSignalTestCase.test_lldbmi_stopped_when_stopatentry_{local,remote} to expect SIGSTOP instead of SIGINT llvm-svn: 237426
2015-04-17Add a "force_kill" arg to Process::Destroy(). This is needed afterJason Molenda1-2/+2
the changes in r233255/r233258. Normally if lldb attaches to a running process, when we call Process::Destroy, we want to detach from the process. If lldb launched the process itself, ::Destroy should kill it. However, if we attach to a process and the driver calls SBProcess::Kill() (which calls Destroy), we need to kill it even if we didn't launch it originally. The force_kill param allows for the SBProcess::Kill method to force the behavior of Destroy. <rdar://problem/20424439> llvm-svn: 235158
2015-03-21Compare pointers directly instead of ::strcmp in SBXxx::EventIsXxxEvent()Ilia K1-1/+1
llvm-svn: 232892
2015-02-11Lock mutex in the same order.Hafiz Abid Qadeer1-2/+2
SBProcess uses 2 mutexex; RunLock and APILock. Apart from 2 places, RunLock is locked before API lock. I have fixed the 2 places where order was different. I observed a deadlock due to this different order in lldb-mi once. Although lldb-mi command and event thread dont run at the same time now. So it can not deadlock there but can still be problem for some other clients. Pre-approved by Greg in http://lists.cs.uiuc.edu/pipermail/lldb-dev/2015-February/006509.html llvm-svn: 228844
2014-10-21Make the "synchronous" mode actually work without race conditions.Greg Clayton1-12/+4
There were many issues with synchronous mode that we discovered when started to try and add a "batch" mode. There was a race condition where the event handling thread might consume events when in sync mode and other times the Process::WaitForProcessToStop() would consume them. This also led to places where the Process IO handler might or might not get popped when it needed to be. llvm-svn: 220254
2014-10-11Add a IsInstrumentationRuntimePresent SB APIKuba Brecka1-0/+15
Reviewed at http://reviews.llvm.org/D5738 This adds an SB API into SBProcess: bool SBProcess::IsInstrumentationRuntimePresent(InstrumentationRuntimeType type); which simply tells whether a particular InstrumentationRuntime (read "ASan") plugin is present and active. llvm-svn: 219560
2014-09-06Implement ASan history threads in SB APIKuba Brecka1-0/+13
Reviewed at http://reviews.llvm.org/D5219 and http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140901/012809.html llvm-svn: 217300
2014-06-23Add API control of the signal disposition.Todd Fiala1-0/+14
See http://reviews.llvm.org/D4221 for details. This commit allows you to control the signals that lldb will suppress, stop or forward using the Python and C++ APIs. Change by Russell Harmon. Xcode build system changes (and any mistakes) by Todd Fiala. Tested on MacOSX 10.9.3 and Xcode 6 beta. (Xcode 5 is hitting the dependency checker crasher on all my systems). llvm-svn: 211526
2014-04-04sweep up -Wformat warnings from gccSaleem Abdulrasool1-153/+155
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-03-29lldb arm64 import.Jason Molenda1-0/+26
These changes were written by Greg Clayton, Jim Ingham, Jason Molenda. It builds cleanly against TOT llvm with xcodebuild. I updated the cmake files by visual inspection but did not try a build. I haven't built these sources on any non-Mac platforms - I don't think this patch adds any code that requires darwin, but please let me know if I missed something. In debugserver, MachProcess.cpp and MachTask.cpp were renamed to MachProcess.mm and MachTask.mm as they picked up some new Objective-C code needed to launch processes when running on iOS. llvm-svn: 205113
2014-03-03"size_t" isn't always 64 bit, it is 32 bit on 32 bit systems. All printf ↵Greg Clayton1-3/+3
style statements that were assuming size_t were 64 bit were changed, and they were also changed to display them as unsigned values as "size_t" isn't signed. If you print anything with 'size_t', please cast it to "uint64_t" in the printf and use PRIu64 or PRIx64. llvm-svn: 202738
2014-03-03Fix Windows build using portable types for formatting the log outputsDeepak Panickal1-1/+1
llvm-svn: 202723
2013-12-13Add new Queue, QueueItem, Queuelist, SBQueue, SBQueueItem classes to representJason Molenda1-0/+47
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
2013-11-12Change SBThread::GetExtendedBacktrace toJason Molenda1-1/+1
SBThread::GetExtendedBacktraceThread to make it more clear what is being returned. llvm-svn: 194531
2013-11-06Rename extended backtrace methods to take out the "ThreadOrigin"Jason Molenda1-5/+5
bit from the method names. <rdar://problem/15314369> llvm-svn: 194122
2013-11-05Add the GetNumThreadOriginExtendedBacktraceTypes andJason Molenda1-0/+35
GetThreadOriginExtendedBacktraceTypeAtIndex methods to SBProcess. Add documentation for the GetQueueName and GetQueueID methods to SBThread. <rdar://problem/15314369> llvm-svn: 194063
2013-10-31Fix the format warnings.Sylvestre Ledru1-1/+1
In almost all cases, the misuse is about "%lu" being used instead of the correct "%zu" (even though these are compatible on 64-bit platforms in practice). There are even a couple of cases where "%ld" (ie., signed int) is used instead of "%zu", and one where "%lu" is used instead of "%" PRIu64. Fixes bug #17551. Patch by "/dev/humancontroller" llvm-svn: 193832
2013-08-28Cleanup/rearrange includes:Virgile Bello1-0/+3
- factorize unistd.h and stdbool.h in lldb-types.h. - Add <functional> and <string> where required. llvm-svn: 189477
2013-06-29Fixed SBProcess::RemoteLaunch() to use the platform executable path. Patch ↵Greg Clayton1-1/+1
from Sebastien Metrot. llvm-svn: 185245
2013-05-10<rdar://problem/13854277>Greg Clayton1-2/+2
<rdar://problem/13594769> Main changes in this patch include: - cleanup plug-in interface and use ConstStrings for plug-in names - Modfiied the BSD Archive plug-in to be able to pick out the correct .o file when .a files contain multiple .o files with the same name by using the timestamp - Modified SymbolFileDWARFDebugMap to properly verify the timestamp on .o files it loads to ensure we don't load updated .o files and cause problems when debugging The plug-in interface changes: Modified the lldb_private::PluginInterface class that all plug-ins inherit from: Changed: virtual const char * GetPluginName() = 0; To: virtual ConstString GetPluginName() = 0; Removed: virtual const char * GetShortPluginName() = 0; - Fixed up all plug-in to adhere to the new interface and to return lldb_private::ConstString values for the plug-in names. - Fixed all plug-ins to return simple names with no prefixes. Some plug-ins had prefixes and most ones didn't, so now they all don't have prefixed names, just simple names like "linux", "gdb-remote", etc. llvm-svn: 181631
2013-05-02Recommitting r180831 with trivial fix - remember to return errors if you ↵Jim Ingham1-1/+9
compute. llvm-svn: 180898
2013-05-01Reverting 180831 as it crashes TestDefaultConstructorForAPIObjects.pyDaniel Malea1-9/+1
llvm-svn: 180868
2013-04-30Added an option to "process detach" to keep the process stopped, if the ↵Jim Ingham1-1/+9
process plugin (or in the case of ProcessGDBRemote the stub we are talking to) know how to do that. rdar://problem/13680832 llvm-svn: 180831
2013-03-27<rdar://problem/13521159>Greg Clayton1-37/+37
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-02-09Reworked the way Process::RunThreadPlan and the ThreadPlanCallFunction ↵Jim Ingham1-0/+12
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
2013-01-18<rdar://problem/13010007>Greg Clayton1-0/+21
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
2013-01-16<rdar://problem/13009943>Greg Clayton1-0/+13
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
2013-01-08Add an SBProcess API to get the current StopID, either considering or ↵Jim Ingham1-0/+15
ignoring stops caused by expression evaluation. <rdar://problem/12968562> llvm-svn: 171914
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-29Resolve printf formatting warnings on Linux:Daniel Malea1-14/+14
- use macros from inttypes.h for format strings instead of OS-specific types Patch from Matt Kopec! llvm-svn: 168945
2012-11-17<rdar://problem/12720514> Sub-TLF: Provide service to profile the inferiorHan Ming Ong1-0/+23
This allows client to query profiling states on the inferior. llvm-svn: 168228