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]

Re: (gdb-6.8) Discard breakpoint address if shared library is unloaded


Vladimir,

I could use a little help with your feedback. I think I'm getting it,
but I think you might know more about this part of the code.

> Yes.  It was in my original patch but I seem to have lost it somehow in the
> intervening period.  I attach the updated patch.

Oh, good.

> 2008-02-05  Nick Roberts  <nickrob@snap.net.nz>
> 
> 	* breakpoint.c (print_one_breakpoint_location): Revert Enb field
> 	to old format.  Discard breakpoint address if shared library is
> 	unloaded.

I think we're still not there, unfortunately.

>   	 state -- it will be apparent from the locations.  */
>         if (header_of_multiple)
>   	pending = 0;
> !       ui_out_field_fmt (uiout, "enabled", "%c", 
> !  			bpenables[(int) b->enable_state]);
>       }

The following code above "ui_out_field_fmt" can be deleted now:

      int pending = (b->loc == NULL || b->loc->shlib_disabled);
      /* For header of multiple, there's no point showing pending
         state -- it will be apparent from the locations.  */
      if (header_of_multiple)
        pending = 0;

That means that the curly braces can go too. We also need to restore
the spacing after the enable state. We end up with:

  annotate_field (3);
  if (part_of_multiple)
    ui_out_field_string (uiout, "enabled", loc->enabled ? "y" : "n");
  else
    ui_out_field_fmt (uiout, "enabled", "%c",
                      bpenables[(int) b->enable_state]);
  ui_out_spaces (uiout, 2);

>   	      ui_out_field_string (uiout, "addr", "<PENDING>");
>   	    else if (header_of_multiple)
>   	      ui_out_field_string (uiout, "addr", "<MULTIPLE>");
> + 	    else if (loc->shlib_disabled)
> + 	      ui_out_field_string (uiout, "addr", "<PENDING>");
>   	    else
>   	      ui_out_field_core_addr (uiout, "addr", loc->address);
>   	  }

I understand what Vladimir said, but I think that the following should
work too:

@@ -3552,10 +3552,10 @@ print_one_breakpoint_location (struct br
 	if (addressprint)
 	  {
 	    annotate_field (4);
-	    if (b->loc == NULL)
-	      ui_out_field_string (uiout, "addr", "<PENDING>");
-	    else if (header_of_multiple)
+	    if (header_of_multiple)
 	      ui_out_field_string (uiout, "addr", "<MULTIPLE>");
+	    if (b->loc == NULL || loc->shlib_disabled)
+	      ui_out_field_string (uiout, "addr", "<PENDING>");
 	    else
 	      ui_out_field_core_addr (uiout, "addr", loc->address);
 	  }

The idea is that you can't have header_of_multiple=1 and b->loc == NULL
at the same time. So it's OK to move the check for header_of_multiple
up.  And that avoids the code duplication.

-- 
Joel


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