From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29346 invoked by alias); 13 May 2011 00:37:38 -0000 Received: (qmail 29337 invoked by uid 22791); 13 May 2011 00:37:37 -0000 X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_BT,TW_DB,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 13 May 2011 00:37:19 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4D0bHGZ032712 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 12 May 2011 20:37:17 -0400 Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p4D0bEq4008079 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 12 May 2011 20:37:16 -0400 Message-ID: <4DCC7D3A.5060206@redhat.com> Date: Fri, 13 May 2011 00:37:00 -0000 From: Keith Seitz User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.38.b3pre.fc13 Lightning/1.0b3pre Thunderbird/3.1.9 MIME-Version: 1.0 To: Hui Zhu CC: insight Subject: Re: [BUG] build trunk error References: In-Reply-To: Content-Type: multipart/mixed; boundary="------------040300040304020702010000" X-IsSubscribed: yes Mailing-List: contact insight-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: insight-owner@sourceware.org X-SW-Source: 2011-q2/txt/msg00011.txt.bz2 This is a multi-part message in MIME format. --------------040300040304020702010000 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1266 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 * 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. --------------040300040304020702010000 Content-Type: text/plain; name="bp-callback-update.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="bp-callback-update.patch" Content-length: 8210 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); } /* 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 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); --------------040300040304020702010000--