From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16304 invoked by alias); 23 Feb 2014 21:24:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 16294 invoked by uid 89); 23 Feb 2014 21:24:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.4 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; Sun, 23 Feb 2014 21:24:06 +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 s1NLO4mS015078 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 23 Feb 2014 16:24:05 -0500 Received: from host2.jankratochvil.net (ovpn-116-18.ams2.redhat.com [10.36.116.18]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s1NLO1NY023346 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sun, 23 Feb 2014 16:24:03 -0500 Date: Sun, 23 Feb 2014 21:24:00 -0000 From: Jan Kratochvil To: Doug Evans Cc: gdb-patches@sourceware.org Subject: [patch+7.7] Fix auto-load 7.7 regression [Re: [commit 2/2] Move processing of .debug_gdb_scripts to auto-load.c] Message-ID: <20140223212400.GA8831@host2.jankratochvil.net> References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="6c2NcOVqGQ03X4Wi" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2014-02/txt/msg00712.txt.bz2 --6c2NcOVqGQ03X4Wi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1785 Hi Doug, the regression affects any loading from /usr/share/gdb/auto-load . 5b2bf9471f1499bee578fcd60c05afe85794e280 is the first bad commit commit 5b2bf9471f1499bee578fcd60c05afe85794e280 Author: Doug Evans Date: Fri Nov 29 21:29:26 2013 -0800 Move .debug_gdb_script processing to auto-load.c. Simplify handling of auto-loaded objfile scripts. Fedora 20 x86_64 $ gdb -q /usr/lib64/libgobject-2.0.so Reading symbols from /usr/lib64/libglib-2.0.so.0.3800.2...Reading symbols from /usr/lib/debug/usr/lib64/libglib-2.0.so.0.3800.2.debug...done. done. (gdb) _ Fedora Rawhide x86_64 $ gdb -q /usr/lib64/libgobject-2.0.so Reading symbols from /usr/lib64/libglib-2.0.so...Reading symbols from /usr/lib/debug/usr/lib64/libglib-2.0.so.0.3990.0.debug...done. done. warning: File "/usr/lib64/libglib-2.0.so.0.3990.0-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load:/usr/bin/mono-gdb.py". To enable execution of this file add add-auto-load-safe-path /usr/lib64/libglib-2.0.so.0.3990.0-gdb.py line to your configuration file "/home/jkratoch/.gdbinit". To completely disable this security protection add set auto-load safe-path / line to your configuration file "/home/jkratoch/.gdbinit". For more information about this security protection see the "Auto-loading safe path" section in the GDB manual. E.g., run from the shell: info "(gdb)Auto-loading safe path" (gdb) _ That is it tries to load "forbidden" /usr/lib64/libglib-2.0.so.0.3990.0-gdb.py but it should load instead /usr/share/gdb/auto-load/usr/lib64/libglib-2.0.so.0.3990.0-gdb.py* Although that is also not exactly this way, there does not exist any /usr/lib64/libglib-2.0.so.0.3990.0-gdb.py despite regressed GDB says so. Regards, Jan --6c2NcOVqGQ03X4Wi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="autoload.patch" Content-length: 4947 gdb/ 2014-02-23 Jan Kratochvil * auto-load.c (auto_load_objfile_script_1): Change filename to debugfile. gdb/testsuite/ 2014-02-23 Jan Kratochvil * gdb.base/auto-load-script: New file. * gdb.base/auto-load.c: New file. * gdb.base/auto-load.exp: New file. diff --git a/gdb/auto-load.c b/gdb/auto-load.c index 86d4e5e..1112ef2 100644 --- a/gdb/auto-load.c +++ b/gdb/auto-load.c @@ -778,17 +778,17 @@ auto_load_objfile_script_1 (struct objfile *objfile, const char *realname, make_cleanup_fclose (input); is_safe - = file_is_auto_load_safe (filename, + = file_is_auto_load_safe (debugfile, _("auto-load: Loading %s script \"%s\"" " by extension for objfile \"%s\".\n"), ext_lang_name (language), - filename, objfile_name (objfile)); + debugfile, objfile_name (objfile)); /* Add this script to the hash table too so "info auto-load ${lang}-scripts" can print it. */ pspace_info = get_auto_load_pspace_data_for_loading (current_program_space); - maybe_add_script (pspace_info, is_safe, filename, filename, language); + maybe_add_script (pspace_info, is_safe, debugfile, debugfile, language); /* To preserve existing behaviour we don't check for whether the script was already in the table, and always load it. diff --git a/gdb/testsuite/gdb.base/auto-load-script b/gdb/testsuite/gdb.base/auto-load-script new file mode 100644 index 0000000..d02bd1a --- /dev/null +++ b/gdb/testsuite/gdb.base/auto-load-script @@ -0,0 +1,17 @@ +# Copyright 2014 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +echo script_loaded\n +set $script_loaded=42 diff --git a/gdb/testsuite/gdb.base/auto-load.c b/gdb/testsuite/gdb.base/auto-load.c new file mode 100644 index 0000000..4b94803 --- /dev/null +++ b/gdb/testsuite/gdb.base/auto-load.c @@ -0,0 +1,22 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2014 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +int +main (void) +{ + return 0; +} diff --git a/gdb/testsuite/gdb.base/auto-load.exp b/gdb/testsuite/gdb.base/auto-load.exp new file mode 100644 index 0000000..9b8211d --- /dev/null +++ b/gdb/testsuite/gdb.base/auto-load.exp @@ -0,0 +1,36 @@ +# Copyright 2014 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +standard_testfile + +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { + return -1 +} + +set targetdir "${binfile}.dir" +set sourcescript "${binfile}-script" +set targetscriptdir "${targetdir}/[file dirname ${sourcescript}]" +set targetscript "${targetscriptdir}/${testfile}-gdb.gdb" + +remote_exec host "rm -rf ${targetdir}" +remote_exec host "mkdir -p ${targetscriptdir}" +remote_exec host "cp ${sourcescript} ${targetscript}" + +gdb_test_no_output "set auto-load scripts-directory ${targetdir}" "set auto-load scripts-directory" +gdb_test_no_output "set auto-load safe-path ${targetscript}" "set auto-load safe-path" + +gdb_load ${binfile} + +gdb_test {print $script_loaded} " = 42" --6c2NcOVqGQ03X4Wi--