From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22397 invoked by alias); 7 Jan 2014 19:09:49 -0000 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 Received: (qmail 22353 invoked by uid 89); 7 Jan 2014 19:09:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 07 Jan 2014 19:09:47 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s07J9jUW001096 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 7 Jan 2014 14:09:46 -0500 Received: from barimba (ovpn-113-85.phx2.redhat.com [10.3.113.85]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s07J9iP5025661 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 7 Jan 2014 14:09:45 -0500 From: Tom Tromey To: Insight List Subject: [PATCH] use an observer instead of deprecated_file_changed_hook Date: Tue, 07 Jan 2014 19:09:00 -0000 Message-ID: <871u0jhamf.fsf@fleche.redhat.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2014-q1/txt/msg00000.txt.bz2 This patch changes Insight to use the new_objfile observer rather than deprecated_file_changed_hook. This will let us remove deprecated_file_changed_hook from gdb. I think it works ok. I tested it by running the "file" command in the console and seeing whether insight reacted. I'm not totally sure whether this is a sufficient check, though. Ok? Tom gdb/gdbtk/ChangeLog: 2014-01-07 Tom Tromey * generic/gdbtk-hooks.c (gdbtk_new_objfile): New function. (gdbtk_file_changed): Remove. (gdbtk_add_hooks): Register "new_objfile" observer. Don't set deprecated_file_changed_hook. Index: gdb/gdbtk/generic/gdbtk-hooks.c =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-hooks.c,v retrieving revision 1.60 diff -u -r1.60 gdbtk-hooks.c --- gdb/gdbtk/generic/gdbtk-hooks.c 2 Jul 2013 17:07:29 -0000 1.60 +++ gdb/gdbtk/generic/gdbtk-hooks.c 7 Jan 2014 19:07:52 -0000 @@ -1,7 +1,7 @@ /* Startup code for Insight. Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 200, 2002, 2003, 2004, - 2008, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. + 2008, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc. Written by Stu Grossman of Cygnus Support. @@ -77,7 +77,7 @@ static void gdbtk_trace_start_stop (int, int); static void gdbtk_attach (void); static void gdbtk_detach (void); -static void gdbtk_file_changed (char *); +static void gdbtk_new_objfile (struct objfile *); static void gdbtk_exec_file_display (char *); static void gdbtk_call_command (struct cmd_list_element *, char *, int); static ptid_t gdbtk_wait (ptid_t, struct target_waitstatus *, int); @@ -144,7 +144,8 @@ deprecated_ui_loop_hook = x_event; deprecated_pre_add_symbol_hook = gdbtk_pre_add_symbol; deprecated_post_add_symbol_hook = gdbtk_post_add_symbol; - deprecated_file_changed_hook = gdbtk_file_changed; + observer_attach_new_objfile (gdbtk_new_objfile); + specify_exec_file_hook (gdbtk_exec_file_display); deprecated_trace_find_hook = gdbtk_trace_find; @@ -764,11 +765,12 @@ gdb_context = num; } -/* Called from file_command */ +/* Called from file_command, via the symfile observer. */ static void -gdbtk_file_changed (char *filename) +gdbtk_new_objfile (struct objfile *objfile) { - gdbtk_two_elem_cmd ("gdbtk_tcl_file_changed", filename); + if (objfile == symfile_objfile && objfile != NULL) + gdbtk_two_elem_cmd ("gdbtk_tcl_file_changed", objfile->original_name); } /* Called from exec_file_command */