Skip to content
  1. Nov 29, 2011
  2. 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
  3. Nov 16, 2011
  4. Nov 15, 2011
    • 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
  5. Nov 13, 2011
    • Greg Clayton's avatar
      <rdar://problem/10338439> · 2fc93eab
      Greg Clayton authored
      This is the actual fix for the above radar where global variables that weren't
      initialized were not being shown correctly when leaving the DWARF in the .o 
      files. Global variables that aren't intialized have symbols in the .o files
      that specify they are undefined and external to the .o file, yet document the
      size of the variable. This allows the compiler to emit a single copy, but makes
      it harder for our DWARF in .o files with the executable having a debug map
      because the symbol for the global in the .o file doesn't exist in a section
      that we can assign a fixed up linked address to, and also the DWARF contains
      an invalid address in the "DW_OP_addr" location (always zero). This means that
      the DWARF is incorrect and actually maps all such global varaibles to the
      first file address in the .o file which is usually the first function. So we
      can fix this in either of two ways: make a new fake section in the .o file
      so that we have a file address in the .o file that we can relink, or fix the 
      the variable as it is created in the .o file DWARF parser and actually give it
      the file address from the executable. Each variable contains a 
      SymbolContextScope, or a single pointer that helps us to recreate where the
      variables came from (which module, file, function, etc). This context helps
      us to resolve any file addresses that might be in the location description of
      the variable by pointing us to which file the file address comes from, so we
      can just replace the SymbolContextScope and also fix up the location, which we
      would have had to do for the other case as well, and update the file address.
      Now globals display correctly.
      
      The above changes made it possible to determine if a variable is a global
      or static variable when parsing DWARF. The DWARF emits a DW_TAG_variable tag
      for each variable (local, global, or static), yet DWARF provides no way for
      us to classify these variables into these categories. We can now detect when
      a variable has a simple address expressions as its location and this will help
      us classify these correctly.
      
      While making the above changes I also noticed that we had two symbol types:
      eSymbolTypeExtern and eSymbolTypeUndefined which mean essentially the same
      thing: the symbol is not defined in the current object file. Symbol objects
      also have a bit that specifies if a symbol is externally visible, so I got
      rid of the eSymbolTypeExtern symbol type and moved all code locations that
      used it to use the eSymbolTypeUndefined type.
       
      
      llvm-svn: 144489
      2fc93eab
  6. Nov 08, 2011
  7. Nov 03, 2011
  8. Nov 02, 2011
    • Sean Callanan's avatar
      Updated LLVM/Clang to pull in an MCJIT fix that · c832475c
      Sean Callanan authored
      allows us to set __attribute__ ((used)) on expressions
      that masquerade as methods.  When we are stopped in
      classes in anonymous namespaces, this fix (and enabling
      __attribute__ ((used)) on the method) will allow
      expressions to run.
      
      llvm-svn: 143560
      c832475c
    • Sean Callanan's avatar
      Sometimes the debug information includes artifically- · dbb58399
      Sean Callanan authored
      generated special member functions (constructors,
      destructors, etc.) for classes that don't really have
      them.  We needed to mark these as artificial to reflect
      the debug information; this bug does that for
      constructors and destructors.
      
      The "etc." case (certain assignment operators, mostly)
      remains to be fixed.
      
      llvm-svn: 143526
      dbb58399
  9. Nov 01, 2011
    • Sean Callanan's avatar
      Added the capability (turned off for now) to mark a · c1b732d7
      Sean Callanan authored
      method as __attribute__ ((used)) when adding it to a
      class.  This functionality is useful when stopped in
      anonymous namespaces: expressions attached to classes
      in anonymous namespaces are typically elided by Clang's
      CodeGen because they have no namespaces are intended
      not to be externally visible.  __attribute__ ((used))
      forces CodeGen to emit the function.
      
      Right now, __attribute__ ((used)) causes the JIT not to
      emit the function, so we're not enabling it until we
      fix that.
      
      llvm-svn: 143469
      c1b732d7
  10. 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
  11. Oct 28, 2011
  12. Oct 27, 2011
  13. Oct 26, 2011
    • Sean Callanan's avatar
      Extended the IR interpreter to handle the variables · d2cb626a
      Sean Callanan authored
      "_cmd", "this", and "self".  These variables are handled
      differently from all other external variables used by
      the expression.  Other variables are used indirectly
      through the $__lldb_arg operand; only _cmd, this, and
      self are passed directly through the ABI.
      
      There are two modifications:
      
       - I added a function to ClangExpressionDeclMap that
         retrives the value of one of these variables by name;
         and
      
       - I made IRInterpreter fetch these values when needed,
         and ensured that the proper level of indirection is
         used.
      
      llvm-svn: 143065
      d2cb626a
  14. Oct 25, 2011
    • Sean Callanan's avatar
      Fixed a problem where local variables conflict with · efa7d1f1
      Sean Callanan authored
      types of the same name.  If a local variable with the
      given name is found (and we are not searching a
      specific namespace) we stop right then and there and
      report it.
      
      llvm-svn: 142962
      efa7d1f1
    • Sean Callanan's avatar
      Improved handling of static data in the expression · c70ed46d
      Sean Callanan authored
      parser.  Now expression like the following work as
      expected:
      
      -
      (lldb) expr struct { int a; int b; } $blah = { 10, 20 }
      <no result>
      (lldb) expr $blah
      (<anonymous struct at Parse:6:5>) $blah = {
        (int) a = 10
        (int) b = 20
      }
      -
      
      Now the IRForTarget subsystem knows how to handle
      static initializers of various composite types.
      
      Also removed an unnecessary parameter from
      ClangExpressionDeclMap::GetFunctionInfo.
      
      llvm-svn: 142936
      c70ed46d
    • Sean Callanan's avatar
      Fixed our handling of const functions, compensating · f463856f
      Sean Callanan authored
      for debug information that occasionally gets the
      const-ness of member functions wrong.  We used to
      demangle the name, add "const," and remangle it; now
      we handle the mangled name directly, which is more
      robust.
      
      llvm-svn: 142933
      f463856f
  15. Oct 22, 2011
  16. Oct 21, 2011
  17. Oct 20, 2011
  18. Oct 18, 2011
  19. Oct 14, 2011
    • Sean Callanan's avatar
      Improved expression logging. Now all calls to · 7dd98126
      Sean Callanan authored
      FindExternalVisibleDecls and FindExternalLexicalDecls
      are marked and given unique IDs, so that all logging
      done as part of their execution can be traced back to
      the proper call.
      
      Also there was some logging that really wasn't helpful
      in most cases so I disabled it unless verbose logging
      (log enable -v lldb expr) is enabled.
      
      llvm-svn: 141987
      7dd98126
    • Sean Callanan's avatar
      Improved logging for FindExternalLexicalDecls to · 187de461
      Sean Callanan authored
      make it easier to track down which members belong
      to which structs (and which call to 
      FindExternalLexicalDecls is doing the reporting).
      
      llvm-svn: 141930
      187de461
    • Sean Callanan's avatar
      Cleaned up a few functions that never get used. · c6bba3e4
      Sean Callanan authored
      Specifically, the expression parser used to use
      functions attached to SymbolContext to do lookups,
      but nowadays it searches a ModuleList or Module
      directly instead.  These functions had no
      remaining clients so I removed them to prevent
      bit rot.
      
      I also removed a stray callback function from
      ClangExpressionDeclMap.
      
      llvm-svn: 141899
      c6bba3e4
  20. Oct 13, 2011
    • Sean Callanan's avatar
      Enabled the namespace-specific search functionality, · ebe6067a
      Sean Callanan authored
      which had previously been commented out while I tested
      it.  It's not fully working yet, but it doesn't break
      our testsuite and it's an important piece of
      functionality.
      
      Also added some logging to SymbolFileDWARF to help
      diagnose entities that are found in a symbol file,
      but do not reside in the expected namespace.
      
      llvm-svn: 141894
      ebe6067a
    • Sean Callanan's avatar
      Moved the list of found namespaces into the search · c41e68b1
      Sean Callanan authored
      context object.  Having it populated and registered
      within a single FindExternalVisibleDecls call worked
      fine when there was only one call (i.e., when we were
      just looking in the global namespace).  
      
      However, now FindExternalVisibleDecls is called for
      nested namespaces as well, which means that it is
      called not once but many times (once per module in
      which the parent namespace appears).  This means that
      the namespace mapping is built up across many calls
      to the inferior FindExternalVisibleDecls, so I moved
      it into a data structure (the search context) that is
      shared by all calls.
      
      I also added some logging to make it easier to see
      what is happening during a namespace search, and 
      cleaned up some existing logging.
      
      llvm-svn: 141888
      c41e68b1
    • Sean Callanan's avatar
      Removed namespace qualification from symbol queries. · b96ff33b
      Sean Callanan authored
      llvm-svn: 141866
      b96ff33b
    • Sean Callanan's avatar
      Completed the glue that passes a ClangNamespaceDecl * · 213fdb8b
      Sean Callanan authored
      down through Module and SymbolVendor into SymbolFile.
      Added checks to SymbolFileDWARF that restrict symbol
      searches when a namespace is passed in.
      
      llvm-svn: 141847
      213fdb8b
    • Sean Callanan's avatar
      Now that we know the values are going to stick around, · 8e5b8b96
      Sean Callanan authored
      we don't need to look them up again when materializing.
      
      Switched over the materialization mechanism (for JIT
      expressions) and the lookup mechanism (for interpreted
      expressions) to use the VariableSP/Symbol that were
      found during parsing.
      
      llvm-svn: 141839
      8e5b8b96
    • Sean Callanan's avatar
      Extended the lifetime of Clang parser objects to the · e3aef1d0
      Sean Callanan authored
      lifetime of ClangExpressionDeclMap.  This allows
      ClangExpressionVariables found during parsing to be
      queried for their containing namespaces during
      expression execution.
      
      Other clients (like ClangFunction) explicitly delete
      this state, so they should not result in any memory
      leaks.
      
      llvm-svn: 141821
      e3aef1d0
  21. Oct 12, 2011
    • Sean Callanan's avatar
      Refactoring in preparation for having multiple · ca4e0fd7
      Sean Callanan authored
      calls to the FindExternalVisibleDecls function.
      
      FindExternalVisibleDecls was recording whether
      it had found generic function symbols in variables
      that were local to the function.  Now, however,
      multiple calls occur in response to one request
      from Clang, since we may be searching across
      namespaces.  To support that, I moved the local
      variables into a bitfield in NameSearchContext.
      
      llvm-svn: 141808
      ca4e0fd7
    • Sean Callanan's avatar
      Made the expression parser's type search call the · 1a2c5386
      Sean Callanan authored
      proper namespace-aware APIs.
      
      llvm-svn: 141797
      1a2c5386
Loading