| #
d7b30ef9 |
| 26-Oct-2012 |
Jim Ingham <[email protected]> |
Add API to get the process plugin name & short name.
llvm-svn: 166799
|
| #
ea561dcf |
| 12-Oct-2012 |
Greg Clayton <[email protected]> |
<rdar://problem/12490558>
SBProcess::SetSelectedThreadByID() had a "uint32_t tid" parameter which would truncate 64 bit thread IDs (lldb::tid_t is 64 bit).
llvm-svn: 165852
|
| #
ccd41e55 |
| 04-Oct-2012 |
Jason Molenda <[email protected]> |
Ran the sources through the compiler with -Wshadow warnings 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 mist
Ran the sources through the compiler with -Wshadow warnings 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
show more ...
|
| #
43e0af06 |
| 18-Sep-2012 |
Greg Clayton <[email protected]> |
Stop using the "%z" size_t modifier and cast all size_t values to uint64_t. Some platforms don't support this modification.
llvm-svn: 164148
|
| #
1f746071 |
| 29-Aug-2012 |
Greg Clayton <[email protected]> |
<rdar://problem/11757916>
Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implem
<rdar://problem/11757916>
Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes: - Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file". - modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly - Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was. - modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile()
Cleaned up header includes a bit as well.
llvm-svn: 162860
show more ...
|
| #
4fc6cb9c |
| 22-Aug-2012 |
Jim Ingham <[email protected]> |
Rework how the API mutex is acquired when filling out an ExecutionContext from an ExecutionContextRef, particularly in the SBThread & SBFrame interfaces. Instead of filling the whole context & then
Rework how the API mutex is acquired when filling out an ExecutionContext from an ExecutionContextRef, particularly in the SBThread & SBFrame interfaces. Instead of filling the whole context & then getting the API mutex, we now get only the target, acquire the API mutex from it, then fill out the rest of the context. This removes a race condition where you get a ThreadSP, then wait on the API mutex while another command Destroy's the Thread you've just gotten. Also fixed the ExecutionContextRef::Get*SP calls so they don't return invalid objects. Also fixed the ExecutionContext::Has*Scope calls so they don't claim to have a scope if the object representing that scope has been destroyed. Also fixed a think-o in Thread::IsValid which was causing it to return the opposite of the desired value.
<rdar://problem/11995490>
llvm-svn: 162401
show more ...
|
| #
cfc0935e |
| 27-Jul-2012 |
Jim Ingham <[email protected]> |
Added an lldb_private & equivalent SB API to send an AsyncInterrupt to the event loop. Convert from calling Halt in the lldb Driver.cpp's input reader's sigint handler to sending this AsyncInterrupt
Added an lldb_private & equivalent SB API to send an AsyncInterrupt to the event loop. Convert from calling Halt in the lldb Driver.cpp's input reader's sigint handler to sending this AsyncInterrupt so it can be handled in the event loop. If you are attaching and get an async interrupt, abort the attach attempt. Also remember to destroy the process if get interrupted while attaching. Getting this to work also required handing the eBroadcastBitInterrupt in a few more places in Process WaitForEvent & friends.
<rdar://problem/10792425>
llvm-svn: 160903
show more ...
|
| #
18b46896 |
| 13-Jul-2012 |
Jim Ingham <[email protected]> |
Add accessors on process to get & set the selected thread by IndexID (useful since that's the one that "thread list" shows and it won't get reused even if the underlying system thread ID gets reused.
Add accessors on process to get & set the selected thread by IndexID (useful since that's the one that "thread list" shows and it won't get reused even if the underlying system thread ID gets reused.
llvm-svn: 160187
show more ...
|
| #
4e0fe8ab |
| 12-Jul-2012 |
Greg Clayton <[email protected]> |
<rdar://problem/11791234>
Fixed a case where the python interpreter could end up holding onto a previous lldb::SBProcess (probably in lldb.process) when run under Xcode. Prior to this fix, the lldb:
<rdar://problem/11791234>
Fixed a case where the python interpreter could end up holding onto a previous lldb::SBProcess (probably in lldb.process) when run under Xcode. Prior to this fix, the lldb::SBProcess held onto a shared pointer to a lldb_private::Process. This in turn could cause the process to still have a thread list with stack frames. The stack frames would have module shared pointers in the lldb_private::SymbolContext objects.
We also had issues with things staying in the shared module list too long when we found things by UUID (we didn't remove the out of date ModuleSP from the global module cache).
Now all of this is fixed and everything goes away between runs.
llvm-svn: 160140
show more ...
|
| #
f9ef60d2 |
| 23-May-2012 |
Johnny Chen <[email protected]> |
Add SBProcess::GetNumSupportedHardwareWatchpoints() API and export it through the Python scripting bridge. Add/modify some test cases.
llvm-svn: 157353
|
|
Revision tags: llvmorg-3.1.0, llvmorg-3.1.0-rc3, llvmorg-3.1.0-rc2, llvmorg-3.1.0-rc1 |
|
| #
c9858e4d |
| 06-Apr-2012 |
Greg Clayton <[email protected]> |
Added logging when API calls try to do something that shouldn't be done when the process is stopped by having logging calls that end with "error: process is running".
Also test for the process to be
Added logging when API calls try to do something that shouldn't be done when the process is stopped by having logging calls that end with "error: process is running".
Also test for the process to be stopped when many SBValue API calls are made to make sure it is safe to evaluate values, children of values and much more.
llvm-svn: 154160
show more ...
|
| #
7fdf9ef1 |
| 05-Apr-2012 |
Greg Clayton <[email protected]> |
Added a new Host class: ReadWriteLock
This abstracts read/write locks on the current host system. It is currently backed by pthread_rwlock_t objects so it should work on all unix systems.
We also n
Added a new Host class: ReadWriteLock
This abstracts read/write locks on the current host system. It is currently backed by pthread_rwlock_t objects so it should work on all unix systems.
We also need a way to control multi-threaded access to the process through the public API when it is running. For example it isn't a good idea to try and get stack frames while the process is running. To implement this, the lldb_private::Process class now contains a ReadWriteLock member variable named m_run_lock which is used to control the public process state. The public process state represents the state of the process as the client knows it. The private is used to control the actual current process state. So the public state of the process can be stopped, yet the private state can be running when evaluating an expression for example.
Adding the read/write lock where readers are clients that want the process to stay stopped, and writers are clients that run the process, allows us to accurately control multi-threaded access to the process.
Switched the SBThread and SBFrame over to us shared pointers to the ExecutionContextRef class instead of making their own class to track this. This fixed an issue with assigning on SBFrame to another and will also centralize the code that tracks weak references to execution context objects into one location.
llvm-svn: 154099
show more ...
|
| #
0e615684 |
| 24-Feb-2012 |
Greg Clayton <[email protected]> |
Added the new way we will eventually do all attaches and launches. First clients will fill out either a SBLaunchInfo or SBAttachInfo class, then call:
SBProcess SBTarget::Launch (SBLaunchInfo &, SBE
Added the new way we will eventually do all attaches and launches. First clients will fill out either a SBLaunchInfo or SBAttachInfo class, then call:
SBProcess SBTarget::Launch (SBLaunchInfo &, SBError &); SBProcess SBTarget::Attach (SBAttachInfo &, SBError &);
The attach is working right now and allows the ability to set many filters such as the parent process ID, the user/group ID, the effective user/group ID, and much more.
The launch is not yet working, but I will get this working soon. By changing our launch and attach calls to take an object, it allows us to add more capabilities to launching and attaching without having to have launch and attach functions that take more and more arguments.
Once this is all working we will deprecated the older launch and attach fucntions and eventually remove them.
llvm-svn: 151344
show more ...
|
| #
4bddaeb5 |
| 16-Feb-2012 |
Jim Ingham <[email protected]> |
Add a general mechanism to wait on the debugger for Broadcasters of a given class/event bit set. Use this to allow the lldb Driver to emit notifications for breakpoint modifications. <rdar://problem/
Add a general mechanism to wait on the debugger for Broadcasters of a given class/event bit set. Use this to allow the lldb Driver to emit notifications for breakpoint modifications. <rdar://problem/10619974>
llvm-svn: 150665
show more ...
|
| #
e6bc6cb9 |
| 08-Feb-2012 |
Jim Ingham <[email protected]> |
Send Breakpoint Changed events for all the relevant changes to breakpoints. Also, provide and use accessors for the thread options on breakpoints so we can control sending the appropriate events.
ll
Send Breakpoint Changed events for all the relevant changes to breakpoints. Also, provide and use accessors for the thread options on breakpoints so we can control sending the appropriate events.
llvm-svn: 150057
show more ...
|
| #
acdbe816 |
| 30-Jan-2012 |
Greg Clayton <[email protected]> |
lldb::SBTarget and lldb::SBProcess are now thread hardened. They both still contain shared pointers to the lldb_private::Target and lldb_private::Process objects respectively as we won't want the tar
lldb::SBTarget and lldb::SBProcess are now thread hardened. They both still contain shared pointers to the lldb_private::Target and lldb_private::Process objects respectively as we won't want the target or process just going away.
Also cleaned up the lldb::SBModule to remove dangerous pointer accessors.
For any code the public API files, we should always be grabbing shared pointers to any objects for the current class, and any other classes prior to running code with them.
llvm-svn: 149238
show more ...
|
| #
b9556acc |
| 30-Jan-2012 |
Greg Clayton <[email protected]> |
SBFrame is now threadsafe using some extra tricks. One issue is that stack frames might go away (the object itself, not the actual logical frame) when we are single stepping due to the way we current
SBFrame is now threadsafe using some extra tricks. One issue is that stack 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
show more ...
|
| #
17a6ad05 |
| 30-Jan-2012 |
Greg Clayton <[email protected]> |
Removed the "lldb-forward-rtti.h" header file as it was designed to contain all RTTI types, and since we don't use RTTI anymore since clang and llvm don't we don't really need this header file. All s
Removed the "lldb-forward-rtti.h" header file as it was designed to contain all RTTI types, and since we don't use RTTI anymore since clang and llvm don't we don't really need this header file. All shared pointer definitions have been moved into "lldb-forward.h".
Defined std::tr1::weak_ptr definitions for all of the types that inherit from enable_shared_from_this() in "lldb-forward.h" in preparation for thread hardening our public API.
The first in the thread hardening check-ins. First we start with SBThread. We have issues in our lldb::SB API right now where if you have one object that is being used by two threads we have a race condition. Consider the following code:
1 int 2 SBThread::SomeFunction() 3 { 4 int result = -1; 5 if (m_opaque_sp) 6 { 7 result = m_opaque_sp->DoSomething(); 8 } 9 return result; 10 }
And now this happens:
Thread 1 enters any SBThread function and checks its m_opaque_sp and is about to execute the code on line 7 but hasn't yet Thread 2 gets to run and class sb_thread.Clear() which calls m_opaque_sp.clear() and clears the contents of the shared pointer member Thread 1 now crashes when it resumes.
The solution is to use std::tr1::weak_ptr. Now the SBThread class contains a lldb::ThreadWP (weak pointer to our lldb_private::Thread class) and this function would look like:
1 int 2 SBThread::SomeFunction() 3 { 4 int result = -1; 5 ThreadSP thread_sp(m_opaque_wp.lock()); 6 if (thread_sp) 7 { 8 result = m_opaque_sp->DoSomething(); 9 } 10 return result; 11 }
Now we have a solid thread safe API where we get a local copy of our thread shared pointer from our weak_ptr and then we are guaranteed it can't go away during our function.
So lldb::SBThread has been thread hardened, more checkins to follow shortly.
llvm-svn: 149218
show more ...
|
| #
e1cd1be6 |
| 29-Jan-2012 |
Greg Clayton <[email protected]> |
Switching back to using std::tr1::shared_ptr. We originally switched away due to RTTI worries since llvm and clang don't use RTTI, but I was able to switch back with no issues as far as I can tell.
Switching back to using std::tr1::shared_ptr. We originally switched away due to RTTI worries since llvm and clang don't use RTTI, but I was able to switch back with no issues as far as I can tell. Once the RTTI issue wasn't an issue, we were looking for a way to properly track weak pointers to objects to solve some of the threading issues we have been running into which naturally led us back to std::tr1::weak_ptr. We also wanted the ability to make a shared pointer from just a pointer, which is also easily solved using the std::tr1::enable_shared_from_this class.
The main reason for this move back is so we can start properly having weak references to objects. Currently a lldb_private::Thread class has a refrence to its parent lldb_private::Process. This doesn't work well when we now hand out a SBThread object that contains a shared pointer to a lldb_private::Thread as this SBThread can be held onto by external clients and if they end up using one of these objects we can easily crash.
So the next task is to start adopting std::tr1::weak_ptr where ever it makes sense which we can do with lldb_private::Debugger, lldb_private::Target, lldb_private::Process, lldb_private::Thread, lldb_private::StackFrame, and many more objects now that they are no longer using intrusive ref counted pointer objects (you can't do std::tr1::weak_ptr functionality with intrusive pointers).
llvm-svn: 149207
show more ...
|
| #
0f28986a |
| 07-Jan-2012 |
Greg Clayton <[email protected]> |
Patch from Enrico Granata that moves SBData related functions into the SBData class instead of requiring a live process in order to be able to create useful SBData objects.
llvm-svn: 147702
|
| #
39c6d0f9 |
| 06-Jan-2012 |
Johnny Chen <[email protected]> |
http://llvm.org/bugs/show_bug.cgi?id=11619 Allow creating SBData values from arrays or primitives in Python
Patch submitted by Enrico Granata.
llvm-svn: 147639
|
| #
e91b7957 |
| 15-Dec-2011 |
Greg Clayton <[email protected]> |
Expose new read memory fucntion through python in SBProcess:
size_t SBProcess::ReadCStringFromMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);
uint64_t SBProcess:
Expose new read memory fucntion through python in SBProcess:
size_t SBProcess::ReadCStringFromMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);
uint64_t SBProcess::ReadUnsignedFromMemory (addr_t addr, uint32_t byte_size, lldb::SBError &error);
lldb::addr_t SBProcess::ReadPointerFromMemory (addr_t addr, lldb::SBError &error);
These ReadCStringFromMemory() has some SWIG type magic that makes it return the python string directly and the "buf" is not needed:
error = SBError() max_cstr_len = 256 cstr = lldb.process.ReadCStringFromMemory (0x1000, max_cstr_len, error) if error.Success(): ....
The other two functions behave as expteced. This will make it easier to get integer values from the inferior process that are correctly byte swapped. Also for pointers, the correct pointer byte size will be used.
Also cleaned up a few printf style warnings for the 32 bit lldb build on darwin.
llvm-svn: 146636
show more ...
|
| #
c91d804a |
| 03-Dec-2011 |
Greg Clayton <[email protected]> |
Fixed some extra warnings that show up with the new clang.
llvm-svn: 145735
|
| #
61e7a58c |
| 01-Dec-2011 |
Greg Clayton <[email protected]> |
Process IDs (lldb::pid_t) and thread IDs (lldb::tid_t) are now 64 bit. This will allow us to represent a process/thread ID using a pointer for the OS plug-ins where they might want to represent the
Process IDs (lldb::pid_t) and thread IDs (lldb::tid_t) are now 64 bit. This will allow us to represent a process/thread ID using a pointer for the OS plug-ins where they might want to represent the process or thread ID using the address of the process or thread structure.
llvm-svn: 145644
show more ...
|
|
Revision tags: llvmorg-3.0.0, llvmorg-3.0.0-rc4 |
|
| #
144f3a9c |
| 15-Nov-2011 |
Greg Clayton <[email protected]> |
Added a new class to Process.h: ProcessAttachInfo. This class contains enough info for us to attach by pid, or by name and will also allow us to eventually do a lot more powerful attaches. If you loo
Added a new class to Process.h: ProcessAttachInfo. This class contains enough info for us to attach by pid, or by name and will also allow us to eventually do a lot more powerful attaches. If you look at the options for the "platform process list" command, there are many options which we should be able to specify. This will allow us to do things like "attach to a process named 'tcsh' that has a parent process ID of 123", or "attach to a process named 'x' which has an effective user ID of 345".
I finished up the --shell implementation so that it can be used without the --tty option in "process launch". The "--shell" option now can take an optional argument which is the path to the shell to use (or a partial name like "sh" which we will find using the current PATH environment variable).
Modified the Process::Attach to use the new ProcessAttachInfo as the sole argument and centralized a lot of code that was in the "process attach" Execute function so that everyone can take advantage of the powerful new attach functionality.
llvm-svn: 144615
show more ...
|