diff --git a/gdb/Makefile.in b/gdb/Makefile.in
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
-@@ -1768,7 +1768,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
+@@ -1726,7 +1726,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
install: all
@$(MAKE) $(FLAGS_TO_PASS) install-only
transformed_name=`t='$(program_transform_name)'; \
echo gdb | sed -e "$$t"` ; \
if test "x$$transformed_name" = x; then \
-@@ -1817,7 +1817,25 @@ install-guile:
+@@ -1775,7 +1775,25 @@ install-guile:
install-python:
$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
transformed_name=`t='$(program_transform_name)'; \
echo gdb | sed -e $$t` ; \
if test "x$$transformed_name" = x; then \
-@@ -1840,6 +1858,18 @@ uninstall: force $(CONFIG_UNINSTALL)
+@@ -1798,6 +1816,18 @@ uninstall: force $(CONFIG_UNINSTALL)
fi
@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
+ fi ; \
+ rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \
+ $(DESTDIR)$(man1dir)/$$transformed_name.1
-+
++
# The C++ name parser can be built standalone for testing.
test-cp-name-parser.o: cp-name-parser.c
$(COMPILE) -DTEST_CPNAMES cp-name-parser.c
+
+# Run GDB, strip out unwanted noise.
+# --readnever is no longer used since .gdb_index is now in use.
-+$GDB --quiet -nx $GDBARGS /proc/$1/exe $1 <<EOF 2>&1 |
++$GDB --quiet -nx $GDBARGS /proc/$1/exe $1 <<EOF 2>&1 |
+set width 0
+set height 0
+set pagination no
+ /* Use the most simple notification not to get caught by attach on exiting
+ the function. */
+ write (1, msg, strlen (msg));
-+
++
+ for (;;);
+}
+
#include "frame.h"
#include "inferior.h"
#include "target.h"
-@@ -345,12 +347,27 @@ exec_file_attach (const char *filename, int from_tty)
+@@ -495,12 +497,27 @@ exec_file_attach (const char *filename, int from_tty)
if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching))
{
/* Make sure to close exec_bfd, or else "run" might try to use
it. */
exec_close ();
-- error (_("\"%s\": not in executable format: %s"),
-- scratch_pathname,
+- error (_("\"%ps\": not in executable format: %s"),
+- styled_string (file_name_style.style (), scratch_pathname),
- gdb_bfd_errmsg (bfd_get_error (), matching).c_str ());
+
+ if (is_core != 0)
+ "Please specify an executable to debug."),
+ scratch_pathname);
+ else
-+ error (_("\"%ss\": not in executable format: %s"),
-+ scratch_pathname,
++ error (_("\"%ps\": not in executable format: %s"),
++ styled_string (file_name_style.style (), scratch_pathname),
+ gdb_bfd_errmsg (bfd_get_error (), matching).c_str ());
}
if (build_section_table (exec_bfd, §ions, §ions_end))
-diff --git a/gdb/gdbsupport/common-exceptions.h b/gdb/gdbsupport/common-exceptions.h
---- a/gdb/gdbsupport/common-exceptions.h
-+++ b/gdb/gdbsupport/common-exceptions.h
-@@ -106,6 +106,9 @@ enum errors {
- "_ERROR" is appended to the name. */
- MAX_COMPLETIONS_REACHED_ERROR,
-
-+ /* Attempt to load a core file as executable. */
-+ IS_CORE_ERROR,
-+
- /* Add more errors here. */
- NR_ERRORS
- };
diff --git a/gdb/main.c b/gdb/main.c
--- a/gdb/main.c
+++ b/gdb/main.c
-@@ -467,6 +467,34 @@ struct cmdarg
+@@ -524,6 +524,34 @@ struct cmdarg
char *string;
};
static void
captured_main_1 (struct captured_main_args *context)
{
-@@ -907,6 +935,8 @@ captured_main_1 (struct captured_main_args *context)
+@@ -959,6 +987,8 @@ captured_main_1 (struct captured_main_args *context)
{
symarg = argv[optind];
execarg = argv[optind];
optind++;
}
-@@ -1063,12 +1093,25 @@ captured_main_1 (struct captured_main_args *context)
+@@ -1114,12 +1144,25 @@ captured_main_1 (struct captured_main_args *context)
&& symarg != NULL
&& strcmp (execarg, symarg) == 0)
{
ret = catch_command_errors (symbol_file_add_main_adapter,
symarg, !batch_flag);
}
+diff --git a/gdbsupport/common-exceptions.h b/gdbsupport/common-exceptions.h
+--- a/gdbsupport/common-exceptions.h
++++ b/gdbsupport/common-exceptions.h
+@@ -106,6 +106,9 @@ enum errors {
+ "_ERROR" is appended to the name. */
+ MAX_COMPLETIONS_REACHED_ERROR,
+
++ /* Attempt to load a core file as executable. */
++ IS_CORE_ERROR,
++
+ /* Add more errors here. */
+ NR_ERRORS
+ };
diff --git a/gdb/build-id.c b/gdb/build-id.c
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
-@@ -709,6 +709,19 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
+@@ -708,6 +708,19 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
#include <dlfcn.h>
#endif
diff --git a/gdb/build-id.c b/gdb/build-id.c
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
-@@ -743,7 +743,11 @@ static int missing_rpm_list_entries;
+@@ -742,7 +742,11 @@ static int missing_rpm_list_entries;
/* Returns the count of newly added rpms. */
static int
{
static int rpm_init_done = 0;
rpmts ts;
-@@ -850,7 +854,11 @@ missing_rpm_enlist (const char *filename)
+@@ -849,7 +853,11 @@ missing_rpm_enlist (const char *filename)
mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
if (mi != NULL)
{
{
Header h;
char *debuginfo, **slot, *s, *s2;
-@@ -968,6 +976,37 @@ missing_rpm_enlist (const char *filename)
+@@ -967,6 +975,37 @@ missing_rpm_enlist (const char *filename)
xfree (debuginfo);
count++;
}
rpmdbFreeIterator_p (mi);
}
-@@ -977,6 +1016,20 @@ missing_rpm_enlist (const char *filename)
+@@ -976,6 +1015,20 @@ missing_rpm_enlist (const char *filename)
return count;
}
static bool
missing_rpm_list_compar (const char *ap, const char *bp)
{
-diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
---- a/gdb/dwarf2read.c
-+++ b/gdb/dwarf2read.c
-@@ -3497,6 +3497,16 @@ read_gdb_index_from_buffer (struct objfile *objfile,
+diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
+--- a/gdb/dwarf2/read.c
++++ b/gdb/dwarf2/read.c
+@@ -3022,6 +3022,16 @@ read_gdb_index_from_buffer (const char *filename,
"set use-deprecated-index-sections on". */
if (version < 6 && !deprecated_ok)
{
static int warning_printed = 0;
if (!warning_printed)
{
-@@ -3508,6 +3518,10 @@ to use the section anyway."),
+@@ -3033,6 +3043,10 @@ to use the section anyway."),
warning_printed = 1;
}
return 0;
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
-+#
++#
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
-+ AC_MSG_RESULT([no])
++ AC_MSG_RESULT([no])
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
-+ else
++ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+_PKG_TEXT])[]dnl
+ ])
+elif test $pkg_failed = untried; then
-+ AC_MSG_RESULT([no])
++ AC_MSG_RESULT([no])
+ m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
#include "gdbcmd.h"
#include "gdbcore.h"
+#include "inferior.h"
- #include "libbfd.h"
#include "objfiles.h"
#include "observable.h"
-@@ -698,8 +699,359 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
+ #include "symfile.h"
+@@ -697,8 +698,374 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
return result;
}
+
+ /* Already failed the initialization before? */
+ if (init_tried)
-+ return 0;
++ return 0;
+ init_tried = 1;
+
+#ifdef DLOPEN_LIBRPM
+
+ std::sort (array.begin (), array.end (), missing_rpm_list_compar);
+
++ /* We zero out the number of missing RPMs here because of a nasty
++ bug (see RHBZ 1801974).
++
++ When we call 'puts_unfiltered' below, if pagination is on and if
++ the number of missing RPMs is big enough to trigger pagination,
++ we will end up in an infinite recursion. The call chain looks
++ like this:
++
++ missing_rpm_list_print -> puts_unfiltered -> fputs_maybe_filtered
++ -> prompt_for_continue -> display_gdb_prompt ->
++ debug_flush_missing -> missing_rpm_list_print ...
++
++ For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero
++ *before* calling any print function. */
++ missing_rpm_list_entries = 0;
++
+ printf_unfiltered (_("Missing separate debuginfos, use: %s"),
+#ifdef DNF_DEBUGINFO_INSTALL
+ "dnf "
+ "debuginfo-install");
+ for (const char *el : array)
+ {
-+ putchar_unfiltered (' ');
++ puts_unfiltered (" ");
+ puts_unfiltered (el);
+ }
-+ putchar_unfiltered ('\n');
++ puts_unfiltered ("\n");
+
+ while (missing_rpm_list != NULL)
+ {
+ missing_rpm_list = list_iter->next;
+ xfree (list_iter);
+ }
-+ missing_rpm_list_entries = 0;
+}
+
+static void
avoidance. */
struct missing_filepair
-@@ -753,11 +1105,17 @@ missing_filepair_change (void)
+@@ -752,11 +1119,17 @@ missing_filepair_change (void)
/* All their memory came just from missing_filepair_OBSTACK. */
missing_filepair_hash = NULL;
}
missing_filepair_change ();
}
-@@ -824,14 +1182,38 @@ debug_print_missing (const char *binary, const char *debug)
+@@ -823,14 +1196,38 @@ debug_print_missing (const char *binary, const char *debug)
*slot = missing_filepair;
diff --git a/gdb/config.in b/gdb/config.in
--- a/gdb/config.in
+++ b/gdb/config.in
-@@ -36,6 +36,9 @@
- /* Define to BFD's default target vector. */
- #undef DEFAULT_BFD_VEC
+@@ -39,6 +39,9 @@
+ /* Handle .ctf type-info sections */
+ #undef ENABLE_LIBCTF
+/* librpm version specific library name to dlopen. */
+#undef DLOPEN_LIBRPM
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
-@@ -245,6 +248,9 @@
+@@ -247,6 +250,9 @@
/* Define if you have the mpfr library. */
#undef HAVE_LIBMPFR
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
-@@ -761,6 +761,11 @@ CODESIGN_CERT
+@@ -769,6 +769,11 @@ PKG_CONFIG
HAVE_NATIVE_GCORE_TARGET
TARGET_OBS
subdirs
GDB_DATADIR
DEBUGDIR
MAKEINFO_EXTRA_FLAGS
-@@ -864,6 +869,7 @@ with_gdb_datadir
+@@ -873,6 +878,7 @@ with_gdb_datadir
with_relocated_sources
with_auto_load_dir
with_auto_load_safe_path
enable_targets
enable_64_bit_bfd
enable_gdbmi
-@@ -926,6 +932,11 @@ CCC
- CPP
- MAKEINFO
- MAKEINFOFLAGS
-+PKG_CONFIG
-+PKG_CONFIG_PATH
-+PKG_CONFIG_LIBDIR
+@@ -949,6 +955,8 @@ PKG_CONFIG_PATH
+ PKG_CONFIG_LIBDIR
+ DEBUGINFOD_CFLAGS
+ DEBUGINFOD_LIBS
+RPM_CFLAGS
+RPM_LIBS
YACC
YFLAGS
XMKMF'
-@@ -1598,6 +1609,8 @@ Optional Packages:
- [--with-auto-load-dir]
- --without-auto-load-safe-path
+@@ -1621,6 +1629,8 @@ Optional Packages:
do not restrict auto-loaded files locations
+ --with-debuginfod Enable debuginfo lookups with debuginfod
+ (auto/yes/no)
+ --with-rpm query rpm database for missing debuginfos (yes/no,
+ def. auto=librpm.so)
--with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
--with-curses use the curses library instead of the termcap
library
-@@ -1661,6 +1674,13 @@ Some influential environment variables:
- MAKEINFO Parent configure detects if it is of sufficient version.
- MAKEINFOFLAGS
- Parameters for MAKEINFO.
-+ PKG_CONFIG path to pkg-config utility
-+ PKG_CONFIG_PATH
-+ directories to add to pkg-config's search path
-+ PKG_CONFIG_LIBDIR
-+ path overriding pkg-config's built-in search path
+@@ -1702,6 +1712,8 @@ Some influential environment variables:
+ C compiler flags for DEBUGINFOD, overriding pkg-config
+ DEBUGINFOD_LIBS
+ linker flags for DEBUGINFOD, overriding pkg-config
+ RPM_CFLAGS C compiler flags for RPM, overriding pkg-config
+ RPM_LIBS linker flags for RPM, overriding pkg-config
YACC The `Yet Another Compiler Compiler' implementation to use.
Defaults to the first program found out of: `bison -y', `byacc',
`yacc'.
-@@ -6587,6 +6607,494 @@ _ACEOF
+@@ -6666,6 +6678,494 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
$as_echo "$with_auto_load_safe_path" >&6; }
+
+
+if test $pkg_failed = yes; then
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+
+ HAVE_LIBRPM=false
+elif test $pkg_failed = untried; then
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ HAVE_LIBRPM=false
+else
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
-@@ -144,6 +144,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
+@@ -143,6 +143,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
[Directories safe to hold auto-loaded files.])
AC_MSG_RESULT([$with_auto_load_safe_path])
+ fi
+ fi
+fi
-+
++
AC_CONFIG_SUBDIRS(testsuite)
# Check whether to support alternative target configurations
diff --git a/gdb/event-top.c b/gdb/event-top.c
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
-@@ -41,6 +41,7 @@
- #include "ser-event.h"
- #include "gdb_select.h"
+@@ -42,6 +42,7 @@
+ #include "gdbsupport/gdb_select.h"
#include "gdbsupport/gdb-sigmask.h"
+ #include "async-event.h"
+#include "symfile.h"
/* readline include files. */
#include "readline/readline.h"
-@@ -363,6 +364,8 @@ display_gdb_prompt (const char *new_prompt)
+@@ -364,6 +365,8 @@ display_gdb_prompt (const char *new_prompt)
/* Reset the nesting depth used when trace-commands is set. */
reset_command_nest_depth ();
/* Do not call the python hook on an explicit prompt change as
passed to this function, as this forms a secondary/local prompt,
IE, displayed but not set. */
-@@ -772,7 +775,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
+@@ -773,7 +776,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
command_handler (cmd);
if (ui->prompt_state != PROMPTED)
diff --git a/gdb/symfile.h b/gdb/symfile.h
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
-@@ -542,6 +542,8 @@ extern void generic_load (const char *args, int from_tty);
+@@ -560,6 +560,7 @@ extern void generic_load (const char *args, int from_tty);
/* build-id support. */
extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr);
extern void debug_print_missing (const char *binary, const char *debug);
+extern void debug_flush_missing (void);
-+#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
+ #define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
/* From dwarf2read.c */
-
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
-@@ -1346,14 +1346,27 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
+@@ -1340,14 +1340,27 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
}
{
if (build_id != NULL)
{
char *name, *build_id_filename;
-@@ -1368,23 +1381,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
+@@ -1362,23 +1375,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
xfree (name);
}
else
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
-@@ -127,7 +127,7 @@ static inline char *
+@@ -121,7 +121,7 @@ static inline char *
bfd_strdup (const char *str)
{
size_t len = strlen (str) + 1;
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
-@@ -132,7 +132,7 @@ static inline char *
+@@ -126,7 +126,7 @@ static inline char *
bfd_strdup (const char *str)
{
size_t len = strlen (str) + 1;
diff --git a/gdb/build-id.c b/gdb/build-id.c
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
-@@ -24,13 +24,71 @@
+@@ -24,13 +24,70 @@
#include "gdbsupport/gdb_vecs.h"
#include "symfile.h"
#include "objfiles.h"
+#include "gdb_bfd.h"
+#include "gdbcmd.h"
#include "gdbcore.h"
-+#include "libbfd.h"
+#include "objfiles.h"
+#include "observable.h"
+#include "symfile.h"
{
if (!bfd_check_format (abfd, bfd_object)
&& !bfd_check_format (abfd, bfd_core))
-@@ -43,6 +101,348 @@ build_id_bfd_get (bfd *abfd)
+@@ -43,6 +100,348 @@ build_id_bfd_get (bfd *abfd)
return NULL;
}
/* See build-id.h. */
int
-@@ -51,7 +451,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
+@@ -51,7 +450,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
const struct bfd_build_id *found;
int retval = 0;
if (found == NULL)
warning (_("File \"%s\" has no build-id, file skipped"),
-@@ -66,56 +466,159 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
+@@ -66,56 +465,159 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
return retval;
}
+ /* There can be multiple build-id symlinks pointing to real files
+ with the same build-id (such as hard links). Some of the real
+ files may not be installed. */
-
-- /* We expect to be silent on the non-existing files. */
-- gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget, -1);
++
+ string_appendf (link, ".%u", seqno);
+ }
+- /* We expect to be silent on the non-existing files. */
+- gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget);
++ ret_link = link;
+
- if (debug_bfd == NULL)
- {
- if (separate_debug_file_debug)
- printf_unfiltered (_(" no, unable to open.\n"));
-+ ret_link = link;
-+
+ struct stat statbuf_trash;
+
+ /* `access' automatically dereferences LINK. */
+
+ continue;
+ }
-
-- return {};
++
+ /* We expect to be silent on the non-existing files. */
+ gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget, -1);
-+
+
+- return {};
+ if (debug_bfd == NULL)
+ {
+ if (separate_debug_file_debug)
}
/* Common code for finding BFDs of a given build-id. This function
-@@ -124,7 +627,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len,
+@@ -124,7 +626,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len,
static gdb_bfd_ref_ptr
build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
{
/* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
cause "/.build-id/..." lookups. */
-@@ -147,16 +650,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
+@@ -147,16 +649,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
if (size > 0)
{
size--;
if (debug_bfd != NULL)
return debug_bfd;
-@@ -170,7 +674,8 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
+@@ -170,7 +673,8 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
if (strcmp (gdb_sysroot, TARGET_SYSROOT_PREFIX) != 0)
{
link = gdb_sysroot + link;
if (debug_bfd != NULL)
return debug_bfd;
}
-@@ -179,38 +684,208 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
+@@ -179,38 +683,208 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
return {};
}
+{
+ gdb_bfd_ref_ptr abfd;
+ char *result;
-+
++
+ abfd = build_id_to_exec_bfd (build_id->size, build_id->data, link_return);
+ if (abfd == NULL)
+ return NULL;
/* Prevent looping on a stripped .debug file. */
if (abfd != NULL
&& filename_cmp (bfd_get_filename (abfd.get ()),
-@@ -223,3 +898,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
+@@ -223,3 +897,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
return std::string ();
}
#include "inferior.h"
#include "infrun.h"
#include "symtab.h"
-@@ -322,6 +326,8 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
- inferior_ptid = ptid; /* Yes, make it current. */
+@@ -362,6 +366,8 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
+ switch_to_thread (thr); /* Yes, make it current. */
}
+static bool build_id_core_loads = true;
/* Issue a message saying we have no core to debug, if FROM_TTY. */
static void
-@@ -358,19 +364,25 @@ core_file_command (const char *filename, int from_tty)
+@@ -398,19 +404,25 @@ core_file_command (const char *filename, int from_tty)
static void
locate_exec_from_corefile_build_id (bfd *abfd, int from_tty)
{
}
/* See gdbcore.h. */
-@@ -998,4 +1010,11 @@ void
- _initialize_corelow (void)
- {
- add_target (core_target_info, core_target_open, filename_completer);
+@@ -1189,4 +1201,11 @@ _initialize_corelow ()
+ maintenance_print_core_file_backed_mappings,
+ _("Print core file's file-backed mappings."),
+ &maintenanceprintlist);
+
+ add_setshow_boolean_cmd ("build-id-core-loads", class_files,
+ &build_id_core_loads, _("\
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
-@@ -20862,6 +20862,27 @@ information files.
+@@ -21074,6 +21074,27 @@ information files.
@end table
@cindex @code{.gnu_debuglink} sections
@cindex debug link sections
A debug link is a special section of the executable file named
-diff --git a/gdb/dwarf-index-cache.c b/gdb/dwarf-index-cache.c
---- a/gdb/dwarf-index-cache.c
-+++ b/gdb/dwarf-index-cache.c
-@@ -94,7 +94,7 @@ index_cache::store (struct dwarf2_per_objfile *dwarf2_per_objfile)
+diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
+--- a/gdb/dwarf2/index-cache.c
++++ b/gdb/dwarf2/index-cache.c
+@@ -95,7 +95,7 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
return;
/* Get build id of objfile. */
if (build_id == nullptr)
{
if (debug_index_cache)
-@@ -112,7 +112,8 @@ index_cache::store (struct dwarf2_per_objfile *dwarf2_per_objfile)
+@@ -113,7 +113,8 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
if (dwz != nullptr)
{
if (dwz_build_id == nullptr)
{
-diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
---- a/gdb/dwarf2read.c
-+++ b/gdb/dwarf2read.c
-@@ -2718,7 +2718,7 @@ dwarf2_get_dwz_file (struct dwarf2_per_objfile *dwarf2_per_objfile)
+diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
+--- a/gdb/dwarf2/read.c
++++ b/gdb/dwarf2/read.c
+@@ -2215,7 +2215,7 @@ dwarf2_get_dwz_file (dwarf2_per_bfd *per_bfd)
}
if (dwz_bfd == NULL)
- dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid);
+ dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid, NULL);
- if (dwz_bfd == NULL)
- error (_("could not find '.gnu_debugaltlink' file for %s"),
-@@ -6276,7 +6276,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
+ if (dwz_bfd == nullptr)
+ {
+@@ -5977,7 +5977,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
static gdb::array_view<const gdb_byte>
- get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_objfile *dwarf2_obj)
+ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
{
- const bfd_build_id *build_id = build_id_bfd_get (obj->obfd);
+ const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd);
if (build_id == nullptr)
return {};
-@@ -6289,7 +6289,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_objfile *dwarf2_obj)
+@@ -5990,7 +5990,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
static gdb::array_view<const gdb_byte>
get_gdb_index_contents_from_cache_dwz (objfile *obj, dwz_file *dwz)
{
diff --git a/gdb/elfread.c b/gdb/elfread.c
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
-@@ -1299,7 +1299,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
+@@ -1298,7 +1298,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
&& objfile->separate_debug_objfile == NULL
&& objfile->separate_debug_objfile_backlink == NULL)
{
if (debugfile.empty ())
debugfile = find_separate_debug_file_by_debuglink (objfile);
-@@ -1311,8 +1313,12 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
- symbol_file_add_separate (debug_bfd.get (), debugfile.c_str (),
- symfile_flags, objfile);
+@@ -1313,7 +1315,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
+ else
+ {
+ has_dwarf2 = false;
+- const struct bfd_build_id *build_id = build_id_bfd_get (objfile->obfd);
++ const struct bfd_build_id *build_id = build_id_bfd_shdr_get (objfile->obfd);
+
+ if (build_id != nullptr)
+ {
+@@ -1338,6 +1340,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
+ has_dwarf2 = true;
+ }
+ }
++ /* Check if any separate debug info has been extracted out. */
++ else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink")
++ != NULL)
++ debug_print_missing (objfile_name (objfile), build_id_filename.get ());
+ }
}
-- else
-- has_dwarf2 = false;
-+ /* Check if any separate debug info has been extracted out. */
-+ else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink")
-+ != NULL)
-+ debug_print_missing (objfile_name (objfile), build_id_filename.get ());
-+ else
-+ has_dwarf2 = false;
}
+diff --git a/gdb/exec.c b/gdb/exec.c
+--- a/gdb/exec.c
++++ b/gdb/exec.c
+@@ -264,7 +264,7 @@ validate_exec_file (int from_tty)
+ reopen_exec_file ();
+ current_exec_file = get_exec_file (0);
+
+- const bfd_build_id *exec_file_build_id = build_id_bfd_get (exec_bfd);
++ const bfd_build_id *exec_file_build_id = build_id_bfd_shdr_get (exec_bfd);
+ if (exec_file_build_id != nullptr)
+ {
+ /* Prepend the target prefix, to force gdb_bfd_open to open the
+@@ -277,7 +277,7 @@ validate_exec_file (int from_tty)
+ if (abfd != nullptr)
+ {
+ const bfd_build_id *target_exec_file_build_id
+- = build_id_bfd_get (abfd.get ());
++ = build_id_bfd_shdr_get (abfd.get ());
- /* Read the CTF section only if there is no DWARF info. */
+ if (target_exec_file_build_id != nullptr)
+ {
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
-@@ -627,6 +627,10 @@ struct objfile
- htab_up static_links;
+@@ -714,6 +714,10 @@ struct objfile
+ bool skip_jit_symbol_lookup = false;
};
+/* This file was loaded according to the BUILD_ID_CORE_LOADS rules. */
+
+#define OBJF_BUILD_ID_CORE_LOADED static_cast<enum objfile_flag>(1 << 12)
+
- /* Declarations for functions defined in objfiles.c */
+ /* A deleter for objfile. */
- extern struct gdbarch *get_objfile_arch (const struct objfile *);
+ struct objfile_deleter
diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
--- a/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c
static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
static int svr4_have_link_map_offsets (void);
-@@ -1344,9 +1345,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
+@@ -1338,9 +1339,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
continue;
}
/* If this entry has no name, or its name matches the name
for the main executable, don't include it in the list. */
+diff --git a/gdb/source.c b/gdb/source.c
+--- a/gdb/source.c
++++ b/gdb/source.c
+@@ -1165,7 +1165,7 @@ open_source_file (struct symtab *s)
+ srcpath += s->filename;
+ }
+
+- const struct bfd_build_id *build_id = build_id_bfd_get (ofp->obfd);
++ const struct bfd_build_id *build_id = build_id_bfd_shdr_get (ofp->obfd);
+
+ /* Query debuginfod for the source file. */
+ if (build_id != nullptr && !srcpath.empty ())
diff --git a/gdb/symfile.h b/gdb/symfile.h
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
-@@ -532,12 +532,17 @@ void expand_symtabs_matching
+@@ -550,12 +550,18 @@ void expand_symtabs_matching
void map_symbol_filenames (symbol_filename_ftype *fun, void *data,
int need_fullname);
+/* build-id support. */
+extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr);
+extern void debug_print_missing (const char *binary, const char *debug);
++#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
+
/* From dwarf2read.c */
diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp
--- a/gdb/testsuite/gdb.base/corefile.exp
+++ b/gdb/testsuite/gdb.base/corefile.exp
-@@ -311,3 +311,33 @@ gdb_test_multiple "core-file $corefile" $test {
+@@ -343,3 +343,33 @@ gdb_test_multiple "core-file $corefile" $test {
pass $test
}
}
+ gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*"
+ pass $wholetest
+}
+diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp
+--- a/gdb/testsuite/gdb.base/gdbinit-history.exp
++++ b/gdb/testsuite/gdb.base/gdbinit-history.exp
+@@ -181,7 +181,8 @@ proc test_empty_history_filename { } {
+ global env
+ global gdb_prompt
+
+- set common_history [list "set height 0" "set width 0"]
++ set common_history [list "set height 0" "set width 0" \
++ "set build-id-verbose 0"]
+
+ set test_dir [standard_output_file history_test]
+ remote_exec host "mkdir -p $test_dir"
diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb.base/new-ui-pending-input.exp
--- a/gdb/testsuite/gdb.base/new-ui-pending-input.exp
+++ b/gdb/testsuite/gdb.base/new-ui-pending-input.exp
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
-@@ -1891,6 +1891,17 @@ proc default_gdb_start { } {
+@@ -2011,6 +2011,17 @@ proc default_gdb_start { } {
}
}
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
-@@ -309,6 +309,16 @@ proc default_mi_gdb_start { args } {
+@@ -308,6 +308,16 @@ proc default_mi_gdb_start { args } {
warning "Couldn't set the width to 0."
}
}
+ # gdb.arch/x86_64-vla-pointer.c:27
+ .loc 1 27 0
+ movl $0, -20(%rbp)
-+# SUCC: 4 [100.0%]
++# SUCC: 4 [100.0%]
+ jmp .L2
+# BLOCK 3 seq:1
+# PRED: 4
+ .loc 1 27 0 discriminator 3
+ addl $1, -20(%rbp)
+# BLOCK 4 seq:2
-+# PRED: 3 (FALLTHRU,DFS_BACK) 2 [100.0%]
++# PRED: 3 (FALLTHRU,DFS_BACK) 2 [100.0%]
+.L2:
+ # gdb.arch/x86_64-vla-pointer.c:27
+ .loc 1 27 0 is_stmt 0 discriminator 1
+ movq -8(%rbp), %rbx
+ leave
+ .cfi_def_cfa 7, 8
-+# SUCC: EXIT [100.0%]
++# SUCC: EXIT [100.0%]
+ ret
+ .cfi_endproc
+.LFE0:
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/gdb9593.cc
-@@ -0,0 +1,180 @@
+@@ -0,0 +1,179 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2008, 2009 Free Software Foundation, Inc.
+
+
+ // Single throw an exception in this function.
-+ void function1()
++ void function1()
+ {
+ throw 20;
+ }
+
+ // Throw an exception in another function.
-+ void function2()
++ void function2()
+ {
+ function1();
+ }
+
+ // Throw an exception in another function, but handle it
+ // locally.
-+ void function3 ()
++ void function3 ()
+ {
+ {
+ try
+ {
+ function1 ();
+ }
-+ catch (...)
++ catch (...)
+ {
+ cout << "Caught and handled function1 exception" << endl;
+ }
+NextOverThrowDerivates next_cases;
+
+
-+int main ()
-+{
++int main ()
++{
+ try
+ {
+ next_cases.function1 ();
+ {
+ }
+}
-+
diff --git a/gdb/testsuite/gdb.cp/gdb9593.exp b/gdb/testsuite/gdb.cp/gdb9593.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/gdb9593.exp
-@@ -0,0 +1,182 @@
+@@ -0,0 +1,189 @@
+# Copyright 2008, 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+if ![runto_main] then {
+ perror "couldn't run to main"
+ continue
-+}
++}
+
+# See whether we have the needed unwinder hooks.
+set ok 1
+ ".*function1 ().*" \
+ "step into finish, for until"
+
-+gdb_test "until" \
-+ ".*function1 ().*" \
-+ "until with no argument 1"
++gdb_test_multiple "until" "until with no argument 1" {
++ -re -wrap ".*function1 ().*" {
++ pass $gdb_test_name
++ }
++ -re -wrap ".*$hex\t80\t \}" {
++ # PR gcc/97774 - "Incorrect line info for try/catch"
++ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97774
++ xfail $gdb_test_name
++ }
++}
+
+set line [gdb_get_line_number "marker for until" $testfile.cc]
+
+ 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,
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp
-@@ -0,0 +1,79 @@
+@@ -0,0 +1,84 @@
+# Copyright 2006 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.
+ && ![istarget *-*-openbsd*]
+ && ![istarget arm-*-eabi*]
+ && ![istarget powerpc-*-eabi*]} {
-+ return 0
++ return 0
++}
++
++if {[use_gdb_stub]} {
++ untested "skipping test because of use_gdb_stub"
++ return -1
+}
+
+set testfile "dw2-stripped"
+ && ![istarget *-*-openbsd*]
+ && ![istarget arm-*-eabi*]
+ && ![istarget powerpc-*-eabi*]} {
-+ return 0
++ return 0
+}
+
+set testfile "dw2-struct-member-data-location"
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if {![dwarf2_support]} {
-+ return 0
++ return 0
+}
+
+set testfile dw2-subrange-no-type
+# 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.
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+# 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.
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/string.exp
-@@ -0,0 +1,59 @@
+@@ -0,0 +1,71 @@
+# Copyright 2008 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.
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+gdb_continue_to_breakpoint "var-init"
+gdb_test "ptype c" "type = character(\\(kind=1\\)|\\*1)"
+gdb_test "ptype d" "type = character(\\(kind=8\\)|\\*8)"
++# Fortran: Support pointers to dynamic types.
++setup_kfail gdb/nnnnn "*-*-*"
+gdb_test "ptype e" "type = character(\\(kind=4\\)|\\*4)"
++# Fortran: Support pointers to dynamic types.
++setup_kfail gdb/nnnnn "*-*-*"
+gdb_test "ptype f" "type = character(\\(kind=4\\)|\\*4) \\(7,8:10\\)"
++# Fortran: Support pointers to dynamic types.
++setup_kfail gdb/nnnnn "*-*-*"
+gdb_test "ptype *e" "Attempt to take contents of a non-pointer value."
++# Fortran: Support pointers to dynamic types.
++setup_kfail gdb/nnnnn "*-*-*"
+gdb_test "ptype *f" "type = character(\\(kind=4\\)|\\*4) \\(7\\)"
+gdb_test "p c" "\\$\[0-9\]* = 'c'"
+gdb_test "p d" "\\$\[0-9\]* = 'd '"
+gdb_test "p e" "\\$\[0-9\]* = 'g '"
++# Fortran: Support pointers to dynamic types.
++setup_kfail gdb/nnnnn "*-*-*"
+gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'h ', 'h ', 'h ', 'h ', 'h ', 'h ', 'h '\\) \\( 'h ', 'h ', 'h ', 'h ', 'h ', 'h ', 'h '\\) \\( 'h ', 'h ', 'h ', 'h ', 'h ', 'h ', 'h '\\) \\)"
+gdb_test "p *e" "Attempt to take contents of a non-pointer value."
+gdb_test "p *f" "Attempt to take contents of a non-pointer value."
+gdb_breakpoint [gdb_get_line_number "var-finish"]
+gdb_continue_to_breakpoint "var-finish"
+gdb_test "p e" "\\$\[0-9\]* = 'e '" "p e re-set"
++# Fortran: Support pointers to dynamic types.
++setup_kfail gdb/nnnnn "*-*-*"
+gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'f ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\( 'f2 ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\( 'f ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\)" "p *f re-set"
diff --git a/gdb/testsuite/gdb.fortran/string.f90 b/gdb/testsuite/gdb.fortran/string.f90
new file mode 100644
+! 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/>.
+
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.opt/fortran-string.exp
-@@ -0,0 +1,39 @@
+@@ -0,0 +1,46 @@
+# Copyright 2009 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.
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+ continue
+}
+
-+gdb_test "frame" ".*s='foo'.*"
-+gdb_test "ptype s" "type = character\\*3"
++gdb_test "info args" ".*s = 'foo'.*"
++gdb_test_multiple "ptype s" "" {
++ -re -wrap "type = character \\(3\\)" {
++ pass $gdb_test_name
++ }
++ -re -wrap "type = character\\*3" {
++ pass $gdb_test_name
++ }
++}
+gdb_test "p s" "\\$\[0-9\]* = 'foo'"
diff --git a/gdb/testsuite/gdb.opt/fortran-string.f90 b/gdb/testsuite/gdb.opt/fortran-string.f90
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.opt/fortran-string.f90
-@@ -0,0 +1,28 @@
+@@ -0,0 +1,29 @@
+! Copyright 2009 Free Software Foundation, Inc.
+!
+! This program is free software; you can redistribute it and/or modify
+ subroutine f(s)
+ character*(*) s
+ s = s
++ print *, s
+ end
+
+ program main
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.pascal/arrays.exp
-@@ -0,0 +1,104 @@
+@@ -0,0 +1,107 @@
+# Copyright 2008, 2009 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+
+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
+ setup_xfail "*-*-*"
++} else {
++ setup_kfail "*-*-*" pascal/26106
+}
+gdb_test "print DynArrStr" ".* = \\{'dstr0', 'dstr1', 'dstr2', 'dstr3', 'dstr4', 'dstr5', 'dstr6', 'dstr7', 'dstr8', 'dstr9', 'dstr10', 'dstr11', 'dstr12'\\}" "Print dynamic array of string"
+
+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
+ setup_xfail "*-*-*"
++} else {
++ setup_kfail "*-*-*" pascal/26855
+}
+gdb_test "print StatArrStr" ".* = \\{'str0', 'str1', 'str2', 'str3', 'str4', 'str5', 'str6', 'str7', 'str8', 'str9', 'str10', 'str11', 'str12'\\}" "Print static array of string"
+
+ setup_xfail "*-*-*"
+}
+gdb_test "print DynArrChar" ".* = 'abcdefghijklm'" "Print dynamic array of char"
-+
diff --git a/gdb/testsuite/gdb.pascal/arrays.pas b/gdb/testsuite/gdb.pascal/arrays.pas
new file mode 100644
--- /dev/null
+ Stat2dArrInt: TStat2dArrInt;
+
+ s: string;
-+
++
+ i,j : integer;
+
+begin
+ DynArrStr[i]:='dstr'+inttostr(i);
+ end;
+ writeln(DynArrInt_[1]);
-+ writeln(DynArrInt[1]);
-+ writeln(DynArrStr[1]);
++ writeln(DynArrInt[1]);
++ writeln(DynArrStr[1]);
+ writeln(StatArrStr[1]);
+ writeln(DynArrChar[1]);
+
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
-@@ -170,6 +170,11 @@ proc gdb_unload {} {
+@@ -224,6 +224,11 @@ proc gdb_unload {} {
send_gdb "y\n" answer
exp_continue
}
--- a/gdb/testsuite/lib/pascal.exp
+++ b/gdb/testsuite/lib/pascal.exp
@@ -37,6 +37,9 @@ proc pascal_init {} {
- global pascal_compiler_is_fpc
- global gpc_compiler
- global fpc_compiler
-+ global fpcversion_major
-+ global fpcversion_minor
-+ global fpcversion_release
+ gdb_persistent_global pascal_compiler_is_fpc
+ gdb_persistent_global gpc_compiler
+ gdb_persistent_global fpc_compiler
++ gdb_persistent_global fpcversion_major
++ gdb_persistent_global fpcversion_minor
++ gdb_persistent_global fpcversion_release
global env
if { $pascal_init_done == 1 } {
+ set fpcversion_major 1
+ set fpcversion_minor 0
+ set fpcversion_release 0
-+ set fpcversion [ remote_exec host $fpc_compiler "-iV" ]
++ set fpcversion [ remote_exec host $fpc_compiler "-iV" ]
+ if [regexp {.*([0-9]+)\.([0-9]+)\.([0-9]+).?} $fpcversion] {
+ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\1} fpcversion_major
+ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\2} fpcversion_minor
# Where is expat? This will be empty if expat was not available.
LIBEXPAT = @LIBEXPAT@
@@ -613,7 +613,7 @@ CLIBS = $(SIM) $(READLINE) $(OPCODES) $(
- $(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) $(LIBIPT) \
- $(LIBIBERTY) $(WIN32LIBS) $(LIBGNU) $(LIBICONV) $(LIBMPFR) \
- $(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS)
--CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) $(LIBCTF) \
-+CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(LIBCTF) \
- $(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU)
+ $(WIN32LIBS) $(LIBGNU) $(LIBICONV) \
+ $(LIBMPFR) $(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS) \
+ $(DEBUGINFOD_LIBS)
+-CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) $(CTF_DEPS) \
++CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(CTF_DEPS) \
+ $(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) \
+ $(LIBSUPPORT)
- DIST = gdb
--- gdb-7.4.50.20120120/Makefile.in.orig 2012-01-20 02:48:18.000000000 +0100
+++ gdb-7.4.50.20120120/Makefile.in 2012-03-17 10:35:14.194730128 +0100
@@ -922,7 +922,6 @@
maybe-install-strip-sim \
maybe-install-strip-texinfo \
@@ -51050,7 +51032,6 @@ all-stagefeedback-intl: maybe-all-stagef
- configure-gdb: maybe-configure-sim
- configure-gdb: maybe-all-gnulib
+ configure-gdb: maybe-all-gdbsupport
all-gdb: maybe-all-gnulib
+ all-gdb: maybe-all-gdbsupport
-all-gdb: maybe-all-readline
all-gdb: maybe-all-build-bison
all-gdb: maybe-all-sim
diff --git a/gdb/eval.c b/gdb/eval.c
--- a/gdb/eval.c
+++ b/gdb/eval.c
-@@ -372,29 +372,324 @@ init_array_element (struct value *array, struct value *element,
+@@ -371,29 +371,323 @@ init_array_element (struct value *array, struct value *element,
return index;
}
{
- int pc = (*pos) + 1;
- LONGEST low_bound, high_bound;
-- struct type *range = check_typedef (TYPE_INDEX_TYPE (value_type (array)));
+- struct type *range = check_typedef (value_type (array)->index_type ());
- enum range_type range_type
- = (enum range_type) longest_to_int (exp->elts[pc].longconst);
-
- *pos += 3;
-
- if (range_type == LOW_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT)
-- low_bound = TYPE_LOW_BOUND (range);
+- low_bound = range->bounds ()->low.const_val ();
- else
-- low_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
+- low_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
+ int i, dim_count = 0;
+ struct value *new_array = array;
+ struct type *array_type = check_typedef (value_type (new_array));
+ upper bound. */
+ if ((range->f90_range_type & SUBARRAY_LOW_BOUND)
+ == SUBARRAY_LOW_BOUND)
-+ range->low = value_as_long (evaluate_subexp (NULL_TYPE, exp,
++ range->low = value_as_long (evaluate_subexp (nullptr, exp,
+ pos, noside));
+ if ((range->f90_range_type & SUBARRAY_HIGH_BOUND)
+ == SUBARRAY_HIGH_BOUND)
-+ range->high = value_as_long (evaluate_subexp (NULL_TYPE, exp,
++ range->high = value_as_long (evaluate_subexp (nullptr, exp,
+ pos, noside));
+
+ /* Assign the user's stride value if provided. */
+ if ((range->f90_range_type & SUBARRAY_STRIDE) == SUBARRAY_STRIDE)
-+ range->stride = value_as_long (evaluate_subexp (NULL_TYPE, exp,
++ range->stride = value_as_long (evaluate_subexp (nullptr, exp,
+ pos, noside));
+
+ /* Assign the default stride value '1'. */
+ range->stride = 1;
- if (range_type == HIGH_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT)
-- high_bound = TYPE_HIGH_BOUND (range);
+- high_bound = range->bounds ()->high.const_val ();
- else
-- high_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
+- high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
+ /* Check the provided stride value is illegal, aka '0'. */
+ if (range->stride == 0)
+ error (_("Stride must not be 0"));
+ for (i = nargs - 1; i >= 0; i--)
+ {
+ struct subscript_store *index = &subscript_array[i];
-+ struct type *index_type = TYPE_INDEX_TYPE (array_type);
++ struct type *index_type = array_type->index_type ();
+
+ switch (index->kind)
+ {
+ /* If no lower bound was provided by the user, we take the
+ default boundary. Same for the high bound. */
+ if ((range->f90_range_type & SUBARRAY_LOW_BOUND) == 0)
-+ range->low = TYPE_LOW_BOUND (index_type);
++ range->low = index_type->bounds ()->low.const_val ();
+
+ if ((range->f90_range_type & SUBARRAY_HIGH_BOUND) == 0)
-+ range->high = TYPE_HIGH_BOUND (index_type);
++ range->high = index_type->bounds ()->high.const_val ();
+
+ /* Both user provided low and high bound have to be inside the
+ array bounds. Throw an error if not. */
-+ if (range->low < TYPE_LOW_BOUND (index_type)
-+ || range->low > TYPE_HIGH_BOUND (index_type)
-+ || range->high < TYPE_LOW_BOUND (index_type)
-+ || range->high > TYPE_HIGH_BOUND (index_type))
++ if (range->low < index_type->bounds ()->low.const_val ()
++ || range->low > index_type->bounds ()->high.const_val ()
++ || range->high < index_type->bounds ()->low.const_val ()
++ || range->high > index_type->bounds ()->high.const_val ())
+ error (_("provided bound(s) outside array bound(s)"));
+
+ /* For a negative stride the lower boundary must be larger than the
+ for (i = nargs - 1; i >= 0; i--)
+ {
+ struct subscript_store *index = &subscript_array[i];
-+ struct type *index_type = TYPE_INDEX_TYPE (array_type);
++ struct type *index_type = array_type->index_type ();
+
+ switch (index->kind)
+ {
+ cannot do the range checks for us. So we have to make sure
+ ourselves that the user provided index is inside the
+ array bounds. Throw an error if not. */
-+ if (index->U.number < TYPE_LOW_BOUND (index_type)
-+ && index->U.number > TYPE_HIGH_BOUND (index_type))
++ if (index->U.number < index_type->bounds ()->low.const_val ()
++ && index->U.number > index_type->bounds ()->high.const_val ())
+ error (_("provided bound(s) outside array bound(s)"));
+
-+ if (index->U.number > TYPE_LOW_BOUND (index_type)
-+ && index->U.number > TYPE_HIGH_BOUND (index_type))
++ if (index->U.number > index_type->bounds ()->low.const_val ()
++ && index->U.number > index_type->bounds ()->high.const_val ())
+ error (_("provided bound(s) outside array bound(s)"));
+
+ new_array = value_slice_1 (new_array,
+ elt_type,
+ range_type);
+
-+ TYPE_CODE (interim_array_type)
-+ = TYPE_CODE (value_type (new_array));
++ interim_array_type->set_code ( value_type (new_array)->code ());
+
+ v = allocate_value (interim_array_type);
+
}
-@@ -1235,19 +1530,6 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos,
+@@ -1233,19 +1527,6 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos,
return eval_call (exp, noside, nargs, argvec, var_func_name, expect_type);
}
- enum noside noside)
-{
- for (int i = 0; i < nargs; ++i)
-- evaluate_subexp (NULL_TYPE, exp, pos, noside);
+- evaluate_subexp (nullptr, exp, pos, noside);
-}
-
- struct value *
- evaluate_subexp_standard (struct type *expect_type,
- struct expression *exp, int *pos,
-@@ -1942,33 +2224,8 @@ evaluate_subexp_standard (struct type *expect_type,
+ /* Return true if type is integral or reference to integral */
+
+ static bool
+@@ -1953,33 +2234,8 @@ evaluate_subexp_standard (struct type *expect_type,
switch (code)
{
case TYPE_CODE_ARRAY:
case TYPE_CODE_PTR:
case TYPE_CODE_FUNC:
-@@ -2388,49 +2645,6 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -2400,49 +2656,6 @@ evaluate_subexp_standard (struct type *expect_type,
}
return (arg1);
- }
-
case BINOP_LOGICAL_AND:
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
-@@ -3350,6 +3564,9 @@ calc_f77_array_dims (struct type *array_type)
+@@ -3360,6 +3573,9 @@ calc_f77_array_dims (struct type *array_type)
int ndimen = 1;
struct type *tmp_type;
-+ if (TYPE_CODE (array_type) == TYPE_CODE_STRING)
++ if (array_type->code () == TYPE_CODE_STRING)
+ return 1;
+
- if ((TYPE_CODE (array_type) != TYPE_CODE_ARRAY))
+ if ((array_type->code () != TYPE_CODE_ARRAY))
error (_("Can't get dimensions for a non-array type"));
diff --git a/gdb/expprint.c b/gdb/expprint.c
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
-@@ -580,17 +580,14 @@ print_subexp_standard (struct expression *exp, int *pos,
+@@ -576,17 +576,14 @@ print_subexp_standard (struct expression *exp, int *pos,
longest_to_int (exp->elts[pc + 1].longconst);
*pos += 2;
print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
fputs_filtered (")", stream);
return;
-@@ -1107,22 +1104,24 @@ dump_subexp_body_standard (struct expression *exp,
+@@ -1103,22 +1100,24 @@ dump_subexp_body_standard (struct expression *exp,
switch (range_type)
{
fputs_filtered ("ExclusiveRange 'EXP..EXP'", stream);
break;
default:
-@@ -1130,11 +1129,9 @@ dump_subexp_body_standard (struct expression *exp,
+@@ -1126,11 +1125,9 @@ dump_subexp_body_standard (struct expression *exp,
break;
}
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
-@@ -936,7 +936,7 @@ create_range_type (struct type *result_type, struct type *index_type,
- TYPE_RANGE_DATA (result_type)->high = *high_bound;
- TYPE_RANGE_DATA (result_type)->bias = bias;
-
-- /* Initialize the stride to be a constant, the value will already be zero
-+ /* bias the stride to be a constant, the value will already be zero
- thanks to the use of TYPE_ZALLOC above. */
- TYPE_RANGE_DATA (result_type)->stride.kind = PROP_CONST;
-
-@@ -1001,7 +1001,8 @@ create_static_range_type (struct type *result_type, struct type *index_type,
- high.kind = PROP_CONST;
- high.data.const_val = high_bound;
+@@ -1006,7 +1006,8 @@ create_static_range_type (struct type *result_type, struct type *index_type,
+ low.set_const_val (low_bound);
+ high.set_const_val (high_bound);
- result_type = create_range_type (result_type, index_type, &low, &high, 0);
+ result_type = create_range_type (result_type, index_type,
return result_type;
}
-@@ -1236,6 +1237,7 @@ create_array_type_with_stride (struct type *result_type,
- if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0)
- low_bound = high_bound = 0;
- element_type = check_typedef (element_type);
-+
- /* Be careful when setting the array length. Ada arrays can be
- empty arrays with the high_bound being smaller than the low_bound.
- In such cases, the array length should be zero. */
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
-@@ -803,7 +803,6 @@ struct main_type
- /* * Union member used for range types. */
+@@ -1615,6 +1615,15 @@ extern unsigned type_align (struct type *);
+ space in struct type. */
+ extern bool set_type_align (struct type *, ULONGEST);
- struct range_bounds *bounds;
--
- } flds_bnds;
-
- /* * Slot to point to additional language-specific fields of this
-@@ -1365,6 +1364,15 @@ extern bool set_type_align (struct type *, ULONGEST);
- #define TYPE_BIT_STRIDE(range_type) \
- (TYPE_RANGE_DATA(range_type)->stride.data.const_val \
- * (TYPE_RANGE_DATA(range_type)->flag_is_byte_stride ? 8 : 1))
+#define TYPE_BYTE_STRIDE(range_type) \
+ TYPE_RANGE_DATA(range_type)->stride.data.const_val
+#define TYPE_BYTE_STRIDE_BLOCK(range_type) \
+#define TYPE_BYTE_STRIDE_KIND(range_type) \
+ TYPE_RANGE_DATA(range_type)->stride.kind
+
-
/* Property accessors for the type data location. */
#define TYPE_DATA_LOCATION(thistype) \
-@@ -1400,6 +1408,9 @@ extern bool set_type_align (struct type *, ULONGEST);
- TYPE_HIGH_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype))
- #define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \
- TYPE_LOW_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype))
+ ((thistype)->dyn_prop (DYN_PROP_DATA_LOCATION))
+@@ -1633,6 +1642,26 @@ extern bool set_type_align (struct type *, ULONGEST);
+ #define TYPE_ASSOCIATED_PROP(thistype) \
+ ((thistype)->dyn_prop (DYN_PROP_ASSOCIATED))
+
++/* Accessors for struct range_bounds data attached to an array type's
++ index type. */
++
++#define TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED(arraytype) \
++ ((arraytype)->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED)
++#define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \
++ (arraytype->index_type ()->bounds ().low.kind () == PROP_UNDEFINED)
+#define TYPE_ARRAY_STRIDE_IS_UNDEFINED(arraytype) \
-+ (TYPE_BYTE_STRIDE(TYPE_INDEX_TYPE(arraytype)) == 0)
++ (TYPE_BYTE_STRIDE(arraytype->index_type ()) == 0)
++
++
++#define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \
++ (TYPE_HIGH_BOUND((arraytype)->index_type ()))
+
++#define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \
++ (TYPE_LOW_BOUND((arraytype)->index_type ()))
++
++#define TYPE_ARRAY_BIT_STRIDE(arraytype) \
++ (TYPE_BIT_STRIDE((arraytype)->index_type ()))
++
+ /* C++ */
- #define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \
- (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype))))
+ #define TYPE_SELF_TYPE(thistype) internal_type_self_type (thistype)
diff --git a/gdb/parse.c b/gdb/parse.c
--- a/gdb/parse.c
+++ b/gdb/parse.c
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
-@@ -1224,13 +1224,11 @@ rust_range (struct expression *exp, int *pos, enum noside noside)
+@@ -1082,13 +1082,11 @@ rust_range (struct expression *exp, int *pos, enum noside noside)
kind = (enum range_type) longest_to_int (exp->elts[*pos + 1].longconst);
*pos += 3;
- if (kind == HIGH_BOUND_DEFAULT || kind == NONE_BOUND_DEFAULT
- || kind == NONE_BOUND_DEFAULT_EXCLUSIVE)
+ if ((kind & SUBARRAY_LOW_BOUND) == SUBARRAY_LOW_BOUND)
- low = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ low = evaluate_subexp (nullptr, exp, pos, noside);
- if (kind == LOW_BOUND_DEFAULT || kind == LOW_BOUND_DEFAULT_EXCLUSIVE
- || kind == NONE_BOUND_DEFAULT || kind == NONE_BOUND_DEFAULT_EXCLUSIVE)
+ if ((kind & SUBARRAY_HIGH_BOUND) == SUBARRAY_HIGH_BOUND)
- high = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ high = evaluate_subexp (nullptr, exp, pos, noside);
- bool inclusive = (kind == NONE_BOUND_DEFAULT || kind == LOW_BOUND_DEFAULT);
+ bool inclusive = (!((kind & SUBARRAY_HIGH_BOUND_EXCLUSIVE) == SUBARRAY_HIGH_BOUND_EXCLUSIVE));
if (noside == EVAL_SKIP)
return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1);
-@@ -1319,7 +1317,7 @@ rust_compute_range (struct type *type, struct value *range,
+@@ -1177,7 +1175,7 @@ rust_compute_range (struct type *type, struct value *range,
*low = 0;
*high = 0;
- *kind = BOTH_BOUND_DEFAULT;
+ *kind = SUBARRAY_NONE_BOUND;
- if (TYPE_NFIELDS (type) == 0)
+ if (type->num_fields () == 0)
return;
-@@ -1327,15 +1325,14 @@ rust_compute_range (struct type *type, struct value *range,
+@@ -1185,15 +1183,14 @@ rust_compute_range (struct type *type, struct value *range,
i = 0;
if (strcmp (TYPE_FIELD_NAME (type, 0), "start") == 0)
{
*low = value_as_long (value_field (range, 0));
++i;
}
- if (TYPE_NFIELDS (type) > i
+ if (type->num_fields () > i
&& strcmp (TYPE_FIELD_NAME (type, i), "end") == 0)
{
- *kind = (*kind == BOTH_BOUND_DEFAULT
*high = value_as_long (value_field (range, i));
if (rust_inclusive_range_type_p (type))
-@@ -1353,7 +1350,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
+@@ -1211,7 +1208,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
struct type *rhstype;
LONGEST low, high_bound;
/* Initialized to appease the compiler. */
LONGEST high = 0;
int want_slice = 0;
-@@ -1451,7 +1448,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
+@@ -1309,7 +1306,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
error (_("Cannot subscript non-array type"));
if (want_slice
low = low_bound;
if (low < 0)
error (_("Index less than zero"));
-@@ -1469,7 +1466,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
+@@ -1327,7 +1324,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
CORE_ADDR addr;
struct value *addrval, *tem;
diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortran/vla-sizeof.exp
--- a/gdb/testsuite/gdb.fortran/vla-sizeof.exp
+++ b/gdb/testsuite/gdb.fortran/vla-sizeof.exp
-@@ -32,7 +32,8 @@ gdb_test "print sizeof(vla1)" " = 0" "print sizeof non-allocated vla1"
+@@ -35,7 +35,8 @@ gdb_test "print sizeof(vla1)" " = 0" "print sizeof non-allocated vla1"
gdb_test "print sizeof(vla1(3,2,1))" \
"no such vector element \\(vector not allocated\\)" \
"print sizeof non-allocated indexed vla1"
"print sizeof non-allocated sliced vla1"
# Try to access value in allocated VLA
-@@ -41,7 +42,7 @@ gdb_continue_to_breakpoint "vla1-allocated"
+@@ -44,7 +45,7 @@ gdb_continue_to_breakpoint "vla1-allocated"
gdb_test "print sizeof(vla1)" " = 4000" "print sizeof allocated vla1"
gdb_test "print sizeof(vla1(3,2,1))" "4" \
"print sizeof element from allocated vla1"
"print sizeof sliced vla1"
# Try to access values in undefined pointer to VLA (dangling)
-@@ -49,7 +50,8 @@ gdb_test "print sizeof(pvla)" " = 0" "print sizeof non-associated pvla"
+@@ -52,7 +53,8 @@ gdb_test "print sizeof(pvla)" " = 0" "print sizeof non-associated pvla"
gdb_test "print sizeof(pvla(3,2,1))" \
"no such vector element \\(vector not associated\\)" \
"print sizeof non-associated indexed pvla"
"print sizeof non-associated sliced pvla"
# Try to access values in pointer to VLA and compare them
-@@ -58,7 +60,8 @@ gdb_continue_to_breakpoint "pvla-associated"
+@@ -61,7 +63,8 @@ gdb_continue_to_breakpoint "pvla-associated"
gdb_test "print sizeof(pvla)" " = 4000" "print sizeof associated pvla"
gdb_test "print sizeof(pvla(3,2,1))" "4" \
"print sizeof element from associated pvla"
diff --git a/gdb/valops.c b/gdb/valops.c
--- a/gdb/valops.c
+++ b/gdb/valops.c
-@@ -3797,13 +3797,42 @@ value_of_this_silent (const struct language_defn *lang)
+@@ -3756,13 +3756,42 @@ value_of_this_silent (const struct language_defn *lang)
struct value *
value_slice (struct value *array, int lowbound, int length)
- array_type = check_typedef (value_type (array));
+ /* Check for legacy code if we are actually dealing with an array or
+ string. */
- if (TYPE_CODE (array_type) != TYPE_CODE_ARRAY
- && TYPE_CODE (array_type) != TYPE_CODE_STRING)
+ if (array_type->code () != TYPE_CODE_ARRAY
+ && array_type->code () != TYPE_CODE_STRING)
error (_("cannot take slice of non-array"));
-@@ -3813,45 +3842,155 @@ value_slice (struct value *array, int lowbound, int length)
+@@ -3772,45 +3801,155 @@ value_slice (struct value *array, int lowbound, int length)
if (type_not_associated (array_type))
error (_("array not associated"));
-- range_type = TYPE_INDEX_TYPE (array_type);
-- if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
+- range_type = array_type->index_type ();
+- if (!get_discrete_bounds (range_type, &lowerbound, &upperbound))
- error (_("slice from bad array or bitstring"));
-+ ary_low_bound = TYPE_LOW_BOUND (TYPE_INDEX_TYPE (array_type));
-+ ary_high_bound = TYPE_HIGH_BOUND (TYPE_INDEX_TYPE (array_type));
++ ary_low_bound = array_type->index_type ()->bounds ()->low.const_val ();
++ ary_high_bound = array_type->index_type ()->bounds ()->high.const_val ();
+
+ /* When we are working on a multi-dimensional array, we need to get the
+ attributes of the underlying type. */
+ if (call_count > 1)
+ {
-+ ary_low_bound = TYPE_LOW_BOUND (TYPE_INDEX_TYPE (elt_type));
-+ ary_high_bound = TYPE_HIGH_BOUND (TYPE_INDEX_TYPE (elt_type));
++ ary_low_bound = elt_type->index_type ()->bounds ()->low.const_val ();
++ ary_high_bound = elt_type->index_type ()->bounds ()->high.const_val ();
+ elt_type = check_typedef (TYPE_TARGET_TYPE (elt_type));
+ row_count = TYPE_LENGTH (array_type)
+ / TYPE_LENGTH (TYPE_TARGET_TYPE (array_type));
+
+ elt_size = TYPE_LENGTH (elt_type);
+ elt_offs = lowbound - ary_low_bound;
++
++ elt_offs *= elt_size;
- if (lowbound < lowerbound || length < 0
- || lowbound + length - 1 > upperbound)
- error (_("slice out of range"));
-+ elt_offs *= elt_size;
-+
+ /* Check for valid user input. In case of Fortran this was already done
+ in the calling function. */
+ if (call_count == 1
+ array by setting slice_range_size. */
+ if (call_count == 1)
+ {
-+ range_type = TYPE_INDEX_TYPE (array_type);
++ range_type = array_type->index_type ();
+ slice_range_size = ary_low_bound + elem_count - 1;
+
+ /* Check if the array bounds are valid. */
+ accordingly. */
+ else
+ {
-+ range_type = TYPE_INDEX_TYPE (TYPE_TARGET_TYPE (array_type));
++ range_type = TYPE_TARGET_TYPE (array_type)->index_type ();
+ slice_range_size = ary_low_bound + (row_count * elem_count) - 1;
-+ ary_low_bound = TYPE_LOW_BOUND (range_type);
++ ary_low_bound = range_type->bounds ()->low.const_val ();
+ }
/* FIXME-type-allocation: need a way to free this type when we are
- LONGEST offset
- = (lowbound - lowerbound) * TYPE_LENGTH (check_typedef (element_type));
+ struct type *element_type;
-+
+
+- slice_type = create_array_type (NULL,
+- element_type,
+- slice_range_type);
+- slice_type->set_code (array_type->code ());
+ /* When both CALL_COUNT and STRIDE_LENGTH equal 1, we can use the legacy
+ code for subarrays. */
+ if (call_count == 1 && stride_length == 1)
+ element_type = TYPE_TARGET_TYPE (array_type);
+
+ slice_type = create_array_type (NULL, element_type, slice_range_type);
-
-- slice_type = create_array_type (NULL,
-- element_type,
-- slice_range_type);
-- TYPE_CODE (slice_type) = TYPE_CODE (array_type);
-+ TYPE_CODE (slice_type) = TYPE_CODE (array_type);
++
++ slice_type->set_code (array_type->code ());
- if (VALUE_LVAL (array) == lval_memory && value_lazy (array))
- slice = allocate_value_lazy (slice_type);
+
+ slice_type = create_array_type (NULL, element_type, slice_range_type);
+
-+ /* If we have a one dimensional array, we copy its TYPE_CODE. For a
-+ multi dimensional array we copy the embedded type's TYPE_CODE. */
++ /* If we have a one dimensional array, we copy its type code. For a
++ multi dimensional array we copy the embedded type's type code. */
+ if (call_count == 1)
-+ TYPE_CODE (slice_type) = TYPE_CODE (array_type);
++ slice_type->set_code (array_type->code ());
+ else
-+ TYPE_CODE (slice_type) = TYPE_CODE (TYPE_TARGET_TYPE (array_type));
++ slice_type->set_code ((TYPE_TARGET_TYPE (array_type)->code ()));
+
+ v = allocate_value (slice_type);
+
+ return v;
}
- /* Create a value for a FORTRAN complex number. Currently most of the
+ /* See value.h. */
diff --git a/gdb/value.h b/gdb/value.h
--- a/gdb/value.h
+++ b/gdb/value.h
-@@ -1145,6 +1145,8 @@ extern struct value *varying_to_slice (struct value *);
+@@ -1144,6 +1144,8 @@ extern struct value *varying_to_slice (struct value *);
extern struct value *value_slice (struct value *, int, int);
+extern struct value *value_slice_1 (struct value *, int, int, int, int);
+
- extern struct value *value_literal_complex (struct value *, struct value *,
- struct type *);
-
+ /* Create a complex number. The type is the complex type; the values
+ are cast to the underlying scalar type before the complex number is
+ created. */
+++ /dev/null
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Fedora GDB patches <invalid@email.com>
-Date: Fri, 27 Oct 2017 21:07:50 +0200
-Subject: gdb-vla-intel-fortran-vla-strings.patch
-
-;;=push
-
-git diff --stat -p gdb/master...gdb/users/bheckel/fortran-vla-strings
-0ad7d8d1a3a36c6e04e3b6d37d8825f18d595723
-
- gdb/NEWS | 2 +
- gdb/c-valprint.c | 22 +++++
- gdb/dwarf2read.c | 158 +++++++++++++++++++++++++-----
- gdb/f-typeprint.c | 93 +++++++++---------
- gdb/gdbtypes.c | 44 ++++++++-
- gdb/testsuite/gdb.cp/vla-cxx.cc | 9 ++
- gdb/testsuite/gdb.cp/vla-cxx.exp | 9 ++
- gdb/testsuite/gdb.fortran/pointers.exp | 143 +++++++++++++++++++++++++++
- gdb/testsuite/gdb.fortran/pointers.f90 | 109 +++++++++++++++++++++
- gdb/testsuite/gdb.fortran/print_type.exp | 100 +++++++++++++++++++
- gdb/testsuite/gdb.fortran/vla-ptype.exp | 12 +--
- gdb/testsuite/gdb.fortran/vla-strings.exp | 103 +++++++++++++++++++
- gdb/testsuite/gdb.fortran/vla-strings.f90 | 39 ++++++++
- gdb/testsuite/gdb.fortran/vla-type.exp | 7 +-
- gdb/testsuite/gdb.fortran/vla-value.exp | 12 ++-
- gdb/testsuite/gdb.mi/mi-var-child-f.exp | 7 +-
- gdb/testsuite/gdb.mi/mi-vla-fortran.exp | 27 ++---
- gdb/typeprint.c | 19 ++++
- gdb/valops.c | 16 ++-
- gdb/valprint.c | 6 --
- 20 files changed, 827 insertions(+), 110 deletions(-)
-
-diff --git a/gdb/NEWS b/gdb/NEWS
---- a/gdb/NEWS
-+++ b/gdb/NEWS
-@@ -805,6 +805,8 @@ SH-5/SH64 running OpenBSD SH-5/SH64 support in sh*-*-openbsd*
-
- *** Changes in GDB 8.1
-
-+* Fortran: Support pointers to dynamic types.
-+
- * GDB now supports dynamically creating arbitrary register groups specified
- in XML target descriptions. This allows for finer grain grouping of
- registers on systems with a large amount of registers.
-diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
---- a/gdb/c-valprint.c
-+++ b/gdb/c-valprint.c
-@@ -649,6 +649,28 @@ c_value_print (struct value *val, struct ui_file *stream,
- else
- {
- /* normal case */
-+ if (TYPE_CODE (type) == TYPE_CODE_PTR
-+ && 1 == is_dynamic_type (type))
-+ {
-+ CORE_ADDR addr;
-+ if (NULL != TYPE_DATA_LOCATION (TYPE_TARGET_TYPE (type)))
-+ addr = value_address (val);
-+ else
-+ addr = value_as_address (val);
-+
-+ /* We resolve the target-type only when the
-+ pointer is associated. */
-+ if ((addr != 0)
-+ && (0 == type_not_associated (type)))
-+ TYPE_TARGET_TYPE (type) =
-+ resolve_dynamic_type (TYPE_TARGET_TYPE (type),
-+ NULL, addr);
-+ }
-+ else
-+ {
-+ /* Do nothing. References are already resolved from the beginning,
-+ only pointers are resolved when we actual need the target. */
-+ }
- fprintf_filtered (stream, "(");
- type_print (value_type (val), "", stream, -1);
- fprintf_filtered (stream, ") ");
-diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
---- a/gdb/dwarf2read.c
-+++ b/gdb/dwarf2read.c
-@@ -1827,7 +1827,10 @@ static void read_signatured_type (struct signatured_type *);
-
- static int attr_to_dynamic_prop (const struct attribute *attr,
- struct die_info *die, struct dwarf2_cu *cu,
-- struct dynamic_prop *prop, struct type *type);
-+ struct dynamic_prop *prop,
-+ struct type *default_type,
-+ const gdb_byte *additional_data,
-+ int additional_data_size);
-
- /* memory allocation interface */
-
-@@ -13799,7 +13802,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
- newobj->static_link
- = XOBNEW (&objfile->objfile_obstack, struct dynamic_prop);
- attr_to_dynamic_prop (attr, die, cu, newobj->static_link,
-- dwarf2_per_cu_addr_type (cu->per_cu));
-+ dwarf2_per_cu_addr_type (cu->per_cu), NULL, 0);
- }
-
- cu->list_in_scope = cu->get_builder ()->get_local_symbols ();
-@@ -16565,7 +16568,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
- byte_stride_prop
- = (struct dynamic_prop *) alloca (sizeof (struct dynamic_prop));
- stride_ok = attr_to_dynamic_prop (attr, die, cu, byte_stride_prop,
-- prop_type);
-+ prop_type, NULL, 0);
- if (!stride_ok)
- {
- complaint (_("unable to read array DW_AT_byte_stride "
-@@ -17325,7 +17328,7 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
- struct attribute *attr;
- struct dynamic_prop prop;
- bool length_is_constant = true;
-- LONGEST length;
-+ ULONGEST length = UINT_MAX;
-
- /* There are a couple of places where bit sizes might be made use of
- when parsing a DW_TAG_string_type, however, no producer that we know
-@@ -17346,6 +17349,10 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
- }
- }
-
-+ index_type = objfile_type (objfile)->builtin_int;
-+ range_type = create_static_range_type (NULL, index_type, 1, length);
-+
-+ /* If DW_AT_string_length is defined, the length is stored in memory. */
- attr = dwarf2_attr (die, DW_AT_string_length, cu);
- if (attr != nullptr && !attr_form_is_constant (attr))
- {
-@@ -17372,13 +17379,71 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
- }
-
- /* Convert the attribute into a dynamic property. */
-- if (!attr_to_dynamic_prop (attr, die, cu, &prop, prop_type))
-+ if (!attr_to_dynamic_prop (attr, die, cu, &prop, prop_type, NULL, 0))
- length = 1;
- else
- length_is_constant = false;
- }
- else if (attr != nullptr)
- {
-+ if (attr_form_is_block (attr))
-+ {
-+ struct attribute *byte_size, *bit_size;
-+ struct dynamic_prop high;
-+
-+ byte_size = dwarf2_attr (die, DW_AT_byte_size, cu);
-+ bit_size = dwarf2_attr (die, DW_AT_bit_size, cu);
-+
-+ /* DW_AT_byte_size should never occur in combination with
-+ DW_AT_bit_size. */
-+ if (byte_size != NULL && bit_size != NULL)
-+ complaint (_("DW_AT_byte_size AND "
-+ "DW_AT_bit_size found together at the same time."));
-+
-+ /* If DW_AT_string_length AND DW_AT_byte_size exist together,
-+ DW_AT_byte_size describes the number of bytes that should be read
-+ from the length memory location. */
-+ if (byte_size != NULL)
-+ {
-+ /* Build new dwarf2_locexpr_baton structure with additions to the
-+ data attribute, to reflect DWARF specialities to get address
-+ sizes. */
-+ const gdb_byte append_ops[] =
-+ {
-+ /* DW_OP_deref_size: size of an address on the target machine
-+ (bytes), where the size will be specified by the next
-+ operand. */
-+ DW_OP_deref_size,
-+ /* Operand for DW_OP_deref_size. */
-+ (gdb_byte) DW_UNSND(byte_size) };
-+
-+ if (!attr_to_dynamic_prop (attr, die, cu, &high, index_type,
-+ append_ops, ARRAY_SIZE(append_ops)))
-+ complaint (_("Could not parse DW_AT_byte_size"));
-+ }
-+ else if (bit_size != NULL)
-+ complaint (_("DW_AT_string_length AND "
-+ "DW_AT_bit_size found but not supported yet."));
-+ /* If DW_AT_string_length WITHOUT DW_AT_byte_size exist, the default
-+ is the address size of the target machine. */
-+ else
-+ {
-+ const gdb_byte append_ops[] =
-+ { DW_OP_deref };
-+
-+ if (!attr_to_dynamic_prop (attr, die, cu, &high, index_type,
-+ append_ops, ARRAY_SIZE(append_ops)))
-+ complaint (_("Could not parse DW_AT_string_length"));
-+ }
-+
-+ TYPE_RANGE_DATA (range_type)->high = high;
-+ }
-+ else
-+ {
-+ TYPE_HIGH_BOUND (range_type) = DW_UNSND(attr);
-+ TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST;
-+ }
-+
- /* This DW_AT_string_length just contains the length with no
- indirection. There's no need to create a dynamic property in this
- case. Pass 0 for the default value as we know it will not be
-@@ -17392,6 +17457,20 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
- }
- else
- {
-+ /* Check for the DW_AT_byte_size attribute, which represents the length
-+ in this case. */
-+ attr = dwarf2_attr (die, DW_AT_byte_size, cu);
-+ if (attr)
-+ {
-+ TYPE_HIGH_BOUND (range_type) = DW_UNSND(attr);
-+ TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST;
-+ }
-+ else
-+ {
-+ TYPE_HIGH_BOUND (range_type) = 1;
-+ TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST;
-+ }
-+
- /* Use 1 as a fallback length if we have nothing else. */
- length = 1;
- }
-@@ -17407,6 +17486,7 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
- low_bound.data.const_val = 1;
- range_type = create_range_type (NULL, index_type, &low_bound, &prop, 0);
- }
-+
- char_type = language_string_char_type (cu->language_defn, gdbarch);
- type = create_string_type (NULL, char_type, range_type);
-
-@@ -17858,7 +17938,8 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
- static int
- attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
- struct dwarf2_cu *cu, struct dynamic_prop *prop,
-- struct type *default_type)
-+ struct type *default_type,
-+ const gdb_byte *additional_data, int additional_data_size)
- {
- struct dwarf2_property_baton *baton;
- struct obstack *obstack
-@@ -17885,9 +17966,30 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
- baton->locexpr.is_reference = false;
- break;
- }
-+
-+ if (additional_data != NULL && additional_data_size > 0)
-+ {
-+ gdb_byte *data;
-+
-+ data = (gdb_byte *) obstack_alloc(
-+ &cu->per_cu->dwarf2_per_objfile->objfile->objfile_obstack,
-+ DW_BLOCK (attr)->size + additional_data_size);
-+ memcpy (data, DW_BLOCK (attr)->data, DW_BLOCK (attr)->size);
-+ memcpy (data + DW_BLOCK (attr)->size, additional_data,
-+ additional_data_size);
-+
-+ baton->locexpr.data = data;
-+ baton->locexpr.size = DW_BLOCK (attr)->size + additional_data_size;
-+ }
-+ else
-+ {
-+ baton->locexpr.data = DW_BLOCK (attr)->data;
-+ baton->locexpr.size = DW_BLOCK (attr)->size;
-+ }
-+
- prop->data.baton = baton;
- prop->kind = PROP_LOCEXPR;
-- gdb_assert (prop->data.baton != NULL);
-+ gdb_assert(prop->data.baton != NULL);
- }
- else if (attr_form_is_ref (attr))
- {
-@@ -17920,9 +18022,29 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
- baton = XOBNEW (obstack, struct dwarf2_property_baton);
- baton->property_type = die_type (target_die, target_cu);
- baton->locexpr.per_cu = cu->per_cu;
-- baton->locexpr.size = DW_BLOCK (target_attr)->size;
-- baton->locexpr.data = DW_BLOCK (target_attr)->data;
- baton->locexpr.is_reference = true;
-+
-+ if (additional_data != NULL && additional_data_size > 0)
-+ {
-+ gdb_byte *data;
-+
-+ data = (gdb_byte *) obstack_alloc (&cu->per_cu->dwarf2_per_objfile->objfile->objfile_obstack,
-+ DW_BLOCK (target_attr)->size + additional_data_size);
-+ memcpy (data, DW_BLOCK (target_attr)->data,
-+ DW_BLOCK (target_attr)->size);
-+ memcpy (data + DW_BLOCK (target_attr)->size,
-+ additional_data, additional_data_size);
-+
-+ baton->locexpr.data = data;
-+ baton->locexpr.size = (DW_BLOCK (target_attr)->size
-+ + additional_data_size);
-+ }
-+ else
-+ {
-+ baton->locexpr.data = DW_BLOCK (target_attr)->data;
-+ baton->locexpr.size = DW_BLOCK (target_attr)->size;
-+ }
-+
- prop->data.baton = baton;
- prop->kind = PROP_LOCEXPR;
- gdb_assert (prop->data.baton != NULL);
-@@ -18099,8 +18221,8 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
- }
-
- attr = dwarf2_attr (die, DW_AT_lower_bound, cu);
-- if (attr != nullptr)
-- attr_to_dynamic_prop (attr, die, cu, &low, base_type);
-+ if (attr)
-+ attr_to_dynamic_prop (attr, die, cu, &low, base_type, NULL, 0);
- else if (!low_default_is_valid)
- complaint (_("Missing DW_AT_lower_bound "
- "- DIE at %s [in module %s]"),
-@@ -18109,10 +18231,10 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
-
- struct attribute *attr_ub, *attr_count;
- attr = attr_ub = dwarf2_attr (die, DW_AT_upper_bound, cu);
-- if (!attr_to_dynamic_prop (attr, die, cu, &high, base_type))
-+ if (!attr_to_dynamic_prop (attr, die, cu, &high, base_type, NULL, 0))
- {
- attr = attr_count = dwarf2_attr (die, DW_AT_count, cu);
-- if (attr_to_dynamic_prop (attr, die, cu, &high, base_type))
-+ if (attr_to_dynamic_prop (attr, die, cu, &high, base_type, NULL, 0))
- {
- /* If bounds are constant do the final calculation here. */
- if (low.kind == PROP_CONST && high.kind == PROP_CONST)
-@@ -18164,7 +18286,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
- struct type *prop_type
- = dwarf2_per_cu_addr_sized_int_type (cu->per_cu, false);
- attr_to_dynamic_prop (attr_byte_stride, die, cu, &byte_stride_prop,
-- prop_type);
-+ prop_type, NULL, 0);
- }
-
- struct dynamic_prop bit_stride_prop;
-@@ -18185,7 +18307,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
- struct type *prop_type
- = dwarf2_per_cu_addr_sized_int_type (cu->per_cu, false);
- attr_to_dynamic_prop (attr_bit_stride, die, cu, &bit_stride_prop,
-- prop_type);
-+ prop_type, NULL, 0);
- }
- }
-
-@@ -25879,7 +26001,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
- {
- struct type *prop_type
- = dwarf2_per_cu_addr_sized_int_type (cu->per_cu, false);
-- if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type))
-+ if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type, NULL, 0))
- add_dyn_prop (DYN_PROP_ALLOCATED, prop, type);
- }
- else if (attr != NULL)
-@@ -25895,7 +26017,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
- {
- struct type *prop_type
- = dwarf2_per_cu_addr_sized_int_type (cu->per_cu, false);
-- if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type))
-+ if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type, NULL, 0))
- add_dyn_prop (DYN_PROP_ASSOCIATED, prop, type);
- }
- else if (attr != NULL)
-@@ -25908,7 +26030,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
- /* Read DW_AT_data_location and set in type. */
- attr = dwarf2_attr (die, DW_AT_data_location, cu);
- if (attr_to_dynamic_prop (attr, die, cu, &prop,
-- dwarf2_per_cu_addr_type (cu->per_cu)))
-+ dwarf2_per_cu_addr_type (cu->per_cu), NULL, 0))
- add_dyn_prop (DYN_PROP_DATA_LOCATION, prop, type);
-
- if (dwarf2_per_objfile->die_type_hash == NULL)
-diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
---- a/gdb/f-typeprint.c
-+++ b/gdb/f-typeprint.c
-@@ -197,15 +197,14 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
- print_rank_only = true;
- else if ((TYPE_ASSOCIATED_PROP (type)
- && PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_ASSOCIATED_PROP (type)))
-- || (TYPE_ALLOCATED_PROP (type)
-- && PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_ALLOCATED_PROP (type)))
-- || (TYPE_DATA_LOCATION (type)
-- && PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_DATA_LOCATION (type))))
-- {
-- /* This case exist when we ptype a typename which has the dynamic
-- properties but cannot be resolved as there is no object. */
-- print_rank_only = true;
-- }
-+ || (TYPE_ALLOCATED_PROP (type)
-+ && PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_ALLOCATED_PROP (type)))
-+ || (TYPE_DATA_LOCATION (type)
-+ && PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_DATA_LOCATION (type))))
-+ /* This case exist when we ptype a typename which has the
-+ dynamic properties but cannot be resolved as there is
-+ no object. */
-+ print_rank_only = true;
-
- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY)
- f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
-@@ -217,8 +216,9 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
- else
- {
- LONGEST lower_bound = f77_get_lowerbound (type);
-+
- if (lower_bound != 1) /* Not the default. */
-- fprintf_filtered (stream, "%s:", plongest (lower_bound));
-+ fprintf_filtered (stream, "%s:", plongest (lower_bound));
-
- /* Make sure that, if we have an assumed size array, we
- print out a warning and print the upperbound as '*'. */
-@@ -229,7 +229,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
- {
- LONGEST upper_bound = f77_get_upperbound (type);
-
-- fputs_filtered (plongest (upper_bound), stream);
-+ fprintf_filtered (stream, "%s", plongest (upper_bound));
- }
- }
-
-@@ -249,7 +249,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
- case TYPE_CODE_REF:
- f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1, 0,
- arrayprint_recurse_level, false);
-- fprintf_filtered (stream, " )");
-+ fprintf_filtered (stream, ")");
- break;
-
- case TYPE_CODE_FUNC:
-diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
---- a/gdb/gdbtypes.c
-+++ b/gdb/gdbtypes.c
-@@ -1939,7 +1939,8 @@ is_dynamic_type_internal (struct type *type, int top_level)
- type = check_typedef (type);
-
- /* We only want to recognize references at the outermost level. */
-- if (top_level && TYPE_CODE (type) == TYPE_CODE_REF)
-+ if (top_level &&
-+ (TYPE_CODE (type) == TYPE_CODE_REF || TYPE_CODE (type) == TYPE_CODE_PTR))
- type = check_typedef (TYPE_TARGET_TYPE (type));
-
- /* Types that have a dynamic TYPE_DATA_LOCATION are considered
-@@ -1972,10 +1973,10 @@ is_dynamic_type_internal (struct type *type, int top_level)
- || is_dynamic_type_internal (TYPE_TARGET_TYPE (type), 0));
- }
-
-- case TYPE_CODE_STRING:
- /* Strings are very much like an array of characters, and can be
- treated as one here. */
- case TYPE_CODE_ARRAY:
-+ case TYPE_CODE_STRING:
- {
- gdb_assert (TYPE_NFIELDS (type) == 1);
-
-@@ -2139,11 +2140,15 @@ resolve_dynamic_array_or_string (struct type *type,
-
- ary_dim = check_typedef (TYPE_TARGET_TYPE (elt_type));
-
-- if (ary_dim != NULL && TYPE_CODE (ary_dim) == TYPE_CODE_ARRAY)
-+ if (ary_dim != NULL && (TYPE_CODE (ary_dim) == TYPE_CODE_ARRAY
-+ || TYPE_CODE (ary_dim) == TYPE_CODE_STRING))
- elt_type = resolve_dynamic_array_or_string (ary_dim, addr_stack);
- else
- elt_type = TYPE_TARGET_TYPE (type);
-
-+ if (TYPE_CODE (type) == TYPE_CODE_STRING)
-+ return create_string_type (type, elt_type, range_type);
-+
- prop = get_dyn_prop (DYN_PROP_BYTE_STRIDE, type);
- if (prop != NULL)
- {
-@@ -2295,6 +2300,28 @@ resolve_dynamic_struct (struct type *type,
- return resolved_type;
- }
-
-+/* Worker for pointer types. */
-+
-+static struct type *
-+resolve_dynamic_pointer (struct type *type,
-+ struct property_addr_info *addr_stack)
-+{
-+ struct dynamic_prop *prop;
-+ CORE_ADDR value;
-+
-+ type = copy_type (type);
-+
-+ /* Resolve associated property. */
-+ prop = TYPE_ASSOCIATED_PROP (type);
-+ if (prop != NULL && dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
-+ {
-+ TYPE_DYN_PROP_ADDR (prop) = value;
-+ TYPE_DYN_PROP_KIND (prop) = PROP_CONST;
-+ }
-+
-+ return type;
-+}
-+
- /* Worker for resolved_dynamic_type. */
-
- static struct type *
-@@ -2349,6 +2376,9 @@ resolve_dynamic_type_internal (struct type *type,
- case TYPE_CODE_ARRAY:
- resolved_type = resolve_dynamic_array_or_string (type, addr_stack);
- break;
-+ case TYPE_CODE_PTR:
-+ resolved_type = resolve_dynamic_pointer (type, addr_stack);
-+ break;
-
- case TYPE_CODE_RANGE:
- resolved_type = resolve_dynamic_range (type, addr_stack);
-diff --git a/gdb/testsuite/gdb.cp/vla-cxx.cc b/gdb/testsuite/gdb.cp/vla-cxx.cc
---- a/gdb/testsuite/gdb.cp/vla-cxx.cc
-+++ b/gdb/testsuite/gdb.cp/vla-cxx.cc
-@@ -15,6 +15,10 @@
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-+extern "C" {
-+#include <stddef.h>
-+}
-+
- struct container;
-
- struct element
-@@ -40,11 +44,16 @@ int main(int argc, char **argv)
- typedef typeof (vla) &vlareftypedef;
- vlareftypedef vlaref2 (vla);
- container c;
-+ typeof (vla) *ptr = NULL;
-+
-+ // Before pointer assignment
-+ ptr = &vla;
-
- for (int i = 0; i < z; ++i)
- vla[i] = 5 + 2 * i;
-
- // vlas_filled
- vla[0] = 2 * vla[0];
-+
- return vla[2];
- }
-diff --git a/gdb/testsuite/gdb.cp/vla-cxx.exp b/gdb/testsuite/gdb.cp/vla-cxx.exp
---- a/gdb/testsuite/gdb.cp/vla-cxx.exp
-+++ b/gdb/testsuite/gdb.cp/vla-cxx.exp
-@@ -23,6 +23,12 @@ if ![runto_main] {
- return -1
- }
-
-+gdb_breakpoint [gdb_get_line_number "Before pointer assignment"]
-+gdb_continue_to_breakpoint "Before pointer assignment"
-+gdb_test "ptype ptr" "int \\(\\*\\)\\\[variable length\\\]" "ptype ptr, Before pointer assignment"
-+gdb_test "print ptr" "\\(int \\(\\*\\)\\\[variable length\\\]\\) 0x0" "print ptr, Before pointer assignment"
-+gdb_test "print *ptr" "Cannot access memory at address 0x0" "print *ptr, Before pointer assignment"
-+
- gdb_breakpoint [gdb_get_line_number "vlas_filled"]
- gdb_continue_to_breakpoint "vlas_filled"
-
-@@ -33,3 +39,6 @@ gdb_test "print vlaref" " = \\(int \\(&\\)\\\[3\\\]\\) @$hex: \\{5, 7, 9\\}"
- # bug being tested, it's better not to depend on the exact spelling.
- gdb_test "print vlaref2" " = \\(.*\\) @$hex: \\{5, 7, 9\\}"
- gdb_test "print c" " = \\{e = \\{c = @$hex\\}\\}"
-+gdb_test "ptype ptr" "int \\(\\*\\)\\\[3\\\]"
-+gdb_test "print ptr" "\\(int \\(\\*\\)\\\[3\\\]\\) $hex"
-+gdb_test "print *ptr" " = \\{5, 7, 9\\}"
-diff --git a/gdb/testsuite/gdb.fortran/pointers.exp b/gdb/testsuite/gdb.fortran/pointers.exp
-new file mode 100644
---- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/pointers.exp
-@@ -0,0 +1,143 @@
-+# Copyright 2016 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 "pointers.f90"
-+load_lib fortran.exp
-+
-+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
-+ {debug f90 quiet}] } {
-+ return -1
-+}
-+
-+if ![runto_main] {
-+ untested "could not run to main"
-+ return -1
-+}
-+
-+# Depending on the compiler being used, the type names can be printed differently.
-+set logical [fortran_logical4]
-+set real [fortran_real4]
-+set int [fortran_int4]
-+set complex [fortran_complex4]
-+
-+
-+gdb_breakpoint [gdb_get_line_number "Before pointer assignment"]
-+gdb_continue_to_breakpoint "Before pointer assignment"
-+gdb_test "print logp" "= \\(PTR TO -> \\( $logical\\)\\) 0x0" "print logp, not associated"
-+gdb_test "print *logp" "Cannot access memory at address 0x0" "print *logp, not associated"
-+gdb_test "print comp" "= \\(PTR TO -> \\( $complex\\)\\) 0x0" "print comp, not associated"
-+gdb_test "print *comp" "Cannot access memory at address 0x0" "print *comp, not associated"
-+gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1\\)\\) 0x0" "print charp, not associated"
-+gdb_test "print *charp" "Cannot access memory at address 0x0" "print *charp, not associated"
-+gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3\\)\\) 0x0" "print charap, not associated"
-+gdb_test "print *charap" "Cannot access memory at address 0x0" "print *charap, not associated"
-+gdb_test "print intp" "= \\(PTR TO -> \\( $int\\)\\) 0x0" "print intp, not associated"
-+gdb_test "print *intp" "Cannot access memory at address 0x0" "print *intp, not associated"
-+set test "print intap, not associated"
-+gdb_test_multiple "print intap" $test {
-+ -re " = \\(PTR TO -> \\( $int \\(:,:\\)\\)\\) <not associated>\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+ -re " = <not associated>\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+}
-+gdb_test "print realp" "= \\(PTR TO -> \\( $real\\)\\) 0x0" "print realp, not associated"
-+gdb_test "print *realp" "Cannot access memory at address 0x0" "print *realp, not associated"
-+gdb_test "print \$my_var = intp" "= \\(PTR TO -> \\( $int\\)\\) 0x0"
-+set test "print cyclicp1, not associated"
-+gdb_test_multiple "print cyclicp1" $test {
-+ -re "= \\( i = -?\\d+, p = 0x0 \\)\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+ -re "= \\( i = -?\\d+, p = <not associated> \\)\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+}
-+set test "print cyclicp1%p, not associated"
-+gdb_test_multiple "print cyclicp1%p" $test {
-+ -re "= \\(PTR TO -> \\( Type typewithpointer\\)\\) 0x0\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+ -re "= \\(PTR TO -> \\( Type typewithpointer\\)\\) <not associated>\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+}
-+
-+
-+gdb_breakpoint [gdb_get_line_number "Before value assignment"]
-+gdb_continue_to_breakpoint "Before value assignment"
-+gdb_test "print *(twop)%ivla2" "= <not allocated>"
-+
-+
-+gdb_breakpoint [gdb_get_line_number "After value assignment"]
-+gdb_continue_to_breakpoint "After value assignment"
-+gdb_test "print logp" "= \\(PTR TO -> \\( $logical\\)\\) $hex\( <.*>\)?"
-+gdb_test "print *logp" "= \\.TRUE\\."
-+gdb_test "print comp" "= \\(PTR TO -> \\( $complex\\)\\) $hex\( <.*>\)?"
-+gdb_test "print *comp" "= \\(1,2\\)"
-+gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1\\)\\) $hex\( <.*>\)?"
-+gdb_test "print *charp" "= 'a'"
-+gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3\\)\\) $hex\( <.*>\)?"
-+gdb_test "print *charap" "= 'abc'"
-+gdb_test "print intp" "= \\(PTR TO -> \\( $int\\)\\) $hex\( <.*>\)?"
-+gdb_test "print *intp" "= 10"
-+set test_name "print intap, associated"
-+gdb_test_multiple "print intap" $test_name {
-+ -re "= \\(\\( 1, 1, 3(, 1){7}\\) \\( 1(, 1){9}\\) \\)\r\n$gdb_prompt $" {
-+ pass $test_name
-+ }
-+ -re "= \\(PTR TO -> \\( $int \\(10,2\\)\\)\\) $hex\( <.*>\)?\r\n$gdb_prompt $" {
-+ gdb_test "print *intap" "= \\(\\( 1, 1, 3(, 1){7}\\) \\( 1(, 1){9}\\) \\)"
-+ pass $test_name
-+ }
-+}
-+set test_name "print intvlap, associated"
-+gdb_test_multiple "print intvlap" $test_name {
-+ -re "= \\(2, 2, 2, 4(, 2){6}\\)\r\n$gdb_prompt $" {
-+ pass $test_name
-+ }
-+ -re "= \\(PTR TO -> \\( $int \\(10\\)\\)\\) $hex\( <.*>\)?\r\n$gdb_prompt $" {
-+ gdb_test "print *intvlap" "= \\(2, 2, 2, 4(, 2){6}\\)"
-+ pass $test_name
-+ }
-+}
-+gdb_test "print realp" "= \\(PTR TO -> \\( $real\\)\\) $hex\( <.*>\)?"
-+gdb_test "print *realp" "= 3\\.14000\\d+"
-+gdb_test "print arrayOfPtr(2)%p" "= \\(PTR TO -> \\( Type two\\)\\) $hex\( <.*>\)?"
-+gdb_test "print *(arrayOfPtr(2)%p)" "= \\( ivla1 = \\(11, 12, 13\\), ivla2 = \\(\\( 211, 221\\) \\( 212, 222\\) \\) \\)"
-+set test_name "print arrayOfPtr(3)%p"
-+gdb_test_multiple $test_name $test_name {
-+ -re "= \\(PTR TO -> \\( Type two\\)\\) <not associated>\r\n$gdb_prompt $" {
-+ pass $test_name
-+ }
-+ -re "= \\(PTR TO -> \\( Type two\\)\\) 0x0\r\n$gdb_prompt $" {
-+ pass $test_name
-+ }
-+}
-+set test_name "print *(arrayOfPtr(3)%p), associated"
-+gdb_test_multiple "print *(arrayOfPtr(3)%p)" $test_name {
-+ -re "Cannot access memory at address 0x0\r\n$gdb_prompt $" {
-+ pass $test_name
-+ }
-+ -re "Attempt to take contents of a not associated pointer.\r\n$gdb_prompt $" {
-+ pass $test_name
-+ }
-+}
-+gdb_test "print cyclicp1" "= \\( i = 1, p = $hex\( <.*>\)? \\)"
-+gdb_test "print cyclicp1%p" "= \\(PTR TO -> \\( Type typewithpointer\\)\\) $hex\( <.*>\)?"
-+gdb_test "print *((integer*) &inta + 2)" "= 3" "print temporary pointer, array"
-+gdb_test "print *((integer*) &intvla + 3)" "= 4" "print temporary pointer, allocated vla"
-+gdb_test "print \$pc" "= \\(PTR TO -> \\( void \\(\\) \\(\\)\\)\\) $hex <pointers\\+\\d+>" "Print program counter"
-diff --git a/gdb/testsuite/gdb.fortran/pointers.f90 b/gdb/testsuite/gdb.fortran/pointers.f90
---- a/gdb/testsuite/gdb.fortran/pointers.f90
-+++ b/gdb/testsuite/gdb.fortran/pointers.f90
-@@ -20,21 +20,34 @@ program pointers
- integer, allocatable :: ivla2 (:, :)
- end type two
-
-+ type :: typeWithPointer
-+ integer i
-+ type(typeWithPointer), pointer:: p
-+ end type typeWithPointer
-+
-+ type :: twoPtr
-+ type (two), pointer :: p
-+ end type twoPtr
-+
- logical, target :: logv
- complex, target :: comv
- character, target :: charv
- character (len=3), target :: chara
- integer, target :: intv
- integer, target, dimension (10,2) :: inta
-- real, target :: realv
-- type(two), target :: twov
-+ integer, target, allocatable, dimension (:) :: intvla
-+ real, target :: realv
-+ type(two), target :: twov
-+ type(twoPtr) :: arrayOfPtr (3)
-+ type(typeWithPointer), target:: cyclicp1,cyclicp2
-
- logical, pointer :: logp
- complex, pointer :: comp
-- character, pointer :: charp
-- character (len=3), pointer :: charap
-+ character, pointer:: charp
-+ character (len=3), pointer:: charap
- integer, pointer :: intp
- integer, pointer, dimension (:,:) :: intap
-+ integer, pointer, dimension (:) :: intvlap
- real, pointer :: realp
- type(two), pointer :: twop
-
-@@ -44,8 +57,14 @@ program pointers
- nullify (charap)
- nullify (intp)
- nullify (intap)
-+ nullify (intvlap)
- nullify (realp)
- nullify (twop)
-+ nullify (arrayOfPtr(1)%p)
-+ nullify (arrayOfPtr(2)%p)
-+ nullify (arrayOfPtr(3)%p)
-+ nullify (cyclicp1%p)
-+ nullify (cyclicp2%p)
-
- logp => logv ! Before pointer assignment
- comp => comv
-@@ -53,8 +72,14 @@ program pointers
- charap => chara
- intp => intv
- intap => inta
-+ intvlap => intvla
- realp => realv
- twop => twov
-+ arrayOfPtr(2)%p => twov
-+ cyclicp1%i = 1
-+ cyclicp1%p => cyclicp2
-+ cyclicp2%i = 2
-+ cyclicp2%p => cyclicp1
-
- logv = associated(logp) ! Before value assignment
- comv = cmplx(1,2)
-@@ -63,6 +88,10 @@ program pointers
- intv = 10
- inta(:,:) = 1
- inta(3,1) = 3
-+ allocate (intvla(10))
-+ intvla(:) = 2
-+ intvla(4) = 4
-+ intvlap => intvla
- realv = 3.14
-
- allocate (twov%ivla1(3))
-diff --git a/gdb/testsuite/gdb.fortran/print_type.exp b/gdb/testsuite/gdb.fortran/print_type.exp
---- a/gdb/testsuite/gdb.fortran/print_type.exp
-+++ b/gdb/testsuite/gdb.fortran/print_type.exp
-@@ -1,5 +1,6 @@
- # Copyright 2019-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
-@@ -40,7 +41,7 @@ set complex [fortran_complex4]
- # matches the string TYPE.
- proc check_pointer_type { var_name type } {
- gdb_test "ptype ${var_name}" \
-- "type = PTR TO -> \\( ${type} \\)"
-+ "type = PTR TO -> \\( ${type}\\)"
- }
-
- gdb_breakpoint [gdb_get_line_number "Before pointer assignment"]
-@@ -85,7 +86,8 @@ gdb_test "ptype twop" \
- [multi_line "type = PTR TO -> \\( Type two" \
- " $int, allocatable :: ivla1\\(:\\)" \
- " $int, allocatable :: ivla2\\(:,:\\)" \
-- "End Type two \\)"]
-+ "End Type two\\)"]
-+
-
- gdb_breakpoint [gdb_get_line_number "After value assignment"]
- gdb_continue_to_breakpoint "After value assignment"
-@@ -97,11 +99,11 @@ gdb_test "ptype intv" "type = $int"
- gdb_test "ptype inta" "type = $int \\(10,2\\)"
- gdb_test "ptype realv" "type = $real"
-
--gdb_test "ptype logp" "type = PTR TO -> \\( $logical \\)"
--gdb_test "ptype comp" "type = PTR TO -> \\( $complex \\)"
--gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1 \\)"
--gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3 \\)"
--gdb_test "ptype intp" "type = PTR TO -> \\( $int \\)"
-+gdb_test "ptype logp" "type = PTR TO -> \\( $logical\\)"
-+gdb_test "ptype comp" "type = PTR TO -> \\( $complex\\)"
-+gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1\\)"
-+gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3\\)"
-+gdb_test "ptype intp" "type = PTR TO -> \\( $int\\)"
- set test "ptype intap"
- gdb_test_multiple $test $test {
- -re "type = $int \\(10,2\\)\r\n$gdb_prompt $" {
-@@ -111,4 +113,4 @@ gdb_test_multiple $test $test {
- pass $test
- }
- }
--gdb_test "ptype realp" "type = PTR TO -> \\( $real \\)"
-+gdb_test "ptype realp" "type = PTR TO -> \\( $real\\)"
-diff --git a/gdb/testsuite/gdb.fortran/vla-strings.exp b/gdb/testsuite/gdb.fortran/vla-strings.exp
-new file mode 100644
---- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/vla-strings.exp
-@@ -0,0 +1,103 @@
-+# Copyright 2016 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 ".f90"
-+
-+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
-+ {debug f90 quiet}] } {
-+ return -1
-+}
-+
-+# check that all fortran standard datatypes will be
-+# handled correctly when using as VLA's
-+
-+if ![runto_main] {
-+ untested "could not run to main"
-+ return -1
-+}
-+
-+gdb_breakpoint [gdb_get_line_number "var_char-allocated-1"]
-+gdb_continue_to_breakpoint "var_char-allocated-1"
-+set test "whatis var_char first time"
-+gdb_test_multiple "whatis var_char" $test {
-+ -re "type = PTR TO -> \\( character\\*10\\)\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+ -re "type = character\\*10\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+}
-+set test "ptype var_char first time"
-+gdb_test_multiple "ptype var_char" $test {
-+ -re "type = PTR TO -> \\( character\\*10\\)\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+ -re "type = character\\*10\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+}
-+
-+
-+gdb_test "next" "\\d+.*var_char = 'foo'.*" \
-+ "next to allocation status of var_char"
-+gdb_test "print l" " = \\.TRUE\\." "print allocation status first time"
-+
-+
-+gdb_breakpoint [gdb_get_line_number "var_char-filled-1"]
-+gdb_continue_to_breakpoint "var_char-filled-1"
-+set test "print var_char, var_char-filled-1"
-+gdb_test_multiple "print var_char" $test {
-+ -re "= \\(PTR TO -> \\( character\\*3\\)\\) $hex\r\n$gdb_prompt $" {
-+ gdb_test "print *var_char" "= 'foo'" "print *var_char, var_char-filled-1"
-+ pass $test
-+ }
-+ -re "= 'foo'\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+}
-+set test "ptype var_char, var_char-filled-1"
-+gdb_test_multiple "ptype var_char" $test {
-+ -re "type = PTR TO -> \\( character\\*3\\)\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+ -re "type = character\\*3\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+}
-+gdb_test "print var_char(1)" " = 102 'f'" "print var_char(1)"
-+gdb_test "print var_char(3)" " = 111 'o'" "print var_char(3)"
-+
-+
-+gdb_breakpoint [gdb_get_line_number "var_char-filled-2"]
-+gdb_continue_to_breakpoint "var_char-filled-2"
-+set test "print var_char, var_char-filled-2"
-+gdb_test_multiple "print var_char" $test {
-+ -re "= \\(PTR TO -> \\( character\\*6\\)\\) $hex\r\n$gdb_prompt $" {
-+ gdb_test "print *var_char" "= 'foobar'" "print *var_char, var_char-filled-2"
-+ pass $test
-+ }
-+ -re "= 'foobar'\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+}
-+set test "ptype var_char, var_char-filled-2"
-+gdb_test_multiple "ptype var_char" $test {
-+ -re "type = PTR TO -> \\( character\\*6\\)\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+ -re "type = character\\*6\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+}
-diff --git a/gdb/testsuite/gdb.fortran/vla-strings.f90 b/gdb/testsuite/gdb.fortran/vla-strings.f90
-new file mode 100644
---- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/vla-strings.f90
-@@ -0,0 +1,39 @@
-+! Copyright 2016 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/>.
-+
-+program vla_strings
-+ character(len=:), target, allocatable :: var_char
-+ character(len=:), pointer :: var_char_p
-+ logical :: l
-+
-+ allocate(character(len=10) :: var_char)
-+ l = allocated(var_char) ! var_char-allocated-1
-+ var_char = 'foo'
-+ deallocate(var_char) ! var_char-filled-1
-+ l = allocated(var_char) ! var_char-deallocated
-+ allocate(character(len=42) :: var_char)
-+ l = allocated(var_char)
-+ var_char = 'foobar'
-+ var_char = '' ! var_char-filled-2
-+ var_char = 'bar' ! var_char-empty
-+ deallocate(var_char)
-+ allocate(character(len=21) :: var_char)
-+ l = allocated(var_char) ! var_char-allocated-3
-+ var_char = 'johndoe'
-+ var_char_p => var_char
-+ l = associated(var_char_p) ! var_char_p-associated
-+ var_char_p => null()
-+ l = associated(var_char_p) ! var_char_p-not-associated
-+end program vla_strings
-diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran/vla-value.exp
---- a/gdb/testsuite/gdb.fortran/vla-value.exp
-+++ b/gdb/testsuite/gdb.fortran/vla-value.exp
-@@ -35,7 +35,7 @@ gdb_breakpoint [gdb_get_line_number "vla1-init"]
- gdb_continue_to_breakpoint "vla1-init"
- gdb_test "print vla1" " = <not allocated>" "print non-allocated vla1"
- gdb_test "print &vla1" \
-- " = \\\(PTR TO -> \\\( $real, allocatable \\\(:,:,:\\\) \\\)\\\) $hex" \
-+ " = \\\(PTR TO -> \\\( $real, allocatable \\\(:,:,:\\\)\\\)\\\) $hex" \
- "print non-allocated &vla1"
- gdb_test "print vla1(1,1,1)" "no such vector element \\\(vector not allocated\\\)" \
- "print member in non-allocated vla1 (1)"
-@@ -56,7 +56,7 @@ with_timeout_factor 15 {
- "step over value assignment of vla1"
- }
- gdb_test "print &vla1" \
-- " = \\\(PTR TO -> \\\( $real, allocatable \\\(10,10,10\\\) \\\)\\\) $hex" \
-+ " = \\\(PTR TO -> \\\( $real, allocatable \\\(10,10,10\\\)\\\)\\\) $hex" \
- "print allocated &vla1"
- gdb_test "print vla1(3, 6, 9)" " = 1311" "print allocated vla1(3,6,9)"
- gdb_test "print vla1(1, 3, 8)" " = 1311" "print allocated vla1(1,3,8)"
-@@ -76,7 +76,7 @@ gdb_test "print vla1(9, 9, 9)" " = 999" \
- # Try to access values in undefined pointer to VLA (dangling)
- gdb_test "print pvla" " = <not associated>" "print undefined pvla"
- gdb_test "print &pvla" \
-- " = \\\(PTR TO -> \\\( $real \\\(:,:,:\\\) \\\)\\\) $hex" \
-+ " = \\\(PTR TO -> \\\( $real \\\(:,:,:\\\)\\\)\\\) $hex" \
- "print non-associated &pvla"
- gdb_test "print pvla(1, 3, 8)" "no such vector element \\\(vector not associated\\\)" \
- "print undefined pvla(1,3,8)"
-@@ -85,7 +85,7 @@ gdb_test "print pvla(1, 3, 8)" "no such vector element \\\(vector not associated
- gdb_breakpoint [gdb_get_line_number "pvla-associated"]
- gdb_continue_to_breakpoint "pvla-associated"
- gdb_test "print &pvla" \
-- " = \\\(PTR TO -> \\\( $real \\\(10,10,10\\\) \\\)\\\) $hex" \
-+ " = \\\(PTR TO -> \\\( $real \\\(10,10,10\\\)\\\)\\\) $hex" \
- "print associated &pvla"
- gdb_test "print pvla(3, 6, 9)" " = 42" "print associated pvla(3,6,9)"
- gdb_test "print pvla(1, 3, 8)" " = 1001" "print associated pvla(1,3,8)"
-diff --git a/gdb/typeprint.c b/gdb/typeprint.c
---- a/gdb/typeprint.c
-+++ b/gdb/typeprint.c
-@@ -574,6 +574,25 @@ whatis_exp (const char *exp, int show)
- printf_filtered (" */\n");
- }
-
-+ /* Resolve any dynamic target type, as we might print
-+ additional information about the target.
-+ For example, in Fortran and C we are printing the dimension of the
-+ dynamic array the pointer is pointing to. */
-+ if (TYPE_CODE (type) == TYPE_CODE_PTR
-+ && is_dynamic_type (type) == 1)
-+ {
-+ CORE_ADDR addr;
-+ if (NULL != TYPE_DATA_LOCATION (TYPE_TARGET_TYPE(type)))
-+ addr = value_address (val);
-+ else
-+ addr = value_as_address (val);
-+
-+ if (addr != 0
-+ && type_not_associated (type) == 0)
-+ TYPE_TARGET_TYPE (type) = resolve_dynamic_type (TYPE_TARGET_TYPE (type),
-+ NULL, addr);
-+ }
-+
- LA_PRINT_TYPE (type, "", gdb_stdout, show, 0, &flags);
- printf_filtered ("\n");
- }
-diff --git a/gdb/valops.c b/gdb/valops.c
---- a/gdb/valops.c
-+++ b/gdb/valops.c
-@@ -1553,6 +1553,19 @@ value_ind (struct value *arg1)
- if (TYPE_CODE (base_type) == TYPE_CODE_PTR)
- {
- struct type *enc_type;
-+ CORE_ADDR addr;
-+
-+ if (type_not_associated (base_type))
-+ error (_("Attempt to take contents of a not associated pointer."));
-+
-+ if (NULL != TYPE_DATA_LOCATION (TYPE_TARGET_TYPE (base_type)))
-+ addr = value_address (arg1);
-+ else
-+ addr = value_as_address (arg1);
-+
-+ if (addr != 0)
-+ TYPE_TARGET_TYPE (base_type) =
-+ resolve_dynamic_type (TYPE_TARGET_TYPE (base_type), NULL, addr);
-
- /* We may be pointing to something embedded in a larger object.
- Get the real type of the enclosing object. */
-@@ -1568,8 +1581,7 @@ value_ind (struct value *arg1)
- else
- /* Retrieve the enclosing object pointed to. */
- arg2 = value_at_lazy (enc_type,
-- (value_as_address (arg1)
-- - value_pointed_to_offset (arg1)));
-+ (addr - value_pointed_to_offset (arg1)));
-
- enc_type = value_type (arg2);
- return readjust_indirect_value_type (arg2, enc_type, base_type, arg1);
-diff --git a/gdb/valprint.c b/gdb/valprint.c
---- a/gdb/valprint.c
-+++ b/gdb/valprint.c
-@@ -1149,12 +1149,6 @@ value_check_printable (struct value *val, struct ui_file *stream,
- return 0;
- }
-
-- if (type_not_associated (value_type (val)))
-- {
-- val_print_not_associated (stream);
-- return 0;
-- }
--
- if (type_not_allocated (value_type (val)))
- {
- val_print_not_allocated (stream);
Thanks,
Jan
-diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
---- a/gdb/dwarf2loc.c
-+++ b/gdb/dwarf2loc.c
-@@ -2154,6 +2154,20 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
+diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
+--- a/gdb/dwarf2/loc.c
++++ b/gdb/dwarf2/loc.c
+@@ -2249,6 +2249,20 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
ctx.per_cu = per_cu;
ctx.obj_address = 0;
+
scoped_value_mark free_values;
- ctx.gdbarch = get_objfile_arch (objfile);
+ ctx.gdbarch = per_objfile->objfile->arch ();
diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
new file mode 100644
--- /dev/null
+# 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.
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+set testfile "dynamic-other-frame"
+set srcfile1 ${testfile}.f90
;;=fedoratest
-diff --git a/gdb/testsuite/gdb.fortran/ptr-indentation.exp b/gdb/testsuite/gdb.fortran/ptr-indentation.exp
---- a/gdb/testsuite/gdb.fortran/ptr-indentation.exp
-+++ b/gdb/testsuite/gdb.fortran/ptr-indentation.exp
-@@ -37,5 +37,5 @@ gdb_continue_to_breakpoint "BP1"
- gdb_test "ptype tinsta" \
- [multi_line "type = Type tuserdef" \
- " $int :: i" \
-- " PTR TO -> \\( $real :: ptr \\)" \
-+ " PTR TO -> \\( $real :: ptr\\)" \
- "End Type tuserdef"]
-diff --git a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
---- a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
-+++ b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
-@@ -42,4 +42,4 @@ gdb_test "ptype say_numbers" \
- "type = void \\(integer\\(kind=4\\), integer\\(kind=4\\), integer\\(kind=4\\)\\)"
-
- gdb_test "ptype fun_ptr" \
-- "type = PTR TO -> \\( integer\\(kind=4\\) \\(\\) \\(REF TO -> \\( integer\\(kind=4\\) \\)\\) \\)"
-+ "type = PTR TO -> \\( integer\\(kind=4\\) \\(\\) \\(REF TO -> \\( integer\\(kind=4\\)\\)\\)\\)"
diff --git a/gdb/testsuite/gdb.fortran/vla-func.exp b/gdb/testsuite/gdb.fortran/vla-func.exp
new file mode 100644
--- /dev/null
+
+ ret = .TRUE. ! func2-returned
+end program vla_func
-diff --git a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp
---- a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp
-+++ b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp
-@@ -28,5 +28,5 @@ if ![runto_main] {
- # Check the status of a pointer to a dynamic array.
- gdb_breakpoint [gdb_get_line_number "pvla-associated"]
- gdb_continue_to_breakpoint "pvla-associated"
--gdb_test "print &pvla" " = \\(PTR TO -> \\( real\\(kind=4\\) \\(10,10,10\\) \\)\\) ${hex}" \
-+gdb_test "print &pvla" " = \\(PTR TO -> \\( real\\(kind=4\\) \\(10,10,10\\)\\)\\) ${hex}" \
- "print pvla pointer information"
-diff --git a/gdb/testsuite/gdb.fortran/vla-stringsold.exp b/gdb/testsuite/gdb.fortran/vla-stringsold.exp
-new file mode 100644
---- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/vla-stringsold.exp
-@@ -0,0 +1,101 @@
-+# 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 ".f90"
-+
-+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
-+ {debug f90 quiet}] } {
-+ return -1
-+}
-+
-+# check that all fortran standard datatypes will be
-+# handled correctly when using as VLA's
-+
-+if ![runto MAIN__] then {
-+ perror "couldn't run to breakpoint MAIN__"
-+ continue
-+}
-+
-+gdb_breakpoint [gdb_get_line_number "var_char-allocated-1"]
-+gdb_continue_to_breakpoint "var_char-allocated-1"
-+gdb_test "print var_char" \
-+ " = \\(PTR TO -> \\( character\\*10\\)\\) ${hex}" \
-+ "print var_char after allocated first time"
-+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*10\\)" \
-+ "whatis var_char first time"
-+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*10\\)" \
-+ "ptype var_char first time"
-+gdb_test "next" "\\d+.*var_char = 'foo'.*" \
-+ "next to allocation status of var_char"
-+gdb_test "print l" " = .TRUE." "print allocation status first time"
-+
-+gdb_breakpoint [gdb_get_line_number "var_char-filled-1"]
-+gdb_continue_to_breakpoint "var_char-filled-1"
-+gdb_test "print var_char" \
-+ " = \\(PTR TO -> \\( character\\*3\\)\\) ${hex}" \
-+ "print var_char after filled first time"
-+gdb_test "print *var_char" " = 'foo'" \
-+ "print *var_char after filled first time"
-+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*3\\)" \
-+ "whatis var_char after filled first time"
-+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*3\\)" \
-+ "ptype var_char after filled first time"
-+gdb_test "print var_char(1)" " = 102 'f'" "print var_char(1)"
-+gdb_test "print var_char(3)" " = 111 'o'" "print var_char(3)"
-+
-+gdb_breakpoint [gdb_get_line_number "var_char-filled-2"]
-+gdb_continue_to_breakpoint "var_char-filled-2"
-+gdb_test "print var_char" \
-+ " = \\(PTR TO -> \\( character\\*6\\)\\) ${hex}" \
-+ "print var_char after allocated second time"
-+gdb_test "print *var_char" " = 'foobar'" \
-+ "print *var_char after allocated second time"
-+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*6\\)" \
-+ "whatis var_char second time"
-+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*6\\)" \
-+ "ptype var_char second time"
-+
-+gdb_breakpoint [gdb_get_line_number "var_char-empty"]
-+gdb_continue_to_breakpoint "var_char-empty"
-+gdb_test "print var_char" \
-+ " = \\(PTR TO -> \\( character\\*0\\)\\) ${hex}" \
-+ "print var_char after set empty"
-+gdb_test "print *var_char" " = \"\"" "print *var_char after set empty"
-+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*0\\)" \
-+ "whatis var_char after set empty"
-+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*0\\)" \
-+ "ptype var_char after set empty"
-+
-+gdb_breakpoint [gdb_get_line_number "var_char-allocated-3"]
-+gdb_continue_to_breakpoint "var_char-allocated-3"
-+gdb_test "print var_char" \
-+ " = \\(PTR TO -> \\( character\\*21\\)\\) ${hex}" \
-+ "print var_char after allocated third time"
-+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*21\\)" \
-+ "whatis var_char after allocated third time"
-+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*21\\)" \
-+ "ptype var_char after allocated third time"
-+
-+gdb_breakpoint [gdb_get_line_number "var_char_p-associated"]
-+gdb_continue_to_breakpoint "var_char_p-associated"
-+gdb_test "print var_char_p" \
-+ " = \\(PTR TO -> \\( character\\*7\\)\\) ${hex}" \
-+ "print var_char_p after associated"
-+gdb_test "print *var_char_p" " = 'johndoe'" \
-+ "print *var_char_ after associated"
-+gdb_test "whatis var_char_p" "type = PTR TO -> \\( character\\*7\\)" \
-+ "whatis var_char_p after associated"
-+gdb_test "ptype var_char_p" "type = PTR TO -> \\( character\\*7\\)" \
-+ "ptype var_char_p after associated"
-diff --git a/gdb/testsuite/gdb.fortran/vla-stringsold.f90 b/gdb/testsuite/gdb.fortran/vla-stringsold.f90
-new file mode 100644
---- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/vla-stringsold.f90
-@@ -0,0 +1,40 @@
-+! 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 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.
-+
-+program vla_strings
-+ character(len=:), target, allocatable :: var_char
-+ character(len=:), pointer :: var_char_p
-+ logical :: l
-+
-+ allocate(character(len=10) :: var_char)
-+ l = allocated(var_char) ! var_char-allocated-1
-+ var_char = 'foo'
-+ deallocate(var_char) ! var_char-filled-1
-+ l = allocated(var_char) ! var_char-deallocated
-+ allocate(character(len=42) :: var_char)
-+ l = allocated(var_char)
-+ var_char = 'foobar'
-+ var_char = '' ! var_char-filled-2
-+ var_char = 'bar' ! var_char-empty
-+ deallocate(var_char)
-+ allocate(character(len=21) :: var_char)
-+ l = allocated(var_char) ! var_char-allocated-3
-+ var_char = 'johndoe'
-+ var_char_p => var_char
-+ l = associated(var_char_p) ! var_char_p-associated
-+ var_char_p => null()
-+ l = associated(var_char_p) ! var_char_p-not-associated
-+end program vla_strings
-diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp
---- a/gdb/testsuite/gdb.fortran/whatis_type.exp
-+++ b/gdb/testsuite/gdb.fortran/whatis_type.exp
-@@ -44,7 +44,7 @@ gdb_test "whatis t2" "type = Type t2"
- gdb_test "whatis t2v" "type = Type t2"
- gdb_test "whatis t3" "type = Type t3"
- gdb_test "whatis t3v" "type = Type t3"
--gdb_test "whatis t3p" "type = PTR TO -> \\( Type t3 \\)"
-+gdb_test "whatis t3p" "type = PTR TO -> \\( Type t3\\)"
-
- gdb_test "ptype t1" \
- [multi_line "type = Type t1" \
-@@ -73,4 +73,4 @@ gdb_test "ptype t3p" \
- [multi_line "type = PTR TO -> \\( Type t3" \
- " $int :: t3_i" \
- " Type t2 :: t2_n" \
-- "End Type t3 \\)"]
-+ "End Type t3\\)"]
Summary(zh_CN.UTF-8): [开发]C和其他语言的调试器
Summary(zh_TW.UTF-8): [.-A開發]C和.$)B其.-A他語.$)B言的調試器
Name: gdb
-Version: 9.1
-Release: 2
+Version: 10.2
+Release: 1
License: GPL v3+
Group: Development/Debuggers
Source0: https://ftp.gnu.org/gnu/gdb/%{name}-%{version}.tar.xz
-# Source0-md5: f7e9f6236c425097d9e5f18a6ac40655
+# Source0-md5: c044b7146903ec51c9d2337a29aee93b
Source1: http://www.mif.pg.gda.pl/homepages/ankry/man-PLD/%{name}-non-english-man-pages.tar.bz2
# Source1-md5: 2e8a48939ae282c12bbacdd54e398247
Source3: %{name}-gstack.man
Patch112: gdb-archer-vla-tests.patch
Patch113: gdb-vla-intel-fortran-strides.patch
Patch114: gdb-vla-intel-stringbt-fix.patch
-Patch115: gdb-vla-intel-fortran-vla-strings.patch
-Patch116: gdb-vla-intel-tests.patch
+Patch115: gdb-vla-intel-tests.patch
Patch1000: %{name}-readline.patch
Patch1001: %{name}-info.patch
Patch1002: %{name}-passflags.patch
%{?with_guile:Requires: guile >= 2.0.12}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+%define autoconf_ver %(rpm -q --qf='%%{VERSION}' autoconf)
+
%description
Gdb is a full featured, command driven debugger. Gdb allows you to
trace the execution of programs and examine their internal state at
%patch113 -p1
%patch114 -p1
%patch115 -p1
-%patch116 -p1
%patch1000 -p1
%patch1001 -p1
gdb/gcore.in \
src-release.sh
+sed -i -e 's/\[2\.69\]/[%{autoconf_ver}]/' config/override.m4
+
%build
# omit hand-written gdb/testsuite aclocal.m4
-for dir in gdb gdb/gdbserver ; do
+for dir in gdb gdbserver ; do
olddir=$(pwd)
cd $dir
%{__rm} aclocal.m4
%dir %{_datadir}/gdb/auto-load%{_prefix}/lib64
%dir %{_datadir}/gdb/auto-load%{_prefix}/libx32
%endif
+%ifarch aarch64
+%dir %{_datadir}/gdb/auto-load%{_prefix}/lib64
+%endif
%{?with_guile:%{_datadir}/gdb/guile}
%{_datadir}/gdb/syscalls
%{_datadir}/gdb/system-gdbinit