From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26226 invoked by alias); 1 Aug 2011 22:10:53 -0000 Received: (qmail 26217 invoked by uid 22791); 1 Aug 2011 22:10:51 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_BT,TW_DB 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; Mon, 01 Aug 2011 22:10:34 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p71MAYLd011737 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 1 Aug 2011 18:10:34 -0400 Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p71MASXc019815 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Mon, 1 Aug 2011 18:10:31 -0400 Message-ID: <4E372454.7010204@redhat.com> Date: Mon, 01 Aug 2011 22:10:00 -0000 From: Keith Seitz User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc15 Lightning/1.0b3pre Thunderbird/3.1.11 MIME-Version: 1.0 To: insight Subject: [PATCH] Recent GDB prompt/bp API updates Content-Type: multipart/mixed; boundary="------------050200040608010202060702" 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-q3/txt/msg00005.txt.bz2 This is a multi-part message in MIME format. --------------050200040608010202060702 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 543 Hi, I've committed the attached patch which fixes some new build failures resulting from API updates in gdb. If there are any problems, please let me know. Keith ChangeLog 2011-08-01 Keith Seitz * generic/gdbtk-bp.c (BREAKPOINT_IS_WATCHPOINT): Remove. (gdb_get_breakpoint_info): Update with recent GDB API changes. (gdb_actions_command): Likewise. (gdb_get_tracepoint_info): Likewise. (breakpoint_notify): Use get_breakpoint. * generic/gdbtk-cmds.c (gdb_prompt_command): Update with recent GDB API changes. --------------050200040608010202060702 Content-Type: text/plain; name="gdb-api-updates.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gdb-api-updates.patch" Content-length: 6705 Index: generic/gdbtk-bp.c =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-bp.c,v retrieving revision 1.41 diff -u -p -r1.41 gdbtk-bp.c --- generic/gdbtk-bp.c 13 May 2011 00:36:26 -0000 1.41 +++ generic/gdbtk-bp.c 1 Aug 2011 22:07:03 -0000 @@ -73,13 +73,6 @@ char *bpdisp[] = || (bp)->type == bp_read_watchpoint \ || (bp)->type == bp_access_watchpoint) -/* Is this breakpoint a watchpoint? */ -#define BREAKPOINT_IS_WATCHPOINT(bp) \ -((bp)->type == bp_watchpoint \ - || (bp)->type == bp_hardware_watchpoint \ - || (bp)->type == bp_read_watchpoint \ - || (bp)->type == bp_access_watchpoint) - /* * Forward declarations */ @@ -287,6 +280,7 @@ gdb_get_breakpoint_info (ClientData clie struct symtab_and_line sal; int bpnum; struct breakpoint *b; + struct watchpoint *w; char *funcname, *filename; int isPending = 0; @@ -304,17 +298,15 @@ gdb_get_breakpoint_info (ClientData clie return TCL_ERROR; } - ALL_BREAKPOINTS (b) - { - if (b->number == bpnum) - break; - } + b = get_breakpoint (bpnum); if (!b || b->type != bp_breakpoint) { gdbtk_set_result (interp, "Breakpoint #%d does not exist.", bpnum); return TCL_ERROR; } + w = (is_watchpoint (b)) ? (struct watchpoint *) b : NULL; + isPending = (b->loc == NULL); Tcl_SetListObj (result_ptr->obj_ptr, 0, NULL); /* Pending breakpoints will display "" as the file name and the @@ -371,8 +363,7 @@ gdb_get_breakpoint_info (ClientData clie Tcl_NewIntObj (b->hit_count)); Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, - Tcl_NewStringObj (BREAKPOINT_IS_WATCHPOINT (b) - ? b->exp_string + Tcl_NewStringObj (w ? w->exp_string : b->addr_string, -1)); return TCL_OK; @@ -604,11 +595,7 @@ breakpoint_notify (int num, const char * char *buf; struct breakpoint *b; - ALL_BREAKPOINTS (b) - { - if (num == b->number) - break; - } + b = get_breakpoint (num); if (b->number < 0 /* FIXME: should not be so restrictive... */ @@ -642,8 +629,8 @@ static int gdb_actions_command (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { - char *number; - struct breakpoint *tp; + int tpnum; + struct tracepoint *tp; struct command_line *commands; if (objc != 3) @@ -652,12 +639,17 @@ gdb_actions_command (ClientData clientDa return TCL_ERROR; } - number = Tcl_GetStringFromObj (objv[1], NULL); - tp = get_tracepoint_by_number (&number, 0, 0); + if (Tcl_GetIntFromObj (NULL, objv[1], &tpnum) != TCL_OK) + { + result_ptr->flags |= GDBTK_IN_TCL_RESULT; + return TCL_ERROR; + } + + tp = get_tracepoint (tpnum); + if (tp == NULL) { - Tcl_AppendStringsToObj (result_ptr->obj_ptr, "Tracepoint \"", - number, "\" does not exist", NULL); + gdbtk_set_result (interp, "Tracepoint #%d does not exist", tpnum); return TCL_ERROR; } @@ -668,7 +660,7 @@ gdb_actions_command (ClientData clientDa commands = read_command_lines_1 (gdbtk_read_next_line, 1, check_tracepoint_command, tp); - breakpoint_set_commands (tp, commands); + breakpoint_set_commands ((struct breakpoint *) tp, commands); return TCL_OK; } @@ -693,7 +685,8 @@ gdb_get_tracepoint_info (ClientData clie { struct symtab_and_line sal; int tpnum; - struct breakpoint *tp; + struct tracepoint *tp; + struct breakpoint *bp; struct command_line *cl; Tcl_Obj *action_list; char *filename, *funcname; @@ -711,7 +704,7 @@ gdb_get_tracepoint_info (ClientData clie } tp = get_tracepoint (tpnum); - + bp = (struct breakpoint *) tp; if (tp == NULL) { gdbtk_set_result (interp, "Tracepoint #%d does not exist", tpnum); @@ -719,37 +712,37 @@ gdb_get_tracepoint_info (ClientData clie } Tcl_SetListObj (result_ptr->obj_ptr, 0, NULL); - sal = find_pc_line (tp->loc->address, 0); + sal = find_pc_line (bp->loc->address, 0); filename = symtab_to_filename (sal.symtab); if (filename == NULL) filename = "N/A"; Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr, Tcl_NewStringObj (filename, -1)); - funcname = pc_function_name (tp->loc->address); + funcname = pc_function_name (bp->loc->address); Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr, Tcl_NewStringObj (funcname, -1)); Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr, Tcl_NewIntObj (sal.line)); Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr, - Tcl_NewStringObj (core_addr_to_string (tp->loc->address), -1)); + Tcl_NewStringObj (core_addr_to_string (bp->loc->address), -1)); Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr, - Tcl_NewIntObj (tp->enable_state == bp_enabled)); + Tcl_NewIntObj (bp->enable_state == bp_enabled)); Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr, Tcl_NewIntObj (tp->pass_count)); Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr, Tcl_NewIntObj (tp->step_count)); Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr, - Tcl_NewIntObj (tp->thread)); + Tcl_NewIntObj (bp->thread)); Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr, - Tcl_NewIntObj (tp->hit_count)); + Tcl_NewIntObj (bp->hit_count)); /* Append a list of actions */ action_list = Tcl_NewObj (); - if (tp->commands != NULL) + if (bp->commands != NULL) { - for (cl = breakpoint_commands (tp); cl != NULL; cl = cl->next) + for (cl = breakpoint_commands (bp); cl != NULL; cl = cl->next) { Tcl_ListObjAppendElement (interp, action_list, Tcl_NewStringObj (cl->line, -1)); Index: generic/gdbtk-cmds.c =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v retrieving revision 1.120 diff -u -p -r1.120 gdbtk-cmds.c --- generic/gdbtk-cmds.c 12 Apr 2011 05:11:08 -0000 1.120 +++ generic/gdbtk-cmds.c 1 Aug 2011 22:07:06 -0000 @@ -224,7 +224,6 @@ static int gdb_disassemble_driver (CORE_ struct disassemble_info *)); -char *get_prompt (void); static int perror_with_name_wrapper (PTR args); static int wrapped_call (PTR opaque_args); static int hex2bin (const char *hex, char *bin, int count); @@ -794,7 +793,7 @@ static int gdb_prompt_command (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { - Tcl_SetStringObj (result_ptr->obj_ptr, get_prompt (), -1); + Tcl_SetStringObj (result_ptr->obj_ptr, get_prompt (0), -1); return TCL_OK; } --------------050200040608010202060702--