- Rebuild for Fedora 14.
This commit is contained in:
parent
c874340ae4
commit
ee681d3b2f
@ -1,2 +1,2 @@
|
||||
gdb-7.0.50.20100203.tar.bz2
|
||||
gdb-7.1.tar.bz2
|
||||
libstdc++-v3-python-r155978.tar.bz2
|
||||
|
@ -4,10 +4,9 @@
|
||||
to install and uninstall.
|
||||
* gstack.sh, gstack.1: New files.
|
||||
|
||||
Index: gdb-6.8.91.20090917/gdb/Makefile.in
|
||||
===================================================================
|
||||
--- gdb-6.8.91.20090917.orig/gdb/Makefile.in 2009-09-17 12:47:07.000000000 +0200
|
||||
+++ gdb-6.8.91.20090917/gdb/Makefile.in 2009-09-17 12:47:38.000000000 +0200
|
||||
diff -up -ruNp gdb-7.0.1-empty/gdb/Makefile.in gdb-7.0.1/gdb/Makefile.in
|
||||
--- gdb-7.0.1-empty/gdb/Makefile.in 2010-04-07 20:36:04.000000000 +0200
|
||||
+++ gdb-7.0.1/gdb/Makefile.in 2010-04-07 20:36:42.000000000 +0200
|
||||
@@ -989,7 +989,7 @@ install: all install-only
|
||||
|
||||
# The "install-only" target also installs the syscalls' XML files in
|
||||
@ -63,10 +62,9 @@ Index: gdb-6.8.91.20090917/gdb/Makefile.in
|
||||
|
||||
# The C++ name parser can be built standalone for testing.
|
||||
test-cp-name-parser.o: cp-name-parser.c
|
||||
Index: gdb-6.8.91.20090917/gdb/gstack.sh
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-6.8.91.20090917/gdb/gstack.sh 2009-09-17 12:47:14.000000000 +0200
|
||||
diff -up -ruNp gdb-7.0.1-empty/gdb/gstack.sh gdb-7.0.1/gdb/gstack.sh
|
||||
--- gdb-7.0.1-empty/gdb/gstack.sh 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ gdb-7.0.1/gdb/gstack.sh 2010-04-07 20:36:47.000000000 +0200
|
||||
@@ -0,0 +1,48 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
@ -87,17 +85,17 @@ Index: gdb-6.8.91.20090917/gdb/gstack.sh
|
||||
+backtrace="bt"
|
||||
+if test -d /proc/$1/task ; then
|
||||
+ # Newer kernel; has a task/ directory.
|
||||
+ if test `ls /proc/$1/task | wc -l` -gt 1 2>/dev/null ; then
|
||||
+ if test `/bin/ls /proc/$1/task | /usr/bin/wc -l` -gt 1 2>/dev/null ; then
|
||||
+ backtrace="thread apply all bt"
|
||||
+ fi
|
||||
+elif test -f /proc/$1/maps ; then
|
||||
+ # Older kernel; go by it loading libpthread.
|
||||
+ if grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
|
||||
+ if /bin/grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
|
||||
+ backtrace="thread apply all bt"
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+GDB=${GDB:-gdb}
|
||||
+GDB=${GDB:-/usr/bin/gdb}
|
||||
+
|
||||
+if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then
|
||||
+ readnever=--readnever
|
||||
@ -112,7 +110,127 @@ Index: gdb-6.8.91.20090917/gdb/gstack.sh
|
||||
+set pagination no
|
||||
+$backtrace
|
||||
+EOF
|
||||
+sed -n \
|
||||
+ -e 's/^(gdb) //' \
|
||||
+/bin/sed -n \
|
||||
+ -e 's/^\((gdb) \)*//' \
|
||||
+ -e '/^#/p' \
|
||||
+ -e '/^Thread/p'
|
||||
--- /dev/null 2010-04-07 06:20:52.289994508 +0200
|
||||
+++ gdb-7.0.1/gdb/testsuite/gdb.base/gstack.exp 2010-04-07 21:53:57.000000000 +0200
|
||||
@@ -0,0 +1,71 @@
|
||||
+# Copyright (C) 2010 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/>.
|
||||
+
|
||||
+set testfile gstack
|
||||
+set executable ${testfile}
|
||||
+set binfile ${objdir}/${subdir}/$executable
|
||||
+if {[build_executable ${testfile} ${executable} "" {debug}] == -1} {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set test "spawn inferior"
|
||||
+set command "${binfile}"
|
||||
+set res [remote_spawn host $command];
|
||||
+if { $res < 0 || $res == "" } {
|
||||
+ perror "Spawning $command failed."
|
||||
+ fail $test
|
||||
+ return
|
||||
+}
|
||||
+set pid [exp_pid -i $res]
|
||||
+gdb_expect {
|
||||
+ -re "looping\r\n" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ eof {
|
||||
+ fail "$test (eof)"
|
||||
+ return
|
||||
+ }
|
||||
+ timeout {
|
||||
+ fail "$test (timeout)"
|
||||
+ return
|
||||
+ }
|
||||
+}
|
||||
+gdb_exit
|
||||
+
|
||||
+# Testcase uses the most simple notification not to get caught by attach on
|
||||
+# exiting the function. Still we could retry the gstack command if we fail.
|
||||
+
|
||||
+set test "spawn gstack"
|
||||
+set command "sh -c GDB=$GDB\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END"
|
||||
+set res [remote_spawn host $command];
|
||||
+if { $res < 0 || $res == "" } {
|
||||
+ perror "Spawning $command failed."
|
||||
+ fail $test
|
||||
+}
|
||||
+set pid [exp_pid -i $res]
|
||||
+gdb_expect {
|
||||
+ -re {^#0 +0x[0-9a-f]+ in \.?func \(\)\r\n#1 +0x[0-9a-f]+ in \.?main \(\)\r\nGSTACK-END\r\n$} {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ eof {
|
||||
+ fail "$test (eof)"
|
||||
+ }
|
||||
+ timeout {
|
||||
+ fail "$test (timeout)"
|
||||
+ }
|
||||
+}
|
||||
+gdb_exit
|
||||
+
|
||||
+remote_exec host "kill -9 $pid"
|
||||
--- /dev/null 2010-04-07 06:20:52.289994508 +0200
|
||||
+++ gdb-7.0.1/gdb/testsuite/gdb.base/gstack.c 2010-04-07 21:46:52.000000000 +0200
|
||||
@@ -0,0 +1,43 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+void
|
||||
+func (void)
|
||||
+{
|
||||
+ const char msg[] = "looping\n";
|
||||
+
|
||||
+ /* Use the most simple notification not to get caught by attach on exiting
|
||||
+ the function. */
|
||||
+ write (1, msg, strlen (msg));
|
||||
+
|
||||
+ for (;;);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ alarm (60);
|
||||
+ nice (100);
|
||||
+
|
||||
+ func ();
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
|
@ -1,34 +0,0 @@
|
||||
Index: gdb-6.3/gdb/gstack.sh
|
||||
===================================================================
|
||||
--- gdb-6.3.orig/gdb/gstack.sh 2006-02-14 17:21:05.000000000 -0200
|
||||
+++ gdb-6.3/gdb/gstack.sh 2006-04-14 03:17:12.000000000 -0300
|
||||
@@ -17,17 +17,17 @@ fi
|
||||
backtrace="bt"
|
||||
if test -d /proc/$1/task ; then
|
||||
# Newer kernel; has a task/ directory.
|
||||
- if test `ls /proc/$1/task | wc -l` -gt 1 2>/dev/null ; then
|
||||
+ if test `/bin/ls /proc/$1/task | /usr/bin/wc -l` -gt 1 2>/dev/null ; then
|
||||
backtrace="thread apply all bt"
|
||||
fi
|
||||
elif test -f /proc/$1/maps ; then
|
||||
# Older kernel; go by it loading libpthread.
|
||||
- if grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
|
||||
+ if /bin/grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
|
||||
backtrace="thread apply all bt"
|
||||
fi
|
||||
fi
|
||||
|
||||
-GDB=${GDB:-gdb}
|
||||
+GDB=${GDB:-/usr/bin/gdb}
|
||||
|
||||
if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then
|
||||
readnever=--readnever
|
||||
@@ -39,7 +39,7 @@ fi
|
||||
set pagination no
|
||||
$backtrace
|
||||
EOF
|
||||
-sed -n \
|
||||
+/bin/sed -n \
|
||||
-e 's/^(gdb) //' \
|
||||
-e '/^#/p' \
|
||||
-e '/^Thread/p'
|
@ -11,11 +11,11 @@
|
||||
|
||||
* gdb.texinfo (File Options): Document --readnever.
|
||||
|
||||
Index: gdb-7.0.50.20100121/gdb/doc/gdb.texinfo
|
||||
Index: gdb-7.0.90.20100306/gdb/doc/gdb.texinfo
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100121.orig/gdb/doc/gdb.texinfo 2010-01-21 15:11:09.000000000 +0100
|
||||
+++ gdb-7.0.50.20100121/gdb/doc/gdb.texinfo 2010-01-21 15:13:02.000000000 +0100
|
||||
@@ -997,6 +997,12 @@ Read each symbol file's entire symbol ta
|
||||
--- gdb-7.0.90.20100306.orig/gdb/doc/gdb.texinfo 2010-03-06 23:19:13.000000000 +0100
|
||||
+++ gdb-7.0.90.20100306/gdb/doc/gdb.texinfo 2010-03-06 23:20:35.000000000 +0100
|
||||
@@ -995,6 +995,12 @@ Read each symbol file's entire symbol ta
|
||||
the default, which is to read it incrementally as it is needed.
|
||||
This makes startup slower, but makes future operations faster.
|
||||
|
||||
@ -28,10 +28,10 @@ Index: gdb-7.0.50.20100121/gdb/doc/gdb.texinfo
|
||||
@end table
|
||||
|
||||
@node Mode Options
|
||||
Index: gdb-7.0.50.20100121/gdb/main.c
|
||||
Index: gdb-7.0.90.20100306/gdb/main.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100121.orig/gdb/main.c 2010-01-21 15:11:18.000000000 +0100
|
||||
+++ gdb-7.0.50.20100121/gdb/main.c 2010-01-21 15:13:02.000000000 +0100
|
||||
--- gdb-7.0.90.20100306.orig/gdb/main.c 2010-03-06 23:20:23.000000000 +0100
|
||||
+++ gdb-7.0.90.20100306/gdb/main.c 2010-03-06 23:20:35.000000000 +0100
|
||||
@@ -382,6 +382,7 @@ captured_main (void *data)
|
||||
{"xdb", no_argument, &xdb_commands, 1},
|
||||
{"dbx", no_argument, &dbx_commands, 1},
|
||||
@ -48,10 +48,10 @@ Index: gdb-7.0.50.20100121/gdb/main.c
|
||||
"), stream);
|
||||
fputs_unfiltered (_("\
|
||||
--se=FILE Use FILE as symbol file and executable file.\n\
|
||||
Index: gdb-7.0.50.20100121/gdb/symfile.c
|
||||
Index: gdb-7.0.90.20100306/gdb/symfile.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100121.orig/gdb/symfile.c 2010-01-21 15:11:09.000000000 +0100
|
||||
+++ gdb-7.0.50.20100121/gdb/symfile.c 2010-01-21 15:13:02.000000000 +0100
|
||||
--- gdb-7.0.90.20100306.orig/gdb/symfile.c 2010-03-06 23:19:13.000000000 +0100
|
||||
+++ gdb-7.0.90.20100306/gdb/symfile.c 2010-03-06 23:20:35.000000000 +0100
|
||||
@@ -79,6 +79,7 @@ static void clear_symtab_users_cleanup (
|
||||
|
||||
/* Global variables owned by this file */
|
||||
@ -60,19 +60,19 @@ Index: gdb-7.0.50.20100121/gdb/symfile.c
|
||||
|
||||
/* External variables and functions referenced. */
|
||||
|
||||
Index: gdb-7.0.50.20100121/gdb/dwarf2read.c
|
||||
Index: gdb-7.0.90.20100306/gdb/dwarf2read.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100121.orig/gdb/dwarf2read.c 2010-01-21 15:11:09.000000000 +0100
|
||||
+++ gdb-7.0.50.20100121/gdb/dwarf2read.c 2010-01-21 15:13:15.000000000 +0100
|
||||
@@ -53,6 +53,7 @@
|
||||
--- gdb-7.0.90.20100306.orig/gdb/dwarf2read.c 2010-03-06 23:19:13.000000000 +0100
|
||||
+++ gdb-7.0.90.20100306/gdb/dwarf2read.c 2010-03-06 23:20:54.000000000 +0100
|
||||
@@ -52,6 +52,7 @@
|
||||
#include "f-lang.h"
|
||||
#include "typeprint.h"
|
||||
#include "jv-lang.h"
|
||||
#include "vec.h"
|
||||
+#include "top.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include "gdb_string.h"
|
||||
@@ -1237,7 +1238,8 @@ dwarf2_has_info (struct objfile *objfile
|
||||
@@ -1222,7 +1223,8 @@ dwarf2_has_info (struct objfile *objfile
|
||||
|
||||
bfd_map_over_sections (objfile->obfd, dwarf2_locate_sections, NULL);
|
||||
}
|
||||
@ -82,10 +82,10 @@ Index: gdb-7.0.50.20100121/gdb/dwarf2read.c
|
||||
&& dwarf2_per_objfile->abbrev.asection != NULL);
|
||||
}
|
||||
|
||||
Index: gdb-7.0.50.20100121/gdb/top.h
|
||||
Index: gdb-7.0.90.20100306/gdb/top.h
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100121.orig/gdb/top.h 2010-01-01 08:31:42.000000000 +0100
|
||||
+++ gdb-7.0.50.20100121/gdb/top.h 2010-01-21 15:13:02.000000000 +0100
|
||||
--- gdb-7.0.90.20100306.orig/gdb/top.h 2010-01-01 08:31:42.000000000 +0100
|
||||
+++ gdb-7.0.90.20100306/gdb/top.h 2010-03-06 23:20:35.000000000 +0100
|
||||
@@ -63,6 +63,7 @@ extern void set_prompt (char *);
|
||||
|
||||
/* From random places. */
|
||||
|
@ -1,29 +1,29 @@
|
||||
Index: gdb-6.8.50.20090909/gdb/testsuite/configure.ac
|
||||
Index: gdb-7.0.90.20100306/gdb/testsuite/configure.ac
|
||||
===================================================================
|
||||
--- gdb-6.8.50.20090909.orig/gdb/testsuite/configure.ac 2009-07-31 17:38:16.000000000 +0200
|
||||
+++ gdb-6.8.50.20090909/gdb/testsuite/configure.ac 2009-09-09 19:06:01.000000000 +0200
|
||||
--- gdb-7.0.90.20100306.orig/gdb/testsuite/configure.ac 2010-02-19 20:16:36.000000000 +0100
|
||||
+++ gdb-7.0.90.20100306/gdb/testsuite/configure.ac 2010-03-06 23:19:56.000000000 +0100
|
||||
@@ -144,6 +144,6 @@ AC_OUTPUT([Makefile \
|
||||
gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \
|
||||
gdb.fortran/Makefile gdb.server/Makefile \
|
||||
gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile \
|
||||
gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile \
|
||||
gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile \
|
||||
- gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile \
|
||||
+ gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile \
|
||||
gdb.python/Makefile gdb.reverse/Makefile \
|
||||
gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile])
|
||||
Index: gdb-6.8.50.20090909/gdb/testsuite/configure
|
||||
Index: gdb-7.0.90.20100306/gdb/testsuite/configure
|
||||
===================================================================
|
||||
--- gdb-6.8.50.20090909.orig/gdb/testsuite/configure 2009-08-22 18:56:43.000000000 +0200
|
||||
+++ gdb-6.8.50.20090909/gdb/testsuite/configure 2009-09-09 19:06:27.000000000 +0200
|
||||
--- gdb-7.0.90.20100306.orig/gdb/testsuite/configure 2010-02-19 20:16:36.000000000 +0100
|
||||
+++ gdb-7.0.90.20100306/gdb/testsuite/configure 2010-03-06 23:20:12.000000000 +0100
|
||||
@@ -3515,7 +3515,7 @@ done
|
||||
|
||||
|
||||
|
||||
-ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/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.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/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.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/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.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/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
|
||||
@@ -4231,6 +4231,7 @@ do
|
||||
@@ -4232,6 +4232,7 @@ do
|
||||
"gdb.objc/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.objc/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-6.8.50.20090909/gdb/testsuite/configure
|
||||
"gdb.python/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.python/Makefile" ;;
|
||||
"gdb.reverse/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.reverse/Makefile" ;;
|
||||
"gdb.threads/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.threads/Makefile" ;;
|
||||
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.c
|
||||
Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.c 2009-09-09 19:06:01.000000000 +0200
|
||||
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.c 2010-03-06 23:19:31.000000000 +0100
|
||||
@@ -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-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.c
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach2.c
|
||||
Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach2.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach2.c 2009-09-09 19:06:01.000000000 +0200
|
||||
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach2.c 2010-03-06 23:19:31.000000000 +0100
|
||||
@@ -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-6.8.50.20090909/gdb/testsuite/gdb.pie/attach2.c
|
||||
+ }
|
||||
+ return (0);
|
||||
+}
|
||||
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.c
|
||||
Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.c 2009-09-09 19:06:01.000000000 +0200
|
||||
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.c 2010-03-06 23:19:31.000000000 +0100
|
||||
@@ -0,0 +1,146 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
@ -236,10 +236,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.c
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break1.c
|
||||
Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break1.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break1.c 2009-09-09 19:06:01.000000000 +0200
|
||||
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break1.c 2010-03-06 23:19:31.000000000 +0100
|
||||
@@ -0,0 +1,44 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
@ -285,10 +285,10 @@ Index: gdb-6.8.50.20090909/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-6.8.50.20090909/gdb/testsuite/gdb.pie/coremaker.c
|
||||
Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/coremaker.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/coremaker.c 2009-09-09 19:06:01.000000000 +0200
|
||||
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/coremaker.c 2010-03-06 23:19:31.000000000 +0100
|
||||
@@ -0,0 +1,142 @@
|
||||
+/* Copyright 1992, 1993, 1994, 1995, 1996, 1999
|
||||
+ Free Software Foundation, Inc.
|
||||
@ -432,10 +432,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/coremaker.c
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp
|
||||
Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.exp
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp 2009-09-09 19:06:01.000000000 +0200
|
||||
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.exp 2010-03-06 23:19:31.000000000 +0100
|
||||
@@ -0,0 +1,433 @@
|
||||
+# Copyright 1997, 1999, 2002 Free Software Foundation, Inc.
|
||||
+
|
||||
@ -870,10 +870,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp
|
||||
+do_call_attach_tests
|
||||
+
|
||||
+return 0
|
||||
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.exp
|
||||
Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.exp
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.exp 2009-09-09 19:06:01.000000000 +0200
|
||||
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.exp 2010-03-06 23:19:31.000000000 +0100
|
||||
@@ -0,0 +1,977 @@
|
||||
+# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
+# 2000, 2002, 2003, 2004
|
||||
@ -1852,10 +1852,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.exp
|
||||
+ send_gdb "set args main\n"
|
||||
+ gdb_expect -re ".*$gdb_prompt $" {}
|
||||
+}
|
||||
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/corefile.exp
|
||||
Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/corefile.exp
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/corefile.exp 2009-09-09 19:06:01.000000000 +0200
|
||||
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/corefile.exp 2010-03-06 23:19:31.000000000 +0100
|
||||
@@ -0,0 +1,243 @@
|
||||
+# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
+# Free Software Foundation, Inc.
|
||||
@ -2100,10 +2100,10 @@ Index: gdb-6.8.50.20090909/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-6.8.50.20090909/gdb/testsuite/gdb.pie/Makefile.in
|
||||
Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/Makefile.in
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/Makefile.in 2009-09-09 19:06:01.000000000 +0200
|
||||
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/Makefile.in 2010-03-06 23:19:31.000000000 +0100
|
||||
@@ -0,0 +1,19 @@
|
||||
+VPATH = @srcdir@
|
||||
+srcdir = @srcdir@
|
||||
|
@ -1,11 +1,11 @@
|
||||
Index: gdb-6.8.50.20090802/gdb/symfile.c
|
||||
Index: gdb-7.0.90.20100306/gdb/symfile.c
|
||||
===================================================================
|
||||
--- gdb-6.8.50.20090802.orig/gdb/symfile.c 2009-08-03 12:29:58.000000000 +0200
|
||||
+++ gdb-6.8.50.20090802/gdb/symfile.c 2009-08-03 12:40:58.000000000 +0200
|
||||
@@ -4012,6 +4012,12 @@ symfile_dummy_outputs (bfd *abfd, asecti
|
||||
bfd_byte *
|
||||
symfile_relocate_debug_section (bfd *abfd, asection *sectp, bfd_byte *buf)
|
||||
--- gdb-7.0.90.20100306.orig/gdb/symfile.c 2010-03-06 23:20:35.000000000 +0100
|
||||
+++ gdb-7.0.90.20100306/gdb/symfile.c 2010-03-06 23:26:25.000000000 +0100
|
||||
@@ -3642,6 +3642,12 @@ default_symfile_relocate (struct objfile
|
||||
{
|
||||
bfd *abfd = objfile->obfd;
|
||||
|
||||
+ /* Executable files have all the relocations already resolved.
|
||||
+ * Handle files linked with --emit-relocs.
|
||||
+ * http://sources.redhat.com/ml/gdb/2006-08/msg00137.html */
|
||||
|
@ -164,7 +164,7 @@ Index: gdb-6.8.50.20090802/gdb/amd64-tdep.c
|
||||
/* Floating-point registers. */
|
||||
--- a/gdb/ia64-tdep.c
|
||||
+++ b/gdb/ia64-tdep.c
|
||||
@@ -2122,6 +2122,137 @@ static const struct frame_unwind ia64_frame_unwind =
|
||||
@@ -2122,6 +2122,138 @@ static const struct frame_unwind ia64_frame_unwind =
|
||||
default_frame_sniffer
|
||||
};
|
||||
|
||||
@ -228,12 +228,13 @@ Index: gdb-6.8.50.20090802/gdb/amd64-tdep.c
|
||||
+ if (minsym == NULL)
|
||||
+ return 0;
|
||||
+
|
||||
+ instr = slotN_contents (&buf[LINUX_CLONE_PRE_SLOTS * 16], 2);
|
||||
+ instr = slotN_contents (&linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16], 2);
|
||||
+ instr &= ~(((1L << 20) - 1) << 13);
|
||||
+ /* Address is relative to the jump instruction slot, not the next one. */
|
||||
+ instr |= (((SYMBOL_VALUE_ADDRESS (minsym) - (pc & ~0xfL)) >> 4)
|
||||
+ & ((1L << 20) - 1)) << 13;
|
||||
+ replace_slotN_contents (&buf[LINUX_CLONE_PRE_SLOTS * 16], instr, 2);
|
||||
+ replace_slotN_contents (&linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16], instr,
|
||||
+ 2);
|
||||
+
|
||||
+ if (memcmp (&buf[LINUX_CLONE_PRE_SLOTS * 16],
|
||||
+ &linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16],
|
||||
|
@ -1,19 +0,0 @@
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
|
||||
|
||||
|
||||
Index: gdb-6.8.50.20081128/gdb/minsyms.c
|
||||
===================================================================
|
||||
--- gdb-6.8.50.20081128.orig/gdb/minsyms.c 2008-10-01 18:56:52.000000000 +0200
|
||||
+++ gdb-6.8.50.20081128/gdb/minsyms.c 2008-12-02 23:24:27.000000000 +0100
|
||||
@@ -544,6 +544,11 @@ lookup_minimal_symbol_by_pc_section_1 (C
|
||||
don't fill the bfd_section member, so don't
|
||||
throw away symbols on those platforms. */
|
||||
&& SYMBOL_OBJ_SECTION (&msymbol[hi]) != NULL
|
||||
+ /* Don't ignore symbols for solib trampolines.
|
||||
+ Limit its sideeffects - only for non-0 sized trampolines.
|
||||
+ Red Hat Bug 200533 with its regression Bug 218379. */
|
||||
+ && (MSYMBOL_TYPE (&msymbol[hi]) != mst_solib_trampoline
|
||||
+ || MSYMBOL_SIZE (&msymbol[hi]))
|
||||
&& (!matching_obj_sections
|
||||
(SYMBOL_OBJ_SECTION (&msymbol[hi]), section)))
|
||||
{
|
@ -58,10 +58,8 @@ 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.0.50.20100128/gdb/exceptions.h
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100128.orig/gdb/exceptions.h 2010-01-18 07:25:22.000000000 +0100
|
||||
+++ gdb-7.0.50.20100128/gdb/exceptions.h 2010-01-28 22:49:00.000000000 +0100
|
||||
--- ./gdb/exceptions.h 2010-04-11 22:31:30.000000000 +0200
|
||||
+++ ./gdb/exceptions.h 2010-04-11 22:31:47.000000000 +0200
|
||||
@@ -78,6 +78,9 @@ enum errors {
|
||||
/* Feature is not supported in this copy of GDB. */
|
||||
UNSUPPORTED_ERROR,
|
||||
@ -72,40 +70,49 @@ Index: gdb-7.0.50.20100128/gdb/exceptions.h
|
||||
/* Add more errors here. */
|
||||
NR_ERRORS
|
||||
};
|
||||
Index: gdb-7.0.50.20100128/gdb/exec.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100128.orig/gdb/exec.c 2010-01-28 22:48:59.000000000 +0100
|
||||
+++ gdb-7.0.50.20100128/gdb/exec.c 2010-01-28 22:58:45.000000000 +0100
|
||||
--- ./gdb/exec.c 2010-04-11 22:31:30.000000000 +0200
|
||||
+++ ./gdb/exec.c 2010-04-11 22:41:26.000000000 +0200
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "arch-utils.h"
|
||||
#include "gdbthread.h"
|
||||
#include "progspace.h"
|
||||
#include "solib.h"
|
||||
+#include "exceptions.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include "readline/readline.h"
|
||||
@@ -258,6 +259,17 @@ exec_file_attach (char *filename, int fr
|
||||
/* Make sure to close exec_bfd, or else "run" might try to use
|
||||
it. */
|
||||
exec_close ();
|
||||
@@ -256,12 +257,27 @@ exec_file_attach (char *filename, int fr
|
||||
|
||||
if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching))
|
||||
{
|
||||
+ int is_core;
|
||||
+
|
||||
+ /* If the user accidentally did "gdb core", print a useful
|
||||
+ error message. Check it only after bfd_object has been checked as
|
||||
+ a valid executable may get recognized for example also as
|
||||
+ "trad-core". */
|
||||
+ if (bfd_check_format (exec_bfd, bfd_core))
|
||||
+ throw_error (IS_CORE_ERROR,
|
||||
+ _("\"%s\" is a core file.\n"
|
||||
+ "Please specify an executable to debug."),
|
||||
+ scratch_pathname);
|
||||
+ is_core = bfd_check_format (exec_bfd, bfd_core);
|
||||
+
|
||||
error (_("\"%s\": not in executable format: %s"),
|
||||
scratch_pathname, bfd_errmsg (bfd_get_error ()));
|
||||
/* Make sure to close exec_bfd, or else "run" might try to use
|
||||
it. */
|
||||
exec_close ();
|
||||
- error (_("\"%s\": not in executable format: %s"),
|
||||
- scratch_pathname,
|
||||
- gdb_bfd_errmsg (bfd_get_error (), matching));
|
||||
+
|
||||
+ if (is_core != 0)
|
||||
+ throw_error (IS_CORE_ERROR,
|
||||
+ _("\"%s\" is a core file.\n"
|
||||
+ "Please specify an executable to debug."),
|
||||
+ scratch_pathname);
|
||||
+ else
|
||||
+ error (_("\"%s\": not in executable format: %s"),
|
||||
+ scratch_pathname,
|
||||
+ gdb_bfd_errmsg (bfd_get_error (), matching));
|
||||
}
|
||||
Index: gdb-7.0.50.20100128/gdb/main.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100128.orig/gdb/main.c 2010-01-28 22:48:59.000000000 +0100
|
||||
+++ gdb-7.0.50.20100128/gdb/main.c 2010-01-28 22:49:00.000000000 +0100
|
||||
|
||||
/* FIXME - This should only be run for RS6000, but the ifdef is a poor
|
||||
--- ./gdb/main.c 2010-04-11 22:31:30.000000000 +0200
|
||||
+++ ./gdb/main.c 2010-04-11 22:31:47.000000000 +0200
|
||||
@@ -241,6 +241,36 @@ captured_command_loop (void *data)
|
||||
return 1;
|
||||
}
|
||||
|
68
gdb-6.7-testsuite-stable-results-prelink.patch
Normal file
68
gdb-6.7-testsuite-stable-results-prelink.patch
Normal file
@ -0,0 +1,68 @@
|
||||
http://sourceware.org/ml/gdb-patches/2010-03/msg01006.html
|
||||
Subject: [patch or FYI] testsuite: Fix prelink.exp on system w/unprelinked system libs
|
||||
|
||||
Hi,
|
||||
|
||||
this is a more conservative variant superseded by:
|
||||
[patch 4/6] testsuite: Unify to lib/prelink-support.exp
|
||||
http://sourceware.org/ml/gdb-patches/2010-03/msg01002.html
|
||||
where gdb.base/prelink.exp is reworked on generic lib/prelink-support.exp.
|
||||
|
||||
I prefer the [patch 4/6] over this patch but this mail can serve also as an
|
||||
illustration of the current problem.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
If your system for some reason currently does not have all the libraries
|
||||
prelinked gdb.base/prelink.exp will get UNRESOLVED randomly also affecting
|
||||
testsuite results diff.
|
||||
|
||||
Apparently the testcase already tried to avoid any system libraries
|
||||
dependencies by "-nodefaultlibs". But currently it does has not worked that
|
||||
way.
|
||||
|
||||
"-lm" is contained already even in dejagnu's default_target_compile (not just
|
||||
in gdb/testsuite/lib/ada.exp). But I do not know why it is there and which
|
||||
systems would get broken by some global gdb/testsuite/ "-lm" removal.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
2010-03-29 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Fix testcase false UNRESOLVED if system libraries are not prelinked.
|
||||
* gdb.base/prelink.exp: New variables compile, board, err and mathlib.
|
||||
Set clear board mathlib for ${libfile} compilation.
|
||||
|
||||
--- a/gdb/testsuite/gdb.base/prelink.exp
|
||||
+++ b/gdb/testsuite/gdb.base/prelink.exp
|
||||
@@ -42,7 +42,25 @@ set testfile "prelink"
|
||||
|
||||
set libsrcfile ${testfile}-lib.c
|
||||
set libfile ${objdir}/${subdir}/${testfile}.so
|
||||
-if { [gdb_compile "${srcdir}/${subdir}/${libsrcfile}" "${libfile}" executable [list debug "additional_flags=-fpic -shared -nodefaultlibs"]] != ""} {
|
||||
+
|
||||
+# default_target_compile would otherwise add "-lm" making the testcase
|
||||
+# dependent on whether the system libraries are already prelinked.
|
||||
+# prelink: Could not set /lib64/libm-2.11.1.so owner or mode: Operation not permitted
|
||||
+set compile {
|
||||
+ gdb_compile "${srcdir}/${subdir}/${libsrcfile}" "${libfile}" executable [list debug "additional_flags=-fpic -shared -nodefaultlibs"]
|
||||
+}
|
||||
+set board [target_info name]
|
||||
+if [board_info $board exists mathlib] {
|
||||
+ set mathlib [board_info $dest mathlib]
|
||||
+ set_board_info mathlib ""
|
||||
+ set err [eval $compile]
|
||||
+ set_board_info mathlib $mathlib
|
||||
+} else {
|
||||
+ set_board_info mathlib ""
|
||||
+ set err [eval $compile]
|
||||
+ unset_board_info mathlib
|
||||
+}
|
||||
+if {$err != ""} {
|
||||
# If creating the shared library fails, maybe we don't have the right tools
|
||||
return -1
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
Index: gdb-7.0.50.20100203/bfd/elf-bfd.h
|
||||
Index: gdb-7.1/bfd/elf-bfd.h
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100203.orig/bfd/elf-bfd.h 2010-02-02 13:37:39.000000000 +0100
|
||||
+++ gdb-7.0.50.20100203/bfd/elf-bfd.h 2010-02-03 07:28:20.000000000 +0100
|
||||
@@ -2140,7 +2140,7 @@ extern Elf_Internal_Phdr * _bfd_elf_find
|
||||
--- gdb-7.1.orig/bfd/elf-bfd.h 2010-02-09 13:14:42.000000000 +0100
|
||||
+++ gdb-7.1/bfd/elf-bfd.h 2010-05-16 20:22:38.000000000 +0200
|
||||
@@ -2160,7 +2160,7 @@ extern Elf_Internal_Phdr * _bfd_elf_find
|
||||
extern char *elfcore_write_note
|
||||
(bfd *, char *, int *, const char *, int, const void *, int);
|
||||
extern char *elfcore_write_prpsinfo
|
||||
@ -11,11 +11,11 @@ Index: gdb-7.0.50.20100203/bfd/elf-bfd.h
|
||||
extern char *elfcore_write_prstatus
|
||||
(bfd *, char *, int *, long, int, const void *);
|
||||
extern char * elfcore_write_pstatus
|
||||
Index: gdb-7.0.50.20100203/bfd/elf.c
|
||||
Index: gdb-7.1/bfd/elf.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100203.orig/bfd/elf.c 2010-02-02 13:37:39.000000000 +0100
|
||||
+++ gdb-7.0.50.20100203/bfd/elf.c 2010-02-03 07:28:20.000000000 +0100
|
||||
@@ -8459,6 +8459,7 @@ char *
|
||||
--- gdb-7.1.orig/bfd/elf.c 2010-02-18 01:09:06.000000000 +0100
|
||||
+++ gdb-7.1/bfd/elf.c 2010-05-16 20:25:15.000000000 +0200
|
||||
@@ -8545,6 +8545,7 @@ char *
|
||||
elfcore_write_prpsinfo (bfd *abfd,
|
||||
char *buf,
|
||||
int *bufsiz,
|
||||
@ -23,7 +23,7 @@ Index: gdb-7.0.50.20100203/bfd/elf.c
|
||||
const char *fname,
|
||||
const char *psargs)
|
||||
{
|
||||
@@ -8485,9 +8486,15 @@ elfcore_write_prpsinfo (bfd *abfd,
|
||||
@@ -8571,26 +8572,40 @@ elfcore_write_prpsinfo (bfd *abfd,
|
||||
int note_type = NT_PRPSINFO;
|
||||
#endif
|
||||
|
||||
@ -42,7 +42,16 @@ Index: gdb-7.0.50.20100203/bfd/elf.c
|
||||
return elfcore_write_note (abfd, buf, bufsiz,
|
||||
note_name, note_type, &data, sizeof (data));
|
||||
}
|
||||
@@ -8502,9 +8509,15 @@ elfcore_write_prpsinfo (bfd *abfd,
|
||||
else
|
||||
#endif
|
||||
{
|
||||
+/* gdb-6.8-bz254229-gcore-prpsinfo.patch misapplication glue. */
|
||||
#if defined (HAVE_PSINFO_T)
|
||||
psinfo_t data;
|
||||
+/* gdb-6.8-bz254229-gcore-prpsinfo.patch misapplication glue. */
|
||||
int note_type = NT_PSINFO;
|
||||
#else
|
||||
prpsinfo_t data;
|
||||
int note_type = NT_PRPSINFO;
|
||||
#endif
|
||||
|
||||
@ -61,10 +70,10 @@ Index: gdb-7.0.50.20100203/bfd/elf.c
|
||||
return elfcore_write_note (abfd, buf, bufsiz,
|
||||
note_name, note_type, &data, sizeof (data));
|
||||
}
|
||||
Index: gdb-7.0.50.20100203/gdb/amd64-linux-nat.c
|
||||
Index: gdb-7.1/gdb/amd64-linux-nat.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100203.orig/gdb/amd64-linux-nat.c 2010-02-03 07:28:20.000000000 +0100
|
||||
+++ gdb-7.0.50.20100203/gdb/amd64-linux-nat.c 2010-02-03 07:28:20.000000000 +0100
|
||||
--- gdb-7.1.orig/gdb/amd64-linux-nat.c 2010-05-16 20:22:38.000000000 +0200
|
||||
+++ gdb-7.1/gdb/amd64-linux-nat.c 2010-05-16 20:22:38.000000000 +0200
|
||||
@@ -140,6 +140,7 @@ static int amd64_linux_gregset32_reg_off
|
||||
|
||||
static char *
|
||||
@ -98,10 +107,10 @@ Index: gdb-7.0.50.20100203/gdb/amd64-linux-nat.c
|
||||
}
|
||||
|
||||
static void
|
||||
Index: gdb-7.0.50.20100203/gdb/fbsd-nat.c
|
||||
Index: gdb-7.1/gdb/fbsd-nat.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100203.orig/gdb/fbsd-nat.c 2010-01-01 08:31:31.000000000 +0100
|
||||
+++ gdb-7.0.50.20100203/gdb/fbsd-nat.c 2010-02-03 07:28:20.000000000 +0100
|
||||
--- gdb-7.1.orig/gdb/fbsd-nat.c 2010-01-01 08:31:31.000000000 +0100
|
||||
+++ gdb-7.1/gdb/fbsd-nat.c 2010-05-16 20:22:38.000000000 +0200
|
||||
@@ -211,6 +211,7 @@ fbsd_make_corefile_notes (bfd *obfd, int
|
||||
psargs = reconcat (psargs, psargs, " ", get_inferior_args (), NULL);
|
||||
|
||||
@ -110,10 +119,10 @@ Index: gdb-7.0.50.20100203/gdb/fbsd-nat.c
|
||||
fname, psargs);
|
||||
}
|
||||
|
||||
Index: gdb-7.0.50.20100203/gdb/linux-nat.c
|
||||
Index: gdb-7.1/gdb/linux-nat.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100203.orig/gdb/linux-nat.c 2010-02-03 07:28:20.000000000 +0100
|
||||
+++ gdb-7.0.50.20100203/gdb/linux-nat.c 2010-02-03 07:28:20.000000000 +0100
|
||||
--- gdb-7.1.orig/gdb/linux-nat.c 2010-05-16 20:22:38.000000000 +0200
|
||||
+++ gdb-7.1/gdb/linux-nat.c 2010-05-16 20:22:38.000000000 +0200
|
||||
@@ -56,6 +56,7 @@
|
||||
#include "terminal.h"
|
||||
#include <sys/vfs.h>
|
||||
@ -131,7 +140,7 @@ Index: gdb-7.0.50.20100203/gdb/linux-nat.c
|
||||
char *(*linux_elfcore_write_prstatus)
|
||||
(bfd *, char *, int *, long, int, const void *) = elfcore_write_prstatus;
|
||||
static char *
|
||||
@@ -4422,6 +4423,159 @@ linux_spu_make_corefile_notes (bfd *obfd
|
||||
@@ -4507,6 +4508,159 @@ linux_spu_make_corefile_notes (bfd *obfd
|
||||
return args.note_data;
|
||||
}
|
||||
|
||||
@ -291,7 +300,7 @@ Index: gdb-7.0.50.20100203/gdb/linux-nat.c
|
||||
/* Fills the "to_make_corefile_note" target vector. Builds the note
|
||||
section for a corefile, and returns it in a malloc buffer. */
|
||||
|
||||
@@ -4442,8 +4596,14 @@ linux_nat_make_corefile_notes (bfd *obfd
|
||||
@@ -4527,8 +4681,14 @@ linux_nat_make_corefile_notes (bfd *obfd
|
||||
|
||||
if (get_exec_file (0))
|
||||
{
|
||||
@ -306,7 +315,7 @@ Index: gdb-7.0.50.20100203/gdb/linux-nat.c
|
||||
if (get_inferior_args ())
|
||||
{
|
||||
char *string_end;
|
||||
@@ -4459,9 +4619,15 @@ linux_nat_make_corefile_notes (bfd *obfd
|
||||
@@ -4544,9 +4704,15 @@ linux_nat_make_corefile_notes (bfd *obfd
|
||||
psargs_end - string_end);
|
||||
}
|
||||
}
|
||||
@ -324,10 +333,10 @@ Index: gdb-7.0.50.20100203/gdb/linux-nat.c
|
||||
}
|
||||
|
||||
/* Dump information for threads. */
|
||||
Index: gdb-7.0.50.20100203/gdb/linux-nat.h
|
||||
Index: gdb-7.1/gdb/linux-nat.h
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100203.orig/gdb/linux-nat.h 2010-02-03 07:28:19.000000000 +0100
|
||||
+++ gdb-7.0.50.20100203/gdb/linux-nat.h 2010-02-03 07:28:20.000000000 +0100
|
||||
--- gdb-7.1.orig/gdb/linux-nat.h 2010-05-16 20:22:37.000000000 +0200
|
||||
+++ gdb-7.1/gdb/linux-nat.h 2010-05-16 20:22:38.000000000 +0200
|
||||
@@ -173,7 +173,7 @@ int linux_nat_core_of_thread_1 (ptid_t p
|
||||
/* These functions make elfcore note sections.
|
||||
They may get overriden by code adjusting data for multi-target builds. */
|
||||
@ -337,11 +346,11 @@ Index: gdb-7.0.50.20100203/gdb/linux-nat.h
|
||||
extern char *(*linux_elfcore_write_prstatus)
|
||||
(bfd *, char *, int *, long, int, const void *);
|
||||
extern char *(*linux_elfcore_write_prfpreg)
|
||||
Index: gdb-7.0.50.20100203/gdb/procfs.c
|
||||
Index: gdb-7.1/gdb/procfs.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100203.orig/gdb/procfs.c 2010-01-28 09:19:29.000000000 +0100
|
||||
+++ gdb-7.0.50.20100203/gdb/procfs.c 2010-02-03 07:28:20.000000000 +0100
|
||||
@@ -6186,6 +6186,7 @@ procfs_make_note_section (bfd *obfd, int
|
||||
--- gdb-7.1.orig/gdb/procfs.c 2010-02-15 18:35:49.000000000 +0100
|
||||
+++ gdb-7.1/gdb/procfs.c 2010-05-16 20:22:38.000000000 +0200
|
||||
@@ -6184,6 +6184,7 @@ procfs_make_note_section (bfd *obfd, int
|
||||
note_data = (char *) elfcore_write_prpsinfo (obfd,
|
||||
note_data,
|
||||
note_size,
|
||||
|
@ -1,571 +0,0 @@
|
||||
infcall.c <unwind_on_signal_p>:
|
||||
Revert the change of: gdb-6.8-inlining.patch
|
||||
causing: FAIL: gdb.base/unwindonsignal.exp: unwindonsignal, stack unwound
|
||||
|
||||
resume() -> target_resume() move of clear_inline_frame_state() is for:
|
||||
gdb.mi/mi-nsmoribund.exp
|
||||
|
||||
Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-bt.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100121.orig/gdb/testsuite/gdb.opt/inline-bt.c 2010-01-01 08:32:04.000000000 +0100
|
||||
+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-bt.c 2010-01-21 15:14:47.000000000 +0100
|
||||
@@ -13,10 +13,16 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
-int x, y;
|
||||
+/* VOLATILE forces all the inlining to happen as otherwise the whole program
|
||||
+ gets optimized by CSE to just simple assignments of the results. */
|
||||
+volatile int x, y;
|
||||
volatile int result;
|
||||
|
||||
-void bar(void);
|
||||
+inline void bar(void)
|
||||
+{
|
||||
+ x += y; /* set breakpoint 1 here */
|
||||
+}
|
||||
+
|
||||
|
||||
inline int func1(void)
|
||||
{
|
||||
Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-cmds.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100121.orig/gdb/testsuite/gdb.opt/inline-cmds.c 2010-01-01 08:32:04.000000000 +0100
|
||||
+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-cmds.c 2010-01-21 15:14:47.000000000 +0100
|
||||
@@ -13,13 +13,19 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
-int x, y;
|
||||
+/* VOLATILE forces all the inlining to happen as otherwise the whole program
|
||||
+ gets optimized by CSE to just simple assignments of the results. */
|
||||
+volatile int x, y;
|
||||
volatile int result;
|
||||
|
||||
-void bar(void);
|
||||
void marker(void);
|
||||
void noinline(void);
|
||||
|
||||
+inline void bar(void)
|
||||
+{
|
||||
+ x += y; /* set breakpoint 1 here */
|
||||
+}
|
||||
+
|
||||
inline int func1(void)
|
||||
{
|
||||
bar ();
|
||||
Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-cmds.exp
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100121.orig/gdb/testsuite/gdb.opt/inline-cmds.exp 2010-01-01 08:32:04.000000000 +0100
|
||||
+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-cmds.exp 2010-01-21 15:14:47.000000000 +0100
|
||||
@@ -230,7 +230,7 @@ set line3 [gdb_get_line_number "set brea
|
||||
gdb_breakpoint $line3
|
||||
gdb_continue_to_breakpoint "consecutive func1"
|
||||
|
||||
-gdb_test "next" ".*func1 .*first call.*" "next to first func1"
|
||||
+gdb_test "next" "func1 .*first call.*" "next to first func1"
|
||||
set msg "next to second func1"
|
||||
gdb_test_multiple "next" $msg {
|
||||
-re ".*func1 .*second call.*$gdb_prompt $" {
|
||||
@@ -253,16 +253,16 @@ set line4 [gdb_get_line_number "set brea
|
||||
gdb_breakpoint $line4
|
||||
gdb_continue_to_breakpoint "func1 then func3"
|
||||
|
||||
-gdb_test "next" ".*func1 \\\(\\\);" "next to func1 before func3"
|
||||
-gdb_test "next" ".*func3 \\\(\\\);" "next to func3"
|
||||
+gdb_test "next" "func1 \\\(\\\);" "next to func1 before func3"
|
||||
+gdb_test "next" "func3 \\\(\\\);" "next to func3"
|
||||
|
||||
# Test finishing out of one thing and into another.
|
||||
set line5 [gdb_get_line_number "set breakpoint 5 here"]
|
||||
gdb_breakpoint $line5
|
||||
gdb_continue_to_breakpoint "finish into func1"
|
||||
|
||||
-gdb_test "next" ".*marker \\\(\\\);" "next to finish marker"
|
||||
-gdb_test "step" ".*set breakpoint 2 here.*" "step into finish marker"
|
||||
+gdb_test "next" "marker \\\(\\\);" "next to finish marker"
|
||||
+gdb_test "step" "set breakpoint 2 here.*" "step into finish marker"
|
||||
gdb_test "finish" "func1 \\\(\\\);" "finish from marker to func1"
|
||||
|
||||
gdb_test "step" "bar \\\(\\\);" "step into func1 for finish"
|
||||
@@ -297,12 +297,12 @@ gdb_test "step" "noinline \\\(\\\) at .*
|
||||
gdb_test "bt" "#0 noinline.*#1 .*outer_inline1.*#2 .*outer_inline2.*#3 main.*" "backtrace at noinline from outer_inline1"
|
||||
gdb_test "step" "inlined_fn \\\(\\\) at .*" "enter inlined_fn from noinline"
|
||||
gdb_test "bt" "#0 inlined_fn.*#1 noinline.*#2 .*outer_inline1.*#3 .*outer_inline2.*#4 main.*" "backtrace at inlined_fn from noinline"
|
||||
-gdb_test "info frame" ".*inlined into frame.*" "inlined_fn from noinline inlined"
|
||||
-gdb_test "up" "#1 noinline.*" "up to noinline"
|
||||
-gdb_test "info frame" ".*\n called by frame.*" "noinline from outer_inline1 not inlined"
|
||||
-gdb_test "up" "#2 .*outer_inline1.*" "up to outer_inline1"
|
||||
-gdb_test "info frame" ".*inlined into frame.*" "outer_inline1 inlined"
|
||||
-gdb_test "up" "#3 .*outer_inline2.*" "up to outer_inline2"
|
||||
-gdb_test "info frame" ".*inlined into frame.*" "outer_inline2 inlined"
|
||||
-gdb_test "up" "#4 main.*" "up from outer_inline2"
|
||||
-gdb_test "info frame" ".*\n caller of frame.*" "main not inlined"
|
||||
+gdb_test "info frame" "inlined into frame.*" "inlined_fn from noinline inlined"
|
||||
+gdb_test "fini" "" "up to noinline"
|
||||
+gdb_test "info frame" "\n called by frame.*" "noinline from outer_inline1 not inlined"
|
||||
+gdb_test "fini" "" "up to outer_inline1"
|
||||
+gdb_test "info frame" "inlined into frame.*" "outer_inline1 inlined"
|
||||
+gdb_test "fini" "" "up to outer_inline2"
|
||||
+gdb_test "info frame" "inlined into frame.*" "outer_inline2 inlined"
|
||||
+gdb_test "fini" "" "up from outer_inline2"
|
||||
+gdb_test "info frame" " in main \[^\n\]*\n source language.*" "main not inlined"
|
||||
Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-locals.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100121.orig/gdb/testsuite/gdb.opt/inline-locals.c 2010-01-01 08:32:04.000000000 +0100
|
||||
+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-locals.c 2010-01-21 15:14:47.000000000 +0100
|
||||
@@ -13,11 +13,16 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
-int x, y;
|
||||
+/* VOLATILE forces all the inlining to happen as otherwise the whole program
|
||||
+ gets optimized by CSE to just simple assignments of the results. */
|
||||
+volatile int x, y;
|
||||
volatile int result;
|
||||
volatile int *array_p;
|
||||
|
||||
-void bar(void);
|
||||
+inline void bar(void)
|
||||
+{
|
||||
+ x += y; /* set breakpoint 1 here */
|
||||
+}
|
||||
|
||||
inline int func1(int arg1)
|
||||
{
|
||||
Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-locals.exp
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100121.orig/gdb/testsuite/gdb.opt/inline-locals.exp 2010-01-01 08:32:04.000000000 +0100
|
||||
+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-locals.exp 2010-01-21 15:14:47.000000000 +0100
|
||||
@@ -77,6 +77,9 @@ if { ! $no_frames } {
|
||||
|
||||
# Make sure that locals on the stack are found. This is an array to
|
||||
# prevent it from living in a register.
|
||||
+if [test_compiler_info "gcc-4-3-*"] {
|
||||
+ setup_kfail *-*-* "gcc/debug.optimization"
|
||||
+}
|
||||
gdb_test "print array\[0\]" "\\\$$decimal = 0" "print local (2)"
|
||||
|
||||
if { ! $no_frames } {
|
||||
@@ -115,4 +118,7 @@ if { ! $no_frames } {
|
||||
gdb_test "info locals" ".*arg2 = 184.*" "info locals above bar (3b)"
|
||||
}
|
||||
|
||||
+if [test_compiler_info "gcc-4-3-*"] {
|
||||
+ setup_kfail *-*-* "gcc/debug.optimization"
|
||||
+}
|
||||
gdb_test "print array\[0\]" "\\\$$decimal = 184" "print local (3)"
|
||||
Index: gdb-7.0.50.20100121/gdb/frame.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100121.orig/gdb/frame.c 2010-01-21 15:13:26.000000000 +0100
|
||||
+++ gdb-7.0.50.20100121/gdb/frame.c 2010-01-21 15:14:47.000000000 +0100
|
||||
@@ -316,7 +316,7 @@ fprint_frame (struct ui_file *file, stru
|
||||
static struct frame_info *
|
||||
skip_inlined_frames (struct frame_info *frame)
|
||||
{
|
||||
- while (get_frame_type (frame) == INLINE_FRAME)
|
||||
+ while (frame && get_frame_type (frame) == INLINE_FRAME)
|
||||
frame = get_prev_frame (frame);
|
||||
|
||||
return frame;
|
||||
@@ -1792,6 +1792,7 @@ get_frame_address_in_block (struct frame
|
||||
{
|
||||
/* A draft address. */
|
||||
CORE_ADDR pc = get_frame_pc (this_frame);
|
||||
+ struct thread_info *tp = inferior_thread ();
|
||||
|
||||
struct frame_info *next_frame = this_frame->next;
|
||||
|
||||
@@ -1834,6 +1835,9 @@ get_frame_address_in_block (struct frame
|
||||
while in an inlined function, then the code address of the
|
||||
"calling" normal function should not be adjusted either. */
|
||||
|
||||
+ if (tp->current_pc_is_notcurrent)
|
||||
+ return pc - 1;
|
||||
+
|
||||
while (get_frame_type (next_frame) == INLINE_FRAME)
|
||||
next_frame = next_frame->next;
|
||||
|
||||
@@ -1865,7 +1869,7 @@ find_frame_sal (struct frame_info *frame
|
||||
sym = inline_skipped_symbol (inferior_ptid);
|
||||
|
||||
init_sal (sal);
|
||||
- if (SYMBOL_LINE (sym) != 0)
|
||||
+ if (sym != NULL && SYMBOL_LINE (sym) != 0)
|
||||
{
|
||||
sal->symtab = SYMBOL_SYMTAB (sym);
|
||||
sal->line = SYMBOL_LINE (sym);
|
||||
Index: gdb-7.0.50.20100121/gdb/breakpoint.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100121.orig/gdb/breakpoint.c 2010-01-21 15:14:41.000000000 +0100
|
||||
+++ gdb-7.0.50.20100121/gdb/breakpoint.c 2010-01-21 15:14:47.000000000 +0100
|
||||
@@ -62,6 +62,7 @@
|
||||
#include "jit.h"
|
||||
#include "xml-syscall.h"
|
||||
#include "parser-defs.h"
|
||||
+#include "inline-frame.h"
|
||||
|
||||
/* readline include files */
|
||||
#include "readline/readline.h"
|
||||
@@ -3558,10 +3559,24 @@ bpstat_check_breakpoint_conditions (bpst
|
||||
const struct bp_location *bl = bs->breakpoint_at;
|
||||
struct breakpoint *b = bl->owner;
|
||||
|
||||
- if (frame_id_p (b->frame_id)
|
||||
- && !frame_id_eq (b->frame_id, get_stack_frame_id (get_current_frame ())))
|
||||
- bs->stop = 0;
|
||||
- else if (bs->stop)
|
||||
+ if (frame_id_p (b->frame_id))
|
||||
+ {
|
||||
+ struct frame_info *b_frame, *frame;
|
||||
+ struct frame_id b_frame_id, current_frame_id;
|
||||
+
|
||||
+ b_frame = frame_find_by_id (b->frame_id);
|
||||
+
|
||||
+ /* get_stack_frame_id normalizes the id to the real non-inlined function
|
||||
+ by skip_inlined_frames. */
|
||||
+ b_frame_id = get_stack_frame_id (b_frame);
|
||||
+ current_frame_id = get_stack_frame_id (get_current_frame ());
|
||||
+
|
||||
+ /* Completely different (inlining notwithstanding) frames? */
|
||||
+ if (!frame_id_eq (b_frame_id, current_frame_id))
|
||||
+ bs->stop = 0;
|
||||
+ }
|
||||
+
|
||||
+ if (bs->stop)
|
||||
{
|
||||
int value_is_zero = 0;
|
||||
|
||||
@@ -3729,6 +3744,12 @@ bpstat_stop_status (struct address_space
|
||||
bs->print = 0;
|
||||
}
|
||||
bs->commands = copy_command_lines (bs->commands);
|
||||
+
|
||||
+ /* Display the innermost inlined frame at a breakpont as it gives to
|
||||
+ most of the available information. */
|
||||
+ if (b->type != bp_until && b->type != bp_finish)
|
||||
+ while (inline_skipped_frames (ptid))
|
||||
+ step_into_inline_frame (ptid);
|
||||
}
|
||||
|
||||
/* Print nothing for this entry if we dont stop or dont print. */
|
||||
@@ -6043,9 +6064,9 @@ set_momentary_breakpoint (struct gdbarch
|
||||
{
|
||||
struct breakpoint *b;
|
||||
|
||||
- /* If FRAME_ID is valid, it should be a real frame, not an inlined
|
||||
- one. */
|
||||
- gdb_assert (!frame_id_inlined_p (frame_id));
|
||||
+ /* We can be returning even into an inline frame. While finish_command will
|
||||
+ shortcut the case of returning _from_ an inline frame we still may be
|
||||
+ returning from non-inlined frame _to_ an inlined frame. */
|
||||
|
||||
b = set_raw_breakpoint (gdbarch, sal, type);
|
||||
b->enable_state = bp_enabled;
|
||||
Index: gdb-7.0.50.20100121/gdb/inline-frame.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100121.orig/gdb/inline-frame.c 2010-01-01 08:31:36.000000000 +0100
|
||||
+++ gdb-7.0.50.20100121/gdb/inline-frame.c 2010-01-21 15:14:47.000000000 +0100
|
||||
@@ -213,6 +213,12 @@ inline_frame_sniffer (const struct frame
|
||||
if (frame_block == NULL)
|
||||
return 0;
|
||||
|
||||
+ /* For >=2 inlined functions SKIPPED_SYMBOL needs to be different after each
|
||||
+ step_into_inline_frame call. But skip_inline_frames is called only once
|
||||
+ and thus SKIPPED_SYMBOL needs to be calculated by INLINE_FRAME_SNIFFER. */
|
||||
+ if (state)
|
||||
+ state->skipped_symbol = NULL;
|
||||
+
|
||||
/* Calculate DEPTH, the number of inlined functions at this
|
||||
location. */
|
||||
depth = 0;
|
||||
@@ -222,6 +228,10 @@ inline_frame_sniffer (const struct frame
|
||||
if (block_inlined_p (cur_block))
|
||||
depth++;
|
||||
|
||||
+ if (state && depth == state->skipped_frames
|
||||
+ && state->skipped_symbol == NULL)
|
||||
+ state->skipped_symbol = BLOCK_FUNCTION (cur_block);
|
||||
+
|
||||
cur_block = BLOCK_SUPERBLOCK (cur_block);
|
||||
}
|
||||
|
||||
@@ -300,7 +310,6 @@ skip_inline_frames (ptid_t ptid)
|
||||
{
|
||||
CORE_ADDR this_pc;
|
||||
struct block *frame_block, *cur_block;
|
||||
- struct symbol *last_sym = NULL;
|
||||
int skip_count = 0;
|
||||
struct inline_state *state;
|
||||
|
||||
@@ -321,10 +330,7 @@ skip_inline_frames (ptid_t ptid)
|
||||
of BLOCK_START. */
|
||||
if (BLOCK_START (cur_block) == this_pc
|
||||
|| block_starting_point_at (this_pc, cur_block))
|
||||
- {
|
||||
- skip_count++;
|
||||
- last_sym = BLOCK_FUNCTION (cur_block);
|
||||
- }
|
||||
+ skip_count++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
@@ -336,7 +342,6 @@ skip_inline_frames (ptid_t ptid)
|
||||
state = allocate_inline_frame_state (ptid);
|
||||
state->skipped_frames = skip_count;
|
||||
state->saved_pc = this_pc;
|
||||
- state->skipped_symbol = last_sym;
|
||||
|
||||
if (skip_count != 0)
|
||||
reinit_frame_cache ();
|
||||
@@ -354,6 +359,23 @@ step_into_inline_frame (ptid_t ptid)
|
||||
reinit_frame_cache ();
|
||||
}
|
||||
|
||||
+/* Step out of an inlined function by hiding it. */
|
||||
+
|
||||
+void
|
||||
+step_out_of_inline_frame (ptid_t ptid)
|
||||
+{
|
||||
+ struct inline_state *state = find_inline_frame_state (ptid);
|
||||
+
|
||||
+ gdb_assert (state != NULL);
|
||||
+
|
||||
+ /* Simulate the caller adjustment. */
|
||||
+ if (state->skipped_frames == 0)
|
||||
+ state->saved_pc--;
|
||||
+
|
||||
+ state->skipped_frames++;
|
||||
+ reinit_frame_cache ();
|
||||
+}
|
||||
+
|
||||
/* Return the number of hidden functions inlined into the current
|
||||
frame. */
|
||||
|
||||
Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-markers.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100121.orig/gdb/testsuite/gdb.opt/inline-markers.c 2010-01-01 08:32:04.000000000 +0100
|
||||
+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-markers.c 2010-01-21 15:14:47.000000000 +0100
|
||||
@@ -15,11 +15,6 @@
|
||||
|
||||
extern int x, y;
|
||||
|
||||
-void bar(void)
|
||||
-{
|
||||
- x += y; /* set breakpoint 1 here */
|
||||
-}
|
||||
-
|
||||
void marker(void)
|
||||
{
|
||||
x += y; /* set breakpoint 2 here */
|
||||
Index: gdb-7.0.50.20100121/gdb/gdbthread.h
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100121.orig/gdb/gdbthread.h 2010-01-21 15:11:09.000000000 +0100
|
||||
+++ gdb-7.0.50.20100121/gdb/gdbthread.h 2010-01-21 15:14:47.000000000 +0100
|
||||
@@ -195,6 +195,12 @@ struct thread_info
|
||||
/* Function that is called to free PRIVATE. If this is NULL, then
|
||||
xfree will be called on PRIVATE. */
|
||||
void (*private_dtor) (struct private_thread_info *);
|
||||
+
|
||||
+ /* Nonzero if the current frame PC should be unwound as the caller. It is
|
||||
+ used to keep the backtrace upper levels existing after finish_command into
|
||||
+ an inlined frame if the current inlined function/block was ending at the
|
||||
+ current PC. */
|
||||
+ int current_pc_is_notcurrent;
|
||||
};
|
||||
|
||||
/* Create an empty thread list, or empty the existing one. */
|
||||
Index: gdb-7.0.50.20100121/gdb/infcmd.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100121.orig/gdb/infcmd.c 2010-01-21 15:11:09.000000000 +0100
|
||||
+++ gdb-7.0.50.20100121/gdb/infcmd.c 2010-01-21 15:14:47.000000000 +0100
|
||||
@@ -1439,11 +1439,11 @@ finish_command_continuation (void *arg)
|
||||
struct type *value_type;
|
||||
|
||||
value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (a->function));
|
||||
- if (!value_type)
|
||||
+ if (!SYMBOL_INLINED (a->function) && !value_type)
|
||||
internal_error (__FILE__, __LINE__,
|
||||
_("finish_command: function has no target type"));
|
||||
|
||||
- if (TYPE_CODE (value_type) != TYPE_CODE_VOID)
|
||||
+ if (value_type && TYPE_CODE (value_type) != TYPE_CODE_VOID)
|
||||
print_return_value (SYMBOL_TYPE (a->function), value_type);
|
||||
}
|
||||
|
||||
@@ -1551,6 +1551,16 @@ finish_forward (struct symbol *function,
|
||||
tp->initiating_frame = get_frame_id (frame);
|
||||
make_cleanup (delete_longjmp_breakpoint_cleanup, &thread);
|
||||
|
||||
+ /* We should _always_ set CURRENT_PC_IS_NOTCURRENT here to always see the
|
||||
+ calling line with the message `Value returned is ...'. Currently it is
|
||||
+ seen only if at least one instruction is on that source line after the
|
||||
+ call instruction. We would also need to hook step_once and only clear
|
||||
+ CURRENT_PC_IS_NOTCURRENT on the first step. But it would be a change of
|
||||
+ general non-inlining behavior against upstream. */
|
||||
+
|
||||
+ if (get_frame_type (frame) == INLINE_FRAME)
|
||||
+ tp->current_pc_is_notcurrent = 1;
|
||||
+
|
||||
tp->proceed_to_finish = 1; /* We want stop_registers, please... */
|
||||
cargs = xmalloc (sizeof (*cargs));
|
||||
|
||||
@@ -1571,7 +1581,9 @@ finish_forward (struct symbol *function,
|
||||
static void
|
||||
finish_command (char *arg, int from_tty)
|
||||
{
|
||||
- struct frame_info *frame;
|
||||
+ /* FIXME: Rename `current_frame' to `frame' upon a merge. */
|
||||
+ struct frame_info *current_frame, *prev_frame;
|
||||
+ CORE_ADDR frame_pc;
|
||||
struct symbol *function;
|
||||
|
||||
int async_exec = 0;
|
||||
@@ -1602,45 +1614,63 @@ finish_command (char *arg, int from_tty)
|
||||
if (!target_has_execution)
|
||||
error (_("The program is not running."));
|
||||
|
||||
- frame = get_prev_frame (get_selected_frame (_("No selected frame.")));
|
||||
- if (frame == 0)
|
||||
+ current_frame = get_selected_frame (_("No selected frame."));
|
||||
+ frame_pc = get_frame_pc (current_frame);
|
||||
+ prev_frame = get_prev_frame (current_frame);
|
||||
+ if (prev_frame == 0)
|
||||
error (_("\"finish\" not meaningful in the outermost frame."));
|
||||
|
||||
- clear_proceed_status ();
|
||||
-
|
||||
/* Finishing from an inline frame is completely different. We don't
|
||||
try to show the "return value" - no way to locate it. So we do
|
||||
not need a completion. */
|
||||
- if (get_frame_type (get_selected_frame (_("No selected frame.")))
|
||||
- == INLINE_FRAME)
|
||||
+ if (get_frame_type (current_frame) == INLINE_FRAME)
|
||||
{
|
||||
- /* Claim we are stepping in the calling frame. An empty step
|
||||
- range means that we will stop once we aren't in a function
|
||||
- called by that frame. We don't use the magic "1" value for
|
||||
- step_range_end, because then infrun will think this is nexti,
|
||||
- and not step over the rest of this inlined function call. */
|
||||
struct thread_info *tp = inferior_thread ();
|
||||
struct symtab_and_line empty_sal;
|
||||
- init_sal (&empty_sal);
|
||||
- set_step_info (frame, empty_sal);
|
||||
- tp->step_range_start = tp->step_range_end = get_frame_pc (frame);
|
||||
- tp->step_over_calls = STEP_OVER_ALL;
|
||||
+ struct block *frame_block;
|
||||
|
||||
/* Print info on the selected frame, including level number but not
|
||||
source. */
|
||||
if (from_tty)
|
||||
{
|
||||
printf_filtered (_("Run till exit from "));
|
||||
- print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
|
||||
+ print_stack_frame (current_frame, 1, LOCATION);
|
||||
+ }
|
||||
+
|
||||
+ /* Even just a single stepi would get us out of the caller function PC
|
||||
+ range. */
|
||||
+
|
||||
+ frame_block = get_frame_block (current_frame, NULL);
|
||||
+
|
||||
+ /* FRAME_BLOCK must be initialized and also the frame printing above must
|
||||
+ be done still with the original CURRENT_PC_IS_NOTCURRENT setting. */
|
||||
+ clear_proceed_status ();
|
||||
+
|
||||
+ if (frame_block && BLOCK_END (frame_block) == frame_pc)
|
||||
+ {
|
||||
+ step_out_of_inline_frame (tp->ptid);
|
||||
+ tp->current_pc_is_notcurrent = 1;
|
||||
+ normal_stop ();
|
||||
+ return;
|
||||
}
|
||||
|
||||
+ /* Claim we are stepping in the calling frame. An empty step
|
||||
+ range means that we will stop once we aren't in a function
|
||||
+ called by that frame. We don't use the magic "1" value for
|
||||
+ step_range_end, because then infrun will think this is nexti,
|
||||
+ and not step over the rest of this inlined function call. */
|
||||
+ init_sal (&empty_sal);
|
||||
+ set_step_info (prev_frame, empty_sal);
|
||||
+ tp->step_range_start = tp->step_range_end = get_frame_pc (prev_frame);
|
||||
+ tp->step_over_calls = STEP_OVER_ALL;
|
||||
+
|
||||
proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Find the function we will return from. */
|
||||
|
||||
- function = find_pc_function (get_frame_pc (get_selected_frame (NULL)));
|
||||
+ function = find_pc_function (frame_pc);
|
||||
|
||||
/* Print info on the selected frame, including level number but not
|
||||
source. */
|
||||
@@ -1654,10 +1684,14 @@ finish_command (char *arg, int from_tty)
|
||||
print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
|
||||
}
|
||||
|
||||
+ /* Frames printing above must be done still with the original
|
||||
+ CURRENT_PC_IS_NOTCURRENT setting. */
|
||||
+ clear_proceed_status ();
|
||||
+
|
||||
if (execution_direction == EXEC_REVERSE)
|
||||
finish_backward (function);
|
||||
else
|
||||
- finish_forward (function, frame);
|
||||
+ finish_forward (function, prev_frame);
|
||||
}
|
||||
|
||||
|
||||
Index: gdb-7.0.50.20100121/gdb/target.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100121.orig/gdb/target.c 2010-01-21 15:13:26.000000000 +0100
|
||||
+++ gdb-7.0.50.20100121/gdb/target.c 2010-01-21 15:14:47.000000000 +0100
|
||||
@@ -2216,6 +2216,7 @@ target_resume (ptid_t ptid, int step, en
|
||||
{
|
||||
struct target_ops *t;
|
||||
|
||||
+ clear_inline_frame_state (ptid);
|
||||
target_dcache_invalidate ();
|
||||
|
||||
for (t = current_target.beneath; t != NULL; t = t->beneath)
|
||||
Index: gdb-7.0.50.20100121/gdb/inline-frame.h
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100121.orig/gdb/inline-frame.h 2010-01-01 08:31:36.000000000 +0100
|
||||
+++ gdb-7.0.50.20100121/gdb/inline-frame.h 2010-01-21 15:14:47.000000000 +0100
|
||||
@@ -43,6 +43,10 @@ void clear_inline_frame_state (ptid_t pt
|
||||
|
||||
void step_into_inline_frame (ptid_t ptid);
|
||||
|
||||
+/* Step out of an inlined function by hiding it. */
|
||||
+
|
||||
+void step_out_of_inline_frame (ptid_t ptid);
|
||||
+
|
||||
/* Return the number of hidden functions inlined into the current
|
||||
frame. */
|
||||
|
||||
Index: gdb-7.0.50.20100121/gdb/dwarf2read.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100121.orig/gdb/dwarf2read.c 2010-01-21 15:14:41.000000000 +0100
|
||||
+++ gdb-7.0.50.20100121/gdb/dwarf2read.c 2010-01-21 15:15:09.000000000 +0100
|
||||
@@ -4137,6 +4137,7 @@ read_func_scope (struct die_info *die, s
|
||||
struct block *block;
|
||||
unsigned die_children = 0;
|
||||
int inlined_func = (die->tag == DW_TAG_inlined_subroutine);
|
||||
+ struct type *type;
|
||||
|
||||
if (inlined_func)
|
||||
{
|
||||
@@ -4178,7 +4179,10 @@ read_func_scope (struct die_info *die, s
|
||||
add_to_cu_func_list (name, lowpc, highpc, cu);
|
||||
|
||||
new = push_context (0, lowpc);
|
||||
- new->name = new_symbol (die, read_type_die (die, cu), cu);
|
||||
+ type = read_type_die (die, cu);
|
||||
+ gdb_assert (type != NULL);
|
||||
+ new->name = new_symbol (die, type, cu);
|
||||
+ gdb_assert (TYPE_CODE (SYMBOL_TYPE (new->name)) == TYPE_CODE_FUNC);
|
||||
|
||||
/* If there is a location expression for DW_AT_frame_base, record
|
||||
it. */
|
@ -1,104 +0,0 @@
|
||||
Implement `b <funcname>' for <funcname> with concete inlined instances by
|
||||
a multiple-PC breakpoint.
|
||||
|
||||
Index: gdb-6.8.50.20081128/gdb/ada-lang.c
|
||||
===================================================================
|
||||
--- gdb-6.8.50.20081128.orig/gdb/ada-lang.c 2008-11-25 00:21:15.000000000 +0100
|
||||
+++ gdb-6.8.50.20081128/gdb/ada-lang.c 2008-12-06 21:39:56.000000000 +0100
|
||||
@@ -4614,7 +4614,7 @@ remove_irrelevant_renamings (struct ada_
|
||||
if (current_block == NULL)
|
||||
return nsyms;
|
||||
|
||||
- current_function = block_linkage_function (current_block);
|
||||
+ current_function = block_function (current_block);
|
||||
if (current_function == NULL)
|
||||
return nsyms;
|
||||
|
||||
@@ -6625,7 +6625,7 @@ ada_find_renaming_symbol (const char *na
|
||||
static struct symbol *
|
||||
find_old_style_renaming_symbol (const char *name, struct block *block)
|
||||
{
|
||||
- const struct symbol *function_sym = block_linkage_function (block);
|
||||
+ const struct symbol *function_sym = block_function (block);
|
||||
char *rename;
|
||||
|
||||
if (function_sym != NULL)
|
||||
Index: gdb-6.8.50.20081128/gdb/block.c
|
||||
===================================================================
|
||||
--- gdb-6.8.50.20081128.orig/gdb/block.c 2008-12-06 14:06:16.000000000 +0100
|
||||
+++ gdb-6.8.50.20081128/gdb/block.c 2008-12-06 21:40:29.000000000 +0100
|
||||
@@ -75,6 +75,19 @@ block_linkage_function (const struct blo
|
||||
return BLOCK_FUNCTION (bl);
|
||||
}
|
||||
|
||||
+/* Return the symbol for the function which contains a specified
|
||||
+ lexical block, described by a struct block BL. Inlined functions
|
||||
+ can be returned. */
|
||||
+
|
||||
+struct symbol *
|
||||
+block_function (const struct block *bl)
|
||||
+{
|
||||
+ while (BLOCK_FUNCTION (bl) == NULL && BLOCK_SUPERBLOCK (bl) != NULL)
|
||||
+ bl = BLOCK_SUPERBLOCK (bl);
|
||||
+
|
||||
+ return BLOCK_FUNCTION (bl);
|
||||
+}
|
||||
+
|
||||
/* Return one if BL represents an inlined function. */
|
||||
|
||||
int
|
||||
Index: gdb-6.8.50.20081128/gdb/block.h
|
||||
===================================================================
|
||||
--- gdb-6.8.50.20081128.orig/gdb/block.h 2008-12-06 14:06:16.000000000 +0100
|
||||
+++ gdb-6.8.50.20081128/gdb/block.h 2008-12-06 21:39:56.000000000 +0100
|
||||
@@ -133,6 +133,7 @@ struct blockvector
|
||||
enum { GLOBAL_BLOCK = 0, STATIC_BLOCK = 1, FIRST_LOCAL_BLOCK = 2 };
|
||||
|
||||
extern struct symbol *block_linkage_function (const struct block *);
|
||||
+extern struct symbol *block_function (const struct block *bl);
|
||||
|
||||
extern int block_inlined_p (const struct block *block);
|
||||
|
||||
Index: gdb-6.8.50.20081128/gdb/blockframe.c
|
||||
===================================================================
|
||||
--- gdb-6.8.50.20081128.orig/gdb/blockframe.c 2008-12-06 14:06:16.000000000 +0100
|
||||
+++ gdb-6.8.50.20081128/gdb/blockframe.c 2008-12-06 21:39:56.000000000 +0100
|
||||
@@ -143,7 +143,7 @@ find_pc_sect_function (CORE_ADDR pc, str
|
||||
struct block *b = block_for_pc_sect (pc, section);
|
||||
if (b == 0)
|
||||
return 0;
|
||||
- return block_linkage_function (b);
|
||||
+ return block_function (b);
|
||||
}
|
||||
|
||||
/* Return the function containing pc value PC.
|
||||
Index: gdb-6.8.50.20081128/gdb/breakpoint.c
|
||||
===================================================================
|
||||
--- gdb-6.8.50.20081128.orig/gdb/breakpoint.c 2008-12-06 14:06:17.000000000 +0100
|
||||
+++ gdb-6.8.50.20081128/gdb/breakpoint.c 2008-12-06 21:39:56.000000000 +0100
|
||||
@@ -5712,7 +5712,7 @@ resolve_sal_pc (struct symtab_and_line *
|
||||
bv = blockvector_for_pc_sect (sal->pc, 0, &b, sal->symtab);
|
||||
if (bv != NULL)
|
||||
{
|
||||
- sym = block_linkage_function (b);
|
||||
+ sym = block_function (b);
|
||||
if (sym != NULL)
|
||||
{
|
||||
fixup_symbol_section (sym, sal->symtab->objfile);
|
||||
Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.opt/inline-cmds.exp
|
||||
===================================================================
|
||||
--- gdb-6.8.50.20081128.orig/gdb/testsuite/gdb.opt/inline-cmds.exp 2008-12-06 21:37:27.000000000 +0100
|
||||
+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.opt/inline-cmds.exp 2008-12-06 21:41:37.000000000 +0100
|
||||
@@ -45,8 +45,10 @@ if { [skip_inline_frame_tests] } {
|
||||
|
||||
# First, check that the things we expected to be inlined really were,
|
||||
# and those that shouldn't be weren't.
|
||||
-set line1 [gdb_get_line_number "set breakpoint 1 here" ${srcfile2}]
|
||||
-gdb_breakpoint $srcfile2:$line1
|
||||
+# We test also inlining by the function name, otherwise we would use:
|
||||
+# set line1 [gdb_get_line_number "set breakpoint 1 here" ${srcfile2}]
|
||||
+# gdb_breakpoint $srcfile2:$line1
|
||||
+gdb_breakpoint "bar"
|
||||
set line2 [gdb_get_line_number "set breakpoint 2 here" ${srcfile2}]
|
||||
gdb_breakpoint $srcfile2:$line2
|
||||
|
23
gdb-archer-ada.patch
Normal file
23
gdb-archer-ada.patch
Normal file
@ -0,0 +1,23 @@
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Message-ID: <4B7F207A.7020102@redhat.com>
|
||||
|
||||
[ read_partial_die part dropped in the port to Rawhide ]
|
||||
|
||||
--- gdb-7.0.1-orig/gdb/dwarf2read.c 2010-02-20 01:06:44.000000000 +0100
|
||||
+++ gdb-7.0.1/gdb/dwarf2read.c 2010-02-20 01:08:28.000000000 +0100
|
||||
@@ -9924,9 +9928,13 @@ dwarf2_canonicalize_name (char *name, st
|
||||
static char *
|
||||
dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
|
||||
{
|
||||
- struct attribute *attr;
|
||||
+ struct attribute *attr = NULL;
|
||||
+
|
||||
+ if (cu->language == language_ada)
|
||||
+ attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
|
||||
|
||||
- attr = dwarf2_attr (die, DW_AT_name, cu);
|
||||
+ if (!attr)
|
||||
+ attr = dwarf2_attr (die, DW_AT_name, cu);
|
||||
if (!attr || !DW_STRING (attr))
|
||||
return NULL;
|
||||
|
104
gdb-archer-next-over-throw-cxx-exec.patch
Normal file
104
gdb-archer-next-over-throw-cxx-exec.patch
Normal file
@ -0,0 +1,104 @@
|
||||
Archer-upstreamed:
|
||||
http://sourceware.org/ml/archer/2010-q2/msg00031.html
|
||||
|
||||
--- ./gdb/breakpoint.c 2010-05-29 01:12:32.000000000 +0200
|
||||
+++ ./gdb/breakpoint.c 2010-05-29 01:22:21.000000000 +0200
|
||||
@@ -1679,14 +1679,11 @@ create_exception_master_breakpoint (void
|
||||
debug_hook = lookup_minimal_symbol_text ("_Unwind_DebugHook", objfile);
|
||||
if (debug_hook != NULL)
|
||||
{
|
||||
- CORE_ADDR pc;
|
||||
struct breakpoint *b;
|
||||
|
||||
- pc = find_function_start_pc (get_objfile_arch (objfile),
|
||||
- SYMBOL_VALUE_ADDRESS (debug_hook),
|
||||
- SYMBOL_OBJ_SECTION (debug_hook));
|
||||
b = create_internal_breakpoint (get_objfile_arch (objfile),
|
||||
- pc, bp_exception_master);
|
||||
+ SYMBOL_VALUE_ADDRESS (debug_hook),
|
||||
+ bp_exception_master);
|
||||
b->addr_string = xstrdup ("_Unwind_DebugHook");
|
||||
b->enable_state = bp_disabled;
|
||||
}
|
||||
--- ./gdb/testsuite/gdb.cp/cxxexec.cc 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ ./gdb/testsuite/gdb.cp/cxxexec.cc 2010-05-29 01:18:56.000000000 +0200
|
||||
@@ -0,0 +1,25 @@
|
||||
+/* This test script is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+int
|
||||
+main()
|
||||
+{
|
||||
+ execlp ("true", "true", NULL);
|
||||
+ return 1;
|
||||
+}
|
||||
--- ./gdb/testsuite/gdb.cp/cxxexec.exp 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ ./gdb/testsuite/gdb.cp/cxxexec.exp 2010-05-29 01:29:25.000000000 +0200
|
||||
@@ -0,0 +1,51 @@
|
||||
+# Copyright 2010 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/>.
|
||||
+
|
||||
+if { [skip_cplus_tests] } { continue }
|
||||
+
|
||||
+set testfile cxxexec
|
||||
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.cc {c++ debug}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+runto_main
|
||||
+
|
||||
+# We could stop after `continue' again at `main'.
|
||||
+delete_breakpoints
|
||||
+
|
||||
+set test "p _Unwind_DebugHook"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re " = .* 0x\[0-9a-f\].*\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "\r\nNo symbol .*\r\n$gdb_prompt $" {
|
||||
+ xfail $test
|
||||
+ untested ${testfile}.exp
|
||||
+ return -1
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+set test continue
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "Cannot access memory at address 0x\[0-9a-f\]+\r\n$gdb_prompt $" {
|
||||
+ fail $test
|
||||
+ }
|
||||
+ -re "\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# `info inferiors' can show <null> on older GDBs.
|
||||
+gdb_test "info threads" "info threads" "program finished"
|
@ -1,77 +0,0 @@
|
||||
[ Forward-ported context. ]
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2009-11/msg00170.html
|
||||
Subject: [patch 03/15] PIE: breakpoint_address_match gdbarch_addr_bit workaround
|
||||
|
||||
Hi,
|
||||
|
||||
there are already multiple cases of CORE_ADDR being masked by the width of
|
||||
gdbarch_addr_bit. This specific new case was required the PIE support.
|
||||
|
||||
Please read the C comment in attached patch.
|
||||
|
||||
Checked that CORE_ADDR math operations are present on 6000+ lines of code of
|
||||
GDB sources which makes it impossible to do some general fix by replacing all
|
||||
a->addr < b->addr
|
||||
by
|
||||
addr_less_than (a->addr, b->addr)
|
||||
etc.
|
||||
|
||||
Even with this patch I think there are still many bugs left in the operation
|
||||
of x86_64 gdb debugging i386 targets. Do you find the C++ way as a viable
|
||||
one?
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
* breakpoint.c (breakpoint_address_match): New variables addr_bit and
|
||||
addr_mask, initialize it. Mask addresses by ADDR_MASK.
|
||||
* defs.h (CORE_ADDR): Extend the comment.
|
||||
|
||||
--- a/gdb/breakpoint.c
|
||||
+++ b/gdb/breakpoint.c
|
||||
@@ -4559,9 +4559,15 @@ static int
|
||||
breakpoint_address_match (struct address_space *aspace1, CORE_ADDR addr1,
|
||||
struct address_space *aspace2, CORE_ADDR addr2)
|
||||
{
|
||||
+ int addr_bit = gdbarch_addr_bit (target_gdbarch);
|
||||
+ CORE_ADDR addr_mask = CORE_ADDR_MAX;
|
||||
+
|
||||
+ if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
|
||||
+ addr_mask = ((CORE_ADDR) 1 << addr_bit) - 1;
|
||||
+
|
||||
return ((gdbarch_has_global_breakpoints (target_gdbarch)
|
||||
|| aspace1 == aspace2)
|
||||
- && addr1 == addr2);
|
||||
+ && (addr1 & addr_mask) == (addr2 & addr_mask));
|
||||
}
|
||||
|
||||
/* Assuming LOC1 and LOC2's types' have meaningful target addresses
|
||||
--- a/gdb/defs.h
|
||||
+++ b/gdb/defs.h
|
||||
@@ -98,7 +98,20 @@
|
||||
/* A byte from the program being debugged. */
|
||||
typedef bfd_byte gdb_byte;
|
||||
|
||||
-/* An address in the program being debugged. Host byte order. */
|
||||
+/* An address in the program being debugged. Host byte order.
|
||||
+
|
||||
+ Its width is the maximum width of all the supported targets. That means
|
||||
+ 32-bit target will run on such GDB using 64-bit CORE_ADDR cluttering the
|
||||
+ bits 32...63 with random data from internal GDB calculations. GDB currently
|
||||
+ in general truncates the address width only when it is being presented/used
|
||||
+ externally (such as by the paddress function).
|
||||
+
|
||||
+ FIXME: This is still not right as any GDB internal comparisons (such as >=)
|
||||
+ of CORE_ADDR do not use the properly truncated width. As converting all the
|
||||
+ CORE_ADDR operations to width-aware functions is not feasible the way out
|
||||
+ could be a width-aware C++ class CORE_ADDR referencing gdbarch as its
|
||||
+ constructor parameter. */
|
||||
+
|
||||
typedef bfd_vma CORE_ADDR;
|
||||
|
||||
/* The largest CORE_ADDR value. */
|
||||
|
@ -1,8 +1,8 @@
|
||||
Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
|
||||
Index: gdb-7.0.90.20100306/gdb/dwarf2read.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100115.orig/gdb/dwarf2read.c 2010-01-15 21:41:32.000000000 +0100
|
||||
+++ gdb-7.0.50.20100115/gdb/dwarf2read.c 2010-01-15 21:42:19.000000000 +0100
|
||||
@@ -5821,7 +5821,12 @@ read_common_block (struct die_info *die,
|
||||
--- gdb-7.0.90.20100306.orig/gdb/dwarf2read.c 2010-03-06 23:27:30.000000000 +0100
|
||||
+++ gdb-7.0.90.20100306/gdb/dwarf2read.c 2010-03-06 23:28:43.000000000 +0100
|
||||
@@ -5910,7 +5910,12 @@ read_common_block (struct die_info *die,
|
||||
{
|
||||
struct attribute *attr;
|
||||
struct symbol *sym;
|
||||
@ -16,7 +16,7 @@ Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
|
||||
|
||||
attr = dwarf2_attr (die, DW_AT_location, cu);
|
||||
if (attr)
|
||||
@@ -5830,6 +5835,7 @@ read_common_block (struct die_info *die,
|
||||
@@ -5919,6 +5924,7 @@ read_common_block (struct die_info *die,
|
||||
if (attr_form_is_block (attr))
|
||||
{
|
||||
base = decode_locdesc (DW_BLOCK (attr), cu);
|
||||
@ -24,7 +24,7 @@ Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
|
||||
}
|
||||
else if (attr_form_is_section_offset (attr))
|
||||
{
|
||||
@@ -5891,12 +5897,15 @@ read_common_block (struct die_info *die,
|
||||
@@ -5980,12 +5986,15 @@ read_common_block (struct die_info *die,
|
||||
else
|
||||
dwarf2_complex_location_expr_complaint ();
|
||||
|
||||
@ -42,7 +42,7 @@ Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
|
||||
else
|
||||
SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym));
|
||||
FIELD_TYPE (*field) = SYMBOL_TYPE (sym);
|
||||
@@ -5910,7 +5919,7 @@ read_common_block (struct die_info *die,
|
||||
@@ -5999,7 +6008,7 @@ read_common_block (struct die_info *die,
|
||||
|
||||
sym = new_symbol (die, type, cu);
|
||||
/* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static. */
|
||||
@ -51,60 +51,11 @@ Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
|
||||
|
||||
set_die_type (die, type, cu);
|
||||
}
|
||||
Index: gdb-7.0.50.20100115/gdb/exec.c
|
||||
Index: gdb-7.0.90.20100306/gdb/gdbtypes.h
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100115.orig/gdb/exec.c 2010-01-15 21:35:14.000000000 +0100
|
||||
+++ gdb-7.0.50.20100115/gdb/exec.c 2010-01-15 21:47:19.000000000 +0100
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "arch-utils.h"
|
||||
#include "gdbthread.h"
|
||||
#include "progspace.h"
|
||||
+#include "solib.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include "readline/readline.h"
|
||||
@@ -225,6 +226,10 @@ exec_file_attach (char *filename, int fr
|
||||
char *scratch_pathname;
|
||||
int scratch_chan;
|
||||
struct target_section *sections = NULL, *sections_end = NULL;
|
||||
+ struct target_section *p;
|
||||
+ int addr_bit;
|
||||
+ CORE_ADDR mask = CORE_ADDR_MAX;
|
||||
+ CORE_ADDR displacement;
|
||||
|
||||
scratch_chan = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, filename,
|
||||
write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY,
|
||||
@@ -293,12 +298,23 @@ exec_file_attach (char *filename, int fr
|
||||
scratch_pathname, bfd_errmsg (bfd_get_error ()));
|
||||
}
|
||||
|
||||
+ set_gdbarch_from_file (exec_bfd);
|
||||
+
|
||||
+ addr_bit = gdbarch_addr_bit (target_gdbarch);
|
||||
+ if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
|
||||
+ mask = ((CORE_ADDR) 1 << addr_bit) - 1;
|
||||
+
|
||||
+ displacement = solib_exec_displacement ();
|
||||
+ for (p = sections; p < sections_end; p++)
|
||||
+ {
|
||||
+ p->addr = (p->addr + displacement) & mask;
|
||||
+ p->endaddr = (p->endaddr + displacement) & mask;
|
||||
+ }
|
||||
+
|
||||
exec_bfd_mtime = bfd_get_mtime (exec_bfd);
|
||||
|
||||
validate_files ();
|
||||
|
||||
- set_gdbarch_from_file (exec_bfd);
|
||||
-
|
||||
/* Add the executable's sections to the current address spaces'
|
||||
list of sections. This possibly pushes the exec_ops
|
||||
target. */
|
||||
Index: gdb-7.0.50.20100115/gdb/gdbtypes.h
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100115.orig/gdb/gdbtypes.h 2010-01-15 21:35:16.000000000 +0100
|
||||
+++ gdb-7.0.50.20100115/gdb/gdbtypes.h 2010-01-15 21:44:24.000000000 +0100
|
||||
@@ -406,6 +406,7 @@ enum type_instance_flag_value
|
||||
--- gdb-7.0.90.20100306.orig/gdb/gdbtypes.h 2010-03-06 23:26:34.000000000 +0100
|
||||
+++ gdb-7.0.90.20100306/gdb/gdbtypes.h 2010-03-06 23:28:43.000000000 +0100
|
||||
@@ -412,6 +412,7 @@ enum type_instance_flag_value
|
||||
enum field_loc_kind
|
||||
{
|
||||
FIELD_LOC_KIND_BITPOS, /* bitpos */
|
||||
@ -112,7 +63,7 @@ Index: gdb-7.0.50.20100115/gdb/gdbtypes.h
|
||||
FIELD_LOC_KIND_PHYSADDR, /* physaddr */
|
||||
FIELD_LOC_KIND_PHYSNAME /* physname */
|
||||
};
|
||||
@@ -582,6 +583,7 @@ struct main_type
|
||||
@@ -591,6 +592,7 @@ struct main_type
|
||||
is the location (in the target) of the static field.
|
||||
Otherwise, physname is the mangled label of the static field. */
|
||||
|
||||
@ -120,7 +71,7 @@ Index: gdb-7.0.50.20100115/gdb/gdbtypes.h
|
||||
CORE_ADDR physaddr;
|
||||
char *physname;
|
||||
}
|
||||
@@ -1100,6 +1102,7 @@ extern void allocate_gnat_aux_type (stru
|
||||
@@ -1091,6 +1093,7 @@ extern void allocate_gnat_aux_type (stru
|
||||
#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
|
||||
#define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
|
||||
#define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
|
||||
@ -128,7 +79,7 @@ Index: gdb-7.0.50.20100115/gdb/gdbtypes.h
|
||||
#define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
|
||||
#define SET_FIELD_BITPOS(thisfld, bitpos) \
|
||||
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_BITPOS, \
|
||||
@@ -1107,6 +1110,7 @@ extern void allocate_gnat_aux_type (stru
|
||||
@@ -1098,6 +1101,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))
|
||||
@ -136,7 +87,7 @@ Index: gdb-7.0.50.20100115/gdb/gdbtypes.h
|
||||
#define SET_FIELD_PHYSADDR(thisfld, addr) \
|
||||
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \
|
||||
FIELD_STATIC_PHYSADDR (thisfld) = (addr))
|
||||
@@ -1119,6 +1123,7 @@ extern void allocate_gnat_aux_type (stru
|
||||
@@ -1110,6 +1114,7 @@ extern void allocate_gnat_aux_type (stru
|
||||
#define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n))
|
||||
#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
|
||||
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
|
||||
@ -144,10 +95,10 @@ Index: gdb-7.0.50.20100115/gdb/gdbtypes.h
|
||||
#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
|
||||
#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
|
||||
#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n))
|
||||
Index: gdb-7.0.50.20100115/gdb/jv-lang.c
|
||||
Index: gdb-7.0.90.20100306/gdb/jv-lang.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100115.orig/gdb/jv-lang.c 2010-01-15 21:35:13.000000000 +0100
|
||||
+++ gdb-7.0.50.20100115/gdb/jv-lang.c 2010-01-15 21:41:58.000000000 +0100
|
||||
--- gdb-7.0.90.20100306.orig/gdb/jv-lang.c 2010-03-06 23:19:13.000000000 +0100
|
||||
+++ gdb-7.0.90.20100306/gdb/jv-lang.c 2010-03-06 23:28:43.000000000 +0100
|
||||
@@ -416,7 +416,8 @@ java_link_class_type (struct gdbarch *gd
|
||||
|
||||
fields = NULL;
|
||||
@ -168,142 +119,10 @@ Index: gdb-7.0.50.20100115/gdb/jv-lang.c
|
||||
else
|
||||
TYPE_FIELD_BITPOS (type, i) = 8 * boffset;
|
||||
if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */
|
||||
Index: gdb-7.0.50.20100115/gdb/solib-svr4.c
|
||||
Index: gdb-7.0.90.20100306/gdb/value.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100115.orig/gdb/solib-svr4.c 2010-01-15 21:35:16.000000000 +0100
|
||||
+++ gdb-7.0.50.20100115/gdb/solib-svr4.c 2010-01-15 21:44:55.000000000 +0100
|
||||
@@ -1689,7 +1689,10 @@ svr4_exec_displacement (void)
|
||||
if (target_auxv_search (¤t_target, AT_ENTRY, &entry_point) == 1)
|
||||
return entry_point - bfd_get_start_address (exec_bfd);
|
||||
|
||||
- return svr4_static_exec_displacement ();
|
||||
+ if (!ptid_equal (inferior_ptid, null_ptid))
|
||||
+ return svr4_static_exec_displacement ();
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
/* Relocate the main executable. This function should be called upon
|
||||
@@ -1700,7 +1703,7 @@ svr4_exec_displacement (void)
|
||||
static void
|
||||
svr4_relocate_main_executable (void)
|
||||
{
|
||||
- CORE_ADDR displacement = svr4_exec_displacement ();
|
||||
+ CORE_ADDR displacement = solib_exec_displacement ();
|
||||
|
||||
/* Even if DISPLACEMENT is 0 still try to relocate it as this is a new
|
||||
difference of in-memory vs. in-file addresses and we could already
|
||||
@@ -2054,6 +2057,7 @@ _initialize_svr4_solib (void)
|
||||
svr4_so_ops.free_so = svr4_free_so;
|
||||
svr4_so_ops.clear_solib = svr4_clear_solib;
|
||||
svr4_so_ops.solib_create_inferior_hook = svr4_solib_create_inferior_hook;
|
||||
+ svr4_so_ops.exec_displacement = svr4_exec_displacement;
|
||||
svr4_so_ops.special_symbol_handling = svr4_special_symbol_handling;
|
||||
svr4_so_ops.current_sos = svr4_current_sos;
|
||||
svr4_so_ops.open_symbol_file_object = open_symbol_file_object;
|
||||
Index: gdb-7.0.50.20100115/gdb/solib.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100115.orig/gdb/solib.c 2010-01-15 21:35:16.000000000 +0100
|
||||
+++ gdb-7.0.50.20100115/gdb/solib.c 2010-01-15 21:41:58.000000000 +0100
|
||||
@@ -1037,6 +1037,19 @@ solib_create_inferior_hook (int from_tty
|
||||
ops->solib_create_inferior_hook (from_tty);
|
||||
}
|
||||
|
||||
+/* Query the difference of in-memory VMA addresses vs. exec_bfd VMAs. */
|
||||
+
|
||||
+CORE_ADDR
|
||||
+solib_exec_displacement (void)
|
||||
+{
|
||||
+ struct target_so_ops *ops = solib_ops (target_gdbarch);
|
||||
+
|
||||
+ if (ops->exec_displacement != NULL)
|
||||
+ return (*ops->exec_displacement) ();
|
||||
+ else
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/* GLOBAL FUNCTION
|
||||
|
||||
in_solib_dynsym_resolve_code -- check to see if an address is in
|
||||
Index: gdb-7.0.50.20100115/gdb/solib.h
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100115.orig/gdb/solib.h 2010-01-08 23:52:04.000000000 +0100
|
||||
+++ gdb-7.0.50.20100115/gdb/solib.h 2010-01-15 21:42:36.000000000 +0100
|
||||
@@ -44,6 +44,8 @@ extern int solib_read_symbols (struct so
|
||||
|
||||
extern void solib_create_inferior_hook (int from_tty);
|
||||
|
||||
+extern CORE_ADDR solib_exec_displacement (void);
|
||||
+
|
||||
/* If ADDR lies in a shared library, return its name. */
|
||||
|
||||
extern char *solib_name_from_address (struct program_space *, CORE_ADDR);
|
||||
Index: gdb-7.0.50.20100115/gdb/solist.h
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100115.orig/gdb/solist.h 2010-01-08 23:52:04.000000000 +0100
|
||||
+++ gdb-7.0.50.20100115/gdb/solist.h 2010-01-15 21:41:58.000000000 +0100
|
||||
@@ -92,6 +92,9 @@ struct target_so_ops
|
||||
/* Target dependent code to run after child process fork. */
|
||||
void (*solib_create_inferior_hook) (int from_tty);
|
||||
|
||||
+ /* Query the difference of in-memory VMA addresses vs. exec_bfd VMAs. */
|
||||
+ CORE_ADDR (*exec_displacement) (void);
|
||||
+
|
||||
/* Do additional symbol handling, lookup, etc. after symbols
|
||||
for a shared object have been loaded. */
|
||||
void (*special_symbol_handling) (void);
|
||||
Index: gdb-7.0.50.20100115/gdb/symfile.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100115.orig/gdb/symfile.c 2010-01-15 21:35:14.000000000 +0100
|
||||
+++ gdb-7.0.50.20100115/gdb/symfile.c 2010-01-15 21:41:58.000000000 +0100
|
||||
@@ -832,15 +832,36 @@ syms_from_objfile (struct objfile *objfi
|
||||
if an error occurs during symbol reading. */
|
||||
old_chain = make_cleanup_free_objfile (objfile);
|
||||
|
||||
- /* If ADDRS and OFFSETS are both NULL, put together a dummy address
|
||||
- list. We now establish the convention that an addr of zero means
|
||||
- no load address was specified. */
|
||||
+ /* If ADDRS and OFFSETS are both NULL, put together a dummy offset list. */
|
||||
+
|
||||
if (! addrs && ! offsets)
|
||||
{
|
||||
- local_addr
|
||||
- = alloc_section_addr_info (bfd_count_sections (objfile->obfd));
|
||||
- make_cleanup (xfree, local_addr);
|
||||
- addrs = local_addr;
|
||||
+ /* Relocateble files have an exception in default_symfile_offsets which
|
||||
+ applies only for ADDRS. But calling solib_exec_displacement is more
|
||||
+ suitable for OFFSETS. Fortunately we never need the both
|
||||
+ functionalities simultaneously and in other cases zeroed ADDRS and
|
||||
+ zeroed OFFSETS are equivalent. */
|
||||
+
|
||||
+ if ((bfd_get_file_flags (objfile->obfd) & (EXEC_P | DYNAMIC)) == 0)
|
||||
+ {
|
||||
+ local_addr
|
||||
+ = alloc_section_addr_info (bfd_count_sections (objfile->obfd));
|
||||
+ make_cleanup (xfree, local_addr);
|
||||
+ addrs = local_addr;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ CORE_ADDR displacement = 0;
|
||||
+ int i;
|
||||
+
|
||||
+ if (mainline)
|
||||
+ displacement = solib_exec_displacement ();
|
||||
+
|
||||
+ num_offsets = bfd_count_sections (objfile->obfd);
|
||||
+ offsets = alloca (SIZEOF_N_SECTION_OFFSETS (num_offsets));
|
||||
+ for (i = 0; i < num_offsets; i++)
|
||||
+ offsets->offsets[i] = displacement;
|
||||
+ }
|
||||
}
|
||||
|
||||
/* Now either addrs or offsets is non-zero. */
|
||||
Index: gdb-7.0.50.20100115/gdb/value.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100115.orig/gdb/value.c 2010-01-15 21:35:13.000000000 +0100
|
||||
+++ gdb-7.0.50.20100115/gdb/value.c 2010-01-15 21:41:58.000000000 +0100
|
||||
--- gdb-7.0.90.20100306.orig/gdb/value.c 2010-03-06 23:19:13.000000000 +0100
|
||||
+++ gdb-7.0.90.20100306/gdb/value.c 2010-03-06 23:28:43.000000000 +0100
|
||||
@@ -1897,7 +1897,8 @@ value_static_field (struct type *type, i
|
||||
if (TYPE_FIELD_LOC_KIND (type, fieldno) == FIELD_LOC_KIND_PHYSADDR)
|
||||
{
|
||||
|
105
gdb-archer-vla-ref-optimizedout.patch
Normal file
105
gdb-archer-vla-ref-optimizedout.patch
Normal file
@ -0,0 +1,105 @@
|
||||
commit a683bac73af74a757591672d89d720169c0b5ec9
|
||||
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Thu May 13 18:08:30 2010 +0200
|
||||
|
||||
Support DW_AT_upper_bound is referencing an optimized-out variable.
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=591879
|
||||
|
||||
--- a/gdb/dwarf2loc.c
|
||||
+++ b/gdb/dwarf2loc.c
|
||||
@@ -383,6 +383,9 @@ dwarf_loclist_baton_eval (struct dwarf2_loclist_baton *dllbaton,
|
||||
size_t size;
|
||||
struct value *val;
|
||||
|
||||
+ if (!dllbaton)
|
||||
+ return 0;
|
||||
+
|
||||
data = find_location_expression (dllbaton, &size,
|
||||
get_frame_address_in_block (frame));
|
||||
if (data == NULL)
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -11693,6 +11693,11 @@ dwarf2_attr_to_loclist_baton (struct attribute *attr, struct dwarf2_cu *cu)
|
||||
{
|
||||
struct dwarf2_loclist_baton *baton;
|
||||
|
||||
+ /* DW_AT_location of the referenced DIE may be missing if the referenced
|
||||
+ variable has been optimized out. */
|
||||
+ if (!attr)
|
||||
+ return NULL;
|
||||
+
|
||||
if (!(attr_form_is_section_offset (attr)
|
||||
/* ".debug_loc" may not exist at all, or the offset may be outside
|
||||
the section. If so, fall through to the complaint in the
|
||||
--- a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
|
||||
@@ -51,6 +51,17 @@ vardata:
|
||||
.4byte .Llen_var-.Lcu1_begin /* DW_AT_upper_bound */
|
||||
.byte 0 /* End of children of die */
|
||||
|
||||
+ /* DW_AT_upper_bound is referencing an optimized-out variable. */
|
||||
+.Larrayb_type:
|
||||
+ .uleb128 2 /* Abbrev: DW_TAG_array_type */
|
||||
+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */
|
||||
+
|
||||
+ .uleb128 3 /* Abbrev: DW_TAG_subrange_type */
|
||||
+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */
|
||||
+ .byte 0 /* DW_AT_lower_bound */
|
||||
+ .4byte .Llenb_var-.Lcu1_begin /* DW_AT_upper_bound */
|
||||
+ .byte 0 /* End of children of die */
|
||||
+
|
||||
.Luint_type:
|
||||
.uleb128 4 /* Abbrev: DW_TAG_base_type */
|
||||
.4byte .Luint_str /* DW_AT_name */
|
||||
@@ -69,9 +80,24 @@ vardata:
|
||||
.4byte .Luint_type-.Lcu1_begin /* DW_AT_type */
|
||||
.4byte .Llen_loclist-.Lloclist /* DW_AT_location */
|
||||
|
||||
+ /* optimized-out variable for b_string. */
|
||||
+.Llenb_var:
|
||||
+ .uleb128 7 /* Abbrev: DW_TAG_variable artificial no DW_AT_location */
|
||||
+ .byte 1 /* DW_AT_artificial */
|
||||
+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */
|
||||
+
|
||||
.uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */
|
||||
.string "a_string" /* DW_AT_name */
|
||||
- .4byte .Larray_type-.Lcu1_begin/* DW_AT_type */
|
||||
+ .4byte .Larray_type-.Lcu1_begin /* DW_AT_type */
|
||||
+ .byte 2f - 1f /* DW_AT_location */
|
||||
+1: .byte 3 /* DW_OP_addr */
|
||||
+ .4byte vardata /* <addr> */
|
||||
+2:
|
||||
+
|
||||
+ /* DW_AT_upper_bound is referencing an optimized-out variable. */
|
||||
+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */
|
||||
+ .string "b_string" /* DW_AT_name */
|
||||
+ .4byte .Larrayb_type-.Lcu1_begin /* DW_AT_type */
|
||||
.byte 2f - 1f /* DW_AT_location */
|
||||
1: .byte 3 /* DW_OP_addr */
|
||||
.4byte vardata /* <addr> */
|
||||
@@ -164,6 +190,16 @@ vardata:
|
||||
.byte 0x0 /* Terminator */
|
||||
.byte 0x0 /* Terminator */
|
||||
|
||||
+ .uleb128 7 /* Abbrev code */
|
||||
+ .uleb128 0x34 /* DW_TAG_variable */
|
||||
+ .byte 0x0 /* no_children */
|
||||
+ .uleb128 0x34 /* DW_AT_artificial */
|
||||
+ .uleb128 0x0c /* DW_FORM_flag */
|
||||
+ .uleb128 0x49 /* DW_AT_type */
|
||||
+ .uleb128 0x13 /* DW_FORM_ref4 */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+
|
||||
.byte 0x0 /* Terminator */
|
||||
|
||||
/* String table */
|
||||
--- a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
|
||||
@@ -46,3 +46,6 @@ if ![runto "*main"] {
|
||||
|
||||
gdb_test "p a_string" { = "seen"}
|
||||
gdb_test "ptype a_string" {type = char \[4\]}
|
||||
+
|
||||
+gdb_test "p b_string" { = (0x[0-9a-f]+ )?"seennotseen"}
|
||||
+gdb_test "ptype b_string" {type = char \[\]}
|
21
gdb-archer-vla-test-oom.patch
Normal file
21
gdb-archer-vla-test-oom.patch
Normal file
@ -0,0 +1,21 @@
|
||||
commit ec5a7769d5c05542d12fc21afa25f32360db7de4
|
||||
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Wed May 12 22:00:46 2010 +0200
|
||||
|
||||
Fix mb_reserve:
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=590635
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/vla-overflow.exp b/gdb/testsuite/gdb.base/vla-overflow.exp
|
||||
index 7203a48..24a608f 100644
|
||||
--- a/gdb/testsuite/gdb.base/vla-overflow.exp
|
||||
+++ b/gdb/testsuite/gdb.base/vla-overflow.exp
|
||||
@@ -66,7 +66,8 @@ proc memory_v_pages_get {} {
|
||||
|
||||
set pages_found [memory_v_pages_get]
|
||||
|
||||
-set mb_reserve 10
|
||||
+# s390x with glibc-debuginfo.s390x installed used approx. 16MB.
|
||||
+set mb_reserve 40
|
||||
verbose -log "pages_found = $pages_found, mb_reserve = $mb_reserve"
|
||||
set kb_found [expr $pages_found * $pagesize / 1024]
|
||||
set kb_permit [expr $kb_found + 1 * 1024 + $mb_reserve * 1024]
|
4573
gdb-archer.patch
4573
gdb-archer.patch
File diff suppressed because it is too large
Load Diff
14
gdb-bz539590-gnu-ifunc-fix-cond.patch
Normal file
14
gdb-bz539590-gnu-ifunc-fix-cond.patch
Normal file
@ -0,0 +1,14 @@
|
||||
--- ./gdb/breakpoint.c 2010-04-26 02:35:53.000000000 +0200
|
||||
+++ ./gdb/breakpoint.c 2010-04-26 02:33:26.000000000 +0200
|
||||
@@ -8499,6 +8499,11 @@ update_breakpoint_locations (struct brea
|
||||
{
|
||||
struct gdb_exception e;
|
||||
|
||||
+ /* Temporary workaround before the non-intrusive ifunc patch gets in.
|
||||
+ exp parsing can now call inferior function invalidating
|
||||
+ EXISTING_LOCATIONS. */
|
||||
+ existing_locations = NULL;
|
||||
+
|
||||
s = b->cond_string;
|
||||
TRY_CATCH (e, RETURN_MASK_ERROR)
|
||||
{
|
43
gdb-bz562763-pretty-print-2d-vectors-libstdcxx.patch
Normal file
43
gdb-bz562763-pretty-print-2d-vectors-libstdcxx.patch
Normal file
@ -0,0 +1,43 @@
|
||||
2010-06-01 Chris Moller <cmoller@redhat.com>
|
||||
|
||||
* python/libstdcxx/v6/printers.py (StdVectorPrinter): Add
|
||||
detection for matrices as nested vectors.
|
||||
|
||||
Index: libstdc++-v3/python/libstdcxx/v6/printers.py
|
||||
===================================================================
|
||||
--- ./libstdc++-v3-python-r155978/libstdcxx/v6/printers.py (revision 159937)
|
||||
+++ ./libstdc++-v3-python-r155978/libstdcxx/v6/printers.py (working copy)
|
||||
@@ -19,6 +19,9 @@
|
||||
import itertools
|
||||
import re
|
||||
|
||||
+vector_sig = 'std::vector'
|
||||
+vector_regex = re.compile('^' + vector_sig + '<.*>$')
|
||||
+
|
||||
class StdPointerPrinter:
|
||||
"Print a smart pointer of some kind"
|
||||
|
||||
@@ -186,7 +189,13 @@
|
||||
% (self.typename, int (finish - start), int (end - start)))
|
||||
|
||||
def display_hint(self):
|
||||
- return 'array'
|
||||
+ itype0 = self.val.type.template_argument(0)
|
||||
+ itag = itype0.tag
|
||||
+ if itag and re.match(vector_regex, itag):
|
||||
+ rc = 'matrix'
|
||||
+ else:
|
||||
+ rc = 'array'
|
||||
+ return rc
|
||||
|
||||
class StdVectorIteratorPrinter:
|
||||
"Print std::vector::iterator"
|
||||
@@ -692,7 +701,7 @@
|
||||
pretty_printers_dict[re.compile('^std::set<.*>$')] = lambda val: StdSetPrinter("std::set", val)
|
||||
pretty_printers_dict[re.compile('^std::stack<.*>$')] = lambda val: StdStackOrQueuePrinter("std::stack", val)
|
||||
pretty_printers_dict[re.compile('^std::unique_ptr<.*>$')] = UniquePointerPrinter
|
||||
- pretty_printers_dict[re.compile('^std::vector<.*>$')] = lambda val: StdVectorPrinter("std::vector", val)
|
||||
+ pretty_printers_dict[vector_regex] = lambda val: StdVectorPrinter(vector_sig, val)
|
||||
# vector<bool>
|
||||
|
||||
# Printer registrations for classes compiled with -D_GLIBCXX_DEBUG.
|
427
gdb-bz562763-pretty-print-2d-vectors-prereq.patch
Normal file
427
gdb-bz562763-pretty-print-2d-vectors-prereq.patch
Normal file
@ -0,0 +1,427 @@
|
||||
commit e5ea8d026015c2a0c7774788b425914857de1ffb
|
||||
Author: pmuldoon <pmuldoon>
|
||||
Date: Wed Apr 14 12:02:42 2010 +0000
|
||||
|
||||
2010-04-14 Phil Muldoon <pmuldoon@redhat.com>
|
||||
|
||||
PR python/11381
|
||||
|
||||
* python/py-prettyprint.c (pretty_print_one_value): Test for
|
||||
Py_None.
|
||||
(print_string_repr): Test for Py_None. Set flags accordingly.
|
||||
Return value depending on return type.
|
||||
(print_children): Take a value indicating whether data was printed
|
||||
before this function was called. Alter output accordingly.
|
||||
(apply_val_pretty_printer): Capture return value from
|
||||
print_string_repr and pass to print_children.
|
||||
|
||||
2010-04-14 Phil Muldoon <pmuldoon@redhat.com>
|
||||
|
||||
* gdb.python/py-prettyprint.py (NoStringContainerPrinter): New printer.
|
||||
* gdb.python/py-prettyprint.c: Add justchildren struct, typedefs.
|
||||
* gdb.python/py-prettyprint.exp: New test for to_string returning None.
|
||||
* gdb.python/py-mi.exp: New test for to_string returning None.
|
||||
|
||||
2010-04-14 Phil Muldoon <pmuldoon@redhat.com>
|
||||
|
||||
* gdb.texinfo (Pretty Printing): Document behaviour when to_string
|
||||
returns None.
|
||||
|
||||
### a/gdb/ChangeLog
|
||||
### b/gdb/ChangeLog
|
||||
## -1,3 +1,16 @@
|
||||
+2010-04-14 Phil Muldoon <pmuldoon@redhat.com>
|
||||
+
|
||||
+ PR python/11381
|
||||
+
|
||||
+ * python/py-prettyprint.c (pretty_print_one_value): Test for
|
||||
+ Py_None.
|
||||
+ (print_string_repr): Test for Py_None. Set flags accordingly.
|
||||
+ Return value depending on return type.
|
||||
+ (print_children): Take a value indicating whether data was printed
|
||||
+ before this function was called. Alter output accordingly.
|
||||
+ (apply_val_pretty_printer): Capture return value from
|
||||
+ print_string_repr and pass to print_children.
|
||||
+
|
||||
2010-04-13 Mark Kettenis <kettenis@gnu.org>
|
||||
|
||||
PR corefiles/11481
|
||||
### a/gdb/doc/ChangeLog
|
||||
### b/gdb/doc/ChangeLog
|
||||
## -1,3 +1,8 @@
|
||||
+2010-04-14 Phil Muldoon <pmuldoon@redhat.com>
|
||||
+
|
||||
+ * gdb.texinfo (Pretty Printing): Document behaviour when to_string
|
||||
+ returns None.
|
||||
+
|
||||
2010-04-09 Stan Shebs <stan@codesourcery.com>
|
||||
|
||||
* gdb.texinfo (gdb/mi Tracepoint Commands) <-trace-status>:
|
||||
Index: gdb-7.1/gdb/doc/gdb.texinfo
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/doc/gdb.texinfo 2010-06-30 03:22:07.000000000 +0200
|
||||
+++ gdb-7.1/gdb/doc/gdb.texinfo 2010-06-30 03:22:20.000000000 +0200
|
||||
@@ -20344,6 +20344,9 @@ the resulting value. Again, this may re
|
||||
pretty-printer. Python scalars (integers, floats, and booleans) and
|
||||
strings are convertible to @code{gdb.Value}; other types are not.
|
||||
|
||||
+Finally, if this method returns @code{None} then no further operations
|
||||
+are peformed in this method and nothing is printed.
|
||||
+
|
||||
If the result is not one of these types, an exception is raised.
|
||||
@end defop
|
||||
|
||||
Index: gdb-7.1/gdb/python/py-prettyprint.c
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/python/py-prettyprint.c 2010-06-30 03:22:02.000000000 +0200
|
||||
+++ gdb-7.1/gdb/python/py-prettyprint.c 2010-06-30 03:23:38.000000000 +0200
|
||||
@@ -125,9 +125,12 @@ find_pretty_printer (PyObject *value)
|
||||
|
||||
/* Pretty-print a single value, via the printer object PRINTER.
|
||||
If the function returns a string, a PyObject containing the string
|
||||
- is returned. Otherwise, if the function returns a value,
|
||||
- *OUT_VALUE is set to the value, and NULL is returned. On error,
|
||||
- *OUT_VALUE is set to NULL, and NULL is returned. */
|
||||
+ is returned. If the function returns Py_NONE that means the pretty
|
||||
+ printer returned the Python None as a value. Otherwise, if the
|
||||
+ function returns a value, *OUT_VALUE is set to the value, and NULL
|
||||
+ is returned. On error, *OUT_VALUE is set to NULL, and NULL is
|
||||
+ returned. */
|
||||
+
|
||||
static PyObject *
|
||||
pretty_print_one_value (PyObject *printer, struct value **out_value)
|
||||
{
|
||||
@@ -140,7 +143,8 @@ pretty_print_one_value (PyObject *printe
|
||||
result = PyObject_CallMethodObjArgs (printer, gdbpy_to_string_cst, NULL);
|
||||
if (result)
|
||||
{
|
||||
- if (! gdbpy_is_string (result) && ! gdbpy_is_lazy_string (result))
|
||||
+ if (! gdbpy_is_string (result) && ! gdbpy_is_lazy_string (result)
|
||||
+ && result != Py_None)
|
||||
{
|
||||
*out_value = convert_value_from_python (result);
|
||||
if (PyErr_Occurred ())
|
||||
@@ -184,8 +188,11 @@ gdbpy_get_display_hint (PyObject *printe
|
||||
}
|
||||
|
||||
/* Helper for apply_val_pretty_printer which calls to_string and
|
||||
- formats the result. */
|
||||
-static void
|
||||
+ formats the result. If the value returnd is Py_None, nothing is
|
||||
+ printed and the function returns a 1; in all other cases data is
|
||||
+ printed as given by the pretty printer and the function returns 0.
|
||||
+*/
|
||||
+static int
|
||||
print_string_repr (PyObject *printer, const char *hint,
|
||||
struct ui_file *stream, int recurse,
|
||||
const struct value_print_options *options,
|
||||
@@ -194,52 +201,58 @@ print_string_repr (PyObject *printer, co
|
||||
{
|
||||
struct value *replacement = NULL;
|
||||
PyObject *py_str = NULL;
|
||||
+ int is_py_none = 0;
|
||||
|
||||
py_str = pretty_print_one_value (printer, &replacement);
|
||||
if (py_str)
|
||||
{
|
||||
- gdb_byte *output = NULL;
|
||||
- long length;
|
||||
- struct type *type;
|
||||
- char *encoding = NULL;
|
||||
- PyObject *string = NULL;
|
||||
- int is_lazy;
|
||||
-
|
||||
- is_lazy = gdbpy_is_lazy_string (py_str);
|
||||
- if (is_lazy)
|
||||
- output = gdbpy_extract_lazy_string (py_str, &type, &length, &encoding);
|
||||
+ if (py_str == Py_None)
|
||||
+ is_py_none = 1;
|
||||
else
|
||||
{
|
||||
- string = python_string_to_target_python_string (py_str);
|
||||
- if (string)
|
||||
+ gdb_byte *output = NULL;
|
||||
+ long length;
|
||||
+ struct type *type;
|
||||
+ char *encoding = NULL;
|
||||
+ PyObject *string = NULL;
|
||||
+ int is_lazy;
|
||||
+
|
||||
+ is_lazy = gdbpy_is_lazy_string (py_str);
|
||||
+ if (is_lazy)
|
||||
+ output = gdbpy_extract_lazy_string (py_str, &type, &length, &encoding);
|
||||
+ else
|
||||
{
|
||||
- output = PyString_AsString (string);
|
||||
- length = PyString_Size (string);
|
||||
- type = builtin_type (gdbarch)->builtin_char;
|
||||
+ string = python_string_to_target_python_string (py_str);
|
||||
+ if (string)
|
||||
+ {
|
||||
+ output = PyString_AsString (string);
|
||||
+ length = PyString_Size (string);
|
||||
+ type = builtin_type (gdbarch)->builtin_char;
|
||||
+ }
|
||||
+ else
|
||||
+ gdbpy_print_stack ();
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ if (output)
|
||||
+ {
|
||||
+ if (is_lazy || (hint && !strcmp (hint, "string")))
|
||||
+ LA_PRINT_STRING (stream, type, output, length, encoding,
|
||||
+ 0, options);
|
||||
+ else
|
||||
+ fputs_filtered (output, stream);
|
||||
}
|
||||
else
|
||||
gdbpy_print_stack ();
|
||||
|
||||
- }
|
||||
-
|
||||
- if (output)
|
||||
- {
|
||||
- if (is_lazy || (hint && !strcmp (hint, "string")))
|
||||
- LA_PRINT_STRING (stream, type, output, length, encoding,
|
||||
- 0, options);
|
||||
+ if (string)
|
||||
+ Py_DECREF (string);
|
||||
else
|
||||
- fputs_filtered (output, stream);
|
||||
- }
|
||||
- else
|
||||
- gdbpy_print_stack ();
|
||||
-
|
||||
- if (string)
|
||||
- Py_DECREF (string);
|
||||
- else
|
||||
- xfree (output);
|
||||
+ xfree (output);
|
||||
|
||||
- xfree (encoding);
|
||||
- Py_DECREF (py_str);
|
||||
+ xfree (encoding);
|
||||
+ Py_DECREF (py_str);
|
||||
+ }
|
||||
}
|
||||
else if (replacement)
|
||||
{
|
||||
@@ -250,6 +263,8 @@ print_string_repr (PyObject *printer, co
|
||||
}
|
||||
else
|
||||
gdbpy_print_stack ();
|
||||
+
|
||||
+ return is_py_none;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -328,12 +343,14 @@ push_dummy_python_frame ()
|
||||
}
|
||||
|
||||
/* Helper for apply_val_pretty_printer that formats children of the
|
||||
- printer, if any exist. */
|
||||
+ printer, if any exist. If is_py_none is true, then nothing has
|
||||
+ been printed by to_string, and format output accordingly. */
|
||||
static void
|
||||
print_children (PyObject *printer, const char *hint,
|
||||
struct ui_file *stream, int recurse,
|
||||
const struct value_print_options *options,
|
||||
- const struct language_defn *language)
|
||||
+ const struct language_defn *language,
|
||||
+ int is_py_none)
|
||||
{
|
||||
int is_map, is_array, done_flag, pretty;
|
||||
unsigned int i;
|
||||
@@ -413,7 +430,13 @@ print_children (PyObject *printer, const
|
||||
2. Arrays. Always print a ",".
|
||||
3. Other. Always print a ",". */
|
||||
if (i == 0)
|
||||
- fputs_filtered (" = {", stream);
|
||||
+ {
|
||||
+ if (is_py_none)
|
||||
+ fputs_filtered ("{", stream);
|
||||
+ else
|
||||
+ fputs_filtered (" = {", stream);
|
||||
+ }
|
||||
+
|
||||
else if (! is_map || i % 2 == 0)
|
||||
fputs_filtered (pretty ? "," : ", ", stream);
|
||||
|
||||
@@ -537,7 +560,7 @@ apply_val_pretty_printer (struct type *t
|
||||
char *hint = NULL;
|
||||
struct cleanup *cleanups;
|
||||
int result = 0;
|
||||
-
|
||||
+ int is_py_none = 0;
|
||||
cleanups = ensure_python_env (gdbarch, language);
|
||||
|
||||
/* Instantiate the printer. */
|
||||
@@ -562,9 +585,11 @@ apply_val_pretty_printer (struct type *t
|
||||
make_cleanup (free_current_contents, &hint);
|
||||
|
||||
/* Print the section */
|
||||
- print_string_repr (printer, hint, stream, recurse, options, language,
|
||||
- gdbarch);
|
||||
- print_children (printer, hint, stream, recurse, options, language);
|
||||
+ is_py_none = print_string_repr (printer, hint, stream, recurse,
|
||||
+ options, language, gdbarch);
|
||||
+ print_children (printer, hint, stream, recurse, options, language,
|
||||
+ is_py_none);
|
||||
+
|
||||
result = 1;
|
||||
|
||||
|
||||
Index: gdb-7.1/gdb/testsuite/gdb.python/py-mi.exp
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/testsuite/gdb.python/py-mi.exp 2010-01-14 09:03:37.000000000 +0100
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.python/py-mi.exp 2010-06-30 03:22:20.000000000 +0200
|
||||
@@ -61,6 +61,16 @@ mi_list_varobj_children container {
|
||||
|
||||
mi_delete_varobj container "delete varobj"
|
||||
|
||||
+mi_create_dynamic_varobj nscont nstype \
|
||||
+ "create nscont varobj, no pretty-printing"
|
||||
+
|
||||
+mi_list_varobj_children nscont {
|
||||
+ { nscont.len len 0 int }
|
||||
+ { nscont.elements elements 1 "int ." }
|
||||
+} "examine nscont children=0, no pretty-printing"
|
||||
+
|
||||
+mi_delete_varobj nscont "delete varobj"
|
||||
+
|
||||
mi_gdb_test "-enable-pretty-printing" ""
|
||||
|
||||
mi_create_varobj_checked string string_1 \
|
||||
@@ -239,4 +249,29 @@ mi_continue_to_line \
|
||||
|
||||
mi_varobj_update_with_type_change container int 0 "update after type change"
|
||||
|
||||
+
|
||||
+mi_continue_to_line \
|
||||
+ [gdb_get_line_number {break to inspect struct and union} ${testfile}.c] \
|
||||
+ "step to outer breakpoint"
|
||||
+
|
||||
+mi_create_dynamic_varobj nscont nstype \
|
||||
+ "create nstype varobj"
|
||||
+
|
||||
+mi_list_varobj_children nscont {
|
||||
+ { {nscont.\[0\]} {\[0\]} 0 int }
|
||||
+ { {nscont.\[1\]} {\[1\]} 0 int }
|
||||
+} "list children after setting update range"
|
||||
+
|
||||
+mi_gdb_test "-var-set-visualizer nscont None" \
|
||||
+ "\\^done" \
|
||||
+ "clear visualizer"
|
||||
+
|
||||
+mi_gdb_test "-var-update nscont" \
|
||||
+ "\\^done,changelist=\\\[\\\]" \
|
||||
+ "varobj update after clearing"
|
||||
+
|
||||
+mi_gdb_test "-var-set-visualizer nscont gdb.default_visualizer" \
|
||||
+ "\\^done" \
|
||||
+ "choose default visualizer"
|
||||
+
|
||||
remote_file host delete ${remote_python_file}
|
||||
Index: gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.c
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/testsuite/gdb.python/py-prettyprint.c 2010-01-14 09:03:37.000000000 +0100
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.c 2010-06-30 03:22:20.000000000 +0200
|
||||
@@ -119,6 +119,15 @@ typedef struct string_repr
|
||||
|
||||
/* This lets us avoid malloc. */
|
||||
int array[100];
|
||||
+int narray[10];
|
||||
+
|
||||
+struct justchildren
|
||||
+{
|
||||
+ int len;
|
||||
+ int *elements;
|
||||
+};
|
||||
+
|
||||
+typedef struct justchildren nostring_type;
|
||||
|
||||
struct container
|
||||
{
|
||||
@@ -196,7 +205,9 @@ main ()
|
||||
const struct string_repr cstring = { { "const string" } };
|
||||
/* Clearing by being `static' could invoke an other GDB C++ bug. */
|
||||
struct nullstr nullstr;
|
||||
-
|
||||
+ nostring_type nstype;
|
||||
+ nstype.elements = narray;
|
||||
+ nstype.len = 0;
|
||||
|
||||
init_ss(&ss, 1, 2);
|
||||
init_ss(ssa+0, 3, 4);
|
||||
@@ -249,5 +260,9 @@ main ()
|
||||
do_nothing ();
|
||||
#endif
|
||||
|
||||
+ nstype.elements[0] = 7;
|
||||
+ nstype.elements[1] = 42;
|
||||
+ nstype.len = 2;
|
||||
+
|
||||
return 0; /* break to inspect struct and union */
|
||||
}
|
||||
Index: gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.exp
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/testsuite/gdb.python/py-prettyprint.exp 2010-06-30 03:22:02.000000000 +0200
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.exp 2010-06-30 03:24:14.000000000 +0200
|
||||
@@ -115,6 +115,7 @@ proc run_lang_tests {lang} {
|
||||
|
||||
gdb_test "print nullstr" "RuntimeError: Error reading string from inferior.*"
|
||||
|
||||
+ gdb_test "print nstype" " = {$nl *.0. = 7,$nl *.1. = 42$nl}"
|
||||
gdb_test "continue" "Program exited normally\."
|
||||
|
||||
remote_file host delete ${remote_python_file}
|
||||
Index: gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.py
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/testsuite/gdb.python/py-prettyprint.py 2010-01-14 09:03:37.000000000 +0100
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.py 2010-06-30 03:22:20.000000000 +0200
|
||||
@@ -53,6 +53,33 @@ class ContainerPrinter:
|
||||
def children(self):
|
||||
return self._iterator(self.val['elements'], self.val['len'])
|
||||
|
||||
+# Test a printer where to_string is None
|
||||
+class NoStringContainerPrinter:
|
||||
+ class _iterator:
|
||||
+ def __init__ (self, pointer, len):
|
||||
+ self.start = pointer
|
||||
+ self.pointer = pointer
|
||||
+ self.end = pointer + len
|
||||
+
|
||||
+ def __iter__(self):
|
||||
+ return self
|
||||
+
|
||||
+ def next(self):
|
||||
+ if self.pointer == self.end:
|
||||
+ raise StopIteration
|
||||
+ result = self.pointer
|
||||
+ self.pointer = self.pointer + 1
|
||||
+ return ('[%d]' % int (result - self.start), result.dereference())
|
||||
+
|
||||
+ def __init__(self, val):
|
||||
+ self.val = val
|
||||
+
|
||||
+ def to_string(self):
|
||||
+ return None
|
||||
+
|
||||
+ def children(self):
|
||||
+ return self._iterator(self.val['elements'], self.val['len'])
|
||||
+
|
||||
class pp_s:
|
||||
def __init__(self, val):
|
||||
self.val = val
|
||||
@@ -190,8 +217,10 @@ def register_pretty_printers ():
|
||||
# both the C and C++ cases.
|
||||
pretty_printers_dict[re.compile ('^struct string_repr$')] = string_print
|
||||
pretty_printers_dict[re.compile ('^struct container$')] = ContainerPrinter
|
||||
+ pretty_printers_dict[re.compile ('^struct justchildren$')] = NoStringContainerPrinter
|
||||
pretty_printers_dict[re.compile ('^string_repr$')] = string_print
|
||||
pretty_printers_dict[re.compile ('^container$')] = ContainerPrinter
|
||||
+ pretty_printers_dict[re.compile ('^justchildren$')] = NoStringContainerPrinter
|
||||
|
||||
pretty_printers_dict[re.compile ('^struct ns$')] = pp_ns
|
||||
pretty_printers_dict[re.compile ('^ns$')] = pp_ns
|
404
gdb-bz562763-pretty-print-2d-vectors.patch
Normal file
404
gdb-bz562763-pretty-print-2d-vectors.patch
Normal file
@ -0,0 +1,404 @@
|
||||
2010-05-31 Chris Moller <cmoller@redhat.com>
|
||||
|
||||
* python/py-prettyprint.c (print_children): Add formatting for
|
||||
matrices. (apply_val_pretty_printer): Detect and deal with matrix
|
||||
hints.
|
||||
|
||||
|
||||
2010-05-31 Chris Moller <cmoller@redhat.com>
|
||||
|
||||
* gdb.python/Makefile.in (EXECUTABLES): Added pr10659.
|
||||
* gdb.python/pr10659.cc: New file.
|
||||
* gdb.python/pr10659.exp. New file.
|
||||
* gdb.python/pr10659.py: New file.
|
||||
|
||||
Index: gdb-7.1/gdb/valprint.h
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/valprint.h 2010-06-30 14:02:16.000000000 +0200
|
||||
+++ gdb-7.1/gdb/valprint.h 2010-06-30 14:35:24.000000000 +0200
|
||||
@@ -90,6 +90,9 @@ struct value_print_options
|
||||
|
||||
/* If nonzero, print the value in "summary" form. */
|
||||
int summary;
|
||||
+
|
||||
+ /* Affects pretty printing of matrices. */
|
||||
+ int prettyprint_matrix;
|
||||
};
|
||||
|
||||
/* The global print options set by the user. In general this should
|
||||
Index: gdb-7.1/gdb/python/py-prettyprint.c
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/python/py-prettyprint.c 2010-06-30 14:01:40.000000000 +0200
|
||||
+++ gdb-7.1/gdb/python/py-prettyprint.c 2010-06-30 14:34:49.000000000 +0200
|
||||
@@ -385,7 +385,8 @@ print_children (PyObject *printer, const
|
||||
|
||||
/* Use the prettyprint_arrays option if we are printing an array,
|
||||
and the pretty option otherwise. */
|
||||
- pretty = is_array ? options->prettyprint_arrays : options->pretty;
|
||||
+ pretty = (is_array || options->prettyprint_matrix) ?
|
||||
+ options->prettyprint_arrays : options->pretty;
|
||||
|
||||
/* Manufacture a dummy Python frame to work around Python 2.4 bug,
|
||||
where it insists on having a non-NULL tstate->frame when
|
||||
@@ -397,6 +398,9 @@ print_children (PyObject *printer, const
|
||||
goto done;
|
||||
}
|
||||
make_cleanup_py_decref (frame);
|
||||
+
|
||||
+ if (options->prettyprint_matrix && recurse == 0)
|
||||
+ fputs_filtered ("\n", stream);
|
||||
|
||||
done_flag = 0;
|
||||
for (i = 0; i < options->print_max; ++i)
|
||||
@@ -431,12 +435,23 @@ print_children (PyObject *printer, const
|
||||
3. Other. Always print a ",". */
|
||||
if (i == 0)
|
||||
{
|
||||
- if (is_py_none)
|
||||
- fputs_filtered ("{", stream);
|
||||
- else
|
||||
- fputs_filtered (" = {", stream);
|
||||
+ if (options->prettyprint_matrix && recurse == 0)
|
||||
+ print_spaces_filtered (2 + 2 * recurse, stream);
|
||||
+ if (is_py_none)
|
||||
+ {
|
||||
+ if (options->prettyprint_matrix && strcmp (hint, "array"))
|
||||
+ {
|
||||
+ fputs_filtered ("{\n", stream);
|
||||
+ print_spaces_filtered (4 + 2 * recurse, stream);
|
||||
+ }
|
||||
+ else
|
||||
+ fputs_filtered ("{", stream);
|
||||
+ }
|
||||
+ else
|
||||
+ fputs_filtered (" = {", stream);
|
||||
}
|
||||
-
|
||||
+ else if (options->prettyprint_matrix)
|
||||
+ print_spaces_filtered (4 + 2 * recurse, stream);
|
||||
else if (! is_map || i % 2 == 0)
|
||||
fputs_filtered (pretty ? "," : ", ", stream);
|
||||
|
||||
@@ -465,6 +480,10 @@ print_children (PyObject *printer, const
|
||||
|
||||
if (is_map && i % 2 == 0)
|
||||
fputs_filtered ("[", stream);
|
||||
+ else if (options->prettyprint_matrix)
|
||||
+ {
|
||||
+ /* Force a do-nothing. */
|
||||
+ }
|
||||
else if (is_array)
|
||||
{
|
||||
/* We print the index, not whatever the child method
|
||||
@@ -539,7 +558,12 @@ print_children (PyObject *printer, const
|
||||
fputs_filtered ("\n", stream);
|
||||
print_spaces_filtered (2 * recurse, stream);
|
||||
}
|
||||
- fputs_filtered ("}", stream);
|
||||
+ if (options->prettyprint_matrix)
|
||||
+ {
|
||||
+ print_spaces_filtered (4 * recurse, stream);
|
||||
+ fputs_filtered ("}\n", stream);
|
||||
+ }
|
||||
+ else fputs_filtered ("}", stream);
|
||||
}
|
||||
|
||||
done:
|
||||
@@ -561,6 +585,7 @@ apply_val_pretty_printer (struct type *t
|
||||
struct cleanup *cleanups;
|
||||
int result = 0;
|
||||
int is_py_none = 0;
|
||||
+ struct value_print_options *options_copy;
|
||||
cleanups = ensure_python_env (gdbarch, language);
|
||||
|
||||
/* Instantiate the printer. */
|
||||
@@ -582,12 +607,23 @@ apply_val_pretty_printer (struct type *t
|
||||
|
||||
/* If we are printing a map, we want some special formatting. */
|
||||
hint = gdbpy_get_display_hint (printer);
|
||||
+
|
||||
+ if (recurse == 0)
|
||||
+ {
|
||||
+ options_copy = alloca (sizeof (struct value_print_options));
|
||||
+ memcpy (options_copy, options, sizeof (struct value_print_options));
|
||||
+ options_copy->prettyprint_matrix = hint && !strcmp (hint, "matrix");
|
||||
+ }
|
||||
+ else options_copy = (struct value_print_options *)options;
|
||||
+
|
||||
make_cleanup (free_current_contents, &hint);
|
||||
|
||||
/* Print the section */
|
||||
- is_py_none = print_string_repr (printer, hint, stream, recurse,
|
||||
- options, language, gdbarch);
|
||||
- print_children (printer, hint, stream, recurse, options, language,
|
||||
+ is_py_none = options_copy->prettyprint_matrix ?
|
||||
+ 1 : print_string_repr (printer, hint, stream,
|
||||
+ recurse, options_copy,
|
||||
+ language, gdbarch);
|
||||
+ print_children (printer, hint, stream, recurse, options_copy, language,
|
||||
is_py_none);
|
||||
|
||||
result = 1;
|
||||
Index: gdb-7.1/gdb/testsuite/gdb.python/pr10659.cc
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.python/pr10659.cc 2010-06-30 14:34:49.000000000 +0200
|
||||
@@ -0,0 +1,43 @@
|
||||
+#include <list>
|
||||
+#include <vector> // /usr/include/c++/4.4.1/bits/vector.tcc
|
||||
+#include <iostream>
|
||||
+
|
||||
+using namespace std;
|
||||
+
|
||||
+int use_windows = 9999;
|
||||
+
|
||||
+int
|
||||
+main(){
|
||||
+ vector<int> test1(2,0);
|
||||
+ test1[0]=8;
|
||||
+ test1[1]=9;
|
||||
+
|
||||
+ vector< vector<int> > test2(3, vector<int>(2,0));
|
||||
+ test2[0][0]=0;
|
||||
+ test2[0][1]=1;
|
||||
+ test2[1][0]=2;
|
||||
+ test2[1][1]=3;
|
||||
+ test2[2][0]=4;
|
||||
+ test2[2][1]=5;
|
||||
+
|
||||
+#define NR_ROWS 2
|
||||
+#define NR_COLS 3
|
||||
+#define NR_PLANES 4
|
||||
+ vector<int> rows(NR_ROWS, 0);
|
||||
+ vector< vector<int> > columns(NR_COLS, rows);
|
||||
+ vector< vector < vector<int> > > test3(NR_PLANES, columns);
|
||||
+
|
||||
+ cout << "rows.size() = " << rows.size()
|
||||
+ << ", columns.size() = " << columns.size()
|
||||
+ << ", test3.size() = " << test3.size() << "\n";
|
||||
+
|
||||
+ for (int i = 0; i < rows.size(); i++) {
|
||||
+ for (int j = 0; j < columns.size(); j++) {
|
||||
+ for (int k = 0; k < test3.size(); k++) {
|
||||
+ test3[k][j][i] = k * 100 + j * 10 + i;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0; // break
|
||||
+}
|
||||
Index: gdb-7.1/gdb/testsuite/gdb.python/pr10659.exp
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.python/pr10659.exp 2010-06-30 14:34:49.000000000 +0200
|
||||
@@ -0,0 +1,82 @@
|
||||
+#Copyright 2010 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/>.
|
||||
+
|
||||
+set nl "\[\r\n\]+"
|
||||
+
|
||||
+set testfile pr10659
|
||||
+set srcfile ${testfile}.cc
|
||||
+if [prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+#if { [skip_python_tests] } { continue }
|
||||
+
|
||||
+gdb_test "python execfile(\"$srcdir/$subdir/pr10659.py\")" ""
|
||||
+gdb_test "python gdb.pretty_printers = \[lookup_function\]" ""
|
||||
+
|
||||
+if ![runto_main] then {
|
||||
+ fail "Can't run to main"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+gdb_breakpoint [gdb_get_line_number "break"]
|
||||
+gdb_continue_to_breakpoint "break"
|
||||
+
|
||||
+gdb_test "p test1" "vector of length 2, capacity 2 =.*"
|
||||
+
|
||||
+gdb_test "p test2" "= $nl {$nl {.*"
|
||||
+
|
||||
+# Complete result is:
|
||||
+#
|
||||
+# (gdb) p test2
|
||||
+# $2 =
|
||||
+# {
|
||||
+# {0 1 }
|
||||
+# {2 3 }
|
||||
+# {4 5 }
|
||||
+# }
|
||||
+
|
||||
+
|
||||
+gdb_test "p test3" "= $nl {$nl {$nl {.*"
|
||||
+
|
||||
+# Complete result is:
|
||||
+#
|
||||
+# (gdb) p test3
|
||||
+# $3 =
|
||||
+# {
|
||||
+# {
|
||||
+# {0 1 }
|
||||
+# {10 11 }
|
||||
+# {20 21 }
|
||||
+# }
|
||||
+# {
|
||||
+# {100 101 }
|
||||
+# {110 111 }
|
||||
+# {120 121 }
|
||||
+# }
|
||||
+# {
|
||||
+# {200 201 }
|
||||
+# {210 211 }
|
||||
+# {220 221 }
|
||||
+# }
|
||||
+# {
|
||||
+# {300 301 }
|
||||
+# {310 311 }
|
||||
+# {320 321 }
|
||||
+# }
|
||||
+# }
|
||||
+#
|
||||
+
|
||||
+
|
||||
Index: gdb-7.1/gdb/testsuite/gdb.python/pr10659.py
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.python/pr10659.py 2010-06-30 14:34:49.000000000 +0200
|
||||
@@ -0,0 +1,109 @@
|
||||
+# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 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/>.
|
||||
+
|
||||
+import gdb
|
||||
+import itertools
|
||||
+import re
|
||||
+
|
||||
+vector_sig = 'std::vector'
|
||||
+vector_regex = re.compile('^' + vector_sig + '<.*>$')
|
||||
+
|
||||
+class FakeVectorPrinter:
|
||||
+ "Print a std::vector"
|
||||
+
|
||||
+ class _iterator:
|
||||
+ def __init__ (self, start, finish):
|
||||
+ self.item = start
|
||||
+ self.finish = finish
|
||||
+ self.count = 0
|
||||
+
|
||||
+ def __iter__(self):
|
||||
+ return self
|
||||
+
|
||||
+ def next(self):
|
||||
+ if self.item == self.finish:
|
||||
+ raise StopIteration
|
||||
+ count = self.count
|
||||
+ self.count = self.count + 1
|
||||
+ elt = self.item.dereference()
|
||||
+ self.item = self.item + 1
|
||||
+ return ('[%d]' % count, elt)
|
||||
+
|
||||
+ def __init__(self, typename, val):
|
||||
+ self.typename = typename
|
||||
+ self.val = val
|
||||
+
|
||||
+ def children(self):
|
||||
+ return self._iterator(self.val['_M_impl']['_M_start'],
|
||||
+ self.val['_M_impl']['_M_finish'])
|
||||
+
|
||||
+ def to_string(self):
|
||||
+ start = self.val['_M_impl']['_M_start']
|
||||
+ finish = self.val['_M_impl']['_M_finish']
|
||||
+ end = self.val['_M_impl']['_M_end_of_storage']
|
||||
+ return ('std::vector of length %d, capacity %d'
|
||||
+ % (int (finish - start), int (end - start)))
|
||||
+
|
||||
+ def display_hint(self):
|
||||
+ itype0 = self.val.type.template_argument(0)
|
||||
+ itag = itype0.tag
|
||||
+ if itag and re.match(vector_regex, itag):
|
||||
+ rc = 'matrix'
|
||||
+ else:
|
||||
+ rc = 'array'
|
||||
+ return rc
|
||||
+
|
||||
+def register_libstdcxx_printers (obj):
|
||||
+ "Register libstdc++ pretty-printers with objfile Obj."
|
||||
+
|
||||
+ if obj == None:
|
||||
+ obj = gdb
|
||||
+
|
||||
+ obj.pretty_printers.append (lookup_function)
|
||||
+
|
||||
+def lookup_function (val):
|
||||
+ "Look-up and return a pretty-printer that can print val."
|
||||
+
|
||||
+ # Get the type.
|
||||
+ type = val.type;
|
||||
+
|
||||
+ # If it points to a reference, get the reference.
|
||||
+ if type.code == gdb.TYPE_CODE_REF:
|
||||
+ type = type.target ()
|
||||
+
|
||||
+ # Get the unqualified type, stripped of typedefs.
|
||||
+ type = type.unqualified ().strip_typedefs ()
|
||||
+
|
||||
+ # Get the type name.
|
||||
+ typename = type.tag
|
||||
+ if typename == None:
|
||||
+ return None
|
||||
+
|
||||
+ # Iterate over local dictionary of types to determine
|
||||
+ # if a printer is registered for that type. Return an
|
||||
+ # instantiation of the printer if found.
|
||||
+ for function in fake_pretty_printers_dict:
|
||||
+ if function.search (typename):
|
||||
+ return fake_pretty_printers_dict[function] (val)
|
||||
+
|
||||
+ # Cannot find a pretty printer. Return None.
|
||||
+ return None
|
||||
+
|
||||
+def build_libfakecxx_dictionary ():
|
||||
+ fake_pretty_printers_dict[vector_regex] = lambda val: FakeVectorPrinter(vector_sig, val)
|
||||
+
|
||||
+fake_pretty_printers_dict = {}
|
||||
+
|
||||
+build_libfakecxx_dictionary ()
|
||||
Index: gdb-7.1/gdb/valprint.c
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/valprint.c 2010-06-30 13:51:26.000000000 +0200
|
||||
+++ gdb-7.1/gdb/valprint.c 2010-06-30 14:35:41.000000000 +0200
|
||||
@@ -83,7 +83,8 @@ struct value_print_options user_print_op
|
||||
1, /* static_field_print */
|
||||
1, /* pascal_static_field_print */
|
||||
0, /* raw */
|
||||
- 0 /* summary */
|
||||
+ 0, /* summary */
|
||||
+ 0 /* prettyprint_matrix */
|
||||
};
|
||||
|
||||
/* Initialize *OPTS to be a copy of the user print options. */
|
159
gdb-bz562975-std-terminate-double-free.patch
Normal file
159
gdb-bz562975-std-terminate-double-free.patch
Normal file
@ -0,0 +1,159 @@
|
||||
http://sourceware.org/ml/gdb-patches/2010-02/msg00625.html
|
||||
Subject: RFC: fix bug with std::terminate handler
|
||||
|
||||
I would appreciate comments on this patch.
|
||||
|
||||
This comes from an automatically-reported bug in the Red Hat bugzilla:
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=562975
|
||||
|
||||
call_function_by_hand installs a momentary breakpoint on std::terminate,
|
||||
and then deletes it later. However, this can cause a double deletion of
|
||||
the breakpoint. In the bug, the called function is dlopen, which causes
|
||||
gdb to enter solib_add, which calls breakpoint_re_set, deleting the
|
||||
momentary breakpoint.
|
||||
|
||||
This fix works by creating the momentary breakpoint with an internal
|
||||
breakpoint number, and then trying to delete the breakpoint by number.
|
||||
|
||||
This bug does not always manifest in a crash. In fact, I couldn't make
|
||||
it crash here, but I could observe the problem under valgrind.
|
||||
|
||||
Built and regtested on x86-64 (compile farm). I also manually verified
|
||||
it using valgrind.
|
||||
|
||||
I think this patch is mildly ugly, due to the introduction of
|
||||
set_momentary_breakpoint_at_pc_with_number. However, in the absence of
|
||||
comments, I plan to check it in after a reasonable waiting period.
|
||||
|
||||
Tom
|
||||
|
||||
2010-02-25 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* infcall.c (do_delete_breakpoint_by_number): New function.
|
||||
(call_function_by_hand): Refer to momentary breakpoint by number.
|
||||
* breakpoint.h (set_momentary_breakpoint_at_pc_with_number):
|
||||
Declare.
|
||||
* breakpoint.c (set_momentary_breakpoint_at_pc_with_number): New
|
||||
function.
|
||||
|
||||
Index: gdb-7.0.90.20100312/gdb/breakpoint.c
|
||||
===================================================================
|
||||
--- gdb-7.0.90.20100312.orig/gdb/breakpoint.c 2010-03-12 14:54:26.000000000 +0100
|
||||
+++ gdb-7.0.90.20100312/gdb/breakpoint.c 2010-03-12 14:54:53.000000000 +0100
|
||||
@@ -6115,6 +6115,20 @@ set_momentary_breakpoint_at_pc (struct g
|
||||
|
||||
return set_momentary_breakpoint (gdbarch, sal, null_frame_id, type);
|
||||
}
|
||||
+
|
||||
+/* Like set_momentary_breakpoint_at_pc, but ensure that the new
|
||||
+ breakpoint has a number. */
|
||||
+
|
||||
+struct breakpoint *
|
||||
+set_momentary_breakpoint_at_pc_with_number (struct gdbarch *gdbarch,
|
||||
+ CORE_ADDR pc,
|
||||
+ enum bptype type)
|
||||
+{
|
||||
+ struct breakpoint *result = set_momentary_breakpoint_at_pc (gdbarch, pc,
|
||||
+ type);
|
||||
+ result->number = internal_breakpoint_number--;
|
||||
+ return result;
|
||||
+}
|
||||
|
||||
|
||||
/* Tell the user we have just set a breakpoint B. */
|
||||
Index: gdb-7.0.90.20100312/gdb/breakpoint.h
|
||||
===================================================================
|
||||
--- gdb-7.0.90.20100312.orig/gdb/breakpoint.h 2010-03-12 14:54:26.000000000 +0100
|
||||
+++ gdb-7.0.90.20100312/gdb/breakpoint.h 2010-03-12 14:54:53.000000000 +0100
|
||||
@@ -774,6 +774,9 @@ extern struct breakpoint *set_momentary_
|
||||
extern struct breakpoint *set_momentary_breakpoint_at_pc
|
||||
(struct gdbarch *, CORE_ADDR pc, enum bptype type);
|
||||
|
||||
+extern struct breakpoint *set_momentary_breakpoint_at_pc_with_number
|
||||
+ (struct gdbarch *, CORE_ADDR pc, enum bptype type);
|
||||
+
|
||||
extern struct breakpoint *clone_momentary_breakpoint (struct breakpoint *bpkt);
|
||||
|
||||
extern void set_ignore_count (int, int, int);
|
||||
Index: gdb-7.0.90.20100312/gdb/infcall.c
|
||||
===================================================================
|
||||
--- gdb-7.0.90.20100312.orig/gdb/infcall.c 2010-03-12 14:54:26.000000000 +0100
|
||||
+++ gdb-7.0.90.20100312/gdb/infcall.c 2010-03-12 14:55:19.000000000 +0100
|
||||
@@ -410,6 +410,18 @@ run_inferior_call (struct thread_info *c
|
||||
return e;
|
||||
}
|
||||
|
||||
+/* A cleanup function that deletes a breakpoint, if it still exists,
|
||||
+ given the breakpoint's number. */
|
||||
+
|
||||
+static void
|
||||
+do_delete_breakpoint_by_number (void *arg)
|
||||
+{
|
||||
+ int *num = arg;
|
||||
+ struct breakpoint *bp = get_breakpoint (*num);
|
||||
+ if (bp)
|
||||
+ delete_breakpoint (bp);
|
||||
+}
|
||||
+
|
||||
/* All this stuff with a dummy frame may seem unnecessarily complicated
|
||||
(why not just save registers in GDB?). The purpose of pushing a dummy
|
||||
frame which looks just like a real frame is so that if you call a
|
||||
@@ -447,7 +459,8 @@ call_function_by_hand (struct value *fun
|
||||
struct cleanup *args_cleanup;
|
||||
struct frame_info *frame;
|
||||
struct gdbarch *gdbarch;
|
||||
- struct breakpoint *terminate_bp = NULL;
|
||||
+ int terminate_bp_num = 0;
|
||||
+ CORE_ADDR terminate_bp_addr = 0;
|
||||
struct minimal_symbol *tm;
|
||||
struct cleanup *terminate_bp_cleanup = NULL;
|
||||
ptid_t call_thread_ptid;
|
||||
@@ -765,8 +778,13 @@ call_function_by_hand (struct value *fun
|
||||
struct minimal_symbol *tm = lookup_minimal_symbol ("std::terminate()",
|
||||
NULL, NULL);
|
||||
if (tm != NULL)
|
||||
- terminate_bp = set_momentary_breakpoint_at_pc
|
||||
+ {
|
||||
+ struct breakpoint *bp;
|
||||
+ bp = set_momentary_breakpoint_at_pc_with_number
|
||||
(gdbarch, SYMBOL_VALUE_ADDRESS (tm), bp_breakpoint);
|
||||
+ terminate_bp_num = bp->number;
|
||||
+ terminate_bp_addr = bp->loc->address;
|
||||
+ }
|
||||
}
|
||||
|
||||
/* Everything's ready, push all the info needed to restore the
|
||||
@@ -780,8 +798,9 @@ call_function_by_hand (struct value *fun
|
||||
discard_cleanups (inf_status_cleanup);
|
||||
|
||||
/* Register a clean-up for unwind_on_terminating_exception_breakpoint. */
|
||||
- if (terminate_bp)
|
||||
- terminate_bp_cleanup = make_cleanup_delete_breakpoint (terminate_bp);
|
||||
+ if (terminate_bp_num != 0)
|
||||
+ terminate_bp_cleanup = make_cleanup (do_delete_breakpoint_by_number,
|
||||
+ &terminate_bp_num);
|
||||
|
||||
/* - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP -
|
||||
If you're looking to implement asynchronous dummy-frames, then
|
||||
@@ -947,9 +966,9 @@ When the function is done executing, GDB
|
||||
in an inferior function call. Rewind, and warn the
|
||||
user. */
|
||||
|
||||
- if (terminate_bp != NULL
|
||||
+ if (terminate_bp_num != 0
|
||||
&& (inferior_thread ()->stop_bpstat->breakpoint_at->address
|
||||
- == terminate_bp->loc->address))
|
||||
+ == terminate_bp_addr))
|
||||
{
|
||||
/* We must get back to the frame we were before the
|
||||
dummy call. */
|
||||
@@ -998,7 +1017,7 @@ When the function is done executing, GDB
|
||||
|
||||
/* If we get here and the std::terminate() breakpoint has been set,
|
||||
it has to be cleaned manually. */
|
||||
- if (terminate_bp)
|
||||
+ if (terminate_bp_num != 0)
|
||||
do_cleanups (terminate_bp_cleanup);
|
||||
|
||||
/* If we get here the called FUNCTION ran to completion,
|
40
gdb-bz570635-prettyprint-doc1.patch
Normal file
40
gdb-bz570635-prettyprint-doc1.patch
Normal file
@ -0,0 +1,40 @@
|
||||
RFA: update `print' docs
|
||||
http://sourceware.org/ml/gdb-patches/2010-03/msg00236.html
|
||||
http://sourceware.org/ml/gdb-cvs/2010-03/msg00048.html
|
||||
|
||||
### src/gdb/doc/ChangeLog 2010/03/01 17:19:22 1.1017
|
||||
### src/gdb/doc/ChangeLog 2010/03/05 20:01:21 1.1018
|
||||
## -1,3 +1,8 @@
|
||||
+2010-03-05 Tom Tromey <tromey@redhat.com>
|
||||
+
|
||||
+ * gdb.texinfo (Data): Link to pretty-printing.
|
||||
+ (Output Formats): Likewise. Correct text.
|
||||
+
|
||||
2010-03-01 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* gdb.texinfo (Types): Describe <struct> and <flags>.
|
||||
--- src/gdb/doc/gdb.texinfo 2010/03/01 17:19:22 1.676
|
||||
+++ src/gdb/doc/gdb.texinfo 2010/03/05 20:01:21 1.677
|
||||
@@ -6661,7 +6661,8 @@
|
||||
command (abbreviated @code{p}), or its synonym @code{inspect}. It
|
||||
evaluates and prints the value of an expression of the language your
|
||||
program is written in (@pxref{Languages, ,Using @value{GDBN} with
|
||||
-Different Languages}).
|
||||
+Different Languages}). It may also print the expression using a
|
||||
+Python-based pretty-printer (@pxref{Pretty Printing}).
|
||||
|
||||
@table @code
|
||||
@item print @var{expr}
|
||||
@@ -7159,8 +7160,10 @@
|
||||
@item r
|
||||
@cindex raw printing
|
||||
Print using the @samp{raw} formatting. By default, @value{GDBN} will
|
||||
-use a type-specific pretty-printer. The @samp{r} format bypasses any
|
||||
-pretty-printer which might exist for the value's type.
|
||||
+use a Python-based pretty-printer, if one is available (@pxref{Pretty
|
||||
+Printing}). This typically results in a higher-level display of the
|
||||
+value's contents. The @samp{r} format bypasses any Python
|
||||
+pretty-printer which might exist.
|
||||
@end table
|
||||
|
||||
For example, to print the program counter in hex (@pxref{Registers}), type
|
182
gdb-bz570635-prettyprint-doc2.patch
Normal file
182
gdb-bz570635-prettyprint-doc2.patch
Normal file
@ -0,0 +1,182 @@
|
||||
Re: [patch] doc-python: Pretty Printing split user / developer
|
||||
http://sourceware.org/ml/gdb-patches/2010-04/msg00757.html
|
||||
http://sourceware.org/ml/gdb-cvs/2010-04/msg00221.html
|
||||
|
||||
[ Backported for Fedora. ]
|
||||
|
||||
### src/gdb/doc/ChangeLog 2010/04/22 04:09:25 1.1053
|
||||
### src/gdb/doc/ChangeLog 2010/04/22 16:32:43 1.1054
|
||||
## -1,3 +1,14 @@
|
||||
+2010-04-22 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ * gdb.texinfo (Data): New @menu reference to Pretty Printing.
|
||||
+ (Python API): Change the reference to Pretty Printing API.
|
||||
+ (Pretty Printing): Move the user part under the Data node. Reformat
|
||||
+ the sample output to 72 columns. Create a new reference to Pretty
|
||||
+ Printing API. Rename the API part ...
|
||||
+ (Pretty Printing API): To a new node name.
|
||||
+ (Selecting Pretty-Printers, Progspaces In Python, Objfiles In Python)
|
||||
+ (GDB/MI Variable Objects): Change references to Pretty Printing API.
|
||||
+
|
||||
2010-04-21 Stan Shebs <stan@codesourcery.com>
|
||||
|
||||
* gdb.texinfo (Tracepoint Actions): Mention synonymy of actions
|
||||
--- gdb-7.1/gdb/doc/gdb.texinfo.orig 2010-04-22 19:08:30.000000000 +0200
|
||||
+++ gdb-7.1/gdb/doc/gdb.texinfo 2010-04-22 19:10:41.000000000 +0200
|
||||
@@ -6727,6 +6727,7 @@ Table}.
|
||||
* Memory:: Examining memory
|
||||
* Auto Display:: Automatic display
|
||||
* Print Settings:: Print settings
|
||||
+* Pretty Printing:: Python pretty printing
|
||||
* Value History:: Value history
|
||||
* Convenience Vars:: Convenience variables
|
||||
* Registers:: Registers
|
||||
@@ -7897,6 +7898,42 @@ Do not pretty print C@t{++} virtual func
|
||||
Show whether C@t{++} virtual function tables are pretty printed, or not.
|
||||
@end table
|
||||
|
||||
+@node Pretty Printing
|
||||
+@section Pretty Printing
|
||||
+
|
||||
+@value{GDBN} provides a mechanism to allow pretty-printing of values using
|
||||
+Python code. It greatly simplifies the display of complex objects. This
|
||||
+mechanism works for both MI and the CLI.
|
||||
+
|
||||
+For example, here is how a C@t{++} @code{std::string} looks without a
|
||||
+pretty-printer:
|
||||
+
|
||||
+@smallexample
|
||||
+(@value{GDBP}) print s
|
||||
+$1 = @{
|
||||
+ static npos = 4294967295,
|
||||
+ _M_dataplus = @{
|
||||
+ <std::allocator<char>> = @{
|
||||
+ <__gnu_cxx::new_allocator<char>> = @{
|
||||
+ <No data fields>@}, <No data fields>
|
||||
+ @},
|
||||
+ members of std::basic_string<char, std::char_traits<char>,
|
||||
+ std::allocator<char> >::_Alloc_hider:
|
||||
+ _M_p = 0x804a014 "abcd"
|
||||
+ @}
|
||||
+@}
|
||||
+@end smallexample
|
||||
+
|
||||
+With a pretty-printer for @code{std::string} only the contents are printed:
|
||||
+
|
||||
+@smallexample
|
||||
+(@value{GDBP}) print s
|
||||
+$2 = "abcd"
|
||||
+@end smallexample
|
||||
+
|
||||
+For implementing pretty printers for new types you should read the Python API
|
||||
+details (@pxref{Pretty Printing API}).
|
||||
+
|
||||
@node Value History
|
||||
@section Value History
|
||||
|
||||
@@ -19608,8 +19645,8 @@ situation, a Python @code{KeyboardInterr
|
||||
* Exception Handling::
|
||||
* Auto-loading:: Automatically loading Python code.
|
||||
* Values From Inferior:: Python representation of values.
|
||||
-* Types In Python:: Python representation of types.
|
||||
-* Pretty Printing:: Pretty-printing values.
|
||||
+* Types In Python:: Python representation of types.
|
||||
+* Pretty Printing API:: Pretty-printing values.
|
||||
* Selecting Pretty-Printers:: How GDB chooses a pretty-printer.
|
||||
* Inferiors In Python:: Python representation of inferiors (processes)
|
||||
* Threads In Python:: Accessing inferior threads from Python.
|
||||
@@ -20241,37 +20278,10 @@ A function internal to @value{GDBN}. Th
|
||||
convenience functions.
|
||||
@end table
|
||||
|
||||
-@node Pretty Printing
|
||||
-@subsubsection Pretty Printing
|
||||
-
|
||||
-@value{GDBN} provides a mechanism to allow pretty-printing of values
|
||||
-using Python code. The pretty-printer API allows application-specific
|
||||
-code to greatly simplify the display of complex objects. This
|
||||
-mechanism works for both MI and the CLI.
|
||||
-
|
||||
-For example, here is how a C@t{++} @code{std::string} looks without a
|
||||
-pretty-printer:
|
||||
+@node Pretty Printing API
|
||||
+@subsubsection Pretty Printing API
|
||||
|
||||
-@smallexample
|
||||
-(@value{GDBP}) print s
|
||||
-$1 = @{
|
||||
- static npos = 4294967295,
|
||||
- _M_dataplus = @{
|
||||
- <std::allocator<char>> = @{
|
||||
- <__gnu_cxx::new_allocator<char>> = @{<No data fields>@}, <No data fields>@},
|
||||
- members of std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider:
|
||||
- _M_p = 0x804a014 "abcd"
|
||||
- @}
|
||||
-@}
|
||||
-@end smallexample
|
||||
-
|
||||
-After a pretty-printer for @code{std::string} has been installed, only
|
||||
-the contents are printed:
|
||||
-
|
||||
-@smallexample
|
||||
-(@value{GDBP}) print s
|
||||
-$2 = "abcd"
|
||||
-@end smallexample
|
||||
+An example output is provided (@pxref{Pretty Printing}).
|
||||
|
||||
A pretty-printer is just an object that holds a value and implements a
|
||||
specific interface, defined here.
|
||||
@@ -20359,7 +20369,7 @@ attribute.
|
||||
|
||||
A function on one of these lists is passed a single @code{gdb.Value}
|
||||
argument and should return a pretty-printer object conforming to the
|
||||
-interface definition above (@pxref{Pretty Printing}). If a function
|
||||
+interface definition above (@pxref{Pretty Printing API}). If a function
|
||||
cannot create a pretty-printer for the value, it should return
|
||||
@code{None}.
|
||||
|
||||
@@ -20436,7 +20446,7 @@ printers with a specific objfile, @value
|
||||
printers for the specific version of the library used by each
|
||||
inferior.
|
||||
|
||||
-To continue the @code{std::string} example (@pxref{Pretty Printing}),
|
||||
+To continue the @code{std::string} example (@pxref{Pretty Printing API}),
|
||||
this code might appear in @code{gdb.libstdcxx.v6}:
|
||||
|
||||
@smallexample
|
||||
@@ -21048,7 +21058,7 @@ The @code{pretty_printers} attribute is
|
||||
used to look up pretty-printers. A @code{Value} is passed to each
|
||||
function in order; if the function returns @code{None}, then the
|
||||
search continues. Otherwise, the return value should be an object
|
||||
-which is used to format the value. @xref{Pretty Printing}, for more
|
||||
+which is used to format the value. @xref{Pretty Printing API}, for more
|
||||
information.
|
||||
@end defivar
|
||||
|
||||
@@ -24875,7 +24885,7 @@ then this attribute will not be present.
|
||||
@item displayhint
|
||||
A dynamic varobj can supply a display hint to the front end. The
|
||||
value comes directly from the Python pretty-printer object's
|
||||
-@code{display_hint} method. @xref{Pretty Printing}.
|
||||
+@code{display_hint} method. @xref{Pretty Printing API}.
|
||||
@end table
|
||||
|
||||
Typical output will look like this:
|
||||
@@ -25047,7 +25057,7 @@ The result may have its own attributes:
|
||||
@item displayhint
|
||||
A dynamic varobj can supply a display hint to the front end. The
|
||||
value comes directly from the Python pretty-printer object's
|
||||
-@code{display_hint} method. @xref{Pretty Printing}.
|
||||
+@code{display_hint} method. @xref{Pretty Printing API}.
|
||||
|
||||
@item has_more
|
||||
This is an integer attribute which is nonzero if there are children
|
||||
@@ -25411,7 +25421,7 @@ single argument. @value{GDBN} will call
|
||||
the varobj @var{name} as an argument (this is done so that the same
|
||||
Python pretty-printing code can be used for both the CLI and MI).
|
||||
When called, this object must return an object which conforms to the
|
||||
-pretty-printing interface (@pxref{Pretty Printing}).
|
||||
+pretty-printing interface (@pxref{Pretty Printing API}).
|
||||
|
||||
The pre-defined function @code{gdb.default_visualizer} may be used to
|
||||
select a visualizer by following the built-in process
|
73
gdb-bz574483-display-sepdebug.patch
Normal file
73
gdb-bz574483-display-sepdebug.patch
Normal file
@ -0,0 +1,73 @@
|
||||
http://sourceware.org/ml/gdb-patches/2010-04/msg00055.html
|
||||
Subject: [patch] Fix dangling displays in separate debug
|
||||
|
||||
[ Backported. ]
|
||||
|
||||
Hi,
|
||||
|
||||
gdb.base/solib-display.exp using _separate_ debug info:
|
||||
3: c_global = gdbtypes.c:1369: internal-error: check_typedef: Assertion `type' failed.
|
||||
A problem internal to GDB has been detected,
|
||||
|
||||
This problem was fixed before by:
|
||||
[patch 1/8] Types GC [unloading observer]
|
||||
http://sourceware.org/ml/gdb-patches/2009-05/msg00544.html
|
||||
Re: [patch 3/8] Types GC [display_uses_solib_p to exp_iterate]
|
||||
http://sourceware.org/ml/gdb-patches/2009-07/msg00054.html
|
||||
|
||||
but as that patchset is still not in providing this temporary fixup instead.
|
||||
|
||||
One may only address that gdb.base/solib-display.exp was testing symbol
|
||||
in-objfile while now it tests only symbol in-sepdebug-objfile and no longer
|
||||
the in-objfile case. I find the in-sepdebug-objfile as a superset of
|
||||
in-objfile test but I can rework it if anyones addresses this test change.
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2010-04-03 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* printcmd.c (display_uses_solib_p): Check also
|
||||
SEPARATE_DEBUG_OBJFILE.
|
||||
|
||||
gdb/testsuite/
|
||||
2010-04-03 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/solib-display.exp (split solib): New.
|
||||
|
||||
--- a/gdb/printcmd.c
|
||||
+++ b/gdb/printcmd.c
|
||||
@@ -1845,7 +1845,10 @@ clear_dangling_display_expressions (stru
|
||||
|
||||
for (d = display_chain; d != NULL; d = d->next)
|
||||
if (block_objfile (d->block) == objfile
|
||||
- || (d->exp && exp_uses_objfile (d->exp, objfile)))
|
||||
+ || (d->exp && exp_uses_objfile (d->exp, objfile))
|
||||
+ || (objfile->separate_debug_objfile
|
||||
+ && (block_objfile (d->block) == objfile->separate_debug_objfile
|
||||
+ || (d->exp && exp_uses_objfile (d->exp, objfile->separate_debug_objfile)))))
|
||||
{
|
||||
xfree (d->exp);
|
||||
d->exp = NULL;
|
||||
--- a/gdb/testsuite/gdb.base/solib-display.exp
|
||||
+++ b/gdb/testsuite/gdb.base/solib-display.exp
|
||||
@@ -53,6 +53,13 @@ if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
|
||||
return -1
|
||||
}
|
||||
|
||||
+set test "split solib"
|
||||
+if {[gdb_gnu_strip_debug $binfile_lib] != 0} {
|
||||
+ fail $test
|
||||
+} else {
|
||||
+ pass $test
|
||||
+}
|
||||
+
|
||||
gdb_exit
|
||||
gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
|
624
gdb-bz575292-delayed-physname.patch
Normal file
624
gdb-bz575292-delayed-physname.patch
Normal file
@ -0,0 +1,624 @@
|
||||
Made more safe (but less effective) by using a linked list.
|
||||
|
||||
Based on:
|
||||
Re: [RFA] Delayed physname computation
|
||||
http://sourceware.org/ml/gdb-patches/2010-05/msg00248.html
|
||||
|
||||
Neither its obstack-leak.patch nor
|
||||
[patch] Fix duplicate types for single DIE
|
||||
http://sourceware.org/ml/gdb-patches/2010-05/msg00271.html
|
||||
is needed as the linked list is used instead.
|
||||
|
||||
--- ./gdb/dwarf2read.c 2010-05-13 18:26:22.000000000 +0200
|
||||
+++ ./gdb/dwarf2read.c 2010-05-13 18:45:04.000000000 +0200
|
||||
@@ -251,6 +251,28 @@ struct comp_unit_head
|
||||
unsigned int first_die_offset;
|
||||
};
|
||||
|
||||
+/* Type used for delaying computation of method physnames.
|
||||
+ See comments for compute_delayed_physnames. */
|
||||
+struct delayed_method_info
|
||||
+{
|
||||
+ struct delayed_method_info *next;
|
||||
+
|
||||
+ /* The type to which the method is attached, i.e., its parent class. */
|
||||
+ struct type *type;
|
||||
+
|
||||
+ /* The index of the method in the type's function fieldlists. */
|
||||
+ int fnfield_index;
|
||||
+
|
||||
+ /* The index of the method in the fieldlist. */
|
||||
+ int index;
|
||||
+
|
||||
+ /* The name of the DIE. */
|
||||
+ const char *name;
|
||||
+
|
||||
+ /* The DIE associated with this method. */
|
||||
+ struct die_info *die;
|
||||
+};
|
||||
+
|
||||
/* Internal state when decoding a particular compilation unit. */
|
||||
struct dwarf2_cu
|
||||
{
|
||||
@@ -329,6 +351,10 @@ struct dwarf2_cu
|
||||
/* Header data from the line table, during full symbol processing. */
|
||||
struct line_header *line_header;
|
||||
|
||||
+ /* A list of methods which need to have physnames computed
|
||||
+ after all type information has been read. */
|
||||
+ struct delayed_method_info *method_list;
|
||||
+
|
||||
/* Mark used when releasing cached dies. */
|
||||
unsigned int mark : 1;
|
||||
|
||||
@@ -1208,6 +1234,9 @@ static void destroy_section (struct dwar
|
||||
static struct dwarf2_locexpr_baton *dwarf2_attr_to_locexpr_baton
|
||||
(struct attribute *attr, struct dwarf2_cu *cu);
|
||||
|
||||
+static const char *dwarf2_physname (char *name, struct die_info *die,
|
||||
+ struct dwarf2_cu *cu);
|
||||
+
|
||||
/* Try to locate the sections we need for DWARF 2 debugging
|
||||
information and return true if we have enough to do something. */
|
||||
|
||||
@@ -3435,6 +3464,58 @@ load_full_comp_unit (struct dwarf2_per_c
|
||||
discard_cleanups (free_cu_cleanup);
|
||||
}
|
||||
|
||||
+/* Add a DIE to the delayed physname list. */
|
||||
+static void
|
||||
+add_to_method_list (struct type *type, int fnfield_index, int index,
|
||||
+ const char *name, struct die_info *die,
|
||||
+ struct dwarf2_cu *cu)
|
||||
+{
|
||||
+ struct delayed_method_info *mi;
|
||||
+
|
||||
+ mi = xmalloc (sizeof (*mi));
|
||||
+ mi->next = cu->method_list;
|
||||
+ cu->method_list = mi;
|
||||
+ mi->type = type;
|
||||
+ mi->fnfield_index = fnfield_index;
|
||||
+ mi->index = index;
|
||||
+ mi->name = name;
|
||||
+ mi->die = die;
|
||||
+}
|
||||
+
|
||||
+/* Compute the physnames of any methods on the CU's method list.
|
||||
+
|
||||
+ The computation of method physnames is delayed in order to avoid the
|
||||
+ (bad) condition that one of the method's formal parameters is of an as yet
|
||||
+ incomplete type. */
|
||||
+static void
|
||||
+compute_delayed_physnames (struct dwarf2_cu *cu)
|
||||
+{
|
||||
+ struct delayed_method_info *mi;
|
||||
+
|
||||
+ for (mi = cu->method_list; mi; mi = mi->next)
|
||||
+ {
|
||||
+ char *physname;
|
||||
+ struct fn_fieldlist *fn_flp
|
||||
+ = &TYPE_FN_FIELDLIST (mi->type, mi->fnfield_index);
|
||||
+ physname = (char *) dwarf2_physname ((char *) mi->name, mi->die, cu);
|
||||
+ fn_flp->fn_fields[mi->index].physname = physname ? physname : "";
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+method_list_cleanup (void *arg)
|
||||
+{
|
||||
+ struct delayed_method_info **method_list_pointer = arg;
|
||||
+
|
||||
+ while (*method_list_pointer)
|
||||
+ {
|
||||
+ struct delayed_method_info *mi = *method_list_pointer;
|
||||
+
|
||||
+ *method_list_pointer = mi->next;
|
||||
+ xfree (mi);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/* Generate full symbol information for PST and CU, whose DIEs have
|
||||
already been loaded into memory. */
|
||||
|
||||
@@ -3447,7 +3528,7 @@ process_full_comp_unit (struct dwarf2_pe
|
||||
bfd *abfd = objfile->obfd;
|
||||
CORE_ADDR lowpc, highpc;
|
||||
struct symtab *symtab;
|
||||
- struct cleanup *back_to;
|
||||
+ struct cleanup *back_to, *delayed_list_cleanup;
|
||||
CORE_ADDR baseaddr;
|
||||
|
||||
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
||||
@@ -3457,11 +3538,22 @@ process_full_comp_unit (struct dwarf2_pe
|
||||
|
||||
cu->list_in_scope = &file_symbols;
|
||||
|
||||
+ /* If methods were found in the partial symbol table, we allocate one
|
||||
+ big buffer to hold the entire delayed list for the CU. */
|
||||
+ delayed_list_cleanup = make_cleanup (method_list_cleanup,
|
||||
+ &cu->method_list);
|
||||
+
|
||||
dwarf2_find_base_address (cu->dies, cu);
|
||||
|
||||
/* Do line number decoding in read_file_scope () */
|
||||
process_die (cu->dies, cu);
|
||||
|
||||
+ /* Now that we have processed all the DIEs in the CU, all the types
|
||||
+ should be complete, and it should now be safe to compute all of the
|
||||
+ physnames. */
|
||||
+ compute_delayed_physnames (cu);
|
||||
+ do_cleanups (delayed_list_cleanup);
|
||||
+
|
||||
/* Some compilers don't define a DW_AT_high_pc attribute for the
|
||||
compilation unit. If the DW_AT_high_pc is missing, synthesize
|
||||
it, by scanning the DIE's below the compilation unit. */
|
||||
@@ -5093,7 +5185,6 @@ dwarf2_add_member_fn (struct field_info
|
||||
int i;
|
||||
struct fn_field *fnp;
|
||||
char *fieldname;
|
||||
- char *physname;
|
||||
struct nextfnfield *new_fnfield;
|
||||
struct type *this_type;
|
||||
|
||||
@@ -5105,9 +5196,6 @@ dwarf2_add_member_fn (struct field_info
|
||||
if (fieldname == NULL)
|
||||
return;
|
||||
|
||||
- /* Get the mangled name. */
|
||||
- physname = (char *) dwarf2_physname (fieldname, die, cu);
|
||||
-
|
||||
/* Look up member function name in fieldlist. */
|
||||
for (i = 0; i < fip->nfnfields; i++)
|
||||
{
|
||||
@@ -5133,7 +5221,7 @@ dwarf2_add_member_fn (struct field_info
|
||||
flp->name = fieldname;
|
||||
flp->length = 0;
|
||||
flp->head = NULL;
|
||||
- fip->nfnfields++;
|
||||
+ i = fip->nfnfields++;
|
||||
}
|
||||
|
||||
/* Create a new member function field and chain it to the field list
|
||||
@@ -5147,9 +5235,19 @@ dwarf2_add_member_fn (struct field_info
|
||||
|
||||
/* Fill in the member function field info. */
|
||||
fnp = &new_fnfield->fnfield;
|
||||
- /* The name is already allocated along with this objfile, so we don't
|
||||
- need to duplicate it for the type. */
|
||||
- fnp->physname = physname ? physname : "";
|
||||
+
|
||||
+ /* Delay processing of the physname until later. */
|
||||
+ if (cu->language == language_cplus || cu->language == language_java)
|
||||
+ {
|
||||
+ add_to_method_list (type, i, flp->length - 1, fieldname,
|
||||
+ die, cu);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ char *physname = (char *) dwarf2_physname (fieldname, die, cu);
|
||||
+ fnp->physname = physname ? physname : "";
|
||||
+ }
|
||||
+
|
||||
fnp->type = alloc_type (objfile);
|
||||
this_type = read_type_die (die, cu);
|
||||
if (this_type && TYPE_CODE (this_type) == TYPE_CODE_FUNC)
|
||||
@@ -5175,7 +5273,7 @@ dwarf2_add_member_fn (struct field_info
|
||||
}
|
||||
else
|
||||
complaint (&symfile_complaints, _("member function type missing for '%s'"),
|
||||
- physname);
|
||||
+ dwarf2_full_name (fieldname, die, cu));
|
||||
|
||||
/* Get fcontext from DW_AT_containing_type if present. */
|
||||
if (dwarf2_attr (die, DW_AT_containing_type, cu) != NULL)
|
||||
@@ -7500,7 +7598,9 @@ load_partial_dies (bfd *abfd, gdb_byte *
|
||||
|| last_die->tag == DW_TAG_interface_type
|
||||
|| last_die->tag == DW_TAG_structure_type
|
||||
|| last_die->tag == DW_TAG_union_type))
|
||||
- || (cu->language == language_ada
|
||||
+ || ((cu->language == language_ada
|
||||
+ || cu->language == language_cplus
|
||||
+ || cu->language == language_java)
|
||||
&& (last_die->tag == DW_TAG_subprogram
|
||||
|| last_die->tag == DW_TAG_lexical_block))))
|
||||
{
|
||||
--- ./gdb/testsuite/gdb.dwarf2/pr11465.S 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ ./gdb/testsuite/gdb.dwarf2/pr11465.S 2010-05-13 18:39:00.000000000 +0200
|
||||
@@ -0,0 +1,355 @@
|
||||
+/* Copyright 2010 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/>. */
|
||||
+
|
||||
+/* Compiled from:
|
||||
+
|
||||
+ namespace N
|
||||
+ {
|
||||
+ class C
|
||||
+ {
|
||||
+ public:
|
||||
+ typedef void (*t) (C);
|
||||
+ C (t) {}
|
||||
+ };
|
||||
+ typedef C::t u;
|
||||
+ u f;
|
||||
+ C c (f);
|
||||
+ };
|
||||
+
|
||||
+ int
|
||||
+ main ()
|
||||
+ {
|
||||
+ return 0;
|
||||
+ }
|
||||
+*/
|
||||
+
|
||||
+ .text
|
||||
+_ZN1N1cE:
|
||||
+ .section .debug_info
|
||||
+d:
|
||||
+ .long .Ldebug_info_end - 1f /* Length of CU info */
|
||||
+1:
|
||||
+ .2byte 0x2 /* DWARF version number */
|
||||
+ .long .Ldebug_abbrev0 /* Abbrev offset */
|
||||
+ .byte 0x4 /* Pointer size */
|
||||
+dieb: .uleb128 0x1 /* DW_TAG_compile_unit */
|
||||
+ .long .LASF4 /* DW_AT_producer */
|
||||
+ .byte 0x4 /* DW_AT_language */
|
||||
+ .long .LASF5 /* DW_AT_name */
|
||||
+ .long .LASF6 /* DW_AT_comp_dir */
|
||||
+ .long 0x0 /* DW_AT_low_pc */
|
||||
+ .long 0x0 /* DW_AT_high_pc */
|
||||
+ .long 0x0 /* DW_AT_entry_pc */
|
||||
+die29: .uleb128 0x2 /* DW_TAG_namespace */
|
||||
+ .string "N" /* DW_AT_name */
|
||||
+die32: .uleb128 0x3 /* DW_TAG_class_type */
|
||||
+ .string "C" /* DW_AT_name */
|
||||
+ .byte 0x1 /* DW_AT_declaration */
|
||||
+die36: .uleb128 0x4 /* DW_TAG_typedef */
|
||||
+ .string "u" /* DW_AT_name */
|
||||
+ .long die7e-d /* DW_AT_type */
|
||||
+die3f: .uleb128 0x5 /* DW_TAG_variable */
|
||||
+ .string "f" /* DW_AT_name */
|
||||
+ .long .LASF0 /* DW_AT_MIPS_linkage_name */
|
||||
+ .long die36-d /* DW_AT_type */
|
||||
+ .byte 0x1 /* DW_AT_external */
|
||||
+ .byte 0x1 /* DW_AT_declaration */
|
||||
+die4e: .uleb128 0x5 /* DW_TAG_variable */
|
||||
+ .string "c" /* DW_AT_name */
|
||||
+ .long .LASF1 /* DW_AT_MIPS_linkage_name */
|
||||
+ .long die5e-d /* DW_AT_type */
|
||||
+ .byte 0x1 /* DW_AT_external */
|
||||
+ .byte 0x1 /* DW_AT_declaration */
|
||||
+ .byte 0x0
|
||||
+die5e: .uleb128 0x6 /* DW_TAG_class_type */
|
||||
+ .long die32-d /* DW_AT_specification */
|
||||
+ .byte 0x1 /* DW_AT_byte_size */
|
||||
+die6a: .uleb128 0x7 /* DW_TAG_subprogram */
|
||||
+ .byte 0x1 /* DW_AT_external */
|
||||
+ .string "C" /* DW_AT_name */
|
||||
+ .byte 0x1 /* DW_AT_declaration */
|
||||
+die71: .uleb128 0x8 /* DW_TAG_formal_parameter */
|
||||
+ .long die8f-d /* DW_AT_type */
|
||||
+ .byte 0x1 /* DW_AT_artificial */
|
||||
+die77: .uleb128 0x9 /* DW_TAG_formal_parameter */
|
||||
+ .long die7e-d /* DW_AT_type */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+die7e: .uleb128 0xa /* DW_TAG_pointer_type */
|
||||
+ .byte 0x4 /* DW_AT_byte_size */
|
||||
+ .long die84-d /* DW_AT_type */
|
||||
+die84: .uleb128 0xb /* DW_TAG_subroutine_type */
|
||||
+die89: .uleb128 0x9 /* DW_TAG_formal_parameter */
|
||||
+ .long die5e-d /* DW_AT_type */
|
||||
+ .byte 0x0
|
||||
+die8f: .uleb128 0xa /* DW_TAG_pointer_type */
|
||||
+ .byte 0x4 /* DW_AT_byte_size */
|
||||
+ .long die5e-d /* DW_AT_type */
|
||||
+die95: .uleb128 0xc /* DW_TAG_subprogram */
|
||||
+ .long die6a-d /* DW_AT_specification */
|
||||
+ .byte 0x2 /* DW_AT_inline */
|
||||
+die9f: .uleb128 0xd /* DW_TAG_formal_parameter */
|
||||
+ .long .LASF7 /* DW_AT_name */
|
||||
+ .long dieaf-d /* DW_AT_type */
|
||||
+ .byte 0x1 /* DW_AT_artificial */
|
||||
+diea9: .uleb128 0x9 /* DW_TAG_formal_parameter */
|
||||
+ .long die7e-d /* DW_AT_type */
|
||||
+ .byte 0x0
|
||||
+dieaf: .uleb128 0xe /* DW_TAG_const_type */
|
||||
+ .long die8f-d /* DW_AT_type */
|
||||
+dieb4: .uleb128 0xf /* DW_TAG_subprogram */
|
||||
+ .long die95-d /* DW_AT_abstract_origin */
|
||||
+ .long _ZN1N1cE /* DW_AT_low_pc */
|
||||
+ .long _ZN1N1cE /* DW_AT_high_pc */
|
||||
+diec9: .uleb128 0x10 /* DW_TAG_subprogram */
|
||||
+ .long die9f-d /* DW_AT_abstract_origin */
|
||||
+ .byte 2f-1f /* DW_AT_location */
|
||||
+1:
|
||||
+ .byte 0x50 /* DW_OP_reg0 */
|
||||
+2:
|
||||
+died1: .uleb128 0x10 /* DW_TAG_formal_parameter */
|
||||
+ .long diea9-d /* DW_AT_abstract_origin */
|
||||
+ .byte 2f-1f /* DW_AT_location */
|
||||
+1:
|
||||
+ .byte 0x51 /* DW_OP_reg1 */
|
||||
+2:
|
||||
+ .byte 0x0
|
||||
+dieda: .uleb128 0x11 /* DW_TAG_subprogram */
|
||||
+ .byte 0x1 /* DW_AT_external */
|
||||
+ .long .LASF8 /* DW_AT_name */
|
||||
+ .long dief2-d /* DW_AT_type */
|
||||
+ .long _ZN1N1cE /* DW_AT_low_pc */
|
||||
+ .long _ZN1N1cE /* DW_AT_high_pc */
|
||||
+dief2: .uleb128 0x12 /* DW_TAG_base_type */
|
||||
+ .byte 0x4 /* DW_AT_byte_size */
|
||||
+ .byte 0x5 /* DW_AT_encoding */
|
||||
+ .string "int" /* DW_AT_name */
|
||||
+die149: .uleb128 0x16 /* DW_TAG_variable */
|
||||
+ .long die4e-d /* DW_AT_specification */
|
||||
+ .byte 0x5 /* DW_AT_location */
|
||||
+ .byte 0x3
|
||||
+ .long _ZN1N1cE
|
||||
+ .byte 0x0
|
||||
+.Ldebug_info_end:
|
||||
+ .section .debug_abbrev
|
||||
+.Ldebug_abbrev0:
|
||||
+ .uleb128 0x1 /* abbrev code*/
|
||||
+ .uleb128 0x11 /* DW_TAG_compile_unit */
|
||||
+ .byte 0x1 /* DW_children_yes */
|
||||
+ .uleb128 0x25 /* DW_AT_producer*/
|
||||
+ .uleb128 0xe /* DW_FORM_strp */
|
||||
+ .uleb128 0x13 /* DW_AT_language */
|
||||
+ .uleb128 0xb /* DW_FORM_data1 */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0xe /* DW_FORM_strp */
|
||||
+ .uleb128 0x1b /* DW_AT_comp_dir */
|
||||
+ .uleb128 0xe /* DW_FORM_strp */
|
||||
+ .uleb128 0x11 /* DW_AT_low_pc */
|
||||
+ .uleb128 0x1 /* DW_FORM_addr */
|
||||
+ .uleb128 0x12 /* DW_AT_high_pc */
|
||||
+ .uleb128 0x1 /* DW_FORM_addr */
|
||||
+ .uleb128 0x52 /* DW_AT_entry_pc */
|
||||
+ .uleb128 0x1 /* DW_FORM_addr */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x2 /* abbrev code */
|
||||
+ .uleb128 0x39 /* DW_TAG_namespace */
|
||||
+ .byte 0x1 /* DW_children_yes */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x3 /* abbrev code */
|
||||
+ .uleb128 0x2 /* DW_TAG_class_type */
|
||||
+ .byte 0x0 /* DW_has_children_no */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .uleb128 0x3c /* DW_AT_declaration */
|
||||
+ .uleb128 0xc /* DW_FORM_flag */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x4 /* abbrev code */
|
||||
+ .uleb128 0x16 /* DW_TAG_typedef */
|
||||
+ .byte 0x0 /* DW_has_children_no */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .uleb128 0x49 /* DW_AT_type */
|
||||
+ .uleb128 0x13 /* DW_FORM_ref4 */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x5 /* abbrev code */
|
||||
+ .uleb128 0x34 /* DW_TAG_variable */
|
||||
+ .byte 0x0 /* DW_has_children_no */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .uleb128 0x2007 /* DW_AT_MIPS_linkage_name */
|
||||
+ .uleb128 0xe /* DW_FORM_strp */
|
||||
+ .uleb128 0x49 /* DW_AT_TYPE */
|
||||
+ .uleb128 0x13 /* DW_FORM_ref4 */
|
||||
+ .uleb128 0x3f /* DW_AT_external */
|
||||
+ .uleb128 0xc /* DW_FORM_flag */
|
||||
+ .uleb128 0x3c /* DW_AT_declaration */
|
||||
+ .uleb128 0xc /* DW_FORM_flag */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x6 /* abbrev code */
|
||||
+ .uleb128 0x2 /* DW_TAG_class_type */
|
||||
+ .byte 0x1 /* DW_has_children_yes */
|
||||
+ .uleb128 0x47 /* DW_AT_specification */
|
||||
+ .uleb128 0x13 /* DW_FORM_ref4 */
|
||||
+ .uleb128 0xb /* DW_AT_byte_size */
|
||||
+ .uleb128 0xb /* DW_FORM_data1 */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x7 /* abbrev code */
|
||||
+ .uleb128 0x2e /* DW_TAG_subprogra */
|
||||
+ .byte 0x1 /* DW_has_children_yes */
|
||||
+ .uleb128 0x3f /* DW_AT_external */
|
||||
+ .uleb128 0xc /* DW_FORM_flag */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .uleb128 0x3c /* DW_AT_declaration */
|
||||
+ .uleb128 0xc /* DW_FORM_flag */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x8 /* abbrev code */
|
||||
+ .uleb128 0x5 /* DW_TAG_formal_parameter */
|
||||
+ .byte 0x0 /* DW_has_children_no */
|
||||
+ .uleb128 0x49 /* DW_AT_type */
|
||||
+ .uleb128 0x13 /* DW_FORM_ref4 */
|
||||
+ .uleb128 0x34 /* DW_AT_artificial */
|
||||
+ .uleb128 0xc /* DW_FORM_flag */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x9 /* abbrev code */
|
||||
+ .uleb128 0x5 /* DW_TAG_formal_parameter */
|
||||
+ .byte 0x0 /* DW_has_children_no */
|
||||
+ .uleb128 0x49 /* DW_AT_type */
|
||||
+ .uleb128 0x13 /* DW_FORM_ref4 */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0xa /* abbrev code */
|
||||
+ .uleb128 0xf /* DW_TAG_pointer_type */
|
||||
+ .byte 0x0 /* DW_has_children_no */
|
||||
+ .uleb128 0xb /* DW_AT_byte_size */
|
||||
+ .uleb128 0xb /* DW_FORM_data1 */
|
||||
+ .uleb128 0x49 /* DW_AT_type */
|
||||
+ .uleb128 0x13 /* DW_FORM_ref4 */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0xb /* abbrev code */
|
||||
+ .uleb128 0x15 /* DW_TAG_subroutine_type */
|
||||
+ .byte 0x1 /* DW_has_children_yes */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0xc /* abbrev code */
|
||||
+ .uleb128 0x2e /* DW_TAG_subprogram */
|
||||
+ .byte 0x1 /* DW_has_children_yes */
|
||||
+ .uleb128 0x47 /* DW_AT_specification */
|
||||
+ .uleb128 0x13 /* DW_FORM_ref4 */
|
||||
+ .uleb128 0x20 /* DW_AT_inline */
|
||||
+ .uleb128 0xb /* DW_FORM_data1 */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0xd /* abbrev code */
|
||||
+ .uleb128 0x5 /* DW_TAG_formal_parameter */
|
||||
+ .byte 0x0 /* DW_has_children_no */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0xe /* DW_FORM_strp */
|
||||
+ .uleb128 0x49 /* DW_AT_type */
|
||||
+ .uleb128 0x13 /* DW_FORM_ref4 */
|
||||
+ .uleb128 0x34 /* DW_AT_artificial */
|
||||
+ .uleb128 0xc /* DW_FORM_flag */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0xe /* abbrev code */
|
||||
+ .uleb128 0x26 /* DW_TAG_const_type */
|
||||
+ .byte 0x0 /* DW_has_children_no */
|
||||
+ .uleb128 0x49 /* DW_AT_type */
|
||||
+ .uleb128 0x13 /* DW_FORM_ref4 */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0xf /* abbrev code */
|
||||
+ .uleb128 0x2e /* DW_TAG_subprogram */
|
||||
+ .byte 0x1 /* DW_has_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 0x1 /* DW_FORM_addr */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x10 /* abbrev code */
|
||||
+ .uleb128 0x5 /* DW_TAG_formal_parameter */
|
||||
+ .byte 0x0 /* DW_has_children_no */
|
||||
+ .uleb128 0x31 /* DW_AT_abstract_origin */
|
||||
+ .uleb128 0x13 /* DW_FORM_ref4 */
|
||||
+ .uleb128 0x2 /* DW_AT_location */
|
||||
+ .uleb128 0xa /* DW_FORM_block1 */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x11 /* abbrev code */
|
||||
+ .uleb128 0x2e /* DW_TAG_subprogram */
|
||||
+ .byte 0x0 /* DW_has_children_no */
|
||||
+ .uleb128 0x3f /* DW_AT_external */
|
||||
+ .uleb128 0xc /* DW_FORM_flag */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0xe /* DW_FORM_strp */
|
||||
+ .uleb128 0x49 /* DW_AT_type */
|
||||
+ .uleb128 0x13 /* DW_FORM_ref4 */
|
||||
+ .uleb128 0x11 /* DW_AT_low_pc */
|
||||
+ .uleb128 0x1 /* DW_FORM_addr */
|
||||
+ .uleb128 0x12 /* DW_AT_high_pc */
|
||||
+ .uleb128 0x1 /* DW_FORM_addr */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x12 /* abbrev code */
|
||||
+ .uleb128 0x24 /* DW_TAG_base_type */
|
||||
+ .byte 0x0 /* DW_has_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 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x16 /* abbrev code */
|
||||
+ .uleb128 0x34 /* DW_TAG_variable */
|
||||
+ .byte 0x0 /* DW_has_children_no */
|
||||
+ .uleb128 0x47 /* DW_AT_specification */
|
||||
+ .uleb128 0x13 /* DW_FORM_ref4 */
|
||||
+ .uleb128 0x2 /* DW_AT_location */
|
||||
+ .uleb128 0xa /* DW_FORM_block1 */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .section .debug_str
|
||||
+.LASF0:
|
||||
+ .string "_ZN1N1fE"
|
||||
+.LASF7:
|
||||
+ .string "this"
|
||||
+.LASF6:
|
||||
+ .string ""
|
||||
+.LASF8:
|
||||
+ .string "main"
|
||||
+.LASF1:
|
||||
+ .string "_ZN1N1cE"
|
||||
+.LASF5:
|
||||
+ .string "pr11465.cc"
|
||||
+.LASF4:
|
||||
+ .string "GNU C++ 4.4.2"
|
||||
+ .ident "GCC: (GNU) 4.4.2"
|
||||
--- ./gdb/testsuite/gdb.dwarf2/pr11465.exp 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ ./gdb/testsuite/gdb.dwarf2/pr11465.exp 2010-05-13 18:39:00.000000000 +0200
|
||||
@@ -0,0 +1,39 @@
|
||||
+# Copyright 2010 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 can only be run on targets which support DWARF-2 and use gas.
|
||||
+# For now pick a sampling of likely targets.
|
||||
+if {![istarget *-*-linux*]
|
||||
+ && ![istarget *-*-gnu*]
|
||||
+ && ![istarget *-*-elf*]
|
||||
+ && ![istarget *-*-openbsd*]
|
||||
+ && ![istarget arm-*-eabi*]
|
||||
+ && ![istarget powerpc-*-eabi*]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set testfile "pr11465"
|
||||
+set srcfile ${testfile}.S
|
||||
+set executable ${testfile}.x
|
||||
+set binfile ${objdir}/${subdir}/${executable}
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart $executable
|
||||
+
|
||||
+# Test delayed physname computations
|
||||
+gdb_test "p N::c.C" { = {void \(N::C \*, void \(\*\)\(N::C\)\)}.*}
|
187
gdb-bz575292-void-workaround.patch
Normal file
187
gdb-bz575292-void-workaround.patch
Normal file
@ -0,0 +1,187 @@
|
||||
http://sourceware.org/ml/gdb-patches/2010-03/msg01039.html
|
||||
Subject: [patch] Fix crash on NULL function's TYPE_FIELD_TYPE
|
||||
|
||||
Hi,
|
||||
|
||||
seen one possibility of a crash.
|
||||
|
||||
#0 c_print_type (type=0x0, ...)
|
||||
#1 in c_type_print_args (type=0xfceb890,
|
||||
|
||||
(The real reason of a reported GDB crash was different, though.)
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2010-03-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Fix crash on reading wrong function declaration DWARF.
|
||||
* dwarf2read.c (read_subroutine_type): New variable void_type.
|
||||
Pre-fill all TYPE_FIELD_TYPEs. Move nparams and iparams initialization
|
||||
more close to their use.
|
||||
|
||||
gdb/testsuite/
|
||||
2010-03-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.dwarf2/dw2-bad-parameter-type.exp,
|
||||
gdb.dwarf2/dw2-bad-parameter-type.S: New.
|
||||
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -5938,13 +5938,14 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||
|
||||
if (die->child != NULL)
|
||||
{
|
||||
+ struct type *void_type = objfile_type (cu->objfile)->builtin_void;
|
||||
struct die_info *child_die;
|
||||
- int nparams = 0;
|
||||
- int iparams = 0;
|
||||
+ int nparams, iparams;
|
||||
|
||||
/* Count the number of parameters.
|
||||
FIXME: GDB currently ignores vararg functions, but knows about
|
||||
vararg member functions. */
|
||||
+ nparams = 0;
|
||||
child_die = die->child;
|
||||
while (child_die && child_die->tag)
|
||||
{
|
||||
@@ -5960,6 +5961,12 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||
TYPE_FIELDS (ftype) = (struct field *)
|
||||
TYPE_ZALLOC (ftype, nparams * sizeof (struct field));
|
||||
|
||||
+ /* TYPE_FIELD_TYPE must never be NULL. Pre-fill the array to ensure it
|
||||
+ even if we error out during the parameters reading below. */
|
||||
+ for (iparams = 0; iparams < nparams; iparams++)
|
||||
+ TYPE_FIELD_TYPE (ftype, iparams) = void_type;
|
||||
+
|
||||
+ iparams = 0;
|
||||
child_die = die->child;
|
||||
while (child_die && child_die->tag)
|
||||
{
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.S
|
||||
@@ -0,0 +1,73 @@
|
||||
+/* Copyright 2010 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/>. */
|
||||
+
|
||||
+ .section .debug_info
|
||||
+debug_start:
|
||||
+ .long debug_end - 1f /* Length of Compilation Unit Info */
|
||||
+1:
|
||||
+ .2byte 0x3 /* DWARF version number */
|
||||
+ .long .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
|
||||
+ .byte 0x4 /* Pointer Size (in bytes) */
|
||||
+ .uleb128 0x1 /* (DIE (0xb) DW_TAG_compile_unit) */
|
||||
+ .ascii "GNU C 4.4.3\0" /* DW_AT_producer */
|
||||
+ .byte 0x1 /* DW_AT_language */
|
||||
+ .ascii "1.c\0" /* DW_AT_name */
|
||||
+ .uleb128 0x4 /* (DIE (0x3c) DW_TAG_subprogram) */
|
||||
+ .ascii "f\0" /* DW_AT_name */
|
||||
+/* Value 0 would require has_section_at_zero != 0 (which is true, though). */
|
||||
+ .long 1 /* DW_AT_low_pc */
|
||||
+ .long 2 /* DW_AT_high_pc */
|
||||
+ .byte 0x1 /* DW_AT_prototyped */
|
||||
+ .uleb128 0x5 /* (DIE (0x42) DW_TAG_formal_parameter) */
|
||||
+/* Invalid value. */
|
||||
+ .long 0x0 /* DW_AT_type */
|
||||
+ .byte 0x0 /* end of children of DIE 0x3c */
|
||||
+ .byte 0x0 /* end of children of DIE 0xb */
|
||||
+debug_end:
|
||||
+
|
||||
+ .section .debug_abbrev
|
||||
+.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) */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x4 /* (abbrev code) */
|
||||
+ .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */
|
||||
+ .byte 0x1 /* DW_children_yes */
|
||||
+ .uleb128 0x3 /* (DW_AT_name) */
|
||||
+ .uleb128 0x8 /* (DW_FORM_string) */
|
||||
+ .uleb128 0x11 /* (DW_AT_low_pc) */
|
||||
+ .uleb128 0x1 /* (DW_FORM_addr) */
|
||||
+ .uleb128 0x12 /* (DW_AT_high_pc) */
|
||||
+ .uleb128 0x1 /* (DW_FORM_addr) */
|
||||
+ .uleb128 0x27 /* (DW_AT_prototyped) */
|
||||
+ .uleb128 0xc /* (DW_FORM_flag) */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x5 /* (abbrev code) */
|
||||
+ .uleb128 0x5 /* (TAG: DW_TAG_formal_parameter) */
|
||||
+ .byte 0x0 /* DW_children_no */
|
||||
+ .uleb128 0x49 /* (DW_AT_type) */
|
||||
+ .uleb128 0x13 /* (DW_FORM_ref4) */
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp
|
||||
@@ -0,0 +1,44 @@
|
||||
+# Copyright 2010 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 can only be run on targets which support DWARF-2 and use gas.
|
||||
+# For now pick a sampling of likely targets.
|
||||
+if {![istarget *-*-linux*]
|
||||
+ && ![istarget *-*-gnu*]
|
||||
+ && ![istarget *-*-elf*]
|
||||
+ && ![istarget *-*-openbsd*]
|
||||
+ && ![istarget arm-*-eabi*]
|
||||
+ && ![istarget powerpc-*-eabi*]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set testfile "dw2-bad-parameter-type"
|
||||
+set srcfile ${testfile}.S
|
||||
+set executable ${testfile}.x
|
||||
+set binfile ${objdir}/${subdir}/${executable}
|
||||
+
|
||||
+# First try referencing DW_AT_frame_base which is not defined.
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart $executable
|
||||
+
|
||||
+# The first access (as we do not use -readnow) prints some:
|
||||
+# Dwarf Error: Cannot find DIE at 0x0 referenced from DIE at 0x29 [in module ...]
|
||||
+gdb_test "ptype f"
|
||||
+
|
||||
+gdb_test "ptype f"
|
||||
+gdb_test "p 5" " = 5" "is alive"
|
||||
|
1733
gdb-bz578250-avx-01of10.patch
Normal file
1733
gdb-bz578250-avx-01of10.patch
Normal file
File diff suppressed because it is too large
Load Diff
751
gdb-bz578250-avx-02of10.patch
Normal file
751
gdb-bz578250-avx-02of10.patch
Normal file
@ -0,0 +1,751 @@
|
||||
[ Backported. ]
|
||||
|
||||
commit cb928c67c90cfb5bbb0636d91855b95e51ad275d
|
||||
Author: Daniel Jacobowitz <dan@debian.org>
|
||||
Date: Mon Mar 1 17:19:21 2010 +0000
|
||||
|
||||
* gdbtypes.c (append_composite_type_field_raw): New.
|
||||
(append_composite_type_field_aligned): Use the new function.
|
||||
* gdbtypes.h (append_composite_type_field_raw): Declare.
|
||||
* target-descriptions.c (struct tdesc_type_field): Add start and end.
|
||||
(struct tdesc_type_flag): New type.
|
||||
(struct tdesc_type): Add TDESC_TYPE_STRUCT and TDESC_TYPE_FLAGS to
|
||||
kind. Add size to u.u. Add u.f for flags.
|
||||
(tdesc_gdb_type): Handle TDESC_TYPE_STRUCT and TDESC_TYPE_FLAGS.
|
||||
(tdesc_free_type): Likewise.
|
||||
(tdesc_create_struct, tdesc_set_struct_size, tdesc_create_flags): New.
|
||||
(tdesc_add_field): Handle TDESC_TYPE_STRUCT.
|
||||
(tdesc_add_bitfield, tdesc_add_flag): New.
|
||||
* target-descriptions.h (tdesc_create_struct, tdesc_set_struct_size)
|
||||
(tdesc_create_flags, tdesc_add_bitfield, tdesc_add_flag): Declare.
|
||||
* xml-tdesc.c (struct tdesc_parsing_data): Rename current_union to
|
||||
current_type. Add current_type_size and current_type_is_flags.
|
||||
(tdesc_start_union): Clear the new fields.
|
||||
(tdesc_start_struct, tdesc_start_flags): New.
|
||||
(tdesc_start_field): Handle struct fields, including bitfields.
|
||||
(field_attributes): Make type optional. Add start and end.
|
||||
(union_children): Rename to struct_union_children.
|
||||
(union_attributes): Rename to struct_union_attributes. Add optional
|
||||
size.
|
||||
(flags_attributes): New.
|
||||
(feature_children): Add struct and flags.
|
||||
* features/gdb-target.dtd: Add flags and struct to features.
|
||||
Make field type optional. Add field start and end.
|
||||
|
||||
doc/
|
||||
* gdb.texinfo (Types): Describe <struct> and <flags>.
|
||||
|
||||
testsuite/
|
||||
* gdb.xml/extra-regs.xml: Add struct1, struct2, and flags
|
||||
types. Add structreg, bitfields, and flags registers.
|
||||
* gdb.xml/tdesc-regs.exp: Test structreg and bitfields
|
||||
registers.
|
||||
|
||||
--- gdb-7.1-p0/gdb/doc/gdb.texinfo 2010-04-03 20:24:51.000000000 +0200
|
||||
+++ gdb-7.1/gdb/doc/gdb.texinfo 2010-04-03 21:04:13.000000000 +0200
|
||||
@@ -33115,6 +33115,47 @@ each of which has a @var{name} and a @va
|
||||
</union>
|
||||
@end smallexample
|
||||
|
||||
+@cindex <struct>
|
||||
+If a register's value is composed from several separate values, define
|
||||
+it with a structure type. There are two forms of the @samp{<struct>}
|
||||
+element; a @samp{<struct>} element must either contain only bitfields
|
||||
+or contain no bitfields. If the structure contains only bitfields,
|
||||
+its total size in bytes must be specified, each bitfield must have an
|
||||
+explicit start and end, and bitfields are automatically assigned an
|
||||
+integer type. The field's @var{start} should be less than or
|
||||
+equal to its @var{end}, and zero represents the least significant bit.
|
||||
+
|
||||
+@smallexample
|
||||
+<struct id="@var{id}" size="@var{size}">
|
||||
+ <field name="@var{name}" start="@var{start}" end="@var{end}"/>
|
||||
+ @dots{}
|
||||
+</struct>
|
||||
+@end smallexample
|
||||
+
|
||||
+If the structure contains no bitfields, then each field has an
|
||||
+explicit type, and no implicit padding is added.
|
||||
+
|
||||
+@smallexample
|
||||
+<struct id="@var{id}">
|
||||
+ <field name="@var{name}" type="@var{type}"/>
|
||||
+ @dots{}
|
||||
+</struct>
|
||||
+@end smallexample
|
||||
+
|
||||
+@cindex <flags>
|
||||
+If a register's value is a series of single-bit flags, define it with
|
||||
+a flags type. The @samp{<flags>} element has an explicit @var{size}
|
||||
+and contains one or more @samp{<field>} elements. Each field has a
|
||||
+@var{name}, a @var{start}, and an @var{end}. Only single-bit flags
|
||||
+are supported.
|
||||
+
|
||||
+@smallexample
|
||||
+<flags id="@var{id}" size="@var{size}">
|
||||
+ <field name="@var{name}" start="@var{start}" end="@var{end}"/>
|
||||
+ @dots{}
|
||||
+</flags>
|
||||
+@end smallexample
|
||||
+
|
||||
@subsection Registers
|
||||
@cindex <reg>
|
||||
|
||||
--- gdb-7.1-p0/gdb/features/gdb-target.dtd 2010-01-01 08:31:48.000000000 +0100
|
||||
+++ gdb-7.1/gdb/features/gdb-target.dtd 2010-04-03 21:04:13.000000000 +0200
|
||||
@@ -19,7 +19,8 @@
|
||||
|
||||
<!ELEMENT compatible (#PCDATA)>
|
||||
|
||||
-<!ELEMENT feature ((vector | union)*, reg*)>
|
||||
+<!ELEMENT feature
|
||||
+ ((vector | flags | struct | union )*, reg*)>
|
||||
<!ATTLIST feature
|
||||
name ID #REQUIRED>
|
||||
|
||||
@@ -39,6 +40,16 @@
|
||||
type CDATA #REQUIRED
|
||||
count CDATA #REQUIRED>
|
||||
|
||||
+<!ELEMENT flags (field+)>
|
||||
+<!ATTLIST flags
|
||||
+ id CDATA #REQUIRED
|
||||
+ size CDATA #REQUIRED>
|
||||
+
|
||||
+<!ELEMENT struct (field+)>
|
||||
+<!ATTLIST struct
|
||||
+ id CDATA #REQUIRED
|
||||
+ size CDATA #IMPLIED>
|
||||
+
|
||||
<!ELEMENT union (field+)>
|
||||
<!ATTLIST union
|
||||
id CDATA #REQUIRED>
|
||||
@@ -46,7 +57,9 @@
|
||||
<!ELEMENT field EMPTY>
|
||||
<!ATTLIST field
|
||||
name CDATA #REQUIRED
|
||||
- type CDATA #REQUIRED>
|
||||
+ type CDATA #IMPLIED
|
||||
+ start CDATA #IMPLIED
|
||||
+ end CDATA #IMPLIED>
|
||||
|
||||
<!ENTITY % xinclude SYSTEM "xinclude.dtd">
|
||||
%xinclude;
|
||||
--- gdb-7.1-p0/gdb/gdbtypes.c 2010-04-03 20:24:51.000000000 +0200
|
||||
+++ gdb-7.1/gdb/gdbtypes.c 2010-04-03 21:04:13.000000000 +0200
|
||||
@@ -3798,10 +3798,11 @@ arch_composite_type (struct gdbarch *gdb
|
||||
}
|
||||
|
||||
/* Add new field with name NAME and type FIELD to composite type T.
|
||||
- ALIGNMENT (if non-zero) specifies the minimum field alignment. */
|
||||
-void
|
||||
-append_composite_type_field_aligned (struct type *t, char *name,
|
||||
- struct type *field, int alignment)
|
||||
+ Do not set the field's position or adjust the type's length;
|
||||
+ the caller should do so. Return the new field. */
|
||||
+struct field *
|
||||
+append_composite_type_field_raw (struct type *t, char *name,
|
||||
+ struct type *field)
|
||||
{
|
||||
struct field *f;
|
||||
TYPE_NFIELDS (t) = TYPE_NFIELDS (t) + 1;
|
||||
@@ -3811,6 +3812,16 @@ append_composite_type_field_aligned (str
|
||||
memset (f, 0, sizeof f[0]);
|
||||
FIELD_TYPE (f[0]) = field;
|
||||
FIELD_NAME (f[0]) = name;
|
||||
+ return f;
|
||||
+}
|
||||
+
|
||||
+/* Add new field with name NAME and type FIELD to composite type T.
|
||||
+ ALIGNMENT (if non-zero) specifies the minimum field alignment. */
|
||||
+void
|
||||
+append_composite_type_field_aligned (struct type *t, char *name,
|
||||
+ struct type *field, int alignment)
|
||||
+{
|
||||
+ struct field *f = append_composite_type_field_raw (t, name, field);
|
||||
if (TYPE_CODE (t) == TYPE_CODE_UNION)
|
||||
{
|
||||
if (TYPE_LENGTH (t) < TYPE_LENGTH (field))
|
||||
--- gdb-7.1-p0/gdb/gdbtypes.h 2010-04-03 20:24:51.000000000 +0200
|
||||
+++ gdb-7.1/gdb/gdbtypes.h 2010-04-03 21:04:13.000000000 +0200
|
||||
@@ -1395,6 +1395,8 @@ extern void append_composite_type_field_
|
||||
char *name,
|
||||
struct type *field,
|
||||
int alignment);
|
||||
+struct field *append_composite_type_field_raw (struct type *t, char *name,
|
||||
+ struct type *field);
|
||||
|
||||
/* Helper functions to construct a bit flags type. An initially empty
|
||||
type is created using arch_flag_type(). Flags are then added using
|
||||
--- gdb-7.1-p0/gdb/target-descriptions.c 2010-02-10 19:45:02.000000000 +0100
|
||||
+++ gdb-7.1/gdb/target-descriptions.c 2010-04-03 21:04:13.000000000 +0200
|
||||
@@ -90,9 +90,17 @@ typedef struct tdesc_type_field
|
||||
{
|
||||
char *name;
|
||||
struct tdesc_type *type;
|
||||
+ int start, end;
|
||||
} tdesc_type_field;
|
||||
DEF_VEC_O(tdesc_type_field);
|
||||
|
||||
+typedef struct tdesc_type_flag
|
||||
+{
|
||||
+ char *name;
|
||||
+ int start;
|
||||
+} tdesc_type_flag;
|
||||
+DEF_VEC_O(tdesc_type_flag);
|
||||
+
|
||||
typedef struct tdesc_type
|
||||
{
|
||||
/* The name of this type. */
|
||||
@@ -123,7 +131,9 @@ typedef struct tdesc_type
|
||||
|
||||
/* Types defined by a target feature. */
|
||||
TDESC_TYPE_VECTOR,
|
||||
- TDESC_TYPE_UNION
|
||||
+ TDESC_TYPE_STRUCT,
|
||||
+ TDESC_TYPE_UNION,
|
||||
+ TDESC_TYPE_FLAGS
|
||||
} kind;
|
||||
|
||||
/* Kind-specific data. */
|
||||
@@ -136,11 +146,19 @@ typedef struct tdesc_type
|
||||
int count;
|
||||
} v;
|
||||
|
||||
- /* Union type. */
|
||||
+ /* Struct or union type. */
|
||||
struct
|
||||
{
|
||||
VEC(tdesc_type_field) *fields;
|
||||
+ LONGEST size;
|
||||
} u;
|
||||
+
|
||||
+ /* Flags type. */
|
||||
+ struct
|
||||
+ {
|
||||
+ VEC(tdesc_type_flag) *flags;
|
||||
+ LONGEST size;
|
||||
+ } f;
|
||||
} u;
|
||||
} *tdesc_type_p;
|
||||
DEF_VEC_P(tdesc_type_p);
|
||||
@@ -652,6 +670,66 @@ tdesc_gdb_type (struct gdbarch *gdbarch,
|
||||
return type;
|
||||
}
|
||||
|
||||
+ case TDESC_TYPE_STRUCT:
|
||||
+ {
|
||||
+ struct type *type, *field_type;
|
||||
+ struct tdesc_type_field *f;
|
||||
+ int ix;
|
||||
+
|
||||
+ type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
|
||||
+ TYPE_NAME (type) = xstrdup (tdesc_type->name);
|
||||
+ TYPE_TAG_NAME (type) = TYPE_NAME (type);
|
||||
+
|
||||
+ for (ix = 0;
|
||||
+ VEC_iterate (tdesc_type_field, tdesc_type->u.u.fields, ix, f);
|
||||
+ ix++)
|
||||
+ {
|
||||
+ if (f->type == NULL)
|
||||
+ {
|
||||
+ /* Bitfield. */
|
||||
+ struct field *fld;
|
||||
+ struct type *field_type;
|
||||
+ int bitsize, total_size;
|
||||
+
|
||||
+ /* This invariant should be preserved while creating
|
||||
+ types. */
|
||||
+ gdb_assert (tdesc_type->u.u.size != 0);
|
||||
+ if (tdesc_type->u.u.size > 4)
|
||||
+ field_type = builtin_type (gdbarch)->builtin_uint64;
|
||||
+ else
|
||||
+ field_type = builtin_type (gdbarch)->builtin_uint32;
|
||||
+
|
||||
+ fld = append_composite_type_field_raw (type, xstrdup (f->name),
|
||||
+ field_type);
|
||||
+
|
||||
+ /* For little-endian, BITPOS counts from the LSB of
|
||||
+ the structure and marks the LSB of the field. For
|
||||
+ big-endian, BITPOS counts from the MSB of the
|
||||
+ structure and marks the MSB of the field. Either
|
||||
+ way, it is the number of bits to the "left" of the
|
||||
+ field. To calculate this in big-endian, we need
|
||||
+ the total size of the structure. */
|
||||
+ bitsize = f->end - f->start + 1;
|
||||
+ total_size = tdesc_type->u.u.size * TARGET_CHAR_BIT;
|
||||
+ if (gdbarch_bits_big_endian (gdbarch))
|
||||
+ FIELD_BITPOS (fld[0]) = total_size - f->start - bitsize;
|
||||
+ else
|
||||
+ FIELD_BITPOS (fld[0]) = f->start;
|
||||
+ FIELD_BITSIZE (fld[0]) = bitsize;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ field_type = tdesc_gdb_type (gdbarch, f->type);
|
||||
+ append_composite_type_field (type, xstrdup (f->name),
|
||||
+ field_type);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (tdesc_type->u.u.size != 0)
|
||||
+ TYPE_LENGTH (type) = tdesc_type->u.u.size;
|
||||
+ return type;
|
||||
+ }
|
||||
+
|
||||
case TDESC_TYPE_UNION:
|
||||
{
|
||||
struct type *type, *field_type;
|
||||
@@ -668,12 +746,30 @@ tdesc_gdb_type (struct gdbarch *gdbarch,
|
||||
field_type = tdesc_gdb_type (gdbarch, f->type);
|
||||
append_composite_type_field (type, xstrdup (f->name), field_type);
|
||||
|
||||
- /* If any of the children of this union are vectors, flag the
|
||||
+ /* If any of the children of a union are vectors, flag the
|
||||
union as a vector also. This allows e.g. a union of two
|
||||
vector types to show up automatically in "info vector". */
|
||||
if (TYPE_VECTOR (field_type))
|
||||
TYPE_VECTOR (type) = 1;
|
||||
}
|
||||
+ return type;
|
||||
+ }
|
||||
+
|
||||
+ case TDESC_TYPE_FLAGS:
|
||||
+ {
|
||||
+ struct type *type, *field_type;
|
||||
+ struct tdesc_type_flag *f;
|
||||
+ int ix;
|
||||
+
|
||||
+ type = arch_flags_type (gdbarch, xstrdup (tdesc_type->name),
|
||||
+ tdesc_type->u.f.size);
|
||||
+ for (ix = 0;
|
||||
+ VEC_iterate (tdesc_type_flag, tdesc_type->u.f.flags, ix, f);
|
||||
+ ix++)
|
||||
+ /* Note that contrary to the function name, this call will
|
||||
+ just set the properties of an already-allocated
|
||||
+ field. */
|
||||
+ append_flags_type_flag (type, f->start, f->name);
|
||||
|
||||
return type;
|
||||
}
|
||||
@@ -1161,6 +1257,7 @@ tdesc_free_type (struct tdesc_type *type
|
||||
|
||||
switch (type->kind)
|
||||
{
|
||||
+ case TDESC_TYPE_STRUCT:
|
||||
case TDESC_TYPE_UNION:
|
||||
{
|
||||
struct tdesc_type_field *f;
|
||||
@@ -1175,6 +1272,20 @@ tdesc_free_type (struct tdesc_type *type
|
||||
}
|
||||
break;
|
||||
|
||||
+ case TDESC_TYPE_FLAGS:
|
||||
+ {
|
||||
+ struct tdesc_type_flag *f;
|
||||
+ int ix;
|
||||
+
|
||||
+ for (ix = 0;
|
||||
+ VEC_iterate (tdesc_type_flag, type->u.f.flags, ix, f);
|
||||
+ ix++)
|
||||
+ xfree (f->name);
|
||||
+
|
||||
+ VEC_free (tdesc_type_flag, type->u.f.flags);
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1199,6 +1310,29 @@ tdesc_create_vector (struct tdesc_featur
|
||||
}
|
||||
|
||||
struct tdesc_type *
|
||||
+tdesc_create_struct (struct tdesc_feature *feature, const char *name)
|
||||
+{
|
||||
+ struct tdesc_type *type = XZALLOC (struct tdesc_type);
|
||||
+
|
||||
+ type->name = xstrdup (name);
|
||||
+ type->kind = TDESC_TYPE_STRUCT;
|
||||
+
|
||||
+ VEC_safe_push (tdesc_type_p, feature->types, type);
|
||||
+ return type;
|
||||
+}
|
||||
+
|
||||
+/* Set the total length of TYPE. Structs which contain bitfields may
|
||||
+ omit the reserved bits, so the end of the last field may not
|
||||
+ suffice. */
|
||||
+
|
||||
+void
|
||||
+tdesc_set_struct_size (struct tdesc_type *type, LONGEST size)
|
||||
+{
|
||||
+ gdb_assert (type->kind == TDESC_TYPE_STRUCT);
|
||||
+ type->u.u.size = size;
|
||||
+}
|
||||
+
|
||||
+struct tdesc_type *
|
||||
tdesc_create_union (struct tdesc_feature *feature, const char *name)
|
||||
{
|
||||
struct tdesc_type *type = XZALLOC (struct tdesc_type);
|
||||
@@ -1210,13 +1344,32 @@ tdesc_create_union (struct tdesc_feature
|
||||
return type;
|
||||
}
|
||||
|
||||
+struct tdesc_type *
|
||||
+tdesc_create_flags (struct tdesc_feature *feature, const char *name,
|
||||
+ LONGEST size)
|
||||
+{
|
||||
+ struct tdesc_type *type = XZALLOC (struct tdesc_type);
|
||||
+
|
||||
+ type->name = xstrdup (name);
|
||||
+ type->kind = TDESC_TYPE_FLAGS;
|
||||
+ type->u.f.size = size;
|
||||
+
|
||||
+ VEC_safe_push (tdesc_type_p, feature->types, type);
|
||||
+ return type;
|
||||
+}
|
||||
+
|
||||
+/* Add a new field. Return a temporary pointer to the field, which
|
||||
+ is only valid until the next call to tdesc_add_field (the vector
|
||||
+ might be reallocated). */
|
||||
+
|
||||
void
|
||||
tdesc_add_field (struct tdesc_type *type, const char *field_name,
|
||||
struct tdesc_type *field_type)
|
||||
{
|
||||
struct tdesc_type_field f = { 0 };
|
||||
|
||||
- gdb_assert (type->kind == TDESC_TYPE_UNION);
|
||||
+ gdb_assert (type->kind == TDESC_TYPE_UNION
|
||||
+ || type->kind == TDESC_TYPE_STRUCT);
|
||||
|
||||
f.name = xstrdup (field_name);
|
||||
f.type = field_type;
|
||||
@@ -1224,6 +1377,37 @@ tdesc_add_field (struct tdesc_type *type
|
||||
VEC_safe_push (tdesc_type_field, type->u.u.fields, &f);
|
||||
}
|
||||
|
||||
+/* Add a new bitfield. */
|
||||
+
|
||||
+void
|
||||
+tdesc_add_bitfield (struct tdesc_type *type, const char *field_name,
|
||||
+ int start, int end)
|
||||
+{
|
||||
+ struct tdesc_type_field f = { 0 };
|
||||
+
|
||||
+ gdb_assert (type->kind == TDESC_TYPE_STRUCT);
|
||||
+
|
||||
+ f.name = xstrdup (field_name);
|
||||
+ f.start = start;
|
||||
+ f.end = end;
|
||||
+
|
||||
+ VEC_safe_push (tdesc_type_field, type->u.u.fields, &f);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+tdesc_add_flag (struct tdesc_type *type, int start,
|
||||
+ const char *flag_name)
|
||||
+{
|
||||
+ struct tdesc_type_flag f = { 0 };
|
||||
+
|
||||
+ gdb_assert (type->kind == TDESC_TYPE_FLAGS);
|
||||
+
|
||||
+ f.name = xstrdup (flag_name);
|
||||
+ f.start = start;
|
||||
+
|
||||
+ VEC_safe_push (tdesc_type_flag, type->u.f.flags, &f);
|
||||
+}
|
||||
+
|
||||
static void
|
||||
tdesc_free_feature (struct tdesc_feature *feature)
|
||||
{
|
||||
--- gdb-7.1-p0/gdb/target-descriptions.h 2010-02-10 19:45:03.000000000 +0100
|
||||
+++ gdb-7.1/gdb/target-descriptions.h 2010-04-03 21:04:13.000000000 +0200
|
||||
@@ -205,10 +205,20 @@ struct tdesc_type *tdesc_create_vector (
|
||||
const char *name,
|
||||
struct tdesc_type *field_type,
|
||||
int count);
|
||||
+struct tdesc_type *tdesc_create_struct (struct tdesc_feature *feature,
|
||||
+ const char *name);
|
||||
+void tdesc_set_struct_size (struct tdesc_type *type, LONGEST size);
|
||||
struct tdesc_type *tdesc_create_union (struct tdesc_feature *feature,
|
||||
const char *name);
|
||||
+struct tdesc_type *tdesc_create_flags (struct tdesc_feature *feature,
|
||||
+ const char *name,
|
||||
+ LONGEST size);
|
||||
void tdesc_add_field (struct tdesc_type *type, const char *field_name,
|
||||
struct tdesc_type *field_type);
|
||||
+void tdesc_add_bitfield (struct tdesc_type *type, const char *field_name,
|
||||
+ int start, int end);
|
||||
+void tdesc_add_flag (struct tdesc_type *type, int start,
|
||||
+ const char *flag_name);
|
||||
void tdesc_create_reg (struct tdesc_feature *feature, const char *name,
|
||||
int regnum, int save_restore, const char *group,
|
||||
int bitsize, const char *type);
|
||||
--- gdb-7.1-p0/gdb/testsuite/gdb.xml/extra-regs.xml 2007-02-08 22:00:36.000000000 +0100
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.xml/extra-regs.xml 2010-04-03 21:04:13.000000000 +0200
|
||||
@@ -8,9 +8,27 @@
|
||||
<field name="v2" type="v2int16"/>
|
||||
</union>
|
||||
|
||||
+ <struct id="struct1">
|
||||
+ <field name="v4" type="v4int8"/>
|
||||
+ <field name="v2" type="v2int16"/>
|
||||
+ </struct>
|
||||
+
|
||||
+ <struct id="struct2" size="8">
|
||||
+ <field name="f1" start="0" end="34"/>
|
||||
+ <field name="f2" start="63" end="63"/>
|
||||
+ </struct>
|
||||
+
|
||||
+ <flags id="flags" size="4">
|
||||
+ <field name="X" start="0" end="0"/>
|
||||
+ <field name="Y" start="2" end="2"/>
|
||||
+ </flags>
|
||||
+
|
||||
<reg name="extrareg" bitsize="32"/>
|
||||
<reg name="uintreg" bitsize="32" type="uint32"/>
|
||||
<reg name="vecreg" bitsize="32" type="v4int8"/>
|
||||
<reg name="unionreg" bitsize="32" type="vecint"/>
|
||||
+ <reg name="structreg" bitsize="64" type="struct1"/>
|
||||
+ <reg name="bitfields" bitsize="64" type="struct2"/>
|
||||
+ <reg name="flags" bitsize="32" type="flags"/>
|
||||
</feature>
|
||||
</target>
|
||||
--- gdb-7.1-p0/gdb/testsuite/gdb.xml/tdesc-regs.exp 2010-04-03 20:59:52.000000000 +0200
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.xml/tdesc-regs.exp 2010-04-03 21:04:13.000000000 +0200
|
||||
@@ -141,6 +141,11 @@ gdb_test "ptype \$vecreg" "type = int8_t
|
||||
gdb_test "ptype \$unionreg" \
|
||||
"type = union {\r\n *v4int8 v4;\r\n *v2int16 v2;\r\n}"
|
||||
gdb_test "ptype \$unionreg.v4" "type = int8_t \\\[4\\\]"
|
||||
+gdb_test "ptype \$structreg" \
|
||||
+ "type = struct struct1 {\r\n *v4int8 v4;\r\n *v2int16 v2;\r\n}"
|
||||
+gdb_test "ptype \$structreg.v4" "type = int8_t \\\[4\\\]"
|
||||
+gdb_test "ptype \$bitfields" \
|
||||
+ "type = struct struct2 {\r\n *uint64_t f1 : 35;\r\n *uint64_t f2 : 1;\r\n}"
|
||||
|
||||
load_description "core-only.xml" ""
|
||||
# The extra register from the previous description should be gone.
|
||||
--- gdb-7.1-p0/gdb/xml-tdesc.c 2010-01-01 08:31:46.000000000 +0100
|
||||
+++ gdb-7.1/gdb/xml-tdesc.c 2010-04-03 21:04:13.000000000 +0200
|
||||
@@ -85,8 +85,15 @@ struct tdesc_parsing_data
|
||||
it does not have its own. This starts at zero. */
|
||||
int next_regnum;
|
||||
|
||||
- /* The union we are currently parsing, or last parsed. */
|
||||
- struct tdesc_type *current_union;
|
||||
+ /* The struct or union we are currently parsing, or last parsed. */
|
||||
+ struct tdesc_type *current_type;
|
||||
+
|
||||
+ /* The byte size of the current struct type, if specified. Zero
|
||||
+ if not specified. */
|
||||
+ int current_type_size;
|
||||
+
|
||||
+ /* Whether the current type is a flags type. */
|
||||
+ int current_type_is_flags;
|
||||
};
|
||||
|
||||
/* Handle the end of an <architecture> element and its value. */
|
||||
@@ -229,11 +236,57 @@ tdesc_start_union (struct gdb_xml_parser
|
||||
struct tdesc_parsing_data *data = user_data;
|
||||
char *id = VEC_index (gdb_xml_value_s, attributes, 0)->value;
|
||||
|
||||
- data->current_union = tdesc_create_union (data->current_feature, id);
|
||||
+ data->current_type = tdesc_create_union (data->current_feature, id);
|
||||
+ data->current_type_size = 0;
|
||||
+ data->current_type_is_flags = 0;
|
||||
+}
|
||||
+
|
||||
+/* Handle the start of a <struct> element. Initialize the type and
|
||||
+ record it with the current feature. */
|
||||
+
|
||||
+static void
|
||||
+tdesc_start_struct (struct gdb_xml_parser *parser,
|
||||
+ const struct gdb_xml_element *element,
|
||||
+ void *user_data, VEC(gdb_xml_value_s) *attributes)
|
||||
+{
|
||||
+ struct tdesc_parsing_data *data = user_data;
|
||||
+ char *id = VEC_index (gdb_xml_value_s, attributes, 0)->value;
|
||||
+ struct tdesc_type *type;
|
||||
+
|
||||
+ type = tdesc_create_struct (data->current_feature, id);
|
||||
+ data->current_type = type;
|
||||
+ data->current_type_size = 0;
|
||||
+ data->current_type_is_flags = 0;
|
||||
+
|
||||
+ if (VEC_length (gdb_xml_value_s, attributes) > 1)
|
||||
+ {
|
||||
+ int size = (int) * (ULONGEST *)
|
||||
+ VEC_index (gdb_xml_value_s, attributes, 1)->value;
|
||||
+ tdesc_set_struct_size (type, size);
|
||||
+ data->current_type_size = size;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+tdesc_start_flags (struct gdb_xml_parser *parser,
|
||||
+ const struct gdb_xml_element *element,
|
||||
+ void *user_data, VEC(gdb_xml_value_s) *attributes)
|
||||
+{
|
||||
+ struct tdesc_parsing_data *data = user_data;
|
||||
+ char *id = VEC_index (gdb_xml_value_s, attributes, 0)->value;
|
||||
+ int length = (int) * (ULONGEST *)
|
||||
+ VEC_index (gdb_xml_value_s, attributes, 1)->value;
|
||||
+ struct tdesc_type *type;
|
||||
+
|
||||
+ type = tdesc_create_flags (data->current_feature, id, length);
|
||||
+
|
||||
+ data->current_type = type;
|
||||
+ data->current_type_size = 0;
|
||||
+ data->current_type_is_flags = 1;
|
||||
}
|
||||
|
||||
/* Handle the start of a <field> element. Attach the field to the
|
||||
- current union. */
|
||||
+ current struct or union. */
|
||||
|
||||
static void
|
||||
tdesc_start_field (struct gdb_xml_parser *parser,
|
||||
@@ -241,20 +294,84 @@ tdesc_start_field (struct gdb_xml_parser
|
||||
void *user_data, VEC(gdb_xml_value_s) *attributes)
|
||||
{
|
||||
struct tdesc_parsing_data *data = user_data;
|
||||
+ int ix = 0, length;
|
||||
struct gdb_xml_value *attrs = VEC_address (gdb_xml_value_s, attributes);
|
||||
struct tdesc_type *field_type;
|
||||
char *field_name, *field_type_id;
|
||||
+ int start, end;
|
||||
|
||||
- field_name = attrs[0].value;
|
||||
- field_type_id = attrs[1].value;
|
||||
+ length = VEC_length (gdb_xml_value_s, attributes);
|
||||
|
||||
- field_type = tdesc_named_type (data->current_feature, field_type_id);
|
||||
- if (field_type == NULL)
|
||||
- gdb_xml_error (parser, _("Union field \"%s\" references undefined "
|
||||
- "type \"%s\""),
|
||||
- field_name, field_type_id);
|
||||
+ field_name = attrs[ix++].value;
|
||||
+
|
||||
+ if (ix < length && strcmp (attrs[ix].name, "type") == 0)
|
||||
+ field_type_id = attrs[ix++].value;
|
||||
+ else
|
||||
+ field_type_id = NULL;
|
||||
+
|
||||
+ if (ix < length && strcmp (attrs[ix].name, "start") == 0)
|
||||
+ start = * (ULONGEST *) attrs[ix++].value;
|
||||
+ else
|
||||
+ start = -1;
|
||||
+
|
||||
+ if (ix < length && strcmp (attrs[ix].name, "end") == 0)
|
||||
+ end = * (ULONGEST *) attrs[ix++].value;
|
||||
+ else
|
||||
+ end = -1;
|
||||
+
|
||||
+ if (field_type_id != NULL)
|
||||
+ {
|
||||
+ if (data->current_type_is_flags)
|
||||
+ gdb_xml_error (parser, _("Cannot add typed field \"%s\" to flags"),
|
||||
+ field_name);
|
||||
+ if (data->current_type_size != 0)
|
||||
+ gdb_xml_error (parser,
|
||||
+ _("Explicitly sized type can not contain non-bitfield \"%s\""),
|
||||
+ field_name);
|
||||
+
|
||||
+ field_type = tdesc_named_type (data->current_feature, field_type_id);
|
||||
+ if (field_type == NULL)
|
||||
+ gdb_xml_error (parser, _("Field \"%s\" references undefined "
|
||||
+ "type \"%s\""),
|
||||
+ field_name, field_type_id);
|
||||
+
|
||||
+ tdesc_add_field (data->current_type, field_name, field_type);
|
||||
+ }
|
||||
+ else if (start != -1 && end != -1)
|
||||
+ {
|
||||
+ struct tdesc_type *t = data->current_type;
|
||||
+
|
||||
+ if (data->current_type_is_flags)
|
||||
+ tdesc_add_flag (t, start, field_name);
|
||||
+ else
|
||||
+ {
|
||||
+ if (data->current_type_size == 0)
|
||||
+ gdb_xml_error (parser,
|
||||
+ _("Implicitly sized type can not contain bitfield \"%s\""),
|
||||
+ field_name);
|
||||
+
|
||||
+ if (end >= 64)
|
||||
+ gdb_xml_error (parser,
|
||||
+ _("Bitfield \"%s\" goes past 64 bits (unsupported)"),
|
||||
+ field_name);
|
||||
+
|
||||
+ /* Assume that the bit numbering in XML is "lsb-zero". Most
|
||||
+ architectures other than PowerPC use this ordering. In
|
||||
+ the future, we can add an XML tag to indicate "msb-zero"
|
||||
+ numbering. */
|
||||
+ if (start > end)
|
||||
+ gdb_xml_error (parser, _("Bitfield \"%s\" has start after end"),
|
||||
+ field_name);
|
||||
|
||||
- tdesc_add_field (data->current_union, field_name, field_type);
|
||||
+ if (end >= data->current_type_size * TARGET_CHAR_BIT)
|
||||
+ gdb_xml_error (parser, _("Bitfield \"%s\" does not fit in struct"));
|
||||
+
|
||||
+ tdesc_add_bitfield (t, field_name, start, end);
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ gdb_xml_error (parser, _("Field \"%s\" has neither type nor bit position"),
|
||||
+ field_name);
|
||||
}
|
||||
|
||||
/* Handle the start of a <vector> element. Initialize the type and
|
||||
@@ -287,11 +404,13 @@ tdesc_start_vector (struct gdb_xml_parse
|
||||
|
||||
static const struct gdb_xml_attribute field_attributes[] = {
|
||||
{ "name", GDB_XML_AF_NONE, NULL, NULL },
|
||||
- { "type", GDB_XML_AF_NONE, NULL, NULL },
|
||||
+ { "type", GDB_XML_AF_OPTIONAL, NULL, NULL },
|
||||
+ { "start", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
|
||||
+ { "end", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
|
||||
{ NULL, GDB_XML_AF_NONE, NULL, NULL }
|
||||
};
|
||||
|
||||
-static const struct gdb_xml_element union_children[] = {
|
||||
+static const struct gdb_xml_element struct_union_children[] = {
|
||||
{ "field", field_attributes, NULL, GDB_XML_EF_REPEATABLE,
|
||||
tdesc_start_field, NULL },
|
||||
{ NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
|
||||
@@ -308,8 +427,15 @@ static const struct gdb_xml_attribute re
|
||||
{ NULL, GDB_XML_AF_NONE, NULL, NULL }
|
||||
};
|
||||
|
||||
-static const struct gdb_xml_attribute union_attributes[] = {
|
||||
+static const struct gdb_xml_attribute struct_union_attributes[] = {
|
||||
{ "id", GDB_XML_AF_NONE, NULL, NULL },
|
||||
+ { "size", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL},
|
||||
+ { NULL, GDB_XML_AF_NONE, NULL, NULL }
|
||||
+};
|
||||
+
|
||||
+static const struct gdb_xml_attribute flags_attributes[] = {
|
||||
+ { "id", GDB_XML_AF_NONE, NULL, NULL },
|
||||
+ { "size", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL},
|
||||
{ NULL, GDB_XML_AF_NONE, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -329,9 +455,15 @@ static const struct gdb_xml_element feat
|
||||
{ "reg", reg_attributes, NULL,
|
||||
GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
|
||||
tdesc_start_reg, NULL },
|
||||
- { "union", union_attributes, union_children,
|
||||
+ { "struct", struct_union_attributes, struct_union_children,
|
||||
+ GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
|
||||
+ tdesc_start_struct, NULL },
|
||||
+ { "union", struct_union_attributes, struct_union_children,
|
||||
GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
|
||||
tdesc_start_union, NULL },
|
||||
+ { "flags", flags_attributes, struct_union_children,
|
||||
+ GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
|
||||
+ tdesc_start_flags, NULL },
|
||||
{ "vector", vector_attributes, NULL,
|
||||
GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
|
||||
tdesc_start_vector, NULL },
|
457
gdb-bz578250-avx-03of10.patch
Normal file
457
gdb-bz578250-avx-03of10.patch
Normal file
@ -0,0 +1,457 @@
|
||||
[ Backported. ]
|
||||
|
||||
commit 0257d639d42f896a359993ae8adb5792e280f65f
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Mon Mar 1 17:26:02 2010 +0000
|
||||
|
||||
Remove TDESC_TYPE_I386_EFLAGS and TDESC_TYPE_I386_MXCSR.
|
||||
|
||||
2010-03-01 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* target-descriptions.c (tdesc_type): Remove
|
||||
TDESC_TYPE_I386_EFLAGS and TDESC_TYPE_I386_MXCSR.
|
||||
(tdesc_predefined_types): Likewise.
|
||||
(tdesc_gdb_type): Likewise. Pass NULL to append_flags_type_flag
|
||||
if flag name is empty.
|
||||
(maint_print_c_tdesc_cmd): Handle TDESC_TYPE_FLAGS.
|
||||
|
||||
* features/i386/32bit-core.xml: Define i386_eflags.
|
||||
* features/i386/64bit-core.xml: Likewise.
|
||||
|
||||
* features/i386/32bit-sse.xml: Define i386_mxcsr.
|
||||
* features/i386/64bit-sse.xml: Likewise.
|
||||
|
||||
* features/i386/amd64-linux.c: Regenerated.
|
||||
* features/i386/amd64.c: Likewise.
|
||||
* features/i386/i386-linux.c: Likewise.
|
||||
* features/i386/i386.c: Likewise.
|
||||
|
||||
--- gdb-7.1-p1/gdb/features/i386/32bit-core.xml 2010-02-08 06:08:46.000000000 +0100
|
||||
+++ gdb-7.1/gdb/features/i386/32bit-core.xml 2010-04-03 21:06:12.000000000 +0200
|
||||
@@ -7,6 +7,26 @@
|
||||
|
||||
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
|
||||
<feature name="org.gnu.gdb.i386.core">
|
||||
+ <flags id="i386_eflags" size="4">
|
||||
+ <field name="CF" start="0" end="0"/>
|
||||
+ <field name="" start="1" end="1"/>
|
||||
+ <field name="PF" start="2" end="2"/>
|
||||
+ <field name="AF" start="4" end="4"/>
|
||||
+ <field name="ZF" start="6" end="6"/>
|
||||
+ <field name="SF" start="7" end="7"/>
|
||||
+ <field name="TF" start="8" end="8"/>
|
||||
+ <field name="IF" start="9" end="9"/>
|
||||
+ <field name="DF" start="10" end="10"/>
|
||||
+ <field name="OF" start="11" end="11"/>
|
||||
+ <field name="NT" start="14" end="14"/>
|
||||
+ <field name="RF" start="16" end="16"/>
|
||||
+ <field name="VM" start="17" end="17"/>
|
||||
+ <field name="AC" start="18" end="18"/>
|
||||
+ <field name="VIF" start="19" end="19"/>
|
||||
+ <field name="VIP" start="20" end="20"/>
|
||||
+ <field name="ID" start="21" end="21"/>
|
||||
+ </flags>
|
||||
+
|
||||
<reg name="eax" bitsize="32" type="int32"/>
|
||||
<reg name="ecx" bitsize="32" type="int32"/>
|
||||
<reg name="edx" bitsize="32" type="int32"/>
|
||||
--- gdb-7.1-p1/gdb/features/i386/32bit-sse.xml 2010-02-08 06:08:46.000000000 +0100
|
||||
+++ gdb-7.1/gdb/features/i386/32bit-sse.xml 2010-04-03 21:06:12.000000000 +0200
|
||||
@@ -22,6 +22,22 @@
|
||||
<field name="v2_int64" type="v2i64"/>
|
||||
<field name="uint128" type="uint128"/>
|
||||
</union>
|
||||
+ <flags id="i386_mxcsr" size="4">
|
||||
+ <field name="IE" start="0" end="0"/>
|
||||
+ <field name="DE" start="1" end="1"/>
|
||||
+ <field name="ZE" start="2" end="2"/>
|
||||
+ <field name="OE" start="3" end="3"/>
|
||||
+ <field name="UE" start="4" end="4"/>
|
||||
+ <field name="PE" start="5" end="5"/>
|
||||
+ <field name="DAZ" start="6" end="6"/>
|
||||
+ <field name="IM" start="7" end="7"/>
|
||||
+ <field name="DM" start="8" end="8"/>
|
||||
+ <field name="ZM" start="9" end="9"/>
|
||||
+ <field name="OM" start="10" end="10"/>
|
||||
+ <field name="UM" start="11" end="11"/>
|
||||
+ <field name="PM" start="12" end="12"/>
|
||||
+ <field name="FZ" start="15" end="15"/>
|
||||
+ </flags>
|
||||
|
||||
<reg name="xmm0" bitsize="128" type="vec128" regnum="32"/>
|
||||
<reg name="xmm1" bitsize="128" type="vec128"/>
|
||||
--- gdb-7.1-p1/gdb/features/i386/64bit-core.xml 2010-02-08 06:08:46.000000000 +0100
|
||||
+++ gdb-7.1/gdb/features/i386/64bit-core.xml 2010-04-03 21:06:12.000000000 +0200
|
||||
@@ -7,6 +7,26 @@
|
||||
|
||||
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
|
||||
<feature name="org.gnu.gdb.i386.core">
|
||||
+ <flags id="i386_eflags" size="4">
|
||||
+ <field name="CF" start="0" end="0"/>
|
||||
+ <field name="" start="1" end="1"/>
|
||||
+ <field name="PF" start="2" end="2"/>
|
||||
+ <field name="AF" start="4" end="4"/>
|
||||
+ <field name="ZF" start="6" end="6"/>
|
||||
+ <field name="SF" start="7" end="7"/>
|
||||
+ <field name="TF" start="8" end="8"/>
|
||||
+ <field name="IF" start="9" end="9"/>
|
||||
+ <field name="DF" start="10" end="10"/>
|
||||
+ <field name="OF" start="11" end="11"/>
|
||||
+ <field name="NT" start="14" end="14"/>
|
||||
+ <field name="RF" start="16" end="16"/>
|
||||
+ <field name="VM" start="17" end="17"/>
|
||||
+ <field name="AC" start="18" end="18"/>
|
||||
+ <field name="VIF" start="19" end="19"/>
|
||||
+ <field name="VIP" start="20" end="20"/>
|
||||
+ <field name="ID" start="21" end="21"/>
|
||||
+ </flags>
|
||||
+
|
||||
<reg name="rax" bitsize="64" type="int64"/>
|
||||
<reg name="rbx" bitsize="64" type="int64"/>
|
||||
<reg name="rcx" bitsize="64" type="int64"/>
|
||||
--- gdb-7.1-p1/gdb/features/i386/64bit-sse.xml 2010-02-08 06:08:46.000000000 +0100
|
||||
+++ gdb-7.1/gdb/features/i386/64bit-sse.xml 2010-04-03 21:06:12.000000000 +0200
|
||||
@@ -22,6 +22,22 @@
|
||||
<field name="v2_int64" type="v2i64"/>
|
||||
<field name="uint128" type="uint128"/>
|
||||
</union>
|
||||
+ <flags id="i386_mxcsr" size="4">
|
||||
+ <field name="IE" start="0" end="0"/>
|
||||
+ <field name="DE" start="1" end="1"/>
|
||||
+ <field name="ZE" start="2" end="2"/>
|
||||
+ <field name="OE" start="3" end="3"/>
|
||||
+ <field name="UE" start="4" end="4"/>
|
||||
+ <field name="PE" start="5" end="5"/>
|
||||
+ <field name="DAZ" start="6" end="6"/>
|
||||
+ <field name="IM" start="7" end="7"/>
|
||||
+ <field name="DM" start="8" end="8"/>
|
||||
+ <field name="ZM" start="9" end="9"/>
|
||||
+ <field name="OM" start="10" end="10"/>
|
||||
+ <field name="UM" start="11" end="11"/>
|
||||
+ <field name="PM" start="12" end="12"/>
|
||||
+ <field name="FZ" start="15" end="15"/>
|
||||
+ </flags>
|
||||
|
||||
<reg name="xmm0" bitsize="128" type="vec128" regnum="40"/>
|
||||
<reg name="xmm1" bitsize="128" type="vec128"/>
|
||||
--- gdb-7.1-p1/gdb/features/i386/amd64-linux.c 2010-02-08 06:08:46.000000000 +0100
|
||||
+++ gdb-7.1/gdb/features/i386/amd64-linux.c 2010-04-03 21:06:12.000000000 +0200
|
||||
@@ -17,6 +17,25 @@ initialize_tdesc_amd64_linux (void)
|
||||
set_tdesc_osabi (result, osabi_from_tdesc_string ("GNU/Linux"));
|
||||
|
||||
feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core");
|
||||
+ field_type = tdesc_create_flags (feature, "i386_eflags", 4);
|
||||
+ tdesc_add_flag (field_type, 0, "CF");
|
||||
+ tdesc_add_flag (field_type, 1, "");
|
||||
+ tdesc_add_flag (field_type, 2, "PF");
|
||||
+ tdesc_add_flag (field_type, 4, "AF");
|
||||
+ tdesc_add_flag (field_type, 6, "ZF");
|
||||
+ tdesc_add_flag (field_type, 7, "SF");
|
||||
+ tdesc_add_flag (field_type, 8, "TF");
|
||||
+ tdesc_add_flag (field_type, 9, "IF");
|
||||
+ tdesc_add_flag (field_type, 10, "DF");
|
||||
+ tdesc_add_flag (field_type, 11, "OF");
|
||||
+ tdesc_add_flag (field_type, 14, "NT");
|
||||
+ tdesc_add_flag (field_type, 16, "RF");
|
||||
+ tdesc_add_flag (field_type, 17, "VM");
|
||||
+ tdesc_add_flag (field_type, 18, "AC");
|
||||
+ tdesc_add_flag (field_type, 19, "VIF");
|
||||
+ tdesc_add_flag (field_type, 20, "VIP");
|
||||
+ tdesc_add_flag (field_type, 21, "ID");
|
||||
+
|
||||
tdesc_create_reg (feature, "rax", 0, 1, NULL, 64, "int64");
|
||||
tdesc_create_reg (feature, "rbx", 1, 1, NULL, 64, "int64");
|
||||
tdesc_create_reg (feature, "rcx", 2, 1, NULL, 64, "int64");
|
||||
@@ -93,6 +112,22 @@ initialize_tdesc_amd64_linux (void)
|
||||
field_type = tdesc_named_type (feature, "uint128");
|
||||
tdesc_add_field (type, "uint128", field_type);
|
||||
|
||||
+ field_type = tdesc_create_flags (feature, "i386_mxcsr", 4);
|
||||
+ tdesc_add_flag (field_type, 0, "IE");
|
||||
+ tdesc_add_flag (field_type, 1, "DE");
|
||||
+ tdesc_add_flag (field_type, 2, "ZE");
|
||||
+ tdesc_add_flag (field_type, 3, "OE");
|
||||
+ tdesc_add_flag (field_type, 4, "UE");
|
||||
+ tdesc_add_flag (field_type, 5, "PE");
|
||||
+ tdesc_add_flag (field_type, 6, "DAZ");
|
||||
+ tdesc_add_flag (field_type, 7, "IM");
|
||||
+ tdesc_add_flag (field_type, 8, "DM");
|
||||
+ tdesc_add_flag (field_type, 9, "ZM");
|
||||
+ tdesc_add_flag (field_type, 10, "OM");
|
||||
+ tdesc_add_flag (field_type, 11, "UM");
|
||||
+ tdesc_add_flag (field_type, 12, "PM");
|
||||
+ tdesc_add_flag (field_type, 15, "FZ");
|
||||
+
|
||||
tdesc_create_reg (feature, "xmm0", 40, 1, NULL, 128, "vec128");
|
||||
tdesc_create_reg (feature, "xmm1", 41, 1, NULL, 128, "vec128");
|
||||
tdesc_create_reg (feature, "xmm2", 42, 1, NULL, 128, "vec128");
|
||||
--- gdb-7.1-p1/gdb/features/i386/amd64.c 2010-02-08 06:08:46.000000000 +0100
|
||||
+++ gdb-7.1/gdb/features/i386/amd64.c 2010-04-03 21:06:12.000000000 +0200
|
||||
@@ -15,6 +15,25 @@ initialize_tdesc_amd64 (void)
|
||||
set_tdesc_architecture (result, bfd_scan_arch ("i386:x86-64"));
|
||||
|
||||
feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core");
|
||||
+ field_type = tdesc_create_flags (feature, "i386_eflags", 4);
|
||||
+ tdesc_add_flag (field_type, 0, "CF");
|
||||
+ tdesc_add_flag (field_type, 1, "");
|
||||
+ tdesc_add_flag (field_type, 2, "PF");
|
||||
+ tdesc_add_flag (field_type, 4, "AF");
|
||||
+ tdesc_add_flag (field_type, 6, "ZF");
|
||||
+ tdesc_add_flag (field_type, 7, "SF");
|
||||
+ tdesc_add_flag (field_type, 8, "TF");
|
||||
+ tdesc_add_flag (field_type, 9, "IF");
|
||||
+ tdesc_add_flag (field_type, 10, "DF");
|
||||
+ tdesc_add_flag (field_type, 11, "OF");
|
||||
+ tdesc_add_flag (field_type, 14, "NT");
|
||||
+ tdesc_add_flag (field_type, 16, "RF");
|
||||
+ tdesc_add_flag (field_type, 17, "VM");
|
||||
+ tdesc_add_flag (field_type, 18, "AC");
|
||||
+ tdesc_add_flag (field_type, 19, "VIF");
|
||||
+ tdesc_add_flag (field_type, 20, "VIP");
|
||||
+ tdesc_add_flag (field_type, 21, "ID");
|
||||
+
|
||||
tdesc_create_reg (feature, "rax", 0, 1, NULL, 64, "int64");
|
||||
tdesc_create_reg (feature, "rbx", 1, 1, NULL, 64, "int64");
|
||||
tdesc_create_reg (feature, "rcx", 2, 1, NULL, 64, "int64");
|
||||
@@ -91,6 +110,22 @@ initialize_tdesc_amd64 (void)
|
||||
field_type = tdesc_named_type (feature, "uint128");
|
||||
tdesc_add_field (type, "uint128", field_type);
|
||||
|
||||
+ field_type = tdesc_create_flags (feature, "i386_mxcsr", 4);
|
||||
+ tdesc_add_flag (field_type, 0, "IE");
|
||||
+ tdesc_add_flag (field_type, 1, "DE");
|
||||
+ tdesc_add_flag (field_type, 2, "ZE");
|
||||
+ tdesc_add_flag (field_type, 3, "OE");
|
||||
+ tdesc_add_flag (field_type, 4, "UE");
|
||||
+ tdesc_add_flag (field_type, 5, "PE");
|
||||
+ tdesc_add_flag (field_type, 6, "DAZ");
|
||||
+ tdesc_add_flag (field_type, 7, "IM");
|
||||
+ tdesc_add_flag (field_type, 8, "DM");
|
||||
+ tdesc_add_flag (field_type, 9, "ZM");
|
||||
+ tdesc_add_flag (field_type, 10, "OM");
|
||||
+ tdesc_add_flag (field_type, 11, "UM");
|
||||
+ tdesc_add_flag (field_type, 12, "PM");
|
||||
+ tdesc_add_flag (field_type, 15, "FZ");
|
||||
+
|
||||
tdesc_create_reg (feature, "xmm0", 40, 1, NULL, 128, "vec128");
|
||||
tdesc_create_reg (feature, "xmm1", 41, 1, NULL, 128, "vec128");
|
||||
tdesc_create_reg (feature, "xmm2", 42, 1, NULL, 128, "vec128");
|
||||
--- gdb-7.1-p1/gdb/features/i386/i386-linux.c 2010-02-08 06:08:46.000000000 +0100
|
||||
+++ gdb-7.1/gdb/features/i386/i386-linux.c 2010-04-03 21:06:12.000000000 +0200
|
||||
@@ -17,6 +17,25 @@ initialize_tdesc_i386_linux (void)
|
||||
set_tdesc_osabi (result, osabi_from_tdesc_string ("GNU/Linux"));
|
||||
|
||||
feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core");
|
||||
+ field_type = tdesc_create_flags (feature, "i386_eflags", 4);
|
||||
+ tdesc_add_flag (field_type, 0, "CF");
|
||||
+ tdesc_add_flag (field_type, 1, "");
|
||||
+ tdesc_add_flag (field_type, 2, "PF");
|
||||
+ tdesc_add_flag (field_type, 4, "AF");
|
||||
+ tdesc_add_flag (field_type, 6, "ZF");
|
||||
+ tdesc_add_flag (field_type, 7, "SF");
|
||||
+ tdesc_add_flag (field_type, 8, "TF");
|
||||
+ tdesc_add_flag (field_type, 9, "IF");
|
||||
+ tdesc_add_flag (field_type, 10, "DF");
|
||||
+ tdesc_add_flag (field_type, 11, "OF");
|
||||
+ tdesc_add_flag (field_type, 14, "NT");
|
||||
+ tdesc_add_flag (field_type, 16, "RF");
|
||||
+ tdesc_add_flag (field_type, 17, "VM");
|
||||
+ tdesc_add_flag (field_type, 18, "AC");
|
||||
+ tdesc_add_flag (field_type, 19, "VIF");
|
||||
+ tdesc_add_flag (field_type, 20, "VIP");
|
||||
+ tdesc_add_flag (field_type, 21, "ID");
|
||||
+
|
||||
tdesc_create_reg (feature, "eax", 0, 1, NULL, 32, "int32");
|
||||
tdesc_create_reg (feature, "ecx", 1, 1, NULL, 32, "int32");
|
||||
tdesc_create_reg (feature, "edx", 2, 1, NULL, 32, "int32");
|
||||
@@ -88,6 +107,22 @@ initialize_tdesc_i386_linux (void)
|
||||
field_type = tdesc_named_type (feature, "uint128");
|
||||
tdesc_add_field (type, "uint128", field_type);
|
||||
|
||||
+ field_type = tdesc_create_flags (feature, "i386_mxcsr", 4);
|
||||
+ tdesc_add_flag (field_type, 0, "IE");
|
||||
+ tdesc_add_flag (field_type, 1, "DE");
|
||||
+ tdesc_add_flag (field_type, 2, "ZE");
|
||||
+ tdesc_add_flag (field_type, 3, "OE");
|
||||
+ tdesc_add_flag (field_type, 4, "UE");
|
||||
+ tdesc_add_flag (field_type, 5, "PE");
|
||||
+ tdesc_add_flag (field_type, 6, "DAZ");
|
||||
+ tdesc_add_flag (field_type, 7, "IM");
|
||||
+ tdesc_add_flag (field_type, 8, "DM");
|
||||
+ tdesc_add_flag (field_type, 9, "ZM");
|
||||
+ tdesc_add_flag (field_type, 10, "OM");
|
||||
+ tdesc_add_flag (field_type, 11, "UM");
|
||||
+ tdesc_add_flag (field_type, 12, "PM");
|
||||
+ tdesc_add_flag (field_type, 15, "FZ");
|
||||
+
|
||||
tdesc_create_reg (feature, "xmm0", 32, 1, NULL, 128, "vec128");
|
||||
tdesc_create_reg (feature, "xmm1", 33, 1, NULL, 128, "vec128");
|
||||
tdesc_create_reg (feature, "xmm2", 34, 1, NULL, 128, "vec128");
|
||||
--- gdb-7.1-p1/gdb/features/i386/i386.c 2010-02-08 06:08:46.000000000 +0100
|
||||
+++ gdb-7.1/gdb/features/i386/i386.c 2010-04-03 21:06:12.000000000 +0200
|
||||
@@ -15,6 +15,25 @@ initialize_tdesc_i386 (void)
|
||||
set_tdesc_architecture (result, bfd_scan_arch ("i386"));
|
||||
|
||||
feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core");
|
||||
+ field_type = tdesc_create_flags (feature, "i386_eflags", 4);
|
||||
+ tdesc_add_flag (field_type, 0, "CF");
|
||||
+ tdesc_add_flag (field_type, 1, "");
|
||||
+ tdesc_add_flag (field_type, 2, "PF");
|
||||
+ tdesc_add_flag (field_type, 4, "AF");
|
||||
+ tdesc_add_flag (field_type, 6, "ZF");
|
||||
+ tdesc_add_flag (field_type, 7, "SF");
|
||||
+ tdesc_add_flag (field_type, 8, "TF");
|
||||
+ tdesc_add_flag (field_type, 9, "IF");
|
||||
+ tdesc_add_flag (field_type, 10, "DF");
|
||||
+ tdesc_add_flag (field_type, 11, "OF");
|
||||
+ tdesc_add_flag (field_type, 14, "NT");
|
||||
+ tdesc_add_flag (field_type, 16, "RF");
|
||||
+ tdesc_add_flag (field_type, 17, "VM");
|
||||
+ tdesc_add_flag (field_type, 18, "AC");
|
||||
+ tdesc_add_flag (field_type, 19, "VIF");
|
||||
+ tdesc_add_flag (field_type, 20, "VIP");
|
||||
+ tdesc_add_flag (field_type, 21, "ID");
|
||||
+
|
||||
tdesc_create_reg (feature, "eax", 0, 1, NULL, 32, "int32");
|
||||
tdesc_create_reg (feature, "ecx", 1, 1, NULL, 32, "int32");
|
||||
tdesc_create_reg (feature, "edx", 2, 1, NULL, 32, "int32");
|
||||
@@ -83,6 +102,22 @@ initialize_tdesc_i386 (void)
|
||||
field_type = tdesc_named_type (feature, "uint128");
|
||||
tdesc_add_field (type, "uint128", field_type);
|
||||
|
||||
+ field_type = tdesc_create_flags (feature, "i386_mxcsr", 4);
|
||||
+ tdesc_add_flag (field_type, 0, "IE");
|
||||
+ tdesc_add_flag (field_type, 1, "DE");
|
||||
+ tdesc_add_flag (field_type, 2, "ZE");
|
||||
+ tdesc_add_flag (field_type, 3, "OE");
|
||||
+ tdesc_add_flag (field_type, 4, "UE");
|
||||
+ tdesc_add_flag (field_type, 5, "PE");
|
||||
+ tdesc_add_flag (field_type, 6, "DAZ");
|
||||
+ tdesc_add_flag (field_type, 7, "IM");
|
||||
+ tdesc_add_flag (field_type, 8, "DM");
|
||||
+ tdesc_add_flag (field_type, 9, "ZM");
|
||||
+ tdesc_add_flag (field_type, 10, "OM");
|
||||
+ tdesc_add_flag (field_type, 11, "UM");
|
||||
+ tdesc_add_flag (field_type, 12, "PM");
|
||||
+ tdesc_add_flag (field_type, 15, "FZ");
|
||||
+
|
||||
tdesc_create_reg (feature, "xmm0", 32, 1, NULL, 128, "vec128");
|
||||
tdesc_create_reg (feature, "xmm1", 33, 1, NULL, 128, "vec128");
|
||||
tdesc_create_reg (feature, "xmm2", 34, 1, NULL, 128, "vec128");
|
||||
--- gdb-7.1-p1/gdb/target-descriptions.c 2010-04-03 21:04:13.000000000 +0200
|
||||
+++ gdb-7.1/gdb/target-descriptions.c 2010-04-03 21:06:12.000000000 +0200
|
||||
@@ -126,8 +126,6 @@ typedef struct tdesc_type
|
||||
TDESC_TYPE_IEEE_DOUBLE,
|
||||
TDESC_TYPE_ARM_FPA_EXT,
|
||||
TDESC_TYPE_I387_EXT,
|
||||
- TDESC_TYPE_I386_EFLAGS,
|
||||
- TDESC_TYPE_I386_MXCSR,
|
||||
|
||||
/* Types defined by a target feature. */
|
||||
TDESC_TYPE_VECTOR,
|
||||
@@ -483,9 +481,7 @@ static struct tdesc_type tdesc_predefine
|
||||
{ "ieee_single", TDESC_TYPE_IEEE_SINGLE },
|
||||
{ "ieee_double", TDESC_TYPE_IEEE_DOUBLE },
|
||||
{ "arm_fpa_ext", TDESC_TYPE_ARM_FPA_EXT },
|
||||
- { "i387_ext", TDESC_TYPE_I387_EXT },
|
||||
- { "i386_eflags", TDESC_TYPE_I386_EFLAGS },
|
||||
- { "i386_mxcsr", TDESC_TYPE_I386_MXCSR }
|
||||
+ { "i387_ext", TDESC_TYPE_I387_EXT }
|
||||
};
|
||||
|
||||
/* Return the type associated with ID in the context of FEATURE, or
|
||||
@@ -607,57 +603,6 @@ tdesc_gdb_type (struct gdbarch *gdbarch,
|
||||
return arch_float_type (gdbarch, -1, "builtin_type_i387_ext",
|
||||
floatformats_i387_ext);
|
||||
|
||||
- case TDESC_TYPE_I386_EFLAGS:
|
||||
- {
|
||||
- struct type *type;
|
||||
-
|
||||
- type = arch_flags_type (gdbarch, "builtin_type_i386_eflags", 4);
|
||||
- append_flags_type_flag (type, 0, "CF");
|
||||
- append_flags_type_flag (type, 1, NULL);
|
||||
- append_flags_type_flag (type, 2, "PF");
|
||||
- append_flags_type_flag (type, 4, "AF");
|
||||
- append_flags_type_flag (type, 6, "ZF");
|
||||
- append_flags_type_flag (type, 7, "SF");
|
||||
- append_flags_type_flag (type, 8, "TF");
|
||||
- append_flags_type_flag (type, 9, "IF");
|
||||
- append_flags_type_flag (type, 10, "DF");
|
||||
- append_flags_type_flag (type, 11, "OF");
|
||||
- append_flags_type_flag (type, 14, "NT");
|
||||
- append_flags_type_flag (type, 16, "RF");
|
||||
- append_flags_type_flag (type, 17, "VM");
|
||||
- append_flags_type_flag (type, 18, "AC");
|
||||
- append_flags_type_flag (type, 19, "VIF");
|
||||
- append_flags_type_flag (type, 20, "VIP");
|
||||
- append_flags_type_flag (type, 21, "ID");
|
||||
-
|
||||
- return type;
|
||||
- }
|
||||
- break;
|
||||
-
|
||||
- case TDESC_TYPE_I386_MXCSR:
|
||||
- {
|
||||
- struct type *type;
|
||||
-
|
||||
- type = arch_flags_type (gdbarch, "builtin_type_i386_mxcsr", 4);
|
||||
- append_flags_type_flag (type, 0, "IE");
|
||||
- append_flags_type_flag (type, 1, "DE");
|
||||
- append_flags_type_flag (type, 2, "ZE");
|
||||
- append_flags_type_flag (type, 3, "OE");
|
||||
- append_flags_type_flag (type, 4, "UE");
|
||||
- append_flags_type_flag (type, 5, "PE");
|
||||
- append_flags_type_flag (type, 6, "DAZ");
|
||||
- append_flags_type_flag (type, 7, "IM");
|
||||
- append_flags_type_flag (type, 8, "DM");
|
||||
- append_flags_type_flag (type, 9, "ZM");
|
||||
- append_flags_type_flag (type, 10, "OM");
|
||||
- append_flags_type_flag (type, 11, "UM");
|
||||
- append_flags_type_flag (type, 12, "PM");
|
||||
- append_flags_type_flag (type, 15, "FZ");
|
||||
-
|
||||
- return type;
|
||||
- }
|
||||
- break;
|
||||
-
|
||||
/* Types defined by a target feature. */
|
||||
case TDESC_TYPE_VECTOR:
|
||||
{
|
||||
@@ -769,7 +714,8 @@ tdesc_gdb_type (struct gdbarch *gdbarch,
|
||||
/* Note that contrary to the function name, this call will
|
||||
just set the properties of an already-allocated
|
||||
field. */
|
||||
- append_flags_type_flag (type, f->start, f->name);
|
||||
+ append_flags_type_flag (type, f->start,
|
||||
+ *f->name ? f->name : NULL);
|
||||
|
||||
return type;
|
||||
}
|
||||
@@ -1602,6 +1548,7 @@ maint_print_c_tdesc_cmd (char *args, int
|
||||
struct tdesc_reg *reg;
|
||||
struct tdesc_type *type;
|
||||
struct tdesc_type_field *f;
|
||||
+ struct tdesc_type_flag *flag;
|
||||
int ix, ix2, ix3;
|
||||
|
||||
/* Use the global target-supplied description, not the current
|
||||
@@ -1715,6 +1662,18 @@ maint_print_c_tdesc_cmd (char *args, int
|
||||
f->name);
|
||||
}
|
||||
break;
|
||||
+ case TDESC_TYPE_FLAGS:
|
||||
+ printf_unfiltered
|
||||
+ (" field_type = tdesc_create_flags (feature, \"%s\", %d);\n",
|
||||
+ type->name, (int) type->u.f.size);
|
||||
+ for (ix3 = 0;
|
||||
+ VEC_iterate (tdesc_type_flag, type->u.f.flags, ix3,
|
||||
+ flag);
|
||||
+ ix3++)
|
||||
+ printf_unfiltered
|
||||
+ (" tdesc_add_flag (field_type, %d, \"%s\");\n",
|
||||
+ flag->start, flag->name);
|
||||
+ break;
|
||||
default:
|
||||
error (_("C output is not supported type \"%s\"."), type->name);
|
||||
}
|
1366
gdb-bz578250-avx-04of10.patch
Normal file
1366
gdb-bz578250-avx-04of10.patch
Normal file
File diff suppressed because it is too large
Load Diff
30
gdb-bz578250-avx-05of10.patch
Normal file
30
gdb-bz578250-avx-05of10.patch
Normal file
@ -0,0 +1,30 @@
|
||||
[ Backported. ]
|
||||
|
||||
commit 6448aace637843e8e7c021d7f8c5d5d5fdd71974
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Wed Mar 3 20:19:48 2010 +0000
|
||||
|
||||
Mention improvement for X86 general purpose registers.
|
||||
|
||||
2010-03-03 H.J. Lu <hongjiu.lu@intel.com>
|
||||
Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* NEWS: Add X86 general purpose registers section.
|
||||
|
||||
--- gdb-7.1-p3/gdb/NEWS 2010-03-18 22:01:55.000000000 +0100
|
||||
+++ gdb-7.1/gdb/NEWS 2010-04-03 21:07:46.000000000 +0200
|
||||
@@ -438,6 +438,14 @@ GDB will now correctly handle all of:
|
||||
now support hardware watchpoints, and will use them automatically
|
||||
as appropriate.
|
||||
|
||||
+* X86 general purpose registers
|
||||
+
|
||||
+ GDB now supports reading/writing byte, word and double-word x86
|
||||
+ general purpose registers directly. This means you can use, say,
|
||||
+ $ah or $ax to refer, respectively, to the byte register AH and
|
||||
+ 16-bit word register AX that are actually portions of the 32-bit
|
||||
+ register EAX or 64-bit register RAX.
|
||||
+
|
||||
* Python scripting
|
||||
|
||||
GDB now has support for scripting using Python. Whether this is
|
35
gdb-bz578250-avx-06of10.patch
Normal file
35
gdb-bz578250-avx-06of10.patch
Normal file
@ -0,0 +1,35 @@
|
||||
[ Backported. ]
|
||||
|
||||
commit 49f8d1c24c639d891f58a3b9feda425833b702fb
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Fri Mar 12 15:12:34 2010 +0000
|
||||
|
||||
Restore sp for x86.
|
||||
|
||||
2010-03-12 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* amd64-tdep.c (amd64_word_names): Replace "sp" with "".
|
||||
* i386-tdep.c (i386_word_names): Likewise.
|
||||
|
||||
--- gdb-7.1-p4/gdb/amd64-tdep.c 2010-04-03 21:06:52.000000000 +0200
|
||||
+++ gdb-7.1/gdb/amd64-tdep.c 2010-04-03 21:08:21.000000000 +0200
|
||||
@@ -222,7 +222,7 @@ static const char *amd64_byte_names[] =
|
||||
|
||||
static const char *amd64_word_names[] =
|
||||
{
|
||||
- "ax", "bx", "cx", "dx", "si", "di", "bp", "sp",
|
||||
+ "ax", "bx", "cx", "dx", "si", "di", "bp", "",
|
||||
"r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w"
|
||||
};
|
||||
|
||||
--- gdb-7.1-p4/gdb/i386-tdep.c 2010-04-03 21:06:52.000000000 +0200
|
||||
+++ gdb-7.1/gdb/i386-tdep.c 2010-04-03 21:08:21.000000000 +0200
|
||||
@@ -94,7 +94,7 @@ static const char *i386_byte_names[] =
|
||||
static const char *i386_word_names[] =
|
||||
{
|
||||
"ax", "cx", "dx", "bx",
|
||||
- "sp", "bp", "si", "di"
|
||||
+ "", "bp", "si", "di"
|
||||
};
|
||||
|
||||
/* MMX register? */
|
183
gdb-bz578250-avx-07of10.patch
Normal file
183
gdb-bz578250-avx-07of10.patch
Normal file
@ -0,0 +1,183 @@
|
||||
[ Backported. ]
|
||||
|
||||
commit d5ea7042210f5ad319ad19910bce13fd5717c6d6
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Tue Mar 30 15:45:08 2010 +0000
|
||||
|
||||
Add xmlRegisters= to qSupported packet.
|
||||
|
||||
gdb/
|
||||
|
||||
2010-03-30 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* NEWS: Mention xmlRegisters= in qSupported packet.
|
||||
|
||||
* i386-tdep.c: Include "remote.h".
|
||||
(_initialize_i386_tdep): Call register_remote_support_xml.
|
||||
|
||||
* remote.c (remote_support_xml): New.
|
||||
(register_remote_support_xml): Likewise.
|
||||
(remote_query_supported_append): Likewise.
|
||||
(remote_query_supported): Support remote_support_xml.
|
||||
|
||||
* remote.h (register_remote_support_xml): New.
|
||||
|
||||
gdb/doc/
|
||||
|
||||
2010-03-30 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* gdb.texinfo (General Query Packets): Add xmlRegisters.
|
||||
|
||||
--- gdb-7.1-p5/gdb/NEWS 2010-04-03 21:07:46.000000000 +0200
|
||||
+++ gdb-7.1/gdb/NEWS 2010-04-03 21:10:06.000000000 +0200
|
||||
@@ -1,6 +1,11 @@
|
||||
What has changed in GDB?
|
||||
(Organized release by release)
|
||||
|
||||
+*** Changes since GDB 7.1
|
||||
+
|
||||
+* GDB now sends xmlRegisters= in qSupported packet to indicate that
|
||||
+ it understands register description.
|
||||
+
|
||||
*** Changes in GDB 7.1
|
||||
|
||||
* C++ Improvements
|
||||
--- gdb-7.1-p5/gdb/doc/gdb.texinfo 2010-04-03 21:04:13.000000000 +0200
|
||||
+++ gdb-7.1/gdb/doc/gdb.texinfo 2010-04-03 21:09:29.000000000 +0200
|
||||
@@ -30292,6 +30292,12 @@ extensions to the remote protocol. @val
|
||||
extensions unless the stub also reports that it supports them by
|
||||
including @samp{multiprocess+} in its @samp{qSupported} reply.
|
||||
@xref{multiprocess extensions}, for details.
|
||||
+
|
||||
+@item xmlRegisters
|
||||
+This feature indicates that @value{GDBN} supports the XML target
|
||||
+description. If the stub sees @samp{xmlRegisters=} with target
|
||||
+specific strings separated by a comma, it will report register
|
||||
+description.
|
||||
@end table
|
||||
|
||||
Stubs should ignore any unknown values for
|
||||
--- gdb-7.1-p5/gdb/i386-tdep.c 2010-04-03 21:08:21.000000000 +0200
|
||||
+++ gdb-7.1/gdb/i386-tdep.c 2010-04-03 21:09:29.000000000 +0200
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "value.h"
|
||||
#include "dis-asm.h"
|
||||
#include "disasm.h"
|
||||
+#include "remote.h"
|
||||
|
||||
#include "gdb_assert.h"
|
||||
#include "gdb_string.h"
|
||||
@@ -6000,4 +6001,7 @@ is \"default\"."),
|
||||
|
||||
/* Initialize the standard target descriptions. */
|
||||
initialize_tdesc_i386 ();
|
||||
+
|
||||
+ /* Tell remote stub that we support XML target description. */
|
||||
+ register_remote_support_xml ("i386");
|
||||
}
|
||||
--- gdb-7.1-p5/gdb/remote.c 2010-04-03 20:24:51.000000000 +0200
|
||||
+++ gdb-7.1/gdb/remote.c 2010-04-03 21:09:29.000000000 +0200
|
||||
@@ -3467,6 +3467,53 @@ static struct protocol_feature remote_pr
|
||||
PACKET_bs },
|
||||
};
|
||||
|
||||
+static char *remote_support_xml;
|
||||
+
|
||||
+/* Register string appended to "xmlRegisters=" in qSupported query. */
|
||||
+
|
||||
+void
|
||||
+register_remote_support_xml (const char *xml ATTRIBUTE_UNUSED)
|
||||
+{
|
||||
+#if defined(HAVE_LIBEXPAT)
|
||||
+ if (remote_support_xml == NULL)
|
||||
+ remote_support_xml = concat ("xmlRegisters=", xml, NULL);
|
||||
+ else
|
||||
+ {
|
||||
+ char *copy = xstrdup (remote_support_xml + 13);
|
||||
+ char *p = strtok (copy, ",");
|
||||
+
|
||||
+ do
|
||||
+ {
|
||||
+ if (strcmp (p, xml) == 0)
|
||||
+ {
|
||||
+ /* already there */
|
||||
+ xfree (copy);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ while ((p = strtok (NULL, ",")) != NULL);
|
||||
+ xfree (copy);
|
||||
+
|
||||
+ p = concat (remote_support_xml, ",", xml, NULL);
|
||||
+ xfree (remote_support_xml);
|
||||
+ remote_support_xml = p;
|
||||
+ }
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+static char *
|
||||
+remote_query_supported_append (char *msg, const char *append)
|
||||
+{
|
||||
+ if (msg)
|
||||
+ {
|
||||
+ char *p = concat (msg, ";", append, NULL);
|
||||
+ xfree (msg);
|
||||
+ return p;
|
||||
+ }
|
||||
+ else
|
||||
+ return xstrdup (append);
|
||||
+}
|
||||
+
|
||||
static void
|
||||
remote_query_supported (void)
|
||||
{
|
||||
@@ -3485,24 +3532,27 @@ remote_query_supported (void)
|
||||
rs->buf[0] = 0;
|
||||
if (remote_protocol_packets[PACKET_qSupported].support != PACKET_DISABLE)
|
||||
{
|
||||
+ char *q = NULL;
|
||||
const char *qsupported = gdbarch_qsupported (target_gdbarch);
|
||||
+
|
||||
+ if (rs->extended)
|
||||
+ q = remote_query_supported_append (q, "multiprocess+");
|
||||
+
|
||||
if (qsupported)
|
||||
+ q = remote_query_supported_append (q, qsupported);
|
||||
+
|
||||
+ if (remote_support_xml)
|
||||
+ q = remote_query_supported_append (q, remote_support_xml);
|
||||
+
|
||||
+ if (q)
|
||||
{
|
||||
- char *q;
|
||||
- if (rs->extended)
|
||||
- q = concat ("qSupported:multiprocess+;", qsupported, NULL);
|
||||
- else
|
||||
- q = concat ("qSupported:", qsupported, NULL);
|
||||
- putpkt (q);
|
||||
+ char *p = concat ("qSupported:", q, NULL);
|
||||
xfree (q);
|
||||
+ putpkt (p);
|
||||
+ xfree (p);
|
||||
}
|
||||
else
|
||||
- {
|
||||
- if (rs->extended)
|
||||
- putpkt ("qSupported:multiprocess+");
|
||||
- else
|
||||
- putpkt ("qSupported");
|
||||
- }
|
||||
+ putpkt ("qSupported");
|
||||
|
||||
getpkt (&rs->buf, &rs->buf_size, 0);
|
||||
|
||||
--- gdb-7.1-p5/gdb/remote.h 2010-01-01 08:31:41.000000000 +0100
|
||||
+++ gdb-7.1/gdb/remote.h 2010-04-03 21:09:29.000000000 +0200
|
||||
@@ -66,6 +66,7 @@ extern void (*deprecated_target_wait_loo
|
||||
|
||||
void register_remote_g_packet_guess (struct gdbarch *gdbarch, int bytes,
|
||||
const struct target_desc *tdesc);
|
||||
+void register_remote_support_xml (const char *);
|
||||
|
||||
void remote_file_put (const char *local_file, const char *remote_file,
|
||||
int from_tty);
|
32
gdb-bz578250-avx-08of10.patch
Normal file
32
gdb-bz578250-avx-08of10.patch
Normal file
@ -0,0 +1,32 @@
|
||||
[ Backported. ]
|
||||
|
||||
commit 684341392f3ca6703dc28dac548d3051811bff47
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Tue Mar 30 18:37:03 2010 +0000
|
||||
|
||||
Add org.gnu.gdb.i386.avx.
|
||||
|
||||
2010-03-30 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* gdb.texinfo (i386 Features): Add org.gnu.gdb.i386.avx.
|
||||
|
||||
--- gdb-7.1-p6/gdb/doc/gdb.texinfo 2010-04-03 21:09:29.000000000 +0200
|
||||
+++ gdb-7.1/gdb/doc/gdb.texinfo 2010-04-03 21:10:57.000000000 +0200
|
||||
@@ -33380,6 +33380,17 @@ describe registers:
|
||||
@samp{mxcsr}
|
||||
@end itemize
|
||||
|
||||
+The @samp{org.gnu.gdb.i386.avx} feature is optional. It should
|
||||
+describe the upper 128 bits of @sc{ymm} registers:
|
||||
+
|
||||
+@itemize @minus
|
||||
+@item
|
||||
+@samp{ymm0h} through @samp{ymm7h} for i386
|
||||
+@item
|
||||
+@samp{ymm0h} through @samp{ymm15h} for amd64
|
||||
+@item
|
||||
+@end itemize
|
||||
+
|
||||
The @samp{org.gnu.gdb.i386.linux} feature is optional. It should
|
||||
describe a single register, @samp{orig_eax}.
|
||||
|
183
gdb-bz578250-avx-09of10.patch
Normal file
183
gdb-bz578250-avx-09of10.patch
Normal file
@ -0,0 +1,183 @@
|
||||
[ Backported. ]
|
||||
|
||||
commit 5362e5e1dc4cfac24fbd58773aaa7a82c615b662
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Thu Apr 1 20:02:07 2010 +0000
|
||||
|
||||
Support "ah", "bh", "ch", "dh" on amd64.
|
||||
|
||||
gdb/
|
||||
|
||||
2010-04-01 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* amd64-tdep.c (amd64_byte_names): Add "ah", "bh", "ch", "dh".
|
||||
(AMD64_NUM_LOWER_BYTE_REGS): New.
|
||||
(amd64_pseudo_register_read): Handle "ah", "bh", "ch", "dh".
|
||||
(amd64_pseudo_register_write): Likewise.
|
||||
(amd64_init_abi): Set num_byte_regs to 20.
|
||||
|
||||
gdb/testsuite/
|
||||
|
||||
2010-04-01 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* gdb.arch/amd64-byte.exp: Check "ah", "bh", "ch", "dh".
|
||||
|
||||
--- gdb-7.1-p7/gdb/amd64-tdep.c 2010-04-03 21:08:21.000000000 +0200
|
||||
+++ gdb-7.1/gdb/amd64-tdep.c 2010-04-03 21:11:41.000000000 +0200
|
||||
@@ -215,9 +215,13 @@ amd64_arch_reg_to_regnum (int reg)
|
||||
static const char *amd64_byte_names[] =
|
||||
{
|
||||
"al", "bl", "cl", "dl", "sil", "dil", "bpl", "spl",
|
||||
- "r8l", "r9l", "r10l", "r11l", "r12l", "r13l", "r14l", "r15l"
|
||||
+ "r8l", "r9l", "r10l", "r11l", "r12l", "r13l", "r14l", "r15l",
|
||||
+ "ah", "bh", "ch", "dh"
|
||||
};
|
||||
|
||||
+/* Number of lower byte registers. */
|
||||
+#define AMD64_NUM_LOWER_BYTE_REGS 16
|
||||
+
|
||||
/* Register names for word pseudo-registers. */
|
||||
|
||||
static const char *amd64_word_names[] =
|
||||
@@ -263,8 +267,18 @@ amd64_pseudo_register_read (struct gdbar
|
||||
int gpnum = regnum - tdep->al_regnum;
|
||||
|
||||
/* Extract (always little endian). */
|
||||
- regcache_raw_read (regcache, gpnum, raw_buf);
|
||||
- memcpy (buf, raw_buf, 1);
|
||||
+ if (gpnum >= AMD64_NUM_LOWER_BYTE_REGS)
|
||||
+ {
|
||||
+ /* Special handling for AH, BH, CH, DH. */
|
||||
+ regcache_raw_read (regcache,
|
||||
+ gpnum - AMD64_NUM_LOWER_BYTE_REGS, raw_buf);
|
||||
+ memcpy (buf, raw_buf + 1, 1);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ regcache_raw_read (regcache, gpnum, raw_buf);
|
||||
+ memcpy (buf, raw_buf, 1);
|
||||
+ }
|
||||
}
|
||||
else if (i386_dword_regnum_p (gdbarch, regnum))
|
||||
{
|
||||
@@ -289,12 +303,26 @@ amd64_pseudo_register_write (struct gdba
|
||||
{
|
||||
int gpnum = regnum - tdep->al_regnum;
|
||||
|
||||
- /* Read ... */
|
||||
- regcache_raw_read (regcache, gpnum, raw_buf);
|
||||
- /* ... Modify ... (always little endian). */
|
||||
- memcpy (raw_buf, buf, 1);
|
||||
- /* ... Write. */
|
||||
- regcache_raw_write (regcache, gpnum, raw_buf);
|
||||
+ if (gpnum >= AMD64_NUM_LOWER_BYTE_REGS)
|
||||
+ {
|
||||
+ /* Read ... AH, BH, CH, DH. */
|
||||
+ regcache_raw_read (regcache,
|
||||
+ gpnum - AMD64_NUM_LOWER_BYTE_REGS, raw_buf);
|
||||
+ /* ... Modify ... (always little endian). */
|
||||
+ memcpy (raw_buf + 1, buf, 1);
|
||||
+ /* ... Write. */
|
||||
+ regcache_raw_write (regcache,
|
||||
+ gpnum - AMD64_NUM_LOWER_BYTE_REGS, raw_buf);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /* Read ... */
|
||||
+ regcache_raw_read (regcache, gpnum, raw_buf);
|
||||
+ /* ... Modify ... (always little endian). */
|
||||
+ memcpy (raw_buf, buf, 1);
|
||||
+ /* ... Write. */
|
||||
+ regcache_raw_write (regcache, gpnum, raw_buf);
|
||||
+ }
|
||||
}
|
||||
else if (i386_dword_regnum_p (gdbarch, regnum))
|
||||
{
|
||||
@@ -2233,7 +2261,7 @@ amd64_init_abi (struct gdbarch_info info
|
||||
tdep->num_core_regs = AMD64_NUM_GREGS + I387_NUM_REGS;
|
||||
tdep->register_names = amd64_register_names;
|
||||
|
||||
- tdep->num_byte_regs = 16;
|
||||
+ tdep->num_byte_regs = 20;
|
||||
tdep->num_word_regs = 16;
|
||||
tdep->num_dword_regs = 16;
|
||||
/* Avoid wiring in the MMX registers for now. */
|
||||
--- gdb-7.1-p7/gdb/testsuite/gdb.arch/amd64-byte.exp 2010-04-03 21:06:52.000000000 +0200
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.arch/amd64-byte.exp 2010-04-03 21:11:41.000000000 +0200
|
||||
@@ -52,7 +52,6 @@ if ![runto_main] then {
|
||||
gdb_suppress_tests
|
||||
}
|
||||
|
||||
-set nr_regs 14
|
||||
set byte_regs(1) al
|
||||
set byte_regs(2) bl
|
||||
set byte_regs(3) cl
|
||||
@@ -67,6 +66,10 @@ set byte_regs(11) r12l
|
||||
set byte_regs(12) r13l
|
||||
set byte_regs(13) r14l
|
||||
set byte_regs(14) r15l
|
||||
+set byte_regs(15) ah
|
||||
+set byte_regs(16) bh
|
||||
+set byte_regs(17) ch
|
||||
+set byte_regs(18) dh
|
||||
|
||||
gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
|
||||
"Breakpoint .* at .*${srcfile}.*" \
|
||||
@@ -79,12 +82,19 @@ for { set r 1 } { $r <= 6 } { incr r }
|
||||
"check contents of %$byte_regs($r)"
|
||||
}
|
||||
|
||||
+for { set r 1 } { $r <= 4 } { incr r } {
|
||||
+ set h [expr $r + 14]
|
||||
+ gdb_test "print/x \$$byte_regs($h)" \
|
||||
+ ".. = 0x[format %x $r]2" \
|
||||
+ "check contents of %$byte_regs($h)"
|
||||
+}
|
||||
+
|
||||
gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
|
||||
"Breakpoint .* at .*${srcfile}.*" \
|
||||
"set second breakpoint in main"
|
||||
gdb_continue_to_breakpoint "continue to second breakpoint in main"
|
||||
|
||||
-for { set r 7 } { $r <= $nr_regs } { incr r } {
|
||||
+for { set r 7 } { $r <= 14 } { incr r } {
|
||||
gdb_test "print/x \$$byte_regs($r)" \
|
||||
".. = 0x[format %x $r]1" \
|
||||
"check contents of %$byte_regs($r)"
|
||||
@@ -94,6 +104,11 @@ for { set r 1 } { $r <= 6 } { incr r }
|
||||
gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
|
||||
}
|
||||
|
||||
+for { set r 1 } { $r <= 4 } { incr r } {
|
||||
+ set h [expr $r + 14]
|
||||
+ gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)"
|
||||
+}
|
||||
+
|
||||
gdb_test "break [gdb_get_line_number "third breakpoint here"]" \
|
||||
"Breakpoint .* at .*${srcfile}.*" \
|
||||
"set third breakpoint in main"
|
||||
@@ -105,7 +120,14 @@ for { set r 1 } { $r <= 6 } { incr r }
|
||||
"check contents of %$byte_regs($r)"
|
||||
}
|
||||
|
||||
-for { set r 7 } { $r <= $nr_regs } { incr r } {
|
||||
+for { set r 1 } { $r <= 4 } { incr r } {
|
||||
+ set h [expr $r + 14]
|
||||
+ gdb_test "print \$$byte_regs($h)" \
|
||||
+ ".. = $h" \
|
||||
+ "check contents of %$byte_regs($h)"
|
||||
+}
|
||||
+
|
||||
+for { set r 7 } { $r <= 14 } { incr r } {
|
||||
gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
|
||||
}
|
||||
|
||||
@@ -114,7 +136,7 @@ gdb_test "break [gdb_get_line_number "fo
|
||||
"set forth breakpoint in main"
|
||||
gdb_continue_to_breakpoint "continue to forth breakpoint in main"
|
||||
|
||||
-for { set r 7 } { $r <= $nr_regs } { incr r } {
|
||||
+for { set r 7 } { $r <= 14 } { incr r } {
|
||||
gdb_test "print \$$byte_regs($r)" \
|
||||
".. = $r" \
|
||||
"check contents of %$byte_regs($r)"
|
16
gdb-bz578250-avx-10of10-ppc.patch
Normal file
16
gdb-bz578250-avx-10of10-ppc.patch
Normal file
@ -0,0 +1,16 @@
|
||||
http://sourceware.org/ml/gdb-patches/2010-04/msg00056.html
|
||||
|
||||
linux-ppc-low.c:599: error: incompatible types when initializing type ‘enum regset_type’ using type ‘void (*)(struct regcache *, void *)’
|
||||
linux-ppc-low.c:599: warning: initialization from incompatible pointer type
|
||||
|
||||
--- a/gdb/gdbserver/linux-ppc-low.c
|
||||
+++ b/gdb/gdbserver/linux-ppc-low.c
|
||||
@@ -594,7 +594,7 @@ struct regset_info target_regsets[] = {
|
||||
PPC_PTRACE_GETREGS. */
|
||||
{ PTRACE_GETVSXREGS, PTRACE_SETVSXREGS, 0, SIZEOF_VSXREGS, EXTENDED_REGS,
|
||||
ppc_fill_vsxregset, ppc_store_vsxregset },
|
||||
- { PTRACE_GETVRREGS, PTRACE_SETVRREGS, SIZEOF_VRREGS, EXTENDED_REGS,
|
||||
+ { PTRACE_GETVRREGS, PTRACE_SETVRREGS, 0, SIZEOF_VRREGS, EXTENDED_REGS,
|
||||
ppc_fill_vrregset, ppc_store_vrregset },
|
||||
{ PTRACE_GETEVRREGS, PTRACE_SETEVRREGS, 0, 32 * 4 + 8 + 4, EXTENDED_REGS,
|
||||
ppc_fill_evrregset, ppc_store_evrregset },
|
8271
gdb-bz578250-avx-10of10.patch
Normal file
8271
gdb-bz578250-avx-10of10.patch
Normal file
File diff suppressed because it is too large
Load Diff
59
gdb-bz589467-pieces-vla-compat.patch
Normal file
59
gdb-bz589467-pieces-vla-compat.patch
Normal file
@ -0,0 +1,59 @@
|
||||
06e357f534abcf8912e4fd597daae8f1387d631c
|
||||
|
||||
Fix compatibility with: FYI: fix BINOP_SUBSCRIPT with pieced arrays
|
||||
http://sourceware.org/ml/gdb-patches/2010-05/msg00281.html
|
||||
|
||||
2010-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* valarith.c (binop_user_defined_p): Return 0 on ARG1 or ARG2 being
|
||||
TYPE_DYNAMIC.
|
||||
* value.c (coerce_ref): Use object_address_get_data resolution for
|
||||
TYPE_DYNAMIC ARG.
|
||||
|
||||
[ Backported. ]
|
||||
|
||||
Index: gdb-7.1/gdb/valarith.c
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/valarith.c 2010-05-30 18:54:28.000000000 +0200
|
||||
+++ gdb-7.1/gdb/valarith.c 2010-05-30 18:54:43.000000000 +0200
|
||||
@@ -309,6 +309,10 @@ int
|
||||
binop_user_defined_p (enum exp_opcode op,
|
||||
struct value *arg1, struct value *arg2)
|
||||
{
|
||||
+ /* FIXME: We should support user defined ops for dynamic types. */
|
||||
+ if (TYPE_DYNAMIC (value_type (arg1)) || TYPE_DYNAMIC (value_type (arg2)))
|
||||
+ return 0;
|
||||
+
|
||||
return binop_types_user_defined_p (op, value_type (arg1), value_type (arg2));
|
||||
}
|
||||
|
||||
Index: gdb-7.1/gdb/value.c
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/value.c 2010-05-30 18:54:36.000000000 +0200
|
||||
+++ gdb-7.1/gdb/value.c 2010-05-30 18:55:52.000000000 +0200
|
||||
@@ -2400,7 +2400,24 @@ value_from_decfloat (struct type *type,
|
||||
struct value *
|
||||
coerce_ref (struct value *arg)
|
||||
{
|
||||
- struct type *value_type_arg_tmp = check_typedef (value_type (arg));
|
||||
+ struct type *value_type_arg_tmp;
|
||||
+
|
||||
+ if (TYPE_DYNAMIC (value_type (arg)))
|
||||
+ {
|
||||
+ struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
|
||||
+ CORE_ADDR address;
|
||||
+
|
||||
+ value_type_arg_tmp = value_type (arg);
|
||||
+ address = value_raw_address (arg);
|
||||
+ if (! object_address_get_data (value_type_arg_tmp, &address))
|
||||
+ error (_("Attempt to coerce non-valid value."));
|
||||
+ CHECK_TYPEDEF (value_type_arg_tmp);
|
||||
+ arg = value_at_lazy (value_type_arg_tmp, address);
|
||||
+ do_cleanups (cleanups);
|
||||
+ }
|
||||
+ else
|
||||
+ value_type_arg_tmp = check_typedef (value_type (arg));
|
||||
+
|
||||
if (TYPE_CODE (value_type_arg_tmp) == TYPE_CODE_REF)
|
||||
arg = value_at_lazy (TYPE_TARGET_TYPE (value_type_arg_tmp),
|
||||
unpack_pointer (value_type (arg),
|
80
gdb-bz589467-pieces01of4.patch
Normal file
80
gdb-bz589467-pieces01of4.patch
Normal file
@ -0,0 +1,80 @@
|
||||
commit 96c23bfd2863bcca7388653a7bc4c9f8a64a03be
|
||||
Author: Ulrich Weigand <uweigand@de.ibm.com>
|
||||
Date: Fri Feb 26 12:48:17 2010 +0000
|
||||
|
||||
* dwarf2loc.c (struct piece_closure): Remove ARCH member,
|
||||
add ADDR_SIZE member.
|
||||
(allocate_piece_closure): Update.
|
||||
(copy_pieced_value_closure): Likewise.
|
||||
(dwarf2_evaluate_loc_desc): Likewise.
|
||||
(read_pieced_value): Use DWARF address size instead of
|
||||
GDB's gdbarch_addr_bit as size of values on the DWARF stack.
|
||||
|
||||
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
|
||||
index 1c4d057..20ede3e 100644
|
||||
--- a/gdb/dwarf2loc.c
|
||||
+++ b/gdb/dwarf2loc.c
|
||||
@@ -232,8 +232,8 @@ struct piece_closure
|
||||
/* The number of pieces used to describe this variable. */
|
||||
int n_pieces;
|
||||
|
||||
- /* The architecture, used only for DWARF_VALUE_STACK. */
|
||||
- struct gdbarch *arch;
|
||||
+ /* The target address size, used only for DWARF_VALUE_STACK. */
|
||||
+ int addr_size;
|
||||
|
||||
/* The pieces themselves. */
|
||||
struct dwarf_expr_piece *pieces;
|
||||
@@ -244,12 +244,12 @@ struct piece_closure
|
||||
|
||||
static struct piece_closure *
|
||||
allocate_piece_closure (int n_pieces, struct dwarf_expr_piece *pieces,
|
||||
- struct gdbarch *arch)
|
||||
+ int addr_size)
|
||||
{
|
||||
struct piece_closure *c = XZALLOC (struct piece_closure);
|
||||
|
||||
c->n_pieces = n_pieces;
|
||||
- c->arch = arch;
|
||||
+ c->addr_size = addr_size;
|
||||
c->pieces = XCALLOC (n_pieces, struct dwarf_expr_piece);
|
||||
|
||||
memcpy (c->pieces, pieces, n_pieces * sizeof (struct dwarf_expr_piece));
|
||||
@@ -298,13 +298,12 @@ read_pieced_value (struct value *v)
|
||||
|
||||
case DWARF_VALUE_STACK:
|
||||
{
|
||||
- size_t n;
|
||||
- int addr_size = gdbarch_addr_bit (c->arch) / 8;
|
||||
- n = p->size;
|
||||
- if (n > addr_size)
|
||||
- n = addr_size;
|
||||
+ struct gdbarch *gdbarch = get_type_arch (value_type (v));
|
||||
+ size_t n = p->size;
|
||||
+ if (n > c->addr_size)
|
||||
+ n = c->addr_size;
|
||||
store_unsigned_integer (contents + offset, n,
|
||||
- gdbarch_byte_order (c->arch),
|
||||
+ gdbarch_byte_order (gdbarch),
|
||||
p->v.expr.value);
|
||||
}
|
||||
break;
|
||||
@@ -377,7 +376,7 @@ copy_pieced_value_closure (struct value *v)
|
||||
{
|
||||
struct piece_closure *c = (struct piece_closure *) value_computed_closure (v);
|
||||
|
||||
- return allocate_piece_closure (c->n_pieces, c->pieces, c->arch);
|
||||
+ return allocate_piece_closure (c->n_pieces, c->pieces, c->addr_size);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -439,7 +438,8 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
|
||||
struct piece_closure *c;
|
||||
struct frame_id frame_id = get_frame_id (frame);
|
||||
|
||||
- c = allocate_piece_closure (ctx->num_pieces, ctx->pieces, ctx->gdbarch);
|
||||
+ c = allocate_piece_closure (ctx->num_pieces, ctx->pieces,
|
||||
+ ctx->addr_size);
|
||||
retval = allocate_computed_value (type, &pieced_value_funcs, c);
|
||||
VALUE_FRAME_ID (retval) = frame_id;
|
||||
}
|
68
gdb-bz589467-pieces02of4.patch
Normal file
68
gdb-bz589467-pieces02of4.patch
Normal file
@ -0,0 +1,68 @@
|
||||
commit 60d15ff6d78921d080aee681e60372abe6627570
|
||||
Author: mgretton <mgretton>
|
||||
Date: Tue May 4 09:54:17 2010 +0000
|
||||
|
||||
* gdb/dwarf2loc.c (read_pieced_value, write_pieced_value,
|
||||
dwarf2_evaluate_loc_desc): Handle not being able to access DWARF
|
||||
registers gracefully.
|
||||
|
||||
Index: gdb-7.1/gdb/dwarf2loc.c
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/dwarf2loc.c 2010-05-25 21:35:10.000000000 +0200
|
||||
+++ gdb-7.1/gdb/dwarf2loc.c 2010-05-25 21:37:32.000000000 +0200
|
||||
@@ -458,8 +458,16 @@ read_pieced_value (struct value *v)
|
||||
/* Big-endian, and we want less than full size. */
|
||||
reg_offset = register_size (arch, gdb_regnum) - p->size;
|
||||
|
||||
- get_frame_register_bytes (frame, gdb_regnum, reg_offset, p->size,
|
||||
- contents + offset);
|
||||
+ if (gdb_regnum != -1)
|
||||
+ {
|
||||
+ get_frame_register_bytes (frame, gdb_regnum, reg_offset,
|
||||
+ p->size, contents + offset);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ error (_("Unable to access DWARF register number %s"),
|
||||
+ paddress (arch, p->v.expr.value));
|
||||
+ }
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -531,8 +539,16 @@ write_pieced_value (struct value *to, st
|
||||
/* Big-endian, and we want less than full size. */
|
||||
reg_offset = register_size (arch, gdb_regnum) - p->size;
|
||||
|
||||
- put_frame_register_bytes (frame, gdb_regnum, reg_offset, p->size,
|
||||
- contents + offset);
|
||||
+ if (gdb_regnum != -1)
|
||||
+ {
|
||||
+ put_frame_register_bytes (frame, gdb_regnum, reg_offset,
|
||||
+ p->size, contents + offset);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ error (_("Unable to write to DWARF register number %s"),
|
||||
+ paddress (arch, p->v.expr.value));
|
||||
+ }
|
||||
}
|
||||
break;
|
||||
case DWARF_VALUE_MEMORY:
|
||||
@@ -611,7 +627,16 @@ dwarf2_evaluate_loc_desc (struct type *t
|
||||
struct gdbarch *arch = get_frame_arch (frame);
|
||||
CORE_ADDR dwarf_regnum = dwarf_expr_fetch (ctx, 0);
|
||||
int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, dwarf_regnum);
|
||||
- retval = value_from_register (type, gdb_regnum, frame);
|
||||
+ if (gdb_regnum != -1)
|
||||
+ {
|
||||
+ retval = value_from_register (type,
|
||||
+ gdb_regnum, frame);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ error (_("Unable to access DWARF register number %s"),
|
||||
+ paddress (arch, dwarf_regnum));
|
||||
+ }
|
||||
}
|
||||
break;
|
||||
|
99
gdb-bz589467-pieces03of4.patch
Normal file
99
gdb-bz589467-pieces03of4.patch
Normal file
@ -0,0 +1,99 @@
|
||||
commit dacd66a53b559be9c26d2c523f168f1ef0261f4d
|
||||
Author: Michael Snyder <msnyder@specifix.com>
|
||||
Date: Fri May 14 17:53:11 2010 +0000
|
||||
|
||||
2010-05-14 Michael Snyder <msnyder@vmware.com>
|
||||
|
||||
* dbxread.c: White space.
|
||||
* dcache.c: White space.
|
||||
* disasm.c: White space.
|
||||
* doublest.c: White space.
|
||||
* dsrec.c: White space.
|
||||
* dummy-frame.c: White space.
|
||||
* dwarf2expr.c: White space.
|
||||
* dwarf2-frame.c: White space.
|
||||
* dwarf2loc.c: White space.
|
||||
* dwarf2read.c: White space.
|
||||
|
||||
--- gdb-7.1/gdb/dwarf2loc.c.orig 2010-05-25 23:06:46.000000000 +0200
|
||||
+++ gdb-7.1/gdb/dwarf2loc.c 2010-05-25 23:06:46.000000000 +0200
|
||||
@@ -236,6 +236,7 @@ static CORE_ADDR
|
||||
dwarf_expr_frame_cfa (void *baton)
|
||||
{
|
||||
struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
|
||||
+
|
||||
return dwarf2_frame_cfa (debaton->frame);
|
||||
}
|
||||
|
||||
@@ -444,6 +445,7 @@ read_pieced_value (struct value *v)
|
||||
for (i = 0; i < c->n_pieces; i++)
|
||||
{
|
||||
struct dwarf_expr_piece *p = &c->pieces[i];
|
||||
+
|
||||
switch (p->location)
|
||||
{
|
||||
case DWARF_VALUE_REGISTER:
|
||||
@@ -482,6 +484,7 @@ read_pieced_value (struct value *v)
|
||||
{
|
||||
struct gdbarch *gdbarch = get_type_arch (value_type (v));
|
||||
size_t n = p->size;
|
||||
+
|
||||
if (n > c->addr_size)
|
||||
n = c->addr_size;
|
||||
store_unsigned_integer (contents + offset, n,
|
||||
@@ -493,6 +496,7 @@ read_pieced_value (struct value *v)
|
||||
case DWARF_VALUE_LITERAL:
|
||||
{
|
||||
size_t n = p->size;
|
||||
+
|
||||
if (n > p->v.literal.length)
|
||||
n = p->v.literal.length;
|
||||
memcpy (contents + offset, p->v.literal.data, n);
|
||||
@@ -525,6 +529,7 @@ write_pieced_value (struct value *to, st
|
||||
for (i = 0; i < c->n_pieces; i++)
|
||||
{
|
||||
struct dwarf_expr_piece *p = &c->pieces[i];
|
||||
+
|
||||
switch (p->location)
|
||||
{
|
||||
case DWARF_VALUE_REGISTER:
|
||||
@@ -712,6 +717,7 @@ static CORE_ADDR
|
||||
needs_frame_read_reg (void *baton, int regnum)
|
||||
{
|
||||
struct needs_frame_baton *nf_baton = baton;
|
||||
+
|
||||
nf_baton->needs_frame = 1;
|
||||
return 1;
|
||||
}
|
||||
@@ -742,6 +748,7 @@ static CORE_ADDR
|
||||
needs_frame_frame_cfa (void *baton)
|
||||
{
|
||||
struct needs_frame_baton *nf_baton = baton;
|
||||
+
|
||||
nf_baton->needs_frame = 1;
|
||||
return 1;
|
||||
}
|
||||
@@ -751,6 +758,7 @@ static CORE_ADDR
|
||||
needs_frame_tls_address (void *baton, CORE_ADDR offset)
|
||||
{
|
||||
struct needs_frame_baton *nf_baton = baton;
|
||||
+
|
||||
nf_baton->needs_frame = 1;
|
||||
return 1;
|
||||
}
|
||||
@@ -907,6 +915,7 @@ locexpr_read_variable (struct symbol *sy
|
||||
{
|
||||
struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
|
||||
struct value *val;
|
||||
+
|
||||
val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, dlbaton->data,
|
||||
dlbaton->size, dlbaton->per_cu);
|
||||
|
||||
@@ -918,6 +927,7 @@ static int
|
||||
locexpr_read_needs_frame (struct symbol *symbol)
|
||||
{
|
||||
struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
|
||||
+
|
||||
return dwarf2_loc_desc_needs_frame (dlbaton->data, dlbaton->size,
|
||||
dlbaton->per_cu);
|
||||
}
|
2075
gdb-bz589467-pieces1of4.patch
Normal file
2075
gdb-bz589467-pieces1of4.patch
Normal file
File diff suppressed because it is too large
Load Diff
53
gdb-bz589467-pieces2of4.patch
Normal file
53
gdb-bz589467-pieces2of4.patch
Normal file
@ -0,0 +1,53 @@
|
||||
http://sourceware.org/ml/gdb-cvs/2010-05/msg00188.html
|
||||
http://sourceware.org/ml/gdb-cvs/2010-05/msg00189.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/05/21 20:45:18 1.11830
|
||||
### src/gdb/ChangeLog 2010/05/21 20:56:48 1.11831
|
||||
## -1,3 +1,8 @@
|
||||
+2010-05-21 Tom Tromey <tromey@redhat.com>
|
||||
+
|
||||
+ * eval.c (evaluate_subexp_standard) <BINOP_SUBSCRIPT>: Call
|
||||
+ evaluate_subexp, not evaluate_subexp_with_coercion.
|
||||
+
|
||||
### src/gdb/testsuite/ChangeLog 2010/05/21 20:39:50 1.2273
|
||||
### src/gdb/testsuite/ChangeLog 2010/05/21 20:56:49 1.2274
|
||||
## -1,5 +1,10 @@
|
||||
2010-05-21 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
+ * gdb.dwarf2/pieces.exp (pieces_test_f2): New proc.
|
||||
+ Call it.
|
||||
+
|
||||
--- src/gdb/eval.c 2010/05/14 18:35:11 1.134
|
||||
+++ src/gdb/eval.c 2010/05/21 20:56:49 1.135
|
||||
@@ -2059,8 +2059,8 @@
|
||||
error (_("':' operator used in invalid context"));
|
||||
|
||||
case BINOP_SUBSCRIPT:
|
||||
- arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
|
||||
- arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
|
||||
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
||||
+ arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
||||
if (noside == EVAL_SKIP)
|
||||
goto nosideret;
|
||||
if (binop_user_defined_p (op, arg1, arg2))
|
||||
--- src/gdb/testsuite/gdb.dwarf2/pieces.exp 2010/05/21 20:39:50 1.1
|
||||
+++ src/gdb/testsuite/gdb.dwarf2/pieces.exp 2010/05/21 21:00:27 1.2
|
||||
@@ -54,4 +54,18 @@
|
||||
gdb_test "print a.j" " = 14" "print a.j in pieces:f1"
|
||||
}
|
||||
|
||||
+# Function f2 tests for a bug when indexing into an array created
|
||||
+# using DW_OP_piece.
|
||||
+proc pieces_test_f2 {} {
|
||||
+ global csrcfile
|
||||
+ set line [gdb_get_line_number "f2 breakpoint" $csrcfile]
|
||||
+ gdb_test "break pieces.c:$line" "Breakpoint 3.*" \
|
||||
+ "set f2 breakpoint for pieces"
|
||||
+ gdb_continue_to_breakpoint "continue to f2 breakpoint for pieces"
|
||||
+ gdb_test "print a" " = .4, 14." "print a in pieces:f2"
|
||||
+ gdb_test "print a\[0\]" " = 4" "print a\[0\] in pieces:f2"
|
||||
+ gdb_test "print a\[1\]" " = 14" "print a\[1\] in pieces:f2"
|
||||
+}
|
||||
+
|
||||
pieces_test_f1
|
||||
+pieces_test_f2
|
1198
gdb-bz589467-pieces3of4.patch
Normal file
1198
gdb-bz589467-pieces3of4.patch
Normal file
File diff suppressed because it is too large
Load Diff
820
gdb-bz589467-pieces4of4.patch
Normal file
820
gdb-bz589467-pieces4of4.patch
Normal file
@ -0,0 +1,820 @@
|
||||
http://sourceware.org/ml/gdb-cvs/2010-05/msg00191.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/05/21 21:01:46 1.11832
|
||||
### src/gdb/ChangeLog 2010/05/21 21:13:10 1.11833
|
||||
## -1,5 +1,20 @@
|
||||
2010-05-21 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
+ * dwarf2loc.c (extract_bits_primitive): New function.
|
||||
+ (extract_bits): Likewise.
|
||||
+ (insert_bits): Likewise.
|
||||
+ (copy_bitwise): Likewise.
|
||||
+ (read_pieced_value): Do all operations in bits.
|
||||
+ (write_pieced_value): Likewise.
|
||||
+ * dwarf2expr.h (struct dwarf_expr_piece) <offset>: New field.
|
||||
+ * dwarf2expr.c (add_piece): New arguments bit_piece, offset.
|
||||
+ Always use xrealloc to resize piece array.
|
||||
+ (execute_stack_op) <DW_OP_reg0>: Handle DW_OP_bit_piece.
|
||||
+ <DW_OP_piece>: Update.
|
||||
+ <DW_OP_bit_piece>: New case.
|
||||
+
|
||||
### src/gdb/testsuite/ChangeLog 2010/05/21 21:01:46 1.2275
|
||||
### src/gdb/testsuite/ChangeLog 2010/05/21 21:13:13 1.2276
|
||||
## -1,5 +1,12 @@
|
||||
2010-05-21 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
+ * gdb.dwarf2/pieces.exp (pieces_test_f3): New proc.
|
||||
+ Call it.
|
||||
+ * gdb.dwarf2/pieces.S: Update.
|
||||
+ * gdb.dwarf2/pieces.c (struct B): Remove initial field.
|
||||
+
|
||||
--- src/gdb/dwarf2expr.c 2010/05/21 21:01:46 1.43
|
||||
+++ src/gdb/dwarf2expr.c 2010/05/21 21:13:10 1.44
|
||||
@@ -153,23 +153,21 @@
|
||||
|
||||
/* Add a new piece to CTX's piece list. */
|
||||
static void
|
||||
-add_piece (struct dwarf_expr_context *ctx, ULONGEST size)
|
||||
+add_piece (struct dwarf_expr_context *ctx, ULONGEST size, ULONGEST offset)
|
||||
{
|
||||
struct dwarf_expr_piece *p;
|
||||
|
||||
ctx->num_pieces++;
|
||||
|
||||
- if (ctx->pieces)
|
||||
- ctx->pieces = xrealloc (ctx->pieces,
|
||||
- (ctx->num_pieces
|
||||
- * sizeof (struct dwarf_expr_piece)));
|
||||
- else
|
||||
- ctx->pieces = xmalloc (ctx->num_pieces
|
||||
- * sizeof (struct dwarf_expr_piece));
|
||||
+ ctx->pieces = xrealloc (ctx->pieces,
|
||||
+ (ctx->num_pieces
|
||||
+ * sizeof (struct dwarf_expr_piece)));
|
||||
|
||||
p = &ctx->pieces[ctx->num_pieces - 1];
|
||||
p->location = ctx->location;
|
||||
p->size = size;
|
||||
+ p->offset = offset;
|
||||
+
|
||||
if (p->location == DWARF_VALUE_LITERAL)
|
||||
{
|
||||
p->v.literal.data = ctx->data;
|
||||
@@ -499,9 +497,11 @@
|
||||
case DW_OP_reg31:
|
||||
if (op_ptr != op_end
|
||||
&& *op_ptr != DW_OP_piece
|
||||
+ && *op_ptr != DW_OP_bit_piece
|
||||
&& *op_ptr != DW_OP_GNU_uninit)
|
||||
error (_("DWARF-2 expression error: DW_OP_reg operations must be "
|
||||
- "used either alone or in conjuction with DW_OP_piece."));
|
||||
+ "used either alone or in conjuction with DW_OP_piece "
|
||||
+ "or DW_OP_bit_piece."));
|
||||
|
||||
result = op - DW_OP_reg0;
|
||||
ctx->location = DWARF_VALUE_REGISTER;
|
||||
@@ -872,7 +872,7 @@
|
||||
|
||||
/* Record the piece. */
|
||||
op_ptr = read_uleb128 (op_ptr, op_end, &size);
|
||||
- add_piece (ctx, size);
|
||||
+ add_piece (ctx, 8 * size, 0);
|
||||
|
||||
/* Pop off the address/regnum, and reset the location
|
||||
type. */
|
||||
@@ -883,6 +883,24 @@
|
||||
}
|
||||
goto no_push;
|
||||
|
||||
+ case DW_OP_bit_piece:
|
||||
+ {
|
||||
+ ULONGEST size, offset;
|
||||
+
|
||||
+ /* Record the piece. */
|
||||
+ op_ptr = read_uleb128 (op_ptr, op_end, &size);
|
||||
+ op_ptr = read_uleb128 (op_ptr, op_end, &offset);
|
||||
+ add_piece (ctx, size, offset);
|
||||
+
|
||||
+ /* Pop off the address/regnum, and reset the location
|
||||
+ type. */
|
||||
+ if (ctx->location != DWARF_VALUE_LITERAL
|
||||
+ && ctx->location != DWARF_VALUE_OPTIMIZED_OUT)
|
||||
+ dwarf_expr_pop (ctx);
|
||||
+ ctx->location = DWARF_VALUE_MEMORY;
|
||||
+ }
|
||||
+ goto no_push;
|
||||
+
|
||||
case DW_OP_GNU_uninit:
|
||||
if (op_ptr != op_end)
|
||||
error (_("DWARF-2 expression error: DW_OP_GNU_uninit must always "
|
||||
--- src/gdb/dwarf2expr.h 2010/05/21 21:01:46 1.21
|
||||
+++ src/gdb/dwarf2expr.h 2010/05/21 21:13:11 1.22
|
||||
@@ -155,7 +155,7 @@
|
||||
};
|
||||
|
||||
|
||||
-/* A piece of an object, as recorded by DW_OP_piece. */
|
||||
+/* A piece of an object, as recorded by DW_OP_piece or DW_OP_bit_piece. */
|
||||
struct dwarf_expr_piece
|
||||
{
|
||||
enum dwarf_value_location location;
|
||||
@@ -181,8 +181,10 @@
|
||||
} literal;
|
||||
} v;
|
||||
|
||||
- /* The length of the piece, in bytes. */
|
||||
+ /* The length of the piece, in bits. */
|
||||
ULONGEST size;
|
||||
+ /* The piece offset, in bits. */
|
||||
+ ULONGEST offset;
|
||||
};
|
||||
|
||||
struct dwarf_expr_context *new_dwarf_expr_context (void);
|
||||
--- src/gdb/dwarf2loc.c 2010/05/21 21:01:46 1.80
|
||||
+++ src/gdb/dwarf2loc.c 2010/05/21 21:13:11 1.81
|
||||
@@ -259,52 +259,245 @@
|
||||
return c;
|
||||
}
|
||||
|
||||
+/* The lowest-level function to extract bits from a byte buffer.
|
||||
+ SOURCE is the buffer. It is updated if we read to the end of a
|
||||
+ byte.
|
||||
+ SOURCE_OFFSET_BITS is the offset of the first bit to read. It is
|
||||
+ updated to reflect the number of bits actually read.
|
||||
+ NBITS is the number of bits we want to read. It is updated to
|
||||
+ reflect the number of bits actually read. This function may read
|
||||
+ fewer bits.
|
||||
+ BITS_BIG_ENDIAN is taken directly from gdbarch.
|
||||
+ This function returns the extracted bits. */
|
||||
+
|
||||
+static unsigned int
|
||||
+extract_bits_primitive (const gdb_byte **source,
|
||||
+ unsigned int *source_offset_bits,
|
||||
+ int *nbits, int bits_big_endian)
|
||||
+{
|
||||
+ unsigned int avail, mask, datum;
|
||||
+
|
||||
+ gdb_assert (*source_offset_bits < 8);
|
||||
+
|
||||
+ avail = 8 - *source_offset_bits;
|
||||
+ if (avail > *nbits)
|
||||
+ avail = *nbits;
|
||||
+
|
||||
+ mask = (1 << avail) - 1;
|
||||
+ datum = **source;
|
||||
+ if (bits_big_endian)
|
||||
+ datum >>= 8 - (*source_offset_bits + *nbits);
|
||||
+ else
|
||||
+ datum >>= *source_offset_bits;
|
||||
+ datum &= mask;
|
||||
+
|
||||
+ *nbits -= avail;
|
||||
+ *source_offset_bits += avail;
|
||||
+ if (*source_offset_bits >= 8)
|
||||
+ {
|
||||
+ *source_offset_bits -= 8;
|
||||
+ ++*source;
|
||||
+ }
|
||||
+
|
||||
+ return datum;
|
||||
+}
|
||||
+
|
||||
+/* Extract some bits from a source buffer and move forward in the
|
||||
+ buffer.
|
||||
+
|
||||
+ SOURCE is the source buffer. It is updated as bytes are read.
|
||||
+ SOURCE_OFFSET_BITS is the offset into SOURCE. It is updated as
|
||||
+ bits are read.
|
||||
+ NBITS is the number of bits to read.
|
||||
+ BITS_BIG_ENDIAN is taken directly from gdbarch.
|
||||
+
|
||||
+ This function returns the bits that were read. */
|
||||
+
|
||||
+static unsigned int
|
||||
+extract_bits (const gdb_byte **source, unsigned int *source_offset_bits,
|
||||
+ int nbits, int bits_big_endian)
|
||||
+{
|
||||
+ unsigned int datum;
|
||||
+
|
||||
+ gdb_assert (nbits > 0 && nbits <= 8);
|
||||
+
|
||||
+ datum = extract_bits_primitive (source, source_offset_bits, &nbits,
|
||||
+ bits_big_endian);
|
||||
+ if (nbits > 0)
|
||||
+ {
|
||||
+ unsigned int more;
|
||||
+
|
||||
+ more = extract_bits_primitive (source, source_offset_bits, &nbits,
|
||||
+ bits_big_endian);
|
||||
+ if (bits_big_endian)
|
||||
+ datum <<= nbits;
|
||||
+ else
|
||||
+ more <<= nbits;
|
||||
+ datum |= more;
|
||||
+ }
|
||||
+
|
||||
+ return datum;
|
||||
+}
|
||||
+
|
||||
+/* Write some bits into a buffer and move forward in the buffer.
|
||||
+
|
||||
+ DATUM is the bits to write. The low-order bits of DATUM are used.
|
||||
+ DEST is the destination buffer. It is updated as bytes are
|
||||
+ written.
|
||||
+ DEST_OFFSET_BITS is the bit offset in DEST at which writing is
|
||||
+ done.
|
||||
+ NBITS is the number of valid bits in DATUM.
|
||||
+ BITS_BIG_ENDIAN is taken directly from gdbarch. */
|
||||
+
|
||||
+static void
|
||||
+insert_bits (unsigned int datum,
|
||||
+ gdb_byte *dest, unsigned int dest_offset_bits,
|
||||
+ int nbits, int bits_big_endian)
|
||||
+{
|
||||
+ unsigned int mask;
|
||||
+
|
||||
+ gdb_assert (dest_offset_bits >= 0 && dest_offset_bits + nbits <= 8);
|
||||
+
|
||||
+ mask = (1 << nbits) - 1;
|
||||
+ if (bits_big_endian)
|
||||
+ {
|
||||
+ datum <<= 8 - (dest_offset_bits + nbits);
|
||||
+ mask <<= 8 - (dest_offset_bits + nbits);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ datum <<= dest_offset_bits;
|
||||
+ mask <<= dest_offset_bits;
|
||||
+ }
|
||||
+
|
||||
+ gdb_assert ((datum & ~mask) == 0);
|
||||
+
|
||||
+ *dest = (*dest & ~mask) | datum;
|
||||
+}
|
||||
+
|
||||
+/* Copy bits from a source to a destination.
|
||||
+
|
||||
+ DEST is where the bits should be written.
|
||||
+ DEST_OFFSET_BITS is the bit offset into DEST.
|
||||
+ SOURCE is the source of bits.
|
||||
+ SOURCE_OFFSET_BITS is the bit offset into SOURCE.
|
||||
+ BIT_COUNT is the number of bits to copy.
|
||||
+ BITS_BIG_ENDIAN is taken directly from gdbarch. */
|
||||
+
|
||||
+static void
|
||||
+copy_bitwise (gdb_byte *dest, unsigned int dest_offset_bits,
|
||||
+ const gdb_byte *source, unsigned int source_offset_bits,
|
||||
+ unsigned int bit_count,
|
||||
+ int bits_big_endian)
|
||||
+{
|
||||
+ unsigned int dest_avail;
|
||||
+ int datum;
|
||||
+
|
||||
+ /* Reduce everything to byte-size pieces. */
|
||||
+ dest += dest_offset_bits / 8;
|
||||
+ dest_offset_bits %= 8;
|
||||
+ source += source_offset_bits / 8;
|
||||
+ source_offset_bits %= 8;
|
||||
+
|
||||
+ dest_avail = 8 - dest_offset_bits % 8;
|
||||
+
|
||||
+ /* See if we can fill the first destination byte. */
|
||||
+ if (dest_avail < bit_count)
|
||||
+ {
|
||||
+ datum = extract_bits (&source, &source_offset_bits, dest_avail,
|
||||
+ bits_big_endian);
|
||||
+ insert_bits (datum, dest, dest_offset_bits, dest_avail, bits_big_endian);
|
||||
+ ++dest;
|
||||
+ dest_offset_bits = 0;
|
||||
+ bit_count -= dest_avail;
|
||||
+ }
|
||||
+
|
||||
+ /* Now, either DEST_OFFSET_BITS is byte-aligned, or we have fewer
|
||||
+ than 8 bits remaining. */
|
||||
+ gdb_assert (dest_offset_bits % 8 == 0 || bit_count < 8);
|
||||
+ for (; bit_count >= 8; bit_count -= 8)
|
||||
+ {
|
||||
+ datum = extract_bits (&source, &source_offset_bits, 8, bits_big_endian);
|
||||
+ *dest++ = (gdb_byte) datum;
|
||||
+ }
|
||||
+
|
||||
+ /* Finally, we may have a few leftover bits. */
|
||||
+ gdb_assert (bit_count <= 8 - dest_offset_bits % 8);
|
||||
+ if (bit_count > 0)
|
||||
+ {
|
||||
+ datum = extract_bits (&source, &source_offset_bits, bit_count,
|
||||
+ bits_big_endian);
|
||||
+ insert_bits (datum, dest, dest_offset_bits, bit_count, bits_big_endian);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void
|
||||
read_pieced_value (struct value *v)
|
||||
{
|
||||
int i;
|
||||
long offset = 0;
|
||||
- ULONGEST bytes_to_skip;
|
||||
+ ULONGEST bits_to_skip;
|
||||
gdb_byte *contents;
|
||||
struct piece_closure *c = (struct piece_closure *) value_computed_closure (v);
|
||||
struct frame_info *frame = frame_find_by_id (VALUE_FRAME_ID (v));
|
||||
size_t type_len;
|
||||
+ size_t buffer_size = 0;
|
||||
+ char *buffer = NULL;
|
||||
+ struct cleanup *cleanup;
|
||||
+ int bits_big_endian
|
||||
+ = gdbarch_bits_big_endian (get_type_arch (value_type (v)));
|
||||
|
||||
if (value_type (v) != value_enclosing_type (v))
|
||||
internal_error (__FILE__, __LINE__,
|
||||
_("Should not be able to create a lazy value with "
|
||||
"an enclosing type"));
|
||||
|
||||
+ cleanup = make_cleanup (free_current_contents, &buffer);
|
||||
+
|
||||
contents = value_contents_raw (v);
|
||||
- bytes_to_skip = value_offset (v);
|
||||
- type_len = TYPE_LENGTH (value_type (v));
|
||||
+ bits_to_skip = 8 * value_offset (v);
|
||||
+ type_len = 8 * TYPE_LENGTH (value_type (v));
|
||||
+
|
||||
for (i = 0; i < c->n_pieces && offset < type_len; i++)
|
||||
{
|
||||
struct dwarf_expr_piece *p = &c->pieces[i];
|
||||
- size_t this_size;
|
||||
- long dest_offset, source_offset;
|
||||
-
|
||||
- if (bytes_to_skip > 0 && bytes_to_skip >= p->size)
|
||||
+ size_t this_size, this_size_bits;
|
||||
+ long dest_offset_bits, source_offset_bits, source_offset;
|
||||
+ gdb_byte *intermediate_buffer;
|
||||
+
|
||||
+ /* Compute size, source, and destination offsets for copying, in
|
||||
+ bits. */
|
||||
+ this_size_bits = p->size;
|
||||
+ if (bits_to_skip > 0 && bits_to_skip >= this_size_bits)
|
||||
{
|
||||
- bytes_to_skip -= p->size;
|
||||
+ bits_to_skip -= this_size_bits;
|
||||
continue;
|
||||
}
|
||||
- this_size = p->size;
|
||||
- if (this_size > type_len - offset)
|
||||
- this_size = type_len - offset;
|
||||
- if (bytes_to_skip > 0)
|
||||
- {
|
||||
- dest_offset = 0;
|
||||
- source_offset = bytes_to_skip;
|
||||
- this_size -= bytes_to_skip;
|
||||
- bytes_to_skip = 0;
|
||||
+ if (this_size_bits > type_len - offset)
|
||||
+ this_size_bits = type_len - offset;
|
||||
+ if (bits_to_skip > 0)
|
||||
+ {
|
||||
+ dest_offset_bits = 0;
|
||||
+ source_offset_bits = bits_to_skip;
|
||||
+ this_size_bits -= bits_to_skip;
|
||||
+ bits_to_skip = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
- dest_offset = offset;
|
||||
- source_offset = 0;
|
||||
+ dest_offset_bits = offset;
|
||||
+ source_offset_bits = 0;
|
||||
+ }
|
||||
+
|
||||
+ this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8;
|
||||
+ source_offset = source_offset_bits / 8;
|
||||
+ if (buffer_size < this_size)
|
||||
+ {
|
||||
+ buffer_size = this_size;
|
||||
+ buffer = xrealloc (buffer, buffer_size);
|
||||
}
|
||||
+ intermediate_buffer = buffer;
|
||||
|
||||
+ /* Copy from the source to DEST_BUFFER. */
|
||||
switch (p->location)
|
||||
{
|
||||
case DWARF_VALUE_REGISTER:
|
||||
@@ -316,13 +509,18 @@
|
||||
|
||||
if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG
|
||||
&& this_size < register_size (arch, gdb_regnum))
|
||||
- /* Big-endian, and we want less than full size. */
|
||||
- reg_offset = register_size (arch, gdb_regnum) - this_size;
|
||||
+ {
|
||||
+ /* Big-endian, and we want less than full size. */
|
||||
+ reg_offset = register_size (arch, gdb_regnum) - this_size;
|
||||
+ /* We want the lower-order THIS_SIZE_BITS of the bytes
|
||||
+ we extract from the register. */
|
||||
+ source_offset_bits += 8 * this_size - this_size_bits;
|
||||
+ }
|
||||
|
||||
if (gdb_regnum != -1)
|
||||
{
|
||||
get_frame_register_bytes (frame, gdb_regnum, reg_offset,
|
||||
- this_size, contents + dest_offset);
|
||||
+ this_size, buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -334,11 +532,9 @@
|
||||
|
||||
case DWARF_VALUE_MEMORY:
|
||||
if (p->v.expr.in_stack_memory)
|
||||
- read_stack (p->v.expr.value + source_offset,
|
||||
- contents + dest_offset, this_size);
|
||||
+ read_stack (p->v.expr.value + source_offset, buffer, this_size);
|
||||
else
|
||||
- read_memory (p->v.expr.value + source_offset,
|
||||
- contents + dest_offset, this_size);
|
||||
+ read_memory (p->v.expr.value + source_offset, buffer, this_size);
|
||||
break;
|
||||
|
||||
case DWARF_VALUE_STACK:
|
||||
@@ -355,7 +551,7 @@
|
||||
/* Nothing. */
|
||||
}
|
||||
else if (source_offset == 0)
|
||||
- store_unsigned_integer (contents + dest_offset, n,
|
||||
+ store_unsigned_integer (buffer, n,
|
||||
gdbarch_byte_order (gdbarch),
|
||||
p->v.expr.value);
|
||||
else
|
||||
@@ -365,7 +561,7 @@
|
||||
store_unsigned_integer (bytes, n + source_offset,
|
||||
gdbarch_byte_order (gdbarch),
|
||||
p->v.expr.value);
|
||||
- memcpy (contents + dest_offset, bytes + source_offset, n);
|
||||
+ memcpy (buffer, bytes + source_offset, n);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -379,8 +575,7 @@
|
||||
? p->v.literal.length - source_offset
|
||||
: 0);
|
||||
if (n != 0)
|
||||
- memcpy (contents + dest_offset,
|
||||
- p->v.literal.data + source_offset, n);
|
||||
+ intermediate_buffer = p->v.literal.data + source_offset;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -388,17 +583,25 @@
|
||||
/* We just leave the bits empty for now. This is not ideal
|
||||
but gdb currently does not have a nice way to represent
|
||||
optimized-out pieces. */
|
||||
- warning (_("bytes %ld-%ld in computed object were optimized out; "
|
||||
+ warning (_("bits %ld-%ld in computed object were optimized out; "
|
||||
"replacing with zeroes"),
|
||||
offset,
|
||||
- offset + (long) this_size);
|
||||
+ offset + (long) this_size_bits);
|
||||
break;
|
||||
|
||||
default:
|
||||
internal_error (__FILE__, __LINE__, _("invalid location type"));
|
||||
}
|
||||
- offset += this_size;
|
||||
+
|
||||
+ if (p->location != DWARF_VALUE_OPTIMIZED_OUT)
|
||||
+ copy_bitwise (contents, dest_offset_bits,
|
||||
+ intermediate_buffer, source_offset_bits % 8,
|
||||
+ this_size_bits, bits_big_endian);
|
||||
+
|
||||
+ offset += this_size_bits;
|
||||
}
|
||||
+
|
||||
+ do_cleanups (cleanup);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -406,11 +609,16 @@
|
||||
{
|
||||
int i;
|
||||
long offset = 0;
|
||||
- ULONGEST bytes_to_skip;
|
||||
+ ULONGEST bits_to_skip;
|
||||
const gdb_byte *contents;
|
||||
struct piece_closure *c = (struct piece_closure *) value_computed_closure (to);
|
||||
struct frame_info *frame = frame_find_by_id (VALUE_FRAME_ID (to));
|
||||
size_t type_len;
|
||||
+ size_t buffer_size = 0;
|
||||
+ char *buffer = NULL;
|
||||
+ struct cleanup *cleanup;
|
||||
+ int bits_big_endian
|
||||
+ = gdbarch_bits_big_endian (get_type_arch (value_type (to)));
|
||||
|
||||
if (frame == NULL)
|
||||
{
|
||||
@@ -418,34 +626,57 @@
|
||||
return;
|
||||
}
|
||||
|
||||
+ cleanup = make_cleanup (free_current_contents, &buffer);
|
||||
+
|
||||
contents = value_contents (from);
|
||||
- bytes_to_skip = value_offset (to);
|
||||
- type_len = TYPE_LENGTH (value_type (to));
|
||||
+ bits_to_skip = 8 * value_offset (to);
|
||||
+ type_len = 8 * TYPE_LENGTH (value_type (to));
|
||||
for (i = 0; i < c->n_pieces && offset < type_len; i++)
|
||||
{
|
||||
struct dwarf_expr_piece *p = &c->pieces[i];
|
||||
- size_t this_size;
|
||||
- long dest_offset, source_offset;
|
||||
+ size_t this_size_bits, this_size;
|
||||
+ long dest_offset_bits, source_offset_bits, dest_offset, source_offset;
|
||||
+ int need_bitwise;
|
||||
+ const gdb_byte *source_buffer;
|
||||
|
||||
- if (bytes_to_skip > 0 && bytes_to_skip >= p->size)
|
||||
+ this_size_bits = p->size;
|
||||
+ if (bits_to_skip > 0 && bits_to_skip >= this_size_bits)
|
||||
{
|
||||
- bytes_to_skip -= p->size;
|
||||
+ bits_to_skip -= this_size_bits;
|
||||
continue;
|
||||
}
|
||||
- this_size = p->size;
|
||||
- if (this_size > type_len - offset)
|
||||
- this_size = type_len - offset;
|
||||
- if (bytes_to_skip > 0)
|
||||
- {
|
||||
- dest_offset = bytes_to_skip;
|
||||
- source_offset = 0;
|
||||
- this_size -= bytes_to_skip;
|
||||
- bytes_to_skip = 0;
|
||||
+ if (this_size_bits > type_len - offset)
|
||||
+ this_size_bits = type_len - offset;
|
||||
+ if (bits_to_skip > 0)
|
||||
+ {
|
||||
+ dest_offset_bits = bits_to_skip;
|
||||
+ source_offset_bits = 0;
|
||||
+ this_size_bits -= bits_to_skip;
|
||||
+ bits_to_skip = 0;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ dest_offset_bits = 0;
|
||||
+ source_offset_bits = offset;
|
||||
+ }
|
||||
+
|
||||
+ this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8;
|
||||
+ source_offset = source_offset_bits / 8;
|
||||
+ dest_offset = dest_offset_bits / 8;
|
||||
+ if (dest_offset_bits % 8 == 0 && source_offset_bits % 8 == 0)
|
||||
+ {
|
||||
+ source_buffer = contents + source_offset;
|
||||
+ need_bitwise = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
- dest_offset = 0;
|
||||
- source_offset = offset;
|
||||
+ if (buffer_size < this_size)
|
||||
+ {
|
||||
+ buffer_size = this_size;
|
||||
+ buffer = xrealloc (buffer, buffer_size);
|
||||
+ }
|
||||
+ source_buffer = buffer;
|
||||
+ need_bitwise = 1;
|
||||
}
|
||||
|
||||
switch (p->location)
|
||||
@@ -463,8 +694,18 @@
|
||||
|
||||
if (gdb_regnum != -1)
|
||||
{
|
||||
+ if (need_bitwise)
|
||||
+ {
|
||||
+ get_frame_register_bytes (frame, gdb_regnum, reg_offset,
|
||||
+ this_size, buffer);
|
||||
+ copy_bitwise (buffer, dest_offset_bits,
|
||||
+ contents, source_offset_bits,
|
||||
+ this_size_bits,
|
||||
+ bits_big_endian);
|
||||
+ }
|
||||
+
|
||||
put_frame_register_bytes (frame, gdb_regnum, reg_offset,
|
||||
- this_size, contents + source_offset);
|
||||
+ this_size, source_buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -474,15 +715,31 @@
|
||||
}
|
||||
break;
|
||||
case DWARF_VALUE_MEMORY:
|
||||
+ if (need_bitwise)
|
||||
+ {
|
||||
+ /* Only the first and last bytes can possibly have any
|
||||
+ bits reused. */
|
||||
+ read_memory (p->v.expr.value + dest_offset, buffer, 1);
|
||||
+ read_memory (p->v.expr.value + dest_offset + this_size - 1,
|
||||
+ buffer + this_size - 1, 1);
|
||||
+ copy_bitwise (buffer, dest_offset_bits,
|
||||
+ contents, source_offset_bits,
|
||||
+ this_size_bits,
|
||||
+ bits_big_endian);
|
||||
+ }
|
||||
+
|
||||
write_memory (p->v.expr.value + dest_offset,
|
||||
- contents + source_offset, this_size);
|
||||
+ source_buffer, this_size);
|
||||
break;
|
||||
default:
|
||||
set_value_optimized_out (to, 1);
|
||||
- return;
|
||||
+ goto done;
|
||||
}
|
||||
- offset += this_size;
|
||||
+ offset += this_size_bits;
|
||||
}
|
||||
+
|
||||
+ done:
|
||||
+ do_cleanups (cleanup);
|
||||
}
|
||||
|
||||
static void *
|
||||
--- src/gdb/testsuite/gdb.dwarf2/pieces.S 2010/05/21 21:01:46 1.2
|
||||
+++ src/gdb/testsuite/gdb.dwarf2/pieces.S 2010/05/21 21:13:13 1.3
|
||||
@@ -989,23 +989,18 @@
|
||||
.LLST6:
|
||||
.long .LVL13-.Ltext0 # Location list begin address (*.LLST6)
|
||||
.long .LVL14-.Ltext0 # Location list end address (*.LLST6)
|
||||
- .value 0xa # Location expression size
|
||||
- .byte 0x9d # DW_OP_bit_piece
|
||||
- .uleb128 0x4
|
||||
- .uleb128 0
|
||||
+ .value 0x8 # Location expression size
|
||||
.byte 0x34 # DW_OP_lit4
|
||||
.byte 0x9f # DW_OP_stack_value
|
||||
.byte 0x9d # DW_OP_bit_piece
|
||||
.uleb128 0xc
|
||||
.uleb128 0
|
||||
- .byte 0x93 # DW_OP_piece
|
||||
- .uleb128 0x2
|
||||
- .long .LVL14-.Ltext0 # Location list begin address (*.LLST6)
|
||||
- .long .LVL15-.Ltext0 # Location list end address (*.LLST6)
|
||||
- .value 0x15 # Location expression size
|
||||
.byte 0x9d # DW_OP_bit_piece
|
||||
- .uleb128 0x4
|
||||
+ .uleb128 0x14
|
||||
.uleb128 0
|
||||
+ .long .LVL14-.Ltext0 # Location list begin address (*.LLST6)
|
||||
+ .long .LVL15-.Ltext0 # Location list end address (*.LLST6)
|
||||
+ .value 0x11 # Location expression size
|
||||
.byte 0x34 # DW_OP_lit4
|
||||
.byte 0x9f # DW_OP_stack_value
|
||||
.byte 0x9d # DW_OP_bit_piece
|
||||
@@ -1021,15 +1016,11 @@
|
||||
.byte 0x9d # DW_OP_bit_piece
|
||||
.uleb128 0xc
|
||||
.uleb128 0
|
||||
- .byte 0x9d # DW_OP_bit_piece
|
||||
- .uleb128 0x4
|
||||
- .uleb128 0
|
||||
+ .byte 0x93 # DW_OP_piece
|
||||
+ .uleb128 0x1
|
||||
.long .LVL15-.Ltext0 # Location list begin address (*.LLST6)
|
||||
.long .LVL16-1-.Ltext0 # Location list end address (*.LLST6)
|
||||
- .value 0x14 # Location expression size
|
||||
- .byte 0x9d # DW_OP_bit_piece
|
||||
- .uleb128 0x4
|
||||
- .uleb128 0
|
||||
+ .value 0x10 # Location expression size
|
||||
.byte 0x52 # DW_OP_reg2
|
||||
.byte 0x9d # DW_OP_bit_piece
|
||||
.uleb128 0xc
|
||||
@@ -1044,15 +1035,11 @@
|
||||
.byte 0x9d # DW_OP_bit_piece
|
||||
.uleb128 0xc
|
||||
.uleb128 0
|
||||
- .byte 0x9d # DW_OP_bit_piece
|
||||
- .uleb128 0x4
|
||||
- .uleb128 0
|
||||
+ .byte 0x93 # DW_OP_piece
|
||||
+ .uleb128 0x1
|
||||
.long .LVL16-1-.Ltext0 # Location list begin address (*.LLST6)
|
||||
.long .LVL17-.Ltext0 # Location list end address (*.LLST6)
|
||||
- .value 0x14 # Location expression size
|
||||
- .byte 0x9d # DW_OP_bit_piece
|
||||
- .uleb128 0x4
|
||||
- .uleb128 0
|
||||
+ .value 0x10 # Location expression size
|
||||
.byte 0x56 # DW_OP_reg6
|
||||
.byte 0x9d # DW_OP_bit_piece
|
||||
.uleb128 0xc
|
||||
@@ -1067,14 +1054,14 @@
|
||||
.byte 0x9d # DW_OP_bit_piece
|
||||
.uleb128 0xc
|
||||
.uleb128 0
|
||||
- .byte 0x9d # DW_OP_bit_piece
|
||||
- .uleb128 0x4
|
||||
- .uleb128 0
|
||||
+ .byte 0x93 # DW_OP_piece
|
||||
+ .uleb128 0x1
|
||||
.long .LVL17-.Ltext0 # Location list begin address (*.LLST6)
|
||||
.long .LFE3-.Ltext0 # Location list end address (*.LLST6)
|
||||
.value 0xf # Location expression size
|
||||
- .byte 0x93 # DW_OP_piece
|
||||
- .uleb128 0x2
|
||||
+ .byte 0x9d # DW_OP_bit_piece
|
||||
+ .uleb128 0xc
|
||||
+ .uleb128 0
|
||||
.byte 0x91 # DW_OP_fbreg
|
||||
.sleb128 0
|
||||
.byte 0x94 # DW_OP_deref_size
|
||||
@@ -1085,9 +1072,8 @@
|
||||
.byte 0x9d # DW_OP_bit_piece
|
||||
.uleb128 0xc
|
||||
.uleb128 0
|
||||
- .byte 0x9d # DW_OP_bit_piece
|
||||
- .uleb128 0x4
|
||||
- .uleb128 0
|
||||
+ .byte 0x93 # DW_OP_piece
|
||||
+ .uleb128 0x1
|
||||
.long 0 # Location list terminator begin (*.LLST6)
|
||||
.long 0 # Location list terminator end (*.LLST6)
|
||||
.LLST7:
|
||||
@@ -1356,7 +1342,7 @@
|
||||
.long 0x48 # DW_AT_type
|
||||
.byte 0x4 # DW_AT_byte_size
|
||||
.byte 0xc # DW_AT_bit_size
|
||||
- .byte 0x10 # DW_AT_bit_offset
|
||||
+ .byte 0x14 # DW_AT_bit_offset
|
||||
.byte 0x2 # DW_AT_data_member_location
|
||||
.byte 0x23 # DW_OP_plus_uconst
|
||||
.uleb128 0
|
||||
@@ -1367,7 +1353,7 @@
|
||||
.long 0x48 # DW_AT_type
|
||||
.byte 0x4 # DW_AT_byte_size
|
||||
.byte 0xc # DW_AT_bit_size
|
||||
- .byte 0x4 # DW_AT_bit_offset
|
||||
+ .byte 0x8 # DW_AT_bit_offset
|
||||
.byte 0x2 # DW_AT_data_member_location
|
||||
.byte 0x23 # DW_OP_plus_uconst
|
||||
.uleb128 0
|
||||
--- src/gdb/testsuite/gdb.dwarf2/pieces.c 2010/05/21 21:01:46 1.2
|
||||
+++ src/gdb/testsuite/gdb.dwarf2/pieces.c 2010/05/21 21:13:13 1.3
|
||||
@@ -21,7 +21,7 @@
|
||||
However, it is used to extract breakpoint line numbers. */
|
||||
|
||||
struct A { int i; int j; };
|
||||
-struct B { int : 4; int i : 12; int j : 12; int : 4; };
|
||||
+struct B { int i : 12; int j : 12; int : 4; };
|
||||
struct C { int i; int j; int q; };
|
||||
|
||||
__attribute__((noinline)) void
|
||||
@@ -89,7 +89,7 @@
|
||||
f6 (int k)
|
||||
{
|
||||
int z = 23;
|
||||
- struct C a = { k, k, z};
|
||||
+ struct C a = { k, k, z };
|
||||
asm ("" : "+r" (a.i));
|
||||
a.j++;
|
||||
bar (a.i);
|
||||
--- src/gdb/testsuite/gdb.dwarf2/pieces.exp 2010/05/21 21:01:46 1.3
|
||||
+++ src/gdb/testsuite/gdb.dwarf2/pieces.exp 2010/05/21 21:13:13 1.4
|
||||
@@ -67,15 +67,30 @@
|
||||
gdb_test "print a\[1\]" " = 14" "print a\[1\] in pieces:f2"
|
||||
}
|
||||
|
||||
+# Function f3 tests DW_OP_bit_piece.
|
||||
+proc pieces_test_f3 {} {
|
||||
+ global csrcfile
|
||||
+ set line [gdb_get_line_number "f3 breakpoint" $csrcfile]
|
||||
+ gdb_test "break pieces.c:$line" "Breakpoint 4.*" \
|
||||
+ "set f3 breakpoint for pieces"
|
||||
+ gdb_continue_to_breakpoint "continue to f3 breakpoint for pieces"
|
||||
+ gdb_test "print a.i" " = 4" "print a.i in pieces:f3"
|
||||
+ gdb_test "print a.j" " = 14" "print a.j in pieces:f3"
|
||||
+ # Right now gdb says "value optimized out" here, but that is wrong.
|
||||
+ setup_kfail "no bug yet" *-*-*
|
||||
+ gdb_test "print a.i = 7" " = 7" "set a.i in pieces:f3"
|
||||
+ gdb_test "print a.i" " = 7" "print new a.i in pieces:f3"
|
||||
+}
|
||||
+
|
||||
# Function f6 tests for an empty DW_OP_piece.
|
||||
proc pieces_test_f6 {} {
|
||||
global csrcfile
|
||||
set line [gdb_get_line_number "f6 breakpoint" $csrcfile]
|
||||
- gdb_test "break pieces.c:$line" "Breakpoint 4.*" \
|
||||
+ gdb_test "break pieces.c:$line" "Breakpoint 5.*" \
|
||||
"set f6 breakpoint for pieces"
|
||||
gdb_continue_to_breakpoint "continue to f6 breakpoint for pieces"
|
||||
gdb_test "print a" \
|
||||
- "warning: bytes .* in computed object were.* = {i = 7, j = 8, q = 0}" \
|
||||
+ "warning: bits .* in computed object were.* = {i = 7, j = 8, q = 0}" \
|
||||
"print a with optimized out piece"
|
||||
# Note: no warning for this case.
|
||||
gdb_test_multiple "print a.i" \
|
||||
@@ -91,4 +106,5 @@
|
||||
|
||||
pieces_test_f1
|
||||
pieces_test_f2
|
||||
+pieces_test_f3
|
||||
pieces_test_f6
|
164
gdb-bz594560-core-vs-process.patch
Normal file
164
gdb-bz594560-core-vs-process.patch
Normal file
@ -0,0 +1,164 @@
|
||||
--- ./gdb/doc/gdb.texinfo 2010-05-24 19:37:01.000000000 +0200
|
||||
+++ ./gdb/doc/gdb.texinfo 2010-05-24 19:38:56.000000000 +0200
|
||||
@@ -14768,33 +14768,21 @@ and @code{show architecture}.
|
||||
@cindex active targets
|
||||
@cindex multiple targets
|
||||
|
||||
-There are three classes of targets: processes, core files, and
|
||||
-executable files. @value{GDBN} can work concurrently on up to three
|
||||
-active targets, one in each class. This allows you to (for example)
|
||||
-start a process and inspect its activity without abandoning your work on
|
||||
-a core file.
|
||||
-
|
||||
-For example, if you execute @samp{gdb a.out}, then the executable file
|
||||
-@code{a.out} is the only active target. If you designate a core file as
|
||||
-well---presumably from a prior run that crashed and coredumped---then
|
||||
-@value{GDBN} has two active targets and uses them in tandem, looking
|
||||
-first in the corefile target, then in the executable file, to satisfy
|
||||
-requests for memory addresses. (Typically, these two classes of target
|
||||
-are complementary, since core files contain only a program's
|
||||
-read-write memory---variables and so on---plus machine status, while
|
||||
-executable files contain only the program text and initialized data.)
|
||||
-
|
||||
-When you type @code{run}, your executable file becomes an active process
|
||||
-target as well. When a process target is active, all @value{GDBN}
|
||||
-commands requesting memory addresses refer to that target; addresses in
|
||||
-an active core file or executable file target are obscured while the
|
||||
-process target is active.
|
||||
-
|
||||
-Use the @code{core-file} and @code{exec-file} commands to select a new
|
||||
-core file or executable target (@pxref{Files, ,Commands to Specify
|
||||
-Files}). To specify as a target a process that is already running, use
|
||||
-the @code{attach} command (@pxref{Attach, ,Debugging an Already-running
|
||||
-Process}).
|
||||
+There are multiple classes of targets such as: processes, executable files or
|
||||
+recording sessions. Core files belong to the process class, there can be
|
||||
+active only one of a core or a running process. Otherwise @value{GDBN} can
|
||||
+work concurrently on multiple active targets, one in each class. This allows
|
||||
+you to (for example) start a process and inspect its activity while still
|
||||
+having access to the executable file after the process finishes. Or if you
|
||||
+start process recording (@pxref{Reverse Execution}) and @code{reverse-step}
|
||||
+there you are presented a virtual layer of the recording target while the
|
||||
+process target remains stopped at the chronologically last point of the process
|
||||
+execution.
|
||||
+
|
||||
+Use the @code{core-file} and @code{exec-file} commands to select a new core
|
||||
+file or executable target (@pxref{Files, ,Commands to Specify Files}). To
|
||||
+specify as a target a process that is already running, use the @code{attach}
|
||||
+command (@pxref{Attach, ,Debugging an Already-running Process}).
|
||||
|
||||
@node Target Commands
|
||||
@section Commands for Managing Targets
|
||||
--- ./gdb/infcmd.c 2010-05-24 19:37:01.000000000 +0200
|
||||
+++ ./gdb/infcmd.c 2010-05-24 19:41:21.000000000 +0200
|
||||
@@ -483,6 +483,13 @@ run_command_1 (char *args, int from_tty,
|
||||
|
||||
dont_repeat ();
|
||||
|
||||
+ if (core_bfd)
|
||||
+ {
|
||||
+ core_file_command (NULL, from_tty);
|
||||
+ if (core_bfd)
|
||||
+ warning (_("Core file not unloaded."));
|
||||
+ }
|
||||
+
|
||||
kill_if_already_running (from_tty);
|
||||
|
||||
init_wait_for_inferior ();
|
||||
@@ -2373,6 +2380,13 @@ attach_command (char *args, int from_tty
|
||||
error (_("Not killed."));
|
||||
}
|
||||
|
||||
+ if (core_bfd)
|
||||
+ {
|
||||
+ core_file_command (NULL, from_tty);
|
||||
+ if (core_bfd)
|
||||
+ warning (_("Core file not unloaded."));
|
||||
+ }
|
||||
+
|
||||
/* Clean up any leftovers from other runs. Some other things from
|
||||
this function should probably be moved into target_pre_inferior. */
|
||||
target_pre_inferior (from_tty);
|
||||
--- ./gdb/testsuite/gdb.base/corefile.exp 2010-01-09 01:14:11.000000000 +0100
|
||||
+++ ./gdb/testsuite/gdb.base/corefile.exp 2010-05-24 19:38:56.000000000 +0200
|
||||
@@ -182,3 +182,62 @@ gdb_load ${binfile}
|
||||
gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp (reinit)"
|
||||
|
||||
gdb_test "core" "No core file now."
|
||||
+
|
||||
+
|
||||
+# Test a run (start) command will clear any loaded core file.
|
||||
+
|
||||
+gdb_test "core-file $corefile" "Core was generated by .*" "run: load core again"
|
||||
+gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "run: sanity check we see the core file"
|
||||
+
|
||||
+set test "run: with core"
|
||||
+if [runto_main] {
|
||||
+ pass $test
|
||||
+} else {
|
||||
+ fail $test
|
||||
+}
|
||||
+
|
||||
+set test "run: core file is cleared"
|
||||
+gdb_test_multiple "info files" $test {
|
||||
+ "\r\nLocal core dump file:\r\n.*\r\n$gdb_prompt $" {
|
||||
+ fail $test
|
||||
+ }
|
||||
+ "\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+
|
||||
+
|
||||
+# Test an attach command will clear any loaded core file.
|
||||
+
|
||||
+if ![is_remote target] {
|
||||
+ set test "attach: spawn sleep"
|
||||
+ set res [remote_spawn host "$binfile sleep"];
|
||||
+ if { $res < 0 || $res == "" } {
|
||||
+ perror "$test failed."
|
||||
+ fail $test
|
||||
+ return
|
||||
+ }
|
||||
+ set pid [exp_pid -i $res]
|
||||
+ # We do not care of the startup phase where it will be caught.
|
||||
+
|
||||
+ gdb_start
|
||||
+
|
||||
+ gdb_test "core-file $corefile" "Core was generated by .*" "attach: load core again"
|
||||
+ gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "attach: sanity check we see the core file"
|
||||
+
|
||||
+ gdb_test "attach $pid" "Attaching to process $pid\r\n.*" "attach: with core"
|
||||
+
|
||||
+ set test "attach: core file is cleared"
|
||||
+ gdb_test_multiple "info files" $test {
|
||||
+ "\r\nLocal core dump file:\r\n.*\r\n$gdb_prompt $" {
|
||||
+ fail $test
|
||||
+ }
|
||||
+ "\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ gdb_exit
|
||||
+}
|
||||
--- ./gdb/testsuite/gdb.base/coremaker.c 2010-01-01 08:32:00.000000000 +0100
|
||||
+++ ./gdb/testsuite/gdb.base/coremaker.c 2010-05-24 19:38:56.000000000 +0200
|
||||
@@ -133,8 +133,14 @@ func1 ()
|
||||
func2 ();
|
||||
}
|
||||
|
||||
-int main ()
|
||||
+int
|
||||
+main (int argc, char **argv)
|
||||
{
|
||||
+ if (argc == 2 && strcmp (argv[1], "sleep") == 0)
|
||||
+ {
|
||||
+ sleep (60);
|
||||
+ return 0;
|
||||
+ }
|
||||
mmapdata ();
|
||||
func1 ();
|
||||
return 0;
|
79
gdb-bz595475-tui-layout.patch
Normal file
79
gdb-bz595475-tui-layout.patch
Normal file
@ -0,0 +1,79 @@
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=586566
|
||||
http://sourceware.org/ml/gdb-patches/2010-03/msg00746.html
|
||||
http://sourceware.org/ml/gdb-patches/2010-05/msg00551.html
|
||||
http://sourceware.org/ml/gdb-cvs/2010-03/msg00194.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/03/19 22:00:16 1.11508
|
||||
### src/gdb/ChangeLog 2010/03/20 05:17:10 1.11509
|
||||
## -1,3 +1,9 @@
|
||||
+2010-03-20 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
+
|
||||
+ * tui/tui-disasm.c (tui_get_begin_asm_address): Default to
|
||||
+ get_current_arch.
|
||||
+ * tui/tui-layout.c (extract_display_start_addr): Likewise.
|
||||
+
|
||||
2010-03-19 Stan Shebs <stan@codesourcery.com>
|
||||
|
||||
* ax-gdb.c (gen_fetch): Handle bool.
|
||||
--- src/gdb/tui/tui-disasm.c 2010/01/01 07:32:07 1.33
|
||||
+++ src/gdb/tui/tui-disasm.c 2010/03/20 05:17:10 1.34
|
||||
@@ -21,6 +21,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "defs.h"
|
||||
+#include "arch-utils.h"
|
||||
#include "symtab.h"
|
||||
#include "breakpoint.h"
|
||||
#include "frame.h"
|
||||
@@ -330,7 +331,7 @@
|
||||
{
|
||||
struct tui_gen_win_info *locator;
|
||||
struct tui_locator_element *element;
|
||||
- struct gdbarch *gdbarch = NULL;
|
||||
+ struct gdbarch *gdbarch = get_current_arch ();
|
||||
CORE_ADDR addr;
|
||||
|
||||
locator = tui_locator_win_info_ptr ();
|
||||
--- src/gdb/tui/tui-layout.c 2010/01/01 07:32:07 1.36
|
||||
+++ src/gdb/tui/tui-layout.c 2010/03/20 05:17:10 1.37
|
||||
@@ -21,6 +21,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "defs.h"
|
||||
+#include "arch-utils.h"
|
||||
#include "command.h"
|
||||
#include "symtab.h"
|
||||
#include "frame.h"
|
||||
@@ -522,7 +523,7 @@
|
||||
extract_display_start_addr (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
|
||||
{
|
||||
enum tui_layout_type cur_layout = tui_current_layout ();
|
||||
- struct gdbarch *gdbarch = NULL;
|
||||
+ struct gdbarch *gdbarch = get_current_arch ();
|
||||
CORE_ADDR addr;
|
||||
CORE_ADDR pc;
|
||||
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
|
||||
--- /dev/null 2010-05-24 04:43:32.632794021 +0200
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.base/tui-layout.exp 2010-05-24 20:13:30.000000000 +0200
|
||||
@@ -0,0 +1,21 @@
|
||||
+# Copyright 2010 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/>.
|
||||
+
|
||||
+set testfile tui-layout
|
||||
+if { [prepare_for_testing ${testfile}.exp ${testfile} start.c] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test "layout asm"
|
66
gdb-bz600746-koenig-crash.patch
Normal file
66
gdb-bz600746-koenig-crash.patch
Normal file
@ -0,0 +1,66 @@
|
||||
[patch] Fix ADL anonymous type crash
|
||||
http://sourceware.org/ml/gdb-patches/2010-06/msg00004.html
|
||||
http://sourceware.org/ml/gdb-cvs/2010-06/msg00012.html
|
||||
|
||||
[ Backported the testcase. ]
|
||||
|
||||
### src/gdb/ChangeLog 2010/06/02 06:24:00 1.11862
|
||||
### src/gdb/ChangeLog 2010/06/02 15:31:29 1.11863
|
||||
## -1,3 +1,8 @@
|
||||
+2010-06-02 Sami Wagiaalla <swagiaal@redhat.com>
|
||||
+
|
||||
+ * cp-support.c (make_symbol_overload_list_adl_namespace): Handle
|
||||
+ anonymous type case.
|
||||
+
|
||||
2010-06-02 Pierre Muller <muller@ics.u-strasbg.fr>
|
||||
|
||||
* dwarf2read.c (read_subrange_type): Handle missing base type
|
||||
### src/gdb/testsuite/ChangeLog 2010/06/01 21:29:21 1.2298
|
||||
### src/gdb/testsuite/ChangeLog 2010/06/02 15:31:30 1.2299
|
||||
## -1,3 +1,8 @@
|
||||
+2010-06-02 Sami Wagiaalla <swagiaal@redhat.com>
|
||||
+
|
||||
+ * gdb.cp/namespace-koenig.exp: Added new test case.
|
||||
+ * gdb.cp/namespace-koenig.cc: Ditto.
|
||||
+
|
||||
2010-06-01 Michael Snyder <msnyder@vmware.com>
|
||||
|
||||
* gdb.base/arithmet.exp: Use gdb_test_no_output.
|
||||
--- src/gdb/cp-support.c 2010/05/13 23:53:32 1.40
|
||||
+++ src/gdb/cp-support.c 2010/06/02 15:31:30 1.41
|
||||
@@ -752,6 +752,9 @@
|
||||
|
||||
type_name = TYPE_NAME (type);
|
||||
|
||||
+ if (type_name == NULL)
|
||||
+ return;
|
||||
+
|
||||
prefix_len = cp_entire_prefix_len (type_name);
|
||||
|
||||
if (prefix_len != 0)
|
||||
--- gdb-7.1/gdb/testsuite/gdb.cp/namespace-koenig.cc.orig 2010-06-09 08:20:14.000000000 +0200
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.cp/namespace-koenig.cc 2010-06-09 11:09:29.000000000 +0200
|
||||
@@ -165,6 +165,13 @@ namespace M {
|
||||
|
||||
}
|
||||
//------------
|
||||
+static union {
|
||||
+ int a;
|
||||
+ char b;
|
||||
+}p_union;
|
||||
+
|
||||
+//------------
|
||||
+
|
||||
int
|
||||
main ()
|
||||
{
|
||||
--- gdb-7.1/gdb/testsuite/gdb.cp/namespace-koenig.exp.orig 2010-06-09 08:20:14.000000000 +0200
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.cp/namespace-koenig.exp 2010-06-09 11:09:48.000000000 +0200
|
||||
@@ -110,3 +111,7 @@ gdb_test "p o + 5.0f" "= 22"
|
||||
gdb_test "p o + 5" "= 23"
|
||||
|
||||
gdb_test "p o++" "= 24"
|
||||
+
|
||||
+#test that lookup is not thwarted by anonymous types
|
||||
+gdb_test "p foo (p_union)" \
|
||||
+ "Cannot resolve function foo to any overloaded instance"
|
329
gdb-bz601887-dwarf4-1of2.patch
Normal file
329
gdb-bz601887-dwarf4-1of2.patch
Normal file
@ -0,0 +1,329 @@
|
||||
commit be1f57c90bdf86477b9bc69cc982171d6ad5df56
|
||||
Author: Tom Tromey <tromey@redhat.com>
|
||||
Date: Tue Apr 20 17:33:13 2010 +0000
|
||||
|
||||
* dwarf2-frame.c (decode_frame_entry_1): Handle CIE version 4.
|
||||
(struct dwarf2_cie) <segment_size>: New field.
|
||||
* dwarf2read.c (partial_read_comp_unit_head): Accept DWARF 4.
|
||||
(skip_one_die): Handle DW_FORM_flag_present, DW_FORM_sec_offset,
|
||||
DW_FORM_exprloc.
|
||||
(read_attribute_value): Handle DW_FORM_flag_present,
|
||||
DW_FORM_sec_offset, DW_FORM_exprloc.
|
||||
(dump_die_shallow): Likewise.
|
||||
(attr_form_is_section_offset): Handle DW_FORM_sec_offset.
|
||||
(dwarf2_const_value): Handle DW_FORM_exprloc.
|
||||
(attr_form_is_block): Likewise.
|
||||
(struct line_header) <maximum_ops_per_instruction>: New field.
|
||||
(dwarf_decode_line_header): Set new field.
|
||||
(dwarf_decode_lines): Handle new field.
|
||||
|
||||
### a/gdb/ChangeLog
|
||||
### b/gdb/ChangeLog
|
||||
## -1,3 +1,20 @@
|
||||
+2010-04-20 Tom Tromey <tromey@redhat.com>
|
||||
+
|
||||
+ * dwarf2-frame.c (decode_frame_entry_1): Handle CIE version 4.
|
||||
+ (struct dwarf2_cie) <segment_size>: New field.
|
||||
+ * dwarf2read.c (partial_read_comp_unit_head): Accept DWARF 4.
|
||||
+ (skip_one_die): Handle DW_FORM_flag_present, DW_FORM_sec_offset,
|
||||
+ DW_FORM_exprloc.
|
||||
+ (read_attribute_value): Handle DW_FORM_flag_present,
|
||||
+ DW_FORM_sec_offset, DW_FORM_exprloc.
|
||||
+ (dump_die_shallow): Likewise.
|
||||
+ (attr_form_is_section_offset): Handle DW_FORM_sec_offset.
|
||||
+ (dwarf2_const_value): Handle DW_FORM_exprloc.
|
||||
+ (attr_form_is_block): Likewise.
|
||||
+ (struct line_header) <maximum_ops_per_instruction>: New field.
|
||||
+ (dwarf_decode_line_header): Set new field.
|
||||
+ (dwarf_decode_lines): Handle new field.
|
||||
+
|
||||
2010-04-20 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* f-exp.y: Add new production to recognize the `logical*8' type.
|
||||
--- a/gdb/dwarf2-frame.c
|
||||
+++ b/gdb/dwarf2-frame.c
|
||||
@@ -85,6 +85,9 @@ struct dwarf2_cie
|
||||
|
||||
/* The version recorded in the CIE. */
|
||||
unsigned char version;
|
||||
+
|
||||
+ /* The segment size. */
|
||||
+ unsigned char segment_size;
|
||||
};
|
||||
|
||||
struct dwarf2_cie_table
|
||||
@@ -1714,7 +1717,7 @@ decode_frame_entry_1 (struct comp_unit *unit, gdb_byte *start, int eh_frame_p,
|
||||
|
||||
/* Check version number. */
|
||||
cie_version = read_1_byte (unit->abfd, buf);
|
||||
- if (cie_version != 1 && cie_version != 3)
|
||||
+ if (cie_version != 1 && cie_version != 3 && cie_version != 4)
|
||||
return NULL;
|
||||
cie->version = cie_version;
|
||||
buf += 1;
|
||||
@@ -1738,6 +1741,20 @@ decode_frame_entry_1 (struct comp_unit *unit, gdb_byte *start, int eh_frame_p,
|
||||
augmentation += 2;
|
||||
}
|
||||
|
||||
+ if (cie->version >= 4)
|
||||
+ {
|
||||
+ /* FIXME: check that this is the same as from the CU header. */
|
||||
+ cie->addr_size = read_1_byte (unit->abfd, buf);
|
||||
+ ++buf;
|
||||
+ cie->segment_size = read_1_byte (unit->abfd, buf);
|
||||
+ ++buf;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ cie->addr_size = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
|
||||
+ cie->segment_size = 0;
|
||||
+ }
|
||||
+
|
||||
cie->code_alignment_factor =
|
||||
read_unsigned_leb128 (unit->abfd, buf, &bytes_read);
|
||||
buf += bytes_read;
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -396,6 +396,7 @@ struct line_header
|
||||
unsigned short version;
|
||||
unsigned int header_length;
|
||||
unsigned char minimum_instruction_length;
|
||||
+ unsigned char maximum_ops_per_instruction;
|
||||
unsigned char default_is_stmt;
|
||||
int line_base;
|
||||
unsigned char line_range;
|
||||
@@ -1488,10 +1489,10 @@ partial_read_comp_unit_head (struct comp_unit_head *header, gdb_byte *info_ptr,
|
||||
|
||||
info_ptr = read_comp_unit_head (header, info_ptr, abfd);
|
||||
|
||||
- if (header->version != 2 && header->version != 3)
|
||||
+ if (header->version != 2 && header->version != 3 && header->version != 4)
|
||||
error (_("Dwarf Error: wrong version in compilation unit header "
|
||||
- "(is %d, should be %d) [in module %s]"), header->version,
|
||||
- 2, bfd_get_filename (abfd));
|
||||
+ "(is %d, should be 2, 3, or 4) [in module %s]"), header->version,
|
||||
+ bfd_get_filename (abfd));
|
||||
|
||||
if (header->abbrev_offset >= dwarf2_per_objfile->abbrev.size)
|
||||
error (_("Dwarf Error: bad offset (0x%lx) in compilation unit header "
|
||||
@@ -2776,6 +2777,8 @@ skip_one_die (gdb_byte *buffer, gdb_byte *info_ptr,
|
||||
case DW_FORM_flag:
|
||||
info_ptr += 1;
|
||||
break;
|
||||
+ case DW_FORM_flag_present:
|
||||
+ break;
|
||||
case DW_FORM_data2:
|
||||
case DW_FORM_ref2:
|
||||
info_ptr += 2;
|
||||
@@ -2793,9 +2796,11 @@ skip_one_die (gdb_byte *buffer, gdb_byte *info_ptr,
|
||||
read_string (abfd, info_ptr, &bytes_read);
|
||||
info_ptr += bytes_read;
|
||||
break;
|
||||
+ case DW_FORM_sec_offset:
|
||||
case DW_FORM_strp:
|
||||
info_ptr += cu->header.offset_size;
|
||||
break;
|
||||
+ case DW_FORM_exprloc:
|
||||
case DW_FORM_block:
|
||||
info_ptr += read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
|
||||
info_ptr += bytes_read;
|
||||
@@ -7129,6 +7134,10 @@ read_attribute_value (struct attribute *attr, unsigned form,
|
||||
DW_UNSND (attr) = read_8_bytes (abfd, info_ptr);
|
||||
info_ptr += 8;
|
||||
break;
|
||||
+ case DW_FORM_sec_offset:
|
||||
+ DW_UNSND (attr) = read_offset (abfd, info_ptr, &cu->header, &bytes_read);
|
||||
+ info_ptr += bytes_read;
|
||||
+ break;
|
||||
case DW_FORM_string:
|
||||
DW_STRING (attr) = read_string (abfd, info_ptr, &bytes_read);
|
||||
DW_STRING_IS_CANONICAL (attr) = 0;
|
||||
@@ -7140,6 +7149,7 @@ read_attribute_value (struct attribute *attr, unsigned form,
|
||||
DW_STRING_IS_CANONICAL (attr) = 0;
|
||||
info_ptr += bytes_read;
|
||||
break;
|
||||
+ case DW_FORM_exprloc:
|
||||
case DW_FORM_block:
|
||||
blk = dwarf_alloc_block (cu);
|
||||
blk->size = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
|
||||
@@ -7164,6 +7174,9 @@ read_attribute_value (struct attribute *attr, unsigned form,
|
||||
DW_UNSND (attr) = read_1_byte (abfd, info_ptr);
|
||||
info_ptr += 1;
|
||||
break;
|
||||
+ case DW_FORM_flag_present:
|
||||
+ DW_UNSND (attr) = 1;
|
||||
+ break;
|
||||
case DW_FORM_sdata:
|
||||
DW_SND (attr) = read_signed_leb128 (abfd, info_ptr, &bytes_read);
|
||||
info_ptr += bytes_read;
|
||||
@@ -7680,7 +7693,7 @@ dwarf2_attr_no_follow (struct die_info *die, unsigned int name,
|
||||
|
||||
/* Return non-zero iff the attribute NAME is defined for the given DIE,
|
||||
and holds a non-zero value. This function should only be used for
|
||||
- DW_FORM_flag attributes. */
|
||||
+ DW_FORM_flag or DW_FORM_flag_present attributes. */
|
||||
|
||||
static int
|
||||
dwarf2_flag_true_p (struct die_info *die, unsigned name, struct dwarf2_cu *cu)
|
||||
@@ -7862,6 +7875,21 @@ dwarf_decode_line_header (unsigned int offset, bfd *abfd,
|
||||
line_ptr += offset_size;
|
||||
lh->minimum_instruction_length = read_1_byte (abfd, line_ptr);
|
||||
line_ptr += 1;
|
||||
+ if (lh->version >= 4)
|
||||
+ {
|
||||
+ lh->maximum_ops_per_instruction = read_1_byte (abfd, line_ptr);
|
||||
+ line_ptr += 1;
|
||||
+ }
|
||||
+ else
|
||||
+ lh->maximum_ops_per_instruction = 1;
|
||||
+
|
||||
+ if (lh->maximum_ops_per_instruction == 0)
|
||||
+ {
|
||||
+ lh->maximum_ops_per_instruction = 1;
|
||||
+ complaint (&symfile_complaints,
|
||||
+ _("invalid maximum_ops_per_instruction in `.debug_line' section"));
|
||||
+ }
|
||||
+
|
||||
lh->default_is_stmt = read_1_byte (abfd, line_ptr);
|
||||
line_ptr += 1;
|
||||
lh->line_base = read_1_signed_byte (abfd, line_ptr);
|
||||
@@ -8010,6 +8038,7 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
|
||||
int basic_block = 0;
|
||||
int end_sequence = 0;
|
||||
CORE_ADDR addr;
|
||||
+ unsigned char op_index = 0;
|
||||
|
||||
if (!decode_for_pst_p && lh->num_file_names >= file)
|
||||
{
|
||||
@@ -8041,12 +8070,17 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
|
||||
{
|
||||
/* Special operand. */
|
||||
adj_opcode = op_code - lh->opcode_base;
|
||||
- address += (adj_opcode / lh->line_range)
|
||||
- * lh->minimum_instruction_length;
|
||||
+ address += (((op_index + (adj_opcode / lh->line_range))
|
||||
+ / lh->maximum_ops_per_instruction)
|
||||
+ * lh->minimum_instruction_length);
|
||||
+ op_index = ((op_index + (adj_opcode / lh->line_range))
|
||||
+ % lh->maximum_ops_per_instruction);
|
||||
line += lh->line_base + (adj_opcode % lh->line_range);
|
||||
if (lh->num_file_names < file || file == 0)
|
||||
dwarf2_debug_line_missing_file_complaint ();
|
||||
- else
|
||||
+ /* For now we ignore lines not starting on an
|
||||
+ instruction boundary. */
|
||||
+ else if (op_index == 0)
|
||||
{
|
||||
lh->file_names[file - 1].included_p = 1;
|
||||
if (!decode_for_pst_p && is_stmt)
|
||||
@@ -8081,6 +8115,7 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
|
||||
break;
|
||||
case DW_LNE_set_address:
|
||||
address = read_address (abfd, line_ptr, cu, &bytes_read);
|
||||
+ op_index = 0;
|
||||
line_ptr += bytes_read;
|
||||
address += baseaddr;
|
||||
break;
|
||||
@@ -8146,9 +8181,17 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
|
||||
basic_block = 0;
|
||||
break;
|
||||
case DW_LNS_advance_pc:
|
||||
- address += lh->minimum_instruction_length
|
||||
- * read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
|
||||
- line_ptr += bytes_read;
|
||||
+ {
|
||||
+ CORE_ADDR adjust
|
||||
+ = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
|
||||
+
|
||||
+ address += (((op_index + adjust)
|
||||
+ / lh->maximum_ops_per_instruction)
|
||||
+ * lh->minimum_instruction_length);
|
||||
+ op_index = ((op_index + adjust)
|
||||
+ % lh->maximum_ops_per_instruction);
|
||||
+ line_ptr += bytes_read;
|
||||
+ }
|
||||
break;
|
||||
case DW_LNS_advance_line:
|
||||
line += read_signed_leb128 (abfd, line_ptr, &bytes_read);
|
||||
@@ -8195,11 +8238,19 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
|
||||
instruction length since special opcode 255 would have
|
||||
scaled the the increment. */
|
||||
case DW_LNS_const_add_pc:
|
||||
- address += (lh->minimum_instruction_length
|
||||
- * ((255 - lh->opcode_base) / lh->line_range));
|
||||
+ {
|
||||
+ CORE_ADDR adjust = (255 - lh->opcode_base) / lh->line_range;
|
||||
+
|
||||
+ address += (((op_index + adjust)
|
||||
+ / lh->maximum_ops_per_instruction)
|
||||
+ * lh->minimum_instruction_length);
|
||||
+ op_index = ((op_index + adjust)
|
||||
+ % lh->maximum_ops_per_instruction);
|
||||
+ }
|
||||
break;
|
||||
case DW_LNS_fixed_advance_pc:
|
||||
address += read_2_bytes (abfd, line_ptr);
|
||||
+ op_index = 0;
|
||||
line_ptr += 2;
|
||||
break;
|
||||
default:
|
||||
@@ -8761,6 +8812,7 @@ dwarf2_const_value (struct attribute *attr, struct symbol *sym,
|
||||
case DW_FORM_block2:
|
||||
case DW_FORM_block4:
|
||||
case DW_FORM_block:
|
||||
+ case DW_FORM_exprloc:
|
||||
blk = DW_BLOCK (attr);
|
||||
if (TYPE_LENGTH (SYMBOL_TYPE (sym)) != blk->size)
|
||||
dwarf2_const_value_length_mismatch_complaint (SYMBOL_PRINT_NAME (sym),
|
||||
@@ -10308,6 +10360,10 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
|
||||
case DW_FORM_block1:
|
||||
fprintf_unfiltered (f, "block: size %d", DW_BLOCK (&die->attrs[i])->size);
|
||||
break;
|
||||
+ case DW_FORM_exprloc:
|
||||
+ fprintf_unfiltered (f, "expression: size %u",
|
||||
+ DW_BLOCK (&die->attrs[i])->size);
|
||||
+ break;
|
||||
case DW_FORM_ref1:
|
||||
case DW_FORM_ref2:
|
||||
case DW_FORM_ref4:
|
||||
@@ -10323,6 +10379,10 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
|
||||
fprintf_unfiltered (f, "constant: %s",
|
||||
pulongest (DW_UNSND (&die->attrs[i])));
|
||||
break;
|
||||
+ case DW_FORM_sec_offset:
|
||||
+ fprintf_unfiltered (f, "section offset: %s",
|
||||
+ pulongest (DW_UNSND (&die->attrs[i])));
|
||||
+ break;
|
||||
case DW_FORM_sig8:
|
||||
if (DW_SIGNATURED_TYPE (&die->attrs[i]) != NULL)
|
||||
fprintf_unfiltered (f, "signatured type, offset: 0x%x",
|
||||
@@ -10343,6 +10403,9 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
|
||||
else
|
||||
fprintf_unfiltered (f, "flag: FALSE");
|
||||
break;
|
||||
+ case DW_FORM_flag_present:
|
||||
+ fprintf_unfiltered (f, "flag: TRUE");
|
||||
+ break;
|
||||
case DW_FORM_indirect:
|
||||
/* the reader will have reduced the indirect form to
|
||||
the "base form" so this form should not occur */
|
||||
@@ -11520,7 +11583,8 @@ attr_form_is_block (struct attribute *attr)
|
||||
attr->form == DW_FORM_block1
|
||||
|| attr->form == DW_FORM_block2
|
||||
|| attr->form == DW_FORM_block4
|
||||
- || attr->form == DW_FORM_block);
|
||||
+ || attr->form == DW_FORM_block
|
||||
+ || attr->form == DW_FORM_exprloc);
|
||||
}
|
||||
|
||||
/* Return non-zero if ATTR's value is a section offset --- classes
|
||||
@@ -11535,7 +11599,8 @@ static int
|
||||
attr_form_is_section_offset (struct attribute *attr)
|
||||
{
|
||||
return (attr->form == DW_FORM_data4
|
||||
- || attr->form == DW_FORM_data8);
|
||||
+ || attr->form == DW_FORM_data8
|
||||
+ || attr->form == DW_FORM_sec_offset);
|
||||
}
|
||||
|
||||
|
56
gdb-bz601887-dwarf4-2of2.patch
Normal file
56
gdb-bz601887-dwarf4-2of2.patch
Normal file
@ -0,0 +1,56 @@
|
||||
commit 669907bd6d54ae8e85b1278f0f16f8641ce6802d
|
||||
Author: Tom Tromey <tromey@redhat.com>
|
||||
Date: Tue Apr 20 21:19:07 2010 +0000
|
||||
|
||||
* dwarf2read.c (dwarf2_compute_name): Handle DW_AT_linkage_name.
|
||||
(read_partial_die): Likewise.
|
||||
(dwarf_attr_name): Likewise.
|
||||
|
||||
### a/gdb/ChangeLog
|
||||
### b/gdb/ChangeLog
|
||||
## -1,3 +1,9 @@
|
||||
+2010-04-20 Tom Tromey <tromey@redhat.com>
|
||||
+
|
||||
+ * dwarf2read.c (dwarf2_compute_name): Handle DW_AT_linkage_name.
|
||||
+ (read_partial_die): Likewise.
|
||||
+ (dwarf_attr_name): Likewise.
|
||||
+
|
||||
2010-04-20 Chris Moller <cmoller@redhat.com>
|
||||
|
||||
PR 10867
|
||||
--- gdb-7.1/gdb/dwarf2read.c.orig 2010-06-09 14:38:01.000000000 +0200
|
||||
+++ gdb-7.1/gdb/dwarf2read.c 2010-06-09 14:49:53.000000000 +0200
|
||||
@@ -7675,7 +7675,11 @@ read_partial_die (struct partial_die_inf
|
||||
break;
|
||||
}
|
||||
break;
|
||||
+ case DW_AT_linkage_name:
|
||||
case DW_AT_MIPS_linkage_name:
|
||||
+ /* Note that both forms of linkage name might appear. We
|
||||
+ assume they will be the same, and we only store the last
|
||||
+ one we see. */
|
||||
if (cu->language == language_ada)
|
||||
part_die->name = DW_STRING (&attr);
|
||||
break;
|
||||
@@ -10167,7 +10171,11 @@ dwarf2_name (struct die_info *die, struc
|
||||
struct attribute *attr = NULL;
|
||||
|
||||
if (cu->language == language_ada)
|
||||
- attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
|
||||
+ {
|
||||
+ attr = dwarf2_attr (die, DW_AT_linkage_name, cu);
|
||||
+ if (attr == NULL)
|
||||
+ attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
|
||||
+ }
|
||||
|
||||
if (!attr)
|
||||
attr = dwarf2_attr (die, DW_AT_name, cu);
|
||||
@@ -10555,6 +10563,8 @@ dwarf_attr_name (unsigned attr)
|
||||
/* DWARF 4 values. */
|
||||
case DW_AT_signature:
|
||||
return "DW_AT_signature";
|
||||
+ case DW_AT_linkage_name:
|
||||
+ return "DW_AT_linkage_name";
|
||||
/* SGI/MIPS extensions. */
|
||||
#ifdef MIPS /* collides with DW_AT_HP_block_index */
|
||||
case DW_AT_MIPS_fde:
|
240
gdb-bz601887-dwarf4-rh-test.patch
Normal file
240
gdb-bz601887-dwarf4-rh-test.patch
Normal file
@ -0,0 +1,240 @@
|
||||
--- /dev/null 2010-06-08 20:35:46.800278452 +0200
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.S 2010-06-09 15:22:57.000000000 +0200
|
||||
@@ -0,0 +1,167 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 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/>. */
|
||||
+
|
||||
+ .file "rh-dwarf4-x86_64.c"
|
||||
+ .section .debug_abbrev,"",@progbits
|
||||
+.Ldebug_abbrev0:
|
||||
+ .section .debug_info,"",@progbits
|
||||
+.Ldebug_info0:
|
||||
+ .section .debug_line,"",@progbits
|
||||
+.Ldebug_line0:
|
||||
+ .text
|
||||
+.Ltext0:
|
||||
+.globl main
|
||||
+ .type main, @function
|
||||
+main:
|
||||
+.LFB0:
|
||||
+ .file 1 "gdb.dwarf2/rh-dwarf4-x86_64.c"
|
||||
+ # gdb.dwarf2/rh-dwarf4-x86_64.c:20
|
||||
+ .loc 1 20 0
|
||||
+ .cfi_startproc
|
||||
+ # basic block 2
|
||||
+ pushq %rbp
|
||||
+ .cfi_def_cfa_offset 16
|
||||
+ movq %rsp, %rbp
|
||||
+ .cfi_offset 6, -16
|
||||
+ .cfi_def_cfa_register 6
|
||||
+ # gdb.dwarf2/rh-dwarf4-x86_64.c:21
|
||||
+ .loc 1 21 0
|
||||
+ movl $0, %eax
|
||||
+ # gdb.dwarf2/rh-dwarf4-x86_64.c:22
|
||||
+ .loc 1 22 0
|
||||
+ leave
|
||||
+ .cfi_def_cfa 7, 8
|
||||
+ ret
|
||||
+ .cfi_endproc
|
||||
+.LFE0:
|
||||
+ .size main, .-main
|
||||
+.Letext0:
|
||||
+ .section .debug_info
|
||||
+ .long 0x4e # Length of Compilation Unit Info
|
||||
+ .value 0x4 # DWARF version number
|
||||
+ .long .Ldebug_abbrev0 # Offset Into Abbrev. Section
|
||||
+ .byte 0x8 # Pointer Size (in bytes)
|
||||
+ .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit)
|
||||
+ .long .LASF0 # DW_AT_producer: "GNU C 4.4.4 20100503 (Red Hat 4.4.4-2)"
|
||||
+ .byte 0x1 # DW_AT_language
|
||||
+ .long .LASF1 # DW_AT_name: "gdb.dwarf2/rh-dwarf4-x86_64.c"
|
||||
+ .long .LASF2 # DW_AT_comp_dir
|
||||
+ .quad .Ltext0 # DW_AT_low_pc
|
||||
+ .quad .Letext0 # DW_AT_high_pc
|
||||
+ .long .Ldebug_line0 # DW_AT_stmt_list
|
||||
+ .uleb128 0x2 # (DIE (0x2d) DW_TAG_subprogram)
|
||||
+ # DW_AT_external
|
||||
+ .long .LASF3 # DW_AT_name: "main"
|
||||
+ .byte 0x1 # DW_AT_decl_file (gdb.dwarf2/rh-dwarf4-x86_64.c)
|
||||
+ .byte 0x13 # DW_AT_decl_line
|
||||
+ # DW_AT_prototyped
|
||||
+ .long 0x4a # DW_AT_type
|
||||
+ .quad .LFB0 # DW_AT_low_pc
|
||||
+ .quad .LFE0 # DW_AT_high_pc
|
||||
+ .uleb128 0x1 # DW_AT_frame_base
|
||||
+ .byte 0x9c # DW_OP_call_frame_cfa
|
||||
+ .uleb128 0x3 # (DIE (0x4a) DW_TAG_base_type)
|
||||
+ .byte 0x4 # DW_AT_byte_size
|
||||
+ .byte 0x5 # DW_AT_encoding
|
||||
+ .ascii "int\0" # DW_AT_name
|
||||
+ .byte 0x0 # end of children of DIE 0xb
|
||||
+ .section .debug_abbrev
|
||||
+ .uleb128 0x1 # (abbrev code)
|
||||
+ .uleb128 0x11 # (TAG: DW_TAG_compile_unit)
|
||||
+ .byte 0x1 # DW_children_yes
|
||||
+ .uleb128 0x25 # (DW_AT_producer)
|
||||
+ .uleb128 0xe # (DW_FORM_strp)
|
||||
+ .uleb128 0x13 # (DW_AT_language)
|
||||
+ .uleb128 0xb # (DW_FORM_data1)
|
||||
+ .uleb128 0x3 # (DW_AT_name)
|
||||
+ .uleb128 0xe # (DW_FORM_strp)
|
||||
+ .uleb128 0x1b # (DW_AT_comp_dir)
|
||||
+ .uleb128 0xe # (DW_FORM_strp)
|
||||
+ .uleb128 0x11 # (DW_AT_low_pc)
|
||||
+ .uleb128 0x1 # (DW_FORM_addr)
|
||||
+ .uleb128 0x12 # (DW_AT_high_pc)
|
||||
+ .uleb128 0x1 # (DW_FORM_addr)
|
||||
+ .uleb128 0x10 # (DW_AT_stmt_list)
|
||||
+ .uleb128 0x17 # (DW_FORM_sec_offset)
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x2 # (abbrev code)
|
||||
+ .uleb128 0x2e # (TAG: DW_TAG_subprogram)
|
||||
+ .byte 0x0 # DW_children_no
|
||||
+ .uleb128 0x3f # (DW_AT_external)
|
||||
+ .uleb128 0x19 # (DW_FORM_flag_present)
|
||||
+ .uleb128 0x3 # (DW_AT_name)
|
||||
+ .uleb128 0xe # (DW_FORM_strp)
|
||||
+ .uleb128 0x3a # (DW_AT_decl_file)
|
||||
+ .uleb128 0xb # (DW_FORM_data1)
|
||||
+ .uleb128 0x3b # (DW_AT_decl_line)
|
||||
+ .uleb128 0xb # (DW_FORM_data1)
|
||||
+ .uleb128 0x27 # (DW_AT_prototyped)
|
||||
+ .uleb128 0x19 # (DW_FORM_flag_present)
|
||||
+ .uleb128 0x49 # (DW_AT_type)
|
||||
+ .uleb128 0x13 # (DW_FORM_ref4)
|
||||
+ .uleb128 0x11 # (DW_AT_low_pc)
|
||||
+ .uleb128 0x1 # (DW_FORM_addr)
|
||||
+ .uleb128 0x12 # (DW_AT_high_pc)
|
||||
+ .uleb128 0x1 # (DW_FORM_addr)
|
||||
+ .uleb128 0x40 # (DW_AT_frame_base)
|
||||
+ .uleb128 0x18 # (DW_FORM_exprloc)
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x3 # (abbrev code)
|
||||
+ .uleb128 0x24 # (TAG: DW_TAG_base_type)
|
||||
+ .byte 0x0 # 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 0x0
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .section .debug_pubnames,"",@progbits
|
||||
+ .long 0x17 # Length of Public Names Info
|
||||
+ .value 0x2 # DWARF Version
|
||||
+ .long .Ldebug_info0 # Offset of Compilation Unit Info
|
||||
+ .long 0x52 # Compilation Unit Length
|
||||
+ .long 0x2d # DIE offset
|
||||
+ .ascii "main\0" # external name
|
||||
+ .long 0x0
|
||||
+ .section .debug_aranges,"",@progbits
|
||||
+ .long 0x2c # Length of Address Ranges Info
|
||||
+ .value 0x2 # DWARF Version
|
||||
+ .long .Ldebug_info0 # Offset of Compilation Unit Info
|
||||
+ .byte 0x8 # Size of Address
|
||||
+ .byte 0x0 # Size of Segment Descriptor
|
||||
+ .value 0x0 # Pad to 16 byte boundary
|
||||
+ .value 0x0
|
||||
+ .quad .Ltext0 # Address
|
||||
+ .quad .Letext0-.Ltext0 # Length
|
||||
+ .quad 0x0
|
||||
+ .quad 0x0
|
||||
+ .section .debug_str,"MS",@progbits,1
|
||||
+.LASF2:
|
||||
+ .string "."
|
||||
+.LASF0:
|
||||
+ .string "GNU C 4.4.4 20100503 (Red Hat 4.4.4-2)"
|
||||
+.LASF1:
|
||||
+ .string "gdb.dwarf2/rh-dwarf4-x86_64.c"
|
||||
+.LASF3:
|
||||
+ .string "main"
|
||||
+ .ident "GCC: (GNU) 4.4.4 20100503 (Red Hat 4.4.4-2)"
|
||||
+ .section .note.GNU-stack,"",@progbits
|
||||
--- /dev/null 2010-06-08 20:35:46.800278452 +0200
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.c 2010-06-09 15:21:35.000000000 +0200
|
||||
@@ -0,0 +1,22 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 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/>. */
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
--- /dev/null 2010-06-08 20:35:46.800278452 +0200
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.exp 2010-06-09 15:26:21.000000000 +0200
|
||||
@@ -0,0 +1,42 @@
|
||||
+# Copyright 2010 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 can only be run on targets which support DWARF-2 and use gas.
|
||||
+# For now pick a sampling of likely targets.
|
||||
+if {![istarget *-*-linux*]
|
||||
+ && ![istarget *-*-gnu*]
|
||||
+ && ![istarget *-*-elf*]
|
||||
+ && ![istarget *-*-openbsd*]
|
||||
+ && ![istarget arm-*-eabi*]
|
||||
+ && ![istarget powerpc-*-eabi*]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+if {![istarget x86_64-*]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set testfile "rh-dwarf4-x86_64"
|
||||
+set srcfile ${testfile}.S
|
||||
+set executable ${testfile}.x
|
||||
+set binfile ${objdir}/${subdir}/${executable}
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart $executable
|
||||
+
|
||||
+gdb_test "ptype main" {type = int \(void\)}
|
274
gdb-bz602314-ptype-class-typedef-1of3.patch
Normal file
274
gdb-bz602314-ptype-class-typedef-1of3.patch
Normal file
@ -0,0 +1,274 @@
|
||||
commit f49f91e9c3eaba847f75f5c46e77e261a76d9a9b
|
||||
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Mon Jun 28 20:35:51 2010 +0000
|
||||
|
||||
gdb/
|
||||
* cp-namespace.c (cp_lookup_nested_type): New variable
|
||||
concatenated_name. Turn the current return condition into a reverse
|
||||
one. Call also lookup_static_symbol_aux on the constructed qualified
|
||||
name.
|
||||
* symtab.c (lookup_symbol_aux): Move variable objfile and searching in
|
||||
other files into a called ...
|
||||
(lookup_static_symbol_aux): ... new function here.
|
||||
* symtab.h (lookup_static_symbol_aux): New prototype.
|
||||
* valops.c (value_maybe_namespace_elt): Call also
|
||||
lookup_static_symbol_aux if we failed otherwise.
|
||||
|
||||
gdb/testsuite/
|
||||
* gdb.cp/namespace.exp (whatis C::cOtherFileType)
|
||||
(whatis ::C::cOtherFileType, whatis C::cOtherFileVar)
|
||||
(whatis ::C::cOtherFileVar, print C::cOtherFileVar)
|
||||
(print ::C::cOtherFileVar)
|
||||
(whatis C::OtherFileClass::cOtherFileClassType)
|
||||
(whatis ::C::OtherFileClass::cOtherFileClassType)
|
||||
(print C::OtherFileClass::cOtherFileClassVar)
|
||||
(print ::cOtherFileClassVar)
|
||||
(print ::C::OtherFileClass::cOtherFileClassVar): New tests.
|
||||
(ptype OtherFileClass, ptype ::C::OtherFileClass): Permit arbitrary
|
||||
trailing content.
|
||||
* gdb.cp/namespace1.cc (C::OtherFileClass::cOtherFileClassType)
|
||||
(C::OtherFileClass::cOtherFileClassVar)
|
||||
(C::OtherFileClass::cOtherFileClassVar_use, C::cOtherFileType)
|
||||
(C::cOtherFileVar, C::cOtherFileVar_use): New.
|
||||
|
||||
### a/gdb/ChangeLog
|
||||
### b/gdb/ChangeLog
|
||||
## -1,5 +1,18 @@
|
||||
2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
+ * cp-namespace.c (cp_lookup_nested_type): New variable
|
||||
+ concatenated_name. Turn the current return condition into a reverse
|
||||
+ one. Call also lookup_static_symbol_aux on the constructed qualified
|
||||
+ name.
|
||||
+ * symtab.c (lookup_symbol_aux): Move variable objfile and searching in
|
||||
+ other files into a called ...
|
||||
+ (lookup_static_symbol_aux): ... new function here.
|
||||
+ * symtab.h (lookup_static_symbol_aux): New prototype.
|
||||
+ * valops.c (value_maybe_namespace_elt): Call also
|
||||
+ lookup_static_symbol_aux if we failed otherwise.
|
||||
+
|
||||
+2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
Fix PR c++/11703 and PR gdb/1448.
|
||||
* c-exp.y (yylex) <last_was_coloncolon && first_was_coloncolon>: Add
|
||||
FIRST_ITER check.
|
||||
Index: gdb-7.1/gdb/cp-namespace.c
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/cp-namespace.c 2010-06-29 17:54:17.000000000 +0200
|
||||
+++ gdb-7.1/gdb/cp-namespace.c 2010-06-29 17:59:32.000000000 +0200
|
||||
@@ -585,10 +585,24 @@ cp_lookup_nested_type (struct type *pare
|
||||
nested_name,
|
||||
block,
|
||||
VAR_DOMAIN);
|
||||
- if (sym == NULL || SYMBOL_CLASS (sym) != LOC_TYPEDEF)
|
||||
- return NULL;
|
||||
- else
|
||||
+ char *concatenated_name;
|
||||
+
|
||||
+ if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
|
||||
+ return SYMBOL_TYPE (sym);
|
||||
+
|
||||
+ /* Now search all static file-level symbols. Not strictly correct,
|
||||
+ but more useful than an error. We do not try to guess any imported
|
||||
+ namespace as even the fully specified namespace seach is is already
|
||||
+ not C++ compliant and more assumptions could make it too magic. */
|
||||
+
|
||||
+ concatenated_name = alloca (strlen (parent_name) + 2
|
||||
+ + strlen (nested_name) + 1);
|
||||
+ sprintf (concatenated_name, "%s::%s", parent_name, nested_name);
|
||||
+ sym = lookup_static_symbol_aux (concatenated_name, VAR_DOMAIN);
|
||||
+ if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
|
||||
return SYMBOL_TYPE (sym);
|
||||
+
|
||||
+ return NULL;
|
||||
}
|
||||
default:
|
||||
internal_error (__FILE__, __LINE__,
|
||||
Index: gdb-7.1/gdb/symtab.h
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/symtab.h 2010-06-29 17:54:16.000000000 +0200
|
||||
+++ gdb-7.1/gdb/symtab.h 2010-06-29 18:00:37.000000000 +0200
|
||||
@@ -1036,6 +1036,12 @@ extern struct partial_symbol *lookup_par
|
||||
const char *, int,
|
||||
domain_enum);
|
||||
|
||||
+/* Lookup a symbol only in the file static scope of all the objfiles. */
|
||||
+
|
||||
+struct symbol *lookup_static_symbol_aux (const char *name,
|
||||
+ const domain_enum domain);
|
||||
+
|
||||
+
|
||||
/* lookup a symbol by name, within a specified block */
|
||||
|
||||
extern struct symbol *lookup_block_symbol (const struct block *, const char *,
|
||||
Index: gdb-7.1/gdb/testsuite/gdb.cp/namespace.exp
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/namespace.exp 2010-06-29 17:54:11.000000000 +0200
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.cp/namespace.exp 2010-06-29 18:17:17.000000000 +0200
|
||||
@@ -217,6 +217,70 @@ gdb_expect {
|
||||
gdb_test "break BBB::Class::xyzq" \
|
||||
"Breakpoint.*at $hex: file.*namespace.cc, line 68\\."
|
||||
|
||||
+# Tests accessing static elements in namespace of other file.
|
||||
+
|
||||
+gdb_test "whatis C::cOtherFileType" "type = short"
|
||||
+gdb_test "whatis ::C::cOtherFileType" "type = short"
|
||||
+gdb_test "whatis C::cOtherFileVar" "type = const C::cOtherFileType"
|
||||
+gdb_test "whatis ::C::cOtherFileVar" "type = const C::cOtherFileType"
|
||||
+gdb_test "print C::cOtherFileVar" "\\$\[0-9\].* = 319"
|
||||
+gdb_test "print ::C::cOtherFileVar" "\\$\[0-9\].* = 319"
|
||||
+
|
||||
+if {[test_compiler_info {gcc-[0-3]-*}]
|
||||
+ || [test_compiler_info {gcc-4-[0-4]-*}]} {
|
||||
+ # The type in class is missing in older GCCs.
|
||||
+ setup_xfail *-*-*
|
||||
+}
|
||||
+gdb_test "whatis C::OtherFileClass::cOtherFileClassType" "type = short"
|
||||
+if {[test_compiler_info {gcc-[0-3]-*}]
|
||||
+ || [test_compiler_info {gcc-4-[0-4]-*}]} {
|
||||
+ # The type in class is missing in older GCCs.
|
||||
+ setup_xfail *-*-*
|
||||
+}
|
||||
+gdb_test "whatis ::C::OtherFileClass::cOtherFileClassType" "type = short"
|
||||
+
|
||||
+set test "print C::OtherFileClass::cOtherFileClassVar"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "\\$\[0-9\].* = 318\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "static field cOtherFileClassVar has been optimized out\r\n$gdb_prompt $" {
|
||||
+ setup_kfail "c++/11702" "*-*-*"
|
||||
+ fail $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# FSF GCC <=4.4 creates unqualified DIE "cOtherFileClassVar" ignoring the
|
||||
+# namespace the same way older GDB did.
|
||||
+set test "print ::cOtherFileClassVar"
|
||||
+set test2 "print ::C::OtherFileClass::cOtherFileClassVar"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "No symbol \"cOtherFileClassVar\" in current context\\.\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+
|
||||
+ gdb_test_multiple $test2 $test2 {
|
||||
+ -re "\\$\[0-9\].* = 318\r\n$gdb_prompt $" {
|
||||
+ pass $test2
|
||||
+ }
|
||||
+ -re "static field cOtherFileClassVar has been optimized out\r\n$gdb_prompt $" {
|
||||
+ setup_kfail "c++/11702" "*-*-*"
|
||||
+ fail $test2
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+ -re "\\$\[0-9\].* = 318\r\n$gdb_prompt $" {
|
||||
+ if {[test_compiler_info {gcc-[0-3]-*}]
|
||||
+ || [test_compiler_info {gcc-4-[0-4]-*}]} {
|
||||
+ # Do not permit to XFAIL on recent GCCs.
|
||||
+ setup_xfail *-*-*
|
||||
+ }
|
||||
+ fail $test
|
||||
+
|
||||
+ unresolved $test2
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
# Test to see if the appropriate namespaces are in scope when trying
|
||||
# to print out stuff from within a function defined within a
|
||||
# namespace.
|
||||
@@ -260,7 +324,7 @@ gdb_test "ptype C::NestedClass" "No symb
|
||||
# Tests involving multiple files
|
||||
|
||||
gdb_test "print cOtherFile" "\\$\[0-9\].* = 316"
|
||||
-gdb_test "ptype OtherFileClass" "type = (class C::OtherFileClass \{\r\n public:|struct C::OtherFileClass \{)\r\n int z;\r\n\}"
|
||||
+gdb_test "ptype OtherFileClass" "type = (class C::OtherFileClass \{\r\n public:|struct C::OtherFileClass \{)\r\n int z;\r\n.*\}"
|
||||
cp_test_ptype_class \
|
||||
"ptype ::C::OtherFileClass" "" "class" "C::OtherFileClass" \
|
||||
{
|
||||
Index: gdb-7.1/gdb/testsuite/gdb.cp/namespace1.cc
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/namespace1.cc 2010-01-01 08:32:01.000000000 +0100
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.cp/namespace1.cc 2010-06-29 17:56:42.000000000 +0200
|
||||
@@ -21,7 +21,15 @@ namespace C
|
||||
class OtherFileClass {
|
||||
public:
|
||||
int z;
|
||||
+
|
||||
+ typedef short cOtherFileClassType;
|
||||
+ static const cOtherFileClassType cOtherFileClassVar = 318;
|
||||
+ cOtherFileClassType cOtherFileClassVar_use ();
|
||||
};
|
||||
+ OtherFileClass::cOtherFileClassType OtherFileClass::cOtherFileClassVar_use ()
|
||||
+ {
|
||||
+ return cOtherFileClassVar;
|
||||
+ }
|
||||
|
||||
namespace {
|
||||
int cXOtherFile = 29;
|
||||
@@ -35,6 +43,13 @@ namespace C
|
||||
static OtherFileClass *c = new OtherFileClass();
|
||||
c->z = cOtherFile + cXOtherFile;
|
||||
}
|
||||
+
|
||||
+ typedef short cOtherFileType;
|
||||
+ static const cOtherFileType cOtherFileVar = 319;
|
||||
+ cOtherFileType cOtherFileVar_use ()
|
||||
+ {
|
||||
+ return cOtherFileVar;
|
||||
+ }
|
||||
}
|
||||
|
||||
namespace {
|
||||
Index: gdb-7.1/gdb/valops.c
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/valops.c 2010-06-29 17:54:16.000000000 +0200
|
||||
+++ gdb-7.1/gdb/valops.c 2010-06-29 18:15:00.000000000 +0200
|
||||
@@ -3253,9 +3253,17 @@ value_maybe_namespace_elt (const struct
|
||||
struct symbol *sym;
|
||||
struct value *result;
|
||||
|
||||
- sym = cp_lookup_symbol_namespace(namespace_name, name,
|
||||
- get_selected_block (0),
|
||||
- VAR_DOMAIN);
|
||||
+ sym = cp_lookup_symbol_namespace (namespace_name, name,
|
||||
+ get_selected_block (0), VAR_DOMAIN);
|
||||
+
|
||||
+ if (sym == NULL)
|
||||
+ {
|
||||
+ char *concatenated_name = alloca (strlen (namespace_name) + 2
|
||||
+ + strlen (name) + 1);
|
||||
+
|
||||
+ sprintf (concatenated_name, "%s::%s", namespace_name, name);
|
||||
+ sym = lookup_static_symbol_aux (concatenated_name, VAR_DOMAIN);
|
||||
+ }
|
||||
|
||||
if (sym == NULL)
|
||||
return NULL;
|
||||
--- a/gdb/symtab.c
|
||||
+++ b/gdb/symtab.c
|
||||
@@ -1122,10 +1121,21 @@ lookup_symbol_aux (const char *name, const struct block *block,
|
||||
return sym;
|
||||
|
||||
/* Now search all static file-level symbols. Not strictly correct,
|
||||
- but more useful than an error. Do the symtabs first, then check
|
||||
- the psymtabs. If a psymtab indicates the existence of the
|
||||
- desired name as a file-level static, then do psymtab-to-symtab
|
||||
- conversion on the fly and return the found symbol. */
|
||||
+ but more useful than an error. */
|
||||
+
|
||||
+ return lookup_static_symbol_aux (name, domain);
|
||||
+}
|
||||
+
|
||||
+/* Search all static file-level symbols for NAME from DOMAIN. Do the symtabs
|
||||
+ first, then check the psymtabs. If a psymtab indicates the existence of the
|
||||
+ desired name as a file-level static, then do psymtab-to-symtab conversion on
|
||||
+ the fly and return the found symbol. */
|
||||
+
|
||||
+struct symbol *
|
||||
+lookup_static_symbol_aux (const char *name, const domain_enum domain)
|
||||
+{
|
||||
+ struct objfile *objfile;
|
||||
+ struct symbol *sym;
|
||||
|
||||
sym = lookup_symbol_aux_symtabs (STATIC_BLOCK, name, domain);
|
||||
if (sym != NULL)
|
308
gdb-bz602314-ptype-class-typedef-2of3.patch
Normal file
308
gdb-bz602314-ptype-class-typedef-2of3.patch
Normal file
@ -0,0 +1,308 @@
|
||||
commit 758a1f7149cb7469c7e6bb30cb572715ee90a6e8
|
||||
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Mon Jun 28 20:39:27 2010 +0000
|
||||
|
||||
gdb/
|
||||
* c-typeprint.c (c_type_print_base): For no fields check include also
|
||||
TYPE_TYPEDEF_FIELD_COUNT. Print new typedefs section.
|
||||
* dwarf2read.c (struct typedef_field_list)
|
||||
(struct field_info) <typedef_field_list, typedef_field_list_count>: New.
|
||||
(dwarf2_add_typedef): New.
|
||||
(read_structure_type): Call dwarf2_add_typedef for DW_TAG_typedef.
|
||||
Copy also FI.TYPEDEF_FIELD_LIST.
|
||||
* gdbtypes.h (struct typedef_field)
|
||||
(struct cplus_struct_type) <typedef_field, typedef_field_count>
|
||||
(TYPE_TYPEDEF_FIELD_ARRAY, TYPE_TYPEDEF_FIELD, TYPE_TYPEDEF_FIELD_NAME)
|
||||
(TYPE_TYPEDEF_FIELD_TYPE, TYPE_TYPEDEF_FIELD_COUNT): New.
|
||||
|
||||
gdb/testsuite/
|
||||
* gdb.cp/namespace.exp (ptype OtherFileClass typedefs)
|
||||
(ptype ::C::OtherFileClass typedefs): New.
|
||||
* gdb.cp/namespace1.cc (C::OtherFileClass::cOtherFileClassType2)
|
||||
(C::OtherFileClass::cOtherFileClassVar2): New.
|
||||
(C::OtherFileClass::cOtherFileClassVar_use): Use also
|
||||
cOtherFileClassVar2.
|
||||
(C::cOtherFileType2, C::cOtherFileVar2): New.
|
||||
(C::cOtherFileVar_use): use also cOtherFileVar2.
|
||||
* gdb.cp/userdef.exp (ptype &*c): Permit arbitrary trailing text.
|
||||
|
||||
### a/gdb/ChangeLog
|
||||
### b/gdb/ChangeLog
|
||||
## -1,5 +1,19 @@
|
||||
2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
+ * c-typeprint.c (c_type_print_base): For no fields check include also
|
||||
+ TYPE_TYPEDEF_FIELD_COUNT. Print new typedefs section.
|
||||
+ * dwarf2read.c (struct typedef_field_list)
|
||||
+ (struct field_info) <typedef_field_list, typedef_field_list_count>: New.
|
||||
+ (dwarf2_add_typedef): New.
|
||||
+ (read_structure_type): Call dwarf2_add_typedef for DW_TAG_typedef.
|
||||
+ Copy also FI.TYPEDEF_FIELD_LIST.
|
||||
+ * gdbtypes.h (struct typedef_field)
|
||||
+ (struct cplus_struct_type) <typedef_field, typedef_field_count>
|
||||
+ (TYPE_TYPEDEF_FIELD_ARRAY, TYPE_TYPEDEF_FIELD, TYPE_TYPEDEF_FIELD_NAME)
|
||||
+ (TYPE_TYPEDEF_FIELD_TYPE, TYPE_TYPEDEF_FIELD_COUNT): New.
|
||||
+
|
||||
+2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
* cp-namespace.c (cp_lookup_nested_type): New variable
|
||||
concatenated_name. Turn the current return condition into a reverse
|
||||
one. Call also lookup_static_symbol_aux on the constructed qualified
|
||||
Index: gdb-7.1/gdb/c-typeprint.c
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/c-typeprint.c 2010-06-29 17:54:09.000000000 +0200
|
||||
+++ gdb-7.1/gdb/c-typeprint.c 2010-06-29 18:17:48.000000000 +0200
|
||||
@@ -774,7 +774,8 @@ c_type_print_base (struct type *type, st
|
||||
cp_type_print_derivation_info (stream, type);
|
||||
|
||||
fprintf_filtered (stream, "{\n");
|
||||
- if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
|
||||
+ if (TYPE_NFIELDS (type) == 0 && TYPE_NFN_FIELDS (type) == 0
|
||||
+ && TYPE_TYPEDEF_FIELD_COUNT (type) == 0)
|
||||
{
|
||||
if (TYPE_STUB (type))
|
||||
fprintfi_filtered (level + 4, stream, _("<incomplete type>\n"));
|
||||
@@ -1060,6 +1061,29 @@ c_type_print_base (struct type *type, st
|
||||
}
|
||||
}
|
||||
|
||||
+ /* Print typedefs defined in this class. */
|
||||
+
|
||||
+ if (TYPE_TYPEDEF_FIELD_COUNT (type) != 0)
|
||||
+ {
|
||||
+ if (TYPE_NFIELDS (type) != 0 || TYPE_NFN_FIELDS (type) != 0)
|
||||
+ fprintf_filtered (stream, "\n");
|
||||
+
|
||||
+ for (i = 0; i < TYPE_TYPEDEF_FIELD_COUNT (type); i++)
|
||||
+ {
|
||||
+ struct type *target = TYPE_TYPEDEF_FIELD_TYPE (type, i);
|
||||
+
|
||||
+ /* Dereference the typedef declaration itself. */
|
||||
+ gdb_assert (TYPE_CODE (target) == TYPE_CODE_TYPEDEF);
|
||||
+ target = TYPE_TARGET_TYPE (target);
|
||||
+
|
||||
+ print_spaces_filtered (level + 4, stream);
|
||||
+ fprintf_filtered (stream, "typedef ");
|
||||
+ c_print_type (target, (char *) TYPE_TYPEDEF_FIELD_NAME (type, i),
|
||||
+ stream, show - 1, level + 4);
|
||||
+ fprintf_filtered (stream, ";\n");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
fprintfi_filtered (level, stream, "}");
|
||||
|
||||
if (TYPE_LOCALTYPE_PTR (type) && show >= 0)
|
||||
Index: gdb-7.1/gdb/dwarf2read.c
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/dwarf2read.c 2010-06-29 17:54:28.000000000 +0200
|
||||
+++ gdb-7.1/gdb/dwarf2read.c 2010-06-29 18:17:48.000000000 +0200
|
||||
@@ -722,6 +722,16 @@ struct field_info
|
||||
|
||||
/* Number of entries in the fnfieldlists array. */
|
||||
int nfnfields;
|
||||
+
|
||||
+ /* typedefs defined inside this class. TYPEDEF_FIELD_LIST contains head of
|
||||
+ a NULL terminated list of TYPEDEF_FIELD_LIST_COUNT elements. */
|
||||
+ struct typedef_field_list
|
||||
+ {
|
||||
+ struct typedef_field field;
|
||||
+ struct typedef_field_list *next;
|
||||
+ }
|
||||
+ *typedef_field_list;
|
||||
+ unsigned typedef_field_list_count;
|
||||
};
|
||||
|
||||
/* One item on the queue of compilation units to read in full symbols
|
||||
@@ -5075,6 +5085,39 @@ dwarf2_add_field (struct field_info *fip
|
||||
}
|
||||
}
|
||||
|
||||
+/* Add a typedef defined in the scope of the FIP's class. */
|
||||
+
|
||||
+static void
|
||||
+dwarf2_add_typedef (struct field_info *fip, struct die_info *die,
|
||||
+ struct dwarf2_cu *cu)
|
||||
+{
|
||||
+ struct objfile *objfile = cu->objfile;
|
||||
+ struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
||||
+ struct typedef_field_list *new_field;
|
||||
+ struct attribute *attr;
|
||||
+ struct typedef_field *fp;
|
||||
+ char *fieldname = "";
|
||||
+
|
||||
+ /* Allocate a new field list entry and link it in. */
|
||||
+ new_field = xzalloc (sizeof (*new_field));
|
||||
+ make_cleanup (xfree, new_field);
|
||||
+
|
||||
+ gdb_assert (die->tag == DW_TAG_typedef);
|
||||
+
|
||||
+ fp = &new_field->field;
|
||||
+
|
||||
+ /* Get name of field. */
|
||||
+ fp->name = dwarf2_name (die, cu);
|
||||
+ if (fp->name == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ fp->type = read_type_die (die, cu);
|
||||
+
|
||||
+ new_field->next = fip->typedef_field_list;
|
||||
+ fip->typedef_field_list = new_field;
|
||||
+ fip->typedef_field_list_count++;
|
||||
+}
|
||||
+
|
||||
/* Create the vector of fields, and attach it to the type. */
|
||||
|
||||
static void
|
||||
@@ -5600,6 +5643,8 @@ read_structure_type (struct die_info *di
|
||||
/* C++ base class field. */
|
||||
dwarf2_add_field (&fi, child_die, cu);
|
||||
}
|
||||
+ else if (child_die->tag == DW_TAG_typedef)
|
||||
+ dwarf2_add_typedef (&fi, child_die, cu);
|
||||
child_die = sibling_die (child_die);
|
||||
}
|
||||
|
||||
@@ -5673,6 +5718,28 @@ read_structure_type (struct die_info *di
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ /* Copy fi.typedef_field_list linked list elements content into the
|
||||
+ allocated array TYPE_TYPEDEF_FIELD_ARRAY (type). */
|
||||
+ if (fi.typedef_field_list)
|
||||
+ {
|
||||
+ int i = fi.typedef_field_list_count;
|
||||
+
|
||||
+ TYPE_TYPEDEF_FIELD_ARRAY (type)
|
||||
+ = TYPE_ALLOC (type, sizeof (TYPE_TYPEDEF_FIELD (type, 0)) * i);
|
||||
+ TYPE_TYPEDEF_FIELD_COUNT (type) = i;
|
||||
+
|
||||
+ /* Reverse the list order to keep the debug info elements order. */
|
||||
+ while (--i >= 0)
|
||||
+ {
|
||||
+ struct typedef_field *dest, *src;
|
||||
+
|
||||
+ dest = &TYPE_TYPEDEF_FIELD (type, i);
|
||||
+ src = &fi.typedef_field_list->field;
|
||||
+ fi.typedef_field_list = fi.typedef_field_list->next;
|
||||
+ *dest = *src;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
quirk_gcc_member_function_pointer (type, cu->objfile);
|
||||
Index: gdb-7.1/gdb/gdbtypes.h
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/gdbtypes.h 2010-06-29 17:54:17.000000000 +0200
|
||||
+++ gdb-7.1/gdb/gdbtypes.h 2010-06-29 18:18:29.000000000 +0200
|
||||
@@ -948,6 +948,19 @@ struct cplus_struct_type
|
||||
member functions or virtual base classes. Minus one if not
|
||||
dynamic. Zero if not yet computed. */
|
||||
int is_dynamic : 2;
|
||||
+
|
||||
+ /* typedefs defined inside this class. TYPEDEF_FIELD points to an array of
|
||||
+ TYPEDEF_FIELD_COUNT elements. */
|
||||
+ struct typedef_field
|
||||
+ {
|
||||
+ /* Unqualified name to be prefixed by owning class qualified name. */
|
||||
+ const char *name;
|
||||
+
|
||||
+ /* Type this typedef named NAME represents. */
|
||||
+ struct type *type;
|
||||
+ }
|
||||
+ *typedef_field;
|
||||
+ unsigned typedef_field_count;
|
||||
};
|
||||
|
||||
/* Struct used for ranking a function for overload resolution */
|
||||
@@ -1182,6 +1195,17 @@ extern void allocate_gnat_aux_type (stru
|
||||
#define TYPE_LOCALTYPE_FILE(thistype) (TYPE_CPLUS_SPECIFIC(thistype)->localtype_ptr->file)
|
||||
#define TYPE_LOCALTYPE_LINE(thistype) (TYPE_CPLUS_SPECIFIC(thistype)->localtype_ptr->line)
|
||||
|
||||
+#define TYPE_TYPEDEF_FIELD_ARRAY(thistype) \
|
||||
+ TYPE_CPLUS_SPECIFIC (thistype)->typedef_field
|
||||
+#define TYPE_TYPEDEF_FIELD(thistype, n) \
|
||||
+ TYPE_CPLUS_SPECIFIC (thistype)->typedef_field[n]
|
||||
+#define TYPE_TYPEDEF_FIELD_NAME(thistype, n) \
|
||||
+ TYPE_TYPEDEF_FIELD (thistype, n).name
|
||||
+#define TYPE_TYPEDEF_FIELD_TYPE(thistype, n) \
|
||||
+ TYPE_TYPEDEF_FIELD (thistype, n).type
|
||||
+#define TYPE_TYPEDEF_FIELD_COUNT(thistype) \
|
||||
+ TYPE_CPLUS_SPECIFIC (thistype)->typedef_field_count
|
||||
+
|
||||
#define TYPE_IS_OPAQUE(thistype) (((TYPE_CODE (thistype) == TYPE_CODE_STRUCT) || \
|
||||
(TYPE_CODE (thistype) == TYPE_CODE_UNION)) && \
|
||||
(TYPE_NFIELDS (thistype) == 0) && \
|
||||
Index: gdb-7.1/gdb/testsuite/gdb.cp/namespace.exp
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/namespace.exp 2010-06-29 18:17:17.000000000 +0200
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.cp/namespace.exp 2010-06-29 18:18:58.000000000 +0200
|
||||
@@ -332,6 +332,21 @@ cp_test_ptype_class \
|
||||
}
|
||||
gdb_test "ptype C::OtherFileClass" "No symbol \"OtherFileClass\" in namespace \"C::C\"."
|
||||
|
||||
+# Test class typedefs printing.
|
||||
+set expect "type = class C::OtherFileClass \{\r\n.*\r\n *typedef short cOtherFileClassType;\r\n *typedef long cOtherFileClassType2;\r\n\}"
|
||||
+if {[test_compiler_info {gcc-[0-3]-*}]
|
||||
+ || [test_compiler_info {gcc-4-[0-4]-*}]} {
|
||||
+ # The type in class is missing in older GCCs.
|
||||
+ setup_xfail *-*-*
|
||||
+}
|
||||
+gdb_test "ptype OtherFileClass" $expect "ptype OtherFileClass typedefs"
|
||||
+if {[test_compiler_info {gcc-[0-3]-*}]
|
||||
+ || [test_compiler_info {gcc-4-[0-4]-*}]} {
|
||||
+ # The type in class is missing in older GCCs.
|
||||
+ setup_xfail *-*-*
|
||||
+}
|
||||
+gdb_test "ptype ::C::OtherFileClass" $expect "ptype ::C::OtherFileClass typedefs"
|
||||
+
|
||||
# Some anonymous namespace tests.
|
||||
|
||||
gdb_test "print cX" "\\$\[0-9\].* = 6"
|
||||
Index: gdb-7.1/gdb/testsuite/gdb.cp/namespace1.cc
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/namespace1.cc 2010-06-29 17:56:42.000000000 +0200
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.cp/namespace1.cc 2010-06-29 18:17:48.000000000 +0200
|
||||
@@ -23,12 +23,14 @@ namespace C
|
||||
int z;
|
||||
|
||||
typedef short cOtherFileClassType;
|
||||
+ typedef long cOtherFileClassType2;
|
||||
static const cOtherFileClassType cOtherFileClassVar = 318;
|
||||
+ static const cOtherFileClassType2 cOtherFileClassVar2 = 320;
|
||||
cOtherFileClassType cOtherFileClassVar_use ();
|
||||
};
|
||||
OtherFileClass::cOtherFileClassType OtherFileClass::cOtherFileClassVar_use ()
|
||||
{
|
||||
- return cOtherFileClassVar;
|
||||
+ return cOtherFileClassVar + cOtherFileClassVar2;
|
||||
}
|
||||
|
||||
namespace {
|
||||
@@ -45,10 +47,12 @@ namespace C
|
||||
}
|
||||
|
||||
typedef short cOtherFileType;
|
||||
+ typedef long cOtherFileType2;
|
||||
static const cOtherFileType cOtherFileVar = 319;
|
||||
+ static const cOtherFileType2 cOtherFileVar2 = 321;
|
||||
cOtherFileType cOtherFileVar_use ()
|
||||
{
|
||||
- return cOtherFileVar;
|
||||
+ return cOtherFileVar + cOtherFileVar2;
|
||||
}
|
||||
}
|
||||
|
||||
Index: gdb-7.1/gdb/testsuite/gdb.cp/userdef.exp
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/userdef.exp 2010-06-29 17:54:11.000000000 +0200
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.cp/userdef.exp 2010-06-29 18:17:48.000000000 +0200
|
||||
@@ -154,7 +154,7 @@ gdb_test "break A2::'operator +'" ".*Bre
|
||||
gdb_test "print c" "\\\$\[0-9\]* = {m = {z = .*}}"
|
||||
gdb_test "print *c" "\\\$\[0-9\]* = \\(Member &\\) @$hex: {z = .*}"
|
||||
gdb_test "print &*c" "\\\$\[0-9\]* = \\(Member \\*\\) $hex"
|
||||
-gdb_test "ptype &*c" "type = (struct|class) Member {(\[\r\n \]+public:)?\[\r\n \]+int z;\[\r\n\]+} &\\*"
|
||||
+gdb_test "ptype &*c" "type = (struct|class) Member {(\[\r\n \]+public:)?\[\r\n \]+int z;\[\r\n\].*} &\\*"
|
||||
|
||||
gdb_test "print operator== (mem1, mem2)" " = false"
|
||||
gdb_test "print operator== (mem1, mem1)" " = true"
|
38
gdb-bz602314-ptype-class-typedef-3of3.patch
Normal file
38
gdb-bz602314-ptype-class-typedef-3of3.patch
Normal file
@ -0,0 +1,38 @@
|
||||
commit 477c1359b217cdc052a7c9f83cae9c894396894c
|
||||
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Mon Jun 28 22:03:31 2010 +0000
|
||||
|
||||
gdb/
|
||||
* dwarf2read.c (read_structure_type) <fi.typedef_field_list>: Call
|
||||
ALLOCATE_CPLUS_STRUCT_TYPE.
|
||||
|
||||
### a/gdb/ChangeLog
|
||||
### b/gdb/ChangeLog
|
||||
## -1,3 +1,8 @@
|
||||
+2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ * dwarf2read.c (read_structure_type) <fi.typedef_field_list>: Call
|
||||
+ ALLOCATE_CPLUS_STRUCT_TYPE.
|
||||
+
|
||||
2010-06-28 Phil Muldoon <pmuldoon@redhat.com>
|
||||
Tom Tromey <tromey@redhat.com>
|
||||
Thiago Jung Bauermann <bauerman@br.ibm.com>
|
||||
## -27,8 +32,6 @@
|
||||
* python/py-inferior.c: New File.
|
||||
* python/py-infthread.c: New File.
|
||||
|
||||
-
|
||||
-
|
||||
2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* c-typeprint.c (c_type_print_base): For no fields check include also
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -5327,6 +5327,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||
{
|
||||
int i = fi.typedef_field_list_count;
|
||||
|
||||
+ ALLOCATE_CPLUS_STRUCT_TYPE (type);
|
||||
TYPE_TYPEDEF_FIELD_ARRAY (type)
|
||||
= TYPE_ALLOC (type, sizeof (TYPE_TYPEDEF_FIELD (type, 0)) * i);
|
||||
TYPE_TYPEDEF_FIELD_COUNT (type) = i;
|
214
gdb-bz606185-obstack-1of5.patch
Normal file
214
gdb-bz606185-obstack-1of5.patch
Normal file
@ -0,0 +1,214 @@
|
||||
commit 78c144e8c3ae7bb36d632f6bfaaaad9c97199ce6
|
||||
Author: cmoller <cmoller>
|
||||
Date: Tue Apr 20 20:22:09 2010 +0000
|
||||
|
||||
PR 10867
|
||||
* cp-valprint.c (global): Adding new static array recursion
|
||||
detection obstack.
|
||||
(cp_print_value_fields, cp_print_static_field): Added new static
|
||||
array recursion detection code.
|
||||
* gdb.cp/Makefile.in (EXECUTABLES): Added pr10687
|
||||
* gdb.cp/pr10687.cc: New file.
|
||||
* gdb.cp/pr10687.exp: New file
|
||||
|
||||
### a/gdb/ChangeLog
|
||||
### b/gdb/ChangeLog
|
||||
## -1,3 +1,12 @@
|
||||
+2010-04-20 Chris Moller <cmoller@redhat.com>
|
||||
+
|
||||
+ PR 10867
|
||||
+
|
||||
+ * cp-valprint.c (global): Adding new static array recursion
|
||||
+ detection obstack.
|
||||
+ (cp_print_value_fields, cp_print_static_field): Added new static
|
||||
+ array recursion detection code.
|
||||
+
|
||||
2010-04-20 Mark Kettenis <kettenis@gnu.org>
|
||||
|
||||
* i386-linux-tdep.c (i386_linux_regset_sections): Size of the
|
||||
Index: gdb-7.1/gdb/cp-valprint.c
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/cp-valprint.c 2010-02-08 19:04:16.000000000 +0100
|
||||
+++ gdb-7.1/gdb/cp-valprint.c 2010-06-28 20:21:53.000000000 +0200
|
||||
@@ -71,6 +71,7 @@ show_static_field_print (struct ui_file
|
||||
|
||||
static struct obstack dont_print_vb_obstack;
|
||||
static struct obstack dont_print_statmem_obstack;
|
||||
+static struct obstack dont_print_stat_array_obstack;
|
||||
|
||||
extern void _initialize_cp_valprint (void);
|
||||
|
||||
@@ -155,12 +156,17 @@ cp_print_value_fields (struct type *type
|
||||
{
|
||||
int i, len, n_baseclasses;
|
||||
int fields_seen = 0;
|
||||
+ static int last_set_recurse = -1;
|
||||
|
||||
CHECK_TYPEDEF (type);
|
||||
|
||||
- if (recurse == 0
|
||||
- && obstack_object_size (&dont_print_statmem_obstack) > 0)
|
||||
- obstack_free (&dont_print_statmem_obstack, NULL);
|
||||
+ if (recurse == 0)
|
||||
+ {
|
||||
+ if (obstack_object_size (&dont_print_statmem_obstack) > 0)
|
||||
+ obstack_free (&dont_print_statmem_obstack, NULL);
|
||||
+ if (obstack_object_size (&dont_print_stat_array_obstack) > 0)
|
||||
+ obstack_free (&dont_print_stat_array_obstack, NULL);
|
||||
+ }
|
||||
|
||||
fprintf_filtered (stream, "{");
|
||||
len = TYPE_NFIELDS (type);
|
||||
@@ -181,12 +187,20 @@ cp_print_value_fields (struct type *type
|
||||
else
|
||||
{
|
||||
void *statmem_obstack_top = NULL;
|
||||
+ void *stat_array_obstack_top = NULL;
|
||||
|
||||
if (dont_print_statmem == 0)
|
||||
{
|
||||
/* Set the current printed-statics stack top. */
|
||||
statmem_obstack_top
|
||||
= obstack_next_free (&dont_print_statmem_obstack);
|
||||
+
|
||||
+ if (last_set_recurse != recurse)
|
||||
+ {
|
||||
+ stat_array_obstack_top
|
||||
+ = obstack_next_free (&dont_print_stat_array_obstack);
|
||||
+ last_set_recurse = recurse;
|
||||
+ }
|
||||
}
|
||||
|
||||
for (i = n_baseclasses; i < len; i++)
|
||||
@@ -307,9 +321,16 @@ cp_print_value_fields (struct type *type
|
||||
|
||||
if (dont_print_statmem == 0)
|
||||
{
|
||||
- /* In effect, a pop of the printed-statics stack. */
|
||||
if (obstack_object_size (&dont_print_statmem_obstack) > 0)
|
||||
obstack_free (&dont_print_statmem_obstack, statmem_obstack_top);
|
||||
+
|
||||
+ if (last_set_recurse != recurse)
|
||||
+ {
|
||||
+ if (obstack_object_size (&dont_print_stat_array_obstack) > 0)
|
||||
+ obstack_free (&dont_print_stat_array_obstack,
|
||||
+ stat_array_obstack_top);
|
||||
+ last_set_recurse = -1;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (options->pretty)
|
||||
@@ -508,6 +529,7 @@ cp_print_static_field (struct type *type
|
||||
const struct value_print_options *options)
|
||||
{
|
||||
struct value_print_options opts;
|
||||
+
|
||||
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
|
||||
{
|
||||
CORE_ADDR *first_dont_print;
|
||||
@@ -542,6 +564,32 @@ cp_print_static_field (struct type *type
|
||||
return;
|
||||
}
|
||||
|
||||
+ if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
|
||||
+ {
|
||||
+ struct type **first_dont_print;
|
||||
+ int i;
|
||||
+ struct type *target_type = TYPE_TARGET_TYPE (type);
|
||||
+
|
||||
+ first_dont_print
|
||||
+ = (struct type **) obstack_base (&dont_print_stat_array_obstack);
|
||||
+ i = obstack_object_size (&dont_print_stat_array_obstack)
|
||||
+ / sizeof (CORE_ADDR);
|
||||
+
|
||||
+ while (--i >= 0)
|
||||
+ {
|
||||
+ if (target_type == first_dont_print[i])
|
||||
+ {
|
||||
+ fputs_filtered ("<same as static member of an already"
|
||||
+ " seen type>",
|
||||
+ stream);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ obstack_grow (&dont_print_stat_array_obstack, (char *) &target_type,
|
||||
+ sizeof (struct type *));
|
||||
+ }
|
||||
+
|
||||
opts = *options;
|
||||
opts.deref_ref = 0;
|
||||
val_print (type, value_contents_all (val),
|
||||
@@ -672,6 +720,7 @@ Show printing of object's derived type b
|
||||
show_objectprint,
|
||||
&setprintlist, &showprintlist);
|
||||
|
||||
+ obstack_begin (&dont_print_stat_array_obstack, 32 * sizeof (CORE_ADDR));
|
||||
obstack_begin (&dont_print_statmem_obstack, 32 * sizeof (CORE_ADDR));
|
||||
obstack_begin (&dont_print_vb_obstack, 32 * sizeof (struct type *));
|
||||
}
|
||||
Index: gdb-7.1/gdb/testsuite/gdb.cp/pr10687.cc
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.cp/pr10687.cc 2010-06-28 20:21:53.000000000 +0200
|
||||
@@ -0,0 +1,24 @@
|
||||
+class vec2
|
||||
+{
|
||||
+ public:
|
||||
+ vec2() { _v[0] = _v[1] = 0; }
|
||||
+ vec2(int x, int y) { _v[0] = x; _v[1] = y; }
|
||||
+ static vec2 axis[2];
|
||||
+ static vec2 axis6[6];
|
||||
+ private:
|
||||
+ int _v[2];
|
||||
+};
|
||||
+
|
||||
+vec2 vec2::axis[2] = { vec2(1,0), vec2(0,1) };
|
||||
+vec2 vec2::axis6[6] = {
|
||||
+ vec2(1,0), vec2(0,1),
|
||||
+ vec2(2,0), vec2(0,2),
|
||||
+ vec2(3,0), vec2(0,3)
|
||||
+};
|
||||
+
|
||||
+int main(int argc, char*argv[])
|
||||
+{
|
||||
+ vec2 a;
|
||||
+
|
||||
+ return 0; // marker
|
||||
+}
|
||||
Index: gdb-7.1/gdb/testsuite/gdb.cp/pr10687.exp
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.cp/pr10687.exp 2010-06-28 20:21:53.000000000 +0200
|
||||
@@ -0,0 +1,31 @@
|
||||
+#Copyright 2010 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/>.
|
||||
+
|
||||
+set testfile pr10687
|
||||
+set srcfile ${testfile}.cc
|
||||
+if [prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if ![runto_main] then {
|
||||
+ fail "Can't run to main"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+gdb_breakpoint [gdb_get_line_number "marker"]
|
||||
+gdb_continue_to_breakpoint "marker"
|
||||
+
|
||||
+gdb_test "p a" "{static axis = {{static axis = <same as static member of an already.*"
|
||||
+
|
163
gdb-bz606185-obstack-2of5.patch
Normal file
163
gdb-bz606185-obstack-2of5.patch
Normal file
@ -0,0 +1,163 @@
|
||||
commit d54f5671e190a5c0ca8fd1ff070372bf20eb42a8
|
||||
Author: cmoller <cmoller>
|
||||
Date: Wed Apr 21 17:33:51 2010 +0000
|
||||
|
||||
PR 9167
|
||||
* cp-valprint.c (cp_print_value_fields): Replaced obstack_base()
|
||||
method of popping recursion-detection stack with a method based on
|
||||
obstack_object_size().
|
||||
* gdb.cp/Makefile.in (EXECUTABLES): Added pr9167.
|
||||
* gdb.cp/pr9167.cc: New file.
|
||||
* gdb.cp/pr9167.exp: New file.
|
||||
|
||||
### a/gdb/ChangeLog
|
||||
### b/gdb/ChangeLog
|
||||
## -1,3 +1,10 @@
|
||||
+2010-04-21 Chris Moller <cmoller@redhat.com>
|
||||
+
|
||||
+ PR 9167
|
||||
+ * cp-valprint.c (cp_print_value_fields): Replaced obstack_base()
|
||||
+ method of popping recursion-detection stack with a method based on
|
||||
+ obstack_object_size().
|
||||
+
|
||||
2010-04-21 Pierre Muller <muller@ics.u-strasbg.fr>
|
||||
|
||||
PR pascal/11492.
|
||||
## -3184,7 +3191,7 @@
|
||||
addr_bit. Adjust LOAD_ADDR sign for cross-arch inferiors.
|
||||
|
||||
2010-02-17 Tristan Gingold <gingold@adacore.com>
|
||||
- Petr HluzÃn <petr.hluzin@gmail.com>
|
||||
+ Petr Hluzín <petr.hluzin@gmail.com>
|
||||
|
||||
* avr-tdep.c (avr_scan_prologue): Convert an if statement to a
|
||||
gdb_assert. Fix info->size for SIG prologue.
|
||||
Index: gdb-7.1/gdb/cp-valprint.c
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/cp-valprint.c 2010-06-28 20:21:53.000000000 +0200
|
||||
+++ gdb-7.1/gdb/cp-valprint.c 2010-06-28 20:22:16.000000000 +0200
|
||||
@@ -186,14 +186,13 @@ cp_print_value_fields (struct type *type
|
||||
fprintf_filtered (stream, "<No data fields>");
|
||||
else
|
||||
{
|
||||
- void *statmem_obstack_top = NULL;
|
||||
+ int obstack_initial_size = 0;
|
||||
void *stat_array_obstack_top = NULL;
|
||||
|
||||
if (dont_print_statmem == 0)
|
||||
{
|
||||
- /* Set the current printed-statics stack top. */
|
||||
- statmem_obstack_top
|
||||
- = obstack_next_free (&dont_print_statmem_obstack);
|
||||
+ obstack_initial_size =
|
||||
+ obstack_object_size (&dont_print_statmem_obstack);
|
||||
|
||||
if (last_set_recurse != recurse)
|
||||
{
|
||||
@@ -321,8 +320,19 @@ cp_print_value_fields (struct type *type
|
||||
|
||||
if (dont_print_statmem == 0)
|
||||
{
|
||||
- if (obstack_object_size (&dont_print_statmem_obstack) > 0)
|
||||
- obstack_free (&dont_print_statmem_obstack, statmem_obstack_top);
|
||||
+ int obstack_final_size =
|
||||
+ obstack_object_size (&dont_print_statmem_obstack);
|
||||
+
|
||||
+ if (obstack_final_size > obstack_initial_size) {
|
||||
+ /* In effect, a pop of the printed-statics stack. */
|
||||
+
|
||||
+ void *free_to_ptr =
|
||||
+ obstack_next_free (&dont_print_statmem_obstack) -
|
||||
+ (obstack_final_size - obstack_initial_size);
|
||||
+
|
||||
+ obstack_free (&dont_print_statmem_obstack,
|
||||
+ free_to_ptr);
|
||||
+ }
|
||||
|
||||
if (last_set_recurse != recurse)
|
||||
{
|
||||
@@ -555,7 +565,6 @@ cp_print_static_field (struct type *type
|
||||
addr = value_address (val);
|
||||
obstack_grow (&dont_print_statmem_obstack, (char *) &addr,
|
||||
sizeof (CORE_ADDR));
|
||||
-
|
||||
CHECK_TYPEDEF (type);
|
||||
cp_print_value_fields (type, value_enclosing_type (val),
|
||||
value_contents_all (val),
|
||||
Index: gdb-7.1/gdb/testsuite/gdb.cp/pr9167.cc
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.cp/pr9167.cc 2010-06-28 20:22:16.000000000 +0200
|
||||
@@ -0,0 +1,36 @@
|
||||
+#include <iostream>
|
||||
+
|
||||
+template<typename DATA>
|
||||
+struct ATB
|
||||
+{
|
||||
+ int data;
|
||||
+ ATB() : data(0) {}
|
||||
+};
|
||||
+
|
||||
+
|
||||
+template<typename DATA,
|
||||
+ typename DerivedType >
|
||||
+class A : public ATB<DATA>
|
||||
+{
|
||||
+public:
|
||||
+ static DerivedType const DEFAULT_INSTANCE;
|
||||
+};
|
||||
+
|
||||
+template<typename DATA, typename DerivedType>
|
||||
+const DerivedType A<DATA, DerivedType>::DEFAULT_INSTANCE;
|
||||
+
|
||||
+class B : public A<int, B>
|
||||
+{
|
||||
+
|
||||
+};
|
||||
+
|
||||
+int main()
|
||||
+{
|
||||
+ B b;
|
||||
+ // If this if-block is removed then GDB shall
|
||||
+ // not infinitely recurse when trying to print b.
|
||||
+
|
||||
+ return 0; // marker
|
||||
+}
|
||||
+
|
||||
+
|
||||
Index: gdb-7.1/gdb/testsuite/gdb.cp/pr9167.exp
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.cp/pr9167.exp 2010-06-28 20:22:16.000000000 +0200
|
||||
@@ -0,0 +1,31 @@
|
||||
+#Copyright 2010 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/>.
|
||||
+
|
||||
+set testfile pr9167
|
||||
+set srcfile ${testfile}.cc
|
||||
+if [prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if ![runto_main] then {
|
||||
+ fail "Can't run to main"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+gdb_breakpoint [gdb_get_line_number "marker"]
|
||||
+gdb_continue_to_breakpoint "marker"
|
||||
+
|
||||
+gdb_test "p b" "{<A<int, B>> = {<ATB<int>> = {data = 0}, static DEFAULT_INSTANCE = <optimized out>}, <No data fields>}"
|
||||
+
|
85
gdb-bz606185-obstack-3of5.patch
Normal file
85
gdb-bz606185-obstack-3of5.patch
Normal file
@ -0,0 +1,85 @@
|
||||
commit 407cb192dcac2602aebaa7e262419adb580ecca6
|
||||
Author: cmoller <cmoller>
|
||||
Date: Thu Apr 22 20:12:06 2010 +0000
|
||||
|
||||
* cp-valprint.c (cp_print_value_fields): Replaced obstack_base()
|
||||
method of popping recursion-detection stack with a method based on
|
||||
obstack_object_size(). (Similar to the PR9167 patch below, but for
|
||||
the static array obstack rather than the static member obstack.)
|
||||
|
||||
### a/gdb/ChangeLog
|
||||
### b/gdb/ChangeLog
|
||||
## -1,3 +1,10 @@
|
||||
+2010-04-22 Chris Moller <cmoller@redhat.com>
|
||||
+
|
||||
+ * cp-valprint.c (cp_print_value_fields): Replaced obstack_base()
|
||||
+ method of popping recursion-detection stack with a method based on
|
||||
+ obstack_object_size(). (Similar to the PR9167 patch below, but for
|
||||
+ the static array obstack rather than the static member obstack.)
|
||||
+
|
||||
2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* amd64-linux-nat.c (amd64_linux_gregset64_reg_offset): Removed.
|
||||
--- a/gdb/cp-valprint.c
|
||||
+++ b/gdb/cp-valprint.c
|
||||
@@ -186,18 +186,18 @@ cp_print_value_fields (struct type *type, struct type *real_type,
|
||||
fprintf_filtered (stream, "<No data fields>");
|
||||
else
|
||||
{
|
||||
- int obstack_initial_size = 0;
|
||||
- void *stat_array_obstack_top = NULL;
|
||||
+ int statmem_obstack_initial_size = 0;
|
||||
+ int stat_array_obstack_initial_size = 0;
|
||||
|
||||
if (dont_print_statmem == 0)
|
||||
{
|
||||
- obstack_initial_size =
|
||||
+ statmem_obstack_initial_size =
|
||||
obstack_object_size (&dont_print_statmem_obstack);
|
||||
|
||||
if (last_set_recurse != recurse)
|
||||
{
|
||||
- stat_array_obstack_top
|
||||
- = obstack_next_free (&dont_print_stat_array_obstack);
|
||||
+ stat_array_obstack_initial_size =
|
||||
+ obstack_object_size (&dont_print_stat_array_obstack);
|
||||
last_set_recurse = recurse;
|
||||
}
|
||||
}
|
||||
@@ -323,12 +323,12 @@ cp_print_value_fields (struct type *type, struct type *real_type,
|
||||
int obstack_final_size =
|
||||
obstack_object_size (&dont_print_statmem_obstack);
|
||||
|
||||
- if (obstack_final_size > obstack_initial_size) {
|
||||
+ if (obstack_final_size > statmem_obstack_initial_size) {
|
||||
/* In effect, a pop of the printed-statics stack. */
|
||||
|
||||
void *free_to_ptr =
|
||||
obstack_next_free (&dont_print_statmem_obstack) -
|
||||
- (obstack_final_size - obstack_initial_size);
|
||||
+ (obstack_final_size - statmem_obstack_initial_size);
|
||||
|
||||
obstack_free (&dont_print_statmem_obstack,
|
||||
free_to_ptr);
|
||||
@@ -336,9 +336,18 @@ cp_print_value_fields (struct type *type, struct type *real_type,
|
||||
|
||||
if (last_set_recurse != recurse)
|
||||
{
|
||||
- if (obstack_object_size (&dont_print_stat_array_obstack) > 0)
|
||||
- obstack_free (&dont_print_stat_array_obstack,
|
||||
- stat_array_obstack_top);
|
||||
+ int obstack_final_size =
|
||||
+ obstack_object_size (&dont_print_stat_array_obstack);
|
||||
+
|
||||
+ if (obstack_final_size > stat_array_obstack_initial_size)
|
||||
+ {
|
||||
+ void *free_to_ptr =
|
||||
+ obstack_next_free (&dont_print_stat_array_obstack) -
|
||||
+ (obstack_final_size - stat_array_obstack_initial_size);
|
||||
+
|
||||
+ obstack_free (&dont_print_stat_array_obstack,
|
||||
+ free_to_ptr);
|
||||
+ }
|
||||
last_set_recurse = -1;
|
||||
}
|
||||
}
|
42
gdb-bz606185-obstack-4of5.patch
Normal file
42
gdb-bz606185-obstack-4of5.patch
Normal file
@ -0,0 +1,42 @@
|
||||
commit 744735550d4a4fd6d4be40776069d799dca5ee39
|
||||
Author: Ulrich Weigand <uweigand@de.ibm.com>
|
||||
Date: Mon Jun 14 16:09:55 2010 +0000
|
||||
|
||||
* cp-valprint.c (cp_print_static_field): Members of
|
||||
dont_print_stat_array_obstack are of type "struct type *".
|
||||
(_initialize_cp_valprint): Likewise.
|
||||
|
||||
### a/gdb/ChangeLog
|
||||
### b/gdb/ChangeLog
|
||||
## -1,5 +1,11 @@
|
||||
2010-06-14 Ulrich Weigand <uweigand@de.ibm.com>
|
||||
|
||||
+ * cp-valprint.c (cp_print_static_field): Members of
|
||||
+ dont_print_stat_array_obstack are of type "struct type *".
|
||||
+ (_initialize_cp_valprint): Likewise.
|
||||
+
|
||||
+2010-06-14 Ulrich Weigand <uweigand@de.ibm.com>
|
||||
+
|
||||
* frame.c (frame_register_unwind): Do not access contents
|
||||
of "optimized out" unwound register value.
|
||||
|
||||
--- a/gdb/cp-valprint.c
|
||||
+++ b/gdb/cp-valprint.c
|
||||
@@ -615,7 +615,7 @@ cp_print_static_field (struct type *type,
|
||||
first_dont_print
|
||||
= (struct type **) obstack_base (&dont_print_stat_array_obstack);
|
||||
i = obstack_object_size (&dont_print_stat_array_obstack)
|
||||
- / sizeof (CORE_ADDR);
|
||||
+ / sizeof (struct type *);
|
||||
|
||||
while (--i >= 0)
|
||||
{
|
||||
@@ -764,7 +764,7 @@ Show printing of object's derived type based on vtable info."), NULL,
|
||||
show_objectprint,
|
||||
&setprintlist, &showprintlist);
|
||||
|
||||
- obstack_begin (&dont_print_stat_array_obstack, 32 * sizeof (CORE_ADDR));
|
||||
+ obstack_begin (&dont_print_stat_array_obstack, 32 * sizeof (struct type *));
|
||||
obstack_begin (&dont_print_statmem_obstack, 32 * sizeof (CORE_ADDR));
|
||||
obstack_begin (&dont_print_vb_obstack, 32 * sizeof (struct type *));
|
||||
}
|
202
gdb-bz606185-obstack-5of5.patch
Normal file
202
gdb-bz606185-obstack-5of5.patch
Normal file
@ -0,0 +1,202 @@
|
||||
commit 47c8c764a9be6d023eca450336e6d9de16970fc0
|
||||
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Mon Jun 28 16:59:43 2010 +0000
|
||||
|
||||
gdb/
|
||||
* cp-valprint.c (cp_print_value_fields) <recurse == 0>: Call
|
||||
obstack_begin after each obstack_free.
|
||||
|
||||
gdb/testsuite/
|
||||
* gdb.cp/static-print-quit.exp, gdb.cp/static-print-quit.cc: New.
|
||||
|
||||
### a/gdb/ChangeLog
|
||||
### b/gdb/ChangeLog
|
||||
## -1,3 +1,8 @@
|
||||
+2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ * cp-valprint.c (cp_print_value_fields) <recurse == 0>: Call
|
||||
+ obstack_begin after each obstack_free.
|
||||
+
|
||||
2010-06-27 Doug Evans <dje@google.com>
|
||||
|
||||
* value.c (value_static_field): Use `switch' instead of `if'.
|
||||
## -12,27 +17,27 @@
|
||||
|
||||
2010-06-25 Paul Hilfinger <hilfinger@adacore.com>
|
||||
|
||||
- * defs.h (make_command_stats_cleanup): Declare.
|
||||
- (set_display_time): Declare.
|
||||
- (set_display_space): Declare.
|
||||
- * event-top.c (command_handler): Use make_command_stats_cleanup.
|
||||
- * main.c (display_time, display_space): Move definitions to utils.c.
|
||||
- (captured_main): Use make_command_stats_cleanup to get start-up
|
||||
- statistics.
|
||||
- Use set_display_time and set_display_space for processing OPT_STATISTICS
|
||||
- case.
|
||||
- * maint.c (maintenance_time_display): Use set_display_time.
|
||||
- (maintenance_space_display): Use set_display_space.
|
||||
- * top.c (execute_command): Remove obsolete 'maint time' code.
|
||||
- (command_loop): Use make_command_stats_cleanup.
|
||||
- * utils.c (struct cmd_stats): Structure for storing initial time
|
||||
- and space usage.
|
||||
- (display_time, display_space): Move definitions here from utils.c.
|
||||
- (set_display_time): New function.
|
||||
- (set_display_space): New function.
|
||||
- (make_command_stats_cleanup): New function.
|
||||
- (report_command_stats): New auxiliary function for
|
||||
- make_command_stats_cleanup.
|
||||
+ * defs.h (make_command_stats_cleanup): Declare.
|
||||
+ (set_display_time): Declare.
|
||||
+ (set_display_space): Declare.
|
||||
+ * event-top.c (command_handler): Use make_command_stats_cleanup.
|
||||
+ * main.c (display_time, display_space): Move definitions to utils.c.
|
||||
+ (captured_main): Use make_command_stats_cleanup to get start-up
|
||||
+ statistics.
|
||||
+ Use set_display_time and set_display_space for processing OPT_STATISTICS
|
||||
+ case.
|
||||
+ * maint.c (maintenance_time_display): Use set_display_time.
|
||||
+ (maintenance_space_display): Use set_display_space.
|
||||
+ * top.c (execute_command): Remove obsolete 'maint time' code.
|
||||
+ (command_loop): Use make_command_stats_cleanup.
|
||||
+ * utils.c (struct cmd_stats): Structure for storing initial time
|
||||
+ and space usage.
|
||||
+ (display_time, display_space): Move definitions here from utils.c.
|
||||
+ (set_display_time): New function.
|
||||
+ (set_display_space): New function.
|
||||
+ (make_command_stats_cleanup): New function.
|
||||
+ (report_command_stats): New auxiliary function for
|
||||
+ make_command_stats_cleanup.
|
||||
|
||||
2010-06-25 Ulrich Weigand <uweigand@de.ibm.com>
|
||||
|
||||
## -6103,7 +6108,7 @@
|
||||
|
||||
PR gdb/9067
|
||||
* cp-valprint.c (cp_print_value_fields) Fix use of obstacks.
|
||||
- cp_print_static_field) Fix use of obstacks.
|
||||
+ (cp_print_static_field) Fix use of obstacks.
|
||||
|
||||
2010-02-08 Pedro Alves <pedro@codesourcery.com>
|
||||
|
||||
--- a/gdb/cp-valprint.c
|
||||
+++ b/gdb/cp-valprint.c
|
||||
@@ -164,10 +164,19 @@ cp_print_value_fields (struct type *type, struct type *real_type,
|
||||
|
||||
if (recurse == 0)
|
||||
{
|
||||
+ /* Any object can be left on obstacks only during an unexpected error. */
|
||||
+
|
||||
if (obstack_object_size (&dont_print_statmem_obstack) > 0)
|
||||
- obstack_free (&dont_print_statmem_obstack, NULL);
|
||||
+ {
|
||||
+ obstack_free (&dont_print_statmem_obstack, NULL);
|
||||
+ obstack_begin (&dont_print_statmem_obstack, 32 * sizeof (CORE_ADDR));
|
||||
+ }
|
||||
if (obstack_object_size (&dont_print_stat_array_obstack) > 0)
|
||||
- obstack_free (&dont_print_stat_array_obstack, NULL);
|
||||
+ {
|
||||
+ obstack_free (&dont_print_stat_array_obstack, NULL);
|
||||
+ obstack_begin (&dont_print_stat_array_obstack,
|
||||
+ 32 * sizeof (struct type *));
|
||||
+ }
|
||||
}
|
||||
|
||||
fprintf_filtered (stream, "{");
|
||||
### a/gdb/testsuite/ChangeLog
|
||||
### b/gdb/testsuite/ChangeLog
|
||||
## -1,3 +1,7 @@
|
||||
+2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ * gdb.cp/static-print-quit.exp, gdb.cp/static-print-quit.cc: New.
|
||||
+
|
||||
2010-06-28 Doug Evans <dje@google.com>
|
||||
|
||||
* gdb.base/break-interp.exp (reach): Relax expected output a bit.
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/static-print-quit.cc
|
||||
@@ -0,0 +1,32 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+class D
|
||||
+ {
|
||||
+ public:
|
||||
+ int loooooooooooooooooooooooooooooooooooooooooooooong;
|
||||
+ };
|
||||
+
|
||||
+class C
|
||||
+ {
|
||||
+ public:
|
||||
+ int loooooooooooooooooooooooooooooooooooooooooooooong;
|
||||
+ static D field;
|
||||
+ };
|
||||
+
|
||||
+D C::field;
|
||||
+C c;
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/static-print-quit.exp
|
||||
@@ -0,0 +1,50 @@
|
||||
+# Copyright 2010 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/>.
|
||||
+
|
||||
+if { [skip_cplus_tests] } { continue }
|
||||
+
|
||||
+set testfile static-print-quit
|
||||
+set srcfile ${testfile}.cc
|
||||
+set executable $testfile.o
|
||||
+set objfile ${objdir}/${subdir}/${executable}
|
||||
+
|
||||
+if { [gdb_compile $srcdir/$subdir/$srcfile $objfile object {debug c++}] != ""} {
|
||||
+ untested ${testfile}.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart $executable
|
||||
+
|
||||
+gdb_test "set width 80"
|
||||
+gdb_test "set height 2"
|
||||
+
|
||||
+set test "print c"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re " = \{loooooooooooooooooooooooooooooooooooooooooooooong = 0, static field = \{\r\n---Type <return> to continue, or q <return> to quit---$" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re " to quit---$" {
|
||||
+ fail $test
|
||||
+ return -1
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_test "q" ".*"
|
||||
+
|
||||
+# Now the obstack is uninitialized. Excercise it.
|
||||
+
|
||||
+gdb_test "set pagination off"
|
||||
+gdb_test "print c" ".*" "first print"
|
||||
+gdb_test "print c" ".*" "second print"
|
106
gdb-bz606660-print-object-nonvirtual.patch
Normal file
106
gdb-bz606660-print-object-nonvirtual.patch
Normal file
@ -0,0 +1,106 @@
|
||||
commit bb604f9e70de515b13e2a935d8ad9d2fb0290849
|
||||
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Mon Jun 28 20:12:52 2010 +0000
|
||||
|
||||
gdb/
|
||||
Fix modification of cplus_struct_default.
|
||||
* dwarf2read.c (dwarf2_add_member_fn) <no DW_AT_vtable_elem_location>:
|
||||
Call ALLOCATE_CPLUS_STRUCT_TYPE.
|
||||
<removed>
|
||||
* gdbtypes.c (cplus_struct_default): New empty initializer, comment it.
|
||||
</removed>
|
||||
|
||||
gdb/testsuite/
|
||||
* gdb.cp/virtbase.cc (class RTTI_base, class RTTI_data)
|
||||
(main) <rtti_data>: New.
|
||||
* gdb.cp/virtbase.exp (print rtti_data): New.
|
||||
|
||||
### a/gdb/ChangeLog
|
||||
### b/gdb/ChangeLog
|
||||
## -1,3 +1,10 @@
|
||||
+2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ Fix modification of cplus_struct_default.
|
||||
+ * dwarf2read.c (dwarf2_add_member_fn) <no DW_AT_vtable_elem_location>:
|
||||
+ Call ALLOCATE_CPLUS_STRUCT_TYPE.
|
||||
+ * gdbtypes.c (cplus_struct_default): New empty initializer, comment it.
|
||||
+
|
||||
### a/gdb/testsuite/ChangeLog
|
||||
### b/gdb/testsuite/ChangeLog
|
||||
## -1,4 +1,10 @@
|
||||
+2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ * gdb.cp/virtbase.cc (class RTTI_base, class RTTI_data)
|
||||
+ (main) <rtti_data>: New.
|
||||
+ * gdb.cp/virtbase.exp (print rtti_data): New.
|
||||
+
|
||||
###--- a/gdb/gdbtypes.c
|
||||
###+++ b/gdb/gdbtypes.c
|
||||
###@@ -1733,7 +1733,8 @@ check_stub_method_group (struct type *type, int method_id)
|
||||
### }
|
||||
### }
|
||||
###
|
||||
###-const struct cplus_struct_type cplus_struct_default;
|
||||
###+/* Ensure it is in .rodata (if available) by workarounding GCC PR 44690. */
|
||||
###+const struct cplus_struct_type cplus_struct_default = { };
|
||||
###
|
||||
### void
|
||||
### allocate_cplus_struct_type (struct type *type)
|
||||
Index: gdb-7.1/gdb/dwarf2read.c
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/dwarf2read.c 2010-06-29 18:26:47.000000000 +0200
|
||||
+++ gdb-7.1/gdb/dwarf2read.c 2010-06-29 18:39:43.000000000 +0200
|
||||
@@ -5404,6 +5404,7 @@ dwarf2_add_member_fn (struct field_info
|
||||
complaint (&symfile_complaints,
|
||||
_("Member function \"%s\" (offset %d) is virtual but the vtable offset is not specified"),
|
||||
fieldname, die->offset);
|
||||
+ ALLOCATE_CPLUS_STRUCT_TYPE (type);
|
||||
TYPE_CPLUS_DYNAMIC (type) = 1;
|
||||
}
|
||||
}
|
||||
Index: gdb-7.1/gdb/testsuite/gdb.cp/virtbase.cc
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/virtbase.cc 2010-02-03 00:40:28.000000000 +0100
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.cp/virtbase.cc 2010-06-29 18:39:43.000000000 +0200
|
||||
@@ -74,8 +74,19 @@ public:
|
||||
virtual void b() {}
|
||||
};
|
||||
|
||||
+class RTTI_base
|
||||
+{
|
||||
+public:
|
||||
+ virtual ~RTTI_base() {}
|
||||
+};
|
||||
|
||||
-
|
||||
+class RTTI_data
|
||||
+{
|
||||
+public:
|
||||
+ RTTI_base base;
|
||||
+ int data;
|
||||
+ RTTI_data() : data(1) {}
|
||||
+};
|
||||
|
||||
int main() {
|
||||
ph::Derived tst;
|
||||
@@ -84,6 +95,7 @@ int main() {
|
||||
|
||||
E *e = new E;
|
||||
RHB *b = new RHC();
|
||||
+ RTTI_data rtti_data;
|
||||
|
||||
return 0; // breakpoint 3
|
||||
}
|
||||
Index: gdb-7.1/gdb/testsuite/gdb.cp/virtbase.exp
|
||||
===================================================================
|
||||
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/virtbase.exp 2010-02-04 22:04:30.000000000 +0100
|
||||
+++ gdb-7.1/gdb/testsuite/gdb.cp/virtbase.exp 2010-06-29 18:39:56.000000000 +0200
|
||||
@@ -60,3 +60,8 @@ gdb_test "print *(D *) e" " = {<C> = {v
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=560741
|
||||
gdb_test "set print object on" ""
|
||||
gdb_test "print/x b->mA" " = 0xaaaaaaaa"
|
||||
+
|
||||
+# A regression test reported to Red Hat bugzilla, see:
|
||||
+# https://bugzilla.redhat.com/show_bug.cgi?id=606660
|
||||
+# `set print object on' is expected.
|
||||
+gdb_test "print rtti_data" " = .*, data = 1\}"
|
81
gdb-infcall-sp-underflow.patch
Normal file
81
gdb-infcall-sp-underflow.patch
Normal file
@ -0,0 +1,81 @@
|
||||
http://sourceware.org/ml/gdb-patches/2010-02/msg00515.html
|
||||
Subject: [patch] infcall: Remove gdb_assert ($sp overflow)
|
||||
|
||||
Hi,
|
||||
|
||||
set $sp=0
|
||||
call something()
|
||||
->
|
||||
../../gdb/infcall.c:521: internal-error: call_function_by_hand: Assertion
|
||||
`(gdbarch_inner_than (gdbarch, 1, 2) && sp <= old_sp) || (gdbarch_inner_than
|
||||
(gdbarch, 2, 1) && sp >= old_sp)' failed.
|
||||
|
||||
as $sp - frame == 0xffffsmth which is not lower than $sp.
|
||||
|
||||
It must not be gdb_assert(). It can be an error() but I left it just to do:
|
||||
(gdb) set $sp=0
|
||||
(gdb) call doubleit (1)
|
||||
Cannot access memory at address 0xffffffffffffff78
|
||||
(gdb) set $sp=-1
|
||||
(gdb) call doubleit (1)
|
||||
Cannot access memory at address 0xffffffffffffff68
|
||||
|
||||
Unaware how inconvenient is an intentional crash of the testcase on some
|
||||
embedded/non-MMU systems.
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2010-02-19 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* infcall.c (call_function_by_hand): Remove gdb_assert on sp and old_sp.
|
||||
New comment.
|
||||
|
||||
gdb/testsuite/
|
||||
2010-02-19 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/callfuncs.exp: New tests for $spval 0 and -1. Remove return.
|
||||
|
||||
--- a/gdb/infcall.c
|
||||
+++ b/gdb/infcall.c
|
||||
@@ -518,10 +518,9 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
|
||||
/* Stack grows up. */
|
||||
sp = gdbarch_frame_align (gdbarch, old_sp + 1);
|
||||
}
|
||||
- gdb_assert ((gdbarch_inner_than (gdbarch, 1, 2)
|
||||
- && sp <= old_sp)
|
||||
- || (gdbarch_inner_than (gdbarch, 2, 1)
|
||||
- && sp >= old_sp));
|
||||
+ /* SP may have overflown address zero here from OLD_SP. Memory access
|
||||
+ functions will probably fail in such case but that is a target's
|
||||
+ problem. */
|
||||
}
|
||||
else
|
||||
/* FIXME: cagney/2002-09-18: Hey, you loose!
|
||||
--- a/gdb/testsuite/gdb.base/callfuncs.exp
|
||||
+++ b/gdb/testsuite/gdb.base/callfuncs.exp
|
||||
@@ -469,5 +469,18 @@ if {$old_reg_content == $new_reg_content} then {
|
||||
fail "nested call dummies preserve register contents"
|
||||
}
|
||||
|
||||
-return 0
|
||||
+# GDB should not crash by internal error on $sp overflow during the inferior
|
||||
+# call. It is OK it will stop on some: Cannot access memory at address 0x$hex.
|
||||
|
||||
+foreach spval {0 -1} {
|
||||
+ set old_ldprefix $pf_prefix
|
||||
+ lappend pf_prefix "sp=$spval:"
|
||||
+
|
||||
+ gdb_test {set $old_sp = $sp}
|
||||
+ gdb_test "set \$sp = $spval"
|
||||
+
|
||||
+ gdb_test "call doubleit (1)"
|
||||
+
|
||||
+ gdb_test {set $sp = $old_sp}
|
||||
+ set pf_prefix $old_ldprefix
|
||||
+}
|
||||
|
16
gdb-moribund-utrace-workaround.patch
Normal file
16
gdb-moribund-utrace-workaround.patch
Normal file
@ -0,0 +1,16 @@
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=590623
|
||||
http://sources.redhat.com/bugzilla/show_bug.cgi?id=11593
|
||||
|
||||
Bug in FSF GDB exploited by the ptrace-on-utrace interaction.
|
||||
|
||||
--- a/gdb/breakpoint.c
|
||||
+++ b/gdb/breakpoint.c
|
||||
@@ -9084,6 +9084,8 @@ update_global_location_list (int should_insert)
|
||||
traps we can no longer explain. */
|
||||
|
||||
old_loc->events_till_retirement = 3 * (thread_count () + 1);
|
||||
+ /* Red Hat Bug 590623. */
|
||||
+ old_loc->events_till_retirement *= 10;
|
||||
old_loc->owner = NULL;
|
||||
|
||||
VEC_safe_push (bp_location_p, moribund_locations, old_loc);
|
443
gdb-pie-1of6-reprelinked-bin.patch
Normal file
443
gdb-pie-1of6-reprelinked-bin.patch
Normal file
@ -0,0 +1,443 @@
|
||||
http://sourceware.org/ml/gdb-patches/2010-03/msg01008.html
|
||||
Subject: [patch 1/6]: PIE: Attach binary even after re-prelinked underneath
|
||||
|
||||
Hi,
|
||||
|
||||
there is a regression (against previous unreleased commits) by:
|
||||
Re: RFC: Verify AT_ENTRY before using it
|
||||
http://sourceware.org/ml/gdb-patches/2010-03/msg00395.html
|
||||
|
||||
for loading PIE executables which have changed on the disk since started.
|
||||
There are in fact 3 different addresses one has to properly deal with.
|
||||
|
||||
This patch uses explicit "file" so it is not dependent on pending:
|
||||
[patch] Attach to running but deleted executable
|
||||
http://sourceware.org/ml/gdb-patches/2010-03/msg00950.html
|
||||
|
||||
The two copy-pasted blocks for elf32 and elf64 are "not nice" but this is the
|
||||
current style in GDB.
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu for the whole
|
||||
patch series together.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2010-03-29 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Fix attaching to PIEs prelinked on the disk since their start.
|
||||
* solib-svr4.c (svr4_exec_displacement): New variable arch_size.
|
||||
Verify it against bfd_get_arch_size. Try to match arbitrary
|
||||
displacement for the phdrs comparison.
|
||||
|
||||
gdb/testsuite/
|
||||
2010-03-29 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/break-interp.exp: Run $binpie with new value "ATTACH", new
|
||||
code for it. New variable relink_args.
|
||||
(prelinkYES): Call prelinkNO.
|
||||
(test_attach): Accept new parameter relink_args. Re-prelink the binary
|
||||
in such case. Move the core code to ...
|
||||
(test_attach_gdb): ... a new function. Send GDB command "file".
|
||||
Extend expected "Attaching to " string.
|
||||
|
||||
--- a/gdb/solib-svr4.c
|
||||
+++ b/gdb/solib-svr4.c
|
||||
@@ -1750,13 +1750,183 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
|
||||
really do not match. */
|
||||
int phdrs_size, phdrs2_size, ok = 1;
|
||||
gdb_byte *buf, *buf2;
|
||||
+ int arch_size;
|
||||
|
||||
- buf = read_program_header (-1, &phdrs_size, NULL);
|
||||
+ buf = read_program_header (-1, &phdrs_size, &arch_size);
|
||||
buf2 = read_program_headers_from_bfd (exec_bfd, &phdrs2_size);
|
||||
- if (buf != NULL && buf2 != NULL
|
||||
- && (phdrs_size != phdrs2_size
|
||||
- || memcmp (buf, buf2, phdrs_size) != 0))
|
||||
- ok = 0;
|
||||
+ if (buf != NULL && buf2 != NULL)
|
||||
+ {
|
||||
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
|
||||
+
|
||||
+ /* We are dealing with three different addresses. EXEC_BFD
|
||||
+ represents current address in on-disk file. target memory content
|
||||
+ may be different from EXEC_BFD as the file may have been prelinked
|
||||
+ to a different address since the executable has been loaded.
|
||||
+ Moreover the address of placement in target memory can be
|
||||
+ different from what say the target memory program headers - this
|
||||
+ is the goal of PIE.
|
||||
+
|
||||
+ Detected DISPLACEMENT covers both the offsets of PIE placement and
|
||||
+ possible new prelink since start of the program. Here relocate
|
||||
+ BUF and BUF2 just by the EXEC_BFD vs. target memory content offset
|
||||
+ for the verification purpose. */
|
||||
+
|
||||
+ if (phdrs_size != phdrs2_size
|
||||
+ || bfd_get_arch_size (exec_bfd) != arch_size)
|
||||
+ ok = 0;
|
||||
+ else if (arch_size == 32 && phdrs_size >= sizeof (Elf32_External_Phdr)
|
||||
+ && phdrs_size % sizeof (Elf32_External_Phdr) == 0)
|
||||
+ {
|
||||
+ Elf_Internal_Ehdr *ehdr2 = elf_tdata (exec_bfd)->elf_header;
|
||||
+ Elf_Internal_Phdr *phdr2 = elf_tdata (exec_bfd)->phdr;
|
||||
+ CORE_ADDR displacement = 0;
|
||||
+ int i;
|
||||
+
|
||||
+ /* DISPLACEMENT could be found easier by the difference of
|
||||
+ ehdr2->e_entry but already read BUF does not contain ehdr. */
|
||||
+
|
||||
+ for (i = 0; i < ehdr2->e_phnum; i++)
|
||||
+ if (phdr2[i].p_type == PT_LOAD)
|
||||
+ {
|
||||
+ Elf32_External_Phdr *phdrp;
|
||||
+ gdb_byte *buf_vaddr_p, *buf_paddr_p;
|
||||
+ CORE_ADDR vaddr, paddr;
|
||||
+ CORE_ADDR displacement_vaddr = 0;
|
||||
+ CORE_ADDR displacement_paddr = 0;
|
||||
+
|
||||
+ phdrp = &((Elf32_External_Phdr *) buf)[i];
|
||||
+ buf_vaddr_p = (gdb_byte *) &phdrp->p_vaddr;
|
||||
+ buf_paddr_p = (gdb_byte *) &phdrp->p_paddr;
|
||||
+
|
||||
+ vaddr = extract_unsigned_integer (buf_vaddr_p, 4,
|
||||
+ byte_order);
|
||||
+ displacement_vaddr = vaddr - phdr2[i].p_vaddr;
|
||||
+
|
||||
+ paddr = extract_unsigned_integer (buf_paddr_p, 4,
|
||||
+ byte_order);
|
||||
+ displacement_paddr = paddr - phdr2[i].p_paddr;
|
||||
+
|
||||
+ if (displacement_vaddr == displacement_paddr)
|
||||
+ displacement = displacement_vaddr;
|
||||
+
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ /* Now compare BUF and BUF2 with optional DISPLACEMENT. */
|
||||
+
|
||||
+ for (i = 0; i < phdrs_size / sizeof (Elf32_External_Phdr); i++)
|
||||
+ {
|
||||
+ Elf32_External_Phdr *phdrp;
|
||||
+ Elf32_External_Phdr *phdr2p;
|
||||
+ gdb_byte *buf_vaddr_p, *buf_paddr_p;
|
||||
+ CORE_ADDR vaddr, paddr;
|
||||
+
|
||||
+ phdrp = &((Elf32_External_Phdr *) buf)[i];
|
||||
+ buf_vaddr_p = (gdb_byte *) &phdrp->p_vaddr;
|
||||
+ buf_paddr_p = (gdb_byte *) &phdrp->p_paddr;
|
||||
+ phdr2p = &((Elf32_External_Phdr *) buf2)[i];
|
||||
+
|
||||
+ /* PT_GNU_STACK addresses are left as zero not being
|
||||
+ relocated by prelink, their displacing would create false
|
||||
+ verification failure. Feel free to test the unrelocated
|
||||
+ comparison for any segment type. */
|
||||
+
|
||||
+ if (memcmp (phdrp, phdr2p, sizeof (*phdrp)) == 0)
|
||||
+ continue;
|
||||
+
|
||||
+ vaddr = extract_unsigned_integer (buf_vaddr_p, 4, byte_order);
|
||||
+ vaddr -= displacement;
|
||||
+ store_unsigned_integer (buf_vaddr_p, 4, byte_order, vaddr);
|
||||
+
|
||||
+ paddr = extract_unsigned_integer (buf_paddr_p, 4, byte_order);
|
||||
+ paddr -= displacement;
|
||||
+ store_unsigned_integer (buf_paddr_p, 4, byte_order, paddr);
|
||||
+
|
||||
+ if (memcmp (phdrp, phdr2p, sizeof (*phdrp)) == 0)
|
||||
+ continue;
|
||||
+
|
||||
+ ok = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ else if (arch_size == 64 && phdrs_size >= sizeof (Elf64_External_Phdr)
|
||||
+ && phdrs_size % sizeof (Elf64_External_Phdr) == 0)
|
||||
+ {
|
||||
+ Elf_Internal_Ehdr *ehdr2 = elf_tdata (exec_bfd)->elf_header;
|
||||
+ Elf_Internal_Phdr *phdr2 = elf_tdata (exec_bfd)->phdr;
|
||||
+ CORE_ADDR displacement = 0;
|
||||
+ int i;
|
||||
+
|
||||
+ /* DISPLACEMENT could be found easier by the difference of
|
||||
+ ehdr2->e_entry but already read BUF does not contain ehdr. */
|
||||
+
|
||||
+ for (i = 0; i < ehdr2->e_phnum; i++)
|
||||
+ if (phdr2[i].p_type == PT_LOAD)
|
||||
+ {
|
||||
+ Elf64_External_Phdr *phdrp;
|
||||
+ gdb_byte *buf_vaddr_p, *buf_paddr_p;
|
||||
+ CORE_ADDR vaddr, paddr;
|
||||
+ CORE_ADDR displacement_vaddr = 0;
|
||||
+ CORE_ADDR displacement_paddr = 0;
|
||||
+
|
||||
+ phdrp = &((Elf64_External_Phdr *) buf)[i];
|
||||
+ buf_vaddr_p = (gdb_byte *) &phdrp->p_vaddr;
|
||||
+ buf_paddr_p = (gdb_byte *) &phdrp->p_paddr;
|
||||
+
|
||||
+ vaddr = extract_unsigned_integer (buf_vaddr_p, 8,
|
||||
+ byte_order);
|
||||
+ displacement_vaddr = vaddr - phdr2[i].p_vaddr;
|
||||
+
|
||||
+ paddr = extract_unsigned_integer (buf_paddr_p, 8,
|
||||
+ byte_order);
|
||||
+ displacement_paddr = paddr - phdr2[i].p_paddr;
|
||||
+
|
||||
+ if (displacement_vaddr == displacement_paddr)
|
||||
+ displacement = displacement_vaddr;
|
||||
+
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ /* Now compare BUF and BUF2 with optional DISPLACEMENT. */
|
||||
+
|
||||
+ for (i = 0; i < phdrs_size / sizeof (Elf64_External_Phdr); i++)
|
||||
+ {
|
||||
+ Elf64_External_Phdr *phdrp;
|
||||
+ Elf64_External_Phdr *phdr2p;
|
||||
+ gdb_byte *buf_vaddr_p, *buf_paddr_p;
|
||||
+ CORE_ADDR vaddr, paddr;
|
||||
+
|
||||
+ phdrp = &((Elf64_External_Phdr *) buf)[i];
|
||||
+ buf_vaddr_p = (gdb_byte *) &phdrp->p_vaddr;
|
||||
+ buf_paddr_p = (gdb_byte *) &phdrp->p_paddr;
|
||||
+ phdr2p = &((Elf64_External_Phdr *) buf2)[i];
|
||||
+
|
||||
+ /* PT_GNU_STACK addresses are left as zero not being
|
||||
+ relocated by prelink, their displacing would create false
|
||||
+ verification failure. Feel free to test the unrelocated
|
||||
+ comparison for any segment type. */
|
||||
+
|
||||
+ if (memcmp (phdrp, phdr2p, sizeof (*phdrp)) == 0)
|
||||
+ continue;
|
||||
+
|
||||
+ vaddr = extract_unsigned_integer (buf_vaddr_p, 8, byte_order);
|
||||
+ vaddr -= displacement;
|
||||
+ store_unsigned_integer (buf_vaddr_p, 8, byte_order, vaddr);
|
||||
+
|
||||
+ paddr = extract_unsigned_integer (buf_paddr_p, 8, byte_order);
|
||||
+ paddr -= displacement;
|
||||
+ store_unsigned_integer (buf_paddr_p, 8, byte_order, paddr);
|
||||
+
|
||||
+ if (memcmp (phdrp, phdr2p, sizeof (*phdrp)) == 0)
|
||||
+ continue;
|
||||
+
|
||||
+ ok = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ ok = 0;
|
||||
+ }
|
||||
|
||||
xfree (buf);
|
||||
xfree (buf2);
|
||||
--- a/gdb/testsuite/gdb.base/break-interp.exp
|
||||
+++ b/gdb/testsuite/gdb.base/break-interp.exp
|
||||
@@ -154,6 +154,12 @@ proc prelinkYES {arg {name ""}} {
|
||||
if {$name == ""} {
|
||||
set name [file tail $arg]
|
||||
}
|
||||
+
|
||||
+ # Try to unprelink it first so that if it has been already prelinked before
|
||||
+ # we get different address now and the result is not affected by the
|
||||
+ # previous $arg state..
|
||||
+ prelinkNO $arg "$name pre-unprelink"
|
||||
+
|
||||
set test "prelink $name"
|
||||
set command "exec /usr/sbin/prelink -qNR --no-exec-shield $arg"
|
||||
verbose -log "command is $command"
|
||||
@@ -319,38 +325,12 @@ proc test_core {file displacement} {
|
||||
set pf_prefix $old_ldprefix
|
||||
}
|
||||
|
||||
-proc test_attach {file displacement} {
|
||||
- global board_info gdb_prompt expect_out
|
||||
-
|
||||
- gdb_exit
|
||||
-
|
||||
- set test "sleep function started"
|
||||
-
|
||||
- set command "${file} sleep"
|
||||
- set res [remote_spawn host $command];
|
||||
- if { $res < 0 || $res == "" } {
|
||||
- perror "Spawning $command failed."
|
||||
- fail $test
|
||||
- return
|
||||
- }
|
||||
- set pid [exp_pid -i $res]
|
||||
- gdb_expect {
|
||||
- -re "sleeping\r\n" {
|
||||
- pass $test
|
||||
- }
|
||||
- eof {
|
||||
- fail "$test (eof)"
|
||||
- return
|
||||
- }
|
||||
- timeout {
|
||||
- fail "$test (timeout)"
|
||||
- return
|
||||
- }
|
||||
- }
|
||||
+proc test_attach_gdb {file pid displacement prefix} {
|
||||
+ global gdb_prompt expect_out
|
||||
|
||||
global pf_prefix
|
||||
set old_ldprefix $pf_prefix
|
||||
- lappend pf_prefix "attach:"
|
||||
+ lappend pf_prefix "$prefix:"
|
||||
|
||||
gdb_exit
|
||||
gdb_start
|
||||
@@ -358,9 +338,13 @@ proc test_attach {file displacement} {
|
||||
# Print the "PIE (Position Independent Executable) displacement" message.
|
||||
gdb_test "set verbose on"
|
||||
|
||||
+ if {$file != ""} {
|
||||
+ gdb_test "file $file" "Reading symbols from .*done\\." "file"
|
||||
+ }
|
||||
+
|
||||
set test "attach"
|
||||
gdb_test_multiple "attach $pid" $test {
|
||||
- -re "Attaching to process $pid\r\n" {
|
||||
+ -re "Attaching to (program: .*, )?process $pid\r\n" {
|
||||
# Missing "$gdb_prompt $" is intentional.
|
||||
pass $test
|
||||
}
|
||||
@@ -396,11 +380,56 @@ proc test_attach {file displacement} {
|
||||
gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "attach main bt"
|
||||
gdb_exit
|
||||
|
||||
- remote_exec host "kill -9 $pid"
|
||||
-
|
||||
set pf_prefix $old_ldprefix
|
||||
}
|
||||
|
||||
+proc test_attach {file displacement {relink_args ""}} {
|
||||
+ global board_info
|
||||
+
|
||||
+ gdb_exit
|
||||
+
|
||||
+ set test "sleep function started"
|
||||
+
|
||||
+ set command "${file} sleep"
|
||||
+ set res [remote_spawn host $command];
|
||||
+ if { $res < 0 || $res == "" } {
|
||||
+ perror "Spawning $command failed."
|
||||
+ fail $test
|
||||
+ return
|
||||
+ }
|
||||
+ set pid [exp_pid -i $res]
|
||||
+ gdb_expect {
|
||||
+ -re "sleeping\r\n" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ eof {
|
||||
+ fail "$test (eof)"
|
||||
+ return
|
||||
+ }
|
||||
+ timeout {
|
||||
+ fail "$test (timeout)"
|
||||
+ return
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if {$relink_args == ""} {
|
||||
+ test_attach_gdb "" $pid $displacement "attach"
|
||||
+ } else {
|
||||
+ # These could be rather passed as arguments.
|
||||
+ global exec interp_saved interp
|
||||
+
|
||||
+ foreach relink {YES NO} {
|
||||
+ if {[prelink$relink $relink_args [file tail $exec]]
|
||||
+ && [copy $interp_saved $interp]} {
|
||||
+ # /proc/PID/exe cannot be loaded as it is "EXECNAME (deleted)".
|
||||
+ test_attach_gdb $exec $pid $displacement "attach-relink$relink"
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ remote_exec host "kill -9 $pid"
|
||||
+}
|
||||
+
|
||||
proc test_ld {file ifmain trynosym displacement} {
|
||||
global srcdir subdir gdb_prompt expect_out
|
||||
|
||||
@@ -609,7 +638,10 @@ foreach ldprelink {NO YES} {
|
||||
set old_binprefix $pf_prefix
|
||||
foreach binprelink {NO YES} {
|
||||
foreach binsepdebug {NO IN SEP} {
|
||||
- foreach binpie {NO YES} {
|
||||
+ # "ATTACH" is like "YES" but it is modified during run.
|
||||
+ # It cannot be used for problem reproducibility after the
|
||||
+ # testcase ends.
|
||||
+ foreach binpie {NO YES ATTACH} {
|
||||
# This combination is not possible, non-PIE (fixed address)
|
||||
# binary cannot be prelinked to any (other) address.
|
||||
if {$binprelink == "YES" && $binpie == "NO"} {
|
||||
@@ -628,7 +660,7 @@ foreach ldprelink {NO YES} {
|
||||
if {$binsepdebug != "NO"} {
|
||||
lappend opts {debug}
|
||||
}
|
||||
- if {$binpie == "YES"} {
|
||||
+ if {$binpie != "NO"} {
|
||||
lappend opts {additional_flags=-fPIE -pie}
|
||||
}
|
||||
if {[build_executable ${test}.exp [file tail $exec] $srcfile $opts] == -1} {
|
||||
@@ -680,16 +712,45 @@ foreach ldprelink {NO YES} {
|
||||
lappend dests $dest
|
||||
}
|
||||
|
||||
- if {[prelink$binprelink "--dynamic-linker=$interp --ld-library-path=$dir $exec $interp [concat $dests]" [file tail $exec]]
|
||||
+ if {$binpie == "NO"} {
|
||||
+ set displacement "NONE"
|
||||
+ } elseif {$binprelink == "NO"} {
|
||||
+ set displacement "NONZERO"
|
||||
+ } else {
|
||||
+ set displacement "ZERO"
|
||||
+ }
|
||||
+
|
||||
+ set relink_args "--dynamic-linker=$interp --ld-library-path=$dir $exec $interp [concat $dests]"
|
||||
+ if {[prelink$binprelink $relink_args [file tail $exec]]
|
||||
&& [copy $interp_saved $interp]} {
|
||||
- if {$binpie == "NO"} {
|
||||
- set displacement "NONE"
|
||||
- } elseif {$binprelink == "NO"} {
|
||||
- set displacement "NONZERO"
|
||||
+ if {$binpie != "ATTACH"} {
|
||||
+ test_ld $exec 1 [expr {$binsepdebug == "NO"}] $displacement
|
||||
} else {
|
||||
- set displacement "ZERO"
|
||||
+ # If the file has been randomly prelinked it must
|
||||
+ # be "NONZERO". We could see "ZERO" only if it was
|
||||
+ # unprelinked na it is now running at the same
|
||||
+ # address - which is 0 but executable can never run
|
||||
+ # at address 0.
|
||||
+
|
||||
+ set displacement "NONZERO"
|
||||
+ test_attach $exec $displacement $relink_args
|
||||
+
|
||||
+ # ATTACH executables + libraries get modified since
|
||||
+ # they have been run. They cannot be used for
|
||||
+ # problem reproducibility after the testcase ends.
|
||||
+ set exec_debug [system_debug_get $exec]
|
||||
+ if {$exec_debug != ""} {
|
||||
+ # `file delete [glob "${exec_debug}*"]' does not work.
|
||||
+ foreach f [glob "${exec_debug}*"] {
|
||||
+ file delete $f
|
||||
+ }
|
||||
+ }
|
||||
+ file delete -force $dir
|
||||
+ # `file delete [glob "${exec}*"]' does not work.
|
||||
+ foreach f [glob "${exec}*"] {
|
||||
+ file delete $f
|
||||
+ }
|
||||
}
|
||||
- test_ld $exec 1 [expr {$binsepdebug == "NO"}] $displacement
|
||||
}
|
||||
}
|
||||
}
|
||||
|
87
gdb-pie-2of6-reprelinked-ld.patch
Normal file
87
gdb-pie-2of6-reprelinked-ld.patch
Normal file
@ -0,0 +1,87 @@
|
||||
http://sourceware.org/ml/gdb-patches/2010-03/msg01000.html
|
||||
Subject: [patch 2/6] PIE: Attach binary even after ld.so re-prelinked underneath
|
||||
|
||||
Hi,
|
||||
|
||||
when I have seen the PIE-binary-changed-sice-start tested also
|
||||
ld.so-changed-since-start and it did not work.
|
||||
|
||||
There is questionable when to print and when to not to print non-fatal memory
|
||||
read errors. Similar change I requested in
|
||||
Re: [RFC/ia64] memory error when reading wrong core file
|
||||
http://sourceware.org/ml/gdb-patches/2010-02/msg00001.html
|
||||
so that GDB prints at least as a warning
|
||||
Cannot access memory at address ...
|
||||
when some unexpected error happens.
|
||||
|
||||
Contrary to it there is not such warning present in the code below as in the
|
||||
case of non-valgrind PIE with re-prelinked ld.so the memory read error happens
|
||||
there. Some GDB code rework could probably avoid it.
|
||||
|
||||
Just for example all the memory read errors in read_program_header or even
|
||||
- primarily - scan_dyntag are currently IMO-incorrectly silent and others.
|
||||
Therefore posted the patch this way, making all these warnings printed and
|
||||
possibly fixing code attempting incorrect reads along the way could be done by
|
||||
a different patch.
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu for the whole
|
||||
patch series together.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2010-03-29 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* auxv.c (ld_so_xfer_auxv): Do not error on failed read of data_address.
|
||||
|
||||
gdb/testsuite/
|
||||
2010-03-29 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/break-interp.exp (test_attach): Keep $interp changed. Move
|
||||
its restore after the <$relink_args != ""> loop. new comment.
|
||||
|
||||
--- a/gdb/auxv.c
|
||||
+++ b/gdb/auxv.c
|
||||
@@ -96,7 +96,16 @@ ld_so_xfer_auxv (gdb_byte *readbuf,
|
||||
|
||||
pointer_address = SYMBOL_VALUE_ADDRESS (msym);
|
||||
|
||||
- data_address = read_memory_typed_address (pointer_address, ptr_type);
|
||||
+ /* While it is an error I am not aware how to solve attaching to PIE under
|
||||
+ valgrind --db-attach=yes different way when ld.so on-disk file has prelink
|
||||
+ change in the meantime. Currently GDB will drop back to procfs_xfer_auxv
|
||||
+ (so that at least non-valgrind PIE attachments with prelink change of
|
||||
+ ld.so work). To make it working even with valgrind is PR 11440 requiring
|
||||
+ a valgrind extension. */
|
||||
+ if (target_read_memory (pointer_address, ptr_buf, ptr_size) != 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ data_address = extract_typed_address (ptr_buf, ptr_type);
|
||||
|
||||
/* Possibly still not initialized such as during an inferior startup. */
|
||||
if (data_address == 0)
|
||||
--- a/gdb/testsuite/gdb.base/break-interp.exp
|
||||
+++ b/gdb/testsuite/gdb.base/break-interp.exp
|
||||
@@ -419,12 +419,16 @@ proc test_attach {file displacement {relink_args ""}} {
|
||||
global exec interp_saved interp
|
||||
|
||||
foreach relink {YES NO} {
|
||||
- if {[prelink$relink $relink_args [file tail $exec]]
|
||||
- && [copy $interp_saved $interp]} {
|
||||
+ # It would be more correct to also [copy $interp_saved $interp]
|
||||
+ # here to really test just different prelink of $exec.
|
||||
+ # But we would need a separate test for different prelink of ld.so
|
||||
+ # where a bug occured. It is now all merged into this single test.
|
||||
+ if [prelink$relink $relink_args [file tail $exec]] {
|
||||
# /proc/PID/exe cannot be loaded as it is "EXECNAME (deleted)".
|
||||
test_attach_gdb $exec $pid $displacement "attach-relink$relink"
|
||||
}
|
||||
}
|
||||
+ copy $interp_saved $interp
|
||||
}
|
||||
|
||||
remote_exec host "kill -9 $pid"
|
||||
|
412
gdb-pie-3of6-relocate-once.patch
Normal file
412
gdb-pie-3of6-relocate-once.patch
Normal file
@ -0,0 +1,412 @@
|
||||
http://sourceware.org/ml/gdb-patches/2010-03/msg01001.html
|
||||
Subject: [patch 3/6] PIE: Fix occasional error attaching i686 binary
|
||||
|
||||
[ Testcase diff backported. ]
|
||||
|
||||
Hi,
|
||||
|
||||
this is the real bugreport which started this patch series.
|
||||
gdb "Cannot access memory" on a running process
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=576742
|
||||
|
||||
Offsets on i686 cause that while attaching to an unprelinked running PIE
|
||||
scan_dyntag will incorrectly get a successful read in scan_dyntag from DT_DEBUG
|
||||
it expects is from the mani executable but in fact it is from some ld.so or
|
||||
libc.so (located low for --exec-shield). Another issue is that scan_dyntag
|
||||
could verify more that the target memory matches the .dynamic section it is
|
||||
reading from exec_bfd. It could also complain when the read failed (as always
|
||||
failed so for for PIE attaches first, succeeded later so nobody has noticed
|
||||
anything).
|
||||
|
||||
The successful read reads a bogus DT_DEBUG value and GDB errors on it later.
|
||||
This is again a non-fatal error after the patch by Joel Brobecker above but it
|
||||
was not so before and it is incorrect anyway.
|
||||
|
||||
The svr4_relocate_main_executable call in svr4_special_symbol_handling was
|
||||
there before delayed that way for svr4_static_exec_displacement.
|
||||
But svr4_static_exec_displacement has been removed in the meantime by:
|
||||
Re: RFC: Verify AT_ENTRY before using it
|
||||
http://sourceware.org/ml/gdb-patches/2010-03/msg00030.html
|
||||
|
||||
So it can be simplified + corrected now. Moreover GDB will now finally print
|
||||
exactly "Using PIE (Position Independent Executable) displacement" exactly
|
||||
once.
|
||||
|
||||
The reproducer depends on various offsets which may be distro dependent but it
|
||||
was made so that it is hopefully reproducible everywhere. Reproduced + fixed
|
||||
on Fedora 12 x86_64 and i686.
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu for the whole
|
||||
patch series together.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2010-03-29 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* auxv.c (memory_xfer_auxv): Update attach comment.
|
||||
* solib-svr4.c (svr4_special_symbol_handling): Remove the call to
|
||||
svr4_relocate_main_executable.
|
||||
(svr4_solib_create_inferior_hook): Make the call to
|
||||
svr4_relocate_main_executable unconditional.
|
||||
|
||||
gdb/testsuite/
|
||||
2010-03-29 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/attach-pie-misread.exp, gdb.base/attach-pie-misread.c: New.
|
||||
|
||||
--- a/gdb/auxv.c
|
||||
+++ b/gdb/auxv.c
|
||||
@@ -198,7 +198,8 @@ memory_xfer_auxv (struct target_ops *ops,
|
||||
|
||||
/* ld_so_xfer_auxv is the only function safe for virtual executables being
|
||||
executed by valgrind's memcheck. As using ld_so_xfer_auxv is problematic
|
||||
- during inferior startup GDB does call it only for attached processes. */
|
||||
+ during inferior startup as ld.so symbol tables are not yet relocated GDB
|
||||
+ calls ld_so_xfer_auxv only for attached processes. */
|
||||
|
||||
if (current_inferior ()->attach_flag != 0)
|
||||
{
|
||||
--- a/gdb/solib-svr4.c
|
||||
+++ b/gdb/solib-svr4.c
|
||||
@@ -1628,7 +1628,6 @@ enable_break (struct svr4_info *info, int from_tty)
|
||||
static void
|
||||
svr4_special_symbol_handling (void)
|
||||
{
|
||||
- svr4_relocate_main_executable ();
|
||||
}
|
||||
|
||||
/* Read the ELF program headers from ABFD. Return the contents and
|
||||
@@ -2065,8 +2064,7 @@ svr4_solib_create_inferior_hook (int from_tty)
|
||||
info = get_svr4_info ();
|
||||
|
||||
/* Relocate the main executable if necessary. */
|
||||
- if (current_inferior ()->attach_flag == 0)
|
||||
- svr4_relocate_main_executable ();
|
||||
+ svr4_relocate_main_executable ();
|
||||
|
||||
if (!svr4_have_link_map_offsets ())
|
||||
return;
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/attach-pie-misread.c
|
||||
@@ -0,0 +1,47 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+const char stub[] = {
|
||||
+#ifdef GEN
|
||||
+# include GEN
|
||||
+#endif
|
||||
+};
|
||||
+
|
||||
+int
|
||||
+main (int argc, char **argv)
|
||||
+{
|
||||
+ /* Generator of GEN written in Python takes about 15s for x86_64's 4MB. */
|
||||
+ if (argc == 2)
|
||||
+ {
|
||||
+ long count = strtol (argv[1], NULL, 0);
|
||||
+
|
||||
+ while (count-- > 0)
|
||||
+ puts ("0x55,");
|
||||
+
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (argc != 1)
|
||||
+ return 1;
|
||||
+
|
||||
+ puts ("sleeping");
|
||||
+ fflush (stdout);
|
||||
+
|
||||
+ return sleep (60);
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/attach-pie-misread.exp
|
||||
@@ -0,0 +1,209 @@
|
||||
+# Copyright 2010 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 only works on GNU/Linux.
|
||||
+if { ![isnative] || [is_remote host] || ![istarget *-linux*] || [skip_shlib_tests]} {
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+set test "attach-pie-misread"
|
||||
+set srcfile ${test}.c
|
||||
+set genfile ${objdir}/${subdir}/${test}-gen.h
|
||||
+set executable ${test}
|
||||
+set binfile ${objdir}/${subdir}/${executable}
|
||||
+
|
||||
+if {[build_executable ${test}.exp $executable $srcfile [list "additional_flags=-fPIE -pie"]] == -1} {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Program Headers:
|
||||
+# Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
|
||||
+# LOAD 0x000000 0x0000000000400000 0x0000000000400000 0x134f5ec 0x134f5ec R E 0x200000
|
||||
+# LOAD 0x134f5f0 0x000000000194f5f0 0x000000000194f5f0 0x1dbc60 0x214088 RW 0x200000
|
||||
+# DYNAMIC 0x134f618 0x000000000194f618 0x000000000194f618 0x000200 0x000200 RW 0x8
|
||||
+#
|
||||
+proc read_phdr {binfile test} {
|
||||
+ set readelf_program [transform readelf]
|
||||
+ set command "exec $readelf_program -Wl $binfile"
|
||||
+ verbose -log "command is $command"
|
||||
+ set result [catch $command output]
|
||||
+ verbose -log "result is $result"
|
||||
+ verbose -log "output is $output"
|
||||
+ if {$result != 0} {
|
||||
+ fail $test
|
||||
+ return
|
||||
+ }
|
||||
+ if ![regexp {\nProgram Headers:\n *Type [^\n]* Align\n(.*?)\n\n} $output trash phdr] {
|
||||
+ fail "$test (no Program Headers)"
|
||||
+ return
|
||||
+ }
|
||||
+ if ![regexp -line {^ *DYNAMIC +0x[0-9a-f]+ +(0x[0-9a-f]+) } $phdr trash dynamic_vaddr] {
|
||||
+ fail "$test (no DYNAMIC found)"
|
||||
+ return
|
||||
+ }
|
||||
+ verbose -log "dynamic_vaddr is $dynamic_vaddr"
|
||||
+ set align_max -1
|
||||
+ foreach {trash align} [regexp -line -all -inline {^ *LOAD .* (0x[0-9]+)$} $phdr] {
|
||||
+ if {$align_max < $align} {
|
||||
+ set align_max $align
|
||||
+ }
|
||||
+ }
|
||||
+ verbose -log "align_max is $align_max"
|
||||
+ if {$align_max == -1} {
|
||||
+ fail "$test (no LOAD found)"
|
||||
+ return
|
||||
+ }
|
||||
+ pass $test
|
||||
+ return [list $dynamic_vaddr $align_max]
|
||||
+}
|
||||
+
|
||||
+set phdr [read_phdr $binfile "readelf initial scan"]
|
||||
+set dynamic_vaddr [lindex $phdr 0]
|
||||
+set align_max [lindex $phdr 1]
|
||||
+
|
||||
+set stub_size [format 0x%x [expr "2 * $align_max - ($dynamic_vaddr & ($align_max - 1))"]]
|
||||
+verbose -log "stub_size is $stub_size"
|
||||
+
|
||||
+# On x86_64 it is commonly about 4MB.
|
||||
+if {$stub_size > 25000000} {
|
||||
+ xfail "stub size $stub_size is too large"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+set test "generate stub"
|
||||
+set command "exec $binfile $stub_size >$genfile"
|
||||
+verbose -log "command is $command"
|
||||
+set result [catch $command output]
|
||||
+verbose -log "result is $result"
|
||||
+verbose -log "output is $output"
|
||||
+if {$result == 0} {
|
||||
+ pass $test
|
||||
+} else {
|
||||
+ fail $test
|
||||
+}
|
||||
+
|
||||
+if {[build_executable ${test}.exp $executable $srcfile [list "additional_flags=-fPIE -pie -DGEN=\"$genfile\""]] == -1} {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# x86_64 file has 25MB, no need to keep it.
|
||||
+file delete -- $genfile
|
||||
+
|
||||
+set phdr [read_phdr $binfile "readelf rebuilt with stub_size"]
|
||||
+set dynamic_vaddr_prelinkno [lindex $phdr 0]
|
||||
+
|
||||
+set command "exec /usr/sbin/prelink -q -N --no-exec-shield -R $binfile"
|
||||
+verbose -log "command is $command"
|
||||
+set result [catch $command output]
|
||||
+verbose -log "result is $result"
|
||||
+verbose -log "output is $output"
|
||||
+
|
||||
+set test "prelink -R"
|
||||
+if {$result == 0 && $output == ""} {
|
||||
+ pass $test
|
||||
+} elseif {$result == 1 && [regexp {^(couldn't execute "/usr/sbin/prelink[^\r\n]*": no such file or directory\n?)*$} $output]} {
|
||||
+ untested attach-pie-misread.exp
|
||||
+ return -1
|
||||
+} else {
|
||||
+ fail $test
|
||||
+}
|
||||
+
|
||||
+set phdr [read_phdr $binfile "readelf with prelink -R"]
|
||||
+set dynamic_vaddr_prelinkyes [lindex $phdr 0]
|
||||
+
|
||||
+set first_offset [format 0x%x [expr $dynamic_vaddr_prelinkyes - $dynamic_vaddr_prelinkno]]
|
||||
+verbose -log "first_offset is $first_offset"
|
||||
+
|
||||
+set test "first offset is non-zero"
|
||||
+if {$first_offset == 0} {
|
||||
+ fail "$test (-fPIE -pie in effect?)"
|
||||
+} else {
|
||||
+ pass $test
|
||||
+}
|
||||
+
|
||||
+set test "start inferior"
|
||||
+gdb_exit
|
||||
+
|
||||
+set res [remote_spawn host $binfile];
|
||||
+if { $res < 0 || $res == "" } {
|
||||
+ perror "Spawning $binfile failed."
|
||||
+ fail $test
|
||||
+ return
|
||||
+}
|
||||
+set pid [exp_pid -i $res]
|
||||
+gdb_expect {
|
||||
+ -re "sleeping\r\n" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ eof {
|
||||
+ fail "$test (eof)"
|
||||
+ remote_exec host "kill -9 $pid"
|
||||
+ return
|
||||
+ }
|
||||
+ timeout {
|
||||
+ fail "$test (timeout)"
|
||||
+ remote_exec host "kill -9 $pid"
|
||||
+ return
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Due to alignments it was reproducible with 1 on x86_64 but 2 on i686.
|
||||
+foreach align_mult {1 2} {
|
||||
+ set old_ldprefix $pf_prefix
|
||||
+ lappend pf_prefix "shift-by-$align_mult:"
|
||||
+
|
||||
+ # FIXME: We believe there is enough room under FIRST_OFFSET.
|
||||
+ set shifted_offset [format 0x%x [expr "$first_offset - $align_mult * $align_max"]]
|
||||
+ verbose -log "shifted_offset is $shifted_offset"
|
||||
+
|
||||
+ set command "exec /usr/sbin/prelink -q -N --no-exec-shield -r $shifted_offset $binfile"
|
||||
+ verbose -log "command is $command"
|
||||
+ set result [catch $command output]
|
||||
+ verbose -log "result is $result"
|
||||
+ verbose -log "output is $output"
|
||||
+
|
||||
+ set test "prelink -r"
|
||||
+ if {$result == 0 && $output == ""} {
|
||||
+ pass $test
|
||||
+ } else {
|
||||
+ fail $test
|
||||
+ }
|
||||
+
|
||||
+ clean_restart $executable
|
||||
+
|
||||
+ set test "attach"
|
||||
+ gdb_test_multiple "attach $pid" $test {
|
||||
+ -re "Attaching to program: .*, process $pid\r\n" {
|
||||
+ # Missing "$gdb_prompt $" is intentional.
|
||||
+ pass $test
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ set test "error on Cannot access memory at address"
|
||||
+ gdb_test_multiple "" $test {
|
||||
+ -re "\r\nCannot access memory at address .*$gdb_prompt $" {
|
||||
+ fail $test
|
||||
+ }
|
||||
+ -re "$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ gdb_test "detach" "Detaching from program: .*"
|
||||
+
|
||||
+ set pf_prefix $old_ldprefix
|
||||
+}
|
||||
+
|
||||
+remote_exec host "kill -9 $pid"
|
||||
--- a/gdb/testsuite/gdb.base/break-interp.exp
|
||||
+++ b/gdb/testsuite/gdb.base/break-interp.exp
|
||||
@@ -248,9 +248,8 @@ proc reach {func command displacement} {
|
||||
}
|
||||
if {$displacement == $case} {
|
||||
pass $test_displacement
|
||||
- # Permit multiple such messages.
|
||||
set displacement "FOUND-$displacement"
|
||||
- } elseif {$displacement != "FOUND-$case"} {
|
||||
+ } else {
|
||||
fail $test_displacement
|
||||
}
|
||||
exp_continue
|
||||
@@ -304,9 +303,8 @@ proc test_core {file displacement} {
|
||||
}
|
||||
if {$displacement == $case} {
|
||||
pass $test_displacement
|
||||
- # Permit multiple such messages.
|
||||
set displacement "FOUND-$displacement"
|
||||
- } elseif {$displacement != "FOUND-$case"} {
|
||||
+ } else {
|
||||
fail $test_displacement
|
||||
}
|
||||
exp_continue
|
||||
@@ -362,9 +360,8 @@ proc test_attach_gdb {file pid displacement prefix} {
|
||||
}
|
||||
if {$displacement == $case} {
|
||||
pass $test_displacement
|
||||
- # Permit multiple such messages.
|
||||
set displacement "FOUND-$displacement"
|
||||
- } elseif {$displacement != "FOUND-$case"} {
|
||||
+ } else {
|
||||
fail $test_displacement
|
||||
}
|
||||
exp_continue
|
||||
@@ -451,9 +448,7 @@
|
||||
gdb_test "bt" "#0 +\[^\r\n\]*\\mdl_main\\M.*" "dl bt"
|
||||
|
||||
if $ifmain {
|
||||
- # Displacement message will be printed the second time on initializing
|
||||
- # the linker from svr4_special_symbol_handling.
|
||||
- reach "main" continue $displacement
|
||||
+ reach "main" continue "NONE"
|
||||
|
||||
reach "libfunc" continue "NONE"
|
||||
|
||||
@@ -528,9 +517,8 @@ proc test_ld {file ifmain trynosym displacement} {
|
||||
}
|
||||
if {$displacement == $case} {
|
||||
pass $test_displacement
|
||||
- # Permit multiple such messages.
|
||||
set displacement "FOUND-$displacement"
|
||||
- } elseif {$displacement != "FOUND-$case"} {
|
||||
+ } else {
|
||||
fail $test_displacement
|
||||
}
|
||||
exp_continue
|
||||
|
127
gdb-pie-rerun.patch
Normal file
127
gdb-pie-rerun.patch
Normal file
@ -0,0 +1,127 @@
|
||||
http://sourceware.org/ml/gdb-patches/2010-03/msg00868.html
|
||||
Subject: [patch] PIE: Fix back re-run [Re: [patch] svr4_exec_displacement success indicator]
|
||||
|
||||
Hi,
|
||||
|
||||
currently:
|
||||
|
||||
$ echo 'main(){}'|gcc -o 1 -fPIE -pie -x c -; ./gdb -nx -ex 'set disable-randomization off' -ex 'b main' -ex r -ex c -ex r ./1
|
||||
Breakpoint 1 at 0x6b0
|
||||
Starting program: /home/jkratoch/redhat/gdb-clean/gdb/testsuite/1
|
||||
Breakpoint 1, 0x00007fbf73e8c6b0 in main ()
|
||||
Continuing.
|
||||
Program exited with code 0140.
|
||||
Starting program: /home/jkratoch/redhat/gdb-clean/gdb/testsuite/1
|
||||
Error in re-setting breakpoint 1: Cannot access memory at address 0x7fbf73e8c6ac
|
||||
|
||||
It is since:
|
||||
[patch] svr4_exec_displacement success indicator [Re: PIE question]
|
||||
http://sourceware.org/ml/gdb-patches/2010-03/msg00336.html
|
||||
|
||||
|
||||
On Mon, 08 Mar 2010 22:53:58 +0100, Jan Kratochvil wrote:
|
||||
> Attached these changes:
|
||||
>
|
||||
> * svr4_exec_displacement calling convention should have success indicator.
|
||||
>
|
||||
> * Preserving now section_offsets if they are already set, inspired by
|
||||
> init_objfile_sect_indices.
|
||||
>
|
||||
> I believe either of parts would be sufficient for this problem.
|
||||
|
||||
The first part has caused the regression for PIE on native x86* GNU/Linux host.
|
||||
|
||||
As I believe for Daniel J.'s seen regression of `qOffsets' the second already
|
||||
checked-in part is sufficient - I would like to remove the first part.
|
||||
|
||||
OK to check it in?
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
|
||||
|
||||
(I do not think one needs to think about 7.1-branch as it is not a regression
|
||||
against any FSF GDB release.)
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2010-03-25 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Fix re-run of PIE executable.
|
||||
* solib-svr4.c (svr4_relocate_main_executable) <symfile_objfile>: Remove
|
||||
the part of pre-set SYMFILE_OBJFILE->SECTION_OFFSETS.
|
||||
|
||||
gdb/testsuite/
|
||||
2010-03-25 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Fix re-run of PIE executable.
|
||||
* gdb.base/break-interp.exp (test_ld): Turn off "disable-randomization".
|
||||
Remove $displacement_main to match the solib-svr4.c change. New "kill"
|
||||
and re-"run" of the inferior.
|
||||
|
||||
--- a/gdb/solib-svr4.c
|
||||
+++ b/gdb/solib-svr4.c
|
||||
@@ -1791,17 +1791,10 @@ svr4_relocate_main_executable (void)
|
||||
{
|
||||
CORE_ADDR displacement;
|
||||
|
||||
- if (symfile_objfile)
|
||||
- {
|
||||
- int i;
|
||||
-
|
||||
- /* Remote target may have already set specific offsets by `qOffsets'
|
||||
- which should be preferred. */
|
||||
-
|
||||
- for (i = 0; i < symfile_objfile->num_sections; i++)
|
||||
- if (ANOFFSET (symfile_objfile->section_offsets, i) != 0)
|
||||
- return;
|
||||
- }
|
||||
+ /* SYMFILE_OBJFILE->SECTION_OFFSETS may now contain displacement from the
|
||||
+ previous run of the inferior. Re-set it according to the current value,
|
||||
+ if we can find it out. But otherwise keep it as for remote target it may
|
||||
+ have been pre-set by the `qOffsets' packet. */
|
||||
|
||||
if (! svr4_exec_displacement (&displacement))
|
||||
return;
|
||||
--- a/gdb/testsuite/gdb.base/break-interp.exp
|
||||
+++ b/gdb/testsuite/gdb.base/break-interp.exp
|
||||
@@ -416,25 +416,28 @@ proc test_ld {file ifmain trynosym displacement} {
|
||||
# Print the "PIE (Position Independent Executable) displacement" message.
|
||||
gdb_test "set verbose on"
|
||||
|
||||
+ # A bit better test coverage.
|
||||
+ gdb_test "set disable-randomization off"
|
||||
+
|
||||
reach "dl_main" "run segv" $displacement
|
||||
|
||||
gdb_test "bt" "#0 +\[^\r\n\]*\\mdl_main\\M.*" "dl bt"
|
||||
|
||||
if $ifmain {
|
||||
# Displacement message will be printed the second time on initializing
|
||||
- # the linker from svr4_special_symbol_handling. If any ANOFFSET has
|
||||
- # been already set as non-zero the detection will no longer be run.
|
||||
- if {$displacement == "NONZERO"} {
|
||||
- set displacement_main "NONE"
|
||||
- } else {
|
||||
- set displacement_main $displacement
|
||||
- }
|
||||
- reach "main" continue $displacement_main
|
||||
+ # the linker from svr4_special_symbol_handling.
|
||||
+ reach "main" continue $displacement
|
||||
|
||||
reach "libfunc" continue "NONE"
|
||||
|
||||
gdb_test "bt" "#0 +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#1 +\[^\r\n\]*\\mmain\\M.*" "main bt"
|
||||
+ }
|
||||
|
||||
+ # Try re-run if the new PIE displacement takes effect.
|
||||
+ gdb_test "kill" "" "kill" {Kill the program being debugged\? \(y or n\) } "y"
|
||||
+ reach "dl_main" "run segv" $displacement
|
||||
+
|
||||
+ if $ifmain {
|
||||
test_core $file $displacement
|
||||
|
||||
test_attach $file $displacement
|
||||
|
@ -1,648 +0,0 @@
|
||||
http://sourceware.org/ml/gdb-patches/2009-11/msg00596.html
|
||||
Subject: [gdb FYI-patch] callback-mode readline-6.0 regression
|
||||
|
||||
Hi Chet,
|
||||
|
||||
FSF GDB currently ships bundled with readline-5.2 which works fine.
|
||||
But using --with-system-readline and readline-6.0-patchlevel4 has
|
||||
a regression:
|
||||
|
||||
readline-5.2: Run `gdb -nx -q' and type CTRL-C:
|
||||
(gdb) Quit
|
||||
(gdb) _
|
||||
|
||||
readline-6.0: Run `gdb -nx -q' and type CTRL-C:
|
||||
(gdb) _
|
||||
= nothing happens (it gets buffered and executed later)
|
||||
(It does also FAIL on gdb.gdb/selftest.exp.)
|
||||
|
||||
It is because GDB waits in its own poll() mainloop and readline uses via
|
||||
rl_callback_handler_install and rl_callback_handler_remove. This way the
|
||||
readline internal variable _rl_interrupt_immediately remains 0 and CTRL-C gets
|
||||
only stored to _rl_caught_signal but not executed.
|
||||
|
||||
Seen in rl_signal_handler even if _rl_interrupt_immediately is set and
|
||||
_rl_handle_signal is called then the signal is still stored to
|
||||
_rl_caught_signal. In the _rl_interrupt_immediately case it should not be
|
||||
stored when it was already processed.
|
||||
|
||||
rl_signal_handler does `_rl_interrupt_immediately = 0;' - while I am not aware
|
||||
of its meaning it breaks the nest-counting of other routines which do
|
||||
`_rl_interrupt_immediately++;' and `_rl_interrupt_immediately--;' possibly
|
||||
creating problematic `_rl_interrupt_immediately == -1'.
|
||||
|
||||
`_rl_interrupt_immediately' is an internal variable, how it could be accessed
|
||||
by a readline application? (OK, maybe it should not be used.)
|
||||
|
||||
Attaching a current GDB-side patch but it must access readline internal
|
||||
variable _rl_caught_signal and it is generally just a workaround. Could you
|
||||
please include support for signals in this asynchronous mode in readline-6.1?
|
||||
I find it would be enough to make RL_CHECK_SIGNALS public?
|
||||
|
||||
|
||||
GDB: No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
|
||||
But this is not a patch intended to be accepted.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2009-11-29 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* config.in, configure: Regenerate.
|
||||
* configure.ac (for readline_echoing_p): Move inside $LIBS change.
|
||||
(for _rl_caught_signal): New.
|
||||
* event-loop.c: Include readline/readline.h.
|
||||
(gdb_do_one_event) [HAVE_READLINE_CAUGHT_SIGNAL]: New.
|
||||
|
||||
gdb/testsuite/
|
||||
2009-11-29 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.gdb/selftest.exp (backtrace through signal handler): Move before
|
||||
SIGINT pass, drop the timeout case.
|
||||
(send SIGINT signal to child process): Use gdb_test.
|
||||
(backtrace through readline handler): New.
|
||||
|
||||
Index: gdb-7.0.50.20100115/gdb/config.in
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100115.orig/gdb/config.in 2010-01-15 12:48:04.000000000 +0100
|
||||
+++ gdb-7.0.50.20100115/gdb/config.in 2010-01-15 12:48:40.000000000 +0100
|
||||
@@ -359,6 +359,9 @@
|
||||
/* Define if Python interpreter is being linked in. */
|
||||
#undef HAVE_PYTHON
|
||||
|
||||
+/* readline-6.0 workaround of blocked signals. */
|
||||
+#undef HAVE_READLINE_CAUGHT_SIGNAL
|
||||
+
|
||||
/* Define to 1 if you have the `realpath' function. */
|
||||
#undef HAVE_REALPATH
|
||||
|
||||
Index: gdb-7.0.50.20100115/gdb/configure.ac
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100115.orig/gdb/configure.ac 2010-01-15 12:48:04.000000000 +0100
|
||||
+++ gdb-7.0.50.20100115/gdb/configure.ac 2010-01-15 12:48:40.000000000 +0100
|
||||
@@ -777,17 +777,25 @@ if test "$with_system_readline" = yes; t
|
||||
# readline-6.0 started to use the name `_rl_echoing_p'.
|
||||
# `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
|
||||
|
||||
- AC_MSG_CHECKING([for readline_echoing_p])
|
||||
save_LIBS=$LIBS
|
||||
LIBS="$LIBS $READLINE"
|
||||
+ AC_MSG_CHECKING([for readline_echoing_p])
|
||||
AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int readline_echoing_p;
|
||||
return readline_echoing_p;]]),
|
||||
[READLINE_ECHOING_P=yes],
|
||||
[READLINE_ECHOING_P=no
|
||||
AC_DEFINE([readline_echoing_p], [_rl_echoing_p],
|
||||
[readline-6.0 started to use different name.])])
|
||||
- LIBS="$save_LIBS"
|
||||
AC_MSG_RESULT([$READLINE_ECHOING_P])
|
||||
+ AC_MSG_CHECKING([for _rl_caught_signal])
|
||||
+ AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int volatile _rl_caught_signal;
|
||||
+ return _rl_caught_signal;]]),
|
||||
+ [READLINE_CAUGHT_SIGNAL=yes
|
||||
+ AC_DEFINE([HAVE_READLINE_CAUGHT_SIGNAL],,
|
||||
+ [readline-6.0 workaround of blocked signals.])],
|
||||
+ [READLINE_CAUGHT_SIGNAL=no])
|
||||
+ AC_MSG_RESULT([$READLINE_CAUGHT_SIGNAL])
|
||||
+ LIBS="$save_LIBS"
|
||||
else
|
||||
READLINE='$(READLINE_DIR)/libreadline.a'
|
||||
READLINE_DEPS='$(READLINE)'
|
||||
Index: gdb-7.0.50.20100115/gdb/event-loop.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100115.orig/gdb/event-loop.c 2010-01-01 08:31:31.000000000 +0100
|
||||
+++ gdb-7.0.50.20100115/gdb/event-loop.c 2010-01-15 12:48:40.000000000 +0100
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "exceptions.h"
|
||||
#include "gdb_assert.h"
|
||||
#include "gdb_select.h"
|
||||
+#include "readline/readline.h"
|
||||
|
||||
/* Data point to pass to the event handler. */
|
||||
typedef union event_data
|
||||
@@ -411,6 +412,9 @@ gdb_do_one_event (void *data)
|
||||
static int event_source_head = 0;
|
||||
const int number_of_sources = 3;
|
||||
int current = 0;
|
||||
+#ifdef HAVE_READLINE_CAUGHT_SIGNAL
|
||||
+ extern int volatile _rl_caught_signal;
|
||||
+#endif
|
||||
|
||||
/* Any events already waiting in the queue? */
|
||||
if (process_event ())
|
||||
@@ -455,6 +459,16 @@ gdb_do_one_event (void *data)
|
||||
if (gdb_wait_for_event (1) < 0)
|
||||
return -1;
|
||||
|
||||
+#ifdef HAVE_READLINE_CAUGHT_SIGNAL
|
||||
+ if (async_command_editing_p && RL_ISSTATE (RL_STATE_CALLBACK)
|
||||
+ && _rl_caught_signal)
|
||||
+ {
|
||||
+ /* Call RL_CHECK_SIGNALS this way. */
|
||||
+ rl_callback_handler_remove ();
|
||||
+ rl_callback_handler_install (NULL, input_handler);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
/* Handle any new events occurred while waiting. */
|
||||
if (process_event ())
|
||||
return 1;
|
||||
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.gdb/selftest.exp
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.gdb/selftest.exp 2010-01-15 12:48:01.000000000 +0100
|
||||
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.gdb/selftest.exp 2010-01-15 12:48:40.000000000 +0100
|
||||
@@ -471,31 +471,42 @@ GDB.*Copyright \[0-9\]+ Free Software Fo
|
||||
fail "$description (timeout)"
|
||||
}
|
||||
}
|
||||
-
|
||||
- set description "send SIGINT signal to child process"
|
||||
- send_gdb "signal SIGINT\n"
|
||||
- gdb_expect {
|
||||
- -re "Continuing with signal SIGINT.*$gdb_prompt $" {
|
||||
+
|
||||
+ # get a stack trace with the poll function
|
||||
+ #
|
||||
+ # This fails on some linux systems for unknown reasons. On the
|
||||
+ # systems where it fails, sometimes it works fine when run manually.
|
||||
+ # The testsuite failures may not be limited to just aout systems.
|
||||
+ setup_xfail "i*86-pc-linuxaout-gnu"
|
||||
+ set description "backtrace through signal handler"
|
||||
+ gdb_test_multiple "backtrace" $description {
|
||||
+ -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
|
||||
pass "$description"
|
||||
}
|
||||
-re ".*$gdb_prompt $" {
|
||||
+ # On the alpha, we hit the infamous problem about gdb
|
||||
+ # being unable to get the frame pointer (mentioned in
|
||||
+ # gdb/README). As it is intermittent, there is no way to
|
||||
+ # XFAIL it which will give us an XPASS if the problem goes
|
||||
+ # away.
|
||||
+ setup_xfail "alpha*-*-osf*"
|
||||
fail "$description"
|
||||
}
|
||||
- timeout {
|
||||
- fail "$description (timeout)"
|
||||
- }
|
||||
}
|
||||
|
||||
- # get a stack trace
|
||||
+ gdb_test "signal SIGINT" "Continuing with signal SIGINT.*" \
|
||||
+ "send SIGINT signal to child process"
|
||||
+
|
||||
+ # get a stack trace being redelivered by readline
|
||||
#
|
||||
# This fails on some linux systems for unknown reasons. On the
|
||||
# systems where it fails, sometimes it works fine when run manually.
|
||||
# The testsuite failures may not be limited to just aout systems.
|
||||
+ # Optional system readline may not have symbols to be shown.
|
||||
setup_xfail "i*86-pc-linuxaout-gnu"
|
||||
- set description "backtrace through signal handler"
|
||||
- send_gdb "backtrace\n"
|
||||
- gdb_expect {
|
||||
- -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
|
||||
+ set description "backtrace through readline handler"
|
||||
+ gdb_test_multiple "backtrace" $description {
|
||||
+ -re "#0.*gdb_do_one_event.*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
|
||||
pass "$description"
|
||||
}
|
||||
-re ".*$gdb_prompt $" {
|
||||
@@ -507,9 +518,6 @@ GDB.*Copyright \[0-9\]+ Free Software Fo
|
||||
setup_xfail "alpha*-*-osf*"
|
||||
fail "$description"
|
||||
}
|
||||
- timeout {
|
||||
- fail "$description (timeout)"
|
||||
- }
|
||||
}
|
||||
|
||||
|
||||
Index: gdb-7.0.50.20100115/gdb/configure
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100115.orig/gdb/configure 2010-01-15 12:48:04.000000000 +0100
|
||||
+++ gdb-7.0.50.20100115/gdb/configure 2010-01-15 12:48:46.000000000 +0100
|
||||
@@ -6772,6 +6772,185 @@ else
|
||||
fi
|
||||
|
||||
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
+# Check whether --with-separate-debug-dir was given.
|
||||
+if test "${with_separate_debug_dir+set}" = set; then :
|
||||
+ withval=$with_separate_debug_dir;
|
||||
+ DEBUGDIR=$withval
|
||||
+else
|
||||
+ DEBUGDIR=${libdir}/debug
|
||||
+fi
|
||||
+
|
||||
+
|
||||
+ test "x$prefix" = xNONE && prefix="$ac_default_prefix"
|
||||
+ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
|
||||
+ ac_define_dir=`eval echo $DEBUGDIR`
|
||||
+ ac_define_dir=`eval echo $ac_define_dir`
|
||||
+
|
||||
+cat >>confdefs.h <<_ACEOF
|
||||
+#define DEBUGDIR "$ac_define_dir"
|
||||
+_ACEOF
|
||||
+
|
||||
+
|
||||
+
|
||||
+ if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
|
||||
+ if test "x$prefix" = xNONE; then
|
||||
+ test_prefix=/usr/local
|
||||
+ else
|
||||
+ test_prefix=$prefix
|
||||
+ fi
|
||||
+ else
|
||||
+ test_prefix=$exec_prefix
|
||||
+ fi
|
||||
+ value=0
|
||||
+ case ${ac_define_dir} in
|
||||
+ "${test_prefix}"|"${test_prefix}/"*|\
|
||||
+ '${exec_prefix}'|'${exec_prefix}/'*)
|
||||
+ value=1
|
||||
+ ;;
|
||||
+ esac
|
||||
+
|
||||
+cat >>confdefs.h <<_ACEOF
|
||||
+#define DEBUGDIR_RELOCATABLE $value
|
||||
+_ACEOF
|
||||
+
|
||||
+
|
||||
+
|
||||
+# GDB's datadir relocation
|
||||
+
|
||||
+
|
||||
+
|
||||
+# Check whether --with-gdb-datadir was given.
|
||||
+if test "${with_gdb_datadir+set}" = set; then :
|
||||
+ withval=$with_gdb_datadir;
|
||||
+ GDB_DATADIR=$withval
|
||||
+else
|
||||
+ GDB_DATADIR=${datadir}/gdb
|
||||
+fi
|
||||
+
|
||||
+
|
||||
+ test "x$prefix" = xNONE && prefix="$ac_default_prefix"
|
||||
+ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
|
||||
+ ac_define_dir=`eval echo $GDB_DATADIR`
|
||||
+ ac_define_dir=`eval echo $ac_define_dir`
|
||||
+
|
||||
+cat >>confdefs.h <<_ACEOF
|
||||
+#define GDB_DATADIR "$ac_define_dir"
|
||||
+_ACEOF
|
||||
+
|
||||
+
|
||||
+
|
||||
+ if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
|
||||
+ if test "x$prefix" = xNONE; then
|
||||
+ test_prefix=/usr/local
|
||||
+ else
|
||||
+ test_prefix=$prefix
|
||||
+ fi
|
||||
+ else
|
||||
+ test_prefix=$exec_prefix
|
||||
+ fi
|
||||
+ value=0
|
||||
+ case ${ac_define_dir} in
|
||||
+ "${test_prefix}"|"${test_prefix}/"*|\
|
||||
+ '${exec_prefix}'|'${exec_prefix}/'*)
|
||||
+ value=1
|
||||
+ ;;
|
||||
+ esac
|
||||
+
|
||||
+cat >>confdefs.h <<_ACEOF
|
||||
+#define GDB_DATADIR_RELOCATABLE $value
|
||||
+_ACEOF
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
+# Check whether --with-relocated-sources was given.
|
||||
+if test "${with_relocated_sources+set}" = set; then :
|
||||
+ withval=$with_relocated_sources; reloc_srcdir="${withval}"
|
||||
+
|
||||
+ test "x$prefix" = xNONE && prefix="$ac_default_prefix"
|
||||
+ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
|
||||
+ ac_define_dir=`eval echo $reloc_srcdir`
|
||||
+ ac_define_dir=`eval echo $ac_define_dir`
|
||||
+
|
||||
+cat >>confdefs.h <<_ACEOF
|
||||
+#define RELOC_SRCDIR "$ac_define_dir"
|
||||
+_ACEOF
|
||||
+
|
||||
+
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+
|
||||
+# GDB's datadir relocation
|
||||
+
|
||||
+gdbdatadir=${datadir}/gdb
|
||||
+
|
||||
+
|
||||
+# Check whether --with-gdb-datadir was given.
|
||||
+if test "${with_gdb_datadir+set}" = set; then :
|
||||
+ withval=$with_gdb_datadir; gdbdatadir="${withval}"
|
||||
+fi
|
||||
+
|
||||
+
|
||||
+
|
||||
+ test "x$prefix" = xNONE && prefix="$ac_default_prefix"
|
||||
+ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
|
||||
+ ac_define_dir=`eval echo $gdbdatadir`
|
||||
+ ac_define_dir=`eval echo $ac_define_dir`
|
||||
+
|
||||
+cat >>confdefs.h <<_ACEOF
|
||||
+#define GDB_DATADIR "$ac_define_dir"
|
||||
+_ACEOF
|
||||
+
|
||||
+
|
||||
+
|
||||
+if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
|
||||
+ if test "x$prefix" = xNONE; then
|
||||
+ test_prefix=/usr/local
|
||||
+ else
|
||||
+ test_prefix=$prefix
|
||||
+ fi
|
||||
+else
|
||||
+ test_prefix=$exec_prefix
|
||||
+fi
|
||||
+
|
||||
+case ${gdbdatadir} in
|
||||
+ "${test_prefix}"|"${test_prefix}/"*|\
|
||||
+ '${exec_prefix}'|'${exec_prefix}/'*)
|
||||
+
|
||||
+$as_echo "#define GDB_DATADIR_RELOCATABLE 1" >>confdefs.h
|
||||
+
|
||||
+ ;;
|
||||
+esac
|
||||
+GDB_DATADIR_PATH=${gdbdatadir}
|
||||
+
|
||||
+
|
||||
+
|
||||
+# Check whether --with-pythondir was given.
|
||||
+if test "${with_pythondir+set}" = set; then :
|
||||
+ withval=$with_pythondir; pythondir="${withval}"
|
||||
+else
|
||||
+ pythondir=no
|
||||
+fi
|
||||
+
|
||||
+
|
||||
+# If the user passed in a path, define it. Otherwise, compute it at
|
||||
+# runtime based on the possibly-relocatable datadir.
|
||||
+if test "$pythondir" = "no"; then
|
||||
+ pythondir='$(GDB_DATADIR_PATH)/python'
|
||||
+else
|
||||
+
|
||||
+cat >>confdefs.h <<_ACEOF
|
||||
+#define PYTHONDIR "$pythondir"
|
||||
+_ACEOF
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+
|
||||
# Integration with rpm library to support missing debuginfo suggestions.
|
||||
# --without-rpm: Disable any rpm support.
|
||||
# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
|
||||
@@ -7255,185 +7434,6 @@ fi
|
||||
|
||||
|
||||
|
||||
-
|
||||
-# Check whether --with-separate-debug-dir was given.
|
||||
-if test "${with_separate_debug_dir+set}" = set; then :
|
||||
- withval=$with_separate_debug_dir;
|
||||
- DEBUGDIR=$withval
|
||||
-else
|
||||
- DEBUGDIR=${libdir}/debug
|
||||
-fi
|
||||
-
|
||||
-
|
||||
- test "x$prefix" = xNONE && prefix="$ac_default_prefix"
|
||||
- test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
|
||||
- ac_define_dir=`eval echo $DEBUGDIR`
|
||||
- ac_define_dir=`eval echo $ac_define_dir`
|
||||
-
|
||||
-cat >>confdefs.h <<_ACEOF
|
||||
-#define DEBUGDIR "$ac_define_dir"
|
||||
-_ACEOF
|
||||
-
|
||||
-
|
||||
-
|
||||
- if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
|
||||
- if test "x$prefix" = xNONE; then
|
||||
- test_prefix=/usr/local
|
||||
- else
|
||||
- test_prefix=$prefix
|
||||
- fi
|
||||
- else
|
||||
- test_prefix=$exec_prefix
|
||||
- fi
|
||||
- value=0
|
||||
- case ${ac_define_dir} in
|
||||
- "${test_prefix}"|"${test_prefix}/"*|\
|
||||
- '${exec_prefix}'|'${exec_prefix}/'*)
|
||||
- value=1
|
||||
- ;;
|
||||
- esac
|
||||
-
|
||||
-cat >>confdefs.h <<_ACEOF
|
||||
-#define DEBUGDIR_RELOCATABLE $value
|
||||
-_ACEOF
|
||||
-
|
||||
-
|
||||
-
|
||||
-# GDB's datadir relocation
|
||||
-
|
||||
-
|
||||
-
|
||||
-# Check whether --with-gdb-datadir was given.
|
||||
-if test "${with_gdb_datadir+set}" = set; then :
|
||||
- withval=$with_gdb_datadir;
|
||||
- GDB_DATADIR=$withval
|
||||
-else
|
||||
- GDB_DATADIR=${datadir}/gdb
|
||||
-fi
|
||||
-
|
||||
-
|
||||
- test "x$prefix" = xNONE && prefix="$ac_default_prefix"
|
||||
- test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
|
||||
- ac_define_dir=`eval echo $GDB_DATADIR`
|
||||
- ac_define_dir=`eval echo $ac_define_dir`
|
||||
-
|
||||
-cat >>confdefs.h <<_ACEOF
|
||||
-#define GDB_DATADIR "$ac_define_dir"
|
||||
-_ACEOF
|
||||
-
|
||||
-
|
||||
-
|
||||
- if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
|
||||
- if test "x$prefix" = xNONE; then
|
||||
- test_prefix=/usr/local
|
||||
- else
|
||||
- test_prefix=$prefix
|
||||
- fi
|
||||
- else
|
||||
- test_prefix=$exec_prefix
|
||||
- fi
|
||||
- value=0
|
||||
- case ${ac_define_dir} in
|
||||
- "${test_prefix}"|"${test_prefix}/"*|\
|
||||
- '${exec_prefix}'|'${exec_prefix}/'*)
|
||||
- value=1
|
||||
- ;;
|
||||
- esac
|
||||
-
|
||||
-cat >>confdefs.h <<_ACEOF
|
||||
-#define GDB_DATADIR_RELOCATABLE $value
|
||||
-_ACEOF
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-# Check whether --with-relocated-sources was given.
|
||||
-if test "${with_relocated_sources+set}" = set; then :
|
||||
- withval=$with_relocated_sources; reloc_srcdir="${withval}"
|
||||
-
|
||||
- test "x$prefix" = xNONE && prefix="$ac_default_prefix"
|
||||
- test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
|
||||
- ac_define_dir=`eval echo $reloc_srcdir`
|
||||
- ac_define_dir=`eval echo $ac_define_dir`
|
||||
-
|
||||
-cat >>confdefs.h <<_ACEOF
|
||||
-#define RELOC_SRCDIR "$ac_define_dir"
|
||||
-_ACEOF
|
||||
-
|
||||
-
|
||||
-
|
||||
-fi
|
||||
-
|
||||
-
|
||||
-# GDB's datadir relocation
|
||||
-
|
||||
-gdbdatadir=${datadir}/gdb
|
||||
-
|
||||
-
|
||||
-# Check whether --with-gdb-datadir was given.
|
||||
-if test "${with_gdb_datadir+set}" = set; then :
|
||||
- withval=$with_gdb_datadir; gdbdatadir="${withval}"
|
||||
-fi
|
||||
-
|
||||
-
|
||||
-
|
||||
- test "x$prefix" = xNONE && prefix="$ac_default_prefix"
|
||||
- test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
|
||||
- ac_define_dir=`eval echo $gdbdatadir`
|
||||
- ac_define_dir=`eval echo $ac_define_dir`
|
||||
-
|
||||
-cat >>confdefs.h <<_ACEOF
|
||||
-#define GDB_DATADIR "$ac_define_dir"
|
||||
-_ACEOF
|
||||
-
|
||||
-
|
||||
-
|
||||
-if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
|
||||
- if test "x$prefix" = xNONE; then
|
||||
- test_prefix=/usr/local
|
||||
- else
|
||||
- test_prefix=$prefix
|
||||
- fi
|
||||
-else
|
||||
- test_prefix=$exec_prefix
|
||||
-fi
|
||||
-
|
||||
-case ${gdbdatadir} in
|
||||
- "${test_prefix}"|"${test_prefix}/"*|\
|
||||
- '${exec_prefix}'|'${exec_prefix}/'*)
|
||||
-
|
||||
-$as_echo "#define GDB_DATADIR_RELOCATABLE 1" >>confdefs.h
|
||||
-
|
||||
- ;;
|
||||
-esac
|
||||
-GDB_DATADIR_PATH=${gdbdatadir}
|
||||
-
|
||||
-
|
||||
-
|
||||
-# Check whether --with-pythondir was given.
|
||||
-if test "${with_pythondir+set}" = set; then :
|
||||
- withval=$with_pythondir; pythondir="${withval}"
|
||||
-else
|
||||
- pythondir=no
|
||||
-fi
|
||||
-
|
||||
-
|
||||
-# If the user passed in a path, define it. Otherwise, compute it at
|
||||
-# runtime based on the possibly-relocatable datadir.
|
||||
-if test "$pythondir" = "no"; then
|
||||
- pythondir='$(GDB_DATADIR_PATH)/python'
|
||||
-else
|
||||
-
|
||||
-cat >>confdefs.h <<_ACEOF
|
||||
-#define PYTHONDIR "$pythondir"
|
||||
-_ACEOF
|
||||
-
|
||||
-fi
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
subdirs="$subdirs doc testsuite"
|
||||
|
||||
|
||||
@@ -9290,10 +9290,10 @@ if test "$with_system_readline" = yes; t
|
||||
# readline-6.0 started to use the name `_rl_echoing_p'.
|
||||
# `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
|
||||
|
||||
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline_echoing_p" >&5
|
||||
-$as_echo_n "checking for readline_echoing_p... " >&6; }
|
||||
save_LIBS=$LIBS
|
||||
LIBS="$LIBS $READLINE"
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline_echoing_p" >&5
|
||||
+$as_echo_n "checking for readline_echoing_p... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
@@ -9316,9 +9316,35 @@ $as_echo "#define readline_echoing_p _rl
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
- LIBS="$save_LIBS"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_ECHOING_P" >&5
|
||||
$as_echo "$READLINE_ECHOING_P" >&6; }
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _rl_caught_signal" >&5
|
||||
+$as_echo_n "checking for _rl_caught_signal... " >&6; }
|
||||
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+extern int volatile _rl_caught_signal;
|
||||
+ return _rl_caught_signal;
|
||||
+ ;
|
||||
+ return 0;
|
||||
+}
|
||||
+_ACEOF
|
||||
+if ac_fn_c_try_link "$LINENO"; then :
|
||||
+ READLINE_CAUGHT_SIGNAL=yes
|
||||
+
|
||||
+$as_echo "#define HAVE_READLINE_CAUGHT_SIGNAL /**/" >>confdefs.h
|
||||
+
|
||||
+else
|
||||
+ READLINE_CAUGHT_SIGNAL=no
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext \
|
||||
+ conftest$ac_exeext conftest.$ac_ext
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_CAUGHT_SIGNAL" >&5
|
||||
+$as_echo "$READLINE_CAUGHT_SIGNAL" >&6; }
|
||||
+ LIBS="$save_LIBS"
|
||||
else
|
||||
READLINE='$(READLINE_DIR)/libreadline.a'
|
||||
READLINE_DEPS='$(READLINE)'
|
@ -69,7 +69,7 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/break-interp.exp
|
||||
}
|
||||
|
||||
@@ -480,9 +500,33 @@ foreach ldprelink {NO YES} {
|
||||
if {$binpie == "YES"} {
|
||||
if {$binpie != "NO"} {
|
||||
lappend opts {additional_flags=-fPIE -pie}
|
||||
}
|
||||
- if {[build_executable ${test}.exp [file tail $exec] $srcfile $opts] == -1} {
|
||||
|
41
gdb-solib-memory-error-nonfatal.patch
Normal file
41
gdb-solib-memory-error-nonfatal.patch
Normal file
@ -0,0 +1,41 @@
|
||||
[RFC/ia64] memory error when reading wrong core file
|
||||
http://sourceware.org/ml/gdb-patches/2010-01/msg00645.html
|
||||
http://sourceware.org/ml/gdb-patches/2010-02/msg00001.html
|
||||
http://sourceware.org/ml/gdb-patches/2010-03/msg00298.html
|
||||
http://sourceware.org/ml/gdb-cvs/2010-03/msg00065.html
|
||||
c961a8da422283662e09ee498c0598d48fc9d70f
|
||||
|
||||
--- src/gdb/solib-svr4.c 2010/02/24 00:29:02 1.125
|
||||
+++ src/gdb/solib-svr4.c 2010/03/08 07:45:49 1.126
|
||||
@@ -868,9 +868,16 @@
|
||||
{
|
||||
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
|
||||
struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
|
||||
+ CORE_ADDR addr = 0;
|
||||
+ volatile struct gdb_exception ex;
|
||||
|
||||
- return read_memory_typed_address (info->debug_base + lmo->r_map_offset,
|
||||
- ptr_type);
|
||||
+ TRY_CATCH (ex, RETURN_MASK_ERROR)
|
||||
+ {
|
||||
+ addr = read_memory_typed_address (info->debug_base + lmo->r_map_offset,
|
||||
+ ptr_type);
|
||||
+ }
|
||||
+ exception_print (gdb_stderr, ex);
|
||||
+ return addr;
|
||||
}
|
||||
|
||||
/* Find r_brk from the inferior's debug base. */
|
||||
### src/gdb/ChangeLog 2010/03/08 01:49:30 1.11441
|
||||
### src/gdb/ChangeLog 2010/03/08 07:45:49 1.11442
|
||||
## -1,3 +1,10 @@
|
||||
+2010-03-08 Joel Brobecker <brobecker@adacore.com>
|
||||
+
|
||||
+ Memory error when reading wrong core file.
|
||||
+ * solib-svr4.c (solib_svr4_r_map): catch and print all exception
|
||||
+ errors while reading the inferior memory, and return zero if
|
||||
+ an exception was raised.
|
||||
+
|
||||
2010-03-07 Michael Snyder <msnyder@vmware.com>
|
||||
|
||||
* record.c (record_restore): Rename tmpu8 to rectype.
|
@ -1,154 +0,0 @@
|
||||
http://sourceware.org/ml/gdb-patches/2009-12/msg00364.html
|
||||
Subject: [patch] related_breakpoint stale ref crash fix
|
||||
|
||||
Hi,
|
||||
|
||||
getting occasional random:
|
||||
PASS: gdb.threads/local-watch-wrong-thread.exp: local watchpoint still triggers
|
||||
PASS: gdb.threads/local-watch-wrong-thread.exp: let thread_function0 return
|
||||
PASS: gdb.threads/local-watch-wrong-thread.exp: breakpoint on thread_function0's caller
|
||||
-PASS: gdb.threads/local-watch-wrong-thread.exp: local watchpoint automatically deleted
|
||||
+ERROR: Process no longer exists
|
||||
+UNRESOLVED: gdb.threads/local-watch-wrong-thread.exp: local watchpoint automatically deleted
|
||||
|
||||
It is even reproducible on HEAD using "input" file below and:
|
||||
valgrind ../gdb -nx <input
|
||||
|
||||
(gdb) (gdb) Breakpoint 6 at 0x400685: file ./gdb.threads/local-watch-wrong-thread.c, line 47.
|
||||
(gdb) ==31759== Invalid write of size 4
|
||||
==31759== at 0x601A11: bpstat_check_breakpoint_conditions (breakpoint.c:3482)
|
||||
==31759== by 0x601C70: bpstat_stop_status (breakpoint.c:3596)
|
||||
==31759== by 0x65D228: handle_inferior_event (infrun.c:3589)
|
||||
==31759== by 0x65A563: wait_for_inferior (infrun.c:2281)
|
||||
==31759== by 0x659AA0: proceed (infrun.c:1883)
|
||||
==31759== by 0x65300B: continue_1 (infcmd.c:668)
|
||||
==31759== by 0x653282: continue_command (infcmd.c:760)
|
||||
==31759== by 0x5C51D8: do_cfunc (cli-decode.c:67)
|
||||
==31759== by 0x5C824F: cmd_func (cli-decode.c:1738)
|
||||
==31759== by 0x48335A: execute_command (top.c:450)
|
||||
==31759== by 0x67273E: command_handler (event-top.c:511)
|
||||
==31759== by 0x672E53: command_line_handler (event-top.c:736)
|
||||
==31759== Address 0xbbdc950 is 240 bytes inside a block of size 336 free'd
|
||||
==31759== at 0x4A04D72: free (vg_replace_malloc.c:325)
|
||||
==31759== by 0x486E4B: xfree (utils.c:1286)
|
||||
==31759== by 0x60BC35: delete_breakpoint (breakpoint.c:8708)
|
||||
==31759== by 0x60BDAF: delete_command (breakpoint.c:8765)
|
||||
==31759== by 0x5C51D8: do_cfunc (cli-decode.c:67)
|
||||
==31759== by 0x5C824F: cmd_func (cli-decode.c:1738)
|
||||
==31759== by 0x48335A: execute_command (top.c:450)
|
||||
==31759== by 0x67273E: command_handler (event-top.c:511)
|
||||
==31759== by 0x672E53: command_line_handler (event-top.c:736)
|
||||
==31759== by 0x672FCF: gdb_readline2 (event-top.c:817)
|
||||
==31759== by 0x6725F7: stdin_event_handler (event-top.c:433)
|
||||
==31759== by 0x670CDE: handle_file_event (event-loop.c:812)
|
||||
==31759==
|
||||
|
||||
Watchpoint 4 deleted because the program has left the block in
|
||||
which its expression is valid.
|
||||
|
||||
|
||||
There is already automatic deletion of RELATED_BREAKPOINT in
|
||||
map_breakpoint_numbers but "delete breakpoints" (for all the breakpoints)
|
||||
calls delete_breakpoint from delete_command directly without calling
|
||||
map_breakpoint_numbers and it does not delete the associated
|
||||
bp_watchpoint_scope.
|
||||
|
||||
I find the attached patch is right for delete_breakpoint itself as such
|
||||
function should not leave stale references in the leftover data structures.
|
||||
How well could be other code cleaned up with this patch in place I have not
|
||||
targeted by this patch.
|
||||
|
||||
|
||||
The existing code expects accessibility of freed memory and discusses the
|
||||
current stale references problem:
|
||||
|
||||
void
|
||||
delete_breakpoint (struct breakpoint *bpt)
|
||||
[...]
|
||||
/* Has this bp already been deleted? This can happen because multiple
|
||||
lists can hold pointers to bp's. bpstat lists are especial culprits.
|
||||
|
||||
One example of this happening is a watchpoint's scope bp. When the
|
||||
scope bp triggers, we notice that the watchpoint is out of scope, and
|
||||
delete it. We also delete its scope bp. But the scope bp is marked
|
||||
"auto-deleting", and is already on a bpstat. That bpstat is then
|
||||
checked for auto-deleting bp's, which are deleted.
|
||||
|
||||
A real solution to this problem might involve reference counts in bp's,
|
||||
and/or giving them pointers back to their referencing bpstat's, and
|
||||
teaching delete_breakpoint to only free a bp's storage when no more
|
||||
references were extent. A cheaper bandaid was chosen. */
|
||||
if (bpt->type == bp_none)
|
||||
return;
|
||||
[...]
|
||||
bpt->type = bp_none;
|
||||
|
||||
xfree (bpt);
|
||||
}
|
||||
|
||||
|
||||
While fixing this part may be difficult I find the attached patch easy enough
|
||||
fixing the IMO currently most common crash due to it.
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
"input":
|
||||
set height 0
|
||||
set width 0
|
||||
set confirm no
|
||||
file ../testsuite/gdb.threads/local-watch-wrong-thread
|
||||
set can-use-hw-watchpoints 1
|
||||
break main
|
||||
run
|
||||
break local-watch-wrong-thread.c:36
|
||||
continue
|
||||
delete breakpoints
|
||||
watch *myp
|
||||
continue
|
||||
delete breakpoints
|
||||
echo MAKE watch\n
|
||||
watch *myp if trigger != 0
|
||||
echo MAKE break\n
|
||||
break local-watch-wrong-thread.c:60
|
||||
info break
|
||||
continue
|
||||
echo DELETE five\n
|
||||
delete 5
|
||||
set trigger=1
|
||||
continue
|
||||
set *myp=0
|
||||
break local-watch-wrong-thread.c:47
|
||||
continue
|
||||
|
||||
|
||||
|
||||
2009-12-23 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* breakpoint.c (delete_breakpoint <bpt->related_breakpoint != NULL>):
|
||||
New.
|
||||
|
||||
--- a/gdb/breakpoint.c
|
||||
+++ b/gdb/breakpoint.c
|
||||
@@ -8649,6 +8649,16 @@ delete_breakpoint (struct breakpoint *bpt)
|
||||
if (bpt->type == bp_none)
|
||||
return;
|
||||
|
||||
+ /* At least avoid this stale reference until the reference counting of
|
||||
+ breakpoints gets resolved. */
|
||||
+ if (bpt->related_breakpoint != NULL)
|
||||
+ {
|
||||
+ gdb_assert (bpt->related_breakpoint->related_breakpoint == bpt);
|
||||
+ bpt->related_breakpoint->disposition = disp_del_at_next_stop;
|
||||
+ bpt->related_breakpoint->related_breakpoint = NULL;
|
||||
+ bpt->related_breakpoint = NULL;
|
||||
+ }
|
||||
+
|
||||
observer_notify_breakpoint_deleted (bpt->number);
|
||||
|
||||
if (breakpoint_chain == bpt)
|
||||
|
46
gdb-unwind-debughook-safe-fail.patch
Normal file
46
gdb-unwind-debughook-safe-fail.patch
Normal file
@ -0,0 +1,46 @@
|
||||
commit 802214c97d1661ad337aad0d011dded44f0b5ddd
|
||||
Author: Tom Tromey <tromey@redhat.com>
|
||||
Date: Mon Apr 26 15:15:55 2010 -0600
|
||||
|
||||
Fail gracefully if the _Unwind_DebugHook argument is optimized out
|
||||
|
||||
diff --git a/gdb/infrun.c b/gdb/infrun.c
|
||||
index 2eea550..9a5b534 100644
|
||||
--- a/gdb/infrun.c
|
||||
+++ b/gdb/infrun.c
|
||||
@@ -4925,20 +4925,24 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
|
||||
|
||||
vsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym), b, VAR_DOMAIN, NULL);
|
||||
value = read_var_value (vsym, frame);
|
||||
- handler = value_as_address (value);
|
||||
+ /* If the value was optimized out, revert to the old behavior. */
|
||||
+ if (! value_optimized_out (value))
|
||||
+ {
|
||||
+ handler = value_as_address (value);
|
||||
|
||||
- /* We're going to replace the current step-resume breakpoint
|
||||
- with an exception-resume breakpoint. */
|
||||
- delete_step_resume_breakpoint (tp);
|
||||
+ /* We're going to replace the current step-resume breakpoint
|
||||
+ with an exception-resume breakpoint. */
|
||||
+ delete_step_resume_breakpoint (tp);
|
||||
|
||||
- if (debug_infrun)
|
||||
- fprintf_unfiltered (gdb_stdlog,
|
||||
- "infrun: exception resume at %lx\n",
|
||||
- (unsigned long) handler);
|
||||
+ if (debug_infrun)
|
||||
+ fprintf_unfiltered (gdb_stdlog,
|
||||
+ "infrun: exception resume at %lx\n",
|
||||
+ (unsigned long) handler);
|
||||
|
||||
- bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),
|
||||
- handler, bp_exception_resume);
|
||||
- inferior_thread ()->step_resume_breakpoint = bp;
|
||||
+ bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),
|
||||
+ handler, bp_exception_resume);
|
||||
+ inferior_thread ()->step_resume_breakpoint = bp;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
235
gdb-unwind-debughook-step-independent.patch
Normal file
235
gdb-unwind-debughook-step-independent.patch
Normal file
@ -0,0 +1,235 @@
|
||||
commit f8ca03e0097ae49c66cf33a50e3247bccd3a4a33
|
||||
Author: Tom Tromey <tromey@redhat.com>
|
||||
Date: Wed Apr 28 14:17:38 2010 -0600
|
||||
|
||||
Reimplement infrun parts of next-over-throw.
|
||||
Previously, we reset the step-resume breakpoint.
|
||||
However, this can do the wrong thing if an exception
|
||||
is thrown and caught beneath the nexting frame.
|
||||
The new approach is to have a separate exception-resume
|
||||
breakpoint.
|
||||
|
||||
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
|
||||
index 611dcbb..9638368 100644
|
||||
--- a/gdb/gdbthread.h
|
||||
+++ b/gdb/gdbthread.h
|
||||
@@ -66,6 +66,9 @@ struct thread_info
|
||||
/* Step-resume or longjmp-resume breakpoint. */
|
||||
struct breakpoint *step_resume_breakpoint;
|
||||
|
||||
+ /* Exception-resume breakpoint. */
|
||||
+ struct breakpoint *exception_resume_breakpoint;
|
||||
+
|
||||
/* Range to single step within.
|
||||
|
||||
If this is nonzero, respond to a single-step signal by continuing
|
||||
@@ -225,6 +228,9 @@ extern void delete_thread_silent (ptid_t);
|
||||
/* Delete a step_resume_breakpoint from the thread database. */
|
||||
extern void delete_step_resume_breakpoint (struct thread_info *);
|
||||
|
||||
+/* Delete an exception_resume_breakpoint from the thread database. */
|
||||
+extern void delete_exception_resume_breakpoint (struct thread_info *);
|
||||
+
|
||||
/* Translate the integer thread id (GDB's homegrown id, not the system's)
|
||||
into a "pid" (which may be overloaded with extra thread information). */
|
||||
extern ptid_t thread_id_to_pid (int);
|
||||
diff --git a/gdb/infrun.c b/gdb/infrun.c
|
||||
index 9a5b534..3546cf1 100644
|
||||
--- a/gdb/infrun.c
|
||||
+++ b/gdb/infrun.c
|
||||
@@ -300,6 +300,7 @@ follow_fork (void)
|
||||
parent thread structure's run control related fields, not just these.
|
||||
Initialized to avoid "may be used uninitialized" warnings from gcc. */
|
||||
struct breakpoint *step_resume_breakpoint = NULL;
|
||||
+ struct breakpoint *exception_resume_breakpoint = NULL;
|
||||
CORE_ADDR step_range_start = 0;
|
||||
CORE_ADDR step_range_end = 0;
|
||||
struct frame_id step_frame_id = { 0 };
|
||||
@@ -352,6 +353,8 @@ follow_fork (void)
|
||||
step_range_start = tp->step_range_start;
|
||||
step_range_end = tp->step_range_end;
|
||||
step_frame_id = tp->step_frame_id;
|
||||
+ exception_resume_breakpoint
|
||||
+ = clone_momentary_breakpoint (tp->exception_resume_breakpoint);
|
||||
|
||||
/* For now, delete the parent's sr breakpoint, otherwise,
|
||||
parent/child sr breakpoints are considered duplicates,
|
||||
@@ -362,6 +365,7 @@ follow_fork (void)
|
||||
tp->step_range_start = 0;
|
||||
tp->step_range_end = 0;
|
||||
tp->step_frame_id = null_frame_id;
|
||||
+ delete_exception_resume_breakpoint (tp);
|
||||
}
|
||||
|
||||
parent = inferior_ptid;
|
||||
@@ -403,6 +407,8 @@ follow_fork (void)
|
||||
tp->step_range_start = step_range_start;
|
||||
tp->step_range_end = step_range_end;
|
||||
tp->step_frame_id = step_frame_id;
|
||||
+ tp->exception_resume_breakpoint
|
||||
+ = exception_resume_breakpoint;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -456,6 +462,9 @@ follow_inferior_reset_breakpoints (void)
|
||||
if (tp->step_resume_breakpoint)
|
||||
breakpoint_re_set_thread (tp->step_resume_breakpoint);
|
||||
|
||||
+ if (tp->exception_resume_breakpoint)
|
||||
+ breakpoint_re_set_thread (tp->exception_resume_breakpoint);
|
||||
+
|
||||
/* Reinsert all breakpoints in the child. The user may have set
|
||||
breakpoints after catching the fork, in which case those
|
||||
were never set in the child, but only in the parent. This makes
|
||||
@@ -694,6 +703,7 @@ follow_exec (ptid_t pid, char *execd_pathname)
|
||||
/* If there was one, it's gone now. We cannot truly step-to-next
|
||||
statement through an exec(). */
|
||||
th->step_resume_breakpoint = NULL;
|
||||
+ th->exception_resume_breakpoint = NULL;
|
||||
th->step_range_start = 0;
|
||||
th->step_range_end = 0;
|
||||
|
||||
@@ -2145,6 +2155,7 @@ delete_step_resume_breakpoint_callback (struct thread_info *info, void *data)
|
||||
return 0;
|
||||
|
||||
delete_step_resume_breakpoint (info);
|
||||
+ delete_exception_resume_breakpoint (info);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2168,6 +2179,7 @@ delete_step_thread_step_resume_breakpoint (void)
|
||||
stepping. */
|
||||
struct thread_info *tp = inferior_thread ();
|
||||
delete_step_resume_breakpoint (tp);
|
||||
+ delete_exception_resume_breakpoint (tp);
|
||||
}
|
||||
else
|
||||
/* In all-stop mode, delete all step-resume and longjmp-resume
|
||||
@@ -3832,30 +3844,31 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
"infrun: BPSTAT_WHAT_CLEAR_LONGJMP_RESUME\n");
|
||||
|
||||
- gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL);
|
||||
- delete_step_resume_breakpoint (ecs->event_thread);
|
||||
-
|
||||
- if (!what.is_longjmp)
|
||||
+ if (what.is_longjmp)
|
||||
+ {
|
||||
+ gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL);
|
||||
+ delete_step_resume_breakpoint (ecs->event_thread);
|
||||
+ }
|
||||
+ else
|
||||
{
|
||||
/* There are several cases to consider.
|
||||
-
|
||||
+
|
||||
1. The initiating frame no longer exists. In this case
|
||||
we must stop, because the exception has gone too far.
|
||||
-
|
||||
+
|
||||
2. The initiating frame exists, and is the same as the
|
||||
- current frame.
|
||||
-
|
||||
- 2.1. If we are stepping, defer to the stepping logic.
|
||||
-
|
||||
- 2.2. Otherwise, we are not stepping, so we are doing a
|
||||
- "finish" and we have reached the calling frame. So,
|
||||
- stop.
|
||||
-
|
||||
+ current frame. We stop, because the exception has been
|
||||
+ caught.
|
||||
+
|
||||
3. The initiating frame exists and is different from
|
||||
the current frame. This means the exception has been
|
||||
caught beneath the initiating frame, so keep going. */
|
||||
struct frame_info *init_frame
|
||||
= frame_find_by_id (ecs->event_thread->initiating_frame);
|
||||
+
|
||||
+ gdb_assert (ecs->event_thread->exception_resume_breakpoint != NULL);
|
||||
+ delete_exception_resume_breakpoint (ecs->event_thread);
|
||||
+
|
||||
if (init_frame)
|
||||
{
|
||||
struct frame_id current_id
|
||||
@@ -3863,15 +3876,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
|
||||
if (frame_id_eq (current_id,
|
||||
ecs->event_thread->initiating_frame))
|
||||
{
|
||||
- if (ecs->event_thread->step_range_start)
|
||||
- {
|
||||
- /* Case 2.1. */
|
||||
- break;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- /* Case 2.2: fall through. */
|
||||
- }
|
||||
+ /* Case 2. Fall through. */
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3880,6 +3885,10 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ /* For Cases 1 and 2, remove the step-resume breakpoint,
|
||||
+ if it exists. */
|
||||
+ delete_step_resume_breakpoint (ecs->event_thread);
|
||||
}
|
||||
|
||||
ecs->event_thread->stop_step = 1;
|
||||
@@ -4930,10 +4939,6 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
|
||||
{
|
||||
handler = value_as_address (value);
|
||||
|
||||
- /* We're going to replace the current step-resume breakpoint
|
||||
- with an exception-resume breakpoint. */
|
||||
- delete_step_resume_breakpoint (tp);
|
||||
-
|
||||
if (debug_infrun)
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
"infrun: exception resume at %lx\n",
|
||||
@@ -4941,7 +4946,7 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
|
||||
|
||||
bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),
|
||||
handler, bp_exception_resume);
|
||||
- inferior_thread ()->step_resume_breakpoint = bp;
|
||||
+ inferior_thread ()->exception_resume_breakpoint = bp;
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/gdb/testsuite/gdb.cp/gdb9593.exp b/gdb/testsuite/gdb.cp/gdb9593.exp
|
||||
index ee9aeff..c77dbd8 100644
|
||||
--- a/gdb/testsuite/gdb.cp/gdb9593.exp
|
||||
+++ b/gdb/testsuite/gdb.cp/gdb9593.exp
|
||||
@@ -145,7 +145,7 @@ gdb_test "step" \
|
||||
"step into finish, for until"
|
||||
|
||||
gdb_test "until" \
|
||||
- ".*catch .int x.*" \
|
||||
+ ".*function1 ().*" \
|
||||
"until with no argument 1"
|
||||
|
||||
set line [gdb_get_line_number "marker for until" $testfile.cc]
|
||||
diff --git a/gdb/thread.c b/gdb/thread.c
|
||||
index 16a207c..3c52ae4 100644
|
||||
--- a/gdb/thread.c
|
||||
+++ b/gdb/thread.c
|
||||
@@ -90,6 +90,16 @@ delete_step_resume_breakpoint (struct thread_info *tp)
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
+delete_exception_resume_breakpoint (struct thread_info *tp)
|
||||
+{
|
||||
+ if (tp && tp->exception_resume_breakpoint)
|
||||
+ {
|
||||
+ delete_breakpoint (tp->exception_resume_breakpoint);
|
||||
+ tp->exception_resume_breakpoint = NULL;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void
|
||||
clear_thread_inferior_resources (struct thread_info *tp)
|
||||
{
|
1179
gdb-upstream.patch
Normal file
1179
gdb-upstream.patch
Normal file
File diff suppressed because it is too large
Load Diff
214
gdb-using-directive-leak.patch
Normal file
214
gdb-using-directive-leak.patch
Normal file
@ -0,0 +1,214 @@
|
||||
FSF GDB variant is at:
|
||||
http://sourceware.org/ml/gdb-patches/2010-03/msg00789.html
|
||||
|
||||
commit 56b45f494f647360f9d6ff84f12f59c08cbe05af
|
||||
Author: Sami Wagiaalla <swagiaal@redhat.com>
|
||||
Date: Mon Mar 29 16:08:58 2010 -0400
|
||||
|
||||
Fix using_directive memory leak.
|
||||
|
||||
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
|
||||
index ff2c9b1..35e4663 100644
|
||||
--- a/gdb/buildsym.c
|
||||
+++ b/gdb/buildsym.c
|
||||
@@ -387,6 +387,7 @@ finish_block (struct symbol *symbol, struct pending **listhead,
|
||||
}
|
||||
|
||||
block_set_using (block, using_directives, &objfile->objfile_obstack);
|
||||
+ using_directives = NULL;
|
||||
|
||||
record_pending_block (objfile, block, opblock);
|
||||
|
||||
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
|
||||
index 6325ead..c6df91f 100644
|
||||
--- a/gdb/cp-namespace.c
|
||||
+++ b/gdb/cp-namespace.c
|
||||
@@ -120,7 +120,8 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol)
|
||||
anonymous namespace. So add symbols in it to the
|
||||
namespace given by the previous component if there is
|
||||
one, or to the global namespace if there isn't. */
|
||||
- cp_add_using_directive (dest, src, NULL, "", 0);
|
||||
+ cp_add_using_directive (dest, src, NULL, "", 0,
|
||||
+ &SYMBOL_SYMTAB (symbol)->objfile->objfile_obstack);
|
||||
}
|
||||
/* The "+ 2" is for the "::". */
|
||||
previous_component = next_component + 2;
|
||||
@@ -132,11 +133,17 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol)
|
||||
}
|
||||
|
||||
/* Add a using directive to using_list. If the using directive in question
|
||||
- has already been added, don't add it twice. */
|
||||
+ has already been added, don't add it twice.
|
||||
+ Create a new struct using_direct which imports the namespace SRC into the
|
||||
+ scope DEST. ALIAS is the name of the imported namespace in the current
|
||||
+ scope. If ALIAS is NULL then the namespace is known by its original name.
|
||||
+ The arguments are copied into newly allocated memory so they can be
|
||||
+ temporaries. */
|
||||
|
||||
void
|
||||
cp_add_using_directive (const char *dest, const char *src, const char *alias,
|
||||
- const char *declaration, const int line_number)
|
||||
+ const char *declaration, const int line_number,
|
||||
+ struct obstack *obstack)
|
||||
{
|
||||
struct using_direct *current;
|
||||
struct using_direct *new;
|
||||
@@ -146,12 +153,26 @@ cp_add_using_directive (const char *dest, const char *src, const char *alias,
|
||||
for (current = using_directives; current != NULL; current = current->next)
|
||||
{
|
||||
if (strcmp (current->import_src, src) == 0
|
||||
- && strcmp (current->import_dest, dest) == 0)
|
||||
+ && strcmp (current->import_dest, dest) == 0
|
||||
+ && ((alias == NULL && current->alias == NULL)
|
||||
+ || (alias != NULL && current->alias != NULL
|
||||
+ && strcmp (alias, current->alias) == 0)))
|
||||
return;
|
||||
}
|
||||
|
||||
- using_directives = cp_add_using (dest, src, alias, declaration,
|
||||
- line_number, using_directives);
|
||||
+ new = OBSTACK_ZALLOC (obstack, struct using_direct);
|
||||
+
|
||||
+ new->import_src = obsavestring (src, strlen (src), obstack);
|
||||
+ new->import_dest = obsavestring (dest, strlen (dest), obstack);
|
||||
+
|
||||
+ if (alias != NULL)
|
||||
+ new->alias = obsavestring (alias, strlen (alias), obstack);
|
||||
+
|
||||
+ new->declaration = obsavestring (declaration, strlen (declaration), obstack);
|
||||
+ new->line_number = line_number;
|
||||
+
|
||||
+ new->next = using_directives;
|
||||
+ using_directives = new;
|
||||
|
||||
}
|
||||
|
||||
@@ -203,42 +224,6 @@ cp_is_anonymous (const char *namespace)
|
||||
!= NULL);
|
||||
}
|
||||
|
||||
-/* Create a new struct using direct which imports the namespace SRC
|
||||
- into the scope DEST. ALIAS is the name of the imported namespace
|
||||
- in the current scope. If ALIAS is NULL then the
|
||||
- namespace is known by its original name.
|
||||
-
|
||||
- Set its next member in the linked list to NEXT; allocate all memory
|
||||
- using xmalloc. It copies the strings, so NAME can be a temporary
|
||||
- string. */
|
||||
-
|
||||
-struct using_direct *
|
||||
-cp_add_using (const char *dest,
|
||||
- const char *src,
|
||||
- const char *alias,
|
||||
- const char *declaration,
|
||||
- const int line_number,
|
||||
- struct using_direct *next)
|
||||
-{
|
||||
- struct using_direct *retval;
|
||||
-
|
||||
- retval = xmalloc (sizeof (struct using_direct));
|
||||
- retval->import_src = savestring (src, strlen (src));
|
||||
- retval->import_dest = savestring (dest, strlen (dest));
|
||||
-
|
||||
- if (alias != NULL)
|
||||
- retval->alias = savestring (alias, strlen (alias));
|
||||
- else
|
||||
- retval->alias = NULL;
|
||||
-
|
||||
- retval->declaration = savestring (declaration, strlen (declaration));
|
||||
- retval->line_number = line_number;
|
||||
- retval->next = next;
|
||||
- retval->searched = 0;
|
||||
-
|
||||
- return retval;
|
||||
-}
|
||||
-
|
||||
/* The C++-specific version of name lookup for static and global
|
||||
names. This makes sure that names get looked for in all namespaces
|
||||
that are in scope. NAME is the natural name of the symbol that
|
||||
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
|
||||
index 57aa5e5..41f17fe 100644
|
||||
--- a/gdb/cp-support.h
|
||||
+++ b/gdb/cp-support.h
|
||||
@@ -101,14 +101,8 @@ extern void cp_add_using_directive (const char *dest,
|
||||
const char *src,
|
||||
const char *alias,
|
||||
const char *declaration,
|
||||
- const int line_number);
|
||||
-
|
||||
-extern struct using_direct *cp_add_using (const char *dest,
|
||||
- const char *src,
|
||||
- const char *alias,
|
||||
- const char *declaration,
|
||||
- const int line_number,
|
||||
- struct using_direct *next);
|
||||
+ const int line_number,
|
||||
+ struct obstack *obstack);
|
||||
|
||||
extern void cp_initialize_namespace (void);
|
||||
|
||||
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
index e3a780e..b73f444 100644
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -3563,12 +3563,12 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
|
||||
}
|
||||
}
|
||||
|
||||
- using_directives = cp_add_using (import_prefix,
|
||||
- canonical_name,
|
||||
- import_alias,
|
||||
- imported_declaration,
|
||||
- line_number,
|
||||
- using_directives);
|
||||
+ cp_add_using_directive (import_prefix,
|
||||
+ canonical_name,
|
||||
+ import_alias,
|
||||
+ imported_declaration,
|
||||
+ line_number,
|
||||
+ &cu->objfile->objfile_obstack);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -5703,7 +5703,12 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
|
||||
if (is_anonymous)
|
||||
{
|
||||
const char *previous_prefix = determine_prefix (die, cu);
|
||||
- cp_add_using_directive (previous_prefix, TYPE_NAME (type), NULL, "", dwarf2_read_decl_line(die, cu));
|
||||
+ cp_add_using_directive (previous_prefix,
|
||||
+ TYPE_NAME (type),
|
||||
+ NULL,
|
||||
+ "",
|
||||
+ dwarf2_read_decl_line(die, cu),
|
||||
+ &objfile->objfile_obstack);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.cp/gdb2384-base.cc b/gdb/testsuite/gdb.cp/gdb2384-base.cc
|
||||
index 09ed04e..b58f30d 100644
|
||||
--- a/gdb/testsuite/gdb.cp/gdb2384-base.cc
|
||||
+++ b/gdb/testsuite/gdb.cp/gdb2384-base.cc
|
||||
@@ -23,6 +23,8 @@ base::base (int _x)
|
||||
{
|
||||
}
|
||||
|
||||
+using namespace B;
|
||||
+
|
||||
int
|
||||
base::meth ()
|
||||
{
|
||||
diff --git a/gdb/testsuite/gdb.cp/gdb2384-base.h b/gdb/testsuite/gdb.cp/gdb2384-base.h
|
||||
index b09701e..981943c 100644
|
||||
--- a/gdb/testsuite/gdb.cp/gdb2384-base.h
|
||||
+++ b/gdb/testsuite/gdb.cp/gdb2384-base.h
|
||||
@@ -16,6 +16,10 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
+namespace B{
|
||||
+ int x;
|
||||
+}
|
||||
+
|
||||
class base
|
||||
{
|
||||
public:
|
367
gdb.spec
367
gdb.spec
@ -32,17 +32,18 @@ Name: gdb%{?_with_debug:-debug}
|
||||
# Set version to contents of gdb/version.in.
|
||||
# NOTE: the FSF gdb versions are numbered N.M for official releases, like 6.3
|
||||
# and, since January 2005, X.Y.Z.date for daily snapshots, like 6.3.50.20050112 # (daily snapshot from mailine), or 6.3.0.20040112 (head of the release branch).
|
||||
Version: 7.0.50.20100203
|
||||
Version: 7.1
|
||||
|
||||
# The release always contains a leading reserved number, start it at 1.
|
||||
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
|
||||
Release: 15%{?_with_upstream:.upstream}%{dist}
|
||||
Release: 28%{?_with_upstream:.upstream}%{dist}
|
||||
|
||||
License: GPLv3+
|
||||
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and GFDL and BSD and Public Domain
|
||||
Group: Development/Debuggers
|
||||
# Do not provide URL for snapshots as the file lasts there only for 2 days.
|
||||
# ftp://sourceware.org/pub/gdb/snapshots/branch/gdb-%{version}.tar.bz2
|
||||
# ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.bz2
|
||||
Source: ftp://sourceware.org/pub/gdb/snapshots/branch/gdb-%{version}.tar.bz2
|
||||
Source: ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.bz2
|
||||
Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
||||
URL: http://gnu.org/software/gdb/
|
||||
|
||||
@ -118,7 +119,6 @@ Patch118: gdb-6.3-gstack-20050411.patch
|
||||
|
||||
# VSYSCALL and PIE
|
||||
Patch122: gdb-6.3-test-pie-20050107.patch
|
||||
Patch124: gdb-archer-pie-0315-breakpoint_address_match.patch
|
||||
Patch389: gdb-archer-pie-addons.patch
|
||||
Patch394: gdb-archer-pie-addons-keep-disabled.patch
|
||||
|
||||
@ -183,10 +183,6 @@ Patch170: gdb-6.3-bt-past-zero-20051201.patch
|
||||
# Use bigger numbers than int.
|
||||
Patch176: gdb-6.3-large-core-20051206.patch
|
||||
|
||||
# Hard-code executable names in gstack, such that it can run with a
|
||||
# corrupted or missing PATH.
|
||||
Patch177: gdb-6.3-gstack-without-path-20060414.patch
|
||||
|
||||
# Fix debuginfo addresses resolving for --emit-relocs Linux kernels (BZ 203661).
|
||||
Patch188: gdb-6.5-bz203661-emit-relocs.patch
|
||||
|
||||
@ -224,8 +220,7 @@ Patch213: gdb-6.5-readline-long-line-crash-test.patch
|
||||
# Fix bogus 0x0 unwind of the thread's topmost function clone(3) (BZ 216711).
|
||||
Patch214: gdb-6.5-bz216711-clone-is-outermost.patch
|
||||
|
||||
# Try to reduce sideeffects of skipping ppc .so libs trampolines (BZ 218379).
|
||||
Patch215: gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch
|
||||
# Test sideeffects of skipping ppc .so libs trampolines (BZ 218379).
|
||||
Patch216: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
|
||||
|
||||
# Fix lockup on trampoline vs. its function lookup; unreproducible (BZ 218379).
|
||||
@ -241,7 +236,7 @@ Patch229: gdb-6.3-bz140532-ppc-unwinding-test.patch
|
||||
Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch
|
||||
|
||||
# Backported fixups post the source tarball.
|
||||
#Patch232: gdb-upstream.patch
|
||||
Patch232: gdb-upstream.patch
|
||||
|
||||
# Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
|
||||
Patch234: gdb-6.6-bz230000-power6-disassembly-test.patch
|
||||
@ -344,13 +339,6 @@ Patch324: gdb-6.8-glibc-headers-compat.patch
|
||||
# Create a single binary `gdb' autodetecting --tui by its argv[0].
|
||||
Patch326: gdb-6.8-tui-singlebinary.patch
|
||||
|
||||
# Support transparent debugging of inlined functions for an optimized code.
|
||||
# Disable break-by-name on inlined functions due to a regression on parameters
|
||||
# of inlined functions falsely <optimized out> (BZ 556975 Comment 8).
|
||||
# Disable addon (finish) due to inline-cmds.exp: up from outer_inline2 assert.
|
||||
Patch350: gdb-6.8-inlining-addon.patch
|
||||
Patch328: gdb-6.8-inlining-by-name.patch
|
||||
|
||||
# Fix PRPSINFO in the core files dumped by gcore (BZ 254229).
|
||||
Patch329: gdb-6.8-bz254229-gcore-prpsinfo.patch
|
||||
|
||||
@ -374,6 +362,7 @@ Patch348: gdb-6.8-bz466901-backtrace-full-prelinked.patch
|
||||
|
||||
# The merged branch `archer' of: http://sourceware.org/gdb/wiki/ProjectArcher
|
||||
Patch349: gdb-archer.patch
|
||||
Patch420: gdb-archer-ada.patch
|
||||
|
||||
# Fix parsing elf64-i386 files for kdump PAE vmcore dumps (BZ 457187).
|
||||
# - Turn on 64-bit BFD support, globally enable AC_SYS_LARGEFILE.
|
||||
@ -385,9 +374,6 @@ Patch381: gdb-simultaneous-step-resume-breakpoint-test.patch
|
||||
# Fix GNU/Linux core open: Can't read pathname for load map: Input/output error.
|
||||
Patch382: gdb-core-open-vdso-warning.patch
|
||||
|
||||
# Fix callback-mode readline-6.0 regression for CTRL-C.
|
||||
Patch390: gdb-readline-6.0-signal.patch
|
||||
|
||||
# Fix syscall restarts for amd64->i386 biarch.
|
||||
Patch391: gdb-x86_64-i386-syscall-restart.patch
|
||||
|
||||
@ -404,9 +390,6 @@ Patch335: gdb-rhel5-compat.patch
|
||||
# Fix regression by python on ia64 due to stale current frame.
|
||||
Patch397: gdb-follow-child-stale-parent.patch
|
||||
|
||||
# Fix related_breakpoint stale ref crash.
|
||||
Patch400: gdb-stale-related_breakpoint.patch
|
||||
|
||||
# Workaround ccache making lineno non-zero for command-line definitions.
|
||||
Patch403: gdb-ccache-workaround.patch
|
||||
|
||||
@ -429,6 +412,121 @@ Patch412: gdb-unused-revert.patch
|
||||
# Fix i386+x86_64 rwatch+awatch before run, regression against 6.8 (BZ 541866).
|
||||
Patch417: gdb-bz541866-rwatch-before-run.patch
|
||||
|
||||
# Remove false gdb_assert on $sp underflow.
|
||||
Patch422: gdb-infcall-sp-underflow.patch
|
||||
|
||||
# Fix double-free on std::terminate handler (Tom Tromey, BZ 562975).
|
||||
Patch429: gdb-bz562975-std-terminate-double-free.patch
|
||||
|
||||
# PIE: Fix back re-reun.
|
||||
Patch430: gdb-pie-rerun.patch
|
||||
|
||||
# Do not consider memory error on reading _r_debug->r_map as fatal (BZ 576742).
|
||||
Patch432: gdb-solib-memory-error-nonfatal.patch
|
||||
|
||||
# testsuite: Fix unstable results of gdb.base/prelink.exp.
|
||||
Patch433: gdb-6.7-testsuite-stable-results-prelink.patch
|
||||
|
||||
# [patch 1/6] PIE: Attach binary even after re-prelinked underneath
|
||||
# [patch 2/6] PIE: Attach binary even after ld.so re-prelinked underneath
|
||||
# [patch 3/6] PIE: Fix occasional error attaching i686 binary
|
||||
Patch434: gdb-pie-1of6-reprelinked-bin.patch
|
||||
Patch435: gdb-pie-2of6-reprelinked-ld.patch
|
||||
Patch436: gdb-pie-3of6-relocate-once.patch
|
||||
|
||||
# [expr-cumulative] using-directive: Fix memory leak (Sami Wagiaalla).
|
||||
Patch437: gdb-using-directive-leak.patch
|
||||
|
||||
# Fix dangling displays in separate debuginfo (BZ 574483).
|
||||
Patch438: gdb-bz574483-display-sepdebug.patch
|
||||
|
||||
# Support AVX registers (BZ 578250).
|
||||
Patch439: gdb-bz578250-avx-01of10.patch
|
||||
Patch440: gdb-bz578250-avx-02of10.patch
|
||||
Patch441: gdb-bz578250-avx-03of10.patch
|
||||
Patch442: gdb-bz578250-avx-04of10.patch
|
||||
Patch443: gdb-bz578250-avx-05of10.patch
|
||||
Patch444: gdb-bz578250-avx-06of10.patch
|
||||
Patch445: gdb-bz578250-avx-07of10.patch
|
||||
Patch446: gdb-bz578250-avx-08of10.patch
|
||||
Patch447: gdb-bz578250-avx-09of10.patch
|
||||
Patch448: gdb-bz578250-avx-10of10.patch
|
||||
Patch449: gdb-bz578250-avx-10of10-ppc.patch
|
||||
|
||||
# Fix crash on C++ types in some debug info files (BZ 575292, Keith Seitz).
|
||||
# Temporarily workaround the crash of BZ 575292 as there was now BZ 585445.
|
||||
# Re-enable the BZ 575292 and BZ 585445 C++ fix using an updated patch.
|
||||
Patch451: gdb-bz575292-delayed-physname.patch
|
||||
Patch455: gdb-bz575292-void-workaround.patch
|
||||
|
||||
# Pretty printers not well documented (BZ 570635, Tom Tromey, Jan Kratochvil).
|
||||
Patch452: gdb-bz570635-prettyprint-doc1.patch
|
||||
Patch453: gdb-bz570635-prettyprint-doc2.patch
|
||||
|
||||
# Fix crash when using GNU IFUNC call from breakpoint condition.
|
||||
Patch454: gdb-bz539590-gnu-ifunc-fix-cond.patch
|
||||
|
||||
# Fail gracefully if the _Unwind_DebugHook arg. is optimized out (Tom Tromey).
|
||||
# Make _Unwind_DebugHook independent from step-resume breakpoint (Tom Tromey).
|
||||
Patch456: gdb-unwind-debughook-safe-fail.patch
|
||||
Patch457: gdb-unwind-debughook-step-independent.patch
|
||||
|
||||
# testsuite: Fix gdb.base/vla-overflow.exp FAILing on s390x (BZ 590635).
|
||||
Patch458: gdb-archer-vla-test-oom.patch
|
||||
|
||||
# Workaround non-stop moribund locations exploited by kernel utrace (BZ 590623).
|
||||
Patch459: gdb-moribund-utrace-workaround.patch
|
||||
|
||||
# Fix crash on VLA bound referencing an optimized-out variable (BZ 591879).
|
||||
Patch460: gdb-archer-vla-ref-optimizedout.patch
|
||||
|
||||
# Remove core file when starting a process (BZ 594560).
|
||||
Patch461: gdb-bz594560-core-vs-process.patch
|
||||
|
||||
# Import fix of TUI layout internal error (BZ 595475).
|
||||
Patch462: gdb-bz595475-tui-layout.patch
|
||||
|
||||
# Fix and support DW_OP_*piece (Tom Tromey, BZ 589467).
|
||||
Patch463: gdb-bz589467-pieces01of4.patch
|
||||
Patch464: gdb-bz589467-pieces02of4.patch
|
||||
Patch465: gdb-bz589467-pieces03of4.patch
|
||||
Patch466: gdb-bz589467-pieces1of4.patch
|
||||
Patch467: gdb-bz589467-pieces2of4.patch
|
||||
Patch468: gdb-bz589467-pieces3of4.patch
|
||||
Patch469: gdb-bz589467-pieces4of4.patch
|
||||
Patch471: gdb-bz589467-pieces-vla-compat.patch
|
||||
|
||||
# Fix follow-exec for C++ programs (bugreported by Martin Stransky).
|
||||
Patch470: gdb-archer-next-over-throw-cxx-exec.patch
|
||||
|
||||
# Fix ADL anonymous type crash (BZ 600746, Sami Wagiaalla).
|
||||
Patch472: gdb-bz600746-koenig-crash.patch
|
||||
|
||||
# Backport DWARF-4 support (BZ 601887, Tom Tromey).
|
||||
Patch473: gdb-bz601887-dwarf4-1of2.patch
|
||||
Patch474: gdb-bz601887-dwarf4-2of2.patch
|
||||
Patch475: gdb-bz601887-dwarf4-rh-test.patch
|
||||
|
||||
# Fix obstack corruptions on C++ (BZ 606185, Chris Moller, Jan Kratochvil).
|
||||
Patch476: gdb-bz606185-obstack-1of5.patch
|
||||
Patch477: gdb-bz606185-obstack-2of5.patch
|
||||
Patch478: gdb-bz606185-obstack-3of5.patch
|
||||
Patch479: gdb-bz606185-obstack-4of5.patch
|
||||
Patch480: gdb-bz606185-obstack-5of5.patch
|
||||
|
||||
# Improve support for typedefs in classes (BZ 602314).
|
||||
Patch481: gdb-bz602314-ptype-class-typedef-1of3.patch
|
||||
Patch482: gdb-bz602314-ptype-class-typedef-2of3.patch
|
||||
Patch483: gdb-bz602314-ptype-class-typedef-3of3.patch
|
||||
|
||||
# Fix `set print object on' for some non-dynamic classes (BZ 606660).
|
||||
Patch484: gdb-bz606660-print-object-nonvirtual.patch
|
||||
|
||||
# Print 2D C++ vectors as matrices (BZ 562763, sourceware10659, Chris Moller).
|
||||
Patch485: gdb-bz562763-pretty-print-2d-vectors-prereq.patch
|
||||
Patch486: gdb-bz562763-pretty-print-2d-vectors.patch
|
||||
Patch487: gdb-bz562763-pretty-print-2d-vectors-libstdcxx.patch
|
||||
|
||||
BuildRequires: ncurses-devel%{?_isa} texinfo gettext flex bison expat-devel%{?_isa}
|
||||
Requires: readline%{?_isa}
|
||||
BuildRequires: readline-devel%{?_isa}
|
||||
@ -459,7 +557,7 @@ BuildRequires: libstdc++%{?_isa}
|
||||
%define bits_other %{?_isa}
|
||||
%if 0%{!?el5:1}
|
||||
%ifarch s390x
|
||||
%define bits_other (%{__isa_name}-31)
|
||||
%define bits_other (%{__isa_name}-32)
|
||||
%else #!s390x
|
||||
%ifarch ppc
|
||||
%define bits_other (%{__isa_name}-64)
|
||||
@ -539,7 +637,8 @@ GDB, the GNU debugger, allows you to debug programs written in C, C++,
|
||||
Java, and other languages, by executing them in a controlled fashion
|
||||
and printing their data.
|
||||
|
||||
This package provides a program that allows you to run GDB on a different machine than the one which is running the program being debugged.
|
||||
This package provides a program that allows you to run GDB on a different
|
||||
machine than the one which is running the program being debugged.
|
||||
%endif # 0%{!?el5:1}
|
||||
|
||||
%prep
|
||||
@ -563,9 +662,9 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
|
||||
|
||||
%if 0%{!?_with_upstream:1}
|
||||
|
||||
#patch232 -p1
|
||||
%patch232 -p1
|
||||
%patch349 -p1
|
||||
%patch124 -p1
|
||||
%patch420 -p1
|
||||
%patch1 -p1
|
||||
%patch3 -p1
|
||||
|
||||
@ -596,7 +695,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
|
||||
%patch169 -p1
|
||||
%patch170 -p1
|
||||
%patch176 -p1
|
||||
%patch177 -p1
|
||||
%patch188 -p1
|
||||
%patch190 -p1
|
||||
%patch194 -p1
|
||||
@ -609,7 +707,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
|
||||
%patch211 -p1
|
||||
%patch213 -p1
|
||||
%patch214 -p1
|
||||
%patch215 -p1
|
||||
%patch216 -p1
|
||||
%patch217 -p1
|
||||
%patch225 -p1
|
||||
@ -651,8 +748,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
|
||||
%patch322 -p1
|
||||
%patch324 -p1
|
||||
%patch326 -p1
|
||||
###patch350 -p1
|
||||
###patch328 -p1
|
||||
%patch329 -p1
|
||||
%patch330 -p1
|
||||
%patch331 -p1
|
||||
@ -663,11 +758,9 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
|
||||
%patch360 -p1
|
||||
%patch381 -p1
|
||||
%patch382 -p1
|
||||
%patch390 -p1
|
||||
%patch391 -p1
|
||||
%patch392 -p1
|
||||
%patch397 -p1
|
||||
%patch400 -p1
|
||||
%patch403 -p1
|
||||
%patch404 -p1
|
||||
%patch405 -p1
|
||||
@ -678,6 +771,64 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
|
||||
%patch408 -p1
|
||||
%patch412 -p1
|
||||
%patch417 -p1
|
||||
%patch422 -p1
|
||||
%patch429 -p1
|
||||
%patch430 -p1
|
||||
%patch432 -p1
|
||||
%patch433 -p1
|
||||
%patch434 -p1
|
||||
%patch435 -p1
|
||||
%patch436 -p1
|
||||
%patch437 -p1
|
||||
%patch438 -p1
|
||||
%patch439 -p1
|
||||
%patch440 -p1
|
||||
%patch441 -p1
|
||||
%patch442 -p1
|
||||
%patch443 -p1
|
||||
%patch444 -p1
|
||||
%patch445 -p1
|
||||
%patch446 -p1
|
||||
%patch447 -p1
|
||||
%patch448 -p1
|
||||
%patch449 -p1
|
||||
%patch451 -p1
|
||||
%patch452 -p1
|
||||
%patch453 -p1
|
||||
%patch454 -p1
|
||||
%patch455 -p1
|
||||
%patch456 -p1
|
||||
%patch457 -p1
|
||||
%patch458 -p1
|
||||
%patch459 -p1
|
||||
%patch460 -p1
|
||||
%patch461 -p1
|
||||
%patch462 -p1
|
||||
%patch463 -p1
|
||||
%patch464 -p1
|
||||
%patch465 -p1
|
||||
%patch466 -p1
|
||||
%patch467 -p1
|
||||
%patch468 -p1
|
||||
%patch469 -p1
|
||||
%patch471 -p1
|
||||
%patch470 -p1
|
||||
%patch472 -p1
|
||||
%patch473 -p1
|
||||
%patch474 -p1
|
||||
%patch475 -p1
|
||||
%patch476 -p1
|
||||
%patch477 -p1
|
||||
%patch478 -p1
|
||||
%patch479 -p1
|
||||
%patch480 -p1
|
||||
%patch481 -p1
|
||||
%patch482 -p1
|
||||
%patch483 -p1
|
||||
%patch484 -p1
|
||||
%patch485 -p1
|
||||
%patch486 -p1
|
||||
%patch487 -p1
|
||||
|
||||
%patch415 -p1
|
||||
%patch393 -p1
|
||||
@ -685,7 +836,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
|
||||
# Patch415: gdb-6.6-buildid-locate-core-as-arg.patch
|
||||
# Currently disabled for RHEL as it is a new experimental feature not present
|
||||
# in FSF GDB and possibly affecting new user scripts.
|
||||
%if 0%{!?rhel:1}
|
||||
%if 0%{?rhel:1}
|
||||
%patch415 -p1 -R
|
||||
%endif
|
||||
%if 0%{!?el5:1}
|
||||
@ -978,7 +1129,7 @@ fi
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc COPYING COPYING.LIB README NEWS
|
||||
%doc COPYING3 COPYING COPYING.LIB README NEWS
|
||||
%{_bindir}/gcore
|
||||
%{_bindir}/gdb
|
||||
%{_bindir}/gdbtui
|
||||
@ -1010,6 +1161,148 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Sun Jul 11 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-28.fc14
|
||||
- Rebuild for Fedora 14.
|
||||
|
||||
* Wed Jun 30 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-28.fc13
|
||||
- Print 2D C++ vectors as matrices (BZ 562763, sourceware10659, Chris Moller).
|
||||
|
||||
* Wed Jun 30 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-27.fc13
|
||||
- Fix obstack corruptions on C++ (BZ 606185, Chris Moller, Jan Kratochvil).
|
||||
- Improve support for typedefs in classes (BZ 602314).
|
||||
- Fix `set print object on' for some non-dynamic classes (BZ 606660).
|
||||
|
||||
* Wed Jun 9 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-26.fc13
|
||||
- Backport DWARF-4 support (BZ 601887, Tom Tromey).
|
||||
|
||||
* Wed Jun 9 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-25.fc13
|
||||
- Fix ADL anonymous type crash (BZ 600746, Sami Wagiaalla).
|
||||
|
||||
* Tue Jun 1 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-24.fc13
|
||||
- Fix crash on /proc/PID/stat race during inferior exit (BZ 596751).
|
||||
- testsuite: gdb.threads/watchthreads-reorder.exp kernel-2.6.33 compat. fix.
|
||||
|
||||
* Sun May 30 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-23.fc13
|
||||
- Fix and support DW_OP_*piece (Tom Tromey, BZ 589467).
|
||||
- Fix follow-exec for C++ programs (bugreported by Martin Stransky).
|
||||
|
||||
* Mon May 24 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-22.fc13
|
||||
- Remove core file when starting a process (BZ 594560).
|
||||
- Fix lock up on loops in the solib chain (BZ 593926).
|
||||
- Import fix of TUI layout internal error (BZ 595475).
|
||||
|
||||
* Sun May 16 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-21.fc13
|
||||
- Make gdb-6.8-bz254229-gcore-prpsinfo.patch RHEL-5 /usr/bin/patch compatible
|
||||
(bugreported by Jonas Maebe).
|
||||
|
||||
* Thu May 13 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-20.fc13
|
||||
- Fix crash on VLA bound referencing an optimized-out variable (BZ 591879).
|
||||
- Re-enable the BZ 575292 and BZ 585445 C++ fix using an updated patch.
|
||||
|
||||
* Wed May 12 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-19.fc13
|
||||
- Backport <tab>-completion bug on anonymous structure fields (BZ 590648).
|
||||
- testsuite: Fix gdb.base/vla-overflow.exp FAILing on s390x (BZ 590635).
|
||||
- Workaround non-stop moribund locations exploited by kernel utrace (BZ 590623).
|
||||
|
||||
* Thu Apr 29 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-18.fc13
|
||||
- Make _Unwind_DebugHook independent from step-resume breakpoint (Tom Tromey).
|
||||
|
||||
* Tue Apr 27 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-17.fc13
|
||||
- Fail gracefully if the _Unwind_DebugHook arg. is optimized out (Tom Tromey).
|
||||
|
||||
* Tue Apr 27 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-16.fc13
|
||||
- Temporarily workaround the crash of BZ 575292 as there was now BZ 585445.
|
||||
|
||||
* Mon Apr 26 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-15.fc13
|
||||
- Fix crash when using GNU IFUNC call from breakpoint condition.
|
||||
- Avoid internal error by disabling the previous BZ 575292 fix (BZ 585445).
|
||||
|
||||
* Thu Apr 22 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-14.fc13
|
||||
- Fix crash on C++ types in some debug info files (BZ 575292, Keith Seitz).
|
||||
- Pretty printers not well documented (BZ 570635, Tom Tromey, Jan Kratochvil).
|
||||
|
||||
* Fri Apr 16 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-13.fc13
|
||||
- archer-jankratochvil-fedora13 commit: 39998c496988faaa1509cc6ab76b5c4777659bf4
|
||||
- [vla] Fix boundaries for arrays on -O2 -g (support bound-ref->var->loclist).
|
||||
- [vla] Fix copy_type_recursive for unavailable variables (Joost van der Sluis).
|
||||
|
||||
* Sun Apr 11 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-12.fc13
|
||||
- Fix crash on trying to load invalid executable (BZ 581215).
|
||||
|
||||
* Thu Apr 8 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-11.fc13
|
||||
- testsuite: Fix gdb.base/gstack.exp also for ppc64 inferiors (for BZ 579793).
|
||||
|
||||
* Thu Apr 8 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-10.fc13
|
||||
- Fix s390 --with testsuite Buildrequiers to be (s390-32) (BZ 580347, Cai Qian).
|
||||
|
||||
* Wed Apr 7 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-9.fc13
|
||||
- Fix gstack to print even the frame #0. New gdb.base/gstack.exp. (BZ 579793)
|
||||
- Merge gdb-6.3-gstack-without-path-20060414.p* into gdb-6.3-gstack-20050411.p*,
|
||||
no real code change.
|
||||
|
||||
* Mon Apr 5 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-8.fc13
|
||||
- Fix breakpoint at *_start (BZ 162775, bugreport by John Reiser).
|
||||
|
||||
* Sat Apr 3 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-7.fc13
|
||||
- Fix ppc build of the AVX registers support (for BZ 578250).
|
||||
|
||||
* Sat Apr 3 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-6.fc13
|
||||
- Support AVX registers (BZ 578250).
|
||||
|
||||
* Sat Apr 3 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-5.fc13
|
||||
- Fix dangling displays in separate debuginfo (BZ 574483).
|
||||
|
||||
* Wed Mar 31 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-4.fc13
|
||||
- Remove gdb-readline-6.0-signal.patch with a bug causing crash while no longer
|
||||
required with F-13 readline-6.1 (BZ 575516)
|
||||
|
||||
* Mon Mar 29 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-3.fc13
|
||||
- [expr-cumulative] using-directive: Fix memory leak (Sami Wagiaalla).
|
||||
|
||||
* Mon Mar 29 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-2.fc13
|
||||
- Drop obsoleted `gdb-archer-pie-0315-breakpoint_address_match.patch'.
|
||||
- Do not consider memory error on reading _r_debug->r_map as fatal (BZ 576742).
|
||||
- PIE: Attach binary even after re-prelinked underneath.
|
||||
- PIE: Attach binary even after ld.so re-prelinked underneath.
|
||||
- PIE: Fix occasional error attaching i686 binary (BZ 576742).
|
||||
- testsuite: Fix unstable results of gdb.base/prelink.exp.
|
||||
|
||||
* Thu Mar 25 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-1.fc13
|
||||
- Update to new FSF GDB release.
|
||||
|
||||
* Mon Mar 15 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.0.90.20100312-24.fc13
|
||||
- Drop gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch having false symbols
|
||||
resolving (related to BZ 573277).
|
||||
|
||||
* Fri Mar 12 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.0.90.20100312-23.fc13
|
||||
- Update to new FSF GDB snapshot.
|
||||
- Fix double-free on std::terminate handler (Tom Tromey, BZ 562975).
|
||||
|
||||
* Wed Mar 10 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.0.90.20100306-22.fc13
|
||||
- Another License update.
|
||||
|
||||
* Wed Mar 10 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.0.90.20100306-21.fc13
|
||||
- Update License for all the licenses contained in .src.rpm.
|
||||
|
||||
* Mon Mar 8 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.0.90.20100306-20.fc13
|
||||
- Remove unapplied: gdb-6.8-inlining-addon.patch gdb-6.8-inlining-by-name.patch
|
||||
|
||||
* Mon Mar 8 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.0.90.20100306-19.fc13
|
||||
- Include also %%doc COPYING3 (review by Petr Machata).
|
||||
- Remove URL for Source (review by Matej Cepl).
|
||||
|
||||
* Sun Mar 7 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.0.90.20100306-18.fc13
|
||||
- archer-jankratochvil-fedora13 commit: 59c35a31f0981a0f0b884b32c91ae6325b2126cd
|
||||
|
||||
* Sun Feb 28 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.0.50.20100203-17.fc13
|
||||
- Fix false warning: section .gnu.liblist not found in ...
|
||||
- Fix crash on stale addrinfo->sectindex (more sensitive due to the PIE patch).
|
||||
|
||||
* Fri Feb 26 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.0.50.20100203-16.fc13
|
||||
- Fix ia64 part of the bt-clone-stop.exp fix.
|
||||
- Fix gdb.ada/* regressions (Keith Seitz).
|
||||
- Remove false gdb_assert on $sp underflow.
|
||||
|
||||
* Mon Feb 8 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.0.50.20100203-15.fc13
|
||||
- Fix i386+x86_64 rwatch+awatch before run, regression against 6.8 (BZ 541866).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user