Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* RE: async operation
@ 2003-11-17 17:30 Newman, Mark (N-Superior Technical Resource Inc)
  2003-11-18  3:56 ` Andrew Cagney
  0 siblings, 1 reply; 11+ messages in thread
From: Newman, Mark (N-Superior Technical Resource Inc) @ 2003-11-17 17:30 UTC (permalink / raw)
  To: Newman, Mark (N-Superior Technical Resource Inc), gdb

No response on this - so I am going to change GDB so that it will correctly handle an "interrupt" command to stop the inferior when in async mode.

I will put the final changes in as patches and as a bug report unless someone objects.

                                        Mark Newman

> -----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: Friday, November 14, 2003 2:30 PM
> To: gdb@sources.redhat.com
> Subject: async operation
> 
> 
> 
> Is there anyway to cleanly stop a remote target manually when 
> in async mode.
> 
> I tried using the "stop" command which makes it through the 
> async filtering in top.c - however stop simply says it is not 
> a valid command.  There is logic in here for cleanly stopping 
> when a break occurs (?) but I can't find any to allow the 
> operator to stop the target?
> 
> I add'ed "interrupt" to the filtering but it does not clear 
> the target_executing flag.
> 
>                                                               
>      Mark Newman
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread
* async operation
@ 2003-11-25 16:07 Newman, Mark (N-Superior Technical Resource Inc)
  0 siblings, 0 replies; 11+ messages in thread
From: Newman, Mark (N-Superior Technical Resource Inc) @ 2003-11-25 16:07 UTC (permalink / raw)
  To: gdb


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);


^ permalink raw reply	[flat|nested] 11+ messages in thread
* RE: async operation
@ 2003-11-18 15:50 Newman, Mark (N-Superior Technical Resource Inc)
  2003-11-18 15:55 ` Daniel Jacobowitz
  2003-12-04 21:01 ` Elena Zannoni
  0 siblings, 2 replies; 11+ messages in thread
From: Newman, Mark (N-Superior Technical Resource Inc) @ 2003-11-18 15:50 UTC (permalink / raw)
  To: Daniel Jacobowitz, Mark Newman; +Cc: Andrew Cagney, gdb

[-- Attachment #1: Type: text/plain, Size: 1962 bytes --]

IMHO async is not an invention of the client but the manner in which gdb
controls the client. ;-)

I am attaching a gdb output with remote_debug set.  In this instance the
sequence

> interrupt
> cont &

worked once but did not work the second time.

However I am going to suspend asking what happened since my version of
GDB has been modified to accept commands on a socket rather than
directly from the keyboard by substituting the FD for the socket for
stdin.  I added (among other things) the following to main:

  	 gdb_stdout = marks_stdout;
	 gdb_stderr = marks_stdout;
       dr_fd = fdopen(dr_in,"rw" );
       instream = dr_fd;
       reinitialize_event_loop ();

where dr_in is a socket.  Among other things I had to add a reinit to
the event loop to update rl_instream.  These changes will not go into
gdb before they are fully discussed on this forum.

It may be my changes that are causing the problem.

                                       Mark Newman

> -----Original Message-----
> From: gdb-owner@sources.redhat.com
> [mailto:gdb-owner@sources.redhat.com]On Behalf Of Daniel Jacobowitz
> Sent: Tuesday, November 18, 2003 2:13 AM
> To: Mark Newman
> Cc: Andrew Cagney; Newman, Mark (N-Superior Technical Resource Inc);
> gdb@sources.redhat.com
> Subject: Re: async operation
> 
> 
> On Mon, Nov 17, 2003 at 09:33:05PM -0800, Mark Newman wrote:
> > I don't mean to sound dumb but could you clarify what
> > "you can set a hook on `stop'" means?
> 
> Search for hooks in the manual.
> 
> > I see that and am working it now in conjunction with
> > the interrupt command - unless the stop command(?)
> > will do what I am looking for.  GDBserver does not
> > properly respond when in async and an "interrupt" is
> > issued.
> 
> What goes wrong?  It should.  Remember, async is an invention of the
> client - the remote protocol is the same.
> 
> -- 
> Daniel Jacobowitz
> MontaVista Software                         Debian GNU/Linux Developer
> 

[-- Attachment #2: temp.txt --]
[-- Type: text/plain, Size: 2769 bytes --]

00000000007f03000000000000ffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000801f0000ffffffff

Sending packet: $m804953c,4#6d...Ack
Packet received: 00200000
Sending packet: $mbffff81c,4#93...Ack
Packet received: 0e000000
Sending packet: $mbffff818,4#68...Ack
Packet received: 78563412
Sending packet: $mbffff7c0,50#c2...Ack
Packet received: 0d0000004a6f686e20536d69746800429f6d0040b8240140426f6973652c20496461686f00a000407c280140882e014001000000000000001e5801420100000074f8ffbf7cf8ffbf1db2024234120000

remote_stop called
Packet received: T0205:98f7ffbf;04:bcf5ffbf;08:61e50a42;
Sending packet: $g#67...Ack
Packet received: 1cf8ffbfb572fbb72f850408d0a21242b0f7ffbf28f8ffbf2020014074f8ffbff783040802020000230000002b0000002b0000002b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007f03000000000000ffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000801f0000ffffffff

Program received signal SIGINT, Interrupt.
Sending packet: $M4000acb0,1:55#68...Ack
Packet received: ENN
Sending packet: $M4000acb0,1:55#68...Ack
Packet received: ENN
Sending packet: $mbffff830,4#62...Ack
Packet received: 55320000
Sending packet: $mbffff834,4#66...Ack
Packet received: 55320000
0x080483f7 in main (argc=12885, argv=0x3255) at main.c:52
52      while (j < 1000000) {

Sending packet: $c#63...Ack

remote_stop called

Sending packet: $c#63...Packet instead of Ack, ignoring it
Packet instead of Ack, ignoring it
Packet instead of Ack, ignoring it
Packet instead of Ack, ignoring it
Packet instead of Ack, ignoring it
Packet instead of Ack, ignoring it
Sending packet: $c#63...Packet instead of Ack, ignoring it
Packet instead of Ack, ignoring it
Packet instead of Ack, ignoring it
Packet instead of Ack, ignoring it
Packet instead of Ack, ignoring it
Sending packet: $c#63...Packet instead of Ack, ignoring it
Packet instead of Ack, ignoring it
Packet instead of Ack, ignoring it
Packet instead of Ack, ignoring it
Packet instead of Ack, ignoring it
Sending packet: $c#63...Packet instead of Ack, ignoring it
Packet instead of Ack, ignoring it
Packet instead of Ack, ignoring it
Packet instead of Ack, ignoring it
Packet instead of Ack, ignoring it


^ permalink raw reply	[flat|nested] 11+ messages in thread
* async operation
@ 2003-11-14 19:30 Newman, Mark (N-Superior Technical Resource Inc)
  0 siblings, 0 replies; 11+ messages in thread
From: Newman, Mark (N-Superior Technical Resource Inc) @ 2003-11-14 19:30 UTC (permalink / raw)
  To: gdb


Is there anyway to cleanly stop a remote target manually when in async mode.

I tried using the "stop" command which makes it through the async filtering in top.c - however stop simply says it is not a valid command.  There is logic in here for cleanly stopping when a break occurs (?) but I can't find any to allow the operator to stop the target?

I add'ed "interrupt" to the filtering but it does not clear the target_executing flag.

                                                                   Mark Newman


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

end of thread, other threads:[~2003-12-04 22:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-17 17:30 async operation Newman, Mark (N-Superior Technical Resource Inc)
2003-11-18  3:56 ` Andrew Cagney
2003-11-18  5:33   ` Mark Newman
2003-11-18  7:12     ` Daniel Jacobowitz
2003-11-18 14:57     ` Andrew Cagney
  -- strict thread matches above, loose matches on Subject: below --
2003-11-25 16:07 Newman, Mark (N-Superior Technical Resource Inc)
2003-11-18 15:50 Newman, Mark (N-Superior Technical Resource Inc)
2003-11-18 15:55 ` Daniel Jacobowitz
2003-12-04 21:01 ` Elena Zannoni
2003-12-04 22:09   ` Mark Newman
2003-11-14 19:30 Newman, Mark (N-Superior Technical Resource Inc)

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