Skip to content
  1. Feb 27, 2012
  2. Feb 26, 2012
    • Greg Clayton's avatar
      Made a ModuleSpec class in Module.h which can specify a module using one or · b9a01b39
      Greg Clayton authored
      more of the local path, platform path, associated symbol file, UUID, arch,
      object name and object offset. This allows many of the calls that were
      GetSharedModule to reduce the number of arguments that were used in a call
      to these functions. It also allows a module to be created with a ModuleSpec
      which allows many things to be specified prior to any accessors being called
      on the Module class itself. 
      
      I was running into problems when adding support for "target symbol add"
      where you can specify a stand alone debug info file after debugging has started
      where I needed to specify the associated symbol file path and if I waited until
      after construction, the wrong  symbol file had already been located. By using
      the ModuleSpec it allows us to construct a module with as little or as much
      information as needed and not have to change the parameter list.
      
      llvm-svn: 151476
      b9a01b39
  3. Feb 24, 2012
    • Greg Clayton's avatar
      Fixed a crasher that was happening after making ObjectFile objects have a · c7f09cca
      Greg Clayton authored
      weak reference back to the Module. We were crashing when trying to make a
      memory object file since it was trying to get the object in the Module 
      constructor before the "Module *" had been put into a shared pointer, and the
      module was trying to initialize a weak pointer back to it.
      
      llvm-svn: 151397
      c7f09cca
    • Greg Clayton's avatar
      <rdar://problem/10103468> · e72dfb32
      Greg Clayton authored
      I started work on being able to add symbol files after a debug session
      had started with a new "target symfile add" command and quickly ran into
      problems with stale Address objects in breakpoint locations that had 
      lldb_private::Section pointers into modules that had been removed or 
      replaced. This also let to grabbing stale modules from those sections. 
      So I needed to thread harded the Address, Section and related objects.
      
      To do this I modified the ModuleChild class to now require a ModuleSP
      on initialization so that a weak reference can created. I also changed
      all places that were handing out "Section *" to have them hand out SectionSP.
      All ObjectFile, SymbolFile and SymbolVendors were inheriting from ModuleChild
      so all of the find plug-in, static creation function and constructors now
      require ModuleSP references instead of Module *. 
      
      Address objects now have weak references to their sections which can
      safely go stale when a module gets destructed. 
      
      This checkin doesn't complete the "target symfile add" command, but it
      does get us a lot clioser to being able to do such things without a high
      risk of crashing or memory corruption.
      
      llvm-svn: 151336
      e72dfb32
    • Enrico Granata's avatar
      This patch provides a set of formatters for most of the commonly used Cocoa classes. · d3d444f8
      Enrico Granata authored
      The formatter for NSString is an improved version of the one previously shipped as an example, the others are new in design and implementation.
      A more robust and OO-compliant Objective-C runtime wrapper is provided for runtime versions 1 and 2 on 32 and 64 bit.
      The formatters are contained in a category named "AppKit", which is not enabled at startup.
      
      llvm-svn: 151299
      d3d444f8
  4. Feb 23, 2012
    • Sean Callanan's avatar
      Added support for looking up the complete type for · 7277284f
      Sean Callanan authored
      Objective-C classes.  This allows LLDB to find
      ivars declared in class extensions in modules other
      than where the debugger is currently stopped (we
      already supported this when the debugger was
      stopped in the same module as the definition).
      
      This involved the following main changes:
      
      - The ObjCLanguageRuntime now knows how to hunt
        for the authoritative version of an Objective-C
        type.  It looks for the symbol indicating a
        definition, and then gets the type from the
        module containing that symbol.
      
      - ValueObjects now report their type with a
        potential override, and the override is set if
        the type of the ValueObject is an Objective-C
        class or pointer type that is defined somewhere
        other than the original reported type.  This
        means that "frame variable" will always use the
        complete type if one is available.
      
      - The ClangASTSource now looks for the complete
        type when looking for ivars.  This means that
        "expr" will always use the complete type if one
        is available.
      
      - I added a testcase that verifies that both
        "frame variable" and "expr" work.
      
      llvm-svn: 151214
      7277284f
  5. Feb 22, 2012
  6. Feb 21, 2012
    • Jim Ingham's avatar
      Forgot to add two files from the last checkin. · 8fdeff25
      Jim Ingham authored
      llvm-svn: 151069
      8fdeff25
    • Jason Molenda's avatar
      Patch Enrico's changes from r150558 on 2012-02-14 to build even if Python · cf7e2dc0
      Jason Molenda authored
      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
      cf7e2dc0
    • Jim Ingham's avatar
      Add a logging mode that takes a callback and flush'es to that callback. · 228063cd
      Jim Ingham authored
      Also add SB API's to set this callback, and to enable the log channels.
      
      llvm-svn: 151018
      228063cd
    • Greg Clayton's avatar
      Thread hardening part 3. Now lldb_private::Thread objects have std::weak_ptr · 1ac04c30
      Greg Clayton authored
      objects for the backlink to the lldb_private::Process. The issues we were
      running into before was someone was holding onto a shared pointer to a 
      lldb_private::Thread for too long, and the lldb_private::Process parent object
      would get destroyed and the lldb_private::Thread had a "Process &m_process"
      member which would just treat whatever memory that used to be a Process as a
      valid Process. This was mostly happening for lldb_private::StackFrame objects
      that had a member like "Thread &m_thread". So this completes the internal
      strong/weak changes.
      
      Documented the ExecutionContext and ExecutionContextRef classes so that our
      LLDB developers can understand when and where to use ExecutionContext and 
      ExecutionContextRef objects.
      
      llvm-svn: 151009
      1ac04c30
  7. Feb 18, 2012
    • Greg Clayton's avatar
      The second part in thread hardening the internals of LLDB where we make · d9e416c0
      Greg Clayton authored
      the lldb_private::StackFrame objects hold onto a weak pointer to the thread
      object. The lldb_private::StackFrame objects the the most volatile objects
      we have as when we are doing single stepping, frames can often get lost or
      thrown away, only to be re-created as another object that still refers to the
      same frame. We have another bug tracking that. But we need to be able to 
      have frames no longer be able to get the thread when they are not part of
      a thread anymore, and this is the first step (this fix makes that possible
      but doesn't implement it yet).
      
      Also changed lldb_private::ExecutionContextScope to return shared pointers to
      all objects in the execution context to further thread harden the internals.
      
      llvm-svn: 150871
      d9e416c0
  8. Feb 17, 2012
    • Greg Clayton's avatar
      This checking is part one of trying to add some threading safety to our · cc4d0146
      Greg Clayton authored
      internals. The first part of this is to use a new class:
      
      lldb_private::ExecutionContextRef
      
      This class holds onto weak pointers to the target, process, thread and frame
      and it also contains the thread ID and frame Stack ID in case the thread and
      frame objects go away and come back as new objects that represent the same
      logical thread/frame. 
      
      ExecutionContextRef objcets have accessors to access shared pointers for
      the target, process, thread and frame which might return NULL if the backing
      object is no longer available. This allows for references to persistent program
      state without needing to hold a shared pointer to each object and potentially
      keeping that object around for longer than it needs to be. 
      
      You can also "Lock" and ExecutionContextRef (which contains weak pointers)
      object into an ExecutionContext (which contains strong, or shared pointers)
      with code like
      
      ExecutionContext exe_ctx (my_obj->GetExectionContextRef().Lock());
      
      llvm-svn: 150801
      cc4d0146
    • Enrico Granata's avatar
      Adding formatters for several useful Objective-C/Cocoa data types. The new... · 864e3e84
      Enrico Granata authored
      Adding formatters for several useful Objective-C/Cocoa data types. The new categories are not enabled at startup, but can be manually activated if desired.
      Adding new API calls to SBValue to be able to retrieve the associated formatters
      Some refactoring to FormatNavigator::Get() in order to shrink its size down to more manageable terms (a future, massive, refactoring effort will still be needed)
      Test cases added for the above
      
      llvm-svn: 150784
      864e3e84
    • Johnny Chen's avatar
      memory read -f X doesn't print anything (lldb should warn when encountering an... · 3517d128
      Johnny Chen authored
      memory read -f X doesn't print anything (lldb should warn when encountering an unsupported byte size)
      Also add a test sequence for it.
      
      rdar://problem/10876841
      
      llvm-svn: 150766
      3517d128
  9. Feb 16, 2012
  10. Feb 15, 2012
    • Enrico Granata's avatar
      <rdar://problem/10062621> · 061858ce
      Enrico Granata authored
      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
      061858ce
  11. Feb 14, 2012
    • Sean Callanan's avatar
      Fixed a bug that caused the description strings · a97aa92a
      Sean Callanan authored
      for assembly instructions to occasionally come
      out empty.
      
      llvm-svn: 150445
      a97aa92a
    • Greg Clayton's avatar
      Full core file support has been added for mach-o core files. · c859e2d5
      Greg Clayton authored
      Tracking modules down when you have a UUID and a path has been improved.
      
      DynamicLoaderDarwinKernel no longer parses mach-o load commands and it
      now uses the memory based modules now that we can load modules from memory.
      
      Added a target setting named "target.exec-search-paths" which can be used
      to supply a list of directories to use when trying to look for executables.
      This allows one or more directories to be used when searching for modules
      that may not exist in the SDK/PDK. The target automatically adds the directory
      for the main executable to this list so this should help us in tracking down
      shared libraries and other binaries. 
      
      llvm-svn: 150426
      c859e2d5
  12. Feb 10, 2012
  13. Feb 09, 2012
    • Greg Clayton's avatar
      First pass at mach-o core file support is in. It currently works for x86_64 · c3776bf2
      Greg Clayton authored
      user space programs. The core file support is implemented by making a process
      plug-in that will dress up the threads and stack frames by using the core file
      memory. 
      
      Added many default implementations for the lldb_private::Process functions so
      that plug-ins like the ProcessMachCore don't need to override many many 
      functions only to have to return an error.
      
      Added new virtual functions to the ObjectFile class for extracting the frozen
      thread states that might be stored in object files. The default implementations
      return no thread information, but any platforms that support core files that
      contain frozen thread states (like mach-o) can make a module using the core
      file and then extract the information. The object files can enumerate the 
      threads and also provide the register state for each thread. Since each object
      file knows how the thread registers are stored, they are responsible for 
      creating a suitable register context that can be used by the core file threads.
      
      Changed the process CreateInstace callbacks to return a shared pointer and
      to also take an "const FileSpec *core_file" parameter to allow for core file
      support. This will also allow for lldb_private::Process subclasses to be made
      that could load crash logs. This should be possible on darwin where the crash
      logs contain all of the stack frames for all of the threads, yet the crash
      logs only contain the registers for the crashed thrad. It should also allow
      some variables to be viewed for the thread that crashed.
      
      llvm-svn: 150154
      c3776bf2
  14. Feb 05, 2012
    • Greg Clayton's avatar
      <rdar://problem/10560053> · c9660546
      Greg Clayton authored
      Fixed "target modules list" (aliased to "image list") to output more information
      by default. Modified the "target modules list" to have a few new options:
      
      "--header" or "-h" => show the image header address
      "--offset" or "-o" => show the image header address offset from the address in the file (the slide applied to the shared library)
      
      Removed the "--symfile-basename" or "-S" option, and repurposed it to 
      "--symfile-unique" "-S" which will show the symbol file if it differs from
      the executable file.
      
      ObjectFile's can now be loaded from memory for cases where we don't have the
      files cached locally in an SDK or net mounted root. ObjectFileMachO can now
      read mach files from memory.
      
      Moved the section data reading code into the ObjectFile so that the object
      file can get the section data from Process memory if the file is only in
      memory.
      
      lldb_private::Module can now load its object file in a target with a rigid 
      slide (very common operation for most dynamic linkers) by using:
      
      bool 
      Module::SetLoadAddress (Target &target, lldb::addr_t offset, bool &changed)
      
      lldb::SBModule() now has a new constructor in the public interface:
      
      SBModule::SBModule (lldb::SBProcess &process, lldb::addr_t header_addr);
      
      This will find an appropriate ObjectFile plug-in to load an image from memory
      where the object file header is at "header_addr".
      
      llvm-svn: 149804
      c9660546
  15. Feb 04, 2012
    • Greg Clayton's avatar
      Convert all python objects in our API to use overload the __str__ method · 81e871ed
      Greg Clayton authored
      instead of the __repr__. __repr__ is a function that should return an
      expression that can be used to recreate an python object and we were using
      it to just return a human readable string.
      
      Fixed a crasher when using the new implementation of SBValue::Cast(SBType).
      
      Thread hardened lldb::SBValue and lldb::SBWatchpoint and did other general
      improvements to the API.
      
      Fixed a crasher in lldb::SBValue::GetChildMemberWithName() where we didn't
      correctly handle not having a target.
      
      llvm-svn: 149743
      81e871ed
  16. Feb 03, 2012
  17. Feb 02, 2012
  18. Jan 31, 2012
  19. Jan 30, 2012
    • 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
  20. 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
  21. 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
    • 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
      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
  22. Jan 26, 2012
  23. Jan 21, 2012
Loading