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: [patch 3/5] Print a message on gdb disconnected.


On 11/17/2011 03:04 AM, Pedro Alves wrote:
>> > +  /* Check whether we still have pending tracepoint.  If we have, warn the
>> > +     user that pending tracepoint will no longer work.  */
>> > +  tp_vec = all_tracepoints ();
>> > +  for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, b); ix++)
>> > +    {
>> > +      if (b->loc == NULL || b->loc->shlib_disabled)
> It's not garanteed that the first location is the one that
> is shlib_disabled.  If you want the warning for the shlib_disabled
> cases, you'll need to iterate over the breakpoint's locations.
> 

Yes.  I am still unable to keep it in mind that there may be multiple
locations for one breakpoint :)

>> > +       {
>> > +         has_pending_p = 1;
>> > +         break;
>> > +       }
>> > +    }
>> > +  VEC_free (breakpoint_p, tp_vec);
>> > +
>> > +  if (has_pending_p)
>> > +    warning (_("Pending tracepoint will not be resolved while"
>> > +              " GBD is disconnected\n"));
> Plural, "Pending tracepoints".

Fixed.

-- 
Yao (éå)
        gdb/
	* tracepoint.c (process_tracepoint_on_disconnect): New.
	(disconnect_tracing): Call process_tracepoint_on_disconnect.
---
 gdb/tracepoint.c |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index e155515..97ab633 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -1642,6 +1642,48 @@ add_aexpr (struct collection_list *collect, struct agent_expr *aexpr)
   collect->next_aexpr_elt++;
 }
 
+static void
+process_tracepoint_on_disconnect (void)
+{
+  VEC(breakpoint_p) *tp_vec = NULL;
+  int ix;
+  struct breakpoint *b;
+  int has_pending_p = 0;
+
+  /* Check whether we still have pending tracepoint.  If we have, warn the
+     user that pending tracepoint will no longer work.  */
+  tp_vec = all_tracepoints ();
+  for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, b); ix++)
+    {
+      if (b->loc == NULL)
+	{
+	  has_pending_p = 1;
+	  break;
+	}
+      else
+	{
+	  struct bp_location *loc1;
+
+	  for (loc1 = b->loc; loc1; loc1 = loc1->next)
+	    {
+	      if (loc1->shlib_disabled)
+		{
+		  has_pending_p = 1;
+		  break;
+		}
+	    }
+
+	  if (has_pending_p)
+	    break;
+	}
+    }
+  VEC_free (breakpoint_p, tp_vec);
+
+  if (has_pending_p)
+    warning (_("Pending tracepoints will not be resolved while"
+	       " GDB is disconnected\n"));
+}
+
 
 void
 start_tracing (void)
@@ -2020,6 +2062,8 @@ disconnect_tracing (int from_tty)
      disconnected-tracing.  */
   if (current_trace_status ()->running && from_tty)
     {
+      process_tracepoint_on_disconnect ();
+
       if (current_trace_status ()->disconnected_tracing)
 	{
 	  if (!query (_("Trace is running and will "
-- 
1.7.0.4


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