Rebase to FSF GDB 7.7.90.20140613 (pre-7.8 snapshot).

This commit is contained in:
Jan Kratochvil 2014-06-19 22:14:32 +02:00
parent 730f2712ef
commit eb6cb2db36
72 changed files with 9873 additions and 13850 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
/gdb-libstdc++-v3-python-r155978.tar.bz2
/gdb-7.7.1.tar.bz2
/gdb-7.7.90.20140613.tar.bz2

View File

@ -1,29 +1,29 @@
Index: gdb-7.6.90.20140127/gdb/testsuite/configure.ac
Index: gdb-7.7.50.20140609/gdb/testsuite/configure.ac
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/testsuite/configure.ac 2014-01-27 22:41:19.281501688 +0100
+++ gdb-7.6.90.20140127/gdb/testsuite/configure.ac 2014-01-27 22:41:39.736517360 +0100
@@ -96,6 +96,6 @@ AC_OUTPUT([Makefile \
--- gdb-7.7.50.20140609.orig/gdb/testsuite/configure.ac 2014-06-13 20:05:33.058506817 +0200
+++ gdb-7.7.50.20140609/gdb/testsuite/configure.ac 2014-06-13 20:05:59.991532595 +0200
@@ -97,6 +97,6 @@ AC_OUTPUT([Makefile \
gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile \
gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile \
gdb.hp/gdb.defects/Makefile gdb.guile/Makefile gdb.linespec/Makefile \
gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile \
- gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile \
+ gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile \
gdb.perf/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile \
gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile])
Index: gdb-7.6.90.20140127/gdb/testsuite/configure
Index: gdb-7.7.50.20140609/gdb/testsuite/configure
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/testsuite/configure 2014-01-27 22:41:19.283501689 +0100
+++ gdb-7.6.90.20140127/gdb/testsuite/configure 2014-01-27 22:41:49.933525172 +0100
--- gdb-7.7.50.20140609.orig/gdb/testsuite/configure 2014-06-13 20:05:29.956503899 +0200
+++ gdb-7.7.50.20140609/gdb/testsuite/configure 2014-06-13 20:06:24.492555709 +0200
@@ -3448,7 +3448,7 @@ done
-ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.btrace/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.go/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.perf/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
+ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.btrace/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.go/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.perf/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
-ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.btrace/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.dlang/Makefile gdb.fortran/Makefile gdb.gdb/Makefile gdb.go/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.guile/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.perf/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
+ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.btrace/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.dlang/Makefile gdb.fortran/Makefile gdb.gdb/Makefile gdb.go/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.guile/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.perf/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -4176,6 +4176,7 @@ do
@@ -4179,6 +4179,7 @@ do
"gdb.opencl/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.opencl/Makefile" ;;
"gdb.opt/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.opt/Makefile" ;;
"gdb.pascal/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.pascal/Makefile" ;;
@ -31,10 +31,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/configure
"gdb.perf/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.perf/Makefile" ;;
"gdb.python/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.python/Makefile" ;;
"gdb.reverse/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.reverse/Makefile" ;;
Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/attach.c
Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/attach.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/attach.c 2014-01-27 22:41:19.284501690 +0100
+++ gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/attach.c 2014-06-13 20:05:33.060506819 +0200
@@ -0,0 +1,20 @@
+/* This program is intended to be started outside of gdb, and then
+ attached to by gdb. Thus, it simply spins in a loop. The loop
@ -56,10 +56,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/attach.c
+ }
+ return 0;
+}
Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/attach2.c
Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/attach2.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/attach2.c 2014-01-27 22:41:19.284501690 +0100
+++ gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/attach2.c 2014-06-13 20:05:33.060506819 +0200
@@ -0,0 +1,24 @@
+/* This program is intended to be started outside of gdb, and then
+ attached to by gdb. Thus, it simply spins in a loop. The loop
@ -85,10 +85,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/attach2.c
+ }
+ return (0);
+}
Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/break.c
Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/break.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/break.c 2014-01-27 22:41:19.284501690 +0100
+++ gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/break.c 2014-06-13 20:05:33.061506820 +0200
@@ -0,0 +1,146 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -236,10 +236,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/break.c
+ }
+ return 0;
+}
Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/break1.c
Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/break1.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/break1.c 2014-01-27 22:41:19.284501690 +0100
+++ gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/break1.c 2014-06-13 20:05:33.061506820 +0200
@@ -0,0 +1,44 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -285,10 +285,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/break1.c
+void marker3 (a, b) char *a, *b; {} /* set breakpoint 18 here */
+void marker4 (d) long d; {} /* set breakpoint 13 here */
+#endif
Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/coremaker.c
Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/coremaker.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/coremaker.c 2014-01-27 22:41:19.284501690 +0100
+++ gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/coremaker.c 2014-06-13 20:05:33.061506820 +0200
@@ -0,0 +1,142 @@
+/* Copyright 1992, 1993, 1994, 1995, 1996, 1999
+ Free Software Foundation, Inc.
@ -432,10 +432,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/coremaker.c
+ return 0;
+}
+
Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/attach.exp
Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/attach.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/attach.exp 2014-01-27 22:41:19.285501691 +0100
+++ gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/attach.exp 2014-06-13 20:05:33.061506820 +0200
@@ -0,0 +1,417 @@
+# Copyright 1997, 1999, 2002 Free Software Foundation, Inc.
+
@ -854,10 +854,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/attach.exp
+do_call_attach_tests
+
+return 0
Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/break.exp
Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/break.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/break.exp 2014-01-27 22:41:19.286501691 +0100
+++ gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/break.exp 2014-06-13 20:05:33.062506821 +0200
@@ -0,0 +1,962 @@
+# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2002, 2003, 2004
@ -1821,10 +1821,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/break.exp
+ send_gdb "set args main\n"
+ gdb_expect -re ".*$gdb_prompt $" {}
+}
Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/corefile.exp
Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/corefile.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/corefile.exp 2014-01-27 22:41:19.286501691 +0100
+++ gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/corefile.exp 2014-06-13 20:05:33.063506822 +0200
@@ -0,0 +1,233 @@
+# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+# Free Software Foundation, Inc.
@ -2059,10 +2059,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/corefile.exp
+gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp (reinit)"
+
+gdb_test "core" "No core file now."
Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/Makefile.in
Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/Makefile.in
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/Makefile.in 2014-01-27 22:41:19.286501691 +0100
+++ gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/Makefile.in 2014-06-13 20:05:33.063506822 +0200
@@ -0,0 +1,19 @@
+VPATH = @srcdir@
+srcdir = @srcdir@

View File

@ -1,11 +1,11 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
Index: gdb-7.6.50.20130731-cvs/gdb/symtab.c
Index: gdb-7.7.90.20140613/gdb/symtab.c
===================================================================
--- gdb-7.6.50.20130731-cvs.orig/gdb/symtab.c 2013-08-02 17:06:19.854663801 +0200
+++ gdb-7.6.50.20130731-cvs/gdb/symtab.c 2013-08-02 17:07:04.317721471 +0200
@@ -2327,6 +2327,13 @@ find_pc_sect_line (CORE_ADDR pc, struct
--- gdb-7.7.90.20140613.orig/gdb/symtab.c 2014-06-13 21:52:06.219338401 +0200
+++ gdb-7.7.90.20140613/gdb/symtab.c 2014-06-13 21:55:02.753531885 +0200
@@ -2394,6 +2394,13 @@ find_pc_sect_line (CORE_ADDR pc, struct
SYMBOL_LINKAGE_NAME (msymbol)); */
;
/* fall through */
@ -13,9 +13,9 @@ Index: gdb-7.6.50.20130731-cvs/gdb/symtab.c
+ but this text symbol may be the address we were looking for.
+ Avoid `find_pc_sect_line'<->`find_pc_line' infinite loop.
+ Red Hat Bug 218379. */
+ else if (SYMBOL_VALUE (mfunsym) == pc)
+ warning ("In stub for %s (0x%s); interlocked, please submit the binary to http://bugzilla.redhat.com", SYMBOL_LINKAGE_NAME (msymbol.minsym), paddress (target_gdbarch (), pc));
+ else if (BMSYMBOL_VALUE_ADDRESS (mfunsym) == pc)
+ warning ("In stub for %s (0x%s); interlocked, please submit the binary to http://bugzilla.redhat.com", MSYMBOL_LINKAGE_NAME (msymbol.minsym), paddress (target_gdbarch (), pc));
+ /* fall through */
else
return find_pc_line (SYMBOL_VALUE_ADDRESS (mfunsym), 0);
return find_pc_line (BMSYMBOL_VALUE_ADDRESS (mfunsym), 0);
}

View File

@ -1,119 +0,0 @@
2007-09-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): New variables
X_SHDR_SHSTRTAB and I_SHDR_SHSTRTAB. Fixed the CONTENTS_SIZE trimming
check for its aligned size between the last segment and still before
the section header end. Added variables check to cover also the
section header string table.
--- gdb-7.4.50.20120120-orig/bfd/elfcode.h 2012-02-29 09:17:08.000000000 +0100
+++ gdb-7.4.50.20120120/bfd/elfcode.h 2012-02-29 10:23:03.000000000 +0100
@@ -1621,6 +1621,8 @@ NAME(_bfd_elf,bfd_from_remote_memory)
Elf_Internal_Ehdr i_ehdr; /* Elf file header, internal form */
Elf_External_Phdr *x_phdrs;
Elf_Internal_Phdr *i_phdrs, *last_phdr;
+ Elf_External_Shdr *x_shdrs;
+ Elf_Internal_Shdr *i_shdrs;
bfd *nbfd;
struct bfd_in_memory *bim;
int contents_size;
@@ -1740,24 +1742,46 @@ NAME(_bfd_elf,bfd_from_remote_memory)
/* Trim the last segment so we don't bother with zeros in the last page
that are off the end of the file. However, if the extra bit in that
- page includes the section headers, keep them. */
- if ((bfd_vma) contents_size > last_phdr->p_offset + last_phdr->p_filesz
- && (bfd_vma) contents_size >= (i_ehdr.e_shoff
- + i_ehdr.e_shnum * i_ehdr.e_shentsize))
+ page includes the section headers os the section header string table,
+ keep them. */
+ if ((bfd_vma) contents_size > last_phdr->p_offset + last_phdr->p_filesz)
+ contents_size = last_phdr->p_offset + last_phdr->p_filesz;
+
+ if ((bfd_vma) contents_size < i_ehdr.e_shoff
+ + i_ehdr.e_shnum * i_ehdr.e_shentsize)
+ contents_size = i_ehdr.e_shoff + i_ehdr.e_shnum * i_ehdr.e_shentsize;
+
+ /* Verify also all the sections fit into CONTENTS_SIZE. */
+
+ x_shdrs = bfd_malloc (i_ehdr.e_shnum * (sizeof *x_shdrs + sizeof *i_shdrs));
+ if (x_shdrs == NULL)
{
- contents_size = last_phdr->p_offset + last_phdr->p_filesz;
- if ((bfd_vma) contents_size < (i_ehdr.e_shoff
- + i_ehdr.e_shnum * i_ehdr.e_shentsize))
- contents_size = i_ehdr.e_shoff + i_ehdr.e_shnum * i_ehdr.e_shentsize;
+ free (x_phdrs);
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
}
+ err = target_read_memory (ehdr_vma + i_ehdr.e_shoff, (bfd_byte *) x_shdrs,
+ i_ehdr.e_shnum * sizeof *x_shdrs);
+ if (err)
+ i_shdrs = NULL;
else
- contents_size = last_phdr->p_offset + last_phdr->p_filesz;
+ {
+ i_shdrs = (Elf_Internal_Shdr *) &x_shdrs[i_ehdr.e_shnum];
+ for (i = 0; i < i_ehdr.e_shnum; ++i)
+ {
+ elf_swap_shdr_in (templ, &x_shdrs[i], &i_shdrs[i]);
+
+ if ((bfd_vma) contents_size < i_shdrs[i].sh_offset + i_shdrs[i].sh_size)
+ contents_size = i_shdrs[i].sh_offset + i_shdrs[i].sh_size;
+ }
+ }
/* Now we know the size of the whole image we want read in. */
contents = (bfd_byte *) bfd_zmalloc (contents_size);
if (contents == NULL)
{
free (x_phdrs);
+ free (x_shdrs);
bfd_set_error (bfd_error_no_memory);
return NULL;
}
@@ -1776,6 +1800,7 @@ NAME(_bfd_elf,bfd_from_remote_memory)
if (err)
{
free (x_phdrs);
+ free (x_shdrs);
free (contents);
bfd_set_error (bfd_error_system_call);
errno = err;
@@ -1784,10 +1809,32 @@ NAME(_bfd_elf,bfd_from_remote_memory)
}
free (x_phdrs);
- /* If the segments visible in memory didn't include the section headers,
+ if (i_shdrs)
+ {
+ memcpy (contents + i_ehdr.e_shoff, x_shdrs,
+ i_ehdr.e_shnum * sizeof *x_shdrs);
+
+ for (i = 0; i < i_ehdr.e_shnum; ++i)
+ {
+ bfd_vma start = i_shdrs[i].sh_offset;
+ bfd_vma end = i_shdrs[i].sh_offset + i_shdrs[i].sh_size;
+
+ if (end > (bfd_vma) contents_size)
+ end = contents_size;
+ err = target_read_memory (ehdr_vma + start, contents + start,
+ end - start);
+ if (err)
+ {
+ i_shdrs = NULL;
+ break;
+ }
+ }
+ }
+ free (x_shdrs);
+
+ /* If the segments readable in memory didn't include the section headers,
then clear them from the file header. */
- if ((bfd_vma) contents_size < (i_ehdr.e_shoff
- + i_ehdr.e_shnum * i_ehdr.e_shentsize))
+ if (i_shdrs == NULL)
{
memset (&x_ehdr.e_shoff, 0, sizeof x_ehdr.e_shoff);
memset (&x_ehdr.e_shnum, 0, sizeof x_ehdr.e_shnum);

View File

@ -58,13 +58,13 @@ Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html
* exec.c (exec_file_attach): Print a more useful error message if the
user did "gdb core".
Index: gdb-7.6.90.20140127/gdb/exceptions.h
Index: gdb-7.7.50.20140609/gdb/exceptions.h
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/exceptions.h 2014-02-06 17:31:00.148529736 +0100
+++ gdb-7.6.90.20140127/gdb/exceptions.h 2014-02-06 17:31:17.560548525 +0100
@@ -97,6 +97,9 @@ enum errors {
/* An undefined command was executed. */
UNDEFINED_COMMAND_ERROR,
--- gdb-7.7.50.20140609.orig/gdb/exceptions.h 2014-06-13 20:26:46.988804553 +0200
+++ gdb-7.7.50.20140609/gdb/exceptions.h 2014-06-13 20:27:01.930820057 +0200
@@ -100,6 +100,9 @@ enum errors {
/* Requested feature, method, mechanism, etc. is not supported. */
NOT_SUPPORTED_ERROR,
+ /* Attempt to load a core file as executable. */
+ IS_CORE_ERROR,
@ -72,19 +72,19 @@ Index: gdb-7.6.90.20140127/gdb/exceptions.h
/* Add more errors here. */
NR_ERRORS
};
Index: gdb-7.6.90.20140127/gdb/exec.c
Index: gdb-7.7.50.20140609/gdb/exec.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/exec.c 2014-02-06 17:30:58.266527708 +0100
+++ gdb-7.6.90.20140127/gdb/exec.c 2014-02-06 17:31:00.149529737 +0100
@@ -34,6 +34,7 @@
#include "gdbthread.h"
--- gdb-7.7.50.20140609.orig/gdb/exec.c 2014-06-13 20:26:44.831802315 +0200
+++ gdb-7.7.50.20140609/gdb/exec.c 2014-06-13 20:27:17.282836454 +0200
@@ -35,6 +35,7 @@
#include "progspace.h"
#include "gdb_bfd.h"
#include "gcore.h"
+#include "exceptions.h"
#include <fcntl.h>
#include "readline/readline.h"
@@ -228,12 +229,27 @@ exec_file_attach (char *filename, int fr
@@ -231,12 +232,27 @@ exec_file_attach (char *filename, int fr
if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching))
{
@ -115,11 +115,11 @@ Index: gdb-7.6.90.20140127/gdb/exec.c
}
if (build_section_table (exec_bfd, &sections, &sections_end))
Index: gdb-7.6.90.20140127/gdb/main.c
Index: gdb-7.7.50.20140609/gdb/main.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/main.c 2014-02-06 17:30:58.267527709 +0100
+++ gdb-7.6.90.20140127/gdb/main.c 2014-02-06 17:32:32.232629052 +0100
@@ -307,6 +307,36 @@ typedef struct cmdarg {
--- gdb-7.7.50.20140609.orig/gdb/main.c 2014-06-13 20:26:44.831802315 +0200
+++ gdb-7.7.50.20140609/gdb/main.c 2014-06-13 20:26:46.990804555 +0200
@@ -341,6 +341,36 @@ typedef struct cmdarg {
/* Define type VEC (cmdarg_s). */
DEF_VEC_O (cmdarg_s);
@ -156,7 +156,7 @@ Index: gdb-7.6.90.20140127/gdb/main.c
static int
captured_main (void *data)
{
@@ -824,6 +854,8 @@ captured_main (void *data)
@@ -854,6 +884,8 @@ captured_main (void *data)
{
symarg = argv[optind];
execarg = argv[optind];
@ -165,7 +165,7 @@ Index: gdb-7.6.90.20140127/gdb/main.c
optind++;
}
@@ -987,11 +1019,25 @@ captured_main (void *data)
@@ -1017,11 +1049,25 @@ captured_main (void *data)
&& symarg != NULL
&& strcmp (execarg, symarg) == 0)
{

View File

@ -1,8 +1,8 @@
Index: gdb-7.6.90.20140127/gdb/event-top.c
Index: gdb-7.7.50.20140609/gdb/event-top.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/event-top.c 2014-02-06 17:18:26.965717210 +0100
+++ gdb-7.6.90.20140127/gdb/event-top.c 2014-02-06 16:59:23.174474404 +0100
@@ -37,6 +37,7 @@
--- gdb-7.7.50.20140609.orig/gdb/event-top.c 2014-06-13 20:10:19.632787642 +0200
+++ gdb-7.7.50.20140609/gdb/event-top.c 2014-06-13 20:11:49.605878557 +0200
@@ -38,6 +38,7 @@
#include "gdbcmd.h" /* for dont_repeat() */
#include "annotate.h"
#include "maint.h"
@ -10,7 +10,7 @@ Index: gdb-7.6.90.20140127/gdb/event-top.c
/* readline include files. */
#include "readline/readline.h"
@@ -173,6 +174,8 @@ rl_callback_read_char_wrapper (gdb_clien
@@ -176,6 +177,8 @@ rl_callback_read_char_wrapper (gdb_clien
void
cli_command_loop (void *data)
{
@ -19,20 +19,20 @@ Index: gdb-7.6.90.20140127/gdb/event-top.c
display_gdb_prompt (0);
/* Now it's time to start the event loop. */
@@ -240,6 +243,8 @@ display_gdb_prompt (char *new_prompt)
@@ -243,6 +246,8 @@ display_gdb_prompt (char *new_prompt)
/* Reset the nesting depth used when trace-commands is set. */
reset_command_nest_depth ();
+ debug_flush_missing ();
+
/* Each interpreter has its own rules on displaying the command
prompt. */
if (!current_interp_display_prompt_p ())
Index: gdb-7.6.90.20140127/gdb/symfile.h
old_chain = make_cleanup (free_current_contents, &actual_gdb_prompt);
/* Do not call the python hook on an explicit prompt change as
Index: gdb-7.7.50.20140609/gdb/symfile.h
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/symfile.h 2014-02-06 17:18:33.865724666 +0100
+++ gdb-7.6.90.20140127/gdb/symfile.h 2014-02-06 17:08:56.282099150 +0100
@@ -557,6 +557,8 @@ extern struct cleanup *increment_reading
--- gdb-7.7.50.20140609.orig/gdb/symfile.h 2014-06-13 20:10:19.633787643 +0200
+++ gdb-7.7.50.20140609/gdb/symfile.h 2014-06-13 20:10:31.066799158 +0200
@@ -573,6 +573,8 @@ void map_symbol_filenames (symbol_filena
/* build-id support. */
extern struct elf_build_id *build_id_addr_get (CORE_ADDR addr);
extern void debug_print_missing (const char *binary, const char *debug);
@ -41,11 +41,11 @@ Index: gdb-7.6.90.20140127/gdb/symfile.h
/* From dwarf2read.c */
Index: gdb-7.6.90.20140127/gdb/testsuite/lib/gdb.exp
Index: gdb-7.7.50.20140609/gdb/testsuite/lib/gdb.exp
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/testsuite/lib/gdb.exp 2014-02-06 17:18:26.969717214 +0100
+++ gdb-7.6.90.20140127/gdb/testsuite/lib/gdb.exp 2014-02-06 17:18:33.866724667 +0100
@@ -1504,7 +1504,7 @@ proc default_gdb_start { } {
--- gdb-7.7.50.20140609.orig/gdb/testsuite/lib/gdb.exp 2014-06-13 20:10:19.634787644 +0200
+++ gdb-7.7.50.20140609/gdb/testsuite/lib/gdb.exp 2014-06-13 20:10:31.067799159 +0200
@@ -1492,7 +1492,7 @@ proc default_gdb_start { } {
warning "Couldn't set the width to 0."
}
}
@ -54,10 +54,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/lib/gdb.exp
send_gdb "set build-id-verbose 0\n"
gdb_expect 10 {
-re "$gdb_prompt $" {
Index: gdb-7.6.90.20140127/gdb/testsuite/lib/mi-support.exp
Index: gdb-7.7.50.20140609/gdb/testsuite/lib/mi-support.exp
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/testsuite/lib/mi-support.exp 2014-02-06 17:18:26.970717215 +0100
+++ gdb-7.6.90.20140127/gdb/testsuite/lib/mi-support.exp 2014-02-06 17:18:33.867724668 +0100
--- gdb-7.7.50.20140609.orig/gdb/testsuite/lib/mi-support.exp 2014-06-13 20:10:19.635787645 +0200
+++ gdb-7.7.50.20140609/gdb/testsuite/lib/mi-support.exp 2014-06-13 20:10:31.068799160 +0200
@@ -212,7 +212,7 @@ proc default_mi_gdb_start { args } {
warning "Couldn't set the width to 0."
}
@ -67,22 +67,22 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/lib/mi-support.exp
send_gdb "190-gdb-set build-id-verbose 0\n"
gdb_expect 10 {
-re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" {
Index: gdb-7.6.90.20140127/gdb/tui/tui-interp.c
Index: gdb-7.7.50.20140609/gdb/tui/tui-interp.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/tui/tui-interp.c 2014-02-06 17:18:26.970717215 +0100
+++ gdb-7.6.90.20140127/gdb/tui/tui-interp.c 2014-02-06 17:18:33.867724668 +0100
@@ -30,6 +30,7 @@
#include "tui/tui.h"
#include "tui/tui-io.h"
--- gdb-7.7.50.20140609.orig/gdb/tui/tui-interp.c 2014-06-13 20:10:31.068799160 +0200
+++ gdb-7.7.50.20140609/gdb/tui/tui-interp.c 2014-06-13 20:10:47.806816542 +0200
@@ -32,6 +32,7 @@
#include "exceptions.h"
#include "infrun.h"
#include "observer.h"
+#include "symfile.h"
/* Set to 1 when the TUI mode must be activated when we first start
gdb. */
Index: gdb-7.6.90.20140127/gdb/aclocal.m4
static struct ui_out *tui_ui_out (struct interp *self);
Index: gdb-7.7.50.20140609/gdb/aclocal.m4
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/aclocal.m4 2014-02-06 17:18:33.868724669 +0100
+++ gdb-7.6.90.20140127/gdb/aclocal.m4 2014-02-06 17:09:49.877157405 +0100
--- gdb-7.7.50.20140609.orig/gdb/aclocal.m4 2014-06-13 20:10:19.636787646 +0200
+++ gdb-7.7.50.20140609/gdb/aclocal.m4 2014-06-13 20:10:31.069799161 +0200
@@ -11,6 +11,221 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@ -305,10 +305,10 @@ Index: gdb-7.6.90.20140127/gdb/aclocal.m4
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
Index: gdb-7.6.90.20140127/gdb/config.in
Index: gdb-7.7.50.20140609/gdb/config.in
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/config.in 2014-02-06 17:18:26.971717216 +0100
+++ gdb-7.6.90.20140127/gdb/config.in 2014-02-06 17:18:33.868724669 +0100
--- gdb-7.7.50.20140609.orig/gdb/config.in 2014-06-13 20:10:19.637787647 +0200
+++ gdb-7.7.50.20140609/gdb/config.in 2014-06-13 20:10:31.069799161 +0200
@@ -33,6 +33,9 @@
/* Define to BFD's default target vector. */
#undef DEFAULT_BFD_VEC
@ -319,7 +319,7 @@ Index: gdb-7.6.90.20140127/gdb/config.in
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
@@ -207,6 +210,9 @@
@@ -210,6 +213,9 @@
/* Define if Python 2.7 is being used. */
#undef HAVE_LIBPYTHON2_7
@ -329,11 +329,11 @@ Index: gdb-7.6.90.20140127/gdb/config.in
/* Define to 1 if you have the <libunwind-ia64.h> header file. */
#undef HAVE_LIBUNWIND_IA64_H
Index: gdb-7.6.90.20140127/gdb/configure
Index: gdb-7.7.50.20140609/gdb/configure
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/configure 2014-02-06 17:18:26.976717221 +0100
+++ gdb-7.6.90.20140127/gdb/configure 2014-02-06 17:18:33.872724673 +0100
@@ -689,6 +689,11 @@ PKGVERSION
--- gdb-7.7.50.20140609.orig/gdb/configure 2014-06-13 20:10:19.642787652 +0200
+++ gdb-7.7.50.20140609/gdb/configure 2014-06-13 20:10:31.073799165 +0200
@@ -692,6 +692,11 @@ PKGVERSION
HAVE_NATIVE_GCORE_TARGET
TARGET_OBS
subdirs
@ -345,7 +345,7 @@ Index: gdb-7.6.90.20140127/gdb/configure
GDB_DATADIR
DEBUGDIR
MAKEINFO_EXTRA_FLAGS
@@ -792,6 +797,7 @@ with_gdb_datadir
@@ -795,6 +800,7 @@ with_gdb_datadir
with_relocated_sources
with_auto_load_dir
with_auto_load_safe_path
@ -353,7 +353,7 @@ Index: gdb-7.6.90.20140127/gdb/configure
enable_targets
enable_64_bit_bfd
enable_gdbcli
@@ -842,6 +848,11 @@ CPPFLAGS
@@ -846,6 +852,11 @@ CPPFLAGS
CPP
MAKEINFO
MAKEINFOFLAGS
@ -365,7 +365,7 @@ Index: gdb-7.6.90.20140127/gdb/configure
YACC
YFLAGS
XMKMF'
@@ -1512,6 +1523,8 @@ Optional Packages:
@@ -1516,6 +1527,8 @@ Optional Packages:
[--with-auto-load-dir]
--without-auto-load-safe-path
do not restrict auto-loaded files locations
@ -374,7 +374,7 @@ Index: gdb-7.6.90.20140127/gdb/configure
--with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
--with-curses use the curses library instead of the termcap
library
@@ -1559,6 +1572,13 @@ Some influential environment variables:
@@ -1565,6 +1578,13 @@ Some influential environment variables:
MAKEINFO Parent configure detects if it is of sufficient version.
MAKEINFOFLAGS
Parameters for MAKEINFO.
@ -388,7 +388,7 @@ Index: gdb-7.6.90.20140127/gdb/configure
YACC The `Yet Another C Compiler' implementation to use. Defaults to
the first program found out of: `bison -y', `byacc', `yacc'.
YFLAGS The list of arguments that will be passed by default to $YACC.
@@ -5154,6 +5174,491 @@ _ACEOF
@@ -5160,6 +5180,491 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
$as_echo "$with_auto_load_safe_path" >&6; }
@ -880,10 +880,10 @@ Index: gdb-7.6.90.20140127/gdb/configure
subdirs="$subdirs testsuite"
Index: gdb-7.6.90.20140127/gdb/configure.ac
Index: gdb-7.7.50.20140609/gdb/configure.ac
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/configure.ac 2014-02-06 17:18:26.977717223 +0100
+++ gdb-7.6.90.20140127/gdb/configure.ac 2014-02-06 17:18:33.873724674 +0100
--- gdb-7.7.50.20140609.orig/gdb/configure.ac 2014-06-13 20:10:19.643787653 +0200
+++ gdb-7.7.50.20140609/gdb/configure.ac 2014-06-13 20:10:31.074799166 +0200
@@ -165,6 +165,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escap
[Directories safe to hold auto-loaded files.])
AC_MSG_RESULT([$with_auto_load_safe_path])
@ -1084,11 +1084,11 @@ Index: gdb-7.6.90.20140127/gdb/configure.ac
AC_CONFIG_SUBDIRS(testsuite)
# Check whether to support alternative target configurations
Index: gdb-7.6.90.20140127/gdb/corelow.c
Index: gdb-7.7.50.20140609/gdb/corelow.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/corelow.c 2014-02-06 17:18:26.978717224 +0100
+++ gdb-7.6.90.20140127/gdb/corelow.c 2014-02-06 17:18:33.873724674 +0100
@@ -315,7 +315,7 @@ build_id_locate_exec (int from_tty)
--- gdb-7.7.50.20140609.orig/gdb/corelow.c 2014-06-13 20:10:19.644787654 +0200
+++ gdb-7.7.50.20140609/gdb/corelow.c 2014-06-13 20:10:31.074799166 +0200
@@ -316,7 +316,7 @@ build_id_locate_exec (int from_tty)
symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
}
else
@ -1097,10 +1097,10 @@ Index: gdb-7.6.90.20140127/gdb/corelow.c
do_cleanups (back_to);
Index: gdb-7.6.90.20140127/gdb/build-id.c
Index: gdb-7.7.50.20140609/gdb/build-id.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/build-id.c 2014-02-06 17:18:26.842717077 +0100
+++ gdb-7.6.90.20140127/gdb/build-id.c 2014-02-06 17:08:18.341060295 +0100
--- gdb-7.7.50.20140609.orig/gdb/build-id.c 2014-06-13 20:10:19.644787654 +0200
+++ gdb-7.7.50.20140609/gdb/build-id.c 2014-06-13 20:10:31.075799167 +0200
@@ -32,6 +32,7 @@
#include "gdbcmd.h"
#include "observer.h"

View File

@ -1,8 +1,8 @@
Index: gdb-7.6.90.20140127/gdb/corelow.c
Index: gdb-7.7.50.20140609/gdb/corelow.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/corelow.c 2014-01-27 02:57:53.000000000 +0100
+++ gdb-7.6.90.20140127/gdb/corelow.c 2014-02-06 16:46:52.261646499 +0100
@@ -48,6 +48,10 @@
--- gdb-7.7.50.20140609.orig/gdb/corelow.c 2014-06-13 20:09:37.369745221 +0200
+++ gdb-7.7.50.20140609/gdb/corelow.c 2014-06-13 20:09:42.407750265 +0200
@@ -49,6 +49,10 @@
#include "gdb_bfd.h"
#include "completer.h"
#include "filestuff.h"
@ -13,7 +13,7 @@ Index: gdb-7.6.90.20140127/gdb/corelow.c
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
@@ -271,6 +275,53 @@ add_to_thread_list (bfd *abfd, asection
@@ -272,6 +276,53 @@ add_to_thread_list (bfd *abfd, asection
inferior_ptid = ptid; /* Yes, make it current. */
}
@ -67,7 +67,7 @@ Index: gdb-7.6.90.20140127/gdb/corelow.c
/* This routine opens and sets up the core file bfd. */
static void
@@ -409,6 +460,14 @@ core_open (char *filename, int from_tty)
@@ -410,6 +461,14 @@ core_open (char *filename, int from_tty)
switch_to_thread (thread->ptid);
}
@ -82,7 +82,7 @@ Index: gdb-7.6.90.20140127/gdb/corelow.c
post_create_inferior (&core_ops, from_tty);
/* Now go through the target stack looking for threads since there
@@ -980,4 +1039,11 @@ _initialize_corelow (void)
@@ -1029,4 +1088,11 @@ _initialize_corelow (void)
init_core_ops ();
add_target_with_completer (&core_ops, filename_completer);
@ -94,11 +94,11 @@ Index: gdb-7.6.90.20140127/gdb/corelow.c
+ NULL, NULL, NULL,
+ &setlist, &showlist);
}
Index: gdb-7.6.90.20140127/gdb/doc/gdb.texinfo
Index: gdb-7.7.50.20140609/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/doc/gdb.texinfo 2014-02-06 16:46:51.804645989 +0100
+++ gdb-7.6.90.20140127/gdb/doc/gdb.texinfo 2014-02-06 16:46:52.110646331 +0100
@@ -17413,6 +17413,27 @@ information files.
--- gdb-7.7.50.20140609.orig/gdb/doc/gdb.texinfo 2014-06-13 20:09:37.380745232 +0200
+++ gdb-7.7.50.20140609/gdb/doc/gdb.texinfo 2014-06-13 20:09:42.417750275 +0200
@@ -17547,6 +17547,27 @@ information files.
@end table
@ -126,11 +126,11 @@ Index: gdb-7.6.90.20140127/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
Index: gdb-7.6.90.20140127/gdb/solib-svr4.c
Index: gdb-7.7.50.20140609/gdb/solib-svr4.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/solib-svr4.c 2014-01-27 02:57:53.000000000 +0100
+++ gdb-7.6.90.20140127/gdb/solib-svr4.c 2014-02-06 16:49:27.508819174 +0100
@@ -47,6 +47,7 @@
--- gdb-7.7.50.20140609.orig/gdb/solib-svr4.c 2014-06-13 20:09:37.382745234 +0200
+++ gdb-7.7.50.20140609/gdb/solib-svr4.c 2014-06-13 20:09:42.418750276 +0200
@@ -48,6 +48,7 @@
#include "exceptions.h"
#include "gdb_bfd.h"
#include "probe.h"
@ -194,11 +194,11 @@ Index: gdb-7.6.90.20140127/gdb/solib-svr4.c
xfree (buffer);
/* If this entry has no name, or its name matches the name
Index: gdb-7.6.90.20140127/gdb/elfread.c
Index: gdb-7.7.50.20140609/gdb/elfread.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/elfread.c 2014-01-27 02:57:53.000000000 +0100
+++ gdb-7.6.90.20140127/gdb/elfread.c 2014-02-06 16:46:52.249646486 +0100
@@ -1316,9 +1316,10 @@ elf_symfile_read (struct objfile *objfil
--- gdb-7.7.50.20140609.orig/gdb/elfread.c 2014-06-13 20:09:37.383745235 +0200
+++ gdb-7.7.50.20140609/gdb/elfread.c 2014-06-13 20:09:42.418750276 +0200
@@ -1335,9 +1335,10 @@ elf_symfile_read (struct objfile *objfil
&& objfile->separate_debug_objfile == NULL
&& objfile->separate_debug_objfile_backlink == NULL)
{
@ -211,7 +211,7 @@ Index: gdb-7.6.90.20140127/gdb/elfread.c
if (debugfile == NULL)
debugfile = find_separate_debug_file_by_debuglink (objfile);
@@ -1332,6 +1333,12 @@ elf_symfile_read (struct objfile *objfil
@@ -1351,6 +1352,12 @@ elf_symfile_read (struct objfile *objfil
symbol_file_add_separate (abfd, debugfile, symfile_flags, objfile);
do_cleanups (cleanup);
}
@ -224,13 +224,13 @@ Index: gdb-7.6.90.20140127/gdb/elfread.c
}
}
Index: gdb-7.6.90.20140127/gdb/symfile.h
Index: gdb-7.7.50.20140609/gdb/symfile.h
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/symfile.h 2014-01-27 02:57:53.000000000 +0100
+++ gdb-7.6.90.20140127/gdb/symfile.h 2014-02-06 16:46:52.250646487 +0100
@@ -554,6 +554,10 @@ void free_symfile_segment_data (struct s
extern struct cleanup *increment_reading_symtab (void);
--- gdb-7.7.50.20140609.orig/gdb/symfile.h 2014-06-13 20:09:42.419750277 +0200
+++ gdb-7.7.50.20140609/gdb/symfile.h 2014-06-13 20:10:04.478772510 +0200
@@ -570,6 +570,10 @@ void expand_symtabs_matching (expand_sym
void map_symbol_filenames (symbol_filename_ftype *fun, void *data,
int need_fullname);
+/* build-id support. */
+extern struct elf_build_id *build_id_addr_get (CORE_ADDR addr);
@ -239,11 +239,11 @@ Index: gdb-7.6.90.20140127/gdb/symfile.h
/* From dwarf2read.c */
/* Names for a dwarf2 debugging section. The field NORMAL is the normal
Index: gdb-7.6.90.20140127/gdb/testsuite/lib/gdb.exp
Index: gdb-7.7.50.20140609/gdb/testsuite/lib/gdb.exp
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/testsuite/lib/gdb.exp 2014-02-06 16:46:51.643645810 +0100
+++ gdb-7.6.90.20140127/gdb/testsuite/lib/gdb.exp 2014-02-06 16:46:52.251646488 +0100
@@ -1504,6 +1504,16 @@ proc default_gdb_start { } {
--- gdb-7.7.50.20140609.orig/gdb/testsuite/lib/gdb.exp 2014-06-13 20:09:37.384745236 +0200
+++ gdb-7.7.50.20140609/gdb/testsuite/lib/gdb.exp 2014-06-13 20:09:42.420750278 +0200
@@ -1492,6 +1492,16 @@ proc default_gdb_start { } {
warning "Couldn't set the width to 0."
}
}
@ -260,10 +260,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/lib/gdb.exp
return 0
}
Index: gdb-7.6.90.20140127/gdb/testsuite/lib/mi-support.exp
Index: gdb-7.7.50.20140609/gdb/testsuite/lib/mi-support.exp
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/testsuite/lib/mi-support.exp 2014-01-27 02:57:54.000000000 +0100
+++ gdb-7.6.90.20140127/gdb/testsuite/lib/mi-support.exp 2014-02-06 16:46:52.252646489 +0100
--- gdb-7.7.50.20140609.orig/gdb/testsuite/lib/mi-support.exp 2014-06-13 20:09:37.385745237 +0200
+++ gdb-7.7.50.20140609/gdb/testsuite/lib/mi-support.exp 2014-06-13 20:09:42.421750279 +0200
@@ -212,6 +212,16 @@ proc default_mi_gdb_start { args } {
warning "Couldn't set the width to 0."
}
@ -281,11 +281,11 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/lib/mi-support.exp
# If allowing the inferior to have its own PTY then assign the inferior
# its own terminal device here.
if { $separate_inferior_pty } {
Index: gdb-7.6.90.20140127/gdb/objfiles.h
Index: gdb-7.7.50.20140609/gdb/objfiles.h
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/objfiles.h 2014-01-27 02:57:53.000000000 +0100
+++ gdb-7.6.90.20140127/gdb/objfiles.h 2014-02-06 16:46:52.113646334 +0100
@@ -436,6 +436,10 @@ struct objfile
--- gdb-7.7.50.20140609.orig/gdb/objfiles.h 2014-06-13 20:09:37.385745237 +0200
+++ gdb-7.7.50.20140609/gdb/objfiles.h 2014-06-13 20:09:42.421750279 +0200
@@ -464,6 +464,10 @@ struct objfile
#define OBJF_NOT_FILENAME (1 << 6)
@ -296,11 +296,11 @@ Index: gdb-7.6.90.20140127/gdb/objfiles.h
/* Declarations for functions defined in objfiles.c */
extern struct objfile *allocate_objfile (bfd *, const char *name, int);
Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.base/corefile.exp
Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.base/corefile.exp
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/testsuite/gdb.base/corefile.exp 2014-01-27 02:57:54.000000000 +0100
+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.base/corefile.exp 2014-02-06 16:46:52.113646334 +0100
@@ -281,3 +281,33 @@ gdb_test_multiple "core-file $corefile"
--- gdb-7.7.50.20140609.orig/gdb/testsuite/gdb.base/corefile.exp 2014-06-13 20:09:37.385745237 +0200
+++ gdb-7.7.50.20140609/gdb/testsuite/gdb.base/corefile.exp 2014-06-13 20:09:42.421750279 +0200
@@ -293,3 +293,33 @@ gdb_test_multiple "core-file $corefile"
pass $test
}
}
@ -334,10 +334,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.base/corefile.exp
+ gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*"
+ pass $wholetest
+}
Index: gdb-7.6.90.20140127/gdb/build-id.c
Index: gdb-7.7.50.20140609/gdb/build-id.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/build-id.c 2014-01-27 02:57:53.000000000 +0100
+++ gdb-7.6.90.20140127/gdb/build-id.c 2014-02-06 16:46:52.113646334 +0100
--- gdb-7.7.50.20140609.orig/gdb/build-id.c 2014-06-13 20:09:37.386745238 +0200
+++ gdb-7.7.50.20140609/gdb/build-id.c 2014-06-13 20:09:42.422750280 +0200
@@ -27,11 +27,65 @@
#include "symfile.h"
#include "objfiles.h"
@ -1160,10 +1160,10 @@ Index: gdb-7.6.90.20140127/gdb/build-id.c
+
+ observer_attach_executable_changed (debug_print_executable_changed);
+}
Index: gdb-7.6.90.20140127/gdb/build-id.h
Index: gdb-7.7.50.20140609/gdb/build-id.h
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/build-id.h 2014-01-27 02:57:53.000000000 +0100
+++ gdb-7.6.90.20140127/gdb/build-id.h 2014-02-06 16:46:52.114646335 +0100
--- gdb-7.7.50.20140609.orig/gdb/build-id.h 2014-06-13 20:09:37.386745238 +0200
+++ gdb-7.7.50.20140609/gdb/build-id.h 2014-06-13 20:09:42.422750280 +0200
@@ -32,13 +32,18 @@ extern int build_id_verify (bfd *abfd,
the caller. */
@ -1185,11 +1185,11 @@ Index: gdb-7.6.90.20140127/gdb/build-id.h
+ char **build_id_filename_return);
#endif /* BUILD_ID_H */
Index: gdb-7.6.90.20140127/gdb/dwarf2read.c
Index: gdb-7.7.50.20140609/gdb/dwarf2read.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/dwarf2read.c 2014-02-06 16:46:51.809645995 +0100
+++ gdb-7.6.90.20140127/gdb/dwarf2read.c 2014-02-06 16:49:55.679850414 +0100
@@ -2429,7 +2429,7 @@ dwarf2_get_dwz_file (void)
--- gdb-7.7.50.20140609.orig/gdb/dwarf2read.c 2014-06-13 20:09:37.389745241 +0200
+++ gdb-7.7.50.20140609/gdb/dwarf2read.c 2014-06-13 20:09:42.425750283 +0200
@@ -2446,7 +2446,7 @@ dwarf2_get_dwz_file (void)
}
if (dwz_bfd == NULL)

View File

@ -1,8 +1,8 @@
Index: gdb-7.6.90.20140127/gdb/infrun.c
Index: gdb-7.7.50.20140609/gdb/infrun.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/infrun.c 2014-02-04 23:48:27.262092869 +0100
+++ gdb-7.6.90.20140127/gdb/infrun.c 2014-02-04 23:48:31.674096613 +0100
@@ -1618,7 +1618,7 @@ static const char *const scheduler_enums
--- gdb-7.7.50.20140609.orig/gdb/infrun.c 2014-06-13 20:08:51.225699203 +0200
+++ gdb-7.7.50.20140609/gdb/infrun.c 2014-06-13 20:08:55.515703466 +0200
@@ -1661,7 +1661,7 @@ static const char *const scheduler_enums
schedlock_step,
NULL
};
@ -11,11 +11,11 @@ Index: gdb-7.6.90.20140127/gdb/infrun.c
static void
show_scheduler_mode (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.mi/mi-cli.exp
Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.mi/mi-cli.exp
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/testsuite/gdb.mi/mi-cli.exp 2014-02-04 23:48:27.263092871 +0100
+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.mi/mi-cli.exp 2014-02-04 23:48:31.674096613 +0100
@@ -163,7 +163,7 @@ mi_execute_to "exec-continue" "breakpoin
--- gdb-7.7.50.20140609.orig/gdb/testsuite/gdb.mi/mi-cli.exp 2014-06-13 20:08:55.515703466 +0200
+++ gdb-7.7.50.20140609/gdb/testsuite/gdb.mi/mi-cli.exp 2014-06-13 20:09:24.862732832 +0200
@@ -181,7 +181,7 @@ mi_expect_stop "breakpoint-hit" "main" "
# Test that the token is output even for CLI commands
# Also test that *stopped includes frame information.
mi_gdb_test "34 next" \
@ -23,11 +23,11 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.mi/mi-cli.exp
+ ".*34\\\^running.*\\*running,thread-id=\"1\"" \
"34 next: run"
if {!$async} {
Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.mi/mi-logging.exp
# Test that the new current source line is output to the console
Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.mi/mi-logging.exp
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/testsuite/gdb.mi/mi-logging.exp 2014-02-04 23:48:27.263092871 +0100
+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.mi/mi-logging.exp 2014-02-04 23:48:31.674096613 +0100
--- gdb-7.7.50.20140609.orig/gdb/testsuite/gdb.mi/mi-logging.exp 2014-06-13 20:08:51.227699205 +0200
+++ gdb-7.7.50.20140609/gdb/testsuite/gdb.mi/mi-logging.exp 2014-06-13 20:08:55.516703467 +0200
@@ -53,7 +53,7 @@ close $chan
set mi_log_prompt "\[(\]gdb\[)\] \[\r\n\]+"
@ -46,10 +46,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.mi/mi-logging.exp
pass "Redirect log file contents"
} else {
fail "Redirect log file contents"
Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.mi/mi-console.exp
Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.mi/mi-console.exp
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/testsuite/gdb.mi/mi-console.exp 2014-02-04 23:48:31.675096666 +0100
+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.mi/mi-console.exp 2014-02-04 23:48:55.981127963 +0100
--- gdb-7.7.50.20140609.orig/gdb/testsuite/gdb.mi/mi-console.exp 2014-06-13 20:08:51.227699205 +0200
+++ gdb-7.7.50.20140609/gdb/testsuite/gdb.mi/mi-console.exp 2014-06-13 20:08:55.516703467 +0200
@@ -60,6 +60,9 @@ if { [gdb_compile "${srcdir}/${subdir}/
mi_run_to_main

View File

@ -21,41 +21,20 @@
Port to GDB-6.8pre.
Index: gdb-7.6.90.20140127/gdb/inferior.h
Index: gdb-7.7.90.20140613/gdb/infrun.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/inferior.h 2014-01-27 22:05:28.801895347 +0100
+++ gdb-7.6.90.20140127/gdb/inferior.h 2014-01-27 22:33:45.230157813 +0100
@@ -155,7 +155,15 @@ extern void reopen_exec_file (void);
/* The `resume' routine should only be called in special circumstances.
Normally, use `proceed', which handles a lot of bookkeeping. */
-extern void resume (int, enum gdb_signal);
+enum resume_step
+ {
+ /* currently_stepping () should return non-zero for non-continue. */
+ RESUME_STEP_CONTINUE = 0,
+ RESUME_STEP_USER, /* Stepping is intentional by the user. */
+ RESUME_STEP_NEEDED /* Stepping only for software watchpoints. */
+ };
+
+extern void resume (enum resume_step, enum gdb_signal);
extern ptid_t user_visible_resume_ptid (int step);
Index: gdb-7.6.90.20140127/gdb/infrun.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/infrun.c 2014-01-27 22:05:28.804895349 +0100
+++ gdb-7.6.90.20140127/gdb/infrun.c 2014-01-27 22:35:12.781224279 +0100
@@ -83,7 +83,7 @@ static int follow_fork (void);
--- gdb-7.7.90.20140613.orig/gdb/infrun.c 2014-06-13 03:59:36.000000000 +0200
+++ gdb-7.7.90.20140613/gdb/infrun.c 2014-06-13 21:36:43.637294782 +0200
@@ -84,7 +84,7 @@ static int follow_fork (void);
static void set_schedlock_func (char *args, int from_tty,
struct cmd_list_element *c);
-static int currently_stepping (struct thread_info *tp);
+static enum resume_step currently_stepping (struct thread_info *tp);
static int currently_stepping_or_nexting_callback (struct thread_info *tp,
void *data);
@@ -1699,7 +1699,8 @@ user_visible_resume_ptid (int step)
static void xdb_handle_command (char *args, int from_tty);
@@ -1742,7 +1742,8 @@ user_visible_resume_ptid (int step)
}
else if ((scheduler_mode == schedlock_on)
|| (scheduler_mode == schedlock_step
@ -65,16 +44,16 @@ Index: gdb-7.6.90.20140127/gdb/infrun.c
{
/* User-settable 'scheduler' mode requires solo thread resume. */
resume_ptid = inferior_ptid;
@@ -1717,7 +1718,7 @@ user_visible_resume_ptid (int step)
@@ -1760,7 +1761,7 @@ user_visible_resume_ptid (int step)
STEP nonzero if we should step (zero to continue instead).
SIG is the signal to give the inferior (zero for none). */
void
-resume (int step, enum gdb_signal sig)
+resume (enum resume_step step, enum gdb_signal sig)
{
int should_resume = 1;
struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
@@ -1750,9 +1751,13 @@ resume (int step, enum gdb_signal sig)
struct regcache *regcache = get_current_regcache ();
@@ -1800,9 +1801,13 @@ resume (int step, enum gdb_signal sig)
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
@ -90,64 +69,59 @@ Index: gdb-7.6.90.20140127/gdb/infrun.c
tp->control.trap_expected,
target_pid_to_str (inferior_ptid),
paddress (gdbarch, pc));
@@ -2147,7 +2152,7 @@ proceed (CORE_ADDR addr, enum gdb_signal
@@ -2188,6 +2193,7 @@ proceed (CORE_ADDR addr, enum gdb_signal
struct thread_info *tp;
CORE_ADDR pc;
struct address_space *aspace;
/* GDB may force the inferior to step due to various reasons. */
- int force_step = 0;
+ enum resume_step resume_step = RESUME_STEP_CONTINUE;
/* If we're stopped at a fork/vfork, follow the branch set by the
"set follow-fork-mode" command; otherwise, we'll just proceed
@@ -2187,13 +2192,13 @@ proceed (CORE_ADDR addr, enum gdb_signal
@@ -2230,13 +2236,19 @@ proceed (CORE_ADDR addr, enum gdb_signal
Note, we don't do this in reverse, because we won't
actually be executing the breakpoint insn anyway.
We'll be (un-)executing the previous instruction. */
- force_step = 1;
+ {
tp->stepping_over_breakpoint = 1;
+ resume_step = RESUME_STEP_USER;
+ }
else if (gdbarch_single_step_through_delay_p (gdbarch)
&& gdbarch_single_step_through_delay (gdbarch,
get_current_frame ()))
/* We stepped onto an instruction that needs to be stepped
again before re-inserting the breakpoint, do so. */
- force_step = 1;
+ {
tp->stepping_over_breakpoint = 1;
+ resume_step = RESUME_STEP_USER;
+ }
}
else
{
@@ -2225,13 +2230,13 @@ proceed (CORE_ADDR addr, enum gdb_signal
is required it returns TRUE and sets the current thread to
the old thread. */
if (prepare_to_proceed (step))
- force_step = 1;
@@ -2288,6 +2300,7 @@ proceed (CORE_ADDR addr, enum gdb_signal
tp->prev_pc = regcache_read_pc (get_current_regcache ());
switch_to_thread (step_over->ptid);
tp = step_over;
+ resume_step = RESUME_STEP_USER;
}
}
/* prepare_to_proceed may change the current thread. */
tp = inferior_thread ();
- if (force_step)
+ if (resume_step == RESUME_STEP_USER)
{
tp->control.trap_expected = 1;
/* If displaced stepping is enabled, we can step over the
@@ -2318,9 +2323,13 @@ proceed (CORE_ADDR addr, enum gdb_signal
@@ -2375,9 +2388,13 @@ proceed (CORE_ADDR addr, enum gdb_signal
/* Reset to normal state. */
init_infwait_state ();
+ if (step)
+ if (tp->control.trap_expected || step)
+ resume_step = RESUME_STEP_USER;
+ if (resume_step == RESUME_STEP_CONTINUE && bpstat_should_step ())
+ resume_step = RESUME_STEP_NEEDED;
+
/* Resume inferior. */
- resume (force_step || step || bpstat_should_step (),
- resume (tp->control.trap_expected || step || bpstat_should_step (),
- tp->suspend.stop_signal);
+ resume (resume_step, tp->suspend.stop_signal);
/* Wait for it to stop (if not standalone)
and in any case decode why it stopped, and act accordingly. */
@@ -5332,13 +5341,18 @@ switch_back_to_stepped_thread (struct ex
@@ -5359,13 +5376,16 @@ switch_back_to_stepped_thread (struct ex
/* Is thread TP in the middle of single-stepping? */
@ -156,26 +130,23 @@ Index: gdb-7.6.90.20140127/gdb/infrun.c
currently_stepping (struct thread_info *tp)
{
- return ((tp->control.step_range_end
- && tp->control.step_resume_breakpoint == NULL)
+ if ((tp->control.step_range_end
&& tp->control.step_resume_breakpoint == NULL)
- || tp->control.trap_expected
- || bpstat_should_step ());
+ if ((tp->control.step_range_end
+ && tp->control.step_resume_breakpoint == NULL)
+ || tp->control.trap_expected)
+ return RESUME_STEP_USER;
+
+ if (bpstat_should_step ())
+ return RESUME_STEP_NEEDED;
+
+ return RESUME_STEP_CONTINUE;
}
/* Returns true if any thread *but* the one passed in "data" is in the
Index: gdb-7.6.90.20140127/gdb/linux-nat.c
/* Inferior has stepped into a subroutine call with source code that
Index: gdb-7.7.90.20140613/gdb/linux-nat.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/linux-nat.c 2014-01-27 22:05:28.806895350 +0100
+++ gdb-7.6.90.20140127/gdb/linux-nat.c 2014-01-27 22:33:45.330157889 +0100
@@ -2697,7 +2697,11 @@ static int
--- gdb-7.7.90.20140613.orig/gdb/linux-nat.c 2014-06-13 03:59:37.000000000 +0200
+++ gdb-7.7.90.20140613/gdb/linux-nat.c 2014-06-13 21:31:19.449949814 +0200
@@ -2709,7 +2709,11 @@ static int
select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
{
if (lp->last_resume_kind == resume_step
@ -188,11 +159,19 @@ Index: gdb-7.6.90.20140127/gdb/linux-nat.c
return 1;
else
return 0;
Index: gdb-7.6.90.20140127/gdb/linux-nat.h
Index: gdb-7.7.90.20140613/gdb/linux-nat.h
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/linux-nat.h 2014-01-27 22:05:28.807895351 +0100
+++ gdb-7.6.90.20140127/gdb/linux-nat.h 2014-01-27 22:33:45.334157892 +0100
@@ -59,8 +59,8 @@ struct lwp_info
--- gdb-7.7.90.20140613.orig/gdb/linux-nat.h 2014-06-13 03:59:37.000000000 +0200
+++ gdb-7.7.90.20140613/gdb/linux-nat.h 2014-06-13 21:31:19.449949814 +0200
@@ -18,6 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "target.h"
+#include "infrun.h"
#include <signal.h>
@@ -59,8 +60,8 @@ struct lwp_info
/* If non-zero, a pending wait status. */
int status;
@ -203,3 +182,36 @@ Index: gdb-7.6.90.20140127/gdb/linux-nat.h
/* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
watchpoint trap. */
Index: gdb-7.7.90.20140613/gdb/infrun.h
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/infrun.h 2014-06-13 03:59:36.000000000 +0200
+++ gdb-7.7.90.20140613/gdb/infrun.h 2014-06-13 21:31:19.449949814 +0200
@@ -89,7 +89,14 @@ extern void proceed (CORE_ADDR, enum gdb
/* The `resume' routine should only be called in special circumstances.
Normally, use `proceed', which handles a lot of bookkeeping. */
-extern void resume (int, enum gdb_signal);
+enum resume_step
+ {
+ /* currently_stepping () should return non-zero for non-continue. */
+ RESUME_STEP_CONTINUE = 0,
+ RESUME_STEP_USER, /* Stepping is intentional by the user. */
+ RESUME_STEP_NEEDED /* Stepping only for software watchpoints. */
+ };
+extern void resume (enum resume_step, enum gdb_signal);
extern ptid_t user_visible_resume_ptid (int step);
diff --git a/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp b/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp
index 2a30604..ee1fd11 100644
--- a/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp
+++ b/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp
@@ -97,7 +97,7 @@ gdb_test "set debug infrun 1"
gdb_test \
"step" \
- ".*need to step-over.*resume \\(step=1.*signal arrived while stepping over breakpoint.*switching back to stepped thread.*stepped to a different line.*callme.*" \
+ ".*need to step-over.*resume \\(step=RESUME_STEP_USER.*signal arrived while stepping over breakpoint.*switching back to stepped thread.*stepped to a different line.*callme.*" \
"step"
set cnt_after [get_value "args\[$my_number\]" "get count after step"]

View File

@ -1,8 +1,8 @@
Index: gdb-7.7/gdb/linux-nat.c
Index: gdb-7.7.90.20140613/gdb/linux-nat.c
===================================================================
--- gdb-7.7.orig/gdb/linux-nat.c 2014-02-09 19:13:32.998214571 +0100
+++ gdb-7.7/gdb/linux-nat.c 2014-02-09 19:17:37.561499606 +0100
@@ -176,6 +176,9 @@ blocked. */
--- gdb-7.7.90.20140613.orig/gdb/linux-nat.c 2014-06-13 23:03:34.364177614 +0200
+++ gdb-7.7.90.20140613/gdb/linux-nat.c 2014-06-13 23:05:07.749279122 +0200
@@ -178,6 +178,9 @@ blocked. */
static struct target_ops *linux_ops;
static struct target_ops linux_ops_saved;
@ -12,7 +12,7 @@ Index: gdb-7.7/gdb/linux-nat.c
/* The method to call, if any, when a new thread is attached. */
static void (*linux_nat_new_thread) (struct lwp_info *);
@@ -652,7 +655,14 @@ holding the child stopped. Try \"set de
@@ -683,7 +686,14 @@ holding the child stopped. Try \"set de
parent_inf->waiting_for_vfork_done = 0;
}
else if (detach_fork)
@ -28,7 +28,7 @@ Index: gdb-7.7/gdb/linux-nat.c
/* Note that the detach above makes PARENT_INF dangling. */
@@ -1099,6 +1109,7 @@ linux_nat_post_attach_wait (ptid_t ptid,
@@ -1107,6 +1117,7 @@ linux_nat_post_attach_wait (ptid_t ptid,
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LNPAW: Attaching to a stopped process\n");
@ -36,7 +36,7 @@ Index: gdb-7.7/gdb/linux-nat.c
/* The process is definitely stopped. It is in a job control
stop, unless the kernel predates the TASK_STOPPED /
@@ -1518,6 +1529,9 @@ get_pending_status (struct lwp_info *lp,
@@ -1529,6 +1540,9 @@ get_pending_status (struct lwp_info *lp,
gdb_signal_to_string (signo));
}
@ -46,7 +46,7 @@ Index: gdb-7.7/gdb/linux-nat.c
return 0;
}
@@ -1631,6 +1645,8 @@ linux_nat_detach (struct target_ops *ops
@@ -1642,6 +1656,8 @@ linux_nat_detach (struct target_ops *ops
}
else
linux_ops->to_detach (ops, args, from_tty);
@ -55,9 +55,9 @@ Index: gdb-7.7/gdb/linux-nat.c
}
/* Resume LP. */
@@ -1813,6 +1829,14 @@ linux_nat_resume (struct target_ops *ops
linux_nat_resume_callback. */
lp->stopped = 0;
@@ -1824,6 +1840,14 @@ linux_nat_resume (struct target_ops *ops
return;
}
+ /* At this point, we are going to resume the inferior and if we
+ have attached to a stopped process, we no longer should leave
@ -68,9 +68,9 @@ Index: gdb-7.7/gdb/linux-nat.c
+ pid_was_stopped = 0;
+
if (resume_many)
iterate_over_lwps (ptid, linux_nat_resume_callback, NULL);
iterate_over_lwps (ptid, linux_nat_resume_callback, lp);
@@ -3864,6 +3888,8 @@ linux_nat_mourn_inferior (struct target_
@@ -3870,6 +3894,8 @@ linux_nat_mourn_inferior (struct target_
/* Let the arch-specific native code know this process is gone. */
linux_nat_forget_process (pid);
@ -79,10 +79,10 @@ Index: gdb-7.7/gdb/linux-nat.c
}
/* Convert a native/host siginfo object, into/from the siginfo in the
Index: gdb-7.7/gdb/testsuite/gdb.threads/attach-stopped.exp
Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.threads/attach-stopped.exp
===================================================================
--- gdb-7.7.orig/gdb/testsuite/gdb.threads/attach-stopped.exp 2014-01-08 10:23:36.000000000 +0100
+++ gdb-7.7/gdb/testsuite/gdb.threads/attach-stopped.exp 2014-02-09 19:13:33.321214945 +0100
--- gdb-7.7.90.20140613.orig/gdb/testsuite/gdb.threads/attach-stopped.exp 2014-06-13 23:03:34.365177615 +0200
+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.threads/attach-stopped.exp 2014-06-13 23:03:37.162180660 +0200
@@ -61,7 +61,65 @@ proc corefunc { threadtype } {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}

View File

@ -5,23 +5,23 @@ Some of the threads may not be properly PTRACE_DETACHed which hurts if they
should have been detached with SIGSTOP (as they are accidentally left running
on the debugger termination).
Index: gdb-7.6.50.20130731-cvs/gdb/defs.h
Index: gdb-7.7.90.20140613/gdb/defs.h
===================================================================
--- gdb-7.6.50.20130731-cvs.orig/gdb/defs.h 2013-08-02 16:58:31.453016573 +0200
+++ gdb-7.6.50.20130731-cvs/gdb/defs.h 2013-08-02 16:58:41.221030412 +0200
@@ -177,6 +177,7 @@ extern int check_quit_flag (void);
/* Set the quit flag. */
extern void set_quit_flag (void);
--- gdb-7.7.90.20140613.orig/gdb/defs.h 2014-06-13 23:10:18.876623018 +0200
+++ gdb-7.7.90.20140613/gdb/defs.h 2014-06-13 23:10:52.450660505 +0200
@@ -174,6 +174,7 @@ extern void set_quit_flag (void);
/* Flag that function quit should call quit_force. */
extern volatile int sync_quit_force_run;
+extern int quit_flag_cleanup;
extern int immediate_quit;
extern void quit (void);
Index: gdb-7.6.50.20130731-cvs/gdb/top.c
Index: gdb-7.7.90.20140613/gdb/top.c
===================================================================
--- gdb-7.6.50.20130731-cvs.orig/gdb/top.c 2013-08-02 16:58:41.222030414 +0200
+++ gdb-7.6.50.20130731-cvs/gdb/top.c 2013-08-02 16:59:06.321066228 +0200
@@ -1415,7 +1415,9 @@ quit_force (char *args, int from_tty)
--- gdb-7.7.90.20140613.orig/gdb/top.c 2014-06-13 23:10:15.910619715 +0200
+++ gdb-7.7.90.20140613/gdb/top.c 2014-06-13 23:10:18.877623020 +0200
@@ -1378,7 +1378,9 @@ quit_force (char *args, int from_tty)
if (ex.reason < 0) \
exception_print (gdb_stderr, ex)
@ -32,11 +32,11 @@ Index: gdb-7.6.50.20130731-cvs/gdb/top.c
/* Get out of tfind mode, and kill or detach all inferiors. */
DO_TRY
Index: gdb-7.6.50.20130731-cvs/gdb/utils.c
Index: gdb-7.7.90.20140613/gdb/utils.c
===================================================================
--- gdb-7.6.50.20130731-cvs.orig/gdb/utils.c 2013-08-02 16:58:31.455016575 +0200
+++ gdb-7.6.50.20130731-cvs/gdb/utils.c 2013-08-02 16:58:41.223030415 +0200
@@ -136,6 +136,11 @@ int quit_flag;
--- gdb-7.7.90.20140613.orig/gdb/utils.c 2014-06-13 23:10:18.878623021 +0200
+++ gdb-7.7.90.20140613/gdb/utils.c 2014-06-13 23:10:38.307644652 +0200
@@ -125,6 +125,11 @@ int job_control;
int immediate_quit;
@ -45,30 +45,20 @@ Index: gdb-7.6.50.20130731-cvs/gdb/utils.c
+
+int quit_flag_cleanup;
+
#ifndef HAVE_PYTHON
/* Clear the quit flag. */
@@ -159,6 +164,9 @@ set_quit_flag (void)
int
check_quit_flag (void)
{
+ if (quit_flag_cleanup)
+ return 0;
+
/* This is written in a particular way to avoid races. */
if (quit_flag)
{
Index: gdb-7.6.50.20130731-cvs/gdb/python/python.c
/* Nonzero means that strings with character values >0x7F should be printed
as octal escapes. Zero means just print the value (e.g. it's an
international character, and the terminal or window can cope.) */
Index: gdb-7.7.90.20140613/gdb/extension.c
===================================================================
--- gdb-7.6.50.20130731-cvs.orig/gdb/python/python.c 2013-08-02 16:58:31.456016577 +0200
+++ gdb-7.6.50.20130731-cvs/gdb/python/python.c 2013-08-02 16:58:41.224030416 +0200
@@ -191,6 +191,9 @@ set_quit_flag (void)
int
check_quit_flag (void)
{
--- gdb-7.7.90.20140613.orig/gdb/extension.c 2014-06-13 03:59:36.000000000 +0200
+++ gdb-7.7.90.20140613/gdb/extension.c 2014-06-13 23:11:32.434704853 +0200
@@ -817,6 +817,9 @@ check_quit_flag (void)
int i, result = 0;
const struct extension_language_defn *extlang;
+ if (quit_flag_cleanup)
+ return 0;
+
return PyOS_InterruptOccurred ();
}
ALL_ENABLED_EXTENSION_LANGUAGES (i, extlang)
{
if (extlang->ops->check_quit_flag != NULL)

View File

@ -1,8 +1,8 @@
Index: gdb-7.6.50.20130731-cvs/gdb/breakpoint.c
Index: gdb-7.7.50.20140609/gdb/breakpoint.c
===================================================================
--- gdb-7.6.50.20130731-cvs.orig/gdb/breakpoint.c 2013-08-02 16:29:16.065402116 +0200
+++ gdb-7.6.50.20130731-cvs/gdb/breakpoint.c 2013-08-02 16:29:17.073403456 +0200
@@ -15963,6 +15963,50 @@ initialize_breakpoint_ops (void)
--- gdb-7.7.50.20140609.orig/gdb/breakpoint.c 2014-06-13 20:24:34.564667225 +0200
+++ gdb-7.7.50.20140609/gdb/breakpoint.c 2014-06-13 20:24:35.650668351 +0200
@@ -16364,6 +16364,50 @@ initialize_breakpoint_ops (void)
static struct cmd_list_element *enablebreaklist = NULL;
void
@ -53,11 +53,11 @@ Index: gdb-7.6.50.20130731-cvs/gdb/breakpoint.c
_initialize_breakpoint (void)
{
struct cmd_list_element *c;
Index: gdb-7.6.50.20130731-cvs/gdb/breakpoint.h
Index: gdb-7.7.50.20140609/gdb/breakpoint.h
===================================================================
--- gdb-7.6.50.20130731-cvs.orig/gdb/breakpoint.h 2013-08-02 16:29:17.074403457 +0200
+++ gdb-7.6.50.20130731-cvs/gdb/breakpoint.h 2013-08-02 16:29:30.221420896 +0200
@@ -1555,4 +1555,7 @@ extern void breakpoint_free_objfile (str
--- gdb-7.7.50.20140609.orig/gdb/breakpoint.h 2014-06-13 20:24:34.566667227 +0200
+++ gdb-7.7.50.20140609/gdb/breakpoint.h 2014-06-13 20:24:35.651668352 +0200
@@ -1553,4 +1553,7 @@ extern void breakpoint_free_objfile (str
extern char *ep_parse_optional_if_clause (char **arg);
@ -65,13 +65,13 @@ Index: gdb-7.6.50.20130731-cvs/gdb/breakpoint.h
+ struct section_offsets *delta);
+
#endif /* !defined (BREAKPOINT_H) */
Index: gdb-7.6.50.20130731-cvs/gdb/objfiles.c
Index: gdb-7.7.50.20140609/gdb/objfiles.c
===================================================================
--- gdb-7.6.50.20130731-cvs.orig/gdb/objfiles.c 2013-08-02 16:29:16.068402120 +0200
+++ gdb-7.6.50.20130731-cvs/gdb/objfiles.c 2013-08-02 16:29:17.075403458 +0200
@@ -851,6 +851,11 @@ objfile_relocate1 (struct objfile *objfi
objfile->sf->sym_probe_fns->sym_relocate_probe (objfile,
new_offsets, delta);
--- gdb-7.7.50.20140609.orig/gdb/objfiles.c 2014-06-13 20:24:35.652668353 +0200
+++ gdb-7.7.50.20140609/gdb/objfiles.c 2014-06-13 20:25:10.867704891 +0200
@@ -820,6 +820,11 @@ objfile_relocate1 (struct objfile *objfi
obj_section_addr (s));
}
+ /* Final call of breakpoint_re_set can keep breakpoint locations disabled if
+ their addresses match. */

View File

@ -1,24 +1,24 @@
Index: gdb-7.5.50.20130118/gdb/gdbtypes.h
Index: gdb-7.7.50.20140609/gdb/gdbtypes.h
===================================================================
--- gdb-7.5.50.20130118.orig/gdb/gdbtypes.h 2013-01-18 23:07:03.488358315 +0100
+++ gdb-7.5.50.20130118/gdb/gdbtypes.h 2013-01-18 23:08:10.286451570 +0100
@@ -420,6 +420,7 @@ enum field_loc_kind
--- gdb-7.7.50.20140609.orig/gdb/gdbtypes.h 2014-06-13 20:23:55.210626427 +0200
+++ gdb-7.7.50.20140609/gdb/gdbtypes.h 2014-06-13 20:24:26.156658622 +0200
@@ -440,6 +440,7 @@ enum field_loc_kind
{
FIELD_LOC_KIND_BITPOS, /* bitpos */
FIELD_LOC_KIND_ENUMVAL, /* enumval */
FIELD_LOC_KIND_BITPOS, /**< bitpos */
FIELD_LOC_KIND_ENUMVAL, /**< enumval */
+ /* This address is unrelocated by the objfile's ANOFFSET. */
FIELD_LOC_KIND_PHYSADDR, /* physaddr */
FIELD_LOC_KIND_PHYSNAME, /* physname */
FIELD_LOC_KIND_DWARF_BLOCK /* dwarf_block */
@@ -614,6 +615,7 @@ struct main_type
is the location (in the target) of the static field.
Otherwise, physname is the mangled label of the static field. */
FIELD_LOC_KIND_PHYSADDR, /**< physaddr */
FIELD_LOC_KIND_PHYSNAME, /**< physname */
FIELD_LOC_KIND_DWARF_BLOCK /**< dwarf_block */
@@ -617,6 +618,7 @@ struct main_type
field. Otherwise, physname is the mangled label of the
static field. */
+ /* This address is unrelocated by the objfile's ANOFFSET. */
CORE_ADDR physaddr;
const char *physname;
@@ -1237,6 +1239,7 @@ extern void allocate_gnat_aux_type (stru
@@ -1262,6 +1264,7 @@ extern void allocate_gnat_aux_type (stru
#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)
@ -26,7 +26,7 @@ Index: gdb-7.5.50.20130118/gdb/gdbtypes.h
#define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
#define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block)
#define SET_FIELD_BITPOS(thisfld, bitpos) \
@@ -1248,6 +1251,7 @@ extern void allocate_gnat_aux_type (stru
@@ -1273,6 +1276,7 @@ extern void allocate_gnat_aux_type (stru
#define SET_FIELD_PHYSNAME(thisfld, name) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \
FIELD_STATIC_PHYSNAME (thisfld) = (name))
@ -34,7 +34,7 @@ Index: gdb-7.5.50.20130118/gdb/gdbtypes.h
#define SET_FIELD_PHYSADDR(thisfld, addr) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \
FIELD_STATIC_PHYSADDR (thisfld) = (addr))
@@ -1264,6 +1268,7 @@ extern void allocate_gnat_aux_type (stru
@@ -1289,6 +1293,7 @@ extern void allocate_gnat_aux_type (stru
#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))
@ -42,11 +42,11 @@ Index: gdb-7.5.50.20130118/gdb/gdbtypes.h
#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))
Index: gdb-7.5.50.20130118/gdb/jv-lang.c
Index: gdb-7.7.50.20140609/gdb/jv-lang.c
===================================================================
--- gdb-7.5.50.20130118.orig/gdb/jv-lang.c 2013-01-18 23:07:03.488358315 +0100
+++ gdb-7.5.50.20130118/gdb/jv-lang.c 2013-01-18 23:08:10.286451570 +0100
@@ -430,7 +430,8 @@ java_link_class_type (struct gdbarch *gd
--- gdb-7.7.50.20140609.orig/gdb/jv-lang.c 2014-06-13 20:23:55.211626428 +0200
+++ gdb-7.7.50.20140609/gdb/jv-lang.c 2014-06-13 20:23:56.278627534 +0200
@@ -427,7 +427,8 @@ java_link_class_type (struct gdbarch *gd
fields = NULL;
nfields--; /* First set up dummy "class" field. */
@ -56,7 +56,7 @@ Index: gdb-7.5.50.20130118/gdb/jv-lang.c
TYPE_FIELD_NAME (type, nfields) = "class";
TYPE_FIELD_TYPE (type, nfields) = value_type (clas);
SET_TYPE_FIELD_PRIVATE (type, nfields);
@@ -478,7 +479,8 @@ java_link_class_type (struct gdbarch *gd
@@ -475,7 +476,8 @@ java_link_class_type (struct gdbarch *gd
SET_TYPE_FIELD_PROTECTED (type, i);
}
if (accflags & 0x0008) /* ACC_STATIC */
@ -66,11 +66,11 @@ Index: gdb-7.5.50.20130118/gdb/jv-lang.c
else
SET_FIELD_BITPOS (TYPE_FIELD (type, i), 8 * boffset);
if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */
Index: gdb-7.5.50.20130118/gdb/value.c
Index: gdb-7.7.50.20140609/gdb/value.c
===================================================================
--- gdb-7.5.50.20130118.orig/gdb/value.c 2013-01-18 23:07:03.490358319 +0100
+++ gdb-7.5.50.20130118/gdb/value.c 2013-01-18 23:08:10.287451543 +0100
@@ -2624,7 +2624,8 @@ value_static_field (struct type *type, i
--- gdb-7.7.50.20140609.orig/gdb/value.c 2014-06-13 20:23:55.212626429 +0200
+++ gdb-7.7.50.20140609/gdb/value.c 2014-06-13 20:23:56.279627535 +0200
@@ -2783,7 +2783,8 @@ value_static_field (struct type *type, i
{
case FIELD_LOC_KIND_PHYSADDR:
retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),

3488
gdb-archer-vla-tests.patch Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -37,10 +37,10 @@ gdb/gdbserver/
(linux_create_inferior, linux_tracefork_child): Call it instead of
direct ptrace.
Index: gdb-7.6.90.20140127/gdb/common/linux-ptrace.c
Index: gdb-7.7.50.20140609/gdb/common/linux-ptrace.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/common/linux-ptrace.c 2014-02-06 17:40:32.530145960 +0100
+++ gdb-7.6.90.20140127/gdb/common/linux-ptrace.c 2014-02-06 17:48:16.329644534 +0100
--- gdb-7.7.50.20140609.orig/gdb/common/linux-ptrace.c 2014-06-13 20:28:04.375884828 +0200
+++ gdb-7.7.50.20140609/gdb/common/linux-ptrace.c 2014-06-13 20:28:57.514940079 +0200
@@ -32,6 +32,10 @@
#include <stdint.h>
@ -52,16 +52,16 @@ Index: gdb-7.6.90.20140127/gdb/common/linux-ptrace.c
/* Stores the currently supported ptrace options. A value of
-1 means we did not check for features yet. A value of 0 means
there are no supported features. */
@@ -56,6 +60,8 @@ linux_ptrace_attach_warnings (pid_t pid,
buffer_xml_printf (buffer, _("warning: process %d is a zombie "
"- the process has already terminated\n"),
@@ -56,6 +60,8 @@ linux_ptrace_attach_fail_reason (pid_t p
buffer_xml_printf (buffer, _("process %d is a zombie "
"- the process has already terminated"),
(int) pid);
+
+ linux_ptrace_create_warnings (buffer);
}
#if defined __i386__ || defined __x86_64__
@@ -542,3 +548,19 @@ linux_ptrace_init_warnings (void)
@@ -551,3 +557,19 @@ linux_ptrace_init_warnings (void)
linux_ptrace_test_ret_to_nx ();
}
@ -81,23 +81,23 @@ Index: gdb-7.6.90.20140127/gdb/common/linux-ptrace.c
+ "(gdb) shell sudo setsebool deny_ptrace=0"));
+#endif /* HAVE_LIBSELINUX */
+}
Index: gdb-7.6.90.20140127/gdb/common/linux-ptrace.h
Index: gdb-7.7.50.20140609/gdb/common/linux-ptrace.h
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/common/linux-ptrace.h 2014-02-06 17:40:35.506149162 +0100
+++ gdb-7.6.90.20140127/gdb/common/linux-ptrace.h 2014-02-06 17:48:00.601627995 +0100
--- gdb-7.7.50.20140609.orig/gdb/common/linux-ptrace.h 2014-06-13 20:28:14.375895202 +0200
+++ gdb-7.7.50.20140609/gdb/common/linux-ptrace.h 2014-06-13 20:28:33.298914047 +0200
@@ -85,6 +85,7 @@ struct buffer;
extern void linux_ptrace_attach_warnings (pid_t pid, struct buffer *buffer);
extern void linux_ptrace_attach_fail_reason (pid_t pid, struct buffer *buffer);
extern void linux_ptrace_init_warnings (void);
+extern void linux_ptrace_create_warnings (struct buffer *buffer);
extern void linux_enable_event_reporting (pid_t pid);
extern void linux_disable_event_reporting (pid_t pid);
extern int linux_supports_tracefork (void);
extern int linux_supports_traceclone (void);
Index: gdb-7.6.90.20140127/gdb/configure.ac
Index: gdb-7.7.50.20140609/gdb/configure.ac
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/configure.ac 2014-02-06 17:40:32.532145962 +0100
+++ gdb-7.6.90.20140127/gdb/configure.ac 2014-02-06 17:40:35.507149163 +0100
@@ -1975,6 +1975,10 @@ case $host_os in
--- gdb-7.7.50.20140609.orig/gdb/configure.ac 2014-06-13 20:28:04.377884830 +0200
+++ gdb-7.7.50.20140609/gdb/configure.ac 2014-06-13 20:28:14.376895203 +0200
@@ -2138,6 +2138,10 @@ case $host_os in
esac
AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.])
@ -108,10 +108,10 @@ Index: gdb-7.6.90.20140127/gdb/configure.ac
dnl Handle optional features that can be enabled.
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
Index: gdb-7.6.90.20140127/gdb/gdbserver/configure.ac
Index: gdb-7.7.50.20140609/gdb/gdbserver/configure.ac
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/gdbserver/configure.ac 2014-02-06 17:40:32.532145962 +0100
+++ gdb-7.6.90.20140127/gdb/gdbserver/configure.ac 2014-02-06 17:40:35.507149163 +0100
--- gdb-7.7.50.20140609.orig/gdb/gdbserver/configure.ac 2014-06-13 20:28:04.377884830 +0200
+++ gdb-7.7.50.20140609/gdb/gdbserver/configure.ac 2014-06-13 20:28:14.376895203 +0200
@@ -454,6 +454,10 @@ if $want_ipa ; then
fi
fi
@ -123,11 +123,11 @@ Index: gdb-7.6.90.20140127/gdb/gdbserver/configure.ac
AC_SUBST(GDBSERVER_DEPFILES)
AC_SUBST(GDBSERVER_LIBS)
AC_SUBST(srv_xmlbuiltin)
Index: gdb-7.6.90.20140127/gdb/gdbserver/linux-low.c
Index: gdb-7.7.50.20140609/gdb/gdbserver/linux-low.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/gdbserver/linux-low.c 2014-02-06 17:40:32.534145964 +0100
+++ gdb-7.6.90.20140127/gdb/gdbserver/linux-low.c 2014-02-06 17:49:32.385726514 +0100
@@ -543,6 +543,29 @@ add_lwp (ptid_t ptid)
--- gdb-7.7.50.20140609.orig/gdb/gdbserver/linux-low.c 2014-06-13 20:28:04.379884832 +0200
+++ gdb-7.7.50.20140609/gdb/gdbserver/linux-low.c 2014-06-13 20:28:14.377895204 +0200
@@ -541,6 +541,29 @@ add_lwp (ptid_t ptid)
return lwp;
}
@ -157,7 +157,7 @@ Index: gdb-7.6.90.20140127/gdb/gdbserver/linux-low.c
/* Start an inferior process and returns its pid.
ALLARGS is a vector of program-name and args. */
@@ -584,7 +607,7 @@ linux_create_inferior (char *program, ch
@@ -582,7 +605,7 @@ linux_create_inferior (char *program, ch
if (pid == 0)
{
close_most_fds ();
@ -166,10 +166,10 @@ Index: gdb-7.6.90.20140127/gdb/gdbserver/linux-low.c
#ifndef __ANDROID__ /* Bionic doesn't use SIGRTMIN the way glibc does. */
signal (__SIGRTMIN + 1, SIG_DFL);
Index: gdb-7.6.90.20140127/gdb/inf-ptrace.c
Index: gdb-7.7.50.20140609/gdb/inf-ptrace.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/inf-ptrace.c 2014-02-06 17:40:32.535145965 +0100
+++ gdb-7.6.90.20140127/gdb/inf-ptrace.c 2014-02-06 17:40:35.510149167 +0100
--- gdb-7.7.50.20140609.orig/gdb/inf-ptrace.c 2014-06-13 20:28:04.380884833 +0200
+++ gdb-7.7.50.20140609/gdb/inf-ptrace.c 2014-06-13 20:28:14.377895204 +0200
@@ -105,7 +105,15 @@ static void
inf_ptrace_me (void)
{
@ -186,11 +186,11 @@ Index: gdb-7.6.90.20140127/gdb/inf-ptrace.c
}
/* Start a new inferior Unix child process. EXEC_FILE is the file to
Index: gdb-7.6.90.20140127/gdb/linux-nat.c
Index: gdb-7.7.50.20140609/gdb/linux-nat.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/linux-nat.c 2014-02-06 17:40:32.537145968 +0100
+++ gdb-7.6.90.20140127/gdb/linux-nat.c 2014-02-06 17:40:35.511149168 +0100
@@ -1283,6 +1283,7 @@ linux_nat_create_inferior (struct target
--- gdb-7.7.50.20140609.orig/gdb/linux-nat.c 2014-06-13 20:28:04.382884835 +0200
+++ gdb-7.7.50.20140609/gdb/linux-nat.c 2014-06-13 20:29:34.554977995 +0200
@@ -1285,6 +1285,7 @@ linux_nat_create_inferior (struct target
#ifdef HAVE_PERSONALITY
int personality_orig = 0, personality_set = 0;
#endif /* HAVE_PERSONALITY */
@ -198,9 +198,9 @@ Index: gdb-7.6.90.20140127/gdb/linux-nat.c
/* The fork_child mechanism is synchronous and calls target_wait, so
we have to mask the async mode. */
@@ -1307,7 +1308,10 @@ linux_nat_create_inferior (struct target
@@ -1309,7 +1310,10 @@ linux_nat_create_inferior (struct target
/* Make sure we report all signals during startup. */
linux_nat_pass_signals (0, NULL);
linux_nat_pass_signals (ops, 0, NULL);
- linux_ops->to_create_inferior (ops, exec_file, allargs, env, from_tty);
+ TRY_CATCH (ex, RETURN_MASK_ERROR)
@ -210,7 +210,7 @@ Index: gdb-7.6.90.20140127/gdb/linux-nat.c
#ifdef HAVE_PERSONALITY
if (personality_set)
@@ -1319,6 +1323,24 @@ linux_nat_create_inferior (struct target
@@ -1321,6 +1325,24 @@ linux_nat_create_inferior (struct target
safe_strerror (errno));
}
#endif /* HAVE_PERSONALITY */
@ -235,11 +235,11 @@ Index: gdb-7.6.90.20140127/gdb/linux-nat.c
}
static void
Index: gdb-7.6.90.20140127/gdb/config.in
Index: gdb-7.7.50.20140609/gdb/config.in
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/config.in 2014-02-06 17:40:32.538145969 +0100
+++ gdb-7.6.90.20140127/gdb/config.in 2014-02-06 17:40:35.511149168 +0100
@@ -213,6 +213,9 @@
--- gdb-7.7.50.20140609.orig/gdb/config.in 2014-06-13 20:28:04.383884836 +0200
+++ gdb-7.7.50.20140609/gdb/config.in 2014-06-13 20:29:57.378002067 +0200
@@ -216,6 +216,9 @@
/* Define if librpm library is being used. */
#undef HAVE_LIBRPM
@ -249,9 +249,9 @@ Index: gdb-7.6.90.20140127/gdb/config.in
/* Define to 1 if you have the <libunwind-ia64.h> header file. */
#undef HAVE_LIBUNWIND_IA64_H
@@ -345,6 +348,9 @@
/* Define to 1 if you have the `sbrk' function. */
#undef HAVE_SBRK
@@ -351,6 +354,9 @@
/* Define to 1 if you have the `scm_new_smob' function. */
#undef HAVE_SCM_NEW_SMOB
+/* Define to 1 if you have the <selinux/selinux.h> header file. */
+#undef HAVE_SELINUX_SELINUX_H
@ -259,11 +259,11 @@ Index: gdb-7.6.90.20140127/gdb/config.in
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
Index: gdb-7.6.90.20140127/gdb/configure
Index: gdb-7.7.50.20140609/gdb/configure
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/configure 2014-02-06 17:40:32.541145972 +0100
+++ gdb-7.6.90.20140127/gdb/configure 2014-02-06 17:40:35.515149172 +0100
@@ -12861,6 +12861,64 @@ cat >>confdefs.h <<_ACEOF
--- gdb-7.7.50.20140609.orig/gdb/configure 2014-06-13 20:28:04.387884840 +0200
+++ gdb-7.7.50.20140609/gdb/configure 2014-06-13 20:28:14.383895210 +0200
@@ -13282,6 +13282,64 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
@ -328,11 +328,11 @@ Index: gdb-7.6.90.20140127/gdb/configure
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
# except that the argument to --with-sysroot is optional.
Index: gdb-7.6.90.20140127/gdb/gdbserver/config.in
Index: gdb-7.7.50.20140609/gdb/gdbserver/config.in
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/gdbserver/config.in 2014-02-06 17:40:32.542145973 +0100
+++ gdb-7.6.90.20140127/gdb/gdbserver/config.in 2014-02-06 17:54:06.923021799 +0100
@@ -78,6 +78,9 @@
--- gdb-7.7.50.20140609.orig/gdb/gdbserver/config.in 2014-06-13 20:28:04.389884842 +0200
+++ gdb-7.7.50.20140609/gdb/gdbserver/config.in 2014-06-13 20:28:14.383895210 +0200
@@ -81,6 +81,9 @@
/* Define to 1 if you have the `mcheck' library (-lmcheck). */
#undef HAVE_LIBMCHECK
@ -342,7 +342,7 @@ Index: gdb-7.6.90.20140127/gdb/gdbserver/config.in
/* Define if the target supports branch tracing. */
#undef HAVE_LINUX_BTRACE
@@ -151,6 +154,9 @@
@@ -154,6 +157,9 @@
/* Define to 1 if you have the `readlink' function. */
#undef HAVE_READLINK
@ -352,10 +352,10 @@ Index: gdb-7.6.90.20140127/gdb/gdbserver/config.in
/* Define to 1 if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
Index: gdb-7.6.90.20140127/gdb/gdbserver/configure
Index: gdb-7.7.50.20140609/gdb/gdbserver/configure
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/gdbserver/configure 2014-02-06 17:40:32.543145974 +0100
+++ gdb-7.6.90.20140127/gdb/gdbserver/configure 2014-02-06 17:40:35.516149173 +0100
--- gdb-7.7.50.20140609.orig/gdb/gdbserver/configure 2014-06-13 20:28:04.390884844 +0200
+++ gdb-7.7.50.20140609/gdb/gdbserver/configure 2014-06-13 20:28:14.384895211 +0200
@@ -6170,6 +6170,64 @@ if $want_ipa ; then
fi
fi

View File

@ -0,0 +1,207 @@
Re: ASAN crash regression [Re: [PATCH 2/2] move the demangled_names_hash into the per-BFD]
https://sourceware.org/ml/gdb-patches/2014-06/msg00550.html
Jan> ./configure ... -fsanitize=address
Jan> echo 'void f(){}main(){}'|gcc -x c++ - -g;ASAN_OPTIONS=symbolize=1 ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer ./gdb -batch a.out -ex 'file a.out'
Readily seen with valgrind as well.
Here's my proposed fix.
Tom
commit 3a93a67ad0ea3495f67c9708673345b73de2d806
Author: Tom Tromey <tromey@redhat.com>
Date: Mon Jun 16 03:17:19 2014 -0600
fix memory errors with demangled name hash
This fixes a regression that Jan pointed out.
The bug is that some names were allocated by dwarf2read on the objfile
obstack, but then passed to SYMBOL_SET_NAMES with copy_name=0. This
violates the invariant that the names must have a lifetime tied to the
lifetime of the BFD.
The fix is to allocate names on the per-BFD obstack.
I looked at all callers, direct or indirect, of SYMBOL_SET_NAMES that
pass copy_name=0. Note that only the ELF and DWARF readers do this;
other symbol readers were never updated (and perhaps cannot be,
depending on the details of the formats). This is why the patch is
relatively small.
Built and regtested on x86-64 Fedora 20.
2014-06-16 Tom Tromey <tromey@redhat.com>
* dwarf2read.c (fixup_go_packaging, dwarf2_compute_name)
(dwarf2_physname, read_partial_die)
(guess_partial_die_structure_name, fixup_partial_die)
(guess_full_die_structure_name, anonymous_struct_prefix)
(dwarf2_name): Use per-BFD obstack.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,13 @@
2014-06-16 Tom Tromey <tromey@redhat.com>
+ * dwarf2read.c (fixup_go_packaging, dwarf2_compute_name)
+ (dwarf2_physname, read_partial_die)
+ (guess_partial_die_structure_name, fixup_partial_die)
+ (guess_full_die_structure_name, anonymous_struct_prefix)
+ (dwarf2_name): Use per-BFD obstack.
+
+2014-06-16 Tom Tromey <tromey@redhat.com>
+
* minsyms.h (prim_record_minimal_symbol)
(prim_record_minimal_symbol_and_info): Update comments.
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -7745,9 +7745,10 @@ fixup_go_packaging (struct dwarf2_cu *cu)
if (package_name != NULL)
{
struct objfile *objfile = cu->objfile;
- const char *saved_package_name = obstack_copy0 (&objfile->objfile_obstack,
- package_name,
- strlen (package_name));
+ const char *saved_package_name
+ = obstack_copy0 (&objfile->per_bfd->storage_obstack,
+ package_name,
+ strlen (package_name));
struct type *type = init_type (TYPE_CODE_MODULE, 0, 0,
saved_package_name, objfile);
struct symbol *sym;
@@ -8365,6 +8366,8 @@ dwarf2_compute_name (const char *name,
long length;
const char *prefix;
struct ui_file *buf;
+ char *intermediate_name;
+ const char *canonical_name = NULL;
prefix = determine_prefix (die, cu);
buf = mem_fileopen ();
@@ -8541,19 +8544,25 @@ dwarf2_compute_name (const char *name,
}
}
- name = ui_file_obsavestring (buf, &objfile->objfile_obstack,
- &length);
+ intermediate_name = ui_file_xstrdup (buf, &length);
ui_file_delete (buf);
if (cu->language == language_cplus)
- {
- const char *cname
- = dwarf2_canonicalize_name (name, cu,
- &objfile->objfile_obstack);
+ canonical_name
+ = dwarf2_canonicalize_name (intermediate_name, cu,
+ &objfile->per_bfd->storage_obstack);
+
+ /* If we only computed INTERMEDIATE_NAME, or if
+ INTERMEDIATE_NAME is already canonical, then we need to
+ copy it to the appropriate obstack. */
+ if (canonical_name == NULL || canonical_name == intermediate_name)
+ name = obstack_copy0 (&objfile->per_bfd->storage_obstack,
+ intermediate_name,
+ strlen (intermediate_name));
+ else
+ name = canonical_name;
- if (cname != NULL)
- name = cname;
- }
+ xfree (intermediate_name);
}
}
@@ -8562,7 +8571,7 @@ dwarf2_compute_name (const char *name,
/* Return the fully qualified name of DIE, based on its DW_AT_name.
If scope qualifiers are appropriate they will be added. The result
- will be allocated on the objfile_obstack, or NULL if the DIE does
+ will be allocated on the storage_obstack, or NULL if the DIE does
not have a name. NAME may either be from a previous call to
dwarf2_name or NULL.
@@ -8677,7 +8686,8 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
retval = canon;
if (need_copy)
- retval = obstack_copy0 (&objfile->objfile_obstack, retval, strlen (retval));
+ retval = obstack_copy0 (&objfile->per_bfd->storage_obstack,
+ retval, strlen (retval));
do_cleanups (back_to);
return retval;
@@ -15508,7 +15518,7 @@ read_partial_die (const struct die_reader_specs *reader,
default:
part_die->name
= dwarf2_canonicalize_name (DW_STRING (&attr), cu,
- &objfile->objfile_obstack);
+ &objfile->per_bfd->storage_obstack);
break;
}
break;
@@ -15793,7 +15803,7 @@ guess_partial_die_structure_name (struct partial_die_info *struct_pdi,
if (actual_class_name != NULL)
{
struct_pdi->name
- = obstack_copy0 (&cu->objfile->objfile_obstack,
+ = obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
actual_class_name,
strlen (actual_class_name));
xfree (actual_class_name);
@@ -15879,8 +15889,9 @@ fixup_partial_die (struct partial_die_info *part_die,
else
base = demangled;
- part_die->name = obstack_copy0 (&cu->objfile->objfile_obstack,
- base, strlen (base));
+ part_die->name
+ = obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
+ base, strlen (base));
xfree (demangled);
}
}
@@ -18557,7 +18568,7 @@ guess_full_die_structure_name (struct die_info *die, struct dwarf2_cu *cu)
&& actual_name[actual_name_len
- die_name_len - 1] == ':')
name =
- obstack_copy0 (&cu->objfile->objfile_obstack,
+ obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
actual_name,
actual_name_len - die_name_len - 2);
}
@@ -18603,7 +18614,7 @@ anonymous_struct_prefix (struct die_info *die, struct dwarf2_cu *cu)
if (base == NULL || base == DW_STRING (attr) || base[-1] != ':')
return "";
- return obstack_copy0 (&cu->objfile->objfile_obstack,
+ return obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
DW_STRING (attr), &base[-1] - DW_STRING (attr));
}
@@ -18943,8 +18954,9 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
char *base;
/* FIXME: we already did this for the partial symbol... */
- DW_STRING (attr) = obstack_copy0 (&cu->objfile->objfile_obstack,
- demangled, strlen (demangled));
+ DW_STRING (attr)
+ = obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
+ demangled, strlen (demangled));
DW_STRING_IS_CANONICAL (attr) = 1;
xfree (demangled);
@@ -18967,7 +18979,7 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
{
DW_STRING (attr)
= dwarf2_canonicalize_name (DW_STRING (attr), cu,
- &cu->objfile->objfile_obstack);
+ &cu->objfile->per_bfd->storage_obstack);
DW_STRING_IS_CANONICAL (attr) = 1;
}
return DW_STRING (attr);

View File

@ -21,11 +21,11 @@ debugging problem of GOMP outside of the scope of this Bug.
Index: gdb-7.6.50.20130731-cvs/gdb/infrun.c
Index: gdb-7.7.90.20140613/gdb/infrun.c
===================================================================
--- gdb-7.6.50.20130731-cvs.orig/gdb/infrun.c 2013-08-02 17:10:08.446962958 +0200
+++ gdb-7.6.50.20130731-cvs/gdb/infrun.c 2013-08-02 17:10:49.109016685 +0200
@@ -4930,6 +4930,16 @@ process_event_stop_test:
--- gdb-7.7.90.20140613.orig/gdb/infrun.c 2014-06-13 21:59:10.835805512 +0200
+++ gdb-7.7.90.20140613/gdb/infrun.c 2014-06-13 21:59:31.064829121 +0200
@@ -4820,6 +4820,16 @@ process_event_stop_test (struct executio
if (ecs->event_thread->control.step_over_calls == STEP_OVER_ALL)
{
@ -36,13 +36,13 @@ Index: gdb-7.6.50.20130731-cvs/gdb/infrun.c
+ || strstr (SYMBOL_LINKAGE_NAME (stop_fn), ".omp_fn.") == NULL)
+ /* gcc-4.7.2-9.fc19.x86_64 uses a new format. */
+ && (stopf == NULL
+ || strstr (SYMBOL_LINKAGE_NAME (stopf), "._omp_fn.") == NULL))
+ || strstr (MSYMBOL_LINKAGE_NAME (stopf), "._omp_fn.") == NULL))
+{ /* ".omp_fn." */
+
/* We're doing a "next".
Normal (forward) execution: set a breakpoint at the
@@ -4965,6 +4975,7 @@ process_event_stop_test:
@@ -4855,6 +4865,7 @@ process_event_stop_test (struct executio
keep_going (ecs);
return;
@ -50,10 +50,10 @@ Index: gdb-7.6.50.20130731-cvs/gdb/infrun.c
}
/* If we are in a function call trampoline (a stub between the
Index: gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.fortran/omp-step.exp
Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/omp-step.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.fortran/omp-step.exp 2013-08-02 17:10:37.063000571 +0200
+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/omp-step.exp 2014-06-13 21:59:22.801819481 +0200
@@ -0,0 +1,31 @@
+# Copyright 2009 Free Software Foundation, Inc.
+
@ -86,10 +86,10 @@ Index: gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.fortran/omp-step.exp
+
+gdb_breakpoint [gdb_get_line_number "success"]
+gdb_continue_to_breakpoint "success" ".*success.*"
Index: gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.fortran/omp-step.f90
Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/omp-step.f90
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.fortran/omp-step.f90 2013-08-02 17:10:37.063000571 +0200
+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/omp-step.f90 2014-06-13 21:59:22.801819481 +0200
@@ -0,0 +1,32 @@
+! Copyright 2009 Free Software Foundation, Inc.
+

View File

@ -1,7 +1,7 @@
Index: gdb-7.6.90.20140127/gdb/config/i386/linux64.mh
Index: gdb-7.7.50.20140609/gdb/config/i386/linux64.mh
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/config/i386/linux64.mh 2014-02-06 17:30:23.021489736 +0100
+++ gdb-7.6.90.20140127/gdb/config/i386/linux64.mh 2014-02-06 17:30:44.984513403 +0100
--- gdb-7.7.50.20140609.orig/gdb/config/i386/linux64.mh 2014-06-13 20:25:37.356732335 +0200
+++ gdb-7.7.50.20140609/gdb/config/i386/linux64.mh 2014-06-13 20:26:07.984764098 +0200
@@ -5,7 +5,7 @@ NATDEPFILES= inf-ptrace.o fork-child.o \
proc-service.o linux-thread-db.o linux-fork.o \
linux-procfs.o linux-ptrace.o linux-btrace.o \
@ -11,10 +11,10 @@ Index: gdb-7.6.90.20140127/gdb/config/i386/linux64.mh
NAT_CDEPS = $(srcdir)/proc-service.list
# The dynamically loaded libthread_db needs access to symbols in the
Index: gdb-7.6.90.20140127/gdb/config/i386/linux.mh
Index: gdb-7.7.50.20140609/gdb/config/i386/linux.mh
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/config/i386/linux.mh 2014-02-06 17:30:15.893482056 +0100
+++ gdb-7.6.90.20140127/gdb/config/i386/linux.mh 2014-02-06 17:30:23.021489736 +0100
--- gdb-7.7.50.20140609.orig/gdb/config/i386/linux.mh 2014-06-13 20:25:37.356732335 +0200
+++ gdb-7.7.50.20140609/gdb/config/i386/linux.mh 2014-06-13 20:26:07.984764098 +0200
@@ -1,6 +1,6 @@
# Host: Intel 386 running GNU/Linux.
@ -23,10 +23,10 @@ Index: gdb-7.6.90.20140127/gdb/config/i386/linux.mh
NATDEPFILES= inf-ptrace.o fork-child.o \
i386-nat.o i386-linux-nat.o \
proc-service.o linux-thread-db.o \
Index: gdb-7.6.90.20140127/gdb/config/i386/nm-linux.h
Index: gdb-7.7.50.20140609/gdb/config/i386/nm-linux.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6.90.20140127/gdb/config/i386/nm-linux.h 2014-02-06 17:30:23.021489736 +0100
+++ gdb-7.7.50.20140609/gdb/config/i386/nm-linux.h 2014-06-13 20:26:07.984764098 +0200
@@ -0,0 +1,28 @@
+/* Native support for GNU/Linux i386.
+
@ -56,10 +56,10 @@ Index: gdb-7.6.90.20140127/gdb/config/i386/nm-linux.h
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
+#endif /* NM_LINUX64_H */
Index: gdb-7.6.90.20140127/gdb/config/i386/nm-linux64.h
Index: gdb-7.7.50.20140609/gdb/config/i386/nm-linux64.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6.90.20140127/gdb/config/i386/nm-linux64.h 2014-02-06 17:30:23.021489736 +0100
+++ gdb-7.7.50.20140609/gdb/config/i386/nm-linux64.h 2014-06-13 20:26:07.984764098 +0200
@@ -0,0 +1,28 @@
+/* Native support for GNU/Linux amd64.
+
@ -89,25 +89,26 @@ Index: gdb-7.6.90.20140127/gdb/config/i386/nm-linux64.h
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
+#endif /* NM_LINUX64_H */
Index: gdb-7.6.90.20140127/gdb/target.h
Index: gdb-7.7.50.20140609/gdb/target.h
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/target.h 2014-02-06 17:30:15.894482057 +0100
+++ gdb-7.6.90.20140127/gdb/target.h 2014-02-06 17:30:23.022489737 +0100
@@ -1521,8 +1521,10 @@ extern char *target_thread_name (struct
--- gdb-7.7.50.20140609.orig/gdb/target.h 2014-06-13 20:26:07.985764099 +0200
+++ gdb-7.7.50.20140609/gdb/target.h 2014-06-13 20:26:34.915792095 +0200
@@ -1728,9 +1728,11 @@ extern char *target_thread_name (struct
bp_hardware_breakpoint. CNT is the number of such watchpoints used so far
(including this one?). OTHERTYPE is who knows what... */
+#ifndef target_can_use_hardware_watchpoint
#define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
(*current_target.to_can_use_hw_breakpoint) (TYPE, CNT, OTHERTYPE);
(*current_target.to_can_use_hw_breakpoint) (&current_target, \
TYPE, CNT, OTHERTYPE);
+#endif
/* Returns the number of debug registers needed to watch the given
memory region, or zero if not supported. */
Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp 2014-02-06 17:30:23.022489737 +0100
+++ gdb-7.7.50.20140609/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp 2014-06-13 20:26:07.986764101 +0200
@@ -0,0 +1,40 @@
+# Copyright 2009, 2010 Free Software Foundation, Inc.
+

View File

@ -1,9 +1,10 @@
https://bugzilla.redhat.com/show_bug.cgi?id=1020004
diff -dup -ruNp gdb-7.7-orig/gdb/data-directory/Makefile.in gdb-7.7/gdb/data-directory/Makefile.in
--- gdb-7.7-orig/gdb/data-directory/Makefile.in 2014-02-23 18:12:51.338866391 +0100
+++ gdb-7.7/gdb/data-directory/Makefile.in 2014-02-23 18:14:31.187756983 +0100
@@ -58,9 +58,12 @@ PYTHON_FILES = \
Index: gdb-7.7.90.20140613/gdb/data-directory/Makefile.in
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/data-directory/Makefile.in 2014-06-13 23:02:37.597115787 +0200
+++ gdb-7.7.90.20140613/gdb/data-directory/Makefile.in 2014-06-13 23:03:21.285163909 +0200
@@ -60,6 +60,8 @@ PYTHON_FILES = \
gdb/frames.py \
gdb/FrameIterator.py \
gdb/FrameDecorator.py \
@ -12,13 +13,18 @@ diff -dup -ruNp gdb-7.7-orig/gdb/data-directory/Makefile.in gdb-7.7/gdb/data-dir
gdb/types.py \
gdb/printing.py \
gdb/prompt.py \
@@ -74,6 +76,7 @@ PYTHON_FILES = \
gdb/command/pretty_printers.py \
gdb/command/prompt.py \
gdb/command/explore.py \
+ gdb/command/backtrace.py \
gdb/command/bound_registers.py \
gdb/command/__init__.py \
gdb/command/ignore_errors.py \
diff -dup -ruNp gdb-7.7-orig/gdb/python/lib/gdb/FrameWrapper.py gdb-7.7/gdb/python/lib/gdb/FrameWrapper.py
--- gdb-7.7-orig/gdb/python/lib/gdb/FrameWrapper.py 1970-01-01 01:00:00.000000000 +0100
+++ gdb-7.7/gdb/python/lib/gdb/FrameWrapper.py 2014-02-23 18:14:31.188756981 +0100
gdb/function/__init__.py \
gdb/function/strfns.py \
gdb/function/caller_is.py \
Index: gdb-7.7.90.20140613/gdb/python/lib/gdb/FrameWrapper.py
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.7.90.20140613/gdb/python/lib/gdb/FrameWrapper.py 2014-06-13 23:02:37.598115788 +0200
@@ -0,0 +1,122 @@
+# Wrapper API for frames.
+
@ -142,9 +148,10 @@ diff -dup -ruNp gdb-7.7-orig/gdb/python/lib/gdb/FrameWrapper.py gdb-7.7/gdb/pyth
+
+ def __getattr__ (self, name):
+ return getattr (self.frame, name)
diff -dup -ruNp gdb-7.7-orig/gdb/python/lib/gdb/backtrace.py gdb-7.7/gdb/python/lib/gdb/backtrace.py
--- gdb-7.7-orig/gdb/python/lib/gdb/backtrace.py 1970-01-01 01:00:00.000000000 +0100
+++ gdb-7.7/gdb/python/lib/gdb/backtrace.py 2014-02-23 18:14:31.188756981 +0100
Index: gdb-7.7.90.20140613/gdb/python/lib/gdb/backtrace.py
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.7.90.20140613/gdb/python/lib/gdb/backtrace.py 2014-06-13 23:02:37.598115788 +0200
@@ -0,0 +1,42 @@
+# Filtering backtrace.
+
@ -188,9 +195,10 @@ diff -dup -ruNp gdb-7.7-orig/gdb/python/lib/gdb/backtrace.py gdb-7.7/gdb/python/
+ return iter
+ return old_frame_filter (iter)
+
diff -dup -ruNp gdb-7.7-orig/gdb/python/lib/gdb/command/backtrace.py gdb-7.7/gdb/python/lib/gdb/command/backtrace.py
--- gdb-7.7-orig/gdb/python/lib/gdb/command/backtrace.py 1970-01-01 01:00:00.000000000 +0100
+++ gdb-7.7/gdb/python/lib/gdb/command/backtrace.py 2014-02-23 18:14:31.188756981 +0100
Index: gdb-7.7.90.20140613/gdb/python/lib/gdb/command/backtrace.py
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.7.90.20140613/gdb/python/lib/gdb/command/backtrace.py 2014-06-13 23:02:37.598115788 +0200
@@ -0,0 +1,106 @@
+# New backtrace command.
+

View File

@ -1,8 +1,8 @@
Index: gdb-7.6.90.20140127/gdb/dwarf2read.c
Index: gdb-7.7.90.20140613/gdb/dwarf2read.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/dwarf2read.c 2014-02-06 18:18:09.676572271 +0100
+++ gdb-7.6.90.20140127/gdb/dwarf2read.c 2014-02-06 18:18:42.664607823 +0100
@@ -17646,6 +17646,25 @@ new_symbol_full (struct die_info *die, s
--- gdb-7.7.90.20140613.orig/gdb/dwarf2read.c 2014-06-13 21:56:54.744653443 +0200
+++ gdb-7.7.90.20140613/gdb/dwarf2read.c 2014-06-13 22:01:51.529990684 +0200
@@ -17695,6 +17695,26 @@ new_symbol_full (struct die_info *die, s
/* Cache this symbol's name and the name's demangled form (if any). */
SYMBOL_SET_LANGUAGE (sym, cu->language, &objfile->objfile_obstack);
linkagename = dwarf2_physname (name, die, cu);
@ -14,24 +14,25 @@ Index: gdb-7.6.90.20140127/gdb/dwarf2read.c
+ && strstr (objfile_name (objfile), "/libc") != NULL)
+ {
+ struct objfile *objfile_msym;
+ struct minimal_symbol *msym;
+ struct bound_minimal_symbol bmsym;
+
+ if (objfile->separate_debug_objfile_backlink)
+ objfile_msym = objfile->separate_debug_objfile_backlink;
+ else
+ objfile_msym = objfile;
+ msym = lookup_minimal_symbol ("strstr", NULL, objfile_msym);
+ if (msym && MSYMBOL_TYPE (msym) == mst_text_gnu_ifunc)
+ bmsym = lookup_minimal_symbol ("strstr", NULL, objfile_msym);
+ if (bmsym.minsym != NULL
+ && MSYMBOL_TYPE (bmsym.minsym) == mst_text_gnu_ifunc)
+ linkagename = "__strstr";
+ }
+
SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile);
/* Fortran does not have mangling standard and the mangling does differ
Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp 2014-02-06 18:18:16.294579381 +0100
+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp 2014-06-13 21:59:41.174840871 +0200
@@ -0,0 +1,108 @@
+# Copyright (C) 2012 Free Software Foundation, Inc.
+

View File

@ -1,451 +0,0 @@
commit adde2bff0757e89175ede493f03b86953d0d9352
Author: Doug Evans <xdje42@gmail.com>
Date: Thu Feb 20 09:13:53 2014 -0800
Fix PR symtab/16581
* dwarf2read.c (struct die_info): New member in_process.
(reset_die_in_process): New function.
(process_die): Set it at the start, reset when returning.
(inherit_abstract_dies): Only call process_die if origin_child_die
not already being processed.
testsuite/
* gdb.dwarf2/dw2-icycle.S: New file.
* gdb.dwarf2/dw2-icycle.c: New file.
* gdb.dwarf2/dw2-icycle.exp: New file.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,14 @@
+2014-02-20 lin zuojian <manjian2006@gmail.com>
+ Joel Brobecker <brobecker@adacore.com>
+ Doug Evans <xdje42@gmail.com>
+
+ PR symtab/16581
+ * dwarf2read.c (struct die_info): New member in_process.
+ (reset_die_in_process): New function.
+ (process_die): Set it at the start, reset when returning.
+ (inherit_abstract_dies): Only call process_die if origin_child_die
+ not already being processed.
+
2014-02-20 Joel Brobecker <brobecker@adacore.com>
* windows-nat.c (handle_unload_dll): Add function documentation.
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1225,6 +1225,9 @@ struct die_info
type derived from this DIE. */
unsigned char building_fullname : 1;
+ /* True if this die is in process. PR 16581. */
+ unsigned char in_process : 1;
+
/* Abbrev number */
unsigned int abbrev;
@@ -8008,11 +8011,28 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu)
}
}
+/* Reset the in_process bit of a die. */
+
+static void
+reset_die_in_process (void *arg)
+{
+ struct die_info *die = arg;
+ die->in_process = 0;
+}
+
/* Process a die and its children. */
static void
process_die (struct die_info *die, struct dwarf2_cu *cu)
{
+ struct cleanup *in_process;
+
+ /* We should only be processing those not already in process. */
+ gdb_assert (!die->in_process);
+
+ die->in_process = 1;
+ in_process = make_cleanup (reset_die_in_process,die);
+
switch (die->tag)
{
case DW_TAG_padding:
@@ -7762,6 +7782,8 @@ process_die (struct die_info *die, struc
new_symbol (die, NULL, cu);
break;
}
+
+ do_cleanups (in_process);
}
/* DWARF name computation. */
@@ -10967,8 +10989,12 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
if (offsetp >= offsets_end
|| offsetp->sect_off > origin_child_die->offset.sect_off)
{
- /* Found that ORIGIN_CHILD_DIE is really not referenced. */
- process_die (origin_child_die, origin_cu);
+ /* Found that ORIGIN_CHILD_DIE is really not referenced.
+ Check whether we're already processing ORIGIN_CHILD_DIE.
+ This can happen with mutually referenced abstract_origins.
+ PR 16581. */
+ if (!origin_child_die->in_process)
+ process_die (origin_child_die, origin_cu);
}
origin_child_die = sibling_die (origin_child_die);
}
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,3 +1,12 @@
+2014-02-20 lin zuojian <manjian2006@gmail.com>
+ Joel Brobecker <brobecker@adacore.com>
+ Doug Evans <xdje42@gmail.com>
+
+ PR symtab/16581
+ * gdb.dwarf2/dw2-icycle.S: New file.
+ * gdb.dwarf2/dw2-icycle.c: New file.
+ * gdb.dwarf2/dw2-icycle.exp: New file.
+
2014-02-19 Siva Chandra Reddy <sivachandra@google.com>
* gdb.python/py-value-cc.cc: Improve test case to enable testing
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-icycle.S
@@ -0,0 +1,258 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2014 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+ .text
+
+.Ltext0:
+ .type p__top__middle__inside.3062, @function
+p__top__middle__inside.3062:
+.LFB4:
+ .file 1 "p.adb"
+ .4byte 0
+.LBE6:
+
+ .globl p__top
+ .type p__top, @function
+p__top:
+.LFB2:
+ .4byte 0
+.LFE2:
+.Letext0:
+
+ .section .debug_info,"",@progbits
+.Ldebug_info0:
+ .4byte .Ledebug_info0 - .Lsdebug_info0 /* Length of CU Info */
+.Lsdebug_info0:
+ .2byte 0x4 /* DWARF version number */
+ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
+ .byte 0x4 /* Pointer Size (in bytes) */
+ .uleb128 0x1 /* (DIE (0xb) DW_TAG_compile_unit) */
+ .ascii "GNU Ada 4.9.0 20140126\0" /* DW_AT_producer */
+ .byte 0xd /* DW_AT_language */
+ .ascii "p.adb\0" /* DW_AT_name */
+ .ascii "/tmp\0" /* DW_AT_comp_dir */
+ .4byte .Ltext0 /* DW_AT_low_pc */
+ .4byte .Letext0-.Ltext0 /* DW_AT_high_pc */
+.S0x142:
+ .uleb128 0x8 /* (DIE (0x142) DW_TAG_base_type) */
+ .byte 0x4 /* DW_AT_byte_size */
+ .byte 0x5 /* DW_AT_encoding */
+ .ascii "integer\0" /* DW_AT_name */
+
+ .uleb128 0x13 /* (DIE (0x1b4) DW_TAG_subprogram) */
+ /* DW_AT_external */
+ .ascii "p__top\0" /* DW_AT_name */
+ .byte 0x1 /* DW_AT_decl_file (p.adb) */
+ .byte 0x3 /* DW_AT_decl_line */
+ .4byte .LFB2 /* DW_AT_low_pc */
+ .4byte .LFE2-.LFB2 /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_AT_frame_base */
+ .byte 0x9c /* DW_OP_call_frame_cfa */
+ /* DW_AT_GNU_all_call_sites */
+ .4byte .S0x4fc - .Ldebug_info0 /* DW_AT_sibling */
+.S0x1e0:
+ .uleb128 0x15 /* (DIE (0x1e0) DW_TAG_subprogram) */
+ .ascii "p__top__middle\0" /* DW_AT_name */
+ .byte 0x1 /* DW_AT_decl_file (p.adb) */
+ .byte 0x4 /* DW_AT_decl_line */
+ .byte 0x1 /* DW_AT_inline */
+ .4byte .S0x374 - .Ldebug_info0 /* DW_AT_sibling */
+.S0x202:
+ .uleb128 0x15 /* (DIE (0x202) DW_TAG_subprogram) */
+ .ascii "p__top__middle__inside\0" /* DW_AT_name */
+ .byte 0x1 /* DW_AT_decl_file (p.adb) */
+ .byte 0x5 /* DW_AT_decl_line */
+ .byte 0x1 /* DW_AT_inline */
+ .4byte .S0x225 - .Ldebug_info0 /* DW_AT_sibling */
+ .byte 0 /* end of children of DIE 0x202 */
+.S0x225:
+ .uleb128 0x18 /* (DIE (0x225) DW_TAG_subprogram) */
+ .4byte .S0x202 - .Ldebug_info0 /* DW_AT_abstract_origin */
+ .4byte .LFB4 /* DW_AT_low_pc */
+ .4byte .LBE6-.LFB4 /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_AT_frame_base */
+ .byte 0x9c /* DW_OP_call_frame_cfa */
+ .uleb128 0x1 /* DW_AT_static_link */
+ .byte 0x56 /* DW_OP_reg6 */
+ /* DW_AT_GNU_all_call_sites */
+ .uleb128 0x1a /* (DIE (0x247) DW_TAG_inlined_subroutine) */
+ .4byte .S0x1e0 - .Ldebug_info0 /* DW_AT_abstract_origin */
+ .4byte .LFB4 /* DW_AT_low_pc */
+ .4byte .LBE6-.LFB4 /* DW_AT_high_pc */
+ .byte 0x1 /* DW_AT_call_file (p.adb) */
+ .byte 0x14 /* DW_AT_call_line */
+ .4byte .S0x374 - .Ldebug_info0 /* DW_AT_sibling */
+ .byte 0 /* end of children of DIE 0x247 */
+ .byte 0 /* end of children of DIE 0x225 */
+ .byte 0 /* end of children of DIE 0x1e0 */
+.S0x374:
+ .uleb128 0x23 /* (DIE (0x382) DW_TAG_inlined_subroutine) */
+ .4byte .S0x1e0 - .Ldebug_info0 /* DW_AT_abstract_origin */
+ .4byte .LFB4 /* DW_AT_low_pc */
+ .4byte .LBE6-.LFB4 /* DW_AT_high_pc */
+ .byte 0x1 /* DW_AT_call_file (p.adb) */
+ .byte 0x1d /* DW_AT_call_line */
+ .byte 0 /* end of children of DIE 0x382 */
+ .byte 0 /* end of children of DIE 0x1b4 */
+.S0x4fc:
+ .uleb128 0x28 /* (DIE (0x52e) DW_TAG_subprogram) */
+ /* DW_AT_external */
+ .ascii "__gnat_rcheck_PE_Explicit_Raise\0" /* DW_AT_name */
+ /* DW_AT_artificial */
+ /* DW_AT_declaration */
+ .byte 0 /* end of children of DIE 0x52e */
+ .byte 0 /* end of children of DIE 0xb */
+.Ledebug_info0:
+
+ .section .debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+ .uleb128 0x1 /* (abbrev code) */
+ .uleb128 0x11 /* (TAG: DW_TAG_compile_unit) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x25 /* (DW_AT_producer) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x13 /* (DW_AT_language) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x1b /* (DW_AT_comp_dir) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x11 /* (DW_AT_low_pc) */
+ .uleb128 0x1 /* (DW_FORM_addr) */
+ .uleb128 0x12 /* (DW_AT_high_pc) */
+ .uleb128 0x6 /* (DW_FORM_data4) */
+ .byte 0
+ .byte 0
+ .uleb128 0x8 /* (abbrev code) */
+ .uleb128 0x24 /* (TAG: DW_TAG_base_type) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0xb /* (DW_AT_byte_size) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3e /* (DW_AT_encoding) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .byte 0
+ .byte 0
+ .uleb128 0x13 /* (abbrev code) */
+ .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x3f /* (DW_AT_external) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x11 /* (DW_AT_low_pc) */
+ .uleb128 0x1 /* (DW_FORM_addr) */
+ .uleb128 0x12 /* (DW_AT_high_pc) */
+ .uleb128 0x6 /* (DW_FORM_data4) */
+ .uleb128 0x40 /* (DW_AT_frame_base) */
+ .uleb128 0x18 /* (DW_FORM_exprloc) */
+ .uleb128 0x2117 /* (DW_AT_GNU_all_call_sites) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .uleb128 0x1 /* (DW_AT_sibling) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .byte 0
+ .byte 0
+ .uleb128 0x15 /* (abbrev code) */
+ .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x20 /* (DW_AT_inline) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x1 /* (DW_AT_sibling) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .byte 0
+ .byte 0
+ .uleb128 0x18 /* (abbrev code) */
+ .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x31 /* (DW_AT_abstract_origin) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x11 /* (DW_AT_low_pc) */
+ .uleb128 0x1 /* (DW_FORM_addr) */
+ .uleb128 0x12 /* (DW_AT_high_pc) */
+ .uleb128 0x6 /* (DW_FORM_data4) */
+ .uleb128 0x40 /* (DW_AT_frame_base) */
+ .uleb128 0x18 /* (DW_FORM_exprloc) */
+ .uleb128 0x48 /* (DW_AT_static_link) */
+ .uleb128 0x18 /* (DW_FORM_exprloc) */
+ .uleb128 0x2117 /* (DW_AT_GNU_all_call_sites) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .byte 0
+ .byte 0
+ .uleb128 0x1a /* (abbrev code) */
+ .uleb128 0x1d /* (TAG: DW_TAG_inlined_subroutine) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x31 /* (DW_AT_abstract_origin) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x11 /* (DW_AT_low_pc) */
+ .uleb128 0x1 /* (DW_FORM_addr) */
+ .uleb128 0x12 /* (DW_AT_high_pc) */
+ .uleb128 0x6 /* (DW_FORM_data4) */
+ .uleb128 0x58 /* (DW_AT_call_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x59 /* (DW_AT_call_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x1 /* (DW_AT_sibling) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .byte 0
+ .byte 0
+ .uleb128 0x23 /* (abbrev code) */
+ .uleb128 0x1d /* (TAG: DW_TAG_inlined_subroutine) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x31 /* (DW_AT_abstract_origin) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x11 /* (DW_AT_low_pc) */
+ .uleb128 0x1 /* (DW_FORM_addr) */
+ .uleb128 0x12 /* (DW_AT_high_pc) */
+ .uleb128 0x6 /* (DW_FORM_data4) */
+ .uleb128 0x58 /* (DW_AT_call_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x59 /* (DW_AT_call_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .byte 0
+ .byte 0
+ .uleb128 0x28 /* (abbrev code) */
+ .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x3f /* (DW_AT_external) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x34 /* (DW_AT_artificial) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .uleb128 0x3c /* (DW_AT_declaration) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .byte 0
+ .byte 0
+ .byte 0
+ .byte 0
+ .byte 0
+
+ .section .debug_line
+.Lline1_begin:
+ .byte 0
+
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-icycle.c
@@ -0,0 +1,24 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2004-2014 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Dummy main function. */
+
+int
+main()
+{
+ return 0;
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-icycle.exp
@@ -0,0 +1,46 @@
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This test exercises PR 16581.
+
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if {![dwarf2_support]} {
+ return 0
+}
+
+standard_testfile .S .c
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} \
+ [list $srcfile $srcfile2] {nodebug}] } {
+ return -1
+}
+
+# We are trying to verify that the partial symtab to symtab expansion
+# for the debugging info hand-coded in our assembly file does not cause
+# the debugger to crash (infinite recursion). To facilitate the test,
+# start the debugger with -readnow. This force expansion as soon as
+# the objfile is loaded.
+
+set saved_gdbflags $GDBFLAGS
+set GDBFLAGS "$GDBFLAGS -readnow"
+clean_restart ${testfile}
+set GDBFLAGS $saved_gdbflags
+
+# And just to be sure that the debugger did not crash after having
+# expanded our symbols, do a life-check.
+
+gdb_test "echo life check\\n" "life check"

View File

@ -1,125 +0,0 @@
http://sourceware.org/ml/gdb-patches/2014-02/msg00729.html
Subject: [patch] [testsuite] Fix dw2-icycle.exp -fsanitize=address GDB crash
--WIyZ46R2i8wDzkSu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi Doug,
in fact obvious, I will check it in.
binutils readelf -wi:
<4><a2>: Abbrev Number: 26 (DW_TAG_inlined_subroutine)
<a3> DW_AT_abstract_origin: <0x5a>
<a7> DW_AT_low_pc : 0x400590
<ab> DW_AT_high_pc : 0x4
<af> DW_AT_call_file : 1
<b0> DW_AT_call_line : 20
<b1> DW_AT_sibling : <0xb8>
<2><b8>: Abbrev Number: 35 (DW_TAG_inlined_subroutine)
<b9> DW_AT_abstract_origin: <0x5a>
<bd> DW_AT_low_pc : 0x400590
<c1> DW_AT_high_pc : 0x4
<c5> DW_AT_call_file : 1
<c6> DW_AT_call_line : 29
<b1> DW_AT_sibling points to the next DIE - but that DIE is 2 levels
upwards - definitely not a sibling. This confuses GDB up to a crash:
==32143== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6024000198ac at pc 0xb4d104 bp 0x7fff63e96e70 sp 0x7fff63e96e60
READ of size 1 at 0x6024000198ac thread T0
#0 0xb4d103 in read_unsigned_leb128 (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb4d103)
#1 0xb15f3c in peek_die_abbrev (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb15f3c)
#2 0xb46185 in load_partial_dies (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb46185)
#3 0xb103fb in process_psymtab_comp_unit_reader (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb103fb)
#4 0xb0d2a9 in init_cutu_and_read_dies (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb0d2a9)
#5 0xb1115f in process_psymtab_comp_unit (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb1115f)
#6 0xb1235f in dwarf2_build_psymtabs_hard (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb1235f)
#7 0xb05536 in dwarf2_build_psymtabs (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb05536)
#8 0x86d5a5 in read_psyms (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x86d5a5)
#9 0x9b1c37 in require_partial_symbols (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9b1c37)
#10 0x9bf2d0 in read_symbols (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9bf2d0)
#11 0x9c014c in syms_from_objfile_1 (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9c014c)
I have added === Delete all DW_AT_sibling ===:
https://sourceware.org/gdb/wiki/GDBTestcaseCookbook?action=diff&rev2=31&rev1=30
Jan
--WIyZ46R2i8wDzkSu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline; filename="sibling.patch"
gdb/testsuite/
2014-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix dw2-icycle.exp -fsanitize=address GDB crash.
* gdb.dwarf2/dw2-icycle.S: Remove all DW_AT_sibling.
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-icycle.S b/gdb/testsuite/gdb.dwarf2/dw2-icycle.S
index 1f84e4a..938ff20 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-icycle.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-icycle.S
@@ -63,21 +63,18 @@ p__top:
.uleb128 0x1 /* DW_AT_frame_base */
.byte 0x9c /* DW_OP_call_frame_cfa */
/* DW_AT_GNU_all_call_sites */
- .4byte .S0x4fc - .Ldebug_info0 /* DW_AT_sibling */
.S0x1e0:
.uleb128 0x15 /* (DIE (0x1e0) DW_TAG_subprogram) */
.ascii "p__top__middle\0" /* DW_AT_name */
.byte 0x1 /* DW_AT_decl_file (p.adb) */
.byte 0x4 /* DW_AT_decl_line */
.byte 0x1 /* DW_AT_inline */
- .4byte .S0x374 - .Ldebug_info0 /* DW_AT_sibling */
.S0x202:
.uleb128 0x15 /* (DIE (0x202) DW_TAG_subprogram) */
.ascii "p__top__middle__inside\0" /* DW_AT_name */
.byte 0x1 /* DW_AT_decl_file (p.adb) */
.byte 0x5 /* DW_AT_decl_line */
.byte 0x1 /* DW_AT_inline */
- .4byte .S0x225 - .Ldebug_info0 /* DW_AT_sibling */
.byte 0 /* end of children of DIE 0x202 */
.S0x225:
.uleb128 0x18 /* (DIE (0x225) DW_TAG_subprogram) */
@@ -95,7 +92,6 @@ p__top:
.4byte .LBE6-.LFB4 /* DW_AT_high_pc */
.byte 0x1 /* DW_AT_call_file (p.adb) */
.byte 0x14 /* DW_AT_call_line */
- .4byte .S0x374 - .Ldebug_info0 /* DW_AT_sibling */
.byte 0 /* end of children of DIE 0x247 */
.byte 0 /* end of children of DIE 0x225 */
.byte 0 /* end of children of DIE 0x1e0 */
@@ -167,8 +163,6 @@ p__top:
.uleb128 0x18 /* (DW_FORM_exprloc) */
.uleb128 0x2117 /* (DW_AT_GNU_all_call_sites) */
.uleb128 0x19 /* (DW_FORM_flag_present) */
- .uleb128 0x1 /* (DW_AT_sibling) */
- .uleb128 0x13 /* (DW_FORM_ref4) */
.byte 0
.byte 0
.uleb128 0x15 /* (abbrev code) */
@@ -182,8 +176,6 @@ p__top:
.uleb128 0xb /* (DW_FORM_data1) */
.uleb128 0x20 /* (DW_AT_inline) */
.uleb128 0xb /* (DW_FORM_data1) */
- .uleb128 0x1 /* (DW_AT_sibling) */
- .uleb128 0x13 /* (DW_FORM_ref4) */
.byte 0
.byte 0
.uleb128 0x18 /* (abbrev code) */
@@ -216,8 +208,6 @@ p__top:
.uleb128 0xb /* (DW_FORM_data1) */
.uleb128 0x59 /* (DW_AT_call_line) */
.uleb128 0xb /* (DW_FORM_data1) */
- .uleb128 0x1 /* (DW_AT_sibling) */
- .uleb128 0x13 /* (DW_FORM_ref4) */
.byte 0
.byte 0
.uleb128 0x23 /* (abbrev code) */
--WIyZ46R2i8wDzkSu--

File diff suppressed because it is too large Load Diff

View File

@ -52,10 +52,10 @@ Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=bitpos-ensure-size_t.patch
Index: gdb-7.6.90.20140127/gdb/alpha-tdep.c
Index: gdb-7.7.90.20140613/gdb/alpha-tdep.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/alpha-tdep.c 2014-02-06 18:18:51.005616676 +0100
+++ gdb-7.6.90.20140127/gdb/alpha-tdep.c 2014-02-06 18:18:53.671621349 +0100
--- gdb-7.7.90.20140613.orig/gdb/alpha-tdep.c 2014-06-13 22:14:49.725846383 +0200
+++ gdb-7.7.90.20140613/gdb/alpha-tdep.c 2014-06-13 22:14:53.163850081 +0200
@@ -414,6 +414,13 @@ alpha_push_dummy_call (struct gdbarch *g
accumulate_size = 0;
else
@ -70,11 +70,11 @@ Index: gdb-7.6.90.20140127/gdb/alpha-tdep.c
sp -= accumulate_size;
/* Keep sp aligned to a multiple of 16 as the ABI requires. */
Index: gdb-7.6.90.20140127/gdb/cp-valprint.c
Index: gdb-7.7.90.20140613/gdb/cp-valprint.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/cp-valprint.c 2014-02-06 18:18:51.006616677 +0100
+++ gdb-7.6.90.20140127/gdb/cp-valprint.c 2014-02-06 18:18:53.671621349 +0100
@@ -537,6 +537,8 @@ cp_print_value (struct type *type, struc
--- gdb-7.7.90.20140613.orig/gdb/cp-valprint.c 2014-06-13 22:14:49.725846383 +0200
+++ gdb-7.7.90.20140613/gdb/cp-valprint.c 2014-06-13 22:14:53.164850081 +0200
@@ -538,6 +538,8 @@ cp_print_value (struct type *type, struc
gdb_byte *buf;
struct cleanup *back_to;
@ -83,11 +83,11 @@ Index: gdb-7.6.90.20140127/gdb/cp-valprint.c
buf = xmalloc (TYPE_LENGTH (baseclass));
back_to = make_cleanup (xfree, buf);
Index: gdb-7.6.90.20140127/gdb/dwarf2loc.c
Index: gdb-7.7.90.20140613/gdb/dwarf2loc.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/dwarf2loc.c 2014-02-06 18:18:51.007616678 +0100
+++ gdb-7.6.90.20140127/gdb/dwarf2loc.c 2014-02-06 18:18:53.672621293 +0100
@@ -1821,6 +1821,8 @@ read_pieced_value (struct value *v)
--- gdb-7.7.90.20140613.orig/gdb/dwarf2loc.c 2014-06-13 22:14:49.726846384 +0200
+++ gdb-7.7.90.20140613/gdb/dwarf2loc.c 2014-06-13 22:14:53.166850084 +0200
@@ -1666,6 +1666,8 @@ read_pieced_value (struct value *v)
this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8;
source_offset = source_offset_bits / 8;
@ -96,7 +96,7 @@ Index: gdb-7.6.90.20140127/gdb/dwarf2loc.c
if (buffer_size < this_size)
{
buffer_size = this_size;
@@ -2012,6 +2014,7 @@ write_pieced_value (struct value *to, st
@@ -1857,6 +1859,7 @@ write_pieced_value (struct value *to, st
}
else
{
@ -104,10 +104,10 @@ Index: gdb-7.6.90.20140127/gdb/dwarf2loc.c
if (buffer_size < this_size)
{
buffer_size = this_size;
Index: gdb-7.6.90.20140127/gdb/findcmd.c
Index: gdb-7.7.90.20140613/gdb/findcmd.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/findcmd.c 2014-02-06 18:18:51.008616679 +0100
+++ gdb-7.6.90.20140127/gdb/findcmd.c 2014-02-06 18:18:53.673621239 +0100
--- gdb-7.7.90.20140613.orig/gdb/findcmd.c 2014-06-13 22:14:49.726846384 +0200
+++ gdb-7.7.90.20140613/gdb/findcmd.c 2014-06-13 22:14:53.166850084 +0200
@@ -185,6 +185,7 @@ parse_find_args (char *args, ULONGEST *m
size_t current_offset = pattern_buf_end - pattern_buf;
@ -116,11 +116,11 @@ Index: gdb-7.6.90.20140127/gdb/findcmd.c
pattern_buf = xrealloc (pattern_buf, pattern_buf_size);
pattern_buf_end = pattern_buf + current_offset;
}
Index: gdb-7.6.90.20140127/gdb/p-valprint.c
Index: gdb-7.7.90.20140613/gdb/p-valprint.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/p-valprint.c 2014-02-06 18:18:51.008616679 +0100
+++ gdb-7.6.90.20140127/gdb/p-valprint.c 2014-02-06 18:18:53.673621239 +0100
@@ -798,6 +798,7 @@ pascal_object_print_value (struct type *
--- gdb-7.7.90.20140613.orig/gdb/p-valprint.c 2014-06-13 22:14:49.728846387 +0200
+++ gdb-7.7.90.20140613/gdb/p-valprint.c 2014-06-13 22:14:53.166850084 +0200
@@ -772,6 +772,7 @@ pascal_object_print_value (struct type *
gdb_byte *buf;
struct cleanup *back_to;
@ -128,12 +128,12 @@ Index: gdb-7.6.90.20140127/gdb/p-valprint.c
buf = xmalloc (TYPE_LENGTH (baseclass));
back_to = make_cleanup (xfree, buf);
Index: gdb-7.6.90.20140127/gdb/utils.c
Index: gdb-7.7.90.20140613/gdb/utils.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/utils.c 2014-02-06 18:18:51.008616679 +0100
+++ gdb-7.6.90.20140127/gdb/utils.c 2014-02-06 18:18:53.674621186 +0100
@@ -3169,6 +3169,18 @@ host_address_to_string (const void *addr
return str;
--- gdb-7.7.90.20140613.orig/gdb/utils.c 2014-06-13 22:14:53.166850084 +0200
+++ gdb-7.7.90.20140613/gdb/utils.c 2014-06-13 22:15:16.839875341 +0200
@@ -2838,6 +2838,18 @@ string_to_core_addr (const char *my_stri
return addr;
}
+/* Ensure that the input NUM is not larger than the maximum capacity of the
@ -151,11 +151,11 @@ Index: gdb-7.6.90.20140127/gdb/utils.c
char *
gdb_realpath (const char *filename)
{
Index: gdb-7.6.90.20140127/gdb/valops.c
Index: gdb-7.7.90.20140613/gdb/valops.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/valops.c 2014-02-06 18:18:51.009616680 +0100
+++ gdb-7.6.90.20140127/gdb/valops.c 2014-02-06 18:18:53.675621135 +0100
@@ -2184,6 +2184,7 @@ search_struct_method (const char *name,
--- gdb-7.7.90.20140613.orig/gdb/valops.c 2014-06-13 22:14:49.730846389 +0200
+++ gdb-7.7.90.20140613/gdb/valops.c 2014-06-13 22:14:53.169850088 +0200
@@ -2074,6 +2074,7 @@ search_struct_method (const char *name,
struct cleanup *back_to;
CORE_ADDR address;
@ -163,11 +163,11 @@ Index: gdb-7.6.90.20140127/gdb/valops.c
tmp = xmalloc (TYPE_LENGTH (baseclass));
back_to = make_cleanup (xfree, tmp);
address = value_address (*arg1p);
Index: gdb-7.6.90.20140127/gdb/value.c
Index: gdb-7.7.90.20140613/gdb/value.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/value.c 2014-02-06 18:18:51.010616681 +0100
+++ gdb-7.6.90.20140127/gdb/value.c 2014-02-06 18:19:10.261637398 +0100
@@ -822,6 +822,7 @@ allocate_value_lazy (struct type *type)
--- gdb-7.7.90.20140613.orig/gdb/value.c 2014-06-13 22:14:49.732846391 +0200
+++ gdb-7.7.90.20140613/gdb/value.c 2014-06-13 22:14:53.169850088 +0200
@@ -824,6 +824,7 @@ allocate_value_lazy (struct type *type)
description correctly. */
check_typedef (type);
@ -175,7 +175,7 @@ Index: gdb-7.6.90.20140127/gdb/value.c
val = (struct value *) xzalloc (sizeof (struct value));
val->contents = NULL;
val->next = all_values;
@@ -853,6 +854,8 @@ allocate_value_lazy (struct type *type)
@@ -855,6 +856,8 @@ allocate_value_lazy (struct type *type)
static void
allocate_value_contents (struct value *val)
{
@ -184,7 +184,7 @@ Index: gdb-7.6.90.20140127/gdb/value.c
if (!val->contents)
val->contents = (gdb_byte *) xzalloc (TYPE_LENGTH (val->enclosing_type));
}
@@ -2854,8 +2857,12 @@ void
@@ -2831,8 +2834,12 @@ void
set_value_enclosing_type (struct value *val, struct type *new_encl_type)
{
if (TYPE_LENGTH (new_encl_type) > TYPE_LENGTH (value_enclosing_type (val)))
@ -199,10 +199,10 @@ Index: gdb-7.6.90.20140127/gdb/value.c
val->enclosing_type = new_encl_type;
}
Index: gdb-7.6.90.20140127/gdb/vax-tdep.c
Index: gdb-7.7.90.20140613/gdb/vax-tdep.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/vax-tdep.c 2014-02-06 18:18:51.370617068 +0100
+++ gdb-7.6.90.20140127/gdb/vax-tdep.c 2014-02-06 18:18:53.676621086 +0100
--- gdb-7.7.90.20140613.orig/gdb/vax-tdep.c 2014-06-13 22:14:49.732846391 +0200
+++ gdb-7.7.90.20140613/gdb/vax-tdep.c 2014-06-13 22:14:53.169850088 +0200
@@ -223,6 +223,7 @@ vax_return_value (struct gdbarch *gdbarc
ULONGEST addr;
@ -211,11 +211,11 @@ Index: gdb-7.6.90.20140127/gdb/vax-tdep.c
read_memory (addr, readbuf, len);
}
Index: gdb-7.6.90.20140127/gdb/defs.h
Index: gdb-7.7.90.20140613/gdb/defs.h
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/defs.h 2014-02-06 18:18:51.370617068 +0100
+++ gdb-7.6.90.20140127/gdb/defs.h 2014-02-06 18:18:53.677621038 +0100
@@ -768,4 +768,6 @@ enum block_enum
--- gdb-7.7.90.20140613.orig/gdb/defs.h 2014-06-13 22:14:49.732846391 +0200
+++ gdb-7.7.90.20140613/gdb/defs.h 2014-06-13 22:14:53.169850088 +0200
@@ -756,4 +756,6 @@ enum block_enum
#include "utils.h"

View File

@ -96,29 +96,11 @@ Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=bitpos-wp.patch
Index: gdb-7.7.1/gdb/arm-linux-nat.c
Index: gdb-7.7.90.20140613/gdb/arm-linux-nat.c
===================================================================
--- gdb-7.7.1.orig/gdb/arm-linux-nat.c 2014-05-30 23:24:14.728103476 +0200
+++ gdb-7.7.1/gdb/arm-linux-nat.c 2014-05-30 23:24:14.783103499 +0200
@@ -1105,7 +1105,7 @@ arm_linux_region_ok_for_hw_watchpoint (C
/* Insert a Hardware breakpoint. */
static int
-arm_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
+arm_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int rw,
struct expression *cond)
{
struct lwp_info *lp;
@@ -1123,7 +1123,7 @@ arm_linux_insert_watchpoint (CORE_ADDR a
/* Remove a hardware breakpoint. */
static int
-arm_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
+arm_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int rw,
struct expression *cond)
{
struct lwp_info *lp;
@@ -1180,7 +1180,7 @@ arm_linux_stopped_by_watchpoint (void)
--- gdb-7.7.90.20140613.orig/gdb/arm-linux-nat.c 2014-06-13 22:23:09.630440699 +0200
+++ gdb-7.7.90.20140613/gdb/arm-linux-nat.c 2014-06-13 22:23:54.666492199 +0200
@@ -1296,7 +1296,7 @@ arm_linux_stopped_by_watchpoint (struct
static int
arm_linux_watchpoint_addr_within_range (struct target_ops *target,
CORE_ADDR addr,
@ -127,151 +109,11 @@ Index: gdb-7.7.1/gdb/arm-linux-nat.c
{
return start <= addr && start + length - 1 >= addr;
}
Index: gdb-7.7.1/gdb/i386-nat.c
Index: gdb-7.7.90.20140613/gdb/ppc-linux-nat.c
===================================================================
--- gdb-7.7.1.orig/gdb/i386-nat.c 2014-05-30 23:24:14.742103482 +0200
+++ gdb-7.7.1/gdb/i386-nat.c 2014-05-30 23:24:14.783103499 +0200
@@ -589,7 +589,7 @@ i386_update_inferior_debug_regs (struct
of the type TYPE. Return 0 on success, -1 on failure. */
static int
-i386_insert_watchpoint (CORE_ADDR addr, int len, int type,
+i386_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
struct i386_debug_reg_state *state
@@ -627,7 +627,7 @@ i386_insert_watchpoint (CORE_ADDR addr,
address ADDR, whose length is LEN bytes, and for accesses of the
type TYPE. Return 0 on success, -1 on failure. */
static int
-i386_remove_watchpoint (CORE_ADDR addr, int len, int type,
+i386_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
struct i386_debug_reg_state *state
Index: gdb-7.7.1/gdb/ia64-linux-nat.c
===================================================================
--- gdb-7.7.1.orig/gdb/ia64-linux-nat.c 2014-05-05 23:51:24.000000000 +0200
+++ gdb-7.7.1/gdb/ia64-linux-nat.c 2014-05-30 23:24:14.784103500 +0200
@@ -542,7 +542,7 @@ is_power_of_2 (int val)
}
static int
-ia64_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
+ia64_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int rw,
struct expression *cond)
{
struct lwp_info *lp;
@@ -596,7 +596,7 @@ ia64_linux_insert_watchpoint (CORE_ADDR
}
static int
-ia64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type,
+ia64_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
int idx;
Index: gdb-7.7.1/gdb/inf-ttrace.c
===================================================================
--- gdb-7.7.1.orig/gdb/inf-ttrace.c 2014-05-30 23:24:14.742103482 +0200
+++ gdb-7.7.1/gdb/inf-ttrace.c 2014-05-30 23:24:14.784103500 +0200
@@ -314,14 +314,14 @@ inf_ttrace_disable_page_protections (pid
type TYPE. */
static int
-inf_ttrace_insert_watchpoint (CORE_ADDR addr, int len, int type,
+inf_ttrace_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
const int pagesize = inf_ttrace_page_dict.pagesize;
pid_t pid = ptid_get_pid (inferior_ptid);
CORE_ADDR page_addr;
- int num_pages;
- int page;
+ LONGEST num_pages;
+ LONGEST page;
gdb_assert (type == hw_write);
@@ -338,14 +338,14 @@ inf_ttrace_insert_watchpoint (CORE_ADDR
type TYPE. */
static int
-inf_ttrace_remove_watchpoint (CORE_ADDR addr, int len, int type,
+inf_ttrace_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
const int pagesize = inf_ttrace_page_dict.pagesize;
pid_t pid = ptid_get_pid (inferior_ptid);
CORE_ADDR page_addr;
- int num_pages;
- int page;
+ LONGEST num_pages;
+ LONGEST page;
gdb_assert (type == hw_write);
Index: gdb-7.7.1/gdb/mips-linux-nat.c
===================================================================
--- gdb-7.7.1.orig/gdb/mips-linux-nat.c 2014-05-30 23:24:14.744103483 +0200
+++ gdb-7.7.1/gdb/mips-linux-nat.c 2014-05-30 23:24:14.784103500 +0200
@@ -644,7 +644,7 @@ mips_linux_new_thread (struct lwp_info *
watch. Return zero on success. */
static int
-mips_linux_insert_watchpoint (CORE_ADDR addr, int len, int type,
+mips_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
struct pt_watch_regs regs;
@@ -697,7 +697,7 @@ mips_linux_insert_watchpoint (CORE_ADDR
Return zero on success. */
static int
-mips_linux_remove_watchpoint (CORE_ADDR addr, int len, int type,
+mips_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
int retval;
Index: gdb-7.7.1/gdb/nto-procfs.c
===================================================================
--- gdb-7.7.1.orig/gdb/nto-procfs.c 2014-05-05 23:51:24.000000000 +0200
+++ gdb-7.7.1/gdb/nto-procfs.c 2014-05-30 23:24:14.785103500 +0200
@@ -69,10 +69,10 @@ static ptid_t do_attach (ptid_t ptid);
static int procfs_can_use_hw_breakpoint (int, int, int);
-static int procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type,
+static int procfs_insert_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond);
-static int procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type,
+static int procfs_remove_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond);
static int procfs_stopped_by_watchpoint (void);
@@ -1494,14 +1494,14 @@ procfs_can_use_hw_breakpoint (int type,
}
static int
-procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type,
+procfs_remove_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
return procfs_hw_watchpoint (addr, -1, type);
}
static int
-procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type,
+procfs_insert_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
return procfs_hw_watchpoint (addr, len, type);
Index: gdb-7.7.1/gdb/ppc-linux-nat.c
===================================================================
--- gdb-7.7.1.orig/gdb/ppc-linux-nat.c 2014-05-30 23:24:14.745103483 +0200
+++ gdb-7.7.1/gdb/ppc-linux-nat.c 2014-05-30 23:24:14.786103501 +0200
@@ -1853,11 +1853,11 @@ can_use_watchpoint_cond_accel (void)
--- gdb-7.7.90.20140613.orig/gdb/ppc-linux-nat.c 2014-06-13 22:23:09.635440704 +0200
+++ gdb-7.7.90.20140613/gdb/ppc-linux-nat.c 2014-06-13 22:23:54.672492206 +0200
@@ -1857,11 +1857,11 @@ can_use_watchpoint_cond_accel (void)
CONDITION_VALUE will hold the value which should be put in the
DVC register. */
static void
@ -286,7 +128,7 @@ Index: gdb-7.7.1/gdb/ppc-linux-nat.c
CORE_ADDR addr_end_data, addr_end_dvc;
/* The DVC register compares bytes within fixed-length windows which
@@ -1944,7 +1944,7 @@ num_memory_accesses (struct value *v)
@@ -1948,7 +1948,7 @@ num_memory_accesses (struct value *v)
of the constant. */
static int
check_condition (CORE_ADDR watch_addr, struct expression *cond,
@ -295,16 +137,7 @@ Index: gdb-7.7.1/gdb/ppc-linux-nat.c
{
int pc = 1, num_accesses_left, num_accesses_right;
struct value *left_val, *right_val, *left_chain, *right_chain;
@@ -2011,7 +2011,7 @@ check_condition (CORE_ADDR watch_addr, s
the condition expression, thus only triggering the watchpoint when it is
true. */
static int
-ppc_linux_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw,
+ppc_linux_can_accel_watchpoint_condition (CORE_ADDR addr, LONGEST len, int rw,
struct expression *cond)
{
CORE_ADDR data_value;
@@ -2028,7 +2028,7 @@ ppc_linux_can_accel_watchpoint_condition
@@ -2033,7 +2033,7 @@ ppc_linux_can_accel_watchpoint_condition
static void
create_watchpoint_request (struct ppc_hw_breakpoint *p, CORE_ADDR addr,
@ -313,25 +146,7 @@ Index: gdb-7.7.1/gdb/ppc-linux-nat.c
int insert)
{
if (len == 1
@@ -2073,7 +2073,7 @@ create_watchpoint_request (struct ppc_hw
}
static int
-ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
+ppc_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int rw,
struct expression *cond)
{
struct lwp_info *lp;
@@ -2141,7 +2141,7 @@ ppc_linux_insert_watchpoint (CORE_ADDR a
}
static int
-ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
+ppc_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int rw,
struct expression *cond)
{
struct lwp_info *lp;
@@ -2292,7 +2292,7 @@ ppc_linux_stopped_by_watchpoint (void)
@@ -2299,7 +2299,7 @@ ppc_linux_stopped_by_watchpoint (struct
static int
ppc_linux_watchpoint_addr_within_range (struct target_ops *target,
CORE_ADDR addr,
@ -340,11 +155,11 @@ Index: gdb-7.7.1/gdb/ppc-linux-nat.c
{
int mask;
Index: gdb-7.7.1/gdb/procfs.c
Index: gdb-7.7.90.20140613/gdb/procfs.c
===================================================================
--- gdb-7.7.1.orig/gdb/procfs.c 2014-05-30 23:24:14.746103484 +0200
+++ gdb-7.7.1/gdb/procfs.c 2014-05-30 23:24:14.787103501 +0200
@@ -2428,7 +2428,7 @@ procfs_address_to_host_pointer (CORE_ADD
--- gdb-7.7.90.20140613.orig/gdb/procfs.c 2014-06-13 22:23:09.638440708 +0200
+++ gdb-7.7.90.20140613/gdb/procfs.c 2014-06-13 22:23:54.673492207 +0200
@@ -2429,7 +2429,7 @@ procfs_address_to_host_pointer (CORE_ADD
#endif
static int
@ -353,7 +168,7 @@ Index: gdb-7.7.1/gdb/procfs.c
{
#if !defined (PCWATCH) && !defined (PIOCSWATCH)
/* If neither or these is defined, we can't support watchpoints.
@@ -4774,7 +4774,7 @@ procfs_pid_to_str (struct target_ops *op
@@ -4762,7 +4762,7 @@ procfs_pid_to_str (struct target_ops *op
/* Insert a watchpoint. */
static int
@ -362,102 +177,11 @@ Index: gdb-7.7.1/gdb/procfs.c
int after)
{
#ifndef AIX5
@@ -4895,7 +4895,7 @@ procfs_stopped_data_address (struct targ
}
static int
-procfs_insert_watchpoint (CORE_ADDR addr, int len, int type,
+procfs_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
if (!target_have_steppable_watchpoint
@@ -4917,7 +4917,7 @@ procfs_insert_watchpoint (CORE_ADDR addr
}
static int
-procfs_remove_watchpoint (CORE_ADDR addr, int len, int type,
+procfs_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
return procfs_set_watchpoint (inferior_ptid, addr, 0, 0, 0);
Index: gdb-7.7.1/gdb/remote-m32r-sdi.c
Index: gdb-7.7.90.20140613/gdb/remote.c
===================================================================
--- gdb-7.7.1.orig/gdb/remote-m32r-sdi.c 2014-05-05 23:51:24.000000000 +0200
+++ gdb-7.7.1/gdb/remote-m32r-sdi.c 2014-05-30 23:24:14.788103502 +0200
@@ -1415,14 +1415,15 @@ m32r_can_use_hw_watchpoint (int type, in
watchpoint. */
static int
-m32r_insert_watchpoint (CORE_ADDR addr, int len, int type,
+m32r_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
int i;
if (remote_debug)
- fprintf_unfiltered (gdb_stdlog, "m32r_insert_watchpoint(%s,%d,%d)\n",
- paddress (target_gdbarch (), addr), len, type);
+ fprintf_unfiltered (gdb_stdlog, "m32r_insert_watchpoint(%s,%s,%d)\n",
+ paddress (target_gdbarch (), addr), plongest (len),
+ type);
for (i = 0; i < MAX_ACCESS_BREAKS; i++)
{
@@ -1440,14 +1441,15 @@ m32r_insert_watchpoint (CORE_ADDR addr,
}
static int
-m32r_remove_watchpoint (CORE_ADDR addr, int len, int type,
+m32r_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
int i;
if (remote_debug)
- fprintf_unfiltered (gdb_stdlog, "m32r_remove_watchpoint(%s,%d,%d)\n",
- paddress (target_gdbarch (), addr), len, type);
+ fprintf_unfiltered (gdb_stdlog, "m32r_remove_watchpoint(%s,%s,%d)\n",
+ paddress (target_gdbarch (), addr), plongest (len),
+ type);
for (i = 0; i < MAX_ACCESS_BREAKS; i++)
{
Index: gdb-7.7.1/gdb/remote-mips.c
===================================================================
--- gdb-7.7.1.orig/gdb/remote-mips.c 2014-05-05 23:51:24.000000000 +0200
+++ gdb-7.7.1/gdb/remote-mips.c 2014-05-30 23:24:14.789103502 +0200
@@ -2424,7 +2424,7 @@ calculate_mask (CORE_ADDR addr, int len)
watchpoint. */
static int
-mips_insert_watchpoint (CORE_ADDR addr, int len, int type,
+mips_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
if (mips_set_breakpoint (addr, len, type))
@@ -2436,7 +2436,7 @@ mips_insert_watchpoint (CORE_ADDR addr,
/* Remove a watchpoint. */
static int
-mips_remove_watchpoint (CORE_ADDR addr, int len, int type,
+mips_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
if (mips_clear_breakpoint (addr, len, type))
Index: gdb-7.7.1/gdb/remote.c
===================================================================
--- gdb-7.7.1.orig/gdb/remote.c 2014-05-30 23:24:14.748103484 +0200
+++ gdb-7.7.1/gdb/remote.c 2014-05-30 23:24:14.791103503 +0200
@@ -8322,7 +8322,7 @@ watchpoint_to_Z_packet (int type)
}
static int
-remote_insert_watchpoint (CORE_ADDR addr, int len, int type,
+remote_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
struct remote_state *rs = get_remote_state ();
@@ -8342,7 +8342,7 @@ remote_insert_watchpoint (CORE_ADDR addr
--- gdb-7.7.90.20140613.orig/gdb/remote.c 2014-06-13 22:23:09.643440713 +0200
+++ gdb-7.7.90.20140613/gdb/remote.c 2014-06-13 22:23:54.680492215 +0200
@@ -8199,7 +8199,7 @@ remote_insert_watchpoint (struct target_
p = strchr (rs->buf, '\0');
addr = remote_address_masked (addr);
p += hexnumstr (p, (ULONGEST) addr);
@ -466,7 +190,7 @@ Index: gdb-7.7.1/gdb/remote.c
putpkt (rs->buf);
getpkt (&rs->buf, &rs->buf_size, 0);
@@ -8362,7 +8362,7 @@ remote_insert_watchpoint (CORE_ADDR addr
@@ -8219,7 +8219,7 @@ remote_insert_watchpoint (struct target_
static int
remote_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr,
@ -475,16 +199,7 @@ Index: gdb-7.7.1/gdb/remote.c
{
CORE_ADDR diff = remote_address_masked (addr - start);
@@ -8371,7 +8371,7 @@ remote_watchpoint_addr_within_range (str
static int
-remote_remove_watchpoint (CORE_ADDR addr, int len, int type,
+remote_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
struct remote_state *rs = get_remote_state ();
@@ -8391,7 +8391,7 @@ remote_remove_watchpoint (CORE_ADDR addr
@@ -8249,7 +8249,7 @@ remote_remove_watchpoint (struct target_
p = strchr (rs->buf, '\0');
addr = remote_address_masked (addr);
p += hexnumstr (p, (ULONGEST) addr);
@ -493,92 +208,29 @@ Index: gdb-7.7.1/gdb/remote.c
putpkt (rs->buf);
getpkt (&rs->buf, &rs->buf_size, 0);
Index: gdb-7.7.1/gdb/s390-linux-nat.c
Index: gdb-7.7.90.20140613/gdb/target.c
===================================================================
--- gdb-7.7.1.orig/gdb/s390-linux-nat.c 2014-05-30 23:24:14.754103487 +0200
+++ gdb-7.7.1/gdb/s390-linux-nat.c 2014-05-30 23:24:14.791103503 +0200
@@ -508,7 +508,7 @@ s390_fix_watch_points (struct lwp_info *
}
static int
-s390_insert_watchpoint (CORE_ADDR addr, int len, int type,
+s390_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
struct lwp_info *lp;
@@ -529,7 +529,7 @@ s390_insert_watchpoint (CORE_ADDR addr,
}
static int
-s390_remove_watchpoint (CORE_ADDR addr, int len, int type,
+s390_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
struct lwp_info *lp;
Index: gdb-7.7.1/gdb/target.c
===================================================================
--- gdb-7.7.1.orig/gdb/target.c 2014-05-30 23:24:14.750103485 +0200
+++ gdb-7.7.1/gdb/target.c 2014-05-30 23:24:14.792103503 +0200
@@ -50,7 +50,7 @@ static void target_info (char *, int);
static void default_terminal_info (const char *, int);
--- gdb-7.7.90.20140613.orig/gdb/target.c 2014-06-13 22:23:09.645440716 +0200
+++ gdb-7.7.90.20140613/gdb/target.c 2014-06-13 22:26:24.077661601 +0200
@@ -52,7 +52,7 @@ static void target_info (char *, int);
static void default_terminal_info (struct target_ops *, const char *, int);
static int default_watchpoint_addr_within_range (struct target_ops *,
- CORE_ADDR, CORE_ADDR, int);
+ CORE_ADDR, CORE_ADDR, LONGEST);
static int default_region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST);
@@ -103,10 +103,10 @@ static int debug_to_insert_hw_breakpoint
static int debug_to_remove_hw_breakpoint (struct gdbarch *,
struct bp_target_info *);
-static int debug_to_insert_watchpoint (CORE_ADDR, int, int,
+static int debug_to_insert_watchpoint (CORE_ADDR, LONGEST, int,
struct expression *);
-static int debug_to_remove_watchpoint (CORE_ADDR, int, int,
+static int debug_to_remove_watchpoint (CORE_ADDR, LONGEST, int,
struct expression *);
static int debug_to_stopped_by_watchpoint (void);
@@ -114,11 +114,12 @@ static int debug_to_stopped_by_watchpoin
static int default_region_ok_for_hw_watchpoint (struct target_ops *,
CORE_ADDR, LONGEST);
@@ -150,7 +150,7 @@ static int debug_to_remove_watchpoint (s
static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *);
static int debug_to_watchpoint_addr_within_range (struct target_ops *,
- CORE_ADDR, CORE_ADDR, int);
+ CORE_ADDR, CORE_ADDR,
+ LONGEST);
+ CORE_ADDR, CORE_ADDR, LONGEST);
static int debug_to_region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST);
-static int debug_to_can_accel_watchpoint_condition (CORE_ADDR, int, int,
+static int debug_to_can_accel_watchpoint_condition (CORE_ADDR, LONGEST, int,
struct expression *);
static void debug_to_terminal_init (void);
@@ -739,10 +740,10 @@ update_current_target (void)
(int (*) (struct gdbarch *, struct bp_target_info *))
return_minus_one);
de_fault (to_insert_watchpoint,
- (int (*) (CORE_ADDR, int, int, struct expression *))
+ (int (*) (CORE_ADDR, LONGEST, int, struct expression *))
return_minus_one);
de_fault (to_remove_watchpoint,
- (int (*) (CORE_ADDR, int, int, struct expression *))
+ (int (*) (CORE_ADDR, LONGEST, int, struct expression *))
return_minus_one);
de_fault (to_stopped_by_watchpoint,
(int (*) (void))
@@ -755,7 +756,7 @@ update_current_target (void)
de_fault (to_region_ok_for_hw_watchpoint,
default_region_ok_for_hw_watchpoint);
de_fault (to_can_accel_watchpoint_condition,
- (int (*) (CORE_ADDR, int, int, struct expression *))
+ (int (*) (CORE_ADDR, LONGEST, int, struct expression *))
return_zero);
de_fault (to_terminal_init,
(void (*) (void))
@@ -3598,7 +3599,7 @@ default_region_ok_for_hw_watchpoint (COR
static int debug_to_region_ok_for_hw_watchpoint (struct target_ops *self,
CORE_ADDR, LONGEST);
@@ -2959,7 +2959,7 @@ default_region_ok_for_hw_watchpoint (str
static int
default_watchpoint_addr_within_range (struct target_ops *target,
CORE_ADDR addr,
@ -587,16 +239,7 @@ Index: gdb-7.7.1/gdb/target.c
{
return addr >= start && addr < start + length;
}
@@ -4571,7 +4572,7 @@ debug_to_region_ok_for_hw_watchpoint (CO
}
static int
-debug_to_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw,
+debug_to_can_accel_watchpoint_condition (CORE_ADDR addr, LONGEST len, int rw,
struct expression *cond)
{
int retval;
@@ -4581,8 +4582,8 @@ debug_to_can_accel_watchpoint_condition
@@ -3691,8 +3691,8 @@ debug_to_can_accel_watchpoint_condition
fprintf_unfiltered (gdb_stdlog,
"target_can_accel_watchpoint_condition "
@ -607,7 +250,7 @@ Index: gdb-7.7.1/gdb/target.c
host_address_to_string (cond), (unsigned long) retval);
return retval;
}
@@ -4617,7 +4618,7 @@ debug_to_stopped_data_address (struct ta
@@ -3727,7 +3727,7 @@ debug_to_stopped_data_address (struct ta
static int
debug_to_watchpoint_addr_within_range (struct target_ops *target,
CORE_ADDR addr,
@ -616,7 +259,7 @@ Index: gdb-7.7.1/gdb/target.c
{
int retval;
@@ -4625,9 +4626,9 @@ debug_to_watchpoint_addr_within_range (s
@@ -3735,9 +3735,9 @@ debug_to_watchpoint_addr_within_range (s
start, length);
fprintf_filtered (gdb_stdlog,
@ -628,79 +271,23 @@ Index: gdb-7.7.1/gdb/target.c
return retval;
}
@@ -4662,7 +4663,7 @@ debug_to_remove_hw_breakpoint (struct gd
}
static int
-debug_to_insert_watchpoint (CORE_ADDR addr, int len, int type,
+debug_to_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
int retval;
@@ -4670,14 +4671,14 @@ debug_to_insert_watchpoint (CORE_ADDR ad
retval = debug_target.to_insert_watchpoint (addr, len, type, cond);
fprintf_unfiltered (gdb_stdlog,
- "target_insert_watchpoint (%s, %d, %d, %s) = %ld\n",
- core_addr_to_string (addr), len, type,
+ "target_insert_watchpoint (%s, %s, %d, %s) = %ld\n",
+ core_addr_to_string (addr), plongest (len), type,
host_address_to_string (cond), (unsigned long) retval);
return retval;
}
static int
-debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type,
+debug_to_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
int retval;
@@ -4685,8 +4686,8 @@ debug_to_remove_watchpoint (CORE_ADDR ad
retval = debug_target.to_remove_watchpoint (addr, len, type, cond);
fprintf_unfiltered (gdb_stdlog,
- "target_remove_watchpoint (%s, %d, %d, %s) = %ld\n",
- core_addr_to_string (addr), len, type,
+ "target_remove_watchpoint (%s, %s, %d, %s) = %ld\n",
+ core_addr_to_string (addr), plongest (len), type,
host_address_to_string (cond), (unsigned long) retval);
return retval;
}
Index: gdb-7.7.1/gdb/target.h
Index: gdb-7.7.90.20140613/gdb/target.h
===================================================================
--- gdb-7.7.1.orig/gdb/target.h 2014-05-30 23:24:14.750103485 +0200
+++ gdb-7.7.1/gdb/target.h 2014-05-30 23:24:14.793103504 +0200
@@ -412,8 +412,8 @@ struct target_ops
/* Documentation of what the two routines below are expected to do is
provided with the corresponding target_* macros. */
- int (*to_remove_watchpoint) (CORE_ADDR, int, int, struct expression *);
- int (*to_insert_watchpoint) (CORE_ADDR, int, int, struct expression *);
+ int (*to_remove_watchpoint) (CORE_ADDR, LONGEST, int, struct expression *);
+ int (*to_insert_watchpoint) (CORE_ADDR, LONGEST, int, struct expression *);
int (*to_insert_mask_watchpoint) (struct target_ops *,
CORE_ADDR, CORE_ADDR, int);
@@ -424,13 +424,13 @@ struct target_ops
int to_have_continuable_watchpoint;
int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *);
--- gdb-7.7.90.20140613.orig/gdb/target.h 2014-06-13 22:23:54.683492219 +0200
+++ gdb-7.7.90.20140613/gdb/target.h 2014-06-13 22:25:41.372613039 +0200
@@ -469,7 +469,7 @@ struct target_ops
int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *)
TARGET_DEFAULT_RETURN (0);
int (*to_watchpoint_addr_within_range) (struct target_ops *,
- CORE_ADDR, CORE_ADDR, int);
+ CORE_ADDR, CORE_ADDR, LONGEST);
- CORE_ADDR, CORE_ADDR, int)
+ CORE_ADDR, CORE_ADDR, LONGEST)
TARGET_DEFAULT_FUNC (default_watchpoint_addr_within_range);
/* Documentation of this routine is provided with the corresponding
target_* macro. */
int (*to_region_ok_for_hw_watchpoint) (CORE_ADDR, LONGEST);
- int (*to_can_accel_watchpoint_condition) (CORE_ADDR, int, int,
+ int (*to_can_accel_watchpoint_condition) (CORE_ADDR, LONGEST, int,
struct expression *);
int (*to_masked_watch_num_registers) (struct target_ops *,
CORE_ADDR, CORE_ADDR);
Index: gdb-7.7.1/gdb/aarch64-linux-nat.c
Index: gdb-7.7.90.20140613/gdb/aarch64-linux-nat.c
===================================================================
--- gdb-7.7.1.orig/gdb/aarch64-linux-nat.c 2014-05-30 23:30:49.088277930 +0200
+++ gdb-7.7.1/gdb/aarch64-linux-nat.c 2014-05-30 23:30:56.911280725 +0200
--- gdb-7.7.90.20140613.orig/gdb/aarch64-linux-nat.c 2014-06-13 22:23:09.647440718 +0200
+++ gdb-7.7.90.20140613/gdb/aarch64-linux-nat.c 2014-06-13 22:23:54.683492219 +0200
@@ -428,14 +428,14 @@ aarch64_notify_debug_reg_change (const s
static void
aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state,
@ -719,7 +306,7 @@ Index: gdb-7.7.1/gdb/aarch64-linux-nat.c
type == hw_write ? "hw-write-watchpoint"
: (type == hw_read ? "hw-read-watchpoint"
: (type == hw_access ? "hw-access-watchpoint"
@@ -867,9 +867,10 @@ aarch64_linux_read_description (struct t
@@ -869,9 +869,10 @@ aarch64_linux_read_description (struct t
gdbserver/linux-aarch64-low.c for more information. */
static void
@ -732,7 +319,7 @@ Index: gdb-7.7.1/gdb/aarch64-linux-nat.c
{
int aligned_len;
unsigned int offset;
@@ -1035,7 +1036,7 @@ aarch64_point_encode_ctrl_reg (int type,
@@ -1038,7 +1039,7 @@ aarch64_point_encode_ctrl_reg (int type,
Return 0 for any non-compliant ADDR and/or LEN; return 1 otherwise. */
static int
@ -741,7 +328,7 @@ Index: gdb-7.7.1/gdb/aarch64-linux-nat.c
{
unsigned int alignment = is_watchpoint ? AARCH64_HWP_ALIGNMENT
: AARCH64_HBP_ALIGNMENT;
@@ -1285,7 +1286,7 @@ aarch64_handle_aligned_watchpoint (int t
@@ -1290,7 +1291,7 @@ aarch64_handle_aligned_watchpoint (int t
Return 0 if succeed. */
static int
@ -750,7 +337,7 @@ Index: gdb-7.7.1/gdb/aarch64-linux-nat.c
int is_insert)
{
struct aarch64_debug_reg_state *state
@@ -1310,8 +1311,8 @@ aarch64_handle_unaligned_watchpoint (int
@@ -1315,8 +1316,8 @@ aarch64_handle_unaligned_watchpoint (int
fprintf_unfiltered (gdb_stdlog,
"handle_unaligned_watchpoint: is_insert: %d\n"
" aligned_addr: 0x%08lx, aligned_len: %d\n"
@ -761,7 +348,7 @@ Index: gdb-7.7.1/gdb/aarch64-linux-nat.c
if (ret != 0)
return ret;
@@ -1323,7 +1324,7 @@ aarch64_handle_unaligned_watchpoint (int
@@ -1328,7 +1329,7 @@ aarch64_handle_unaligned_watchpoint (int
/* Implements insertion and removal of a single watchpoint. */
static int
@ -770,54 +357,7 @@ Index: gdb-7.7.1/gdb/aarch64-linux-nat.c
{
if (aarch64_point_is_aligned (1 /* is_watchpoint */ , addr, len))
return aarch64_handle_aligned_watchpoint (type, addr, len, is_insert);
@@ -1338,15 +1339,15 @@ aarch64_handle_watchpoint (int type, COR
of the type TYPE. Return 0 on success, -1 on failure. */
static int
-aarch64_linux_insert_watchpoint (CORE_ADDR addr, int len, int type,
+aarch64_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
int ret;
if (debug_hw_points)
fprintf_unfiltered (gdb_stdlog,
- "insert_watchpoint on entry (addr=0x%08lx, len=%d)\n",
- (unsigned long) addr, len);
+ "insert_watchpoint on entry (addr=0x%08lx, len=%s)\n",
+ (unsigned long) addr, plongest (len));
gdb_assert (type != hw_execute);
@@ -1370,15 +1371,15 @@ aarch64_linux_insert_watchpoint (CORE_AD
type TYPE. Return 0 on success, -1 on failure. */
static int
-aarch64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type,
+aarch64_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
int ret;
if (debug_hw_points)
fprintf_unfiltered (gdb_stdlog,
- "remove_watchpoint on entry (addr=0x%08lx, len=%d)\n",
- (unsigned long) addr, len);
+ "remove_watchpoint on entry (addr=0x%08lx, len=%s)\n",
+ (unsigned long) addr, plongest (len));
gdb_assert (type != hw_execute);
@@ -1399,7 +1400,7 @@ aarch64_linux_remove_watchpoint (CORE_AD
/* Implement the "to_region_ok_for_hw_watchpoint" target_ops method. */
static int
-aarch64_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
+aarch64_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len)
{
CORE_ADDR aligned_addr;
@@ -1489,7 +1490,7 @@ aarch64_linux_stopped_by_watchpoint (voi
@@ -1497,7 +1498,7 @@ aarch64_linux_stopped_by_watchpoint (str
static int
aarch64_linux_watchpoint_addr_within_range (struct target_ops *target,
CORE_ADDR addr,
@ -826,3 +366,16 @@ Index: gdb-7.7.1/gdb/aarch64-linux-nat.c
{
return start <= addr && start + length - 1 >= addr;
}
Index: gdb-7.7.90.20140613/gdb/target-delegates.c
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/target-delegates.c 2014-06-13 22:22:37.917404611 +0200
+++ gdb-7.7.90.20140613/gdb/target-delegates.c 2014-06-13 22:26:06.092640924 +0200
@@ -261,7 +261,7 @@ tdefault_stopped_data_address (struct ta
}
static int
-delegate_watchpoint_addr_within_range (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2, int arg3)
+delegate_watchpoint_addr_within_range (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2, LONGEST arg3)
{
self = self->beneath;
return self->to_watchpoint_addr_within_range (self, arg1, arg2, arg3);

View File

@ -47,11 +47,11 @@ Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=f77-bounds.patch
Index: gdb-7.5.50.20130118/gdb/f-lang.h
Index: gdb-7.7.90.20140613/gdb/f-lang.h
===================================================================
--- gdb-7.5.50.20130118.orig/gdb/f-lang.h 2013-01-18 23:39:40.209500968 +0100
+++ gdb-7.5.50.20130118/gdb/f-lang.h 2013-01-18 23:40:04.010531177 +0100
@@ -65,9 +65,9 @@ struct common_block
--- gdb-7.7.90.20140613.orig/gdb/f-lang.h 2014-06-16 22:45:00.404470944 +0200
+++ gdb-7.7.90.20140613/gdb/f-lang.h 2014-06-16 22:45:10.352477761 +0200
@@ -62,9 +62,9 @@ struct common_block
struct symbol *contents[1];
};
@ -63,11 +63,11 @@ Index: gdb-7.5.50.20130118/gdb/f-lang.h
extern void f77_get_dynamic_array_length (struct type *);
Index: gdb-7.5.50.20130118/gdb/f-typeprint.c
Index: gdb-7.7.90.20140613/gdb/f-typeprint.c
===================================================================
--- gdb-7.5.50.20130118.orig/gdb/f-typeprint.c 2013-01-18 23:39:37.564497620 +0100
+++ gdb-7.5.50.20130118/gdb/f-typeprint.c 2013-01-18 23:39:40.210500970 +0100
@@ -180,7 +180,7 @@ f_type_print_varspec_suffix (struct type
--- gdb-7.7.90.20140613.orig/gdb/f-typeprint.c 2014-06-16 22:45:00.404470944 +0200
+++ gdb-7.7.90.20140613/gdb/f-typeprint.c 2014-06-16 22:45:10.353477761 +0200
@@ -161,7 +161,7 @@ f_type_print_varspec_suffix (struct type
int show, int passed_a_ptr, int demangled_args,
int arrayprint_recurse_level)
{
@ -76,7 +76,7 @@ Index: gdb-7.5.50.20130118/gdb/f-typeprint.c
/* No static variables are permitted as an error call may occur during
execution of this function. */
@@ -210,7 +210,7 @@ f_type_print_varspec_suffix (struct type
@@ -195,7 +195,7 @@ f_type_print_varspec_suffix (struct type
lower_bound = f77_get_lowerbound (type);
if (lower_bound != 1) /* Not the default. */
@ -85,7 +85,7 @@ Index: gdb-7.5.50.20130118/gdb/f-typeprint.c
/* Make sure that, if we have an assumed size array, we
print out a warning and print the upperbound as '*'. */
@@ -220,7 +220,7 @@ f_type_print_varspec_suffix (struct type
@@ -205,7 +205,7 @@ f_type_print_varspec_suffix (struct type
else
{
upper_bound = f77_get_upperbound (type);
@ -94,7 +94,7 @@ Index: gdb-7.5.50.20130118/gdb/f-typeprint.c
}
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
@@ -288,7 +288,7 @@ void
@@ -274,7 +274,7 @@ void
f_type_print_base (struct type *type, struct ui_file *stream, int show,
int level)
{
@ -103,7 +103,7 @@ Index: gdb-7.5.50.20130118/gdb/f-typeprint.c
int index;
QUIT;
@@ -370,7 +370,7 @@ f_type_print_base (struct type *type, st
@@ -356,7 +356,7 @@ f_type_print_base (struct type *type, st
else
{
upper_bound = f77_get_upperbound (type);
@ -112,20 +112,20 @@ Index: gdb-7.5.50.20130118/gdb/f-typeprint.c
}
break;
Index: gdb-7.5.50.20130118/gdb/f-valprint.c
Index: gdb-7.7.90.20140613/gdb/f-valprint.c
===================================================================
--- gdb-7.5.50.20130118.orig/gdb/f-valprint.c 2013-01-18 23:39:37.564497620 +0100
+++ gdb-7.5.50.20130118/gdb/f-valprint.c 2013-01-18 23:39:40.210500970 +0100
@@ -57,7 +57,7 @@ LONGEST f77_array_offset_tbl[MAX_FORTRAN
#define F77_DIM_BYTE_STRIDE(n) (f77_array_offset_tbl[n][0])
--- gdb-7.7.90.20140613.orig/gdb/f-valprint.c 2014-06-16 22:45:34.901495069 +0200
+++ gdb-7.7.90.20140613/gdb/f-valprint.c 2014-06-16 22:45:44.933502067 +0200
@@ -46,7 +46,7 @@ LONGEST f77_array_offset_tbl[MAX_FORTRAN
/* Array which holds offsets to be applied to get a row's elements
for a given array. Array also holds the size of each subarray. */
-int
+LONGEST
f77_get_lowerbound (struct type *type)
{
f_object_address_data_valid_or_error (type);
@@ -68,7 +68,7 @@ f77_get_lowerbound (struct type *type)
if (TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED (type))
@@ -55,7 +55,7 @@ f77_get_lowerbound (struct type *type)
return TYPE_ARRAY_LOWER_BOUND_VALUE (type);
}
@ -133,24 +133,4 @@ Index: gdb-7.5.50.20130118/gdb/f-valprint.c
+LONGEST
f77_get_upperbound (struct type *type)
{
f_object_address_data_valid_or_error (type);
@@ -92,8 +92,8 @@ f77_get_upperbound (struct type *type)
static void
f77_get_dynamic_length_of_aggregate (struct type *type)
{
- int upper_bound = -1;
- int lower_bound = 1;
+ LONGEST upper_bound = -1;
+ LONGEST lower_bound = 1;
/* Recursively go all the way down into a possibly multi-dimensional
F77 array and get the bounds. For simple arrays, this is pretty
@@ -128,7 +128,7 @@ f77_create_arrayprint_offset_tbl (struct
struct type *tmp_type;
LONGEST eltlen;
int ndimen = 1;
- int upper, lower;
+ LONGEST upper, lower;
tmp_type = type;
if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))

View File

@ -1,82 +0,0 @@
http://sourceware.org/ml/gdb-patches/2014-04/msg00154.html
Subject: [patch] Fix gdbserver qGetTLSAddr for x86_64 -m32
--St7VIuEGZ6dlpu13
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
gdbserver makes libthread_db to access uninitialized memory. Surprisingly it
does not harm normally, even -fsanitize=address works with current gdbserver.
I have found just valgrind detects it as a very first warning for gdbserver:
Syscall param ptrace(addr) contains uninitialised byte(s)
at 0x3721EECEBE: ptrace (ptrace.c:45)
by 0x436EE5: ps_get_thread_area (linux-x86-low.c:252)
by 0x5559D02: __td_ta_lookup_th_unique (td_ta_map_lwp2thr.c:157)
by 0x5559EC3: td_ta_map_lwp2thr (td_ta_map_lwp2thr.c:207)
by 0x43F87D: find_one_thread (thread-db.c:281)
by 0x440038: thread_db_get_tls_address (thread-db.c:505)
by 0x40F6D0: handle_query (server.c:2004)
by 0x4124CF: process_serial_event (server.c:3445)
by 0x4136B6: handle_serial_event (server.c:3889)
by 0x419571: handle_file_event (event-loop.c:434)
by 0x418D38: process_event (event-loop.c:189)
by 0x419AB7: start_event_loop (event-loop.c:552)
Reproducible with:
cd gdb/testsuite
g++ -o gdb.threads/tls gdb.threads/tls{,2}.c -m32 -pthread
../gdbserver/gdbserver :1234 gdb.threads/tls
../gdb -batch gdb.threads/tls -ex 'target remote :1234' -ex 'b spin' -ex c -ex 'p a_thread_local'
It is more easily reproducible even without valgrind using s/0x00/0xff/ in the
attached patch. It will then turn the output of reproducer above:
$1 = 0
->
Cannot find thread-local storage for Thread 29044, executable file .../gdb/testsuite/gdb.threads/tls:
Remote target failed to process qGetTLSAddr request
Thanks,
Jan
--St7VIuEGZ6dlpu13
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline; filename="00ff.patch"
gdb/gdbserver/
2014-04-10 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix gdbserver qGetTLSAddr for x86_64 -m32.
* linux-x86-low.c (X86_64_USER_REGS): New.
(x86_fill_gregset): Call memset for BUF first in x86_64 -m32 case.
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 33b5f26..1156e58 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -185,6 +185,7 @@ static const int x86_64_regmap[] =
};
#define X86_64_NUM_REGS (sizeof (x86_64_regmap) / sizeof (x86_64_regmap[0]))
+#define X86_64_USER_REGS (GS + 1)
#else /* ! __x86_64__ */
@@ -343,6 +344,10 @@ x86_fill_gregset (struct regcache *regcache, void *buf)
collect_register (regcache, i, ((char *) buf) + x86_64_regmap[i]);
return;
}
+
+ /* 32-bit inferior registers need to be zero-extended.
+ Callers would read uninitialized memory otherwise. */
+ memset (buf, 0x00, X86_64_USER_REGS * 8);
#endif
for (i = 0; i < I386_NUM_REGS; i++)
--St7VIuEGZ6dlpu13--

View File

@ -1,326 +0,0 @@
http://sourceware.org/ml/gdb-patches/2014-04/msg00155.html
Subject: [patch] Fix TLS access for -static -pthread
--qtZFehHsKgwS5rPz
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
testcase results may depend on patch:
[patch] Fix gdbserver qGetTLSAddr for x86_64 -m32
https://sourceware.org/ml/gdb-patches/2014-04/msg00154.html
Message-ID: <20140410114901.GA16411@host2.jankratochvil.net>
There is:
* gdb.threads/staticthreads.exp to test -static -pthread 'info threads'
* gdb.threads/tls.exp to test TLS access (__thread variables)
but no testcase to test both together - it even does not work.
I have posted:
TLS variables access for -static -lpthread executables
https://sourceware.org/ml/libc-help/2014-03/msg00024.html
and the GDB patch below has been confirmed as OK for current glibcs.
Future glibcs may implement more native support for -static -pthread TLS
https://sourceware.org/bugzilla/show_bug.cgi?id=16828
which will require also some new GDB support.
Still the patch below implements the feature in a fully functional way backward
compatible with current glibcs, it depends on the following glibc source line:
csu/libc-tls.c
main_map->l_tls_modid = 1;
No regressions on {x86_64,x86_64-m32}-fedorarawhide-linux-gnu.
Thanks,
Jan
--qtZFehHsKgwS5rPz
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline; filename="staticthread.patch"
gdb/
2014-04-10 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix TLS access for -static -pthread.
* linux-thread-db.c (struct thread_db_info): Add td_thr_tlsbase_p.
(try_thread_db_load_1): Initialize it.
(thread_db_get_thread_local_address): Call it if LM is zero.
* target.c (target_translate_tls_address): Remove LM_ADDR zero check.
* target.h (struct target_ops) (to_get_thread_local_address): Add
load_module_addr comment.
gdb/gdbserver/
2014-04-10 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix TLS access for -static -pthread.
* gdbserver/thread-db.c (struct thread_db): Add td_thr_tlsbase_p.
(thread_db_get_tls_address): Call it if LOAD_MODULE is zero.
(thread_db_load_search, try_thread_db_load_1): Initialize it.
gdb/testsuite/
2014-04-10 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix TLS access for -static -pthread.
* gdb.threads/staticthreads.c <HAVE_TLS> (tlsvar): New.
<HAVE_TLS> (thread_function, main): Initialize it.
* gdb.threads/staticthreads.exp: Try gdb_compile_pthreads for $have_tls.
Add clean_restart.
<$have_tls != "">: Check TLSVAR.
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index ca614a3..4578610 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -196,6 +196,9 @@ struct thread_db_info
td_err_e (*td_thr_tls_get_addr_p) (const td_thrhandle_t *th,
psaddr_t map_address,
size_t offset, psaddr_t *address);
+ td_err_e (*td_thr_tlsbase_p) (const td_thrhandle_t *th,
+ unsigned long int modid,
+ psaddr_t *base);
};
/* List of known processes using thread_db, and the required
@@ -799,6 +802,7 @@ try_thread_db_load_1 (struct thread_db_info *info)
info->td_ta_event_getmsg_p = dlsym (info->handle, "td_ta_event_getmsg");
info->td_thr_event_enable_p = dlsym (info->handle, "td_thr_event_enable");
info->td_thr_tls_get_addr_p = dlsym (info->handle, "td_thr_tls_get_addr");
+ info->td_thr_tlsbase_p = dlsym (info->handle, "td_thr_tlsbase");
if (thread_db_find_new_threads_silently (inferior_ptid) != 0)
{
@@ -1811,21 +1815,34 @@ thread_db_get_thread_local_address (struct target_ops *ops,
info = get_thread_db_info (ptid_get_pid (ptid));
- /* glibc doesn't provide the needed interface. */
- if (!info->td_thr_tls_get_addr_p)
- throw_error (TLS_NO_LIBRARY_SUPPORT_ERROR,
- _("No TLS library support"));
-
- /* Caller should have verified that lm != 0. */
- gdb_assert (lm != 0);
-
/* Finally, get the address of the variable. */
- /* Note the cast through uintptr_t: this interface only works if
- a target address fits in a psaddr_t, which is a host pointer.
- So a 32-bit debugger can not access 64-bit TLS through this. */
- err = info->td_thr_tls_get_addr_p (&thread_info->private->th,
- (psaddr_t)(uintptr_t) lm,
- offset, &address);
+ if (lm != 0)
+ {
+ /* glibc doesn't provide the needed interface. */
+ if (!info->td_thr_tls_get_addr_p)
+ throw_error (TLS_NO_LIBRARY_SUPPORT_ERROR,
+ _("No TLS library support"));
+
+ /* Note the cast through uintptr_t: this interface only works if
+ a target address fits in a psaddr_t, which is a host pointer.
+ So a 32-bit debugger can not access 64-bit TLS through this. */
+ err = info->td_thr_tls_get_addr_p (&thread_info->private->th,
+ (psaddr_t)(uintptr_t) lm,
+ offset, &address);
+ }
+ else
+ {
+ /* If glibc doesn't provide the needed interface throw an error
+ that LM is zero - normally cases it should not be. */
+ if (!info->td_thr_tlsbase_p)
+ throw_error (TLS_LOAD_MODULE_NOT_FOUND_ERROR,
+ _("TLS load module not found"));
+
+ /* GNU __libc_setup_tls initializes l_tls_modid as 1. */
+ err = info->td_thr_tlsbase_p (&thread_info->private->th,
+ 1, &address);
+ address = (char *) address + offset;
+ }
#ifdef THREAD_DB_HAS_TD_NOTALLOC
/* The memory hasn't been allocated, yet. */
diff --git a/gdb/target.c b/gdb/target.c
index 1b48f79..fce646c 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -753,10 +753,6 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
/* Fetch the load module address for this objfile. */
lm_addr = gdbarch_fetch_tls_load_module_address (target_gdbarch (),
objfile);
- /* If it's 0, throw the appropriate exception. */
- if (lm_addr == 0)
- throw_error (TLS_LOAD_MODULE_NOT_FOUND_ERROR,
- _("TLS load module not found"));
addr = target->to_get_thread_local_address (target, ptid,
lm_addr, offset);
diff --git a/gdb/target.h b/gdb/target.h
index d7c6c3d..1aba9e1 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -605,7 +605,8 @@ struct target_ops
thread-local storage for the thread PTID and the shared library
or executable file given by OBJFILE. If that block of
thread-local storage hasn't been allocated yet, this function
- may return an error. */
+ may return an error. LOAD_MODULE_ADDR may be zero for statically
+ linked multithreaded inferiors. */
CORE_ADDR (*to_get_thread_local_address) (struct target_ops *ops,
ptid_t ptid,
CORE_ADDR load_module_addr,
diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c
index f63e39e..f2335ab 100644
--- a/gdb/gdbserver/thread-db.c
+++ b/gdb/gdbserver/thread-db.c
@@ -88,6 +88,9 @@ struct thread_db
td_err_e (*td_thr_tls_get_addr_p) (const td_thrhandle_t *th,
psaddr_t map_address,
size_t offset, psaddr_t *address);
+ td_err_e (*td_thr_tlsbase_p) (const td_thrhandle_t *th,
+ unsigned long int modid,
+ psaddr_t *base);
const char ** (*td_symbol_list_p) (void);
};
@@ -497,7 +500,10 @@ thread_db_get_tls_address (struct thread_info *thread, CORE_ADDR offset,
if (thread_db == NULL || !thread_db->all_symbols_looked_up)
return TD_ERR;
- if (thread_db->td_thr_tls_get_addr_p == NULL)
+ /* If td_thr_tls_get_addr is missing rather do not expect td_thr_tlsbase
+ could work. */
+ if (thread_db->td_thr_tls_get_addr_p == NULL
+ || (load_module == 0 && thread_db->td_thr_tlsbase_p == NULL))
return -1;
lwp = get_thread_lwp (thread);
@@ -508,12 +514,23 @@ thread_db_get_tls_address (struct thread_info *thread, CORE_ADDR offset,
saved_inferior = current_inferior;
current_inferior = thread;
- /* Note the cast through uintptr_t: this interface only works if
- a target address fits in a psaddr_t, which is a host pointer.
- So a 32-bit debugger can not access 64-bit TLS through this. */
- err = thread_db->td_thr_tls_get_addr_p (&lwp->th,
- (psaddr_t) (uintptr_t) load_module,
- offset, &addr);
+
+ if (load_module != 0)
+ {
+ /* Note the cast through uintptr_t: this interface only works if
+ a target address fits in a psaddr_t, which is a host pointer.
+ So a 32-bit debugger can not access 64-bit TLS through this. */
+ err = thread_db->td_thr_tls_get_addr_p (&lwp->th,
+ (psaddr_t) (uintptr_t) load_module,
+ offset, &addr);
+ }
+ else
+ {
+ /* GNU __libc_setup_tls initializes l_tls_modid as 1. */
+ err = thread_db->td_thr_tlsbase_p (&lwp->th, 1, &addr);
+ addr = (char *) addr + offset;
+ }
+
current_inferior = saved_inferior;
if (err == TD_OK)
{
@@ -565,6 +582,7 @@ thread_db_load_search (void)
tdb->td_ta_set_event_p = &td_ta_set_event;
tdb->td_ta_event_getmsg_p = &td_ta_event_getmsg;
tdb->td_thr_tls_get_addr_p = &td_thr_tls_get_addr;
+ tdb->td_thr_tlsbase_p = &td_thr_tlsbase;
return 1;
}
@@ -633,6 +651,7 @@ try_thread_db_load_1 (void *handle)
CHK (0, tdb->td_ta_set_event_p = dlsym (handle, "td_ta_set_event"));
CHK (0, tdb->td_ta_event_getmsg_p = dlsym (handle, "td_ta_event_getmsg"));
CHK (0, tdb->td_thr_tls_get_addr_p = dlsym (handle, "td_thr_tls_get_addr"));
+ CHK (0, tdb->td_thr_tlsbase_p = dlsym (handle, "td_thr_tlsbase"));
#undef CHK
diff --git a/gdb/testsuite/gdb.threads/staticthreads.c b/gdb/testsuite/gdb.threads/staticthreads.c
index f98f4f1..93bef56 100644
--- a/gdb/testsuite/gdb.threads/staticthreads.c
+++ b/gdb/testsuite/gdb.threads/staticthreads.c
@@ -28,10 +28,17 @@
sem_t semaphore;
+#ifdef HAVE_TLS
+__thread int tlsvar;
+#endif
+
void *
thread_function (void *arg)
{
- printf ("Thread executing\n");
+#ifdef HAVE_TLS
+ tlsvar = 2;
+#endif
+ printf ("Thread executing\n"); /* tlsvar-is-set */
while (sem_wait (&semaphore) != 0)
{
if (errno != EINTR)
@@ -57,6 +64,9 @@ main (int argc, char **argv)
return -1;
}
+#ifdef HAVE_TLS
+ tlsvar = 1;
+#endif
/* Create a thread, wait for it to complete. */
{
diff --git a/gdb/testsuite/gdb.threads/staticthreads.exp b/gdb/testsuite/gdb.threads/staticthreads.exp
index 80b0ba8..9fa625a 100644
--- a/gdb/testsuite/gdb.threads/staticthreads.exp
+++ b/gdb/testsuite/gdb.threads/staticthreads.exp
@@ -22,11 +22,16 @@
standard_testfile
set static_flag "-static"
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
- executable \
- [list debug "additional_flags=${static_flag}" \
- ]] != "" } {
- return -1
+foreach have_tls { "-DHAVE_TLS" "" } {
+ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
+ executable \
+ [list debug "additional_flags=${static_flag} ${have_tls}" \
+ ]] == "" } {
+ break
+ }
+ if { $have_tls == "" } {
+ return -1
+ }
}
clean_restart ${binfile}
@@ -89,3 +94,18 @@ gdb_test_multiple "quit" "$test" {
pass "$test"
}
}
+clean_restart ${binfile}
+
+
+if { "$have_tls" != "" } {
+ if ![runto_main] {
+ return -1
+ }
+ gdb_breakpoint [gdb_get_line_number "tlsvar-is-set"]
+ gdb_continue_to_breakpoint "tlsvar-is-set" ".* tlsvar-is-set .*"
+ gdb_test "p tlsvar" " = 2" "tlsvar in thread"
+ gdb_test "thread 1" ".*"
+ # Unwind from pthread_join.
+ gdb_test "up 10" " in main .*"
+ gdb_test "p tlsvar" " = 1" "tlsvar in main"
+}
--qtZFehHsKgwS5rPz--

View File

@ -1,50 +0,0 @@
http://sourceware.org/ml/gdb-patches/2014-02/msg00158.html
Subject: [patch] testsuite: Fix "ERROR: no fileid for"
--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
a35cfb4007cee8cb84106412cd17f4e12f13345b is the first bad commit
commit a35cfb4007cee8cb84106412cd17f4e12f13345b
Author: Maciej W. Rozycki <macro@codesourcery.com>
Date: Thu Oct 24 23:32:30 2013 +0100
$ runtest gdb.base/solib-disc.exp
Running ./gdb.base/solib-disc.exp ...
ERROR: no fileid for host1
[...]
Jan
--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline; filename="gdbfinish.patch"
gdb/testsuite/
2014-02-06 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix "ERROR: no fileid for" in the testsuite.
* lib/gdb.exp (gdb_finish): Check gdb_spawn_id.
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 533b81b..5c53cdf 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3708,7 +3708,8 @@ proc gdb_finish { } {
global cleanfiles
# Give persistent gdbserver a chance to terminate before GDB is killed.
- if {[info exists gdbserver_reconnect_p] && $gdbserver_reconnect_p} {
+ if {[info exists gdbserver_reconnect_p] && $gdbserver_reconnect_p
+ && [info exists gdb_spawn_id]} {
send_gdb "kill\n";
gdb_expect 10 {
-re "y or n" {
--azLHFNyN32YCQGCU--

View File

@ -1,61 +0,0 @@
commit 718ee4dc9b09491707420ae403ad1ce8dfdb61b2
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Date: Thu Jan 30 19:12:35 2014 +0100
Add support for AT_HWCAP2 auxv entry
Recent ppc64 Linux kernels provide a new auxv entry AT_HWCAP2,
which is currently not recognized by GDB, causing every use of
"info auxv" to show an error.
This commit adds the AT_HWCAP2 define to include/elf/common.h
and handles it in GDB.
include/elf/ChangeLog:
* common.h (AT_HWCAP2): Define.
gdb/ChangeLog:
* auxv.c (fprint_target_auxv): Handle AT_HWCAP2.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,7 @@
+2014-01-30 Ulrich Weigand  <uweigand@de.ibm.com>
+
+ * auxv.c (fprint_target_auxv): Handle AT_HWCAP2.
+
2014-01-29 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc64-linux-tdep.c (sparc64_linux_step_trap): Get PC from
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -442,6 +442,7 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
TAG (AT_IGNOREPPC, _("Entry should be ignored"), dec);
TAG (AT_BASE_PLATFORM, _("String identifying base platform"), str);
TAG (AT_RANDOM, _("Address of 16 random bytes"), hex);
+ TAG (AT_HWCAP2, _("Extension of AT_HWCAP"), hex);
TAG (AT_EXECFN, _("File name of executable"), str);
TAG (AT_SECURE, _("Boolean, was exec setuid-like?"), dec);
TAG (AT_SYSINFO, _("Special system info/entry points"), hex);
### a/include/elf/ChangeLog
### b/include/elf/ChangeLog
## -1,3 +1,7 @@
+2014-01-30 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * common.h (AT_HWCAP2): Define.
+
2013-12-13 Kuan-Lin Chen <kuanlinchentw@gmail.com>
Wei-Cheng Wang <cole945@gmail.com>
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -959,6 +959,7 @@
#define AT_BASE_PLATFORM 24 /* String identifying real platform,
may differ from AT_PLATFORM. */
#define AT_RANDOM 25 /* Address of 16 random bytes. */
+#define AT_HWCAP2 26 /* Extension of AT_HWCAP. */
#define AT_EXECFN 31 /* Filename of executable. */
/* Pointer to the global system page used for system calls and other
nice things. */

View File

@ -1,36 +0,0 @@
commit 36c24d95382572e9cf4095712a8613664d7165cc
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Date: Tue Feb 4 18:19:51 2014 +0100
Document support for powerpc64le-*-linux* target
gdb/ChangeLog:
* NEWS: Document new target powerpc64le-*-linux*.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,7 @@
+2014-02-04 Ulrich Weigand  <uweigand@de.ibm.com>
+
+ * NEWS: Document new target powerpc64le-*-linux*.
+
2014-02-04 Mark Kettenis <kettenis@gnu.org>
* sparc64obsd-tdep.c (sparc64obsd_gregset): New variable.
Index: gdb-7.7.1/gdb/NEWS
===================================================================
--- gdb-7.7.1.orig/gdb/NEWS 2014-05-09 19:21:57.798235002 +0200
+++ gdb-7.7.1/gdb/NEWS 2014-05-09 19:22:30.206239145 +0200
@@ -1,6 +1,11 @@
What has changed in GDB?
(Organized release by release)
+*** Changes since GDB 7.7
+
+* New targets
+PowerPC64 GNU/Linux little-endian powerpc64le-*-linux*
+
*** Changes in GDB 7.7
* GDB now supports SystemTap SDT probes on AArch64 GNU/Linux.

File diff suppressed because it is too large Load Diff

View File

@ -1,44 +0,0 @@
commit d63167affc2a56189e3ba2cc47dd9a3451208b59
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Date: Tue Feb 4 18:26:26 2014 +0100
PowerPC64 little-endian fixes: structure passing
When passing a small structure in a GPR, the ABI specifies that it
should be passed in the least-significant bytes of the register
(or stack slot). On big-endian systems, this means the value
needs to be stored at an offset, which is what current code does.
However, on little-endian systems, the least-significant bytes are
addresses with offset 0. This patch fixes that.
gdb/ChangeLog:
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_val): Use correct
offset on little-endian when passing small structures.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,10 @@
2014-02-04 Ulrich Weigand  <uweigand@de.ibm.com>
+ * ppc-sysv-tdep.c (ppc64_sysv_abi_push_val): Use correct
+ offset on little-endian when passing small structures.
+
+2014-02-04 Ulrich Weigand  <uweigand@de.ibm.com>
+
* ppc-sysv-tdep.c (get_decimal_float_return_value): Update comment.
(struct ppc64_sysv_argpos): New data structure.
(ppc64_sysv_abi_push_float): Remove.
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -1150,7 +1150,8 @@ ppc64_sysv_abi_push_val (struct gdbarch *gdbarch,
doubleword are right-aligned and those larger are left-aligned.
GCC versions before 3.4 implemented this incorrectly; see
<http://gcc.gnu.org/gcc-3.4/powerpc-abi.html>. */
- if (len < tdep->wordsize)
+ if (len < tdep->wordsize
+ && gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
offset = tdep->wordsize - len;
if (argpos->regcache)

View File

@ -1,67 +0,0 @@
commit 6ed14ff33979bc48367c35b1b235fef8c5e2229b
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Date: Tue Feb 4 18:28:24 2014 +0100
PowerPC64 little-endian fixes: AltiVec tests
A couple of AltiVec tests fail spuriously on powerpc64le-linux, because
they compare against an incorrect pattern. Note that those tests already
contain little-endian variants of the patterns, but those seem to have
bit-rotted a bit: when outputting a vector, GDB no longer omits trailing
zero elements (as it used to do in the past).
This patch updates the pattern to the new GDB output behavior.
In addition, the patch updates the endian test to use the new
gdb_test_multiple logic instead of gdb_expect.
gdb/testsuite/ChangeLog:
* gdb.arch/altivec-regs.exp: Use gdb_test_multiple for endian test.
(decimal_vector): Fix for little-endian.
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,3 +1,8 @@
+2014-02-04 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * gdb.arch/altivec-regs.exp: Use gdb_test_multiple for endian test.
+ (decimal_vector): Fix for little-endian.
+
2014-01-29 Jose E. Marchesi <jose.marchesi@oracle.com>
* gdb.arch/sparc-sysstep.exp: New file.
--- a/gdb/testsuite/gdb.arch/altivec-regs.exp
+++ b/gdb/testsuite/gdb.arch/altivec-regs.exp
@@ -79,17 +79,16 @@ gdb_test "set \$vrsave = 1" "" ""
gdb_test "next" "" ""
-send_gdb "show endian\n"
set endianness ""
-gdb_expect {
+set msg "detect endianness"
+gdb_test_multiple "show endian" "$msg" {
-re "(The target endianness is set automatically .currently )(big|little)( endian.*)$gdb_prompt $" {
- pass "endianness"
- set endianness $expect_out(2,string)
+ pass "$msg"
+ set endianness $expect_out(2,string)
}
-re ".*$gdb_prompt $" {
- fail "couldn't get endianness"
+ fail "$msg"
}
- timeout { fail "(timeout) endianness" }
}
# And then read the AltiVec registers back, to see that
@@ -118,7 +117,7 @@ gdb_test "info reg vscr" "vscr.*0x1\t1" "info reg vscr"
if {$endianness == "big"} {
set decimal_vector ".uint128 = 0x00000001000000010000000100000001, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .0, 1, 0, 1, 0, 1, 0, 1., v16_int8 = .0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1.."
} else {
- set decimal_vector ".uint128 = 0x00000001000000010000000100000001, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .1, 0, 1, 0, 1, 0, 1, 0., v16_int8 = .1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.."
+ set decimal_vector ".uint128 = 0x00000001000000010000000100000001, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .1, 0, 1, 0, 1, 0, 1, 0., v16_int8 = .1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.."
}
for {set i 0} {$i < 32} {incr i 1} {

View File

@ -1,149 +0,0 @@
commit 084ee54552f6c35d740e8b9bc81a4fe8d8bb178b
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Date: Tue Feb 4 18:31:38 2014 +0100
PowerPC64 little-endian fixes: VSX tests and pseudo-regs
Many VSX test were failing on powerpc64le-linux, since -as opposed to the
AltiVec tests- there never were little-endian versions of the test patterns.
This patch adds such patterns, along the lines of altivec-regs.exp.
In addition, there is an actual code change required: For those VSX
registers that overlap a floating-point register, the FP register
overlaps the most-significant half of the VSX register both on big-
and little-endian systems. However, on little-endian systems, that
half is stored at an offset of 8 bytes (not 0). This works already
for the "real" FP registers, but current code gets it wrong for
the "extended" pseudo FP register GDB generates for the second
half of the VSX register bank.
This patch updates the corresponding pseudo read/write routines
to take the appropriate offset into consideration.
gdb/ChangeLog:
* rs6000-tdep.c (efpr_pseudo_register_read): Use correct offset
of the overlapped FP register within the VSX register on little-
endian platforms.
(efpr_pseudo_register_write): Likewise.
gdb/testsuite/ChangeLog:
* gdb.arch/vsx-regs.exp: Check target endianness. Provide variants
of the test patterns for use on little-endian systems.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,12 @@
2014-02-04 Ulrich Weigand  <uweigand@de.ibm.com>
+ * rs6000-tdep.c (efpr_pseudo_register_read): Use correct offset
+ of the overlapped FP register within the VSX register on little-
+ endian platforms.
+ (efpr_pseudo_register_write): Likewise.
+
+2014-02-04 Ulrich Weigand  <uweigand@de.ibm.com>
+
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_val): Use correct
offset on little-endian when passing small structures.
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -2779,10 +2779,12 @@ efpr_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int reg_index = reg_nr - tdep->ppc_efpr0_regnum;
+ int offset = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 0 : 8;
/* Read the portion that overlaps the VMX register. */
- return regcache_raw_read_part (regcache, tdep->ppc_vr0_regnum + reg_index, 0,
- register_size (gdbarch, reg_nr), buffer);
+ return regcache_raw_read_part (regcache, tdep->ppc_vr0_regnum + reg_index,
+ offset, register_size (gdbarch, reg_nr),
+ buffer);
}
/* Write method for POWER7 Extended FP pseudo-registers. */
@@ -2792,10 +2794,12 @@ efpr_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int reg_index = reg_nr - tdep->ppc_efpr0_regnum;
+ int offset = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 0 : 8;
/* Write the portion that overlaps the VMX register. */
- regcache_raw_write_part (regcache, tdep->ppc_vr0_regnum + reg_index, 0,
- register_size (gdbarch, reg_nr), buffer);
+ regcache_raw_write_part (regcache, tdep->ppc_vr0_regnum + reg_index,
+ offset, register_size (gdbarch, reg_nr),
+ buffer);
}
static enum register_status
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,5 +1,10 @@
2014-02-04 Ulrich Weigand <uweigand@de.ibm.com>
+ * gdb.arch/vsx-regs.exp: Check target endianness. Provide variants
+ of the test patterns for use on little-endian systems.
+
+2014-02-04 Ulrich Weigand <uweigand@de.ibm.com>
+
* gdb.arch/altivec-regs.exp: Use gdb_test_multiple for endian test.
(decimal_vector): Fix for little-endian.
--- a/gdb/testsuite/gdb.arch/vsx-regs.exp
+++ b/gdb/testsuite/gdb.arch/vsx-regs.exp
@@ -58,19 +58,45 @@ if ![runto_main] then {
gdb_suppress_tests
}
+set endianness ""
+set msg "detect endianness"
+gdb_test_multiple "show endian" "$msg" {
+ -re "(The target endianness is set automatically .currently )(big|little)( endian.*)$gdb_prompt $" {
+ pass "$msg"
+ set endianness $expect_out(2,string)
+ }
+ -re ".*$gdb_prompt $" {
+ fail "$msg"
+ }
+}
+
# Data sets used throughout the test
-set vector_register1 ".uint128 = 0x3ff4cccccccccccc0000000000000000, v2_double = .0x1, 0x0., v4_float = .0x1, 0xf99999a0, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccc, 0x0, 0x0., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccc, 0x0, 0x0, 0x0, 0x0., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0.."
+if {$endianness == "big"} {
+ set vector_register1 ".uint128 = 0x3ff4cccccccccccc0000000000000000, v2_double = .0x1, 0x0., v4_float = .0x1, 0xf99999a0, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccc, 0x0, 0x0., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccc, 0x0, 0x0, 0x0, 0x0., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0.."
+
+ set vector_register1_vr ".uint128 = 0x3ff4cccccccccccc0000000100000001, v4_float = .0x1, 0xf99999a0, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccc, 0x1, 0x1., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccc, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
-set vector_register1_vr ".uint128 = 0x3ff4cccccccccccc0000000100000001, v4_float = .0x1, 0xf99999a0, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccc, 0x1, 0x1., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccc, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
+ set vector_register2 "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v2_double = .0x1, 0x1., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.."
-set vector_register2 "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v2_double = .0x1, 0x1., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.."
+ set vector_register2_vr "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.."
-set vector_register2_vr "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.."
+ set vector_register3 ".uint128 = 0x00000001000000010000000100000001, v2_double = .0x0, 0x0., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
+
+ set vector_register3_vr ".uint128 = 0x00000001000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
+} else {
+ set vector_register1 ".uint128 = 0x3ff4cccccccccccc0000000000000000, v2_double = .0x0, 0x1., v4_float = .0x0, 0x0, 0xf99999a0, 0x1., v4_int32 = .0x0, 0x0, 0xcccccccc, 0x3ff4cccc., v8_int16 = .0x0, 0x0, 0x0, 0x0, 0xcccc, 0xcccc, 0xcccc, 0x3ff4., v16_int8 = .0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xf4, 0x3f.."
-set vector_register3 ".uint128 = 0x00000001000000010000000100000001, v2_double = .0x0, 0x0., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
+ set vector_register1_vr ".uint128 = 0x3ff4cccccccccccc0000000100000001, v4_float = .0x0, 0x0, 0xf99999a0, 0x1., v4_int32 = .0x1, 0x1, 0xcccccccc, 0x3ff4cccc., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0xcccc, 0xcccc, 0xcccc, 0x3ff4., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xf4, 0x3f.."
-set vector_register3_vr ".uint128 = 0x00000001000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
+ set vector_register2 "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v2_double = .0x1, 0x1., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead., v16_int8 = .0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde.."
+
+ set vector_register2_vr "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead., v16_int8 = .0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde.."
+
+ set vector_register3 ".uint128 = 0x00000001000000010000000100000001, v2_double = .0x0, 0x0., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.."
+
+ set vector_register3_vr ".uint128 = 0x00000001000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.."
+}
set float_register ".raw 0xdeadbeefdeadbeef."

View File

@ -1,57 +0,0 @@
commit 5b757e5ddbd9ad252d9c51103f1aa52b41c2e947
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Date: Tue Feb 4 18:33:04 2014 +0100
PowerPC64 little-endian fixes: 32-bit DFP parameters
Passing a 32-bit DFP in register needs to use the least-significant part
of the register. Like with a previous patch that addressed the same
issue for small structs, this patch makes sure the appropriate offset
is used on little-endian systems.
gdb/ChangeLog:
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct
offset on little-endian when passing _Decimal32.
(ppc64_sysv_abi_return_value_base): Likewise for return values.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,11 @@
2014-02-04 Ulrich Weigand  <uweigand@de.ibm.com>
+ * ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct
+ offset on little-endian when passing _Decimal32.
+ (ppc64_sysv_abi_return_value_base): Likewise for return values.
+
+2014-02-04 Ulrich Weigand  <uweigand@de.ibm.com>
+
* rs6000-tdep.c (efpr_pseudo_register_read): Use correct offset
of the overlapped FP register within the VSX register on little-
endian platforms.
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -1232,7 +1232,10 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch,
if (argpos->regcache && argpos->freg <= 13)
{
int regnum = tdep->ppc_fp0_regnum + argpos->freg;
- int offset = 8 - TYPE_LENGTH (type);
+ int offset = 0;
+
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
+ offset = 8 - TYPE_LENGTH (type);
regcache_cooked_write_part (argpos->regcache, regnum,
offset, TYPE_LENGTH (type), val);
@@ -1641,7 +1644,10 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype,
&& TYPE_CODE (valtype) == TYPE_CODE_DECFLOAT)
{
int regnum = tdep->ppc_fp0_regnum + 1 + index;
- int offset = 8 - TYPE_LENGTH (valtype);
+ int offset = 0;
+
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
+ offset = 8 - TYPE_LENGTH (valtype);
if (writebuf != NULL)
regcache_cooked_write_part (regcache, regnum,

View File

@ -1,140 +0,0 @@
commit 0ff3e01fdc67a3842ee54224cf197e9a55f0a750
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Date: Tue Feb 4 18:34:19 2014 +0100
PowerPC64 little-endian fixes: 128-bit DFP parameters / registers
The powerpc64le-linux ABI specifies that when a 128-bit DFP value is
passed in a pair of floating-point registers, the first register holds
the most-significant part of the value. This is as opposed to the
usual rule on little-endian systems, where the first register would
hold the least-significant part.
This affects two places in GDB, the read/write routines for the
128-bit DFP pseudo-registers, and the function call / return
sequence. For the former, current code already distinguishes
between big- and little-endian targets, but gets the latter
wrong. This is presumably because *GCC* also got it wrong,
and GDB matches the old GCC behavior. But GCC is now fixed:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02145.html
so GDB needs to be fixed too. (Old code shouldn't really be
an issue since there is no code "out there" so far that uses
dfp128 on little-endian ...)
gdb/ChangeLog:
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct order
within a register pair holding a DFP 128-bit value on little-endian.
(ppc64_sysv_abi_return_value_base): Likewise.
* rs6000-tdep.c (dfp_pseudo_register_read): Likewise.
(dfp_pseudo_register_write): Likewise.
gdb/testsuite/ChangeLog:
* gdb.arch/powerpc-d128-regs.exp: Enable on powerpc64*-*.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,13 @@
2014-02-04 Ulrich Weigand  <uweigand@de.ibm.com>
+ * ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct order
+ within a register pair holding a DFP 128-bit value on little-endian.
+ (ppc64_sysv_abi_return_value_base): Likewise.
+ * rs6000-tdep.c (dfp_pseudo_register_read): Likewise.
+ (dfp_pseudo_register_write): Likewise.
+
+2014-02-04 Ulrich Weigand  <uweigand@de.ibm.com>
+
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct
offset on little-endian when passing _Decimal32.
(ppc64_sysv_abi_return_value_base): Likewise for return values.
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -1270,9 +1270,11 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch,
if (argpos->regcache && argpos->freg <= 12)
{
int regnum = tdep->ppc_fp0_regnum + argpos->freg;
+ int lopart = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 8 : 0;
+ int hipart = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 0 : 8;
- regcache_cooked_write (argpos->regcache, regnum, val);
- regcache_cooked_write (argpos->regcache, regnum + 1, val + 8);
+ regcache_cooked_write (argpos->regcache, regnum, val + hipart);
+ regcache_cooked_write (argpos->regcache, regnum + 1, val + lopart);
}
argpos->freg += 2;
@@ -1685,16 +1687,18 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype,
&& TYPE_CODE (valtype) == TYPE_CODE_DECFLOAT)
{
int regnum = tdep->ppc_fp0_regnum + 2 + 2 * index;
+ int lopart = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 8 : 0;
+ int hipart = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 0 : 8;
if (writebuf != NULL)
{
- regcache_cooked_write (regcache, regnum, writebuf);
- regcache_cooked_write (regcache, regnum + 1, writebuf + 8);
+ regcache_cooked_write (regcache, regnum, writebuf + hipart);
+ regcache_cooked_write (regcache, regnum + 1, writebuf + lopart);
}
if (readbuf != NULL)
{
- regcache_cooked_read (regcache, regnum, readbuf);
- regcache_cooked_read (regcache, regnum + 1, readbuf + 8);
+ regcache_cooked_read (regcache, regnum, readbuf + hipart);
+ regcache_cooked_read (regcache, regnum + 1, readbuf + lopart);
}
return 1;
}
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -2672,10 +2672,10 @@ dfp_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
else
{
status = regcache_raw_read (regcache, tdep->ppc_fp0_regnum +
- 2 * reg_index + 1, buffer + 8);
+ 2 * reg_index + 1, buffer);
if (status == REG_VALID)
status = regcache_raw_read (regcache, tdep->ppc_fp0_regnum +
- 2 * reg_index, buffer);
+ 2 * reg_index, buffer + 8);
}
return status;
@@ -2701,9 +2701,9 @@ dfp_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
else
{
regcache_raw_write (regcache, tdep->ppc_fp0_regnum +
- 2 * reg_index + 1, buffer + 8);
+ 2 * reg_index + 1, buffer);
regcache_raw_write (regcache, tdep->ppc_fp0_regnum +
- 2 * reg_index, buffer);
+ 2 * reg_index, buffer + 8);
}
}
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,5 +1,9 @@
2014-02-04 Ulrich Weigand <uweigand@de.ibm.com>
+ * gdb.arch/powerpc-d128-regs.exp: Enable on powerpc64*-*.
+
+2014-02-04 Ulrich Weigand <uweigand@de.ibm.com>
+
* gdb.arch/vsx-regs.exp: Check target endianness. Provide variants
of the test patterns for use on little-endian systems.
--- a/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp
@@ -20,7 +20,7 @@
# Testcase for ppc decimal128 pseudo-registers.
-if ![istarget "powerpc64-*"] then {
+if ![istarget "powerpc64*-*"] then {
verbose "Skipping powerpc Decimal128 pseudo-registers testcase."
return
}

View File

@ -1,159 +0,0 @@
commit cd453cd072004d26ede355b850b3831acffaeddd
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Date: Tue Feb 4 18:38:56 2014 +0100
PowerPC64 ELFv2 ABI: base support
This is the first patch of a series to implement support for the
PowerPC ELFv2 ABI. While powerpc64le-linux will use ELFv2, and
the existing powerpc64-linux code will continue to use ELFv1,
in theory ELFv2 is also defined for big-endian systems (and
ELFv1 was also defined for little-endian systems).
Therefore this patch adds a new tdep->elf_abi variable to decide
which ABI version to use. This is detected from the ELF header
e_flags value; if this is not present, we default to ELFv2 on
little-endian and ELFv1 otherwise.
This patch does not yet introduce any actual difference in GDB's
handling of the two ABIs. Those will be added by the remainder
of this patch series.
For an overview of the changes in ELFv2, have a look at the
comments in the patch series that added ELFv2 to GCC, starting at:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01144.html
gdb/ChangeLog:
* ppc-tdep.h (enum powerpc_elf_abi): New data type.
(struct gdbarch_tdep): New member elf_abi.
* rs6000-tdep.c: Include "elf/ppc64.h".
(rs6000_gdbarch_init): Detect ELF ABI version.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,13 @@
2014-02-04 Ulrich Weigand  <uweigand@de.ibm.com>
+ * ppc-tdep.h (enum powerpc_elf_abi): New data type.
+ (struct gdbarch_tdep): New member elf_abi.
+
+ * rs6000-tdep.c: Include "elf/ppc64.h".
+ (rs6000_gdbarch_init): Detect ELF ABI version.
+
+2014-02-04 Ulrich Weigand  <uweigand@de.ibm.com>
+
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct order
within a register pair holding a DFP 128-bit value on little-endian.
(ppc64_sysv_abi_return_value_base): Likewise.
Index: gdb-7.7.1/gdb/ppc-tdep.h
===================================================================
--- gdb-7.7.1.orig/gdb/ppc-tdep.h 2014-05-09 19:23:40.892248064 +0200
+++ gdb-7.7.1/gdb/ppc-tdep.h 2014-05-09 19:23:42.346248246 +0200
@@ -182,6 +182,15 @@ extern void ppc_collect_vsxregset (const
/* Private data that this module attaches to struct gdbarch. */
+/* ELF ABI version used by the inferior. */
+enum powerpc_elf_abi
+{
+ POWERPC_ELF_AUTO,
+ POWERPC_ELF_V1,
+ POWERPC_ELF_V2,
+ POWERPC_ELF_LAST
+};
+
/* Vector ABI used by the inferior. */
enum powerpc_vector_abi
{
@@ -197,6 +206,8 @@ struct gdbarch_tdep
int wordsize; /* Size in bytes of fixed-point word. */
int soft_float; /* Avoid FP registers for arguments? */
+ enum powerpc_elf_abi elf_abi; /* ELF ABI version. */
+
/* How to pass vector arguments. Never set to AUTO or LAST. */
enum powerpc_vector_abi vector_abi;
Index: gdb-7.7.1/gdb/rs6000-tdep.c
===================================================================
--- gdb-7.7.1.orig/gdb/rs6000-tdep.c 2014-05-09 19:23:40.894248064 +0200
+++ gdb-7.7.1/gdb/rs6000-tdep.c 2014-05-09 19:23:57.974250197 +0200
@@ -48,6 +48,7 @@
#include "elf-bfd.h"
#include "elf/ppc.h"
+#include "elf/ppc64.h"
#include "solib-svr4.h"
#include "ppc-tdep.h"
@@ -3554,6 +3555,7 @@ rs6000_gdbarch_init (struct gdbarch_info
enum auto_boolean soft_float_flag = powerpc_soft_float_global;
int soft_float;
enum powerpc_vector_abi vector_abi = powerpc_vector_abi_global;
+ enum powerpc_elf_abi elf_abi = POWERPC_ELF_AUTO;
int have_fpu = 1, have_spe = 0, have_mq = 0, have_altivec = 0, have_dfp = 0,
have_vsx = 0;
int tdesc_wordsize = -1;
@@ -3860,6 +3862,21 @@ rs6000_gdbarch_init (struct gdbarch_info
}
#ifdef HAVE_ELF
+ if (from_elf_exec)
+ {
+ switch (elf_elfheader (info.abfd)->e_flags & EF_PPC64_ABI)
+ {
+ case 1:
+ elf_abi = POWERPC_ELF_V1;
+ break;
+ case 2:
+ elf_abi = POWERPC_ELF_V2;
+ break;
+ default:
+ break;
+ }
+ }
+
if (soft_float_flag == AUTO_BOOLEAN_AUTO && from_elf_exec)
{
switch (bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_GNU,
@@ -3896,6 +3913,21 @@ rs6000_gdbarch_init (struct gdbarch_info
}
#endif
+ /* At this point, the only supported ELF-based 64-bit little-endian
+ operating system is GNU/Linux, and this uses the ELFv2 ABI by
+ default. All other supported ELF-based operating systems use the
+ ELFv1 ABI by default. Therefore, if the ABI marker is missing,
+ e.g. because we run a legacy binary, or have attached to a process
+ and have not found any associated binary file, set the default
+ according to this heuristic. */
+ if (elf_abi == POWERPC_ELF_AUTO)
+ {
+ if (wordsize == 8 && info.byte_order == BFD_ENDIAN_LITTLE)
+ elf_abi = POWERPC_ELF_V2;
+ else
+ elf_abi = POWERPC_ELF_V1;
+ }
+
if (soft_float_flag == AUTO_BOOLEAN_TRUE)
soft_float = 1;
else if (soft_float_flag == AUTO_BOOLEAN_FALSE)
@@ -3938,6 +3970,8 @@ rs6000_gdbarch_init (struct gdbarch_info
meaningful, because 64-bit CPUs can run in 32-bit mode. So, perform
separate word size check. */
tdep = gdbarch_tdep (arches->gdbarch);
+ if (tdep && tdep->elf_abi != elf_abi)
+ continue;
if (tdep && tdep->soft_float != soft_float)
continue;
if (tdep && tdep->vector_abi != vector_abi)
@@ -3960,6 +3994,7 @@ rs6000_gdbarch_init (struct gdbarch_info
tdep = XCALLOC (1, struct gdbarch_tdep);
tdep->wordsize = wordsize;
+ tdep->elf_abi = elf_abi;
tdep->soft_float = soft_float;
tdep->vector_abi = vector_abi;

View File

@ -1,132 +0,0 @@
commit d4094b6a8883ae481c7644c5a210254efe92e9ad
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Date: Tue Feb 4 18:40:16 2014 +0100
PowerPC64 ELFv2 ABI: no function descriptors
This implements the most significant difference with the ELFv2 ABI:
we no longer use function descriptors. The patch consists mostly
of switching off code to deal with descriptors :-)
In addition, when calling an inferior function, we no longer need
to provide its TOC in r2. Instead, ELFv2 code expects to be called
with r12 pointing to the code address itself.
gdb/ChangeLog:
* ppc-linux-tdep.c (ppc_linux_init_abi): Only call
set_gdbarch_convert_from_func_ptr_addr and
set_gdbarch_elf_make_msymbol_special for ELFv1.
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_param): Only handle
function descriptors on ELFv1.
(ppc64_sysv_abi_push_dummy_call): Likewise. On ELFv2,
set up r12 at function entry.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,15 @@
2014-02-04 Ulrich Weigand  <uweigand@de.ibm.com>
+ * ppc-linux-tdep.c (ppc_linux_init_abi): Only call
+ set_gdbarch_convert_from_func_ptr_addr and
+ set_gdbarch_elf_make_msymbol_special for ELFv1.
+ * ppc-sysv-tdep.c (ppc64_sysv_abi_push_param): Only handle
+ function descriptors on ELFv1.
+ (ppc64_sysv_abi_push_dummy_call): Likewise. On ELFv2,
+ set up r12 at function entry.
+
+2014-02-04 Ulrich Weigand  <uweigand@de.ibm.com>
+
* ppc-tdep.h (enum powerpc_elf_abi): New data type.
(struct gdbarch_tdep): New member elf_abi.
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1339,13 +1339,16 @@ ppc_linux_init_abi (struct gdbarch_info info,
if (tdep->wordsize == 8)
{
- /* Handle PPC GNU/Linux 64-bit function pointers (which are really
- function descriptors). */
- set_gdbarch_convert_from_func_ptr_addr
- (gdbarch, ppc64_convert_from_func_ptr_addr);
+ if (tdep->elf_abi == POWERPC_ELF_V1)
+ {
+ /* Handle PPC GNU/Linux 64-bit function pointers (which are really
+ function descriptors). */
+ set_gdbarch_convert_from_func_ptr_addr
+ (gdbarch, ppc64_convert_from_func_ptr_addr);
- set_gdbarch_elf_make_msymbol_special (gdbarch,
- ppc64_elf_make_msymbol_special);
+ set_gdbarch_elf_make_msymbol_special
+ (gdbarch, ppc64_elf_make_msymbol_special);
+ }
/* Shared library handling. */
set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code);
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -1352,8 +1352,9 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch,
word = unpack_long (type, val);
/* Convert any function code addresses into descriptors. */
- if (TYPE_CODE (type) == TYPE_CODE_PTR
- || TYPE_CODE (type) == TYPE_CODE_REF)
+ if (tdep->elf_abi == POWERPC_ELF_V1
+ && (TYPE_CODE (type) == TYPE_CODE_PTR
+ || TYPE_CODE (type) == TYPE_CODE_REF))
{
struct type *target_type
= check_typedef (TYPE_TARGET_TYPE (type));
@@ -1553,24 +1554,32 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
breakpoint. */
regcache_cooked_write_signed (regcache, tdep->ppc_lr_regnum, bp_addr);
- /* Use the func_addr to find the descriptor, and use that to find
- the TOC. If we're calling via a function pointer, the pointer
- itself identifies the descriptor. */
- {
- struct type *ftype = check_typedef (value_type (function));
- CORE_ADDR desc_addr = value_as_address (function);
-
- if (TYPE_CODE (ftype) == TYPE_CODE_PTR
- || convert_code_addr_to_desc_addr (func_addr, &desc_addr))
- {
- /* The TOC is the second double word in the descriptor. */
- CORE_ADDR toc =
- read_memory_unsigned_integer (desc_addr + tdep->wordsize,
- tdep->wordsize, byte_order);
- regcache_cooked_write_unsigned (regcache,
- tdep->ppc_gp0_regnum + 2, toc);
- }
- }
+ /* In the ELFv1 ABI, use the func_addr to find the descriptor, and use
+ that to find the TOC. If we're calling via a function pointer,
+ the pointer itself identifies the descriptor. */
+ if (tdep->elf_abi == POWERPC_ELF_V1)
+ {
+ struct type *ftype = check_typedef (value_type (function));
+ CORE_ADDR desc_addr = value_as_address (function);
+
+ if (TYPE_CODE (ftype) == TYPE_CODE_PTR
+ || convert_code_addr_to_desc_addr (func_addr, &desc_addr))
+ {
+ /* The TOC is the second double word in the descriptor. */
+ CORE_ADDR toc =
+ read_memory_unsigned_integer (desc_addr + tdep->wordsize,
+ tdep->wordsize, byte_order);
+
+ regcache_cooked_write_unsigned (regcache,
+ tdep->ppc_gp0_regnum + 2, toc);
+ }
+ }
+
+ /* In the ELFv2 ABI, we need to pass the target address in r12 since
+ we may be calling a global entry point. */
+ if (tdep->elf_abi == POWERPC_ELF_V2)
+ regcache_cooked_write_unsigned (regcache,
+ tdep->ppc_gp0_regnum + 12, func_addr);
return sp;
}

View File

@ -1,48 +0,0 @@
commit 52f548e41f085550d7740c350c1c8a239532af77
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Date: Tue Feb 4 18:41:36 2014 +0100
PowerPC64 ELFv2 ABI: stack frame layout changes
This implementes another change in ELFv2: the stack frame no longer
contains the reserved double words for linker and compiler use
(which weren't really used for much of anything anyway). This
affects placement of on-stack parameters in inferior calls.
gdb/ChangeLog:
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_dummy_call): Use correct
offset to the stack parameter list for the ELFv2 ABI.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,10 @@
2014-02-04 Ulrich Weigand  <uweigand@de.ibm.com>
+ * ppc-sysv-tdep.c (ppc64_sysv_abi_push_dummy_call): Use correct
+ offset to the stack parameter list for the ELFv2 ABI.
+
+2014-02-04 Ulrich Weigand  <uweigand@de.ibm.com>
+
* ppc-linux-tdep.c (ppc_linux_init_abi): Only call
set_gdbarch_convert_from_func_ptr_addr and
set_gdbarch_elf_make_msymbol_special for ELFv1.
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -1474,9 +1474,13 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
argpos.regcache = regcache;
argpos.refparam = align_down (sp - refparam_size, 16);
argpos.gparam = align_down (argpos.refparam - gparam_size, 16);
- /* Add in space for the TOC, link editor double word,
- compiler double word, LR save area, CR save area. */
- sp = align_down (argpos.gparam - 48, 16);
+ /* Add in space for the TOC, link editor double word (v1 only),
+ compiler double word (v1 only), LR save area, CR save area,
+ and backchain. */
+ if (tdep->elf_abi == POWERPC_ELF_V1)
+ sp = align_down (argpos.gparam - 48, 16);
+ else
+ sp = align_down (argpos.gparam - 32, 16);
}
/* If the function is returning a `struct', then there is an

View File

@ -1,309 +0,0 @@
commit cc0e89c519912e0e4e75a2fc0d836f715cdc6806
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Date: Tue Feb 4 18:42:35 2014 +0100
PowerPC64 ELFv2 ABI: structure passing / return
Another significant difference in the ELFv2 ABI is that "homogeneous"
floating-point and vector aggregates, i.e. aggregates the consist
(recursively) only of members of the same floating-point or vector type,
are passed in a series of floating-point / vector registers, as if they
were seperate parameters. (This is similar to the ARM ABI.) This
applies to both calls and returns.
In addition when returning any aggregate of up to 16 bytes, ELFv2 now
used general-purpose registers.
This patch adds support for these aspects of the ABI, which is relatively
straightforward after the refactoring patch to ppc-sysv-tdep.c.
gdb/ChangeLog:
* ppc-sysv-tdep.c (ppc64_aggregate_candidate): New routine.
(ppc64_elfv2_abi_homogeneous_aggregate): Likewise.
(ppc64_sysv_abi_push_param): Handle ELFv2 homogeneous structs.
(ppc64_sysv_abi_return_value): Likewise. Also, handle small
structures returned in GPRs.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,13 @@
2014-02-04 Ulrich Weigand  <uweigand@de.ibm.com>
+ * ppc-sysv-tdep.c (ppc64_aggregate_candidate): New routine.
+ (ppc64_elfv2_abi_homogeneous_aggregate): Likewise.
+ (ppc64_sysv_abi_push_param): Handle ELFv2 homogeneous structs.
+ (ppc64_sysv_abi_return_value): Likewise. Also, handle small
+ structures returned in GPRs.
+
+2014-02-04 Ulrich Weigand  <uweigand@de.ibm.com>
+
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_dummy_call): Use correct
offset to the stack parameter list for the ELFv2 ABI.
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -1101,6 +1101,160 @@ convert_code_addr_to_desc_addr (CORE_ADDR code_addr, CORE_ADDR *desc_addr)
return 1;
}
+/* Walk down the type tree of TYPE counting consecutive base elements.
+ If *FIELD_TYPE is NULL, then set it to the first valid floating point
+ or vector type. If a non-floating point or vector type is found, or
+ if a floating point or vector type that doesn't match a non-NULL
+ *FIELD_TYPE is found, then return -1, otherwise return the count in the
+ sub-tree. */
+
+static LONGEST
+ppc64_aggregate_candidate (struct type *type,
+ struct type **field_type)
+{
+ type = check_typedef (type);
+
+ switch (TYPE_CODE (type))
+ {
+ case TYPE_CODE_FLT:
+ case TYPE_CODE_DECFLOAT:
+ if (!*field_type)
+ *field_type = type;
+ if (TYPE_CODE (*field_type) == TYPE_CODE (type)
+ && TYPE_LENGTH (*field_type) == TYPE_LENGTH (type))
+ return 1;
+ break;
+
+ case TYPE_CODE_COMPLEX:
+ type = TYPE_TARGET_TYPE (type);
+ if (TYPE_CODE (type) == TYPE_CODE_FLT
+ || TYPE_CODE (type) == TYPE_CODE_DECFLOAT)
+ {
+ if (!*field_type)
+ *field_type = type;
+ if (TYPE_CODE (*field_type) == TYPE_CODE (type)
+ && TYPE_LENGTH (*field_type) == TYPE_LENGTH (type))
+ return 2;
+ }
+ break;
+
+ case TYPE_CODE_ARRAY:
+ if (TYPE_VECTOR (type))
+ {
+ if (!*field_type)
+ *field_type = type;
+ if (TYPE_CODE (*field_type) == TYPE_CODE (type)
+ && TYPE_LENGTH (*field_type) == TYPE_LENGTH (type))
+ return 1;
+ }
+ else
+ {
+ LONGEST count, low_bound, high_bound;
+
+ count = ppc64_aggregate_candidate
+ (TYPE_TARGET_TYPE (type), field_type);
+ if (count == -1)
+ return -1;
+
+ if (!get_array_bounds (type, &low_bound, &high_bound))
+ return -1;
+ count *= high_bound - low_bound;
+
+ /* There must be no padding. */
+ if (count == 0)
+ return TYPE_LENGTH (type) == 0 ? 0 : -1;
+ else if (TYPE_LENGTH (type) != count * TYPE_LENGTH (*field_type))
+ return -1;
+
+ return count;
+ }
+ break;
+
+ case TYPE_CODE_STRUCT:
+ case TYPE_CODE_UNION:
+ {
+ LONGEST count = 0;
+ int i;
+
+ for (i = 0; i < TYPE_NFIELDS (type); i++)
+ {
+ LONGEST sub_count;
+
+ if (field_is_static (&TYPE_FIELD (type, i)))
+ continue;
+
+ sub_count = ppc64_aggregate_candidate
+ (TYPE_FIELD_TYPE (type, i), field_type);
+ if (sub_count == -1)
+ return -1;
+
+ if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ count += sub_count;
+ else
+ count = max (count, sub_count);
+ }
+
+ /* There must be no padding. */
+ if (count == 0)
+ return TYPE_LENGTH (type) == 0 ? 0 : -1;
+ else if (TYPE_LENGTH (type) != count * TYPE_LENGTH (*field_type))
+ return -1;
+
+ return count;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return -1;
+}
+
+/* If an argument of type TYPE is a homogeneous float or vector aggregate
+ that shall be passed in FP/vector registers according to the ELFv2 ABI,
+ return the homogeneous element type in *ELT_TYPE and the number of
+ elements in *N_ELTS, and return non-zero. Otherwise, return zero. */
+
+static int
+ppc64_elfv2_abi_homogeneous_aggregate (struct type *type,
+ struct type **elt_type, int *n_elts)
+{
+ /* Complex types at the top level are treated separately. However,
+ complex types can be elements of homogeneous aggregates. */
+ if (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ || TYPE_CODE (type) == TYPE_CODE_UNION
+ || (TYPE_CODE (type) == TYPE_CODE_ARRAY && !TYPE_VECTOR (type)))
+ {
+ struct type *field_type = NULL;
+ LONGEST field_count = ppc64_aggregate_candidate (type, &field_type);
+
+ if (field_count > 0)
+ {
+ int n_regs = ((TYPE_CODE (field_type) == TYPE_CODE_FLT
+ || TYPE_CODE (field_type) == TYPE_CODE_DECFLOAT)?
+ (TYPE_LENGTH (field_type) + 7) >> 3 : 1);
+
+ /* The ELFv2 ABI allows homogeneous aggregates to occupy
+ up to 8 registers. */
+ if (field_count * n_regs <= 8)
+ {
+ if (elt_type)
+ *elt_type = field_type;
+ if (n_elts)
+ *n_elts = (int) field_count;
+ /* Note that field_count is LONGEST since it may hold the size
+ of an array, while *n_elts is int since its value is bounded
+ by the number of registers used for argument passing. The
+ cast cannot overflow due to the bounds checking above. */
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
+
/* Structure holding the next argument position. */
struct ppc64_sysv_argpos
{
@@ -1389,6 +1543,29 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch,
if (TYPE_CODE (type) == TYPE_CODE_FLT)
ppc64_sysv_abi_push_freg (gdbarch, type, val, argpos);
}
+
+ /* In the ELFv2 ABI, homogeneous floating-point or vector
+ aggregates are passed in a series of registers. */
+ if (tdep->elf_abi == POWERPC_ELF_V2)
+ {
+ struct type *eltype;
+ int i, nelt;
+
+ if (ppc64_elfv2_abi_homogeneous_aggregate (type, &eltype, &nelt))
+ for (i = 0; i < nelt; i++)
+ {
+ const gdb_byte *elval = val + i * TYPE_LENGTH (eltype);
+
+ if (TYPE_CODE (eltype) == TYPE_CODE_FLT
+ || TYPE_CODE (eltype) == TYPE_CODE_DECFLOAT)
+ ppc64_sysv_abi_push_freg (gdbarch, eltype, elval, argpos);
+ else if (TYPE_CODE (eltype) == TYPE_CODE_ARRAY
+ && TYPE_VECTOR (eltype)
+ && tdep->vector_abi == POWERPC_VEC_ALTIVEC
+ && TYPE_LENGTH (eltype) == 16)
+ ppc64_sysv_abi_push_vreg (gdbarch, elval, argpos);
+ }
+ }
}
}
@@ -1834,6 +2011,72 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
return RETURN_VALUE_REGISTER_CONVENTION;
}
+ /* In the ELFv2 ABI, homogeneous floating-point or vector
+ aggregates are returned in registers. */
+ if (tdep->elf_abi == POWERPC_ELF_V2
+ && ppc64_elfv2_abi_homogeneous_aggregate (valtype, &eltype, &nelt))
+ {
+ for (i = 0; i < nelt; i++)
+ {
+ ok = ppc64_sysv_abi_return_value_base (gdbarch, eltype, regcache,
+ readbuf, writebuf, i);
+ gdb_assert (ok);
+
+ if (readbuf)
+ readbuf += TYPE_LENGTH (eltype);
+ if (writebuf)
+ writebuf += TYPE_LENGTH (eltype);
+ }
+
+ return RETURN_VALUE_REGISTER_CONVENTION;
+ }
+
+ /* In the ELFv2 ABI, aggregate types of up to 16 bytes are
+ returned in registers r3:r4. */
+ if (tdep->elf_abi == POWERPC_ELF_V2
+ && TYPE_LENGTH (valtype) <= 16
+ && (TYPE_CODE (valtype) == TYPE_CODE_STRUCT
+ || TYPE_CODE (valtype) == TYPE_CODE_UNION
+ || (TYPE_CODE (valtype) == TYPE_CODE_ARRAY
+ && !TYPE_VECTOR (valtype))))
+ {
+ int n_regs = ((TYPE_LENGTH (valtype) + tdep->wordsize - 1)
+ / tdep->wordsize);
+ int i;
+
+ for (i = 0; i < n_regs; i++)
+ {
+ gdb_byte regval[MAX_REGISTER_SIZE];
+ int regnum = tdep->ppc_gp0_regnum + 3 + i;
+ int offset = i * tdep->wordsize;
+ int len = TYPE_LENGTH (valtype) - offset;
+
+ if (len > tdep->wordsize)
+ len = tdep->wordsize;
+
+ if (writebuf != NULL)
+ {
+ memset (regval, 0, sizeof regval);
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG
+ && offset == 0)
+ memcpy (regval + tdep->wordsize - len, writebuf, len);
+ else
+ memcpy (regval, writebuf + offset, len);
+ regcache_cooked_write (regcache, regnum, regval);
+ }
+ if (readbuf != NULL)
+ {
+ regcache_cooked_read (regcache, regnum, regval);
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG
+ && offset == 0)
+ memcpy (readbuf, regval + tdep->wordsize - len, len);
+ else
+ memcpy (readbuf + offset, regval, len);
+ }
+ }
+ return RETURN_VALUE_REGISTER_CONVENTION;
+ }
+
/* Handle plain base types. */
if (ppc64_sysv_abi_return_value_base (gdbarch, valtype, regcache,
readbuf, writebuf, 0))

View File

@ -1,375 +0,0 @@
commit 591a12a1d4c8843343eb999145d8bcc1efedf408
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Date: Tue Feb 4 18:44:14 2014 +0100
PowerPC64 ELFv2 ABI: skip global entry point code
This patch handles another aspect of the ELFv2 ABI, which unfortunately
requires common code changes.
In ELFv2, functions may provide both a global and a local entry point.
The global entry point (where the function symbol points to) is intended
to be used for function-pointer or cross-module (PLT) calls, and requires
r12 to be set up to the entry point address itself. The local entry
point (which is found at a fixed offset after the global entry point,
as defined by bits in the symbol table entries' st_other field), instead
expects r2 to be set up to the current TOC.
Now, when setting a breakpoint on a function by name, you really want
that breakpoint to trigger either way, no matter whether the function
is called via its local or global entry point. Since the global entry
point will always fall through into the local entry point, the way to
achieve that is to simply set the breakpoint at the local entry point.
One way to do that would be to have prologue parsing skip the code
sequence that makes up the global entry point. Unfortunately, this
does not work reliably, since -for optimized code- GDB these days
will not actuall invoke the prologue parsing code but instead just
set the breakpoint at the symbol address and rely on DWARF being
correct at any point throughout the function ...
Unfortunately, I don't really see any way to express the notion of
local entry points with the current set of gdbarch callbacks.
Thus this patch adds a new callback, skip_entrypoint, that is
somewhat analogous to skip_prologue, but is called every time
GDB needs to determine a function start address, even in those
cases where GDB decides to not call skip_prologue.
As a side effect, the skip_entrypoint implementation on ppc64
does not need to perform any instruction parsing; it can simply
rely on the local entry point flags in the symbol table entry.
With this implemented, two test cases would still fail to set
the breakpoint correctly, but that's because they use the construct:
gdb_test "break *hello"
Now, using "*hello" explicitly instructs GDB to set the breakpoint
at the numerical value of "hello" treated as function pointer, so
it will by definition only hit the global entry point.
I think this behaviour is unavoidable, but acceptable -- most people
do not use this construct, and if they do, they get what they
asked for ...
In one of those two test cases, use of this construct is really
not appropriate. I think this was added way back when as a means
to work around prologue skipping problems on some platforms. These
days that shouldn't really be necessary any more ...
For the other (step-bt), we really want to make sure backtracing
works on the very first instruction of the routine. To enable that
test also on powerpc64le-linux, we can modify the code to call the
test function via function pointer (which makes it use the global
entry point in the ELFv2 ABI).
gdb/ChangeLog:
* gdbarch.sh (skip_entrypoint): New callback.
* gdbarch.c, gdbarch.h: Regenerate.
* symtab.c (skip_prologue_sal): Call gdbarch_skip_entrypoint.
* infrun.c (fill_in_stop_func): Likewise.
* ppc-linux-tdep.c: Include "elf/ppc64.h".
(ppc_elfv2_elf_make_msymbol_special): New function.
(ppc_elfv2_skip_entrypoint): Likewise.
(ppc_linux_init_abi): Install them for ELFv2.
gdb/testsuite/ChangeLog:
* gdb.base/sigbpt.exp: Do not use "*" when setting breakpoint
on a function.
* gdb.base/step-bt.c: Call hello via function pointer to make
sure its first instruction is executed on powerpc64le-linux.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,16 @@
2014-02-04 Ulrich Weigand  <uweigand@de.ibm.com>
+ * gdbarch.sh (skip_entrypoint): New callback.
+ * gdbarch.c, gdbarch.h: Regenerate.
+ * symtab.c (skip_prologue_sal): Call gdbarch_skip_entrypoint.
+ * infrun.c (fill_in_stop_func): Likewise.
+ * ppc-linux-tdep.c: Include "elf/ppc64.h".
+ (ppc_elfv2_elf_make_msymbol_special): New function.
+ (ppc_elfv2_skip_entrypoint): Likewise.
+ (ppc_linux_init_abi): Install them for ELFv2.
+
+2014-02-04 Ulrich Weigand  <uweigand@de.ibm.com>
+
* ppc-sysv-tdep.c (ppc64_aggregate_candidate): New routine.
(ppc64_elfv2_abi_homogeneous_aggregate): Likewise.
(ppc64_sysv_abi_push_param): Handle ELFv2 homogeneous structs.
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -229,6 +229,7 @@ struct gdbarch
gdbarch_return_in_first_hidden_param_p_ftype *return_in_first_hidden_param_p;
gdbarch_skip_prologue_ftype *skip_prologue;
gdbarch_skip_main_prologue_ftype *skip_main_prologue;
+ gdbarch_skip_entrypoint_ftype *skip_entrypoint;
gdbarch_inner_than_ftype *inner_than;
gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc;
gdbarch_remote_breakpoint_from_pc_ftype *remote_breakpoint_from_pc;
@@ -405,6 +406,7 @@ struct gdbarch startup_gdbarch =
default_return_in_first_hidden_param_p, /* return_in_first_hidden_param_p */
0, /* skip_prologue */
0, /* skip_main_prologue */
+ 0, /* skip_entrypoint */
0, /* inner_than */
0, /* breakpoint_from_pc */
default_remote_breakpoint_from_pc, /* remote_breakpoint_from_pc */
@@ -714,6 +716,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
if (gdbarch->skip_prologue == 0)
fprintf_unfiltered (log, "\n\tskip_prologue");
/* Skip verify of skip_main_prologue, has predicate. */
+ /* Skip verify of skip_entrypoint, has predicate. */
if (gdbarch->inner_than == 0)
fprintf_unfiltered (log, "\n\tinner_than");
if (gdbarch->breakpoint_from_pc == 0)
@@ -1353,6 +1356,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: single_step_through_delay = <%s>\n",
host_address_to_string (gdbarch->single_step_through_delay));
fprintf_unfiltered (file,
+ "gdbarch_dump: gdbarch_skip_entrypoint_p() = %d\n",
+ gdbarch_skip_entrypoint_p (gdbarch));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: skip_entrypoint = <%s>\n",
+ host_address_to_string (gdbarch->skip_entrypoint));
+ fprintf_unfiltered (file,
"gdbarch_dump: gdbarch_skip_main_prologue_p() = %d\n",
gdbarch_skip_main_prologue_p (gdbarch));
fprintf_unfiltered (file,
@@ -2703,6 +2712,30 @@ set_gdbarch_skip_main_prologue (struct gdbarch *gdbarch,
}
int
+gdbarch_skip_entrypoint_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->skip_entrypoint != NULL;
+}
+
+CORE_ADDR
+gdbarch_skip_entrypoint (struct gdbarch *gdbarch, CORE_ADDR ip)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->skip_entrypoint != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_entrypoint called\n");
+ return gdbarch->skip_entrypoint (gdbarch, ip);
+}
+
+void
+set_gdbarch_skip_entrypoint (struct gdbarch *gdbarch,
+ gdbarch_skip_entrypoint_ftype skip_entrypoint)
+{
+ gdbarch->skip_entrypoint = skip_entrypoint;
+}
+
+int
gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs)
{
gdb_assert (gdbarch != NULL);
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -486,6 +486,24 @@ typedef CORE_ADDR (gdbarch_skip_main_prologue_ftype) (struct gdbarch *gdbarch, C
extern CORE_ADDR gdbarch_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR ip);
extern void set_gdbarch_skip_main_prologue (struct gdbarch *gdbarch, gdbarch_skip_main_prologue_ftype *skip_main_prologue);
+/* On some platforms, a single function may provide multiple entry points,
+ e.g. one that is used for function-pointer calls and a different one
+ that is used for direct function calls.
+ In order to ensure that breakpoints set on the function will trigger
+ no matter via which entry point the function is entered, a platform
+ may provide the skip_entrypoint callback. It is called with IP set
+ to the main entry point of a function (as determined by the symbol table),
+ and should return the address of the innermost entry point, where the
+ actual breakpoint needs to be set. Note that skip_entrypoint is used
+ by GDB common code even when debugging optimized code, where skip_prologue
+ is not used. */
+
+extern int gdbarch_skip_entrypoint_p (struct gdbarch *gdbarch);
+
+typedef CORE_ADDR (gdbarch_skip_entrypoint_ftype) (struct gdbarch *gdbarch, CORE_ADDR ip);
+extern CORE_ADDR gdbarch_skip_entrypoint (struct gdbarch *gdbarch, CORE_ADDR ip);
+extern void set_gdbarch_skip_entrypoint (struct gdbarch *gdbarch, gdbarch_skip_entrypoint_ftype *skip_entrypoint);
+
typedef int (gdbarch_inner_than_ftype) (CORE_ADDR lhs, CORE_ADDR rhs);
extern int gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs);
extern void set_gdbarch_inner_than (struct gdbarch *gdbarch, gdbarch_inner_than_ftype *inner_than);
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -530,6 +530,19 @@ m:int:return_in_first_hidden_param_p:struct type *type:type::default_return_in_f
m:CORE_ADDR:skip_prologue:CORE_ADDR ip:ip:0:0
M:CORE_ADDR:skip_main_prologue:CORE_ADDR ip:ip
+# On some platforms, a single function may provide multiple entry points,
+# e.g. one that is used for function-pointer calls and a different one
+# that is used for direct function calls.
+# In order to ensure that breakpoints set on the function will trigger
+# no matter via which entry point the function is entered, a platform
+# may provide the skip_entrypoint callback. It is called with IP set
+# to the main entry point of a function (as determined by the symbol table),
+# and should return the address of the innermost entry point, where the
+# actual breakpoint needs to be set. Note that skip_entrypoint is used
+# by GDB common code even when debugging optimized code, where skip_prologue
+# is not used.
+M:CORE_ADDR:skip_entrypoint:CORE_ADDR ip:ip
+
f:int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs:0:0
m:const gdb_byte *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr::0:
# Return the adjusted address and kind to use for Z0/Z1 packets.
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -3159,6 +3159,10 @@ fill_in_stop_func (struct gdbarch *gdbarch,
ecs->stop_func_start
+= gdbarch_deprecated_function_start_offset (gdbarch);
+ if (gdbarch_skip_entrypoint_p (gdbarch))
+ ecs->stop_func_start = gdbarch_skip_entrypoint (gdbarch,
+ ecs->stop_func_start);
+
ecs->stop_func_filled_in = 1;
}
}
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -44,6 +44,7 @@
#include "observer.h"
#include "auxv.h"
#include "elf/common.h"
+#include "elf/ppc64.h"
#include "exceptions.h"
#include "arch-utils.h"
#include "spu-tdep.h"
@@ -876,6 +877,55 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch,
}
}
+
+/* Implementation of `gdbarch_elf_make_msymbol_special', as defined in
+ gdbarch.h. This implementation is used for the ELFv2 ABI only. */
+
+static void
+ppc_elfv2_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
+{
+ elf_symbol_type *elf_sym = (elf_symbol_type *)sym;
+
+ /* If the symbol is marked as having a local entry point, set a target
+ flag in the msymbol. We currently only support local entry point
+ offsets of 8 bytes, which is the only entry point offset ever used
+ by current compilers. If/when other offsets are ever used, we will
+ have to use additional target flag bits to store them. */
+ switch (PPC64_LOCAL_ENTRY_OFFSET (elf_sym->internal_elf_sym.st_other))
+ {
+ default:
+ break;
+ case 8:
+ MSYMBOL_TARGET_FLAG_1 (msym) = 1;
+ break;
+ }
+}
+
+/* Implementation of `gdbarch_skip_entrypoint', as defined in
+ gdbarch.h. This implementation is used for the ELFv2 ABI only. */
+
+static CORE_ADDR
+ppc_elfv2_skip_entrypoint (struct gdbarch *gdbarch, CORE_ADDR pc)
+{
+ struct bound_minimal_symbol fun;
+ int local_entry_offset = 0;
+
+ fun = lookup_minimal_symbol_by_pc (pc);
+ if (fun.minsym == NULL)
+ return pc;
+
+ /* See ppc_elfv2_elf_make_msymbol_special for how local entry point
+ offset values are encoded. */
+ if (MSYMBOL_TARGET_FLAG_1 (fun.minsym))
+ local_entry_offset = 8;
+
+ if (SYMBOL_VALUE_ADDRESS (fun.minsym) <= pc
+ && pc < SYMBOL_VALUE_ADDRESS (fun.minsym) + local_entry_offset)
+ return SYMBOL_VALUE_ADDRESS (fun.minsym) + local_entry_offset;
+
+ return pc;
+}
+
/* Implementation of `gdbarch_stap_is_single_operand', as defined in
gdbarch.h. */
@@ -1349,6 +1399,13 @@ ppc_linux_init_abi (struct gdbarch_info info,
set_gdbarch_elf_make_msymbol_special
(gdbarch, ppc64_elf_make_msymbol_special);
}
+ else
+ {
+ set_gdbarch_elf_make_msymbol_special
+ (gdbarch, ppc_elfv2_elf_make_msymbol_special);
+
+ set_gdbarch_skip_entrypoint (gdbarch, ppc_elfv2_skip_entrypoint);
+ }
/* Shared library handling. */
set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code);
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2950,6 +2950,8 @@ skip_prologue_sal (struct symtab_and_line *sal)
/* Skip "first line" of function (which is actually its prologue). */
pc += gdbarch_deprecated_function_start_offset (gdbarch);
+ if (gdbarch_skip_entrypoint_p (gdbarch))
+ pc = gdbarch_skip_entrypoint (gdbarch, pc);
if (skip)
pc = gdbarch_skip_prologue (gdbarch, pc);
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,5 +1,12 @@
2014-02-04 Ulrich Weigand <uweigand@de.ibm.com>
+ * gdb.base/sigbpt.exp: Do not use "*" when setting breakpoint
+ on a function.
+ * gdb.base/step-bt.c: Call hello via function pointer to make
+ sure its first instruction is executed on powerpc64le-linux.
+
+2014-02-04 Ulrich Weigand <uweigand@de.ibm.com>
+
* gdb.arch/powerpc-d128-regs.exp: Enable on powerpc64*-*.
2014-02-04 Ulrich Weigand <uweigand@de.ibm.com>
--- a/gdb/testsuite/gdb.base/sigbpt.exp
+++ b/gdb/testsuite/gdb.base/sigbpt.exp
@@ -76,7 +76,7 @@ gdb_test "break keeper"
set bowler_addrs bowler
set segv_addr none
gdb_test {display/i $pc}
-gdb_test "advance *bowler" "bowler.*" "advance to the bowler"
+gdb_test "advance bowler" "bowler.*" "advance to the bowler"
set test "stepping to fault"
set signame "SIGSEGV"
gdb_test_multiple "stepi" "$test" {
--- a/gdb/testsuite/gdb.base/step-bt.c
+++ b/gdb/testsuite/gdb.base/step-bt.c
@@ -23,10 +23,19 @@ hello (void)
printf ("Hello world.\n");
}
+/* The test case uses "break *hello" to make sure to step at the very
+ first instruction of the function. This causes a problem running
+ the test on powerpc64le-linux, since the first instruction belongs
+ to the global entry point prologue, which is skipped when doing a
+ local direct function call. To make sure that first instruction is
+ indeed being executed and the breakpoint hits, we make sure to call
+ the routine via an indirect call. */
+void (*ptr) (void) = hello;
+
int
main (void)
{
- hello ();
+ ptr ();
return 0;
}

View File

@ -1,90 +0,0 @@
commit bc9a55253ed7122cfeee90cd23d964f44c8b0e6a
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Date: Tue Mar 25 15:39:32 2014 +0100
Support gdb.asm/asm-source.exp on powerpc64le
Add new powerpc64le.inc file appropriate for the ELFv2 ABI and
use it to support the asm-source.exp test case on powerpc64le.
gdb/testsuite/
2014-03-25 Ulrich Weigand <uweigand@de.ibm.com>
* gdb.asm/asm-source.exp: Handle powerpc64le-* targets.
* gdb.asm/powerpc64le.inc: New file.
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,3 +1,8 @@
+2014-03-25 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * gdb.asm/asm-source.exp: Handle powerpc64le-* targets.
+ * gdb.asm/powerpc64le.inc: New file.
+
2014-03-25 Pedro Alves <palves@redhat.com>
Doug Evans <dje@google.com>
--- a/gdb/testsuite/gdb.asm/asm-source.exp
+++ b/gdb/testsuite/gdb.asm/asm-source.exp
@@ -97,6 +97,11 @@ switch -glob -- [istarget] {
"mips*-*" {
set asm-arch mips
}
+ "powerpc64le-*" {
+ set asm-arch powerpc64le
+ set asm-flags "-a64 -I${srcdir}/${subdir} $obj_include"
+ append link-flags " -m elf64lppc"
+ }
"powerpc*-*" {
if { [is_lp64_target] } {
set asm-arch powerpc64
--- /dev/null
+++ b/gdb/testsuite/gdb.asm/powerpc64le.inc
@@ -0,0 +1,47 @@
+ comment "subroutine prologue"
+ .macro gdbasm_enter
+ stdu 1, -32(1)
+ mflr 0
+ std 0, 48(1)
+ .endm
+
+ comment "subroutine epilogue"
+ .macro gdbasm_leave
+ ld 0, 48(1)
+ mtlr 0
+ ld 1, 0(1)
+ blr
+ .endm
+
+ .macro gdbasm_call subr
+ bl \subr
+ nop
+ .endm
+
+ .macro gdbasm_several_nops
+ nop
+ nop
+ nop
+ nop
+ .endm
+
+ comment "exit (0)"
+ .macro gdbasm_exit0
+ comment "sys_exit"
+ li 0, 1
+ sc
+ .endm
+
+ comment "crt0 startup"
+ .macro gdbasm_startup
+ .abiversion 2
+ .p2align 2
+ .endm
+
+ comment "Declare a data variable"
+ .purgem gdbasm_datavar
+ .macro gdbasm_datavar name value
+ .section ".data"
+\name:
+ .long \value
+ .endm

View File

@ -1,369 +1,321 @@
http://sourceware.org/ml/gdb-patches/2014-02/msg00179.html
Subject: [obv] testsuite: Fix i386-sse-stack-align.exp regression since GDB_PARALLEL
http://sourceware.org/ml/gdb-patches/2014-06/msg00656.html
Subject: Re: Regression with default scheduler-locking=step [Re: [pushed] Consecutive step-overs trigger internal error.]
On 06/17/2014 08:24 PM, Jan Kratochvil wrote:
> On Tue, 22 Apr 2014 20:24:28 +0200, Pedro Alves wrote:
>> Tested on x86_64 Fedora 17, native and gdbserver, and also native on
>> top of my "software single-step on x86_64" series.
>
> 483805cf9ea5a6dace41415d8830e93fccc49c43 is the first bad commit
> commit 483805cf9ea5a6dace41415d8830e93fccc49c43
> Author: Pedro Alves <palves@redhat.com>
> Date: Tue Apr 22 15:00:56 2014 +0100
> Consecutive step-overs trigger internal error.
>
> (gdb) next^M
> [Thread 0x7ffff7fda700 (LWP 27168) exited]^M
> [New LWP 27168]^M
> [Thread 0x7ffff74ee700 (LWP 27174) exited]^M
> process 27168 is executing new program: /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.threads/thread-execl^M
> [Thread debugging using libthread_db enabled]^M
> Using host libthread_db library "/lib64/libthread_db.so.1".^M
> infrun.c:5225: internal-error: switch_back_to_stepped_thread: Assertion `!schedlock_applies (1)' failed.^M
> A problem internal to GDB has been detected,^M
> further debugging may prove unreliable.^M
> Quit this debugging session? (y or n) FAIL: gdb.threads/thread-execl.exp: get to main in new image (GDB internal error)
> Resyncing due to internal error.
--u3/rZRmxL6MmkK24
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Thanks Jan.
Hi Tom,
>
> The regressions happens only with the attached patch which I am not sure if it
> is considered as a valid FSF GDB regression or not but I think it is.
$ make check//unix/-m32 RUNTESTFLAGS="gdb.arch/i386-sse-stack-align.exp GDB_PARALLEL=1"
[...]
Running /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp ...
ERROR: (/home/jkratoch/redhat/gdb-clean/gdb/testsuite.unix.-m32/outputs/gdb.arch/i386-sse-stack-align/i386-sse-stack-align) No such file or directory
If it worked before, then it's certainly a regression. The user is
free to do "set scheduler-locking step" herself.
Here's a fix. Let me know what you think.
Checked in.
8<---------------------------------
>From f717378c16cb04f8350935a1336767d2541b36a5 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Wed, 18 Jun 2014 14:20:31 +0100
Subject: [PATCH] Fix next over threaded execl with "set scheduler-locking
Subject: [PATCH] Fix next over threaded execl with "set scheduler-locking
step".
Running gdb.threads/thread-execl.exp with scheduler-locking set to
"step" reveals a problem:
Jan
(gdb) next^M
[Thread 0x7ffff7fda700 (LWP 27168) exited]^M
[New LWP 27168]^M
[Thread 0x7ffff74ee700 (LWP 27174) exited]^M
process 27168 is executing new program: /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.threads/thread-execl^M
[Thread debugging using libthread_db enabled]^M
Using host libthread_db library "/lib64/libthread_db.so.1".^M
infrun.c:5225: internal-error: switch_back_to_stepped_thread: Assertion `!schedlock_applies (1)' failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
Quit this debugging session? (y or n) FAIL: gdb.threads/thread-execl.exp: schedlock step: get to main in new image (GDB internal error)
--u3/rZRmxL6MmkK24
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline; filename=1
The assertion is correct. The issue is that GDB is mistakenly trying
to switch back to an exited thread, that was previously stepping when
it exited. This is exactly the sort of thing the test wants to make
sure doesn't happen:
commit 3c77faf33dc4c7bb693f05f44077ed687e9f8217
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Thu Feb 6 23:14:20 2014 +0100
# Now set a breakpoint at `main', and step over the execl call. The
# breakpoint at main should be reached. GDB should not try to revert
# back to the old thread from the old image and resume stepping it
Fix i386-sse-stack-align.exp regression since GDB_PARALLEL.
We don't see this bug with schedlock off only because a different
sequence of events makes GDB manage to delete the thread instead of
marking it exited.
gdb/testsuite/
2014-02-06 Jan Kratochvil <jan.kratochvil@redhat.com>
This particular internal error can be fixed by making the loop over
all threads in switch_back_to_stepped_thread skip exited threads.
But, looking over other ALL_THREADS users, all either can or should be
skipping exited threads too. So for simplicity, this patch replaces
ALL_THREADS with a new macro that skips exited threads itself, and
updates everything to use it.
Fix i386-sse-stack-align.exp regression since GDB_PARALLEL.
* gdb.arch/i386-sse-stack-align.exp: Use standard_output_file.
Tested on x86_64 Fedora 20.
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 8c846b8..13ccaf3 100644
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,3 +1,8 @@
+2014-02-06 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix i386-sse-stack-align.exp regression since GDB_PARALLEL.
+ * gdb.arch/i386-sse-stack-align.exp: Use standard_output_file.
+
2014-02-06 Doug Evans <xdje42@gmail.com>
gdb/
2014-06-18 Pedro Alves <palves@redhat.com>
* gdb.python/py-breakpoint.exp (test_bkpt_eval_funcs): Update expected
diff --git a/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp b/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp
index b5a7e1e..462df1f 100644
--- a/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp
+++ b/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp
@@ -22,7 +22,7 @@ set testfile "i386-sse-stack-align"
set srcfile ${testfile}.S
set csrcfile ${testfile}.c
set executable ${testfile}
-set binfile ${objdir}/${subdir}/${executable}
+set binfile [standard_output_file ${executable}]
set opts {}
* gdbthread.h (ALL_THREADS): Delete.
(ALL_NON_EXITED_THREADS): New macro.
* btrace.c (btrace_free_objfile): Use ALL_NON_EXITED_THREADS
instead of ALL_THREADS.
* infrun.c (find_thread_needs_step_over)
(switch_back_to_stepped_thread): Use ALL_NON_EXITED_THREADS
instead of ALL_THREADS.
* record-btrace.c (record_btrace_open)
(record_btrace_stop_recording, record_btrace_close)
(record_btrace_is_replaying, record_btrace_resume)
(record_btrace_find_thread_to_move, record_btrace_wait): Likewise.
* remote.c (append_pending_thread_resumptions): Likewise.
if [info exists COMPILE] {
gdb/testsuite/
2014-06-18 Pedro Alves <palves@redhat.com>
--u3/rZRmxL6MmkK24--
* gdb.threads/thread-execl.exp (do_test): New procedure, factored
out from ...
(top level): ... here. Iterate running tests under different
scheduler-locking settings.
---
gdb/btrace.c | 2 +-
gdb/gdbthread.h | 8 ++++--
gdb/infrun.c | 4 +--
gdb/record-btrace.c | 14 +++++-----
gdb/remote.c | 2 +-
gdb/testsuite/gdb.threads/thread-execl.exp | 44 ++++++++++++++++++++----------
gdb/thread.c | 2 +-
7 files changed, 46 insertions(+), 30 deletions(-)
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 601eb41..87a171e 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -958,7 +958,7 @@ btrace_free_objfile (struct objfile *objfile)
DEBUG ("free objfile");
commit 20dca09662aa0d2706fbe325b8f448ef74773028
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Tue May 13 14:55:53 2014 +0200
PR target/16940 S390: Fix erroneous offset in fill_gregset.
This fixes a bug that leads to various failures when debugging a
31-bit inferior with a 64-bit gdb on s390x.
Conflicts:
gdb/ChangeLog
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,9 @@
+2014-05-13 Andreas Arnez <arnez@vnet.linux.ibm.com>
+
+ PR target/16940
+ * s390-linux-nat.c (fill_gregset): Remove erroneous offset 4 in
+ call to regcache_raw_collect.
+
2014-05-05 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 7.7.1.DATE-cvs.
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -164,7 +164,7 @@ fill_gregset (const struct regcache *regcache, gregset_t *regp, int regno)
memset (p, 0, 4);
p += 4;
}
- regcache_raw_collect (regcache, reg, p + 4);
+ regcache_raw_collect (regcache, reg, p);
}
- ALL_THREADS (tp)
+ ALL_NON_EXITED_THREADS (tp)
btrace_clear (tp);
}
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index 9f5dee6..64e37c3 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -317,10 +317,12 @@ void thread_change_ptid (ptid_t old_ptid, ptid_t new_ptid);
typedef int (*thread_callback_func) (struct thread_info *, void *);
extern struct thread_info *iterate_over_threads (thread_callback_func, void *);
-/* Traverse all threads. */
+/* Traverse all threads, except those that have THREAD_EXITED
+ state. */
-#define ALL_THREADS(T) \
- for (T = thread_list; T; T = T->next)
+#define ALL_NON_EXITED_THREADS(T) \
+ for (T = thread_list; T; T = T->next) \
+ if ((T)->state != THREAD_EXITED)
https://bugzilla.redhat.com/show_bug.cgi?id=1086894
commit f2205de0080d999c9b67872c9db471c31b53e378
Author: Hui Zhu <teawater@gmail.com>
Date: Tue May 20 13:19:06 2014 +0800
extern int thread_count (void);
Fix issue #15778: GDB Aarch64 signal frame unwinder issue
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 4e808d9..e8e26e0 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2160,7 +2160,7 @@ find_thread_needs_step_over (int step, struct thread_info *except)
return NULL;
}
The root cause of this issue is unwinder of "#3 <signal handler called>"
doesn't supply right values of registers.
When GDB want to get the previous frame of "#3 <signal handler called>",
it will call cache init function of unwinder "aarch64_linux_sigframe_init".
The address or the value of the registers is get from this function.
So the bug is inside thie function.
I check the asm code of "#3 <signal handler called>":
(gdb) frame 3
(gdb) p $pc
$1 = (void (*)()) 0x7f931fa4d0
(gdb) disassemble $pc, +10
Dump of assembler code from 0x7f931fa4d0 to 0x7f931fa4da:
=> 0x0000007f931fa4d0: mov x8, #0x8b // #139
0x0000007f931fa4d4: svc #0x0
0x0000007f931fa4d8: nop
This is the syscall sys_rt_sigreturn, Linux kernel function "restore_sigframe"
will set the frame:
for (i = 0; i < 31; i++)
__get_user_error(regs->regs[i], &sf->uc.uc_mcontext.regs[i],
err);
__get_user_error(regs->sp, &sf->uc.uc_mcontext.sp, err);
__get_user_error(regs->pc, &sf->uc.uc_mcontext.pc, err);
The struct of uc_mcontext is:
struct sigcontext {
__u64 fault_address;
/* AArch64 registers */
__u64 regs[31];
__u64 sp;
__u64 pc;
__u64 pstate;
/* 4K reserved for FP/SIMD state and future expansion */
__u8 __reserved[4096] __attribute__((__aligned__(16)));
};
But in GDB function "aarch64_linux_sigframe_init", the code the get address
of registers is:
for (i = 0; i < 31; i++)
- ALL_THREADS (tp)
+ ALL_NON_EXITED_THREADS (tp)
{
trad_frame_set_reg_addr (this_cache,
AARCH64_X0_REGNUM + i,
sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET
+ i * AARCH64_SIGCONTEXT_REG_SIZE);
}
trad_frame_set_reg_addr (this_cache, AARCH64_FP_REGNUM, fp);
trad_frame_set_reg_addr (this_cache, AARCH64_LR_REGNUM, fp + 8);
trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM, fp + 8);
The code that get pc and sp is not right, so I change the code according
to Linux kernel code:
trad_frame_set_reg_addr (this_cache, AARCH64_SP_REGNUM,
sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET
+ 31 * AARCH64_SIGCONTEXT_REG_SIZE);
trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM,
sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET
+ 32 * AARCH64_SIGCONTEXT_REG_SIZE);
The issue was fixed by this change, and I did the regression test. It
also fixed a lot of other XFAIL and FAIL.
2014-05-20 Hui Zhu <hui@codesourcery.com>
Yao Qi <yao@codesourcery.com>
PR backtrace/16558
* aarch64-linux-tdep.c (aarch64_linux_sigframe_init): Update comments
and change address of sp and pc.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,10 @@
+2014-05-20 Hui Zhu <hui@codesourcery.com>
+ Yao Qi <yao@codesourcery.com>
+
+ PR backtrace/16558
+ * aarch64-linux-tdep.c (aarch64_linux_sigframe_init): Update comments
+ and change address of sp and pc.
+
2014-05-19 Tom Tromey <tromey@redhat.com>
* gdbtypes.c (rank_function): Use XNEWVEC.
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -53,28 +53,30 @@
/* Signal frame handling.
- +----------+ ^
- | saved lr | |
- +->| saved fp |--+
- | | |
- | | |
- | +----------+
- | | saved lr |
- +--| saved fp |
- ^ | |
- | | |
- | +----------+
- ^ | |
- | | signal |
- | | |
- | | saved lr |-->interrupted_function_pc
- +--| saved fp |
- | +----------+
- | | saved lr |--> default_restorer (movz x8, NR_sys_rt_sigreturn; svc 0)
- +--| saved fp |<- FP
- | |
- | |<- SP
- +----------+
+ +------------+ ^
+ | saved lr | |
+ +->| saved fp |--+
+ | | |
+ | | |
+ | +------------+
+ | | saved lr |
+ +--| saved fp |
+ ^ | |
+ | | |
+ | +------------+
+ ^ | |
+ | | signal |
+ | | | SIGTRAMP_FRAME (struct rt_sigframe)
+ | | saved regs |
+ +--| saved sp |--> interrupted_sp
+ | | saved pc |--> interrupted_pc
+ | | |
+ | +------------+
+ | | saved lr |--> default_restorer (movz x8, NR_sys_rt_sigreturn; svc 0)
+ +--| saved fp |<- FP
+ | | NORMAL_FRAME
+ | |<- SP
+ +------------+
On signal delivery, the kernel will create a signal handler stack
frame and setup the return address in LR to point at restorer stub.
@@ -123,6 +125,8 @@
d28015a8 movz x8, #0xad
d4000001 svc #0x0
+ This is a system call sys_rt_sigreturn.
+
We detect signal frames by snooping the return code for the restorer
instruction sequence.
@@ -146,7 +150,6 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self,
/* Ignore the EXCEPT thread. */
if (tp == except)
@@ -5204,7 +5204,7 @@ switch_back_to_stepped_thread (struct execution_control_state *ecs)
step/next/etc. */
stepping_thread = NULL;
step_over = NULL;
- ALL_THREADS (tp)
+ ALL_NON_EXITED_THREADS (tp)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
CORE_ADDR sp = get_frame_register_unsigned (this_frame, AARCH64_SP_REGNUM);
- CORE_ADDR fp = get_frame_register_unsigned (this_frame, AARCH64_FP_REGNUM);
CORE_ADDR sigcontext_addr =
sp
+ AARCH64_RT_SIGFRAME_UCONTEXT_OFFSET
@@ -160,12 +163,14 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self,
sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET
+ i * AARCH64_SIGCONTEXT_REG_SIZE);
/* Ignore threads of processes we're not resuming. */
if (!sched_multi
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index e0c537a8..6a9bfe1 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -206,7 +206,7 @@ record_btrace_open (char *args, int from_tty)
gdb_assert (record_btrace_thread_observer == NULL);
disable_chain = make_cleanup (null_cleanup, NULL);
- ALL_THREADS (tp)
+ ALL_NON_EXITED_THREADS (tp)
if (args == NULL || *args == 0 || number_is_in_list (args, tp->num))
{
btrace_enable (tp);
@@ -238,7 +238,7 @@ record_btrace_stop_recording (struct target_ops *self)
record_btrace_auto_disable ();
- ALL_THREADS (tp)
+ ALL_NON_EXITED_THREADS (tp)
if (tp->btrace.target != NULL)
btrace_disable (tp);
}
-
- trad_frame_set_reg_addr (this_cache, AARCH64_FP_REGNUM, fp);
- trad_frame_set_reg_addr (this_cache, AARCH64_LR_REGNUM, fp + 8);
- trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM, fp + 8);
-
- trad_frame_set_id (this_cache, frame_id_build (fp, func));
+ trad_frame_set_reg_addr (this_cache, AARCH64_SP_REGNUM,
+ sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET
+ + 31 * AARCH64_SIGCONTEXT_REG_SIZE);
+ trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM,
+ sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET
+ + 32 * AARCH64_SIGCONTEXT_REG_SIZE);
+
+ trad_frame_set_id (this_cache, frame_id_build (sp, func));
@@ -259,7 +259,7 @@ record_btrace_close (struct target_ops *self)
/* We should have already stopped recording.
Tear down btrace in case we have not. */
- ALL_THREADS (tp)
+ ALL_NON_EXITED_THREADS (tp)
btrace_teardown (tp);
}
static const struct tramp_frame aarch64_linux_rt_sigframe =
@@ -835,7 +835,7 @@ record_btrace_is_replaying (struct target_ops *self)
{
struct thread_info *tp;
- ALL_THREADS (tp)
+ ALL_NON_EXITED_THREADS (tp)
if (btrace_is_replaying (tp))
return 1;
@@ -1522,7 +1522,7 @@ record_btrace_resume (struct target_ops *ops, ptid_t ptid, int step,
Bug 1102624 - latest gdb -15 build is FTBFS on aarch64
https://bugzilla.redhat.com/show_bug.cgi?id=1102624
commit 036cd38182bde32d8297b630cd5c861d53b8949e
Author: Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
Date: Thu May 22 16:07:20 2014 +0100
/* Stop replaying other threads if the thread to resume is not replaying. */
if (!btrace_is_replaying (tp) && execution_direction != EXEC_REVERSE)
- ALL_THREADS (other)
+ ALL_NON_EXITED_THREADS (other)
record_btrace_stop_replaying (other);
Include asm/ptrace.h in aarch64-linux-nat.c
/* As long as we're not replaying, just forward the request. */
@@ -1572,7 +1572,7 @@ record_btrace_find_thread_to_move (ptid_t ptid)
return tp;
A recent change to glibc removed asm/ptrace.h from user.h for
AArch64. This meant that cross-native builds of gdb using trunk
glibc broke because aarch64-linux-nat.c because user_hwdebug_state
couldn't be found.
/* Otherwise, find one other thread that has been resumed. */
- ALL_THREADS (tp)
+ ALL_NON_EXITED_THREADS (tp)
if ((tp->btrace.flags & BTHR_MOVE) != 0)
return tp;
Fixed by including asm/ptrace.h like other ports.
@@ -1777,7 +1777,7 @@ record_btrace_wait (struct target_ops *ops, ptid_t ptid,
2014-05-22 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
/* Stop all other threads. */
if (!non_stop)
- ALL_THREADS (other)
+ ALL_NON_EXITED_THREADS (other)
other->btrace.flags &= ~BTHR_MOVE;
* aarch64-linux-nat.c (asm/ptrace.h): Include.
/* Start record histories anew from the current position. */
diff --git a/gdb/remote.c b/gdb/remote.c
index 6915dd8..b5318f1 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -4626,7 +4626,7 @@ append_pending_thread_resumptions (char *p, char *endp, ptid_t ptid)
{
struct thread_info *thread;
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,9 @@
2014-05-22 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
- ALL_THREADS (thread)
+ ALL_NON_EXITED_THREADS (thread)
if (ptid_match (thread->ptid, ptid)
&& !ptid_equal (inferior_ptid, thread->ptid)
&& thread->suspend.stop_signal != GDB_SIGNAL_0
diff --git a/gdb/testsuite/gdb.threads/thread-execl.exp b/gdb/testsuite/gdb.threads/thread-execl.exp
index d837fe4..14b96d2 100644
--- a/gdb/testsuite/gdb.threads/thread-execl.exp
+++ b/gdb/testsuite/gdb.threads/thread-execl.exp
@@ -28,19 +28,33 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
return -1
}
+ * aarch64-linux-nat.c (asm/ptrace.h): Include.
-clean_restart ${binfile}
-
-runto_main
-
-# Get ourselves to the thread that execs
-gdb_breakpoint "thread_execler"
-gdb_test "continue" ".*thread_execler.*" "continue to thread start"
-
-# Now set a breakpoint at `main', and step over the execl call. The
-# breakpoint at main should be reached. GDB should not try to revert
-# back to the old thread from the old image and resume stepping it
-# (since it is gone).
-gdb_breakpoint "main"
-gdb_test "next" ".*main.*" "get to main in new image"
+# Run the test proper. SCHEDLOCK specifies what scheduler-locking
+# should be set to.
+
+2014-05-22 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
+proc do_test { schedlock } {
+ global binfile
+
* MAINTAINERS (Write After Approval): Move self back from
paper trail.
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -33,6 +33,7 @@
#include <sys/ptrace.h>
#include <sys/utsname.h>
+#include <asm/ptrace.h>
#include "gregset.h"
commit e9dae05e9c32efda9724330c6d5ade3ca848591d
Author: Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
Date: Fri May 23 09:01:14 2014 +0100
Include asm/ptrace.h for linux-aarch64-low.c
A recent change to glibc removed asm/ptrace.h from user.h for AArch64.
This meant that cross-native builds of gdbserver using trunk glibc broke
because linux-aarch64-low.c because user_hwdebug_state couldn't be found.
This is like commit #036cd38182bde32d8297b630cd5c861d53b8949e
2014-05-23 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
* linux-aarch64-low.c (asm/ptrace.h): Include.
### a/gdb/gdbserver/ChangeLog
### b/gdb/gdbserver/ChangeLog
## -1,3 +1,7 @@
+2014-05-23 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
+ with_test_prefix "schedlock $schedlock" {
+ clean_restart ${binfile}
+
+ * linux-aarch64-low.c (asm/ptrace.h): Include.
+ if ![runto_main] {
+ return 0
+ }
+
2014-05-21 Jan Kratochvil <jan.kratochvil@redhat.com>
+ # Get ourselves to the thread that execs.
+ gdb_breakpoint "thread_execler"
+ gdb_test "continue" ".*thread_execler.*" "continue to thread start"
+
+ # Now set a breakpoint at `main', and step over the execl call. The
+ # breakpoint at main should be reached. GDB should not try to revert
+ # back to the old thread from the old image and resume stepping it
+ # (since it is gone).
+ gdb_breakpoint "main"
+ gdb_test_no_output "set scheduler-locking $schedlock"
+ gdb_test "next" ".*main.*" "get to main in new image"
+ }
+}
-return 0
+foreach schedlock {"off" "step" "on"} {
+ do_test $schedlock
+}
diff --git a/gdb/thread.c b/gdb/thread.c
index 7bc5271..532149d 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -1243,7 +1243,7 @@ thread_apply_all_command (char *cmd, int from_tty)
ta_cleanup.tp_array = tp_array;
ta_cleanup.count = tc;
- ALL_THREADS (tp)
+ ALL_NON_EXITED_THREADS (tp)
{
tp_array[i] = tp;
tp->refcount++;
--
1.9.3
Fix TLS access for -static -pthread.
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -26,6 +26,7 @@
#include <signal.h>
#include <sys/user.h>
#include <sys/ptrace.h>
+#include <asm/ptrace.h>
#include <sys/uio.h>
#include "gdb_proc_service.h"

270
gdb-vla-intel-01of23.patch Normal file
View File

@ -0,0 +1,270 @@
Subject: [PATCH 01/23] dwarf: add dwarf3 DW_OP_push_object_address opcode
Message-Id: <1401861266-6240-2-git-send-email-keven.boell@intel.com>
The opcode pushes the address of the object being evaluated. The semantic is
equivalent to the implicit push of the base address of a data member location.
2014-05-28 Sanimir Agovic <sanimir.agovic@intel.com>
Keven Boell <keven.boell@intel.com>
* dwarf2expr.c (execute_stack_op) <DW_OP_push_object_address>: New case.
* dwarf2expr.h (struct dwarf_expr_context_funcs)
<DW_OP_push_object_address>: New function pointer get_object_addr.
* dwarf2loc.c (struct dwarf_expr_baton): Add obj_address.
(dwarf_expr_get_obj_addr): New function.
(struct dwarf_expr_context_funcs): Add
dwarf_expr_get_obj_addr to dwarf_expr_ctx_funcs.
(dwarf2_evaluate_loc_desc_full): Initialize baton.obj_address.
(dwarf2_locexpr_baton_eval): Set baton.obj_address to addr.
(needs_get_obj_addr): New function.
(struct dwarf_expr_context_funcs): Add needs_get_obj_addr to
needs_frame_ctx_funcs.
Change-Id: Ied9e1ba632e8d35d0ec00cc832b96d432449fd82
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/dwarf2expr.c | 6 ++++++
gdb/dwarf2expr.h | 4 ----
gdb/dwarf2loc.c | 41 +++++++++++++++++++++++++++++++++++++----
gdb/dwarf2loc.h | 1 +
gdb/gdbtypes.c | 16 ++++++++--------
5 files changed, 52 insertions(+), 16 deletions(-)
Index: gdb-7.7.90.20140613/gdb/dwarf2expr.c
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/dwarf2expr.c 2014-06-14 15:02:21.484551132 +0200
+++ gdb-7.7.90.20140613/gdb/dwarf2expr.c 2014-06-14 15:02:52.299575369 +0200
@@ -1478,6 +1478,12 @@ execute_stack_op (struct dwarf_expr_cont
}
break;
+ case DW_OP_push_object_address:
+ /* Return the address of the object we are currently observing. */
+ result = (ctx->funcs->get_object_address) (ctx->baton);
+ result_val = value_from_ulongest (address_type, result);
+ break;
+
default:
error (_("Unhandled dwarf expression opcode 0x%x"), op);
}
Index: gdb-7.7.90.20140613/gdb/dwarf2expr.h
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/dwarf2expr.h 2014-06-14 15:02:21.485551133 +0200
+++ gdb-7.7.90.20140613/gdb/dwarf2expr.h 2014-06-14 15:02:52.299575369 +0200
@@ -84,12 +84,8 @@ struct dwarf_expr_context_funcs
This can throw an exception if the index is out of range. */
CORE_ADDR (*get_addr_index) (void *baton, unsigned int index);
-#if 0
- /* Not yet implemented. */
-
/* Return the `object address' for DW_OP_push_object_address. */
CORE_ADDR (*get_object_address) (void *baton);
-#endif
};
/* The location of a value. */
Index: gdb-7.7.90.20140613/gdb/dwarf2loc.c
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/dwarf2loc.c 2014-06-14 15:02:21.487551135 +0200
+++ gdb-7.7.90.20140613/gdb/dwarf2loc.c 2014-06-14 15:02:52.301575370 +0200
@@ -306,6 +306,7 @@ struct dwarf_expr_baton
{
struct frame_info *frame;
struct dwarf2_per_cu_data *per_cu;
+ CORE_ADDR obj_address;
};
/* Helper functions for dwarf2_evaluate_loc_desc. */
@@ -1209,6 +1210,7 @@ dwarf_expr_push_dwarf_reg_entry_value (s
baton_local.frame = caller_frame;
baton_local.per_cu = caller_per_cu;
+ baton_local.obj_address = 0;
saved_ctx.gdbarch = ctx->gdbarch;
saved_ctx.addr_size = ctx->addr_size;
@@ -1238,6 +1240,22 @@ dwarf_expr_get_addr_index (void *baton,
return dwarf2_read_addr_index (debaton->per_cu, index);
}
+/* Callback function for get_object_address. Return the address of the VLA
+ object. */
+
+static CORE_ADDR
+dwarf_expr_get_obj_addr (void *baton)
+{
+ struct dwarf_expr_baton *debaton = baton;
+
+ gdb_assert (debaton != NULL);
+
+ if (debaton->obj_address == 0)
+ error (_("Location address is not set."));
+
+ return debaton->obj_address;
+}
+
/* VALUE must be of type lval_computed with entry_data_value_funcs. Perform
the indirect method on it, that is use its stored target value, the sole
purpose of entry_data_value_funcs.. */
@@ -2206,7 +2224,8 @@ static const struct dwarf_expr_context_f
dwarf_expr_dwarf_call,
dwarf_expr_get_base_type,
dwarf_expr_push_dwarf_reg_entry_value,
- dwarf_expr_get_addr_index
+ dwarf_expr_get_addr_index,
+ dwarf_expr_get_obj_addr
};
/* Evaluate a location description, starting at DATA and with length
@@ -2235,6 +2254,7 @@ dwarf2_evaluate_loc_desc_full (struct ty
baton.frame = frame;
baton.per_cu = per_cu;
+ baton.obj_address = 0;
ctx = new_dwarf_expr_context ();
old_chain = make_cleanup_free_dwarf_expr_context (ctx);
@@ -2440,6 +2460,7 @@ dwarf2_evaluate_loc_desc (struct type *t
static int
dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
+ CORE_ADDR addr,
CORE_ADDR *valp)
{
struct dwarf_expr_context *ctx;
@@ -2455,6 +2476,7 @@ dwarf2_locexpr_baton_eval (const struct
baton.frame = get_selected_frame (NULL);
baton.per_cu = dlbaton->per_cu;
+ baton.obj_address = addr;
objfile = dwarf2_per_cu_objfile (dlbaton->per_cu);
@@ -2495,7 +2517,8 @@ dwarf2_locexpr_baton_eval (const struct
/* See dwarf2loc.h. */
int
-dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR *value)
+dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR address,
+ CORE_ADDR *value)
{
if (prop == NULL)
return 0;
@@ -2506,7 +2529,7 @@ dwarf2_evaluate_property (const struct d
{
const struct dwarf2_property_baton *baton = prop->data.baton;
- if (dwarf2_locexpr_baton_eval (&baton->locexpr, value))
+ if (dwarf2_locexpr_baton_eval (&baton->locexpr, address, value))
{
if (baton->referenced_type)
{
@@ -2657,6 +2680,15 @@ needs_get_addr_index (void *baton, unsig
return 1;
}
+/* DW_OP_push_object_address has a frame already passed thru. */
+
+static CORE_ADDR
+needs_get_obj_addr (void *baton)
+{
+ /* Nothing to do. */
+ return 1;
+}
+
/* Virtual method table for dwarf2_loc_desc_needs_frame below. */
static const struct dwarf_expr_context_funcs needs_frame_ctx_funcs =
@@ -2671,7 +2703,8 @@ static const struct dwarf_expr_context_f
needs_frame_dwarf_call,
NULL, /* get_base_type */
needs_dwarf_reg_entry_value,
- needs_get_addr_index
+ needs_get_addr_index,
+ needs_get_obj_addr
};
/* Return non-zero iff the location expression at DATA (length SIZE)
Index: gdb-7.7.90.20140613/gdb/dwarf2loc.h
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/dwarf2loc.h 2014-06-14 15:02:21.488551135 +0200
+++ gdb-7.7.90.20140613/gdb/dwarf2loc.h 2014-06-14 15:02:52.301575370 +0200
@@ -96,6 +96,7 @@ struct value *dwarf2_evaluate_loc_desc (
into VALUE, otherwise returns 0. */
int dwarf2_evaluate_property (const struct dynamic_prop *prop,
+ CORE_ADDR address,
CORE_ADDR *value);
CORE_ADDR dwarf2_read_addr_index (struct dwarf2_per_cu_data *per_cu,
Index: gdb-7.7.90.20140613/gdb/gdbtypes.c
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/gdbtypes.c 2014-06-14 15:02:21.490551137 +0200
+++ gdb-7.7.90.20140613/gdb/gdbtypes.c 2014-06-14 15:03:37.919609955 +0200
@@ -1657,7 +1657,7 @@ is_dynamic_type (struct type *type)
of that type. */
static struct type *
-resolve_dynamic_range (struct type *dyn_range_type)
+resolve_dynamic_range (struct type *dyn_range_type, CORE_ADDR addr)
{
CORE_ADDR value;
struct type *static_range_type;
@@ -1668,7 +1668,7 @@ resolve_dynamic_range (struct type *dyn_
gdb_assert (TYPE_CODE (dyn_range_type) == TYPE_CODE_RANGE);
prop = &TYPE_RANGE_DATA (dyn_range_type)->low;
- if (dwarf2_evaluate_property (prop, &value))
+ if (dwarf2_evaluate_property (prop, addr, &value))
{
low_bound.kind = PROP_CONST;
low_bound.data.const_val = value;
@@ -1680,7 +1680,7 @@ resolve_dynamic_range (struct type *dyn_
}
prop = &TYPE_RANGE_DATA (dyn_range_type)->high;
- if (dwarf2_evaluate_property (prop, &value))
+ if (dwarf2_evaluate_property (prop, addr, &value))
{
high_bound.kind = PROP_CONST;
high_bound.data.const_val = value;
@@ -1707,7 +1707,7 @@ resolve_dynamic_range (struct type *dyn_
of the associated array. */
static struct type *
-resolve_dynamic_array (struct type *type)
+resolve_dynamic_array (struct type *type, CORE_ADDR addr)
{
CORE_ADDR value;
struct type *elt_type;
@@ -1718,12 +1718,12 @@ resolve_dynamic_array (struct type *type
elt_type = type;
range_type = check_typedef (TYPE_INDEX_TYPE (elt_type));
- range_type = resolve_dynamic_range (range_type);
+ range_type = resolve_dynamic_range (range_type, addr);
ary_dim = check_typedef (TYPE_TARGET_TYPE (elt_type));
if (ary_dim != NULL && TYPE_CODE (ary_dim) == TYPE_CODE_ARRAY)
- elt_type = resolve_dynamic_array (TYPE_TARGET_TYPE (type));
+ elt_type = resolve_dynamic_array (TYPE_TARGET_TYPE (type), addr);
else
elt_type = TYPE_TARGET_TYPE (type);
@@ -1853,11 +1853,11 @@ resolve_dynamic_type (struct type *type,
}
case TYPE_CODE_ARRAY:
- resolved_type = resolve_dynamic_array (type);
+ resolved_type = resolve_dynamic_array (type, addr);
break;
case TYPE_CODE_RANGE:
- resolved_type = resolve_dynamic_range (type);
+ resolved_type = resolve_dynamic_range (type, addr);
break;
case TYPE_CODE_UNION:

192
gdb-vla-intel-02of23.patch Normal file
View File

@ -0,0 +1,192 @@
Subject: [PATCH 02/23] dwarf: add DW_AT_data_location support
Message-Id: <1401861266-6240-3-git-send-email-keven.boell@intel.com>
An object might have a descriptor proceeding the actual value.
To point the debugger to the actually value of an object
DW_AT_data_location is used for. For example the compile may
emit for this entity:
1| int foo[N];
the following descriptor:
struct array {
size_t size;
void* data; // DW_AT_data_location describes this location
}
This allows GDB to print the actual data of an type.
2014-05-28 Sanimir Agovic <sanimir.agovic@intel.com>
Keven Boell <keven.boell@intel.com>
* dwarf2read.c (set_die_type): Parse and save DW_AT_data_location
attribute.
* gdbtypes.c (is_dynamic_type): Consider a type being dynamic if
the data location has not yet been resolved.
(resolve_dynamic_type): Evaluate data location baton
if present and save its value.
* gdbtypes.h <main_type>: Add data_location.
(TYPE_DATA_LOCATION): New macro.
(TYPE_DATA_LOCATION_ADDR): New macro.
(TYPE_DATA_LOCATION_IS_ADDRESS): New macro.
* value.c: Include dwarf2loc.h.
(value_fetch_lazy): Use data location addres to read value from
memory.
(coerce_ref): Construct new value from data location.
Change-Id: Ic633fa125efdb5e438204e4f80bb3a1c97758b12
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/dwarf2read.c | 15 +++++++++++++++
gdb/gdbtypes.c | 29 +++++++++++++++++++++++++++--
gdb/gdbtypes.h | 14 ++++++++++++++
gdb/value.c | 8 +++++++-
4 files changed, 63 insertions(+), 3 deletions(-)
Index: gdb-7.7.90.20140613/gdb/dwarf2read.c
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/dwarf2read.c 2014-06-14 15:06:00.834714409 +0200
+++ gdb-7.7.90.20140613/gdb/dwarf2read.c 2014-06-14 15:06:08.326719753 +0200
@@ -21642,6 +21642,7 @@ set_die_type (struct die_info *die, stru
{
struct dwarf2_per_cu_offset_and_type **slot, ofs;
struct objfile *objfile = cu->objfile;
+ struct attribute *attr;
/* For Ada types, make sure that the gnat-specific data is always
initialized (if not already set). There are a few types where
@@ -21656,6 +21657,20 @@ set_die_type (struct die_info *die, stru
&& !HAVE_GNAT_AUX_INFO (type))
INIT_GNAT_SPECIFIC (type);
+ /* Read DW_AT_data_location and set in type. */
+ attr = dwarf2_attr (die, DW_AT_data_location, cu);
+ if (attr_form_is_block (attr))
+ {
+ struct dynamic_prop prop;
+
+ if (attr_to_dynamic_prop (attr, die, cu, &prop))
+ {
+ TYPE_DATA_LOCATION (type)
+ = obstack_alloc (&objfile->objfile_obstack, sizeof (prop));
+ *TYPE_DATA_LOCATION (type) = prop;
+ }
+ }
+
if (dwarf2_per_objfile->die_type_hash == NULL)
{
dwarf2_per_objfile->die_type_hash =
Index: gdb-7.7.90.20140613/gdb/gdbtypes.c
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/gdbtypes.c 2014-06-14 15:06:00.836714410 +0200
+++ gdb-7.7.90.20140613/gdb/gdbtypes.c 2014-06-14 15:12:28.963986344 +0200
@@ -1634,7 +1634,12 @@ is_dynamic_type (struct type *type)
or the elements it contains have a dynamic contents. */
if (is_dynamic_type (TYPE_INDEX_TYPE (type)))
return 1;
- return is_dynamic_type (TYPE_TARGET_TYPE (type));
+ else if (TYPE_DATA_LOCATION (type) != NULL
+ && (TYPE_DATA_LOCATION_KIND (type) == PROP_LOCEXPR
+ || TYPE_DATA_LOCATION_KIND (type) == PROP_LOCLIST))
+ return 1;
+ else
+ return is_dynamic_type (TYPE_TARGET_TYPE (type));
}
case TYPE_CODE_STRUCT:
@@ -1830,6 +1835,8 @@ resolve_dynamic_type (struct type *type,
{
struct type *real_type = check_typedef (type);
struct type *resolved_type = type;
+ const struct dynamic_prop *prop;
+ CORE_ADDR value;
if (!is_dynamic_type (real_type))
return type;
@@ -1869,6 +1876,18 @@ resolve_dynamic_type (struct type *type,
break;
}
+ type = resolved_type;
+
+ /* Resolve data_location attribute. */
+ prop = TYPE_DATA_LOCATION (type);
+ if (dwarf2_evaluate_property (prop, addr, &value))
+ {
+ TYPE_DATA_LOCATION_ADDR (type) = value;
+ TYPE_DATA_LOCATION_KIND (type) = PROP_CONST;
+ }
+ else
+ TYPE_DATA_LOCATION (type) = NULL;
+
return resolved_type;
}
@@ -4078,6 +4097,13 @@ copy_type_recursive (struct objfile *obj
*TYPE_RANGE_DATA (new_type) = *TYPE_RANGE_DATA (type);
}
+ /* Copy the data location information. */
+ if (TYPE_DATA_LOCATION (type) != NULL)
+ {
+ TYPE_DATA_LOCATION (new_type) = xmalloc (sizeof (struct dynamic_prop));
+ *TYPE_DATA_LOCATION (new_type) = *TYPE_DATA_LOCATION (type);
+ }
+
/* Copy pointers to other types. */
if (TYPE_TARGET_TYPE (type))
TYPE_TARGET_TYPE (new_type) =
Index: gdb-7.7.90.20140613/gdb/gdbtypes.h
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/gdbtypes.h 2014-06-14 15:06:00.837714411 +0200
+++ gdb-7.7.90.20140613/gdb/gdbtypes.h 2014-06-14 15:06:08.328719754 +0200
@@ -725,6 +725,10 @@ struct main_type
struct func_type *func_stuff;
} type_specific;
+
+ /* * Indirection to actual data. */
+
+ struct dynamic_prop *data_location;
};
/* * A ``struct type'' describes a particular instance of a type, with
@@ -1204,6 +1208,16 @@ extern void allocate_gnat_aux_type (stru
#define TYPE_LOW_BOUND_KIND(range_type) \
TYPE_RANGE_DATA(range_type)->low.kind
+/* Attribute accessors for VLA support. */
+#define TYPE_DATA_LOCATION(thistype) \
+ TYPE_MAIN_TYPE(thistype)->data_location
+#define TYPE_DATA_LOCATION_BATON(thistype) \
+ TYPE_DATA_LOCATION (thistype)->data.baton
+#define TYPE_DATA_LOCATION_ADDR(thistype) \
+ TYPE_DATA_LOCATION (thistype)->data.const_val
+#define TYPE_DATA_LOCATION_KIND(thistype) \
+ TYPE_DATA_LOCATION (thistype)->kind
+
/* Moto-specific stuff for FORTRAN arrays. */
#define TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED(arraytype) \
Index: gdb-7.7.90.20140613/gdb/value.c
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/value.c 2014-06-14 15:06:00.838714412 +0200
+++ gdb-7.7.90.20140613/gdb/value.c 2014-06-14 15:06:08.329719755 +0200
@@ -3699,8 +3699,14 @@ value_fetch_lazy (struct value *val)
}
else if (VALUE_LVAL (val) == lval_memory)
{
- CORE_ADDR addr = value_address (val);
struct type *type = check_typedef (value_enclosing_type (val));
+ CORE_ADDR addr;
+
+ if (TYPE_DATA_LOCATION (type) != NULL
+ && TYPE_DATA_LOCATION_KIND (type) == PROP_CONST)
+ addr = TYPE_DATA_LOCATION_ADDR (type);
+ else
+ addr = value_address (val);
if (TYPE_LENGTH (type))
read_value_memory (val, 0, value_stack (val),

115
gdb-vla-intel-03of23.patch Normal file
View File

@ -0,0 +1,115 @@
Subject: [PATCH 03/23] vla: introduce allocated/associated flags
Message-Id: <1401861266-6240-4-git-send-email-keven.boell@intel.com>
Fortran 90 provide types whose values may be dynamically
allocated or associated with a variable under explicit
program control. The purpose of this commit is to read
allocated/associated DWARF tags and store them to the
main_type.
2014-05-28 Keven Boell <keven.boell@intel.com>
Sanimir Agovic <sanimir.agovic@intel.com>
* dwarf2read.c (set_die_type): Add reading of
allocated/associated flags.
* gdbtypes.h (struct main_type): Add allocated/
associated dwarf2_prop attributes.
(TYPE_ALLOCATED_PROP): New macro.
(TYPE_ASSOCIATED_PROP): New macro.
(TYPE_NOT_ALLOCATED): New macro.
(TYPE_NOT_ASSOCIATED): New macro.
Change-Id: I44a9e21986de16de061b3ea2a7689f1bfa28ed2e
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/dwarf2read.c | 28 ++++++++++++++++++++++++++++
gdb/gdbtypes.h | 26 ++++++++++++++++++++++++++
2 files changed, 54 insertions(+)
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 7a0f7f4..ea66602 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -21514,6 +21514,34 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
&& !HAVE_GNAT_AUX_INFO (type))
INIT_GNAT_SPECIFIC (type);
+ /* Read DW_AT_allocated and set in type. */
+ attr = dwarf2_attr (die, DW_AT_allocated, cu);
+ if (attr_form_is_block (attr))
+ {
+ struct dynamic_prop prop;
+
+ if (attr_to_dynamic_prop (attr, die, cu, &prop))
+ {
+ TYPE_ALLOCATED_PROP (type)
+ = obstack_alloc (&objfile->objfile_obstack, sizeof (prop));
+ *TYPE_ALLOCATED_PROP (type) = prop;
+ }
+ }
+
+ /* Read DW_AT_associated and set in type. */
+ attr = dwarf2_attr (die, DW_AT_associated, cu);
+ if (attr_form_is_block (attr))
+ {
+ struct dynamic_prop prop;
+
+ if (attr_to_dynamic_prop (attr, die, cu, &prop))
+ {
+ TYPE_ASSOCIATED_PROP (type)
+ = obstack_alloc (&objfile->objfile_obstack, sizeof (prop));
+ *TYPE_ASSOCIATED_PROP (type) = prop;
+ }
+ }
+
/* Read DW_AT_data_location and set in type. */
attr = dwarf2_attr (die, DW_AT_data_location, cu);
if (attr_form_is_block (attr))
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index c6d14d2..52e6233 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -726,6 +726,18 @@ struct main_type
/* * Indirection to actual data. */
struct dynamic_prop *data_location;
+
+ /* Structure for DW_AT_allocated.
+ The presence of this attribute indicates that the object of the type
+ can be allocated/deallocated. The value can be a dwarf expression,
+ reference, or a constant. */
+ struct dynamic_prop *allocated;
+
+ /* Structure for DW_AT_associated.
+ The presence of this attribute indicated that the object of the type
+ can be associated. The value can be a dwarf expression,
+ reference, or a constant. */
+ struct dynamic_prop *associated;
};
/* * A ``struct type'' describes a particular instance of a type, with
@@ -1214,6 +1226,20 @@ extern void allocate_gnat_aux_type (struct type *);
TYPE_DATA_LOCATION (thistype)->data.const_val
#define TYPE_DATA_LOCATION_KIND(thistype) \
TYPE_DATA_LOCATION (thistype)->kind
+#define TYPE_ALLOCATED_PROP(thistype) TYPE_MAIN_TYPE(thistype)->allocated
+#define TYPE_ASSOCIATED_PROP(thistype) TYPE_MAIN_TYPE(thistype)->associated
+
+/* Allocated status of type object. If set to non-zero it means the object
+ is allocated. A zero value means it is not allocated. */
+#define TYPE_NOT_ALLOCATED(t) (TYPE_ALLOCATED_PROP (t) \
+ && TYPE_ALLOCATED_PROP (t)->kind == PROP_CONST \
+ && !TYPE_ALLOCATED_PROP (t)->data.const_val)
+
+/* Associated status of type object. If set to non-zero it means the object
+ is associated. A zero value means it is not associated. */
+#define TYPE_NOT_ASSOCIATED(t) (TYPE_ASSOCIATED_PROP (t) \
+ && TYPE_ASSOCIATED_PROP (t)->kind == PROP_CONST \
+ && !TYPE_ASSOCIATED_PROP (t)->data.const_val)
/* Moto-specific stuff for FORTRAN arrays. */
--
1.7.9.5

View File

@ -0,0 +1,36 @@
Re: [PATCH 04/23] vla: make dynamic fortran arrays functional.
https://sourceware.org/ml/gdb-patches/2014-06/msg00570.html
Index: gdb-7.7.90.20140613/gdb/valarith.c
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/valarith.c 2014-06-16 23:16:48.129164644 +0200
+++ gdb-7.7.90.20140613/gdb/valarith.c 2014-06-16 23:17:52.544225452 +0200
@@ -195,19 +195,19 @@ value_subscripted_rvalue (struct value *
struct type *array_type = check_typedef (value_type (array));
struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type));
unsigned int elt_size = TYPE_LENGTH (elt_type);
- unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound);
+ unsigned int elt_offs;
struct value *v;
+ if (TYPE_NOT_ASSOCIATED (array_type))
+ error (_("no such vector element because not associated"));
+ if (TYPE_NOT_ALLOCATED (array_type))
+ error (_("no such vector element because not allocated"));
+
+ elt_offs = elt_size * longest_to_int (index - lowerbound);
+
if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
&& elt_offs >= TYPE_LENGTH (array_type)))
- {
- if (TYPE_NOT_ASSOCIATED (array_type))
- error (_("no such vector element because not associated"));
- else if (TYPE_NOT_ALLOCATED (array_type))
- error (_("no such vector element because not allocated"));
- else
- error (_("no such vector element"));
- }
+ error (_("no such vector element"));
if (VALUE_LVAL (array) == lval_memory && value_lazy (array))
v = allocate_value_lazy (elt_type);

614
gdb-vla-intel-04of23.patch Normal file
View File

@ -0,0 +1,614 @@
Subject: [PATCH 04/23] vla: make dynamic fortran arrays functional.
Message-Id: <1401861266-6240-5-git-send-email-keven.boell@intel.com>
This patch enables GDB to print the value of a dynamic
array (VLA) if allocated/associated in fortran. If not the
allocation status will be printed to the command line.
(gdb) p vla_not_allocated
$1 = <not allocated>
(gdb) p vla_allocated
$1 = (1, 2, 3)
(gdb) p vla_not_associated
$1 = <not associated>
(gdb) p vla_associated
$1 = (3, 2, 1)
The patch covers various locations where the allocation/
association status makes sense to print.
2014-05-28 Keven Boell <keven.boell@intel.com>
Sanimir Agovic <sanimir.agovic@intel.com>
* dwarf2loc.c (dwarf2_address_data_valid): New
function.
* dwarf2loc.h (dwarf2_address_data_valid): New
function.
* f-typeprint.c (f_print_type): Print allocation/
association status.
(f_type_print_varspec_suffix): Print allocation/
association status for &-operator usages.
* gdbtypes.c (create_array_type_with_stride): Add
query for valid data location.
(is_dynamic_type): Extend dynamic type detection
with allocated/associated. Add type detection for
fields.
(resolve_dynamic_range): Copy type before resolving
it as dynamic attributes need to be preserved.
(resolve_dynamic_array): Copy type before resolving
it as dynamic attributes need to be preserved. Add
resolving of allocated/associated attributes.
(resolve_dynamic_type): Add call to nested
type resolving.
(copy_type_recursive): Add allocated/associated
attributes to be copied.
(copy_type): Copy allocated/associated/data_location
as well as the fields structure if available.
(resolve_dynamic_compound): New function.
* valarith.c (value_subscripted_rvalue): Print allocated/
associated status when indexing a VLA.
* valprint.c (valprint_check_validity): Print allocated/
associated status.
(val_print_not_allocated): New function.
(val_print_not_associated): New function.
* valprint.h (val_print_not_allocated): New function.
(val_print_not_associated): New function.
* value.c (set_value_component_location): Adjust the value
address for single value prints.
Change-Id: Idfb44c8a6b38008f8e2c84cb0fdb13729ec160f4
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/dwarf2loc.c | 14 +++++
gdb/dwarf2loc.h | 6 ++
gdb/f-typeprint.c | 62 +++++++++++++-------
gdb/gdbtypes.c | 165 +++++++++++++++++++++++++++++++++++++++++++++++++++--
gdb/valarith.c | 9 ++-
gdb/valprint.c | 40 +++++++++++++
gdb/valprint.h | 4 ++
gdb/value.c | 20 +++++++
8 files changed, 292 insertions(+), 28 deletions(-)
Index: gdb-7.7.90.20140613/gdb/dwarf2loc.c
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/dwarf2loc.c 2014-06-14 15:12:43.797996885 +0200
+++ gdb-7.7.90.20140613/gdb/dwarf2loc.c 2014-06-14 15:12:45.485998049 +0200
@@ -2569,6 +2569,20 @@ dwarf2_evaluate_property (const struct d
return 0;
}
+/* See dwarf2loc.h. */
+
+int
+dwarf2_address_data_valid (const struct type *type)
+{
+ if (TYPE_NOT_ASSOCIATED (type))
+ return 0;
+
+ if (TYPE_NOT_ALLOCATED (type))
+ return 0;
+
+ return 1;
+}
+
/* Helper functions and baton for dwarf2_loc_desc_needs_frame. */
Index: gdb-7.7.90.20140613/gdb/dwarf2loc.h
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/dwarf2loc.h 2014-06-14 15:12:43.797996885 +0200
+++ gdb-7.7.90.20140613/gdb/dwarf2loc.h 2014-06-14 15:12:45.486998064 +0200
@@ -102,6 +102,12 @@ int dwarf2_evaluate_property (const stru
CORE_ADDR dwarf2_read_addr_index (struct dwarf2_per_cu_data *per_cu,
unsigned int addr_index);
+/* Checks if a dwarf location definition is valid.
+ Returns 1 if valid; 0 otherwise. */
+
+extern int dwarf2_address_data_valid (const struct type *type);
+
+
/* The symbol location baton types used by the DWARF-2 reader (i.e.
SYMBOL_LOCATION_BATON for a LOC_COMPUTED symbol). "struct
dwarf2_locexpr_baton" is for a symbol with a single location
Index: gdb-7.7.90.20140613/gdb/f-typeprint.c
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/f-typeprint.c 2014-06-14 15:12:43.798996886 +0200
+++ gdb-7.7.90.20140613/gdb/f-typeprint.c 2014-06-14 15:12:45.486998064 +0200
@@ -30,6 +30,7 @@
#include "gdbcore.h"
#include "target.h"
#include "f-lang.h"
+#include "valprint.h"
#include <string.h>
#include <errno.h>
@@ -56,6 +57,17 @@ f_print_type (struct type *type, const c
enum type_code code;
int demangled_args;
+ if (TYPE_NOT_ASSOCIATED (type))
+ {
+ val_print_not_associated (stream);
+ return;
+ }
+ if (TYPE_NOT_ALLOCATED (type))
+ {
+ val_print_not_allocated (stream);
+ return;
+ }
+
f_type_print_base (type, stream, show, level);
code = TYPE_CODE (type);
if ((varstring != NULL && *varstring != '\0')
@@ -170,28 +182,36 @@ f_type_print_varspec_suffix (struct type
if (arrayprint_recurse_level == 1)
fprintf_filtered (stream, "(");
- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY)
- f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0,
- arrayprint_recurse_level);
-
- lower_bound = f77_get_lowerbound (type);
- if (lower_bound != 1) /* Not the default. */
- fprintf_filtered (stream, "%d:", lower_bound);
-
- /* Make sure that, if we have an assumed size array, we
- print out a warning and print the upperbound as '*'. */
-
- if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
- fprintf_filtered (stream, "*");
+ if (TYPE_NOT_ASSOCIATED (type))
+ val_print_not_associated (stream);
+ else if (TYPE_NOT_ALLOCATED (type))
+ val_print_not_allocated (stream);
else
- {
- upper_bound = f77_get_upperbound (type);
- fprintf_filtered (stream, "%d", upper_bound);
- }
-
- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
- f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0,
- arrayprint_recurse_level);
+ {
+
+ if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY)
+ f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0,
+ arrayprint_recurse_level);
+
+ lower_bound = f77_get_lowerbound (type);
+ if (lower_bound != 1) /* Not the default. */
+ fprintf_filtered (stream, "%d:", lower_bound);
+
+ /* Make sure that, if we have an assumed size array, we
+ print out a warning and print the upperbound as '*'. */
+
+ if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
+ fprintf_filtered (stream, "*");
+ else
+ {
+ upper_bound = f77_get_upperbound (type);
+ fprintf_filtered (stream, "%d", upper_bound);
+ }
+
+ if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
+ f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0,
+ arrayprint_recurse_level);
+ }
if (arrayprint_recurse_level == 1)
fprintf_filtered (stream, ")");
else
Index: gdb-7.7.90.20140613/gdb/gdbtypes.c
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/gdbtypes.c 2014-06-14 15:12:43.801996888 +0200
+++ gdb-7.7.90.20140613/gdb/gdbtypes.c 2014-06-14 15:14:34.837102369 +0200
@@ -1003,7 +1003,8 @@ create_array_type_with_stride (struct ty
TYPE_CODE (result_type) = TYPE_CODE_ARRAY;
TYPE_TARGET_TYPE (result_type) = element_type;
- if (has_static_range (TYPE_RANGE_DATA (range_type)))
+ if (has_static_range (TYPE_RANGE_DATA (range_type))
+ && dwarf2_address_data_valid (result_type))
{
LONGEST low_bound, high_bound;
@@ -1616,11 +1617,30 @@ stub_noname_complaint (void)
int
is_dynamic_type (struct type *type)
{
+ int index;
+
+ if (!type)
+ return 0;
+
type = check_typedef (type);
if (TYPE_CODE (type) == TYPE_CODE_REF)
type = check_typedef (TYPE_TARGET_TYPE (type));
+ if (TYPE_ASSOCIATED_PROP (type))
+ return 1;
+
+ if (TYPE_ALLOCATED_PROP (type))
+ return 1;
+
+ /* Scan field types in the Fortran case for nested dynamic types.
+ This will be done only for Fortran as in the C++ case an endless recursion
+ can occur in the area of classes. */
+ if (current_language->la_language == language_fortran)
+ for (index = 0; index < TYPE_NFIELDS (type); index++)
+ if (is_dynamic_type (TYPE_FIELD_TYPE (type, index)))
+ return 1;
+
switch (TYPE_CODE (type))
{
case TYPE_CODE_RANGE:
@@ -1669,6 +1689,7 @@ resolve_dynamic_range (struct type *dyn_
const struct dynamic_prop *prop;
const struct dwarf2_locexpr_baton *baton;
struct dynamic_prop low_bound, high_bound;
+ struct type *range_copy = copy_type (dyn_range_type);
gdb_assert (TYPE_CODE (dyn_range_type) == TYPE_CODE_RANGE);
@@ -1700,8 +1721,8 @@ resolve_dynamic_range (struct type *dyn_
high_bound.data.const_val = 0;
}
- static_range_type = create_range_type (copy_type (dyn_range_type),
- TYPE_TARGET_TYPE (dyn_range_type),
+ static_range_type = create_range_type (range_copy,
+ TYPE_TARGET_TYPE (range_copy),
&low_bound, &high_bound);
TYPE_RANGE_DATA (static_range_type)->flag_bound_evaluated = 1;
return static_range_type;
@@ -1718,6 +1739,8 @@ resolve_dynamic_array (struct type *type
struct type *elt_type;
struct type *range_type;
struct type *ary_dim;
+ struct dynamic_prop *prop;
+ struct type *copy = copy_type (type);
gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY);
@@ -1725,18 +1748,93 @@ resolve_dynamic_array (struct type *type
range_type = check_typedef (TYPE_INDEX_TYPE (elt_type));
range_type = resolve_dynamic_range (range_type, addr);
+ prop = TYPE_ALLOCATED_PROP (type);
+ if (dwarf2_evaluate_property (prop, addr, &value))
+ {
+ TYPE_ALLOCATED_PROP (copy)->kind = PROP_CONST;
+ TYPE_ALLOCATED_PROP (copy)->data.const_val = value;
+ }
+
+ prop = TYPE_ASSOCIATED_PROP (type);
+ if (dwarf2_evaluate_property (prop, addr, &value))
+ {
+ TYPE_ASSOCIATED_PROP (copy)->kind = PROP_CONST;
+ TYPE_ASSOCIATED_PROP (copy)->data.const_val = value;
+ }
+
ary_dim = check_typedef (TYPE_TARGET_TYPE (elt_type));
if (ary_dim != NULL && TYPE_CODE (ary_dim) == TYPE_CODE_ARRAY)
- elt_type = resolve_dynamic_array (TYPE_TARGET_TYPE (type), addr);
+ elt_type = resolve_dynamic_array (TYPE_TARGET_TYPE (copy), addr);
else
elt_type = TYPE_TARGET_TYPE (type);
- return create_array_type (copy_type (type),
+ return create_array_type (copy,
elt_type,
range_type);
}
+/* Resolves dynamic compound types, e.g. STRUCTS's to static ones.
+ ADDRESS is needed to resolve the compound type data location. */
+
+static struct type *
+resolve_dynamic_compound (struct type *type, CORE_ADDR addr)
+{
+ struct type *cur_type, *prev_type, *copy;
+ int index, depth = 0;
+
+ cur_type = type;
+ prev_type = cur_type;
+ while (cur_type)
+ {
+ switch (TYPE_CODE (cur_type))
+ {
+ case TYPE_CODE_STRUCT:
+ {
+ copy = copy_type (cur_type);
+ for (index = 0; index < TYPE_NFIELDS (copy); index++)
+ {
+ struct type *index_type = TYPE_FIELD_TYPE (copy, index);
+
+ if (index_type == NULL)
+ continue;
+
+ if (TYPE_CODE (index_type) == TYPE_CODE_ARRAY
+ || TYPE_CODE (index_type) == TYPE_CODE_STRUCT)
+ {
+ if (TYPE_CODE (index_type) != TYPE_CODE_RANGE)
+ addr +=
+ (TYPE_FIELD_BITPOS (copy, index) / 8);
+
+ TYPE_FIELD_TYPE (copy, index) =
+ resolve_dynamic_type (TYPE_FIELD_TYPE (copy, index),
+ addr);
+ }
+ }
+
+ /* If a struct type will be resolved as the first type, we need
+ to assign it back the resolved_type. In the other case it can
+ be that we have a struct, which is nested in another type.
+ Therefore we need to preserve the previous type, to assign the
+ new resolved type as the previous' target type. */
+ if (depth == 0)
+ type = copy;
+ else
+ TYPE_TARGET_TYPE (prev_type) = copy;
+ }
+ break;
+ }
+
+ /* Store the previous type, in order to assign resolved types back to
+ the right target type. */
+ prev_type = cur_type;
+ cur_type = TYPE_TARGET_TYPE (cur_type);
+ depth++;
+ };
+
+ return type;
+}
+
/* Resolve dynamic bounds of members of the union TYPE to static
bounds. */
@@ -1836,7 +1934,7 @@ resolve_dynamic_type (struct type *type,
struct type *real_type = check_typedef (type);
struct type *resolved_type = type;
const struct dynamic_prop *prop;
- CORE_ADDR value;
+ CORE_ADDR value, adjusted_address = addr;
if (!is_dynamic_type (real_type))
return type;
@@ -1882,12 +1980,15 @@ resolve_dynamic_type (struct type *type,
prop = TYPE_DATA_LOCATION (type);
if (dwarf2_evaluate_property (prop, addr, &value))
{
+ adjusted_address = value;
TYPE_DATA_LOCATION_ADDR (type) = value;
TYPE_DATA_LOCATION_KIND (type) = PROP_CONST;
}
else
TYPE_DATA_LOCATION (type) = NULL;
+ resolved_type = resolve_dynamic_compound (type, adjusted_address);
+
return resolved_type;
}
@@ -4104,6 +4205,20 @@ copy_type_recursive (struct objfile *obj
*TYPE_DATA_LOCATION (new_type) = *TYPE_DATA_LOCATION (type);
}
+ /* Copy allocated information. */
+ if (TYPE_ALLOCATED_PROP (type) != NULL)
+ {
+ TYPE_ALLOCATED_PROP (new_type) = xmalloc (sizeof (struct dynamic_prop));
+ *TYPE_ALLOCATED_PROP (new_type) = *TYPE_ALLOCATED_PROP (type);
+ }
+
+ /* Copy associated information. */
+ if (TYPE_ASSOCIATED_PROP (type) != NULL)
+ {
+ TYPE_ASSOCIATED_PROP (new_type) = xmalloc (sizeof (struct dynamic_prop));
+ *TYPE_ASSOCIATED_PROP (new_type) = *TYPE_ASSOCIATED_PROP (type);
+ }
+
/* Copy pointers to other types. */
if (TYPE_TARGET_TYPE (type))
TYPE_TARGET_TYPE (new_type) =
@@ -4150,6 +4265,44 @@ copy_type (const struct type *type)
memcpy (TYPE_MAIN_TYPE (new_type), TYPE_MAIN_TYPE (type),
sizeof (struct main_type));
+ if (TYPE_ALLOCATED_PROP (type))
+ {
+ TYPE_ALLOCATED_PROP (new_type)
+ = OBSTACK_ZALLOC (&TYPE_OWNER (type).objfile->objfile_obstack,
+ struct dynamic_prop);
+ memcpy (TYPE_ALLOCATED_PROP (new_type), TYPE_ALLOCATED_PROP (type),
+ sizeof (struct dynamic_prop));
+ }
+
+ if (TYPE_ASSOCIATED_PROP (type))
+ {
+ TYPE_ASSOCIATED_PROP (new_type)
+ = OBSTACK_ZALLOC (&TYPE_OWNER (type).objfile->objfile_obstack,
+ struct dynamic_prop);
+ memcpy (TYPE_ASSOCIATED_PROP (new_type), TYPE_ASSOCIATED_PROP (type),
+ sizeof (struct dynamic_prop));
+ }
+
+ if (TYPE_DATA_LOCATION (type))
+ {
+ TYPE_DATA_LOCATION (new_type)
+ = OBSTACK_ZALLOC (&TYPE_OWNER (type).objfile->objfile_obstack,
+ struct dynamic_prop);
+ memcpy (TYPE_DATA_LOCATION (new_type), TYPE_DATA_LOCATION (type),
+ sizeof (struct dynamic_prop));
+ }
+
+ if (TYPE_NFIELDS (type))
+ {
+ int nfields = TYPE_NFIELDS (type);
+
+ TYPE_FIELDS (new_type)
+ = OBSTACK_CALLOC (&TYPE_OWNER (type).objfile->objfile_obstack,
+ nfields, struct field);
+ memcpy (TYPE_FIELDS (new_type), TYPE_FIELDS (type),
+ nfields * sizeof (struct field));
+ }
+
return new_type;
}
Index: gdb-7.7.90.20140613/gdb/valarith.c
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/valarith.c 2014-06-14 15:12:43.801996888 +0200
+++ gdb-7.7.90.20140613/gdb/valarith.c 2014-06-14 15:12:45.488998075 +0200
@@ -200,7 +200,14 @@ value_subscripted_rvalue (struct value *
if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
&& elt_offs >= TYPE_LENGTH (array_type)))
- error (_("no such vector element"));
+ {
+ if (TYPE_NOT_ASSOCIATED (array_type))
+ error (_("no such vector element because not associated"));
+ else if (TYPE_NOT_ALLOCATED (array_type))
+ error (_("no such vector element because not allocated"));
+ else
+ error (_("no such vector element"));
+ }
if (VALUE_LVAL (array) == lval_memory && value_lazy (array))
v = allocate_value_lazy (elt_type);
Index: gdb-7.7.90.20140613/gdb/valprint.c
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/valprint.c 2014-06-14 15:12:43.802996888 +0200
+++ gdb-7.7.90.20140613/gdb/valprint.c 2014-06-14 15:12:45.488998075 +0200
@@ -307,6 +307,18 @@ valprint_check_validity (struct ui_file
{
CHECK_TYPEDEF (type);
+ if (TYPE_NOT_ASSOCIATED (type))
+ {
+ val_print_not_associated (stream);
+ return 0;
+ }
+
+ if (TYPE_NOT_ALLOCATED (type))
+ {
+ val_print_not_allocated (stream);
+ return 0;
+ }
+
if (TYPE_CODE (type) != TYPE_CODE_UNION
&& TYPE_CODE (type) != TYPE_CODE_STRUCT
&& TYPE_CODE (type) != TYPE_CODE_ARRAY)
@@ -362,6 +374,18 @@ val_print_invalid_address (struct ui_fil
fprintf_filtered (stream, _("<invalid address>"));
}
+void
+val_print_not_allocated (struct ui_file *stream)
+{
+ fprintf_filtered (stream, _("<not allocated>"));
+}
+
+void
+val_print_not_associated (struct ui_file *stream)
+{
+ fprintf_filtered (stream, _("<not associated>"));
+}
+
/* A generic val_print that is suitable for use by language
implementations of the la_val_print method. This function can
handle most type codes, though not all, notably exception
@@ -803,12 +827,16 @@ static int
value_check_printable (struct value *val, struct ui_file *stream,
const struct value_print_options *options)
{
+ const struct type *type;
+
if (val == 0)
{
fprintf_filtered (stream, _("<address of value unknown>"));
return 0;
}
+ type = value_type (val);
+
if (value_entirely_optimized_out (val))
{
if (options->summary && !val_print_scalar_type_p (value_type (val)))
@@ -834,6 +862,18 @@ value_check_printable (struct value *val
return 0;
}
+ if (TYPE_NOT_ASSOCIATED (type))
+ {
+ val_print_not_associated (stream);
+ return 0;
+ }
+
+ if (TYPE_NOT_ALLOCATED (type))
+ {
+ val_print_not_allocated (stream);
+ return 0;
+ }
+
return 1;
}
Index: gdb-7.7.90.20140613/gdb/valprint.h
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/valprint.h 2014-06-14 15:12:43.803996889 +0200
+++ gdb-7.7.90.20140613/gdb/valprint.h 2014-06-14 15:12:45.489998073 +0200
@@ -217,4 +217,8 @@ extern void output_command_const (const
extern int val_print_scalar_type_p (struct type *type);
+extern void val_print_not_allocated (struct ui_file *stream);
+
+extern void val_print_not_associated (struct ui_file *stream);
+
#endif
Index: gdb-7.7.90.20140613/gdb/value.c
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/value.c 2014-06-14 15:12:43.804996890 +0200
+++ gdb-7.7.90.20140613/gdb/value.c 2014-06-14 15:12:45.490998069 +0200
@@ -43,6 +43,7 @@
#include "tracepoint.h"
#include "cp-abi.h"
#include "user-regs.h"
+#include "dwarf2loc.h"
/* Prototypes for exported functions. */
@@ -1646,6 +1647,25 @@ set_value_component_location (struct val
if (funcs->copy_closure)
component->location.computed.closure = funcs->copy_closure (whole);
}
+
+ /* For dynamic types compute the address of the component value location in
+ sub range types based on the location of the sub range type, if not being
+ an internal GDB variable or parts of it. */
+ if (VALUE_LVAL (component) != lval_internalvar
+ && VALUE_LVAL (component) != lval_internalvar_component)
+ {
+ CORE_ADDR addr;
+ struct type *type = value_type (whole);
+
+ addr = value_raw_address (component);
+
+ if (TYPE_DATA_LOCATION (type)
+ && TYPE_DATA_LOCATION_KIND (type) == PROP_CONST)
+ {
+ addr = TYPE_DATA_LOCATION_ADDR (type);
+ set_value_address (component, addr);
+ }
+ }
}

View File

@ -0,0 +1,65 @@
Subject: [PATCH 05/23] vla: make field selection work with vla
Message-Id: <1401861266-6240-6-git-send-email-keven.boell@intel.com>
In Fortran vla are pointers to arrays. Thus a
type only contains a pointer to such array and
we need to re-read the field to retrieve the
correct vla.
old (wrong value):
(gdb) p type_var%vla(14)
$1 = 1
new (correct value):
(gdb) p type_var%vla(14)
$1 = 42
2014-05-28 Sanimir Agovic <sanimir.agovic@intel.com>
Keven Boell <keven.boell@intel.com>
* value.c (value_primitive_field): Re-evaluate
field value to get the actual value.
Change-Id: Ic22c37324963aca520c52a80fbbd0042d1fddc05
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/value.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/gdb/value.c b/gdb/value.c
index 08593b6..1f0d9a4 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2929,13 +2929,22 @@ value_primitive_field (struct value *arg1, int offset,
v = allocate_value_lazy (type);
else
{
- v = allocate_value (type);
- value_contents_copy_raw (v, value_embedded_offset (v),
- arg1, value_embedded_offset (arg1) + offset,
- TYPE_LENGTH (type));
+ if (TYPE_DATA_LOCATION (type)
+ && TYPE_DATA_LOCATION_KIND (type) == PROP_CONST)
+ v = value_at_lazy (type, value_address (arg1) + offset);
+ else
+ {
+ v = allocate_value (type);
+ value_contents_copy_raw (v, value_embedded_offset (v),
+ arg1, value_embedded_offset (arg1) + offset,
+ TYPE_LENGTH (type));
+ }
}
- v->offset = (value_offset (arg1) + offset
- + value_embedded_offset (arg1));
+
+ if (!TYPE_DATA_LOCATION (type)
+ || !TYPE_DATA_LOCATION_KIND (type) == PROP_CONST)
+ v->offset = (value_offset (arg1) + offset
+ + value_embedded_offset (arg1));
}
set_value_component_location (v, arg1);
VALUE_REGNUM (v) = VALUE_REGNUM (arg1);
--
1.7.9.5

View File

@ -0,0 +1,67 @@
Subject: [PATCH 06/23] vla: reconstruct value to compute bounds of target type
Message-Id: <1401861266-6240-7-git-send-email-keven.boell@intel.com>
Printing a pointer to an array, gdb tries to print the
target type including its bounds. To follow this
semantic with vla, this patch re-constructs the value to
resolve the bounds of the target type.
2014-05-28 Sanimir Agovic <sanimir.agovic@intel.com>
Keven Boell <keven.boell@intel.com>
* typeprint.c (whatis_exp): Re-construct value to
compute bounds of target type.
* c-valprint.c (c_value_print): Re-construct value
to compute bounds of target type.
Change-Id: Ia8a25021c7cc206711ca6f359ae5566a367e3b3d
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/c-valprint.c | 11 ++++++++++-
gdb/typeprint.c | 7 +++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index f4694b0..8c45276 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -538,7 +538,16 @@ c_value_print (struct value *val, struct ui_file *stream,
{
/* normal case */
fprintf_filtered (stream, "(");
- type_print (value_type (val), "", stream, -1);
+ if (is_dynamic_type (TYPE_TARGET_TYPE (type)))
+ {
+ struct value *v;
+
+ v = value_ind (val);
+ v = value_addr (v);
+ type_print (value_type (v), "", stream, -1);
+ }
+ else
+ type_print (value_type (val), "", stream, -1);
fprintf_filtered (stream, ") ");
}
}
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index b4ad431..b3c73a8 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -459,6 +459,13 @@ whatis_exp (char *exp, int show)
type = value_type (val);
+ if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (is_dynamic_type (TYPE_TARGET_TYPE (type)))
+ {
+ val = value_addr (value_ind (val));
+ type = value_type (val);
+ }
+
get_user_print_options (&opts);
if (opts.objectprint)
{
--
1.7.9.5

211
gdb-vla-intel-07of23.patch Normal file
View File

@ -0,0 +1,211 @@
Subject: [PATCH 07/23] vla: use value constructor instead of raw-buffer manipulation
Message-Id: <1401861266-6240-8-git-send-email-keven.boell@intel.com>
Instead of pre-computing indices into a fortran array re-use
the value_* interfaces to subscript a fortran array.
2014-05-28 Sanimir Agovic <sanimir.agovic@intel.com>
Keven Boell <keven.boell@intel.com>
* f-valprint.c (f77_create_arrayprint_offset_tbl): Remove
function.
(F77_DIM_SIZE, F77_DIM_OFFSET): Remove macro.
(f77_print_array_1): Use value_subscript to subscript a
value array.
(f77_print_array): Remove call to f77_create_arrayprint_offset_tbl.
(f_val_print): Use value_field to construct a field value.
Change-Id: I09e482ceb114eeb0f08b5528d40ffed8d79119ee
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/f-valprint.c | 118 ++++++++++++++++++------------------------------------
1 file changed, 39 insertions(+), 79 deletions(-)
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index d8c767f..1ab5bd8 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -39,8 +39,6 @@
extern void _initialize_f_valprint (void);
static void info_common_command (char *, int);
-static void f77_create_arrayprint_offset_tbl (struct type *,
- struct ui_file *);
static void f77_get_dynamic_length_of_aggregate (struct type *);
int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2];
@@ -48,15 +46,6 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2];
/* Array which holds offsets to be applied to get a row's elements
for a given array. Array also holds the size of each subarray. */
-/* The following macro gives us the size of the nth dimension, Where
- n is 1 based. */
-
-#define F77_DIM_SIZE(n) (f77_array_offset_tbl[n][1])
-
-/* The following gives us the offset for row n where n is 1-based. */
-
-#define F77_DIM_OFFSET(n) (f77_array_offset_tbl[n][0])
-
int
f77_get_lowerbound (struct type *type)
{
@@ -114,47 +103,6 @@ f77_get_dynamic_length_of_aggregate (struct type *type)
* TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type)));
}
-/* Function that sets up the array offset,size table for the array
- type "type". */
-
-static void
-f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream)
-{
- struct type *tmp_type;
- int eltlen;
- int ndimen = 1;
- int upper, lower;
-
- tmp_type = type;
-
- while (TYPE_CODE (tmp_type) == TYPE_CODE_ARRAY)
- {
- upper = f77_get_upperbound (tmp_type);
- lower = f77_get_lowerbound (tmp_type);
-
- F77_DIM_SIZE (ndimen) = upper - lower + 1;
-
- tmp_type = TYPE_TARGET_TYPE (tmp_type);
- ndimen++;
- }
-
- /* Now we multiply eltlen by all the offsets, so that later we
- can print out array elements correctly. Up till now we
- know an offset to apply to get the item but we also
- have to know how much to add to get to the next item. */
-
- ndimen--;
- eltlen = TYPE_LENGTH (tmp_type);
- F77_DIM_OFFSET (ndimen) = eltlen;
- while (--ndimen > 0)
- {
- eltlen *= F77_DIM_SIZE (ndimen + 1);
- F77_DIM_OFFSET (ndimen) = eltlen;
- }
-}
-
-
-
/* Actual function which prints out F77 arrays, Valaddr == address in
the superior. Address == the address in the inferior. */
@@ -167,41 +115,56 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type,
const struct value_print_options *options,
int *elts)
{
+ struct type *range_type = TYPE_INDEX_TYPE (check_typedef (type));
+ CORE_ADDR addr = address + embedded_offset;
+ LONGEST lowerbound, upperbound;
int i;
+ get_discrete_bounds (range_type, &lowerbound, &upperbound);
+
if (nss != ndimensions)
{
- for (i = 0;
- (i < F77_DIM_SIZE (nss) && (*elts) < options->print_max);
+ size_t dim_size = TYPE_LENGTH (TYPE_TARGET_TYPE (type));
+ size_t offs = 0;
+
+ for (i = lowerbound;
+ (i < upperbound + 1 && (*elts) < options->print_max);
i++)
{
+ struct value *subarray = value_from_contents_and_address
+ (TYPE_TARGET_TYPE (type), value_contents_for_printing_const (val)
+ + offs, addr + offs);
+
fprintf_filtered (stream, "( ");
- f77_print_array_1 (nss + 1, ndimensions, TYPE_TARGET_TYPE (type),
- valaddr,
- embedded_offset + i * F77_DIM_OFFSET (nss),
- address,
- stream, recurse, val, options, elts);
+ f77_print_array_1 (nss + 1, ndimensions, value_type (subarray),
+ value_contents_for_printing (subarray),
+ value_embedded_offset (subarray),
+ value_address (subarray),
+ stream, recurse, subarray, options, elts);
+ offs += dim_size;
fprintf_filtered (stream, ") ");
}
- if (*elts >= options->print_max && i < F77_DIM_SIZE (nss))
+ if (*elts >= options->print_max && i < upperbound)
fprintf_filtered (stream, "...");
}
else
{
- for (i = 0; i < F77_DIM_SIZE (nss) && (*elts) < options->print_max;
+ for (i = lowerbound; i < upperbound + 1 && (*elts) < options->print_max;
i++, (*elts)++)
{
- val_print (TYPE_TARGET_TYPE (type),
- valaddr,
- embedded_offset + i * F77_DIM_OFFSET (ndimensions),
- address, stream, recurse,
- val, options, current_language);
+ struct value *elt = value_subscript ((struct value *)val, i);
+
+ val_print (value_type (elt),
+ value_contents_for_printing (elt),
+ value_embedded_offset (elt),
+ value_address (elt), stream, recurse,
+ elt, options, current_language);
- if (i != (F77_DIM_SIZE (nss) - 1))
+ if (i != upperbound)
fprintf_filtered (stream, ", ");
if ((*elts == options->print_max - 1)
- && (i != (F77_DIM_SIZE (nss) - 1)))
+ && (i != upperbound))
fprintf_filtered (stream, "...");
}
}
@@ -228,12 +191,6 @@ f77_print_array (struct type *type, const gdb_byte *valaddr,
Type node corrupt! F77 arrays cannot have %d subscripts (%d Max)"),
ndimensions, MAX_FORTRAN_DIMS);
- /* Since F77 arrays are stored column-major, we set up an
- offset table to get at the various row's elements. The
- offset table contains entries for both offset and subarray size. */
-
- f77_create_arrayprint_offset_tbl (type, stream);
-
f77_print_array_1 (1, ndimensions, type, valaddr, embedded_offset,
address, stream, recurse, val, options, &elts);
}
@@ -378,12 +335,15 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
fprintf_filtered (stream, "( ");
for (index = 0; index < TYPE_NFIELDS (type); index++)
{
- int offset = TYPE_FIELD_BITPOS (type, index) / 8;
+ struct value *field = value_field
+ ((struct value *)original_value, index);
+
+ val_print (value_type (field),
+ value_contents_for_printing (field),
+ value_embedded_offset (field),
+ value_address (field), stream, recurse + 1,
+ field, options, current_language);
- val_print (TYPE_FIELD_TYPE (type, index), valaddr,
- embedded_offset + offset,
- address, stream, recurse + 1,
- original_value, options, current_language);
if (index != TYPE_NFIELDS (type) - 1)
fputs_filtered (", ", stream);
}
--
1.7.9.5

View File

@ -0,0 +1,49 @@
Subject: [PATCH 08/23] vla: get dynamic array corner cases to work
Message-Id: <1401861266-6240-9-git-send-email-keven.boell@intel.com>
This patch does not overwrite the value type in
case it is a dynamic type. For dynamic types GDB
resolved its dynamic values in a copy of the type.
The call to deprecated_set_value_type overwrites the
resolved type with the original type, which breaks
e.g. pointer to a Fortran type, which contains a dynamic
array.
Old:
(gdb) print &vla1
(PTR TO -> ( real(kind=4) (23959136:23959184))) 0x7fffffffd490
New:
(gdb) print &vla1
(PTR TO -> ( real(kind=4) (5))) 0x7fffffffd490
2014-05-28 Keven Boell <keven.boell@intel.com>
Sanimir Agovic <sanimir.agovic@intel.com>
* value.c (readjust_indirect_value_type): Add
check for dynamic types.
Change-Id: If1c6fb0bd3c1d04619e89a1b58850edb69bbfde0
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/value.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdb/value.c b/gdb/value.c
index 1f0d9a4..7abb20a 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -3504,7 +3504,8 @@ readjust_indirect_value_type (struct value *value, struct type *enc_type,
struct value *original_value)
{
/* Re-adjust type. */
- deprecated_set_value_type (value, TYPE_TARGET_TYPE (original_type));
+ if (!is_dynamic_type (TYPE_TARGET_TYPE (original_type)))
+ deprecated_set_value_type (value, TYPE_TARGET_TYPE (original_type));
/* Add embedding info. */
set_value_enclosing_type (value, enc_type);
--
1.7.9.5

316
gdb-vla-intel-09of23.patch Normal file
View File

@ -0,0 +1,316 @@
Subject: [PATCH 09/23] vla: changed string length semantic.
Message-Id: <1401861266-6240-10-git-send-email-keven.boell@intel.com>
This patch changes the semantic of the Dwarf string length
attribute to reflect the standard. This serves as pre-work
to get variable strings in Fortran to work.
2014-05-28 Keven Boell <keven.boell@intel.com>
Sanimir Agovic <sanimir.agovic@intel.com>
* dwarf2read.c (read_tag_string_type): changed
semantic of DW_AT_string_length to be able to
handle Dwarf blocks as well. Support for
DW_AT_byte_length added to get correct length
if specified in combination with
DW_AT_string_length.
(attr_to_dynamic_prop): added
functionality to add Dwarf operators to baton
data attribute. Added post values to baton
as required by the string evaluation case.
(read_subrange_type): Adapt caller.
(set_die_type): Adapt caller.
(add_post_values_to_baton): New function.
* dwarf2loc.c (dwarf2_evaluate_property): Evaluate
post processing dwarf.
* dwarf2loc.h (struct dwarf2_property_baton): Add
post dwarf values attribute.
Change-Id: I6edfa005f416cddc8e364d34891b9abf6b44f757
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/dwarf2loc.c | 10 +++++
gdb/dwarf2loc.h | 3 ++
gdb/dwarf2read.c | 129 +++++++++++++++++++++++++++++++++++++++++++++++-------
3 files changed, 127 insertions(+), 15 deletions(-)
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 7ab734d..2473f80 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -2533,6 +2533,11 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR address,
*value = value_as_address (val);
}
+ if (baton->post_values.data && baton->post_values.size > 0)
+ {
+ CORE_ADDR new_addr = *value;
+ dwarf2_locexpr_baton_eval (&baton->post_values, new_addr, value);
+ }
return 1;
}
}
@@ -2555,6 +2560,11 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR address,
if (!value_optimized_out (val))
{
*value = value_as_address (val);
+ if (baton->post_values.data && baton->post_values.size > 0)
+ {
+ CORE_ADDR new_addr = *value;
+ dwarf2_locexpr_baton_eval (&baton->post_values, new_addr, value);
+ }
return 1;
}
}
diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h
index fb65c5c..cf648eb 100644
--- a/gdb/dwarf2loc.h
+++ b/gdb/dwarf2loc.h
@@ -168,6 +168,9 @@ struct dwarf2_property_baton
/* Location list to be evaluated in the context of REFERENCED_TYPE. */
struct dwarf2_loclist_baton loclist;
};
+
+ /* Attributes, which will be pushed after evaluating locexpr or loclist. */
+ struct dwarf2_locexpr_baton post_values;
};
extern const struct symbol_computed_ops dwarf2_locexpr_funcs;
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index ea66602..0b23701 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1842,6 +1842,15 @@ static void free_dwo_file_cleanup (void *);
static void process_cu_includes (void);
static void check_producer (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,
+ const gdb_byte *additional_data, int additional_data_size);
+
+static void add_post_values_to_baton (struct dwarf2_property_baton *baton,
+ const gdb_byte *data, int size, struct dwarf2_cu *cu);
+
/* Various complaints about symbol reading that don't abort the process. */
@@ -14029,29 +14038,90 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct type *type, *range_type, *index_type, *char_type;
struct attribute *attr;
- unsigned int length;
+ unsigned int length = UINT_MAX;
+
+ index_type = objfile_type (objfile)->builtin_int;
+ range_type = create_static_range_type (NULL, index_type, 1, length);
+ /* If DW_AT_string_length is defined, the length is stored at some location
+ * in memory. */
attr = dwarf2_attr (die, DW_AT_string_length, cu);
if (attr)
{
- length = DW_UNSND (attr);
+ if (attr_form_is_block (attr))
+ {
+ struct attribute *byte_size, *bit_size;
+ struct dynamic_prop high;
+
+ byte_size = dwarf2_attr (die, DW_AT_byte_size, cu);
+ bit_size = dwarf2_attr (die, DW_AT_bit_size, cu);
+
+ /* DW_AT_byte_size should never occur together in combination with
+ DW_AT_string_length. */
+ if ((byte_size == NULL && bit_size != NULL) ||
+ (byte_size != NULL && bit_size == NULL))
+ complaint (&symfile_complaints, _("DW_AT_byte_size AND "
+ "DW_AT_bit_size found together at the same time."));
+
+ /* If DW_AT_string_length AND DW_AT_byte_size exist together, it
+ describes the number of bytes that should be read from the length
+ memory location. */
+ if (byte_size != NULL && bit_size == NULL)
+ {
+ /* Build new dwarf2_locexpr_baton structure with additions to the
+ data attribute, to reflect DWARF specialities to get address
+ sizes. */
+ const gdb_byte append_ops[] = {
+ DW_OP_push_object_address,
+ /* DW_OP_deref_size: size of an address on the target machine
+ (bytes), where the size will be specified by the next
+ operand. */
+ DW_OP_deref_size,
+ /* Operand for DW_OP_deref_size. */
+ DW_UNSND (byte_size) };
+
+ if (!attr_to_dynamic_prop (attr, die, cu, &high,
+ append_ops, ARRAY_SIZE (append_ops)))
+ complaint (&symfile_complaints,
+ _("Could not parse DW_AT_byte_size"));
+ }
+ else if (bit_size != NULL && byte_size == NULL)
+ complaint (&symfile_complaints, _("DW_AT_string_length AND "
+ "DW_AT_bit_size found but not supported yet."));
+ /* If DW_AT_string_length WITHOUT DW_AT_byte_size exist, the default
+ is the address size of the target machine. */
+ else
+ {
+ if (!attr_to_dynamic_prop (attr, die, cu, &high, NULL, 0))
+ complaint (&symfile_complaints,
+ _("Could not parse DW_AT_string_length"));
+ }
+
+ TYPE_RANGE_DATA (range_type)->high = high;
+ }
+ else
+ {
+ TYPE_HIGH_BOUND (range_type) = DW_UNSND (attr);
+ TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST;
+ }
}
else
{
- /* Check for the DW_AT_byte_size attribute. */
+ /* Check for the DW_AT_byte_size attribute, which represents the length
+ in this case. */
attr = dwarf2_attr (die, DW_AT_byte_size, cu);
if (attr)
{
- length = DW_UNSND (attr);
+ TYPE_HIGH_BOUND (range_type) = DW_UNSND (attr);
+ TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST;
}
else
{
- length = 1;
+ TYPE_HIGH_BOUND (range_type) = 1;
+ TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST;
}
}
- index_type = objfile_type (objfile)->builtin_int;
- range_type = create_static_range_type (NULL, index_type, 1, length);
char_type = language_string_char_type (cu->language_defn, gdbarch);
type = create_string_type (NULL, char_type, range_type);
@@ -14368,13 +14438,36 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
return set_die_type (die, type, cu);
}
+/* Add post processing op-codes to a dwarf2_property_baton. */
+
+static void add_post_values_to_baton (struct dwarf2_property_baton *baton,
+ const gdb_byte *data, int size, struct dwarf2_cu *cu)
+{
+ if (data != NULL && size > 0)
+ {
+ struct obstack *obstack = &cu->objfile->objfile_obstack;
+ gdb_byte *post_data;
+
+ post_data = obstack_alloc (obstack, size);
+ memcpy(post_data, data, size);
+ baton->post_values.data = post_data;
+ baton->post_values.size = size;
+ baton->post_values.per_cu = cu->per_cu;
+ } else {
+ baton->post_values.data = NULL;
+ baton->post_values.size = 0;
+ baton->post_values.per_cu = NULL;
+ }
+}
+
/* Parse dwarf attribute if it's a block, reference or constant and put the
resulting value of the attribute into struct bound_prop.
Returns 1 if ATTR could be resolved into PROP, 0 otherwise. */
static int
attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
- struct dwarf2_cu *cu, struct dynamic_prop *prop)
+ struct dwarf2_cu *cu, struct dynamic_prop *prop,
+ const gdb_byte *additional_data, int additional_data_size)
{
struct dwarf2_property_baton *baton;
struct obstack *obstack = &cu->objfile->objfile_obstack;
@@ -14387,8 +14480,10 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
baton = obstack_alloc (obstack, sizeof (*baton));
baton->referenced_type = NULL;
baton->locexpr.per_cu = cu->per_cu;
- baton->locexpr.size = DW_BLOCK (attr)->size;
baton->locexpr.data = DW_BLOCK (attr)->data;
+ baton->locexpr.size = DW_BLOCK (attr)->size;
+ add_post_values_to_baton (baton, additional_data,
+ additional_data_size, cu);
prop->data.baton = baton;
prop->kind = PROP_LOCEXPR;
gdb_assert (prop->data.baton != NULL);
@@ -14409,6 +14504,8 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
baton = obstack_alloc (obstack, sizeof (*baton));
baton->referenced_type = die_type (target_die, target_cu);
fill_in_loclist_baton (cu, &baton->loclist, target_attr);
+ add_post_values_to_baton (baton, additional_data,
+ additional_data_size, cu);
prop->data.baton = baton;
prop->kind = PROP_LOCLIST;
gdb_assert (prop->data.baton != NULL);
@@ -14420,6 +14517,8 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
baton->locexpr.per_cu = cu->per_cu;
baton->locexpr.size = DW_BLOCK (target_attr)->size;
baton->locexpr.data = DW_BLOCK (target_attr)->data;
+ add_post_values_to_baton (baton, additional_data,
+ additional_data_size, cu);
prop->data.baton = baton;
prop->kind = PROP_LOCEXPR;
gdb_assert (prop->data.baton != NULL);
@@ -14509,17 +14608,17 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
attr = dwarf2_attr (die, DW_AT_lower_bound, cu);
if (attr)
- attr_to_dynamic_prop (attr, die, cu, &low);
+ attr_to_dynamic_prop (attr, die, cu, &low, NULL, 0);
else if (!low_default_is_valid)
complaint (&symfile_complaints, _("Missing DW_AT_lower_bound "
"- DIE at 0x%x [in module %s]"),
die->offset.sect_off, objfile_name (cu->objfile));
attr = dwarf2_attr (die, DW_AT_upper_bound, cu);
- if (!attr_to_dynamic_prop (attr, die, cu, &high))
+ if (!attr_to_dynamic_prop (attr, die, cu, &high, NULL, 0))
{
attr = dwarf2_attr (die, DW_AT_count, cu);
- if (attr_to_dynamic_prop (attr, die, cu, &high))
+ if (attr_to_dynamic_prop (attr, die, cu, &high, NULL, 0))
{
/* If bounds are constant do the final calculation here. */
if (low.kind == PROP_CONST && high.kind == PROP_CONST)
@@ -21520,7 +21619,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
{
struct dynamic_prop prop;
- if (attr_to_dynamic_prop (attr, die, cu, &prop))
+ if (attr_to_dynamic_prop (attr, die, cu, &prop, NULL, 0))
{
TYPE_ALLOCATED_PROP (type)
= obstack_alloc (&objfile->objfile_obstack, sizeof (prop));
@@ -21534,7 +21633,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
{
struct dynamic_prop prop;
- if (attr_to_dynamic_prop (attr, die, cu, &prop))
+ if (attr_to_dynamic_prop (attr, die, cu, &prop, NULL, 0))
{
TYPE_ASSOCIATED_PROP (type)
= obstack_alloc (&objfile->objfile_obstack, sizeof (prop));
@@ -21548,7 +21647,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
{
struct dynamic_prop prop;
- if (attr_to_dynamic_prop (attr, die, cu, &prop))
+ if (attr_to_dynamic_prop (attr, die, cu, &prop, NULL, 0))
{
TYPE_DATA_LOCATION (type)
= obstack_alloc (&objfile->objfile_obstack, sizeof (prop));
--
1.7.9.5

View File

@ -0,0 +1,94 @@
Subject: [PATCH 10/23] vla: get Fortran dynamic strings working.
Message-Id: <1401861266-6240-11-git-send-email-keven.boell@intel.com>
This patch enables the correct calculation of dynamic
string length.
Old:
(gdb) p my_dyn_string
$1 = (PTR TO -> ( character*23959136 )) 0x605fc0
(gdb) p *my_dyn_string
Cannot access memory at address 0x605fc0
New:
(gdb) p my_dyn_string
$1 = (PTR TO -> ( character*10 )) 0x605fc0
(gdb) p *my_dyn_string
$2 = 'foo'
2014-05-28 Keven Boell <keven.boell@intel.com>
Sanimir Agovic <sanimir.agovic@intel.com>
* gdbtypes.c (resolve_dynamic_type): Add
conditions to support string types.
(resolve_dynamic_array): Add conditions for dynamic
strings and create a new string type.
(is_dynamic_type): Follow pointer if a string type
was detected, as Fortran strings are represented
as pointers to strings internally.
Change-Id: I7d54d762a081ce034be37ac3e368bac8111dc4e6
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/gdbtypes.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
Index: gdb-7.7.90.20140613/gdb/gdbtypes.c
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/gdbtypes.c 2014-06-14 15:14:48.623115597 +0200
+++ gdb-7.7.90.20140613/gdb/gdbtypes.c 2014-06-14 15:15:26.876151187 +0200
@@ -1662,6 +1662,15 @@ is_dynamic_type (struct type *type)
return is_dynamic_type (TYPE_TARGET_TYPE (type));
}
+ case TYPE_CODE_PTR:
+ {
+ if (TYPE_TARGET_TYPE (type)
+ && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRING)
+ return is_dynamic_type (check_typedef (TYPE_TARGET_TYPE (type)));
+
+ return 0;
+ break;
+ }
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
{
@@ -1742,7 +1751,8 @@ resolve_dynamic_array (struct type *type
struct dynamic_prop *prop;
struct type *copy = copy_type (type);
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY);
+ gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY
+ || TYPE_CODE (type) == TYPE_CODE_STRING);
elt_type = type;
range_type = check_typedef (TYPE_INDEX_TYPE (elt_type));
@@ -1769,9 +1779,14 @@ resolve_dynamic_array (struct type *type
else
elt_type = TYPE_TARGET_TYPE (type);
- return create_array_type (copy,
- elt_type,
- range_type);
+ if (TYPE_CODE (type) == TYPE_CODE_STRING)
+ return create_string_type (copy,
+ elt_type,
+ range_type);
+ else
+ return create_array_type (copy,
+ elt_type,
+ range_type);
}
/* Resolves dynamic compound types, e.g. STRUCTS's to static ones.
@@ -1958,6 +1973,7 @@ resolve_dynamic_type (struct type *type,
}
case TYPE_CODE_ARRAY:
+ case TYPE_CODE_STRING:
resolved_type = resolve_dynamic_array (type, addr);
break;

272
gdb-vla-intel-11of23.patch Normal file
View File

@ -0,0 +1,272 @@
Subject: [PATCH 11/23] vla: add stride support to fortran arrays.
Message-Id: <1401861266-6240-12-git-send-email-keven.boell@intel.com>
2014-05-28 Sanimir Agovic <sanimir.agovic@intel.com>
Keven Boell <keven.boell@intel.com>
* dwarf2read.c (read_subrange_type): Read dynamic
stride attributes.
* gdbtypes.c (create_array_type_with_stride): Add
stride support
(create_range_type): Add stride parameter.
(create_static_range_type): Pass default stride
parameter.
(resolve_dynamic_range): Evaluate stride baton.
(resolve_dynamic_type): Adjust data location with
the value of byte stride.
* gdbtypes.h (TYPE_BYTE_STRIDE): New macro.
(TYPE_BYTE_STRIDE_BLOCK): New macro.
(TYPE_BYTE_STRIDE_LOCLIST): New macro.
(TYPE_BYTE_STRIDE_KIND): New macro.
* valarith.c (value_subscripted_rvalue): Use stride.
Change-Id: I3d810c0dc37f9d9fd84dba4c764cdefc52d8501e
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/dwarf2read.c | 13 +++++++++++--
gdb/gdbtypes.c | 40 ++++++++++++++++++++++++++++++++++------
gdb/gdbtypes.h | 17 +++++++++++++++++
gdb/valarith.c | 14 +++++++++++++-
4 files changed, 75 insertions(+), 9 deletions(-)
Index: gdb-7.7.90.20140613/gdb/dwarf2read.c
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/dwarf2read.c 2014-06-16 23:24:12.741584315 +0200
+++ gdb-7.7.90.20140613/gdb/dwarf2read.c 2014-06-16 23:25:12.702640910 +0200
@@ -14696,7 +14696,7 @@ read_subrange_type (struct die_info *die
struct type *base_type, *orig_base_type;
struct type *range_type;
struct attribute *attr;
- struct dynamic_prop low, high;
+ struct dynamic_prop low, high, stride;
int low_default_is_valid;
int high_bound_is_count = 0;
const char *name;
@@ -14716,7 +14716,9 @@ read_subrange_type (struct die_info *die
low.kind = PROP_CONST;
high.kind = PROP_CONST;
+ stride.kind = PROP_CONST;
high.data.const_val = 0;
+ stride.data.const_val = 0;
/* Set LOW_DEFAULT_IS_VALID if current language and DWARF version allow
omitting DW_AT_lower_bound. */
@@ -14749,6 +14751,13 @@ read_subrange_type (struct die_info *die
break;
}
+ attr = dwarf2_attr (die, DW_AT_byte_stride, cu);
+ if (attr)
+ if (!attr_to_dynamic_prop (attr, die, cu, &stride, NULL, 0))
+ complaint (&symfile_complaints, _("Missing DW_AT_byte_stride "
+ "- DIE at 0x%x [in module %s]"),
+ die->offset.sect_off, objfile_name (cu->objfile));
+
attr = dwarf2_attr (die, DW_AT_lower_bound, cu);
if (attr)
attr_to_dynamic_prop (attr, die, cu, &low, NULL, 0);
@@ -14825,7 +14834,7 @@ read_subrange_type (struct die_info *die
&& !TYPE_UNSIGNED (base_type) && (high.data.const_val & negative_mask))
high.data.const_val |= negative_mask;
- range_type = create_range_type (NULL, orig_base_type, &low, &high);
+ range_type = create_range_type (NULL, orig_base_type, &low, &high, &stride);
if (high_bound_is_count)
TYPE_RANGE_DATA (range_type)->flag_upper_bound_is_count = 1;
Index: gdb-7.7.90.20140613/gdb/gdbtypes.c
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/gdbtypes.c 2014-06-16 23:24:12.741584315 +0200
+++ gdb-7.7.90.20140613/gdb/gdbtypes.c 2014-06-16 23:25:12.704640911 +0200
@@ -805,7 +805,8 @@ allocate_stub_method (struct type *type)
struct type *
create_range_type (struct type *result_type, struct type *index_type,
const struct dynamic_prop *low_bound,
- const struct dynamic_prop *high_bound)
+ const struct dynamic_prop *high_bound,
+ const struct dynamic_prop *stride)
{
if (result_type == NULL)
result_type = alloc_type_copy (index_type);
@@ -820,6 +821,7 @@ create_range_type (struct type *result_t
TYPE_ZALLOC (result_type, sizeof (struct range_bounds));
TYPE_RANGE_DATA (result_type)->low = *low_bound;
TYPE_RANGE_DATA (result_type)->high = *high_bound;
+ TYPE_RANGE_DATA (result_type)->stride = *stride;
if (low_bound->kind == PROP_CONST && low_bound->data.const_val >= 0)
TYPE_UNSIGNED (result_type) = 1;
@@ -841,7 +843,7 @@ struct type *
create_static_range_type (struct type *result_type, struct type *index_type,
LONGEST low_bound, LONGEST high_bound)
{
- struct dynamic_prop low, high;
+ struct dynamic_prop low, high, stride;
low.kind = PROP_CONST;
low.data.const_val = low_bound;
@@ -849,7 +851,11 @@ create_static_range_type (struct type *r
high.kind = PROP_CONST;
high.data.const_val = high_bound;
- result_type = create_range_type (result_type, index_type, &low, &high);
+ stride.kind = PROP_CONST;
+ stride.data.const_val = 0;
+
+ result_type = create_range_type (result_type, index_type,
+ &low, &high, &stride);
return result_type;
}
@@ -1006,16 +1012,21 @@ create_array_type_with_stride (struct ty
if (has_static_range (TYPE_RANGE_DATA (range_type))
&& dwarf2_address_data_valid (result_type))
{
- LONGEST low_bound, high_bound;
+ LONGEST low_bound, high_bound, byte_stride;
if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0)
low_bound = high_bound = 0;
CHECK_TYPEDEF (element_type);
+
+ byte_stride = abs (TYPE_BYTE_STRIDE (range_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. */
if (high_bound < low_bound)
TYPE_LENGTH (result_type) = 0;
+ else if (byte_stride > 0)
+ TYPE_LENGTH (result_type) = byte_stride * (high_bound - low_bound + 1);
else if (bit_stride > 0)
TYPE_LENGTH (result_type) =
(bit_stride * (high_bound - low_bound + 1) + 7) / 8;
@@ -1697,7 +1708,7 @@ resolve_dynamic_range (struct type *dyn_
struct type *static_range_type;
const struct dynamic_prop *prop;
const struct dwarf2_locexpr_baton *baton;
- struct dynamic_prop low_bound, high_bound;
+ struct dynamic_prop low_bound, high_bound, stride;
struct type *range_copy = copy_type (dyn_range_type);
gdb_assert (TYPE_CODE (dyn_range_type) == TYPE_CODE_RANGE);
@@ -1729,10 +1740,17 @@ resolve_dynamic_range (struct type *dyn_
high_bound.kind = PROP_UNDEFINED;
high_bound.data.const_val = 0;
}
+
+ prop = &TYPE_RANGE_DATA (dyn_range_type)->stride;
+ if (dwarf2_evaluate_property (prop, addr, &value))
+ {
+ stride.kind = PROP_CONST;
+ stride.data.const_val = value;
+ }
static_range_type = create_range_type (range_copy,
TYPE_TARGET_TYPE (range_copy),
- &low_bound, &high_bound);
+ &low_bound, &high_bound, &stride);
TYPE_RANGE_DATA (static_range_type)->flag_bound_evaluated = 1;
return static_range_type;
}
@@ -1996,7 +2014,17 @@ resolve_dynamic_type (struct type *type,
prop = TYPE_DATA_LOCATION (type);
if (dwarf2_evaluate_property (prop, addr, &value))
{
+ struct type *range_type = TYPE_INDEX_TYPE (type);
+
+ /* Adjust the data location with the value of byte stride if set, which
+ can describe the separation between successive elements along the
+ dimension. */
+ if (TYPE_BYTE_STRIDE (range_type) < 0)
+ value += (TYPE_HIGH_BOUND (range_type) - TYPE_LOW_BOUND (range_type))
+ * TYPE_BYTE_STRIDE (range_type);
+
adjusted_address = value;
+
TYPE_DATA_LOCATION_ADDR (type) = value;
TYPE_DATA_LOCATION_KIND (type) = PROP_CONST;
}
Index: gdb-7.7.90.20140613/gdb/gdbtypes.h
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/gdbtypes.h 2014-06-16 23:24:12.741584315 +0200
+++ gdb-7.7.90.20140613/gdb/gdbtypes.h 2014-06-16 23:25:12.704640911 +0200
@@ -670,6 +670,10 @@ struct main_type
struct dynamic_prop high;
+ /* * Stride of range. */
+
+ struct dynamic_prop stride;
+
/* True if HIGH range bound contains the number of elements in the
subrange. This affects how the final hight bound is computed. */
@@ -1219,6 +1223,15 @@ extern void allocate_gnat_aux_type (stru
TYPE_RANGE_DATA(range_type)->high.kind
#define TYPE_LOW_BOUND_KIND(range_type) \
TYPE_RANGE_DATA(range_type)->low.kind
+#define TYPE_BYTE_STRIDE(range_type) \
+ TYPE_RANGE_DATA(range_type)->stride.data.const_val
+#define TYPE_BYTE_STRIDE_BLOCK(range_type) \
+ TYPE_RANGE_DATA(range_type)->stride.data.locexpr
+#define TYPE_BYTE_STRIDE_LOCLIST(range_type) \
+ TYPE_RANGE_DATA(range_type)->stride.data.loclist
+#define TYPE_BYTE_STRIDE_KIND(range_type) \
+ TYPE_RANGE_DATA(range_type)->stride.kind
+
/* Attribute accessors for VLA support. */
#define TYPE_DATA_LOCATION(thistype) \
@@ -1250,6 +1263,9 @@ extern void allocate_gnat_aux_type (stru
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)
+
#define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \
(TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype))))
@@ -1718,6 +1734,7 @@ extern struct type *create_array_type_wi
extern struct type *create_range_type (struct type *, struct type *,
const struct dynamic_prop *,
+ const struct dynamic_prop *,
const struct dynamic_prop *);
extern struct type *create_array_type (struct type *, struct type *,
Index: gdb-7.7.90.20140613/gdb/valarith.c
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/valarith.c 2014-06-16 23:24:12.741584315 +0200
+++ gdb-7.7.90.20140613/gdb/valarith.c 2014-06-16 23:26:42.541725886 +0200
@@ -196,6 +196,7 @@ value_subscripted_rvalue (struct value *
struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type));
unsigned int elt_size = TYPE_LENGTH (elt_type);
unsigned int elt_offs;
+ LONGEST elt_stride = TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type));
struct value *v;
if (TYPE_NOT_ASSOCIATED (array_type))
@@ -203,7 +204,18 @@ value_subscripted_rvalue (struct value *
if (TYPE_NOT_ALLOCATED (array_type))
error (_("no such vector element because not allocated"));
- elt_offs = elt_size * longest_to_int (index - lowerbound);
+ elt_offs = longest_to_int (index - lowerbound);
+
+ if (elt_stride > 0)
+ elt_offs *= elt_stride;
+ else if (elt_stride < 0)
+ {
+ int offs = (elt_offs + 1) * elt_stride;
+
+ elt_offs = TYPE_LENGTH (array_type) + offs;
+ }
+ else
+ elt_offs *= elt_size;
if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
&& elt_offs >= TYPE_LENGTH (array_type)))

243
gdb-vla-intel-12of23.patch Normal file
View File

@ -0,0 +1,243 @@
Subject: [PATCH 12/23] test: basic tests for dynamic array evaluations in Fortran.
Message-Id: <1401861266-6240-13-git-send-email-keven.boell@intel.com>
Tests ensure that values of Fortran dynamic arrays
can be evaluated correctly in various ways and states.
2014-05-28 Keven Boell <keven.boell@intel.com>
Sanimir Agovic <sanimir.agovic@intel.com>
testsuite/gdb.fortran/:
* vla.f90: New file.
* vla-value.exp: New file.
Change-Id: I0229c3b58f72ae89c2ee42d1219e4538cb6bf023
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/testsuite/gdb.fortran/vla-value.exp | 148 +++++++++++++++++++++++++++++++
gdb/testsuite/gdb.fortran/vla.f90 | 56 ++++++++++++
2 files changed, 204 insertions(+)
create mode 100644 gdb/testsuite/gdb.fortran/vla-value.exp
create mode 100644 gdb/testsuite/gdb.fortran/vla.f90
diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran/vla-value.exp
new file mode 100644
index 0000000..d7b8a1e
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-value.exp
@@ -0,0 +1,148 @@
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile "vla.f90"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+ {debug f90 quiet}] } {
+ return -1
+}
+
+if ![runto MAIN__] then {
+ perror "couldn't run to breakpoint MAIN__"
+ continue
+}
+
+# Try to access values in non allocated VLA
+gdb_breakpoint [gdb_get_line_number "vla1-init"]
+gdb_continue_to_breakpoint "vla1-init"
+gdb_test "print vla1" " = <not allocated>" "print non-allocated vla1"
+gdb_test "print &vla1" \
+ " = \\\(PTR TO -> \\\( real\\\(kind=4\\\) \\\(<not allocated>\\\)\\\)\\\) $hex" \
+ "print non-allocated &vla1"
+gdb_test "print vla1(1,1,1)" "no such vector element because not allocated" \
+ "print member in non-allocated vla1 (1)"
+gdb_test "print vla1(101,202,303)" \
+ "no such vector element because not allocated" \
+ "print member in non-allocated vla1 (2)"
+gdb_test "print vla1(5,2,18)=1" "no such vector element because not allocated" \
+ "set member in non-allocated vla1"
+
+# Try to access value in allocated VLA
+gdb_breakpoint [gdb_get_line_number "vla2-allocated"]
+gdb_continue_to_breakpoint "vla2-allocated"
+gdb_test "next" "\\d+(\\t|\\s)+vla1\\\(3, 6, 9\\\) = 42" \
+ "step over value assignment of vla1"
+gdb_test "print &vla1" \
+ " = \\\(PTR TO -> \\\( real\\\(kind=4\\\) \\\(10,10,10\\\)\\\)\\\) $hex" \
+ "print allocated &vla1"
+gdb_test "print vla1(3, 6, 9)" " = 1311" "print allocated vla1(3,6,9)"
+gdb_test "print vla1(1, 3, 8)" " = 1311" "print allocated vla1(1,3,8)"
+gdb_test "print vla1(9, 9, 9) = 999" " = 999" \
+ "print allocated vla1(9,9,9)=1"
+
+# Try to access values in allocated VLA after specific assignment
+gdb_breakpoint [gdb_get_line_number "vla1-filled"]
+gdb_continue_to_breakpoint "vla1-filled"
+gdb_test "print vla1(3, 6, 9)" " = 42" \
+ "print allocated vla1(3,6,9) after specific assignment (filled)"
+gdb_test "print vla1(1, 3, 8)" " = 1001" \
+ "print allocated vla1(1,3,8) after specific assignment (filled)"
+gdb_test "print vla1(9, 9, 9)" " = 999" \
+ "print allocated vla1(9,9,9) after assignment in debugger (filled)"
+
+# Try to access values in undefined pointer to VLA (dangling)
+gdb_test "print pvla" " = <not associated>" "print undefined pvla"
+gdb_test "print &pvla" \
+ " = \\\(PTR TO -> \\\( real\\\(kind=4\\\) \\\(<not associated>\\\)\\\)\\\) $hex" \
+ "print non-associated &pvla"
+gdb_test "print pvla(1, 3, 8)" "no such vector element because not associated" \
+ "print undefined pvla(1,3,8)"
+
+# Try to access values in pointer to VLA and compare them
+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" \
+ "print associated &pvla"
+gdb_test "print pvla(3, 6, 9)" " = 42" "print associated pvla(3,6,9)"
+gdb_test "print pvla(1, 3, 8)" " = 1001" "print associated pvla(1,3,8)"
+gdb_test "print pvla(9, 9, 9)" " = 999" "print associated pvla(9,9,9)"
+
+# Fill values to VLA using pointer and check
+gdb_breakpoint [gdb_get_line_number "pvla-re-associated"]
+gdb_continue_to_breakpoint "pvla-re-associated"
+gdb_test "print pvla(5, 45, 20)" \
+ " = 1" "print pvla(5, 45, 20) after filled using pointer"
+gdb_test "print vla2(5, 45, 20)" \
+ " = 1" "print vla2(5, 45, 20) after filled using pointer"
+gdb_test "print pvla(7, 45, 14)" " = 2" \
+ "print pvla(7, 45, 14) after filled using pointer"
+gdb_test "print vla2(7, 45, 14)" " = 2" \
+ "print vla2(7, 45, 14) after filled using pointer"
+
+# Try to access values of deassociated VLA pointer
+gdb_breakpoint [gdb_get_line_number "pvla-deassociated"]
+gdb_continue_to_breakpoint "pvla-deassociated"
+gdb_test "print pvla(5, 45, 20)" \
+ "no such vector element because not associated" \
+ "print pvla(5, 45, 20) after deassociated"
+gdb_test "print pvla(7, 45, 14)" \
+ "no such vector element because not associated" \
+ "print pvla(7, 45, 14) after dissasociated"
+gdb_test "print pvla" " = <not associated>" \
+ "print vla1 after deassociated"
+
+# Try to access values of deallocated VLA
+gdb_breakpoint [gdb_get_line_number "vla1-deallocated"]
+gdb_continue_to_breakpoint "vla1-deallocated"
+gdb_test "print vla1(3, 6, 9)" "no such vector element because not allocated" \
+ "print allocated vla1(3,6,9) after specific assignment (deallocated)"
+gdb_test "print vla1(1, 3, 8)" "no such vector element because not allocated" \
+ "print allocated vla1(1,3,8) after specific assignment (deallocated)"
+gdb_test "print vla1(9, 9, 9)" "no such vector element because not allocated" \
+ "print allocated vla1(9,9,9) after assignment in debugger (deallocated)"
+
+
+# Try to assign VLA to user variable
+clean_restart ${testfile}
+
+if ![runto MAIN__] then {
+ perror "couldn't run to breakpoint MAIN__"
+ continue
+}
+gdb_breakpoint [gdb_get_line_number "vla2-allocated"]
+gdb_continue_to_breakpoint "vla2-allocated"
+gdb_test "next" "\\d+.*vla1\\(3, 6, 9\\) = 42" "next (1)"
+
+gdb_test_no_output "set \$myvar = vla1" "set \$myvar = vla1"
+gdb_test "print \$myvar" \
+ " = \\( *\\( *\\( *1311, *1311, *1311,\[()1311, .\]*\\)" \
+ "print \$myvar set to vla1"
+
+gdb_test "next" "\\d+.*vla1\\(1, 3, 8\\) = 1001" "next (2)"
+gdb_test "print \$myvar(3,6,9)" " = 1311" "print \$myvar(3,6,9)"
+
+gdb_breakpoint [gdb_get_line_number "pvla-associated"]
+gdb_continue_to_breakpoint "pvla-associated"
+gdb_test_no_output "set \$mypvar = pvla" "set \$mypvar = pvla"
+gdb_test "print \$mypvar(1,3,8)" " = 1001" "print \$mypvar(1,3,8)"
+
+# deallocate pointer and make sure user defined variable still has the
+# right value.
+gdb_breakpoint [gdb_get_line_number "pvla-deassociated"]
+gdb_continue_to_breakpoint "pvla-deassociated"
+gdb_test "print \$mypvar(1,3,8)" " = 1001" \
+ "print \$mypvar(1,3,8) after deallocated"
diff --git a/gdb/testsuite/gdb.fortran/vla.f90 b/gdb/testsuite/gdb.fortran/vla.f90
new file mode 100644
index 0000000..73425f3
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla.f90
@@ -0,0 +1,56 @@
+! Copyright 2014 Free Software Foundation, Inc.
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 3 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+program vla
+ real, target, allocatable :: vla1 (:, :, :)
+ real, target, allocatable :: vla2 (:, :, :)
+ real, target, allocatable :: vla3 (:, :)
+ real, pointer :: pvla (:, :, :)
+ logical :: l
+
+ allocate (vla1 (10,10,10)) ! vla1-init
+ l = allocated(vla1)
+
+ allocate (vla2 (1:7,42:50,13:35)) ! vla1-allocated
+ l = allocated(vla2)
+
+ vla1(:, :, :) = 1311 ! vla2-allocated
+ vla1(3, 6, 9) = 42
+ vla1(1, 3, 8) = 1001
+ vla1(6, 2, 7) = 13
+
+ vla2(:, :, :) = 1311 ! vla1-filled
+ vla2(5, 45, 20) = 42
+
+ pvla => vla1 ! vla2-filled
+ l = associated(pvla)
+
+ pvla => vla2 ! pvla-associated
+ l = associated(pvla)
+ pvla(5, 45, 20) = 1
+ pvla(7, 45, 14) = 2
+
+ pvla => null() ! pvla-re-associated
+ l = associated(pvla)
+
+ deallocate (vla1) ! pvla-deassociated
+ l = allocated(vla1)
+
+ deallocate (vla2) ! vla1-deallocated
+ l = allocated(vla2)
+
+ allocate (vla3 (2,2)) ! vla2-deallocated
+ vla3(:,:) = 13
+end program vla
--
1.7.9.5

273
gdb-vla-intel-13of23.patch Normal file
View File

@ -0,0 +1,273 @@
Subject: [PATCH 13/23] test: evaluate Fortran dynamic arrays of types.
Message-Id: <1401861266-6240-14-git-send-email-keven.boell@intel.com>
Tests ensure that dynamic arrays of various Fortran
datatypes can be evaluated correctly.
2014-05-28 Keven Boell <keven.boell@intel.com>
Sanimir Agovic <sanimir.agovic@intel.com>
testsuite/gdb.fortran/:
* vla-type.exp: New file.
* vla-type.f90: New file.
Change-Id: I7c1a381c5cb0ad48872b77993e7c7fdac85bc756
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/testsuite/gdb.fortran/vla-type.exp | 127 ++++++++++++++++++++++++++++++++
gdb/testsuite/gdb.fortran/vla-type.f90 | 107 +++++++++++++++++++++++++++
2 files changed, 234 insertions(+)
create mode 100644 gdb/testsuite/gdb.fortran/vla-type.exp
create mode 100644 gdb/testsuite/gdb.fortran/vla-type.f90
diff --git a/gdb/testsuite/gdb.fortran/vla-type.exp b/gdb/testsuite/gdb.fortran/vla-type.exp
new file mode 100644
index 0000000..ad50d9c
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-type.exp
@@ -0,0 +1,127 @@
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile ".f90"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+ {debug f90 quiet}] } {
+ return -1
+}
+
+if ![runto MAIN__] then {
+ perror "couldn't run to breakpoint MAIN__"
+ continue
+}
+
+# Check if not allocated VLA in type does not break
+# the debugger when accessing it.
+gdb_breakpoint [gdb_get_line_number "before-allocated"]
+gdb_continue_to_breakpoint "before-allocated"
+gdb_test "print twov" " = \\\( <not allocated>, <not allocated> \\\)" \
+ "print twov before allocated"
+gdb_test "print twov%ivla1" " = <not allocated>" \
+ "print twov%ivla1 before allocated"
+
+# Check type with one VLA's inside
+gdb_breakpoint [gdb_get_line_number "onev-filled"]
+gdb_continue_to_breakpoint "onev-filled"
+gdb_test "print onev%ivla(5, 11, 23)" " = 1" "print onev%ivla(5, 11, 23)"
+gdb_test "print onev%ivla(1, 2, 3)" " = 123" "print onev%ivla(1, 2, 3)"
+gdb_test "print onev%ivla(3, 2, 1)" " = 321" "print onev%ivla(3, 2, 1)"
+gdb_test "ptype onev" \
+ "type = Type one\r\n\\s+real\\\(kind=4\\\) :: ivla\\\(11,22,33\\\)\r\nEnd Type one" \
+ "ptype onev"
+
+# Check type with two VLA's inside
+gdb_breakpoint [gdb_get_line_number "twov-filled"]
+gdb_continue_to_breakpoint "twov-filled"
+gdb_test "print twov%ivla1(5, 11, 23)" " = 1" \
+ "print twov%ivla1(5, 11, 23)"
+gdb_test "print twov%ivla1(1, 2, 3)" " = 123" \
+ "print twov%ivla1(1, 2, 3)"
+gdb_test "print twov%ivla1(3, 2, 1)" " = 321" \
+ "print twov%ivla1(3, 2, 1)"
+gdb_test "ptype twov" \
+ "type = Type two\r\n\\s+real\\\(kind=4\\\) :: ivla1\\\(5,12,99\\\)\r\n\\s+real\\\(kind=4\\\) :: ivla2\\\(9,12\\\)\r\nEnd Type two" \
+ "ptype twov"
+
+# Check type with attribute at beginn of type
+gdb_breakpoint [gdb_get_line_number "threev-filled"]
+gdb_continue_to_breakpoint "threev-filled"
+gdb_test "print threev%ivla(1)" " = 1" "print threev%ivla(1)"
+gdb_test "print threev%ivla(5)" " = 42" "print threev%ivla(5)"
+gdb_test "print threev%ivla(14)" " = 24" "print threev%ivla(14)"
+gdb_test "print threev%ivar" " = 3.14\\d+?" "print threev%ivar"
+gdb_test "ptype threev" \
+ "type = Type three\r\n\\s+real\\\(kind=4\\\) :: ivar\r\n\\s+real\\\(kind=4\\\) :: ivla\\\(20\\\)\r\nEnd Type three" \
+ "ptype threev"
+
+# Check type with attribute at end of type
+gdb_breakpoint [gdb_get_line_number "fourv-filled"]
+gdb_continue_to_breakpoint "fourv-filled"
+gdb_test "print fourv%ivla(1)" " = 1" "print fourv%ivla(1)"
+gdb_test "print fourv%ivla(2)" " = 2" "print fourv%ivla(2)"
+gdb_test "print fourv%ivla(7)" " = 7" "print fourv%ivla(7)"
+gdb_test "print fourv%ivla(12)" "no such vector element" "print fourv%ivla(12)"
+gdb_test "print fourv%ivar" " = 3.14\\d+?" "print fourv%ivar"
+gdb_test "ptype fourv" \
+ "type = Type four\r\n\\s+real\\\(kind=4\\\) :: ivla\\\(10\\\)\r\n\\s+real\\\(kind=4\\\) :: ivar\r\nEnd Type four" \
+ "ptype fourv"
+
+# Check VLA of types
+gdb_breakpoint [gdb_get_line_number "onevla-filled"]
+gdb_continue_to_breakpoint "onevla-filled"
+gdb_test "print onevla(2,2)%ivla(3, 6, 9)" \
+ " = 369" "print onevla(2,2)%ivla(3, 6, 9)"
+gdb_test "print onevla(2,2)%ivla(9, 3, 6)" \
+ " = 936" "print onevla(2,2)%ivla(9, 3, 6)"
+
+# Check nested types containing a VLA
+gdb_breakpoint [gdb_get_line_number "fivev-filled"]
+gdb_continue_to_breakpoint "fivev-filled"
+gdb_test "print fivev%tone%ivla(5, 5, 1)" " = 1" \
+ "print fivev%tone%ivla(5, 5, 1)"
+gdb_test "print fivev%tone%ivla(1, 2, 3)" " = 123" \
+ "print fivev%tone%ivla(1, 2, 3)"
+gdb_test "print fivev%tone%ivla(3, 2, 1)" " = 321" \
+ "print fivev%tone%ivla(3, 2, 1)"
+gdb_test "ptype fivev" \
+ "type = Type five\r\n\\s+Type one\r\n\\s+real\\\(kind=4\\\) :: ivla\\\(10,10,10\\\)\r\n\\s+End Type one :: tone\r\nEnd Type five" \
+ "ptype fivev"
+
+# Check pointer to type, containing a VLA
+gdb_breakpoint [gdb_get_line_number "onep-associated"]
+gdb_continue_to_breakpoint "onep-associated"
+gdb_test "ptype onev" ".*real\\\(kind=4\\\) :: ivla\\\(11,22,33\\\).*" \
+ "ptype onev"
+gdb_test "ptype onep" ".*real\\\(kind=4\\\) :: ivla\\\(11,22,33\\\).*" \
+ "ptype onep"
+
+gdb_test "print onev%ivla" " = \\( *\\( *\\( *2, *2, *2,\[()2, .\]*\\)" \
+ "print onev%ivla"
+gdb_test "print onev" " = \\( *\\( *\\( *\\( *2, *2, *2,\[()2, .\]*\\)" \
+ "print onev"
+gdb_test "print onep" ".*real\\\(kind=4\\\) :: ivla\\\(11,22,33\\\).*" \
+ "print onep"
+
+gdb_test "ptype onev%ivla" "type = real\\\(kind=4\\\) \\\(11,22,33\\\)" \
+ "ptype onev%ivla"
+gdb_test "ptype onep%ivla" "type = real\\\(kind=4\\\) \\\(11,22,33\\\)" \
+ "ptype onep%ivla"
+
+gdb_test "ptype onev%ivla(1,1,1)" "type = real\\\(kind=4\\\)" \
+ "ptype onev%ivla(1,1,1)"
+gdb_test "ptype onep%ivla(1,1,1)" "type = real\\\(kind=4\\\)" \
+ "ptype onep%ivla(1,1,1)"
diff --git a/gdb/testsuite/gdb.fortran/vla-type.f90 b/gdb/testsuite/gdb.fortran/vla-type.f90
new file mode 100644
index 0000000..06600c9
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-type.f90
@@ -0,0 +1,107 @@
+! Copyright 2014 Free Software Foundation, Inc.
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program; if not, write to the Free Software
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+program vla_struct
+ type :: one
+ real, allocatable :: ivla (:, :, :)
+ end type one
+ type :: two
+ real, allocatable :: ivla1 (:, :, :)
+ real, allocatable :: ivla2 (:, :)
+ end type two
+ type :: three
+ real :: ivar
+ real, allocatable :: ivla (:)
+ end type three
+ type :: four
+ real, allocatable :: ivla (:)
+ real :: ivar
+ end type four
+ type :: five
+ type(one) :: tone
+ end type five
+
+ type(one), target :: onev
+ type(two) :: twov
+ type(three) :: threev
+ type(four) :: fourv
+ type(five) :: fivev
+ type(one), allocatable :: onevla(:, :)
+ type(one), pointer :: onep
+ logical :: l
+ integer :: i, j
+
+ allocate (onev%ivla (11,22,33)) ! before-allocated
+ l = allocated(onev%ivla)
+
+ onev%ivla(:, :, :) = 1
+ onev%ivla(1, 2, 3) = 123
+ onev%ivla(3, 2, 1) = 321
+
+ allocate (twov%ivla1 (5,12,99)) ! onev-filled
+ l = allocated(twov%ivla1)
+ allocate (twov%ivla2 (9,12))
+ l = allocated(twov%ivla2)
+
+ twov%ivla1(:, :, :) = 1
+ twov%ivla1(1, 2, 3) = 123
+ twov%ivla1(3, 2, 1) = 321
+
+ twov%ivla2(:, :) = 1
+ twov%ivla2(1, 2) = 12
+ twov%ivla2(2, 1) = 21
+
+ threev%ivar = 3.14 ! twov-filled
+ allocate (threev%ivla (20))
+ l = allocated(threev%ivla)
+
+ threev%ivla(:) = 1
+ threev%ivla(5) = 42
+ threev%ivla(14) = 24
+
+ allocate (fourv%ivla (10)) ! threev-filled
+ l = allocated(fourv%ivla)
+
+ fourv%ivar = 3.14
+ fourv%ivla(:) = 1
+ fourv%ivla(2) = 2
+ fourv%ivla(7) = 7
+
+
+ allocate (onevla (10, 10)) ! fourv-filled
+ do i = 1, 10
+ do j = 1, 10
+ allocate (onevla(i,j)%ivla(10,10,10))
+ l = allocated(onevla(i,j)%ivla)
+
+ onevla(i,j)%ivla(3, 6, 9) = 369
+ onevla(i,j)%ivla(9, 3, 6) = 936
+ end do
+ end do
+
+ allocate (fivev%tone%ivla (10, 10, 10)) ! onevla-filled
+ l = allocated(fivev%tone%ivla)
+ fivev%tone%ivla(:, :, :) = 1
+ fivev%tone%ivla(1, 2, 3) = 123
+ fivev%tone%ivla(3, 2, 1) = 321
+
+
+ onev%ivla(:,:,:) = 2 ! fivev-filled
+ onep => onev
+
+ ! dummy statement for bp
+ l = allocated(fivev%tone%ivla) ! onep-associated
+end program vla_struct
--
1.7.9.5

172
gdb-vla-intel-14of23.patch Normal file
View File

@ -0,0 +1,172 @@
Subject: [PATCH 14/23] test: evaluate dynamic arrays using Fortran primitives.
Message-Id: <1401861266-6240-15-git-send-email-keven.boell@intel.com>
Tests ensure that Fortran primitives can be evaluated
correctly when used as a dynamic array.
2014-05-28 Keven Boell <keven.boell@intel.com>
Sanimir Agovic <sanimir.agovic@intel.com>
testsuite/gdb.fortran/:
* vla-datatypes.f90: New file.
* vla-datatypes.exp: New file.
Change-Id: I8e82fa3833d77bfd7e9b4bdc40e3f96ce5e72da2
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/testsuite/gdb.fortran/vla-datatypes.exp | 82 +++++++++++++++++++++++++++
gdb/testsuite/gdb.fortran/vla-datatypes.f90 | 51 +++++++++++++++++
2 files changed, 133 insertions(+)
create mode 100644 gdb/testsuite/gdb.fortran/vla-datatypes.exp
create mode 100644 gdb/testsuite/gdb.fortran/vla-datatypes.f90
diff --git a/gdb/testsuite/gdb.fortran/vla-datatypes.exp b/gdb/testsuite/gdb.fortran/vla-datatypes.exp
new file mode 100644
index 0000000..20276d6
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-datatypes.exp
@@ -0,0 +1,82 @@
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile ".f90"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+ {debug f90 quiet}] } {
+ return -1
+}
+
+# check that all fortran standard datatypes will be
+# handled correctly when using as VLA's
+
+if ![runto MAIN__] then {
+ perror "couldn't run to breakpoint MAIN__"
+ continue
+}
+
+gdb_breakpoint [gdb_get_line_number "vlas-allocated"]
+gdb_continue_to_breakpoint "vlas-allocated"
+gdb_test "next" " = allocated\\\(realvla\\\)" \
+ "next to allocation status of intvla"
+gdb_test "print l" " = \\.TRUE\\." "intvla allocated"
+gdb_test "next" " = allocated\\\(complexvla\\\)" \
+ "next to allocation status of realvla"
+gdb_test "print l" " = \\.TRUE\\." "realvla allocated"
+gdb_test "next" " = allocated\\\(logicalvla\\\)" \
+ "next to allocation status of complexvla"
+gdb_test "print l" " = \\.TRUE\\." "complexvla allocated"
+gdb_test "next" " = allocated\\\(charactervla\\\)" \
+ "next to allocation status of logicalvla"
+gdb_test "print l" " = \\.TRUE\\." "logicalvla allocated"
+gdb_test "next" "intvla\\\(:,:,:\\\) = 1" \
+ "next to allocation status of charactervla"
+gdb_test "print l" " = \\.TRUE\\." "charactervla allocated"
+
+gdb_breakpoint [gdb_get_line_number "vlas-initialized"]
+gdb_continue_to_breakpoint "vlas-initialized"
+gdb_test "ptype intvla" "type = integer\\\(kind=4\\\) \\\(11,22,33\\\)" \
+ "ptype intvla"
+gdb_test "ptype realvla" "type = real\\\(kind=4\\\) \\\(11,22,33\\\)" \
+ "ptype realvla"
+gdb_test "ptype complexvla" "type = complex\\\(kind=4\\\) \\\(11,22,33\\\)" \
+ "ptype complexvla"
+gdb_test "ptype logicalvla" "type = logical\\\(kind=4\\\) \\\(11,22,33\\\)" \
+ "ptype logicalvla"
+gdb_test "ptype charactervla" "type = character\\\*1 \\\(11,22,33\\\)" \
+ "ptype charactervla"
+
+gdb_test "print intvla(5,5,5)" " = 1" "print intvla(5,5,5) (1st)"
+gdb_test "print realvla(5,5,5)" " = 3.14\\d+" \
+ "print realvla(5,5,5) (1st)"
+gdb_test "print complexvla(5,5,5)" " = \\\(2,-3\\\)" \
+ "print complexvla(5,5,5) (1st)"
+gdb_test "print logicalvla(5,5,5)" " = \\.TRUE\\." \
+ "print logicalvla(5,5,5) (1st)"
+gdb_test "print charactervla(5,5,5)" " = 'K'" \
+ "print charactervla(5,5,5) (1st)"
+
+gdb_breakpoint [gdb_get_line_number "vlas-modified"]
+gdb_continue_to_breakpoint "vlas-modified"
+gdb_test "print intvla(5,5,5)" " = 42" "print intvla(5,5,5) (2nd)"
+gdb_test "print realvla(5,5,5)" " = 4.13\\d+" \
+ "print realvla(5,5,5) (2nd)"
+gdb_test "print complexvla(5,5,5)" " = \\\(-3,2\\\)" \
+ "print complexvla(5,5,5) (2nd)"
+gdb_test "print logicalvla(5,5,5)" " = \\.FALSE\\." \
+ "print logicalvla(5,5,5) (2nd)"
+gdb_test "print charactervla(5,5,5)" " = 'X'" \
+ "print charactervla(5,5,5) (2nd)"
diff --git a/gdb/testsuite/gdb.fortran/vla-datatypes.f90 b/gdb/testsuite/gdb.fortran/vla-datatypes.f90
new file mode 100644
index 0000000..b11879a
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-datatypes.f90
@@ -0,0 +1,51 @@
+! Copyright 2014 Free Software Foundation, Inc.
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program; if not, write to the Free Software
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+program vla_primitives
+ integer, allocatable :: intvla(:, :, :)
+ real, allocatable :: realvla(:, :, :)
+ complex, allocatable :: complexvla(:, :, :)
+ logical, allocatable :: logicalvla(:, :, :)
+ character, allocatable :: charactervla(:, :, :)
+ logical :: l
+
+ allocate (intvla (11,22,33))
+ allocate (realvla (11,22,33))
+ allocate (complexvla (11,22,33))
+ allocate (logicalvla (11,22,33))
+ allocate (charactervla (11,22,33))
+
+ l = allocated(intvla) ! vlas-allocated
+ l = allocated(realvla)
+ l = allocated(complexvla)
+ l = allocated(logicalvla)
+ l = allocated(charactervla)
+
+ intvla(:,:,:) = 1
+ realvla(:,:,:) = 3.14
+ complexvla(:,:,:) = cmplx(2.0,-3.0)
+ logicalvla(:,:,:) = .TRUE.
+ charactervla(:,:,:) = char(75)
+
+ intvla(5,5,5) = 42 ! vlas-initialized
+ realvla(5,5,5) = 4.13
+ complexvla(5,5,5) = cmplx(-3.0,2.0)
+ logicalvla(5,5,5) = .FALSE.
+ charactervla(5,5,5) = 'X'
+
+ ! dummy statement for bp
+ l = .FALSE. ! vlas-modified
+end program vla_primitives
--
1.7.9.5

409
gdb-vla-intel-15of23.patch Normal file
View File

@ -0,0 +1,409 @@
Subject: [PATCH 15/23] test: dynamic arrays passed to subroutines.
Message-Id: <1401861266-6240-16-git-send-email-keven.boell@intel.com>
Tests dynamic arrays passed to subroutines and handled
in different ways inside the routine.
2014-05-28 Keven Boell <keven.boell@intel.com>
Sanimir Agovic <sanimir.agovic@intel.com>
testsuite/gdb.fortran/:
* vla-sub.f90: New file.
* vla-ptype-sub.exp: New file.
* vla-value-sub-arbitrary.exp: New file.
* vla-value-sub-finish.exp: New file.
* vla-value-sub.exp: New file.
Change-Id: I76db950fbacbf15b1f5e887bfd164eb8f85c55d1
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/testsuite/gdb.fortran/vla-ptype-sub.exp | 87 +++++++++++++++++++
gdb/testsuite/gdb.fortran/vla-sub.f90 | 82 ++++++++++++++++++
.../gdb.fortran/vla-value-sub-arbitrary.exp | 35 ++++++++
gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp | 49 +++++++++++
gdb/testsuite/gdb.fortran/vla-value-sub.exp | 90 ++++++++++++++++++++
5 files changed, 343 insertions(+)
create mode 100644 gdb/testsuite/gdb.fortran/vla-ptype-sub.exp
create mode 100644 gdb/testsuite/gdb.fortran/vla-sub.f90
create mode 100644 gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp
create mode 100644 gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp
create mode 100644 gdb/testsuite/gdb.fortran/vla-value-sub.exp
diff --git a/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp b/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp
new file mode 100644
index 0000000..2ee2914
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp
@@ -0,0 +1,87 @@
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile "vla-sub.f90"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+ {debug f90 quiet}] } {
+ return -1
+}
+
+if ![runto MAIN__] then {
+ perror "couldn't run to breakpoint MAIN__"
+ continue
+}
+
+# Pass fixed array to function and handle them as vla in function.
+gdb_breakpoint [gdb_get_line_number "not-filled"]
+gdb_continue_to_breakpoint "not-filled (1st)"
+gdb_test "ptype array1" "type = integer\\\(kind=4\\\) \\\(42,42\\\)" \
+ "ptype array1 (passed fixed)"
+gdb_test "ptype array2" "type = real\\\(kind=4\\\) \\\(42,42,42\\\)" \
+ "ptype array2 (passed fixed)"
+gdb_test "ptype array1(40, 10)" "type = integer\\\(kind=4\\\)" \
+ "ptype array1(40, 10) (passed fixed)"
+gdb_test "ptype array2(13, 11, 5)" "type = real\\\(kind=4\\\)" \
+ "ptype array2(13, 11, 5) (passed fixed)"
+
+# Pass sub arrays to function and handle them as vla in function.
+gdb_continue_to_breakpoint "not-filled (2nd)"
+gdb_test "ptype array1" "type = integer\\\(kind=4\\\) \\\(6,6\\\)" \
+ "ptype array1 (passed sub-array)"
+gdb_test "ptype array2" "type = real\\\(kind=4\\\) \\\(6,6,6\\\)" \
+ "ptype array2 (passed sub-array)"
+gdb_test "ptype array1(3, 3)" "type = integer\\\(kind=4\\\)" \
+ "ptype array1(3, 3) (passed sub-array)"
+gdb_test "ptype array2(4, 4, 4)" "type = real\\\(kind=4\\\)" \
+ "ptype array2(4, 4, 4) (passed sub-array)"
+
+# Check ptype outside of bounds. This should not crash GDB.
+gdb_test "ptype array1(100, 100)" "no such vector element" \
+ "ptype array1(100, 100) subarray do not crash (passed sub-array)"
+gdb_test "ptype array2(100, 100, 100)" "no such vector element" \
+ "ptype array2(100, 100, 100) subarray do not crash (passed sub-array)"
+
+# Pass vla to function.
+gdb_continue_to_breakpoint "not-filled (3rd)"
+gdb_test "ptype array1" "type = integer\\\(kind=4\\\) \\\(20,20\\\)" \
+ "ptype array1 (passed vla)"
+gdb_test "ptype array2" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \
+ "ptype array2 (passed vla)"
+gdb_test "ptype array1(3, 3)" "type = integer\\\(kind=4\\\)" \
+ "ptype array1(3, 3) (passed vla)"
+gdb_test "ptype array2(4, 4, 4)" "type = real\\\(kind=4\\\)" \
+ "ptype array2(4, 4, 4) (passed vla)"
+
+# Check ptype outside of bounds. This should not crash GDB.
+gdb_test "ptype array1(100, 100)" "no such vector element" \
+ "ptype array1(100, 100) VLA do not crash (passed vla)"
+gdb_test "ptype array2(100, 100, 100)" "no such vector element" \
+ "ptype array2(100, 100, 100) VLA do not crash (passed vla)"
+
+# Pass fixed array to function and handle it as VLA of arbitrary length in
+# function.
+gdb_breakpoint [gdb_get_line_number "end-of-bar"]
+gdb_continue_to_breakpoint "end-of-bar"
+gdb_test "ptype array1" \
+ "type = (PTR TO -> \\( )?integer(\\(kind=4\\)|\\*4) \\(\\*\\)\\)?" \
+ "ptype array1 (arbitrary length)"
+gdb_test "ptype array2" \
+ "type = (PTR TO -> \\( )?integer(\\(kind=4\\)|\\*4) \\(4:9,10:\\*\\)\\)?" \
+ "ptype array2 (arbitrary length)"
+gdb_test "ptype array1(100)" "type = integer\\\(kind=4\\\)" \
+ "ptype array1(100) (arbitrary length)"
+gdb_test "ptype array2(4,100)" "type = integer\\\(kind=4\\\)" \
+ "ptype array2(4,100) (arbitrary length)"
diff --git a/gdb/testsuite/gdb.fortran/vla-sub.f90 b/gdb/testsuite/gdb.fortran/vla-sub.f90
new file mode 100644
index 0000000..8c2c9ff
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-sub.f90
@@ -0,0 +1,82 @@
+! Copyright 2014 Free Software Foundation, Inc.
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program; if not, write to the Free Software
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+!
+! Original file written by Jakub Jelinek <jakub@redhat.com> and
+! Jan Kratochvil <jan.kratochvil@redhat.com>.
+! Modified for the GDB testcases by Keven Boell <keven.boell@intel.com>.
+
+subroutine foo (array1, array2)
+ integer :: array1 (:, :)
+ real :: array2 (:, :, :)
+
+ array1(:,:) = 5 ! not-filled
+ array1(1, 1) = 30
+
+ array2(:,:,:) = 6 ! array1-filled
+ array2(:,:,:) = 3
+ array2(1,1,1) = 30
+ array2(3,3,3) = 90 ! array2-almost-filled
+end subroutine
+
+subroutine bar (array1, array2)
+ integer :: array1 (*)
+ integer :: array2 (4:9, 10:*)
+
+ array1(5:10) = 1311
+ array1(7) = 1
+ array1(100) = 100
+ array2(4,10) = array1(7)
+ array2(4,100) = array1(7)
+ return ! end-of-bar
+end subroutine
+
+program vla_sub
+ interface
+ subroutine foo (array1, array2)
+ integer :: array1 (:, :)
+ real :: array2 (:, :, :)
+ end subroutine
+ end interface
+ interface
+ subroutine bar (array1, array2)
+ integer :: array1 (*)
+ integer :: array2 (4:9, 10:*)
+ end subroutine
+ end interface
+
+ real, allocatable :: vla1 (:, :, :)
+ integer, allocatable :: vla2 (:, :)
+
+ ! used for subroutine
+ integer :: sub_arr1(42, 42)
+ real :: sub_arr2(42, 42, 42)
+ integer :: sub_arr3(42)
+
+ sub_arr1(:,:) = 1 ! vla2-deallocated
+ sub_arr2(:,:,:) = 2
+ sub_arr3(:) = 3
+
+ call foo(sub_arr1, sub_arr2)
+ call foo(sub_arr1(5:10, 5:10), sub_arr2(10:15,10:15,10:15))
+
+ allocate (vla1 (10,10,10))
+ allocate (vla2 (20,20))
+ vla1(:,:,:) = 1311
+ vla2(:,:) = 42
+ call foo(vla2, vla1)
+
+ call bar(sub_arr3, sub_arr1)
+end program vla_sub
diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp b/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp
new file mode 100644
index 0000000..fd11adb
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp
@@ -0,0 +1,35 @@
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile "vla-sub.f90"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+ {debug f90 quiet}] } {
+ return -1
+}
+
+if ![runto MAIN__] then {
+ perror "couldn't run to breakpoint MAIN__"
+ continue
+}
+
+# Check VLA with arbitary length and check that elements outside of
+# bounds of the passed VLA can be accessed correctly.
+gdb_breakpoint [gdb_get_line_number "end-of-bar"]
+gdb_continue_to_breakpoint "end-of-bar"
+gdb_test "p array1(42)" " = 3" "print arbitary array1(42)"
+gdb_test "p array1(100)" " = 100" "print arbitary array1(100)"
+gdb_test "p array2(4,10)" " = 1" "print arbitary array2(4,10)"
+gdb_test "p array2(4,100)" " = 1" "print arbitary array2(4,100)"
diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp b/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp
new file mode 100644
index 0000000..a163617
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp
@@ -0,0 +1,49 @@
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile "vla-sub.f90"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+ {debug f90 quiet}] } {
+ return -1
+}
+
+if ![runto MAIN__] then {
+ perror "couldn't run to breakpoint MAIN__"
+ continue
+}
+
+# "up" works with GCC but other Fortran compilers may copy the values into the
+# outer function only on the exit of the inner function.
+# We need both variants as depending on the arch we optionally may still be
+# executing the caller line or not after `finish'.
+
+gdb_breakpoint [gdb_get_line_number "array2-almost-filled"]
+gdb_continue_to_breakpoint "array2-almost-filled"
+gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \
+ "print array2 in foo after it was filled"
+gdb_test "print array2(2,1,1)=20" " = 20" \
+ "set array(2,2,2) to 20 in subroutine"
+gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \
+ "print array2 in foo after it was mofified in debugger"
+
+gdb_test "finish" \
+ ".*foo\\\(sub_arr1\\\(5:10, 5:10\\\), sub_arr2\\\(10:15,10:15,10:15\\\)\\\)" \
+ "finish function"
+gdb_test "p sub_arr1(5, 7)" " = 5" "sub_arr1(5, 7) after finish"
+gdb_test "p sub_arr1(1, 1)" " = 30" "sub_arr1(1, 1) after finish"
+gdb_test "p sub_arr2(1, 1, 1)" " = 30" "sub_arr2(1, 1, 1) after finish"
+gdb_test "p sub_arr2(2, 1, 1)" " = 20" "sub_arr2(2, 1, 1) after finish"
+
diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub.exp b/gdb/testsuite/gdb.fortran/vla-value-sub.exp
new file mode 100644
index 0000000..848f9d7
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-value-sub.exp
@@ -0,0 +1,90 @@
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile "vla-sub.f90"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+ {debug f90 quiet}] } {
+ return -1
+}
+
+if ![runto MAIN__] then {
+ perror "couldn't run to breakpoint MAIN__"
+ continue
+}
+
+# Check the values of VLA's in subroutine can be evaluated correctly
+
+# Try to access values from a fixed array handled as VLA in subroutine.
+gdb_breakpoint [gdb_get_line_number "not-filled"]
+gdb_continue_to_breakpoint "not-filled (1st)"
+gdb_test "print array1" " = \\(\[()1, .\]*\\)" \
+ "print passed array1 in foo (passed fixed array)"
+
+gdb_breakpoint [gdb_get_line_number "array1-filled"]
+gdb_continue_to_breakpoint "array1-filled (1st)"
+gdb_test "print array1(5, 7)" " = 5" \
+ "print array1(5, 7) after filled in foo (passed fixed array)"
+gdb_test "print array1(1, 1)" " = 30" \
+ "print array1(1, 1) after filled in foo (passed fixed array)"
+
+gdb_breakpoint [gdb_get_line_number "array2-almost-filled"]
+gdb_continue_to_breakpoint "array2-almost-filled (1st)"
+gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \
+ "print array2 in foo after it was filled (passed fixed array)"
+gdb_test "print array2(2,1,1)=20" " = 20" \
+ "set array(2,2,2) to 20 in subroutine (passed fixed array)"
+gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \
+ "print array2 in foo after it was mofified in debugger (passed fixed array)"
+
+
+# Try to access values from a fixed sub-array handled as VLA in subroutine.
+gdb_continue_to_breakpoint "not-filled (2nd)"
+gdb_test "print array1" " = \\(\[()5, .\]*\\)" \
+ "print passed array1 in foo (passed sub-array)"
+
+gdb_continue_to_breakpoint "array1-filled (2nd)"
+gdb_test "print array1(5, 5)" " = 5" \
+ "print array1(5, 5) after filled in foo (passed sub-array)"
+gdb_test "print array1(1, 1)" " = 30" \
+ "print array1(1, 1) after filled in foo (passed sub-array)"
+
+gdb_continue_to_breakpoint "array2-almost-filled (2nd)"
+gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \
+ "print array2 in foo after it was filled (passed sub-array)"
+gdb_test "print array2(2,1,1)=20" " = 20" \
+ "set array(2,2,2) to 20 in subroutine (passed sub-array)"
+gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \
+ "print array2 in foo after it was mofified in debugger (passed sub-array)"
+
+
+# Try to access values from a VLA passed to subroutine.
+gdb_continue_to_breakpoint "not-filled (3rd)"
+gdb_test "print array1" " = \\(\[()42, .\]*\\)" \
+ "print passed array1 in foo (passed vla)"
+
+gdb_continue_to_breakpoint "array1-filled (3rd)"
+gdb_test "print array1(5, 5)" " = 5" \
+ "print array1(5, 5) after filled in foo (passed vla)"
+gdb_test "print array1(1, 1)" " = 30" \
+ "print array1(1, 1) after filled in foo (passed vla)"
+
+gdb_continue_to_breakpoint "array2-almost-filled (3rd)"
+gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \
+ "print array2 in foo after it was filled (passed vla)"
+gdb_test "print array2(2,1,1)=20" " = 20" \
+ "set array(2,2,2) to 20 in subroutine (passed vla)"
+gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \
+ "print array2 in foo after it was mofified in debugger (passed vla)"
--
1.7.9.5

126
gdb-vla-intel-16of23.patch Normal file
View File

@ -0,0 +1,126 @@
Subject: [PATCH 16/23] test: correct ptype of dynamic arrays in Fortran.
Message-Id: <1401861266-6240-17-git-send-email-keven.boell@intel.com>
Tests ensure that the ptype of dynamic arrays in
Fortran can be printed in GDB correctly.
2014-05-28 Keven Boell <keven.boell@intel.com>
Sanimir Agovic <sanimir.agovic@intel.com>
testsuite/gdb.fortran/:
* vla-ptype.exp: New file.
Change-Id: I508a0537be7cac5739a263788be89b18e84d8f8f
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/testsuite/gdb.fortran/vla-ptype.exp | 96 +++++++++++++++++++++++++++++++
1 file changed, 96 insertions(+)
create mode 100644 gdb/testsuite/gdb.fortran/vla-ptype.exp
diff --git a/gdb/testsuite/gdb.fortran/vla-ptype.exp b/gdb/testsuite/gdb.fortran/vla-ptype.exp
new file mode 100644
index 0000000..9267723
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-ptype.exp
@@ -0,0 +1,96 @@
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile "vla.f90"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+ {debug f90 quiet}] } {
+ return -1
+}
+
+if ![runto MAIN__] then {
+ perror "couldn't run to breakpoint MAIN__"
+ continue
+}
+
+# Check the ptype of various VLA states and pointer to VLA's.
+gdb_breakpoint [gdb_get_line_number "vla1-init"]
+gdb_continue_to_breakpoint "vla1-init"
+gdb_test "ptype vla1" "type = <not allocated>" "ptype vla1 not initialized"
+gdb_test "ptype vla2" "type = <not allocated>" "ptype vla2 not initialized"
+gdb_test "ptype pvla" "type = <not associated>" "ptype pvla not initialized"
+gdb_test "ptype vla1(3, 6, 9)" "no such vector element because not allocated" \
+ "ptype vla1(3, 6, 9) not initialized"
+gdb_test "ptype vla2(5, 45, 20)" \
+ "no such vector element because not allocated" \
+ "ptype vla1(5, 45, 20) not initialized"
+
+gdb_breakpoint [gdb_get_line_number "vla1-allocated"]
+gdb_continue_to_breakpoint "vla1-allocated"
+gdb_test "ptype vla1" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \
+ "ptype vla1 allocated"
+
+gdb_breakpoint [gdb_get_line_number "vla2-allocated"]
+gdb_continue_to_breakpoint "vla2-allocated"
+gdb_test "ptype vla2" "type = real\\\(kind=4\\\) \\\(7,42:50,13:35\\\)" \
+ "ptype vla2 allocated"
+
+gdb_breakpoint [gdb_get_line_number "vla1-filled"]
+gdb_continue_to_breakpoint "vla1-filled"
+gdb_test "ptype vla1" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \
+ "ptype vla1 filled"
+gdb_test "ptype vla1(3, 6, 9)" "type = real\\\(kind=4\\\)" \
+ "ptype vla1(3, 6, 9)"
+
+gdb_breakpoint [gdb_get_line_number "vla2-filled"]
+gdb_continue_to_breakpoint "vla2-filled"
+gdb_test "ptype vla2" "type = real\\\(kind=4\\\) \\\(7,42:50,13:35\\\)" \
+ "ptype vla2 filled"
+gdb_test "ptype vla2(5, 45, 20)" "type = real\\\(kind=4\\\)" \
+ "ptype vla1(5, 45, 20) filled"
+
+gdb_breakpoint [gdb_get_line_number "pvla-associated"]
+gdb_continue_to_breakpoint "pvla-associated"
+gdb_test "ptype pvla" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \
+ "ptype pvla associated"
+gdb_test "ptype pvla(3, 6, 9)" "type = real\\\(kind=4\\\)" \
+ "ptype pvla(3, 6, 9)"
+
+gdb_breakpoint [gdb_get_line_number "pvla-re-associated"]
+gdb_continue_to_breakpoint "pvla-re-associated"
+gdb_test "ptype pvla" "type = real\\\(kind=4\\\) \\\(7,42:50,13:35\\\)" \
+ "ptype pvla re-associated"
+gdb_test "ptype vla2(5, 45, 20)" "type = real\\\(kind=4\\\)" \
+ "ptype vla1(5, 45, 20) re-associated"
+
+gdb_breakpoint [gdb_get_line_number "pvla-deassociated"]
+gdb_continue_to_breakpoint "pvla-deassociated"
+gdb_test "ptype pvla" "type = <not associated>" "ptype pvla deassociated"
+gdb_test "ptype pvla(5, 45, 20)" \
+ "no such vector element because not associated" \
+ "ptype pvla(5, 45, 20) not associated"
+
+gdb_breakpoint [gdb_get_line_number "vla1-deallocated"]
+gdb_continue_to_breakpoint "vla1-deallocated"
+gdb_test "ptype vla1" "type = <not allocated>" "ptype vla1 not allocated"
+gdb_test "ptype vla1(3, 6, 9)" "no such vector element because not allocated" \
+ "ptype vla1(3, 6, 9) not allocated"
+
+gdb_breakpoint [gdb_get_line_number "vla2-deallocated"]
+gdb_continue_to_breakpoint "vla2-deallocated"
+gdb_test "ptype vla2" "type = <not allocated>" "ptype vla2 not allocated"
+gdb_test "ptype vla2(5, 45, 20)" \
+ "no such vector element because not allocated" \
+ "ptype vla2(5, 45, 20) not allocated"
--
1.7.9.5

View File

@ -0,0 +1,95 @@
Subject: [PATCH 17/23] test: evaluating allocation/association status
Message-Id: <1401861266-6240-18-git-send-email-keven.boell@intel.com>
Tests ensure that dynamic arrays in different states
(allocated/associated) can be evaluated.
2014-05-28 Keven Boell <keven.boell@intel.com>
Sanimir Agovic <sanimir.agovic@intel.com>
testsuite/gdb.fortran/:
* vla-alloc-assoc.exp: New file.
Change-Id: I6950473c3f1724ebf5c7b037706186b2cd6af5f0
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp | 65 +++++++++++++++++++++++++
1 file changed, 65 insertions(+)
create mode 100644 gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp
diff --git a/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp b/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp
new file mode 100644
index 0000000..20607c3
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp
@@ -0,0 +1,65 @@
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile "vla.f90"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+ {debug f90 quiet}] } {
+ return -1
+}
+
+if ![runto MAIN__] then {
+ perror "couldn't run to breakpoint MAIN__"
+ continue
+}
+
+# Check the association status of various types of VLA's
+# and pointer to VLA's.
+gdb_breakpoint [gdb_get_line_number "vla1-allocated"]
+gdb_continue_to_breakpoint "vla1-allocated"
+gdb_test "print l" " = \\.TRUE\\." \
+ "print vla1 allocation status (allocated)"
+
+gdb_breakpoint [gdb_get_line_number "vla2-allocated"]
+gdb_continue_to_breakpoint "vla2-allocated"
+gdb_test "print l" " = \\.TRUE\\." \
+ "print vla2 allocation status (allocated)"
+
+gdb_breakpoint [gdb_get_line_number "pvla-associated"]
+gdb_continue_to_breakpoint "pvla-associated"
+gdb_test "print l" " = \\.TRUE\\." \
+ "print pvla associated status (associated)"
+
+gdb_breakpoint [gdb_get_line_number "pvla-re-associated"]
+gdb_continue_to_breakpoint "pvla-re-associated"
+gdb_test "print l" " = \\.TRUE\\." \
+ "print pvla associated status (re-associated)"
+
+gdb_breakpoint [gdb_get_line_number "pvla-deassociated"]
+gdb_continue_to_breakpoint "pvla-deassociated"
+gdb_test "print l" " = \\.FALSE\\." \
+ "print pvla allocation status (deassociated)"
+
+gdb_breakpoint [gdb_get_line_number "vla1-deallocated"]
+gdb_continue_to_breakpoint "vla1-deallocated"
+gdb_test "print l" " = \\.FALSE\\." \
+ "print vla1 allocation status (deallocated)"
+gdb_test "print vla1" " = <not allocated>" \
+ "print deallocated vla1"
+
+gdb_breakpoint [gdb_get_line_number "vla2-deallocated"]
+gdb_continue_to_breakpoint "vla2-deallocated"
+gdb_test "print l" " = \\.FALSE\\." "print vla2 deallocated"
+gdb_test "print vla2" " = <not allocated>" "print deallocated vla2"
--
1.7.9.5

171
gdb-vla-intel-18of23.patch Normal file
View File

@ -0,0 +1,171 @@
Subject: [PATCH 18/23] test: dynamic arrays passed to functions.
Message-Id: <1401861266-6240-19-git-send-email-keven.boell@intel.com>
Tests for dynamic arrays passed to functions
and returned from functions.
2014-05-28 Keven Boell <keven.boell@intel.com>
Sanimir Agovic <sanimir.agovic@intel.com>
testsuite/gdb.fortran/:
* vla-func.f90: New file.
* vla-func.exp: New file.
Change-Id: Ic3eb212f35f599e4c10a284c23125491653b17df
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/testsuite/gdb.fortran/vla-func.exp | 61 +++++++++++++++++++++++++++
gdb/testsuite/gdb.fortran/vla-func.f90 | 71 ++++++++++++++++++++++++++++++++
2 files changed, 132 insertions(+)
create mode 100644 gdb/testsuite/gdb.fortran/vla-func.exp
create mode 100644 gdb/testsuite/gdb.fortran/vla-func.f90
diff --git a/gdb/testsuite/gdb.fortran/vla-func.exp b/gdb/testsuite/gdb.fortran/vla-func.exp
new file mode 100644
index 0000000..f0f236b
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-func.exp
@@ -0,0 +1,61 @@
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile ".f90"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+ {debug f90 quiet}] } {
+ return -1
+}
+
+if ![runto MAIN__] then {
+ perror "couldn't run to breakpoint MAIN__"
+ continue
+}
+
+# Check VLA passed to first Fortran function.
+gdb_breakpoint [gdb_get_line_number "func1-vla-passed"]
+gdb_continue_to_breakpoint "func1-vla-passed"
+gdb_test "print vla" " = \\( *\\( *22, *22, *22,\[()22, .\]*\\)" \
+ "print vla (func1)"
+gdb_test "ptype vla" "type = integer\\\(kind=4\\\) \\\(10,10\\\)" \
+ "ptype vla (func1)"
+
+gdb_breakpoint [gdb_get_line_number "func1-vla-modified"]
+gdb_continue_to_breakpoint "func1-vla-modified"
+gdb_test "print vla(5,5)" " = 55" "print vla(5,5) (func1)"
+gdb_test "print vla(7,7)" " = 77" "print vla(5,5) (func1)"
+
+# Check if the values are correct after returning from func1
+gdb_breakpoint [gdb_get_line_number "func1-returned"]
+gdb_continue_to_breakpoint "func1-returned"
+gdb_test "print ret" " = .TRUE." "print ret after func1 returned"
+
+# Check VLA passed to second Fortran function
+gdb_breakpoint [gdb_get_line_number "func2-vla-passed"]
+gdb_continue_to_breakpoint "func2-vla-passed"
+gdb_test "print vla" \
+ " = \\\(44, 44, 44, 44, 44, 44, 44, 44, 44, 44\\\)" \
+ "print vla (func2)"
+gdb_test "ptype vla" "type = integer\\\(kind=4\\\) \\\(10\\\)" \
+ "ptype vla (func2)"
+
+# Check if the returned VLA has the correct values and ptype.
+gdb_breakpoint [gdb_get_line_number "func2-returned"]
+gdb_continue_to_breakpoint "func2-returned"
+gdb_test "print vla3" " = \\\(1, 2, 44, 4, 44, 44, 44, 8, 44, 44\\\)" \
+ "print vla3 (after func2)"
+gdb_test "ptype vla3" "type = integer\\\(kind=4\\\) \\\(10\\\)" \
+ "ptype vla3 (after func2)"
diff --git a/gdb/testsuite/gdb.fortran/vla-func.f90 b/gdb/testsuite/gdb.fortran/vla-func.f90
new file mode 100644
index 0000000..4f45da1
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-func.f90
@@ -0,0 +1,71 @@
+! Copyright 2014 Free Software Foundation, Inc.
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program; if not, write to the Free Software
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+logical function func1 (vla)
+ implicit none
+ integer, allocatable :: vla (:, :)
+ func1 = allocated(vla)
+ vla(5,5) = 55 ! func1-vla-passed
+ vla(7,7) = 77
+ return ! func1-vla-modified
+end function func1
+
+function func2(vla)
+ implicit none
+ integer :: vla (:)
+ integer :: func2(size(vla))
+ integer :: k
+
+ vla(1) = 1 ! func2-vla-passed
+ vla(2) = 2
+ vla(4) = 4
+ vla(8) = 8
+
+ func2 = vla
+end function func2
+
+program vla_func
+ implicit none
+ interface
+ logical function func1 (vla)
+ integer :: vla (:, :)
+ end function
+ end interface
+ interface
+ function func2 (vla)
+ integer :: vla (:)
+ integer func2(size(vla))
+ end function
+ end interface
+
+ logical :: ret
+ integer, allocatable :: vla1 (:, :)
+ integer, allocatable :: vla2 (:)
+ integer, allocatable :: vla3 (:)
+
+ ret = .FALSE.
+
+ allocate (vla1 (10,10))
+ vla1(:,:) = 22
+
+ allocate (vla2 (10))
+ vla2(:) = 44
+
+ ret = func1(vla1)
+ vla3 = func2(vla2) ! func1-returned
+
+ ret = .TRUE. ! func2-returned
+end program vla_func
--
1.7.9.5

View File

@ -0,0 +1,92 @@
Subject: [PATCH 19/23] test: accessing dynamic array history values.
Message-Id: <1401861266-6240-20-git-send-email-keven.boell@intel.com>
Tests if the history values of dynamic arrays can be
accessed and printed again with the correct values.
2014-05-28 Keven Boell <keven.boell@intel.com>
Sanimir Agovic <sanimir.agovic@intel.com>
testsuite/gdb.fortran/:
* vla-history.exp: New file.
Change-Id: Ib6d2d30272aefc24b6db5fa0633fe72274390e91
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/testsuite/gdb.fortran/vla-history.exp | 62 +++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
create mode 100644 gdb/testsuite/gdb.fortran/vla-history.exp
diff --git a/gdb/testsuite/gdb.fortran/vla-history.exp b/gdb/testsuite/gdb.fortran/vla-history.exp
new file mode 100644
index 0000000..170e1eb
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-history.exp
@@ -0,0 +1,62 @@
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile "vla.f90"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+ {debug f90 quiet}] } {
+ return -1
+}
+
+if ![runto MAIN__] then {
+ perror "couldn't run to breakpoint MAIN__"
+ continue
+}
+
+# Set some breakpoints and print complete vla.
+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_breakpoint [gdb_get_line_number "vla2-allocated"]
+gdb_continue_to_breakpoint "vla2-allocated"
+gdb_test "print vla1" " = \\( *\\( *\\( *0, *0, *0,\[()0, .\]*\\)" \
+ "print vla1 allocated"
+gdb_test "print vla2" " = \\( *\\( *\\( *0, *0, *0,\[()0, .\]*\\)" \
+ "print vla2 allocated"
+
+gdb_breakpoint [gdb_get_line_number "vla1-filled"]
+gdb_continue_to_breakpoint "vla1-filled"
+gdb_test "print vla1" \
+ " = \\( *\\( *\\( *1311, *1311, *1311,\[()1311, .\]*\\)" \
+ "print vla1 filled"
+
+# Try to access history values for full vla prints.
+gdb_test "print \$1" " = <not allocated>" "print \$1"
+gdb_test "print \$2" " = \\( *\\( *\\( *0, *0, *0,\[()0, .\]*\\)" \
+ "print \$2"
+gdb_test "print \$3" " = \\( *\\( *\\( *0, *0, *0,\[()0, .\]*\\)" \
+ "print \$3"
+gdb_test "print \$4" \
+ " = \\( *\\( *\\( *1311, *1311, *1311,\[()1311, .\]*\\)" "print \$4"
+
+gdb_breakpoint [gdb_get_line_number "vla2-filled"]
+gdb_continue_to_breakpoint "vla2-filled"
+gdb_test "print vla2(1,43,20)" " = 1311" "print vla2(1,43,20)"
+gdb_test "print vla1(1,3,8)" " = 1001" "print vla2(1,3,8)"
+
+# Try to access history values for vla values.
+gdb_test "print \$9" " = 1311" "print \$9"
+gdb_test "print \$10" " = 1001" "print \$10"
--
1.7.9.5

181
gdb-vla-intel-20of23.patch Normal file
View File

@ -0,0 +1,181 @@
Subject: [PATCH 20/23] test: dynamic string evaluations.
Message-Id: <1401861266-6240-21-git-send-email-keven.boell@intel.com>
Tests various dynamic string evaluations. Dynamic strings
will be handled internally the same way as dynamic arrays.
2014-05-28 Keven Boell <keven.boell@intel.com>
Sanimir Agovic <sanimir.agovic@intel.com>
testsuite/gdb.fortran/:
* vla-strings.f90: New file.
* vla-strings.exp: New file.
Change-Id: Ib2f3dded2fbc5f0a9684050c5cfa22a450e18358
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/testsuite/gdb.fortran/vla-strings.exp | 104 +++++++++++++++++++++++++++++
gdb/testsuite/gdb.fortran/vla-strings.f90 | 38 +++++++++++
2 files changed, 142 insertions(+)
create mode 100644 gdb/testsuite/gdb.fortran/vla-strings.exp
create mode 100644 gdb/testsuite/gdb.fortran/vla-strings.f90
diff --git a/gdb/testsuite/gdb.fortran/vla-strings.exp b/gdb/testsuite/gdb.fortran/vla-strings.exp
new file mode 100644
index 0000000..7fc1734
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-strings.exp
@@ -0,0 +1,104 @@
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile ".f90"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+ {debug f90 quiet}] } {
+ return -1
+}
+
+# check that all fortran standard datatypes will be
+# handled correctly when using as VLA's
+
+if ![runto MAIN__] then {
+ perror "couldn't run to breakpoint MAIN__"
+ continue
+}
+
+gdb_breakpoint [gdb_get_line_number "var_char-allocated-1"]
+gdb_continue_to_breakpoint "var_char-allocated-1"
+gdb_test "print var_char" \
+ " = \\(PTR TO -> \\( character\\*10 \\)\\) ${hex}" \
+ "print var_char after allocated first time"
+gdb_test "print *var_char" \
+ " = '\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000'" \
+ "print *var_char after allocated first time"
+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*10 \\)" \
+ "whatis var_char first time"
+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*10 \\)" \
+ "ptype var_char first time"
+gdb_test "next" "\\d+.*var_char = 'foo'.*" \
+ "next to allocation status of var_char"
+gdb_test "print l" " = .TRUE." "print allocation status first time"
+
+gdb_breakpoint [gdb_get_line_number "var_char-filled-1"]
+gdb_continue_to_breakpoint "var_char-filled-1"
+gdb_test "print var_char" \
+ " = \\(PTR TO -> \\( character\\*3 \\)\\) ${hex}" \
+ "print var_char after filled first time"
+gdb_test "print *var_char" " = 'foo'" \
+ "print *var_char after filled first time"
+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*3 \\)" \
+ "whatis var_char after filled first time"
+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*3 \\)" \
+ "ptype var_char after filled first time"
+gdb_test "print var_char(1)" " = 102 'f'" "print var_char(1)"
+gdb_test "print var_char(3)" " = 111 'o'" "print var_char(3)"
+
+gdb_breakpoint [gdb_get_line_number "var_char-filled-2"]
+gdb_continue_to_breakpoint "var_char-filled-2"
+gdb_test "print var_char" \
+ " = \\(PTR TO -> \\( character\\*6 \\)\\) ${hex}" \
+ "print var_char after allocated second time"
+gdb_test "print *var_char" " = 'foobar'" \
+ "print *var_char after allocated second time"
+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*6 \\)" \
+ "whatis var_char second time"
+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*6 \\)" \
+ "ptype var_char second time"
+
+gdb_breakpoint [gdb_get_line_number "var_char-empty"]
+gdb_continue_to_breakpoint "var_char-empty"
+gdb_test "print var_char" \
+ " = \\(PTR TO -> \\( character\\*0 \\)\\) ${hex}" \
+ "print var_char after set empty"
+gdb_test "print *var_char" " = \"\"" "print *var_char after set empty"
+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*0 \\)" \
+ "whatis var_char after set empty"
+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*0 \\)" \
+ "ptype var_char after set empty"
+
+gdb_breakpoint [gdb_get_line_number "var_char-allocated-3"]
+gdb_continue_to_breakpoint "var_char-allocated-3"
+gdb_test "print var_char" \
+ " = \\(PTR TO -> \\( character\\*21 \\)\\) ${hex}" \
+ "print var_char after allocated third time"
+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*21 \\)" \
+ "whatis var_char after allocated third time"
+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*21 \\)" \
+ "ptype var_char after allocated third time"
+
+gdb_breakpoint [gdb_get_line_number "var_char_p-associated"]
+gdb_continue_to_breakpoint "var_char_p-associated"
+gdb_test "print var_char_p" \
+ " = \\(PTR TO -> \\( character\\*7 \\)\\) ${hex}" \
+ "print var_char_p after associated"
+gdb_test "print *var_char_p" " = 'johndoe'" \
+ "print *var_char_ after associated"
+gdb_test "whatis var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \
+ "whatis var_char_p after associated"
+gdb_test "ptype var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \
+ "ptype var_char_p after associated"
diff --git a/gdb/testsuite/gdb.fortran/vla-strings.f90 b/gdb/testsuite/gdb.fortran/vla-strings.f90
new file mode 100644
index 0000000..6679043
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-strings.f90
@@ -0,0 +1,38 @@
+! Copyright 2014 Free Software Foundation, Inc.
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program; if not, write to the Free Software
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+program vla_strings
+ character(len=:), target, allocatable :: var_char
+ character(len=:), pointer :: var_char_p
+ logical :: l
+
+ allocate(character(len=10) :: var_char)
+ l = allocated(var_char) ! var_char-allocated-1
+ var_char = 'foo'
+ deallocate(var_char) ! var_char-filled-1
+ l = allocated(var_char) ! var_char-deallocated
+ allocate(character(len=42) :: var_char)
+ l = allocated(var_char)
+ var_char = 'foobar'
+ var_char = '' ! var_char-filled-2
+ allocate(character(len=21) :: var_char) ! var_char-empty
+ l = allocated(var_char) ! var_char-allocated-3
+ var_char = 'johndoe'
+ var_char_p => var_char
+ l = associated(var_char_p) ! var_char_p-associated
+ var_char_p => null()
+ l = associated(var_char_p) ! var_char_p-not-associated
+end program vla_strings
--
1.7.9.5

262
gdb-vla-intel-21of23.patch Normal file
View File

@ -0,0 +1,262 @@
Subject: [PATCH 21/23] test: basic MI test for the dynamic array support.
Message-Id: <1401861266-6240-22-git-send-email-keven.boell@intel.com>
Tests dynamic array evaluations using MI protocol.
2014-05-28 Keven Boell <keven.boell@intel.com>
Sanimir Agovic <sanimir.agovic@intel.com>
testsuite/gdb.mi/:
* mi-vla-fortran.exp: New file.
* vla.f90: New file.
Change-Id: I37caa85b1498478f5eff0f52d3fd431388aaab6f
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/testsuite/gdb.mi/mi-vla-fortran.exp | 182 +++++++++++++++++++++++++++++++
gdb/testsuite/gdb.mi/vla.f90 | 42 +++++++
2 files changed, 224 insertions(+)
create mode 100644 gdb/testsuite/gdb.mi/mi-vla-fortran.exp
create mode 100644 gdb/testsuite/gdb.mi/vla.f90
diff --git a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
new file mode 100644
index 0000000..72b0be2
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
@@ -0,0 +1,182 @@
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Verify that, using the MI, we can evaluate a simple C Variable Length
+# Array (VLA).
+
+load_lib mi-support.exp
+set MIFLAGS "-i=mi"
+
+gdb_exit
+if [mi_gdb_start] {
+ continue
+}
+
+standard_testfile vla.f90
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
+ {debug f90}] != "" } {
+ untested mi-vla-fortran.exp
+ return -1
+}
+
+mi_delete_breakpoints
+mi_gdb_reinitialize_dir $srcdir/$subdir
+mi_gdb_load ${binfile}
+
+set bp_lineno [gdb_get_line_number "vla1-not-allocated"]
+mi_create_breakpoint "-t vla.f90:$bp_lineno" 1 "del" "vla" \
+ ".*vla.f90" $bp_lineno $hex \
+ "insert breakpoint at line $bp_lineno (vla not allocated)"
+mi_run_cmd
+mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
+ { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno"
+mi_gdb_test "500-data-evaluate-expression vla1" \
+ "500\\^done,value=\"<not allocated>\"" "evaluate not allocated vla"
+
+mi_create_varobj_checked vla1_not_allocated vla1 "<not allocated>" \
+ "create local variable vla1_not_allocated"
+mi_gdb_test "501-var-info-type vla1_not_allocated" \
+ "501\\^done,type=\"<not allocated>\"" \
+ "info type variable vla1_not_allocated"
+mi_gdb_test "502-var-show-format vla1_not_allocated" \
+ "502\\^done,format=\"natural\"" \
+ "show format variable vla1_not_allocated"
+mi_gdb_test "503-var-evaluate-expression vla1_not_allocated" \
+ "503\\^done,value=\"\\\[0\\\]\"" \
+ "eval variable vla1_not_allocated"
+mi_list_array_varobj_children_with_index "vla1_not_allocated" "0" "1" \
+ "real\\\(kind=4\\\)" "get children of vla1_not_allocated"
+
+
+
+set bp_lineno [gdb_get_line_number "vla1-allocated"]
+mi_create_breakpoint "-t vla.f90:$bp_lineno" 2 "del" "vla" ".*vla.f90" \
+ $bp_lineno $hex "insert breakpoint at line $bp_lineno (vla allocated)"
+mi_run_cmd
+mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
+ { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno"
+mi_gdb_test "510-data-evaluate-expression vla1" \
+ "510\\^done,value=\"\\(0, 0, 0, 0, 0\\)\"" "evaluate allocated vla"
+
+mi_create_varobj_checked vla1_allocated vla1 "real\\\(kind=4\\\) \\\(5\\\)" \
+ "create local variable vla1_allocated"
+mi_gdb_test "511-var-info-type vla1_allocated" \
+ "511\\^done,type=\"real\\\(kind=4\\\) \\\(5\\\)\"" \
+ "info type variable vla1_allocated"
+mi_gdb_test "512-var-show-format vla1_allocated" \
+ "512\\^done,format=\"natural\"" \
+ "show format variable vla1_allocated"
+mi_gdb_test "513-var-evaluate-expression vla1_allocated" \
+ "513\\^done,value=\"\\\[5\\\]\"" \
+ "eval variable vla1_allocated"
+mi_list_array_varobj_children_with_index "vla1_allocated" "5" "1" \
+ "real\\\(kind=4\\\)" "get children of vla1_allocated"
+
+
+set bp_lineno [gdb_get_line_number "vla1-filled"]
+mi_create_breakpoint "-t vla.f90:$bp_lineno" 3 "del" "vla" ".*vla.f90" \
+ $bp_lineno $hex "insert breakpoint at line $bp_lineno"
+mi_run_cmd
+mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
+ { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno"
+mi_gdb_test "520-data-evaluate-expression vla1" \
+ "520\\^done,value=\"\\(1, 1, 1, 1, 1\\)\"" "evaluate filled vla"
+
+
+set bp_lineno [gdb_get_line_number "vla1-modified"]
+mi_create_breakpoint "-t vla.f90:$bp_lineno" 4 "del" "vla" ".*vla.f90" \
+ $bp_lineno $hex "insert breakpoint at line $bp_lineno"
+mi_run_cmd
+mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
+ { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno"
+mi_gdb_test "530-data-evaluate-expression vla1" \
+ "530\\^done,value=\"\\(1, 42, 1, 24, 1\\)\"" "evaluate filled vla"
+mi_gdb_test "540-data-evaluate-expression vla1(1)" \
+ "540\\^done,value=\"1\"" "evaluate filled vla"
+mi_gdb_test "550-data-evaluate-expression vla1(2)" \
+ "550\\^done,value=\"42\"" "evaluate filled vla"
+mi_gdb_test "560-data-evaluate-expression vla1(4)" \
+ "560\\^done,value=\"24\"" "evaluate filled vla"
+
+
+set bp_lineno [gdb_get_line_number "vla1-deallocated"]
+mi_create_breakpoint "-t vla.f90:$bp_lineno" 5 "del" "vla" ".*vla.f90" \
+ $bp_lineno $hex "insert breakpoint at line $bp_lineno"
+mi_run_cmd
+mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
+ { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno"
+mi_gdb_test "570-data-evaluate-expression vla1" \
+ "570\\^done,value=\"<not allocated>\"" "evaluate not allocated vla"
+
+
+set bp_lineno [gdb_get_line_number "pvla2-not-associated"]
+mi_create_breakpoint "-t vla.f90:$bp_lineno" 6 "del" "vla" ".*vla.f90" \
+ $bp_lineno $hex "insert breakpoint at line $bp_lineno"
+mi_run_cmd
+mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
+ { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno"
+mi_gdb_test "580-data-evaluate-expression pvla2" \
+ "580\\^done,value=\"<not associated>\"" "evaluate not associated vla"
+
+mi_create_varobj_checked pvla2_not_associated pvla2 "<not associated>" \
+ "create local variable pvla2_not_associated"
+mi_gdb_test "581-var-info-type pvla2_not_associated" \
+ "581\\^done,type=\"<not associated>\"" \
+ "info type variable pvla2_not_associated"
+mi_gdb_test "582-var-show-format pvla2_not_associated" \
+ "582\\^done,format=\"natural\"" \
+ "show format variable pvla2_not_associated"
+mi_gdb_test "583-var-evaluate-expression pvla2_not_associated" \
+ "583\\^done,value=\"\\\[0\\\]\"" \
+ "eval variable pvla2_not_associated"
+mi_list_array_varobj_children_with_index "pvla2_not_associated" "0" "1" \
+ "real\\\(kind=4\\\)" "get children of pvla2_not_associated"
+
+
+set bp_lineno [gdb_get_line_number "pvla2-associated"]
+mi_create_breakpoint "-t vla.f90:$bp_lineno" 7 "del" "vla" ".*vla.f90" \
+ $bp_lineno $hex "insert breakpoint at line $bp_lineno"
+mi_run_cmd
+mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
+ { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno"
+mi_gdb_test "590-data-evaluate-expression pvla2" \
+ "590\\^done,value=\"\\(\\( 2, 2, 2, 2, 2\\) \\( 2, 2, 2, 2, 2\\) \\)\"" \
+ "evaluate associated vla"
+
+mi_create_varobj_checked pvla2_associated pvla2 \
+ "real\\\(kind=4\\\) \\\(5,2\\\)" "create local variable pvla2_associated"
+mi_gdb_test "591-var-info-type pvla2_associated" \
+ "591\\^done,type=\"real\\\(kind=4\\\) \\\(5,2\\\)\"" \
+ "info type variable pvla2_associated"
+mi_gdb_test "592-var-show-format pvla2_associated" \
+ "592\\^done,format=\"natural\"" \
+ "show format variable pvla2_associated"
+mi_gdb_test "593-var-evaluate-expression pvla2_associated" \
+ "593\\^done,value=\"\\\[2\\\]\"" \
+ "eval variable pvla2_associated"
+
+
+set bp_lineno [gdb_get_line_number "pvla2-set-to-null"]
+mi_create_breakpoint "-t vla.f90:$bp_lineno" 8 "del" "vla" ".*vla.f90" \
+ $bp_lineno $hex "insert breakpoint at line $bp_lineno"
+mi_run_cmd
+mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
+ { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno"
+mi_gdb_test "600-data-evaluate-expression pvla2" \
+ "600\\^done,value=\"<not associated>\"" "evaluate vla pointer set to null"
+
+mi_gdb_exit
+return 0
diff --git a/gdb/testsuite/gdb.mi/vla.f90 b/gdb/testsuite/gdb.mi/vla.f90
new file mode 100644
index 0000000..46edad2
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/vla.f90
@@ -0,0 +1,42 @@
+! Copyright 2014 Free Software Foundation, Inc.
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 3 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+program vla
+ real, allocatable :: vla1 (:)
+ real, target, allocatable :: vla2(:, :)
+ real, pointer :: pvla2 (:, :)
+ logical :: l
+
+ allocate (vla1 (5)) ! vla1-not-allocated
+ l = allocated(vla1) ! vla1-allocated
+
+ vla1(:) = 1
+ vla1(2) = 42 ! vla1-filled
+ vla1(4) = 24
+
+ deallocate (vla1) ! vla1-modified
+ l = allocated(vla1) ! vla1-deallocated
+
+ allocate (vla2 (5, 2))
+ vla2(:, :) = 2
+
+ pvla2 => vla2 ! pvla2-not-associated
+ l = associated(pvla2) ! pvla2-associated
+
+ pvla2(2, 1) = 42
+
+ pvla2 => null()
+ l = associated(pvla2) ! pvla2-set-to-null
+end program vla
--
1.7.9.5

View File

@ -0,0 +1,75 @@
Subject: [PATCH 22/23] test: test sizeof for dynamic fortran arrays.
Message-Id: <1401861266-6240-23-git-send-email-keven.boell@intel.com>
Tests sizeof output of dynamic arrays in various states.
2014-05-28 Keven Boell <keven.boell@intel.com>
Sanimir Agovic <sanimir.agovic@intel.com>
testsuite/gdb.fortran/:
* vla-sizeof.exp: New file.
Change-Id: I68d81d03ff2daa32ab87d2750873652d684e7389
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/testsuite/gdb.fortran/vla-sizeof.exp | 46 ++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
create mode 100644 gdb/testsuite/gdb.fortran/vla-sizeof.exp
diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortran/vla-sizeof.exp
new file mode 100644
index 0000000..6053c17
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-sizeof.exp
@@ -0,0 +1,46 @@
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile "vla.f90"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+ {debug f90 quiet}] } {
+ return -1
+}
+
+if ![runto MAIN__] then {
+ perror "couldn't run to breakpoint MAIN__"
+ continue
+}
+
+# Try to access values in non allocated VLA
+gdb_breakpoint [gdb_get_line_number "vla1-init"]
+gdb_continue_to_breakpoint "vla1-init"
+gdb_test "print sizeof(vla1)" " = 0" "print sizeof non-allocated vla1"
+
+# Try to access value in allocated VLA
+gdb_breakpoint [gdb_get_line_number "vla2-allocated"]
+gdb_continue_to_breakpoint "vla2-allocated"
+gdb_test "print sizeof(vla1)" " = 4000" "print sizeof allocated vla1"
+
+# Try to access values in undefined pointer to VLA (dangling)
+gdb_breakpoint [gdb_get_line_number "vla1-filled"]
+gdb_continue_to_breakpoint "vla1-filled"
+gdb_test "print sizeof(pvla)" " = 0" "print sizeof non-associated pvla"
+
+# Try to access values in pointer to VLA and compare them
+gdb_breakpoint [gdb_get_line_number "pvla-associated"]
+gdb_continue_to_breakpoint "pvla-associated"
+gdb_test "print sizeof(pvla)" " = 4000" "print sizeof associated pvla"
--
1.7.9.5

119
gdb-vla-intel-23of23.patch Normal file
View File

@ -0,0 +1,119 @@
Subject: [PATCH 23/23] test: stride support for dynamic arrays.
Message-Id: <1401861266-6240-24-git-send-email-keven.boell@intel.com>
Tests the usage of stride values in dynamic arrays.
2014-05-28 Sanimir Agovic <sanimir.agovic@intel.com>
Keven Boell <keven.boell@intel.com>
testsuite/gdb.fortran/:
* vla-stride.exp: New file.
* vla-stride.f90: New file.
Change-Id: Ic4f68cf97046cc9f5f3664fe4c12d2b7528c22ee
Signed-off-by: Keven Boell <keven.boell@intel.com>
---
gdb/testsuite/gdb.fortran/vla-stride.exp | 51 ++++++++++++++++++++++++++++++
gdb/testsuite/gdb.fortran/vla-stride.f90 | 30 ++++++++++++++++++
2 files changed, 81 insertions(+)
create mode 100644 gdb/testsuite/gdb.fortran/vla-stride.exp
create mode 100644 gdb/testsuite/gdb.fortran/vla-stride.f90
diff --git a/gdb/testsuite/gdb.fortran/vla-stride.exp b/gdb/testsuite/gdb.fortran/vla-stride.exp
new file mode 100644
index 0000000..e791115
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-stride.exp
@@ -0,0 +1,51 @@
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile ".f90"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+ {debug f90 quiet}] } {
+ return -1
+}
+
+if ![runto MAIN__] then {
+ perror "couldn't run to breakpoint MAIN__"
+ continue
+}
+
+gdb_breakpoint [gdb_get_line_number "reverse-elements"]
+gdb_continue_to_breakpoint "reverse-elements"
+gdb_test "print pvla" " = \\\(10, 9, 8, 7, 6, 5, 4, 3, 2, 1\\\)" \
+ "print reverse-elements"
+gdb_test "print pvla(1)" " = 10" "print first reverse-element"
+gdb_test "print pvla(10)" " = 1" "print last reverse-element"
+
+gdb_breakpoint [gdb_get_line_number "re-reverse-elements"]
+gdb_continue_to_breakpoint "re-reverse-elements"
+gdb_test "print pvla" " = \\\(1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\\)" \
+ "print re-reverse-elements"
+gdb_test "print pvla(1)" " = 1" "print first re-reverse-element"
+gdb_test "print pvla(10)" " = 10" "print last re-reverse-element"
+
+gdb_breakpoint [gdb_get_line_number "odd-elements"]
+gdb_continue_to_breakpoint "odd-elements"
+gdb_test "print pvla" " = \\\(1, 3, 5, 7, 9\\\)" "print odd-elements"
+gdb_test "print pvla(1)" " = 1" "print first odd-element"
+gdb_test "print pvla(5)" " = 9" "print last odd-element"
+
+gdb_breakpoint [gdb_get_line_number "single-element"]
+gdb_continue_to_breakpoint "single-element"
+gdb_test "print pvla" " = \\\(5\\\)" "print single-element"
+gdb_test "print pvla(1)" " = 5" "print one single-element"
diff --git a/gdb/testsuite/gdb.fortran/vla-stride.f90 b/gdb/testsuite/gdb.fortran/vla-stride.f90
new file mode 100644
index 0000000..1f8cc55
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-stride.f90
@@ -0,0 +1,30 @@
+! Copyright 2014 Free Software Foundation, Inc.
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program; if not, write to the Free Software
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+program vla_stride
+ integer, target, allocatable :: vla (:)
+ integer, pointer :: pvla (:)
+
+ allocate(vla(10))
+ vla = (/ (I, I = 1,10) /)
+
+ pvla => vla(10:1:-1)
+ pvla => pvla(10:1:-1) ! reverse-elements
+ pvla => vla(1:10:2) ! re-reverse-elements
+ pvla => vla(5:4:-2) ! odd-elements
+
+ pvla => null() ! single-element
+end program vla_stride
--
1.7.9.5

View File

@ -0,0 +1,38 @@
http://sourceware.org/ml/gdb-patches/2014-06/msg00710.html
Subject: Re: Regression for watchpoint-fork.exp [Re: [PATCH v3 2/5] PR breakpoints/7143 - Watchpoint does not trigger when first set]
On 06/19/2014 04:02 PM, Pedro Alves wrote:
>> Attaching gzipped gdb.threads/watchpoint-fork-parent-st
>> from gcc-4.9.0-9.fc21.x86_64.
>
> Thanks, I can reproduce it.
Hmm, I suspect this might be related to kernel-side validation
of DR_CONTROL vs DR0-3, like what we already handle in amd64_linux_prepare_to_resume.
And indeed this below makes the error go away. Not exactly sure why yet.
[ patch extended by Jan Kratochvil ]
--- gdb-7.7.90.20140613/gdb/i386-linux-nat.c.orig 2014-06-19 21:42:00.788611544 +0200
+++ gdb-7.7.90.20140613/gdb/i386-linux-nat.c 2014-06-19 21:42:04.556614401 +0200
@@ -778,6 +778,8 @@ i386_linux_prepare_to_resume (struct lwp
/* See amd64_linux_prepare_to_resume for Linux kernel note on
i386_linux_dr_set calls ordering. */
+ i386_linux_dr_set (lwp->ptid, DR_CONTROL, 0);
+
for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++)
if (state->dr_ref_count[i] > 0)
{
--- gdb-7.7.90.20140613/gdb/amd64-linux-nat.c.orig 2014-06-19 21:40:37.582534392 +0200
+++ gdb-7.7.90.20140613/gdb/amd64-linux-nat.c 2014-06-19 21:41:17.192570902 +0200
@@ -415,6 +415,8 @@ amd64_linux_prepare_to_resume (struct lw
Ensure DR_CONTROL gets written as the very last register here. */
+ amd64_linux_dr_set (lwp->ptid, DR_CONTROL, 0);
+
for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++)
if (state->dr_ref_count[i] > 0)
{

117
gdb.spec
View File

@ -17,17 +17,15 @@
Summary: A GNU source-level debugger for C, C++, Fortran, Go and other languages
Name: %{?scl_prefix}gdb
# 6e5c95e6cf1e3c37bd3a822ca9e6721caab97a85
#global snap 20140127
# Freeze it when GDB gets branched
%global snapsrc 20140108
%global snapsrc 20140613
# See timestamp of source gnulib installed into gdb/gnulib/ .
%global snapgnulib 20121213
Version: 7.7.1
Version: 7.7.90.20140613
# 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: 21%{?dist}
Release: 1%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL
Group: Development/Debuggers
@ -221,20 +219,6 @@ Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch
# Backported fixups post the source tarball.
#Xdrop: Just backports.
Patch232: gdb-upstream.patch
Patch868: gdb-upstream-ppc64le02of15.patch
Patch869: gdb-upstream-ppc64le03of15.patch
Patch870: gdb-upstream-ppc64le04of15.patch
Patch871: gdb-upstream-ppc64le05of15.patch
Patch872: gdb-upstream-ppc64le06of15.patch
Patch873: gdb-upstream-ppc64le07of15.patch
Patch874: gdb-upstream-ppc64le08of15.patch
Patch875: gdb-upstream-ppc64le09of15.patch
Patch876: gdb-upstream-ppc64le10of15.patch
Patch877: gdb-upstream-ppc64le11of15.patch
Patch878: gdb-upstream-ppc64le12of15.patch
Patch879: gdb-upstream-ppc64le13of15.patch
Patch880: gdb-upstream-ppc64le14of15.patch
Patch881: gdb-upstream-ppc64le15of15.patch
# Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
#=fedoratest+ppc
@ -287,10 +271,6 @@ Patch833: gdb-6.6-buildid-locate-rpm-scl.patch
# but not corresponding binary pkg' (RH BZ 981154).
Patch863: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
# Add kernel vDSO workaround (`no loadable ...') on RHEL-5 (kernel BZ 765875).
#=push
Patch276: gdb-6.6-bfd-vdso8k.patch
# Fix displaying of numeric char arrays as strings (BZ 224128).
#=fedoratest: But it is failing anyway, one should check the behavior more.
Patch282: gdb-6.7-charsign-test.patch
@ -518,20 +498,44 @@ Patch832: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
# Fix crash on 'enable count' (Simon Marchi, BZ 993118).
Patch843: gdb-enable-count-crash.patch
# Fix testsuite "ERROR: no fileid for".
Patch846: gdb-testsuite-nohostid.patch
# [rhel6] DTS backward Python compatibility API (BZ 1020004, Phil Muldoon).
Patch848: gdb-dts-rhel6-python-compat.patch
# Fix crash of -readnow /usr/lib/debug/usr/bin/gnatbind.debug (BZ 1069211).
Patch850: gdb-gnat-dwarf-crash-1of3.patch
Patch851: gdb-gnat-dwarf-crash-2of3.patch
Patch852: gdb-gnat-dwarf-crash-3of3.patch
# Fix TLS access for -static -pthread (BZ 1080660).
Patch865: gdb-static-tls-1of2.patch
Patch866: gdb-static-tls-2of2.patch
# VLA (Fortran dynamic arrays) from Intel + archer-jankratochvil-vla tests.
Patch887: gdb-archer-vla-tests.patch
Patch888: gdb-vla-intel-01of23.patch
Patch889: gdb-vla-intel-02of23.patch
Patch890: gdb-vla-intel-03of23.patch
Patch891: gdb-vla-intel-04of23.patch
Patch912: gdb-vla-intel-04of23-fix.patch
Patch892: gdb-vla-intel-05of23.patch
Patch893: gdb-vla-intel-06of23.patch
Patch894: gdb-vla-intel-07of23.patch
Patch895: gdb-vla-intel-08of23.patch
Patch896: gdb-vla-intel-09of23.patch
Patch897: gdb-vla-intel-10of23.patch
Patch898: gdb-vla-intel-11of23.patch
Patch899: gdb-vla-intel-12of23.patch
Patch900: gdb-vla-intel-13of23.patch
Patch901: gdb-vla-intel-14of23.patch
Patch902: gdb-vla-intel-15of23.patch
Patch903: gdb-vla-intel-16of23.patch
Patch904: gdb-vla-intel-17of23.patch
Patch905: gdb-vla-intel-18of23.patch
Patch906: gdb-vla-intel-19of23.patch
Patch907: gdb-vla-intel-20of23.patch
Patch908: gdb-vla-intel-21of23.patch
Patch909: gdb-vla-intel-22of23.patch
Patch910: gdb-vla-intel-23of23.patch
# Fix ASAN crash regression with demangled names copy (Tom Tromey).
Patch911: gdb-bfd-demangled-names.patch
# Fix gdb-7.8 watchpoint-fork.exp regression (Pedro Alves).
Patch913: gdb-watchpoint-fork-fix.patch
%if 0%{!?rhel:1} || 0%{?rhel} > 6
# RL_STATE_FEDORA_GDB would not be found for:
@ -707,20 +711,30 @@ find -name "*.info*"|xargs rm -f
%patch349 -p1
%patch232 -p1
%patch868 -p1
%patch869 -p1
%patch870 -p1
%patch871 -p1
%patch872 -p1
%patch873 -p1
%patch874 -p1
%patch875 -p1
%patch876 -p1
%patch877 -p1
%patch878 -p1
%patch879 -p1
%patch880 -p1
%patch881 -p1
%patch888 -p1
%patch889 -p1
%patch890 -p1
%patch891 -p1
%patch912 -p1
%patch892 -p1
%patch893 -p1
%patch894 -p1
%patch895 -p1
%patch896 -p1
%patch897 -p1
%patch898 -p1
%patch899 -p1
%patch900 -p1
%patch901 -p1
%patch902 -p1
%patch903 -p1
%patch904 -p1
%patch905 -p1
%patch906 -p1
%patch907 -p1
%patch908 -p1
%patch909 -p1
%patch910 -p1
%patch1 -p1
%patch105 -p1
@ -760,7 +774,6 @@ find -name "*.info*"|xargs rm -f
%patch274 -p1
%patch659 -p1
%patch353 -p1
%patch276 -p1
%patch282 -p1
%patch284 -p1
%patch289 -p1
@ -817,13 +830,11 @@ find -name "*.info*"|xargs rm -f
%patch818 -p1
%patch832 -p1
%patch843 -p1
%patch846 -p1
%patch850 -p1
%patch851 -p1
%patch852 -p1
%patch863 -p1
%patch865 -p1
%patch866 -p1
%patch887 -p1
%patch911 -p1
%patch913 -p1
%patch848 -p1
%if 0%{!?el6:1}
@ -910,6 +921,7 @@ export LDFLAGS="%{?__global_ldflags} %{?_with_asan:-fsanitize=address}"
--with-separate-debug-dir=/usr/lib/debug \
--disable-sim \
--disable-rpath \
--without-guile \
%if 0%{!?rhel:1} || 0%{?rhel} > 6
--with-system-readline \
%else
@ -1308,6 +1320,9 @@ then
fi
%changelog
* Thu Jun 19 2014 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.7.90.20140613-1.fc21
- Rebase to FSF GDB 7.7.90.20140613 (pre-7.8 snapshot).
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 7.7.1-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

View File

@ -1,2 +1,2 @@
4981307aa9619bbec5b73261e4e41c8d gdb-libstdc++-v3-python-r155978.tar.bz2
77b20b515e7c25f032cb9732a66620fe gdb-7.7.1.tar.bz2
cf4ddceb79fef56b4146e14be72c8727 gdb-7.7.90.20140613.tar.bz2