[PATCH] Fix PR gdb/15678 Typing "enable count" crashes gdb

Muhammad Waqas mwaqas@codesourcery.com
Wed Aug 7 09:23:00 GMT 2013


On 08/07/2013 02:00 PM, Muhammad Waqas wrote:
> Patch for http://sourceware.org/bugzilla/show_bug.cgi?id=15678
>
> gdb crashes when "enable count" command is entered.
>
> In function enable_count_command no checks for args if it's null
> or not and pass it to get_number function where gdb crashed
> while doing dereference to null pointer.
> So I added code to check if args is null then put
> error to user Arguments are need.
>
> Changlog
>
> 2013-08-07  Muhammad Waqas  <mwaqas@codesourcery.com>
>
>     PR gdb/15678
>     * breakpoint.c (enable_count_command): Fix gdb crash if args
>     is null.
>
> Index: breakpoint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/breakpoint.c,v
> retrieving revision 1.773
> diff -u -p -r1.773 breakpoint.c
> --- breakpoint.c    24 Jul 2013 19:50:32 -0000    1.773
> +++ breakpoint.c    7 Aug 2013 08:46:02 -0000
> @@ -14740,9 +14740,16 @@ do_map_enable_count_breakpoint (struct b
>  static void
>  enable_count_command (char *args, int from_tty)
>  {
> -  int count = get_number (&args);
> -
> -  map_breakpoint_numbers (args, do_map_enable_count_breakpoint, &count);
> +  if (args == NULL)
> +    {
> +      error_no_arg (_("count, breakpoints"));
> +    }
> +  else
> +    {
> +      int count = get_number (&args);
> +
> +      map_breakpoint_numbers (args, do_map_enable_count_breakpoint, 
> &count);
> +    }
>  }
>
>  static void
>
Sorry every one I with draw this patch I didn't noticed it is already fixed.



More information about the Gdb-patches mailing list