This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Fix PR gdb/15678 Typing "enable count" crashes gdb
- From: Muhammad Waqas <mwaqas at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Wed, 7 Aug 2013 14:00:43 +0500
- Subject: [PATCH] Fix PR gdb/15678 Typing "enable count" crashes gdb
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