Skip to content
  1. 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
  2. Dec 08, 2011
  3. 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
  4. 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
  5. 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
  6. 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
  7. Nov 29, 2011
  8. 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
  9. 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
  10. 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
  11. Nov 14, 2011
  12. Nov 11, 2011
  13. 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
  14. 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
  15. 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
  16. Oct 08, 2011
  17. 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
  18. 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
  19. 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
  20. 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
  21. Mar 15, 2011
  22. Jan 27, 2011
  23. Jan 23, 2011
  24. Jan 19, 2011
  25. 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
  26. Dec 13, 2010
    • Sean Callanan's avatar
      Added support for generating expressions that have · 17827830
      Sean Callanan authored
      access to the members of the Objective-C self object.
      
      The approach we take is to generate the method as a
      @category on top of the self object, and to pass the
      "self" pointer to it.  (_cmd is currently NULL.)
      
      Most changes are in ClangExpressionDeclMap, but the
      change that adds support to the ABIs to pass _cmd
      touches a fair amount of code.
      
      llvm-svn: 121722
      17827830
  27. Dec 03, 2010
    • Sean Callanan's avatar
      Fixed object lifetimes in ClangExpressionDeclMap · 979f74d1
      Sean Callanan authored
      so that it is not referring to potentially stale
      state during IR execution.
      
      This was done by introducing modular state (like
      ClangExpressionVariable) where groups of state
      variables have well-defined lifetimes:
      
      - m_parser_vars are specific to parsing, and only
        exist between calls to WillParse() and DidParse().
      
      - m_struct_vars survive for the entire execution
        of the ClangExpressionDeclMap because they
        provide the template for a materialized set of
        expression variables.
      
      - m_material_vars are specific to a single
        instance of materialization, and only exist
        between calls to Materialize() and
        Dematerialize().
      
      I also removed unnecessary references to long-
      lived state that really didn't need to be referred
      to at all, and also introduced several assert()s
      that helped me diagnose a few bugs (fixed too).
      
      llvm-svn: 120778
      979f74d1
  28. Nov 30, 2010
  29. Nov 18, 2010
  30. Nov 15, 2010
  31. Nov 13, 2010
    • Greg Clayton's avatar
      Got namespace lookup working and was able to print a complex "this" as an · 580c5dac
      Greg Clayton authored
      expression. This currently takes waaaayyyyy too much time to evaluate. We will
      need to look at the expression parser and find ways to optimize the info we
      provide and get this to evaluate quicker. I believe the performance issue is
      currently related to us always providing a complete C++ class type when asked
      about a C++ class which can cause a lot of information to be pulled since all
      classes will be fully created (methods, base classes, members, all their 
      types). We will need to give the classes back the parser and mark them as 
      having external sources and get parser (Sema) to query us when it needs more
      info. This should bring things up to an acceptable level.
      
      llvm-svn: 118979
      580c5dac
  32. Oct 29, 2010
  33. Oct 16, 2010
    • Greg Clayton's avatar
      Made many ConstString functions inlined in the header file. · 7b462cc1
      Greg Clayton authored
      Changed all of our synthesized "___clang" functions, types and variables
      that get used in expressions over to have a prefix of "$_lldb". Now when we
      do name lookups we can easily switch off of the first '$' character to know
      if we should look through only our internal (when first char is '$') stuff,
      or when we should look through program variables, functions and types.
      
      Converted all of the clang expression code over to using "const ConstString&" 
      values for names instead of "const char *" since there were many places that
      were converting the "const char *" names into ConstString names and them
      throwing them away. We now avoid making a lot of ConstString conversions and
      benefit from the quick comparisons in a few extra spots.
      
      Converted a lot of code from LLVM coding conventions into LLDB coding 
      conventions.
      
      llvm-svn: 116634
      7b462cc1
  34. Oct 15, 2010
  35. Oct 13, 2010
    • Greg Clayton's avatar
      Fixed C++ class clang type creation and display by making sure we omit · 24739923
      Greg Clayton authored
      artifical members (like the vtable pointer member that shows up in the DWARF).
      We were adding this to each class which was making all member variables be off
      by a pointer size.
      
      Added a test case so we can track this with "test/forward".
      
      Fixed the type name index in DWARF to include all the types after finding
      some types were being omitted due to the DW_AT_specification having the
      DW_AT_declaration attribute which was being read into the real type instances
      when there were forward declarations in the DWARF, causing the type to be
      omitted. We now check to make sure any DW_AT_declaration values are only
      respected when parsing types if the attribute is from the current DIE.
      
      After fixing the missing types, we ran into some issues with the expression
      parser finding duplicate entries for __va_list_tag since they are built in
      types and would result in a "duplicate __va_list_tag definition" error. We
      are now just ignoring this name during lookup, but we will need to see if
      we can get the name lookup function to not get called in these cases.
      
      Fixed an issue that would cause an assertion where DW_TAG_subroutine_types
      that had no children, would not properly make a clang function type of:
      "void (*) (void)".
      
      llvm-svn: 116392
      24739923
Loading