summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBDebugger.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Adding "-n", "-p" and "-w" flags to the lldb command-line tool toJim Ingham2011-09-131-0/+27
| | | | | | allow attaching from the command line. llvm-svn: 139665
* SBSourceManager now gets the real source manager either from the Debugger or ↵Jim Ingham2011-09-131-4/+3
| | | | | | | | Target. Also, move the SourceManager file cache into the debugger so it can be shared amongst the targets. llvm-svn: 139564
* Move the SourceManager from the Debugger to the Target. That way it can ↵Jim Ingham2011-09-081-1/+1
| | | | | | | | | | store the per-Target default Source File & Line. Set the default Source File & line to main (if it can be found.) at startup. Selecting the current thread & or frame resets the current source file & line, and "source list" as well as the breakpoint command "break set -l <NUM>" will use the current source file. llvm-svn: 139323
* Fixed some SWIG interoperability issuesEnrico Granata2011-08-191-0/+5
| | | | llvm-svn: 138154
* Remember to restore the frame in the exe_ctx passed in to RunThreadPlan.Jim Ingham2011-08-131-1/+1
| | | | | | | Also, default "source_init_file" to False in the version of SBDebugger::Create so that we don't pick up the init file in Python. llvm-svn: 137545
* Add a version of SBDebugger::Create which allows us to specify whether to sourceJim Ingham2011-08-131-0/+19
| | | | | | in the init files or not. llvm-svn: 137541
* Make ValueObject::SetValueFromCString work correctly.Jim Ingham2011-08-121-0/+7
| | | | | | | | | | | | | | | | Also change the SourceInitFile to look for .lldb-<APPNAME> and source that preferentially if it exists. Also made the breakpoint site report its address as well as its breakpoint number when it gets hit and can't find any the associated locations (usually because the breakpoint got disabled or deleted programmatically between the time it was hit and reported.) Changed ThreadPlanCallFunction to initialize the ivar m_func in the initializers of the constructor, rather than waiting to initialize till later on in the function. Fixed a bug where if you make an SBError and the ask it Success, it returns false. Fixed ValueObject::ResolveValue so that it resolves a temporary value, rather than overwriting the one in the value object. llvm-svn: 137536
* Added the notion of an system root for SDKs. This is a directory where allGreg Clayton2011-06-171-0/+16
| | | | | | | | | | | | | | | | libraries and headers exist. This can be specified using the platform select function: platform select --sysroot /Volumes/remote-root remote-macosx Each platform subclass is free to interpret the sysroot as needed. Expose the new SDK root directory through the SBDebugger class. Fixed an issue with the GDB remote protocol where unimplemented packets were not being handled correctly. llvm-svn: 133231
* Add an API to SBDebugger class:Johnny Chen2011-06-151-0/+18
| | | | | | | | | | | | | | | | | bool SBDebugger::DeleteTarget(lldb::SBTarget &target); which is used in the test tearDown() phase to cleanup the debugger's target list so that it won't grow larger and larger as test cases are executed. This is also a good opportunity to get rid of the arcane requirement that test cases exercising the Python API must assign the process object to self.process so that it gets shutdown gracefully. Instead, the shutdown of the process associated with each target is now being now automatically. Also get rid of an API from SBTarget class: SBTarget::DeleteTargetFromList(lldb_private::TargetList *list); llvm-svn: 133091
* Don't have the debugger default to ignoring EOF. This is only what the driverGreg Clayton2011-05-291-0/+14
| | | | | | | | (or anything running in a terminal) wants. Not what a UI (Xcode) would want where it creates a debugger per debug window. The current code had an infinite loop after a debug session ended. llvm-svn: 132280
* Make sure writing asynchronous output only backs upCaroline Tice2011-05-091-0/+18
| | | | | | | & overwrites prompt if the IOChannel input reader is the top input reader. llvm-svn: 131110
* This patch captures and serializes all output being written by theCaroline Tice2011-05-021-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | command line driver, including the lldb prompt being output by editline, the asynchronous process output & error messages, and asynchronous messages written by target stop-hooks. As part of this it introduces a new Stream class, StreamAsynchronousIO. A StreamAsynchronousIO object is created with a broadcaster, who will eventually broadcast the stream's data for a listener to handle, and an event type indicating what type of event the broadcaster will broadcast. When the Write method is called on a StreamAsynchronousIO object, the data is appended to an internal string. When the Flush method is called on a StreamAsynchronousIO object, it broadcasts it's data string and clears the string. Anything in lldb-core that needs to generate asynchronous output for the end-user should use the StreamAsynchronousIO objects. I have also added a new notification type for InputReaders, to let them know that a asynchronous output has been written. This is to allow the input readers to, for example, refresh their prompts and lines, if desired. I added the case statements to all the input readers to catch this notification, but I haven't added any code for handling them yet (except to the IOChannel input reader). llvm-svn: 130721
* Added the ability to set the Platform path for a module through the SBModuleGreg Clayton2011-04-301-0/+20
| | | | | | | | | | | | | | interface. Added a quick way to set the platform though the SBDebugger interface. I will actually an a SBPlatform support soon, but for now this will do. ConnectionFileDescriptor can be passed a url formatted as: "fd://<fd>" where <fd> is a file descriptor in the current process. This is handy if you have services, deamons, or other tools that can spawn processes and give you a file handle. llvm-svn: 130565
* Add 'lldb_private' namespace where necessary to prevent ambiguity andCaroline Tice2011-04-251-3/+3
| | | | | | resulting infinite loops. llvm-svn: 130159
* Fixed an issue where if you specify an architecture from the command line like:Greg Clayton2011-04-181-43/+47
| | | | | | | | | | $ lldb --arch i386-unknown-unknown a.out It would then create a target with only the "i386" part due to SBDebugger::GetDefaultArchitecture(...) truncating the arch triple due to the way things used to be. llvm-svn: 129731
* Modified the ArchSpec to take an optional "Platform *" when setting the triple.Greg Clayton2011-04-071-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fixed the LLDB build so that we can have private types, private enums andGreg Clayton2011-03-241-3/+6
| | | | | | | | 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
* Abtracted the innards of lldb-core away from the SB interface. There was someGreg Clayton2011-03-221-0/+2
| | | | | | | | | | | | | | | | 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
* LLDB now has "Platform" plug-ins. Platform plug-ins are plug-ins that provideGreg Clayton2011-03-081-31/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | an interface to a local or remote debugging platform. By default each host OS that supports LLDB should be registering a "default" platform that will be used unless a new platform is selected. Platforms are responsible for things such as: - getting process information by name or by processs ID - finding platform files. This is useful for remote debugging where there is an SDK with files that might already or need to be cached for debug access. - getting a list of platform supported architectures in the exact order they should be selected. This helps the native x86 platform on MacOSX select the correct x86_64/i386 slice from universal binaries. - Connect to remote platforms for remote debugging - Resolving an executable including finding an executable inside platform specific bundles (macosx uses .app bundles that contain files) and also selecting the appropriate slice of universal files for a given platform. So by default there is always a local platform, but remote platforms can be connected to. I will soon be adding a new "platform" command that will support the following commands: (lldb) platform connect --name machine1 macosx connect://host:port Connected to "machine1" platform. (lldb) platform disconnect macosx This allows LLDB to be well setup to do remote debugging and also once connected process listing and finding for things like: (lldb) process attach --name x<TAB> The currently selected platform plug-in can now auto complete any available processes that start with "x". The responsibilities for the platform plug-in will soon grow and expand. llvm-svn: 127286
OpenPOWER on IntegriCloud