This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


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

Re: [PATCH] Fix PR cli/15603


On Mon, 17 Jun 2013 23:09:13 +0200, Tom Tromey wrote:
> --- a/gdb/breakpoint.c
> +++ b/gdb/breakpoint.c
> @@ -4153,7 +4153,7 @@ bpstat_find_breakpoint (bpstat bsp, struct breakpoint *breakpoint)
>  /* See breakpoint.h.  */
>  
>  enum bpstat_signal_value
> -bpstat_explains_signal (bpstat bsp)
> +bpstat_explains_signal (bpstat bsp, enum gdb_signal sig)
>  {
>    enum bpstat_signal_value result = BPSTAT_SIGNAL_NO;
>  
> @@ -4163,8 +4163,16 @@ bpstat_explains_signal (bpstat bsp)
>  	 return BPSTAT_SIGNAL_HIDE.  */
>        enum bpstat_signal_value newval = BPSTAT_SIGNAL_HIDE;

style/nitpick:
         enum bpstat_signal_value newval;

>  
> -      if (bsp->breakpoint_at != NULL)
> -	newval = bsp->breakpoint_at->ops->explains_signal (bsp->breakpoint_at);
> +      if (bsp->breakpoint_at == NULL)
> +	{
> +	  /* A moribund location can never explain a signal other than
> +	     GDB_SIGNAL_TRAP.  */
> +	  if (sig != GDB_SIGNAL_TRAP)
> +	    newval = BPSTAT_SIGNAL_NO;

style/nitpick:
	  if (sig == GDB_SIGNAL_TRAP)
	    newval = BPSTAT_SIGNAL_HIDE;
	  else
	    newval = BPSTAT_SIGNAL_NO;


> +	}
> +      else
> +	newval = bsp->breakpoint_at->ops->explains_signal (bsp->breakpoint_at,
> +							   sig);
>  
>        if (newval > result)
>  	result = newval;
> @@ -10630,6 +10638,20 @@ print_recreate_watchpoint (struct breakpoint *b, struct ui_file *fp)
>    print_recreate_thread (b, fp);
>  }
>  
> +/* Implement the "explains_signal" breakpoint_ops method for
> +   watchpoints.  */
> +
> +static enum bpstat_signal_value
> +explains_signal_watchpoint (struct breakpoint *b, enum gdb_signal sig)
> +{
> +  /* A software watchpoint cannot cause a signal other than
> +     GDB_SIGNAL_TRAP.  */
> +  if (b->type == bp_watchpoint && sig != GDB_SIGNAL_TRAP)
> +    return BPSTAT_SIGNAL_NO;

Even hardware watchpoints create only GDB_SIGNAL_TRAP and no other signal,
don't they?  Why to make the check for bp_watchpoint?


> +
> +  return BPSTAT_SIGNAL_HIDE;
> +}
> +
>  /* The breakpoint_ops structure to be used in hardware watchpoints.  */
>  
>  static struct breakpoint_ops watchpoint_breakpoint_ops;
[...]
> --- /dev/null
> +++ b/gdb/testsuite/gdb.base/random-signal.c
> @@ -0,0 +1,28 @@
> +/* This testcase is part of GDB, the GNU debugger.
> +
> +   Copyright 2013 Free Software Foundation, Inc.
> +
> +   This program is free software; you can redistribute it and/or modify
> +   it under the terms of the GNU General Public License as published by
> +   the Free Software Foundation; either version 3 of the License, or
> +   (at your option) any later version.
> +
> +   This program is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +   GNU General Public License for more details.
> +
> +   You should have received a copy of the GNU General Public License
> +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
> +
> +int v;
> +
> +void do_something () { }
(void)
> +
> +int main()
(void)
> +{

Here should be at least alarm to prevent runaway forever running testcases.


> +  do_something();
> +
> +  for (;;)
> +    ;
> +}


Thanks,
Jan


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