Skip to content
  1. Mar 27, 2012
    • Greg Clayton's avatar
      <rdar://problem/11113279> · 84db9105
      Greg Clayton authored
      Fixed type lookups to "do the right thing". Prior to this fix, looking up a type using "foo::bar" would result in a type list that contains all types that had "bar" as a basename unless the symbol file was able to match fully qualified names (which our DWARF parser does not). 
      
      This fix will allow type matches to be made based on the basename and then have the types that don't match filtered out. Types by name can be fully qualified, or partially qualified with the new "bool exact_match" parameter to the Module::FindTypes() method.
      
      This fixes some issue that we discovered with dynamic type resolution as well as improves the overall type lookups in LLDB.
      
      llvm-svn: 153482
      84db9105
  2. Feb 24, 2012
    • 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
  3. 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
  4. 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
  5. Oct 26, 2011
    • Greg Clayton's avatar
      Cleaned up many error codes. For any who is filling in error strings into · 86edbf41
      Greg Clayton authored
      lldb_private::Error objects the rules are:
      - short strings that don't start with a capitol letter unless the name is a
        class or anything else that is always capitolized
      - no trailing newline character
      - should be one line if possible
      
      Implemented a first pass at adding "--gdb-format" support to anything that
      accepts format with optional size/count.
      
      llvm-svn: 142999
      86edbf41
  6. Sep 06, 2011
    • Enrico Granata's avatar
      Redesign of the interaction between Python and frozen objects: · 9128ee2f
      Enrico Granata authored
       - introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
         a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
         in frozen objects ; now such reads transparently move from host to target as required
       - as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
         removed code that enabled to recognize an expression result VO as such
       - introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
         representing a T* or T[], and doing dereferences transparently
         in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
       - as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
         en lieu of doing the raw read itself
       - introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
         this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
         in public layer this returns an SBData, just like GetPointeeData()
       - introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
         the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
         of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
       - added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
      Solved a bug where global pointers to global variables were not dereferenced correctly for display
      New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
      Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
      Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
       of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
       addresses that generate file address children UNLESS we have a live process)
      Updated help text for summary-string
      Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
      Edited the syntax and help for some commands to have proper argument types
      
      llvm-svn: 139160
      9128ee2f
  7. Aug 16, 2011
  8. Aug 13, 2011
    • Jim Ingham's avatar
      Make ValueObject::SetValueFromCString work correctly. · 16e0c686
      Jim Ingham authored
      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
      16e0c686
  9. Aug 02, 2011
    • Enrico Granata's avatar
      Fixed a bug where a variable could not be formatted in a summary if its... · c3e320a7
      Enrico Granata authored
      Fixed a bug where a variable could not be formatted in a summary if its datatype already had a custom format
      Fixed a bug where Objective-C variables coming out of the expression parser could crash the Python synthetic providers:
       - expression parser output has a "frozen data" component, which is a byte-exact copy of the value (in host memory),
         if trying to read into memory based on the host address, LLDB would crash. we are now passing the correct (target)
         pointer to the Python code
      Objective-C "id" variables are now formatted according to their dynamic type, if the -d option to frame variable is used:
       - Code based on the Objective-C 2.0 runtime is used to obtain this information without running code on the target
      
      llvm-svn: 136695
      c3e320a7
  10. Jul 07, 2011
    • Greg Clayton's avatar
      Added "target variable" command that allows introspection of global · 644247c1
      Greg Clayton authored
      variables prior to running your binary. Zero filled sections now get
      section data correctly filled with zeroes when Target::ReadMemory
      reads from the object file section data.
      
      Added new option groups and option values for file lists. I still need
      to hook up all of the options to "target variable" to allow more complete
      introspection by file and shlib.
      
      Added the ability for ValueObjectVariable objects to be created with
      only the target as the execution context. This allows them to be read
      from the object files through Target::ReadMemory(...). 
      
      Added a "virtual Module * GetModule()" function to the ValueObject
      class. By default it will look to the parent variable object and
      return its module. The module is needed when we have global variables
      that have file addresses (virtual addresses that are specific to
      module object files) and in turn allows global variables to be displayed
      prior to running.
      
      Removed all of the unused proxy object support that bit rotted in 
      lldb_private::Value.
      
      Replaced a lot of places that used "FileSpec::Compare (lhs, rhs) == 0" code
      with the more efficient "FileSpec::Equal (lhs, rhs)".
      
      Improved logging in GDB remote plug-in.
      
      llvm-svn: 134579
      644247c1
  11. Jun 30, 2011
  12. Apr 16, 2011
    • Jim Ingham's avatar
      Add support for "dynamic values" for C++ classes. This currently only works... · 78a685aa
      Jim Ingham authored
      Add support for "dynamic values" for C++ classes.  This currently only works for "frame var" and for the
      expressions that are simple enough to get passed to the "frame var" underpinnings.  The parser code will
      have to be changed to also query for the dynamic types & offsets as it is looking up variables.
      
      The behavior of "frame var" is controlled in two ways.  You can pass "-d {true/false} to the frame var
      command to get the dynamic or static value of the variables you are printing.
      
      There's also a general setting:
      
      target.prefer-dynamic-value (boolean) = 'true'
      
      which is consulted if you call "frame var" without supplying a value for the -d option.
      
      llvm-svn: 129623
      78a685aa
  13. Mar 31, 2011
    • Jim Ingham's avatar
      Convert ValueObject to explicitly maintain the Execution Context in which they... · 6035b67d
      Jim Ingham authored
      Convert ValueObject to explicitly maintain the Execution Context in which they were created, and then use that when they update themselves.  That means all the ValueObject evaluate me type functions that used to require a Frame object now do not.  I didn't remove the SBValue API's that take this now useless frame, but I added ones that don't require the frame, and marked the SBFrame taking ones as deprecated.
      
      llvm-svn: 128593
      6035b67d
  14. Jan 21, 2011
  15. Jan 17, 2011
    • Greg Clayton's avatar
      A few of the issue I have been trying to track down and fix have been due to · 6beaaa68
      Greg Clayton authored
      the way LLDB lazily gets complete definitions for types within the debug info.
      When we run across a class/struct/union definition in the DWARF, we will only
      parse the full definition if we need to. This works fine for top level types
      that are assigned directly to variables and arguments, but when we have a 
      variable with a class, lets say "A" for this example, that has a member:
      "B *m_b". Initially we don't need to hunt down a definition for this class
      unless we are ever asked to do something with it ("expr m_b->getDecl()" for
      example). With my previous approach to lazy type completion, we would be able
      to take a "A *a" and get a complete type for it, but we wouldn't be able to
      then do an "a->m_b->getDecl()" unless we always expanded all types within a
      class prior to handing out the type. Expanding everything is very costly and
      it would be great if there were a better way.
      
      A few months ago I worked with the llvm/clang folks to have the 
      ExternalASTSource class be able to complete classes if there weren't completed
      yet:
      
      class ExternalASTSource {
      ....
      
          virtual void
          CompleteType (clang::TagDecl *Tag);
          
          virtual void 
          CompleteType (clang::ObjCInterfaceDecl *Class);
      };
      
      This was great, because we can now have the class that is producing the AST
      (SymbolFileDWARF and SymbolFileDWARFDebugMap) sign up as external AST sources
      and the object that creates the forward declaration types can now also
      complete them anywhere within the clang type system.
      
      This patch makes a few major changes:
      - lldb_private::Module classes now own the AST context. Previously the TypeList
        objects did.
      - The DWARF parsers now sign up as an external AST sources so they can complete
        types.
      - All of the pure clang type system wrapper code we have in LLDB (ClangASTContext,
        ClangASTType, and more) can now be iterating through children of any type,
        and if a class/union/struct type (clang::RecordType or ObjC interface) 
        is found that is incomplete, we can ask the AST to get the definition. 
      - The SymbolFileDWARFDebugMap class now will create and use a single AST that
        all child SymbolFileDWARF classes will share (much like what happens when
        we have a complete linked DWARF for an executable).
        
      We will need to modify some of the ClangUserExpression code to take more 
      advantage of this completion ability in the near future. Meanwhile we should
      be better off now that we can be accessing any children of variables through
      pointers and always be able to resolve the clang type if needed.
      
      llvm-svn: 123613
      6beaaa68
  16. Jan 09, 2011
  17. Jan 08, 2011
  18. Dec 14, 2010
    • Greg Clayton's avatar
      Modified LLDB expressions to not have to JIT and run code just to see variable · 8b2fe6dc
      Greg Clayton authored
      values or persistent expression variables. Now if an expression consists of
      a value that is a child of a variable, or of a persistent variable only, we
      will create a value object for it and make a ValueObjectConstResult from it to
      freeze the value (for program variables only, not persistent variables) and
      avoid running JITed code. For everything else we still parse up and JIT code
      and run it in the inferior. 
      
      There was also a lot of clean up in the expression code. I made the 
      ClangExpressionVariables be stored in collections of shared pointers instead
      of in collections of objects. This will help stop a lot of copy constructors on
      these large objects and also cleans up the code considerably. The persistent
      clang expression variables were moved over to the Target to ensure they persist
      across process executions.
      
      Added the ability for lldb_private::Target objects to evaluate expressions.
      We want to evaluate expressions at the target level in case we aren't running
      yet, or we have just completed running. We still want to be able to access the
      persistent expression variables between runs, and also evaluate constant 
      expressions. 
      
      Added extra logging to the dynamic loader plug-in for MacOSX. ModuleList objects
      can now dump their contents with the UUID, arch and full paths being logged with
      appropriate prefix values.
      
      Thread hardened the Communication class a bit by making the connection auto_ptr
      member into a shared pointer member and then making a local copy of the shared
      pointer in each method that uses it to make sure another thread can't nuke the
      connection object while it is being used by another thread.
      
      Added a new file to the lldb/test/load_unload test that causes the test a.out file
      to link to the libd.dylib file all the time. This will allow us to test using
      the DYLD_LIBRARY_PATH environment variable after moving libd.dylib somewhere else.
      
      llvm-svn: 121745
      8b2fe6dc
  19. Dec 07, 2010
  20. Nov 13, 2010
    • Greg Clayton's avatar
      Modified the lldb_private::Type clang type resolving code to handle three · 526e5afb
      Greg Clayton authored
      cases when getting the clang type:
      - need only a forward declaration
      - need a clang type that can be used for layout (members and args/return types)
      - need a full clang type
      
      This allows us to partially parse the clang types and be as lazy as possible.
      The first case is when we just need to declare a type and we will complete it
      later. The forward declaration happens only for class/union/structs and enums.
      The layout type allows us to resolve the full clang type _except_ if we have
      any modifiers on a pointer or reference (both R and L value). In this case
      when we are adding members or function args or return types, we only need to
      know how the type will be laid out and we can defer completing the pointee
      type until we later need it. The last type means we need a full definition for
      the clang type.
      
      Did some renaming of some enumerations to get rid of the old "DC" prefix (which
      stands for DebugCore which is no longer around).
      
      Modified the clang namespace support to be almost ready to be fed to the
      expression parser. I made a new ClangNamespaceDecl class that can carry around
      the AST and the namespace decl so we can copy it into the expression AST. I
      modified the symbol vendor and symbol file plug-ins to use this new class.
      
      llvm-svn: 118976
      526e5afb
  21. Nov 02, 2010
  22. Oct 25, 2010
    • Sean Callanan's avatar
      Fixes to Objective-C built-in type handling. · a242417a
      Sean Callanan authored
      Specifically, we fixed handling of the objc_class
      built-in type, which allowed us to pass
      named Objective-C objects to functions,
      call variable list -t on objects safely, etc.
      
      llvm-svn: 117249
      a242417a
  23. Oct 15, 2010
    • Greg Clayton's avatar
      Fixed an expression parsing issue where if you were stopped somewhere without · 8f92f0a3
      Greg Clayton authored
      debug information and you evaluated an expression, a crash would occur as a
      result of an unchecked pointer.
      
      Added the ability to get the expression path for a ValueObject. For a rectangle
      point child "x" the expression path would be something like: "rect.top_left.x".
      This will allow GUI and command lines to get ahold of the expression path for
      a value object without having to explicitly know about the hierarchy. This
      means the ValueObject base class now has a "ValueObject *m_parent;" member.
      All ValueObject subclasses now correctly track their lineage and are able
      to provide value expression paths as well.
      
      Added a new "--flat" option to the "frame variable" to allow for flat variable
      output. An example of the current and new outputs:
      
      (lldb) frame variable 
      argc = 1
      argv = 0x00007fff5fbffe80
      pt = {
        x = 2
        y = 3
      }
      rect = {
        bottom_left = {
          x = 1
          y = 2
        }
        top_right = {
          x = 3
          y = 4
        }
      }
      (lldb) frame variable --flat 
      argc = 1
      argv = 0x00007fff5fbffe80
      pt.x = 2
      pt.y = 3
      rect.bottom_left.x = 1
      rect.bottom_left.y = 2
      rect.top_right.x = 3
      rect.top_right.y = 4
      
      
      As you can see when there is a lot of hierarchy it can help flatten things out.
      Also if you want to use a member in an expression, you can copy the text from
      the "--flat" output and not have to piece it together manually. This can help
      when you want to use parts of the STL in expressions:
      
      (lldb) frame variable --flat
      argc = 1
      argv = 0x00007fff5fbffea8
      hello_world._M_dataplus._M_p = 0x0000000000000000
      (lldb) expr hello_world._M_dataplus._M_p[0] == '\0'
      
      llvm-svn: 116532
      8f92f0a3
  24. Sep 29, 2010
    • Greg Clayton's avatar
      Fixed the forward declaration issue that was present in the DWARF parser after · 1be10fca
      Greg Clayton authored
      adding methods to C++ and objective C classes. In order to make methods, we
      need the function prototype which means we need the arguments. Parsing these
      could cause a circular reference that caused an  assertion.
      
      Added a new typedef for the clang opaque types which are just void pointers:
      lldb::clang_type_t. This appears in lldb-types.h.
      
      This was fixed by enabling struct, union, class, and enum types to only get
      a forward declaration when we make the clang opaque qual type for these
      types. When they need to actually be resolved, lldb_private::Type will call
      a new function in the SymbolFile protocol to resolve a clang type when it is
      not fully defined (clang::TagDecl::getDefinition() returns NULL). This allows
      us to be a lot more lazy when parsing clang types and keeps down the amount
      of data that gets parsed into the ASTContext for each module. 
      
      Getting the clang type from a "lldb_private::Type" object now takes a boolean
      that indicates if a forward declaration is ok:
      
          clang_type_t lldb_private::Type::GetClangType (bool forward_decl_is_ok);
          
      So function prototypes that define parameters that are "const T&" can now just
      parse the forward declaration for type 'T' and we avoid circular references in
      the type system.
      
      llvm-svn: 115012
      1be10fca
  25. Sep 28, 2010
  26. Jul 22, 2010
    • Greg Clayton's avatar
      Change over to using the definitions for mach-o types and defines to the · e1a916a7
      Greg Clayton authored
      defines that are in "llvm/Support/MachO.h". This should allow ObjectFileMachO
      and ObjectContainerUniversalMachO to be able to be cross compiled in Linux.
      
      Also did some cleanup on the ASTType by renaming it to ClangASTType and
      renaming the header file. Moved a lot of "AST * + opaque clang type *"
      functionality from lldb_private::Type over into ClangASTType.
      
      llvm-svn: 109046
      e1a916a7
  27. Jul 21, 2010
  28. Jul 09, 2010
  29. Jul 07, 2010
  30. Jun 08, 2010
Loading