Skip to content
  1. May 17, 2011
  2. May 16, 2011
  3. May 15, 2011
    • Greg Clayton's avatar
      Added the ability to get the return value from a ThreadPlanCallFunction · 70b57657
      Greg Clayton authored
      thread plan. In order to get the return value, you can call:
      
              void
              ThreadPlanCallFunction::RequestReturnValue (lldb::ValueSP &return_value_sp);
              
      This registers a shared pointer to a return value that will get filled in if
      everything goes well. After the thread plan is run the return value will be
      extracted for you.
      
      Added an ifdef to be able to switch between the LLVM MCJIT and the standand JIT.
      We currently have the standard JIT selected because we have some work to do to
      get the MCJIT fuctioning properly.
      
      Added the ability to call functions with 6 argument in the x86_64 ABI.
      
      Added the ability for GDBRemoteCommunicationClient to detect if the allocate
      and deallocate memory packets are supported and to not call allocate memory 
      ("_M") or deallocate ("_m") if we find they aren't supported.
      
      Modified the ProcessGDBRemote::DoAllocateMemory(...) and ProcessGDBRemote::DoDeallocateMemory(...) 
      to be able to deal with the allocate and deallocate memory packets not being 
      supported. If they are not supported, ProcessGDBRemote will switch to calling
      "mmap" and "munmap" to allocate and deallocate memory instead using our 
      trivial function call support.
      
      Modified the "void ProcessGDBRemote::DidLaunchOrAttach()" to correctly ignore 
      the qHostInfo triple information if any was specified in the target. Currently 
      if the target only specifies an architecture when creating the target:
      
      (lldb) target create --arch i386 a.out
      
      Then the vendor, os and environemnt will be adopted by the target.
      
      If the target was created with any triple that specifies more than the arch:
      
      (lldb) target create --arch i386-unknown-unknown a.out
      
      Then the target will maintain its triple and not adopt any new values. This
      can be used to help force bare board debugging where the dynamic loader for
      static files will get used and users can then use "target modules load ..."
      to set addressses for any files that are desired.
      
      Added back some convenience functions to the lldb_private::RegisterContext class
      for writing registers with unsigned values. Also made all RegisterContext
      constructors explicit to make sure we know when an integer is being converted
      to a RegisterValue. 
      
      llvm-svn: 131370
      70b57657
  4. May 14, 2011
  5. May 12, 2011
    • Greg Clayton's avatar
      Cleaned up the ABI::PrepareTrivialCall() function to take three argument · fdeb1563
      Greg Clayton authored
      pointers:
      
              virtual bool
              PrepareTrivialCall (Thread &thread, 
                                  lldb::addr_t sp,
                                  lldb::addr_t functionAddress,
                                  lldb::addr_t returnAddress, 
                                  lldb::addr_t *arg1_ptr,
                                  lldb::addr_t *arg2_ptr,
                                  lldb::addr_t *arg3_ptr) const = 0;
      
      Prior to this it was:
      
              virtual bool
              PrepareTrivialCall (Thread &thread, 
                                  lldb::addr_t sp,
                                  lldb::addr_t functionAddress,
                                  lldb::addr_t returnAddress, 
                                  lldb::addr_t arg,
                                  lldb::addr_t *this_arg,
                                  lldb::addr_t *cmd_arg) const = 0;
      
      This was because the function that called this slowly added more features to
      be able to call a C++ member function that might have a "this" pointer, and 
      then later added "self + cmd" support for objective C. Cleaning this code up
      and the code that calls it makes it easier to implement the functions for
      new targets.
      
      The MacOSX_arm::PrepareTrivialCall() is now filled in and ready for testing.
      
      llvm-svn: 131221
      fdeb1563
    • Jim Ingham's avatar
      Target::EvaluateExpression should suppress stop hooks. · 6026ca37
      Jim Ingham authored
      llvm-svn: 131219
      6026ca37
    • Jim Ingham's avatar
      48028b68
  6. May 11, 2011
    • Greg Clayton's avatar
      Moved all code from ArchDefaultUnwindPlan and ArchVolatileRegs into their · 31f1d2f5
      Greg Clayton authored
      respective ABI plugins as they were plug-ins that supplied ABI specfic info.
      
      Also hookep up the UnwindAssemblyInstEmulation so that it can generate the
      unwind plans for ARM.
      
      Changed the way ABI plug-ins are handed out when you get an instance from
      the plug-in manager. They used to return pointers that would be mananged
      individually by each client that requested them, but now they are handed out
      as shared pointers since there is no state in the ABI objects, they can be
      shared.
      
      llvm-svn: 131193
      31f1d2f5
  7. May 10, 2011
    • Sean Callanan's avatar
      Fixed a bug in which expression-local variables were · e359d9b7
      Sean Callanan authored
      treated as being permanently resident in target
      memory.  In fact, since the expression's stack frame
      is deleted and potentially re-used after the
      expression completes, the variables need to be treated
      as being freeze-dried.
      
      llvm-svn: 131104
      e359d9b7
  8. 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
  9. May 07, 2011
  10. May 04, 2011
  11. May 02, 2011
    • Caroline Tice's avatar
      · 969ed3d1
      Caroline Tice authored
      This patch captures and serializes all output being written by the
      command line driver, including the lldb prompt being output by
      editline, the asynchronous process output & error messages, and
      asynchronous messages written by target stop-hooks.
      
      As part of this it introduces a new Stream class,
      StreamAsynchronousIO.  A StreamAsynchronousIO object is created with a
      broadcaster, who will eventually broadcast the stream's data for a
      listener to handle, and an event type indicating what type of event
      the broadcaster will broadcast.  When the Write method is called on a
      StreamAsynchronousIO object, the data is appended to an internal
      string.  When the Flush method is called on a StreamAsynchronousIO
      object, it broadcasts it's data string and clears the string.
      
      Anything in lldb-core that needs to generate asynchronous output for
      the end-user should use the StreamAsynchronousIO objects.
      
      I have also added a new notification type for InputReaders, to let
      them know that a asynchronous output has been written. This is to
      allow the input readers to, for example, refresh their prompts and
      lines, if desired.  I added the case statements to all the input
      readers to catch this notification, but I haven't added any code for
      handling them yet (except to the IOChannel input reader).
      
      llvm-svn: 130721
      969ed3d1
    • Jim Ingham's avatar
      Adding support for fetching the Dynamic Value for ObjC Objects. · 61be0903
      Jim Ingham authored
      llvm-svn: 130701
      61be0903
  12. Apr 30, 2011
    • Greg Clayton's avatar
      Added the ability to set the Platform path for a module through the SBModule · 2289fa48
      Greg Clayton authored
      interface.
      
      Added a quick way to set the platform though the SBDebugger interface. I will
      actually an a SBPlatform support soon, but for now this will do.
      
      ConnectionFileDescriptor can be passed a url formatted as: "fd://<fd>" where
      <fd> is a file descriptor in the current process. This is handy if you have
      services, deamons, or other tools that can spawn processes and give you a
      file handle.
      
      llvm-svn: 130565
      2289fa48
  13. Apr 26, 2011
    • Greg Clayton's avatar
      Changed the emulate instruction function to take emulate options which · 2ed751bd
      Greg Clayton authored
      are defined as enumerations. Current bits include:
      
              eEmulateInstructionOptionAutoAdvancePC
              eEmulateInstructionOptionIgnoreConditions
      
      Modified the EmulateInstruction class to have a few more pure virtuals that
      can help clients understand how many instructions the emulator can handle:
      
              virtual bool
              SupportsEmulatingIntructionsOfType (InstructionType inst_type) = 0;
      
      
      Where instruction types are defined as:
      
      //------------------------------------------------------------------
      /// Instruction types
      //------------------------------------------------------------------    
      typedef enum InstructionType
      {
          eInstructionTypeAny,                // Support for any instructions at all (at least one)
          eInstructionTypePrologueEpilogue,   // All prologue and epilogue instructons that push and pop register values and modify sp/fp
          eInstructionTypePCModifying,        // Any instruction that modifies the program counter/instruction pointer
          eInstructionTypeAll                 // All instructions of any kind
      
      }  InstructionType;
      
      
      This allows use to tell what an emulator can do and also allows us to request
      these abilities when we are finding the plug-in interface.
      
      Added the ability for an EmulateInstruction class to get the register names
      for any registers that are part of the emulation. This helps with being able
      to dump and log effectively.
      
      The UnwindAssembly class now stores the architecture it was created with in
      case it is needed later in the unwinding process.
      
      Added a function that can tell us DWARF register names for ARM that goes
      along with the source/Utility/ARM_DWARF_Registers.h file: 
      
              source/Utility/ARM_DWARF_Registers.c
              
      Took some of plug-ins out of the lldb_private namespace.
      
      llvm-svn: 130189
      2ed751bd
  14. Apr 25, 2011
  15. 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
    • Jim Ingham's avatar
      Fix up how the ValueObjects manage their life cycle so that you can hand out a shared · 58b59f95
      Jim Ingham authored
      pointer to a ValueObject or any of its dependent ValueObjects, and the whole cluster will
      stay around as long as that shared pointer stays around.
      
      llvm-svn: 130035
      58b59f95
  16. Apr 22, 2011
    • Greg Clayton's avatar
      Did some work on the "register read" command to only show the first register · 385aa28c
      Greg Clayton authored
      set by default when dumping registers. If you want to see all of the register
      sets you can use the "--all" option:
      
      (lldb) register read --all
      
      If you want to just see some register sets, you can currently specify them
      by index:
      
      (lldb) register read --set 0 --set 2
      
      We need to get shorter register set names soon so we can specify the register
      sets by name without having to type too much. I will make this change soon.
      
      You can also have any integer encoded registers resolve the address values
      back to any code or data from the object files using the "--lookup" option.
      Below is sample output when stopped in the libc function "puts" with some
      const strings in registers:
      
      Process 8973 stopped
      * thread #1: tid = 0x2c03, 0x00007fff828fa30f libSystem.B.dylib`puts + 1, stop reason = instruction step into
        frame #0: 0x00007fff828fa30f libSystem.B.dylib`puts + 1
      (lldb) register read --lookup 
      General Purpose Registers:
        rax          = 0x0000000100000e98  "----------------------------------------------------------------------"
        rbx          = 0x0000000000000000
        rcx          = 0x0000000000000001  
        rdx          = 0x0000000000000000
        rdi          = 0x0000000100000e98  "----------------------------------------------------------------------"
        rsi          = 0x0000000100800000
        rbp          = 0x00007fff5fbff710
        rsp          = 0x00007fff5fbff280
        r8           = 0x0000000000000040  
        r9           = 0x0000000000000000
        r10          = 0x0000000000000000
        r11          = 0x0000000000000246  
        r12          = 0x0000000000000000
        r13          = 0x0000000000000000
        r14          = 0x0000000000000000
        r15          = 0x0000000000000000
        rip          = 0x00007fff828fa30f  libSystem.B.dylib`puts + 1
        rflags       = 0x0000000000000246  
        cs           = 0x0000000000000027  
        fs           = 0x0000000000000000
        gs           = 0x0000000000000000
      
      As we can see, we see two constant strings and the PC (register "rip") is 
      showing the code it resolves to.
      
      I fixed the register "--format" option to work as expected.
      
      Added a setting to disable skipping the function prologue when setting 
      breakpoints as a target settings variable:
      
      (lldb) settings set target.skip-prologue false
      
      Updated the user settings controller boolean value handler funciton to be able
      to take the default value so it can correctly respond to the eVarSetOperationClear
      operation.
      
      Did some usability work on the OptionValue classes.
      
      Fixed the "image lookup" command to correctly respond to the "--verbose" 
      option and display the detailed symbol context information when looking up
      line table entries and functions by name. This previously was only working
      for address lookups.
      
      llvm-svn: 129977
      385aa28c
  17. Apr 20, 2011
    • Greg Clayton's avatar
      General cleanup on the UserSettingsController stuff. There were 5 different · 4c20717a
      Greg Clayton authored
      places that were dumping values for the settings. Centralized all of the
      value dumping into a single place. When dumping values that aren't strings
      we no longer surround the value with single quotes. When dumping values that
      are strings, surround the string value with double quotes. When dumping array
      values, assume they are always string values, and don't put quotes around
      dictionary values.
      
      llvm-svn: 129826
      4c20717a
  18. Apr 18, 2011
    • Greg Clayton's avatar
      Centralized a lot of the status information for processes, · 7260f620
      Greg Clayton authored
      threads, and stack frame down in the lldb_private::Process,
      lldb_private::Thread, lldb_private::StackFrameList and the 
      lldb_private::StackFrame classes. We had some command line
      commands that had duplicate versions of the process status
      output ("thread list" and "process status" for example). 
      
      Removed the "file" command and placed it where it should
      have been: "target create". Made an alias for "file" to
      "target create" so we stay compatible with GDB commands.
      
      We can now have multple usable targets in lldb at the
      same time. This is nice for comparing two runs of a program
      or debugging more than one binary at the same time. The
      new command is "target select <target-idx>" and also to see
      a list of the current targets you can use the new "target list"
      command. The flow in a debug session can be:
      
      (lldb) target create /path/to/exe/a.out
      (lldb) breakpoint set --name main
      (lldb) run
      ... hit breakpoint
      (lldb) target create /bin/ls
      (lldb) run /tmp
      Process 36001 exited with status = 0 (0x00000000) 
      (lldb) target list
      Current targets:
        target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
      * target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
      (lldb) target select 0
      Current targets:
      * target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
        target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
      (lldb) bt
      * thread #1: tid = 0x2d03, 0x0000000100000b9a a.out`main + 42 at main.c:16, stop reason = breakpoint 1.1
        frame #0: 0x0000000100000b9a a.out`main + 42 at main.c:16
        frame #1: 0x0000000100000b64 a.out`start + 52
      
      Above we created a target for "a.out" and ran and hit a
      breakpoint at "main". Then we created a new target for /bin/ls
      and ran it. Then we listed the targest and selected our original
      "a.out" program, so we showed two concurent debug sessions
      going on at the same time.
      
      llvm-svn: 129695
      7260f620
  19. Apr 16, 2011
    • Jim Ingham's avatar
      Add support for "dynamic values" for C++ classes. This currently only works... · 78a685aa
      Jim Ingham authored
      Add support for "dynamic values" for C++ classes.  This currently only works for "frame var" and for the
      expressions that are simple enough to get passed to the "frame var" underpinnings.  The parser code will
      have to be changed to also query for the dynamic types & offsets as it is looking up variables.
      
      The behavior of "frame var" is controlled in two ways.  You can pass "-d {true/false} to the frame var
      command to get the dynamic or static value of the variables you are printing.
      
      There's also a general setting:
      
      target.prefer-dynamic-value (boolean) = 'true'
      
      which is consulted if you call "frame var" without supplying a value for the -d option.
      
      llvm-svn: 129623
      78a685aa
  20. Apr 14, 2011
    • Greg Clayton's avatar
      Added auto completion for architecture names and for platforms. · ab65b34f
      Greg Clayton authored
      Modified the OptionGroupOptions to be able to specify only some of the options
      that should be appended by using the usage_mask in the group defintions and
      also provided a way to remap them to a new usage mask after the copy. This 
      allows options to be re-used and also targetted for specific option groups.
      
      Modfied the CommandArgumentType to have a new eArgTypePlatform enumeration.
      Taught the option parser to be able to automatically use the appropriate
      auto completion for a given options if nothing is explicitly specified
      in the option definition. So you don't have to specify it in the option
      definition tables.
      
      Renamed the default host platform name to "host", and the default platform
      hostname to be "localhost".
      
      Modified the "file" and "platform select" commands to make sure all options
      and args are good prior to creating a new platform. Also defer the computation
      of the architecture in the file command until all options are parsed and the
      platform has either not been specified or reset to a new value to avoid
      computing the arch more than once.
      
      Switch the PluginManager code over to using llvm::StringRef for string
      comparisons and got rid of all the AccessorXXX functions in lieu of the newer
      mutex + collection singleton accessors.
      
      llvm-svn: 129483
      ab65b34f
  21. Apr 13, 2011
    • Greg Clayton's avatar
      Added two new classes for command options: · f6b8b581
      Greg Clayton authored
          lldb_private::OptionGroup
          lldb_private::OptionGroupOptions
      
      OptionGroup lets you define a class that encapsulates settings that you want
      to reuse in multiple commands. It contains only the option definitions and the
      ability to set the option values, but it doesn't directly interface with the
      lldb_private::Options class that is the front end to all of the CommandObject
      option parsing. For that the OptionGroupOptions class can be used. It aggregates
      one or more OptionGroup objects and directs the option setting to the 
      appropriate OptionGroup class. For an example of this, take a look at the 
      CommandObjectFile and how it uses its "m_option_group" object shown below
      to be able to set values in both the FileOptionGroup and PlatformOptionGroup
      classes. The members used in CommandObjectFile are:
      
          OptionGroupOptions m_option_group;
          FileOptionGroup m_file_options;
          PlatformOptionGroup m_platform_options;
      
      Then in the constructor for CommandObjectFile you can combine the option
      settings. The code below shows a simplified version of the constructor:
      
      CommandObjectFile::CommandObjectFile(CommandInterpreter &interpreter) :
          CommandObject (...),
          m_option_group (interpreter),
          m_file_options (),
          m_platform_options(true)
      {
          m_option_group.Append (&m_file_options);
          m_option_group.Append (&m_platform_options);
          m_option_group.Finalize();
      }
      
      We append the m_file_options and then the m_platform_options and then tell
      the option group the finalize the results. This allows the m_option_group to
      become the organizer of our prefs and after option parsing we end up with
      valid preference settings in both the m_file_options and m_platform_options
      objects. This also allows any other commands to use the FileOptionGroup and
      PlatformOptionGroup classes to implement options for their commands.
      
      Renamed:
          virtual void Options::ResetOptionValues();
      to:
          virtual void Options::OptionParsingStarting();
      
      And implemented a new callback named:
      
          virtual Error Options::OptionParsingFinished();
          
      This allows Options subclasses to verify that the options all go together
      after all of the options have been specified and gives the chance for the
      command object to return an error. It also gives a chance to take all of the
      option values and produce or initialize objects after all options have
      completed parsing.
      
      Modfied:
      
          virtual Error
          SetOptionValue (int option_idx, const char *option_arg) = 0;
          
      to be:
      
          virtual Error
          SetOptionValue (uint32_t option_idx, const char *option_arg) = 0;
      
      (option_idx is now unsigned).
      
      llvm-svn: 129415
      f6b8b581
  22. Apr 12, 2011
    • Greg Clayton's avatar
      Moved the execution context that was in the Debugger into · 8b82f087
      Greg Clayton authored
      the CommandInterpreter where it was always being used.
      
      Make sure that Modules can track their object file offsets correctly to
      allow opening of sub object files (like the "__commpage" on darwin).
      
      Modified the Platforms to be able to launch processes. The first part of this
      move is the platform soon will become the entity that launches your program
      and when it does, it uses a new ProcessLaunchInfo class which encapsulates
      all process launching settings. This simplifies the internal APIs needed for
      launching. I want to slowly phase out process launching from the process
      classes, so for now we can still launch just as we used to, but eventually
      the platform is the object that should do the launching.
      
      Modified the Host::LaunchProcess in the MacOSX Host.mm to correctly be able
      to launch processes with all of the new eLaunchFlag settings. Modified any
      code that was manually launching processes to use the Host::LaunchProcess
      functions.
      
      Fixed an issue where lldb_private::Args had implicitly defined copy 
      constructors that could do the wrong thing. This has now been fixed by adding
      an appropriate copy constructor and assignment operator.
      
      Make sure we don't add empty ModuleSP entries to a module list.
      
      Fixed the commpage module creation on MacOSX, but we still need to train
      the MacOSX dynamic loader to not get rid of it when it doesn't have an entry
      in the all image infos.
      
      Abstracted many more calls from in ProcessGDBRemote down into the 
      GDBRemoteCommunicationClient subclass to make the classes cleaner and more
      efficient.
      
      Fixed the default iOS ARM register context to be correct and also added support
      for targets that don't support the qThreadStopInfo packet by selecting the
      current thread (only if needed) and then sending a stop reply packet.
      
      Debugserver can now start up with a --unix-socket (-u for short) and can 
      then bind to port zero and send the port it bound to to a listening process
      on the other end. This allows the GDB remote platform to spawn new GDB server
      instances (debugserver) to allow platform debugging.
      
      llvm-svn: 129351
      8b82f087
  23. Apr 11, 2011
  24. 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
  25. Apr 01, 2011
  26. Mar 31, 2011
  27. 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
  28. 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
  29. Mar 25, 2011
    • Greg Clayton's avatar
      Cleaned up the Disassembler code a bit more. You can now request a disassembler · 1080edbc
      Greg Clayton authored
      plugin by name on the command line for when there is more than one disassembler
      plugin.
      
      Taught the Opcode class to dump itself so that "disassembler -b" will dump
      the bytes correctly for each opcode type. Modified all places that were passing
      the opcode bytes buffer in so that the bytes could be displayed to just pass
      in a bool that indicates if we should dump the opcode bytes since the opcode
      now lives inside llvm_private::Instruction.
      
      llvm-svn: 128290
      1080edbc
  30. Mar 24, 2011
    • Greg Clayton's avatar
      Fixed the LLDB build so that we can have private types, private enums and · e0d378b3
      Greg Clayton authored
      public types and public enums. This was done to keep the SWIG stuff from
      parsing all sorts of enums and types that weren't needed, and allows us to
      abstract our API better.
      
      llvm-svn: 128239
      e0d378b3
    • Greg Clayton's avatar
      Did a lot more work on abtracting and organizing the platforms. · 1cb6496e
      Greg Clayton authored
      On Mac OS X we now have 3 platforms:
      PlatformDarwin - must be subclassed to fill in the missing pure virtual funcs
                       but this implements all the common functionality between
                       remote-macosx and remote-ios. It also allows for another
                       platform to be used (remote-gdb-server for now) when doing
                       remote connections. Keeping this pluggable will allow for
                       flexibility.
      PlatformMacOSX - Now implements both local and remote macosx desktop platforms.
      PlatformRemoteiOS - Remote only iOS that knows how to locate SDK files in the
                          cached SDK locations on the host.
      
      A new agnostic platform has been created:
      PlatformRemoteGDBServer - this implements the platform using the GDB remote 
                                protocol and uses the built in lldb_private::Host
                                static functions to implement many queries.
      
      llvm-svn: 128193
      1cb6496e
  31. Mar 23, 2011
    • Greg Clayton's avatar
      Added new platform commands: · d314e810
      Greg Clayton authored
      platform connect <args>
      platform disconnect
      
      Each platform can decide the args they want to use for "platform connect". I 
      will need to add a function that gets the connect options for the current
      platform as each one can have different options and argument counts.
      
      Hooked up more functionality in the PlatformMacOSX and PlatformRemoteiOS.
      Also started an platform agnostic PlatformRemoteGDBServer.cpp which can end
      up being used by one or more actual platforms. It can also be specialized and
      allow for platform specific commands.
      
      llvm-svn: 128123
      d314e810
  32. Mar 22, 2011
Loading