public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* Recent tracepoint changes in gdb
@ 2012-11-05 11:43 Roland Schwingel
  2012-11-05 15:37 ` Keith Seitz
  0 siblings, 1 reply; 4+ messages in thread
From: Roland Schwingel @ 2012-11-05 11:43 UTC (permalink / raw)
  To: insight

Hi...

Since November 3rd insight is no longer compiling against current gdb 
head sources. This is reasoned by changes to fix this bug:

http://sourceware.org/bugzilla/show_bug.cgi?id=14617

gdb removed the tracepoint observers. The single occurrance of 
observer_notify_tracepoint_modified() in breakpoint.c was moved to
observer_notify_breakpoint_modified().

I was investigating history...
There are 3 actions for dealing with tracepoints.
tracepoint_created
tracepoint_modified
tracepoint_deleted

I was searching gdb 6.8/7.0/7.3/head and I could only find
the tracepoint_modified action to be used ever.

Thus this leads me the conclusion that the WHOLE tracepoint
support in insight could be removed at all.

A quick fix to get insight to compile again would be to remove the 
observer attaching in gdbtk-hooks.c for the 3 tracepoint hooks but it 
might be cleaner to remove the existing tracepoint support at all.

Or am I missing something here?

Roland






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

* Re: Recent tracepoint changes in gdb
  2012-11-05 11:43 Recent tracepoint changes in gdb Roland Schwingel
@ 2012-11-05 15:37 ` Keith Seitz
  2012-11-10 17:51   ` Keith Seitz
  0 siblings, 1 reply; 4+ messages in thread
From: Keith Seitz @ 2012-11-05 15:37 UTC (permalink / raw)
  To: Roland Schwingel; +Cc: insight

On 11/05/2012 03:43 AM, Roland Schwingel wrote:
> Thus this leads me the conclusion that the WHOLE tracepoint
> support in insight could be removed at all.

Actually what they did is reroute those notifications through the 
breakpoint notifier. Internally to gdb, tracepoints, probes, and 
breakpoints are all the same, just subclasses each other (in an ugly 
C-ish way).

Thanks for pointing this out, I will work on a patch.

Keith

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

* Re: Recent tracepoint changes in gdb
  2012-11-05 15:37 ` Keith Seitz
@ 2012-11-10 17:51   ` Keith Seitz
  2012-11-10 18:10     ` Keith Seitz
  0 siblings, 1 reply; 4+ messages in thread
From: Keith Seitz @ 2012-11-10 17:51 UTC (permalink / raw)
  To: Roland Schwingel; +Cc: insight

[-- Attachment #1: Type: text/plain, Size: 560 bytes --]

On 11/05/2012 07:37 AM, Keith Seitz wrote:
> Thanks for pointing this out, I will work on a patch.

Here is the patch. Let me know if there are any further difficulties.

Keith

ChangeLog
2012-11-10  Keith Seitz  <keiths@redhat.com>

	* generic/gdbtk-bp.c (breakpoint_notify): Handle tracepoints, too.
	(tracepoint_notify): Remove.
	(gdbtk_create_tracepoint): Remove.
	(gdbtk_delete_tracepoint): Remove.
	(gdbtk_modify_tracepoint): Remove.
	* generic/gdbtk-hooks.c: Remove deleted function extern declarations.
	(gdbtk_add_hooks): Remove tracepoint observers.

[-- Attachment #2: rm-tp-observers.patch --]
[-- Type: text/x-patch, Size: 4876 bytes --]

diff --git a/gdb/gdbtk/generic/gdbtk-bp.c b/gdb/gdbtk/generic/gdbtk-bp.c
index 2a0e056..8e752f1 100644
--- a/gdb/gdbtk/generic/gdbtk-bp.c
+++ b/gdb/gdbtk/generic/gdbtk-bp.c
@@ -109,11 +109,7 @@ static int tracepoint_exists (char *args);
 void gdbtk_create_breakpoint (struct breakpoint *);
 void gdbtk_delete_breakpoint (struct breakpoint *);
 void gdbtk_modify_breakpoint (struct breakpoint *);
-void gdbtk_create_tracepoint (int);
-void gdbtk_delete_tracepoint (int);
-void gdbtk_modify_tracepoint (int);
 static void breakpoint_notify (int, const char *);
-static void tracepoint_notify (int, const char *);
 
 int
 Gdbtk_Breakpoint_Init (Tcl_Interp *interp)
@@ -586,7 +582,7 @@ gdbtk_modify_breakpoint (struct breakpoint *b)
 
 /* This is the generic function for handling changes in
  * a breakpoint.  It routes the information to the Tcl
- * command "gdbtk_tcl_breakpoint" in the form:
+ * command "gdbtk_tcl_breakpoint" (or "gdbtk_tcl_tracepoint") in the form:
  *   gdbtk_tcl_breakpoint action b_number b_address b_line b_file
  * On error, the error string is written to gdb_stdout.
  */
@@ -597,15 +593,29 @@ breakpoint_notify (int num, const char *action)
   struct breakpoint *b;
 
   b = get_breakpoint (num);
+  if (b == NULL)
+    {
+      struct tracepoint *tp;
+
+      tp = get_tracepoint (num);
+      if (tp == NULL)
+	return;
+      b = &tp->base;
+    }
 
   if (b->number < 0
       /* FIXME: should not be so restrictive... */
-      || b->type != bp_breakpoint)
+      && b->type != bp_breakpoint
+      && b->type != bp_tracepoint
+      && b->type != bp_fast_tracepoint)
     return;
 
   /* We ensure that ACTION contains no special Tcl characters, so we
      can do this.  */
-  buf = xstrprintf ("gdbtk_tcl_breakpoint %s %d", action, b->number);
+  if (b->type == bp_breakpoint)
+    buf = xstrprintf ("gdbtk_tcl_breakpoint %s %d", action, b->number);
+  else
+    buf = xstrprintf ("gdbtk_tcl_tracepoint %s %d", action, b->number);
 
   if (Tcl_Eval (gdbtk_interp, buf) != TCL_OK)
     report_error ();
@@ -854,40 +864,3 @@ gdb_tracepoint_exists_command (ClientData clientData,
   Tcl_SetIntObj (result_ptr->obj_ptr, tracepoint_exists (args));
   return TCL_OK;
 }
-\f
-/*
- * This section contains functions which deal with tracepoint
- * events from gdb.
- */
-
-void
-gdbtk_create_tracepoint (int num)
-{
-  tracepoint_notify (num, "create");
-}
-
-void
-gdbtk_delete_tracepoint (int num)
-{
-  tracepoint_notify (num, "delete");
-}
-
-void
-gdbtk_modify_tracepoint (int num)
-{
-  tracepoint_notify (num, "modify");
-}
-
-static void
-tracepoint_notify (int num, const char *action)
-{
-  char *buf;
-
-  /* We ensure that ACTION contains no special Tcl characters, so we
-     can do this.  */
-  buf = xstrprintf ("gdbtk_tcl_tracepoint %s %d", action, num);
-
-  if (Tcl_Eval (gdbtk_interp, buf) != TCL_OK)
-    report_error ();
-  free(buf); 
-}
diff --git a/gdb/gdbtk/generic/gdbtk-hooks.c b/gdb/gdbtk/generic/gdbtk-hooks.c
index d27b9df..2ac6312 100644
--- a/gdb/gdbtk/generic/gdbtk-hooks.c
+++ b/gdb/gdbtk/generic/gdbtk-hooks.c
@@ -71,9 +71,6 @@ int gdbtk_force_detach = 0;
 extern void gdbtk_create_breakpoint (struct breakpoint *);
 extern void gdbtk_delete_breakpoint (struct breakpoint *);
 extern void gdbtk_modify_breakpoint (struct breakpoint *);
-extern void gdbtk_create_tracepoint (int);
-extern void gdbtk_delete_tracepoint (int);
-extern void gdbtk_modify_tracepoint (int);
 
 static void gdbtk_architecture_changed (struct gdbarch *);
 static void gdbtk_trace_find (char *arg, int from_tty);
@@ -126,9 +123,6 @@ gdbtk_add_hooks (void)
   observer_attach_breakpoint_created (gdbtk_create_breakpoint);
   observer_attach_breakpoint_modified (gdbtk_modify_breakpoint);
   observer_attach_breakpoint_deleted (gdbtk_delete_breakpoint);
-  observer_attach_tracepoint_created (gdbtk_create_tracepoint);
-  observer_attach_tracepoint_modified (gdbtk_modify_tracepoint);
-  observer_attach_tracepoint_deleted (gdbtk_delete_tracepoint);
   observer_attach_architecture_changed (gdbtk_architecture_changed);
   observer_attach_memory_changed (gdbtk_memory_changed);
 
diff --git a/gdb/gdbtk/library/CVS/Entries b/gdb/gdbtk/library/CVS/Entries
index 7c94873..027fe00 100644
--- a/gdb/gdbtk/library/CVS/Entries
+++ b/gdb/gdbtk/library/CVS/Entries
@@ -34,7 +34,6 @@ D/images2////
 /gdbwin.ith/1.5/Thu Mar 29 20:19:15 2012/-ko/
 /globalpref.ith/1.5/Thu Mar 29 20:19:16 2012/-ko/
 /helpviewer.tcl/1.5/Thu Mar 29 20:19:15 2012//
-/interface.tcl/1.60/Thu Mar 29 20:19:15 2012/-ko/
 /ipc.tcl/1.2/Thu Mar 29 20:19:15 2012//
 /ipcpref.itb/1.2/Thu Mar 29 20:19:15 2012//
 /ipcpref.ith/1.2/Thu Mar 29 20:19:16 2012//
@@ -80,3 +79,4 @@ D/images2////
 /stackwin.itb/1.14/Wed Oct 10 15:53:33 2012/-ko/
 /stackwin.ith/1.8/Wed Oct 10 15:53:33 2012/-ko/
 /vartree.itb/1.10/Wed Oct 10 15:53:33 2012//
+/interface.tcl/1.60/Sat Nov 10 17:39:03 2012/-ko/

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

* Re: Recent tracepoint changes in gdb
  2012-11-10 17:51   ` Keith Seitz
@ 2012-11-10 18:10     ` Keith Seitz
  0 siblings, 0 replies; 4+ messages in thread
From: Keith Seitz @ 2012-11-10 18:10 UTC (permalink / raw)
  To: insight

On 11/10/2012 09:50 AM, Keith Seitz wrote:
> On 11/05/2012 07:37 AM, Keith Seitz wrote:
>> Thanks for pointing this out, I will work on a patch.
>
> Here is the patch. Let me know if there are any further difficulties.

Gah! And there was a logic bug in that patch. This patch fixes that.

Keith

ChangeLog
2012-11-10  Keith Seitz  <keiths@redhat.com>

	* generic/gdbtk-bp.c (breakpoint_notify): Fix logic error
	when detecting breakpoint types to be handled.

diff --git a/gdb/gdbtk/generic/gdbtk-bp.c b/gdb/gdbtk/generic/gdbtk-bp.c
index 8e752f1..c6e2df9 100644
--- a/gdb/gdbtk/generic/gdbtk-bp.c
+++ b/gdb/gdbtk/generic/gdbtk-bp.c
@@ -605,9 +605,9 @@ breakpoint_notify (int num, const char *action)

    if (b->number < 0
        /* FIXME: should not be so restrictive... */
-      && b->type != bp_breakpoint
-      && b->type != bp_tracepoint
-      && b->type != bp_fast_tracepoint)
+      || (b->type != bp_breakpoint
+         && b->type != bp_tracepoint
+         && b->type != bp_fast_tracepoint))
      return;

    /* We ensure that ACTION contains no special Tcl characters, so we

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

end of thread, other threads:[~2012-11-10 18:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-05 11:43 Recent tracepoint changes in gdb Roland Schwingel
2012-11-05 15:37 ` Keith Seitz
2012-11-10 17:51   ` Keith Seitz
2012-11-10 18:10     ` Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).