[RFA] async changes; Was: Re: regarding transparent data ranges (in tracepoint support)

Mark Newman markn_46@yahoo.com
Fri Dec 5 02:22:00 GMT 2003


--- Elena Zannoni <ezannoni@redhat.com> wrote:
> Mark Newman writes:
>  > I looked at gdb/CONTRIBUTE.  I hope that this
> meets
>  > the requirements:
>  > 
> 
> It is usually a good idea to change the subject to
> something relevant
> to the patch. Here you are not dealing with
> tracepoints at all.
> 
> [redirected to gdb-patches only, specified subject]
> 
Change Log:

 2003-11-28 Mark Newman <markn_46@yahoo.com>

   * (infrun.c) set async ok flag for stop
   * (maint.c) set async ok for show
   * (top.c) pay attention to async ok and async wait
   * (cli-cmds.c) set async ok for pwd and help
   * (cli-decode.c) add routine to set async flags
   * (cli-decode.h) define async bits
ASYNC_OK,ASYNC_WAIT


>  > 
> 
> In the Changelog you need an entry for each file,
> and for each file an
> entry for each function you have touched.
> 

Changes below:

===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.122
diff -c -3 -p -r1.122 infrun.c
*** gdb/infrun.c	25 Nov 2003 16:01:36 -0000	1.122
--- gdb/infrun.c	5 Dec 2003 01:59:11 -0000
***************
*** 44,49 ****
--- 44,50 ----
  #include "value.h"
  #include "observer.h"
  #include "language.h"
+ #include "cli/cli-decode.h"
  
  /* Prototypes for local functions */
  
*************** Pass and Stop may be combined.",
NULL));
*** 4005,4010 ****
--- 4006,4012 ----
        add_cmd ("stop", class_obscure,
not_just_help_class_command, "There is no `stop'
command, but you can set a hook on `stop'.\n\
  This allows you to set a list of commands to be run
each time execution\n\
  of the program stops.", &cmdlist);
+       async_cmd(stop_command , ASYNC_OK);
  
    numsigs = (int) TARGET_SIGNAL_LAST;
    signal_stop = (unsigned char *) xmalloc (sizeof
(signal_stop[0]) * numsigs);
Index: gdb/maint.c
===================================================================
RCS file: /cvs/src/src/gdb/maint.c,v
retrieving revision 1.40
diff -c -3 -p -r1.40 maint.c
*** gdb/maint.c	21 Sep 2003 01:26:45 -0000	1.40
--- gdb/maint.c	5 Dec 2003 01:59:12 -0000
*************** Configure variables internal to GDB
that
*** 734,745 ****
  		  0/*allow-unknown*/,
  		  &maintenancelist);
  
!   add_prefix_cmd ("show", class_maintenance,
maintenance_show_cmd, "\
  Show GDB internal variables used by the GDB
maintainer.\n\
  Configure variables internal to GDB that aid in
GDB's maintenance",
  		  &maintenance_show_cmdlist, "maintenance show ",
  		  0/*allow-unknown*/,
  		  &maintenancelist);
  
  #ifndef _WIN32
    add_cmd ("dump-me", class_maintenance,
maintenance_dump_me,
--- 734,747 ----
  		  0/*allow-unknown*/,
  		  &maintenancelist);
  
!   tmpcmd = add_prefix_cmd ("show",
class_maintenance, maintenance_show_cmd, "\
  Show GDB internal variables used by the GDB
maintainer.\n\
  Configure variables internal to GDB that aid in
GDB's maintenance",
  		  &maintenance_show_cmdlist, "maintenance show ",
  		  0/*allow-unknown*/,
  		  &maintenancelist);
+   async_cmd (tmpcmd,ASYNC_OK);
+ 
  
  #ifndef _WIN32
    add_cmd ("dump-me", class_maintenance,
maintenance_dump_me,
Index: gdb/top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.85
diff -c -3 -p -r1.85 top.c
*** gdb/top.c	8 Nov 2003 00:13:03 -0000	1.85
--- gdb/top.c	5 Dec 2003 01:59:14 -0000
*************** execute_command (char *p, int
from_tty)
*** 669,678 ****
        /* If the target is running, we allow only a
limited set of
           commands. */
        if (event_loop_p && target_can_async_p () &&
target_executing)
! 	if (strcmp (c->name, "help") != 0
! 	    && strcmp (c->name, "pwd") != 0
! 	    && strcmp (c->name, "show") != 0
! 	    && strcmp (c->name, "stop") != 0)
  	  error ("Cannot execute this command while the
target is running.");
  
        /* Pass null arg rather than an empty one.  */
--- 669,676 ----
        /* If the target is running, we allow only a
limited set of
           commands. */
        if (event_loop_p && target_can_async_p () &&
target_executing)
! 	    if ((c->flags & ASYNC_OK) != 0)
! 
  	  error ("Cannot execute this command while the
target is running.");
  
        /* Pass null arg rather than an empty one.  */
*************** execute_command (char *p, int
from_tty)
*** 718,723 ****
--- 716,726 ----
        /* If this command has been post-hooked, run
the hook last. */
        execute_cmd_post_hook (c);
  
+       if (event_loop_p && target_can_async_p () &&
target_executing) {
+         if ((c->flags & ASYNC_WAIT) != 0) {
+   	     wait_for_inferior();
+   	    }
+       }
      }
  
    /* Tell the user if the language has changed
(except first time).  */
*************** execute_command (char *p, int
from_tty)
*** 746,753 ****
  	  printf_filtered ("%s\n",
lang_frame_mismatch_warn);
  	  warned = 1;
  	}
!     }
  }
  
  /* Read commands from `instream' and execute them
     until end of file or error reading instream.  */
--- 749,757 ----
  	  printf_filtered ("%s\n",
lang_frame_mismatch_warn);
  	  warned = 1;
  	}
!   }
  }
+ 
  
  /* Read commands from `instream' and execute them
     until end of file or error reading instream.  */
Index: gdb/cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.36
diff -c -3 -p -r1.36 cli-cmds.c
*** gdb/cli/cli-cmds.c	8 Nov 2003 00:13:03 -0000	1.36
--- gdb/cli/cli-cmds.c	5 Dec 2003 01:59:14 -0000
*************** The commands below can be used to
select
*** 1056,1063 ****
  
    /* Define general commands. */
  
!   add_com ("pwd", class_files, pwd_command,
  	"Print working directory.  This is used for your
program as well.");
    c = add_cmd ("cd", class_files, cd_command,
  	       "Set working directory to DIR for debugger
and program being debugged.\n\
  The change does not take effect for the program
being debugged\n\
--- 1056,1065 ----
  
    /* Define general commands. */
  
!   c = add_com ("pwd", class_files, pwd_command,
  	"Print working directory.  This is used for your
program as well.");
+   async_cmd(c, ASYNC_OK);
+ 
    c = add_cmd ("cd", class_files, cd_command,
  	       "Set working directory to DIR for debugger
and program being debugged.\n\
  The change does not take effect for the program
being debugged\n\
*************** when gdb is started.", &cmdlist);
*** 1091,1096 ****
--- 1093,1099 ----
  
    add_com ("quit", class_support, quit_command,
"Exit gdb.");
    c = add_com ("help", class_support, help_command,
"Print list of commands.");
+   async_cmd(c, ASYNC_OK);
    set_cmd_completer (c, command_completer);
    add_com_alias ("q", "quit", class_support, 1);
    add_com_alias ("h", "help", class_support, 1);
Index: gdb/cli/cli-decode.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v
retrieving revision 1.34
diff -c -3 -p -r1.34 cli-decode.c
*** gdb/cli/cli-decode.c	8 Nov 2003 00:13:03 -0000
1.34
--- gdb/cli/cli-decode.c	5 Dec 2003 01:59:15 -0000
*************** cmd_func (struct cmd_list_element
*cmd, 
*** 1539,1542 ****
--- 1539,1550 ----
      error ("Invalid command");
  }
  
+ struct cmd_list_element *
+ async_cmd (struct cmd_list_element *cmd, int f)
+ {
+   
+    cmd->flags |= f;
+  
+    return cmd;
+ }
  
Index: gdb/cli/cli-decode.h
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.h,v
retrieving revision 1.17
diff -c -3 -p -r1.17 cli-decode.h
*** gdb/cli/cli-decode.h	14 Jan 2003 00:49:05 -0000
1.17
--- gdb/cli/cli-decode.h	5 Dec 2003 01:59:16 -0000
*************** cmd_types;
*** 49,54 ****
--- 49,56 ----
  #define CMD_DEPRECATED            0x1
  #define DEPRECATED_WARN_USER      0x2
  #define MALLOCED_REPLACEMENT      0x4
+ #define ASYNC_OK                  0x08
+ #define ASYNC_WAIT                0x10
  
  struct cmd_list_element
    {
*************** struct cmd_list_element
*** 107,112 ****
--- 109,122 ----
         undeprecated or re-deprecated at runtime we
don't want to risk
         calling free on statically allocated memory,
so we check this
         flag.  
+        
+        bit 3: ASYNC_OK when true indicates that the
command can be 
+        executed in ASYNC mode
+        
+        bit 4: ASYNC_WAIT when this bit is true it
indicates that the
+        command needs to receive a response from the
target prior to 
+        completing. Only valid in ASYNC mode.
+        
       */
      int flags;
  



More information about the Gdb-patches mailing list