[Lldb-commits] [lldb] r159511 - in /lldb/trunk: include/lldb/Target/Process.h include/lldb/Target/Target.h source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp source/Target/Process.cpp

Jim Ingham jingham at apple.com
Sun Jul 1 22:40:07 PDT 2012


Author: jingham
Date: Mon Jul  2 00:40:07 2012
New Revision: 159511

URL: http://llvm.org/viewvc/llvm-project?rev=159511&view=rev
Log:
Add an "extra-startup-commands" process setting so we can send some command strings to the actual process plugin to interpret as it wishes.

Modified:
    lldb/trunk/include/lldb/Target/Process.h
    lldb/trunk/include/lldb/Target/Target.h
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=159511&r1=159510&r2=159511&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Mon Jul  2 00:40:07 2012
@@ -87,10 +87,25 @@
         return m_disable_memory_cache;
     }
     
+    const Args &
+    GetExtraStartupCommands () const
+    {
+        return m_extra_startup_commands;
+    }
+    
+    void
+    SetExtraStartupCommands (const Args &args)
+    {
+        m_extra_startup_commands = args;
+    }
+    
 protected:
     const ConstString &
     GetDisableMemoryCacheVarName () const;
     
+    const ConstString &
+    GetExtraStartupCommandVarName () const;
+
     void
     CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings,
                           bool pending);
@@ -98,7 +113,8 @@
     const ConstString
     CreateInstanceName ();
     
-    bool    m_disable_memory_cache;
+    bool        m_disable_memory_cache;
+    Args        m_extra_startup_commands;
 };
 
 //----------------------------------------------------------------------

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=159511&r1=159510&r2=159511&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Mon Jul  2 00:40:07 2012
@@ -128,8 +128,7 @@
     {
         return m_breakpoints_use_platform_avoid;
     }
-    
-    
+        
     const Args &
     GetRunArguments () const
     {

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=159511&r1=159510&r2=159511&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Mon Jul  2 00:40:07 2012
@@ -729,6 +729,14 @@
     m_gdb_comm.GetListThreadsInStopReplySupported ();
     m_gdb_comm.GetHostInfo ();
     m_gdb_comm.GetVContSupported ('c');
+    
+    size_t num_cmds = GetExtraStartupCommands().GetArgumentCount();
+    for (size_t idx = 0; idx < num_cmds; idx++)
+    {
+        StringExtractorGDBRemote response;
+        printf ("Sending command: \%s.\n", GetExtraStartupCommands().GetArgumentAtIndex(idx));
+        m_gdb_comm.SendPacketAndWaitForResponse (GetExtraStartupCommands().GetArgumentAtIndex(idx), response, false);
+    }
     return error;
 }
 

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=159511&r1=159510&r2=159511&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Mon Jul  2 00:40:07 2012
@@ -4866,7 +4866,9 @@
 }
 
 ProcessInstanceSettings::ProcessInstanceSettings (const ProcessInstanceSettings &rhs) :
-    InstanceSettings (Process::GetSettingsController(), CreateInstanceName().AsCString())
+    InstanceSettings (Process::GetSettingsController(), CreateInstanceName().AsCString()),
+    m_disable_memory_cache(rhs.m_disable_memory_cache),
+    m_extra_startup_commands (rhs.m_extra_startup_commands)
 {
     if (m_instance_name != InstanceSettings::GetDefaultName())
     {
@@ -4888,6 +4890,8 @@
 {
     if (this != &rhs)
     {
+        m_disable_memory_cache = rhs.m_disable_memory_cache;
+        m_extra_startup_commands = rhs.m_extra_startup_commands;
     }
 
     return *this;
@@ -4919,6 +4923,10 @@
         }
         
     }
+    else if (var_name == GetExtraStartupCommandVarName())
+    {
+        UserSettingsController::UpdateStringArrayVariable (op, index_value, m_extra_startup_commands, value, err);
+    }
 }
 
 void
@@ -4947,6 +4955,15 @@
         value.AppendString(m_disable_memory_cache ? "true" : "false");
         return true;
     }
+    else if (var_name == GetExtraStartupCommandVarName())
+    {
+        if (m_extra_startup_commands.GetArgumentCount() > 0)
+        {
+            for (int i = 0; i < m_extra_startup_commands.GetArgumentCount(); ++i)
+                value.AppendString (m_extra_startup_commands.GetArgumentAtIndex (i));
+        }
+        return true;
+    }
     else
     {
         if (err)
@@ -4976,6 +4993,14 @@
     return disable_memory_cache_var_name;
 }
 
+const ConstString &
+ProcessInstanceSettings::GetExtraStartupCommandVarName () const
+{
+    static ConstString extra_startup_command_var_name ("extra-startup-command");
+    
+    return extra_startup_command_var_name;
+}
+
 //--------------------------------------------------
 // SettingsController Variable Tables
 //--------------------------------------------------
@@ -4999,6 +5024,7 @@
         "true",
 #endif
         NULL,       false,  false,  "Disable reading and caching of memory in fixed-size units." },
+    { "extra-startup-command", eSetVarTypeArray, NULL, NULL, false,  false,  "A list containing extra commands understood by the particular process plugin used." },
     {  NULL,            eSetVarTypeNone,        NULL,           NULL,       false,  false,  NULL }
 };
 





More information about the lldb-commits mailing list