public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* [BUG] build trunk error
@ 2011-05-09  4:06 Hui Zhu
  2011-05-13  0:37 ` Keith Seitz
  0 siblings, 1 reply; 3+ messages in thread
From: Hui Zhu @ 2011-05-09  4:06 UTC (permalink / raw)
  To: insight

gcc -g -O2   -I. -I../../src/gdb -I../../src/gdb/common
-I../../src/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\""
-DHAVE_CONFIG_H -I../../src/gdb/../include/opcode
-I../../src/gdb/../opcodes/.. -I../../src/gdb/../readline/.. -I../bfd
-I../../src/gdb/../bfd -I../../src/gdb/../include -I../libdecnumber
-I../../src/gdb/../libdecnumber  -I../../src/gdb/gnulib -Ignulib
-DMI_OUT=1 -DTUI=1 -DGDBTK  -Wall -Wdeclaration-after-statement
-Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused
-Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts
-Werror -c -o gdbtk-hooks.o -MT gdbtk-hooks.o -MMD -MP -MF
.deps/gdbtk-hooks.Tpo -I../../src/gdb/../libgui/src
-I/home/teawater/gdb/cvs/src/tcl/generic
-I/home/teawater/gdb/cvs/src/tk/generic
-DGDBTK_LIBRARY=\"/usr/local/share/insight1.0\"
-DSRC_DIR=\"/home/teawater/gdb/cvs/src/gdb\"
../../src/gdb/gdbtk/generic/gdbtk-hooks.c
cc1: warnings being treated as errors
../../src/gdb/gdbtk/generic/gdbtk-hooks.c: In function 'gdbtk_add_hooks':
../../src/gdb/gdbtk/generic/gdbtk-hooks.c:126: error: passing argument
1 of 'observer_attach_breakpoint_created' from incompatible pointer
type
./observer.h:134: note: expected 'void (*)(struct breakpoint *)' but
argument is of type 'void (*)(int)'
../../src/gdb/gdbtk/generic/gdbtk-hooks.c:127: error: passing argument
1 of 'observer_attach_breakpoint_modified' from incompatible pointer
type
./observer.h:150: note: expected 'void (*)(struct breakpoint *)' but
argument is of type 'void (*)(int)'
../../src/gdb/gdbtk/generic/gdbtk-hooks.c:128: error: passing argument
1 of 'observer_attach_breakpoint_deleted' from incompatible pointer
type
./observer.h:142: note: expected 'void (*)(struct breakpoint *)' but
argument is of type 'void (*)(int)'
make: *** [gdbtk-hooks.o] Error 1

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

* Re: [BUG] build trunk error
  2011-05-09  4:06 [BUG] build trunk error Hui Zhu
@ 2011-05-13  0:37 ` Keith Seitz
  2011-05-14  3:42   ` Hui Zhu
  0 siblings, 1 reply; 3+ messages in thread
From: Keith Seitz @ 2011-05-13  0:37 UTC (permalink / raw)
  To: Hui Zhu; +Cc: insight

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

On 05/08/2011 09:05 PM, Hui Zhu wrote:
> ../../src/gdb/gdbtk/generic/gdbtk-hooks.c: In function 'gdbtk_add_hooks':
> ../../src/gdb/gdbtk/generic/gdbtk-hooks.c:126: error: passing argument
> 1 of 'observer_attach_breakpoint_created' from incompatible pointer
> type

[snip]

I've committed the attached patch to address this. IMO this patch should 
have been necessary years ago! [Better late than never, gdb! :-)]

Thank you for notifying me.

Keith

ChangeLog
2011-05-12  Keith Seitz  <keiths@redhat.com>

	* generic/gdbtk-hooks.c (gdbtk_create_breakpoint): Change
	parameter from `int' to `struct breakpoint *'.
	(gdbtk_delete_breakpoint): Likewise.
	(gdbtk_modify_breakpoint): Likewise.
	* generic/gdbtk-bp.c (ALL_BREAKPOINTS): Define.
	(breakpoint_list): Remove.
	(breakpoint_list_size): Remove.
	(Gdbtk_Breakpoint_Init): Remove initialization of breakpoint_list.
	(gdb_find_bp_at_addr): Rewrite using ALL_BREAKPOINTS.
	(gdb_find_bp_at_line): Likewise.
	(gdb_get_breakpoint_info): Likewise.
	(gdb_get_breakpoint_list): Likewise.
	(gdbtk_create_breakpoint): Change parameter from `int' to
	`struct breakpoint *' and update function.
	(gdbtk_delete_breakpoint): Likewise.
	(gdbtk_modify_breakpoint): Likewise.	
	(breakpoint_notify): Rewrite using ALL_BREAKPOINTS.

[-- Attachment #2: bp-callback-update.patch --]
[-- Type: text/plain, Size: 8210 bytes --]

Index: generic/gdbtk-bp.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-bp.c,v
retrieving revision 1.40
diff -u -p -r1.40 gdbtk-bp.c
--- generic/gdbtk-bp.c	12 Apr 2011 05:11:08 -0000	1.40
+++ generic/gdbtk-bp.c	13 May 2011 00:33:04 -0000
@@ -42,6 +42,8 @@ static int gdbtk_obj_array_ptr;
 /* From breakpoint.c */
 extern struct breakpoint *breakpoint_chain;
 
+#define ALL_BREAKPOINTS(B)  for (B = breakpoint_chain; B; B = B->next)
+
 /* From gdbtk-hooks.c */
 extern void report_error (void);
 
@@ -78,13 +80,6 @@ char *bpdisp[] =
  || (bp)->type == bp_read_watchpoint					      \
  || (bp)->type == bp_access_watchpoint)
 
-/* Breakpoint/Tracepoint lists. Unfortunately, gdb forces us to
-   keep a list of breakpoints, too. Why couldn't it be done like
-   treacepoints? */
-#define DEFAULT_LIST_SIZE 32
-static struct breakpoint **breakpoint_list;
-static int breakpoint_list_size = DEFAULT_LIST_SIZE;
-
 /*
  * Forward declarations
  */
@@ -119,9 +114,9 @@ static int tracepoint_exists (char *args
 
 /* Breakpoint/tracepoint events and related functions */
 
-void gdbtk_create_breakpoint (int);
-void gdbtk_delete_breakpoint (int);
-void gdbtk_modify_breakpoint (int);
+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);
@@ -156,10 +151,6 @@ Gdbtk_Breakpoint_Init (Tcl_Interp *inter
   Tcl_CreateObjCommand (interp, "gdb_tracepoint_exists",
 			gdbtk_call_wrapper, gdb_tracepoint_exists_command, NULL);
 
-  /* Initialize our tables of BPs. */
-  breakpoint_list = (struct breakpoint **) xmalloc (breakpoint_list_size * sizeof (struct breakpoint *));
-  memset (breakpoint_list, 0, breakpoint_list_size * sizeof (struct breakpoint *));
-
   return TCL_OK;
 }
 
@@ -209,9 +200,9 @@ static int
 gdb_find_bp_at_addr (ClientData clientData, Tcl_Interp *interp,
 		     int objc, Tcl_Obj *CONST objv[])
 {
-  int i;
   CORE_ADDR addr;
   Tcl_WideInt waddr;
+  struct breakpoint *b;
 
   if (objc != 2)
     {
@@ -224,12 +215,11 @@ gdb_find_bp_at_addr (ClientData clientDa
   addr = waddr;
 
   Tcl_SetListObj (result_ptr->obj_ptr, 0, NULL);
-  for (i = 0; i < breakpoint_list_size; i++)
+  ALL_BREAKPOINTS (b)
     {
-      if (breakpoint_list[i] != NULL && breakpoint_list[i]->loc != NULL
-	  && breakpoint_list[i]->loc->address == addr)
+      if (b->loc != NULL && b->loc->address == addr)
 	Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr,
-				  Tcl_NewIntObj (i));
+				  Tcl_NewIntObj (b->number));
     }
 
   return TCL_OK;
@@ -249,7 +239,8 @@ gdb_find_bp_at_line (ClientData clientDa
 
 {
   struct symtab *s;
-  int i, line;
+  int line;
+  struct breakpoint *b;
 
   if (objc != 3)
     {
@@ -268,12 +259,14 @@ gdb_find_bp_at_line (ClientData clientDa
     }
 
   Tcl_SetListObj (result_ptr->obj_ptr, 0, NULL);
-  for (i = 0; i < breakpoint_list_size; i++)
-    if (breakpoint_list[i] != NULL
-	&& breakpoint_list[i]->line_number == line
-	&& !strcmp (breakpoint_list[i]->source_file, s->filename))
-      Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr,
-				Tcl_NewIntObj (i));
+  ALL_BREAKPOINTS (b)
+  {
+    if (b->line_number == line && !strcmp (b->source_file, s->filename))
+      {
+	Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr,
+				  Tcl_NewIntObj (b->number));
+      }
+  }
 
   return TCL_OK;
 }
@@ -311,7 +304,11 @@ gdb_get_breakpoint_info (ClientData clie
       return TCL_ERROR;
     }
 
-  b = (bpnum <= breakpoint_list_size ? breakpoint_list[bpnum] : NULL);
+  ALL_BREAKPOINTS (b)
+  {
+    if (b->number == bpnum)
+      break;
+  }
   if (!b || b->type != bp_breakpoint)
     {
       gdbtk_set_result (interp, "Breakpoint #%d does not exist.", bpnum);
@@ -466,8 +463,8 @@ static int
 gdb_get_breakpoint_list (ClientData clientData, Tcl_Interp *interp,
 			 int objc, Tcl_Obj *CONST objv[])
 {
-  int i;
   Tcl_Obj *new_obj;
+  struct breakpoint *b;
 
   if (objc != 1)
     {
@@ -475,15 +472,14 @@ gdb_get_breakpoint_list (ClientData clie
       return TCL_ERROR;
     }
 
-  for (i = 0; i < breakpoint_list_size; i++)
-    {
-      if (breakpoint_list[i] != NULL
-	  && breakpoint_list[i]->type == bp_breakpoint)
-	{
-	  new_obj = Tcl_NewIntObj (i);
-	  Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, new_obj);
-	}
-    }
+  ALL_BREAKPOINTS (b)
+  {
+    if (b->type == bp_breakpoint)
+      {
+	new_obj = Tcl_NewIntObj (b->number);
+	Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, new_obj);
+      }
+  }
 
   return TCL_OK;
 }
@@ -575,49 +571,25 @@ gdb_set_bp (ClientData clientData, Tcl_I
  */
 
 void
-gdbtk_create_breakpoint (int num)
+gdbtk_create_breakpoint (struct breakpoint *b)
 {
-  struct breakpoint *b;
-  for (b = breakpoint_chain; b != NULL; b = b->next)
-    {
-      if (b->number == num)
-	break;
-    }
-
   if (b == NULL || !BREAKPOINT_IS_INTERESTING (b))
     return;
 
-  /* Check if there is room to store it */
-  if (num >= breakpoint_list_size)
-    {
-      int oldsize = breakpoint_list_size;
-      while (num >= breakpoint_list_size)
-	breakpoint_list_size += DEFAULT_LIST_SIZE;
-      breakpoint_list = (struct breakpoint **) xrealloc (breakpoint_list, breakpoint_list_size * sizeof (struct breakpoint *));
-      memset (&(breakpoint_list[oldsize]), 0, (breakpoint_list_size - oldsize) * sizeof (struct breakpoint *));
-    }
-
-  breakpoint_list[num] = b;
-  breakpoint_notify (num, "create");
+  breakpoint_notify (b->number, "create");
 }
 
 void
-gdbtk_delete_breakpoint (int num)
+gdbtk_delete_breakpoint (struct breakpoint *b)
 {
-  if (num >= 0
-      && num <= breakpoint_list_size
-      && breakpoint_list[num] != NULL)
-    {
-      breakpoint_notify (num, "delete");
-      breakpoint_list[num] = NULL;
-    }
+  breakpoint_notify (b->number, "delete");
 }
 
 void
-gdbtk_modify_breakpoint (int num)
+gdbtk_modify_breakpoint (struct breakpoint *b)
 {
-  if (num >= 0)
-    breakpoint_notify (num, "modify");
+  if (b->number >= 0)
+    breakpoint_notify (b->number, "modify");
 }
 
 /* This is the generic function for handling changes in
@@ -630,21 +602,26 @@ static void
 breakpoint_notify (int num, const char *action)
 {
   char *buf;
+  struct breakpoint *b;
 
-  if (num > breakpoint_list_size
-      || num < 0
-      || breakpoint_list[num] == NULL
+  ALL_BREAKPOINTS (b)
+  {
+    if (num == b->number)
+      break;
+  }
+
+  if (b->number < 0
       /* FIXME: should not be so restrictive... */
-      || breakpoint_list[num]->type != bp_breakpoint)
+      || b->type != bp_breakpoint)
     return;
 
   /* We ensure that ACTION contains no special Tcl characters, so we
      can do this.  */
-  buf = xstrprintf ("gdbtk_tcl_breakpoint %s %d", action, num);
+  buf = xstrprintf ("gdbtk_tcl_breakpoint %s %d", action, b->number);
 
   if (Tcl_Eval (gdbtk_interp, buf) != TCL_OK)
     report_error ();
-  free(buf); 
+  xfree(buf); 
 }
 \f
 /*
Index: generic/gdbtk-hooks.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-hooks.c,v
retrieving revision 1.51
diff -u -p -r1.51 gdbtk-hooks.c
--- generic/gdbtk-hooks.c	2 Dec 2010 06:48:00 -0000	1.51
+++ generic/gdbtk-hooks.c	13 May 2011 00:33:05 -0000
@@ -1,7 +1,7 @@
 /* Startup code for Insight.
 
    Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 200, 2002, 2003, 2004,
-   2008, 2010 Free Software Foundation, Inc.
+   2008, 2010, 2011 Free Software Foundation, Inc.
 
    Written by Stu Grossman <grossman@cygnus.com> of Cygnus Support.
 
@@ -68,9 +68,9 @@ volatile int in_fputs = 0;
 int gdbtk_force_detach = 0;
 
 /* From gdbtk-bp.c */
-extern void gdbtk_create_breakpoint (int);
-extern void gdbtk_delete_breakpoint (int);
-extern void gdbtk_modify_breakpoint (int);
+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);

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

* Re: [BUG] build trunk error
  2011-05-13  0:37 ` Keith Seitz
@ 2011-05-14  3:42   ` Hui Zhu
  0 siblings, 0 replies; 3+ messages in thread
From: Hui Zhu @ 2011-05-14  3:42 UTC (permalink / raw)
  To: Keith Seitz; +Cc: insight

Thanks Keith.  My part is OK.

Best,
Hui

On Fri, May 13, 2011 at 08:37, Keith Seitz <keiths@redhat.com> wrote:
> On 05/08/2011 09:05 PM, Hui Zhu wrote:
>>
>> ../../src/gdb/gdbtk/generic/gdbtk-hooks.c: In function 'gdbtk_add_hooks':
>> ../../src/gdb/gdbtk/generic/gdbtk-hooks.c:126: error: passing argument
>> 1 of 'observer_attach_breakpoint_created' from incompatible pointer
>> type
>
> [snip]
>
> I've committed the attached patch to address this. IMO this patch should
> have been necessary years ago! [Better late than never, gdb! :-)]
>
> Thank you for notifying me.
>
> Keith
>
> ChangeLog
> 2011-05-12  Keith Seitz  <keiths@redhat.com>
>
>        * generic/gdbtk-hooks.c (gdbtk_create_breakpoint): Change
>        parameter from `int' to `struct breakpoint *'.
>        (gdbtk_delete_breakpoint): Likewise.
>        (gdbtk_modify_breakpoint): Likewise.
>        * generic/gdbtk-bp.c (ALL_BREAKPOINTS): Define.
>        (breakpoint_list): Remove.
>        (breakpoint_list_size): Remove.
>        (Gdbtk_Breakpoint_Init): Remove initialization of breakpoint_list.
>        (gdb_find_bp_at_addr): Rewrite using ALL_BREAKPOINTS.
>        (gdb_find_bp_at_line): Likewise.
>        (gdb_get_breakpoint_info): Likewise.
>        (gdb_get_breakpoint_list): Likewise.
>        (gdbtk_create_breakpoint): Change parameter from `int' to
>        `struct breakpoint *' and update function.
>        (gdbtk_delete_breakpoint): Likewise.
>        (gdbtk_modify_breakpoint): Likewise.
>        (breakpoint_notify): Rewrite using ALL_BREAKPOINTS.
>

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

end of thread, other threads:[~2011-05-14  3:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-09  4:06 [BUG] build trunk error Hui Zhu
2011-05-13  0:37 ` Keith Seitz
2011-05-14  3:42   ` Hui Zhu

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).