Skip to content
  1. Feb 08, 2012
  2. 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
  3. Jan 06, 2012
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. Nov 08, 2011
    • Jim Ingham's avatar
      Do a better job of detecting when a breakpoint command has set the target... · 0faa43f9
      Jim Ingham authored
      Do a better job of detecting when a breakpoint command has set the target running again (except you have to ignore
      cases where the breakpoint runs expressions, those don't count as really "running again").
      
      llvm-svn: 144064
      0faa43f9
    • Sean Callanan's avatar
      Added a language parameter to the expression parser, · c7b65067
      Sean Callanan authored
      which will in the future allow expressions to be
      compiled as C, C++, and Objective-C instead of the
      current default Objective-C++.  This feature requires
      some additional support from Clang -- specifically, it
      requires reference types in the parser regardless of
      language -- so it is not yet exposed to the user.
      
      llvm-svn: 144042
      c7b65067
  10. Nov 04, 2011
    • Sean Callanan's avatar
      Occasionally LLDB runs into contexts where the · 744756e3
      Sean Callanan authored
      target is stopped in a C++ or Objective-C method
      but the "self" pointer's valid range actually
      doesn't cover the current location.  Before, that
      was confusing Clang to the point where it crashed;
      now, we sanity-check and fall back to pretending
      we're in a C function if "self" or "this" isn't
      available.
      
      llvm-svn: 143676
      744756e3
  11. Oct 31, 2011
  12. Oct 29, 2011
    • 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
  13. Oct 13, 2011
    • 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
  14. Oct 08, 2011
  15. Sep 26, 2011
    • Sean Callanan's avatar
      Factored out handling of the source code for an · 9bc83841
      Sean Callanan authored
      expression into a separate class.  This class
      encapsulates wrapping the function as needed.  I
      am also moving from using booleans to indicate
      what the expression's language should be to using
      lldb::LanguageType instead.
      
      llvm-svn: 140545
      9bc83841
  16. Sep 22, 2011
    • Greg Clayton's avatar
      Converted the lldb_private::Process over to use the intrusive · c14ee32d
      Greg Clayton authored
      shared pointers.
      
      Changed the ExecutionContext over to use shared pointers for
      the target, process, thread and frame since these objects can
      easily go away at any time and any object that was holding onto
      an ExecutionContext was running the risk of using a bad object.
      
      Now that the shared pointers for target, process, thread and
      frame are just a single pointer (they all use the instrusive
      shared pointers) the execution context is much safer and still
      the same size. 
      
      Made the shared pointers in the the ExecutionContext class protected
      and made accessors for all of the various ways to get at the pointers,
      references, and shared pointers.
      
      llvm-svn: 140298
      c14ee32d
  17. Sep 21, 2011
  18. Sep 20, 2011
  19. Sep 15, 2011
    • Sean Callanan's avatar
      Fixed a problem where the expression parser would · 64fe1994
      Sean Callanan authored
      attempt to obtain information from the process even
      in cases where the process isn't available.
      
      llvm-svn: 139803
      64fe1994
    • Sean Callanan's avatar
      This patch modifies the expression parser to allow it · 3bfdaa2a
      Sean Callanan authored
      to execute expressions even in the absence of a process.
      This allows expressions to run in situations where the
      target cannot run -- e.g., to perform calculations based
      on type information, or to inspect a binary's static
      data.
      
      This modification touches the following files:
      
      lldb-private-enumerations.h
        Introduce a new enum specifying the policy for
        processing an expression.  Some expressions should
        always be JITted, for example if they are functions
        that will be used over and over again.  Some
        expressions should always be interpreted, for
        example if the target is unsafe to run.  For most,
        it is acceptable to JIT them, but interpretation
        is preferable when possible.
      
      Target.[h,cpp]
        Have EvaluateExpression now accept the new enum.
      
      ClangExpressionDeclMap.[cpp,h]
        Add support for the IR interpreter and also make
        the ClangExpressionDeclMap more robust in the 
        absence of a process.
      
      ClangFunction.[cpp,h]
        Add support for the new enum.
      
      IRInterpreter.[cpp,h]
        New implementation.
      
      ClangUserExpression.[cpp,h]
        Add support for the new enum, and for running 
        expressions in the absence of a process.
      
      ClangExpression.h
        Remove references to the old DWARF-based method
        of evaluating expressions, because it has been
        superseded for now.
      
      ClangUtilityFunction.[cpp,h]
        Add support for the new enum.
      
      ClangExpressionParser.[cpp,h]
        Add support for the new enum, remove references
        to DWARF, and add support for checking whether
        the expression could be evaluated statically.
      
      IRForTarget.[h,cpp]
        Add support for the new enum, and add utility
        functions to support the interpreter.
      
      IRToDWARF.cpp
        Removed
      
      CommandObjectExpression.cpp
        Remove references to the obsolete -i option.
      
      Process.cpp 
        Modify calls to ClangUserExpression::Evaluate
        to pass the correct enum (for dlopen/dlclose)
      
      SBValue.cpp
        Add support for the new enum.
      
      SBFrame.cpp
        Add support for he new enum.
      
      BreakpointOptions.cpp
        Add support for the new enum.
      
      llvm-svn: 139772
      3bfdaa2a
  20. Sep 13, 2011
    • Greg Clayton's avatar
      Huge memory and performance improvements in the DWARF parser. · d4a2b370
      Greg Clayton authored
      Address ranges are now split up into two different tables: 
      - one in DWARFDebugInfo that is compile unit specific
      - one in each DWARFCompileUnit that has exact function DIE offsets
      
      This helps keep the size of the aranges down since the main table will get
      uniqued and sorted and have consecutive ranges merged. We then only parse the
      compile unit one on demand once we have determined that a compile unit contains
      the address in question. We also now use the .debug_aranges section if there 
      is one instead of always indexing the DWARF manually.
      
      NameToDIE now uses a UniqueCStringMap<dw_offset> map instead of a std::map.
      std::map is very bulky as each node has 3 pointers and the key and value types.
      This gets our NameToDIE entry down to 12 bytes each instead of 48 which saves
      us a lot of memory when we have very large DWARF.
      
      DWARFDebugAranges now has a smaller footprint for each range it contains to 
      save on memory.
      
      llvm-svn: 139557
      d4a2b370
  21. Aug 25, 2011
  22. Aug 23, 2011
    • Sean Callanan's avatar
      Added support for persistent types to the · bccce813
      Sean Callanan authored
      expression parser.  You can use a persistent
      type like this:
      
      (lldb) expr struct $foo { int a; int b; };
      (lldb) struct $foo i; i.a = 2; i.b = 3; i
      ($foo) $0 = {
        (int) a = 2
        (int) b = 3
      }
      
      typedefs work similarly.
      
      This patch affects the following files:
      
      test/expression_command/persistent_types/*
        A test case for persistent types,
        in particular structs and typedefs.
      
      ClangForward.h
        Added TypeDecl, needed to declare some
        functions in ASTResultSynthesizer.h
      
      ClangPersistentVariables.[h,cpp]
        Added a list of persistent types to the
        persistent variable store.
      
      ASTResultSynthesizer.[h,cpp]
        Made the AST result synthesizer iterate
        across TypeDecls in the expression, and
        record any persistent types found.  Also
        made a minor documentation fix.
      
      ClangUserExpression.[h,cpp]
        Extended the user expression class to
        keep the state needed to report the
        persistent variable store for the target
        to the AST result synthesizers. 
      
        Also introduced a new error code for
        expressions that executed normally but
        did not return a result.
      
      CommandObjectExpression.cpp
        Improved output for expressions (like 
        declarations of new persistent types) that
        don't return a result.  This is no longer
        treated as an error.
      
      llvm-svn: 138383
      bccce813
  23. Aug 09, 2011
  24. Aug 06, 2011
    • Sean Callanan's avatar
      This is an overhaul of the expression parser code · 72e4940b
      Sean Callanan authored
      that detects what context the current expression is
      meant to execute in.  LLDB now properly consults
      the method declaration in the debug information
      rather than trying to hunt down the "this" or "self"
      pointer by name, which can be misleading.
      
      Other fixes include:
      
      - LLDB now properly detects that it is inside
        an inlined C++ member function.
      
      - LLDB now allows access to non-const members when
        in const code.
      
      - The functions in SymbolFile that locate the
        DeclContext containing a DIE have been renamed
        to reflect what they actually do.  I have added
        new functions that find the DeclContext for the
        DIE itself.
      
      I have also introduced testcases for C++ and 
      Objective-C.
      
      llvm-svn: 136999
      72e4940b
  25. Aug 03, 2011
    • Sean Callanan's avatar
      Improved the expression parser's detection of the · a789aa77
      Sean Callanan authored
      current context.  Previously, if there was a variable
      called "self" available, the expression parser
      assumed it was inside a method.  But class methods
      in Objective-C also take a "self" parameter, of DWARF
      type "id".  We now detect this properly, and only
      assume we're in an instance method if "self" is a
      pointer to an Objective-C object.
      
      llvm-svn: 136784
      a789aa77
  26. Aug 01, 2011
  27. Jul 19, 2011
    • Johnny Chen's avatar
      Patch by Matt Johnson to silence G++ warnings! · 4480530a
      Johnny Chen authored
      Used hand merge to apply the diffs.  I did not apply the diffs for FormatManager.h and
      the diffs for memberwise initialization for ValueObject.cpp because they changed since.
      I will ask my colleague to apply them later.
      
      llvm-svn: 135508
      4480530a
    • Enrico Granata's avatar
      The implementation of categories is now synchronization safe · 20edcdbe
      Enrico Granata authored
      Code cleanup:
       - The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the
         actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and
         FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...)
         are contained. The wrapper code always remains in Debugger.{h|cpp}
       - Several leftover fields, methods and comments from previous design choices have been removed
      type category subcommands (enable, disable, delete) now can take a list of category names as input
       - for type category enable, saying "enable A B C" is the same as saying
          enable C
          enable B
          enable A
         (the ordering is relevant in enabling categories, and it is expected that a user typing
          enable A B C wants to look into category A, then into B, then into C and not the other
          way round)
       - for the other two commands, the order is not really relevant (however, the same inverted ordering
         is used for consistency)
      
      llvm-svn: 135494
      20edcdbe
  28. Jun 25, 2011
  29. Jun 20, 2011
  30. May 23, 2011
    • Sean Callanan's avatar
      This commit integrates support for the LLVM MCJIT · 79763a42
      Sean Callanan authored
      into the mainline LLDB codebase.  MCJIT introduces
      API improvements and better architectural support.
      
      This commit adds a new subsystem, the
      ProcessDataAllocator, which is responsible for
      performing static data allocations on behalf of the
      IR transformer.  MCJIT currently does not support
      the relocations required to store the constant pool
      in the same allocation as the function body, so we
      allocate a heap region separately and redirect
      static data references from the expression to that
      heap region in a new IR modification pass.
      
      This patch also fixes bugs in the IR
      transformations that were exposed by the transition
      to the MCJIT.  Finally, the patch also pulls in a
      more recent revision of LLVM so that the MCJIT is
      available for use.
      
      llvm-svn: 131923
      79763a42
  31. May 18, 2011
  32. May 17, 2011
  33. May 10, 2011
    • Sean Callanan's avatar
      Fixed a bug in which expression-local variables were · e359d9b7
      Sean Callanan authored
      treated as being permanently resident in target
      memory.  In fact, since the expression's stack frame
      is deleted and potentially re-used after the
      expression completes, the variables need to be treated
      as being freeze-dried.
      
      llvm-svn: 131104
      e359d9b7
  34. May 07, 2011
  35. Apr 23, 2011
  36. Apr 11, 2011
Loading