From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17734 invoked by alias); 4 Feb 2003 07:14:26 -0000 Mailing-List: contact insight-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: insight-owner@sources.redhat.com Received: (qmail 17720 invoked from network); 4 Feb 2003 07:14:26 -0000 Received: from unknown (HELO mx1.redhat.com) (172.16.49.200) by 172.16.49.205 with SMTP; 4 Feb 2003 07:14:26 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h147EQf06467 for ; Tue, 4 Feb 2003 02:14:26 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h147EPa08491 for ; Tue, 4 Feb 2003 02:14:25 -0500 Received: from dragon (romulus-int.sfbay.redhat.com [172.16.27.46]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h147EPX12753 for ; Tue, 4 Feb 2003 02:14:25 -0500 Subject: [patch] gdb_locate_main optimizations From: "Martin M. Hunt" To: "insight@sources.redhat.com" Content-Type: multipart/mixed; boundary="=-ysodj60EGcEmWI0X2yFq" Date: Tue, 04 Feb 2003 07:14:00 -0000 Message-Id: <1044342870.2678.1.camel@Dragon> Mime-Version: 1.0 X-SW-Source: 2003-q1/txt/msg00069.txt.bz2 --=-ysodj60EGcEmWI0X2yFq Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 353 These changes knock several seconds off startup time on my system. 2003-02-03 Martin M. Hunt * library/interface.tcl (gdbtk_locate_main): Rewrite for efficiency. No longer uses gdb_search. Caches result. (initialize_gdbtk): Initialize gdb_locate_main cache. * library/main.tcl: Call initialize_gdbtk after loading prefs. --=-ysodj60EGcEmWI0X2yFq Content-Disposition: attachment; filename=p Content-Transfer-Encoding: quoted-printable Content-Type: text/x-patch; name=p; charset=UTF-8 Content-length: 3080 Index: library/main.tcl =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/gdbtk/library/main.tcl,v retrieving revision 1.13 diff -u -r1.13 main.tcl --- library/main.tcl 21 Jan 2003 21:58:34 -0000 1.13 +++ library/main.tcl 4 Feb 2003 07:11:30 -0000 @@ -127,9 +127,6 @@ # For testing set _test(interactive) 0 =20 -# initialize state variables -initialize_gdbtk - # set traces on state variables trace variable gdb_running w do_state_hook trace variable gdb_downloading w do_state_hook @@ -149,6 +146,9 @@ pref_read =20 init_disassembly_flavor + +# initialize state variables +initialize_gdbtk =20 # Arrange for session code to notice when file changes. add_hook file_changed_hook Session::notice_file_change Index: library/interface.tcl =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v retrieving revision 1.46 diff -u -r1.46 interface.tcl --- library/interface.tcl 18 Dec 2002 19:35:55 -0000 1.46 +++ library/interface.tcl 4 Feb 2003 07:11:31 -0000 @@ -823,29 +823,35 @@ # 6: shared library name if the pc is in a shared lib # # ------------------------------------------------------------------ -proc gdbtk_locate_main {} { - set result {} - set main_names [pref get gdb/main_names] - debug "Searching $main_names" +proc gdbtk_locate_main {{init ""}} { + global _main_cache gdb_exe_name + debug + + if {$init =3D=3D "" && $_main_cache !=3D ""} { + #debug "returning $_main_cache from cache" + return $_main_cache + } + set _main_cache {} =20 + set main_names [pref get gdb/main_names] foreach main $main_names { - if {![catch {gdb_search functions $main -static 1}] \ - && ![catch {gdb_loc $main} linespec]} { - set result $linespec + if {![catch {gdb_loc $main} linespec]} { + set _main_cache $linespec break } } - if {$result =3D=3D {}=20 + if {$_main_cache =3D=3D {}=20 && ![catch gdb_entry_point entry_point] && ![catch {gdb_loc "*$entry_point"} linespec]} { - set result $linespec + set _main_cache $linespec } =20=20=20 # need to see if result is valid - lassign $result file func ffile line addr rest - if {$addr =3D=3D 0x0 && $func =3D=3D {}} { set result {} } + lassign $_main_cache file func ffile line addr rest + if {$addr =3D=3D 0x0 && $func =3D=3D {}} { set _main_cache {} } =20 - return $result + #debug "returning $_main_cache" + return $_main_cache } =20 ############################################## @@ -1770,6 +1776,9 @@ set gdbtk_state(console) "" set gdbtk_state(readlineShowUser) 1 } + + # flush cache for gdbtk_locate_main + gdbtk_locate_main 1 =20 # check for existence of a kod command and get it's name and # text for menu entry --=-ysodj60EGcEmWI0X2yFq--