diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2014-02-25 18:32:32 +0100 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2014-02-25 18:32:32 +0100 |
commit | 849c862eb2637990692ffe31d16dc779f9bf30c5 (patch) | |
tree | ca11bd02efb1e2c11afdbd299c79903ad87a7a7c /gdb/testsuite/gdb.base/auto-load.exp | |
parent | e2f0d509b33e91abf99978af5fe8d45240550c35 (diff) | |
download | gdb-849c862eb2637990692ffe31d16dc779f9bf30c5.zip gdb-849c862eb2637990692ffe31d16dc779f9bf30c5.tar.gz gdb-849c862eb2637990692ffe31d16dc779f9bf30c5.tar.bz2 |
PR gdb/16626
Fix auto-load 7.7 regression,
the regression affects any loading from /usr/share/gdb/auto-load .
5b2bf9471f1499bee578fcd60c05afe85794e280 is the first bad commit
commit 5b2bf9471f1499bee578fcd60c05afe85794e280
Author: Doug Evans <xdje42@gmail.com>
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.
gdb/
2014-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
PR gdb/16626
* auto-load.c (auto_load_objfile_script_1): Change filename to
debugfile.
gdb/testsuite/
2014-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
PR gdb/16626
* gdb.base/auto-load-script: New file.
* gdb.base/auto-load.c: New file.
* gdb.base/auto-load.exp: New file.
Message-ID: <20140223212400.GA8831@host2.jankratochvil.net>
Diffstat (limited to 'gdb/testsuite/gdb.base/auto-load.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/auto-load.exp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/auto-load.exp b/gdb/testsuite/gdb.base/auto-load.exp new file mode 100644 index 0000000..226711f --- /dev/null +++ b/gdb/testsuite/gdb.base/auto-load.exp @@ -0,0 +1,41 @@ +# 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 <http://www.gnu.org/licenses/>. + +standard_testfile + +if [is_remote host] { + return 0 +} + +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}" + +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { + return -1 +} + +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" |