This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] info-fun-opt.exp


Hi.

Regardless of how we fix the issue outlined here:

http://sourceware.org/ml/gdb-patches/2012-06/msg00109.html

here's a testcase that triggers the issue.
I will check it in once we decide on a fix.

When run with current cvs gdb and a recent gcc it hits the
assert failure in dw2_find_pc_sect_symtab when used with cc-with-index.sh.

(gdb) info fun foo
../../gdb.git/gdb/dwarf2read.c:3049: internal-error: dw2_find_pc_sect_symtab: Assertion `result != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) FAIL: gdb.opt/info-fun-opt.exp: info fun foo (GDB internal error)


2012-06-04  Doug Evans  <dje@google.com>

	* gdb.opt/info-fun-opt.cc: New file.
	* gdb.opt/info-fun-opt.exp: New file.

Index: gdb.opt/info-fun-opt.cc
===================================================================
RCS file: gdb.opt/info-fun-opt.cc
diff -N gdb.opt/info-fun-opt.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gdb.opt/info-fun-opt.cc	5 Jun 2012 06:27:47 -0000
@@ -0,0 +1,40 @@
+/* Copyright (C) 2012 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/>.  */
+
+class B1
+{
+ public:
+  virtual int foo () { return 1; }
+};
+
+class B2
+{
+ public:
+  virtual int foo () { return 2; }
+};
+
+class M : public B1, B2
+{
+ public:
+  virtual int foo () { return dynamic_cast<B1*>(this)->foo (); }
+};
+
+int
+main ()
+{
+  M *m = new M;
+
+  return m->foo ();
+}
Index: gdb.opt/info-fun-opt.exp
===================================================================
RCS file: gdb.opt/info-fun-opt.exp
diff -N gdb.opt/info-fun-opt.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gdb.opt/info-fun-opt.exp	5 Jun 2012 06:27:47 -0000
@@ -0,0 +1,29 @@
+# Copyright 2012 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/>.
+#
+# This file is part of the gdb testsuite.
+
+# Test "info fun" on optimized code.
+# This exercises the use of blockvector.map when tested with cc-with-index.sh.
+
+set basename "info-fun-opt"
+set testfile $basename
+
+if { [prepare_for_testing $testfile.exp $testfile $testfile.cc \
+          {debug c++ optimize=-O2}] } {
+    return -1
+}
+
+gdb_test "info fun foo" "File.*info-fun-opt.*foo.*foo.*foo.*"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]