aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorDoug Evans <xdje42@gmail.com>2014-11-15 10:08:34 -0800
committerDoug Evans <xdje42@gmail.com>2014-11-15 10:08:34 -0800
commit34248c3af73049fe1f8b7a4b9eb7ae09f42eed95 (patch)
tree4ee18ab40e0acfad0e4524ba74c58005394b8752 /gdb/testsuite
parent2097ae2584c1018a7a58d93d9edd7f6d1d9654c8 (diff)
downloadgdb-34248c3af73049fe1f8b7a4b9eb7ae09f42eed95.zip
gdb-34248c3af73049fe1f8b7a4b9eb7ae09f42eed95.tar.gz
gdb-34248c3af73049fe1f8b7a4b9eb7ae09f42eed95.tar.bz2
PR symtab/17559
Basically the problem is that "symtab" is ambiguous. Is it the primary symtab (where we canonically think of blockvectors as being stored) or is it for a specific file (where each file's line table is stored) ? gdb_disassembly wants the symtab that contains the line table but is instead getting the primary symtab. gdb/ChangeLog: PR symtab/17559 * symtab.c (find_pc_line_symtab): New function. * symtab.h (find_pc_line_symtab): Declare. * disasm.c (gdb_disassembly): Call find_pc_line_symtab instead of find_pc_symtab. * tui/tui-disasm.c (tui_set_disassem_content): Ditto. * tui/tui-hooks.c (tui_selected_frame_level_changed_hook): Ditto. * tui/tui-source.c (tui_vertical_source_scroll): Ditto. * tui/tui-win.c (make_visible_with_new_height): Ditto. * tui/tui-winsource.c (tui_horizontal_source_scroll): Ditto. (tui_display_main): Call find_pc_line_symtab instead of find_pc_line. gdb/testsuite/ChangeLog: PR symtab/17559 * gdb.base/line-symtabs.exp: New file. * gdb.base/line-symtabs.c: New file. * gdb.base/line-symtabs.h: New file.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.base/line-symtabs.c25
-rw-r--r--gdb/testsuite/gdb.base/line-symtabs.exp33
-rw-r--r--gdb/testsuite/gdb.base/line-symtabs.h24
4 files changed, 89 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index ce9c819..65687c0 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2014-11-15 Doug Evans <xdje42@gmail.com>
+
+ PR symtab/17559
+ * gdb.base/line-symtabs.exp: New file.
+ * gdb.base/line-symtabs.c: New file.
+ * gdb.base/line-symtabs.h: New file.
+
2014-11-14 Yao Qi <yao@codesourcery.com>
* gdb.dwarf2/dw2-ifort-parameter.c: Remove inline asm.
diff --git a/gdb/testsuite/gdb.base/line-symtabs.c b/gdb/testsuite/gdb.base/line-symtabs.c
new file mode 100644
index 0000000..d21c711
--- /dev/null
+++ b/gdb/testsuite/gdb.base/line-symtabs.c
@@ -0,0 +1,25 @@
+/* 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 <http://www.gnu.org/licenses/>. */
+
+#include "line-symtabs.h"
+
+int
+main ()
+{
+ header_function ();
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/line-symtabs.exp b/gdb/testsuite/gdb.base/line-symtabs.exp
new file mode 100644
index 0000000..9bcbb92
--- /dev/null
+++ b/gdb/testsuite/gdb.base/line-symtabs.exp
@@ -0,0 +1,33 @@
+# Test handling of line symbol tables (non-primary symtabs).
+# 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 .c line-symtabs.h
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
+ return -1
+}
+
+if ![runto_main] {
+ fail "Can't run to main"
+ return -1
+}
+
+# PR 17559: gdb_disassembly was using the wrong symtab lookup function.
+# It was expecting the symtab of the source file containing $pc,
+# instead it was getting the primary symtab of that compilation unit.
+gdb_breakpoint "$srcfile2:[gdb_get_line_number {break here} $srcfile2]"
+gdb_continue_to_breakpoint "continue to breakpoint in header"
+gdb_test "disas /m" "break here.*End of assembler dump\\."
diff --git a/gdb/testsuite/gdb.base/line-symtabs.h b/gdb/testsuite/gdb.base/line-symtabs.h
new file mode 100644
index 0000000..7e19060
--- /dev/null
+++ b/gdb/testsuite/gdb.base/line-symtabs.h
@@ -0,0 +1,24 @@
+/* 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 <http://www.gnu.org/licenses/>. */
+
+int x;
+
+void
+header_function (void)
+{
+ x = 42; /* break here */
+}