Skip to content
  1. 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
  2. Sep 20, 2011
  3. Sep 15, 2011
    • 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
  4. Aug 12, 2011
    • Greg Clayton's avatar
      We were leaking a stack frame in StackFrameList in Thread.cpp which could · 7e9b1fd0
      Greg Clayton authored
      cause extra shared pointer references to one or more modules to be leaked.
      This would cause many object files to stay around the life of LLDB, so after
      a recompile and rexecution, we would keep adding more and more memory. After
      fixing the leak, we found many cases where leaked stack frames were still
      being used and causing crashes in the test suite. These are now all resolved.
      
      llvm-svn: 137516
      7e9b1fd0
  5. Jun 30, 2011
  6. 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
    • Greg Clayton's avatar
      Added new lldb_private::Process memory read/write functions to stop a bunch · f3ef3d2a
      Greg Clayton authored
      of duplicated code from appearing all over LLDB:
      
      lldb::addr_t
      Process::ReadPointerFromMemory (lldb::addr_t vm_addr, Error &error);
      
      bool
      Process::WritePointerToMemory (lldb::addr_t vm_addr, lldb::addr_t ptr_value, Error &error);
      
      size_t
      Process::ReadScalarIntegerFromMemory (lldb::addr_t addr, uint32_t byte_size, bool is_signed, Scalar &scalar, Error &error);
      
      size_t
      Process::WriteScalarToMemory (lldb::addr_t vm_addr, const Scalar &scalar, uint32_t size, Error &error);
      
      in lldb_private::Process the following functions were renamed:
      
      From:
      uint64_t
      Process::ReadUnsignedInteger (lldb::addr_t load_addr, 
                                    size_t byte_size,
                                    Error &error);
      
      To:
      uint64_t
      Process::ReadUnsignedIntegerFromMemory (lldb::addr_t load_addr, 
                                              size_t byte_size,
                                              uint64_t fail_value, 
                                              Error &error);
      
      Cleaned up a lot of code that was manually doing what the above functions do
      to use the functions listed above.
      
      Added the ability to get a scalar value as a buffer that can be written down
      to a process (byte swapping the Scalar value if needed):
      
      uint32_t 
      Scalar::GetAsMemoryData (void *dst,
                              uint32_t dst_len, 
                              lldb::ByteOrder dst_byte_order,
                              Error &error) const;
      
      The "dst_len" can be smaller that the size of the scalar and the least 
      significant bytes will be written. "dst_len" can also be larger and the
      most significant bytes will be padded with zeroes. 
      
      Centralized the code that adds or removes address bits for callable and opcode
      addresses into lldb_private::Target:
      
      lldb::addr_t
      Target::GetCallableLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const;
      
      lldb::addr_t
      Target::GetOpcodeLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const;
      
      All necessary lldb_private::Address functions now use the target versions so
      changes should only need to happen in one place if anything needs updating.
      
      Fixed up a lot of places that were calling :
      
      addr_t
      Address::GetLoadAddress(Target*);
      
      to call the Address::GetCallableLoadAddress() or Address::GetOpcodeLoadAddress()
      as needed. There were many places in the breakpoint code where things could
      go wrong for ARM if these weren't used.
      
      llvm-svn: 131878
      f3ef3d2a
  7. May 07, 2011
  8. Mar 24, 2011
  9. Mar 17, 2011
  10. Feb 17, 2011
  11. Feb 15, 2011
  12. Jan 20, 2011
  13. Jan 18, 2011
  14. 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
  15. 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
  16. 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
  17. Nov 18, 2010
  18. Nov 17, 2010
    • Jim Ingham's avatar
      Added an "Interrupted" bit to the ProcessEventData. Halt now generates an event · 0d8bcc79
      Jim Ingham authored
      with the Interrupted bit set.  Process::HandlePrivateEvent ignores Interrupted events.
      DoHalt is changed to ensure that the stop even is processed, and an event with
      the Interrupted event is posted.  Finally ClangFunction is rationalized to use this
      facility so the that Halt is handled more deterministically.
      
      llvm-svn: 119453
      0d8bcc79
  19. Nov 13, 2010
    • Greg Clayton's avatar
      Modified the lldb_private::Type clang type resolving code to handle three · 526e5afb
      Greg Clayton authored
      cases when getting the clang type:
      - need only a forward declaration
      - need a clang type that can be used for layout (members and args/return types)
      - need a full clang type
      
      This allows us to partially parse the clang types and be as lazy as possible.
      The first case is when we just need to declare a type and we will complete it
      later. The forward declaration happens only for class/union/structs and enums.
      The layout type allows us to resolve the full clang type _except_ if we have
      any modifiers on a pointer or reference (both R and L value). In this case
      when we are adding members or function args or return types, we only need to
      know how the type will be laid out and we can defer completing the pointee
      type until we later need it. The last type means we need a full definition for
      the clang type.
      
      Did some renaming of some enumerations to get rid of the old "DC" prefix (which
      stands for DebugCore which is no longer around).
      
      Modified the clang namespace support to be almost ready to be fed to the
      expression parser. I made a new ClangNamespaceDecl class that can carry around
      the AST and the namespace decl so we can copy it into the expression AST. I
      modified the symbol vendor and symbol file plug-ins to use this new class.
      
      llvm-svn: 118976
      526e5afb
  20. 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
  21. Nov 05, 2010
  22. Nov 03, 2010
  23. Oct 29, 2010
  24. Oct 20, 2010
    • Jim Ingham's avatar
      Don't cache the public stop reason, since it can change as plan completion... · b15bfc75
      Jim Ingham authored
      Don't cache the public stop reason, since it can change as plan completion gets processed.  That means GetStopReason needs to return a shared pointer, not a pointer to the thread's cached version.  Also allow the thread plans to get and set the thread private stop reason - that is usually more appropriate for the logic the thread plans need to do.
      
      llvm-svn: 116892
      b15bfc75
  25. 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
  26. 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
  27. Oct 12, 2010
  28. Sep 30, 2010
  29. Sep 29, 2010
    • Greg Clayton's avatar
      Fixed the forward declaration issue that was present in the DWARF parser after · 1be10fca
      Greg Clayton authored
      adding methods to C++ and objective C classes. In order to make methods, we
      need the function prototype which means we need the arguments. Parsing these
      could cause a circular reference that caused an  assertion.
      
      Added a new typedef for the clang opaque types which are just void pointers:
      lldb::clang_type_t. This appears in lldb-types.h.
      
      This was fixed by enabling struct, union, class, and enum types to only get
      a forward declaration when we make the clang opaque qual type for these
      types. When they need to actually be resolved, lldb_private::Type will call
      a new function in the SymbolFile protocol to resolve a clang type when it is
      not fully defined (clang::TagDecl::getDefinition() returns NULL). This allows
      us to be a lot more lazy when parsing clang types and keeps down the amount
      of data that gets parsed into the ASTContext for each module. 
      
      Getting the clang type from a "lldb_private::Type" object now takes a boolean
      that indicates if a forward declaration is ok:
      
          clang_type_t lldb_private::Type::GetClangType (bool forward_decl_is_ok);
          
      So function prototypes that define parameters that are "const T&" can now just
      parse the forward declaration for type 'T' and we avoid circular references in
      the type system.
      
      llvm-svn: 115012
      1be10fca
  30. Sep 28, 2010
  31. 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
  32. Sep 15, 2010
  33. Sep 11, 2010
  34. Sep 09, 2010
  35. Sep 08, 2010
    • Sean Callanan's avatar
      Fixed an expression parser bug that prevented · afa4237d
      Sean Callanan authored
      certain functions from being resolved correctly.
      
      Some functions (particularly varargs functions)
      are BitCast before being called, and the problem
      was that a CallInst where getCalledValue()
      returned a BitCast ConstantExpr was not being
      relocated at all.
      
      This problem should now be resolved for the case
      of BitCast.
      
      llvm-svn: 113396
      afa4237d
  36. 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
  37. 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
  38. Aug 17, 2010
Loading