+2020-04-30 Hannes Domani <ssbssa@yahoo.de>
+
+ PR gdb/18706
+ * gdbtypes.c (check_typedef): Calculate size of array of
+ stubbed type.
+
2020-04-30 Hannes Domani <ssbssa@yahoo.de>
PR gdb/15559
TYPE_LENGTH (type) = TYPE_LENGTH (target_type);
TYPE_TARGET_STUB (type) = 0;
}
+ else if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ {
+ struct type *range_type = check_typedef (TYPE_INDEX_TYPE (type));
+ if (has_static_range (TYPE_RANGE_DATA (range_type)))
+ {
+ ULONGEST len = 0;
+ LONGEST low_bound = TYPE_LOW_BOUND (range_type);
+ LONGEST high_bound = TYPE_HIGH_BOUND (range_type);
+ if (high_bound >= low_bound)
+ len = (high_bound - low_bound + 1) * TYPE_LENGTH (target_type);
+ TYPE_LENGTH (type) = len;
+ TYPE_TARGET_STUB (type) = 0;
+ }
+ }
}
type = make_qualified_type (type, instance_flags, NULL);
+2020-04-30 Hannes Domani <ssbssa@yahoo.de>
+
+ PR gdb/18706
+ * gdb.cp/stub-array-size.cc: New test.
+ * gdb.cp/stub-array-size.exp: New file.
+ * gdb.cp/stub-array-size.h: New test.
+ * gdb.cp/stub-array-size2.cc: New test.
+
2020-04-30 Hannes Domani <ssbssa@yahoo.de>
* gdb.python/py-format-string.exp: Adjust pretty_arrays expected
--- /dev/null
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2020 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 "stub-array-size.h"
+
+A a[10];
+
+int main()
+{
+ return 0;
+};
--- /dev/null
+# Copyright 2020 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 size of arrays of stubbed types (structures where the full definition
+# is not immediately available).
+
+if {[skip_cplus_tests]} { continue }
+
+standard_testfile .cc stub-array-size2.cc
+
+if {[prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2" \
+ {c++ debug}]} {
+ return -1
+}
+
+gdb_test "print sizeof(a)/sizeof(a\[0\])" "10"
--- /dev/null
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2020 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/>. */
+
+struct A
+{
+ virtual ~A();
+};
--- /dev/null
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2020 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 "stub-array-size.h"
+
+A::~A()
+{
+}