Skip to content
  1. Oct 12, 2011
    • Greg Clayton's avatar
      d4e2552c
    • 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
  2. Oct 08, 2011
  3. 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
  4. 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
    • Sean Callanan's avatar
      Fixed a problem with the IR interpreter that caused · 0886e565
      Sean Callanan authored
      it to generate result variables that were not bound
      to their underlying data.  This allowed the SBValue
      class to use the interpreter (if possible).
      
      Also made sure that any result variables that point
      to stack allocations in the stack frame of the
      interpreted expressions do not get live data.
      
      llvm-svn: 140285
      0886e565
  5. Sep 21, 2011
  6. Sep 20, 2011
  7. Sep 17, 2011
    • Greg Clayton's avatar
      Adopt the intrusive pointers in: · 4d122c40
      Greg Clayton authored
      lldb_private::Breakpoint
      lldb_private::BreakpointLocations
      lldb_private::BreakpointSite
      lldb_private::Debugger
      lldb_private::StackFrame
      lldb_private::Thread
      lldb_private::Target
      
      llvm-svn: 139985
      4d122c40
    • 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
  8. Sep 15, 2011
    • Sean Callanan's avatar
      Fixed a problem where the symbol context was not · c2ff2744
      Sean Callanan authored
      being initialized properly in the absence of a
      process.
      
      llvm-svn: 139823
      c2ff2744
    • 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
  9. Sep 13, 2011
    • Greg Clayton's avatar
      Fixed some incorrect return values. · cce8671f
      Greg Clayton authored
      llvm-svn: 139582
      cce8671f
    • 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
  10. Sep 02, 2011
  11. Aug 25, 2011
  12. 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
  13. Aug 16, 2011
  14. Aug 12, 2011
  15. Aug 10, 2011
    • Sean Callanan's avatar
      Fixed a problem that prevented access to members · 5207a340
      Sean Callanan authored
      of string literals ("hello"[2]).  Also fixed a
      problem in which empty string literals were not
      being compiled correctly ((int)printf("") would
      print garbage).
      
      Added a testcase that covers both.
      
      llvm-svn: 137247
      5207a340
    • Greg Clayton's avatar
      While tracking down memory consumption issue a few things were needed: the · 3418c857
      Greg Clayton authored
      ability to dump more information about modules in "target modules list". We
      can now dump the shared pointer reference count for modules, the pointer to
      the module itself (in case performance tools can help track down who has
      references to said pointer), and the modification time.
      
      Added "target delete [target-idx ...]" to be able to delete targets when they
      are no longer needed. This will help track down memory usage issues and help 
      to resolve when module ref counts keep getting incremented. If the command gets
      no arguments, the currently selected target will be deleted. If any arguments 
      are given, they must all be valid target indexes (use the "target list" 
      command to get the current target indexes).
      
      Took care of a bunch of "no newline at end of file" warnings.
      
      TimeValue objects can now dump their time to a lldb_private::Stream object.
      
      Modified the "target modules list --global" command to not error out if there
      are no targets since it doesn't require a target.
      
      Fixed an issue in the MacOSX DYLD dynamic loader plug-in where if a shared 
      library was updated on disk, we would keep using the older one, even if it was
      updated.
      
      Don't allow the ModuleList::GetSharedModule(...) to return an empty module.
      Previously we could specify a valid path on disc to a module, and specify an
      architecture that wasn't contained in that module and get a shared pointer to
      a module that wouldn't be able to return an object file or a symbol file. We
      now make sure an object file can be extracted prior to adding the shared pointer
      to the module to get added to the shared list.
      
      llvm-svn: 137196
      3418c857
    • Johnny Chen's avatar
      Check log shared pointer before using it. · ee7a359d
      Johnny Chen authored
      llvm-svn: 137173
      ee7a359d
    • Johnny Chen's avatar
      Check log shared pointer before using it. · e95fcf78
      Johnny Chen authored
      llvm-svn: 137169
      e95fcf78
  16. Aug 09, 2011
  17. Aug 06, 2011
    • Sean Callanan's avatar
      Made the expression parser use the StackFrame's · 69b5341c
      Sean Callanan authored
      variable search API rather than rolling its own,
      fixing one of our testcases.
      
      llvm-svn: 137004
      69b5341c
    • 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
  18. Aug 04, 2011
    • Sean Callanan's avatar
      Fixed a problem that caused LLDB to fail to execute · 0c4d8d25
      Sean Callanan authored
      expressions that used function pointers.  The problem
      was that IRForTarget previously only scanned the IR
      for the expression for call instructions; if a function
      was used in another context, it was ignored.
      
      Now LLDB scans the Module for functions that are only
      declared (not also defined -- so these are externals);
      it then constructs function pointers for these
      functions and substitutes them wherever the function
      is used.
      
      Also made some changes so that "expr main" works just
      as well as "expr &main"; they end up being the same
      code, but LLDB was generating the result variable in
      different ways.
      
      llvm-svn: 136928
      0c4d8d25
  19. 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
  20. Aug 01, 2011
    • Sean Callanan's avatar
      Fixed a problem in the expression parser that · 7f3755b5
      Sean Callanan authored
      caused functions that were cast as part of the
      call to have that cast ignored once their 
      addresses were resolved.
      
      Notably, in the case of objc_msgSend(), if
      the function was cast from something returning
      i8* to something returning i8, the expression
      parser was discarding the cast as part of its
      resolution.  This caused crashes later on.
      
      llvm-svn: 136648
      7f3755b5
    • Sean Callanan's avatar
      Added checking to make sure that the target has a · b9951199
      Sean Callanan authored
      scratch AST context before attempting to parse.
      
      llvm-svn: 136631
      b9951199
    • Sean Callanan's avatar
      Fixed a bug where named constants were being · af8e96c1
      Sean Callanan authored
      treated as externals, causing problems when we
      tried to look their locations up in the debug
      info.  For example:
      
      expr char c[] = "foo"; c[0]
      
      would terminate when trying to find c in the
      debug information, despite the fact that c was
      defined inside the expression.
      
      llvm-svn: 136629
      af8e96c1
  21. Jul 31, 2011
  22. 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
  23. 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
Loading