* [PATCH] Fix PR gdb/15678 Typing "enable count" crashes gdb
@ 2013-08-07 9:01 Muhammad Waqas
2013-08-07 9:23 ` Muhammad Waqas
0 siblings, 1 reply; 2+ messages in thread
From: Muhammad Waqas @ 2013-08-07 9:01 UTC (permalink / raw)
To: gdb-patches
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix PR gdb/15678 Typing "enable count" crashes gdb
2013-08-07 9:01 [PATCH] Fix PR gdb/15678 Typing "enable count" crashes gdb Muhammad Waqas
@ 2013-08-07 9:23 ` Muhammad Waqas
0 siblings, 0 replies; 2+ messages in thread
From: Muhammad Waqas @ 2013-08-07 9:23 UTC (permalink / raw)
To: gdb-patches
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-08-07 9:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-07 9:01 [PATCH] Fix PR gdb/15678 Typing "enable count" crashes gdb Muhammad Waqas
2013-08-07 9:23 ` Muhammad Waqas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).