[Lldb-commits] [PATCH] Add -exec-arguments command

Greg Clayton clayborg at gmail.com
Wed Feb 4 10:18:42 PST 2015


So remove everything I listed and add m_lldbLaunchOptions to your CMICmnLLDBDebugSessionInfo object and populate it with all of the -exec calls, then use it to launch


================
Comment at: include/lldb/API/SBArgs.h:1-83
@@ +1,83 @@
+//===-- SBArgs.h ------------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBArgs_h_
+#define LLDB_SBArgs_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class SBArgs
+{
+public:
+    SBArgs ();
+
+    SBArgs (bool force_create);
+
+    SBArgs (const SBArgs &rhs);
+
+    ~SBArgs ();
+
+    const lldb::SBArgs &
+    operator = (const lldb::SBArgs &rhs);
+
+    bool
+    IsValid () const;
+
+    size_t
+    GetArgumentCount () const;
+
+    const char *
+    GetArgumentAtIndex (size_t idx) const;
+
+    char **
+    GetArgumentVector ();
+
+    const char **
+    GetConstArgumentVector () const;
+
+    const char *
+    AppendArgument (const char *arg_cstr);
+
+    void
+    Clear ();
+
+protected:
+
+    friend class SBTarget;
+
+    lldb_private::Args *
+    get ();
+
+    const lldb_private::Args *
+    get () const;
+
+    lldb_private::Args *
+    operator -> ();
+
+    const lldb_private::Args &
+    operator * () const;
+
+    lldb_private::Args &
+    ref ();
+
+    void
+    SetArgs (const lldb_private::Args &lldb_args);
+
+private:
+    std::unique_ptr<lldb_private::Args> m_opaque_ap;
+
+    void
+    CreateIfNeeded ();
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBArgs_h_
----------------
Remove this.

================
Comment at: include/lldb/API/SBDefines.h:32
@@ -31,2 +31,3 @@
 class LLDB_API SBAddress;
+class LLDB_API SBArgs;
 class LLDB_API SBBlock;
----------------
Remove this.

================
Comment at: include/lldb/API/SBTarget.h:1050-1056
@@ -1049,3 +1049,9 @@
     GetStackRedZoneSize();
-    
+
+    lldb::SBArgs
+    GetRunArguments () const;
+
+    bool
+    SetRunArguments (const lldb::SBArgs &args);
+
 protected:
----------------
Remove this.

================
Comment at: source/API/CMakeLists.txt:8
@@ -7,2 +7,3 @@
   SBAddress.cpp
+  SBArgs.cpp
   SBBlock.cpp
----------------
Remove this.

================
Comment at: source/API/SBArgs.cpp:1-153
@@ +1,153 @@
+//===-- SBArgs.cpp -------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/API/SBArgs.h"
+#include "lldb/Interpreter/Args.h"
+
+
+using namespace lldb;
+using namespace lldb_private;
+
+
+SBArgs::SBArgs () :
+    m_opaque_ap ()
+{
+}
+
+SBArgs::SBArgs (bool force_create) :
+    m_opaque_ap ()
+{
+    if (force_create)
+        m_opaque_ap.reset (new Args());
+}
+
+SBArgs::SBArgs (const SBArgs &rhs) :
+    m_opaque_ap ()
+{
+    if (rhs.IsValid())
+        m_opaque_ap.reset (new Args(*rhs));
+}
+
+SBArgs::~SBArgs ()
+{
+}
+
+const SBArgs &
+SBArgs::operator = (const SBArgs &rhs)
+{
+    if (rhs.IsValid())
+    {
+        if (m_opaque_ap.get())
+            *m_opaque_ap = *rhs;
+        else
+            m_opaque_ap.reset (new Args(*rhs));
+    }
+    else
+        m_opaque_ap.reset();
+
+    return *this;
+}
+
+bool
+SBArgs::IsValid () const
+{
+    return m_opaque_ap.get() != NULL;
+}
+
+void
+SBArgs::SetArgs (const Args &lldb_args)
+{
+    CreateIfNeeded ();
+    *m_opaque_ap = lldb_args;
+}
+
+size_t
+SBArgs::GetArgumentCount () const
+{
+    if (m_opaque_ap.get())
+        return m_opaque_ap->GetArgumentCount();
+    return 0;
+}
+
+const char *
+SBArgs::GetArgumentAtIndex (size_t idx) const
+{
+    if (m_opaque_ap)
+        return m_opaque_ap->GetArgumentAtIndex(idx);
+    return NULL;
+}
+
+char **
+SBArgs::GetArgumentVector ()
+{
+    if (m_opaque_ap)
+        return m_opaque_ap->GetArgumentVector();
+    return NULL;
+}
+
+const char **
+SBArgs::GetConstArgumentVector () const
+{
+    if (m_opaque_ap)
+        return m_opaque_ap->GetConstArgumentVector();
+    return NULL;
+}
+
+const char *
+SBArgs::AppendArgument (const char *arg_cstr)
+{
+    CreateIfNeeded ();
+    return m_opaque_ap->AppendArgument(arg_cstr);
+}
+
+void
+SBArgs::Clear ()
+{
+    if (m_opaque_ap)
+        m_opaque_ap->Clear();
+}
+
+Args *
+SBArgs::get ()
+{
+    return m_opaque_ap.get();
+}
+
+const Args *
+SBArgs::get () const
+{
+    return m_opaque_ap.get();
+}
+
+Args *
+SBArgs::operator -> ()
+{
+    return m_opaque_ap.get();
+}
+
+const Args &
+SBArgs::operator * () const
+{
+    // Be sure to call "IsValid()" before calling this function or it will crash
+    return *m_opaque_ap;
+}
+
+Args &
+SBArgs::ref ()
+{
+    CreateIfNeeded();
+    return *m_opaque_ap;
+}
+
+void
+SBArgs::CreateIfNeeded ()
+{
+    if (m_opaque_ap.get() == NULL)
+        m_opaque_ap.reset(new Args());
+}
----------------
Remove this.

================
Comment at: source/API/SBTarget.cpp:16
@@ -15,2 +15,3 @@
 
+#include "lldb/API/SBArgs.h"
 #include "lldb/API/SBDebugger.h"
----------------
Remove this.

================
Comment at: source/API/SBTarget.cpp:2933-2958
@@ -2931,1 +2932,27 @@
 
+SBArgs
+SBTarget::GetRunArguments () const
+{
+    SBArgs sb_args;
+    TargetSP target_sp(GetSP());
+    if (target_sp)
+    {
+        Args args;
+        if (m_opaque_sp->GetRunArguments(args))
+            sb_args.SetArgs(args);
+    }
+    return sb_args;
+}
+
+bool
+SBTarget::SetRunArguments (const SBArgs &args)
+{
+    bool result = false;
+    TargetSP target_sp(GetSP());
+    if (target_sp && args.IsValid())
+    {
+        m_opaque_sp->SetRunArguments(*args.get());
+        result = true;
+    }
+    return result;
+}
----------------
Remove this.

http://reviews.llvm.org/D6965

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the lldb-commits mailing list