aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2007-01-21 16:49:40 +0000
committerDaniel Jacobowitz <drow@false.org>2007-01-21 16:49:40 +0000
commitcb1df416fb6d2cc4837a8f81c5f102821c02db93 (patch)
tree4121c2130d5016d17bb765aafc6399b46742397d /gdb/testsuite
parent727da90068091580ad9cea2a18cd95234b600d21 (diff)
downloadgdb-cb1df416fb6d2cc4837a8f81c5f102821c02db93.zip
gdb-cb1df416fb6d2cc4837a8f81c5f102821c02db93.tar.gz
gdb-cb1df416fb6d2cc4837a8f81c5f102821c02db93.tar.bz2
2007-01-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com> * buildsym.c (end_symtab): Use preallocated symtab if available. Fill in SYMBOL_SYMTAB. * buildsym.h (struct subfile): Add symtab member. * dwarf2read.c (struct dwarf2_cu): Add line_header. (struct file_entry): Add symtab. (free_cu_line_header): New function. (read_file_scope): Use it. Save line_header in the cu. Process lines before DIEs. (add_file_name): Initialize new symtab member. (dwarf_decode_lines): Create symtabs for included files. (new_symbol): Set SYMBOL_SYMTAB. * symtab.c (lookup_symbol): Use SYMBOL_SYMTAB. (search_symbols): Likewise. * symtab.h (struct symbol): Add symtab member. (SYMBOL_SYMTAB): Define. * gdb.base/included.c, gdb.base/included.exp, gdb.base/included.h: New files.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.base/included.c26
-rw-r--r--gdb/testsuite/gdb.base/included.exp46
-rw-r--r--gdb/testsuite/gdb.base/included.h20
4 files changed, 98 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index c876e51..e45b6c3 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2007-01-21 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Daniel Jacobowitz <dan@codesourcery.com>
+
+ * gdb.base/included.c, gdb.base/included.exp,
+ gdb.base/included.h: New files.
+
2007-01-20 Daniel Jacobowitz <dan@codesourcery.com>
* gdb.base/bigcore.c (RLIMIT_CAP): Define.
diff --git a/gdb/testsuite/gdb.base/included.c b/gdb/testsuite/gdb.base/included.c
new file mode 100644
index 0000000..677290b
--- /dev/null
+++ b/gdb/testsuite/gdb.base/included.c
@@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2007 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. */
+
+#include "included.h"
+
+int
+main()
+{
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/included.exp b/gdb/testsuite/gdb.base/included.exp
new file mode 100644
index 0000000..c3ed857
--- /dev/null
+++ b/gdb/testsuite/gdb.base/included.exp
@@ -0,0 +1,46 @@
+# Copyright 2007 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.
+
+set testfile "included"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested included.exp
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+gdb_test "set listsize 1" ""
+
+gdb_test "list main" ".*"
+get_debug_format
+set non_dwarf [expr ! [test_debug_format "DWARF 2"]]
+
+# We should be able to find the source file containing the definition,
+# even though it was an included header.
+if { $non_dwarf } { setup_xfail *-*-* }
+gdb_test "list integer" "int integer;"
+
+gdb_test "ptype integer" "type = int"
+
+# We should report that integer comes from the header file.
+if { $non_dwarf } { setup_xfail *-*-* }
+gdb_test "info variables integer" "\r\nFile \[^\r\n\]*/${subdir}/${testfile}.h:\r\nint integer;"
diff --git a/gdb/testsuite/gdb.base/included.h b/gdb/testsuite/gdb.base/included.h
new file mode 100644
index 0000000..130fc7f
--- /dev/null
+++ b/gdb/testsuite/gdb.base/included.h
@@ -0,0 +1,20 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2007 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. */
+
+int integer;