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]

[PATCH] Combine two blocks together in print_one_breakpoint_location.


Hi,
These two blocks handling 'hit_count' can be combined into a single
if-else block.  This patch does this.
The original comment "FIXME: Should have a better test for this" looks
out of date, because there are some tests in gdb.mi to check the field
"times", so this patch remove it as well.

I don't indent the code to make patch easy to read.  I'll indent the
code when I commit this patch.  Regression tested on
x86_64-unknown-linux-gnu.  Is it OK?

gdb:

2012-11-30  Yao Qi  <yao@codesourcery.com>

	* breakpoint.c (print_one_breakpoint_location): Combine two
	blocks handling 'hit count' together.
---
 gdb/breakpoint.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 10a8af7..4e85a43 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -6029,7 +6029,9 @@ print_one_breakpoint_location (struct breakpoint *b,
       ui_out_text (uiout, "\n");
     }
   
-  if (!part_of_multiple && b->hit_count)
+  if (!part_of_multiple)
+    {
+      if (b->hit_count)
     {
       /* FIXME should make an annotation for this.  */
       if (is_catchpoint (b))
@@ -6045,12 +6047,13 @@ print_one_breakpoint_location (struct breakpoint *b,
       else
 	ui_out_text (uiout, " times\n");
     }
-  
-  /* Output the count also if it is zero, but only if this is mi.
-     FIXME: Should have a better test for this.  */
+      else
+	{
+  /* Output the count also if it is zero, but only if this is mi.  */
   if (ui_out_is_mi_like_p (uiout))
-    if (!part_of_multiple && b->hit_count == 0)
       ui_out_field_int (uiout, "times", b->hit_count);
+	}
+    }
 
   if (!part_of_multiple && b->ignore_count)
     {
-- 
1.7.7.6


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