[ovs-dev] [PATCH] ovs-sandbox: Tell gdb to start the daemon.

Andy Zhou azhou at nicira.com
Fri Apr 10 21:10:50 UTC 2015


Hi, Russell,

Thanks for pointing out the issue.

I am afraid this patch does not solve the problem entirely.  On my
system, the delay in launching an xterm
and the ovsdb-server under gdb is large enough that the same error
message is still produced.

The only real use case for the gdb option is to allow setting break
points before the program starts.
Once the program is launched, one can always attach gdb to a running process.

How about the following patch, that 1) remove the '-ex run' option,
because you are better off attach gdb to a running
process, 2) delay executing ovs-vsctl command until ovsdb-server is
launched.  If this looks reasonable, I can
submit an official patch.

--andy

diff --git a/tutorial/ovs-sandbox b/tutorial/ovs-sandbox
index 251f021..ac1c90e 100755
--- a/tutorial/ovs-sandbox
+++ b/tutorial/ovs-sandbox
@@ -36,7 +36,7 @@ rungdb() {
     if $under_gdb && [ "$DISPLAY" ]; then
         args=`echo $@ |sed s/--detach//g | sed s/--vconsole:off//g`
         xterm_title=$1
-        run_xterm $xterm_title gdb -ex run --args $args
+        run_xterm $xterm_title gdb --args $args
     else
         run $@
     fi
@@ -235,6 +235,14 @@ run ovsdb-tool create conf.db "$schema"
 rungdb $gdb_ovsdb ovsdb-server --detach --no-chdir --pidfile
-vconsole:off --log-file \
     --remote=punix:"$sandbox"/db.sock

+if test ! -e "$sandbox"/db.sock; then
+    echo -n "Waiting for ovsdb-server to start..."
+    while test ! -e "$sandbox"/db.sock; do
+        sleep 0;
+    done
+    echo "  Done"
+fi
+
 # Initialize database.
 run ovs-vsctl --no-wait -- init




On Fri, Apr 3, 2015 at 1:04 PM, Russell Bryant <rbryant at redhat.com> wrote:
> The current gdb support launches gdb but doesn't start the daemon.
> If you start ovsdb-server with gdb, ovs-sandbox produces an error as
> it tries to run ovs-vsctl before ovsdb-server is running.  Telling gdb
> to start the daemon immediately avoids this error.
>
> There are cases where it's useful to go straight to the gdb prompt,
> too.  For example, someone may want to set a breakpoint.  In that
> case, it's easy enough to just kill it, set a breakpoint, and execute
> 'run' again.
>
> In passing, fix indentation to use spaces instead of tabs.
>
> Signed-off-by: Russell Bryant <rbryant at redhat.com>
> ---
>
> Note: This may produce a merge conflict with the ovn branch since I
> fixed the same indentation issue there in a different patch.
>
> ---
>  tutorial/ovs-sandbox | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tutorial/ovs-sandbox b/tutorial/ovs-sandbox
> index 9520a41..251f021 100755
> --- a/tutorial/ovs-sandbox
> +++ b/tutorial/ovs-sandbox
> @@ -35,8 +35,8 @@ rungdb() {
>      # Use "DISPLAY" variable to determine out if X is supported
>      if $under_gdb && [ "$DISPLAY" ]; then
>          args=`echo $@ |sed s/--detach//g | sed s/--vconsole:off//g`
> -       xterm_title=$1
> -       run_xterm $xterm_title gdb --args $args
> +        xterm_title=$1
> +        run_xterm $xterm_title gdb -ex run --args $args
>      else
>          run $@
>      fi
> --
> 2.1.0
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list