Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Reposition NULL check in print_it_typical
@ 2011-03-02 15:26 Thiago Jung Bauermann
  2011-03-03 15:41 ` Ulrich Weigand
  0 siblings, 1 reply; 3+ messages in thread
From: Thiago Jung Bauermann @ 2011-03-02 15:26 UTC (permalink / raw)
  To: gdb-patches ml

Hi,

This is a cleanup that was part of my ranged breakpoints patch and
Ulrich asked me to submit separately. It makes more sense to have the
NULL check at print_it_typical's caller, since it would also be needed
in breakpoint_ops.print_it implementations. As a bonus, we get rid of a
FIXME.

No regressions on ppc-linux and ppc64-linux. Ok?
-- 
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center


2011-03-02  Thiago Jung Bauermann  <bauerman@br.ibm.com>

	* breakpointc (print_it_typical): Move NULL check from here...
	(print_bp_stop_message): ... to here.


Index: gdb.git/gdb/breakpoint.c
===================================================================
--- gdb.git.orig/gdb/breakpoint.c	2011-03-01 00:38:26.000000000 -0300
+++ gdb.git/gdb/breakpoint.c	2011-03-01 19:11:02.000000000 -0300
@@ -3309,11 +3309,6 @@ print_it_typical (bpstat bs)
   int bp_temp = 0;
   enum print_stop_action result;
 
-  /* bs->breakpoint_at can be NULL if it was a momentary breakpoint
-     which has since been deleted.  */
-  if (bs->breakpoint_at == NULL)
-    return PRINT_UNKNOWN;
-
   gdb_assert (bs->bp_location_at != NULL);
 
   bl = bs->bp_location_at;
@@ -3519,10 +3514,14 @@ print_bp_stop_message (bpstat bs)
       {
 	struct breakpoint *b = bs->breakpoint_at;
 
+	/* bs->breakpoint_at can be NULL if it was a momentary breakpoint
+	   which has since been deleted.  */
+	if (b == NULL)
+	  return PRINT_UNKNOWN;
+
 	/* Normal case.  Call the breakpoint's print_it method, or
 	   print_it_typical.  */
-	/* FIXME: how breakpoint can ever be NULL here?  */
-	if (b != NULL && b->ops != NULL && b->ops->print_it != NULL)
+	if (b->ops != NULL && b->ops->print_it != NULL)
 	  return b->ops->print_it (b);
 	else
 	  return print_it_typical (bs);



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA] Reposition NULL check in print_it_typical
  2011-03-02 15:26 [RFA] Reposition NULL check in print_it_typical Thiago Jung Bauermann
@ 2011-03-03 15:41 ` Ulrich Weigand
  2011-03-04 20:13   ` Thiago Jung Bauermann
  0 siblings, 1 reply; 3+ messages in thread
From: Ulrich Weigand @ 2011-03-03 15:41 UTC (permalink / raw)
  To: Thiago Jung Bauermann; +Cc: gdb-patches ml

Thiago Jung Bauermann wrote:

> 	* breakpointc (print_it_typical): Move NULL check from here...
> 	(print_bp_stop_message): ... to here.

This is OK.

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA] Reposition NULL check in print_it_typical
  2011-03-03 15:41 ` Ulrich Weigand
@ 2011-03-04 20:13   ` Thiago Jung Bauermann
  0 siblings, 0 replies; 3+ messages in thread
From: Thiago Jung Bauermann @ 2011-03-04 20:13 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gdb-patches ml

On Thu, 2011-03-03 at 16:41 +0100, Ulrich Weigand wrote:
> Thiago Jung Bauermann wrote:
> 
> > 	* breakpointc (print_it_typical): Move NULL check from here...
> > 	(print_bp_stop_message): ... to here.
> 
> This is OK.

Committed. Thanks!
-- 
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-04 20:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-02 15:26 [RFA] Reposition NULL check in print_it_typical Thiago Jung Bauermann
2011-03-03 15:41 ` Ulrich Weigand
2011-03-04 20:13   ` Thiago Jung Bauermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox