Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@wins.uva.nl>
To: jimb@cygnus.com
Cc: eliz@is.elta.co.il, gdb-patches@sourceware.cygnus.com
Subject: Re: RFA: minor watchpoint code cleanup
Date: Sat, 01 Apr 2000 00:00:00 -0000	[thread overview]
Message-ID: <200003212357.e2LNvIq05590@delius.kettenis.local> (raw)
In-Reply-To: <npk8iv7vat.fsf@zwingli.cygnus.com>

   From: Jim Blandy <jimb@cygnus.com>
   Date: 21 Mar 2000 18:33:30 -0500

   > The reason is that IMHO we should avoid making a variable (`size')
   > serve two puproses at the same time.

   Good suggestion --- done.

   I'm just waiting for Mark's approval.

Approved.

Mark
From ac131313@cygnus.com Sat Apr 01 00:00:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Elena Zannoni <ezannoni@cygnus.com>
Cc: Philippe De Muyter <phdm@macqel.be>, "gdb-patches@sourceware.cygnus.com" <gdb-patches@sourceware.cygnus.com>
Subject: Re: HAVE_POLL is not enough
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38BCBC3F.56354ECB@cygnus.com>
References: <200002211141.MAA05937@mail.macqel.be> <14513.24286.123785.77651@kwikemart.cygnus.com>
X-SW-Source: 2000-q1/msg00438.html
Content-length: 1724

Elena Zannoni wrote:
> 
> Philippe De Muyter writes:
>  > With the gdb cvs tree of 2000-02-19, on m68k-motorola-sys, configure
>  > correctly detect  that we have `poll', but gdb incorrectly assumes that
>  > `poll' can be used to wait for `stdin'.  On m68k-motorola-sysv, tty's
>  > are not stream-based and not `poll'able.  Should the configure test
>  > be enhanced ? I don't think so if we need to run a target program to check
>  > that, because it would fail if we cross-compile gdb, but if it can be
>  > determined by other ways, like the presence of some constants in some
>  > header files then I would agree.  We could also always compile in the `poll'
>  > version if HAVE_POLL, but switch to the the fall-back method at run time if
>  > poll fails with POLLNVAL.
>  >
> 
> Right now the decision on whether to run gdb with or without the event
> loop is determined by the user as start up, and it is not detected
> neither by configure or at run time. The easiest thing to do for now
> is probably tell the user what happened and switch to
> non-event-loop mode.  Maybe some configury work could be done to
> determine whether the tty's can be pollable, I am not familiar with
> your system enough to know whether this is anything feasible.  Sorry I
> cannot be of more help here.
> How about the 'target async' part, would that work?

As far as I know, this problem is still present.

Following on from Elena's comment.  Is there any known work around or
other hack available?

If we get really desparate there is always the option of putting:

	HOST_POLL_BROKEN

in

	config/m68k/xm-m68kv4.h

:-( (And yes, I'm about to get really desperate).

Philippe, if GDB is forced to use select, does it work?

	Andrew
From jimb@cygnus.com Sat Apr 01 00:00:00 2000
From: Jim Blandy <jimb@cygnus.com>
To: gdb-patches@sourceware.cygnus.com
Subject: RFA: Improved C++ type printing
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200002041447.JAA29317@zwingli.cygnus.com>
X-SW-Source: 2000-q1/msg00075.html
Content-length: 8402

These changes tighten up some of the munging of C++ names GDB does
when printing class methods.  They remove a number of test suite
failures that appear when using Dwarf 2 debugging information (due to
permissible variation between GCC's stabs and Dwarf 2 output).

Specifically:

- In some circumstances, GDB's symbol tables hold qualified names
  of operators or methods ("classname::methodname"), but since GDB is
  printing them out as part of the class definition, the qualifiers
  are redundant (and incorrect, I think).  GDB used to try to peel off
  all the qualifiers using strrchr to scan for colons, but this would
  reach inside template arguments or the function's argument list
  itself, generating garbage.  (In other words, exactly the kind of
  failure you'd expect when using simple-minded string hacking to
  operate on structured data like C++ qualified names.)
  Unfortunately, GDB only has this data in string form, so every
  solution involves some on-the-fly parsing.  My change simply does it
  better.

- C++ supports `type conversion operators', which are operators that
  allow you to specify conversions from user-defined types to basic
  types.  They have names that look like `operator int ()'.  GDB wants
  to avoid printing out the return types for such operators, because
  they are redundant.  However, it has no good way to recognize such
  operators, other than by looking at their name.  Without this
  change, GDB uses the rather reckless heuristic of checking for a
  space after the word "operator".  This assumes that the debug info
  will never provide names like "operator =", and is flat-out wrong
  for things like "operator new" and "operator delete".  Again, my
  change replaces an inadequate parser with something that actually
  does the job according to the C++ grammar.


 
2000-02-04  Jim Blandy  <jimb@redhat.com>

	* c-typeprint.c (remove_qualifiers): New function.
	(c_type_print_base): Use it to remove qualifiers from C++
	qualified names, not strrchr.

	* c-typeprint.c (c_type_print_base): Recognize type conversion
 	operators by calling is_type_conversion_operator.
	(is_type_conversion_operator): New function.
	
Index: c-typeprint.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/c-typeprint.c,v
retrieving revision 2.41
diff -c -r2.41 c-typeprint.c
*** c-typeprint.c	2000/02/01 03:09:00	2.41
--- c-typeprint.c	2000/02/04 14:31:18
***************
*** 433,438 ****
--- 433,567 ----
    fprintf_filtered (stream, ")");
  }
  
+ 
+ /* Return true iff the j'th overloading of the i'th method of TYPE
+    is a type conversion operator, like `operator int () { ... }'.
+    When listing a class's methods, we don't print the return type of
+    such operators.  */
+ static int
+ is_type_conversion_operator (struct type *type, int i, int j)
+ {
+   /* I think the whole idea of recognizing type conversion operators
+      by their name is pretty terrible.  But I don't think our present
+      data structure gives us any other way to tell.  If you know of
+      some other way, feel free to rewrite this function.  */
+   char *name = TYPE_FN_FIELDLIST_NAME (type, i);
+ 
+   if (strncmp (name, "operator", 8) != 0)
+     return 0;
+ 
+   name += 8;
+   if (! strchr (" \t\f\n\r", *name))
+     return 0;
+ 
+   while (strchr (" \t\f\n\r", *name))
+     name++;
+ 
+   if (strncmp (name, "new", 3) == 0)
+     name += 3;
+   else if (strncmp (name, "delete", 6) == 0)
+     name += 6;
+   else
+     return 0;
+ 
+   /* Is that really the end of the name?  */
+   if (('a' <= *name && *name <= 'z')
+       || ('A' <= *name && *name <= 'Z')
+       || ('0' <= *name && *name <= '9')
+       || *name == '_')
+     /* No, so the identifier following "operator" must be a type name,
+        and this is a type conversion operator.  */
+     return 1;
+ 
+   /* That was indeed the end of the name, so it was `operator new' or
+      `operator delete', neither of which are type conversion operators.  */
+   return 0;
+ }
+ 
+ 
+ /* Given a C++ qualified identifier QID, strip off the qualifiers,
+    yielding the unqualified name.  The return value is a pointer into
+    the original string.
+ 
+    It's a pity we don't have this information in some more structured
+    form.  Even the author of this function feels that writing little
+    parsers like this everywhere is stupid.  */
+ static char *
+ remove_qualifiers (char *qid)
+ {
+   int quoted = 0;		/* zero if we're not in quotes;
+ 				   '"' if we're in a double-quoted string;
+ 				   '\'' if we're in a single-quoted string.  */
+   int depth = 0;		/* number of unclosed parens we've seen */
+   char *parenstack = (char *) alloca (strlen (qid));
+   char *scan;
+   char *last = 0;		/* The character after the rightmost
+ 				   `::' token we've seen so far.  */
+ 
+   for (scan = qid; *scan; scan++)
+     {
+       if (quoted)
+ 	{
+ 	  if (*scan == quoted)
+ 	    quoted = 0;
+ 	  else if (*scan == '\\' && *(scan + 1))
+ 	    scan++;
+ 	}
+       else if (scan[0] == ':' && scan[1] == ':')
+ 	{
+ 	  /* If we're inside parenthesis (i.e., an argument list) or
+ 	     angle brackets (i.e., a list of template arguments), then
+ 	     we don't record the position of this :: token, since it's
+ 	     not relevant to the top-level structure we're trying
+ 	     to operate on.  */
+ 	  if (depth == 0)
+ 	    {
+ 	      last = scan + 2;
+ 	      scan++;
+ 	    }
+ 	}
+       else if (*scan == '"' || *scan == '\'')
+ 	quoted = *scan;
+       else if (*scan == '(')
+ 	parenstack[depth++] = ')';
+       else if (*scan == '[')
+ 	parenstack[depth++] = ']';
+       /* We're going to treat <> as a pair of matching characters,
+ 	 since we're more likely to see those in template id's than
+ 	 real less-than characters.  What a crock.  */
+       else if (*scan == '<')
+ 	parenstack[depth++] = '>';
+       else if (*scan == ')' || *scan == ']' || *scan == '>')
+ 	{
+ 	  if (depth > 0 && parenstack[depth - 1] == *scan)
+ 	    depth--;
+ 	  else
+ 	    {
+ 	      /* We're going to do a little error recovery here.  If we
+ 		 don't find a match for *scan on the paren stack, but
+ 		 there is something lower on the stack that does match, we
+ 		 pop the stack to that point.  */
+ 	      int i;
+ 
+ 	      for (i = depth - 1; i >= 0; i--)
+ 		if (parenstack[i] == *scan)
+ 		  {
+ 		    depth = i;
+ 		    break;
+ 		  }
+ 	    }
+ 	}
+     }
+ 
+   if (last)
+     return last;
+   else
+     /* We didn't find any :: tokens at the top level, so declare the
+        whole thing an unqualified identifier.  */
+     return qid;
+ }
+ 
+ 
  /* Print any array sizes, function arguments or close parentheses
     needed after the variable name (to describe its type).
     Args work like c_type_print_varspec_prefix.  */
***************
*** 896,903 ****
  		    }
  		  else if (!is_constructor &&	/* constructors don't have declared types */
  			   !is_full_physname_constructor &&	/*    " "  */
! 			   !strstr (method_name, "operator "))	/* Not a type conversion operator */
! 		    /* (note space -- other operators don't have it) */
  		    {
  		      type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)),
  				  "", stream, -1);
--- 1025,1031 ----
  		    }
  		  else if (!is_constructor &&	/* constructors don't have declared types */
  			   !is_full_physname_constructor &&	/*    " "  */
! 			   !is_type_conversion_operator (type, i, j))
  		    {
  		      type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)),
  				  "", stream, -1);
***************
*** 931,945 ****
  		  else
  		    {
  		      char *p;
! 		      char *demangled_no_class = strrchr (demangled_name, ':');
  
!                       if (demangled_no_class == NULL)
!                         demangled_no_class = demangled_name;
!                       else
!                         {
!                           ++demangled_no_class; /* skip over last ':' */
! 			}
! 		      /* get rid of the static word appended by the demangler */
  		      p = strstr (demangled_no_class, " static");
  		      if (p != NULL)
  			{
--- 1059,1068 ----
  		  else
  		    {
  		      char *p;
! 		      char *demangled_no_class
! 			= remove_qualifiers (demangled_name);
  
! 		      /* get rid of the `static' appended by the demangler */
  		      p = strstr (demangled_no_class, " static");
  		      if (p != NULL)
  			{
From scottb@netwinder.org Sat Apr 01 00:00:00 2000
From: Scott Bambrough <scottb@netwinder.org>
To: Nick Clifton <nickc@cygnus.com>
Cc: rearnsha@arm.com, pb@futuretv.com, gcc-patches@gcc.gnu.org, binutils@sourceware.cygnus.com, gdb-patches@sourceware.cygnus.com
Subject: Re: Incompatability between APCS and ATPCS
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38C0442A.1991F3AE@netwinder.org>
References: <200003032226.OAA16432@elmo.cygnus.com>
X-SW-Source: 2000-q1/msg00486.html
Content-length: 584

Nick Clifton wrote:
 
> One thing that this patch does not do is implement the GDB side of
> things, maybe somebody else would like to do that ?
> 
> What do you think - should we go with this patch ?

Thanks for taking the time to look into this problem.  I haven't had time to
evaluate the patch yet, but I will volunteer to implement the GDB side of things
once we have agreed on the patch.  I'm trying to get some other problems fixed
up before GDB 5.0 ships.

Scott

-- 
Scott Bambrough - Software Engineer
REBEL.COM    http://www.rebel.com
NetWinder    http://www.netwinder.org
From dima@Chg.RU Sat Apr 01 00:00:00 2000
From: Dmitry Sivachenko <dima@Chg.RU>
To: eliz@is.elta.co.il
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: Patch to gdb.texinfo
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200003130944.MAA64255@netserv1.chg.ru>
References: <200003130906.MAA63437@netserv1.chg.ru> <200003121611.TAA45044@netserv1.chg.ru> <200003130859.DAA25938@indy.delorie.com> <200003130933.EAA25971@indy.delorie.com>
X-SW-Source: 2000-q1/msg00663.html
Content-length: 771

   >    > -For complicated cases, you can specify an arbitrary number of @r{-T}@var{section} @var{address}                                               
   >    > +For complicated cases, you can specify an arbitrary number of @samp{@r{-T}@var{section} @var{address}}                                        

   >    I don't see the rationale for this change.  Could you please explain?
   >
   > Look at the printable copy.  Single quotes around `-Tsection address'
   > looks better.

   You don't need a @samp to add the quotes.

   What I wanted to point out was that a @samp whose effect is
   effectively undone by @r and @var is not necessary.

   I'll let Stan decide on this one.

OK, may be it is better to replace @samp with explicit quotes (`.....').

--dima
From eliz@delorie.com Sat Apr 01 00:00:00 2000
From: Eli Zaretskii <eliz@delorie.com>
To: shebs@shebs.cnchost.com
Cc: gdb-patches@sourceware.cygnus.com, 3diff@gnu.org
Subject: Re: GDB manual changes
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200003312310.SAA07152@indy.delorie.com>
References: <38E0E672.478B088F@shebs.cnchost.com>
X-SW-Source: 2000-q1/msg01143.html
Content-length: 1283

> ! @c below produces an acceptable overful hbox. --mew 13aug1993
>   @cindex frameless execution
>   Some compilers provide a way to compile functions so that they operate
> ! without stack frames.  (For example, the @code{@value{GCC}} option
> ! @samp{-fomit-frame-pointer} generates functions without a frame.)
>   This is occasionally done with heavily used library functions to save
>   the frame setup time.  @value{GDBN} has limited facilities for dealing
>   with these function invocations.  If the innermost function invocation
> --- 3661,3675 ----
>   they are assigned by @value{GDBN} to give you a way of designating stack
>   frames in @value{GDBN} commands.
>   
> ! @c The -fomit-frame-pointer below perennially causes hbox overflow
> ! @c underflow problems.
>   @cindex frameless execution
>   Some compilers provide a way to compile functions so that they operate
> ! without stack frames.  (For example, the @value{GCC} option
> ! @example
> ! @samp{-fomit-frame-pointer}
> ! @end example
> ! generates functions without a frame.)

Ouch!  Isn't there a better way of avoiding overflow?  I usually put
in some slack words to do that.  Do you want me to try to find a
better solution?

Anyway, you probably want @noindent after the @example, if this is
left alone.
From msnyder@cygnus.com Sat Apr 01 00:00:00 2000
From: Michael Snyder <msnyder@cygnus.com>
To: Eli Zaretskii <eliz@is.elta.co.il>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH] Running the inferior from breakpoint commands
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38D7F31D.1827@cygnus.com>
References: <200003120759.CAA24402@indy.delorie.com> <200003151624.LAA01228@indy.delorie.com>
X-SW-Source: 2000-q1/msg00875.html
Content-length: 8368

Eli Zaretskii wrote:
> 
> This is about the problem described in the following message:
> 
>   http://sourceware.cygnus.com/ml/gdb/2000-q1/msg00684.html
> 
> The relevant test cases are in gdb/testsuite/gdb.base/commands.exp.

Eli, 

While this is intriguing, I don't think it's as simple as
you suppose.  In the first place, it is a documented limitation
that GDB only partially handles breakpoint command lists if they
contain commands that run the target.  The GDB manual states:

	You can use breakpoint commands to start your program
	up again.  Simply use the continue command, or step,
	or any other command that resumes execution.  Any
	other commands in the command list are ignored, after
	a command that resumes execution.

Note the last sentence.  So despite the fact that the 
testsuite seems to imply that this should work, it is
not expected to.  I have no idea what that test is 
doing in there.  The commands-on-breakpoint behavior
is NOT intended to be recursive.

Therefore what you are trying to do is more of an 
enhancement than a bug fix.  As such, I would need to
see some new tests; and given the difficulty of solving
this problem correctly, they would have to be pretty
thorough.  I would have to see tests for every kind of
execution command (step, next, call, finish, return, etc.)
combined with a wide variety of "things that could go
wrong (expression evaluation using globals, locals, 
recursive vs. non-recursive functions, multiple 
breakpoints on mutually recursive functions...)

If you seriously want to undertake this project, we can
work on a list of criteria that should be tested (things
that can go wrong).  Off the top of my head, I can think
of:

    * What happens if we continue and hit another BP?
    * What happens if we continue and hit the same
      BP, eg. in a recursive function?
    * What happens if we continue and switch threads?
    * What happens if we continue and the program terminates?
    * What happens if we continue, hit another BP, 
      then that BP continues and we hit the first BP?
    * What happens if the program isn't continuable?

On top of that, I have grave concerns about being able
to correctly save and restore all of the internal
debugger state necessary to make this work (the
infrun execution state, the expression chain, etc.)
Not to discourage you from trying it, but I would be 
very suspicious of any effort that only took a few days
to complete.

				Sincerely,
				Michael Snyder

> Here are the patches which correct the problems I described in the
> original message.  After applying them, the test program works as I'd
> expect (and as commands.exp seems to want).
> 
> I didn't see any replies to my message, so I still don't know whether
> the original code works for other platforms (I think it shouldn't).
> Could someone please try commands.exp and tell what you get?
> 
> Please tell if it's okay to commit these changes.  If they are
> accepted, I will also send changes for the docs, since I think there
> are some limitations on what breakpoint commands can do that should be
> documented.
> 
> 2000-03-14  Eli Zaretskii  <eliz@is.elta.co.il>
> 
>         * breakpoint.c (breakpoint_alive_p): New function.
>         (bpstat_do_actions): Allow recursive invocation, provided that the
>         argument isn't identical to the one last seen.  Stop executing
>         commands if their breakpoint no longer exists (e.g., was deleted
>         by the previous command).  Save and restore the bpstat chain if
>         the command proceeded the inferior.  Invoke bpstat_do_actions
>         recursively to process the new bpstat produced when the proceeding
>         inferior stops.
> 
> --- gdb/breakpoint.c~3  Wed Mar  8 20:02:20 2000
> +++ gdb/breakpoint.c    Tue Mar 14 18:17:50 2000
> @@ -1820,6 +1820,20 @@ bpstat_clear_actions (bs)
>      }
>  }
> 
> +/* Is the breakpoint BPT still defined?  */
> +static int
> +breakpoint_alive_p (bpt)
> +     struct breakpoint *bpt;
> +{
> +  struct breakpoint *b;
> +
> +  ALL_BREAKPOINTS (b)
> +    if (b == bpt)
> +      return 1;
> +
> +  return 0;
> +}
> +
>  /* Stub for cleaning up our state if we error-out of a breakpoint command */
>  /* ARGSUSED */
>  static void
> @@ -1838,19 +1852,23 @@ void
>  bpstat_do_actions (bsp)
>       bpstat *bsp;
>  {
> -  bpstat bs;
> +  static bpstat last_bpstat;
> +  bpstat bs, saved_bs;
>    struct cleanup *old_chain;
>    struct command_line *cmd;
> +  int bs_idx, cmd_idx;
> 
>    /* Avoid endless recursion if a `source' command is contained
>       in bs->commands.  */
> -  if (executing_breakpoint_commands)
> +  if (executing_breakpoint_commands
> +      && memcmp (bsp, &last_bpstat, sizeof (*bsp)) == 0)
>      return;
> 
> +  last_bpstat = *bsp;
> +
>    executing_breakpoint_commands = 1;
>    old_chain = make_cleanup (cleanup_executing_breakpoints, 0);
> 
> -top:
>    /* Note that (as of this writing), our callers all appear to
>       be passing us the address of global stop_bpstat.  And, if
>       our calls to execute_control_command cause the inferior to
> @@ -1863,26 +1881,78 @@ top:
>    bs = *bsp;
> 
>    breakpoint_proceeded = 0;
> -  for (; bs != NULL; bs = bs->next)
> +  for (bs_idx = 0; bs != NULL; bs = bs->next, bs_idx++)
>      {
> +      /* If someone deleted the breakpoint associated with this
> +        bpstat, we cannot run its commands, since deleting a
> +        breakpoint nukes its command lines.  */
> +      if (!breakpoint_alive_p (bs->breakpoint_at))
> +       continue;
>        cmd = bs->commands;
> +      cmd_idx = 0;
>        while (cmd != NULL)
>         {
> +         struct cleanup *pchain;
> +         int idx;
> +
> +         saved_bs = bpstat_copy (*bsp);
> +         pchain = make_cleanup ((make_cleanup_func)bpstat_clear, &saved_bs);
>           execute_control_command (cmd);
> 
>           if (breakpoint_proceeded)
> +           {
> +             /* The inferior is proceeded by the command.  We cannot
> +                continue, as the bpstat chain has been blown away by
> +                wait_for_inferior.  But since execution has stopped
> +                again, there is a new bpstat to look at, so start
> +                over.  */
> +             bpstat_do_actions (bsp);
> +
> +             /* Now we need to proceed with any actions of the old
> +                bpstat chain which are still not done.  But first, we
> +                need to restore the old chain, since it was blown
> +                away.  */
> +             *bsp = saved_bs;
> +             bs = *bsp;
> +             last_bpstat = *bsp;
> +
> +             /* Recursive invocation of bpstat_do_actions could reset
> +                breakpoint_proceeded and
> +                executing_breakpoint_commands, so restore their
> +                values.  */
> +             breakpoint_proceeded = 1;
> +             executing_breakpoint_commands = 1;
> +
> +             /* Skip all the actions that were already done.  */
> +             for (idx = 0; idx < bs_idx; idx++)
> +               {
> +                 bs->commands = NULL;
> +                 bs = bs->next;
> +               }
> +             cmd = bs->commands;
> +           }
> +         else
> +           {
> +             bpstat_clear (&saved_bs);
> +             discard_cleanups (pchain);
> +           }
> +         cmd_idx++;
> +         /* The command we just ran could have deleted the
> +            breakpoint.  This nukes the command lines for this
> +            breakpoint, so we cannot continue them.  */
> +         if (!breakpoint_alive_p (bs->breakpoint_at))
>             break;
> +         if (breakpoint_proceeded)
> +           {
> +             /* Skip the commands we already ran.  */
> +             for (idx = 0; idx < cmd_idx; idx++)
> +               cmd = cmd->next;
> +             breakpoint_proceeded = 0;
> +           }
>           else
>             cmd = cmd->next;
>         }
> -      if (breakpoint_proceeded)
> -       /* The inferior is proceeded by the command; bomb out now.
> -          The bpstat chain has been blown away by wait_for_inferior.
> -          But since execution has stopped again, there is a new bpstat
> -          to look at, so start over.  */
> -       goto top;
> -      else
> -       bs->commands = NULL;
> +      bs->commands = NULL;
>      }
> 
>    executing_breakpoint_commands = 0;
From hjl@lucon.org Sat Apr 01 00:00:00 2000
From: "H . J . Lu" <hjl@lucon.org>
To: Jim Kingdon <kingdon@redhat.com>
Cc: kettenis@wins.uva.nl, msnyder@cygnus.com, gdb-patches@sourceware.cygnus.com
Subject: Re: GDB 5.0 2000-03-05
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <20000307205233.A1573@lucon.org>
References: <38C2320A.E2134B29@cygnus.com> <20000305094341.A10426@lucon.org> <br9dojaan.fsf@rtl.cygnus.com> <200003061753.MAA14567@devserv.devel.redhat.com> <20000307161242.A485@lucon.org> <200003080049.e280nAs00441@delius.kettenis.local> <200003080406.XAA02076@devserv.devel.redhat.com>
X-SW-Source: 2000-q1/msg00583.html
Content-length: 1024

On Tue, Mar 07, 2000 at 11:06:49PM -0500, Jim Kingdon wrote:
> > I like this approach.  Then we can simply enable thread_db when we've
> > fixed all critical bugs.
> 
> Agreed.  There just isn't time to get thread_db working for 5.0
> (IMHO).  I'd be interested in hearing reports of how much disabling
> thread_db helps, though (e.g. with mozilla).  The spurious SIGTRAP bug
> is not specific to thread_db but we have at least one report (HJ's)
> that it is worse with thread_db.
> 
> > But the patch looks wrong to me.  Seems to *enable* thread_db by
> > default, end what's up with LIN_CTHREAD_CFLAGS?
> 
> The patch looks OK to me.  If you don't specify --enable-lin-thread
> then thread_db doesn't get set, so LIN_THREAD gets set to empty.  I'm
> not enough of a configure.in person to know whether there is an easier
> way.  Agreed about LIN_CTHREAD_CFLAGS though, I don't see that being
> used anywhere.

I put it there just in case that thread_db requires some changes
in source code which break the old one.


H.J.
From ac131313@cygnus.com Sat Apr 01 00:00:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Kevin Buettner <kevinb@cygnus.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH RFA] Makefile.in, configure.tgt changes for linux/ppc
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38B1EF63.1353F096@cygnus.com>
References: <1000221204205.ZM8213@ocotillo.lan> <38B1CDEA.7191A16A@cygnus.com> <1000222003256.ZM9245@ocotillo.lan>
X-SW-Source: 2000-q1/msg00294.html
Content-length: 599

Kevin Buettner wrote:
> 
> On Feb 22, 10:44am, Andrew Cagney wrote:
> 
> > Kevin, I'd suggest doing it the other way - adding the missing
> > definition of language_h and then commiting that as a separate
> > check-in.  Defining language_h appears to be the adopted convention.
> 
> Okay.  Will do.  (Though I'm not sure I see the point.  Is it our
> goal to wind up with $(foo_h) instead of foo.h for all foo?)

Well, the final goal is to use automake :-)
Fixing the occasional header dependency by using $(foo_h) is, hopefully,
just a way of making our intervening lives easier.

	enjoy,
		Andrew
From ac131313@cygnus.com Sat Apr 01 00:00:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Mark Kettenis <kettenis@wins.uva.nl>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: [Fwd: Updated tools]
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38BCD5C9.9DCFDBCA@cygnus.com>
References: <38BBD180.5EBCF466@cygnus.com> <200002291440.PAA05054@landau.wins.uva.nl>
X-SW-Source: 2000-q1/msg00439.html
Content-length: 625

Mark Kettenis wrote:
> 
>    Date: Wed, 01 Mar 2000 01:02:40 +1100
>    From: Andrew Cagney <ac131313@cygnus.com>
> 
>    Now what this means for GDB I'm not sure.
> 
> I propose that we stich with stock autoconf 2.13 for the parts of the
> repository that are only used by GDB as long as we do not encounter
> any problems.

Yes, that is what we've been doing.  I've added the below to the
contribute notes.

	Andrew


o	If ``gdb/configure.in'' is modified then you don't
	need to include patches to the regenerated file
	``configure''.

	The maintainer will re-generate those files
	using autoconf (2.13 as of 2000-02-29).
From shebs@apple.com Sat Apr 01 00:00:00 2000
From: Stan Shebs <shebs@apple.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: "H . J . Lu" <hjl@valinux.com>, gdb-patches@sourceware.cygnus.com
Subject: Re: A new revised patch for dlclose
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38C7F8F2.3C4AE23C@apple.com>
References: <20000307120800.A27315@valinux.com> <20000307122129.A3568@valinux.com> <38C7C7C7.CD90829D@cygnus.com>
X-SW-Source: 2000-q1/msg00633.html
Content-length: 537

Andrew Cagney wrote:

> H.J., I'm curious.  Who is Sam Lantinga, they don't show up in GDB's
> copyright assignment file.

Sam is the main genius behind all those commercial Linux games you
can see on store shelves these days.  He also maintains the SDL
library, which is the LGPL cross-platform library that makes those
game ports possible.  (Dig under lokigames.com's open source pages
to see more.)  Sam thus qualifies as a key GDB user who should be
taken seriously, and who is clearly not afraid to hack GDB if it
needs it...

Stan
From akale@fermat.vxindia.veritas.com Sat Apr 01 00:00:00 2000
From: "Amit S. Kale" <akale@fermat.vxindia.veritas.com>
To: gdb-patches@sourceware.cygnus.com
Subject: [Patch] option -noreloc in add-symbol-file (linux module debugging)
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <00032414220200.18476@fermat.vxindia.veritas.com>
X-SW-Source: 2000-q1/msg00982.html
Content-length: 564

Hi,

Following patch adds an option -noreloc to command add-symbol-file.
This will allow working around reloction problems if an object file can be
relocated using ld.

linux kernel module debugging:
Buid a relocated file from module file using ld. Get text, data and bss
addresses by generating a module map. Then load it using add-symbol-file with
-noreloc flag which will load it without performing relocations.

This patch includes changes for x86-elf only.

Can this patch be included in gdb?
Thanks.
-- 
Amit Kale
Veritas Software ( http://www.veritas.com )
From kingdon@redhat.com Sat Apr 01 00:00:00 2000
From: Jim Kingdon <kingdon@redhat.com>
To: kettenis@wins.uva.nl
Cc: hjl@lucon.org, msnyder@cygnus.com, gdb-patches@sourceware.cygnus.com
Subject: Re: GDB 5.0 2000-03-05
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200003080406.XAA02076@devserv.devel.redhat.com>
References: <38C2320A.E2134B29@cygnus.com> <20000305094341.A10426@lucon.org> <br9dojaan.fsf@rtl.cygnus.com> <200003061753.MAA14567@devserv.devel.redhat.com> <20000307161242.A485@lucon.org> <200003080049.e280nAs00441@delius.kettenis.local>
X-SW-Source: 2000-q1/msg00581.html
Content-length: 816

> I like this approach.  Then we can simply enable thread_db when we've
> fixed all critical bugs.

Agreed.  There just isn't time to get thread_db working for 5.0
(IMHO).  I'd be interested in hearing reports of how much disabling
thread_db helps, though (e.g. with mozilla).  The spurious SIGTRAP bug
is not specific to thread_db but we have at least one report (HJ's)
that it is worse with thread_db.

> But the patch looks wrong to me.  Seems to *enable* thread_db by
> default, end what's up with LIN_CTHREAD_CFLAGS?

The patch looks OK to me.  If you don't specify --enable-lin-thread
then thread_db doesn't get set, so LIN_THREAD gets set to empty.  I'm
not enough of a configure.in person to know whether there is an easier
way.  Agreed about LIN_CTHREAD_CFLAGS though, I don't see that being
used anywhere.
From msnyder@cygnus.com Sat Apr 01 00:00:00 2000
From: Michael Snyder <msnyder@cygnus.com>
To: gdb-patches@sourceware.cygnus.com
Subject: Re: RFA: breakpoint.c: Minor output fixes for hardware watchpoints
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38E1067A.119C@cygnus.com>
References: <200003072114.WAA26280@reisser.regent.e-technik.tu-muenchen.de>
X-SW-Source: 2000-q1/msg01090.html
Content-length: 5447

Peter.Schauer wrote:
> 
> During implementation of hardware watchpoints on Solaris, I noticed the
> following inconsistencies in breakpoint.c output between software and
> hardware breakpoints.
> 
> 1) insert_breakpoints and do_enable_breakpoint now use select_and_print_frame
>   to reselect frames after frame selection for watchpoint evaluation.
>   Up to gdb-4.18 GDB used select_frame to reselect frames.
>   I have no idea why this was done (I am unable to find a ChangeLog entry,
>   perhaps this was a side effect of the HP merge), and it causes the following
>   confusing output from the recurse.exp testcase:

This change did indeed come in with the HP merge, which was so 
massive that we did not get justifications for every little
change.  I'm going to approve backing this change out.  If 
the folks at HP really need it, let's get a justification 
and a change that doesn't have unpleasant side effects.

Checking in this patch.

> continue
> Continuing.
> #0  recurse (a=10) at /users/pes/gdbnd/devo/gdb/testsuite/gdb.base/recurse.c:15
> 15        if (a == 1)
> Hardware watchpoint 2: b
> 
> Old value = 0
> New value = 10
> recurse (a=10) at /users/pes/gdbnd/devo/gdb/testsuite/gdb.base/recurse.c:19
> 19        b *= recurse (a - 1);
> (gdb) PASS: gdb.base/recurse.exp: continue to first instance watchpoint, first time
> 
> Note the extra frame output before the watchpoint trigger. This is still
> worse in other cases, where we have even more frame output (see below).
> 
> 2) insert_breakpoints tries to reinsert watchpoints even if they are already
>   marked for deletion at next stop, causing the following redundant output,
>   again from the recurse.exp testcase:
> 
> continue
> Continuing.
> #0  recurse (a=5) at /users/pes/gdbnd/devo/gdb/testsuite/gdb.base/recurse.c:20
> 20        return b;
> #0  recurse (a=5) at /users/pes/gdbnd/devo/gdb/testsuite/gdb.base/recurse.c:20
> 20        return b;
> Watchpoint 4 deleted because the program has left the block in
> which its expression is valid.
> #0  0x8048a71 in recurse (a=6) at /users/pes/gdbnd/devo/gdb/testsuite/gdb.base/recurse.c:19
> 19        b *= recurse (a - 1);
> Hardware watchpoint 4 deletedbecause the program has left the block
> in which its expression is valid.
> 0x8048a70 in recurse (a=6) at /users/pes/gdbnd/devo/gdb/testsuite/gdb.base/recurse.c:19
> 19        b *= recurse (a - 1);
> (gdb) PASS: gdb.base/recurse.exp: second instance watchpoint deleted when leaving scope
> 
> Here is a patch for both problems:
> 
> 2000-03-07  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>
> 
>         * breakpoint.c (insert_breakpoints, do_enable_breakpoint):  Reselect
>         the saved frame silently after frame selection for watchpoint
>         evaluation.
>         (insert_breakpoints):  Add missing space in `Hardware watchpoint
>         deleted' message.  Do not reinsert hardware watchpoint if it is
>         already marked for deletion at next stop.
> 
> *** gdb/breakpoint.c.orig       Thu Feb 24 13:41:33 2000
> --- gdb/breakpoint.c    Sat Mar  4 11:42:48 2000
> ***************
> *** 918,923 ****
> --- 918,924 ----
>               b->type == bp_read_watchpoint ||
>               b->type == bp_access_watchpoint)
>              && b->enable == enabled
> +            && b->disposition != del_at_next_stop
>              && !b->inserted
>              && !b->duplicate)
>         {
> ***************
> *** 1005,1011 ****
>           }
>         else
>           {
> !           printf_filtered ("Hardware watchpoint %d deleted", b->number);
>             printf_filtered ("because the program has left the block \n");
>             printf_filtered ("in which its expression is valid.\n");
>             if (b->related_breakpoint)
> --- 1006,1012 ----
>           }
>         else
>           {
> !           printf_filtered ("Hardware watchpoint %d deleted ", b->number);
>             printf_filtered ("because the program has left the block \n");
>             printf_filtered ("in which its expression is valid.\n");
>             if (b->related_breakpoint)
> ***************
> *** 1016,1022 ****
>         /* Restore the frame and level.  */
>         if ((saved_frame != selected_frame) ||
>             (saved_level != selected_frame_level))
> !         select_and_print_frame (saved_frame, saved_level);
> 
>         if (val)
>           return_val = val;     /* remember failure */
> --- 1017,1023 ----
>         /* Restore the frame and level.  */
>         if ((saved_frame != selected_frame) ||
>             (saved_level != selected_frame_level))
> !         select_frame (saved_frame, saved_level);
> 
>         if (val)
>           return_val = val;     /* remember failure */
> ***************
> *** 7536,7543 ****
>         }
> 
>         if (save_selected_frame_level >= 0)
> !       select_and_print_frame (save_selected_frame,
> !                               save_selected_frame_level);
>         value_free_to_mark (mark);
>       }
>     if (modify_breakpoint_hook)
> --- 7558,7564 ----
>         }
> 
>         if (save_selected_frame_level >= 0)
> !       select_frame (save_selected_frame, save_selected_frame_level);
>         value_free_to_mark (mark);
>       }
>     if (modify_breakpoint_hook)
> 
> --
> Peter Schauer                   pes@regent.e-technik.tu-muenchen.de
From geoffk@cygnus.com Sat Apr 01 00:00:00 2000
From: Geoff Keating <geoffk@cygnus.com>
To: gdb-patches@sourceware.cygnus.com
Subject: patch to psim for denormal values
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200003250008.QAA31192@localhost.cygnus.com>
X-SW-Source: 2000-q1/msg01012.html
Content-length: 1148

gcc/testsuite/gcc.c-torture/execute/ieee/20000320-1.c was sending the
sim into a very long (perhaps infinite) loop, because of this typo.

My copy of the ppc 601 user's manual correctly uses '+' here (on page
F-2).

OK to commit?

-- 
- Geoffrey Keating <geoffk@cygnus.com>

===File ~/patches/cygnus/sim-ppc-denormal.patch=============
2000-03-23  Geoff Keating  <geoffk@cygnus.com>

	* ppc-instructions (Disabled_Exponent_Underflow): Increment
	the exponent when denormalizing.

Index: ppc-instructions
===================================================================
RCS file: /cvs/cvsfiles/devo/sim/ppc/ppc-instructions,v
retrieving revision 1.46
diff -p -u -u -p -r1.46 ppc-instructions
--- ppc-instructions	2000/03/02 09:24:10	1.46
+++ ppc-instructions	2000/03/24 01:53:30
@@ -4282,7 +4282,7 @@ void::function::invalid_zero_divide_oper
 	  }
 	    /* G|R|X == zero from above */
 	    while (exp < -126) {
-	      exp = exp - 1;
+	      exp = exp + 1;
 	      frac_grx = (INSERTED64(EXTRACTED64(frac_grx, 0, 54), 1, 55)
 	                  | MASKED64(frac_grx, 55, 55));
 	    }
============================================================
From Peter.Schauer@regent.e-technik.tu-muenchen.de Sat Apr 01 00:00:00 2000
From: "Peter.Schauer" <Peter.Schauer@regent.e-technik.tu-muenchen.de>
To: gdb-patches@sourceware.cygnus.com
Subject: Problem with gdb/objfiles.c and --with-mmalloc + fix
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200002232157.WAA26169@reisser.regent.e-technik.tu-muenchen.de>
X-SW-Source: 2000-q1/msg00341.html
Content-length: 1678

I have used --with-mmalloc with GDB configure for a long time to get sort of
a poor man's purify. Unfortunately gdb/objfiles.c suffered some bitrot
during the last year, here is a fix:


2000-02-23  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>

	* objfiles.c (open_mapped_file):  Fix obsolete references to `mapped'
	parameter.


*** ./gdb/objfiles.c.orig	Tue Dec  7 04:56:03 1999
--- ./gdb/objfiles.c	Thu Feb 17 10:56:51 2000
***************
*** 865,871 ****
      {
        free (symsfilename);
        symsfilename = concat (filename, ".syms", (char *) NULL);
!       fd = open_existing_mapped_file (symsfilename, mtime, mapped);
      }
  
    /* If we don't have an open file by now, then either the file does not
--- 865,871 ----
      {
        free (symsfilename);
        symsfilename = concat (filename, ".syms", (char *) NULL);
!       fd = open_existing_mapped_file (symsfilename, mtime, flags);
      }
  
    /* If we don't have an open file by now, then either the file does not
***************
*** 877,883 ****
       By default the file is rw for everyone, with the user's umask taking
       care of turning off the permissions the user wants off. */
  
!   if ((fd < 0) && mapped)
      {
        free (symsfilename);
        symsfilename = concat ("./", basename (filename), ".syms",
--- 877,883 ----
       By default the file is rw for everyone, with the user's umask taking
       care of turning off the permissions the user wants off. */
  
!   if ((fd < 0) && (flags & OBJF_MAPPED))
      {
        free (symsfilename);
        symsfilename = concat ("./", basename (filename), ".syms",

-- 
Peter Schauer			pes@regent.e-technik.tu-muenchen.de
From eliz@delorie.com Sat Apr 01 00:00:00 2000
From: Eli Zaretskii <eliz@delorie.com>
To: gdb-patches@sourceware.cygnus.com
Subject: [PATCH] Patches to go32-nat.c
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200003151619.LAA01221@indy.delorie.com>
X-SW-Source: 2000-q1/msg00710.html
Content-length: 17903

These were committed a couple of days ago, but my message about them
somehow didn't make it.

2000-03-13  Eli Zaretskii  <eliz@is.elta.co.il>

	* go32-nat.c (struct env387): Remove declaration.
	(print_387_status, i386_go32_float_info): Remove redundant
	functions.
	(regno_mapping, sig_map, excepn_map): Add braces around inner
	initializers.
	(many functions): Use ATTRIBUTE_UNUSED to shut up the compiler;
	fix code which mixed signed with unsigned.
	(go32_resume): Use TARGET_SIGNAL_LAST instead of -1.
	(go32_wait): Initialize INT3_addr.
	(go32_fetch_registers): Extend all FP registers that are shorter
	than 4 bytes to 32 bits.  Support 32 standard FP registers defined
	on config/i386/tm-i386.h.
	(store_register): Support 32 FP registers.
	(go32_create_inferior): Don't crash if handed a NULL pointer
	instead of exec file name.
	(ignore): Remove unused function.
	(go32_insert_hw_breakpoint): Remove unused variables.
	(init_go32_ops): Set value of processing_gcc_compilation to 2.

--- ../gdb5-pre/gdb/go32-nat.c	Wed Feb  9 11:13:24 2000
+++ ./gdb/go32-nat.c	Fri Mar 10 22:22:56 2000
@@ -22,13 +22,12 @@
 #include <fcntl.h>
 
 #include "defs.h"
-#include "frame.h"		/* required by inferior.h */
 #include "inferior.h"
-#include "target.h"
 #include "gdb_wait.h"
 #include "gdbcore.h"
 #include "command.h"
 #include "floatformat.h"
+#include "buildsym.h"
 
 #include <stdio.h>		/* required for __DJGPP_MINOR__ */
 #include <stdlib.h>
@@ -137,23 +136,6 @@ int redir_debug_init (cmdline_t *ptr) { 
 
 extern void _initialize_go32_nat (void);
 
-struct env387
-  {
-    unsigned short control;
-    unsigned short r0;
-    unsigned short status;
-    unsigned short r1;
-    unsigned short tag;
-    unsigned short r2;
-    unsigned long eip;
-    unsigned short code_seg;
-    unsigned short opcode;
-    unsigned long operand;
-    unsigned short operand_seg;
-    unsigned short r3;
-    unsigned char regs[8][10];
-  };
-
 typedef enum { wp_insert, wp_remove, wp_count } wp_op;
 
 /* This holds the current reference counts for each debug register.  */
@@ -164,7 +146,6 @@ extern char **environ;
 #define SOME_PID 42
 
 static int prog_has_started = 0;
-static void print_387_status (unsigned short status, struct env387 *ep);
 static void go32_open (char *name, int from_tty);
 static void go32_close (int quitting);
 static void go32_attach (char *args, int from_tty);
@@ -184,8 +165,6 @@ static void go32_create_inferior (char *
 static void cleanup_dregs (void);
 static void go32_mourn_inferior (void);
 static int go32_can_run (void);
-static void ignore (void);
-static void ignore2 (char *a, int b);
 static int go32_insert_aligned_watchpoint (CORE_ADDR waddr, CORE_ADDR addr,
 					   int len, int rw);
 static int go32_remove_aligned_watchpoint (CORE_ADDR waddr, CORE_ADDR addr,
@@ -198,92 +177,6 @@ static void go32_terminal_init (void);
 static void go32_terminal_inferior (void);
 static void go32_terminal_ours (void);
 
-static void
-print_387_status (unsigned short status, struct env387 *ep)
-{
-  int i;
-  int bothstatus;
-  int top;
-  int fpreg;
-
-  bothstatus = ((status != 0) && (ep->status != 0));
-  if (status != 0)
-    {
-      if (bothstatus)
-	printf_unfiltered ("u: ");
-      print_387_status_word (status);
-    }
-
-  if (ep->status != 0)
-    {
-      if (bothstatus)
-	printf_unfiltered ("e: ");
-      print_387_status_word (ep->status);
-    }
-
-  print_387_control_word (ep->control & 0xffff);
-  /* Other platforms say "last exception", but that's not true: the
-     FPU stores the last non-control instruction there.  */
-  printf_unfiltered ("last FP instruction: ");
-  /* The ORing with D800h restores the upper 5 bits of the opcode that
-     are not stored by the FPU (since these bits are the same for all
-     floating-point instructions).  */
-  printf_unfiltered ("opcode %s; ",
-		     local_hex_string (ep->opcode ? (ep->opcode|0xd800) : 0));
-  printf_unfiltered ("pc %s:", local_hex_string (ep->code_seg));
-  printf_unfiltered ("%s; ", local_hex_string (ep->eip));
-  printf_unfiltered ("operand %s", local_hex_string (ep->operand_seg));
-  printf_unfiltered (":%s\n", local_hex_string (ep->operand));
-
-  top = (ep->status >> 11) & 7;
-
-  printf_unfiltered ("regno tag     msb              lsb  value\n");
-  for (fpreg = 7; fpreg >= 0; fpreg--)
-    {
-      /* FNSAVE saves the FP registers in their logical TOP-relative
-	 order, beginning with ST(0).  Since we need to print them in
-	 their physical order, we have to remap them.  */
-      int  regno = fpreg - top;
-      long double val;
-
-      if (regno < 0)
-	regno += 8;
-
-      printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : "  ", fpreg);
-
-      switch ((ep->tag >> (fpreg * 2)) & 3)
-	{
-	case 0:
-	  printf_unfiltered ("valid   ");
-	  break;
-	case 1:
-	  printf_unfiltered ("zero    ");
-	  break;
-	case 2:
-	  /* All other versions of print_387_status use TRAP here, but I
-	     think this is misleading, since Intel manuals say SPECIAL.  */
-	  printf_unfiltered ("special ");
-	  break;
-	case 3:
-	  printf_unfiltered ("empty   ");
-	  break;
-	}
-      for (i = 9; i >= 0; i--)
-	printf_unfiltered ("%02x", ep->regs[regno][i]);
-
-      REGISTER_CONVERT_TO_VIRTUAL (FP0_REGNUM+regno, builtin_type_long_double,
-				   &ep->regs[regno], &val);
-
-      printf_unfiltered ("  %.19LG\n", val);
-    }
-}
-
-void
-i386_go32_float_info (void)
-{
-  print_387_status (0, (struct env387 *) &npx);
-}
-
 #define r_ofs(x) (offsetof(TSS,x))
 
 static struct
@@ -293,110 +186,111 @@ static struct
 }
 regno_mapping[] =
 {
-  r_ofs (tss_eax), 4,	/* normal registers, from a_tss */
-    r_ofs (tss_ecx), 4,
-    r_ofs (tss_edx), 4,
-    r_ofs (tss_ebx), 4,
-    r_ofs (tss_esp), 4,
-    r_ofs (tss_ebp), 4,
-    r_ofs (tss_esi), 4,
-    r_ofs (tss_edi), 4,
-    r_ofs (tss_eip), 4,
-    r_ofs (tss_eflags), 4,
-    r_ofs (tss_cs), 2,
-    r_ofs (tss_ss), 2,
-    r_ofs (tss_ds), 2,
-    r_ofs (tss_es), 2,
-    r_ofs (tss_fs), 2,
-    r_ofs (tss_gs), 2,
-    0, 10,		/* 8 FP registers, from npx.reg[] */
-    1, 10,
-    2, 10,
-    3, 10,
-    4, 10,
-    5, 10,
-    6, 10,
-    7, 10,
+  {r_ofs (tss_eax), 4},	/* normal registers, from a_tss */
+  {r_ofs (tss_ecx), 4},
+  {r_ofs (tss_edx), 4},
+  {r_ofs (tss_ebx), 4},
+  {r_ofs (tss_esp), 4},
+  {r_ofs (tss_ebp), 4},
+  {r_ofs (tss_esi), 4},
+  {r_ofs (tss_edi), 4},
+  {r_ofs (tss_eip), 4},
+  {r_ofs (tss_eflags), 4},
+  {r_ofs (tss_cs), 2},
+  {r_ofs (tss_ss), 2},
+  {r_ofs (tss_ds), 2},
+  {r_ofs (tss_es), 2},
+  {r_ofs (tss_fs), 2},
+  {r_ofs (tss_gs), 2},
+  {0, 10},		/* 8 FP registers, from npx.reg[] */
+  {1, 10},
+  {2, 10},
+  {3, 10},
+  {4, 10},
+  {5, 10},
+  {6, 10},
+  {7, 10},
 	/* The order of the next 7 registers must be consistent
-	   with their numbering in config/i386/tm-go32.h, which see.  */
-  0, 2,			/* control word, from npx */
-  4, 2,			/* status word, from npx */
-  8, 2,			/* tag word, from npx */
-  16, 2,		/* last FP exception CS from npx */
-  24, 2,		/* last FP exception operand selector from npx */
-  12, 4,		/* last FP exception EIP from npx */
-  20, 4			/* last FP exception operand offset from npx */
+	   with their numbering in config/i386/tm-i386.h, which see.  */
+  {0, 2},		/* control word, from npx */
+  {4, 2},		/* status word, from npx */
+  {8, 2},		/* tag word, from npx */
+  {16, 2},		/* last FP exception CS from npx */
+  {12, 4},		/* last FP exception EIP from npx */
+  {24, 2},		/* last FP exception operand selector from npx */
+  {20, 4},		/* last FP exception operand offset from npx */
+  {18, 2}		/* last FP opcode from npx */
 };
 
 static struct
   {
     int go32_sig;
-    int gdb_sig;
+    enum target_signal gdb_sig;
   }
 sig_map[] =
 {
-  0, TARGET_SIGNAL_FPE,
-    1, TARGET_SIGNAL_TRAP,
+  {0, TARGET_SIGNAL_FPE},
+  {1, TARGET_SIGNAL_TRAP},
   /* Exception 2 is triggered by the NMI.  DJGPP handles it as SIGILL,
      but I think SIGBUS is better, since the NMI is usually activated
      as a result of a memory parity check failure.  */
-    2, TARGET_SIGNAL_BUS,
-    3, TARGET_SIGNAL_TRAP,
-    4, TARGET_SIGNAL_FPE,
-    5, TARGET_SIGNAL_SEGV,
-    6, TARGET_SIGNAL_ILL,
-    7, TARGET_SIGNAL_EMT,	/* no-coprocessor exception */
-    8, TARGET_SIGNAL_SEGV,
-    9, TARGET_SIGNAL_SEGV,
-    10, TARGET_SIGNAL_BUS,
-    11, TARGET_SIGNAL_SEGV,
-    12, TARGET_SIGNAL_SEGV,
-    13, TARGET_SIGNAL_SEGV,
-    14, TARGET_SIGNAL_SEGV,
-    16, TARGET_SIGNAL_FPE,
-    17, TARGET_SIGNAL_BUS,
-    31, TARGET_SIGNAL_ILL,
-    0x1b, TARGET_SIGNAL_INT,
-    0x75, TARGET_SIGNAL_FPE,
-    0x78, TARGET_SIGNAL_ALRM,
-    0x79, TARGET_SIGNAL_INT,
-    0x7a, TARGET_SIGNAL_QUIT,
-    -1, -1
+  {2, TARGET_SIGNAL_BUS},
+  {3, TARGET_SIGNAL_TRAP},
+  {4, TARGET_SIGNAL_FPE},
+  {5, TARGET_SIGNAL_SEGV},
+  {6, TARGET_SIGNAL_ILL},
+  {7, TARGET_SIGNAL_EMT},	/* no-coprocessor exception */
+  {8, TARGET_SIGNAL_SEGV},
+  {9, TARGET_SIGNAL_SEGV},
+  {10, TARGET_SIGNAL_BUS},
+  {11, TARGET_SIGNAL_SEGV},
+  {12, TARGET_SIGNAL_SEGV},
+  {13, TARGET_SIGNAL_SEGV},
+  {14, TARGET_SIGNAL_SEGV},
+  {16, TARGET_SIGNAL_FPE},
+  {17, TARGET_SIGNAL_BUS},
+  {31, TARGET_SIGNAL_ILL},
+  {0x1b, TARGET_SIGNAL_INT},
+  {0x75, TARGET_SIGNAL_FPE},
+  {0x78, TARGET_SIGNAL_ALRM},
+  {0x79, TARGET_SIGNAL_INT},
+  {0x7a, TARGET_SIGNAL_QUIT},
+  {-1, TARGET_SIGNAL_LAST}
 };
 
 static struct {
   enum target_signal gdb_sig;
   int djgpp_excepno;
 } excepn_map[] = {
-  TARGET_SIGNAL_0, -1,
-  TARGET_SIGNAL_ILL, 6,		/* Invalid Opcode */
-  TARGET_SIGNAL_EMT, 7,		/* triggers SIGNOFP */
-  TARGET_SIGNAL_SEGV, 13,	/* GPF */
-  TARGET_SIGNAL_BUS, 17,	/* Alignment Check */
+  {TARGET_SIGNAL_0, -1},
+  {TARGET_SIGNAL_ILL, 6},	/* Invalid Opcode */
+  {TARGET_SIGNAL_EMT, 7},	/* triggers SIGNOFP */
+  {TARGET_SIGNAL_SEGV, 13},	/* GPF */
+  {TARGET_SIGNAL_BUS, 17},	/* Alignment Check */
   /* The rest are fake exceptions, see dpmiexcp.c in djlsr*.zip for
      details.  */
-  TARGET_SIGNAL_TERM, 0x1b,	/* triggers Ctrl-Break type of SIGINT */
-  TARGET_SIGNAL_FPE, 0x75,
-  TARGET_SIGNAL_INT, 0x79,
-  TARGET_SIGNAL_QUIT, 0x7a,
-  TARGET_SIGNAL_ALRM, 0x78,	/* triggers SIGTIMR */
-  TARGET_SIGNAL_PROF, 0x78,
-  -1, -1
+  {TARGET_SIGNAL_TERM, 0x1b},	/* triggers Ctrl-Break type of SIGINT */
+  {TARGET_SIGNAL_FPE, 0x75},
+  {TARGET_SIGNAL_INT, 0x79},
+  {TARGET_SIGNAL_QUIT, 0x7a},
+  {TARGET_SIGNAL_ALRM, 0x78},	/* triggers SIGTIMR */
+  {TARGET_SIGNAL_PROF, 0x78},
+  {TARGET_SIGNAL_LAST, -1}
 };
 
 static void
-go32_open (char *name, int from_tty)
+go32_open (char *name ATTRIBUTE_UNUSED, int from_tty ATTRIBUTE_UNUSED)
 {
   printf_unfiltered ("Done.  Use the \"run\" command to run the program.\n");
 }
 
 static void
-go32_close (int quitting)
+go32_close (int quitting ATTRIBUTE_UNUSED)
 {
 }
 
 static void
-go32_attach (char *args, int from_tty)
+go32_attach (char *args ATTRIBUTE_UNUSED, int from_tty ATTRIBUTE_UNUSED)
 {
   error ("\
 You cannot attach to a running program on this platform.\n\
@@ -404,7 +298,7 @@ Use the `run' command to run DJGPP progr
 }
 
 static void
-go32_detach (char *args, int from_tty)
+go32_detach (char *args ATTRIBUTE_UNUSED, int from_tty ATTRIBUTE_UNUSED)
 {
 }
 
@@ -412,7 +306,7 @@ static int resume_is_step;
 static int resume_signal = -1;
 
 static void
-go32_resume (int pid, int step, enum target_signal siggnal)
+go32_resume (int pid ATTRIBUTE_UNUSED, int step, enum target_signal siggnal)
 {
   int i;
 
@@ -420,7 +314,8 @@ go32_resume (int pid, int step, enum tar
 
   if (siggnal != TARGET_SIGNAL_0 && siggnal != TARGET_SIGNAL_TRAP)
   {
-    for (i = 0, resume_signal = -1; excepn_map[i].gdb_sig != -1; i++)
+    for (i = 0, resume_signal = -1;
+	 excepn_map[i].gdb_sig != TARGET_SIGNAL_LAST; i++)
       if (excepn_map[i].gdb_sig == siggnal)
       {
 	resume_signal = excepn_map[i].djgpp_excepno;
@@ -435,11 +330,11 @@ go32_resume (int pid, int step, enum tar
 static char child_cwd[FILENAME_MAX];
 
 static int
-go32_wait (int pid, struct target_waitstatus *status)
+go32_wait (int pid ATTRIBUTE_UNUSED, struct target_waitstatus *status)
 {
   int i;
   unsigned char saved_opcode;
-  unsigned long INT3_addr;
+  unsigned long INT3_addr = 0;
   int stepping_over_INT = 0;
 
   a_tss.tss_eflags &= 0xfeff;	/* reset the single-step flag (TF) */
@@ -566,9 +461,31 @@ go32_fetch_registers (int regno)
       else if (regno < 24)
 	supply_register (regno,
 			 (char *) &npx.reg[regno_mapping[regno].tss_ofs]);
-      else if (regno < 31)
-	supply_register (regno,
-			 (char *) &npx + regno_mapping[regno].tss_ofs);
+      else if (regno < 32)
+	{
+	  unsigned regval;
+
+	  switch (regno_mapping[regno].size)
+	    {
+	      case 2:
+		regval = *(unsigned short *)
+		  ((char *) &npx + regno_mapping[regno].tss_ofs);
+		regval &= 0xffff;
+		if (regno == FOP_REGNUM && regval)
+		  /* Feature: restore the 5 bits of the opcode
+		     stripped by FSAVE/FNSAVE.  */
+		  regval |= 0xd800;
+		break;
+	      case 4:
+		regval = *(unsigned *)
+		  ((char *) &npx + regno_mapping[regno].tss_ofs);
+		break;
+	      default:
+		internal_error ("\
+Invalid native size for register no. %d in go32_fetch_register.", regno);
+	    }
+	  supply_register (regno, (char *) &regval);
+	}
       else
 	internal_error ("Invalid register no. %d in go32_fetch_register.",
 			regno);
@@ -585,17 +502,19 @@ store_register (int regno)
     rp = (char *) &a_tss + regno_mapping[regno].tss_ofs;
   else if (regno < 24)
     rp = (char *) &npx.reg[regno_mapping[regno].tss_ofs];
-  else if (regno < 31)
+  else if (regno < 32)
     rp = (char *) &npx + regno_mapping[regno].tss_ofs;
   else
     internal_error ("Invalid register no. %d in store_register.", regno);
   memcpy (rp, v, regno_mapping[regno].size);
+  if (regno == FOP_REGNUM)
+    *(short *)rp &= 0x07ff; /* strip high 5 bits, in case they added them */
 }
 
 static void
 go32_store_registers (int regno)
 {
-  int r;
+  unsigned r;
 
   if (regno >= 0)
     store_register (regno);
@@ -613,7 +532,7 @@ go32_prepare_to_store (void)
 
 static int
 go32_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
-		  struct target_ops *target)
+		  struct target_ops *target ATTRIBUTE_UNUSED)
 {
   if (write)
     {
@@ -642,7 +561,7 @@ go32_xfer_memory (CORE_ADDR memaddr, cha
 static cmdline_t child_cmd;	/* parsed child's command line kept here */
 
 static void
-go32_files_info (struct target_ops *target)
+go32_files_info (struct target_ops *target ATTRIBUTE_UNUSED)
 {
   printf_unfiltered ("You are running a DJGPP V2 program.\n");
 }
@@ -672,6 +591,11 @@ go32_create_inferior (char *exec_file, c
   char *cmdline;
   char **env_save = environ;
 
+  /* If no exec file handed to us, get it from the exec-file command -- with
+     a good, common error message if none is specified.  */
+  if (exec_file == 0)
+    exec_file = get_exec_file (1);
+
   if (prog_has_started)
     {
       go32_stop ();
@@ -743,11 +667,6 @@ go32_can_run (void)
   return 1;
 }
 
-static void
-ignore (void)
-{
-}
-
 /* Hardware watchpoint support.  */
 
 #define DR_STATUS 6
@@ -849,7 +768,8 @@ cleanup_dregs (void)
 /* Insert a watchpoint.  */
 
 int
-go32_insert_watchpoint (int pid, CORE_ADDR addr, int len, int rw)
+go32_insert_watchpoint (int pid ATTRIBUTE_UNUSED, CORE_ADDR addr,
+			int len, int rw)
 {
   int ret = go32_insert_aligned_watchpoint (addr, addr, len, rw);
 
@@ -891,7 +811,7 @@ go32_insert_aligned_watchpoint (CORE_ADD
   for (i = 0; i < 4; i++)
   {
     if (!IS_REG_FREE (i) && D_REGS[i] == addr
-	&& DR_DEF (i) == (len_bits | read_write_bits))
+	&& DR_DEF (i) == (unsigned)(len_bits | read_write_bits))
     {
       dr_ref_count[i]++;
       return 0;
@@ -980,7 +900,8 @@ go32_handle_nonaligned_watchpoint (wp_op
 /* Remove a watchpoint.  */
 
 int
-go32_remove_watchpoint (int pid, CORE_ADDR addr, int len, int rw)
+go32_remove_watchpoint (int pid ATTRIBUTE_UNUSED, CORE_ADDR addr,
+			int len, int rw)
 {
   int ret = go32_remove_aligned_watchpoint (addr, addr, len, rw);
 
@@ -1034,7 +955,7 @@ go32_remove_aligned_watchpoint (CORE_ADD
   for (i = 0; i <= 3; i++)
     {
       if (!IS_REG_FREE (i) && D_REGS[i] == addr
-	  && DR_DEF (i) == (len_bits | read_write_bits))
+	  && DR_DEF (i) == (unsigned)(len_bits | read_write_bits))
 	{
 	  dr_ref_count[i]--;
 	  if (dr_ref_count[i] == 0)
@@ -1064,7 +985,7 @@ go32_region_ok_for_watchpoint (CORE_ADDR
    whose access triggered the watchpoint.  */
 
 CORE_ADDR
-go32_stopped_by_watchpoint (int pid, int data_watchpoint)
+go32_stopped_by_watchpoint (int pid ATTRIBUTE_UNUSED, int data_watchpoint)
 {
   int i, ret = 0;
   int status;
@@ -1086,7 +1007,7 @@ go32_stopped_by_watchpoint (int pid, int
 /* Remove a breakpoint.  */
 
 int
-go32_remove_hw_breakpoint (CORE_ADDR addr, CORE_ADDR shadow)
+go32_remove_hw_breakpoint (CORE_ADDR addr, void *shadow ATTRIBUTE_UNUSED)
 {
   int i;
   for (i = 0; i <= 3; i++)
@@ -1103,12 +1024,9 @@ go32_remove_hw_breakpoint (CORE_ADDR add
 }
 
 int
-go32_insert_hw_breakpoint (CORE_ADDR addr, CORE_ADDR shadow)
+go32_insert_hw_breakpoint (CORE_ADDR addr, void *shadow ATTRIBUTE_UNUSED)
 {
   int i;
-  int read_write_bits, len_bits;
-  int free_debug_register;
-  int register_number;
 
   /* Look for an occupied debug register with the same address and the
      same RW and LEN definitions.  If we find one, we can use it for
@@ -1192,7 +1110,7 @@ go32_terminal_init (void)
 }
 
 static void
-go32_terminal_info (char *args, int from_tty)
+go32_terminal_info (char *args ATTRIBUTE_UNUSED, int from_tty ATTRIBUTE_UNUSED)
 {
   printf_unfiltered ("Inferior's terminal is in %s mode.\n",
 		     !inf_mode_valid
@@ -1313,6 +1231,9 @@ init_go32_ops (void)
   /* Initialize child's command line storage.  */
   if (redir_debug_init (&child_cmd) == -1)
     internal_error ("Cannot allocate redirection storage: not enough memory.\n");
+
+  /* We are always processing GCC-compiled programs.  */
+  processing_gcc_compilation = 2;
 }
 
 void
From fnasser@redhat.com Sat Apr 01 00:00:00 2000
From: Fernando Nasser <fnasser@redhat.com>
To: Scott Bambrough <scottb@netwinder.org>
Cc: GDB Patches Mail List <gdb-patches@sourceware.cygnus.com>
Subject: Re: Patch fallen through the cracks?
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38C7BD11.9A8188CF@redhat.com>
References: <38C7ADD4.A6697C36@netwinder.org>
X-SW-Source: 2000-q1/msg00621.html
Content-length: 746

Scott Bambrough wrote:
> 
> Can someone approve this patch please.  It shouldn't be a problem.
> 
> http://sourceware.cygnus.com/ml/gdb-patches/2000-q1/msg00367.html
> 

I would rather have it xfail'ed.  It means that we know this test won't
work on this platform but it is not ding what we want (this is what pass
would mean).

Could you please add a small comment before the "if" as well, explaining
why it won't work on ARM?

After these changes there is no need to resubmit the patch though, just
post what went in.

Thanks.


-- 
Fernando Nasser
Red Hat, Inc. - Toronto                 E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300           Tel:  416-482-2661 ext. 311
Toronto, Ontario   M4P 2C9              Fax:  416-482-6299
From kettenis@wins.uva.nl Sat Apr 01 00:00:00 2000
From: Mark Kettenis <kettenis@wins.uva.nl>
To: ac131313@cygnus.com
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH] Replace ../include/wait.h with gdb_wait.h.
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200002091429.e19ETk916570@delius.kettenis.local>
References: <38A12872.13D194C4@cygnus.com>
X-SW-Source: 2000-q1/msg00102.html
Content-length: 4250

   Date: Wed, 09 Feb 2000 19:42:26 +1100
   From: Andrew Cagney <ac131313@cygnus.com>

   FYI,

   I've just checked in the attatched patch.  It replaces the sometimes
   convoluted sequence:

   [snip]

Great!

   So far this has only been verified on for the d10v-elf target.  Please
   report / submit patches for other targets.

There is a problem with `linux-thread.c', where `gdb_wait.h' is included
before config.h.  This means that HAVE_SYS_WAIT_H and HAVE_WAIT_H are
still undefined and the system headers are never used.

Since `linux-thread.c' uses __W_STOPCODE, and `gdb_wait.h' doesn't
provide a fallback macro I get a linker failure.  Moving up the
include for `defs.h' solves this problem.

The rest of GDB seems to be using WSETSTOP, so it seems appropriate to
use that macro instead of __W_STOPCODE in `linux-thread.c'.  I changed
the definition of WSETSTOP and WSETEXIT in `gdb_wait.h' to use
W_STOPCODE and W_EXITCODE if they are available.  All BSD-derived
systems and systems that try to be source-compatible with BSD (like
Linux and the Hurd) should have those macros.  The change is merely
cosmetic but there might be systems out there that really use a
different way to store this information.

Feel free to do with this patch what you want as long as you make sure
that `gdb_wait.h' is included after `config.h' in `linux-thread.c' :-).

Mark


PS Andrew, concering coding-style, current practice in a lot of GNU
packages is to use extra whitespace after `#' like in the following
example:

#ifndef foobar
# ifdef foo
#  define foobar foo
# else
#  define foobar bar
# endif
#endif

This makes things a bit more readable.  The patch below doesn't do
this, but is it OK to use this style in GDB in the future?  


2000-02-09  Mark Kettenis  <kettenis@gnu.org>

	* linux-thread.c: Include defs.h before gdb_wait.h.
	(linuxthreads_attach): Use WSETSTOP instead of __W_STOPCODE.
	(linuxthreads_create_inferior): Likewise.

	* gdb_wait.h (WSETEXIT): Define in terms of W_EXITCODE if defined.
	(WSETSTOP): Define in terms of W_STOPCODE if defined.


Index: gdb/linux-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-thread.c,v
retrieving revision 1.2
diff -u -r1.2 linux-thread.c
--- gdb/linux-thread.c	2000/02/09 08:52:46	1.2
+++ gdb/linux-thread.c	2000/02/09 14:23:02
@@ -47,13 +47,13 @@
    linuxthreads package heavily relies on wait() synchronization to keep
    them correct.  */
 
+#include "defs.h"
 #include <sys/types.h> /* for pid_t */
 #include <sys/ptrace.h> /* for PT_* flags */
 #include "gdb_wait.h" /* for WUNTRACED and __WCLONE flags */
 #include <signal.h> /* for struct sigaction and NSIG */
 #include <sys/utsname.h>
 
-#include "defs.h"
 #include "target.h"
 #include "inferior.h"
 #include "gdbcore.h"
@@ -1129,7 +1129,7 @@
   linuxthreads_breakpoints_inserted = 1;
   linuxthreads_breakpoint_last = -1;
   linuxthreads_wait_last = -1;
-  linuxthreads_exit_status = __W_STOPCODE(0);
+  WSETSTOP (linuxthreads_exit_status, 0);
 
   child_ops.to_attach (args, from_tty);
 
@@ -1189,7 +1189,7 @@
 	  linuxthreads_find_trap (inferior_pid, 1);
 
 	  linuxthreads_wait_last = -1;
-	  linuxthreads_exit_status = __W_STOPCODE(0);
+	  WSETSTOP (linuxthreads_exit_status, 0);
 	}
 
       linuxthreads_inferior_pid = 0;
@@ -1601,7 +1601,7 @@
   linuxthreads_breakpoints_inserted = 1;
   linuxthreads_breakpoint_last = -1;
   linuxthreads_wait_last = -1;
-  linuxthreads_exit_status = __W_STOPCODE(0);
+  WSETSTOP (linuxthreads_exit_status, 0);
   
   if (linuxthreads_max)
     linuxthreads_attach_pending = 1;
Index: gdb/gdb_wait.h
===================================================================
RCS file: /cvs/src/src/gdb/gdb_wait.h,v
retrieving revision 1.1
diff -u -r1.1 gdb_wait.h
--- gdb/gdb_wait.h	2000/02/09 08:52:45	1.1
+++ gdb/gdb_wait.h	2000/02/09 14:23:07
@@ -86,11 +86,19 @@
 #endif
 
 #ifndef	WSETEXIT
+#ifdef W_EXITCODE
+#define WSETEXIT(w,status) ((w) = W_EXITCODE(status, 0))
+#else
 #define WSETEXIT(w,status) ((w) = (0 | ((status) << 8)))
 #endif
+#endif
 
 #ifndef	WSETSTOP
+#ifndef W_STOPCODE
+#define WSETSTOP(w,sig)    ((w) = W_STOPCODE(sig))
+#else
 #define WSETSTOP(w,sig)	   ((w) = (0177 | ((sig) << 8)))
+#endif
 #endif
 
 /*
From ac131313@cygnus.com Sat Apr 01 00:00:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: [MAINT] Add Glen McCready
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38DFF9A8.43C81352@cygnus.com>
X-SW-Source: 2000-q1/msg01071.html
Content-length: 84

FYI, 

To the write after approval list.

	Andrew

Glen McCready					gkm@cygnus.com
From eliz@delorie.com Sat Apr 01 00:00:00 2000
From: Eli Zaretskii <eliz@delorie.com>
To: cgf@cygnus.com
Cc: kettenis@wins.uva.nl, kevinb@cygnus.com, jimb@cygnus.com, gdb-patches@sourceware.cygnus.com
Subject: Re: Linux sigtramp detection code moved to its proper place
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200003182227.RAA07055@indy.delorie.com>
References: <200003162241.RAA19616@zwingli.cygnus.com> <jimb@cygnus.com> <1000316225504.ZM3009@ocotillo.lan> <20000316180048.A30640@cygnus.com> <200003162311.e2GNBUH00362@delius.kettenis.local> <20000316193609.D30640@cygnus.com>
X-SW-Source: 2000-q1/msg00772.html
Content-length: 1122

> I would be in favor of just creating an i386-linux-tdep.c and working
> out the 8.3 issues later.  Since there are already 8.3 issues in
> the gdb source directory, adding one more is not going to aggravate
> the problem unduly.

I beg to disagree ;-).  Let me explain why.

What I intend to do to resolve the problem of file names clashing in
the 8+3 namespace is to use the feature of DJTAR, an untar utility
which comes with DJGPP, to rename files on the fly.  To this end, I
created a name-mapping file which specifies what files to rename and
how; this file needs to be submitted to DJTAR when unpacking the
distribution.  I will make the file itself part of the distribution
(so DJGPP users will need to unpack that special file first, and then
the rest).

I already spent a frustrating evening creating this name-mapping file;
adding any new files that clash with existing files would require me
to reproduce that file, possibly affecting other files as well.

I respect the decision not to change any names before GDB 5.0 is
released, but in the meantime could we please not add any new files
whose names clash?
From shebs@apple.com Sat Apr 01 00:00:00 2000
From: Stan Shebs <shebs@apple.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: Eli Zaretskii <eliz@is.elta.co.il>, gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH] Fix texinfo problems...
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38E1171F.7651C329@apple.com>
References: <38DB1875.4B504618@cygnus.com> <38DBB937.126C95E@apple.com> <38DC6763.563424A2@cygnus.com> <200003260443.XAA26499@mescaline.gnu.org> <38E05161.9707ED26@cygnus.com>
X-SW-Source: 2000-q1/msg01091.html
Content-length: 462

Andrew Cagney wrote:

> The attatched converts my botch into your patch.
> I've also dropped a copy of texinfo-3.12 into the snapshots directory.
> 
>         sorry,
>                 Andrew
> 
> Stan, ok?

I didn't see your message before doing my big commit this morning,
so some of the changes are redundant.  I would suggest updating
from cvs over your patched file and seeing what's left over after
the merge - the remainder should be much smaller...

Stan
From grante@visi.com Sat Apr 01 00:00:00 2000
From: Grant Edwards <grante@visi.com>
To: gdb-patches@sourceware.cygnus.com
Subject: Patch for RDI target code to allow user-specified devices
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <20000221141155.A31206@visi.com>
X-SW-Source: 2000-q1/msg00284.html
Content-length: 1026

Hello,

The attached patch against 4.18 sources modifies the RDI target
unix comm code to allow users to specify any device they please
to be used for serial and/or parallel communication with the
target.

The current routines limit the user to a certain set of devices
(which never seems to include the one I want).  I've tripped
over this many times.  With the patch applied, the target
commands like

 target rdi s=/whatever/flipping/device/the/user/wants
 target rdi s=/serial/device/name,p=/parallel/device/name

Will accept whatever the user specifies (I think the path is
limited to 64 characters).  After all it's _my_ computer and I
do, in fact, know which serial port is hooked to the target!
The fact that the ARM Ltd. code won't believe me has always
been annoying...

Yes, I know, the patched code uses a different indenting style
that the rest of the file -- if this is a problem, feel free to
re-indent it however you please.  I simply can not easily grok
the existing style.

-- 
Grant Edwards
grante@visi.com
From ac131313@cygnus.com Sat Apr 01 00:00:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: [patch] Stop MI testsuite falling on its face
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38C07D7C.2B6EBFFC@cygnus.com>
X-SW-Source: 2000-q1/msg00494.html
Content-length: 1031

The attatched (from PeterS) stops the MI testsuite falling on its face
when the MI interface wasn't enabled.

	Andrew
Sat Mar  4 13:55:08 2000  Andrew Cagney  <cagney@b1.cygnus.com>

	From Fri 3 Mar 2000 Peter Schauer:
	* mi-support.exp (mi_gdb_start): When GDB doesn't recongize -i=mi
 	option, assume no MI support present.

Index: testsuite/lib/mi-support.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/mi-support.exp,v
retrieving revision 1.1
diff -p -r1.1 mi-support.exp
*** mi-support.exp	2000/02/23 00:25:43	1.1
--- mi-support.exp	2000/03/04 02:59:53
*************** proc mi_gdb_start { } {
*** 130,135 ****
--- 130,140 ----
  	    remote_close host;
  	    return -1;
  	}
+ 	-re ".*unrecognized option.*for a complete list of options." {
+ 	    untested "Skip mi tests (not compiled with mi support)."
+ 	    remote_close host;
+ 	    return -1;
+ 	}
  	timeout {
  	    perror "(timeout) GDB never initialized after 10 seconds."
  	    remote_close host;
From msnyder@cygnus.com Sat Apr 01 00:00:00 2000
From: Michael Snyder <msnyder@cygnus.com>
To: Fernando Nasser <fnasser@redhat.com>
Cc: Eli Zaretskii <eliz@is.elta.co.il>, Daniel Berlin <dan@cgsoftware.com>, gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH]: add set/show debug, move gdb debugging flags into it
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38CFB57A.1900@cygnus.com>
References: <Pine.LNX.4.10.10003130852170.6968-200000@localhost.localdomain> <200003150919.EAA29966@indy.delorie.com> <r9dctixc.fsf@dan.resnet.rochester.edu> <200003151430.JAA01149@indy.delorie.com> <38CFAE9E.39D1C081@redhat.com>
X-SW-Source: 2000-q1/msg00709.html
Content-length: 561

Fernando Nasser wrote:

> The documentation problem may not be restricted to the debug command but
> also to other maintenance class commands.  They have been considered to
> be restricted to wizards that read source code instead of manuals and so
> they have not been documented in the user's manual.

I always consider it questionable whether maintenance commands
SHOULD be documented in the user's guide.  If they should, 
perhaps it should be in a separate section clearly identified
as being for the maintenance and debugging of the debugger.

				Michael
From kingdon@redhat.com Sat Apr 01 00:00:00 2000
From: Jim Kingdon <kingdon@redhat.com>
To: ac131313@cygnus.com
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: Clean up compiler warnings
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200002080452.XAA30493@devserv.devel.redhat.com>
References: <200002071950.OAA29599@devserv.devel.redhat.com> <389F583E.65831CE5@cygnus.com>
X-SW-Source: 2000-q1/msg00092.html
Content-length: 706

> As for the actual changes, they all look pretty good - especially the
> bit where you delete ``extern''s from .c files :-)

I'll take that as approval :-).  Checked in.

> So you know and don't start doing unnecessary work, the suggested list
> of warning flags for 5.0 is no more than:

I didn't mess with any warning flags.  I just used the defaults that
come with "./configure; make".  If you are saying that this will not
get cleaned up until after 5.0 I guess I'm not going to argue.

As for switches on enums, in this particular case using "default"
makes sense to me, but feel free to change it to the other way if you
want.  I'm having trouble getting very excited about it one way or the
other.
From kettenis@wins.uva.nl Sat Apr 01 00:00:00 2000
From: Mark Kettenis <kettenis@wins.uva.nl>
To: gdb-patches@sourceware.cygnus.com
Subject: [Conversion of the GNU Hurd to the new i386 register layout]
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200001271357.e0RDvJ100750@delius.kettenis.local>
X-SW-Source: 2000-q1/msg00036.html
Content-length: 23898

Last month I sent the following patch to gdb-patches.  Could somebody
please apply this?

Mark

------- Start of forwarded message -------
Date: 20 Dec 1999 23:38:24 +0100
To: gdb-patches@sourceware.cygnus.com
Subject: Conversion of the GNU Hurd to the new i386 register layout

The following patch converts the GNU Hurd to the new i386 register
layout.

Mark


1999-12-20  Mark Kettenis  <kettenis@gnu.org>

	* config/i386/tm-i386gnu.h (THREAD_STATE_FLAVOR): Define to
	i386_REGS_SEGS_STATE.
	(HAVE_I387_REGS): Define.
	(FLOAT_INFO): Remove.
	* i386gnu-nat.c: Almost completely rewritten to use new i386
	register layout and `float info' implementation.
	* gnu-nat.c (inf_update_procs, proc_get_state, proc_string):
	Move prototypes from here.
	* gnu-nat.h: To here.


Index: gdb/gdb/config/i386/tm-i386gnu.h
===================================================================
RCS file: /var/cvsroot/gdb/gdb/config/i386/tm-i386gnu.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 tm-i386gnu.h
- --- gdb/gdb/config/i386/tm-i386gnu.h	1999/07/19 17:23:27	1.1.1.2
+++ gdb/gdb/config/i386/tm-i386gnu.h	1999/12/20 21:06:55
@@ -1,4 +1,4 @@
- -/* Macro definitions for i386, GNU Hurd
+/* Macro definitions for i386 running the GNU Hurd.
    Copyright (C) 1992, 1999 Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -21,26 +21,26 @@
 #ifndef TM_I386GNU_H
 #define TM_I386GNU_H 1
 
- -/* Include common definitions for gnu systems */
+/* Include common definitions for GNU systems.
+   FIXME: This does not belong here since this is supposed to contain
+   only native-dependent information.  */
 #include "nm-gnu.h"
 
 /* Thread flavors used in re-setting the T bit.
- - * @@ this is also bad for cross debugging.
- - */
- -#define THREAD_STATE_FLAVOR		i386_THREAD_STATE
+   FIXME: This is native-dependent.  */
+#define THREAD_STATE_FLAVOR		i386_REGS_SEGS_STATE
 #define THREAD_STATE_SIZE		i386_THREAD_STATE_COUNT
 #define THREAD_STATE_SET_TRACED(state) \
   	((struct i386_thread_state *)state)->efl |= 0x100
 #define THREAD_STATE_CLEAR_TRACED(state) \
   	((((struct i386_thread_state *)state)->efl &= ~0x100), 1)
 
- -/* we can do it */
+/* We can attach and detach.
+   FIXME: This is probably native-dependent too.  */
 #define ATTACH_DETACH 1
 
+#define HAVE_I387_REGS
 #include "i386/tm-i386.h"
- -
- -#undef FLOAT_INFO
- -#define FLOAT_INFO { i386_mach3_float_info (); }
 
 /* Offset to saved PC in sigcontext.  */
 #define SIGCONTEXT_PC_OFFSET 68
Index: gdb/gdb/i386gnu-nat.c
===================================================================
RCS file: /var/cvsroot/gdb/gdb/i386gnu-nat.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 i386gnu-nat.c
- --- gdb/gdb/i386gnu-nat.c	1999/07/19 17:22:27	1.1.1.2
+++ gdb/gdb/i386gnu-nat.c	1999/12/20 20:31:13
@@ -1,4 +1,4 @@
- -/* Low level interface to I386 running the GNU Hurd
+/* Low level interface to i386 running the GNU Hurd.
    Copyright (C) 1992, 1995, 1996 Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -22,36 +22,41 @@
 #include "inferior.h"
 #include "floatformat.h"
 
+#include <assert.h>
 #include <stdio.h>
 #include <errno.h>
 
 #include <mach.h>
+#include <mach_error.h>
 #include <mach/message.h>
 #include <mach/exception.h>
- -#include <mach_error.h>
 
 #include "gnu-nat.h"
+
+/* The FPU hardware state.  */
+struct env387
+{
+  unsigned short control;
+  unsigned short r0;
+  unsigned short status;
+  unsigned short r1;
+  unsigned short tag;
+  unsigned short r2;
+  unsigned long eip;
+  unsigned short code_seg;
+  unsigned short opcode;
+  unsigned long operand;
+  unsigned short operand_seg;
+  unsigned short r3;
+  unsigned char regs[8][10];
+};
 
- -/* Hmmm... Should this not be here?
- - * Now for i386_float_info() target_has_execution
- - */
- -#include <target.h>
- -
- -/* @@@ Should move print_387_status() to i387-tdep.c */
- -extern void print_387_control_word ();	/* i387-tdep.h */
- -extern void print_387_status_word ();
 \f
- -/* Find offsets to thread states at compile time.
- - * If your compiler does not grok this, calculate offsets
- - * offsets yourself and use them (or get a compatible compiler :-)
- - */
- -
- -#define  REG_OFFSET(reg) (int)(&((struct i386_thread_state *)0)->reg)
- -
- -/* at reg_offset[i] is the offset to the i386_thread_state
- - * location where the gdb registers[i] is stored.
- - */
+/* Offset to the thread_state_t location where REG is stored.  */
+#define REG_OFFSET(reg) offsetof (struct i386_thread_state, reg)
 
+/* At reg_offset[i] is the offset to the thread_state_t location where
+   the gdb registers[i] is stored.  */
 static int reg_offset[] =
 {
   REG_OFFSET (eax), REG_OFFSET (ecx), REG_OFFSET (edx), REG_OFFSET (ebx),
@@ -60,309 +65,268 @@
   REG_OFFSET (ds), REG_OFFSET (es), REG_OFFSET (fs), REG_OFFSET (gs)
 };
 
- -#define REG_ADDR(state,regnum) ((char *)(state)+reg_offset[regnum])
+#define REG_ADDR(state, regnum) ((char *)(state) + reg_offset[regnum])
 
- -/* Fetch COUNT contiguous registers from thread STATE starting from REGNUM
- - * Caller knows that the regs handled in one transaction are of same size.
- - */
- -#define FETCH_REGS(state, regnum, count) \
- -  memcpy (&registers[REGISTER_BYTE (regnum)], \
- -	  REG_ADDR (state, regnum), \
- -	  count * REGISTER_RAW_SIZE (regnum))
- -
- -/* Store COUNT contiguous registers to thread STATE starting from REGNUM */
- -#define STORE_REGS(state, regnum, count) \
- -  memcpy (REG_ADDR (state, regnum), \
- -	  &registers[REGISTER_BYTE (regnum)], \
- -	  count * REGISTER_RAW_SIZE (regnum))
 \f
- -/*
- - * Fetch inferiors registers for gdb.
- - * REG specifies which (as gdb views it) register, -1 for all.
- - */
- -void
- -gnu_fetch_registers (int reg)
+/* Get the whole floating-point state of THREAD and record the
+   values of the corresponding (pseudo) registers.  */
+static void
+fetch_fpregs (struct proc *thread)
 {
- -  struct proc *thread;
- -  thread_state_t state;
- -
- -  inf_update_procs (current_inferior);	/* Make sure we know about new threads.  */
- -
- -  thread = inf_tid_to_thread (current_inferior, inferior_pid);
- -  if (!thread)
- -    error ("fetch inferior registers: %d: Invalid thread", inferior_pid);
- -
- -  state = proc_get_state (thread, 0);
+  mach_msg_type_number_t count = i386_FLOAT_STATE_COUNT;
+  struct i386_float_state state;
+  struct env387 *ep = (struct env387 *) state.hw_state;
+  error_t err;
+  int i;
 
- -  if (!state)
- -    warning ("Couldn't fetch register %s from %s (invalid thread).",
- -	     REGISTER_NAME (reg), proc_string (thread));
- -  else if (reg >= 0)
+  err = thread_get_state (thread->port, i386_FLOAT_STATE,
+			  (thread_state_t) &state, &count);
+  if (err)
     {
- -      proc_debug (thread, "fetching register: %s", REGISTER_NAME (reg));
- -      supply_register (reg, REG_ADDR (state, reg));
- -      thread->fetched_regs |= (1 << reg);
+      warning ("Couldn't fetch floating-point state from %s",
+	       proc_string (thread));
+      return;
     }
- -  else
+
+  if (! state.initialized)
+    /* The floating-point state isn't initialized.  */
     {
- -      proc_debug (thread, "fetching all registers");
- -      for (reg = 0; reg < NUM_REGS; reg++)
- -	supply_register (reg, REG_ADDR (state, reg));
- -      thread->fetched_regs = ~0;
+      for (i = FP0_REGNUM; i <= FP7_REGNUM; i++)
+	supply_register (i, NULL);
+      for (i = FIRST_FPU_CTRL_REGNUM; i <= LAST_FPU_CTRL_REGNUM; i++)
+	supply_register (i, NULL);
+
+      return;
     }
+
+  /* Supply the floating-point registers.  */
+  for (i = 0; i < 8; i++)
+    supply_register (FP0_REGNUM + i, ep->regs[i]);
+
+  supply_register (FCTRL_REGNUM, (char *) &ep->control);
+  supply_register (FSTAT_REGNUM, (char *) &ep->status);
+  supply_register (FTAG_REGNUM,  (char *) &ep->tag);
+  supply_register (FCOFF_REGNUM, (char *) &ep->eip);
+  supply_register (FDS_REGNUM,   (char *) &ep->operand_seg);
+  supply_register (FDOFF_REGNUM, (char *) &ep->operand);
+
+  /* Store the code segment and opcode pseudo registers.  */
+  {
+    long l;
+
+    l = ep->code_seg;
+    supply_register (FCS_REGNUM, (char *) &l);
+    l = ep->opcode & ((1 << 11) - 1);
+    supply_register (FOP_REGNUM, (char *) &l);
+  }
 }
- -\f
- -/* Store our register values back into the inferior.
- - * If REG is -1, do this for all registers.
- - * Otherwise, REG specifies which register
- - *
- - * On mach3 all registers are always saved in one call.
- - */
+
+/* Fetch register REGNO, or all regs if REGNO is -1.  */
 void
- -gnu_store_registers (reg)
- -     int reg;
+gnu_fetch_registers (int regno)
 {
   struct proc *thread;
- -  int was_aborted, was_valid;
- -  thread_state_t state;
- -  thread_state_data_t old_state;
 
- -  inf_update_procs (current_inferior);	/* Make sure we know about new threads.  */
+  /* Make sure we know about new threads.  */
+  inf_update_procs (current_inferior);
 
   thread = inf_tid_to_thread (current_inferior, inferior_pid);
   if (!thread)
- -    error ("store inferior registers: %d: Invalid thread", inferior_pid);
- -
- -  proc_debug (thread, "storing register %s.", REGISTER_NAME (reg));
- -
- -  was_aborted = thread->aborted;
- -  was_valid = thread->state_valid;
- -  if (!was_aborted && was_valid)
- -    bcopy (&thread->state, &old_state, sizeof (old_state));
+    error ("Can't fetch registers from thread %d: No such thread",
+	   inferior_pid);
 
- -  state = proc_get_state (thread, 1);
- -
- -  if (!state)
- -    warning ("Couldn't store register %s from %s (invalid thread).",
- -	     REGISTER_NAME (reg), proc_string (thread));
- -  else
+  if (regno < NUM_GREGS || regno == -1)
     {
- -      if (!was_aborted && was_valid)
- -	/* See which registers have changed after aborting the thread.  */
+      thread_state_t state;
+      
+      /* This does the dirty work for us.  */
+      state = proc_get_state (thread, 0);
+      if (!state)
 	{
- -	  int check_reg;
- -	  for (check_reg = 0; check_reg < NUM_REGS; check_reg++)
- -	    if ((thread->fetched_regs & (1 << check_reg))
- -		&& bcmp (REG_ADDR (&old_state, check_reg),
- -			 REG_ADDR (state, check_reg),
- -			 REGISTER_RAW_SIZE (check_reg)))
- -	      /* Register CHECK_REG has changed!  Ack!  */
- -	      {
- -		warning ("Register %s changed after thread was aborted.",
- -			 REGISTER_NAME (check_reg));
- -		if (reg >= 0 && reg != check_reg)
- -		  /* Update gdb's copy of the register.  */
- -		  supply_register (check_reg, REG_ADDR (state, check_reg));
- -		else
- -		  warning ("... also writing this register!  Suspicious...");
- -	      }
+	  warning ("Couldn't fetch registers from %s",
+		   proc_string (thread));
+	  return;
 	}
 
- -      if (reg >= 0)
+      if (regno == -1)
 	{
- -	  proc_debug (thread, "storing register: %s", REGISTER_NAME (reg));
- -	  STORE_REGS (state, reg, 1);
+	  int i;
+	  
+	  proc_debug (thread, "fetching all register");
+	  
+	  for (i = 0; i < NUM_GREGS; i++)
+	    supply_register (i, REG_ADDR (state, i));
+	  thread->fetched_regs = ~0;
 	}
       else
 	{
- -	  proc_debug (thread, "storing all registers");
- -	  for (reg = 0; reg < NUM_REGS; reg++)
- -	    STORE_REGS (state, reg, 1);
+	  proc_debug (thread, "fetching register %s", REGISTER_NAME (regno));
+	  
+	  supply_register (regno, REG_ADDR (state, regno));
+	  thread->fetched_regs |= (1 << regno);
 	}
     }
+
+  if (regno >= NUM_GREGS || regno == -1)
+    {
+      proc_debug (thread, "fetching floating-point registers");
+      
+      fetch_fpregs (thread);
+    }
 }
+
 \f
- -/* jtv@hut.fi: I copied and modified this 387 code from
- - * gdb/i386-xdep.c. Modifications for Mach 3.0.
- - *
- - * i387 status dumper. See also i387-tdep.c
- - */
- -struct env387
+/* Fill the i387 hardware state EP with selected data from the set of
+   (pseudo) registers specified by REGS and VALID.  VALID is an array
+   indicating which registers in REGS are valid.  If VALID is zero,
+   all registers are assumed to be valid.  */
+static void
+convert_to_env387 (struct env387 *ep, char *regs, signed char *valid)
 {
- -  unsigned short control;
- -  unsigned short r0;
- -  unsigned short status;
- -  unsigned short r1;
- -  unsigned short tag;
- -  unsigned short r2;
- -  unsigned long eip;
- -  unsigned short code_seg;
- -  unsigned short opcode;
- -  unsigned long operand;
- -  unsigned short operand_seg;
- -  unsigned short r3;
- -  unsigned char regs[8][10];
- -};
- -/* This routine is machine independent?
- - * Should move it to i387-tdep.c but you need to export struct env387
- - */
- -static
- -print_387_status (status, ep)
- -     unsigned short status;
- -     struct env387 *ep;
- -{
   int i;
- -  int bothstatus;
- -  int top;
- -  int fpreg;
- -  unsigned char *p;
 
- -  bothstatus = ((status != 0) && (ep->status != 0));
- -  if (status != 0)
- -    {
- -      if (bothstatus)
- -	printf_unfiltered ("u: ");
- -      print_387_status_word (status);
- -    }
+  /* Fill in the floating-point registers.  */
+  for (i = 0; i < 8; i++)
+    if (!valid || valid[i])
+      memcpy (ep->regs[i], &regs[REGISTER_BYTE (FP0_REGNUM + i)],
+	      REGISTER_RAW_SIZE (FP0_REGNUM + i));
+
+#define fill(member, regno)                                              \
+  if (!valid || valid[(regno)])                                          \
+    memcpy (&ep->member, &regs[REGISTER_BYTE (regno)],                   \
+            sizeof (ep->member));
+
+  fill (control, FCTRL_REGNUM);
+  fill (status, FSTAT_REGNUM);
+  fill (tag, FTAG_REGNUM);
+  fill (eip, FCOFF_REGNUM);
+  fill (operand, FDOFF_REGNUM);
+  fill (operand_seg, FDS_REGNUM);
+
+#undef fill
+
+  if (!valid || valid[FCS_REGNUM])
+    ep->code_seg =
+      (* (int *) &registers[REGISTER_BYTE (FCS_REGNUM)] & 0xffff);
+  
+  if (!valid || valid[FOP_REGNUM])
+    ep->opcode =
+      ((* (int *) &registers[REGISTER_BYTE (FOP_REGNUM)] & ((1 << 11) - 1)));
+}
 
- -  if (ep->status != 0)
+/* Store the whole floating-point state into THREAD using information
+   from the corresponding (pseudo) registers.  */
+static void
+store_fpregs (struct proc *thread)
+{
+  mach_msg_type_number_t count = i386_FLOAT_STATE_COUNT;
+  struct i386_float_state state;
+  error_t err;
+
+  err = thread_get_state (thread->port, i386_FLOAT_STATE,
+			  (thread_state_t) &state, &count);
+  if (err)
     {
- -      if (bothstatus)
- -	printf_unfiltered ("e: ");
- -      print_387_status_word (ep->status);
+      warning ("Couldn't fetch floating-point state from %s",
+	       proc_string (thread));
+      return;
     }
 
- -  print_387_control_word (ep->control);
- -  printf_unfiltered ("last exception: ");
- -  printf_unfiltered ("opcode %s; ", local_hex_string (ep->opcode));
- -  printf_unfiltered ("pc %s:", local_hex_string (ep->code_seg));
- -  printf_unfiltered ("%s; ", local_hex_string (ep->eip));
- -  printf_unfiltered ("operand %s", local_hex_string (ep->operand_seg));
- -  printf_unfiltered (":%s\n", local_hex_string (ep->operand));
- -
- -  top = (ep->status >> 11) & 7;
- -
- -  printf_unfiltered ("regno  tag  msb              lsb  value\n");
- -  for (fpreg = 7; fpreg >= 0; fpreg--)
+  convert_to_env387 ((struct env387 *) state.hw_state,
+		     registers, register_valid);
+    
+  err = thread_set_state (thread->port, i386_FLOAT_STATE,
+			  (thread_state_t) &state, i386_FLOAT_STATE_COUNT);
+  if (err)
     {
- -      double val;
- -
- -      printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : "  ", fpreg);
- -
- -      switch ((ep->tag >> (fpreg * 2)) & 3)
- -	{
- -	case 0:
- -	  printf_unfiltered ("valid ");
- -	  break;
- -	case 1:
- -	  printf_unfiltered ("zero  ");
- -	  break;
- -	case 2:
- -	  printf_unfiltered ("trap  ");
- -	  break;
- -	case 3:
- -	  printf_unfiltered ("empty ");
- -	  break;
- -	}
- -      for (i = 9; i >= 0; i--)
- -	printf_unfiltered ("%02x", ep->regs[fpreg][i]);
- -
- -      floatformat_to_double (&floatformat_i387_ext, (char *) ep->regs[fpreg],
- -			     &val);
- -      printf_unfiltered ("  %g\n", val);
+      warning ("Couldn't store floating-point state into %s",
+	       proc_string (thread));
+      return;
     }
- -  if (ep->r0)
- -    printf_unfiltered ("warning: reserved0 is %s\n", local_hex_string (ep->r0));
- -  if (ep->r1)
- -    printf_unfiltered ("warning: reserved1 is %s\n", local_hex_string (ep->r1));
- -  if (ep->r2)
- -    printf_unfiltered ("warning: reserved2 is %s\n", local_hex_string (ep->r2));
- -  if (ep->r3)
- -    printf_unfiltered ("warning: reserved3 is %s\n", local_hex_string (ep->r3));
 }
- -
- -/*
- - * values that go into fp_kind (from <i386/fpreg.h>)
- - */
- -#define FP_NO   0		/* no fp chip, no emulator (no fp support)      */
- -#define FP_SW   1		/* no fp chip, using software emulator          */
- -#define FP_HW   2		/* chip present bit                             */
- -#define FP_287  2		/* 80287 chip present                           */
- -#define FP_387  3		/* 80387 chip present                           */
 
- -typedef struct fpstate
+/* Store at least register REGNO, or all regs if REGNO == -1.  */
+void
+gnu_store_registers (int regno)
 {
- -#if 1
- -  unsigned char state[FP_STATE_BYTES];	/* "hardware" state */
- -#else
- -  struct env387 state;		/* Actually this */
- -#endif
- -  int status;			/* Duplicate status */
- -}
- - *fpstate_t;
+  struct proc *thread;
 
- -/* Mach 3 specific routines.
- - */
- -static int
- -get_i387_state (fstate)
- -     struct fpstate *fstate;
- -{
- -  error_t err;
- -  thread_state_data_t state;
- -  unsigned int fsCnt = i386_FLOAT_STATE_COUNT;
- -  struct i386_float_state *fsp;
- -  struct proc *thread = inf_tid_to_thread (current_inferior, inferior_pid);
+  /* Make sure we know about new threads.  */
+  inf_update_procs (current_inferior);
 
+  thread = inf_tid_to_thread (current_inferior, inferior_pid);
   if (!thread)
- -    error ("get_i387_state: Invalid thread");
- -
- -  proc_abort (thread, 0);	/* Make sure THREAD's in a reasonable state. */
+    error ("Couldn't store registers into thread %d: No such thread",
+	   inferior_pid);
 
- -  err = thread_get_state (thread->port, i386_FLOAT_STATE, state, &fsCnt);
- -  if (err)
+  if (regno < NUM_GREGS || regno == -1)
     {
- -      warning ("Can not get live floating point state: %s",
- -	       mach_error_string (err));
- -      return 0;
- -    }
+      thread_state_t state;
+      thread_state_data_t old_state;
+      int was_aborted = thread->aborted;
+      int was_valid = thread->state_valid;
 
- -  fsp = (struct i386_float_state *) state;
- -  /* The 387 chip (also 486 counts) or a software emulator? */
- -  if (!fsp->initialized || (fsp->fpkind != FP_387 && fsp->fpkind != FP_SW))
- -    return 0;
+      if (!was_aborted && was_valid)
+	memcpy (&old_state, &thread->state, sizeof (old_state));
 
- -  /* Clear the target then copy thread's float state there.
- -     Make a copy of the status word, for some reason?
- -   */
- -  memset (fstate, 0, sizeof (struct fpstate));
+      state = proc_get_state (thread, 1);
+      if (!state)
+	{
+	  warning ("Couldn't store registers into %s", proc_string (thread));
+	  return;
+	}
 
- -  fstate->status = fsp->exc_status;
+      if (!was_aborted && was_valid)
+	/* See which registers have changed after aborting the thread.  */
+	{
+	  int check_regno;
 
- -  memcpy (fstate->state, (char *) &fsp->hw_state, FP_STATE_BYTES);
+	  for (check_regno = 0; check_regno < NUM_GREGS; check_regno++)
+	    if ((thread->fetched_regs & (1 << check_regno))
+		&& memcpy (REG_ADDR (&old_state, check_regno),
+			   REG_ADDR (state, check_regno),
+			   REGISTER_RAW_SIZE (check_regno)))
+	      /* Register CHECK_REGNO has changed!  Ack!  */
+	      {
+		warning ("Register %s changed after the thread was aborted",
+			 REGISTER_NAME (check_regno));
+		if (regno >= 0 && regno != check_regno)
+		  /* Update gdb's copy of the register.  */
+		  supply_register (check_regno, REG_ADDR (state, check_regno));
+		else
+		  warning ("... also writing this register!  Suspicious...");
+	      }
+	}
 
- -  return 1;
- -}
+#define fill(state, regno)                                               \
+  memcpy (REG_ADDR(state, regno), &registers[REGISTER_BYTE (regno)],     \
+          REGISTER_RAW_SIZE (regno))
 
- -/*
- - * This is called by "info float" command
- - */
- -void
- -i386_mach3_float_info ()
- -{
- -  char buf[sizeof (struct fpstate) + 2 * sizeof (int)];
- -  int valid = 0;
- -  fpstate_t fps;
+      if (regno == -1)
+	{
+	  int i;
+	  
+	  proc_debug (thread, "storing all registers");
 
- -  if (target_has_execution)
- -    valid = get_i387_state (buf);
+	  for (i = 0; i < NUM_GREGS; i++)
+	    if (register_valid[i])
+	      fill (state, i);
+	}
+      else
+	{
+	  proc_debug (thread, "storing register %s", REGISTER_NAME (regno));
 
- -  if (!valid)
- -    {
- -      warning ("no floating point status saved");
- -      return;
+	  assert (register_valid[regno]);
+	  fill (state, regno);
+	}
     }
 
- -  fps = (fpstate_t) buf;
+#undef fill
 
- -  print_387_status (fps->status, (struct env387 *) fps->state);
+  if (regno >= NUM_GREGS || regno == -1)
+    {
+      proc_debug (thread, "storing floating-point registers");
+      
+      store_fpregs (thread);
+    }
 }
Index: gdb/gdb/gnu-nat.c
===================================================================
RCS file: /var/cvsroot/gdb/gdb/gnu-nat.c,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 gnu-nat.c
- --- gdb/gdb/gnu-nat.c	1999/10/16 15:27:26	1.1.1.5
+++ gdb/gdb/gnu-nat.c	1999/12/20 20:43:12
@@ -1,4 +1,4 @@
- -/* Interface GDB to the GNU Hurd
+/* Interface GDB to the GNU Hurd.
    Copyright (C) 1992, 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -88,7 +88,6 @@
 
 extern struct target_ops gnu_ops;
 
- -int inf_update_procs (struct inf *inf);
 struct inf *make_inf ();
 void inf_clear_wait (struct inf *inf);
 void inf_cleanup (struct inf *inf);
@@ -116,7 +115,6 @@
        debug ("{inf %d %p}: " msg, __inf->pid, __inf , ##args); } while (0)
 
 void proc_abort (struct proc *proc, int force);
- -thread_state_t proc_get_state (struct proc *proc, int force);
 struct proc *make_proc (struct inf *inf, mach_port_t port, int tid);
 struct proc *_proc_free (struct proc *proc);
 int proc_update_sc (struct proc *proc);
@@ -126,7 +124,6 @@
 void proc_steal_exc_port (struct proc *proc, mach_port_t exc_port);
 void proc_restore_exc_port (struct proc *proc);
 int proc_trace (struct proc *proc, int set);
- -char *proc_string (struct proc *proc);
 
 /* Evaluate RPC_EXPR in a scope with the variables MSGPORT and REFPORT bound
    to INF's msg port and task port respectively.  If it has no msg port,
Index: gdb/gdb/gnu-nat.h
===================================================================
RCS file: /var/cvsroot/gdb/gdb/gnu-nat.h,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 gnu-nat.h
- --- gdb/gdb/gnu-nat.h	1999/07/19 17:22:22	1.1.1.3
+++ gdb/gdb/gnu-nat.h	1999/12/20 20:38:32
@@ -31,6 +31,9 @@
 /* Converts a GDB pid to a struct proc.  */
 struct proc *inf_tid_to_thread (struct inf *inf, int tid);
 
+/* Makes sure that INF's thread list is synced with the actual process.  */
+int inf_update_procs (struct inf *inf);
+
 /* A proc is either a thread, or the task (there can only be one task proc
    because it always has the same TID, PROC_TID_TASK).  */
 struct proc
@@ -75,7 +78,14 @@
 
 extern int __proc_pid (struct proc *proc);
 
+/* Make sure that the state field in PROC is up to date, and return a
+   pointer to it, or 0 if something is wrong.  If WILL_MODIFY is true,
+   makes sure that the thread is stopped and aborted first, and sets
+   the state_changed field in PROC to true.  */
 extern thread_state_t proc_get_state (struct proc *proc, int will_modify);
+
+/* Return printable description of proc.  */
+extern char *proc_string (struct proc *proc);
 
 #define proc_debug(_proc, msg, args...) \
   do { struct proc *__proc = (_proc); \
------- End of forwarded message -------
From eliz@delorie.com Sat Apr 01 00:00:00 2000
From: Eli Zaretskii <eliz@delorie.com>
To: ezannoni@cygnus.com
Cc: phdm@macqel.be, ac131313@cygnus.com, gdb-patches@sourceware.cygnus.com
Subject: Re: HAVE_POLL is not enough - RFA
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200003211815.NAA12423@indy.delorie.com>
References: <200003181028.LAA30913@mail.macqel.be> <200003182226.RAA07052@indy.delorie.com> <14550.33984.488206.90007@kwikemart.cygnus.com>
X-SW-Source: 2000-q1/msg00862.html
Content-length: 257

> I committed Eli's patch below. 

Thanks!

It seems apology is in order: my previous message implied that I
posted that patch some time ago, while in reality I simply forgot to
post it.  So there was nothing wrong with Elena not taking care of it.

Sorry!
From fnasser@cygnus.com Sat Apr 01 00:00:00 2000
From: Fernando Nasser <fnasser@cygnus.com>
To: Dave Vogel <dave@lightsurf.com>
Cc: Insight mail-list <insight@sourceware.cygnus.com>, gdb-patches@sourceware.cygnus.com, grante@visi.com
Subject: Re: ARM - RDI ethernet support
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <387295B5.CBBF5807@cygnus.com>
References: <386A5B50.EFBCA961@lightsurf.com>
X-SW-Source: 2000-q1/msg00010.html
Content-length: 2459

Hi Dave,

Thank you for your patches.

I will incorporate the Tcl part of it soon, so we will be able to select
RDI over UDP on Insight.
As soon as I find some time, I will try to figure why pressing the STOP
button does not work.  Note that it will be somewhat difficult for me as
I don't have an interruptible target on hands, but I will at least check
if interrupt_target() gets called.

With regards to the interrupt patch to ardi.c, we have already
incorporated a patch from Grant Edwards that does the same thing.  Due
to my vacations and the difficulties I have to test (lack of ICE
target), I had no time to incorporate it in the snapshots, which I was
planning to do this week.

I am attaching the current patch and I would appreciate if you give it a
spin.  If you have any problems please let us know.  We can try to merge
the two patches (I don't think it will be necessary though).

Regards,
Fernando

-- 
Fernando Nasser
Cygnus Solutions - Toronto Office       E-Mail:  fnasser@cygnus.com
2323 Yonge Street, Suite #300           Tel:  416-482-2661 ext. 311
Toronto, Ontario   M4P 2C9              Fax:  416-482-6299


Index: ardi.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/rdi-share/ardi.c,v
retrieving revision 1.5
diff -c -r1.5 ardi.c
*** ardi.c      1999/11/01 15:29:56     1.5
--- ardi.c      1999/12/13 22:31:16
***************
*** 392,397 ****
--- 392,398 ----
  #endif
  
  static bool boot_interrupted = FALSE;
+ static volatile bool interrupt_request = FALSE;
  
  static void ardi_sigint_handler(int sig) {
  #ifdef DEBUG
***************
*** 401,406 ****
--- 402,408 ----
      IGNORE(sig);
  #endif
      boot_interrupted = TRUE;
+     interrupt_request = TRUE;
  #ifndef __unix
      signal(SIGINT, ardi_sigint_handler);
  #endif
***************
*** 1306,1312 ****
    return RDIError_NoError;
  }
  
- static volatile bool interrupt_request = FALSE;
  
  static void interrupt_target( void )
  {
--- 1308,1313 ----
***************
*** 1397,1402 ****
--- 1398,1404 ----
    angel_DebugPrint("Waiting for program to finish...\n");
  #endif
  
+   signal(SIGINT, ardi_sigint_handler);
    while( executing )
    {
        if (interrupt_request)
***************
*** 1406,1411 ****
--- 1408,1415 ----
        }
        Adp_AsynchronousProcessing( async_block_on_nothing );
    }
+   signal(SIGINT, SIG_IGN);
+ 
  
  #ifdef TEST_DC_APPL
    Adp_Install_DC_Appl_Handler( NULL );
From kingdon@redhat.com Sat Apr 01 00:00:00 2000
From: Jim Kingdon <kingdon@redhat.com>
To: ac131313@cygnus.com
Cc: gdb-patches@sourceware.cygnus.com, blizzard@mozilla.org
Subject: Re: dlclose()
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200003020552.AAA07061@devserv.devel.redhat.com>
References: <200002161953.OAA07411@devserv.devel.redhat.com> <38BD058E.51313D7D@cygnus.com>
X-SW-Source: 2000-q1/msg00454.html
Content-length: 5974

> One fix, and some extra random noise:

OK, I've changed assert() to internal_error() and reworded the
comment.  PTR is also gone.

I don't know how the WITHDRAWN thing is supposed to work, but this
patch supercedes the two that I already posted under the subject line
"dlclose()".

> JimB's got the final say.

Well, any reactions, JimB?  We don't have any other solib.c
maintainers yet.  I also haven't heard from Mark Kettenis recently on
this issue - I know he was talking about an solib.c rewrite (not
something I disagree with, really), but that was in the context of a
rather different patch (even if it addressed the same problem).

2000-02-20  Jim Kingdon  <kingdon@redhat.com>

	* solib.c (find_solib): New argument recheck.
	* solib.c (solib_add): Pass it as 1, and add logic to delete
	shared libraries which aren't still in the inferior.
	(struct so_list): New field found_me, for solib_add.
	* solib.c (other find_solib callers): Pass recheck as 0.

Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.1.1.10
diff -u -r1.1.1.10 solib.c
--- solib.c	1999/11/17 02:30:28	1.1.1.10
+++ solib.c	2000/03/02 05:19:21
@@ -143,6 +143,11 @@
     char so_name[MAX_PATH_SIZE];	/* shared object lib name (FIXME) */
     char symbols_loaded;	/* flag: symbols read in yet? */
     char from_tty;		/* flag: print msgs? */
+
+    /* Flag for use within solib_add: have we seen this library actually
+       still mapped in the inferior this pass?  */
+    char found_me;
+
     struct objfile *objfile;	/* objfile for loaded lib */
     struct section_table *sections;
     struct section_table *sections_end;
@@ -181,8 +186,7 @@
 
 static int symbol_add_stub PARAMS ((PTR));
 
-static struct so_list *
-  find_solib PARAMS ((struct so_list *));
+static struct so_list *find_solib (struct so_list *, int);
 
 static struct link_map *
   first_link_map_member PARAMS ((void));
@@ -975,8 +979,10 @@
  */
 
 static struct so_list *
-find_solib (so_list_ptr)
-     struct so_list *so_list_ptr;	/* Last lm or NULL for first one */
+find_solib (struct so_list *so_list_ptr,
+	    /* Nonzero if we should read all the entries from the inferior,
+	       not just the ones at the end of the list.  */
+	    int recheck)
 {
   struct so_list *so_list_next = NULL;
   struct link_map *lm = NULL;
@@ -985,7 +991,9 @@
   if (so_list_ptr == NULL)
     {
       /* We are setting up for a new scan through the loaded images. */
-      if ((so_list_next = so_list_head) == NULL)
+      so_list_next = so_list_head;
+      if (so_list_next == NULL
+	  || recheck)
 	{
 	  /* We have not already read in the dynamic linking structures
 	     from the inferior, lookup the address of the base structure. */
@@ -1002,7 +1010,8 @@
     {
       /* We have been called before, and are in the process of walking
          the shared library list.  Advance to the next shared object. */
-      if ((lm = LM_NEXT (so_list_ptr)) == NULL)
+      lm = LM_NEXT (so_list_ptr);
+      if (recheck || lm == NULL)
 	{
 	  /* We have hit the end of the list, so check to see if any were
 	     added, but be quiet if we can't read from the target any more. */
@@ -1020,7 +1029,7 @@
 	}
       so_list_next = so_list_ptr->next;
     }
-  if ((so_list_next == NULL) && (lm != NULL))
+  if ((so_list_next == NULL || recheck) && (lm != NULL))
     {
       /* Get next link map structure from inferior image and build a local
          abbreviated load_map structure */
@@ -1188,7 +1197,7 @@
       /* Count how many new section_table entries there are.  */
       so = NULL;
       count = 0;
-      while ((so = find_solib (so)) != NULL)
+      while ((so = find_solib (so, 0)) != NULL)
 	{
 	  if (so->so_name[0] && !match_main (so->so_name))
 	    {
@@ -1201,7 +1210,7 @@
 	  
 	  /* Add these section table entries to the target's table.  */
 	  old = target_resize_to_sections (target, count);
-	  while ((so = find_solib (so)) != NULL)
+	  while ((so = find_solib (so, 0)) != NULL)
 	    {
 	      if (so->so_name[0])
 		{
@@ -1215,9 +1224,13 @@
 	}
     }
 
+  for (so = so_list_head; so != NULL; so = so->next)
+    so->found_me = 0;
+
   /* Now add the symbol files.  */
-  while ((so = find_solib (so)) != NULL)
+  while ((so = find_solib (so, 1)) != NULL)
     {
+      so->found_me = 1;
       if (so->so_name[0] && re_exec (so->so_name) &&
 	  !match_main (so->so_name))
 	{
@@ -1240,6 +1253,44 @@
 	}
     }
 
+  {
+    struct so_list *prev;
+    prev = NULL;
+    for (so = so_list_head; so != NULL; so = so->next)
+      {
+	if (!so->found_me)
+	  {
+	    /* If there were an analogue to
+	       disable_breakpoints_in_shlibs but just for this one
+	       struct so_list, we'd call it.  */
+
+	    if (so->sections != NULL)
+	      free (so->sections);
+
+	    free_objfile (so->objfile);
+
+	    /* Punt the issue of the section tables that we put in the
+	       target vector.  The excuse is that they are basically
+	       used for coredumps rather than running programs, and
+	       with coredumps we don't unload shared libraries.  */
+
+	    if (so->abfd == NULL)
+	      internal_error ("no bfd in solib_add");
+	    if (!bfd_close (so->abfd))
+	      warning ("cannot close \"%s\": %s",
+		       so->so_name, bfd_errmsg (bfd_get_error ()));
+
+	    if (prev == NULL)
+	      so_list_head = so->next;
+	    else
+	      prev->next = so->next;
+
+	    free (so);
+	  }
+	prev = so;
+      }
+  }
+
   /* Getting new symbols may change our opinion about what is
      frameless.  */
   if (so_last)
@@ -1289,7 +1340,7 @@
   addr_fmt = "016l";
 #endif
 
-  while ((so = find_solib (so)) != NULL)
+  while ((so = find_solib (so, 0)) != NULL)
     {
       if (so->so_name[0])
 	{
@@ -1347,7 +1398,7 @@
 {
   register struct so_list *so = 0;	/* link map state variable */
 
-  while ((so = find_solib (so)) != NULL)
+  while ((so = find_solib (so, 0)) != NULL)
     {
       if (so->so_name[0])
 	{
From ezannoni@cygnus.com Sat Apr 01 00:00:00 2000
From: Elena Zannoni <ezannoni@cygnus.com>
To: Eli Zaretskii <eliz@is.elta.co.il>
Cc: ezannoni@cygnus.com, ac131313@cygnus.com, gdb-patches@sourceware.cygnus.com
Subject: Re: GDB-5 2000-03-03
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <14543.59234.407028.669194@kwikemart.cygnus.com>
References: <38BFBD74.79263683@cygnus.com> <200003040702.CAA08162@indy.delorie.com> <38C0E240.FC02154E@cygnus.com> <14531.54961.880860.662139@kwikemart.cygnus.com> <200003151417.JAA01137@indy.delorie.com>
X-SW-Source: 2000-q1/msg00723.html
Content-length: 19022

Eli Zaretskii writes:
 > 
 > > Andrew Cagney writes:
 > >  > Eli Zaretskii wrote:
 > >  > 
 > >  > > But there's a similar issue with Readline.  The current version in the
 > >  > > GDB CVS tree has bugs in the DJGPP-specific code, one of which simply
 > >  > > prevents GDB from linking.  I see that most of these problems are
 > >  > > solved in the current beta version of Readline, but will you be
 > >  > > synchronizing the GDB tree with that version before release?  If not,
 > >  > > I don't see any solution but a local patch.  Please advise.
 > >  > 
 > >  > Consider yourself the maintainer of the DJGPP specific readline stuff
 > >  > (like mmalloc).  (I'll add a note to MAINTAINERS.)
 > >  > 
 > >  > The main thing is to make certain that the true readline sources have
 > >  > the fix as well.  I wasn't planning on importing readline (I'll add a
 > >  > note stateing that this is something that won't make it).
 > >  > 
 > >  > 	Andrew
 > > 
 > > Eli, yes, please check in you fix to readline, I have no time this
 > > week to do another import.
 > 
 > I just committed the changes below.
 > 
 > (It seems the readline directory doesn't have a ChangeLog file, 'cause
 > CVS won't check it out for me.  Am I missing something?)
 > 

There is ChangeLog.Cygnus file. You can use that for the time
being. The readline package doesn't include a ChangeLog. I wonder
though if this makes any sense anymore, I mean, the name 'Cygnus'.

Elena

 > --- readline/support/shobj-conf.~	Tue Aug  3 02:08:42 1999
 > +++ readline/support/shobj-conf	Sat Feb 26 15:07:52 2000
 > @@ -305,6 +305,12 @@
 >  
 >  	SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
 >  	;;
 > +
 > +msdosdjgpp*)
 > +	SHOBJ_STATUS=unsupported
 > +	SHLIB_STATUS=unsupported
 > +	;;
 > +
 >  #
 >  # Rely on correct gcc configuration for everything else
 >  #
 > --- readline/bind.c~	Tue Aug  3 02:08:36 1999
 > +++ readline/bind.c	Wed Feb 23 16:05:52 2000
 > @@ -62,6 +62,10 @@ extern int errno;
 >  extern char *strchr (), *strrchr ();
 >  #endif /* !strchr && !__STDC__ */
 >  
 > +#ifndef O_BINARY
 > +# define O_BINARY 0
 > +#endif
 > +
 >  extern int _rl_horizontal_scroll_mode;
 >  extern int _rl_mark_modified_lines;
 >  extern int _rl_bell_preference;
 > @@ -646,7 +650,7 @@ _rl_read_file (filename, sizep)
 >    char *buffer;
 >    int i, file;
 >  
 > -  if ((stat (filename, &finfo) < 0) || (file = open (filename, O_RDONLY, 0666)) < 0)
 > +  if ((stat (filename, &finfo) < 0) || (file = open (filename, O_RDONLY | O_BINARY, 0666)) < 0)
 >      return ((char *)NULL);
 >  
 >    file_size = (size_t)finfo.st_size;
 > @@ -667,7 +671,7 @@ _rl_read_file (filename, sizep)
 >    i = read (file, buffer, file_size);
 >    close (file);
 >  
 > -#if 0
 > +#if 1
 >    if (i < file_size)
 >  #else
 >    if (i < 0)
 > @@ -678,6 +682,30 @@ _rl_read_file (filename, sizep)
 >      }
 >  
 >    buffer[file_size] = '\0';
 > +
 > +#if O_BINARY
 > +  {
 > +    /* Systems which distinguish between text and binary files need
 > +       to strip the CR characters before each Newline, otherwise the
 > +       parsing functions won't work.  */
 > +    char *s, *d;
 > +    size_t removed = 0;
 > +
 > +    for (s = buffer, d = buffer; s < buffer + file_size; s++)
 > +      {
 > +	if (removed)
 > +	  *d = *s;
 > +	if (*s != '\r' || s[1] != '\n')
 > +	  d++;
 > +	else
 > +	  removed++;
 > +      }
 > +
 > +    file_size -= removed;
 > +    buffer[file_size] = '\0';
 > +  }
 > +#endif
 > +
 >    if (sizep)
 >      *sizep = file_size;
 >    return (buffer);
 > @@ -699,6 +728,7 @@ rl_re_read_init_file (count, ignore)
 >       1. the filename used for the previous call
 >       2. the value of the shell variable `INPUTRC'
 >       3. ~/.inputrc
 > +     4. (for __MSDOS__ only) ~/_inputrc
 >     If the file existed and could be opened and read, 0 is returned,
 >     otherwise errno is returned. */
 >  int
 > @@ -718,6 +748,20 @@ rl_read_init_file (filename)
 >    if (*filename == 0)
 >      filename = DEFAULT_INPUTRC;
 >  
 > +#ifdef __MSDOS__
 > +  {
 > +    /* DOS doesn't allow leading dots in file names.  If the original
 > +       name fails (it could work if we are on Windows), fall back to
 > +       ~/_inputrc.  */
 > +    int retval = _rl_read_init_file (filename, 0);
 > +
 > +    if (retval == 0)
 > +      return retval;
 > +    else if (strcmp (filename, "~/.inputrc") == 0)
 > +      filename = "~/_inputrc";
 > +  }
 > +#endif
 > +
 >    return (_rl_read_init_file (filename, 0));
 >  }
 >  
 > --- readline/complete.c~	Tue Aug  3 02:08:36 1999
 > +++ readline/complete.c	Wed Feb 23 18:02:32 2000
 > @@ -1407,9 +1410,9 @@ username_completion_function (text, stat
 >       char *text;
 >       int state;
 >  {
 > -#if defined (__GO32__) || defined (__WIN32__) || defined (__OPENNT)
 > +#if defined (__WIN32__) || defined (__OPENNT)
 >    return (char *)NULL;
 > -#else /* !__GO32__ */
 > +#else /* !__WIN32__ && !__OPENNT */
 >    static char *username = (char *)NULL;
 >    static struct passwd *entry;
 >    static int namelen, first_char, first_char_loc;
 > @@ -1499,6 +1502,14 @@ filename_completion_function (text, stat
 >  	  strcpy (filename, ++temp);
 >  	  *temp = '\0';
 >  	}
 > +#if defined (__WIN32__) || defined (__OPENNT) || defined (__MSDOS__)
 > +      /* Handle the drive-relative names "d:foo/bar".  */
 > +      else if (dirname[1] == ':')
 > +	{
 > +	  strcpy (filename, dirname + 2);
 > +	  dirname[2] = '\0';
 > +	}
 > +#endif
 >        else
 >  	{
 >  	  dirname[0] = '.';
 > --- readline/display.c~	Tue Aug  3 02:08:36 1999
 > +++ readline/display.c	Wed Feb 23 16:13:52 2000
 > @@ -1126,8 +1126,10 @@ _rl_move_vert (to)
 >    {
 >      int row, col;
 >  
 > +    i = fflush (rl_outstream);	/* make sure the cursor pos is current! */
 >      ScreenGetCursor (&row, &col);
 >      ScreenSetCursor ((row + to - _rl_last_v_pos), col);
 > +    delta = i;
 >    }
 >  #else /* !__GO32__ */
 >  
 > @@ -1377,7 +1379,10 @@ space_to_eol (count)
 >  void
 >  _rl_clear_screen ()
 >  {
 > -#if !defined (__GO32__)
 > +#if defined (__GO32__)
 > +  ScreenClear ();	/* FIXME: only works in text modes */
 > +  ScreenSetCursor (0, 0);  /* term_clrpag is "cl" which homes the cursor */
 > +#else
 >    if (term_clrpag)
 >      tputs (term_clrpag, 1, _rl_output_character_function);
 >    else
 > @@ -1392,6 +1397,7 @@ insert_some_chars (string, count)
 >       int count;
 >  {
 >  #if defined (__GO32__)
 > +#ifndef __DJGPP__
 >    int row, col, width;
 >    char *row_start;
 >  
 > @@ -1400,7 +1406,7 @@ insert_some_chars (string, count)
 >    row_start = ScreenPrimary + (row * width);
 >  
 >    memcpy (row_start + col + count, row_start + col, width - col - count);
 > -
 > +#endif /* !__DJGPP__ */
 >    /* Place the text on the screen. */
 >    _rl_output_some_chars (string, count);
 >  #else /* !_GO32 */
 > @@ -1445,6 +1451,7 @@ static void
 >  delete_chars (count)
 >       int count;
 >  {
 > +#if !defined (__DJGPP__)
 >  #if defined (__GO32__)
 >    int row, col, width;
 >    char *row_start;
 > @@ -1473,6 +1480,7 @@ delete_chars (count)
 >  	  tputs (term_dc, 1, _rl_output_character_function);
 >      }
 >  #endif /* !__GO32__ */
 > +#endif /* !__DJGPP__ */
 >  }
 >  
 >  void
 > --- readline/histfile.c~	Tue Aug  3 02:08:38 1999
 > +++ readline/histfile.c	Wed Feb 23 18:11:46 2000
 > @@ -140,6 +140,16 @@ read_history_range (filename, from, to)
 >    input = history_filename (filename);
 >    file = open (input, O_RDONLY|O_BINARY, 0666);
 >  
 > +
 > +#ifdef __MSDOS__
 > +  /* MSDOS doesn't allow leading dots in file names.  Try again
 > +     with the dot replaced by an underscore.  */
 > +  if (file < 0 && !filename)
 > +    {
 > +      input[strlen (input) - 8] = '_';
 > +      file = open (input, O_RDONLY|O_BINARY, 0666);
 > +    }
 > +#endif
 >    if ((file < 0) || (fstat (file, &finfo) == -1))
 >      goto error_and_exit;
 >  
 > @@ -233,6 +243,16 @@ history_truncate_file (fname, lines)
 >    filename = history_filename (fname);
 >    file = open (filename, O_RDONLY|O_BINARY, 0666);
 >  
 > +#ifdef __MSDOS__
 > +  /* MSDOS doesn't allow leading dots in file names.  Try again
 > +     with the dot replaced by an underscore.  */
 > +  if (file < 0 && !fname)
 > +    {
 > +      filename[strlen (filename) - 8] = '_';
 > +      file = open (filename, O_RDONLY|O_BINARY, 0666);
 > +    }
 > +#endif
 > +
 >    if (file == -1 || fstat (file, &finfo) == -1)
 >      goto truncate_exit;
 >  
 > @@ -314,8 +334,23 @@ history_do_write (filename, nelements, o
 >  
 >    if ((file = open (output, mode, 0600)) == -1)
 >      {
 > +#ifdef __MSDOS__
 > +      /* MSDOS doesn't allow leading dots in file names.  If this is
 > +	 the default file name, try again with the dot replaced by an
 > +	 underscore.  */
 > +      if (!filename)
 > +	{
 > +	  output[strlen (output) - 8] = '_';
 > +	  if ((file = open (output, mode, 0600)) == -1)
 > +	    {
 > +	      FREE (output);
 > +	      return (errno);
 > +	    }
 > +	}
 > +#else
 >        FREE (output);
 >        return (errno);
 > +#endif
 >      }
 >  
 >    if (nelements > history_length)
 > --- readline/input.c~	Tue Aug  3 02:08:38 1999
 > +++ readline/input.c	Wed Feb 23 16:25:20 2000
 > @@ -96,7 +96,7 @@ extern Keymap _rl_keymap;
 >  
 >  extern int _rl_convert_meta_chars_to_ascii;
 >  
 > -#if defined (__GO32__)
 > +#if defined (__GO32__) && !defined (HAVE_SELECT)
 >  #  include <pc.h>
 >  #endif /* __GO32__ */
 >  
 > @@ -176,7 +176,7 @@ rl_unget_char (key)
 >  static void
 >  rl_gather_tyi ()
 >  {
 > -#if defined (__GO32__)
 > +#if defined (__GO32__) && !defined (HAVE_SELECT)
 >    char input;
 >  
 >    if (isatty (0) && kbhit () && ibuffer_space ())
 > @@ -397,7 +397,7 @@ rl_getc (stream)
 >    int result, flags;
 >    unsigned char c;
 >  
 > -#if defined (__GO32__)
 > +#if defined (__GO32__) && !defined (HAVE_TERMIOS_H)
 >    if (isatty (0))
 >      return (getkey () & 0x7F);
 >  #endif /* __GO32__ */
 > @@ -448,7 +448,7 @@ rl_getc (stream)
 >  	}
 >  #endif /* _POSIX_VERSION && EAGAIN && O_NONBLOCK */
 >  
 > -#if !defined (__GO32__)
 > +#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
 >        /* If the error that we received was SIGINT, then try again,
 >  	 this is simply an interrupted system call to read ().
 >  	 Otherwise, some error ocurred, also signifying EOF. */
 > --- readline/readline.c~	Tue Aug  3 02:08:38 1999
 > +++ readline/readline.c	Wed Feb 23 17:58:46 2000
 > @@ -163,14 +163,16 @@ static void readline_initialize_everythi
 >  static void start_using_history ();
 >  static void bind_arrow_keys ();
 >  
 > -#if !defined (__GO32__)
 > +#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
 >  static void readline_default_bindings ();
 >  #endif /* !__GO32__ */
 >  
 >  #if defined (__GO32__)
 >  #  include <go32.h>
 >  #  include <pc.h>
 > -#  undef HANDLE_SIGNALS
 > +#  if !defined (__DJGPP__)
 > +#    undef HANDLE_SIGNALS
 > +#  endif /* !__DJGPP__ */
 >  #endif /* __GO32__ */
 >  
 >  extern char *xmalloc (), *xrealloc ();
 > @@ -745,10 +747,10 @@ readline_initialize_everything ()
 >    /* Initialize the terminal interface. */
 >    _rl_init_terminal_io ((char *)NULL);
 >  
 > -#if !defined (__GO32__)
 > +#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
 >    /* Bind tty characters to readline functions. */
 >    readline_default_bindings ();
 > -#endif /* !__GO32__ */
 > +#endif /* !__GO32__ || HAVE_TERMIOS_H */
 >  
 >    /* Initialize the function names. */
 >    rl_initialize_funmap ();
 > @@ -1272,7 +1279,7 @@ rl_refresh_line (ignore1, ignore2)
 >    _rl_move_vert (curr_line);
 >    _rl_move_cursor_relative (0, the_line);   /* XXX is this right */
 >  
 > -#if defined (__GO32__)
 > +#if defined (__GO32__) && !defined (__DJGPP__)
 >    {
 >      int row, col, width, row_start;
 >  
 > @@ -1281,9 +1288,9 @@ rl_refresh_line (ignore1, ignore2)
 >      row_start = ScreenPrimary + (row * width);
 >      memset (row_start + col, 0, (width - col) * 2);
 >    }
 > -#else /* !__GO32__ */
 > +#else /* !__GO32__ || __DJGPP__ */
 >    _rl_clear_to_eol (0);		/* arg of 0 means to not use spaces */
 > -#endif /* !__GO32__ */
 > +#endif /* !__GO32__ || __DJGPP__ */
 >  
 >    rl_forced_update_display ();
 >    rl_display_fixed = 1;
 > --- readline/rltty.c~	Mon Aug 16 22:17:56 1999
 > +++ readline/rltty.c	Wed Feb 23 15:56:42 2000
 > @@ -57,7 +57,9 @@ extern void _rl_control_keypad ();
 >  
 >  #if defined (__GO32__)
 >  #  include <pc.h>
 > -#  undef HANDLE_SIGNALS
 > +#  if !defined (__DJGPP__)
 > +#    undef HANDLE_SIGNALS
 > +#  endif /* !__DJGPP__ */
 >  #endif /* __GO32__ */
 >  
 >  /* Indirect functions to allow apps control over terminal management. */
 > @@ -260,7 +262,7 @@ prepare_terminal_settings (meta_flag, ot
 >       int meta_flag;
 >       TIOTYPE otio, *tiop;
 >  {
 > -#if !defined (__GO32__)
 > +#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
 >    readline_echoing_p = (otio.sgttyb.sg_flags & ECHO);
 >  
 >    /* Copy the original settings to the structure we're going to use for
 > @@ -326,7 +328,7 @@ prepare_terminal_settings (meta_flag, ot
 >    tiop->ltchars.t_dsuspc = -1;	/* C-y */
 >    tiop->ltchars.t_lnextc = -1;	/* C-v */
 >  #endif /* TIOCGLTC */
 > -#endif /* !__GO32__ */
 > +#endif /* !__GO32__ || HAVE_TERMIOS_H */
 >  }
 >  
 >  #else  /* !defined (NEW_TTY_DRIVER) */
 > @@ -524,7 +526,7 @@ void
 >  rl_prep_terminal (meta_flag)
 >       int meta_flag;
 >  {
 > -#if !defined (__GO32__)
 > +#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
 >    int tty;
 >    TIOTYPE tio;
 >  
 > @@ -559,14 +561,14 @@ rl_prep_terminal (meta_flag)
 >    terminal_prepped = 1;
 >  
 >    release_sigint ();
 > -#endif /* !__GO32__ */
 > +#endif /* !__GO32__ || HAVE_TERMIOS_H */
 >  }
 >  
 >  /* Restore the terminal's normal settings and modes. */
 >  void
 >  rl_deprep_terminal ()
 >  {
 > -#if !defined (__GO32__)
 > +#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
 >    int tty;
 >  
 >    if (!terminal_prepped)
 > @@ -591,7 +593,7 @@ rl_deprep_terminal ()
 >    terminal_prepped = 0;
 >  
 >    release_sigint ();
 > -#endif /* !__GO32__ */
 > +#endif /* !__GO32__ || HAVE_TERMIOS_H */
 >  }
 >  \f
 >  /* **************************************************************** */
 > --- readline/signals.c~	Tue Aug  3 02:08:38 1999
 > +++ readline/signals.c	Wed Feb 23 18:04:20 2000
 > @@ -40,9 +40,9 @@
 >  #  include <sys/ioctl.h>
 >  #endif /* GWINSZ_IN_SYS_IOCTL */
 >  
 > -#if defined (__GO32__)
 > +#if defined (__GO32__) && !defined(__DJGPP__)
 >  #  undef HANDLE_SIGNALS
 > -#endif /* __GO32__ */
 > +#endif /* __GO32__  && !__DJGPP__ */
 >  
 >  #if defined (HANDLE_SIGNALS)
 >  /* Some standard library routines. */
 > @@ -93,7 +93,9 @@ int rl_catch_sigwinch = 1;
 >  #endif
 >  
 >  static int signals_set_flag;
 > +#ifdef SIGWINCH
 >  static int sigwinch_set_flag;
 > +#endif
 >  
 >  /* **************************************************************** */
 >  /*					        		    */
 > --- readline/terminal.c~	Tue Aug  3 02:08:38 1999
 > +++ readline/terminal.c	Wed Feb 23 18:07:12 2000
 > @@ -57,6 +57,10 @@
 >  #  include <sys/ioctl.h>
 >  #endif /* GWINSZ_IN_SYS_IOCTL && !TIOCGWINSZ */
 >  
 > +#if defined (__GO32__)
 > +#  include <pc.h>
 > +#endif
 > +
 >  #include "rltty.h"
 >  #include "tcap.h"
 >  
 > @@ -77,19 +81,24 @@ extern void _rl_bind_if_unbound ();
 >  extern void set_lines_and_columns ();
 >  extern char *get_env_value ();
 >  
 > +/* Functions imported from display.c */
 > +extern void _rl_redisplay_after_sigwinch ();
 > +
 >  /* **************************************************************** */
 >  /*								    */
 >  /*			Terminal and Termcap			    */
 >  /*								    */
 >  /* **************************************************************** */
 >  
 > +#ifndef __DJGPP__
 >  static char *term_buffer = (char *)NULL;
 >  static char *term_string_buffer = (char *)NULL;
 >  
 > -static int tcap_initialized;
 > -
 >  /* Non-zero means this terminal can't really do anything. */
 >  static int dumb_term;
 > +#endif
 > +
 > +static int tcap_initialized;
 >  
 >  #if !defined (__linux__)
 >  #  if defined (__EMX__) || defined (NEED_EXTERN_PC)
 > @@ -186,7 +195,11 @@ _rl_get_screen_size (tty, ignore_env)
 >        if (ignore_env == 0 && (ss = get_env_value ("COLUMNS")))
 >  	screenwidth = atoi (ss);
 >  
 > -#if !defined(__DJGPP__)
 > +#if defined(__DJGPP__)
 > +      tty = tty;
 > +      if (screenwidth <= 0)
 > +	screenwidth = ScreenCols ();
 > +#else
 >        if (screenwidth <= 0 && term_string_buffer)
 >  	screenwidth = tgetnum ("co");
 >  #endif
 > @@ -199,7 +212,10 @@ _rl_get_screen_size (tty, ignore_env)
 >        if (ignore_env == 0 && (ss = get_env_value ("LINES")))
 >  	screenheight = atoi (ss);
 >  
 > -#if !defined(__DJGPP__)
 > +#if defined(__DJGPP__)
 > +      if (screenheight <= 0)
 > +	screenheight = ScreenRows ();
 > +#else
 >        if (screenheight <= 0 && term_string_buffer)
 >  	screenheight = tgetnum ("li");
 >  #endif
 > @@ -291,7 +307,9 @@ static void
 >  get_term_capabilities (bp)
 >       char **bp;
 >  {
 > -#if !defined(__DJGPP__)
 > +#if defined(__DJGPP__)
 > +  bp = bp;
 > +#else
 >    register int i;
 >  
 >    for (i = 0; i < NUM_TC_STRINGS; i++)
 > @@ -305,9 +323,10 @@ _rl_init_terminal_io (terminal_name)
 >       char *terminal_name;
 >  {
 >  #if defined (__GO32__)
 > -  screenwidth = ScreenCols ();
 > -  screenheight = ScreenRows ();
 > -  screenchars = screenwidth * screenheight;
 > +  terminal_name = terminal_name;
 > +  screenwidth = screenheight = 0;
 > +  _rl_get_screen_size (rl_instream ? fileno (rl_instream) : 0, 0);
 > +
 >    term_cr = "\r";
 >    term_im = term_ei = term_ic = term_IC = (char *)NULL;
 >    term_up = term_dc = term_DC = visible_bell = (char *)NULL;
 > @@ -323,7 +342,7 @@ _rl_init_terminal_io (terminal_name)
 >    term_forward_char = (char *)NULL;
 >  #endif /* HACK_TERMCAP_MOTION */
 >    terminal_can_insert = _rl_term_autowrap = 0;
 > -  return;
 > +  return 0;
 >  #else /* !__GO32__ */
 >  
 >    char *term, *buffer;
 > @@ -510,28 +529,28 @@ ding ()
 >  {
 >    if (readline_echoing_p)
 >      {
 > -#if !defined (__GO32__)
 >        switch (_rl_bell_preference)
 >          {
 >  	case NO_BELL:
 >  	default:
 >  	  break;
 >  	case VISIBLE_BELL:
 > +#if defined (__GO32__)
 > +	  ScreenVisualBell ();
 > +	  break;
 > +#else
 >  	  if (visible_bell)
 >  	    {
 >  	      tputs (visible_bell, 1, _rl_output_character_function);
 >  	      break;
 >  	    }
 > +#endif
 >  	  /* FALLTHROUGH */
 >  	case AUDIBLE_BELL:
 >  	  fprintf (stderr, "\007");
 >  	  fflush (stderr);
 >  	  break;
 >          }
 > -#else /* __GO32__ */
 > -      fprintf (stderr, "\007");
 > -      fflush (stderr);
 > -#endif /* __GO32__ */
 >        return (0);
 >      }
 >    return (-1);
 > @@ -556,7 +575,9 @@ void
 >  _rl_control_keypad (on)
 >       int on;
 >  {
 > -#if !defined(__DJGPP__)
 > +#if defined(__DJGPP__)
 > +  on = on;
 > +#else
 >    if (on && term_ks)
 >      tputs (term_ks, 1, _rl_output_character_function);
 >    else if (!on && term_ke)
From phdm@macqel.be Sat Apr 01 00:00:00 2000
From: "Philippe De Muyter" <phdm@macqel.be>
To: ac131313@cygnus.com (Andrew Cagney)
Cc: ezannoni@cygnus.com, gdb-patches@sourceware.cygnus.com
Subject: Re: HAVE_POLL is not enough - RFA
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200003211559.QAA16996@mail.macqel.be>
References: <38D5BE1D.7BB02C99@cygnus.com>
X-SW-Source: 2000-q1/msg00858.html
Content-length: 18695

Andrew Cagney wrote :
> 	if (use_poll)
> 	  {
> #if HAVE_POLL
> 	    ...
> #else
> 	    internal_error (...);
> #endif
> 	  }
> 	else
> 	  {
> 	  }
I have done that.  OK to commit ?

Tue Mar 21 16:49:38 2000  Philippe De Muyter  <phdm@macqel.be>

	* event-loop.c (sys/types.h): File now included unconditionally.
	(use_poll): New variable, initialized to HAVE_POLL.
	(gdb_notifier): poll- and select-versions merged.
	(add_file_handler): If HAVE_POLL, check whether poll is usable,
	and reset `use_poll' if not.
	(create_file_handler): Select poll- or select-version according to
	`use_poll'.
	(delete_file_handler, handle_file_event): Likewise.
	(gdb_wait_for_event, poll_timers): Likewise.

Index: gdb/event-loop.c
===================================================================
RCS file: /cvs/src/src/gdb/event-loop.c,v
retrieving revision 1.4
diff -u -p -r1.4 event-loop.c
--- event-loop.c	2000/03/20 19:59:38	1.4
+++ event-loop.c	2000/03/21 15:39:29
@@ -25,10 +25,9 @@
 #include "event-top.h"
 #ifdef HAVE_POLL
 #include <poll.h>
-#else
+#endif
 #include <sys/types.h>
 #include <string.h>
-#endif
 #include <errno.h>
 #include <setjmp.h>
 #include <sys/time.h>
@@ -166,36 +165,21 @@ event_queue;
 /* As of 1999-04-30 only the input file descriptor is registered with the
    event loop. */
 
-#ifdef HAVE_POLL
-/* Poll based implementation of the notifier. */
+/* Do we use poll or select ? */
+static unsigned char use_poll = HAVE_POLL;
 
 static struct
   {
     /* Ptr to head of file handler list. */
     file_handler *first_file_handler;
 
+#ifdef HAVE_POLL
     /* Ptr to array of pollfd structures. */
     struct pollfd *poll_fds;
 
-    /* Number of file descriptors to monitor. */
-    int num_fds;
-
     /* Timeout in milliseconds for calls to poll(). */
-    int timeout;
-
-    /* Flag to tell whether the timeout value shuld be used. */
-    int timeout_valid;
-  }
-gdb_notifier;
-
-#else /* ! HAVE_POLL */
-
-/* Select based implementation of the notifier. */
-
-static struct
-  {
-    /* Ptr to head of file handler list. */
-    file_handler *first_file_handler;
+    int poll_timeout;
+#endif
 
     /* Masks to be used in the next call to select.
        Bits are set in response to calls to create_file_handler. */
@@ -204,19 +188,18 @@ static struct
     /* What file descriptors were found ready by select. */
     fd_set ready_masks[3];
 
-    /* Number of valid bits (highest fd value + 1). */
+    /* Number of file descriptors to monitor. (for poll) */
+    /* Number of valid bits (highest fd value + 1). (for select) */
     int num_fds;
 
     /* Time structure for calls to select(). */
-    struct timeval timeout;
+    struct timeval select_timeout;
 
-    /* Flag to tell whether the timeout struct should be used. */
+    /* Flag to tell whether the timeout should be used. */
     int timeout_valid;
   }
 gdb_notifier;
 
-#endif /* HAVE_POLL */
-
 /* Structure associated with a timer. PROC will be executed at the
    first occasion after WHEN. */
 struct gdb_timer
@@ -384,7 +367,7 @@ process_event (void)
 	}
       free ((char *) event_ptr);
 
-      /* Now call the procedure associted with the event. */
+      /* Now call the procedure associated with the event. */
       (*proc) (fd);
       return 1;
     }
@@ -473,10 +456,30 @@ void
 add_file_handler (int fd, handler_func * proc, gdb_client_data client_data)
 {
 #ifdef HAVE_POLL
-  create_file_handler (fd, POLLIN, proc, client_data);
+  struct pollfd fds;
+#endif
+
+  if (use_poll)
+    {
+#ifdef HAVE_POLL
+    fds.fd = fd;
+    fds.events = POLLIN;
+    if (poll (&fds, 1, 0) == 1 && (fds.revents & POLLNVAL))
+      use_poll = 0;
 #else
-  create_file_handler (fd, GDB_READABLE | GDB_EXCEPTION, proc, client_data);
+    internal_error ("event-loop.c : use_poll without HAVE_POLL");
+#endif /* HAVE_POLL */
+    }
+  if (use_poll)
+    {
+#ifdef HAVE_POLL
+      create_file_handler (fd, POLLIN, proc, client_data);
+#else
+      internal_error ("event-loop.c : use_poll without HAVE_POLL");
 #endif
+    }
+  else
+    create_file_handler (fd, GDB_READABLE | GDB_EXCEPTION, proc, client_data);
 }
 
 /* Add a file handler/descriptor to the list of descriptors we are
@@ -512,48 +515,49 @@ create_file_handler (int fd, int mask, h
       file_ptr->ready_mask = 0;
       file_ptr->next_file = gdb_notifier.first_file_handler;
       gdb_notifier.first_file_handler = file_ptr;
-#ifdef HAVE_POLL
-      gdb_notifier.num_fds++;
-#endif
     }
   file_ptr->proc = proc;
   file_ptr->client_data = client_data;
   file_ptr->mask = mask;
 
+  if (use_poll)
+    {
 #ifdef HAVE_POLL
-
-  if (gdb_notifier.poll_fds)
-    gdb_notifier.poll_fds =
-      (struct pollfd *) realloc (gdb_notifier.poll_fds,
-			   (gdb_notifier.num_fds) * sizeof (struct pollfd));
-  else
-    gdb_notifier.poll_fds =
-      (struct pollfd *) xmalloc (sizeof (struct pollfd));
-  (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->fd = fd;
-  (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->events = mask;
-  (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->revents = 0;
-
-#else /* ! HAVE_POLL */
-
-  if (mask & GDB_READABLE)
-    FD_SET (fd, &gdb_notifier.check_masks[0]);
-  else
-    FD_CLR (fd, &gdb_notifier.check_masks[0]);
-
-  if (mask & GDB_WRITABLE)
-    FD_SET (fd, &gdb_notifier.check_masks[1]);
+      gdb_notifier.num_fds++;
+      if (gdb_notifier.poll_fds)
+	gdb_notifier.poll_fds =
+	  (struct pollfd *) realloc (gdb_notifier.poll_fds,
+			       (gdb_notifier.num_fds) * sizeof (struct pollfd));
+      else
+	gdb_notifier.poll_fds =
+	  (struct pollfd *) xmalloc (sizeof (struct pollfd));
+      (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->fd = fd;
+      (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->events = mask;
+      (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->revents = 0;
+#else
+      internal_error ("event-loop.c : use_poll without HAVE_POLL");
+#endif /* HAVE_POLL */
+    }
   else
-    FD_CLR (fd, &gdb_notifier.check_masks[1]);
+    {
+      if (mask & GDB_READABLE)
+	FD_SET (fd, &gdb_notifier.check_masks[0]);
+      else
+	FD_CLR (fd, &gdb_notifier.check_masks[0]);
 
-  if (mask & GDB_EXCEPTION)
-    FD_SET (fd, &gdb_notifier.check_masks[2]);
-  else
-    FD_CLR (fd, &gdb_notifier.check_masks[2]);
+      if (mask & GDB_WRITABLE)
+	FD_SET (fd, &gdb_notifier.check_masks[1]);
+      else
+	FD_CLR (fd, &gdb_notifier.check_masks[1]);
 
-  if (gdb_notifier.num_fds <= fd)
-    gdb_notifier.num_fds = fd + 1;
+      if (mask & GDB_EXCEPTION)
+	FD_SET (fd, &gdb_notifier.check_masks[2]);
+      else
+	FD_CLR (fd, &gdb_notifier.check_masks[2]);
 
-#endif /* HAVE_POLL */
+      if (gdb_notifier.num_fds <= fd)
+	gdb_notifier.num_fds = fd + 1;
+    }
 }
 
 /* Remove the file descriptor FD from the list of monitored fd's: 
@@ -580,51 +584,56 @@ delete_file_handler (int fd)
   if (file_ptr == NULL)
     return;
 
+  if (use_poll)
+    {
 #ifdef HAVE_POLL
-  /* Create a new poll_fds array by copying every fd's information but the
-     one we want to get rid of. */
+      /* Create a new poll_fds array by copying every fd's information but the
+	 one we want to get rid of. */
 
-  new_poll_fds =
-    (struct pollfd *) xmalloc ((gdb_notifier.num_fds - 1) * sizeof (struct pollfd));
+      new_poll_fds =
+	(struct pollfd *) xmalloc ((gdb_notifier.num_fds - 1) * sizeof (struct pollfd));
 
-  for (i = 0, j = 0; i < gdb_notifier.num_fds; i++)
-    {
-      if ((gdb_notifier.poll_fds + i)->fd != fd)
+      for (i = 0, j = 0; i < gdb_notifier.num_fds; i++)
 	{
-	  (new_poll_fds + j)->fd = (gdb_notifier.poll_fds + i)->fd;
-	  (new_poll_fds + j)->events = (gdb_notifier.poll_fds + i)->events;
-	  (new_poll_fds + j)->revents = (gdb_notifier.poll_fds + i)->revents;
-	  j++;
+	  if ((gdb_notifier.poll_fds + i)->fd != fd)
+	    {
+	      (new_poll_fds + j)->fd = (gdb_notifier.poll_fds + i)->fd;
+	      (new_poll_fds + j)->events = (gdb_notifier.poll_fds + i)->events;
+	      (new_poll_fds + j)->revents = (gdb_notifier.poll_fds + i)->revents;
+	      j++;
+	    }
 	}
+      free (gdb_notifier.poll_fds);
+      gdb_notifier.poll_fds = new_poll_fds;
+      gdb_notifier.num_fds--;
+#else
+      internal_error ("event-loop.c : use_poll without HAVE_POLL");
+#endif /* HAVE_POLL */
     }
-  free (gdb_notifier.poll_fds);
-  gdb_notifier.poll_fds = new_poll_fds;
-  gdb_notifier.num_fds--;
-
-#else /* ! HAVE_POLL */
-
-  if (file_ptr->mask & GDB_READABLE)
-    FD_CLR (fd, &gdb_notifier.check_masks[0]);
-  if (file_ptr->mask & GDB_WRITABLE)
-    FD_CLR (fd, &gdb_notifier.check_masks[1]);
-  if (file_ptr->mask & GDB_EXCEPTION)
-    FD_CLR (fd, &gdb_notifier.check_masks[2]);
+  else
+    {
+      if (file_ptr->mask & GDB_READABLE)
+	FD_CLR (fd, &gdb_notifier.check_masks[0]);
+      if (file_ptr->mask & GDB_WRITABLE)
+	FD_CLR (fd, &gdb_notifier.check_masks[1]);
+      if (file_ptr->mask & GDB_EXCEPTION)
+	FD_CLR (fd, &gdb_notifier.check_masks[2]);
 
-  /* Find current max fd. */
+      /* Find current max fd. */
 
-  if ((fd + 1) == gdb_notifier.num_fds)
-    {
-      gdb_notifier.num_fds--;
-      for (i = gdb_notifier.num_fds; i; i--)
+      if ((fd + 1) == gdb_notifier.num_fds)
 	{
-	  if (FD_ISSET (i - 1, &gdb_notifier.check_masks[0])
-	      || FD_ISSET (i - 1, &gdb_notifier.check_masks[1])
-	      || FD_ISSET (i - 1, &gdb_notifier.check_masks[2]))
-	    break;
+	  gdb_notifier.num_fds--;
+	  for (i = gdb_notifier.num_fds; i; i--)
+	    {
+	      if (FD_ISSET (i - 1, &gdb_notifier.check_masks[0])
+		  || FD_ISSET (i - 1, &gdb_notifier.check_masks[1])
+		  || FD_ISSET (i - 1, &gdb_notifier.check_masks[2]))
+		break;
+	    }
+	  gdb_notifier.num_fds = i;
 	}
-      gdb_notifier.num_fds = i;
     }
-#endif /* HAVE_POLL */
 
   /* Deactivate the file descriptor, by clearing its mask, 
      so that it will not fire again. */
@@ -676,36 +685,43 @@ handle_file_event (int event_file_desc)
 	  /* See if the desired events (mask) match the received
 	     events (ready_mask). */
 
-#ifdef HAVE_POLL
-	  error_mask = POLLHUP | POLLERR | POLLNVAL;
-	  mask = (file_ptr->ready_mask & file_ptr->mask) |
-	    (file_ptr->ready_mask & error_mask);
-	  error_mask_returned = mask & error_mask;
-
-	  if (error_mask_returned != 0)
+	  if (use_poll)
 	    {
-	      /* Work in progress. We may need to tell somebody what
-	         kind of error we had. */
-	      if (error_mask_returned & POLLHUP)
-		printf_unfiltered ("Hangup detected on fd %d\n", file_ptr->fd);
-	      if (error_mask_returned & POLLERR)
-		printf_unfiltered ("Error detected on fd %d\n", file_ptr->fd);
-	      if (error_mask_returned & POLLNVAL)
-		printf_unfiltered ("Invalid or non-`poll'able fd %d\n", file_ptr->fd);
-	      file_ptr->error = 1;
+#ifdef HAVE_POLL
+	      error_mask = POLLHUP | POLLERR | POLLNVAL;
+	      mask = (file_ptr->ready_mask & file_ptr->mask) |
+		(file_ptr->ready_mask & error_mask);
+	      error_mask_returned = mask & error_mask;
+
+	      if (error_mask_returned != 0)
+		{
+		  /* Work in progress. We may need to tell somebody what
+		     kind of error we had. */
+		  if (error_mask_returned & POLLHUP)
+		    printf_unfiltered ("Hangup detected on fd %d\n", file_ptr->fd);
+		  if (error_mask_returned & POLLERR)
+		    printf_unfiltered ("Error detected on fd %d\n", file_ptr->fd);
+		  if (error_mask_returned & POLLNVAL)
+		    printf_unfiltered ("Invalid or non-`poll'able fd %d\n", file_ptr->fd);
+		  file_ptr->error = 1;
+		}
+	      else
+		file_ptr->error = 0;
+#else
+      internal_error ("event-loop.c : use_poll without HAVE_POLL");
+#endif /* HAVE_POLL */
 	    }
 	  else
-	    file_ptr->error = 0;
-#else /* ! HAVE_POLL */
-	  if (file_ptr->ready_mask & GDB_EXCEPTION)
 	    {
-	      printf_unfiltered ("Exception condition detected on fd %d\n", file_ptr->fd);
-	      file_ptr->error = 1;
+	      if (file_ptr->ready_mask & GDB_EXCEPTION)
+		{
+		  printf_unfiltered ("Exception condition detected on fd %d\n", file_ptr->fd);
+		  file_ptr->error = 1;
+		}
+	      else
+		file_ptr->error = 0;
+	      mask = file_ptr->ready_mask & file_ptr->mask;
 	    }
-	  else
-	    file_ptr->error = 0;
-	  mask = file_ptr->ready_mask & file_ptr->mask;
-#endif /* HAVE_POLL */
 
 	  /* Clear the received events for next time around. */
 	  file_ptr->ready_mask = 0;
@@ -731,9 +747,7 @@ gdb_wait_for_event (void)
   file_handler *file_ptr;
   gdb_event *file_event_ptr;
   int num_found = 0;
-#ifdef HAVE_POLL
   int i;
-#endif
 
   /* Make sure all output is done before getting another event. */
   gdb_flush (gdb_stdout);
@@ -742,108 +756,114 @@ gdb_wait_for_event (void)
   if (gdb_notifier.num_fds == 0)
     return -1;
 
+  if (use_poll)
+    {
 #ifdef HAVE_POLL
-  num_found =
-    poll (gdb_notifier.poll_fds,
-	  (unsigned long) gdb_notifier.num_fds,
-	  gdb_notifier.timeout_valid ? gdb_notifier.timeout : -1);
-
-  /* Don't print anything if we get out of poll because of a
-     signal. */
-  if (num_found == -1 && errno != EINTR)
-    perror_with_name ("Poll");
-
-#else /* ! HAVE_POLL */
-
-  gdb_notifier.ready_masks[0] = gdb_notifier.check_masks[0];
-  gdb_notifier.ready_masks[1] = gdb_notifier.check_masks[1];
-  gdb_notifier.ready_masks[2] = gdb_notifier.check_masks[2];
-
-  num_found = select (gdb_notifier.num_fds,
-		      & gdb_notifier.ready_masks[0],
-		      & gdb_notifier.ready_masks[1],
-		      & gdb_notifier.ready_masks[2],
-		      gdb_notifier.timeout_valid
-		      ? &gdb_notifier.timeout : NULL);
-
-  /* Clear the masks after an error from select. */
-  if (num_found == -1)
-    {
-      FD_ZERO (&gdb_notifier.ready_masks[0]);
-      FD_ZERO (&gdb_notifier.ready_masks[1]);
-      FD_ZERO (&gdb_notifier.ready_masks[2]);
-      /* Dont print anything is we got a signal, let gdb handle it. */
-      if (errno != EINTR)
-	perror_with_name ("Select");
-    }
+      num_found =
+	poll (gdb_notifier.poll_fds,
+	      (unsigned long) gdb_notifier.num_fds,
+	      gdb_notifier.timeout_valid ? gdb_notifier.poll_timeout : -1);
+
+      /* Don't print anything if we get out of poll because of a
+	 signal. */
+      if (num_found == -1 && errno != EINTR)
+	perror_with_name ("Poll");
+#else
+      internal_error ("event-loop.c : use_poll without HAVE_POLL");
 #endif /* HAVE_POLL */
+    }
+  else
+    {
+      gdb_notifier.ready_masks[0] = gdb_notifier.check_masks[0];
+      gdb_notifier.ready_masks[1] = gdb_notifier.check_masks[1];
+      gdb_notifier.ready_masks[2] = gdb_notifier.check_masks[2];
+      num_found = select (gdb_notifier.num_fds,
+			  & gdb_notifier.ready_masks[0],
+			  & gdb_notifier.ready_masks[1],
+			  & gdb_notifier.ready_masks[2],
+			  gdb_notifier.timeout_valid
+			  ? &gdb_notifier.select_timeout : NULL);
 
+      /* Clear the masks after an error from select. */
+      if (num_found == -1)
+	{
+	  FD_ZERO (&gdb_notifier.ready_masks[0]);
+	  FD_ZERO (&gdb_notifier.ready_masks[1]);
+	  FD_ZERO (&gdb_notifier.ready_masks[2]);
+	  /* Dont print anything is we got a signal, let gdb handle it. */
+	  if (errno != EINTR)
+	    perror_with_name ("Select");
+	}
+    }
+
   /* Enqueue all detected file events. */
 
+  if (use_poll)
+    {
 #ifdef HAVE_POLL
+      for (i = 0; (i < gdb_notifier.num_fds) && (num_found > 0); i++)
+	{
+	  if ((gdb_notifier.poll_fds + i)->revents)
+	    num_found--;
+	  else
+	    continue;
 
-  for (i = 0; (i < gdb_notifier.num_fds) && (num_found > 0); i++)
-    {
-      if ((gdb_notifier.poll_fds + i)->revents)
-	num_found--;
-      else
-	continue;
+	  for (file_ptr = gdb_notifier.first_file_handler;
+	       file_ptr != NULL;
+	       file_ptr = file_ptr->next_file)
+	    {
+	      if (file_ptr->fd == (gdb_notifier.poll_fds + i)->fd)
+		break;
+	    }
+
+	  if (file_ptr)
+	    {
+	      /* Enqueue an event only if this is still a new event for
+		 this fd. */
+	      if (file_ptr->ready_mask == 0)
+		{
+		  file_event_ptr = create_file_event (file_ptr->fd);
+		  async_queue_event (file_event_ptr, TAIL);
+		}
+	    }
 
+	  file_ptr->ready_mask = (gdb_notifier.poll_fds + i)->revents;
+	}
+#else
+      internal_error ("event-loop.c : use_poll without HAVE_POLL");
+#endif /* HAVE_POLL */
+    }
+  else
+    {
       for (file_ptr = gdb_notifier.first_file_handler;
-	   file_ptr != NULL;
+	   (file_ptr != NULL) && (num_found > 0);
 	   file_ptr = file_ptr->next_file)
 	{
-	  if (file_ptr->fd == (gdb_notifier.poll_fds + i)->fd)
-	    break;
-	}
+	  int mask = 0;
 
-      if (file_ptr)
-	{
+	  if (FD_ISSET (file_ptr->fd, &gdb_notifier.ready_masks[0]))
+	    mask |= GDB_READABLE;
+	  if (FD_ISSET (file_ptr->fd, &gdb_notifier.ready_masks[1]))
+	    mask |= GDB_WRITABLE;
+	  if (FD_ISSET (file_ptr->fd, &gdb_notifier.ready_masks[2]))
+	    mask |= GDB_EXCEPTION;
+
+	  if (!mask)
+	    continue;
+	  else
+	    num_found--;
+
 	  /* Enqueue an event only if this is still a new event for
 	     this fd. */
+
 	  if (file_ptr->ready_mask == 0)
 	    {
 	      file_event_ptr = create_file_event (file_ptr->fd);
 	      async_queue_event (file_event_ptr, TAIL);
 	    }
+	  file_ptr->ready_mask = mask;
 	}
-
-      file_ptr->ready_mask = (gdb_notifier.poll_fds + i)->revents;
     }
-
-#else /* ! HAVE_POLL */
-
-  for (file_ptr = gdb_notifier.first_file_handler;
-       (file_ptr != NULL) && (num_found > 0);
-       file_ptr = file_ptr->next_file)
-    {
-      int mask = 0;
-
-      if (FD_ISSET (file_ptr->fd, &gdb_notifier.ready_masks[0]))
-	mask |= GDB_READABLE;
-      if (FD_ISSET (file_ptr->fd, &gdb_notifier.ready_masks[1]))
-	mask |= GDB_WRITABLE;
-      if (FD_ISSET (file_ptr->fd, &gdb_notifier.ready_masks[2]))
-	mask |= GDB_EXCEPTION;
-
-      if (!mask)
-	continue;
-      else
-	num_found--;
-
-      /* Enqueue an event only if this is still a new event for
-         this fd. */
-
-      if (file_ptr->ready_mask == 0)
-	{
-	  file_event_ptr = create_file_event (file_ptr->fd);
-	  async_queue_event (file_event_ptr, TAIL);
-	}
-      file_ptr->ready_mask = mask;
-    }
-
-#endif /* HAVE_POLL */
-
   return 0;
 }
 \f
@@ -1125,12 +1145,19 @@ poll_timers (void)
 
       /* Now we need to update the timeout for select/ poll, because we
          don't want to sit there while this timer is expiring. */
+      if (use_poll)
+	{
 #ifdef HAVE_POLL
-      gdb_notifier.timeout = delta.tv_sec * 1000;
+	  gdb_notifier.poll_timeout = delta.tv_sec * 1000;
 #else
-      gdb_notifier.timeout.tv_sec = delta.tv_sec;
-      gdb_notifier.timeout.tv_usec = delta.tv_usec;
-#endif
+	  internal_error ("event-loop.c : use_poll without HAVE_POLL");
+#endif /* HAVE_POLL */
+	}
+      else
+	{
+	  gdb_notifier.select_timeout.tv_sec = delta.tv_sec;
+	  gdb_notifier.select_timeout.tv_usec = delta.tv_usec;
+	}
       gdb_notifier.timeout_valid = 1;
     }
   else
From ac131313@cygnus.com Sat Apr 01 00:00:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Eli Zaretskii <eliz@delorie.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH]: DJGPP build and cleanup
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38BB7BDD.39EEFE54@cygnus.com>
References: <200002232229.RAA18809@indy.delorie.com>
X-SW-Source: 2000-q1/msg00421.html
Content-length: 851

Eli Zaretskii wrote:

> 2000-02-23  Eli Zaretskii  <eliz@is.elta.co.il>
> 
>         * config/i386/nm-go32.h (FLOAT_INFO): Remove macro definition.
>         (top level): Add prototypes for go32_* functions.
> 
>         * config/i386/tm-go32.h (I386_DJGPP_TARGET): Define.
>         (FRAME_CHAIN, FRAMELESS_FUNCTION_INVOCATION, FRAME_SAVED_PC):
>         Override definitions from tm-i386.h.
>         (REGISTER_VIRTUAL_TYPE): Remove macro definition.
> 
>         * i386-tdep.c (i386_extract_return_value)
>         [I386_AIX_TARGET || I386_GNULINUX_TARGET]: Add I386_DJGPP_TARGET
>         to the list of targets which return FP values in FP registers.

FYI,

I've checked this in.  The only mod I made was to add a FIXME to
i386_extract_return_value() pointing out that the function should be
multi-arched.

Hope it matches what you had,

	Andrew
From fnasser@cygnus.com Sat Apr 01 00:00:00 2000
From: Fernando Nasser <fnasser@cygnus.com>
To: gdb-patches@sourceware.cygnus.com
Subject: RFA: set unwindonsignal (as promissed)
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38ADFA6A.A45CC83A@cygnus.com>
X-SW-Source: 2000-q1/msg00247.html
Content-length: 7513

This patch makes everybody happy.  Just set the flag as you like.

The default behavior is what gdb used to do before: stay in the frame
where the signal occurred.


2000-02-18  Fernando Nasser  <fnasser@cygnus.com>

        * top.c (init_main): Add command set unwindonsignal.
        * infcmd.c (run_stack_dummy): Do not pop frame on random signal.
        * valops.c (hand_function_call): Test for unwind_on_signal and
        act accordingly.


-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@cygnus.com
2323 Yonge Street, Suite #300           Tel:  416-482-2661 ext. 311
Toronto, Ontario   M4P 2C9              Fax:  416-482-6299



Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.2
diff -c -p -r1.2 top.c
*** top.c       2000/02/09 03:28:18     1.2
--- top.c       2000/02/19 01:57:16
*************** int linesize = 100;
*** 298,304 ****
--- 298,311 ----
     from the user, and have the user not notice that the user interface
     is issuing commands too.  */
  int server_command;
+  
+ /* This boolean tells what gdb should do if a signal is received while
in
+    a function called from gdb (call dummy).  If set, gdb unwinds the
stack
+    and restore the context to what as it was before the call.
+    The default is to stop in the frame where the signal was received.
*/
  
+ int unwind_on_signal_p = 0;
+ 
  /* Baud rate specified for talking to serial target systems.  Default
     is left as -1, so targets can choose their own defaults.  */
  /* FIXME: This means that "show remotebaud" and gr_files_info can
print -1
*************** The conditional expression must follow t
*** 4266,4271 ****
--- 4273,4288 ----
  followed by a new line.  The nested commands must be entered one per
line,\n\
  and should be terminated by the word 'else' or `end'.  If an else
clause\n\
  is used, the same rules apply to its nested commands as to the first
ones.");
+ 
+   add_show_from_set (
+   add_set_cmd ("unwindonsignal", no_class, var_boolean,
+              (char *) &unwind_on_signal_p,
+ "Set unwinding of stack if a signal is received while in a call
dummy.\n\
+ The unwindonsignal lets the user determine what gdb should do if a
signal\n\
+ is received while in a function called from gdb (call dummy).  If set,
gdb\n\
+ unwinds the stack and restore the context to what as it was before the
call.\n\
+ The default is to stop in the frame where the signal was received.",
&setlist),
+                    &showlist);
  
    /* If target is open when baud changes, it doesn't take effect until
the
       next open (I think, not sure).  */
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.1.1.11
diff -c -p -r1.1.1.11 valops.c
*** valops.c    2000/02/01 03:19:12     1.1.1.11
--- valops.c    2000/02/19 01:57:17
***************
*** 47,52 ****
--- 47,57 ----
     value operations with HP aCC code/runtime. */
  extern int hp_som_som_object_present;
  
+ /* This boolean tells what gdb should do if a signal is received while
in
+    a function called from gdb (call dummy).  If set, gdb unwinds the
stack
+    and restore the context to what as it was before the call.
+    The default is to stop in the frame where the signal was received.
*/
+ extern int unwind_on_signal_p;
  
  /* Local functions.  */
  
*************** You must use a pointer to function type 
*** 1695,1710 ****
        /* We stopped inside the FUNCTION because of a random signal.
           Further execution of the FUNCTION is not allowed. */
  
!       /* In this case, we must do the cleanups because we don't
!          want the dummy anymore (the dummy frame has been poped
already. */
!       do_cleanups (old_chain);
! 
!       /* FIXME: Insert a bunch of wrap_here; name can be very long if
it's
!          a C++ name with arguments and stuff.  */
!       error ("\
! The program being debugged stopped while in a function called from
GDB.\n\
  Evaluation of the expression containing the function (%s) will be
abandoned.",
!              name);
        }
  
      if (rc == 2)
--- 1700,1745 ----
        /* We stopped inside the FUNCTION because of a random signal.
           Further execution of the FUNCTION is not allowed. */
  
!         if (unwind_on_signal_p)
!         {
!           /* The user wants the context restored. */
! 
!             /* We must get back to the frame we were before the dummy
call. */
!             POP_FRAME;
! 
!           /* In this case, we must do the cleanups because we don't
!              want the dummy anymore */
!           do_cleanups (old_chain);
! 
!           /* FIXME: Insert a bunch of wrap_here; name can be very long
if it's
!              a C++ name with arguments and stuff.  */
!           error ("\
! The program being debugged was signaled while in a function called
from GDB.\n\
! GDB has restored the context to what it was before the call.\n\
! To change this behavior use \"set unwindonsignal off\"\n\
  Evaluation of the expression containing the function (%s) will be
abandoned.",
!                  name);
!         }
!       else
!         {
!           /* The user wants to stay in the frame where we stopped
(default).*/
! 
!           /* If we did the cleanups, we would print a spurious error
!              message (Unable to restore previously selected frame),
!              would write the registers from the inf_status (which is
!              wrong), and would do other wrong things.  */
!           discard_cleanups (old_chain);
!           discard_inferior_status (inf_status);
! 
!           /* FIXME: Insert a bunch of wrap_here; name can be very long
if it's
!              a C++ name with arguments and stuff.  */
!           error ("\
! The program being debugged was signaled while in a function called
from GDB.\n\
! GDB remains in the frame where the signal was received.\n\
! To change this behavior use \"set unwindonsignal on\"\n\
! Evaluation of the expression containing the function (%s) will be
abandoned.",
!                  name);
!         }
        }
  
      if (rc == 2)
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.1.1.17
diff -c -p -r1.1.1.17 infcmd.c
*** infcmd.c    2000/02/03 04:14:31     1.1.1.17
--- infcmd.c    2000/02/19 01:57:18
*************** run_stack_dummy (addr, buffer)
*** 926,945 ****
  
    discard_cleanups (old_cleanups);
  
    if (stopped_by_random_signal)
!     {
!       /* If the inferior execution fails we need to restore our
!          stack.  It is not done by proceed() in this case. */
!       /* Pop the empty frame that contains the stack dummy.
!          POP_FRAME ends with a setting of the current frame, so we
!          can use that next. */
!       POP_FRAME;
!       return 1;
!     }
      
    /* We may also stop prematurely because we hit a breakpoint in the
!      called routine.  We do not pop the frame as the user may wish
!      to single step or continue from there. */
    if (!stop_stack_dummy)
      return 2;
  
--- 926,937 ----
  
    discard_cleanups (old_cleanups);
  
+   /* We can stop during an inferior call because a signal is received.
*/
    if (stopped_by_random_signal)
!     return 1;
      
    /* We may also stop prematurely because we hit a breakpoint in the
!      called routine. */
    if (!stop_stack_dummy)
      return 2;
From ac131313@cygnus.com Sat Apr 01 00:00:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: rearnsha@arm.com
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: Recommend directory update
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38B3C390.214B8988@cygnus.com>
References: <200002231000.KAA27985@cam-mail2.cambridge.arm.com>
X-SW-Source: 2000-q1/msg00332.html
Content-length: 630

Richard Earnshaw wrote:
> 
> > (I just don't recommend using cvs update -d.  You will get far more than
> > you ever planned)
> >
> > The sequence:
> >       test -d src/gdb && echo cvs -d `cat src/CVS/Root` co gdb
> > works pretty well.  Insight people should s/gdb/insight/.
> >
> > Several new directories (libiberty/testsuite, gdb/mi
> > gdb/testsuite/gdb.mi) have been created.
> >
> >       Andrew
> 
> Any chance that we can crib the contrib structure from gcc and have
> contrib/update_{gdb,binutils,...}?  This would then ensure that configure
> files didn't get mangled either.

Um, I'm not sure what you mean.

	Andrew
From ac131313@cygnus.com Sat Apr 01 00:00:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Mark Kettenis <kettenis@wins.uva.nl>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: What happened to: [RFC] Move/Rename include/wait.h ("wait.h")
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <389F6523.CBD40BE3@cygnus.com>
References: <200002072347.e17NlFI26317@delius.kettenis.local>
X-SW-Source: 2000-q1/msg00091.html
Content-length: 645

Mark Kettenis wrote:
> 
> Hi Andrew,
> 
> What happened to the proposal mentioned in the subject of this
> message?  The issue about confusing "wait.h" and <wait.h> is now
> biting me on Linux with glibc 2.1.3-to-be, where we have both <wait.h>
> and <sys/wait.h>.  Happened somehow when I moved over to using the new
> CVS repository :-(.

Its not forgotten.  It's sitting in an internal (to Red Hat) bug
tracking database (Please don't restart the bug tracking discussion) and
will be processed as part of this two week purge.

Part of the change involves deleting src/include/wait.h (part of
binutils) but that is now been approved.

	Andrew
From kettenis@wins.uva.nl Sat Apr 01 00:00:00 2000
From: Mark Kettenis <kettenis@wins.uva.nl>
To: ac131313@cygnus.com
Cc: gdb-patches@sourceware.cygnus.com
Subject: What happened to: [RFC] Move/Rename include/wait.h ("wait.h")
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200002072347.e17NlFI26317@delius.kettenis.local>
X-SW-Source: 2000-q1/msg00088.html
Content-length: 308

Hi Andrew,

What happened to the proposal mentioned in the subject of this
message?  The issue about confusing "wait.h" and <wait.h> is now
biting me on Linux with glibc 2.1.3-to-be, where we have both <wait.h>
and <sys/wait.h>.  Happened somehow when I moved over to using the new
CVS repository :-(.

Mark
From fnasser@cygnus.com Sat Apr 01 00:00:00 2000
From: Fernando Nasser <fnasser@cygnus.com>
To: Dave Vogel <dave@lightsurf.com>, Insight mail-list <insight@sourceware.cygnus.com>, gdb-patches@sourceware.cygnus.com, grante@visi.com, James Ingham <jingham@cygnus.com>
Subject: RDI debugging
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <3873A126.2171803D@cygnus.com>
References: <386A5B50.EFBCA961@lightsurf.com> <387295B5.CBBF5807@cygnus.com>
X-SW-Source: 2000-q1/msg00011.html
Content-length: 912

The following patches have been commited and will show up in the next
snapshot:

Thank you Dave, Grant and Thomas.


2000-01-05  Fernando Nasser  <fnasser@totem.to.cygnus.com>

	From Dave Vogel (dave@lightsurf.com):
	* targetselection.itb (init_target_db, config_dialog): Add support
	for selecting a target running the Angel monitor (RDI protocol)
	over an UDP connection.
	* interface.tcl (set_target_name): Set hostname when target is RDI
	over UDP (see previous entry).

2000-01-05  Fernando Nasser  <fnasser@totem.to.cygnus.com>

	From Grant Edwards <grante@visi.com> (original patch from Thomas
	Zenker ):
	* rdi-share/ardi.c: Allow interruption of interruptible
	targets with a <CNTL-C>.


-- 
Fernando Nasser
Cygnus Solutions - Toronto Office       E-Mail:  fnasser@cygnus.com
2323 Yonge Street, Suite #300           Tel:  416-482-2661 ext. 311
Toronto, Ontario   M4P 2C9              Fax:  416-482-6299
From ezannoni@cygnus.com Sat Apr 01 00:00:00 2000
From: Elena Zannoni <ezannoni@cygnus.com>
To: nsd@cygnus.com
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: Patch: catch_errors() bug fixes and speedups
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <14514.63567.180178.977613@kwikemart.cygnus.com>
References: <200002112031.UAA02868@nog.bosbc.com> <200002222010.UAA05801@nog.bosbc.com>
X-SW-Source: 2000-q1/msg00307.html
Content-length: 9277

Looks great. Thanks Nick, for taking the time to fix this.
It can certainly go in, unless Andrew has some objections.

Elena

nsd@cygnus.com writes:
 > The appended patch is an improved version of the "catch_errors() cleanup
 > chain restore" patch I posted on 11-Feb.
 > 
 > It fixes these bugs:
 > 
 >   1. If a quit happened within catch_errors(RETURN_MASK_ERROR) or vice
 >      versa, the cleanup chain got lost.
 > 
 >   2. A catch_errors(RETURN_MASK_ERROR) within a
 >      catch_errors(RETURN_MASK_QUIT) or vice versa could have resulted in a
 >      garbled jump buffer.
 > 
 >   3. Some comments were out of date.
 > 
 > It also improves efficiency by avoiding a few memcpy()s.
 > 
 > Comments welcome,
 > 
 > Nick Duffek
 > nsd@cygnus.com
 > 
 > [patch follows]
 > 
 > Index: top.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/top.c,v
 > retrieving revision 1.2
 > diff -u -r1.2 top.c
 > --- top.c	2000/02/09 03:28:18	1.2
 > +++ top.c	2000/02/22 19:59:14
 > @@ -482,8 +482,8 @@
 >  PARAMS ((void)) ATTR_NORETURN;
 >  \f
 >  
 > -/* Generally one should use catch_errors rather than manipulating these
 > -   directly.  The exception is main().  */
 > +/* One should use catch_errors rather than manipulating these
 > +   directly.  */
 >  #if defined(HAVE_SIGSETJMP)
 >  #define SIGJMP_BUF		sigjmp_buf
 >  #define SIGSETJMP(buf)		sigsetjmp(buf, 1)
 > @@ -494,13 +494,10 @@
 >  #define SIGLONGJMP(buf,val)	longjmp(buf,val)
 >  #endif
 >  
 > -/* Where to go for return_to_top_level (RETURN_ERROR).  */
 > -static SIGJMP_BUF error_return;
 > -/* Where to go for return_to_top_level (RETURN_QUIT).  */
 > -static SIGJMP_BUF quit_return;
 > +/* Where to go for return_to_top_level.  */
 > +static SIGJMP_BUF *catch_return;
 >  
 > -/* Return for reason REASON.  This generally gets back to the command
 > -   loop, but can be caught via catch_errors.  */
 > +/* Return for reason REASON to the nearest containing catch_errors().  */
 >  
 >  NORETURN void
 >  return_to_top_level (reason)
 > @@ -531,8 +528,11 @@
 >  	break;
 >        }
 >  
 > -  (NORETURN void) SIGLONGJMP
 > -    (reason == RETURN_ERROR ? error_return : quit_return, 1);
 > +  /* Jump to the containing catch_errors() call, communicating REASON
 > +     to that call via setjmp's return value.  Note that REASON can't
 > +     be zero, by definition in defs.h. */
 > +
 > +  (NORETURN void) SIGLONGJMP (*catch_return, (int)reason);
 >  }
 >  
 >  /* Call FUNC with arg ARGS, catching any errors.  If there is no
 > @@ -562,13 +562,6 @@
 >     code also randomly used a SET_TOP_LEVEL macro that directly
 >     initialize the longjmp buffers. */
 >  
 > -/* MAYBE: cagney/1999-11-05: Since the SET_TOP_LEVEL macro has been
 > -   eliminated it is now possible to use the stack to directly store
 > -   each longjmp buffer.  The global code would just need to update a
 > -   pointer (onto the stack - ulgh!?) indicating the current longjmp
 > -   buffers. It would certainly improve the performance of the longjmp
 > -   code since the memcpy's would be eliminated. */
 > -
 >  /* MAYBE: cagney/1999-11-05: Should the catch_erros and cleanups code
 >     be consolidated into a single file instead of being distributed
 >     between utils.c and top.c? */
 > @@ -580,61 +573,89 @@
 >       char *errstring;
 >       return_mask mask;
 >  {
 > -  SIGJMP_BUF saved_error;
 > -  SIGJMP_BUF saved_quit;
 > -  SIGJMP_BUF tmp_jmp;
 > +  SIGJMP_BUF *saved_catch;
 > +  SIGJMP_BUF catch;
 >    int val;
 >    struct cleanup *saved_cleanup_chain;
 >    char *saved_error_pre_print;
 >    char *saved_quit_pre_print;
 >  
 > -  saved_cleanup_chain = save_cleanups ();
 > +  /* Return value from SIGSETJMP(): enum return_reason if error or
 > +     quit caught, 0 otherwise. */
 > +  int caught;
 > +
 > +  /* Override error/quit messages during FUNC. */
 > +
 >    saved_error_pre_print = error_pre_print;
 >    saved_quit_pre_print = quit_pre_print;
 >  
 >    if (mask & RETURN_MASK_ERROR)
 > -    {
 > -      memcpy ((char *) saved_error, (char *) error_return, sizeof (SIGJMP_BUF));
 > -      error_pre_print = errstring;
 > -    }
 > +    error_pre_print = errstring;
 >    if (mask & RETURN_MASK_QUIT)
 > -    {
 > -      memcpy (saved_quit, quit_return, sizeof (SIGJMP_BUF));
 > -      quit_pre_print = errstring;
 > -    }
 > -
 > -  if (SIGSETJMP (tmp_jmp) == 0)
 > -    {
 > -      if (mask & RETURN_MASK_ERROR)
 > -	memcpy (error_return, tmp_jmp, sizeof (SIGJMP_BUF));
 > -      if (mask & RETURN_MASK_QUIT)
 > -	memcpy (quit_return, tmp_jmp, sizeof (SIGJMP_BUF));
 > -      val = (*func) (args);
 > -      /* FIXME: cagney/1999-11-05: A correct FUNC implementaton will
 > -         clean things up (restoring the cleanup chain) to the state
 > -         they were just prior to the call.  Technically, this means
 > -         that the below restore_cleanups call is redundant.
 > -         Unfortunatly, many FUNC's are not that well behaved.
 > -         restore_cleanups should either be replaced with a do_cleanups
 > -         call (to cover the problem) or an assertion check to detect
 > -         bad FUNCs code. */
 > -    }
 > -  else
 > -    val = 0;
 > +    quit_pre_print = errstring;
 > +
 > +  /* Prevent error/quit during FUNC from calling cleanups established
 > +     prior to here. */
 >  
 > +  saved_cleanup_chain = save_cleanups ();
 > +
 > +  /* Call FUNC, catching error/quit events. */
 > +
 > +  saved_catch = catch_return;
 > +  catch_return = &catch;
 > +  caught = SIGSETJMP (catch);
 > +  if (!caught)
 > +    val = (*func) (args);
 > +  catch_return = saved_catch;
 > +
 > +  /* FIXME: cagney/1999-11-05: A correct FUNC implementaton will
 > +     clean things up (restoring the cleanup chain) to the state they
 > +     were just prior to the call.  Unfortunatly, many FUNC's are not
 > +     that well behaved.  This could be fixed by adding either a
 > +     do_cleanups call (to cover the problem) or an assertion check to
 > +     detect bad FUNCs code. */
 > +
 > +  /* Restore the cleanup chain and error/quit messages to their
 > +     original states. */
 > +
 >    restore_cleanups (saved_cleanup_chain);
 >  
 > -  if (mask & RETURN_MASK_ERROR)
 > -    {
 > -      memcpy (error_return, saved_error, sizeof (SIGJMP_BUF));
 > -      error_pre_print = saved_error_pre_print;
 > -    }
 >    if (mask & RETURN_MASK_QUIT)
 > -    {
 > -      memcpy (quit_return, saved_quit, sizeof (SIGJMP_BUF));
 > -      quit_pre_print = saved_quit_pre_print;
 > -    }
 > -  return val;
 > +    quit_pre_print = saved_quit_pre_print;
 > +  if (mask & RETURN_MASK_ERROR)
 > +    error_pre_print = saved_error_pre_print;
 > +
 > +  /* Return normally if no error/quit event occurred. */
 > +
 > +  if (!caught)
 > +    return val;
 > +
 > +  /* If the caller didn't request that the event be caught, relay the
 > +     event to the next containing catch_errors(). */
 > +
 > +  if (!(mask & RETURN_MASK (caught)))
 > +    return_to_top_level (caught);
 > +
 > +  /* Tell the caller that an event was caught.
 > +
 > +     FIXME: nsd/2000-02-22: When MASK is RETURN_MASK_ALL, the caller
 > +     can't tell what type of event occurred.
 > +
 > +     A possible fix is to add a new interface, catch_event(), that
 > +     returns enum return_reason after catching an error or a quit.
 > +
 > +     When returning normally, i.e. without catching an error or a
 > +     quit, catch_event() could return RETURN_NORMAL, which would be
 > +     added to enum return_reason.  FUNC would return information
 > +     exclusively via ARGS.
 > +
 > +     Alternatively, normal catch_event() could return FUNC's return
 > +     value.  The caller would need to be aware of potential overlap
 > +     with enum return_reason, which could be publicly restricted to
 > +     negative values to simplify return value processing in FUNC and
 > +     in the caller. */
 > +
 > +  return 0;
 >  }
 >  
 >  struct captured_command_args
 > Index: defs.h
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/defs.h,v
 > retrieving revision 1.2
 > diff -u -r1.2 defs.h
 > --- defs.h	2000/02/10 20:06:32	1.2
 > +++ defs.h	2000/02/22 19:59:14
 > @@ -801,21 +801,24 @@
 >  
 >  extern NORETURN void nomem (long) ATTR_NORETURN;
 >  
 > -/* Reasons for calling return_to_top_level.  */
 > +/* Reasons for calling return_to_top_level.  Note: enum value 0 is
 > +   reserved for internal use as the return value from an initial
 > +   setjmp().  */
 >  
 >  enum return_reason
 >    {
 >      /* User interrupt.  */
 > -    RETURN_QUIT,
 > +    RETURN_QUIT = 1,
 >      /* Any other error.  */
 >      RETURN_ERROR
 >    };
 >  
 >  #define	ALL_CLEANUPS	((struct cleanup *)0)
 >  
 > -#define RETURN_MASK_QUIT (1 << (int)RETURN_QUIT)
 > -#define RETURN_MASK_ERROR (1 << (int)RETURN_ERROR)
 > -#define RETURN_MASK_ALL (RETURN_MASK_QUIT | RETURN_MASK_ERROR)
 > +#define RETURN_MASK(reason)	(1 << (int)(reason))
 > +#define RETURN_MASK_QUIT	RETURN_MASK (RETURN_QUIT)
 > +#define RETURN_MASK_ERROR	RETURN_MASK (RETURN_ERROR)
 > +#define RETURN_MASK_ALL		(RETURN_MASK_QUIT | RETURN_MASK_ERROR)
 >  typedef int return_mask;
 >  
 >  extern NORETURN void return_to_top_level (enum return_reason) ATTR_NORETURN;


WARNING: multiple messages have this Message-ID
From: Mark Kettenis <kettenis@wins.uva.nl>
To: jimb@cygnus.com
Cc: eliz@is.elta.co.il, gdb-patches@sourceware.cygnus.com
Subject: Re: RFA: minor watchpoint code cleanup
Date: Tue, 21 Mar 2000 15:57:00 -0000	[thread overview]
Message-ID: <200003212357.e2LNvIq05590@delius.kettenis.local> (raw)
Message-ID: <20000321155700.pE-c5uOaSXGeAS21HQE4HwjcDJbgZkmr1b6NbPUrW94@z> (raw)
In-Reply-To: <npk8iv7vat.fsf@zwingli.cygnus.com>

   From: Jim Blandy <jimb@cygnus.com>
   Date: 21 Mar 2000 18:33:30 -0500

   > The reason is that IMHO we should avoid making a variable (`size')
   > serve two puproses at the same time.

   Good suggestion --- done.

   I'm just waiting for Mark's approval.

Approved.

Mark
From ac131313@cygnus.com Tue Mar 21 15:58:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: GDB Discussion <gdb@sourceware.cygnus.com>, GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: [MAINT] More additions
Date: Tue, 21 Mar 2000 15:58:00 -0000
Message-id: <38D80C7E.BF2217E8@cygnus.com>
X-SW-Source: 2000-03/msg00451.html
Content-length: 537

Hello,


Michael and Jim are going to share breakpoint code between themselves:

breakpoint.c		Michael Snyder		msnyder@cygnus.com
			Jim Blandy		jimb@cygnus.com


Jonathan Larmour's just managed to exceed his quota of good patch
submissions :-). He's happy to join the write aver approval list:

Jonathan Larmour				jlarmour@redhat.co.uk


David has stepped forward as the SPARC/Solaris and target maintainer:

sparc target		David Taylor		taylor@cygnus.com
Solaris/SPARC native & host
			David Taylor		taylor@cygnus.com


enjoy,
	Andrew
From ac131313@cygnus.com Tue Mar 21 16:10:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Daniel Berlin <dan@cgsoftware.com>
Cc: jtc@redback.com, gdb-patches@sourceware.cygnus.com
Subject: Re: RFA: i386/nbsd.mt, i386nbsd-nat.c
Date: Tue, 21 Mar 2000 16:10:00 -0000
Message-id: <38D80F23.799B5F41@cygnus.com>
References: <Pine.LNX.4.10.10003211547370.15517-100000@propylaea.anduin.com>
X-SW-Source: 2000-03/msg00452.html
Content-length: 516

Daniel Berlin wrote:
> 
> Actually, i have patches to make FreeBSD build native just fine.
> I merged the patches freebsd uses against 4.18 into the current gdb.
> It fails some shared lib tests, but past that, it's fine.
> I can submit them if you like.

The problem I have with the FreeBSD patches is that they have never been
assigned to the FSF by the original author.
I'd have otherwize done the same thing (they are also pretty scrappy)
:-(

Many of the NetBSD changes have the same problem.

	sorry,
		Andrew
From shebs@apple.com Tue Mar 21 17:48:00 2000
From: Stan Shebs <shebs@apple.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: Michael Snyder <msnyder@cygnus.com>, gdb-patches@sourceware.cygnus.com
Subject: Re: gdb.texinfo broken?
Date: Tue, 21 Mar 2000 17:48:00 -0000
Message-id: <38D82684.89633B0B@apple.com>
References: <38D6CF69.6844@cygnus.com> <200003211819.NAA12435@indy.delorie.com> <38D7C977.FA3@cygnus.com> <5mitygglxs.fsf@jtc.redbacknetworks.com> <38D7FDD1.D54DE1D8@cygnus.com>
X-SW-Source: 2000-03/msg00453.html
Content-length: 483

Andrew Cagney wrote:
> 
> "J.T. Conklin" wrote:
> 
> > It looks like the changes to the directory entry require the latest
> > makeinfo.  I tried to use makeinfo from texinfo-3.2 and it failed,
> > makeinfo from texinfo-4.0 works.
> 
> >From memory, the possibility of requiring texinfo 4.0 as part of
> building GDB 5 was considered and rejected :-(

Yeah, I have to revert - tried it on one of Apple's MkLinux systems,
which claims to have texinfo 3.9, and it fell down too.

Stan
From jtc@redback.com Tue Mar 21 19:07:00 2000
From: jtc@redback.com (J.T. Conklin)
To: gdb-patches@sourceware.cygnus.com
Subject: RFA: call-ar-st.exp, relax patterns
Date: Tue, 21 Mar 2000 19:07:00 -0000
Message-id: <5mog87g0sx.fsf@jtc.redbacknetworks.com>
X-SW-Source: 2000-03/msg00454.html
Content-length: 8945

I submit the enclosed patch for approval.  As I mentioned some months
ago ( http://sourceware.cygnus.com/ml/gdb/1999-q3/msg00162.html ), the
default pty attributes on NetBSD systems has tabs expanding to spaces
but some of the tests explicitly check for tabs.  I fixed some of the
tests then, but didn't have time to go through all of the failures.
This change relaxes more of expect patterns in call-ar-st.exp.

        --jtc

2000-03-21  J.T. Conklin  <jtc@redback.com> 
 
        * gdb.base/call-ar-st.exp: relax patterns matching tab
          characters.

Index: call-ar-st.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/call-ar-st.exp,v
retrieving revision 1.1.1.7
diff -c -3 -p -r1.1.1.7 call-ar-st.exp
*** call-ar-st.exp	1999/08/23 22:37:37	1.1.1.7
--- call-ar-st.exp	2000/03/22 02:59:09
*************** gdb_expect {
*** 366,372 ****
  if {![target_info exists gdb,skip_float_tests]} {
    send_gdb "print print_small_structs(*struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)\n"
    gdb_expect {
!     -re ".*alpha\[\t\r\n \]+gamma\[\t\r\n \]+epsilon\[\t\r\n \]+alpha\[\t\r\n \]+gamma\[\t\r\n \]+epsilon\[\t\r\n \]+ch1: y\tch2: n\[\t\r\n \]+Contents of three_char_t:\[\t\r\n \]+a\tb\tc\[\t\r\n \]+Contents of five_char_t:\[\t\r\n \]+l\tm\tn\to\tp\[\t\r\n \]+Contents of int_char_combo_t:\[\t\r\n \]+123.*z\[\t\r\n \]+Sum of the 4 struct values and seed :\[\t\r\n \]+52\[\t\r\n \]+Contents of struct1:\[\t\r\n \]+6.*0\[\t\r\n \]+Contents of struct2:\[\t\r\n \]+10.*0\[\t\r\n \]+Contents of struct3:\[\t\r\n \]+12.*0\[\t\r\n \]+Contents of one_double_t:\[\t\r\n \]+10.500000\[\t\r\n \]+Contents of one_double_t:.*-3.340000\[\t\r\n \]+Contents of one_double_t:.*675.091230\[\t\r\n \]+Contents of two_floats_t:.*45.234001.*43.599998\[\t\r\n \]+Contents of two_floats_t:.*78.010002.*122.099998\[\t\r\n \]+Contents of two_floats_t:.*-1232.344971.*-199.210007\[\t\r\n \]+.*$gdb_prompt $" {
        pass "print print_small_structs"
      }
      -re ".*$gdb_prompt $" { fail "print print_small_structs" }
--- 366,372 ----
  if {![target_info exists gdb,skip_float_tests]} {
    send_gdb "print print_small_structs(*struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)\n"
    gdb_expect {
!     -re ".*alpha\[\t\r\n \]+gamma\[\t\r\n \]+epsilon\[\t\r\n \]+alpha\[\t\r\n \]+gamma\[\t\r\n \]+epsilon\[\t\r\n \]+ch1: y.*ch2: n\[\t\r\n \]+Contents of three_char_t:\[\t\r\n \]+a.*b.*c\[\t\r\n \]+Contents of five_char_t:\[\t\r\n \]+l.*m.*n.*o.*p\[\t\r\n \]+Contents of int_char_combo_t:\[\t\r\n \]+123.*z\[\t\r\n \]+Sum of the 4 struct values and seed :\[\t\r\n \]+52\[\t\r\n \]+Contents of struct1:\[\t\r\n \]+6.*0\[\t\r\n \]+Contents of struct2:\[\t\r\n \]+10.*0\[\t\r\n \]+Contents of struct3:\[\t\r\n \]+12.*0\[\t\r\n \]+Contents of one_double_t:\[\t\r\n \]+10.500000\[\t\r\n \]+Contents of one_double_t:.*-3.340000\[\t\r\n \]+Contents of one_double_t:.*675.091230\[\t\r\n \]+Contents of two_floats_t:.*45.234001.*43.599998\[\t\r\n \]+Contents of two_floats_t:.*78.010002.*122.099998\[\t\r\n \]+Contents of two_floats_t:.*-1232.344971.*-199.210007\[\t\r\n \]+.*$gdb_prompt $" {
        pass "print print_small_structs"
      }
      -re ".*$gdb_prompt $" { fail "print print_small_structs" }
*************** if {![target_info exists gdb,skip_float_
*** 461,467 ****
      setup_xfail "sparc*-*-solaris*"
      send_gdb "print print_small_structs(struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1, d2, d3, f1, f2, f3)\n"
      gdb_expect {
! 	-re ".*alpha${ws}gamma${ws}epsilon${ws}alpha${ws}gamma${ws}epsilon${ws}ch1: y\tch2: n${ws}Contents of three_char_t:${ws}a\tb\tc${ws}Contents of five_char_t:${ws}l\tm\tn\to\tp${ws}Contents of int_char_combo_t:${ws}123.*z${ws}Sum of the 4 struct values and seed :${ws}52${ws}Contents of struct1:${ws}6.*0${ws}Contents of struct2:${ws}10.*0${ws}Contents of struct3:${ws}12.*0${ws}Contents of one_double_t:${ws}10.500000${ws}Contents of one_double_t:${ws}-3.340000${ws}Contents of one_double_t:${ws}675.091230${ws}Contents of two_floats_t:${ws}45.234001.*43.599998${ws}Contents of two_floats_t:${ws}78.010002.*122.099998${ws}Contents of two_floats_t:${ws}-1232.344971.*-199.210007${ws}.*$gdb_prompt $" {
  	    pass "print print_small_structs from print_long_arg_list"
  	}
  	-re ".*$gdb_prompt $" { fail "print print_small_structs from print_long_arg_list" }
--- 461,467 ----
      setup_xfail "sparc*-*-solaris*"
      send_gdb "print print_small_structs(struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1, d2, d3, f1, f2, f3)\n"
      gdb_expect {
! 	-re ".*alpha${ws}gamma${ws}epsilon${ws}alpha${ws}gamma${ws}epsilon${ws}ch1: y.*ch2: n${ws}Contents of three_char_t:${ws}a.*b.*c${ws}Contents of five_char_t:${ws}l.*m.*n.*o.*p${ws}Contents of int_char_combo_t:${ws}123.*z${ws}Sum of the 4 struct values and seed :${ws}52${ws}Contents of struct1:${ws}6.*0${ws}Contents of struct2:${ws}10.*0${ws}Contents of struct3:${ws}12.*0${ws}Contents of one_double_t:${ws}10.500000${ws}Contents of one_double_t:${ws}-3.340000${ws}Contents of one_double_t:${ws}675.091230${ws}Contents of two_floats_t:${ws}45.234001.*43.599998${ws}Contents of two_floats_t:${ws}78.010002.*122.099998${ws}Contents of two_floats_t:${ws}-1232.344971.*-199.210007${ws}.*$gdb_prompt $" {
  	    pass "print print_small_structs from print_long_arg_list"
  	}
  	-re ".*$gdb_prompt $" { fail "print print_small_structs from print_long_arg_list" }
*************** init_bit_flags_combo \\(bit_flags_combo=
*** 491,497 ****
  #call print_bit_flags_combo(*bit_flags_combo)
  send_gdb "print print_bit_flags_combo(*bit_flags_combo)\n"
  gdb_expect {
!     -re ".*alpha.*gamma.*epsilon.*ch1: y\tch2: n.*$gdb_prompt $" {
          pass "print print_bit_flags_combo from init_bit_flags_combo"
        }
      -re ".*$gdb_prompt $" { fail "print print_bit_flags_combo from init_bit_flags_combo" }
--- 491,497 ----
  #call print_bit_flags_combo(*bit_flags_combo)
  send_gdb "print print_bit_flags_combo(*bit_flags_combo)\n"
  gdb_expect {
!     -re ".*alpha.*gamma.*epsilon.*ch1: y.*ch2: n.*$gdb_prompt $" {
          pass "print print_bit_flags_combo from init_bit_flags_combo"
        }
      -re ".*$gdb_prompt $" { fail "print print_bit_flags_combo from init_bit_flags_combo" }
*************** if {$hp_aCC_compiler} {setup_xfail "hppa
*** 518,524 ****
  if {![target_info exists gdb,skip_float_tests]} {
    send_gdb "print print_long_arg_list(a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)\n"
    gdb_expect {
!     -re ".*double : 22.220000.*double : 33.333000.*int : 0.*int : -25.*int : 100.*int : 2345.*alpha.*gamma.*epsilon.*ch1: y\tch2: n.*Contents of three_char_t:.*x\ty\tz.*Contents of five_char_t:.*h\te\tl\tl\to.*Contents of int_char_combo_t:.*123\tz.*Sum of the 4 struct values and seed :.*52.*Contents of struct1:.*6\[ \]+0.*Contents of struct2:.*10\[ \]+0.*Contents of struct3:.*12.*0.*Contents of one_double_t:\[ \n\r\t\]+1.111110\[ \n\r\t\]+Contents of one_double_t:\[ \n\r\t\]+-345.340000\[ \n\r\t\]+Contents of one_double_t:\[ \n\r\t\]+546464.200000\[ \n\r\t\]+Contents of two_floats_t:\[ \n\r\t\]+0.234000\t453.100006\[ \n\r\t\]+Contents of two_floats_t:\[ \n\r\t\]+78.345001\t23.090000\[ \n\r\t\]+Contents of two_floats_t:\[ \n\r\t\]+-2.345000\t1.000000.*$gdb_prompt $" {
        pass "print print_long_arg_list"
      }
      -re ".*$gdb_prompt $" { fail "print print_long_arg_list" }
--- 518,524 ----
  if {![target_info exists gdb,skip_float_tests]} {
    send_gdb "print print_long_arg_list(a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)\n"
    gdb_expect {
!     -re ".*double : 22.220000.*double : 33.333000.*int : 0.*int : -25.*int : 100.*int : 2345.*alpha.*gamma.*epsilon.*ch1: y.*ch2: n.*Contents of three_char_t:.*x.*y.*z.*Contents of five_char_t:.*h.*e.*l.*l.*o.*Contents of int_char_combo_t:.*123.*z.*Sum of the 4 struct values and seed :.*52.*Contents of struct1:.*6\[ \]+0.*Contents of struct2:.*10\[ \]+0.*Contents of struct3:.*12.*0.*Contents of one_double_t:\[ \n\r\t\]+1.111110\[ \n\r\t\]+Contents of one_double_t:\[ \n\r\t\]+-345.340000\[ \n\r\t\]+Contents of one_double_t:\[ \n\r\t\]+546464.200000\[ \n\r\t\]+Contents of two_floats_t:\[ \n\r\t\]+0.234000.*453.100006\[ \n\r\t\]+Contents of two_floats_t:\[ \n\r\t\]+78.345001.*23.090000\[ \n\r\t\]+Contents of two_floats_t:\[ \n\r\t\]+-2.345000.*1.000000.*$gdb_prompt $" {
        pass "print print_long_arg_list"
      }
      -re ".*$gdb_prompt $" { fail "print print_long_arg_list" }


-- 
J.T. Conklin
RedBack Networks
From ac131313@cygnus.com Tue Mar 21 20:21:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Jimmy Guo <guo@cup.hp.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: Initialization of hpux_threads
Date: Tue, 21 Mar 2000 20:21:00 -0000
Message-id: <38D849A1.F5F706A@cygnus.com>
References: <Pine.LNX.4.10.10003211552360.31590-100000@hpcll168.cup.hp.com>
X-SW-Source: 2000-03/msg00455.html
Content-length: 1125

Jimmy Guo wrote:
> 
> I was looking at an old source tree and didn't see its 'revival'.
> Yes it is some setup to solve the kinds of problem you mentioned.
> But any other usage of it will only introduce multiple calls to
> a _initialize_* routine.
> 
> The initializer in hpux-thread.c is just one of these cases.  They're
> mostly fixed as of today's tree except for a remaining one -
> remote-nrom.c.

Thanks,  I've applied the attatched.

	Andrew
Wed Mar 22 15:09:34 2000  Andrew Cagney  <cagney@b1.cygnus.com>

	* configure.in (CONFIG_INITS): Do not append remote-nrom.c

Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/configure.in,v
retrieving revision 1.12
diff -p -r1.12 configure.in
*** configure.in	2000/03/20 06:41:24	1.12
--- configure.in	2000/03/22 04:15:36
*************** esac])
*** 447,453 ****
  if test "${enable_netrom}" = "yes"; then
  	CONFIG_OBS="${CONFIG_OBS} remote-nrom.o" 
          CONFIG_SRCS="${CONFIG_SRCS} remote-nrom.c"
- 	CONFIG_INITS="${CONFIG_INITS} remote-nrom.c"
  fi
  
  AC_ARG_ENABLE(build-warnings,
--- 447,452 ----
From ac131313@cygnus.com Tue Mar 21 20:25:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: GDB Patches <gdb-patches@sourceware.cygnus.com>
Cc: GDB Discussion <gdb@sourceware.cygnus.com>
Subject: [Maint] Second testsuite maintainer
Date: Tue, 21 Mar 2000 20:25:00 -0000
Message-id: <38D84B37.B90E15AB@cygnus.com>
X-SW-Source: 2000-03/msg00456.html
Content-length: 282

Another addition:

Add Fernando to list of testsuite maintainers.

testsuite	 	Stan Shebs		shebs@apple.com
			Fernando Nasser		fnasser@cygnus.com
  hp tests (gdb.hp)	*Jimmy Guo	 adl-debugger-wdb-merge-guru@cup.hp.com
  Java tests (gdb.java)	Anthony Green 		green@cygnus.com

Andrew
From ac131313@cygnus.com Tue Mar 21 21:38:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Michael Snyder <msnyder@cygnus.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH] Document the ThreadInfo remote protocol queries
Date: Tue, 21 Mar 2000 21:38:00 -0000
Message-id: <38D85C2F.FF89881D@cygnus.com>
References: <200003202316.PAA07888@cleaver.cygnus.com> <38D6FCE2.EBD9830F@cygnus.com> <38D7C38C.6CB0@cygnus.com>
X-SW-Source: 2000-03/msg00457.html
Content-length: 2117

Michael Snyder wrote:

> > An additional note on these versions of thread queries.  While
> > significantly better than the ``qL'' packet these commands still have
> > problems.  I'll add notes expanding on this.  Briefly, however:
> >
> >         o       Per the query packet spec, they should be
> >                 prefixed with a UCASE letter if they
> >                 are to be official GDB packets.
> >
> >         o       The ``sThread..'' command assumes
> >                 that the GDB protocol is reliable
> >                 which it is not.  GDB can re-issue
> >                 a ``sThread'' request and this can
> >                 lead to GDB and the target falling
> >                 out of sync.
> 
> How about if the 'sThread' request were to be suffixed with
> the last thread ID received?

I was thinking of deprecating fThreadInfo and sThreadInfo and having gdb
try:

	qThreadInfo
	qThreadInfo,<sentinal>

Where sentinal could be <last-thread-id> index (counting from zero) for
next threads, or anything else.

Given ``sThreadInfo'' is in the field, we can't change it.


> > with regard to ``qfThreadExtraInfo''.  As far as I know its not been
> > deployed in the field.  Is there any reason to not name it correctly
> > from the start  (``qThreadExtraInfo'')?
> 
> Only that it conflicts with the tracepoint messages,
> which all begin with qT (see tracepoint.c).

I don't think that is a problem.  The protocol requires:

@tab @code{q}@var{query}
@tab
Request info about @var{query}.  In general @value{GDBN} @var{query}'s
have a leading upper case letter.  Custom vendor queries should use a
company prefix (in lower case) ex: @samp{qfsf.var}.  @var{query} may
optionally be followed by a @samp{,} or @samp{;} separated list.  Stubs
must ensure that they match the full @var{query} name.

The last sentence is ment to ensure that the target's query handling
code matches using something like:
	strcmp (packet, "qThreadInfo")
instead of
	packet[0] == 'q' && packet[1] == 'T' && packet[7] == 'I'


Should ``C'' also be suceeded by something like ``qThread''?  Is ``C''
still used?

	Andrew
From eliz@delorie.com Wed Mar 22 00:58:00 2000
From: Eli Zaretskii <eliz@delorie.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: Mark Kettenis <kettenis@wins.uva.nl>, gdb-patches@sourceware.cygnus.com
Subject: Re: Linux sigtramp detection code moved to its proper place
Date: Wed, 22 Mar 2000 00:58:00 -0000
Message-id: <200003220858.DAA12990@indy.delorie.com>
References: <200003201529.KAA10589@indy.delorie.com> <38D73C78.4B2B3562@cygnus.com>
X-SW-Source: 2000-03/msg00458.html
Content-length: 2641

> Is there anything that the nightly snapshots (short term) and/or
> testsuite (medium/long term) can do to ensure that the relevant
> djgpp files are always up-to-date?

As a matter of fact, there is.  I have todo items for the following
issues:

  - The file config/djgpp/fnchange.lst needs to be updated to include
    the exact version in the file names it maps.  Specifically, that
    file consists of lines which look like this:

      gdb-0321/foo/bar/long-name-foo.c gdb-0321/foo/bar/short-foo.c

    (When DJTAR sees this line, it renames the file whose name is on
    the left to what's on the right.)

    The "gdb-0312" part should be replaced with the actual name of the
    directory which the distribution creates when unpacked, and that
    name includes the version of the snapshot/release.

    What I was thinking was to provide a template whose lines will say
    this:

      gdb-@VER@/foo/bar/long-name-foo.c gdb-@VER@/foo/bar/short-foo.c

    and run Sed on it inside the commands used to tar the
    distribution, to replace that with the actual version (taken from
    the Makefile, for example).

  - If the long names which clash after 8+3 truncation are to stay
    with us for Quite A While (tm), it might make sense to have some
    script or program that will update fnchange.lst whenever a new
    file is added that clashes with some other file name, but is not
    yet covered in fnchange.lst.  Assuming that the files which get
    added are not required for the DJGPP build (since those must
    *never* clash with other file names), what we need is to add an
    entry like this:

      gdb-@VER@/foo/bar/new-long-name-foo.bar

    When DJTAR sees such a line, it skips the named file.

    This looks like a job for a Perl script.  Unfortunately, Perl for
    me is a read-only language.  I could write a C program to do this,
    if this is acceptable, though.

Comments and ideas are welcome.

> As a suggestion from left field, I've wondered if gdb.base/selftest.exp
> should be moved to gdb.wb/selftest.exp (wb == white box) so that people
> can freely add additional white box tests to GDB.  Checking consistency
> between config/djgpp/<that-file> and the GDB sources could be part of
> that testsuite.

Does that mean that you always run the test suite before preparing the
snapshots?  If so, how do you know whether a certain new failure is
grave enough to prevent you from making the snapshot?  I mean, if the
test for consistency in config/djgpp/<that-file> were added, and it
failed, how would you know that this is not some minor regression
(which I assume do happen in other parts of GDB)?
From eliz@delorie.com Wed Mar 22 01:30:00 2000
From: Eli Zaretskii <eliz@delorie.com>
To: msnyder@cygnus.com
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH] Running the inferior from breakpoint commands
Date: Wed, 22 Mar 2000 01:30:00 -0000
Message-id: <200003220930.EAA13024@indy.delorie.com>
References: <200003120759.CAA24402@indy.delorie.com> <200003151624.LAA01228@indy.delorie.com> <38D7F31D.1827@cygnus.com>
X-SW-Source: 2000-03/msg00459.html
Content-length: 2020

> 	Any
> 	other commands in the command list are ignored, after
> 	a command that resumes execution.
> 
> Note the last sentence.  So despite the fact that the 
> testsuite seems to imply that this should work, it is
> not expected to.  I have no idea what that test is 
> doing in there.  The commands-on-breakpoint behavior
> is NOT intended to be recursive.

Yes, somebody already pointed out that this appears to be a documented
limitation.  Unfortunately, this info came after I already did the
changes and posted them; my original question when I first discovered
the problem remained unanswered...

(I did look in the manual, but since the snippet you cited isn't
indexed, I didn't find it.  [Yes, I will submit a manual change to add
an index entry.])

To me, the fact that the test suite tried to do this was a sign that
it was supposed to work.

As an aside: is there any place I can find the list of tests which
fail, and on what systems do they fail?

> If you seriously want to undertake this project, we can
> work on a list of criteria that should be tested (things
> that can go wrong).

I will put it on my todo (thanks for the list of things to test; some
of them were already tested, I just didn't report it).  I would like
at least to probe the issues, to get a feeling how badly broken is
what I did ;-).

> On top of that, I have grave concerns about being able
> to correctly save and restore all of the internal
> debugger state necessary to make this work (the
> infrun execution state, the expression chain, etc.)

Err... I'm not sure this should be of concern here (but perhaps I
don't see the subtle issues clearly enough): if the breakpoint
commands change any of these global entities, I think the user expects
the changes to be visible after these commands are processed.  For
example, if the commands delete the breakpoint where you stopped, the
user will expect the breakpoint to remain deleted after that (the
changes I submitted do handle this specific case).  Am I missing
something?
From kettenis@wins.uva.nl Wed Mar 22 01:49:00 2000
From: Mark Kettenis <kettenis@wins.uva.nl>
To: gdb-patches@sourceware.cygnus.com
Cc: jtc@redback.com
Subject: [PATCH] Restructuring i386-tdep.c:i386_extract_return_value()
Date: Wed, 22 Mar 2000 01:49:00 -0000
Message-id: <200003220949.e2M9nl001746@delius.kettenis.local>
X-SW-Source: 2000-03/msg00460.html
Content-length: 6153

Hi,

I checked in the attached patch.  This is one of the patches I
discussed two weeks ago, which makes i386_extract_return_value() do
the right thing for most of the supported i386 targets.  Some targets
(for example those that use tm-i386v.h) still redefine
EXTRACT_RETURN_VALUE, so they don't take advantage of this
improvement.  I'll deal with that later.

Mark


2000-03-22  Mark Kettenis  <kettenis@gnu.org>

	* config/i386/tm-i386aix.h (I386_AIX_TARGET): Remove.
	* config/i386/tm-linux.h (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM):
	Remove
	* i386-tdep.c (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): New defines.
	(i386_extract_return_value): Rewritten.  Correctly support all
	floating-point types and large integer types on targets that use
	the standard i386 GDB register layout and return floating-point
	values in the FPU.


Index: config/i386/tm-i386aix.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/tm-i386aix.h,v
retrieving revision 1.2
diff -u -p -r1.2 tm-i386aix.h
--- config/i386/tm-i386aix.h	2000/03/02 15:44:27	1.2
+++ config/i386/tm-i386aix.h	2000/03/22 09:41:10
@@ -30,14 +30,6 @@
 #define I386 1
 #endif
 
-/* FIXME: kettenis/2000-03-02: This is used in
-   i386-tdep.c:i386_extract_return_value(), and will be remove once
-   I've fixed that.  Meanwhile don't use it for any other purpose
-   please!  */
-#ifndef I386_AIX_TARGET
-#define I386_AIX_TARGET 1
-#endif
-
 /* AIX/i386 has FPU support.  However, the native configuration (which
    is the only supported configuration) doesn't make the FPU control
    registers available.  Override the appropriate symbols such that
Index: config/i386/tm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/tm-linux.h,v
retrieving revision 1.4
diff -u -p -r1.4 tm-linux.h
--- config/i386/tm-linux.h	2000/03/16 22:46:30	1.4
+++ config/i386/tm-linux.h	2000/03/22 09:41:10
@@ -30,9 +30,6 @@
 #include "i386/tm-i386.h"
 #include "tm-linux.h"
 
-#define LOW_RETURN_REGNUM 0	/* holds low four bytes of result */
-#define HIGH_RETURN_REGNUM 2	/* holds high four bytes of result */
-
 /* This should probably move to tm-i386.h.  */
 #define TARGET_LONG_DOUBLE_BIT 80
 
Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.7
diff -u -p -r1.7 i386-tdep.c
--- i386-tdep.c	2000/03/16 22:46:26	1.7
+++ i386-tdep.c	2000/03/22 09:41:10
@@ -698,56 +698,66 @@ get_longjmp_target (pc)
 
 #endif /* GET_LONGJMP_TARGET */
 
+/* These registers are used for returning integers (and on some
+   targets also for returning `struct' and `union' values when their
+   size and alignment match an integer type.  */
+#define LOW_RETURN_REGNUM 0	/* %eax */
+#define HIGH_RETURN_REGNUM 2	/* %edx */
+
+/* Extract from an array REGBUF containing the (raw) register state, a
+   function return value of TYPE, and copy that, in virtual format,
+   into VALBUF.  */
+
 void
-i386_extract_return_value (type, regbuf, valbuf)
-     struct type *type;
-     char regbuf[REGISTER_BYTES];
-     char *valbuf;
+i386_extract_return_value (struct type *type, char *regbuf, char *valbuf)
 {
-  /* On AIX, i386 GNU/Linux and DJGPP, floating point values are
-     returned in floating point registers.  */
-  /* FIXME: cagney/2000-02-29: This function needs to be rewritten
-     using multi-arch. Please don't keep adding to this #ifdef
-     spaghetti. */
-#if defined(I386_AIX_TARGET) || defined(I386_GNULINUX_TARGET) || defined(I386_DJGPP_TARGET)
+  int len = TYPE_LENGTH (type);
+
   if (TYPE_CODE_FLT == TYPE_CODE (type))
     {
-      double d;
-      /* 387 %st(0), gcc uses this */
-      floatformat_to_double (&floatformat_i387_ext,
-#if defined(FPDATA_REGNUM)
-			     &regbuf[REGISTER_BYTE (FPDATA_REGNUM)],
-#else /* !FPDATA_REGNUM */
-			     &regbuf[REGISTER_BYTE (FP0_REGNUM)],
-#endif /* FPDATA_REGNUM */
+      if (NUM_FREGS == 0)
+	{
+	  warning ("Cannot find floating-point return value.");
+	  memset (valbuf, 0, len);
+	}
 
-			     &d);
-      store_floating (valbuf, TYPE_LENGTH (type), d);
+      /* Floating-point return values can be found in %st(0).  */
+      if (len == TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT
+	  && TARGET_LONG_DOUBLE_FORMAT == &floatformat_i387_ext)
+	{
+	  /* Copy straight over, but take care of the padding.  */
+	  memcpy (valbuf, &regbuf[REGISTER_BYTE (FP0_REGNUM)],
+		  FPU_REG_RAW_SIZE);
+	  memset (valbuf + FPU_REG_RAW_SIZE, 0, len - FPU_REG_RAW_SIZE);
+	}
+      else
+	{
+	  /* Convert the extended floating-point number found in
+             %st(0) to the desired type.  This is probably not exactly
+             how it would happen on the target itself, but it is the
+             best we can do.  */
+	  DOUBLEST val;
+	  floatformat_to_doublest (&floatformat_i387_ext,
+				   &regbuf[REGISTER_BYTE (FP0_REGNUM)], &val);
+	  store_floating (valbuf, TYPE_LENGTH (type), val);
+	}
     }
   else
-#endif /* I386_AIX_TARGET || I386_GNULINUX_TARGET || I386_DJGPP_TARGET */
     {
-#if defined(LOW_RETURN_REGNUM)
-      int len = TYPE_LENGTH (type);
       int low_size = REGISTER_RAW_SIZE (LOW_RETURN_REGNUM);
       int high_size = REGISTER_RAW_SIZE (HIGH_RETURN_REGNUM);
 
       if (len <= low_size)
-	memcpy (valbuf, regbuf + REGISTER_BYTE (LOW_RETURN_REGNUM), len);
+	memcpy (valbuf, &regbuf[REGISTER_BYTE (LOW_RETURN_REGNUM)], len);
       else if (len <= (low_size + high_size))
 	{
 	  memcpy (valbuf,
-		  regbuf + REGISTER_BYTE (LOW_RETURN_REGNUM),
-		  low_size);
+		  &regbuf[REGISTER_BYTE (LOW_RETURN_REGNUM)], low_size);
 	  memcpy (valbuf + low_size,
-		  regbuf + REGISTER_BYTE (HIGH_RETURN_REGNUM),
-		  len - low_size);
+		  &regbuf[REGISTER_BYTE (HIGH_RETURN_REGNUM)], len - low_size);
 	}
       else
-	error ("GDB bug: i386-tdep.c (i386_extract_return_value): Don't know how to find a return value %d bytes long", len);
-#else /* !LOW_RETURN_REGNUM */
-      memcpy (valbuf, regbuf, TYPE_LENGTH (type));
-#endif /* LOW_RETURN_REGNUM */
+	internal_error ("Cannot extract return value of %d bytes long.", len);
     }
 }
 
From eliz@delorie.com Wed Mar 22 02:32:00 2000
From: Eli Zaretskii <eliz@delorie.com>
To: jtc@redback.com
Cc: msnyder@cygnus.com, gdb-patches@sourceware.cygnus.com
Subject: Re: gdb.texinfo broken?
Date: Wed, 22 Mar 2000 02:32:00 -0000
Message-id: <200003221032.FAA13070@indy.delorie.com>
References: <38D6CF69.6844@cygnus.com> <200003211819.NAA12435@indy.delorie.com> <38D7C977.FA3@cygnus.com> <5mitygglxs.fsf@jtc.redbacknetworks.com>
X-SW-Source: 2000-03/msg00461.html
Content-length: 488

> It looks like the changes to the directory entry require the latest
> makeinfo.  I tried to use makeinfo from texinfo-3.2 and it failed,
> makeinfo from texinfo-4.0 works.

What directory entry?  If you mean @direntry and @dircategory, then
they were introduced in Texinfo 3.8, so they are not the problem.

I have several old versions of Texinfo on my machine, so will look
into these problems ASAP (since it might be my fault: the error
messages mention some of the lines I changed).
From ac131313@cygnus.com Wed Mar 22 03:23:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Eli Zaretskii <eliz@is.elta.co.il>
Cc: Mark Kettenis <kettenis@wins.uva.nl>, gdb-patches@sourceware.cygnus.com
Subject: Re: Linux sigtramp detection code moved to its proper place
Date: Wed, 22 Mar 2000 03:23:00 -0000
Message-id: <38D8ACDE.DA82F9E6@cygnus.com>
References: <200003201529.KAA10589@indy.delorie.com> <38D73C78.4B2B3562@cygnus.com> <200003220858.DAA12990@indy.delorie.com>
X-SW-Source: 2000-03/msg00462.html
Content-length: 1013

Eli Zaretskii wrote:

> > As a suggestion from left field, I've wondered if gdb.base/selftest.exp
> > should be moved to gdb.wb/selftest.exp (wb == white box) so that people
> > can freely add additional white box tests to GDB.  Checking consistency
> > between config/djgpp/<that-file> and the GDB sources could be part of
> > that testsuite.
> 
> Does that mean that you always run the test suite before preparing the
> snapshots?  If so, how do you know whether a certain new failure is
> grave enough to prevent you from making the snapshot?  I mean, if the
> test for consistency in config/djgpp/<that-file> were added, and it
> failed, how would you know that this is not some minor regression
> (which I assume do happen in other parts of GDB)?

No a snapshot is just that.  No guarentee that it will even build :-/

The reason for suggesting a check in the testsuite was that someone
adding a new file would hopefully run the testsuite after adding their
badly named file and notice the failure.

	Andrew
From fnasser@redhat.com Wed Mar 22 05:09:00 2000
From: Fernando Nasser <fnasser@redhat.com>
To: GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: Re: [Maint] Second testsuite maintainer
Date: Wed, 22 Mar 2000 05:09:00 -0000
Message-id: <38D8C5BA.20C4B77@redhat.com>
References: <38D84B37.B90E15AB@cygnus.com>
X-SW-Source: 2000-03/msg00463.html
Content-length: 772

Are you still going from the backlog from the Linux conference? :-)

Ben said it was OK and that he met the RedHat mkting people from the
North of Australia...

Andrew Cagney wrote:
> 
> Another addition:
> 
> Add Fernando to list of testsuite maintainers.
> 
> testsuite               Stan Shebs              shebs@apple.com
>                         Fernando Nasser         fnasser@cygnus.com
>   hp tests (gdb.hp)     *Jimmy Guo       adl-debugger-wdb-merge-guru@cup.hp.com
>   Java tests (gdb.java) Anthony Green           green@cygnus.com
> 
> Andrew

-- 
Fernando Nasser
Red Hat, Inc. - Toronto                 E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300           Tel:  416-482-2661 ext. 311
Toronto, Ontario   M4P 2C9              Fax:  416-482-6299
From fnasser@redhat.com Wed Mar 22 05:11:00 2000
From: Fernando Nasser <fnasser@redhat.com>
To: GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: Re: [Maint] Second testsuite maintainer
Date: Wed, 22 Mar 2000 05:11:00 -0000
Message-id: <38D8C648.3FE00B1C@redhat.com>
References: <38D84B37.B90E15AB@cygnus.com> <38D8C5BA.20C4B77@redhat.com>
X-SW-Source: 2000-03/msg00464.html
Content-length: 307

Sorry folks.

That was a personal message and I pressed the wrong button by mistake. 
:-(


-- 
Fernando Nasser
Red Hat, Inc. - Toronto                 E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300           Tel:  416-482-2661 ext. 311
Toronto, Ontario   M4P 2C9              Fax:  416-482-6299
From eliz@delorie.com Wed Mar 22 08:55:00 2000
From: Eli Zaretskii <eliz@delorie.com>
To: Michael Snyder <msnyder@cygnus.com>
Cc: jtc@redback.com (J.T. Conklin), gdb-patches@sourceware.cygnus.com
Subject: Re: gdb.texinfo broken? 
Date: Wed, 22 Mar 2000 08:55:00 -0000
Message-id: <200003221655.LAA14175@indy.delorie.com>
References: <38D6CF69.6844@cygnus.com> <200003211819.NAA12435@indy.delorie.com> <5mitygglxs.fsf@jtc.redbacknetworks.com>
X-SW-Source: 2000-03/msg00465.html
Content-length: 4870

< 38D7C977.FA3@cygnus.com > < 5mitygglxs.fsf@jtc.redbacknetworks.com >

> >>>>> "Michael" == Michael Snyder <msnyder@cygnus.com> writes:
> Michael> %] msnyder<2>% make gdb.info
> Michael> makeinfo -I
> Michael> /cleaver/blade/msnyder/sourceware/src/gdb/doc/../../readline/doc -I
> Michael> /cleaver/blade/msnyder/sourceware/src/gdb/doc -o ./gdb.info gdb.texinfo
> Michael> Making info file `./gdb.info' from `gdb.texinfo'.
> Michael> gdb.texinfo:113: No matching `@end ifnottex'.
> Michael> gdb.texinfo:156: Unmatched `@end'.
> 
> It looks like the changes to the directory entry require the latest
> makeinfo.  I tried to use makeinfo from texinfo-3.2 and it failed,
> makeinfo from texinfo-4.0 works.

Okay, I think I know what's going on with gdb.texinfo and old versions
of Texinfo.

First, I'm guessing that Michael Snyder didn't "cvs up annotate.texi".
The old version was written as a separate manual, so it had its own
Top node etc.  The new gdb.texinfo @include's annotate.texi, so
Michael gets error messages about multiple Top nodes etc..  When I
introduced the changes into gdb.texinfo to include the Annotations
chapter, I changed annotate.texi accordingly, to avoid all these
problems.

This leaves us with two error messages cited above:

 gdb.texinfo:113: No matching `@end ifnottex'.
 gdb.texinfo:156: Unmatched `@end'.

These come from Texinfo 3.11 and later (I tried 3.12; I don't have
3.11 on my disk), which is where @ifnottex was introduced.  Texinfo
3.9 and earlier doesn't grok @ifnottex at all, and Texinfo 4.0
converts the file without any problems.

The problem with @ifnottex in Texinfo 3.12 are actually a
bug/misfeature in that version: conditionals such as @ifnottex cannot
span node boundaries.  Here's a ChangeLog entry from the latest
Texinfo distribution:

  Sun Nov 29 17:12:35 1998  Karl Berry  <karl@gnu.org>

	  [...]
	  * makeinfo/insertion.c (discard_insertions): Let any conditional
	  cross node boundary.  (So the @top node can be wrapped
	  in @ifnottex, for example.)

This was done during the (long) pretest of Texinfo 4.0.

Since we decided not to depend on Texinfo 4.0, it seems we have 2
alternatives:

  - Toss @ifnottex and go back to using @ifinfo.  This will disallow
    producing the manual in the HTML format (only possible with
    Texinfo 4.0).

  - Duplicate the offending Top node, once wrapped with @ifinfo, the
    other time wrapped with @ifhtml.  This works for me with Texinfo
    3.12 and 4.0.  The patch for this alternative is below.

I recommend to use the second alternative, even though it's kludgey.

Note that if we use @ifnottex, we need to require Texinfo 3.11 or
later; Texinfo 3.9 will not work.

--- gdb/doc/gdb.t~2	Wed Mar 22 12:49:54 2000
+++ gdb/doc/gdb.texinfo	Wed Mar 22 18:02:48 2000
@@ -110,7 +110,7 @@
 @end titlepage
 @page
 
-@ifnottex
+@ifinfo
 @node Top
 @top Debugging with @value{GDBN}
 
@@ -153,7 +153,52 @@
 * Index::                       Index
 @end menu
 
-@end ifnottex
+@end ifinfo
+
+@ifhtml
+@node Top
+@top Debugging with @value{GDBN}
+
+This file describes @value{GDBN}, the @sc{gnu} symbolic debugger.
+
+This is the @value{EDITION} Edition, @value{DATE}, for @value{GDBN} Version 
+@value{GDBVN}.
+
+Copyright (C) 1988-1999 Free Software Foundation, Inc.
+@menu
+* Summary::                     Summary of @value{GDBN}
+* Sample Session::              A sample @value{GDBN} session
+
+* Invocation::                  Getting in and out of @value{GDBN}
+* Commands::                    @value{GDBN} commands
+* Running::                     Running programs under @value{GDBN}
+* Stopping::                    Stopping and continuing
+* Stack::                       Examining the stack
+* Source::                      Examining source files
+* Data::                        Examining data
+
+* Languages::                   Using @value{GDBN} with different languages
+
+* Symbols::                     Examining the symbol table
+* Altering::                    Altering execution
+* GDB Files::                   @value{GDBN} files
+* Targets::                     Specifying a debugging target
+* Configurations::              Configuration-specific information
+* Controlling GDB::             Controlling @value{GDBN}
+* Sequences::                   Canned sequences of commands
+* Emacs::                       Using @value{GDBN} under @sc{gnu} Emacs
+* Annotations::                 @value{GDBN}'s annotations interface.
+
+* GDB Bugs::                    Reporting bugs in @value{GDBN}
+* Formatting Documentation::    How to format and print @value{GDBN} documentation
+
+* Command Line Editing::        Command Line Editing
+* Using History Interactively:: Using History Interactively
+* Installing GDB::              Installing GDB
+* Index::                       Index
+@end menu
+
+@end ifhtml
 
 @node Summary
 @unnumbered Summary of @value{GDBN}
From eliz@delorie.com Wed Mar 22 10:10:00 2000
From: Eli Zaretskii <eliz@delorie.com>
To: Jim Blandy <jimb@zwingli.cygnus.com>
Cc: hjl@lucon.org, gdb@sourceware.cygnus.com, gdb-patches@sourceware.cygnus.com
Subject: Re: Problems with hardware watchpoint on ia32.
Date: Wed, 22 Mar 2000 10:10:00 -0000
Message-id: <200003221806.NAA14225@indy.delorie.com>
References: <20000307132401.A20282@valinux.com> <200003081008.FAA16481@indy.delorie.com> <20000308084304.A3150@lucon.org> <200003091210.HAA19857@indy.delorie.com> <npya7c6zn7.fsf@zwingli.cygnus.com>
X-SW-Source: 2000-03/msg00466.html
Content-length: 724

> Eli's test of the value's type is incorrect if the watch expression
> contains a structure comparison, like (foo == bar) || (something
> else), where foo and bar are structures.  In that case, there will be
> a value of type "struct", not at the end of the value list, but which
> should be watched in its entirety.

Errr... do you have an actual example program where this happens?

I seem to be unable to reproduce the problem, at least in a C program:
whenever I say "watch foo == bar" (where foo and bar are structs), GDB
curses thusly:

	Structure has no component named operator==.

Am I missing something?

In case it matters, I tested this with a DJGPP-compiled program; DJGPP
by default uses COFF debugging info.
From msnyder@cygnus.com Wed Mar 22 10:11:00 2000
From: Michael Snyder <msnyder@cygnus.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH] Document the ThreadInfo remote protocol queries
Date: Wed, 22 Mar 2000 10:11:00 -0000
Message-id: <38D90CE6.4D18@cygnus.com>
References: <200003202316.PAA07888@cleaver.cygnus.com> <38D6FCE2.EBD9830F@cygnus.com> <38D7C38C.6CB0@cygnus.com> <38D85C2F.FF89881D@cygnus.com>
X-SW-Source: 2000-03/msg00467.html
Content-length: 130

Andrew Cagney wrote:

> Should ``C'' also be suceeded by something like ``qThread''?  Is ``C''
> still used?

'qC' is still used.
From msnyder@cygnus.com Wed Mar 22 10:20:00 2000
From: Michael Snyder <msnyder@cygnus.com>
To: Eli Zaretskii <eliz@is.elta.co.il>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH] Running the inferior from breakpoint commands
Date: Wed, 22 Mar 2000 10:20:00 -0000
Message-id: <38D90EEC.1566@cygnus.com>
References: <200003120759.CAA24402@indy.delorie.com> <200003151624.LAA01228@indy.delorie.com> <38D7F31D.1827@cygnus.com> <200003220930.EAA13024@indy.delorie.com>
X-SW-Source: 2000-03/msg00468.html
Content-length: 2019

Eli Zaretskii wrote:

> (I did look in the manual, but since the snippet you cited isn't
> indexed, I didn't find it.  [Yes, I will submit a manual change to add
> an index entry.])

http://sourceware.cygnus.com/gdb/onlinedocs/gdb_6.html#SEC34
four or five paragraphs down.

> To me, the fact that the test suite tried to do this was a sign that
> it was supposed to work.

Not a very reliable guide, I'm afraid.  That test was added in
1995, but as far as I know it did not work even then.  Perhaps
no one knew that it didn't.

> As an aside: is there any place I can find the list of tests which
> fail, and on what systems do they fail?

I'm afraid not.  Such a list would change daily.

> > If you seriously want to undertake this project, we can
> > work on a list of criteria that should be tested (things
> > that can go wrong).
> 
> I will put it on my todo (thanks for the list of things to test; 

Remember it was just a partial list off the top of my head.
I'm sure there are lots more issues to consider.

> > On top of that, I have grave concerns about being able
> > to correctly save and restore all of the internal
> > debugger state necessary to make this work (the
> > infrun execution state, the expression chain, etc.)
> 
> Err... I'm not sure this should be of concern here (but perhaps I
> don't see the subtle issues clearly enough): if the breakpoint
> commands change any of these global entities, I think the user expects
> the changes to be visible after these commands are processed.  For
> example, if the commands delete the breakpoint where you stopped, the
> user will expect the breakpoint to remain deleted after that (the
> changes I submitted do handle this specific case).  Am I missing
> something?

I'm not talking about anything user-visible -- I'm talking about
GDB's internal state.  All the variables with which it keeps 
track of what it's doing and what the child program is doing.
I don't have anything specific in mind, I just know there is
a lot to think about.

Michael
From dima@Chg.RU Wed Mar 22 11:48:00 2000
From: Dmitry Sivachenko <dima@Chg.RU>
To: gdb-patches@sourceware.cygnus.com
Subject: typo in gdb.texinfo
Date: Wed, 22 Mar 2000 11:48:00 -0000
Message-id: <200003221948.WAA31796@netserv1.chg.ru>
X-SW-Source: 2000-03/msg00469.html
Content-length: 1030

Please swap these two lines in the @menu.  This is how these chapters
actually appear in the manual.

Thank you in advance,
Dima.

--- gdb.1.4.texinfo	Wed Mar 22 22:45:32 2000
+++ gdb.1.4.texinfo.new	Wed Mar 22 22:44:43 2000
@@ -142,13 +142,13 @@
 * Controlling GDB::             Controlling @value{GDBN}
 * Sequences::                   Canned sequences of commands
 * Emacs::                       Using @value{GDBN} under @sc{gnu} Emacs
-* Annotations::                 @value{GDBN}'s annotations interface.
+* Annotations::                 @value{GDBN}'s annotations interface
 
 * GDB Bugs::                    Reporting bugs in @value{GDBN}
-* Formatting Documentation::    How to format and print @value{GDBN} documentation
 
 * Command Line Editing::        Command Line Editing
 * Using History Interactively:: Using History Interactively
+* Formatting Documentation::    How to format and print @value{GDBN} documentation
 * Installing GDB::              Installing GDB
 * Index::                       Index
 @end menu
From assign@gnu.org Wed Mar 22 12:14:00 2000
From: assignments <assign@gnu.org>
To: gdb-patches@sourceware.cygnus.com
Subject: GDB assigns/disclaims
Date: Wed, 22 Mar 2000 12:14:00 -0000
Message-id: <200003222013.PAA12928@delysid.gnu.org>
X-SW-Source: 2000-03/msg00470.html
Content-length: 1183

The following disclaimers and/or assignments concerning GDB
have recently been added to the file copyright.list here at the 
Free Software Foundation.  If you have any questions or corrections,
please send them to my general work address, 3diff@gnu.org.
                                     Thanks!
                                     Brian Youmans
                                     Assignments Clerk

GDB     David Whedon    US 1975 2000-02-25
Assigns past and future changes. (ser-tcp.c, command.[ch], top.c,
commands.exp, gdbint.texinfo)
dwhedon@gordian.com

GDB     Gordian 2000-03-01
Disclaims changes by David Whedon in the past and for one year.

GDB Andreas Jaeger      Germany 1969    2000-02-16
Assigns past and future changes.
aj@suse.de

GDB     Serge V. Vakulenko      Russia 1966     2000-01-31
Assigns past and future changes.  (patch for remote debugging of
Atmel AVR microcontrollers via the serial port)
vak@cronyx.ru

GDB     Techniche Universita:t Mu:nchen, Institute for Real-Time Computer Systems       2000-02-17
Disclaims changes by Gunter Magin and Linux BDM device driver by Michael Schraut
and Gunter Magin.
Georg.Faerber@rcs.ei.tum.de (Georg Fa:rber)
From msnyder@cygnus.com Wed Mar 22 12:41:00 2000
From: Michael Snyder <msnyder@cygnus.com>
To: Eli Zaretskii <eliz@is.elta.co.il>
Cc: Jim Blandy <jimb@cygnus.com>, hjl@lucon.org, gdb@sourceware.cygnus.com, gdb-patches@sourceware.cygnus.com
Subject: Re: Problems with hardware watchpoint on ia32.
Date: Wed, 22 Mar 2000 12:41:00 -0000
Message-id: <38D92F29.A3D@cygnus.com>
References: <20000307132401.A20282@valinux.com> <200003081008.FAA16481@indy.delorie.com> <20000308084304.A3150@lucon.org> <200003091210.HAA19857@indy.delorie.com> <npya7c6zn7.fsf@zwingli.cygnus.com> <200003221806.NAA14225@indy.delorie.com>
X-SW-Source: 2000-03/msg00471.html
Content-length: 759

Eli Zaretskii wrote:
> 
> > Eli's test of the value's type is incorrect if the watch expression
> > contains a structure comparison, like (foo == bar) || (something
> > else), where foo and bar are structures.  In that case, there will be
> > a value of type "struct", not at the end of the value list, but which
> > should be watched in its entirety.
> 
> Errr... do you have an actual example program where this happens?
> 
> I seem to be unable to reproduce the problem, at least in a C program:
> whenever I say "watch foo == bar" (where foo and bar are structs), GDB
> curses thusly:
> 
>         Structure has no component named operator==.

Argh... gdb does not seem to know that struct compare
is permitted.  I'll publish a patch.

				Michael Snyder
From msnyder@cygnus.com Wed Mar 22 12:43:00 2000
From: Michael Snyder <msnyder@cygnus.com>
To: gdb-patches@sourceware.cygnus.com
Subject: [PATCH]: Allow struct compare in expressions.
Date: Wed, 22 Mar 2000 12:43:00 -0000
Message-id: <200003222043.MAA10512@cleaver.cygnus.com>
X-SW-Source: 2000-03/msg00472.html
Content-length: 4627

The following change allows GDB to evaluate (and set watchpoints on)
expressions of the form (a == b) and (a != b), where a and b are
simple C structs or unions.  It would be possible to extend this
further by allowing simple binary comparison for classes that don't
have an operator== method: I leave that as an exercise for someone
else.

Jim Blandy, David Taylor, I think both of your approvals is required.

2000-03-22  Michael Snyder  <msnyder@cleaver.cygnus.com>

        * eval.c (evaluate_subexp_standard): allow for simple comparison
        of structures, in the absense of C++ method symbols.
        * symtab.c (total_number_of_methods): make public, for use above.
        * symtab.h (total_number_of_methods): publish prototype.

Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.163
diff -c -r1.163 ChangeLog
*** ChangeLog	2000/03/22 09:45:01	1.163
--- ChangeLog	2000/03/22 20:38:33
***************
*** 1,3 ****
--- 1,10 ----
+ 2000-03-22  Michael Snyder  <msnyder@cleaver.cygnus.com>
+ 
+ 	* eval.c (evaluate_subexp_standard): allow for simple comparison
+ 	of structures, in the absense of C++ method symbols.
+ 	* symtab.c (total_number_of_methods): make public, for use above.
+ 	* symtab.h (total_number_of_methods): publish prototype.
+ 
  2000-03-22  Mark Kettenis  <kettenis@gnu.org>
  
  	* config/i386/tm-i386aix.h (I386_AIX_TARGET): Remove.
Index: eval.c
===================================================================
RCS file: /cvs/src/src/gdb/eval.c,v
retrieving revision 1.2
diff -c -r1.2 eval.c
*** eval.c	2000/03/14 17:01:04	1.2
--- eval.c	2000/03/22 20:38:34
***************
*** 1448,1454 ****
        arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
        if (noside == EVAL_SKIP)
  	goto nosideret;
!       if (binop_user_defined_p (op, arg1, arg2))
  	{
  	  return value_x_binop (arg1, arg2, op, OP_NULL, noside);
  	}
--- 1448,1459 ----
        arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
        if (noside == EVAL_SKIP)
  	goto nosideret;
! 
!       /* NOTE: because BINOP_EQUAL is a legal operaton for 
! 	 C structs (as opposed to C++ classes), revert to 
! 	 simple value comparison if the type has no methods.  */
!       if (binop_user_defined_p (op, arg1, arg2) &&
! 	  total_number_of_methods (arg1->type) > 0)
  	{
  	  return value_x_binop (arg1, arg2, op, OP_NULL, noside);
  	}
***************
*** 1463,1469 ****
        arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
        if (noside == EVAL_SKIP)
  	goto nosideret;
!       if (binop_user_defined_p (op, arg1, arg2))
  	{
  	  return value_x_binop (arg1, arg2, op, OP_NULL, noside);
  	}
--- 1468,1479 ----
        arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
        if (noside == EVAL_SKIP)
  	goto nosideret;
! 
!       /* NOTE: because BINOP_NOTEQUAL is a legal operaton for 
! 	 C structs (as opposed to C++ classes), revert to 
! 	 simple value comparison if the type has no methods.  */
!       if (binop_user_defined_p (op, arg1, arg2) &&
! 	  total_number_of_methods (arg1->type) > 0)
  	{
  	  return value_x_binop (arg1, arg2, op, OP_NULL, noside);
  	}
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.2
diff -c -r1.2 symtab.c
*** symtab.c	2000/02/08 04:39:02	1.2
--- symtab.c	2000/03/22 20:38:34
***************
*** 2217,2225 ****
     reader because the type of the baseclass might still be stubbed
     when the definition of the derived class is parsed.  */
  
! static int total_number_of_methods PARAMS ((struct type * type));
! 
! static int
  total_number_of_methods (type)
       struct type *type;
  {
--- 2217,2223 ----
     reader because the type of the baseclass might still be stubbed
     when the definition of the derived class is parsed.  */
  
! int
  total_number_of_methods (type)
       struct type *type;
  {
Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.4
diff -c -r1.4 symtab.h
*** symtab.h	2000/03/21 22:37:42	1.4
--- symtab.h	2000/03/22 20:38:34
***************
*** 1462,1467 ****
--- 1462,1472 ----
  extern int
  in_prologue PARAMS ((CORE_ADDR pc, CORE_ADDR func_start));
  
+ /* Number of method symbols for TYPE
+    (and all its base classes) */
+ extern int 
+ total_number_of_methods PARAMS ((struct type * type));
+ 
  extern struct symbol *
    fixup_symbol_section PARAMS ((struct symbol *, struct objfile *));
  
From gkm@cygnus.com Wed Mar 22 12:45:00 2000
From: gkm@cygnus.com (glen mccready)
To: Elena Zannoni <ezannoni@cygnus.com>, gdb-patches@sourceware.cygnus.com
Cc: Fernando Nasser <fnasser@redhat.com>, Chris Faylor <cgf@cygnus.com>
Subject: sim/arm/wrapper.c fix.
Date: Wed, 22 Mar 2000 12:45:00 -0000
Message-id: <200003222045.MAA03959@cygint.cygnus.com>
X-SW-Source: 2000-03/msg00473.html
Content-length: 1457

Index: ChangeLog
===================================================================
RCS file: /cvs/cvsfiles/devo/sim/arm/ChangeLog,v
retrieving revision 1.77
diff -c -b -r1.77 ChangeLog
*** ChangeLog	1998/09/14 17:04:36	1.77
--- ChangeLog	2000/03/22 20:27:15
***************
*** 1,3 ****
--- 1,7 ----
+ Wed Mar 22 15:24:21 2000  glen mccready  <gkm@pobox.com>
+ 
+ 	* wrapper.c (sim_open,sim_close): Copy into myname, free myname
+ 
  Mon Sep 14 09:00:05 1998  Nick Clifton  <nickc@cygnus.com>
  
  	* wrapper.c (sim_open): Set endianness according to BFD or command
Index: wrapper.c
===================================================================
RCS file: /cvs/cvsfiles/devo/sim/arm/wrapper.c,v
retrieving revision 1.24
diff -c -b -r1.24 wrapper.c
*** wrapper.c	1998/09/14 17:04:36	1.24
--- wrapper.c	2000/03/22 20:27:15
***************
*** 347,353 ****
       char **argv;
  {
    sim_kind = kind;
!   myname = argv[0];
    sim_callback = ptr;
    
    /* Decide upon the endian-ness of the processor.
--- 347,354 ----
       char **argv;
  {
    sim_kind = kind;
!   if (myname) free(myname);
!   myname = xstrdup(argv[0]);
    sim_callback = ptr;
    
    /* Decide upon the endian-ness of the processor.
***************
*** 405,411 ****
       SIM_DESC sd;
       int quitting;
  {
!   /* nothing to do */
  }
  
  SIM_RC
--- 406,413 ----
       SIM_DESC sd;
       int quitting;
  {
!   if (myname) free(myname);
!   myname = 0;
  }
  
  SIM_RC
From Peter.Schauer@regent.e-technik.tu-muenchen.de Wed Mar 22 12:57:00 2000
From: "Peter.Schauer" <Peter.Schauer@regent.e-technik.tu-muenchen.de>
To: gdb-patches@sourceware.cygnus.com
Subject: [PATCH] printcmd.c: Truncate output width of p/a and x/a if necessary
Date: Wed, 22 Mar 2000 12:57:00 -0000
Message-id: <200003222057.VAA24195@reisser.regent.e-technik.tu-muenchen.de>
X-SW-Source: 2000-03/msg00474.html
Content-length: 1272

FYI,

I checked in the attached patch. It gets rid of the
gdb.base/long_long.exp: x/a &oct
testsuite failure on Solaris 2.7 sparc. For more information see

http://sourceware.cygnus.com/ml/gdb-patches/2000-q1/msg00555.html


2000-03-22  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>

	* printcmd.c (print_scalar_formatted):  Truncate addresses to the
	size of a target pointer before passing them to print_address.


Index: printcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/printcmd.c,v
retrieving revision 1.1.1.8
diff -u -p -r1.1.1.8 printcmd.c
--- printcmd.c	2000/02/05 07:29:47	1.1.1.8
+++ printcmd.c	2000/03/22 20:48:31
@@ -443,7 +443,14 @@ print_scalar_formatted (valaddr, type, f
       break;
 
     case 'a':
-      print_address (unpack_pointer (type, valaddr), stream);
+      {
+	/* Truncate address to the size of a target pointer, avoiding
+	   shifts larger or equal than the width of a CORE_ADDR.  */
+	CORE_ADDR addr = unpack_pointer (type, valaddr);
+	if (TARGET_PTR_BIT < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
+	  addr &= ((CORE_ADDR) 1 << TARGET_PTR_BIT) - 1;
+	print_address (addr, stream);
+      }
       break;
 
     case 'c':

-- 
Peter Schauer			pes@regent.e-technik.tu-muenchen.de
From taylor@cygnus.com Wed Mar 22 12:58:00 2000
From: David Taylor <taylor@cygnus.com>
To: Michael Snyder <msnyder@cygnus.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH]: Allow struct compare in expressions.
Date: Wed, 22 Mar 2000 12:58:00 -0000
Message-id: <200003222057.PAA23063@texas.cygnus.com>
X-SW-Source: 2000-03/msg00476.html
Content-length: 5148

    From: Michael Snyder <msnyder@cygnus.com>
    Date: Wed, 22 Mar 2000 12:43:56 -0800 (PST)

    The following change allows GDB to evaluate (and set watchpoints on)
    expressions of the form (a == b) and (a != b), where a and b are
    simple C structs or unions.  It would be possible to extend this
    further by allowing simple binary comparison for classes that don't
    have an operator== method: I leave that as an exercise for someone
    else.

    Jim Blandy, David Taylor, I think both of your approvals is required.

    2000-03-22  Michael Snyder  <msnyder@cleaver.cygnus.com>

	    * eval.c (evaluate_subexp_standard): allow for simple comparison
	    of structures, in the absense of C++ method symbols.
	    * symtab.c (total_number_of_methods): make public, for use above.
	    * symtab.h (total_number_of_methods): publish prototype.

Approved.

    Index: ChangeLog
    ===================================================================
    RCS file: /cvs/src/src/gdb/ChangeLog,v
    retrieving revision 1.163
    diff -c -r1.163 ChangeLog
    *** ChangeLog   2000/03/22 09:45:01     1.163
    --- ChangeLog   2000/03/22 20:38:33
    ***************
    *** 1,3 ****
    --- 1,10 ----
    + 2000-03-22  Michael Snyder  <msnyder@cleaver.cygnus.com>
    + 
    +       * eval.c (evaluate_subexp_standard): allow for simple comparison
    +       of structures, in the absense of C++ method symbols.
    +       * symtab.c (total_number_of_methods): make public, for use above.
    +       * symtab.h (total_number_of_methods): publish prototype.
    + 
      2000-03-22  Mark Kettenis  <kettenis@gnu.org>

	    * config/i386/tm-i386aix.h (I386_AIX_TARGET): Remove.
    Index: eval.c
    ===================================================================
    RCS file: /cvs/src/src/gdb/eval.c,v
    retrieving revision 1.2
    diff -c -r1.2 eval.c
    *** eval.c      2000/03/14 17:01:04     1.2
    --- eval.c      2000/03/22 20:38:34
    ***************
    *** 1448,1454 ****
	    arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
	    if (noside == EVAL_SKIP)
	    goto nosideret;
    !       if (binop_user_defined_p (op, arg1, arg2))
	    {
	      return value_x_binop (arg1, arg2, op, OP_NULL, noside);
	    }
    --- 1448,1459 ----
	    arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
	    if (noside == EVAL_SKIP)
	    goto nosideret;
    ! 
    !       /* NOTE: because BINOP_EQUAL is a legal operaton for 
    !        C structs (as opposed to C++ classes), revert to 
    !        simple value comparison if the type has no methods.  */
    !       if (binop_user_defined_p (op, arg1, arg2) &&
    !         total_number_of_methods (arg1->type) > 0)
	    {
	      return value_x_binop (arg1, arg2, op, OP_NULL, noside);
	    }
    ***************
    *** 1463,1469 ****
	    arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
	    if (noside == EVAL_SKIP)
	    goto nosideret;
    !       if (binop_user_defined_p (op, arg1, arg2))
	    {
	      return value_x_binop (arg1, arg2, op, OP_NULL, noside);
	    }
    --- 1468,1479 ----
	    arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
	    if (noside == EVAL_SKIP)
	    goto nosideret;
    ! 
    !       /* NOTE: because BINOP_NOTEQUAL is a legal operaton for 
    !        C structs (as opposed to C++ classes), revert to 
    !        simple value comparison if the type has no methods.  */
    !       if (binop_user_defined_p (op, arg1, arg2) &&
    !         total_number_of_methods (arg1->type) > 0)
	    {
	      return value_x_binop (arg1, arg2, op, OP_NULL, noside);
	    }
    Index: symtab.c
    ===================================================================
    RCS file: /cvs/src/src/gdb/symtab.c,v
    retrieving revision 1.2
    diff -c -r1.2 symtab.c
    *** symtab.c    2000/02/08 04:39:02     1.2
    --- symtab.c    2000/03/22 20:38:34
    ***************
    *** 2217,2225 ****
	 reader because the type of the baseclass might still be stubbed
	 when the definition of the derived class is parsed.  */

    ! static int total_number_of_methods PARAMS ((struct type * type));
    ! 
    ! static int
      total_number_of_methods (type)
	   struct type *type;
      {
    --- 2217,2223 ----
	 reader because the type of the baseclass might still be stubbed
	 when the definition of the derived class is parsed.  */

    ! int
      total_number_of_methods (type)
	   struct type *type;
      {
    Index: symtab.h
    ===================================================================
    RCS file: /cvs/src/src/gdb/symtab.h,v
    retrieving revision 1.4
    diff -c -r1.4 symtab.h
    *** symtab.h    2000/03/21 22:37:42     1.4
    --- symtab.h    2000/03/22 20:38:34
    ***************
    *** 1462,1467 ****
    --- 1462,1472 ----
      extern int
      in_prologue PARAMS ((CORE_ADDR pc, CORE_ADDR func_start));

    + /* Number of method symbols for TYPE
    +    (and all its base classes) */
    + extern int 
    + total_number_of_methods PARAMS ((struct type * type));
    + 
      extern struct symbol *
	fixup_symbol_section PARAMS ((struct symbol *, struct objfile *));


  reply	other threads:[~2000-04-01  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200003180006.TAA26919@zwingli.cygnus.com>
2000-03-19  1:45 ` Eli Zaretskii
     [not found]   ` <200003192255.e2JMtcs00643@delius.kettenis.local>
     [not found]     ` <200003200958.EAA09356@indy.delorie.com>
2000-04-01  0:00       ` Jim Blandy
     [not found]         ` <200003211817.NAA12429@indy.delorie.com>
2000-03-21 15:33           ` Jim Blandy
2000-04-01  0:00             ` Mark Kettenis [this message]
2000-03-21 15:57               ` Mark Kettenis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200003212357.e2LNvIq05590@delius.kettenis.local \
    --to=kettenis@wins.uva.nl \
    --cc=eliz@is.elta.co.il \
    --cc=gdb-patches@sourceware.cygnus.com \
    --cc=jimb@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox