Skip to content
  1. Dec 16, 2010
  2. Dec 14, 2010
    • Greg Clayton's avatar
      Modified LLDB expressions to not have to JIT and run code just to see variable · 8b2fe6dc
      Greg Clayton authored
      values or persistent expression variables. Now if an expression consists of
      a value that is a child of a variable, or of a persistent variable only, we
      will create a value object for it and make a ValueObjectConstResult from it to
      freeze the value (for program variables only, not persistent variables) and
      avoid running JITed code. For everything else we still parse up and JIT code
      and run it in the inferior. 
      
      There was also a lot of clean up in the expression code. I made the 
      ClangExpressionVariables be stored in collections of shared pointers instead
      of in collections of objects. This will help stop a lot of copy constructors on
      these large objects and also cleans up the code considerably. The persistent
      clang expression variables were moved over to the Target to ensure they persist
      across process executions.
      
      Added the ability for lldb_private::Target objects to evaluate expressions.
      We want to evaluate expressions at the target level in case we aren't running
      yet, or we have just completed running. We still want to be able to access the
      persistent expression variables between runs, and also evaluate constant 
      expressions. 
      
      Added extra logging to the dynamic loader plug-in for MacOSX. ModuleList objects
      can now dump their contents with the UUID, arch and full paths being logged with
      appropriate prefix values.
      
      Thread hardened the Communication class a bit by making the connection auto_ptr
      member into a shared pointer member and then making a local copy of the shared
      pointer in each method that uses it to make sure another thread can't nuke the
      connection object while it is being used by another thread.
      
      Added a new file to the lldb/test/load_unload test that causes the test a.out file
      to link to the libd.dylib file all the time. This will allow us to test using
      the DYLD_LIBRARY_PATH environment variable after moving libd.dylib somewhere else.
      
      llvm-svn: 121745
      8b2fe6dc
    • Sean Callanan's avatar
      Bugfixes for the new "self" pointer handling. Specifically, · 9d48e804
      Sean Callanan authored
      the code to pass the _cmd pointer has been improved, and _cmd
      is now set to the value of _cmd for the current context, as
      opposed to being simply NULL.
      
      llvm-svn: 121739
      9d48e804
  3. 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
  4. Dec 07, 2010
  5. 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
  6. Dec 01, 2010
  7. Nov 30, 2010
    • Jim Ingham's avatar
      Moved the code in ClangUserExpression that set up & ran the thread plan with... · f48169bb
      Jim Ingham authored
      Moved the code in ClangUserExpression that set up & ran the thread plan with timeouts, and restarting with all threads into a utility function in Process.  This required a bunch of renaming. 
      
      Added a ThreadPlanCallUserExpression that differs from ThreadPlanCallFunction in that it holds onto a shared pointer to its ClangUserExpression so that can't go away before the thread plan is done using it.
      
      Fixed the stop message when you hit a breakpoint while running a user expression so it is more obvious what has happened.
      
      llvm-svn: 120386
      f48169bb
  8. Nov 19, 2010
  9. Nov 10, 2010
  10. Nov 08, 2010
  11. Nov 06, 2010
    • Greg Clayton's avatar
      Modified all logging calls to hand out shared pointers to make sure we · 2d4edfbc
      Greg Clayton authored
      don't crash if we disable logging when some code already has a copy of the
      logger. Prior to this fix, logs were handed out as pointers and if they were
      held onto while a log got disabled, then it could cause a crash. Now all logs
      are handed out as shared pointers so this problem shouldn't happen anymore.
      We are also using our new shared pointers that put the shared pointer count
      and the object into the same allocation for a tad better performance.
      
      llvm-svn: 118319
      2d4edfbc
  12. Nov 05, 2010
  13. Nov 04, 2010
    • Greg Clayton's avatar
      Added support for loading and unloading shared libraries. This was done by · 8f343b09
      Greg Clayton authored
      adding support into lldb_private::Process:
      
          virtual uint32_t
          lldb_private::Process::LoadImage (const FileSpec &image_spec, 
                                            Error &error);
      
          virtual Error
          lldb_private::Process::UnloadImage (uint32_t image_token);
      
      There is a default implementation that should work for both linux and MacOSX.
      This ability has also been exported through the SBProcess API:
      
          uint32_t
          lldb::SBProcess::LoadImage (lldb::SBFileSpec &image_spec, 
                                      lldb::SBError &error);
      
          lldb::SBError
          lldb::SBProcess::UnloadImage (uint32_t image_token);
      
      Modified the DynamicLoader plug-in interface to require it to be able to 
      tell us if it is currently possible to load/unload a shared library:
      
          virtual lldb_private::Error
          DynamicLoader::CanLoadImage () = 0;
      
      This way the dynamic loader plug-ins are allows to veto whether we can 
      currently load a shared library since the dynamic loader might know if it is
      currenlty loading/unloading shared libraries. It might also know about the
      current host system and know where to check to make sure runtime or malloc
      locks are currently being held.
      
      Modified the expression parser to have ClangUserExpression::Evaluate() be
      the one that causes the dynamic checkers to be loaded instead of other code
      that shouldn't have to worry about it.
      
      llvm-svn: 118227
      8f343b09
  14. Oct 29, 2010
    • Johnny Chen's avatar
      dabefd01
    • Sean Callanan's avatar
      Added a user-settable variable, 'target.expr-prefix', · 322f529b
      Sean Callanan authored
      which holds the name of a file whose contents are
      prefixed to each expression.  For example, if the file
      ~/lldb.prefix.header contains:
      
      typedef unsigned short my_type;
      
      then you can do this:
      
      (lldb) settings set target.expr-prefix '~/lldb.prefix.header'
      (lldb) expr sizeof(my_type)
      (unsigned long) $0 = 2
      
      When the variable is changed, the corresponding file
      is loaded and its contents are fetched into a string
      that is stored along with the target.  This string
      is then passed to each expression and inserted into
      it during parsing, like this:
      
      typedef unsigned short my_type;
                                   
      void                           
      $__lldb_expr(void *$__lldb_arg)          
      {                              
          sizeof(my_type);                        
      }
      
      llvm-svn: 117627
      322f529b
  15. Oct 27, 2010
    • Greg Clayton's avatar
      Updated the lldb_private::Flags class to have better method names and made · 73b472d4
      Greg Clayton authored
      all of the calls inlined in the header file for better performance.
      
      Fixed the summary for C string types (array of chars (with any combo if
      modifiers), and pointers to chars) work in all cases.
      
      Fixed an issue where a forward declaration to a clang type could cause itself
      to resolve itself more than once if, during the resolving of the type itself
      it caused something to try and resolve itself again. We now remove the clang
      type from the forward declaration map in the DWARF parser when we start to 
      resolve it and avoid this additional call. This should stop any duplicate
      members from appearing and throwing all the alignment of structs, unions and
      classes.
      
      llvm-svn: 117437
      73b472d4
  16. Oct 24, 2010
    • Sean Callanan's avatar
      Added a hack so that "unichar" is resolved to · 64186e7f
      Sean Callanan authored
      "unsigned short."  As discussed in the comments,
      this is pending a better solution to the problem
      of types not in the debug information but readily
      available through headers.
      
      llvm-svn: 117247
      64186e7f
  17. Oct 23, 2010
  18. Oct 20, 2010
  19. Oct 19, 2010
  20. 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
  21. Oct 15, 2010
    • Jim Ingham's avatar
      Added support for breakpoint conditions. I also had to separate the "run the... · 36f3b369
      Jim Ingham authored
      Added support for breakpoint conditions.  I also had to separate the "run the expression" part of ClangFunction::Execute from the "Gather the expression result" so that in the case of the Breakpoint condition I can move the condition evaluation into the normal thread plan processing.
      
      Also added support for remembering the "last set breakpoint" so that "break modify" will act on the last set breakpoint.
      
      llvm-svn: 116542
      36f3b369
  22. Oct 07, 2010
  23. Oct 05, 2010
    • Greg Clayton's avatar
      Added the notion that a value object can be constant by adding: · b71f3844
      Greg Clayton authored
          bool ValueObject::GetIsConstant() const;
          void ValueObject::SetIsConstant();
      
      This will stop anything from being re-evaluated within the value object so
      that constant result value objects can maintain their frozen values without
      anything being updated or changed within the value object.
      
      Made it so the ValueObjectConstResult can be constructed with an 
      lldb_private::Error object to allow for expression results to have errors.
      
      Since ValueObject objects contain error objects, I changed the expression
      evaluation in ClangUserExpression from 
      
          static Error
          ClangUserExpression::Evaluate (ExecutionContext &exe_ctx, 
                                        const char *expr_cstr, 
                                        lldb::ValueObjectSP &result_valobj_sp);
      
      to:
      
          static lldb::ValueObjectSP
          Evaluate (ExecutionContext &exe_ctx, const char *expr_cstr);
          
      Even though expression parsing is borked right now (pending fixes coming from
      Sean Callanan), I filled in the implementation for:
          
          SBValue SBFrame::EvaluateExpression (const char *expr);
          
      Modified all expression code to deal with the above changes.
      
      llvm-svn: 115589
      b71f3844
    • Greg Clayton's avatar
      Moved expression evaluation from CommandObjectExpression into · 0184f019
      Greg Clayton authored
      ClangUserExpression::Evaluate () as a public static function so anyone can
      evaluate an expression.
      
      llvm-svn: 115581
      0184f019
  24. Sep 21, 2010
    • Sean Callanan's avatar
      Removed the hacky "#define this ___clang_this" handler · fc55f5d1
      Sean Callanan authored
      for C++ classes.  Replaced it with a less hacky approach:
      
       - If an expression is defined in the context of a
         method of class A, then that expression is wrapped as
         ___clang_class::___clang_expr(void*) { ... }
         instead of ___clang_expr(void*) { ... }.
      
       - ___clang_class is resolved as the type of the target
         of the "this" pointer in the method the expression
         is defined in.
      
       - When reporting the type of ___clang_class, a method
         with the signature ___clang_expr(void*) is added to
         that class, so that Clang doesn't complain about a
         method being defined without a corresponding
         declaration.
      
       - Whenever the expression gets called, "this" gets
         looked up, type-checked, and then passed in as the
         first argument.
      
      This required the following changes:
      
       - The ABIs were changed to support passing of the "this"
         pointer as part of trivial calls.
      
       - ThreadPlanCallFunction and ClangFunction were changed
         to support passing of an optional "this" pointer.
      
       - ClangUserExpression was extended to perform the
         wrapping described above.
      
       - ClangASTSource was changed to revert the changes
         required by the hack.
      
       - ClangExpressionParser, IRForTarget, and
         ClangExpressionDeclMap were changed to handle
         different manglings of ___clang_expr flexibly.  This
         meant no longer searching for a function called
         ___clang_expr, but rather looking for a function whose
         name *contains* ___clang_expr.
      
       - ClangExpressionParser and ClangExpressionDeclMap now
         remember whether "this" is required, and know how to
         look it up as necessary.
      
      A few inheritance bugs remain, and I'm trying to resolve
      these.  But it is now possible to use "this" as well as
      refer implicitly to member variables, when in the proper
      context.
      
      llvm-svn: 114384
      fc55f5d1
  25. Sep 14, 2010
    • Sean Callanan's avatar
      Added code to support use of "this" and "self" in · 44096b1a
      Sean Callanan authored
      expressions.  This involved three main changes:
      
       - In ClangUserExpression::ClangUserExpression(),
         we now insert the following lines into the
         expression:
           #define this ___clang_this
           #define self ___clang_self
      
       - In ClangExpressionDeclMap::GetDecls(), we
         special-case ___clang_(this|self) and instead
         look up "this" or "self"
      
       - In ClangASTSource, we introduce the capability
         to generate Decls with a different, overridden,
         name from the one that was requested, e.g.
         this for ___clang_this.
      
      llvm-svn: 113866
      44096b1a
  26. Sep 13, 2010
    • Sean Callanan's avatar
      Bugfixes to the expression parser. Fixes include: · 9e6ed53e
      Sean Callanan authored
       - If you put a semicolon at the end of an expression,
         this no longer causes the expression parser to
         error out.  This was a two-part fix: first,
         ClangExpressionDeclMap::Materialize now handles
         an empty struct (such as when there is no return
         value); second, ASTResultSynthesizer walks backward
         from the end of the ASTs until it reaches something
         that's not a NullStmt.
      
       - ClangExpressionVariable now properly byte-swaps when
         printing itself.
      
       - ClangUtilityFunction now cleans up after itself when
         it's done compiling itself.
      
       - Utility functions can now use external functions just
         like user expressions.
      
       - If you end your expression with a statement that does
         not return a value, the expression now runs correctly
         anyway.
      
      Also, added the beginnings of an Objective-C object
      validator function, which is neither installed nor used
      as yet.
      
      llvm-svn: 113789
      9e6ed53e
  27. Aug 28, 2010
    • Sean Callanan's avatar
      Added a ClangUtilityFunction class that allows the · e71d553c
      Sean Callanan authored
      debugger to insert self-contained functions for use by
      expressions (mainly for error-checking).
      
      In order to support detecting whether a crash occurred
      in one of these helpers -- currently our preferred way
      of reporting that an error-check failed -- added a bit
      of support for getting the extent of a JITted function
      in addition to just its base.
      
      llvm-svn: 112324
      e71d553c
  28. Aug 27, 2010
    • Sean Callanan's avatar
      This is a major refactoring of the expression parser. · 1a8d4093
      Sean Callanan authored
      The goal is to separate the parser's data from the data
      belonging to the parser's clients.  This allows clients
      to use the parser to obtain (for example) a JIT compiled
      function or some DWARF code, and then discard the parser
      state.
      
      Previously, parser state was held in ClangExpression and
      used liberally by ClangFunction, which inherited from
      ClangExpression.  The main effects of this refactoring 
      are:
      
      - reducing ClangExpression to an abstract class that
        declares methods that any client must expose to the
        expression parser,
      
      - moving the code specific to implementing the "expr"
        command from ClangExpression and
        CommandObjectExpression into ClangUserExpression,
        a new class,
      
      - moving the common parser interaction code from
        ClangExpression into ClangExpressionParser, a new
        class, and
      
      - making ClangFunction rely only on
        ClangExpressionParser and not depend on the
        internal implementation of ClangExpression.
      
      Side effects include:
      
      - the compiler interaction code has been factored
        out of ClangFunction and is now in an AST pass
        (ASTStructExtractor),
      
      - the header file for ClangFunction is now fully
        documented,
      
      - several bugs that only popped up when Clang was
        deallocated (which never happened, since the
        lifetime of the compiler was essentially infinite)
        are now fixed, and
      
      - the developer-only "call" command has been
        disabled.
      
      I have tested the expr command and the Objective-C
      step-into code, which use ClangUserExpression and
      ClangFunction, respectively, and verified that they
      work.  Please let me know if you encounter bugs or
      poor documentation.
      
      llvm-svn: 112249
      1a8d4093
Loading