fix gdb for sparcv9 and sparc64

This commit is contained in:
Tom Callaway 2008-05-15 21:16:19 +00:00
parent 4824eeeeb5
commit dccf7f213b
2 changed files with 119 additions and 5 deletions

97
gdb-6.8-sparc-fix.patch Normal file
View File

@ -0,0 +1,97 @@
diff -up gdb-6.8/gdb/sparc64-linux-tdep.c.sparc gdb-6.8/gdb/sparc64-linux-tdep.c
--- gdb-6.8/gdb/sparc64-linux-tdep.c.sparc 2008-01-01 16:53:13.000000000 -0600
+++ gdb-6.8/gdb/sparc64-linux-tdep.c 2008-05-15 14:08:57.000000000 -0500
@@ -174,6 +174,30 @@ sparc64_linux_collect_core_fpregset (con
sparc64_collect_fpregset (regcache, regnum, fpregs);
}
+/* Set the program counter for process PTID to PC. */
+
+static void
+sparc64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+ ULONGEST state;
+
+ regcache_cooked_write_unsigned (regcache, tdep->pc_regnum, pc);
+ regcache_cooked_write_unsigned (regcache, tdep->npc_regnum, pc + 4);
+
+ /* Clear the "in syscall" bit to prevent the kernel from
+ messing with the PCs we just installed, if we happen to be
+ within an interrupted system call that the kernel wants to
+ restart.
+
+ Note that after we return from the dummy call, the TSTATE et al.
+ registers will be automatically restored, and the kernel
+ continues to restart the system call at this point. */
+ regcache_cooked_read_unsigned (regcache, SPARC64_STATE_REGNUM, &state);
+ state &= ~((ULONGEST)0x20);
+ regcache_cooked_write_unsigned (regcache, SPARC64_STATE_REGNUM, state);
+}
+
static void
@@ -211,6 +235,8 @@ sparc64_linux_init_abi (struct gdbarch_i
/* Make sure we can single-step over signal return system calls. */
tdep->step_trap = sparc64_linux_step_trap;
+
+ set_gdbarch_write_pc (gdbarch, sparc64_linux_write_pc);
}
diff -up gdb-6.8/gdb/sparc-linux-tdep.c.sparc gdb-6.8/gdb/sparc-linux-tdep.c
--- gdb-6.8/gdb/sparc-linux-tdep.c.sparc 2008-01-01 16:53:13.000000000 -0600
+++ gdb-6.8/gdb/sparc-linux-tdep.c 2008-05-15 14:08:12.000000000 -0500
@@ -211,6 +211,30 @@ sparc32_linux_collect_core_fpregset (con
sparc32_collect_fpregset (regcache, regnum, fpregs);
}
+/* Set the program counter for process PTID to PC. */
+
+static void
+sparc_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+ ULONGEST psr;
+
+ regcache_cooked_write_unsigned (regcache, tdep->pc_regnum, pc);
+ regcache_cooked_write_unsigned (regcache, tdep->npc_regnum, pc + 4);
+
+ /* Clear the "in syscall" bit to prevent the kernel from
+ messing with the PCs we just installed, if we happen to be
+ within an interrupted system call that the kernel wants to
+ restart.
+
+ Note that after we return from the dummy call, the PSR et al.
+ registers will be automatically restored, and the kernel
+ continues to restart the system call at this point. */
+ regcache_cooked_read_unsigned (regcache, SPARC32_PSR_REGNUM, &psr);
+ psr &= ~0x000004000;
+ regcache_cooked_write_unsigned (regcache, SPARC32_PSR_REGNUM, psr);
+}
+
static void
@@ -238,10 +262,6 @@ sparc32_linux_init_abi (struct gdbarch_i
prologue analysis. */
tdep->plt_entry_size = 12;
- /* GNU/Linux doesn't support the 128-bit `long double' from the psABI. */
- set_gdbarch_long_double_bit (gdbarch, 64);
- set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
-
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
@@ -251,6 +271,8 @@ sparc32_linux_init_abi (struct gdbarch_i
/* Hook in the DWARF CFI frame unwinder. */
frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
+
+ set_gdbarch_write_pc (gdbarch, sparc_linux_write_pc);
}
/* Provide a prototype to silence -Wmissing-prototypes. */

View File

@ -13,9 +13,9 @@ Version: 6.8
# 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: 5cvspost%{?_with_upstream:.upstream}%{?dist}
Release: 6%{?_with_upstream:.upstream}%{?dist}
License: GPL
License: GPLv3+
Group: Development/Debuggers
Source: ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.bz2
Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
@ -349,6 +349,9 @@ Patch314: gdb-6.3-watchpoint-cond-gone-test.patch
# Test various forms of threads tracking across exec() (BZ 442765).
Patch315: gdb-6.8-bz442765-threaded-exec-test.patch
# Enable program counter for processing PTID to PC (sparc/sparc64)
Patch316: gdb-6.8-sparc-fix.patch
BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu gettext
BuildRequires: flex bison sharutils expat-devel
Requires: readline
@ -365,11 +368,11 @@ BuildRequires: gcc gcc-c++ gcc-gfortran gcc-java gcc-objc fpc
# Copied from gcc-4.1.2-32
%ifarch %{ix86} x86_64 ia64 ppc alpha
BuildRequires: gcc-gnat
%ifarch %{multilib_64_archs} sparc ppc
%ifarch %{multilib_64_archs} ppc
BuildRequires: %{_exec_prefix}/lib64/libgnat-4.3.so %{_exec_prefix}/lib/libgnat-4.3.so
%endif
%endif
%ifarch %{multilib_64_archs} sparc ppc
%ifarch %{multilib_64_archs} sparc sparcv9 ppc
BuildRequires: /lib/libc.so.6 %{_exec_prefix}/lib/libc.so /lib64/libc.so.6 %{_exec_prefix}/lib64/libc.so
BuildRequires: /lib/libgcc_s.so.1 /lib64/libgcc_s.so.1
BuildRequires: %{_exec_prefix}/lib/libstdc++.so.6 %{_exec_prefix}/lib64/libstdc++.so.6
@ -383,8 +386,11 @@ BuildRequires: %{_exec_prefix}/lib64/libz.so %{_exec_prefix}/lib/libz.so
BuildRequires: libunwind-devel >= 0.99-0.1.frysk20070405cvs
Requires: libunwind >= 0.99-0.1.frysk20070405cvs
%else
# Prelink is broken on sparcv9/sparc64
%ifnarch sparcv9 sparc64
BuildRequires: prelink
%endif
%endif
Requires(post): /sbin/install-info
Requires(preun): /sbin/install-info
@ -521,6 +527,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch311 -p1
%patch314 -p1
%patch315 -p1
%patch316 -p1
%patch124 -p1
find -name "*.orig" | xargs rm -f
@ -571,7 +578,7 @@ CFLAGS="$CFLAGS -O0 -ggdb2"
--mandir=%{_mandir} \
--infodir=%{_infodir} \
--enable-gdb-build-warnings=,-Wno-unused \
%ifnarch %{ix86} alpha ia64 ppc s390 s390x x86_64 ppc64
%ifnarch %{ix86} alpha ia64 ppc s390 s390x x86_64 ppc64 sparcv9 sparc64
--disable-werror \
%else
%if 0%{?_with_upstream:1}
@ -593,7 +600,11 @@ CFLAGS="$CFLAGS -O0 -ggdb2"
%if 0%{?_with_debug:1}
--enable-static --disable-shared --enable-debug \
%endif
%ifarch sparcv9
sparc-%{_vendor}-%{_target_os}%{?_gnu}
%else
%{_target_platform}
%endif
make %{?_smp_mflags}
make %{?_smp_mflags} info
@ -759,11 +770,17 @@ fi
# don't include the files in include, they are part of binutils
%ifnarch sparcv9 sparc64
%files gdbserver
%{_bindir}/gdbserver
%{_mandir}/*/gdbserver.1*
%endif
%changelog
* Thu May 15 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 6.8-6
- patch from DaveM for sparc/sparc64
- touch up spec to enable sparcv9/sparc64
* Sat May 3 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-5cvspost
- Fix gdb.base/gcore-shmid0.exp to be unresolved on recent kernels.
- Make the testsuite results of dfp-test.exp more stable.