This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
RFA: test GDB's ability to find #included source files by name
- From: Jim Blandy <jimb at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: 06 Apr 2004 18:47:10 -0500
- Subject: RFA: test GDB's ability to find #included source files by name
Passes for STABS, fails on Dwarf 2. Filed as symtab/1607.
2004-04-06 Jim Blandy <jimb@redhat.com>
* gdb.base/incfunc.exp, gdb.base/incfunc.c, gdb.base/incfunc2.c:
New test.
Index: gdb/testsuite/gdb.base/incfunc.exp
===================================================================
RCS file: gdb/testsuite/gdb.base/incfunc.exp
diff -N gdb/testsuite/gdb.base/incfunc.exp
*** gdb/testsuite/gdb.base/incfunc.exp 1 Jan 1970 00:00:00 -0000
--- gdb/testsuite/gdb.base/incfunc.exp 6 Apr 2004 23:24:39 -0000
***************
*** 0 ****
--- 1,70 ----
+ # Copyright 2004 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 2 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, write to the Free Software
+ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ # Please email any bugs, comments, and/or additions to this file to:
+ # bug-gdb@gnu.org
+
+ # Make sure GDB's debug information reader includes the names of
+ # header files in the partial symbol table.
+
+ if $tracelevel {
+ strace $tracelevel
+ }
+
+ #
+ # test running programs
+ #
+ set prms_id 0
+ set bug_id 0
+
+ set testfile incfunc
+ set srcfile ${testfile}.c
+ set binfile ${objdir}/${subdir}/${testfile}
+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+ }
+
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load ${binfile}
+
+ if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ continue
+ }
+
+ get_debug_format
+
+ # When we stopped at main, we read full symbols for main's compilation
+ # unit. But the test needs to run before we've read any full symbols,
+ # so re-start GDB.
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load ${binfile}
+
+ if { [test_debug_format "DWARF 2"] } then {
+ setup_kfail "gdb/1607" *-*-*
+ }
+ gdb_test_multiple "break incfunc2.c:4" "set breakpoint in included file" {
+ -re "Breakpoint ${decimal} at ${hex}: file .*incfunc2.c, line .*${gdb_prompt}" {
+ pass "set breakpoint in included file"
+ }
+ -re "Make breakpoint pending on future shared library load. .y or .n.. " {
+ fail "set breakpoint in included file"
+ }
+ }
Index: gdb/testsuite/gdb.base/incfunc2.c
===================================================================
RCS file: gdb/testsuite/gdb.base/incfunc2.c
diff -N gdb/testsuite/gdb.base/incfunc2.c
*** gdb/testsuite/gdb.base/incfunc2.c 1 Jan 1970 00:00:00 -0000
--- gdb/testsuite/gdb.base/incfunc2.c 6 Apr 2004 23:24:39 -0000
***************
*** 0 ****
--- 1,5 ----
+ void
+ f (void)
+ {
+ puts ("Hello.\n");
+ }
Index: gdb/testsuite/gdb.base/incfunc.c
===================================================================
RCS file: gdb/testsuite/gdb.base/incfunc.c
diff -N gdb/testsuite/gdb.base/incfunc.c
*** gdb/testsuite/gdb.base/incfunc.c 1 Jan 1970 00:00:00 -0000
--- gdb/testsuite/gdb.base/incfunc.c 6 Apr 2004 23:24:39 -0000
***************
*** 0 ****
--- 1,8 ----
+ #include <stdio.h>
+ #include "incfunc2.c"
+
+ int
+ main ()
+ {
+ f ();
+ }