Skip to content
  1. Feb 02, 2012
  2. Feb 01, 2012
    • Johnny Chen's avatar
      Add const-ness to BreakpointLocation::IsEnabled(). · fdad6794
      Johnny Chen authored
      llvm-svn: 149523
      fdad6794
    • Greg Clayton's avatar
      Added many more python convenience accessors: · 6b2bd939
      Greg Clayton authored
      You can now access a frame in a thread using:
      
      lldb.SBThread.frame[int] -> lldb.SBFrame object for a frame in a thread
      
      Where "int" is an integer index. You can also access a list object with all of
      the frames using:
      
      lldb.SBThread.frames => list() of lldb.SBFrame objects
      
      All SB objects that give out SBAddress objects have properties named "addr"
      
      lldb.SBInstructionList now has the following convenience accessors for len() and
      instruction access using an index:
      
      insts = lldb.frame.function.instructions
      for idx in range(len(insts)):
          print insts[idx]
          
      Instruction lists can also lookup an isntruction using a lldb.SBAddress as the key:
      
      pc_inst = lldb.frame.function.instructions[lldb.frame.addr]
      
      lldb.SBProcess now exposes:
      
      lldb.SBProcess.is_alive => BOOL Check if a process is exists and is alive
      lldb.SBProcess.is_running => BOOL check if a process is running (or stepping):
      lldb.SBProcess.is_running => BOOL check if a process is currently stopped or crashed:
      lldb.SBProcess.thread[int] => lldb.SBThreads for a given "int" zero based index
      lldb.SBProcess.threads => list() containing all lldb.SBThread objects in a process
      
      SBInstruction now exposes:
      lldb.SBInstruction.mnemonic => python string for instruction mnemonic
      lldb.SBInstruction.operands => python string for instruction operands
      lldb.SBInstruction.command => python string for instruction comment
      
      SBModule now exposes:
      
      lldb.SBModule.uuid => uuid.UUID(), an UUID object from the "uuid" python module
      lldb.SBModule.symbol[int] => lldb.Symbol, lookup symbol by zero based index
      lldb.SBModule.symbol[str] => list() of lldb.Symbol objects that match "str"
      lldb.SBModule.symbol[re] => list() of lldb.Symbol objecxts that match the regex
      lldb.SBModule.symbols => list() of all symbols in a module
      
        
      SBAddress objects can now access the current load address with the "lldb.SBAddress.load_addr"
      property. The current "lldb.target" will be used to try and resolve the load address.
      
      Load addresses can also be set using this accessor:
      
      addr = lldb.SBAddress()
      addd.load_addr = 0x123023
      
      Then you can check the section and offset to see if the address got resolved.
      
      SBTarget now exposes:
      
      lldb.SBTarget.module[int] => lldb.SBModule from zero based module index
      lldb.SBTarget.module[str] => lldb.SBModule by basename or fullpath or uuid string
      lldb.SBTarget.module[uuid.UUID()] => lldb.SBModule whose UUID matches
      lldb.SBTarget.module[re] => list() of lldb.SBModule objects that match the regex
      lldb.SBTarget.modules => list() of all lldb.SBModule objects in the target
      
      SBSymbol now exposes:
      
      lldb.SBSymbol.name => python string for demangled symbol name
      lldb.SBSymbol.mangled => python string for mangled symbol name or None if there is none
      lldb.SBSymbol.type => lldb.eSymbolType enum value
      lldb.SBSymbol.addr => SBAddress object that represents the start address for this symbol (if there is one)
      lldb.SBSymbol.end_addr => SBAddress for the end address of the symbol  (if there is one)
      lldb.SBSymbol.prologue_size => pythin int containing The size of the prologue in bytes
      lldb.SBSymbol.instructions => SBInstructionList containing all instructions for this symbol
      
      SBFunction now also has these new properties in addition to what is already has:
      lldb.SBFunction.addr => SBAddress object that represents the start address for this function
      lldb.SBFunction.end_addr => SBAddress for the end address of the function
      lldb.SBFunction.instructions => SBInstructionList containing all instructions for this function
      
      SBFrame now exposes the SBAddress for the frame:
      lldb.SBFrame.addr => SBAddress which is the section offset address for the current frame PC
      
      These are all in addition to what was already added. Documentation and website
      updates coming soon.
      
      llvm-svn: 149489
      6b2bd939
    • Johnny Chen's avatar
      lldb should warn when dSYM does not match the binary. · fdc80a5c
      Johnny Chen authored
      o Symbols.cpp:
      
        Emit a warning message when dSYM does not match the binary.
      
      o warnings/uuid:
      
        Added regression test case.
      
      o lldbtest.py:
      
        Modified to allow test case writer to demand that the build command does not begin
        with a clean first; required to make TestUUIDMismatchWanring.py work.
      
      rdar://problem/10515708
      
      llvm-svn: 149465
      fdc80a5c
    • Greg Clayton's avatar
      Added a new class to the lldb python module: · 05e8d194
      Greg Clayton authored
      lldb.value()
      
      It it designed to be given a lldb.SBValue object and it allows natural
      use of a variable value:
      
          pt = lldb.value(lldb.frame.FindVariable("pt"))
          print pt
          print pt.x
          print pt.y
      
          pt = lldb.frame.FindVariable("rectangle_array")
          print rectangle_array[12]
          print rectangle_array[5].origin.x
      
      Note that array access works just fine and works on arrays or pointers:
      
      pt = lldb.frame.FindVariable("point_ptr")
      print point_ptr[5].y
      
      Also note that pointer child accesses are done using a "." instead of "->":
      
      print point_ptr.x
      
      llvm-svn: 149464
      05e8d194
    • Greg Clayton's avatar
      Added fuzz testing for when we call API calls with an invalid object. · fbf1b641
      Greg Clayton authored
      We previously weren't catching that SBValue::Cast(...) would crash
      if we had an invalid (empty) SBValue object.
      
      Cleaned up the SBType API a bit.
      
      llvm-svn: 149447
      fbf1b641
    • Jim Ingham's avatar
      Threads now store their "temporary" resume state, so we know whether they were... · 92087d86
      Jim Ingham authored
      Threads now store their "temporary" resume state, so we know whether they were suspended in the most
      recent step, and if they weren't allowed to run, don't ask questions about their state unless explicitly
      requested to do so.
      
      llvm-svn: 149443
      92087d86
  3. Jan 31, 2012
  4. Jan 30, 2012
    • Johnny Chen's avatar
      Reverted 149277 changeset. It was coded that way for a reason. · 50df1f96
      Johnny Chen authored
      llvm-svn: 149292
      50df1f96
    • Johnny Chen's avatar
      Add "watch set" command as a more general interface in conjunction with "frame var -w". · dedb67ab
      Johnny Chen authored
      Also add test cases for watching a variable as well as a location expressed as an expression.
      
      o TestMyFirstWatchpoint.py:
      
        Modified to test "watchpoint set -w write global".
      
      o TestWatchLocationWithWatchSet.py:
      
        Added to test "watchpoint set -w write -x 1 g_char_ptr + 7" where a contrived example program
        with several threads is supposed to only access the array index within the range [0..6], but
        there's some misbehaving thread writing past the range.
      
      rdar://problem/10701761
      
      llvm-svn: 149280
      dedb67ab
    • Johnny Chen's avatar
      Make BreakpointLocation::IsEnabled() consistent with the... · a5822c05
      Johnny Chen authored
      Make BreakpointLocation::IsEnabled() consistent with the BreakpointLocation::SetEnabled() implementation.
      
      llvm-svn: 149277
      a5822c05
    • Greg Clayton's avatar
      lldb::SBTarget and lldb::SBProcess are now thread hardened. They both still · acdbe816
      Greg Clayton authored
      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
      acdbe816
    • Greg Clayton's avatar
      SBFrame is now threadsafe using some extra tricks. One issue is that stack · b9556acc
      Greg Clayton authored
      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
      b9556acc
    • Greg Clayton's avatar
      Removed the "lldb-forward-rtti.h" header file as it was designed to contain · 17a6ad05
      Greg Clayton authored
      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
      17a6ad05
  5. Jan 29, 2012
    • Greg Clayton's avatar
      Switching back to using std::tr1::shared_ptr. We originally switched away · e1cd1be6
      Greg Clayton authored
      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
      e1cd1be6
    • Greg Clayton's avatar
      Added the ability to get the target triple, byte order and address byte size · 13d1950a
      Greg Clayton authored
      from the SBTarget and SBModule interfaces. Also added many python properties
      for easier access to many things from many SB objects.
      
      llvm-svn: 149191
      13d1950a
  6. Jan 28, 2012
  7. Jan 27, 2012
    • Johnny Chen's avatar
      Add an InstanceSettings::NotifyOwnerIsShuttingDown() method so that the owner... · aefcf999
      Johnny Chen authored
      Add an InstanceSettings::NotifyOwnerIsShuttingDown() method so that the owner can notify InstanceSettings instances
      that their owner reference is no longer valid.
      
      llvm-svn: 149145
      aefcf999
    • Greg Clayton's avatar
      Disable the ConnectionFileDescriptor mutex for now as it is deadlocking our · 9620f466
      Greg Clayton authored
      test suite and I need to investigate this.
      
      llvm-svn: 149141
      9620f466
    • Johnny Chen's avatar
      Fix typo. · f8f0fd76
      Johnny Chen authored
      llvm-svn: 149140
      f8f0fd76
    • Johnny Chen's avatar
      Emit the message about putting ' -- ' between the end of command options and... · 921ca5d4
      Johnny Chen authored
      Emit the message about putting ' -- ' between the end of command options and the raw input conditionally,
      that is, only if the command object does not want completion.  An example is the "settings set" command.
      
      llvm-svn: 149139
      921ca5d4
    • Greg Clayton's avatar
      Added a ModuleList::Destroy() method which will reclaim the std::vector · 29ad7b91
      Greg Clayton authored
      memory by doing a swap.
      
      Also added a few utilty functions that can be enabled for debugging issues
      with modules staying around too long when external clients still have references
      to them.
      
      llvm-svn: 149138
      29ad7b91
    • Greg Clayton's avatar
      Enable extra error checking for debug builds in our mutexes by · ecc61169
      Greg Clayton authored
      watching for errors from pthread_mutex_destroy () (usually "Resource
      busy" errors for when you have a mutex locked and try to destroy
      it), and pthread_mutex_lock, and pthread_mutex_unlock (usually for
      trying to lock an invalid mutex that might have possible already
      been freed).
      
      llvm-svn: 149135
      ecc61169
    • Greg Clayton's avatar
      There is no need to hold onto an ExecutionContext as a member variable. · a73d2692
      Greg Clayton authored
      ExecutionContext objects have shared pointers to Target, Process, Thread
      and Frame objects and they can end up being held onto for too long.
      
      llvm-svn: 149133
      a73d2692
    • Greg Clayton's avatar
      Fixed an issue that could happen during global object destruction in our · b26e6beb
      Greg Clayton authored
      map that tracks all live Module classes. We must leak our mutex for our
      collection class as it might be destroyed in an order we can't control.
      
      llvm-svn: 149131
      b26e6beb
    • Greg Clayton's avatar
      <rdar://problem/10760649> · 23f7793b
      Greg Clayton authored
      Fixed another double file descriptor close issue that could occur when destroying a ProcessGDBRemote() object. There was a race which was detected by our fd_interposing library:
      
      error: /Applications/Xcode.app/Contents/MacOS/Xcode (pid=55222): close (fd=60) resulted in EBADF:
      0   libFDInterposing.dylib              0x00000001082be8ca close$__interposed__ + 666
      1   LLDB                                0x00000001194fde91 lldb_private::ConnectionFileDescriptor::Close(int&, lldb_private::Error*) + 97
      2   LLDB                                0x00000001194fddcd lldb_private::ConnectionFileDescriptor::Disconnect(lldb_private::Error*) + 143
      3   LLDB                                0x00000001194fe249 lldb_private::ConnectionFileDescriptor::Read(void*, unsigned long, unsigned int, lldb::ConnectionStatus&, lldb_private::Error*) + 835
      4   LLDB                                0x00000001194fc320 lldb_private::Communication::Read(void*, unsigned long, unsigned int, lldb::ConnectionStatus&, lldb_private::Error*) + 634
      5   LLDB                                0x000000011959c7f4 GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSecondsNoLock(StringExtractorGDBRemote&, unsigned int) + 228
      6   LLDB                                0x000000011959c6b5 GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSeconds(StringExtractorGDBRemote&, unsigned int) + 49
      7   LLDB                                0x0000000119629a71 GDBRemoteCommunicationClient::SendContinuePacketAndWaitForResponse(ProcessGDBRemote*, char const*, unsigned long, StringExtractorGDBRemote&) + 509
      8   LLDB                                0x00000001195a4076 ProcessGDBRemote::AsyncThread(void*) + 514
      9   LLDB                                0x0000000119568094 ThreadCreateTrampoline(void*) + 91
      10  libsystem_c.dylib                   0x00007fff8ca028bf _pthread_start + 335
      11  libsystem_c.dylib                   0x00007fff8ca05b75 thread_start + 13
      
      fd=60 was previously closed with this event:
      pid=55222: close (fd=60) => 0
      0   libFDInterposing.dylib              0x00000001082be870 close$__interposed__ + 576
      1   LLDB                                0x00000001194fde91 lldb_private::ConnectionFileDescriptor::Close(int&, lldb_private::Error*) + 97
      2   LLDB                                0x00000001194fddcd lldb_private::ConnectionFileDescriptor::Disconnect(lldb_private::Error*) + 143
      3   LLDB                                0x00000001194fbf00 lldb_private::Communication::Disconnect(lldb_private::Error*) + 92
      4   LLDB                                0x00000001195a2a77 ProcessGDBRemote::StopAsyncThread() + 89
      5   LLDB                                0x00000001195a2bf6 ProcessGDBRemote::DoDestroy() + 310
      6   LLDB                                0x00000001195f938d lldb_private::Process::Destroy() + 85
      7   LLDB                                0x0000000118819b48 lldb::SBProcess::Kill() + 72
      8   DebuggerLLDB                        0x0000000117264358 DBGLLDBSessionThread(void*) + 4450
      9   LLDB                                0x0000000119568094 ThreadCreateTrampoline(void*) + 91
      10  libsystem_c.dylib                   0x00007fff8ca028bf _pthread_start + 335
      11  libsystem_c.dylib                   0x00007fff8ca05b75 thread_start + 13
      
      fd=60 was created with this event:
      pid=55222: socket (domain = 2, type = 1, protocol = 6) => fd=60
      0   libFDInterposing.dylib              0x00000001082bc968 socket$__interposed__ + 600
      1   LLDB                                0x00000001194fd75f lldb_private::ConnectionFileDescriptor::ConnectTCP(char const*, lldb_private::Error*) + 179
      .....
      
      llvm-svn: 149103
      23f7793b
    • Greg Clayton's avatar
      <rdar://problem/10750012> · 9ea3fcd8
      Greg Clayton authored
      Remove a pseudo terminal master open and slave file descriptor that was being
      used for pythong stdin. It was not hooked up correctly and was causing file
      descriptor leaks.
      
      llvm-svn: 149098
      9ea3fcd8
  8. Jan 26, 2012
  9. Jan 25, 2012
Loading