diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5f840aa06ad..062569575f2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2014-02-25 Jan Kratochvil + + PR gdb/16626 + * auto-load.c (auto_load_objfile_script_1): Change filename to + debugfile. + 2014-02-09 Jan Kratochvil Fix Python stack corruption. diff --git a/gdb/auto-load.c b/gdb/auto-load.c index fd612b2a3b1..62a7de4aa9c 100644 --- a/gdb/auto-load.c +++ b/gdb/auto-load.c @@ -791,17 +791,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"), - language->name, filename, + language->name, 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/ChangeLog b/gdb/testsuite/ChangeLog index d7eaa39af87..c9b65b2c6f7 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2014-02-25 Jan Kratochvil + + PR gdb/16626 + * gdb.base/auto-load-script: New file. + * gdb.base/auto-load.c: New file. + * gdb.base/auto-load.exp: New file. + 2014-02-05 Yao Qi * gdb.trace/report.exp (use_collected_data): Test the output diff --git a/gdb/testsuite/gdb.base/auto-load-script b/gdb/testsuite/gdb.base/auto-load-script new file mode 100644 index 00000000000..d02bd1abf68 --- /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 00000000000..4b948035d16 --- /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 00000000000..226711f5156 --- /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 . + +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"