Rebase to FSF GDB 10.1.

Bump 'snapgnulib' date.
Drop gdb-rhbz1818011-bfd-gcc10-error.patch.
Drop gdb-rhbz1822715-fix-python-deprecation.patch.
Drop gdb-rhbz1829702-fix-python39.patch.
Drop gdb-rhbz1838777-debuginfod.patch.
Drop gdb-rhbz1844458-use-fputX_unfiltered.patch.
Drop gdb-rhbz1869484-deleted-working-directory.
Adjust build-id related patches.
Ajust VLA patches.
This commit is contained in:
Kevin Buettner 2020-11-05 14:17:24 -07:00
parent d7b61266b7
commit ed8730b4d9
45 changed files with 634 additions and 2654 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
/binutils-gdb
/gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz
/gdb-9.2.tar.xz
/v2.0.2.tar.gz
/gdb-10.1.tar.xz

View File

@ -37,10 +37,6 @@ Patch009: gdb-6.3-test-movedir-20050125.patch
#=fedoratest
Patch010: gdb-6.3-threaded-watchpoints2-20050225.patch
# Notify observers that the inferior has been created
#=fedoratest
Patch011: gdb-6.3-inferior-notification-20050721.patch
# Verify printing of inherited members test
#=fedoratest
Patch012: gdb-6.3-inheritancetest-20050726.patch
@ -102,10 +98,6 @@ Patch025: gdb-6.6-testsuite-timeouts.patch
#=fedoratest
Patch026: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
# Test kernel VDSO decoding while attaching to an i386 process.
#=fedoratest
Patch027: gdb-6.3-attach-see-vdso-test.patch
# Test leftover zombie process (BZ 243845).
#=fedoratest
Patch028: gdb-6.5-bz243845-stale-testing-zombie-test.patch
@ -143,10 +135,6 @@ Patch035: gdb-6.5-ia64-libunwind-leak-test.patch
#=fedoratest
Patch036: gdb-6.5-missed-trap-on-step-test.patch
# Test gcore memory and time requirements for large inferiors.
#=fedoratest
Patch037: gdb-6.5-gcore-buffer-limit-test.patch
# Test GCORE for shmid 0 shared memory mappings.
#=fedoratest: But it is broken anyway, sometimes the case being tested is not reproducible.
Patch038: gdb-6.3-mapping-zero-inode-test.patch
@ -394,24 +382,3 @@ Patch096: gdb-vla-intel-fix-print-char-array.patch
# =fedoratest
Patch097: gdb-rhbz1553104-s390x-arch12-test.patch
# Fix int conversion error from bfd/elf.c when compiling with gcc 10
Patch098: gdb-rhbz1818011-bfd-gcc10-error.patch
# Backport fix for deprecation of PyEval_InitThreads in Python 3.9.
Patch099: gdb-rhbz1822715-fix-python-deprecation.patch
# Backport "Fix Python 3.9 related runtime problems"
# Kevin Buettner <kevinb@redhat.com> and Keith Seitz <keiths@redhat.com>
Patch100: gdb-rhbz1829702-fix-python39.patch
# Fix fput?_unfiltered functions
# RH BZ 1844458 (Sergio Durigan Junior and Tom Tromey)
Patch101: gdb-rhbz1844458-use-fputX_unfiltered.patch
# Backport debuginofd support.
# (Aaron Merey, RH BZ 183877)
Patch102: gdb-rhbz1838777-debuginfod.patch
# Backport patches fixing abort when working directory is deleted.
Patch103: gdb-rhbz1869484-deleted-working-directory

View File

@ -8,7 +8,6 @@
%patch008 -p1
%patch009 -p1
%patch010 -p1
%patch011 -p1
%patch012 -p1
%patch013 -p1
%patch014 -p1
@ -24,7 +23,6 @@
%patch024 -p1
%patch025 -p1
%patch026 -p1
%patch027 -p1
%patch028 -p1
%patch029 -p1
%patch030 -p1
@ -34,7 +32,6 @@
%patch034 -p1
%patch035 -p1
%patch036 -p1
%patch037 -p1
%patch038 -p1
%patch039 -p1
%patch040 -p1
@ -95,9 +92,3 @@
%patch095 -p1
%patch096 -p1
%patch097 -p1
%patch098 -p1
%patch099 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1

View File

@ -1 +1 @@
e7fe0803b6427d3906e991bbb3b7fd2f0fd05e00
606e3fd147ed9a00df165e46f30fe5c46dcda345

View File

@ -95,9 +95,3 @@ gdb-rhbz1398387-tab-crash-test.patch
gdb-archer.patch
gdb-vla-intel-fix-print-char-array.patch
gdb-rhbz1553104-s390x-arch12-test.patch
gdb-rhbz1818011-bfd-gcc10-error.patch
gdb-rhbz1822715-fix-python-deprecation.patch
gdb-rhbz1829702-fix-python39.patch
gdb-rhbz1844458-use-fputX_unfiltered.patch
gdb-rhbz1838777-debuginfod.patch
gdb-rhbz1869484-deleted-working-directory

View File

@ -16,7 +16,7 @@ Subject: gdb-6.3-gstack-20050411.patch
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
@ -25,7 +25,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in
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
@ -52,7 +52,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in
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

View File

@ -27,7 +27,7 @@ diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest
diff --git a/gdb/top.c b/gdb/top.c
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -2096,7 +2096,7 @@ init_gdb_version_vars (void)
@@ -2163,7 +2163,7 @@ init_gdb_version_vars (void)
struct internalvar *major_version_var = create_internalvar ("_gdb_major");
struct internalvar *minor_version_var = create_internalvar ("_gdb_minor");
int vmajor = 0, vminor = 0, vrevision = 0;

View File

@ -17,7 +17,7 @@ Subject: gdb-6.3-test-self-20050110.patch
diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp
--- a/gdb/testsuite/lib/selftest-support.exp
+++ b/gdb/testsuite/lib/selftest-support.exp
@@ -151,18 +151,18 @@ proc do_self_tests {function body} {
@@ -152,18 +152,18 @@ proc do_self_tests {function body} {
}
# Remove any old copy lying around.

View File

@ -44,7 +44,7 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1214,6 +1214,10 @@ print_command_1 (const char *args, int voidprint)
@@ -1210,6 +1210,10 @@ print_command_1 (const char *args, int voidprint)
if (exp != nullptr && *exp)
{

View File

@ -11,7 +11,7 @@ https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
diff --git a/gdb/symtab.c b/gdb/symtab.c
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3166,6 +3166,13 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
@@ -3169,6 +3169,13 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
msymbol->linkage_name ()); */
;
/* fall through */
@ -23,5 +23,5 @@ diff --git a/gdb/symtab.c b/gdb/symtab.c
+ warning ("In stub for %s (0x%s); interlocked, please submit the binary to http://bugzilla.redhat.com", msymbol.minsym->linkage_name (), paddress (target_gdbarch (), pc));
+ /* fall through */
else
return find_pc_line (BMSYMBOL_VALUE_ADDRESS (mfunsym), 0);
}
{
/* Detect an obvious case of infinite recursion. If this

View File

@ -73,7 +73,7 @@ diff --git a/gdb/exec.c b/gdb/exec.c
#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))
{
@ -88,8 +88,8 @@ diff --git a/gdb/exec.c b/gdb/exec.c
/* 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)
@ -98,29 +98,16 @@ diff --git a/gdb/exec.c b/gdb/exec.c
+ "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, &sections, &sections_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;
};
@ -155,7 +142,7 @@ diff --git a/gdb/main.c b/gdb/main.c
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];
@ -164,7 +151,7 @@ diff --git a/gdb/main.c b/gdb/main.c
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)
{
@ -194,3 +181,16 @@ diff --git a/gdb/main.c b/gdb/main.c
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
};

View File

@ -9,7 +9,7 @@ Subject: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
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

View File

@ -12,7 +12,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=953585
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
@ -24,7 +24,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
{
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)
{
@ -36,7 +36,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
{
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++;
}
@ -74,7 +74,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
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;
}
@ -95,10 +95,10 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
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
@@ -3025,6 +3025,16 @@ read_gdb_index_from_buffer (const char *filename,
"set use-deprecated-index-sections on". */
if (version < 6 && !deprecated_ok)
{
@ -115,7 +115,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
static int warning_printed = 0;
if (!warning_printed)
{
@@ -3508,6 +3518,10 @@ to use the section anyway."),
@@ -3036,6 +3046,10 @@ to use the section anyway."),
warning_printed = 1;
}
return 0;

View File

@ -240,10 +240,10 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
#include "gdbcmd.h"
#include "gdbcore.h"
+#include "inferior.h"
#include "libbfd.h"
#include "objfiles.h"
#include "observable.h"
@@ -698,8 +699,374 @@ 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;
}
@ -619,7 +619,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
avoidance. */
struct missing_filepair
@@ -753,11 +1120,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;
}
@ -637,7 +637,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
missing_filepair_change ();
}
@@ -824,14 +1197,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;
@ -686,9 +686,9 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
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
@ -696,7 +696,7 @@ diff --git a/gdb/config.in b/gdb/config.in
/* 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
@ -709,7 +709,7 @@ diff --git a/gdb/config.in b/gdb/config.in
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
@ -721,7 +721,7 @@ diff --git a/gdb/configure b/gdb/configure
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
@ -729,42 +729,34 @@ diff --git a/gdb/configure b/gdb/configure
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; }
@ -1262,7 +1254,7 @@ diff --git a/gdb/configure b/gdb/configure
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])
@ -1465,15 +1457,15 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
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 ();
@ -1482,7 +1474,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c
/* 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)
@ -1497,12 +1489,11 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c
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 */

View File

@ -14,7 +14,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1339862
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,
}
{
@ -44,7 +44,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
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

View File

@ -9,7 +9,7 @@ Subject: gdb-6.6-buildid-locate.patch
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;
@ -21,7 +21,7 @@ diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
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;
@ -33,7 +33,7 @@ diff --git a/bfd/libbfd.h b/bfd/libbfd.h
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"
@ -46,7 +46,6 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+#include "gdb_bfd.h"
+#include "gdbcmd.h"
#include "gdbcore.h"
+#include "libbfd.h"
+#include "objfiles.h"
+#include "observable.h"
+#include "symfile.h"
@ -106,7 +105,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
{
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;
}
@ -455,7 +454,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
/* 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;
@ -464,7 +463,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
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;
}
@ -543,7 +542,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ 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);
- gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget);
+ string_appendf (link, ".%u", seqno);
+ }
@ -651,7 +650,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
}
/* 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,
@ -660,7 +659,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
{
/* 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--;
@ -681,7 +680,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
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;
@ -691,7 +690,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
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 {};
}
@ -907,7 +906,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
/* 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 ();
}
@ -1003,8 +1002,8 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
#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;
@ -1012,7 +1011,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
/* 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)
{
@ -1040,10 +1039,10 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
}
/* 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, _("\
@ -1055,7 +1054,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
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
@ -1083,10 +1082,10 @@ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
@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. */
@ -1095,7 +1094,7 @@ diff --git a/gdb/dwarf-index-cache.c b/gdb/dwarf-index-cache.c
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)
{
@ -1105,28 +1104,28 @@ diff --git a/gdb/dwarf-index-cache.c b/gdb/dwarf-index-cache.c
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
@@ -2218,7 +2218,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)
{
@@ -5980,7 +5980,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)
@@ -5993,7 +5993,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)
{
@ -1138,7 +1137,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
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)
{
@ -1149,35 +1148,61 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
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);
}
- 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;
}
@@ -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);
/* Read the CTF section only if there is no DWARF info. */
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 ());
}
}
}
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 ());
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
@ -1210,7 +1235,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.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;
}
@ -1265,10 +1290,22 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
/* 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);
@ -1282,6 +1319,7 @@ diff --git a/gdb/symfile.h b/gdb/symfile.h
+/* 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 */
@ -1289,7 +1327,7 @@ diff --git a/gdb/symfile.h b/gdb/symfile.h
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
}
}
@ -1337,7 +1375,7 @@ diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb
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 { } {
}
}
@ -1358,7 +1396,7 @@ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
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."
}
}

View File

@ -28,7 +28,7 @@ frames-invalid can happen asynchronously.
diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c
--- a/gdb/testsuite/gdb.base/fileio.c
+++ b/gdb/testsuite/gdb.base/fileio.c
@@ -560,6 +560,28 @@ strerrno (int err)
@@ -559,6 +559,28 @@ strerrno (int err)
int
main ()
{

View File

@ -16,7 +16,7 @@ on the debugger termination).
diff --git a/gdb/defs.h b/gdb/defs.h
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -168,6 +168,10 @@ extern void default_quit_handler (void);
@@ -177,6 +177,10 @@ extern void default_quit_handler (void);
/* Flag that function quit should call quit_force. */
extern volatile int sync_quit_force_run;
@ -30,24 +30,24 @@ diff --git a/gdb/defs.h b/gdb/defs.h
diff --git a/gdb/extension.c b/gdb/extension.c
--- a/gdb/extension.c
+++ b/gdb/extension.c
@@ -823,6 +823,11 @@ check_quit_flag (void)
int i, result = 0;
const struct extension_language_defn *extlang;
@@ -769,6 +769,11 @@ check_quit_flag (void)
{
int result = 0;
+#ifdef NEED_DETACH_SIGSTOP
+ if (quit_flag_cleanup)
+ return 0;
+#endif
+
ALL_ENABLED_EXTENSION_LANGUAGES (i, extlang)
for (const struct extension_language_defn *extlang : extension_languages)
{
if (extlang->ops->check_quit_flag != NULL)
if (extlang->ops != nullptr
diff --git a/gdb/top.c b/gdb/top.c
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1703,7 +1703,13 @@ quit_force (int *exit_arg, int from_tty)
qt.from_tty = from_tty;
@@ -1770,7 +1770,13 @@ quit_force (int *exit_arg, int from_tty)
else if (return_child_result)
exit_code = return_child_result_value;
+#ifndef NEED_DETACH_SIGSTOP
/* We want to handle any quit errors and exit regardless. */
@ -62,7 +62,7 @@ diff --git a/gdb/top.c b/gdb/top.c
diff --git a/gdb/utils.c b/gdb/utils.c
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -102,6 +102,13 @@ static std::chrono::steady_clock::duration prompt_for_continue_wait_time;
@@ -103,6 +103,13 @@ static std::chrono::steady_clock::duration prompt_for_continue_wait_time;
static bool debug_timestamp = false;

View File

@ -8,12 +8,12 @@ Subject: gdb-archer-pie-addons-keep-disabled.patch
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -15396,6 +15396,51 @@ static struct cmd_list_element *enablebreaklist = NULL;
@@ -15431,6 +15431,50 @@ static struct cmd_list_element *enablebreaklist = NULL;
cmd_list_element *commands_cmd_element = nullptr;
+void
+breakpoints_relocate (struct objfile *objfile, struct section_offsets *delta)
+breakpoints_relocate (struct objfile *objfile, section_offsets &delta)
+{
+ struct bp_location *bl, **blp_tmp;
+ int changed = 0;
@ -32,7 +32,7 @@ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
+ CORE_ADDR relocated_address;
+ CORE_ADDR delta_offset;
+
+ delta_offset = ANOFFSET (delta, osect->the_bfd_section->index);
+ delta_offset = delta[osect->the_bfd_section->index];
+ if (delta_offset == 0)
+ continue;
+ relocated_address = bl->address + delta_offset;
@ -56,19 +56,18 @@ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
+ bp_location_is_less_than);
+}
+
+void _initialize_breakpoint (void);
void _initialize_breakpoint ();
void
_initialize_breakpoint (void)
{
_initialize_breakpoint ()
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -1696,6 +1696,9 @@ extern const char *ep_parse_optional_if_clause (const char **arg);
@@ -1691,6 +1691,9 @@ extern const char *ep_parse_optional_if_clause (const char **arg);
UIOUT iff debugging multiple threads. */
extern void maybe_print_thread_hit_breakpoint (struct ui_out *uiout);
+extern void breakpoints_relocate (struct objfile *objfile,
+ struct section_offsets *delta);
+ section_offsets &delta);
+
/* Print the specified breakpoint. */
extern void print_breakpoint (breakpoint *bp);
@ -76,7 +75,7 @@ diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -816,6 +816,11 @@ objfile_relocate1 (struct objfile *objfile,
@@ -742,6 +742,11 @@ objfile_relocate1 (struct objfile *objfile,
obj_section_addr (s));
}
@ -88,15 +87,3 @@ diff --git a/gdb/objfiles.c b/gdb/objfiles.c
/* Data changed. */
return 1;
}
diff --git a/gdb/value.c b/gdb/value.c
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2840,7 +2840,7 @@ value_static_field (struct type *type, int fieldno)
case FIELD_LOC_KIND_PHYSADDR:
retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),
TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)
- + (TYPE_OBJFILE (type) == NULL ? 0 : TYPE_OBJFILE (type)->section_offsets[SECT_OFF_TEXT (TYPE_OBJFILE (type))]));
+ + (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
break;
case FIELD_LOC_KIND_PHYSNAME:
{

View File

@ -8,7 +8,7 @@ Subject: gdb-archer-pie-addons.patch
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -516,6 +516,7 @@ enum field_loc_kind
@@ -649,6 +649,7 @@ enum field_loc_kind
{
FIELD_LOC_KIND_BITPOS, /**< bitpos */
FIELD_LOC_KIND_ENUMVAL, /**< enumval */
@ -16,7 +16,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
FIELD_LOC_KIND_PHYSADDR, /**< physaddr */
FIELD_LOC_KIND_PHYSNAME, /**< physname */
FIELD_LOC_KIND_DWARF_BLOCK /**< dwarf_block */
@@ -566,6 +567,7 @@ union field_location
@@ -699,6 +700,7 @@ union field_location
field. Otherwise, physname is the mangled label of the
static field. */
@ -24,37 +24,13 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
CORE_ADDR physaddr;
const char *physname;
@@ -1474,6 +1476,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
#define FIELD_ENUMVAL_LVAL(thisfld) ((thisfld).loc.enumval)
#define FIELD_ENUMVAL(thisfld) (FIELD_ENUMVAL_LVAL (thisfld) + 0)
#define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
+/* This address is unrelocated by the objfile's ANOFFSET. */
#define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
#define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block)
#define SET_FIELD_BITPOS(thisfld, bitpos) \
@@ -1485,6 +1488,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
#define SET_FIELD_PHYSNAME(thisfld, name) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \
FIELD_STATIC_PHYSNAME (thisfld) = (name))
+/* This address is unrelocated by the objfile's ANOFFSET. */
#define SET_FIELD_PHYSADDR(thisfld, addr) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \
FIELD_STATIC_PHYSADDR (thisfld) = (addr))
@@ -1501,6 +1505,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
+/* This address is unrelocated by the objfile's ANOFFSET. */
#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
diff --git a/gdb/value.c b/gdb/value.c
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2839,7 +2839,8 @@ value_static_field (struct type *type, int fieldno)
@@ -2850,7 +2850,8 @@ value_static_field (struct type *type, int fieldno)
{
case FIELD_LOC_KIND_PHYSADDR:
retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),
retval = value_at_lazy (type->field (fieldno).type (),
- TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
+ TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)
+ + (TYPE_OBJFILE (type) == NULL ? 0 : TYPE_OBJFILE (type)->section_offsets[SECT_OFF_TEXT (TYPE_OBJFILE (type))]));

View File

@ -3689,7 +3689,7 @@ new file mode 100644
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
}
@ -3705,12 +3705,12 @@ diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp
--- 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 } {

View File

@ -45,7 +45,7 @@ gdb/gdbserver/
diff --git a/gdb/config.in b/gdb/config.in
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -251,6 +251,9 @@
@@ -253,6 +253,9 @@
/* Define if librpm library is being used. */
#undef HAVE_LIBRPM
@ -55,7 +55,7 @@ diff --git a/gdb/config.in b/gdb/config.in
/* Define to 1 if you have the <libunwind-ia64.h> header file. */
#undef HAVE_LIBUNWIND_IA64_H
@@ -386,6 +389,9 @@
@@ -388,6 +391,9 @@
/* Define to 1 if you have the `scm_new_smob' function. */
#undef HAVE_SCM_NEW_SMOB
@ -68,7 +68,7 @@ diff --git a/gdb/config.in b/gdb/config.in
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
@@ -16434,6 +16434,64 @@ cat >>confdefs.h <<_ACEOF
@@ -16861,6 +16861,64 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
@ -136,7 +136,7 @@ diff --git a/gdb/configure b/gdb/configure
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1964,6 +1964,10 @@ case $host_os in
@@ -1900,6 +1900,10 @@ case $host_os in
esac
AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.])
@ -147,136 +147,10 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
dnl Handle optional features that can be enabled.
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
--- a/gdb/gdbserver/config.in
+++ b/gdb/gdbserver/config.in
@@ -125,6 +125,9 @@
/* Define to 1 if you have the `dl' library (-ldl). */
#undef HAVE_LIBDL
+/* Define to 1 if you have the `selinux' library (-lselinux). */
+#undef HAVE_LIBSELINUX
+
/* Define if the target supports branch tracing. */
#undef HAVE_LINUX_BTRACE
@@ -210,6 +213,9 @@
/* Define to 1 if you have the `pwrite' function. */
#undef HAVE_PWRITE
+/* Define to 1 if you have the <selinux/selinux.h> header file. */
+#undef HAVE_SELINUX_SELINUX_H
+
/* Define to 1 if you have the `setns' function. */
#undef HAVE_SETNS
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -9398,6 +9398,64 @@ if $want_ipa ; then
fi
fi
+for ac_header in selinux/selinux.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default"
+if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SELINUX_SELINUX_H 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5
+$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; }
+if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lselinux $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char security_get_boolean_active ();
+int
+main ()
+{
+return security_get_boolean_active ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_selinux_security_get_boolean_active=yes
+else
+ ac_cv_lib_selinux_security_get_boolean_active=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5
+$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; }
+if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBSELINUX 1
+_ACEOF
+
+ LIBS="-lselinux $LIBS"
+
+fi
+
+
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -465,6 +465,10 @@ if $want_ipa ; then
fi
fi
+dnl Check security_get_boolean_active availability.
+AC_CHECK_HEADERS(selinux/selinux.h)
+AC_CHECK_LIB(selinux, security_get_boolean_active)
+
AC_SUBST(GDBSERVER_DEPFILES)
AC_SUBST(GDBSERVER_LIBS)
AC_SUBST(srv_xmlbuiltin)
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -968,7 +968,16 @@ linux_ptrace_fun ()
{
if (ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) 0,
(PTRACE_TYPE_ARG4) 0) < 0)
- trace_start_error_with_name ("ptrace");
+ {
+ int save_errno = errno;
+
+ std::string msg (linux_ptrace_create_warnings ());
+
+ msg += _("Cannot trace created process");
+
+ errno = save_errno;
+ trace_start_error_with_name (msg.c_str ());
+ }
if (setpgid (0, 0) < 0)
trace_start_error_with_name ("setpgid");
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1092,7 +1092,16 @@ linux_nat_target::create_inferior (const char *exec_file,
@@ -1103,7 +1103,16 @@ linux_nat_target::create_inferior (const char *exec_file,
/* Make sure we report all signals during startup. */
pass_signals ({});
@ -354,3 +228,129 @@ diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h
extern void linux_check_ptrace_features (void);
extern void linux_enable_event_reporting (pid_t pid, int attached);
extern void linux_disable_event_reporting (pid_t pid);
diff --git a/gdbserver/config.in b/gdbserver/config.in
--- a/gdbserver/config.in
+++ b/gdbserver/config.in
@@ -143,6 +143,9 @@
/* Define if you have the ipt library. */
#undef HAVE_LIBIPT
+/* Define to 1 if you have the `selinux' library (-lselinux). */
+#undef HAVE_LIBSELINUX
+
/* Define if the target supports branch tracing. */
#undef HAVE_LINUX_BTRACE
@@ -249,6 +252,9 @@
/* Define to 1 if you have the `sbrk' function. */
#undef HAVE_SBRK
+/* Define to 1 if you have the <selinux/selinux.h> header file. */
+#undef HAVE_SELINUX_SELINUX_H
+
/* Define to 1 if you have the `setns' function. */
#undef HAVE_SETNS
diff --git a/gdbserver/configure b/gdbserver/configure
--- a/gdbserver/configure
+++ b/gdbserver/configure
@@ -10683,6 +10683,64 @@ if $want_ipa ; then
fi
fi
+for ac_header in selinux/selinux.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default"
+if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SELINUX_SELINUX_H 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5
+$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; }
+if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lselinux $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char security_get_boolean_active ();
+int
+main ()
+{
+return security_get_boolean_active ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_selinux_security_get_boolean_active=yes
+else
+ ac_cv_lib_selinux_security_get_boolean_active=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5
+$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; }
+if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBSELINUX 1
+_ACEOF
+
+ LIBS="-lselinux $LIBS"
+
+fi
+
+
diff --git a/gdbserver/configure.ac b/gdbserver/configure.ac
--- a/gdbserver/configure.ac
+++ b/gdbserver/configure.ac
@@ -401,6 +401,10 @@ if $want_ipa ; then
fi
fi
+dnl Check security_get_boolean_active availability.
+AC_CHECK_HEADERS(selinux/selinux.h)
+AC_CHECK_LIB(selinux, security_get_boolean_active)
+
AC_SUBST(GDBSERVER_DEPFILES)
AC_SUBST(GDBSERVER_LIBS)
AC_SUBST(srv_xmlbuiltin)
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -932,7 +932,16 @@ linux_ptrace_fun ()
{
if (ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) 0,
(PTRACE_TYPE_ARG4) 0) < 0)
- trace_start_error_with_name ("ptrace");
+ {
+ int save_errno = errno;
+
+ std::string msg (linux_ptrace_create_warnings ());
+
+ msg += _("Cannot trace created process");
+
+ errno = save_errno;
+ trace_start_error_with_name (msg.c_str ());
+ }
if (setpgid (0, 0) < 0)
trace_start_error_with_name ("setpgid");

View File

@ -80,7 +80,7 @@ gdb/testsuite/ChangeLog
diff --git a/gdb/main.c b/gdb/main.c
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -1148,7 +1148,10 @@ captured_main_1 (struct captured_main_args *context)
@@ -1199,7 +1199,10 @@ captured_main_1 (struct captured_main_args *context)
{
ret = catch_command_errors (attach_command, pid_or_core_arg,
!batch_flag);

View File

@ -30,7 +30,7 @@ debugging problem of GOMP outside of the scope of this Bug.
diff --git a/gdb/infrun.c b/gdb/infrun.c
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -6453,6 +6453,16 @@ process_event_stop_test (struct execution_control_state *ecs)
@@ -6788,6 +6788,16 @@ process_event_stop_test (struct execution_control_state *ecs)
if (ecs->event_thread->control.step_over_calls == STEP_OVER_ALL)
{
@ -47,7 +47,7 @@ diff --git a/gdb/infrun.c b/gdb/infrun.c
/* We're doing a "next".
Normal (forward) execution: set a breakpoint at the
@@ -6486,6 +6496,7 @@ process_event_stop_test (struct execution_control_state *ecs)
@@ -6821,6 +6831,7 @@ process_event_stop_test (struct execution_control_state *ecs)
keep_going (ecs);
return;

View File

@ -9,7 +9,7 @@ Subject: gdb-container-rh-pkg.patch
diff --git a/gdb/remote.c b/gdb/remote.c
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -13916,7 +13916,17 @@ remote_target::pid_to_exec_file (int pid)
@@ -14031,7 +14031,17 @@ remote_target::pid_to_exec_file (int pid)
char *annex = NULL;
if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE)
@ -26,5 +26,5 @@ diff --git a/gdb/remote.c b/gdb/remote.c
+ return NULL;
+ }
inf = find_inferior_pid (pid);
inferior *inf = find_inferior_pid (this, pid);
if (inf == NULL)

View File

@ -12,7 +12,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1270534
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
@@ -9375,6 +9375,7 @@ if test x"$prefer_curses" = xyes; then
@@ -9649,6 +9649,7 @@ if test x"$prefer_curses" = xyes; then
# search /usr/local/include, if ncurses is installed in /usr/local. A
# default installation of ncurses on alpha*-dec-osf* will lead to such
# a situation.
@ -20,7 +20,7 @@ diff --git a/gdb/configure b/gdb/configure
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing waddstr" >&5
$as_echo_n "checking for library containing waddstr... " >&6; }
if ${ac_cv_search_waddstr+:} false; then :
@@ -9399,7 +9400,7 @@ return waddstr ();
@@ -9673,7 +9674,7 @@ return waddstr ();
return 0;
}
_ACEOF
@ -29,7 +29,7 @@ diff --git a/gdb/configure b/gdb/configure
if test -z "$ac_lib"; then
ac_res="none required"
else
@@ -9473,6 +9474,7 @@ case $host_os in
@@ -9747,6 +9748,7 @@ case $host_os in
esac
# These are the libraries checked by Readline.
@ -37,7 +37,7 @@ diff --git a/gdb/configure b/gdb/configure
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5
$as_echo_n "checking for library containing tgetent... " >&6; }
if ${ac_cv_search_tgetent+:} false; then :
@@ -9497,7 +9499,7 @@ return tgetent ();
@@ -9771,7 +9773,7 @@ return tgetent ();
return 0;
}
_ACEOF
@ -49,7 +49,7 @@ diff --git a/gdb/configure b/gdb/configure
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -717,7 +717,8 @@ if test x"$prefer_curses" = xyes; then
@@ -712,7 +712,8 @@ if test x"$prefer_curses" = xyes; then
# search /usr/local/include, if ncurses is installed in /usr/local. A
# default installation of ncurses on alpha*-dec-osf* will lead to such
# a situation.
@ -59,7 +59,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
if test "$ac_cv_search_waddstr" != no; then
curses_found=yes
@@ -759,7 +760,8 @@ case $host_os in
@@ -754,7 +755,8 @@ case $host_os in
esac
# These are the libraries checked by Readline.

View File

@ -39,10 +39,10 @@ gdb/
* dwarf2read.c (process_die): Change gdb_assert to complaint.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -10657,6 +10657,13 @@ private:
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -10162,6 +10162,13 @@ class process_die_scope
static void
process_die (struct die_info *die, struct dwarf2_cu *cu)
{
@ -56,27 +56,10 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
process_die_scope scope (die, cu);
switch (die->tag)
diff --git a/gdb/infrun.c b/gdb/infrun.c
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -601,6 +601,13 @@ holding the child stopped. Try \"set detach-on-fork\" or \
target_pid_to_str (process_ptid).c_str ());
}
+#ifdef NEED_DETACH_SIGSTOP
+ /* We should check PID_WAS_STOPPED and detach it stopped accordingly.
+ In this point of code it cannot be 1 as we would not get FORK
+ executed without CONTINUE first which resets PID_WAS_STOPPED.
+ We would have to first TARGET_STOP and WAITPID it as with running
+ inferior PTRACE_DETACH, SIGSTOP will ignore the signal. */
+#endif
target_detach (parent_inf, 0);
}
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -189,6 +189,12 @@ struct linux_nat_target *linux_target;
@@ -190,6 +190,12 @@ struct linux_nat_target *linux_target;
/* Does the current host support PTRACE_GETREGSET? */
enum tribool have_ptrace_getregset = TRIBOOL_UNKNOWN;
@ -89,17 +72,17 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
static unsigned int debug_linux_nat;
static void
show_debug_linux_nat (struct ui_file *file, int from_tty,
@@ -1030,6 +1036,9 @@ linux_nat_post_attach_wait (ptid_t ptid, int *signalled)
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LNPAW: Attaching to a stopped process\n");
@@ -1044,6 +1050,9 @@ linux_nat_post_attach_wait (ptid_t ptid, int *signalled)
if (linux_proc_pid_is_stopped (pid))
{
linux_nat_debug_printf ("Attaching to a stopped process");
+#ifdef NEED_DETACH_SIGSTOP
+ pid_was_stopped = ptid.pid ();
+#endif
/* The process is definitely stopped. It is in a job control
stop, unless the kernel predates the TASK_STOPPED /
@@ -1361,6 +1370,25 @@ get_detach_signal (struct lwp_info *lp)
@@ -1359,6 +1368,25 @@ get_detach_signal (struct lwp_info *lp)
return gdb_signal_to_host (signo);
}
@ -125,7 +108,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
return 0;
}
@@ -1509,6 +1537,10 @@ linux_nat_target::detach (inferior *inf, int from_tty)
@@ -1502,6 +1530,10 @@ linux_nat_target::detach (inferior *inf, int from_tty)
detach_one_lwp (main_lwp, &signo);
detach_success (inf);
@ -136,7 +119,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
}
}
@@ -1766,6 +1798,16 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
@@ -1744,6 +1776,16 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
return;
}
@ -153,7 +136,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
if (resume_many)
iterate_over_lwps (ptid, [=] (struct lwp_info *info)
{
@@ -3770,6 +3812,10 @@ linux_nat_target::mourn_inferior ()
@@ -3617,6 +3659,10 @@ linux_nat_target::mourn_inferior ()
/* Let the arch-specific native code know this process is gone. */
linux_target->low_forget_process (pid);

View File

@ -9,7 +9,7 @@ Subject: gdb-jit-reader-multilib.patch
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
@@ -9694,10 +9694,12 @@ _ACEOF
@@ -9968,10 +9968,12 @@ _ACEOF
@ -28,7 +28,7 @@ diff --git a/gdb/configure b/gdb/configure
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -808,10 +808,12 @@ AC_CHECK_SIZEOF(unsigned long long)
@@ -803,10 +803,12 @@ AC_CHECK_SIZEOF(unsigned long long)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(unsigned __int128)

View File

@ -6,30 +6,6 @@ Subject: gdb-linux_perf-bundle.patch
;; [dts+el7] [x86*] Bundle linux_perf.h for libipt (RH BZ 1256513).
;;=fedora
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
@@ -11905,7 +11905,7 @@ else
#include <linux/perf_event.h>
#ifndef PERF_ATTR_SIZE_VER5
-# error
+// error // PERF_ATTR_SIZE_VER5_BUNDLE is not available here - Fedora+RHEL
#endif
_ACEOF
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1414,7 +1414,7 @@ else
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
#include <linux/perf_event.h>
#ifndef PERF_ATTR_SIZE_VER5
-# error
+// error // PERF_ATTR_SIZE_VER5_BUNDLE is not available here - Fedora+RHEL
#endif
]])], [perf_event=yes], [perf_event=no])
if test "$perf_event" != yes; then
diff --git a/gdb/gdb.c b/gdb/gdb.c
--- a/gdb/gdb.c
+++ b/gdb/gdb.c
@ -234,3 +210,15 @@ diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.h
struct target_ops;
#if HAVE_LINUX_PERF_EVENT_H
diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4
--- a/gdbsupport/common.m4
+++ b/gdbsupport/common.m4
@@ -145,7 +145,7 @@ AC_DEFUN([GDB_AC_COMMON], [
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
#include <linux/perf_event.h>
#ifndef PERF_ATTR_SIZE_VER5
- # error
+ // error // PERF_ATTR_SIZE_VER5_BUNDLE is not available here - Fedora+RHEL
#endif
]])], [perf_event=yes], [perf_event=no])
if test "$perf_event" != yes; then

View File

@ -1,12 +0,0 @@
diff -Nrup a/gdb/gdbserver/ax.c b/gdb/gdbserver/ax.c
--- a/gdb/gdbserver/ax.c 2019-11-18 18:49:19.000000000 -0700
+++ b/gdb/gdbserver/ax.c 2019-12-19 21:30:19.512505411 -0700
@@ -25,7 +25,7 @@
static void ax_vdebug (const char *, ...) ATTRIBUTE_PRINTF (1, 2);
#ifdef IN_PROCESS_AGENT
-int debug_agent = 0;
+bool debug_agent = 0;
#endif
static void

View File

@ -14,10 +14,10 @@ Bug in FSF GDB exploited by the ptrace-on-utrace interaction.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -11904,6 +11904,8 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
traps we can no longer explain. */
old_loc->events_till_retirement = 3 * (thread_count () + 1);
@@ -11948,6 +11948,8 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
= 3 * (thread_count (proc_target) + 1);
else
old_loc->events_till_retirement = 1;
+ /* Red Hat Bug 590623. */
+ old_loc->events_till_retirement *= 10;
old_loc->owner = NULL;

View File

@ -1,49 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Kevin Buettner <kevinb@redhat.com>
Date: Wed, 8 Apr 2020 16:15:52 -0400
Subject: gdb-rhbz1818011-bfd-gcc10-error.patch
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
;; Fix int conversion error from bfd/elf.c when compiling with gcc 10
Original commit message from H.J. Lu <hjl.tools@gmail.com> is below:
bfd: Change num_group to unsigned int
elf.c failed with to with GCC 10 as of
commit 906b3eb9df6c577d3f6e9c3ea5c9d7e4d1e90536
Author: Martin Liska <mliska@suse.cz>
Date: Tue Mar 24 11:40:10 2020 +0100
Improve endianess detection.
PR lto/94249
* plugin-api.h: Add more robust endianess detection.
binutils-gdb/bfd/elf.c: In function setup_group:
binutils-gdb/bfd/elf.c:740:35: error: overflow in conversion from unsigned int to int changes value from num_group = 4294967295 to -1 [-Werror=overflow]
740 | elf_tdata (abfd)->num_group = num_group = -1;
| ^~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:1608: elf.lo] Error 1
Change num_group in elf_obj_tdata to unsigned int to compile with GCC 10.
PR binutils/25717
* elf-bfd.h (elf_obj_tdata): Change num_group to unsigned int.
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1937,7 +1937,7 @@ struct elf_obj_tdata
struct sdt_note *sdt_note_head;
Elf_Internal_Shdr **group_sect_ptr;
- int num_group;
+ unsigned int num_group;
/* Index into group_sect_ptr, updated by setup_group when finding a
section's group. Used to optimize subsequent group searches. */

View File

@ -1,70 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Kevin Buettner <kevinb@redhat.com>
Date: Thu, 16 Apr 2020 05:27:26 -0700
Subject: gdb-rhbz1822715-fix-python-deprecation.patch
;; Backport fix for deprecation of PyEval_InitThreads in Python 3.9.
Fix compilation of python/python.c for Python 3.9
This commit fixes a compilation warning/error when building GDB
with Python 3.9:
g++ -x c++ -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -DDNF_DEBUGINFO_INSTALL -I. -I../../gdb -I../../gdb/config -DLOCALEDIR="\"/usr/share/locale\"" -DHAVE_CONFIG_H -I../../gdb/../include/opcode -I../bfd -I../../gdb/../bfd -I../../gdb/../include -I../libdecnumber -I../../gdb/../libdecnumber -I../../gdb/../gnulib/import -I../gnulib/import -DTUI=1 -I/usr/include/guile/2.0 -pthread -I/usr/include/python3.9 -I/usr/include/python3.9 -I../../gdb/.. -pthread -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-variable -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-error=maybe-uninitialized -Wno-mismatched-tags -Wsuggest-override -Wimplicit-fallthrough=3 -Wduplicated-cond -Wshadow=local -Wdeprecated-copy -Wdeprecated-copy-dtor -Wredundant-move -Wformat -Wformat-nonliteral -Wno-unused -Werror -c -o ser-tcp.o -MT ser-tcp.o -MMD -MP -MF ./.deps/ser-tcp.Tpo ../../gdb/ser-tcp.c
../../gdb/python/python.c: In function 'bool do_start_initialization()':
../../gdb/python/python.c:1621:23: error: 'void PyEval_InitThreads()' is deprecated [-Werror=deprecated-declarations]
1621 | PyEval_InitThreads ();
| ^
In file included from /usr/include/python3.9/Python.h:141,
from ../../gdb/python/python-internal.h:86,
from ../../gdb/python/python.c:92:
/usr/include/python3.9/ceval.h:132:37: note: declared here
132 | Py_DEPRECATED(3.9) PyAPI_FUNC(void) PyEval_InitThreads(void);
| ^~~~~~~~~~~~~~~~~~
Information about the deprecated function can be found here:
https://docs.python.org/3.9/whatsnew/3.9.html#deprecated
Specifically, with regard to PyEval_InitThreads(), it says:
The PyEval_InitThreads() and PyEval_ThreadsInitialized() functions
are now deprecated and will be removed in Python 3.11. Calling
PyEval_InitThreads() now does nothing. The GIL is initialized by
Py_Initialize() since Python 3.7. (Contributed by Victor Stinner
in bpo-39877.)
I chose to disable the call with a #if test using PY_VERSION_HEX.
There is precedent for use of PY_VERSION_HEX; it's used in two places
in python-internal.h. I noticed that under certain circumstances
python-internal.h defines PyEval_InitThreads to be nothing, which
accomplishes the same thing. I considered doing something similar for
this case, but decided against it because, at some point in the future,
the presence of PyEval_InitThreads() without some explanation will be
confusing to a reader who won't be able to find PyEval_InitThreads in
the current (future for us) Python API. IMO, use of the #if along
with an accompanying comment seemed more straightforward.
gdb/ChangeLog:
* python/python.c (do_start_initialization): Don't call
PyEval_InitThreads for Python 3.9 and beyond.
Change-Id: I0679fc10b6b76761a99538568f13188c6d8014e0
diff --git a/gdb/python/python.c b/gdb/python/python.c
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1618,7 +1618,12 @@ do_start_initialization ()
#endif
Py_Initialize ();
+#if PY_VERSION_HEX < 0x03090000
+ /* PyEval_InitThreads became deprecated in Python 3.9 and will
+ be removed in Python 3.11. Prior to Python 3.7, this call was
+ required to initialize the GIL. */
PyEval_InitThreads ();
+#endif
#ifdef IS_PY3K
gdb_module = PyImport_ImportModule ("_gdb");

View File

@ -1,224 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Keith Seitz <keiths@redhat.com>
Date: Thu, 4 Jun 2020 17:16:48 -0700
Subject: gdb-rhbz1829702-fix-python39.patch
;; Backport "Fix Python 3.9 related runtime problems"
;; Kevin Buettner <kevinb@redhat.com> and Keith Seitz <keiths@redhat.com>
commit c47bae859a5af0d95224d90000df0e529f7c5aa0
Author: Kevin Buettner <kevinb@redhat.com>
Date: Wed May 27 20:05:40 2020 -0700
Fix Python3.9 related runtime problems
Python3.9b1 is now available on Rawhide. GDB w/ Python 3.9 support
can be built using the configure switch -with-python=/usr/bin/python3.9.
Attempting to run gdb/Python3.9 segfaults on startup:
#0 0x00007ffff7b0582c in PyEval_ReleaseLock () from /lib64/libpython3.9
.so.1.0
#1 0x000000000069ccbf in do_start_initialization ()
at worktree-test1/gdb/python/python.c:1789
#2 _initialize_python ()
at worktree-test1/gdb/python/python.c:1877
#3 0x00000000007afb0a in initialize_all_files () at init.c:237
...
Consulting the the documentation...
https://docs.python.org/3/c-api/init.html
...we find that PyEval_ReleaseLock() has been deprecated since version
3.2. It recommends using PyEval_SaveThread or PyEval_ReleaseThread()
instead. In do_start_initialization, in gdb/python/python.c, we
can replace the calls to PyThreadState_Swap() and PyEval_ReleaseLock()
with a single call to PyEval_SaveThread. (Thanks to Keith Seitz
for working this out.)
With that in place, GDB gets a little bit further. It still dies
on startup, but the backtrace is different:
#0 0x00007ffff7b04306 in PyOS_InterruptOccurred ()
from /lib64/libpython3.9.so.1.0
#1 0x0000000000576e86 in check_quit_flag ()
at worktree-test1/gdb/extension.c:776
#2 0x0000000000576f8a in set_active_ext_lang (now_active=now_active@entry=0x983c00 <extension_language_python>)
at worktree-test1/gdb/extension.c:705
#3 0x000000000069d399 in gdbpy_enter::gdbpy_enter (this=0x7fffffffd2d0,
gdbarch=0x0, language=0x0)
at worktree-test1/gdb/python/python.c:211
#4 0x0000000000686e00 in python_new_inferior (inf=0xddeb10)
at worktree-test1/gdb/python/py-inferior.c:251
#5 0x00000000005d9fb9 in std::function<void (inferior*)>::operator()(inferior*) const (__args#0=<optimized out>, this=0xccad20)
at /usr/include/c++/10/bits/std_function.h:617
#6 gdb::observers::observable<inferior*>::notify (args#0=0xddeb10,
this=<optimized out>)
at worktree-test1/gdb/../gdbsupport/observable.h:106
#7 add_inferior_silent (pid=0)
at worktree-test1/gdb/inferior.c:113
#8 0x00000000005dbcb8 in initialize_inferiors ()
at worktree-test1/gdb/inferior.c:947
...
We checked with some Python Developers and were told that we should
acquire the GIL prior to calling any Python C API function. We
definitely don't have the GIL for calls of PyOS_InterruptOccurred().
I moved class_gdbpy_gil earlier in the file and use it in
gdbpy_check_quit_flag() to acquire (and automatically release) the
GIL.
With those changes in place, I was able to run to a GDB prompt. But,
when trying to quit, it segfaulted again due to due to some other
problems with gdbpy_check_quit_flag():
Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
0x00007ffff7bbab0c in new_threadstate () from /lib64/libpython3.9.so.1.0
(top-gdb) bt 8
#0 0x00007ffff7bbab0c in new_threadstate () from /lib64/libpython3.9.so.1.0
#1 0x00007ffff7afa5ea in PyGILState_Ensure.cold ()
from /lib64/libpython3.9.so.1.0
#2 0x000000000069b58c in gdbpy_gil::gdbpy_gil (this=<synthetic pointer>)
at worktree-test1/gdb/python/python.c:278
#3 gdbpy_check_quit_flag (extlang=<optimized out>)
at worktree-test1/gdb/python/python.c:278
#4 0x0000000000576e96 in check_quit_flag ()
at worktree-test1/gdb/extension.c:776
#5 0x000000000057700c in restore_active_ext_lang (previous=0xe9c050)
at worktree-test1/gdb/extension.c:729
#6 0x000000000088913a in do_my_cleanups (
pmy_chain=0xc31870 <final_cleanup_chain>,
old_chain=0xae5720 <sentinel_cleanup>)
at worktree-test1/gdbsupport/cleanups.cc:131
#7 do_final_cleanups ()
at worktree-test1/gdbsupport/cleanups.cc:143
In this case, we're trying to call a Python C API function after
Py_Finalize() has been called from finalize_python(). I made
finalize_python set gdb_python_initialized to false and then cause
check_quit_flag() to return early when it's false.
With these changes in place, GDB seems to be working again with
Python3.9b1. I think it likely that there are other problems lurking.
I wouldn't be surprised to find that there are other calls into Python
where we don't first make sure that we have the GIL. Further changes
may well be needed.
I see no regressions testing on Rawhide using a GDB built with the
default Python version (3.8.3) versus one built using Python 3.9b1.
I've also tested on Fedora 28, 29, 30, 31, and 32 (all x86_64) using
the default (though updated) system installed versions of Python on
those OSes. This means that I've tested against Python versions
2.7.15, 2.7.17, 2.7.18, 3.7.7, 3.8.2, and 3.8.3. In each case GDB
still builds without problem and shows no regressions after applying
this patch.
gdb/ChangeLog:
2020-MM-DD Kevin Buettner <kevinb@redhat.com>
Keith Seitz <keiths@redhat.com>
* python/python.c (do_start_initialization): For Python 3.9 and
later, call PyEval_SaveThread instead of PyEval_ReleaseLock.
(class gdbpy_gil): Move to earlier in file.
(finalize_python): Set gdb_python_initialized.
(gdbpy_check_quit_flag): Acquire GIL via gdbpy_gil. Return early
when not initialized.
diff --git a/gdb/python/python.c b/gdb/python/python.c
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -234,6 +234,30 @@ gdbpy_enter::~gdbpy_enter ()
PyGILState_Release (m_state);
}
+/* A helper class to save and restore the GIL, but without touching
+ the other globals that are handled by gdbpy_enter. */
+
+class gdbpy_gil
+{
+public:
+
+ gdbpy_gil ()
+ : m_state (PyGILState_Ensure ())
+ {
+ }
+
+ ~gdbpy_gil ()
+ {
+ PyGILState_Release (m_state);
+ }
+
+ DISABLE_COPY_AND_ASSIGN (gdbpy_gil);
+
+private:
+
+ PyGILState_STATE m_state;
+};
+
/* Set the quit flag. */
static void
@@ -247,6 +271,10 @@ gdbpy_set_quit_flag (const struct extension_language_defn *extlang)
static int
gdbpy_check_quit_flag (const struct extension_language_defn *extlang)
{
+ if (!gdb_python_initialized)
+ return 0;
+
+ gdbpy_gil gil;
return PyOS_InterruptOccurred ();
}
@@ -924,30 +952,6 @@ gdbpy_source_script (const struct extension_language_defn *extlang,
/* Posting and handling events. */
-/* A helper class to save and restore the GIL, but without touching
- the other globals that are handled by gdbpy_enter. */
-
-class gdbpy_gil
-{
-public:
-
- gdbpy_gil ()
- : m_state (PyGILState_Ensure ())
- {
- }
-
- ~gdbpy_gil ()
- {
- PyGILState_Release (m_state);
- }
-
- DISABLE_COPY_AND_ASSIGN (gdbpy_gil);
-
-private:
-
- PyGILState_STATE m_state;
-};
-
/* A single event. */
struct gdbpy_event
{
@@ -1548,6 +1552,7 @@ finalize_python (void *ignore)
Py_Finalize ();
+ gdb_python_initialized = false;
restore_active_ext_lang (previous_active);
}
@@ -1720,8 +1725,7 @@ do_start_initialization ()
return false;
/* Release the GIL while gdb runs. */
- PyThreadState_Swap (NULL);
- PyEval_ReleaseLock ();
+ PyEval_SaveThread ();
make_final_cleanup (finalize_python, NULL);

File diff suppressed because it is too large Load Diff

View File

@ -1,120 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Wed, 19 Feb 2020 16:40:48 -0500
Subject: gdb-rhbz1844458-use-fputX_unfiltered.patch
;; Fix fput?_unfiltered functions
;; RH BZ 1844458 (Sergio Durigan Junior and Tom Tromey)
Make '{putchar,fputc}_unfiltered' use 'fputs_unfiltered'
There is currently a regression when using
'{putchar,fputc}_unfiltered' with 'puts_unfiltered' which was
introduced by one of the commits that reworked the unfiltered print
code.
The regression makes it impossible to use '{putchar,fputc}_unfiltered'
with 'puts_unfiltered', because the former writes directly to the
ui_file stream using 'stream->write', while the latter uses a buffered
mechanism (see 'wrap_buffer') and delays the printing.
If you do a quick & dirty hack on e.g. top.c:show_gdb_datadir:
@@ -2088,6 +2088,13 @@ static void
show_gdb_datadir (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
+ putchar_unfiltered ('\n');
+ puts_unfiltered ("TEST");
+ putchar_unfiltered ('>');
+ puts_unfiltered ("PUTS");
+ puts_unfiltered ("PUTS");
+ putchar_unfiltered ('\n');
rebuild GDB and invoke the "show data-directory" command, you will
see:
(gdb) show data-directory
>
TESTPUTSGDB's data directory is "/usr/local/share/gdb".
Note how the '>' was printed before the output, and "TEST" and "PUTS"
were printed together.
My first attempt to fix this was to always call 'flush_wrap_buffer' at
the end of 'fputs_maybe_filtered', since it seemed to me that the
function should always print what was requested. But I wasn't sure
this was the right thing to do, so I talked to Tom on IRC and he gave
me another, simpler idea: make '{putchar,fputc}_unfiltered' call into
the already existing 'fputs_unfiltered' function.
This patch implements the idea. I regtested it on the Buildbot, and
no regressions were detected.
gdb/ChangeLog:
2020-02-20 Sergio Durigan Junior <sergiodj@redhat.com>
Tom Tromey <tom@tromey.com>
* utils.c (fputs_maybe_filtered): Call 'stream->puts' instead
of 'fputc_unfiltered'.
(putchar_unfiltered): Call 'fputc_unfiltered'.
(fputc_unfiltered): Call 'fputs_unfiltered'.
diff --git a/gdb/utils.c b/gdb/utils.c
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1783,7 +1783,12 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream,
newline -- if chars_per_line is right, we
probably just overflowed anyway; if it's wrong,
let us keep going. */
- fputc_unfiltered ('\n', stream);
+ /* XXX: The ideal thing would be to call
+ 'stream->putc' here, but we can't because it
+ currently calls 'fputc_unfiltered', which ends up
+ calling us, which generates an infinite
+ recursion. */
+ stream->puts ("\n");
}
else
{
@@ -1828,7 +1833,12 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream,
wrap_here ((char *) 0); /* Spit out chars, cancel
further wraps. */
lines_printed++;
- fputc_unfiltered ('\n', stream);
+ /* XXX: The ideal thing would be to call
+ 'stream->putc' here, but we can't because it
+ currently calls 'fputc_unfiltered', which ends up
+ calling us, which generates an infinite
+ recursion. */
+ stream->puts ("\n");
lineptr++;
}
}
@@ -1923,10 +1933,7 @@ fputs_highlighted (const char *str, const compiled_regex &highlight,
int
putchar_unfiltered (int c)
{
- char buf = c;
-
- ui_file_write (gdb_stdout, &buf, 1);
- return c;
+ return fputc_unfiltered (c, gdb_stdout);
}
/* Write character C to gdb_stdout using GDB's paging mechanism and return C.
@@ -1941,9 +1948,11 @@ putchar_filtered (int c)
int
fputc_unfiltered (int c, struct ui_file *stream)
{
- char buf = c;
+ char buf[2];
- ui_file_write (stream, &buf, 1);
+ buf[0] = c;
+ buf[1] = 0;
+ fputs_unfiltered (buf, stream);
return c;
}

View File

@ -1,240 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Kevin Buettner <kevinb@redhat.com>
Date: Thu, 20 Aug 2020 20:52:12 -0700
Subject: gdb-rhbz1869484-deleted-working-directory
;; Backport patches fixing abort when working directory is deleted.
Guard against 'current_directory == NULL' on gdb_abspath (PR gdb/23613)
Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1728147
Ref.: https://sourceware.org/bugzilla/show_bug.cgi?id=23613
Hi,
This bug has been reported against Fedora GDB, but there's also an
upstream bug. The problem reported is that GDB segfaults when the
working directory is deleted. It's pretty use to reproduce it:
mkdir bla
cd bla
rmdir ../bla
gdb echo
Debugging the problem is a bit tricky, because, since the current
directory doesn't exist anymore, a corefile cannot be saved there.
After a few attempts, I came up with the following:
gdb -ex 'shell mkdir bla' -ex 'cd bla' -ex 'shell rmdir ../bla' -ex 'r echo' ./gdb/gdb
This assumes that you're inside a build directory which contains
./gdb/gdb, of course.
After investigating it, I found that the problem happens at
gdb_abspath, where we're dereferencing 'current_directory' without
checking if it's NULL:
...
(concat (current_directory,
IS_DIR_SEPARATOR (current_directory[strlen (current_directory) - 1])
? "" : SLASH_STRING,
...
So I fixed the problem with the patch below. The idea is that, if
'current_directory' is NULL, then the final string returned should be
just the "path".
After fixing the bug, I found a similar one reported against our
bugzilla: PR gdb/23613. The problem is the same, but the reproducer
is a bit different.
I really tried writing a testcase for this, but unfortunately it's
apparently not possible to start GDB inside a non-existent directory
with DejaGNU.
I regression tested this patch on the BuildBot, and no regressions
were found.
gdb/ChangeLog:
2019-12-14 Sergio Durigan Junior <sergiodj@redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=1728147
PR gdb/23613
* bsd-kvm.c (bsd_kvm_target_open): Use 'gdb_abspath'.
* corelow.c: Include 'gdbsupport/pathstuff.h'.
(core_target_open): Use 'gdb_abspath'.
* gdbsupport/pathstuff.c (gdb_abspath): Guard against
'current_directory == NULL' case.
* gdbsupport/pathstuff.h (gdb_abspath): Expand comment and
explain what happens when 'current_directory' is NULL.
* go32-nat.c (go32_nat_target::wait): Check if
'current_directory' is NULL before call to 'chdir'.
* source.c (add_path): Use 'gdb_abspath'.
* top.c: Include 'gdbsupport/pathstuff.h'.
(init_history): Use 'gdb_abspath'.
(set_history_filename): Likewise.
* tracefile-tfile.c: Include 'gdbsupport/pathstuff.h'.
(tfile_target_open): Use 'gdb_abspath'.
Change-Id: Ibb0932fa25bc5c2d3ae4a7f64bd7f32885ca403b
diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c
--- a/gdb/bsd-kvm.c
+++ b/gdb/bsd-kvm.c
@@ -114,14 +114,13 @@ bsd_kvm_target_open (const char *arg, int from_tty)
if (arg)
{
- char *temp;
-
filename = tilde_expand (arg);
if (filename[0] != '/')
{
- temp = concat (current_directory, "/", filename, (char *)NULL);
+ gdb::unique_xmalloc_ptr<char> temp (gdb_abspath (filename));
+
xfree (filename);
- filename = temp;
+ filename = temp.release ();
}
}
diff --git a/gdb/corelow.c b/gdb/corelow.c
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -48,6 +48,7 @@
#include "completer.h"
#include "gdbsupport/filestuff.h"
#include "build-id.h"
+#include "gdbsupport/pathstuff.h"
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
@@ -407,8 +408,7 @@ core_target_open (const char *arg, int from_tty)
gdb::unique_xmalloc_ptr<char> filename (tilde_expand (arg));
if (!IS_ABSOLUTE_PATH (filename.get ()))
- filename.reset (concat (current_directory, "/",
- filename.get (), (char *) NULL));
+ filename = gdb_abspath (filename.get ());
flags = O_BINARY | O_LARGEFILE;
if (write_files)
diff --git a/gdb/gdbsupport/pathstuff.c b/gdb/gdbsupport/pathstuff.c
--- a/gdb/gdbsupport/pathstuff.c
+++ b/gdb/gdbsupport/pathstuff.c
@@ -134,7 +134,7 @@ gdb_abspath (const char *path)
if (path[0] == '~')
return gdb_tilde_expand_up (path);
- if (IS_ABSOLUTE_PATH (path))
+ if (IS_ABSOLUTE_PATH (path) || current_directory == NULL)
return make_unique_xstrdup (path);
/* Beware the // my son, the Emacs barfs, the botch that catch... */
diff --git a/gdb/gdbsupport/pathstuff.h b/gdb/gdbsupport/pathstuff.h
--- a/gdb/gdbsupport/pathstuff.h
+++ b/gdb/gdbsupport/pathstuff.h
@@ -44,7 +44,10 @@ extern gdb::unique_xmalloc_ptr<char>
Contrary to "gdb_realpath", this function uses CURRENT_DIRECTORY
for the path expansion. This may lead to scenarios the current
- working directory (CWD) is different than CURRENT_DIRECTORY. */
+ working directory (CWD) is different than CURRENT_DIRECTORY.
+
+ If CURRENT_DIRECTORY is NULL, this function returns a copy of
+ PATH. */
extern gdb::unique_xmalloc_ptr<char> gdb_abspath (const char *path);
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -507,7 +507,8 @@ go32_nat_target::wait (ptid_t ptid, struct target_waitstatus *status,
}
getcwd (child_cwd, sizeof (child_cwd)); /* in case it has changed */
- chdir (current_directory);
+ if (current_directory != NULL)
+ chdir (current_directory);
if (a_tss.tss_irqn == 0x21)
{
diff --git a/gdb/source.c b/gdb/source.c
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -542,8 +542,7 @@ add_path (const char *dirname, char **which_path, int parse_separators)
new_name_holder.reset (concat (name, ".", (char *) NULL));
#endif
else if (!IS_ABSOLUTE_PATH (name) && name[0] != '$')
- new_name_holder.reset (concat (current_directory, SLASH_STRING, name,
- (char *) NULL));
+ new_name_holder = gdb_abspath (name);
else
new_name_holder.reset (savestring (name, p - name));
name = new_name_holder.get ();
diff --git a/gdb/top.c b/gdb/top.c
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -54,6 +54,7 @@
#include "gdb_select.h"
#include "gdbsupport/scope-exit.h"
#include "gdbarch.h"
+#include "gdbsupport/pathstuff.h"
/* readline include files. */
#include "readline/readline.h"
@@ -2020,12 +2021,13 @@ init_history (void)
that was read. */
#ifdef __MSDOS__
/* No leading dots in file names are allowed on MSDOS. */
- history_filename = concat (current_directory, "/_gdb_history",
- (char *)NULL);
+ const char *fname = "_gdb_history";
#else
- history_filename = concat (current_directory, "/.gdb_history",
- (char *)NULL);
+ const char *fname = ".gdb_history";
#endif
+
+ gdb::unique_xmalloc_ptr<char> temp (gdb_abspath (fname));
+ history_filename = temp.release ();
}
read_history (history_filename);
}
@@ -2103,8 +2105,12 @@ set_history_filename (const char *args,
directories the file written will be the same as the one
that was read. */
if (!IS_ABSOLUTE_PATH (history_filename))
- history_filename = reconcat (history_filename, current_directory, "/",
- history_filename, (char *) NULL);
+ {
+ gdb::unique_xmalloc_ptr<char> temp (gdb_abspath (history_filename));
+
+ xfree (history_filename);
+ history_filename = temp.release ();
+ }
}
static void
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -32,6 +32,7 @@
#include "xml-tdesc.h"
#include "target-descriptions.h"
#include "gdbsupport/buffer.h"
+#include "gdbsupport/pathstuff.h"
#include <algorithm>
#ifndef O_LARGEFILE
@@ -470,8 +471,7 @@ tfile_target_open (const char *arg, int from_tty)
gdb::unique_xmalloc_ptr<char> filename (tilde_expand (arg));
if (!IS_ABSOLUTE_PATH (filename.get ()))
- filename.reset (concat (current_directory, "/", filename.get (),
- (char *) NULL));
+ filename = gdb_abspath (filename.get ());
flags = O_BINARY | O_LARGEFILE;
flags |= O_RDONLY;

View File

@ -25,7 +25,7 @@ a problem with make -j parallelization of the testsuite.
diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
--- a/gdb/testsuite/lib/future.exp
+++ b/gdb/testsuite/lib/future.exp
@@ -195,6 +195,10 @@ proc gdb_default_target_compile {source destfile type options} {
@@ -197,6 +197,10 @@ proc gdb_default_target_compile_1 {source destfile type options} {
set ldflags ""
set dest [target_info name]
@ -36,7 +36,7 @@ diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
if {[info exists CFLAGS_FOR_TARGET]} {
append add_flags " $CFLAGS_FOR_TARGET"
}
@@ -529,10 +533,6 @@ proc gdb_default_target_compile {source destfile type options} {
@@ -531,10 +535,6 @@ proc gdb_default_target_compile_1 {source destfile type options} {
}
}

View File

@ -22,15 +22,13 @@ And adjust its testcase.
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -319,8 +319,22 @@ f_val_print (struct type *type, int embedded_offset,
original_value, &opts, 0, stream);
@@ -310,7 +310,21 @@ f_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
value_print_scalar_formatted (val, &opts, 0, stream);
}
else
- val_print_scalar_formatted (type, embedded_offset,
- original_value, options, 0, stream);
- value_print_scalar_formatted (val, options, 0, stream);
+ {
+ val_print_scalar_formatted (type, embedded_offset,
+ original_value, options, 0, stream);
+ value_print_scalar_formatted (val, options, 0, stream);
+ /* C and C++ has no single byte int type, char is used instead.
+ Since we don't know whether the value is really intended to
+ be used as an integer or a character, print the character
@ -40,7 +38,7 @@ diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
+ LONGEST c;
+
+ fputs_filtered (" ", stream);
+ c = unpack_long (type, valaddr + embedded_offset);
+ c = unpack_long (type, valaddr);
+ LA_PRINT_CHAR ((unsigned char) c, type, stream);
+ }
+ }
@ -50,7 +48,7 @@ diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
diff --git a/gdb/testsuite/gdb.fortran/printing-types.exp b/gdb/testsuite/gdb.fortran/printing-types.exp
--- a/gdb/testsuite/gdb.fortran/printing-types.exp
+++ b/gdb/testsuite/gdb.fortran/printing-types.exp
@@ -29,7 +29,7 @@ if {![runto MAIN__]} then {
@@ -30,7 +30,7 @@ if {![fortran_runto_main]} then {
gdb_breakpoint [gdb_get_line_number "write"]
gdb_continue_to_breakpoint "write"

View File

@ -37,7 +37,7 @@ dbfd7140bf4c0500d1f5d192be781f83f78f7922
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;
}
@ -56,16 +56,16 @@ diff --git a/gdb/eval.c b/gdb/eval.c
{
- 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));
@ -139,16 +139,16 @@ diff --git a/gdb/eval.c b/gdb/eval.c
+ 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'. */
@ -156,9 +156,9 @@ diff --git a/gdb/eval.c b/gdb/eval.c
+ 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"));
@ -183,7 +183,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c
+ 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)
+ {
@ -199,17 +199,17 @@ diff --git a/gdb/eval.c b/gdb/eval.c
+ /* 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
@ -241,7 +241,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c
+ 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)
+ {
@ -289,12 +289,12 @@ diff --git a/gdb/eval.c b/gdb/eval.c
+ 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,
@ -364,8 +364,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c
+ 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);
+
@ -381,7 +380,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c
}
@@ -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);
}
@ -395,13 +394,13 @@ diff --git a/gdb/eval.c b/gdb/eval.c
- 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:
@ -436,7 +435,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c
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);
@ -484,22 +483,22 @@ diff --git a/gdb/eval.c b/gdb/eval.c
- }
-
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;
@ -521,7 +520,7 @@ diff --git a/gdb/expprint.c b/gdb/expprint.c
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)
{
@ -554,7 +553,7 @@ diff --git a/gdb/expprint.c b/gdb/expprint.c
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;
}
@ -710,18 +709,9 @@ diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
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,
@ -729,29 +719,13 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
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) \
@ -761,19 +735,36 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
+#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))
+#define TYPE_ARRAY_STRIDE_IS_UNDEFINED(arraytype) \
+ (TYPE_BYTE_STRIDE(TYPE_INDEX_TYPE(arraytype)) == 0)
+
((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))
#define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \
(TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype))))
+/* 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(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_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
@ -856,33 +847,33 @@ diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y
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)
{
@ -891,7 +882,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
*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
@ -900,7 +891,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
*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. */
@ -909,7 +900,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
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
@ -918,7 +909,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
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;
@ -1416,7 +1407,7 @@ new file mode 100644
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"
@ -1426,7 +1417,7 @@ diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortra
"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"
@ -1435,7 +1426,7 @@ diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortra
"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"
@ -1445,7 +1436,7 @@ diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortra
"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"
@ -1544,7 +1535,7 @@ new file mode 100644
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)
@ -1588,25 +1579,25 @@ diff --git a/gdb/valops.c b/gdb/valops.c
- 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);
- range_type = array_type->index_type ();
- if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
- 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));
@ -1623,12 +1614,12 @@ diff --git a/gdb/valops.c b/gdb/valops.c
+
+ 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
@ -1642,7 +1633,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c
+ 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. */
@ -1654,9 +1645,9 @@ diff --git a/gdb/valops.c b/gdb/valops.c
+ 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
@ -1674,7 +1665,11 @@ diff --git a/gdb/valops.c b/gdb/valops.c
- 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)
@ -1682,12 +1677,8 @@ diff --git a/gdb/valops.c b/gdb/valops.c
+ 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);
@ -1731,12 +1722,12 @@ diff --git a/gdb/valops.c b/gdb/valops.c
+
+ 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);
+
@ -1772,16 +1763,16 @@ diff --git a/gdb/valops.c b/gdb/valops.c
+ 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. */

View File

@ -33,7 +33,7 @@ git diff --stat -p gdb/master...gdb/users/bheckel/fortran-vla-strings
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*
@@ -985,6 +985,8 @@ SH-5/SH64 running OpenBSD SH-5/SH64 support in sh*-*-openbsd*
*** Changes in GDB 8.1
@ -45,11 +45,11 @@ diff --git a/gdb/NEWS b/gdb/NEWS
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,
@@ -572,6 +572,28 @@ c_value_print (struct value *val, struct ui_file *stream,
else
{
/* normal case */
+ if (TYPE_CODE (type) == TYPE_CODE_PTR
+ if (type->code () == TYPE_CODE_PTR
+ && 1 == is_dynamic_type (type))
+ {
+ CORE_ADDR addr;
@ -64,7 +64,7 @@ diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
+ && (0 == type_not_associated (type)))
+ TYPE_TARGET_TYPE (type) =
+ resolve_dynamic_type (TYPE_TARGET_TYPE (type),
+ NULL, addr);
+ {}, addr);
+ }
+ else
+ {
@ -74,10 +74,10 @@ diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
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 *);
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -1562,7 +1562,10 @@ static void read_signatured_type (signatured_type *sig_type,
static int attr_to_dynamic_prop (const struct attribute *attr,
struct die_info *die, struct dwarf2_cu *cu,
@ -89,16 +89,25 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
/* memory allocation interface */
@@ -13799,7 +13802,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
@@ -13631,7 +13634,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->addr_type ());
+ cu->addr_type (), 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)
@@ -16073,7 +16076,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
else
{
struct dynamic_prop prop;
- if (attr_to_dynamic_prop (attr, die, cu, &prop, cu->addr_type ()))
+ if (attr_to_dynamic_prop (attr, die, cu, &prop, cu->addr_type (), NULL, 0))
type->add_dyn_prop (DYN_PROP_BYTE_SIZE, prop);
TYPE_LENGTH (type) = 0;
}
@@ -16764,7 +16767,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,
@ -107,7 +116,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
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)
@@ -17522,7 +17525,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;
@ -116,7 +125,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
/* 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)
@@ -17543,6 +17546,10 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
}
}
@ -125,9 +134,9 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
+
+ /* 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))
if (attr != nullptr && !attr->form_is_constant ())
{
@@ -17372,13 +17379,71 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
@@ -17569,13 +17576,68 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
}
/* Convert the attribute into a dynamic property. */
@ -139,7 +148,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
}
else if (attr != nullptr)
{
+ if (attr_form_is_block (attr))
+ if (attr->form_is_block ())
+ {
+ struct attribute *byte_size, *bit_size;
+ struct dynamic_prop high;
@ -189,18 +198,15 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
+ complaint (_("Could not parse DW_AT_string_length"));
+ }
+
+ TYPE_RANGE_DATA (range_type)->high = high;
+ range_type->bounds ()->high = high;
+ }
+ else
+ {
+ TYPE_HIGH_BOUND (range_type) = DW_UNSND(attr);
+ TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST;
+ }
+ range_type->bounds ()->high.set_const_val (DW_UNSND(attr));
+
/* 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)
@@ -17589,6 +17651,14 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
}
else
{
@ -208,28 +214,22 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
+ 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;
+ }
+ range_type->bounds ()->high.set_const_val (DW_UNSND(attr));
+ else
+ {
+ TYPE_HIGH_BOUND (range_type) = 1;
+ TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST;
+ }
+ range_type->bounds ()->high.set_const_val (1);
+
/* 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;
@@ -17603,6 +17673,7 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
low_bound.set_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)
@@ -18078,7 +18149,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,
@ -238,18 +238,17 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
+ 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;
dwarf2_per_objfile *per_objfile = cu->per_objfile;
@@ -18108,6 +18180,26 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
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,
+ &cu->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,
@ -264,17 +263,13 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
+ 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);
prop->set_locexpr (baton);
gdb_assert (prop->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);
@@ -18142,11 +18234,31 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
baton->property_type = die_type (target_die, target_cu);
baton->locexpr.per_cu = cu->per_cu;
baton->locexpr.per_objfile = per_objfile;
- baton->locexpr.size = DW_BLOCK (target_attr)->size;
- baton->locexpr.data = DW_BLOCK (target_attr)->data;
baton->locexpr.is_reference = true;
@ -283,7 +278,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
+ {
+ gdb_byte *data;
+
+ data = (gdb_byte *) obstack_alloc (&cu->per_cu->dwarf2_per_objfile->objfile->objfile_obstack,
+ data = (gdb_byte *) obstack_alloc (&cu->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);
@ -300,10 +295,13 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
+ 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)
prop->set_locexpr (baton);
- gdb_assert (prop->baton () != NULL);
+ gdb_assert (prop->baton() != NULL);
}
else
{
@@ -18308,8 +18420,8 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
}
attr = dwarf2_attr (die, DW_AT_lower_bound, cu);
@ -314,7 +312,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
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)
@@ -18318,10 +18430,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);
@ -326,80 +324,54 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
+ 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);
if (low.kind () == PROP_CONST && high.kind () == PROP_CONST)
@@ -18372,7 +18484,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
{
struct type *prop_type = cu->addr_sized_int_type (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);
@@ -18392,7 +18504,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
{
struct type *prop_type = cu->addr_sized_int_type (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)
@@ -24424,7 +24536,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
if (attr != NULL)
{
struct type *prop_type
= dwarf2_per_cu_addr_sized_int_type (cu->per_cu, false);
struct type *prop_type = cu->addr_sized_int_type (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);
type->add_dyn_prop (DYN_PROP_ALLOCATED, prop);
}
else if (attr != NULL)
@@ -25895,7 +26017,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
@@ -24433,13 +24545,13 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
if (attr != NULL)
{
struct type *prop_type
= dwarf2_per_cu_addr_sized_int_type (cu->per_cu, false);
struct type *prop_type = cu->addr_sized_int_type (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);
type->add_dyn_prop (DYN_PROP_ASSOCIATED, prop);
}
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 (attr_to_dynamic_prop (attr, die, cu, &prop, cu->addr_type ()))
+ if (attr_to_dynamic_prop (attr, die, cu, &prop, cu->addr_type (), NULL, 0))
type->add_dyn_prop (DYN_PROP_DATA_LOCATION, prop);
if (dwarf2_per_objfile->die_type_hash == NULL)
if (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,
@@ -217,8 +217,9 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
else
{
LONGEST lower_bound = f77_get_lowerbound (type);
@ -410,7 +382,7 @@ diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
/* 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,
@@ -229,7 +230,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
{
LONGEST upper_bound = f77_get_upperbound (type);
@ -419,7 +391,7 @@ diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
}
}
@@ -249,7 +249,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
@@ -249,7 +250,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);
@ -431,17 +403,17 @@ diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
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)
@@ -1977,7 +1977,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_CODE_REF)
+ if (top_level &&
+ (TYPE_CODE (type) == TYPE_CODE_REF || TYPE_CODE (type) == TYPE_CODE_PTR))
+ (type->code () == TYPE_CODE_REF || type-> code() == 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)
@@ -2017,10 +2018,10 @@ is_dynamic_type_internal (struct type *type, int top_level)
|| is_dynamic_type_internal (TYPE_TARGET_TYPE (type), 0));
}
@ -451,26 +423,26 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
case TYPE_CODE_ARRAY:
+ case TYPE_CODE_STRING:
{
gdb_assert (TYPE_NFIELDS (type) == 1);
gdb_assert (type->num_fields () == 1);
@@ -2139,11 +2140,15 @@ resolve_dynamic_array_or_string (struct type *type,
@@ -2183,11 +2184,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))
- if (ary_dim != NULL && ary_dim->code () == TYPE_CODE_ARRAY)
+ if (ary_dim != NULL && (ary_dim->code () == TYPE_CODE_ARRAY
+ || ary_dim->code () == 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)
+ if (type->code () == TYPE_CODE_STRING)
+ return create_string_type (type, elt_type, range_type);
+
prop = get_dyn_prop (DYN_PROP_BYTE_STRIDE, type);
prop = type->dyn_prop (DYN_PROP_BYTE_STRIDE);
if (prop != NULL)
{
@@ -2295,6 +2300,28 @@ resolve_dynamic_struct (struct type *type,
@@ -2533,6 +2538,25 @@ resolve_dynamic_struct (struct type *type,
return resolved_type;
}
@ -488,10 +460,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
+ /* 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;
+ }
+ prop->set_const_val (value);
+
+ return type;
+}
@ -499,7 +468,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
/* Worker for resolved_dynamic_type. */
static struct type *
@@ -2349,6 +2376,9 @@ resolve_dynamic_type_internal (struct type *type,
@@ -2594,6 +2618,9 @@ resolve_dynamic_type_internal (struct type *type,
case TYPE_CODE_ARRAY:
resolved_type = resolve_dynamic_array_or_string (type, addr_stack);
break;
@ -804,7 +773,7 @@ diff --git a/gdb/testsuite/gdb.fortran/print_type.exp b/gdb/testsuite/gdb.fortra
# 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]
@@ -42,7 +43,7 @@ set complex [fortran_complex4]
# matches the string TYPE.
proc check_pointer_type { var_name type } {
gdb_test "ptype ${var_name}" \
@ -813,7 +782,7 @@ diff --git a/gdb/testsuite/gdb.fortran/print_type.exp b/gdb/testsuite/gdb.fortra
}
gdb_breakpoint [gdb_get_line_number "Before pointer assignment"]
@@ -85,7 +86,8 @@ gdb_test "ptype twop" \
@@ -87,7 +88,8 @@ gdb_test "ptype twop" \
[multi_line "type = PTR TO -> \\( Type two" \
" $int, allocatable :: ivla1\\(:\\)" \
" $int, allocatable :: ivla2\\(:,:\\)" \
@ -823,7 +792,7 @@ diff --git a/gdb/testsuite/gdb.fortran/print_type.exp b/gdb/testsuite/gdb.fortra
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"
@@ -99,11 +101,11 @@ gdb_test "ptype intv" "type = $int"
gdb_test "ptype inta" "type = $int \\(10,2\\)"
gdb_test "ptype realv" "type = $real"
@ -840,7 +809,7 @@ diff --git a/gdb/testsuite/gdb.fortran/print_type.exp b/gdb/testsuite/gdb.fortra
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 {
@@ -113,4 +115,4 @@ gdb_test_multiple $test $test {
pass $test
}
}
@ -1001,7 +970,7 @@ new file mode 100644
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"]
@@ -37,7 +37,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" \
@ -1010,7 +979,7 @@ diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran
"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 {
@@ -58,7 +58,7 @@ with_timeout_factor 15 {
"step over value assignment of vla1"
}
gdb_test "print &vla1" \
@ -1019,7 +988,7 @@ diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran
"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" \
@@ -78,7 +78,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" \
@ -1028,7 +997,7 @@ diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran
"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
@@ -87,7 +87,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" \
@ -1040,7 +1009,7 @@ diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran
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)
@@ -565,6 +565,25 @@ whatis_exp (const char *exp, int show)
printf_filtered (" */\n");
}
@ -1048,7 +1017,7 @@ diff --git a/gdb/typeprint.c b/gdb/typeprint.c
+ 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
+ if (type->code () == TYPE_CODE_PTR
+ && is_dynamic_type (type) == 1)
+ {
+ CORE_ADDR addr;
@ -1060,7 +1029,7 @@ diff --git a/gdb/typeprint.c b/gdb/typeprint.c
+ if (addr != 0
+ && type_not_associated (type) == 0)
+ TYPE_TARGET_TYPE (type) = resolve_dynamic_type (TYPE_TARGET_TYPE (type),
+ NULL, addr);
+ {}, addr);
+ }
+
LA_PRINT_TYPE (type, "", gdb_stdout, show, 0, &flags);
@ -1070,7 +1039,7 @@ 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)
if (base_type->code () == TYPE_CODE_PTR)
{
struct type *enc_type;
+ CORE_ADDR addr;
@ -1085,24 +1054,24 @@ diff --git a/gdb/valops.c b/gdb/valops.c
+
+ if (addr != 0)
+ TYPE_TARGET_TYPE (base_type) =
+ resolve_dynamic_type (TYPE_TARGET_TYPE (base_type), NULL, addr);
+ resolve_dynamic_type (TYPE_TARGET_TYPE (base_type), {}, 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)
@@ -1570,8 +1583,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)));
{
/* Retrieve the enclosing object pointed to. */
- base_addr = (value_as_address (arg1)
- - value_pointed_to_offset (arg1));
+ base_addr = (addr - value_pointed_to_offset (arg1));
}
arg2 = value_at_lazy (enc_type, base_addr);
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,
@@ -1046,12 +1046,6 @@ value_check_printable (struct value *val, struct ui_file *stream,
return 0;
}

View File

@ -27,10 +27,10 @@ cannot reproduce it.
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;
@ -50,7 +50,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
+
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

View File

@ -18,12 +18,15 @@ diff --git a/gdb/testsuite/gdb.fortran/ptr-indentation.exp b/gdb/testsuite/gdb.f
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" \
@@ -42,7 +42,7 @@ 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\\)\\)\\)\\)"
gdb_test "ptype say_string" \
"type = void \\(character\\*\\(\\*\\), integer\\(kind=\\d+\\)\\)"
diff --git a/gdb/testsuite/gdb.fortran/vla-func.exp b/gdb/testsuite/gdb.fortran/vla-func.exp
new file mode 100644
--- /dev/null
@ -169,12 +172,12 @@ new file mode 100644
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] {
@@ -33,5 +33,5 @@ set real4 [fortran_real4]
# 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}" \
-gdb_test "print &pvla" " = \\(PTR TO -> \\( $real4 \\(10,10,10\\) \\)\\) ${hex}" \
+gdb_test "print &pvla" " = \\(PTR TO -> \\( $real4 \\(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

View File

@ -31,13 +31,13 @@ Name: %{?scl_prefix}gdb
# Freeze it when GDB gets branched
%global snapsrc 20200208
# See timestamp of source gnulib installed into gnulib/ .
%global snapgnulib 20191216
%global snapgnulib 20200630
%global tarname gdb-%{version}
Version: 9.2
Version: 10.1
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
Release: 8%{?dist}
Release: 1%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL
# Do not provide URL for snapshots as the file lasts there only for 2 days.
@ -205,10 +205,6 @@ Patch1119: gdb-testsuite-readline63-sigint-revert.patch
#push=Should be pushed upstream.
Patch2000: gdb-config.patch
# Fix type mismatch issue exposed by LTO
#push=Should be pushed upstream.
Patch2001: gdb-ltofix.patch
# Include the auto-generated file containing the "Patch:" directives.
# See README.local-patches for more details.
Patch9998: _gdb.spec.Patch.include
@ -497,7 +493,6 @@ done
%endif
%patch2000 -p1
%patch2001 -p1
# The above patches twiddle a .m4 file for configure, so update the affected
# configure files
@ -1189,6 +1184,18 @@ fi
%endif
%changelog
* Wed Nov 04 2020 Kevin Buettner <kevinb@redhat.com> - 10.1-1
- Rebase to FSF GDB 10.1.
- Bump 'snapgnulib' date.
- Drop gdb-rhbz1818011-bfd-gcc10-error.patch.
- Drop gdb-rhbz1822715-fix-python-deprecation.patch.
- Drop gdb-rhbz1829702-fix-python39.patch.
- Drop gdb-rhbz1838777-debuginfod.patch.
- Drop gdb-rhbz1844458-use-fputX_unfiltered.patch.
- Drop gdb-rhbz1869484-deleted-working-directory.
- Adjust build-id related patches.
- Ajust VLA patches.
* Mon Nov 2 2020 Kevin Buettner <kevinb@redhat.com> - 9.2-8
- Backport patches fixing abort when working directory is deleted.
(RHBZ 1869484, Sergio Durigan Junior)

View File

@ -1,3 +1,3 @@
SHA512 (gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz) = a8b1c54dd348cfeb37da73f968742896be3dd13a4215f8d8519870c2abea915f5176c3fa6989ddd10f20020a16f0fab20cbae68ee8d58a82234d8778023520f8
SHA512 (v2.0.2.tar.gz) = bc256a57a8481e0be8220624da3ccf1fe4bf0ea83e9808fdf0aad6db865aee402a36e78285efb0316c016f57e0d6fc56b647ee8e9a2ad4b05bfc1ad68ddde535
SHA512 (gdb-9.2.tar.xz) = 73635f00f343117aa5e2436f1e1597099e2bfb31ef7bb162b273fa1ea282c3fa9b0f52762e70bfc7ad0334addb8d159e9ac7cbe5998ca4f755ea8cf90714d274
SHA512 (gdb-10.1.tar.xz) = 0dc54380435c6853db60f1e388b94836d294dfa9ad7f518385a27db4edd03cb970f8717d5f1e9c9a0d4a33d7fcf91bc2e5d6c9cf9e4b561dcc74e65b806c1537