Skip to content
  1. Aug 29, 2012
    • Greg Clayton's avatar
      <rdar://problem/11757916> · 1f746071
      Greg Clayton authored
      Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes:
      - Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file". 
      - modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly
      - Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was.
      - modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile()
      
      Cleaned up header includes a bit as well.
      
      llvm-svn: 162860
      1f746071
  2. Jul 14, 2012
  3. May 10, 2012
    • Greg Clayton's avatar
      <rdar://problem/11330621> · ba812f42
      Greg Clayton authored
      Fixed the DisassemblerLLVMC disassembler to parse more efficiently instead of parsing opcodes over and over. The InstructionLLVMC class now only reads the opcode in the InstructionLLVMC::Decode function. This can be done very efficiently for ARM and architectures that have fixed opcode sizes. For x64 it still calls the disassembler to get the byte size.
      
      Moved the lldb_private::Instruction::Dump(...) function up into the lldb_private::Instruction class and it now uses the function that gets the mnemonic, operandes and comments so that all disassembly is using the same code.
      
      Added StreamString::FillLastLineToColumn() to allow filling a line up to a column with a character (which is used by the lldb_private::Instruction::Dump(...) function).
      
      Modified the Opcode::GetData() fucntion to "do the right thing" for thumb instructions.
      
      llvm-svn: 156532
      ba812f42
  4. Mar 07, 2012
    • Greg Clayton's avatar
      <rdar://problem/10997402> · e7612134
      Greg Clayton authored
      This fix really needed to happen as a previous fix I had submitted for
      calculating symbol sizes made many symbols appear to have zero size since
      the function that was calculating the symbol size was calling another function
      that would cause the calculation to happen again. This resulted in some symbols
      having zero size when they shouldn't. This could then cause infinite stack
      traces and many other side affects.
      
      llvm-svn: 152244
      e7612134
  5. Mar 02, 2012
  6. Feb 26, 2012
    • Greg Clayton's avatar
      Made a ModuleSpec class in Module.h which can specify a module using one or · b9a01b39
      Greg Clayton authored
      more of the local path, platform path, associated symbol file, UUID, arch,
      object name and object offset. This allows many of the calls that were
      GetSharedModule to reduce the number of arguments that were used in a call
      to these functions. It also allows a module to be created with a ModuleSpec
      which allows many things to be specified prior to any accessors being called
      on the Module class itself. 
      
      I was running into problems when adding support for "target symbol add"
      where you can specify a stand alone debug info file after debugging has started
      where I needed to specify the associated symbol file path and if I waited until
      after construction, the wrong  symbol file had already been located. By using
      the ModuleSpec it allows us to construct a module with as little or as much
      information as needed and not have to change the parameter list.
      
      llvm-svn: 151476
      b9a01b39
  7. Feb 06, 2012
    • Greg Clayton's avatar
      Removed all of the "#ifndef SWIG" from the SB header files since we are using · 5569e64e
      Greg Clayton authored
      interface (.i) files for each class.
      
      Changed the FindFunction class from:
      
      uint32_t
      SBTarget::FindFunctions (const char *name, 
                               uint32_t name_type_mask, 
                               bool append, 
                               lldb::SBSymbolContextList& sc_list)
      
      uint32_t
      SBModule::FindFunctions (const char *name, 
                               uint32_t name_type_mask, 
                               bool append, 
                               lldb::SBSymbolContextList& sc_list)
      
      To:
      
      lldb::SBSymbolContextList
      SBTarget::FindFunctions (const char *name, 
                               uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
      
      lldb::SBSymbolContextList
      SBModule::FindFunctions (const char *name,
                               uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
      
      This makes the API easier to use from python. Also added the ability to
      append a SBSymbolContext or a SBSymbolContextList to a SBSymbolContextList.
      
      Exposed properties for lldb.SBSymbolContextList in python:
      
      lldb.SBSymbolContextList.modules => list() or all lldb.SBModule objects in the list
      lldb.SBSymbolContextList.compile_units => list() or all lldb.SBCompileUnits objects in the list
      lldb.SBSymbolContextList.functions => list() or all lldb.SBFunction objects in the list
      lldb.SBSymbolContextList.blocks => list() or all lldb.SBBlock objects in the list
      lldb.SBSymbolContextList.line_entries => list() or all lldb.SBLineEntry objects in the list
      lldb.SBSymbolContextList.symbols => list() or all lldb.SBSymbol objects in the list
      
      This allows a call to the SBTarget::FindFunctions(...) and SBModule::FindFunctions(...)
      and then the result can be used to extract the desired information:
      
      sc_list = lldb.target.FindFunctions("erase")
      
      for function in sc_list.functions:
          print function
      for symbol in sc_list.symbols:
          print symbol
      
      Exposed properties for the lldb.SBSymbolContext objects in python:
      
      lldb.SBSymbolContext.module => lldb.SBModule
      lldb.SBSymbolContext.compile_unit => lldb.SBCompileUnit
      lldb.SBSymbolContext.function => lldb.SBFunction
      lldb.SBSymbolContext.block => lldb.SBBlock
      lldb.SBSymbolContext.line_entry => lldb.SBLineEntry
      lldb.SBSymbolContext.symbol => lldb.SBSymbol
      
      
      Exposed properties for the lldb.SBBlock objects in python:
      
      lldb.SBBlock.parent => lldb.SBBlock for the parent block that contains
      lldb.SBBlock.sibling => lldb.SBBlock for the sibling block to the current block
      lldb.SBBlock.first_child => lldb.SBBlock for the first child block to the current block
      lldb.SBBlock.call_site => for inline functions, return a lldb.declaration object that gives the call site file, line and column
      lldb.SBBlock.name => for inline functions this is the name of the inline function that this block represents
      lldb.SBBlock.inlined_block => returns the inlined function block that contains this block (might return itself if the current block is an inlined block)
      lldb.SBBlock.range[int] => access the address ranges for a block by index, a list() with start and end address is returned
      lldb.SBBlock.ranges => an array or all address ranges for this block
      lldb.SBBlock.num_ranges => the number of address ranges for this blcok
      
      SBFunction objects can now get the SBType and the SBBlock that represents the
      top scope of the function.
      
      SBBlock objects can now get the variable list from the current block. The value
      list returned allows varaibles to be viewed prior with no process if code
      wants to check the variables in a function. There are two ways to get a variable
      list from a SBBlock:
      
      lldb::SBValueList
      SBBlock::GetVariables (lldb::SBFrame& frame,
                             bool arguments,
                             bool locals,
                             bool statics,
                             lldb::DynamicValueType use_dynamic);
      
      lldb::SBValueList
      SBBlock::GetVariables (lldb::SBTarget& target,
                             bool arguments,
                             bool locals,
                             bool statics);
      
      When a SBFrame is used, the values returned will be locked down to the frame
      and the values will be evaluated in the context of that frame.
      
      When a SBTarget is used, global an static variables can be viewed without a
      running process.
      
      llvm-svn: 149853
      5569e64e
  8. Jan 05, 2012
    • Greg Clayton's avatar
      Added code in the Host layer that can report system log messages · e38a5edd
      Greg Clayton authored
      so that we don't have "fprintf (stderr, ...)" calls sprinkled everywhere.
      Changed all needed locations over to using this.
      
      For non-darwin, we log to stderr only. On darwin, we log to stderr _and_
      to ASL (Apple System Log facility). This will allow GUI apps to have a place
      for these error and warning messages to go, and also allows the command line
      apps to log directly to the terminal.
      
      llvm-svn: 147596
      e38a5edd
  9. Oct 19, 2011
    • Greg Clayton's avatar
      Moved lldb::user_id_t values to be 64 bit. This was going to be needed for · 81c22f61
      Greg Clayton authored
      process IDs, and thread IDs, but was mainly needed for for the UserID's for
      Types so that DWARF with debug map can work flawlessly. With DWARF in .o files
      the type ID was the DIE offset in the DWARF for the .o file which is not
      unique across all .o files, so now the SymbolFileDWARFDebugMap class will
      make the .o file index part (the high 32 bits) of the unique type identifier
      so it can uniquely identify the types.
      
      llvm-svn: 142534
      81c22f61
  10. Oct 14, 2011
    • Sean Callanan's avatar
      Cleaned up a few functions that never get used. · c6bba3e4
      Sean Callanan authored
      Specifically, the expression parser used to use
      functions attached to SymbolContext to do lookups,
      but nowadays it searches a ModuleList or Module
      directly instead.  These functions had no
      remaining clients so I removed them to prevent
      bit rot.
      
      I also removed a stray callback function from
      ClangExpressionDeclMap.
      
      llvm-svn: 141899
      c6bba3e4
  11. Oct 13, 2011
  12. Oct 12, 2011
  13. Oct 08, 2011
  14. Oct 07, 2011
  15. Oct 05, 2011
  16. Oct 01, 2011
    • Greg Clayton's avatar
      Cleaned up the the code that figures out the inlined stack frames given a · 1ed54f50
      Greg Clayton authored
      symbol context that represents an inlined function. This function has been
      renamed internally to:
      
      bool
      SymbolContext::GetParentOfInlinedScope (const Address &curr_frame_pc, 
                                              SymbolContext &next_frame_sc, 
                                              Address &next_frame_pc) const;
                                              
      And externally to:
      
      SBSymbolContext
      SBSymbolContext::GetParentOfInlinedScope (const SBAddress &curr_frame_pc, 
                                                SBAddress &parent_frame_addr) const;
      
      The correct blocks are now correctly calculated.
      
      Switched the stack backtracing engine (in StackFrameList) and the address
      context printing over to using the internal SymbolContext::GetParentOfInlinedScope(...) 
      so all inlined callstacks will match exactly.
      
      llvm-svn: 140910
      1ed54f50
  17. Sep 29, 2011
  18. Sep 28, 2011
  19. Sep 27, 2011
  20. Sep 26, 2011
    • Greg Clayton's avatar
      Added more functionality to the public API to allow for better · 8f7180b1
      Greg Clayton authored
      symbolication. Also improved the SBInstruction API to allow
      access to the instruction opcode name, mnemonics, comment and
      instruction data.
      
      Added the ability to edit SBLineEntry objects (change the file,
      line and column), and also allow SBSymbolContext objects to be
      modified (set module, comp unit, function, block, line entry
      or symbol). 
      
      The SymbolContext and SBSymbolContext can now generate inlined
      call stack infomration for symbolication much easier using the
      SymbolContext::GetParentInlinedFrameInfo(...) and 
      SBSymbolContext::GetParentInlinedFrameInfo(...) methods.
      
      llvm-svn: 140518
      8f7180b1
  21. Sep 20, 2011
  22. Sep 17, 2011
    • 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
  23. Jul 12, 2011
    • Greg Clayton's avatar
      Added the ability to _not_ skip the prologue when settings breakpoints · d16e1e59
      Greg Clayton authored
      by name by adding an extra parameter to the lldb_private::Target breakpoint 
      setting functions.
      
      Added a function in the DWARF symbol file plug-in that can dump errors
      and prints out which DWARF file the error is happening in so we can track
      down what used to be assertions easily.
      
      Fixed the MacOSX kernel plug-in to properly read the kext images and set
      the kext breakpoint to watch for kexts as they are loaded.
      
      llvm-svn: 134990
      d16e1e59
    • Enrico Granata's avatar
      named summaries: · f9fa6ee5
      Enrico Granata authored
       - a new --name option for "type summary add" lets you give a name to a summary
       - a new --summary option for "frame variable" lets you bind a named summary to one or more variables
      ${var%s} now works for printing the value of 0-terminated CStrings
      type format test case now tests for cascading
       - this is disabled on GCC because GCC may end up stripping typedef chains, basically breaking cascading
      new design for the FormatNavigator class
      new template class CleanUp2 meant to support cleanup routines with 1 additional parameter beyond resource handle
      
      llvm-svn: 134943
      f9fa6ee5
  24. Jul 10, 2011
    • Greg Clayton's avatar
      Allow the built in ValueObject summary providers for C strings · 45ba8543
      Greg Clayton authored
      use lldb_private::Target::ReadMemory(...) to allow constant strings
      to be displayed in global variables prior on in between process
      execution.
      
      Centralized the variable declaration dumping into:
      
      	bool
      	Variable::DumpDeclaration (Stream *s, bool show_fullpaths, bool show_module);
      
      Fixed an issue if you used "target variable --regex <regex>" where the
      variable name would not be displayed, but the regular expression would.
      
      Fixed an issue when viewing global variables through "target variable"
      might not display correctly when doing DWARF in object files.
      
      llvm-svn: 134878
      45ba8543
  25. May 10, 2011
    • Sean Callanan's avatar
      Fixed a bug that caused types to be incorrectly · 019cacca
      Sean Callanan authored
      looked up.  Queries for global types were made
      too specific -- including the current module
      and compile unit in the query was limiting the
      search when we wanted a truly global search.
      
      llvm-svn: 131145
      019cacca
  26. Apr 23, 2011
    • Greg Clayton's avatar
      Fixed the SymbolContext::DumpStopContext() to correctly indent and dump · 7e14f91d
      Greg Clayton authored
      inline contexts when the deepest most block is not inlined.
      
      Added source path remappings to the lldb_private::Target class that allow it
      to remap paths found in debug info so we can find source files that are elsewhere
      on the current system.
      
      Fixed disassembly by function name to disassemble inline functions that are
      inside other functions much better and to show enough context before the
      disassembly output so you can tell where things came from.
      
      Added the ability to get more than one address range from a SymbolContext 
      class for the case where a block or function has discontiguous address ranges.
      
      llvm-svn: 130044
      7e14f91d
  27. Apr 19, 2011
    • Greg Clayton's avatar
      Added a new option to the "source list" command that allows us to see where · 176761e5
      Greg Clayton authored
      line tables specify breakpoints can be set in the source. When dumping the
      source, the number of breakpoints that can be set on a source line are shown
      as a prefix:
      
      (lldb) source list -f test.c -l1 -c222 -b
             1   	#include <stdio.h>
             2   	#include <sys/fcntl.h>
             3   	#include <unistd.h>
             4   	int
             5   	sleep_loop (const int num_secs)
      [2]    6   	{
             7   	    int i;
      [1]    8   	    for (i=0; i<num_secs; ++i)
             9   	    {
      [1]    10  	        printf("%d of %i - sleep(1);\n", i, num_secs);
      [1]    11  	        sleep(1);       
             12  	    }
             13  	    return 0;
      [1]    14  	}
             15  	
             16  	int 
             17  	main (int argc, char const* argv[])
      [1]    18  	{
      [1]    19  	    printf("Process: %i\n\n", getpid());
      [1]    20  	    puts("Press any key to continue..."); getchar();
      [1]    21  	    sleep_loop (20);
             22  	    return 12;
      [1]    23  	}
      
      Above we can see there are two breakpoints for line 6 and one breakpoint for
      lines 8, 10, 11, 14, 18, 19, 20, 21 and 23. All other lines have no line table
      entries for them. This helps visualize the data provided in the debug 
      information without having to manually dump all line tables. It also includes
      all inline breakpoint that may result for a given file which can also be very
      handy to see.
      
      llvm-svn: 129747
      176761e5
  28. Apr 08, 2011
    • Greg Clayton's avatar
      Modified the ArchSpec to take an optional "Platform *" when setting the triple. · eb0103f2
      Greg Clayton authored
      This allows you to have a platform selected, then specify a triple using
      "i386" and have the remaining triple items (vendor, os, and environment) set
      automatically.
      
      Many interpreter commands take the "--arch" option to specify an architecture
      triple, so now the command options needed to be able to get to the current
      platform, so the Options class now take a reference to the interpreter on
      construction.
      
      Modified the build LLVM building in the Xcode project to use the new
      Xcode project level user definitions:
      
      LLVM_BUILD_DIR - a path to the llvm build directory
      LLVM_SOURCE_DIR - a path to the llvm sources for the llvm that will be used to build lldb
      LLVM_CONFIGURATION - the configuration that lldb is built for (Release, 
      Release+Asserts, Debug, Debug+Asserts).
      
      I also changed the LLVM build to not check if "lldb/llvm" is a symlink and
      then assume it is a real llvm build directory versus the unzipped llvm.zip
      package, so now you can actually have a "lldb/llvm" directory in your lldb
      sources.
      
      llvm-svn: 129112
      eb0103f2
  29. Mar 30, 2011
    • Greg Clayton's avatar
      Many improvements to the Platform base class and subclasses. The base Platform · 32e0a750
      Greg Clayton authored
      class now implements the Host functionality for a lot of things that make 
      sense by default so that subclasses can check:
      
      int
      PlatformSubclass::Foo ()
      {
          if (IsHost())
              return Platform::Foo (); // Let the platform base class do the host specific stuff
          
          // Platform subclass specific code...
          int result = ...
          return result;
      }
      
      Added new functions to the platform:
      
          virtual const char *Platform::GetUserName (uint32_t uid);
          virtual const char *Platform::GetGroupName (uint32_t gid);
      
      The user and group names are cached locally so that remote platforms can avoid
      sending packets multiple times to resolve this information.
      
      Added the parent process ID to the ProcessInfo class. 
      
      Added a new ProcessInfoMatch class which helps us to match processes up
      and changed the Host layer over to using this new class. The new class allows
      us to search for processs:
      1 - by name (equal to, starts with, ends with, contains, and regex)
      2 - by pid
      3 - And further check for parent pid == value, uid == value, gid == value, 
          euid == value, egid == value, arch == value, parent == value.
          
      This is all hookup up to the "platform process list" command which required
      adding dumping routines to dump process information. If the Host class 
      implements the process lookup routines, you can now lists processes on 
      your local machine:
      
      machine1.foo.com % lldb
      (lldb) platform process list 
      PID    PARENT USER       GROUP      EFF USER   EFF GROUP  TRIPLE                   NAME
      ====== ====== ========== ========== ========== ========== ======================== ============================
      99538  1      username   usergroup  username   usergroup  x86_64-apple-darwin      FileMerge
      94943  1      username   usergroup  username   usergroup  x86_64-apple-darwin      mdworker
      94852  244    username   usergroup  username   usergroup  x86_64-apple-darwin      Safari
      94727  244    username   usergroup  username   usergroup  x86_64-apple-darwin      Xcode
      92742  92710  username   usergroup  username   usergroup  i386-apple-darwin        debugserver
      
      
      This of course also works remotely with the lldb-platform:
      
      machine1.foo.com % lldb-platform --listen 1234
      
      machine2.foo.com % lldb
      (lldb) platform create remote-macosx
        Platform: remote-macosx
       Connected: no
      (lldb) platform connect connect://localhost:1444
        Platform: remote-macosx
          Triple: x86_64-apple-darwin
      OS Version: 10.6.7 (10J869)
          Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
        Hostname: machine1.foo.com
       Connected: yes
      (lldb) platform process list 
      PID    PARENT USER       GROUP      EFF USER   EFF GROUP  TRIPLE                   NAME
      ====== ====== ========== ========== ========== ========== ======================== ============================
      99556  244    username   usergroup  username   usergroup  x86_64-apple-darwin      trustevaluation
      99548  65539  username   usergroup  username   usergroup  x86_64-apple-darwin      lldb
      99538  1      username   usergroup  username   usergroup  x86_64-apple-darwin      FileMerge
      94943  1      username   usergroup  username   usergroup  x86_64-apple-darwin      mdworker
      94852  244    username   usergroup  username   usergroup  x86_64-apple-darwin      Safari
      
      The lldb-platform implements everything with the Host:: layer, so this should
      "just work" for linux. I will probably be adding more stuff to the Host layer
      for launching processes and attaching to processes so that this support should
      eventually just work as well.
      
      Modified the target to be able to be created with an architecture that differs
      from the main executable. This is needed for iOS debugging since we can have
      an "armv6" binary which can run on an "armv7" machine, so we want to be able
      to do:
      
      % lldb
      (lldb) platform create remote-ios
      (lldb) file --arch armv7 a.out
      
      Where "a.out" is an armv6 executable. The platform then can correctly decide
      to open all "armv7" images for all dependent shared libraries.
      
      Modified the disassembly to show the current PC value. Example output:
      
      (lldb) disassemble --frame
      a.out`main:
         0x1eb7:  pushl  %ebp
         0x1eb8:  movl   %esp, %ebp
         0x1eba:  pushl  %ebx
         0x1ebb:  subl   $20, %esp
         0x1ebe:  calll  0x1ec3                   ; main + 12 at test.c:18
         0x1ec3:  popl   %ebx
      -> 0x1ec4:  calll  0x1f12                   ; getpid
         0x1ec9:  movl   %eax, 4(%esp)
         0x1ecd:  leal   199(%ebx), %eax
         0x1ed3:  movl   %eax, (%esp)
         0x1ed6:  calll  0x1f18                   ; printf
         0x1edb:  leal   213(%ebx), %eax
         0x1ee1:  movl   %eax, (%esp)
         0x1ee4:  calll  0x1f1e                   ; puts
         0x1ee9:  calll  0x1f0c                   ; getchar
         0x1eee:  movl   $20, (%esp)
         0x1ef5:  calll  0x1e6a                   ; sleep_loop at test.c:6
         0x1efa:  movl   $12, %eax
         0x1eff:  addl   $20, %esp
         0x1f02:  popl   %ebx
         0x1f03:  leave
         0x1f04:  ret
         
      This can be handy when dealing with the new --line options that was recently
      added:
      
      (lldb) disassemble --line
      a.out`main + 13 at test.c:19
         18  	{
      -> 19  		printf("Process: %i\n\n", getpid());
         20  	    puts("Press any key to continue..."); getchar();
      -> 0x1ec4:  calll  0x1f12                   ; getpid
         0x1ec9:  movl   %eax, 4(%esp)
         0x1ecd:  leal   199(%ebx), %eax
         0x1ed3:  movl   %eax, (%esp)
         0x1ed6:  calll  0x1f18                   ; printf
      
      Modified the ModuleList to have a lookup based solely on a UUID. Since the
      UUID is typically the MD5 checksum of a binary image, there is no need
      to give the path and architecture when searching for a pre-existing
      image in an image list.
      
      Now that we support remote debugging a bit better, our lldb_private::Module
      needs to be able to track what the original path for file was as the platform
      knows it, as well as where the file is locally. The module has the two 
      following functions to retrieve both paths:
      
      const FileSpec &Module::GetFileSpec () const;
      const FileSpec &Module::GetPlatformFileSpec () const;
      
      llvm-svn: 128563
      32e0a750
  30. Mar 26, 2011
    • Greg Clayton's avatar
      Added the ability to get the min and max instruction byte size for · 357132eb
      Greg Clayton authored
      an architecture into ArchSpec:
      
      uint32_t
      ArchSpec::GetMinimumOpcodeByteSize() const;
      
      uint32_t
      ArchSpec::GetMaximumOpcodeByteSize() const;
      
      Added an AddressClass to the Instruction class in Disassembler.h.
      This allows decoded instructions to know know if they are code,
      code with alternate ISA (thumb), or even data which can be mixed
      into code. The instruction does have an address, but it is a good
      idea to cache this value so we don't have to look it up more than 
      once.
      
      Fixed an issue in Opcode::SetOpcodeBytes() where the length wasn't
      getting set.
      
      Changed:
      
      	bool
      	SymbolContextList::AppendIfUnique (const SymbolContext& sc);
      
      To:
      	bool
      	SymbolContextList::AppendIfUnique (const SymbolContext& sc, 
      									   bool merge_symbol_into_function);
      
      This function was typically being used when looking up functions
      and symbols. Now if you lookup a function, then find the symbol,
      they can be merged into the same symbol context and not cause
      multiple symbol contexts to appear in a symbol context list that
      describes the same function.
      
      Fixed the SymbolContext not equal operator which was causing mixed
      mode disassembly to not work ("disassembler --mixed --name main").
      
      Modified the disassembler classes to know about the fact we know,
      for a given architecture, what the min and max opcode byte sizes
      are. The InstructionList class was modified to return the max
      opcode byte size for all of the instructions in its list.
      These two fixes means when disassemble a list of instructions and dump 
      them and show the opcode bytes, we can format the output more 
      intelligently when showing opcode bytes. This affects any architectures
      that have varying opcode byte sizes (x86_64 and i386). Knowing the max
      opcode byte size also helps us to be able to disassemble N instructions
      without having to re-read data if we didn't read enough bytes.
      
      Added the ability to set the architecture for the disassemble command.
      This means you can easily cross disassemble data for any supported 
      architecture. I also added the ability to specify "thumb" as an 
      architecture so that we can force disassembly into thumb mode when
      needed. In GDB this was done using a hack of specifying an odd
      address when disassembling. I don't want to repeat this hack in LLDB,
      so the auto detection between ARM and thumb is failing, just specify
      thumb when disassembling:
      
      (lldb) disassemble --arch thumb --name main
      
      You can also have data in say an x86_64 file executable and disassemble
      data as any other supported architecture:
      % lldb a.out
      Current executable set to 'a.out' (x86_64).
      (lldb) b main
      (lldb) run
      (lldb) disassemble --arch thumb --count 2 --start-address 0x0000000100001080 --bytes
      0x100001080:  0xb580 push   {r7, lr}
      0x100001082:  0xaf00 add    r7, sp, #0
      
      Fixed Target::ReadMemory(...) to be able to deal with Address argument object
      that isn't section offset. When an address object was supplied that was
      out on the heap or stack, target read memory would fail. Disassembly uses
      Target::ReadMemory(...), and the example above where we disassembler thumb
      opcodes in an x86 binary was failing do to this bug.
      
      llvm-svn: 128347
      357132eb
  31. Mar 11, 2011
    • Jim Ingham's avatar
      Add a first pass at a "stop hook" mechanism. This allows you to add commands... · 9575d844
      Jim Ingham authored
      Add a first pass at a "stop hook" mechanism.  This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc.  You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
      
      Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
      
      llvm-svn: 127457
      9575d844
  32. Feb 23, 2011
    • Greg Clayton's avatar
      Abtracted all mach-o and ELF out of ArchSpec. This patch is a modified form · 64195a2c
      Greg Clayton authored
      of Stephen Wilson's idea (thanks for the input Stephen!). What I ended up
      doing was:
      - Got rid of ArchSpec::CPU (which was a generic CPU enumeration that mimics
        the contents of llvm::Triple::ArchType). We now rely upon the llvm::Triple 
        to give us the machine type from llvm::Triple::ArchType.
      - There is a new ArchSpec::Core definition which further qualifies the CPU
        core we are dealing with into a single enumeration. If you need support for
        a new Core and want to debug it in LLDB, it must be added to this list. In
        the future we can allow for dynamic core registration, but for now it is
        hard coded.
      - The ArchSpec can now be initialized with a llvm::Triple or with a C string
        that represents the triple (it can just be an arch still like "i386").
      - The ArchSpec can still initialize itself with a architecture type -- mach-o
        with cpu type and subtype, or ELF with e_machine + e_flags -- and this will
        then get translated into the internal llvm::Triple::ArchSpec + ArchSpec::Core.
        The mach-o cpu type and subtype can be accessed using the getter functions:
        
        uint32_t
        ArchSpec::GetMachOCPUType () const;
      
        uint32_t
        ArchSpec::GetMachOCPUSubType () const;
        
        But these functions are just converting out internal llvm::Triple::ArchSpec 
        + ArchSpec::Core back into mach-o. Same goes for ELF.
      
      All code has been updated to deal with the changes.
      
      This should abstract us until later when the llvm::TargetSpec stuff gets
      finalized and we can then adopt it.
      
      llvm-svn: 126278
      64195a2c
  33. Feb 19, 2011
    • Jim Ingham's avatar
      - Changed all the places where CommandObjectReturn was exporting a StreamString to just exporting · 85e8b814
      Jim Ingham authored
      a Stream, and then added GetOutputData & GetErrorData to get the accumulated data.
      - Added a StreamTee that will tee output to two provided lldb::StreamSP's.
      - Made the CommandObjectReturn use this so you can Tee the results immediately to
      the debuggers output file, as well as saving up the results to return when the command
      is done executing.
      - HandleCommands now uses this so that if you have a set of commands that continue the target
      you will see the commands come out as they are processed.
      - The Driver now uses this to output the command results as you go, which makes the interface
      more reactive seeming.
      
      llvm-svn: 126015
      85e8b814
  34. Feb 08, 2011
  35. Jan 27, 2011
    • Greg Clayton's avatar
      Changed the SymbolFile::FindFunction() function calls to only return · 931180e6
      Greg Clayton authored
      lldb_private::Function objects. Previously the SymbolFileSymtab subclass
      would return lldb_private::Symbol objects when it was asked to find functions.
      
      The Module::FindFunctions (...) now take a boolean "bool include_symbols" so
      that the module can track down functions and symbols, yet functions are found
      by the SymbolFile plug-ins (through the SymbolVendor class), and symbols are
      gotten through the ObjectFile plug-ins.
      
      Fixed and issue where the DWARF parser might run into incomplete class member
      function defintions which would make clang mad when we tried to make certain
      member functions with invalid number of parameters (such as an operator=
      operator that had no parameters). Now we just avoid and don't complete these
      incomplete functions.
      
      llvm-svn: 124359
      931180e6
  36. 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
  37. Oct 30, 2010
Loading