[nemiver] Catch --remote=HOST:PORT with no binary copy arg



commit fdf252b707a1d921f4fcb4528f4433b940ee3377
Author: Dodji Seketeli <dodji seketeli org>
Date:   Sun Oct 3 19:39:31 2010 +0200

    Catch --remote=HOST:PORT with no binary copy arg
    
    	* src/main.cc (parse_command_line): If the user forgets to provide
    	a binary copy of the binary she wants to debug remotely, catch the
    	case and display a meaningful error.

 src/main.cc |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/main.cc b/src/main.cc
index 21baefa..d57ad31 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -44,6 +44,7 @@ using nemiver::IWorkbench;
 using nemiver::IWorkbenchSafePtr;
 using nemiver::IDBGPerspective;
 using nemiver::common::UString;
+using nemiver::common::GCharSafePtr;
 using nemiver::ISessMgr;
 
 static const UString DBGPERSPECTIVE_PLUGIN_NAME="dbgperspective";
@@ -316,6 +317,28 @@ parse_command_line (int& a_argc,
         memmove (a_argv, inf_argv, inf_argc * sizeof (char*));
         a_argc = inf_argc;
     }
+
+    //***************************************************************
+    // Here goes some sanity checking on the command line parsed so far.
+    //****************************************************************
+
+    // If the user wants to debug a binary running on a remote target,
+    // make sure she provides us with a local copy of the binary too.
+    if (gv_remote) {
+        if (a_argc < 1 || a_argv[0][0] == '-') {
+            cerr << _("Please provide a local copy of the binary "
+                      "you intend to debug remotely.\n"
+                      "Like this:\n")
+                 << "nemiver --remote=" << gv_remote
+                 << " <binary-copy>\n\n";
+            cerr << _("Otherwise, find below the full set of nemiver options.\n");
+            GCharSafePtr help_message;
+            help_message.reset (g_option_context_get_help (context.get (),
+                                                           true, NULL));
+            cerr << help_message.get () << std::endl;
+            return false;
+        }
+    }
     return true;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]