This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] remote debugging patches


On Mon, Mar 11, 2002 at 05:06:51PM +0100, Michal Ludvig wrote:
> Daniel Jacobowitz wrote:
> >But you had #define WAIT_FOREVER_FLAG 0.
> 
> During the weekend I was debugging problems in communication between 
> gdb(i386) and gdbserver(x8664). Whenever I was stepping through 
> gdbserver, the other side timeouted. I've found, that last argument to 
> getpkt() is called 'forever', but in all calls was set to '0'. I didn't 
> want these timeouts, so I changed all occurences of 0 to 
> WAIT_FOREVER_FLAG, which could be set in compile-time. Most users and 
> developpers (unless they will work on remote.c or alike) will leave this 
> unchanged to 0, but sometimes it may be handy to set to 1 and recompile.

> >I think what Andrew had in mind was more like
> >
> >enum {
> >  do_not_wait_forever = 0,
> >  wait_forever = 1
> >};
> >
> >and change calls to
> >  getpkt (blah, do_not_wait_forever)
> 
> I don't understand the point of this :-( Then I'd have to change all 
> occurences of do_not_wait_forever to wait_forever in the whole file to 
> change the behaviour? Isn't it much easier to change just one line on 
> top of the file from 'no' to 'yes' instead?

Ah!  This is why you should say clearly what you're trying to
accomplish instead of just posting a patch :)

The right thing to do here is more like:
  - Create the enum, as Andrew or I described it
  - Create the global variable, with a name that does not suggest its
    value, only its meaning.  Something like ``getpkt_default_timeout_flag''.
  - Change all appropriate calls to use the variable.
  - Add ``set remote wait-forever on/off'' to update the variable.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]