Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] gdb-events.sh: event notifications w/o args
@ 2001-08-09 13:58 Keith Seitz
  2001-08-10  0:00 ` Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Keith Seitz @ 2001-08-09 13:58 UTC (permalink / raw)
  To: gdb-patches

Hi,

It may happen (sometime soon ;-) that an event notification will occur
with no arguments, e.g.,

  f:void:foo_bar:void

This patch allows gdb-events.sh to deal with such cases. It is currently
emitting code like:

	case foo_bar:
	  vector->foo_bar
);
	  break;

and

struct foo_bar
  {
    void;
  };

Keith

ChangeLog
2001-08-09  Keith Seitz  <keiths@redhat.com>

        * gdb-events.sh: Deal with event notifications with no
        arguments.

Patch
Index: gdb-events.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdb-events.sh,v
retrieving revision 1.9
diff -u -p -r1.9 gdb-events.sh
--- gdb-events.sh	2001/06/07 20:18:45	1.9
+++ gdb-events.sh	2001/08/09 20:57:02
@@ -64,6 +64,7 @@ f:void:breakpoint_modify:int b:b
 f:void:tracepoint_create:int number:number
 f:void:tracepoint_delete:int number:number
 f:void:tracepoint_modify:int number:number
+f:void:foo_bar:void
 #*:void:annotate_starting_hook:void
 #*:void:annotate_stopped_hook:void
 #*:void:annotate_signalled_hook:void
@@ -419,11 +420,13 @@ function_list | while eval read $read
 do
   case "${class}" in
     "f" )
-      echo "struct ${function}"
-      echo "  {"
-      echo "    `echo ${formal} | tr '[,]' '[;]'`;"
-      echo "  };"
-      echo ""
+      if test ${actual}; then
+        echo "struct ${function}"
+        echo "  {"
+        echo "    `echo ${formal} | tr '[,]' '[;]'`;"
+        echo "  };"
+        echo ""
+      fi
       ;;
   esac
 done
@@ -441,7 +444,9 @@ function_list | while eval read $read
 do
   case "${class}" in
     "f" )
-      echo "        struct ${function} ${function};"
+      if test ${actual}; then
+        echo "        struct ${function} ${function};"
+      fi
       ;;
   esac
 done
@@ -517,15 +522,19 @@ do
   case "${class}" in
     "f" )
       echo "        case ${function}:"
-      echo "          vector->${function}"
-      sep="            ("
-      ass=""
-      for arg in `echo ${actual} | tr '[,]' '[:]' | tr -d '[ ]'`; do
-        ass="${ass}${sep}event->data.${function}.${arg}"
-	sep=",
-             "
-      done
-      echo "${ass});"
+      if test ${actual}; then
+        echo "          vector->${function}"
+        sep="            ("
+        ass=""
+        for arg in `echo ${actual} | tr '[,]' '[:]' | tr -d '[ ]'`; do
+          ass="${ass}${sep}event->data.${function}.${arg}"
+	  sep=",
+               "
+        done
+        echo "${ass});"
+      else
+        echo "          vector->${function} ();"
+      fi
       echo "          break;"
       ;;
   esac


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA] gdb-events.sh: event notifications w/o args
  2001-08-09 13:58 [RFA] gdb-events.sh: event notifications w/o args Keith Seitz
@ 2001-08-10  0:00 ` Andrew Cagney
  2001-08-10  9:05   ` Keith Seitz
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2001-08-10  0:00 UTC (permalink / raw)
  To: Keith Seitz; +Cc: gdb-patches

> Hi,
> 
> It may happen (sometime soon  [;-)] that an event notification will occur
> with no arguments, e.g.,


Yes, ok (almost).  Can you just change the ``if'' to use the:

	if test ...
	then
	    ..
	fi

rather than

	if test ...; then
	    ..
	fi

so that it is consistent with the rest of the file (unless you can find 
a GNU SH SCRIPT coding standard which indicates otherwize :-).

I'm also trying to remember if TR has any portability issues (not your 
problem but your patch reminded me :-)

	Andrew


> 
> Keith
> 
> ChangeLog
> 2001-08-09  Keith Seitz  <keiths@redhat.com>
> 
> * gdb-events.sh: Deal with event notifications with no
>         arguments.
> 
> Patch
> Index: gdb-events.sh
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdb-events.sh,v
> retrieving revision 1.9
> diff -u -p -r1.9 gdb-events.sh
> --- gdb-events.sh	2001/06/07 20:18:45	1.9
> +++ gdb-events.sh	2001/08/09 20:57:02
> @@ -64,6 +64,7 @@ f:void:breakpoint_modify:int b:b
>  f:void:tracepoint_create:int number:number
>  f:void:tracepoint_delete:int number:number
>  f:void:tracepoint_modify:int number:number
> +f:void:foo_bar:void
>  #*:void:annotate_starting_hook:void
>  #*:void:annotate_stopped_hook:void
>  #*:void:annotate_signalled_hook:void
> @@ -419,11 +420,13 @@ function_list | while eval read $read
>  do
>    case "${class}" in
>      "f" )
> -      echo "struct ${function}"
> -      echo "  {"
> -      echo "    `echo ${formal} | tr '[,]' '[;]'`;"
> -      echo "  };"
> -      echo ""
> +      if test ${actual}; then
> +        echo "struct ${function}"
> +        echo "  {"
> +        echo "    `echo ${formal} | tr '[,]' '[;]'`;"
> +        echo "  };"
> +        echo ""
> +      fi
>        ;;
>    esac
>  done
> @@ -441,7 +444,9 @@ function_list | while eval read $read
>  do
>    case "${class}" in
>      "f" )
> -      echo "        struct ${function} ${function};"
> +      if test ${actual}; then
> +        echo "        struct ${function} ${function};"
> +      fi
>        ;;
>    esac
>  done
> @@ -517,15 +522,19 @@ do
>    case "${class}" in
>      "f" )
>        echo "        case ${function}:"
> -      echo "          vector->${function}"
> -      sep="            ("
> -      ass=""
> -      for arg in `echo ${actual} | tr '[,]' '[:]' | tr -d '[ ]'`; do
> -        ass="${ass}${sep}event->data.${function}.${arg}"
> -	sep=",
> -             "
> -      done
> -      echo "${ass});"
> +      if test ${actual}; then
> +        echo "          vector->${function}"
> +        sep="            ("
> +        ass=""
> +        for arg in `echo ${actual} | tr '[,]' '[:]' | tr -d '[ ]'`; do
> +          ass="${ass}${sep}event->data.${function}.${arg}"
> +	  sep=",
> +               "
> +        done
> +        echo "${ass});"
> +      else
> +        echo "          vector->${function} ();"
> +      fi
>        echo "          break;"
>        ;;
>    esac
> 
> 
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA] gdb-events.sh: event notifications w/o args
  2001-08-10  0:00 ` Andrew Cagney
@ 2001-08-10  9:05   ` Keith Seitz
  0 siblings, 0 replies; 3+ messages in thread
From: Keith Seitz @ 2001-08-10  9:05 UTC (permalink / raw)
  To: gdb-patches

On Fri, 10 Aug 2001, Andrew Cagney wrote:

> Yes, ok (almost).  Can you just change the ``if'' to use the:
>
> 	if test ...
> 	then
> 	    ..
> 	fi
>
> rather than
>
> 	if test ...; then
> 	    ..
> 	fi
>
> so that it is consistent with the rest of the file (unless you can find
> a GNU SH SCRIPT coding standard which indicates otherwize :-).

Did I do that! Sheesh. Sorry.

For the record, I've committed this patch:

Index: gdb-events.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdb-events.sh,v
retrieving revision 1.9
diff -u -p -r1.9 gdb-events.sh
--- gdb-events.sh	2001/06/07 20:18:45	1.9
+++ gdb-events.sh	2001/08/10 16:03:11
@@ -419,11 +419,14 @@ function_list | while eval read $read
 do
   case "${class}" in
     "f" )
-      echo "struct ${function}"
-      echo "  {"
-      echo "    `echo ${formal} | tr '[,]' '[;]'`;"
-      echo "  };"
-      echo ""
+      if test ${actual}
+      then
+        echo "struct ${function}"
+        echo "  {"
+        echo "    `echo ${formal} | tr '[,]' '[;]'`;"
+        echo "  };"
+        echo ""
+      fi
       ;;
   esac
 done
@@ -441,7 +444,10 @@ function_list | while eval read $read
 do
   case "${class}" in
     "f" )
-      echo "        struct ${function} ${function};"
+      if test ${actual}
+      then
+        echo "        struct ${function} ${function};"
+      fi
       ;;
   esac
 done
@@ -517,15 +523,20 @@ do
   case "${class}" in
     "f" )
       echo "        case ${function}:"
-      echo "          vector->${function}"
-      sep="            ("
-      ass=""
-      for arg in `echo ${actual} | tr '[,]' '[:]' | tr -d '[ ]'`; do
-        ass="${ass}${sep}event->data.${function}.${arg}"
-	sep=",
-             "
-      done
-      echo "${ass});"
+      if test ${actual}
+      then
+        echo "          vector->${function}"
+        sep="            ("
+        ass=""
+        for arg in `echo ${actual} | tr '[,]' '[:]' | tr -d '[ ]'`; do
+          ass="${ass}${sep}event->data.${function}.${arg}"
+	  sep=",
+               "
+        done
+        echo "${ass});"
+      else
+        echo "          vector->${function} ();"
+      fi
       echo "          break;"
       ;;
   esac

> I'm also trying to remember if TR has any portability issues (not your
> problem but your patch reminded me :-)

It's always possible... FWIW, I checked the last patch I had on this file
(which did fiddle with tr) on many hosts, linux, hpux, aix,
solaris, cygwin, osf, and anything else I could get my hands on. It worked
(after much fiddling) on all of them.

Keith


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-08-10  9:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-09 13:58 [RFA] gdb-events.sh: event notifications w/o args Keith Seitz
2001-08-10  0:00 ` Andrew Cagney
2001-08-10  9:05   ` Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox