Skip to content
  1. Jan 04, 2012
  2. Dec 22, 2011
  3. Dec 21, 2011
    • Sean Callanan's avatar
      The "desired result type" code in the expression · 20bb3aa5
      Sean Callanan authored
      parser has hitherto been an implementation waiting
      for a use.  I have now tied the '-o' option for
      the expression command -- which indicates that the
      result is an Objective-C object and needs to be
      printed -- to the ExpressionParser, which
      communicates the desired type to Clang.
      
      Now, if the result of an expression is determined
      by an Objective-C method call for which there is
      no type information, that result is implicitly
      cast to id if and only if the -o option is passed
      to the expression command.  (Otherwise if there
      is no explicit cast Clang will issue an error.
      This behavior is identical to what happened before
      r146756.)
      
      Also added a testcase for -o enabled and disabled.
      
      llvm-svn: 147099
      20bb3aa5
  4. 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
  5. Dec 17, 2011
    • Jim Ingham's avatar
      Remove an unnecessary #include. · 105d7234
      Jim Ingham authored
      llvm-svn: 146798
      105d7234
    • Johnny Chen's avatar
      http://llvm.org/bugs/show_bug.cgi?id=11588 · b456b792
      Johnny Chen authored
      valobj.AddressOf() returns None when an address is expected in a SyntheticChildrenProvider
      
      Patch from Enrico Granata:
      
      The problem was that the frozen object created by the expression parser was a copy of the contents of the StgClosure, rather than a pointer to it. Thus, the expression parser was correctly computing the result of the arithmetic&cast operation along with its address, but only saving it in the live object. This meant that the frozen copy acted as an address-less variable, hence the problem.
      
      The fix attached to this email lets the expression parser store the "live address" in the frozen copy of the address when the object is built without a valid address of its own.
      Doing so, along with delegating ValueObjectConstResult to calculate its own address when necessary, solves the issue. I have also added a new test case to check for regressions in this area, and checked that existing test cases pass correctly.
      
      llvm-svn: 146768
      b456b792
  6. Dec 16, 2011
    • Sean Callanan's avatar
      Updated Clang to take an enhancement to the way · bb12004c
      Sean Callanan authored
      we handle Objective-C method calls.  Currently,
      LLDB treats the result of an Objective-C method
      as unknown if the type information doesn't have
      the method's signature.  Now Clang can cast the
      result to id if it isn't explicitly cast.
      
      I also added a test case for this, as well as a
      fix for a type import problem that this feature
      exposed.
      
      llvm-svn: 146756
      bb12004c
  7. 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
  8. Dec 13, 2011
    • Sean Callanan's avatar
      I have modified the part of the code that finds and · d5cc132b
      Sean Callanan authored
      validates the "self," "this," and "_cmd" pointers
      that get passed into expressions.  It used to check
      them aggressively for validity before allowing the
      expression to run as an object method; now, this
      functionality is gated by a bool and off by default.
      
      Now the default is that when LLDB is stopped in a
      method of a class, code entered using "expr" will
      always masquerade as an instance method.  If for
      some reason "self," "this," or "_cmd" is unavailable
      it will be reported as NULL.  This may cause the
      expression to crash if it relies on those pointers,
      but for example getting the addresses of ivars will
      now work as the user would expect.
      
      llvm-svn: 146465
      d5cc132b
  9. Dec 10, 2011
    • Sean Callanan's avatar
      Fixed a problem where if a frame was present the · fd1ba911
      Sean Callanan authored
      expression parser would never try getting typed
      variables from the target.
      
      llvm-svn: 146317
      fd1ba911
    • Sean Callanan's avatar
      Two fixes for file variables: · 9b3569ba
      Sean Callanan authored
      - Even if a frame isn't present, we always try
        to use FindGlobalVariable to find variables.
        Instead of using frame->TrackGlobalVariable()
        to promote the VariableSP into a ValueObject,
        we now simply use ValueObjectVariable.
      
      - When requesting the value of a variable, we
        allow returning of the "live version" of the
        variable -- that is, the variable in the
        target instead of a pointer to its freeze
        dried version in LLDB -- even if there is no
        process present.
      
      llvm-svn: 146315
      9b3569ba
  10. 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
  11. Dec 08, 2011
  12. 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
    • Sean Callanan's avatar
      Fixed a potential crasher if the frame is not · ae6d6141
      Sean Callanan authored
      avalable when a global variable is looked up.
      In ClangExpressionDeclMap, a frame should usually
      be available.
      
      llvm-svn: 146066
      ae6d6141
    • Jim Ingham's avatar
      Fix assert string to be more informative. · b3527409
      Jim Ingham authored
      llvm-svn: 146061
      b3527409
  13. 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
  14. Dec 03, 2011
    • Greg Clayton's avatar
      Added the ability for clients to grab a set of symbol table indexes and then · 1075acaf
      Greg Clayton authored
      add them to a fast lookup map. lldb_private::Symtab now export the following
      public typedefs:
      
      namespace lldb_private {
      
      	class Symtab {
      		typedef std::vector<uint32_t> IndexCollection;
      		typedef UniqueCStringMap<uint32_t> NameToIndexMap;
      	};
      }
      
      Clients can then find symbols by name and or type and end up with a 
      Symtab::IndexCollection that is filled with indexes. These indexes can then
      be put into a name to index lookup map and control if the mangled and 
      demangled names get added to the map:
      
      bool add_demangled = true;
      bool add_mangled = true;
      Symtab::NameToIndexMap name_to_index;
      symtab->AppendSymbolNamesToMap (indexes, add_demangled, add_mangled, name_to_index).
      
      This can be repeated as many times as needed to get a lookup table that
      you are happy with, and then this can be sorted:
      
      name_to_index.Sort();
      
      Now name lookups can be done using a subset of the symbols you extracted from
      the symbol table. This is currently being used to extract objective C types
      from object files when there is no debug info in SymbolFileSymtab.
      
      Cleaned up how the objective C types were being vended to be more efficient
      and fixed some errors in the regular expression that was being used.
      
      llvm-svn: 145777
      1075acaf
    • Greg Clayton's avatar
      Added new symbol types for Objective C classes, metaclasses, and ivars. Each · 456809c1
      Greg Clayton authored
      object file can correctly make these symbols which will abstract us from the
      file format and ABI and we can then ask for the objective C class symbol for
      a class and find out which object file it was defined in.
      
      llvm-svn: 145744
      456809c1
  15. 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
    • Sean Callanan's avatar
      Picked up a new revision of Clang to pull in Objective-C · a5230ce3
      Sean Callanan authored
      enhancements.  With these enhancements, the return values
      of Objective-C methods with unknown return types can be
      implicitly cast to id for the purpose of making method
      calls.
      
      So what would have required this:
      
      (int)[(id)[ClassWithNoDebugInfo methodReturningObject] methodReturningInt]
      
      can now be written as:
      
      (int)[[ClassWithNoDebugInfo methodReturningObject] methodReturningInt]
      
      llvm-svn: 145567
      a5230ce3
    • Greg Clayton's avatar
      <rdar://problem/10507811> · eaeaf6f9
      Greg Clayton authored
      Avoid a crash for the new DW_OP_stack_value and DW_OP_implicit_value opcodes
      that was due to an assertion.
      
      llvm-svn: 145564
      eaeaf6f9
    • Jim Ingham's avatar
      If we are going to assert due to an unhanded opcode, stuff the opcode value... · f220d593
      Jim Ingham authored
      If we are going to assert due to an unhanded opcode, stuff the opcode value into the CrashReporter string first.
      
      llvm-svn: 145558
      f220d593
    • Sean Callanan's avatar
      Made symbol lookup in the expression parser more · 947ccc73
      Sean Callanan authored
      robust:
      
      - Now a client can specify what kind of symbols
        are needed; notably, this allows looking up
        Objective-C class symbols specifically.
      
      - In the class of symbols being looked up, if
        one is non-NULL and others are NULL, LLDB now
        prefers the non-NULL one.
      
      llvm-svn: 145554
      947ccc73
    • 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
  16. 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
  17. Nov 29, 2011
  18. Nov 19, 2011
    • Sean Callanan's avatar
      Pulled in a new revision of LLVM/Clang and added · 7f27d604
      Sean Callanan authored
      several patches.  These patches fix a problem
      where templated types were not being completed the
      first time they were used, and fix a variety of
      minor issues I discovered while fixing that problem.
      
      One of the previous local patches was resolved in
      the most recent Clang, so I removed it.  The others
      will be removed in due course.
      
      llvm-svn: 144984
      7f27d604
  19. 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
  20. 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
    • Sean Callanan's avatar
      Fixed a crash when we merrily went on to try to log · ed8d58fc
      Sean Callanan authored
      information about a nonexistent function declaration.
      
      llvm-svn: 144744
      ed8d58fc
    • Sean Callanan's avatar
      Two fixes for Objetive-C methods that return struct · a6cbf06d
      Sean Callanan authored
      types.  First, I added handling for the memset intrinsic
      in the IR, which is used to zero out the returned struct.
      Second, I fixed the object-checking instrumentation
      to objc_msgSend_stret, and generally tightened up how
      the object-checking functions get inserted.
      
      llvm-svn: 144741
      a6cbf06d
  21. 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
      Fixed a bug where the variable-resolution code · fe5d139b
      Sean Callanan authored
      would occasionally try to resolve the placeholder
      variable used for static data allocation.
      
      llvm-svn: 144677
      fe5d139b
    • 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
  22. Nov 14, 2011
Loading