Skip to content
  1. Nov 02, 2012
    • Jason Molenda's avatar
      Change DataExtractor::Dump() to use a series of if..else if · cc57a383
      Jason Molenda authored
      statements instead of a switch for the size of the floating
      point types; some architectures sizeof double and sizeof long
      double are the same and that's invalid in a switch.
      
      Fix the LLDB_DISABLE_PYTHON ifdef block in FormatManager::LoadObjCFormatters
      so it builds on arm again.
      
      llvm-svn: 167263
      cc57a383
  2. Oct 31, 2012
  3. Oct 20, 2012
  4. Aug 09, 2012
  5. Jul 12, 2012
    • Greg Clayton's avatar
      Modifying the "address" format, which prints a pointer and a description of... · c3a86bf9
      Greg Clayton authored
      Modifying the "address" format, which prints a pointer and a description of what it points to, to detect when the deref of that pointer points to something valid. So if you have:
      
          % cat sp.cpp 
          #include <tr1/memory>
      
          class A
          {
          public:
              A (): m_i (12) {}
              virtual ~A() {}
          private:
              int m_i;
          };
      
          int main (int argc, char const *argv[], char const *envp[])
          {
              A *a_pointers[2] = { NULL, NULL };
              A a1;
              A a2;
              a_pointers[0] = &a1;
              a_pointers[1] = &a2;
              return 0;
          }
      
      
      And you stop at the "return 0", you can now read memory using the "address" format and see:
      
      (lldb) memory read --format address `&a_pointers`
      0x7fff5fbff870: 0x00007fff5fbff860 -> 0x00000001000010b0 vtable for A + 16
      0x7fff5fbff878: 0x00007fff5fbff850 -> 0x00000001000010b0 vtable for A + 16
      0x7fff5fbff880: 0x00007fff5fbff8d0
      0x7fff5fbff888: 0x00007fff5fbff8c0
      0x7fff5fbff890: 0x0000000000000001
      0x7fff5fbff898: 0x36d54c275add2294
      0x7fff5fbff8a0: 0x00007fff5fbff8b0
      0x7fff5fbff8a8: 0x0000000100000bb4 a.out`start + 52
      
      Note the extra dereference that was applied to 0x00007fff5fbff860 and 0x00007fff5fbff850 so we can see that these are "A" classes.
      
      llvm-svn: 160085
      c3a86bf9
  6. Feb 28, 2012
    • Greg Clayton's avatar
      <rdar://problem/10017623> · 70a08d99
      Greg Clayton authored
      Fixed an error where if we tried to format a ValueObject using a format
      that was incorrect for a variable, then it would set ValueObject::m_error
      to an error state and stop the value from being able to be updated. We now
      leave m_error alone and only let the update value code change that. Any errors
      in formatting will return a valid value as C string that contains an error 
      string. This lets us then modify the format and redisplay without any issues.
      
      llvm-svn: 151581
      70a08d99
  7. Feb 24, 2012
    • Greg Clayton's avatar
      <rdar://problem/10103468> · e72dfb32
      Greg Clayton authored
      I started work on being able to add symbol files after a debug session
      had started with a new "target symfile add" command and quickly ran into
      problems with stale Address objects in breakpoint locations that had 
      lldb_private::Section pointers into modules that had been removed or 
      replaced. This also let to grabbing stale modules from those sections. 
      So I needed to thread harded the Address, Section and related objects.
      
      To do this I modified the ModuleChild class to now require a ModuleSP
      on initialization so that a weak reference can created. I also changed
      all places that were handing out "Section *" to have them hand out SectionSP.
      All ObjectFile, SymbolFile and SymbolVendors were inheriting from ModuleChild
      so all of the find plug-in, static creation function and constructors now
      require ModuleSP references instead of Module *. 
      
      Address objects now have weak references to their sections which can
      safely go stale when a module gets destructed. 
      
      This checkin doesn't complete the "target symfile add" command, but it
      does get us a lot clioser to being able to do such things without a high
      risk of crashing or memory corruption.
      
      llvm-svn: 151336
      e72dfb32
  8. Feb 18, 2012
    • Greg Clayton's avatar
      The second part in thread hardening the internals of LLDB where we make · d9e416c0
      Greg Clayton authored
      the lldb_private::StackFrame objects hold onto a weak pointer to the thread
      object. The lldb_private::StackFrame objects the the most volatile objects
      we have as when we are doing single stepping, frames can often get lost or
      thrown away, only to be re-created as another object that still refers to the
      same frame. We have another bug tracking that. But we need to be able to 
      have frames no longer be able to get the thread when they are not part of
      a thread anymore, and this is the first step (this fix makes that possible
      but doesn't implement it yet).
      
      Also changed lldb_private::ExecutionContextScope to return shared pointers to
      all objects in the execution context to further thread harden the internals.
      
      llvm-svn: 150871
      d9e416c0
  9. Feb 17, 2012
  10. Feb 16, 2012
  11. Jan 04, 2012
  12. Dec 30, 2011
    • Greg Clayton's avatar
      <rdar://problem/10368163> · 77ccca71
      Greg Clayton authored
      Watch for empty symbol tables by doing a lot more error checking on
      all mach-o symbol table load command values and data that is obtained.
      This avoids a crash that was happening when there was no string table.
      
      llvm-svn: 147358
      77ccca71
  13. Nov 14, 2011
  14. Nov 10, 2011
  15. Nov 08, 2011
  16. Oct 31, 2011
  17. Oct 29, 2011
    • Greg Clayton's avatar
      Fixed the continuation dumping of instructions to properly advance the · 1848afbb
      Greg Clayton authored
      previous address only by the number of bytes consumed by the disassembly:
      
      (lldb) x/4i 0x0000000100000ea9
      0x100000ea9:  66 c7 45 fa 10 00     movw   $16, -6(%rbp)
      0x100000eaf:  c7 45 f4 20 00 00 00  movl   $32, -12(%rbp)
      0x100000eb6:  e8 47 00 00 00        callq  0x0000000100000f02       ; void f<nullptr_t>(nullptr_t)
      0x100000ebb:  8b 45 fc              movl   -4(%rbp), %eax
      (lldb) 
      0x100000ebe:  48 83 c4 10  addq   $16, %rsp
      0x100000ec2:  5d           popq   %rbp
      0x100000ec3:  c3           ret    
      0x100000ec4:  90           nop    
      (lldb) 
      0x100000ec5:  90  nop    
      0x100000ec6:  90  nop    
      0x100000ec7:  90  nop    
      0x100000ec8:  90  nop    
      (lldb) 
      0x100000ec9:  90  nop    
      0x100000eca:  90  nop    
      0x100000ecb:  90  nop    
      0x100000ecc:  90  nop    
      (lldb) 
      0x100000ecd:  90  nop    
      0x100000ece:  90  nop    
      0x100000ecf:  90  nop    
      0x100000ed0:  55  pushq  %rbp
      
      llvm-svn: 143254
      1848afbb
  18. Oct 27, 2011
    • Greg Clayton's avatar
      Added support for the new ".apple_objc" accelerator tables. These tables are · 5009f9d5
      Greg Clayton authored
      in the same hashed format as the ".apple_names", but they map objective C
      class names to all of the methods and class functions. We need to do this 
      because in the DWARF the methods for Objective C are never contained in the
      class definition, they are scattered about at the translation unit level and
      they don't even have attributes that say the are contained within the class
      itself. 
      
      Added 3 new formats which can be used to display data:
      
          eFormatAddressInfo
          eFormatHexFloat
          eFormatInstruction
          
      eFormatAddressInfo describes an address such as function+offset and file+line,
      or symbol + offset, or constant data (c string, 2, 4, 8, or 16 byte constants).
      The format character for this is "A", the long format is "address".
      
      eFormatHexFloat will print out the hex float format that compilers tend to use.
      The format character for this is "X", the long format is "hex float".
      
      eFormatInstruction will print out disassembly with bytes and it will use the
      current target's architecture. The format character for this is "i" (which
      used to be being used for the integer format, but the integer format also has
      "d", so we gave the "i" format to disassembly), the long format is 
      "instruction".
      
      Mate the lldb::FormatterChoiceCriterion enumeration private as it should have
      been from the start. It is very specialized and doesn't belong in the public 
      API.
      
      llvm-svn: 143114
      5009f9d5
  19. Oct 26, 2011
  20. Oct 12, 2011
  21. Sep 20, 2011
  22. Sep 06, 2011
    • Enrico Granata's avatar
      Redesign of the interaction between Python and frozen objects: · 9128ee2f
      Enrico Granata authored
       - introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
         a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
         in frozen objects ; now such reads transparently move from host to target as required
       - as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
         removed code that enabled to recognize an expression result VO as such
       - introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
         representing a T* or T[], and doing dereferences transparently
         in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
       - as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
         en lieu of doing the raw read itself
       - introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
         this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
         in public layer this returns an SBData, just like GetPointeeData()
       - introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
         the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
         of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
       - added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
      Solved a bug where global pointers to global variables were not dereferenced correctly for display
      New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
      Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
      Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
       of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
       addresses that generate file address children UNLESS we have a live process)
      Updated help text for summary-string
      Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
      Edited the syntax and help for some commands to have proper argument types
      
      llvm-svn: 139160
      9128ee2f
  23. Aug 27, 2011
  24. Aug 15, 2011
  25. Jul 19, 2011
    • 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
  26. Jul 17, 2011
    • Greg Clayton's avatar
      Added a boolean to the pure virtual lldb_private::Process::CanDebug(...) · 3a29bdbe
      Greg Clayton authored
      method so process plug-ins that are requested by name can answer yes when
      asked if they can debug a target that might not have any file in the target.
      
      Modified the ConnectionFileDescriptor to have both a read and a write file
      descriptor. This allows us to support UDP, and eventually will allow us to
      support pipes. The ConnectionFileDescriptor class also has a file descriptor
      type for each of the read and write file decriptors so we can use the correct
      read/recv/recvfrom call when reading, or write/send/sendto for writing.
      
      Finished up an initial implementation of UDP where you can use the "udp://"
      URL to specify a host and port to connect to:
      
      (lldb) process connect --plugin kdp-remote udp://host:41139
      
      This will cause a ConnectionFileDescriptor to be created that can send UDP
      packets to "host:41139", and it will also bind to a localhost port that can
      be given out to receive the connectionless UDP reply. 
      
      Added the ability to get to the IPv4/IPv6 socket port number from a 
      ConnectionFileDescriptor instance if either file descriptor is a socket.
      
      The ProcessKDP can now successfully connect to a remote kernel and detach
      using the above "processs connect" command!!! So far we have the following
      packets working:
          KDP_CONNECT
          KDP_DISCONNECT
          KDP_HOSTINFO
          KDP_VERSION
          KDP_REATTACH
      
      Now that the packets are working, adding new packets will go very quickly.
      
      llvm-svn: 135363
      3a29bdbe
  27. Jul 16, 2011
    • Greg Clayton's avatar
      Completed more work on the KDP darwin kernel debugging Process plug-in. · 4df8ddfc
      Greg Clayton authored
      Implemented connect, disconnect, reattach, version, and hostinfo.
      
      Modified the ConnectionFileDescriptor class to be able to handle UDP. 
      
      Added a new Stream subclass called StreamBuffer that is backed by a
      llvm::SmallVector for better efficiency.
      
      Modified the DataExtractor class to have a static function that can
      dump hex bytes into a stream. This is currently being used to dump incoming
      binary packet data in the KDP plug-in.
      
      llvm-svn: 135338
      4df8ddfc
  28. Jul 13, 2011
    • Enrico Granata's avatar
      smarter summary strings: · f4efecd9
      Enrico Granata authored
       - formats %s %char[] %c and %a now work to print 0-terminated c-strings if they are applied to a char* or char[] even without the [] operator (e.g. ${var%s})
       - array formats (char[], intN[], ..) now work when applied to an array of a scalar type even without the [] operator (e.g. ${var%int32_t[]})
      LLDB will not crash because of endless loop when trying to obtain a summary for an object that has no value and references itself in its summary string
      In many cases, a wrong summary string will now display an "<error>" message instead of giving out an empty string
      
      llvm-svn: 135007
      f4efecd9
  29. Jul 06, 2011
    • Enrico Granata's avatar
      new syntax for summary strings: · 9fc1944e
      Enrico Granata authored
       - ${*expr} now simply means to dereference expr before actually using it
       - bitfields, array ranges and pointer ranges now work in a (hopefully) more natural and language-compliant way
      a new class TypeHierarchyNavigator replicates the behavior of the FormatManager in going through type hierarchies
      when one-lining summary strings, children's summaries can be used as well as values
      
      llvm-svn: 134458
      9fc1944e
  30. Jun 18, 2011
    • Greg Clayton's avatar
      Added a new format for displaying an array of characters: eFormatCharArray · 4e4294bd
      Greg Clayton authored
      This us useful because sometomes you have to show a single character as: 'a'
      (using eFormatChar) and other times you might have an array of single 
      charcters for display as: 'a' 'b' 'c', and other times you might want to 
      show the contents of buffer of characters that can contain non printable
      chars: "\0\x22\n123". 
      
      This also fixes an issue that currently happens when you have a single character
      C string (const char *a = "a"; or char b[1] = { 'b' };) that was being output
      as "'a'" incorrectly due to the way the eFormatChar format output worked.
      
      llvm-svn: 133316
      4e4294bd
  31. May 30, 2011
  32. May 23, 2011
    • 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
  33. May 09, 2011
    • Greg Clayton's avatar
      While implementing unwind information using UnwindAssemblyInstEmulation I ran · 7349bd90
      Greg Clayton authored
      into some cleanup I have been wanting to do when reading/writing registers.
      Previously all RegisterContext subclasses would need to implement:
      
      virtual bool
      ReadRegisterBytes (uint32_t reg, DataExtractor &data);
      
      virtual bool
      WriteRegisterBytes (uint32_t reg, DataExtractor &data, uint32_t data_offset = 0);
      
      There is now a new class specifically designed to hold register values: 
              lldb_private::RegisterValue
              
      The new register context calls that subclasses must implement are:
      
      virtual bool
      ReadRegister (const RegisterInfo *reg_info, RegisterValue &reg_value) = 0;
      
      virtual bool
      WriteRegister (const RegisterInfo *reg_info, const RegisterValue &reg_value) = 0;
      
      The RegisterValue class must be big enough to handle any register value. The
      class contains an enumeration for the value type, and then a union for the 
      data value. Any integer/float values are stored directly in an appropriate
      host integer/float. Anything bigger is stored in a byte buffer that has a length
      and byte order. The RegisterValue class also knows how to copy register value
      bytes into in a buffer with a specified byte order which can be used to write
      the register value down into memory, and this does the right thing when not
      all bytes from the register values are needed (getting a uint8 from a uint32
      register value..). 
      
      All RegiterContext and other sources have been switched over to using the new
      regiter value class.
      
      llvm-svn: 131096
      7349bd90
  34. Apr 28, 2011
  35. Apr 01, 2011
  36. Feb 04, 2011
  37. Feb 01, 2011
  38. Jan 26, 2011
Loading