Skip to content
  1. Apr 05, 2012
    • Sean Callanan's avatar
      Fixed a problem where we did not read properties · a658226a
      Sean Callanan authored
      correctly if the setter/getter were not present
      in the debug information.  The fixes are as follows:
      
      - We not only look for the method by its full name,
        but also look for automatically-generated methods
        when searching for a selector in an Objective-C
        interface.  This is necessary to find accessors.
      
      - Extract the getter and setter name from the
        DW_TAG_APPLE_Property declaration in the DWARF
        if they are present; generate them if not.
      
      llvm-svn: 154067
      a658226a
  2. 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
  3. Mar 21, 2012
  4. Mar 20, 2012
  5. Mar 15, 2012
    • Sean Callanan's avatar
      Strengthened LLDB's completion of object types. · cf12862a
      Sean Callanan authored
      Now when LLDB reports a variable, it has a
      complete type.  Similarly, when it reports
      members of a struct, it completes their types.
      Also, when it creates the result variable for
      an expression, it ensures that variable's type
      is complete.
      
      This ensures compliance with Clang's
      expectations, preventing potential crashes.
      
      llvm-svn: 152771
      cf12862a
  6. Feb 27, 2012
  7. 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
  8. Feb 10, 2012
  9. Feb 06, 2012
  10. Feb 04, 2012
    • Sean Callanan's avatar
      I have brought LLDB up-to-date with top of tree · 5b26f27f
      Sean Callanan authored
      LLVM/Clang.  This brings in several fixes, including:
      
      - Improvements in the Just-In-Time compiler's
        allocation of memory: the JIT now allocates
        memory in chunks of sections, improving its
        ability to generate relocations.  I have
        revamped the RecordingMemoryManager to reflect
        these changes, as well as to get the memory
        allocation and data copying out fo the
        ClangExpressionParser code.  Jim Grosbach wrote
        the updates to the JIT on the LLVM side.
      
      - A new ExternalASTSource interface to allow LLDB to
        report accurate structure layout information to
        Clang.  Previously we could only report the sizes
        of fields, not their offsets.  This meant that if
        data structures included field alignment
        directives, we could not communicate the necessary
        alignment to Clang and accesses to the data would
        fail.  Now we can (and I have update the relevant
        test case).  Thanks to Doug Gregor for implementing
        the Clang side of this fix.
      
      - The way Objective-C interfaces are completed by
        Clang has been made consistent with RecordDecls;
        with help from Doug Gregor and Greg Clayton I have
        ensured that this still works.
      
      - I have eliminated all local LLVM and Clang patches,
        committing the ones that are still relevant to LLVM
        and Clang as needed.
      
      I have tested the changes extensively locally, but
      please let me know if they cause any trouble for you.
      
      llvm-svn: 149775
      5b26f27f
  11. 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
  12. Jan 19, 2012
    • Sean Callanan's avatar
      Fixed a problem where maintaining the ObjCInterfaceMap · a9bc0656
      Sean Callanan authored
      for each ObjCInterfaceDecl was imposing performance
      penalties for Objective-C apps.  Instead, we now use
      the normal function query mechanisms, which use the
      relevant accelerator tables.
      
      This fix also includes some modifications to the
      SymbolFile which allow us to find Objective-C methods
      and report their Clang Decls correctly.
      
      llvm-svn: 148457
      a9bc0656
  13. Jan 13, 2012
  14. Dec 19, 2011
    • Sean Callanan's avatar
      Added some strength to the checks that prevent · bfb7c68b
      Sean Callanan authored
      "id" from being found by the parser as an
      externally-defined type.  Before, "id" would
      sometimes make it through if it was defined in
      a namespace, but this sometimes caused
      confusion, for example when it conflicted with
      std::locale::id.
      
      llvm-svn: 146891
      bfb7c68b
  15. Dec 14, 2011
    • Sean Callanan's avatar
      This commit is the result of a general audit of · fc4f2fb0
      Sean Callanan authored
      the expression parser to locate instances where
      dyn_cast<>() and isa<>() are used on types, and
      replace them with getAs<>() as appropriate.
      
      The difference is that dyn_cast<>() and isa<>()
      are essentially LLVM/Clang's equivalent of RTTI
      -- that is, they try to downcast the object and
      return NULL if they cannot -- but getAs<>() can
      traverse typedefs to perform a semantic cast.
      
      llvm-svn: 146537
      fc4f2fb0
  16. Dec 09, 2011
    • Sean Callanan's avatar
      If the expression parser is unable to complete a TagDecl · 12014a04
      Sean Callanan authored
      in the context in which it was originally found, the
      expression parser now goes hunting for it in all modules
      (in the appropriate namespace, if applicable).  This means
      that forward-declared types that exist in another shared
      library will now be resolved correctly.
      
      Added a test case to cover this.  The test case also tests
      "frame variable," which does not have this functionality
      yet.
      
      llvm-svn: 146204
      12014a04
  17. Dec 08, 2011
  18. Dec 07, 2011
    • Sean Callanan's avatar
      Fixed a few details of method lookup in Objective-C · 610baf42
      Sean Callanan authored
      symbols.  Now we find the correct method.
      
      Unfortunately we don't get the superclass from the
      runtime yet so the method doesn't import correctly
      (and I added a check to make sure that doesn't hurt
      us) but once we get that information right we will
      report methods correctly to the parser as well.
      
      Getting superclass information requires a common AST
      context for all Objective-C runtime information,
      meaning that the superclass and the subclass are in
      the same AST context in all cases.  That is the next
      thing that needs to be done here.
      
      llvm-svn: 146089
      610baf42
  19. Dec 06, 2011
    • Sean Callanan's avatar
      As part of the work to make Objective-C type information · 0eed0d42
      Sean Callanan authored
      from symbols more accessible, I have added a second
      map to the ClangASTImporter: the ObjCInterfaceMetaMap.
      This map keeps track of all type definitions found for
      a particular Objective-C interface, allowing the
      ClangASTSource to refer to all possible sources when
      looking for method definitions.
      
      There is a bug in lookup that I still need to figure out,
      but after that we should be able to report full method
      information for Objective-C classes shown in symbols.
      
      Also fixed some errors I ran into when enabling the maps
      for the persistent type store.  The persistent type store
      previously did not use the ClangASTImporter to import
      types, instead using ASTImporters that got allocated each
      time a type needed copying.  To support the requirements
      of the persistent type store -- namely, that types must be
      copied, completed, and then completely severed from their
      origin in the parser's AST context (which will go away) --
      I added a new function called DeportType which severs all
      these connections.
      
      llvm-svn: 145914
      0eed0d42
  20. Dec 01, 2011
    • Sean Callanan's avatar
      Modified clients of ClangASTImporter to be more robust · e0a64f73
      Sean Callanan authored
      in the face of failures to import types, since blithely
      passing on NULL types can sometimes lead to trouble.
      
      Also eliminated a use of getAs and replaced it with
      dyn_cast, which is more robust.
      
      llvm-svn: 145628
      e0a64f73
    • Johnny Chen's avatar
      rdar://problem/10501020 · 60e2c6aa
      Johnny Chen authored
      ClangASTSource::~ClangASTSource() was calling
      
          ClangASTContext *scratch_clang_ast_context = m_target->GetScratchClangASTContext();
      
      which had the side effect of deleting this very ClangASTSource instance.  Not good.
      Change it to
      
          // We are in the process of destruction, don't create clang ast context on demand
          // by passing false to Target::GetScratchClangASTContext(create_on_demand).
          ClangASTContext *scratch_clang_ast_context = m_target->GetScratchClangASTContext(false);
      
      The Target::GetScratchClangASTContext(bool create_on_demand=true) has a new signature.
      
      llvm-svn: 145537
      60e2c6aa
  21. Nov 30, 2011
    • Sean Callanan's avatar
      Added support to the Objective-C language runtime · 09ab4b77
      Sean Callanan authored
      to find Objective-C class types by looking in the
      symbol tables for the individual object files.
      
      I did this as follows:
      
      - I added code to SymbolFileSymtab that vends
        Clang types for symbols matching the pattern
        "_OBJC_CLASS_$_NSMyClassName," making them
        appear as Objective-C classes.  This only occurs
        in modules that do not have debug information,
        since otherwise SymbolFileDWARF would be in
        charge of looking up types.
      
      - I made a new SymbolVendor subclass for the
        Apple Objective-C runtime that is in charge of
        making global lookups of Objective-C types.  It
        currently just sends out type lookup requests to
        the appropriate SymbolFiles, but in the future we
        will probably extend it to query the runtime more
        completely.
      
      I also modified a testcase whose behavior is changed
      by the fact that we now actually return an Objective-C
      type for __NSCFString.
      
      llvm-svn: 145526
      09ab4b77
  22. Nov 29, 2011
  23. Nov 18, 2011
    • Sean Callanan's avatar
      This commit completes the rearchitecting of ClangASTSource · 00f43622
      Sean Callanan authored
      to allow variables in the persistent variable store to know
      how to complete themselves from debug information.  That
      fixes a variety of bugs during dematerialization of 
      expression results and also makes persistent variable and
      result variables ($foo, $4, ...) more useful.
      
      I have also added logging improvements that make it much
      easier to figure out how types are moving from place to 
      place, and made some checking a little more aggressive.
      
      The commit includes patches to Clang which are currently being
      integrated into Clang proper; once these fixes are in Clang
      top-of-tree, these patches will be removed.  The patches don't
      fix API; rather, they fix some internal bugs in Clang's 
      ASTImporter that were exposed when LLDB was moving types from
      place to place multiple times.
      
      llvm-svn: 144969
      00f43622
  24. Nov 16, 2011
    • Sean Callanan's avatar
      I made the ClangASTImporter owned by the target · 686b2319
      Sean Callanan authored
      rather than individually on behalf of each
      ASTContext.  This allows the ASTImporter to know
      about all containers of types, which will let it
      be smarter about forwarding information about
      type origins.  That means that the following
      sequence of steps will be possible (after a few
      more changes):
      
      - Import a type from a Module's ASTContext into
        an expression parser ASTContext, tracking its
        origin information -- this works now.
      
      - Because the result of the expression uses that
        type, import it from the expression parser
        ASTContext into the Target's scratch AST
        context, forwarding the origin information --
        this needs to be added.
      
      - For a later expression that uses the result,
        import the type from the Target's scratch AST
        context, still forwarding origin information
        -- this also needs to be added.
      
      - Use the intact origin information to complete
        the type as needed -- this works now if the
        origin information is present.
      
      To this end, I made the following changes:
      
      - ASTImporter top-level copy functions now
        require both a source and a destination AST
        context parameter.
      
      - The ASTImporter now knows how to purge
        records related to an ASTContext that is
        going away.
      
      - The Target now owns and creates the ASTImporter
        whenever the main executable changes or (in the
        absence of a main executable) on demand.
      
      llvm-svn: 144802
      686b2319
  25. Nov 15, 2011
    • Sean Callanan's avatar
      Eliminated a compile warning by removing dyn_cast · 100d74e2
      Sean Callanan authored
      where isa is good enough.
      
      llvm-svn: 144704
      100d74e2
    • Sean Callanan's avatar
      Pulled in a new version of LLVM/Clang to solve a variety · d5c17edb
      Sean Callanan authored
      of problems with Objective-C object completion.  To go
      along with the LLVM/Clang-side fixes, we have a variety
      of Objective-C improvements.
      
      Fixes include:
      
      - It is now possible to run expressions when stopped in
        an Objective-C class method and have "self" act just
        like "self" would act in the class method itself (i.e.,
        [self classMethod] works without casting the return
        type if debug info is present).  To accomplish this,
        the expression masquerades as a class method added by
        a category.
      
      - Objective-C objects can now provide methods and
        properties and methods to Clang on demand (i.e., the
        ASTImporter sets hasExternalVisibleDecls on Objective-C
        interface objects).
      
      - Objective-C built-in types, which had long been a bone
        of contention (should we be using "id"?  "id*"?), are
        now fetched correctly using accessor functions on
        ClangASTContext.  We inhibit searches for them in the
        debug information.
      
      There are also a variety of logging fixes, and I made two
      changes to the test suite:
      
      - Enabled a test case for Objective-C properties in the
        current translation unit.
      
      - Added a test case for calling Objective-C class methods
        when stopped in a class method.
      
      llvm-svn: 144607
      d5c17edb
  26. Nov 14, 2011
  27. Nov 11, 2011
  28. Nov 09, 2011
    • Sean Callanan's avatar
      Added a function to ClangASTSource to service · 0730e9c9
      Sean Callanan authored
      lookups for Objective-C methods by selector.
      Right now all it does is print log information.
      
      Also improved the logging for imported TagDecls
      to indicate whether or not the definition for
      the imported TagDecl is complete.
      
      llvm-svn: 144203
      0730e9c9
  29. Oct 29, 2011
    • Sean Callanan's avatar
      Cloned FindExternalVisibleDecls from · fb3e4306
      Sean Callanan authored
      ClangExpressionDeclMap to ClangASTSource, and
      moved all general type and namespace lookups
      into ClangASTSource.  Now ClangASTSource is ready
      to complete types given nothing more than a target
      and an AST context.
      
      llvm-svn: 143292
      fb3e4306
    • Sean Callanan's avatar
      Moved FindExternalLexicalDecls and a few smaller · ba0aca72
      Sean Callanan authored
      functions from ClangExpressionDeclMap to ClangASTSource.
      
      llvm-svn: 143276
      ba0aca72
    • Sean Callanan's avatar
      I moved the responsibility for interacting with the · 1ee44b74
      Sean Callanan authored
      AST importer on completing namespace mappings from
      ClangExpressionDeclMap to ClangASTSource.
      
      ClangASTSource now contains a TargetSP which it
      uses to lookup namespaces in all of a target's
      modules.  I will use the TargetSP in the future to
      look up globals.
      
      llvm-svn: 143275
      1ee44b74
    • Sean Callanan's avatar
      As part of a general refactoring of ClangASTSource to · eddeb3b9
      Sean Callanan authored
      allow it to complete types on behalf of any AST context
      (including the "scratch" AST context associated with
      the target), I scrapped its role as intermediary between
      the Clang parser and ClangExpressionDeclMap, and instead
      made ClangExpressionDeclMap inherit from ClangASTSource.
      
      After this, I will migrate the functions that complete
      types and perform namespace lookups from
      ClangExpressionDeclMap to ClangASTSource.  Ultimately
      ClangExpressionDeclMap's only responsiblity will be to
      look up variables and ensure that they are materialized
      and dematerialized correctly.
      
      llvm-svn: 143253
      eddeb3b9
  30. Oct 12, 2011
    • Sean Callanan's avatar
      Implemented a namespace map that allows searching · 503aa525
      Sean Callanan authored
      of namespaces (only in the modules where they've
      been found) for entities inside those namespaces.
      
      For each NamespaceDecl that has been imported into
      the parser, we maintain a map containing
      [ModuleSP, ClangNamespaceDecl] pairs in the ASTImporter.
      This map has one entry for each module in which the
      namespace has been found.  When we later scan for an
      entity inside a namespace, we search only the modules
      in which that namespace was found.
      
      Also made a small whitespace fix in 
      ClangExpressionParser.cpp.
      
      llvm-svn: 141748
      503aa525
  31. Oct 08, 2011
  32. Sep 17, 2011
    • Greg Clayton's avatar
      Convert lldb::ModuleSP to use an instrusive ref counted pointer. · 747bcb03
      Greg Clayton authored
      We had some cases where getting the shared pointer for a module from
      the global module list was causing a performance issue when debugging
      with DWARF in .o files. Now that the module uses intrusive ref counts,
      we can easily convert any pointer to a shared pointer.
      
      llvm-svn: 139983
      747bcb03
  33. Jul 30, 2011
    • Sean Callanan's avatar
      This change brings in the latest LLVM/Clang, and · cc427fad
      Sean Callanan authored
      completes the support in the LLDB expression parser
      for incomplete types.  Clang now imports types
      lazily, and we complete those types as necessary.
      
      Changes include:
      
      - ClangASTSource now supports three APIs which it
        passes to ClangExpressionDeclMap.  CompleteType
        completes a TagDecl or an ObjCInterfaceDecl when
        needed; FindExternalVisibleDecls finds named
        entities that are visible in the expression's
        scope; and FindExternalLexicalDecls performs a
        (potentially restricted) search for entities
        inside a lexical scope like a namespace.  These
        changes mean that entities in namespaces should
        work normally.
      
      - The SymbolFileDWARF code for searching a context
        for a specific name is now more general, and can
        search arbitrary contexts.
      
      - We are continuing to adapt our calls into LLVM
        from interfaces that take start and end iterators
        when accepting multiple items to interfaces that
        use ArrayRef.
      
      - I have cleaned up some code, especially our use
        of namespaces.
      
      This change is neutral for our testsuite and greatly
      improves correctness for large programs (like Clang)
      with complicated type systems.  It should also lay
      the groundwork for improving the expression parser's
      performance as we are lazier and lazier about
      providing type information.
      
      llvm-svn: 136555
      cc427fad
  34. Jun 25, 2011
    • Greg Clayton's avatar
      This commit adds broad architectural support for hierarchical · a2721476
      Greg Clayton authored
      inspection of namespaces in the expression parser.
      
      ClangExpressionDeclMap hitherto reported that namespaces had
      been completely imported, even though the namespaces are
      returned empty.  To deal with this situation, ClangASTSource
      was recently extended with an API to complete incomplete type
      definitions, and, for greater efficiency, to complete these
      definitions partially, returning only those objects that have
      a given name.
      
      This commit supports these APIs on LLDB's side, and uses it
      to provide information on types resident in namespaces.
      Namespaces are now imported as they were -- that is to say,
      empty -- but with minimal import mode on.  This means that
      Clang will come back and request their contents by name as
      needed.  We now respond with information on the contained
      types; this will be followed soon by information on functions
      and variables.
      
      llvm-svn: 133852
      a2721476
  35. May 13, 2011
    • Sean Callanan's avatar
      Introduced support for UnknownAnyTy, the Clang type · 77502265
      Sean Callanan authored
      representing variables whose type must be inferred
      from the way they are used.  Functions without debug
      information now return UnknownAnyTy and must be cast.
      
      Variables with no debug information are not yet using
      UnknownAnyTy; instead they are assumed to be void*.
      Support for variables of unknown type is coming (and,
      in fact, some relevant support functions are included
      in this commit) but will take a bit of extra effort.
      
      The testsuite has also been updated to reflect the new
      requirement that the result of printf be cast, i.e.
      
      expr (int) printf("Hello world!")
      
      llvm-svn: 131263
      77502265
Loading