This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
FW: async operation
- From: "Newman, Mark (N-Superior Technical Resource Inc)" <mark dot newman at lmco dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 25 Nov 2003 12:26:51 -0500
- Subject: FW: async operation
-----Original Message-----
From: gdb-owner@sources.redhat.com
[mailto:gdb-owner@sources.redhat.com]On Behalf Of Newman, Mark
(N-Superior Technical Resource Inc)
Sent: Tuesday, November 25, 2003 11:06 AM
To: gdb@sources.redhat.com
Subject: async operation
I have made a set of changes that I think will improve the operation in remote async. Among other things it will allow one to add commands like "interrupt" and "quit" to the repetoire of commands that are legal.
I made some design decisions that could have gone another way - e.g. use of the flags field and not using a define for async_cmd. If anyone has strong feelings about this please let me know.
Also I am looking for opinions in general about this.
None of this reflects what Apple has done. I still am not certain that I can use that code.
The changes are:
For a total of less than 20 lines of change
/////////////////////////////////////////////////////////////////////
cli/cli-decode.h
Is
#define CMD_DEPRECATED 0x1
#define DEPRECATED_WARN_USER 0x2
#define MALLOCED_REPLACEMENT 0x4
Should be:
#define CMD_DEPRECATED 0x1
#define DEPRECATED_WARN_USER 0x2
#define MALLOCED_REPLACEMENT 0x4
#define ASYNC_OK 0x08
#define ASYNC_WAIT 0x10
///////////////////////////////////////////////////////////////////////
cli/cli-decode.c
add in the file
struct cmd_list_element *
async_cmd (struct cmd_list_element *cmd, int f)
{
cmd->flags = f;
return cmd;
}
///////////////////////////////////////////////////////////////////////
top.c
Is
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)
Should be
if (event_loop_p && target_can_async_p () && target_executing) {
if ((c->flags & ASYNC_OK) != 0)
/////////////////////////////////////////////////////////////////////////////
top.c
Should be (note add to the end of void execute_command (char *p, int from_tty))
if (event_loop_p && target_can_async_p () && target_executing) {
if ((c->flags & ASYNC_WAIT) != 0) {
wait_for_inferior();
}
}
////////////////////////////////////////////////////////////////////////////
maint.c
Is
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);
Should be
async_cmd ( 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_OK);
////////////////////////////////////////////////////////////////////////////
infrun.c
Is
stop_command =
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);
Should be
#include "cli/cli-decode.h"
stop_command =
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);
//////////////////////////////////////////////////////////////////////////////
cli/cli-cmds.c
Is
c = add_com ("help", class_support, help_command, "Print list of commands.");
Should be
c = add_com ("help", class_support, help_command, "Print list of commands.");
async_cmd(c, ASYNC_OK);
//////////////////////////////////////////////////////////////////////////////
cli/cli-cmds.c
Is
add_com ("pwd", class_files, pwd_command,
"Print working directory. This is used for your program as well.");
Should be
async_cmd(add_com ("pwd", class_files, pwd_command,
"Print working directory. This is used for your program as well.")
, ASYNC_OK);