This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [PATCH] fix PR-15501
- From: "Waqas, Muhammad" <Muhammad_Waqas at mentor dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Tue, 20 Aug 2013 06:45:50 +0000
- Subject: RE: [PATCH] fix PR-15501
- References: <520A0453 dot 4070309 at codesourcery dot com> <520A6EEB dot 8010808 at redhat dot com> <520CAE24 dot 7050301 at codesourcery dot com>,<52123990 dot 6070807 at redhat dot com>
Hi!
Sorry for inconvenience. please find attachment for the patch. I'm unable to set
mail editor settings after long try. But attached file will be applied as
I had tested them.
________________________________________
From: Pedro Alves [palves@redhat.com]
Sent: Monday, August 19, 2013 8:28 PM
To: Waqas, Muhammad
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] fix PR-15501
Hi!
Unfortunately, I'm having trouble applying your patches. Seems like
they're mangled somehow. I see you're using Thunderbird.
Could you go through:
http://sourceware.org/gdb/wiki/ContributionChecklist#Submitting_patches
and fix it up as necessary (and then check if you can apply
a patch that you privately send yourself?)
Thanks,
--
Pedro Alves
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 20 Aug 2013 05:55:02 -0000
@@ -14553,25 +14553,35 @@ disable_command (char *args, int from_tt
if (user_breakpoint_p (bpt))
disable_breakpoint (bpt);
}
- else if (strchr (args, '.'))
+ else
{
- struct bp_location *loc = find_location_by_number (args);
- if (loc)
+ char *num = extract_arg (&args);
+
+ while (num)
{
- if (loc->enabled)
+ if (strchr (num, '.'))
{
- loc->enabled = 0;
- mark_breakpoint_location_modified (loc);
+ struct bp_location *loc = find_location_by_number (num);
+
+ if (loc)
+ {
+ if (loc->enabled)
+ {
+ loc->enabled = 0;
+ mark_breakpoint_location_modified (loc);
+ }
+ if (target_supports_enable_disable_tracepoint ()
+ && current_trace_status ()->running && loc->owner
+ && is_tracepoint (loc->owner))
+ target_disable_tracepoint (loc);
+ }
+ update_global_location_list (0);
}
- if (target_supports_enable_disable_tracepoint ()
- && current_trace_status ()->running && loc->owner
- && is_tracepoint (loc->owner))
- target_disable_tracepoint (loc);
+ else
+ map_breakpoint_numbers (num, do_map_disable_breakpoint, NULL);
+ num = extract_arg (&args);
}
- update_global_location_list (0);
}
- else
- map_breakpoint_numbers (args, do_map_disable_breakpoint, NULL);
}
static void
@@ -14677,25 +14687,35 @@ enable_command (char *args, int from_tty
if (user_breakpoint_p (bpt))
enable_breakpoint (bpt);
}
- else if (strchr (args, '.'))
+ else
{
- struct bp_location *loc = find_location_by_number (args);
- if (loc)
+ char *num = extract_arg (&args);
+
+ while (num)
{
- if (!loc->enabled)
+ if (strchr (num, '.'))
{
- loc->enabled = 1;
- mark_breakpoint_location_modified (loc);
+ struct bp_location *loc = find_location_by_number (num);
+
+ if (loc)
+ {
+ if (!loc->enabled)
+ {
+ loc->enabled = 1;
+ mark_breakpoint_location_modified (loc);
+ }
+ if (target_supports_enable_disable_tracepoint ()
+ && current_trace_status ()->running && loc->owner
+ && is_tracepoint (loc->owner))
+ target_enable_tracepoint (loc);
+ }
+ update_global_location_list (1);
}
- if (target_supports_enable_disable_tracepoint ()
- && current_trace_status ()->running && loc->owner
- && is_tracepoint (loc->owner))
- target_enable_tracepoint (loc);
+ else
+ map_breakpoint_numbers (num, do_map_enable_breakpoint, NULL);
+ num = extract_arg (&args);
}
- update_global_location_list (1);
}
- else
- map_breakpoint_numbers (args, do_map_enable_breakpoint, NULL);
}
/* This struct packages up disposition data for application to multiple
Index: ena-dis-br.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/ena-dis-br.exp,v
retrieving revision 1.22
diff -u -p -r1.22 ena-dis-br.exp
--- ena-dis-br.exp 27 Jun 2013 18:50:30 -0000 1.22
+++ ena-dis-br.exp 15 Aug 2013 09:12:04 -0000
@@ -301,5 +301,88 @@ gdb_test_multiple "continue 2" "$test" {
}
}
+# Verify that GDB correctly handles the "enable/disable" command with arguments.
+#
+if ![runto_main] then { fail "enable/disable break tests suppressed" }
+
+set b1 0
+set b2 0
+set b3 0
+set b4 0
+
+set b1 [break_at main ""]
+set b2 [break_at main ""]
+set b3 [break_at main ""]
+set b4 [break_at main ""]
+
+# This proc will work correctly If args will be according to below explaned values
+#
+# If "what" = "disable" then
+# "what_res" = "n"
+# "p1" = "pass"
+# "p2" = "fail".
+#
+# If "what" = "enable" then
+# "what_res" = "y"
+# "p1" = "fail"
+# "p2" = "pass".
+
+proc test_ena_dis_br { what what_res p1 p2 } {
+ global b1
+ global b2
+ global b3
+ global b4
+ global gdb_prompt
+
+ gdb_test_no_output "$what $b1.1 $b2.1" "$what \$b1.1 \$b2.1"
+ set test1 "$what \$b1.1 and \$b2.1"
+
+ gdb_test_multiple "info break" "$test1" {
+ -re "(${b1}.1)(\[^\n\r\]*)( n.*)(${b2}.1)(\[^\n\r\]*)( n.*)$gdb_prompt $" {
+ $p1 "$test1"
+ }
+ -re ".*$gdb_prompt $" {
+ $p2 "$test1"
+ }
+ }
+
+ gdb_test "$what $b1 fooo.1" \
+ "Bad breakpoint number 'fooo'" \
+ "$what \$b1 fooo.1"
+
+ gdb_test "info break" \
+ "(${b1})(\[^\n\r]*)( $what_res.*)" \
+ "${what}d \$b1"
+
+ gdb_test_no_output "$what $b4 $b3.1" "$what \$b4 \$b3.1"
+ set test1 "${what}d \$b4 and \$b3.1,remain enabled \$b3"
+
+ gdb_test_multiple "info break" "$test1" {
+ -re "(${b3})(\[^\n\r]*)( y.*)(${b3}.1)(\[^\n\r\]*)( n.*)(${b4})(\[^\n\r\]*)( $what_res.*)$gdb_prompt $" {
+ $p1 "$test1"
+ }
+ -re "(${b3})(\[^\n\r]*)( y.*)(${b4})(\[^\n\r\]*)( $what_res.*)$gdb_prompt $" {
+ $p2 "$test1"
+ }
+ }
+
+ gdb_test "$what $b4.1 fooobaar" \
+ "warning: bad breakpoint number at or near 'fooobaar'" \
+ "$what \$b4.1 fooobar"
+ set test1 "${what}d \$b4.1"
+
+ gdb_test_multiple "info break" "$test1" {
+ -re "(${b4}.1)(\[^\n\r\]*)( n.*)$gdb_prompt $" {
+ $p1 "$test1"
+ }
+ -re ".*$gdb_prompt $" {
+ $p2 "$test1"
+ }
+ }
+}
+
+test_ena_dis_br "disable" "n" "pass" "fail"
+test_ena_dis_br "enable" "y" "fail" "pass"
+
gdb_exit
return 0