From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6586 invoked by alias); 9 Nov 2009 19:43:16 -0000 Received: (qmail 6578 invoked by uid 22791); 9 Nov 2009 19:43:15 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS 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, 09 Nov 2009 19:43:10 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nA9Jh8sN005706 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Mon, 9 Nov 2009 14:43:09 -0500 Received: from [IPv6:::1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nA9Jh5js011547 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 9 Nov 2009 14:43:07 -0500 Message-ID: <4AF870C9.1010406@redhat.com> Date: Mon, 09 Nov 2009 19:43:00 -0000 From: Keith Seitz User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Lightning/1.0pre Thunderbird/3.0b4 MIME-Version: 1.0 To: insight Subject: [PATCH] Update breakpoint methods Content-Type: multipart/mixed; boundary="------------000003000609010100090303" 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: 2009-q4/txt/msg00028.txt.bz2 This is a multi-part message in MIME format. --------------000003000609010100090303 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 922 Hi, Recent snapshot users have probably noticed that breakpoints have been broken for a couple of weeks. This is a direct result of some ancient code in insight which has been using some private gdb code to do its work. I've rewritten these routines to follow the same methodology as the MI code. This should help insulate insight from some gdb churn. If there are any problems with this, please let me know ASAP. I am gearing up for the release candidate (that I promised a week or two ago). Keith ChangeLog 2009-11-09 Keith Seitz * library/srctextwin.itb (lookup_line): Update parameters to gdb_set_bp. * generic/gdbtk-bp.c: Remove extern declarations for symbols in breakpoint.c. (gdb_set_bp_addr): Remove. (Gdbtk_Breakpoint_Init): Remove Tcl command "gdb_set_bp_addr". (gdb_set_bp): Remove file and line arguments; add "addr" argument. Rewrite to use "public" APIs from gdb. --------------000003000609010100090303 Content-Type: text/plain; name="bp.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="bp.patch" Content-length: 7811 Index: library/srctextwin.itb =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/library/srctextwin.itb,v retrieving revision 1.45 diff -u -p -r1.45 srctextwin.itb --- library/srctextwin.itb 9 Oct 2009 02:51:47 -0000 1.45 +++ library/srctextwin.itb 9 Nov 2009 19:34:29 -0000 @@ -1756,10 +1756,10 @@ itcl::body SrcTextWin::lookup_line {win switch $type { asm { - set set_cmd [list gdb_set_bp_addr $addr] + set set_cmd [list gdb_set_bp "*$addr"] } src { - set set_cmd [list gdb_set_bp $current(filename) $addr] + set set_cmd [list gdb_set_bp "$current(filename):$addr"] } } Index: generic/gdbtk-bp.c =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-bp.c,v retrieving revision 1.31 diff -u -p -r1.31 gdbtk-bp.c --- generic/gdbtk-bp.c 7 Jul 2009 12:38:56 -0000 1.31 +++ generic/gdbtk-bp.c 9 Nov 2009 19:34:29 -0000 @@ -1,5 +1,5 @@ /* Tcl/Tk command definitions for Insight - Breakpoints. - Copyright (C) 2001, 2002, 2008 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2008, 2009 Free Software Foundation, Inc. This file is part of GDB. @@ -31,6 +31,7 @@ #include "gdbtk-cmds.h" #include "observer.h" #include "arch-utils.h" +#include "exceptions.h" /* From breakpoint.c */ extern struct breakpoint *breakpoint_chain; @@ -71,17 +72,6 @@ char *bpdisp[] = || (bp)->type == bp_read_watchpoint \ || (bp)->type == bp_access_watchpoint) -/* - * These are routines we need from breakpoint.c. - * at some point make these static in breakpoint.c and move GUI code there - */ - -extern struct breakpoint *set_raw_breakpoint (struct gdbarch *gdbarch, - struct symtab_and_line, - enum bptype); -extern void set_breakpoint_count (int); -extern int breakpoint_count; - /* Breakpoint/Tracepoint lists. Unfortunately, gdb forces us to keep a list of breakpoints, too. Why couldn't it be done like treacepoints? */ @@ -103,8 +93,6 @@ static int gdb_get_breakpoint_info (Clie static int gdb_get_breakpoint_list (ClientData, Tcl_Interp *, int, Tcl_Obj * CONST[]); static int gdb_set_bp (ClientData, Tcl_Interp *, int, Tcl_Obj * CONST objv[]); -static int gdb_set_bp_addr (ClientData, Tcl_Interp *, int, - Tcl_Obj * CONST objv[]); /* Tracepoint-related functions */ static int gdb_actions_command (ClientData, Tcl_Interp *, int, @@ -147,8 +135,6 @@ Gdbtk_Breakpoint_Init (Tcl_Interp *inter Tcl_CreateObjCommand (interp, "gdb_get_breakpoint_list", gdbtk_call_wrapper, gdb_get_breakpoint_list, NULL); Tcl_CreateObjCommand (interp, "gdb_set_bp", gdbtk_call_wrapper, gdb_set_bp, NULL); - Tcl_CreateObjCommand (interp, "gdb_set_bp_addr", gdbtk_call_wrapper, - gdb_set_bp_addr, NULL); /* Tracepoint commands */ Tcl_CreateObjCommand (interp, "gdb_actions", @@ -489,8 +475,7 @@ gdb_get_breakpoint_list (ClientData clie * It sets breakpoints, and notifies the GUI. * * Tcl Arguments: - * filename: the file in which to set the breakpoint - * line: the line number for the breakpoint + * addr: the "address" for the breakpoint (either *ADDR or file:line) * type: the type of the breakpoint * thread: optional thread number * Tcl Result: @@ -500,135 +485,59 @@ static int gdb_set_bp (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { - struct symtab_and_line sal; - int line, thread = -1; - struct breakpoint *b; - char *buf, *typestr; - enum bpdisp disp; + int temp, ignore_count, thread, pending, enabled; + char *address, *typestr, *condition; + struct gdb_exception e; + + /* Insight does not use all of these (yet?). */ + ignore_count = 0; + condition = NULL; + pending = 0; + enabled = 1; - if (objc != 4 && objc != 5) + if (objc != 3 && objc != 4) { - Tcl_WrongNumArgs (interp, 1, objv, "filename line type ?thread?"); + Tcl_WrongNumArgs (interp, 1, objv, "addr type ?thread?"); return TCL_ERROR; } - sal.symtab = lookup_symtab (Tcl_GetStringFromObj (objv[1], NULL)); - if (sal.symtab == NULL) - return TCL_ERROR; - - if (Tcl_GetIntFromObj (interp, objv[2], &line) == TCL_ERROR) + address = Tcl_GetStringFromObj (objv[1], NULL); + if (address == NULL) { result_ptr->flags = GDBTK_IN_TCL_RESULT; return TCL_ERROR; } - typestr = Tcl_GetStringFromObj (objv[3], NULL); + typestr = Tcl_GetStringFromObj (objv[2], NULL); if (strncmp (typestr, "temp", 4) == 0) - disp = disp_del; + temp = 1; else if (strncmp (typestr, "normal", 6) == 0) - disp = disp_donttouch; + temp = 0; else { gdbtk_set_result (interp, "type must be \"temp\" or \"normal\""); return TCL_ERROR; } - if (objc == 5) + if (objc == 4) { - if (Tcl_GetIntFromObj (interp, objv[4], &thread) == TCL_ERROR) + if (Tcl_GetIntFromObj (interp, objv[3], &thread) == TCL_ERROR) { result_ptr->flags = GDBTK_IN_TCL_RESULT; return TCL_ERROR; } } - sal.line = line; - if (!find_line_pc (sal.symtab, sal.line, &sal.pc)) - return TCL_ERROR; - - sal.section = find_pc_overlay (sal.pc); - b = set_raw_breakpoint (get_current_arch (), sal, bp_breakpoint); - set_breakpoint_count (breakpoint_count + 1); - b->number = breakpoint_count; - b->disposition = disp; - b->thread = thread; - - /* FIXME: this won't work for duplicate basenames! */ - buf = xstrprintf ("%s:%d", lbasename (Tcl_GetStringFromObj (objv[1], NULL)), - line); - b->addr_string = xstrdup (buf); - free(buf); - - /* now send notification command back to GUI */ - observer_notify_breakpoint_created (b->number); - return TCL_OK; -} - -/* This implements the tcl command "gdb_set_bp_addr" - * It sets breakpoints, and notifies the GUI. - * - * Tcl Arguments: - * addr: the CORE_ADDR at which to set the breakpoint - * type: the type of the breakpoint - * thread: optional thread number - * Tcl Result: - * The return value of the call to gdbtk_tcl_breakpoint. - */ -static int -gdb_set_bp_addr (ClientData clientData, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]) - -{ - struct symtab_and_line sal; - int thread = -1; - CORE_ADDR addr; - Tcl_WideInt waddr; - struct breakpoint *b; - char *saddr, *typestr; - enum bpdisp disp; - - if (objc != 3 && objc != 4) + TRY_CATCH (e, RETURN_MASK_ALL) { - Tcl_WrongNumArgs (interp, 1, objv, "address type ?thread?"); - return TCL_ERROR; + set_breakpoint (get_current_arch (), address, condition, + 0 /* hardwareflag */, temp, thread, ignore_count, + pending, enabled); } - if (Tcl_GetWideIntFromObj (interp, objv[1], &waddr) != TCL_OK) + if (e.reason < 0) return TCL_ERROR; - addr = waddr; - saddr = Tcl_GetStringFromObj (objv[1], NULL); - - typestr = Tcl_GetStringFromObj (objv[2], NULL); - if (strncmp (typestr, "temp", 4) == 0) - disp = disp_del; - else if (strncmp (typestr, "normal", 6) == 0) - disp = disp_donttouch; - else - { - gdbtk_set_result (interp, "type must be \"temp\" or \"normal\""); - return TCL_ERROR; - } - - if (objc == 4) - { - if (Tcl_GetIntFromObj (interp, objv[3], &thread) == TCL_ERROR) - { - result_ptr->flags = GDBTK_IN_TCL_RESULT; - return TCL_ERROR; - } - } - - sal = find_pc_line (addr, 0); - sal.pc = addr; - b = set_raw_breakpoint (get_current_arch (), sal, bp_breakpoint); - set_breakpoint_count (breakpoint_count + 1); - b->number = breakpoint_count; - b->disposition = disp; - b->thread = thread; - b->addr_string = xstrdup (saddr); - /* now send notification command back to GUI */ - observer_notify_breakpoint_created (b->number); return TCL_OK; } --------------000003000609010100090303--