- Fixed compatibility with the Rawhide glibc open(2) syscall sanity
checking. - Update the core_dump_elf_headers=1 compatibility code to the upstream variant.
This commit is contained in:
parent
7a31f8b0c5
commit
daafa059ee
@ -662,3 +662,32 @@ diff -u -rup gdb-6.6-orig/gdb/utils.c gdb-6.6/gdb/utils.c
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
--- ./gdb/gdbserver/gdbreplay.c 29 Mar 2007 01:06:47 -0000 1.14
|
||||
+++ ./gdb/gdbserver/gdbreplay.c 8 Aug 2007 20:32:12 -0000
|
||||
@@ -358,7 +358,12 @@ expect (FILE *fp)
|
||||
{
|
||||
break;
|
||||
}
|
||||
- read (remote_desc, &fromgdb, 1);
|
||||
+ if (read (remote_desc, &fromgdb, 1) != 1)
|
||||
+ {
|
||||
+ /* Error gets reported below. */
|
||||
+ fromlog = 0;
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
while (fromlog == fromgdb);
|
||||
if (fromlog != EOL)
|
||||
@@ -385,7 +390,11 @@ play (FILE *fp)
|
||||
while ((fromlog = logchar (fp)) != EOL)
|
||||
{
|
||||
ch = fromlog;
|
||||
- write (remote_desc, &ch, 1);
|
||||
+ if (write (remote_desc, &ch, 1) != 1)
|
||||
+ {
|
||||
+ sync_error (fp, "Sync error during write of gdb packet", ch, 0);
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,28 +1,116 @@
|
||||
Compatibility with: linux-2.6-elf-core-sysctl.patch
|
||||
fs.binfmt_elf.core_dump_elf_headers=1
|
||||
|
||||
--- ./bfd/elf.c 18 Jul 2007 11:23:37 -0000 1.399
|
||||
+++ ./bfd/elf.c 22 Jul 2007 11:45:33 -0000
|
||||
@@ -2592,6 +2592,11 @@ _bfd_elf_new_section_hook (bfd *abfd, as
|
||||
2007-08-07 Alan Modra <amodra@bigpond.net.au>
|
||||
|
||||
* elf.c: (_bfd_elf_make_section_from_phdr): Properly handle
|
||||
bss segments.
|
||||
|
||||
--- ./bfd/elf.c 6 Aug 2007 18:35:18 -0000 1.405
|
||||
+++ ./bfd/elf.c 6 Aug 2007 22:53:27 -0000 1.406
|
||||
@@ -2223,7 +2223,7 @@ _bfd_elf_new_section_hook (bfd *abfd, as
|
||||
for the single program segment. The first has the length specified by
|
||||
the file size of the segment, and the second has the length specified
|
||||
by the difference between the two sizes. In effect, the segment is split
|
||||
into it's initialized and uninitialized parts.
|
||||
- into it's initialized and uninitialized parts.
|
||||
+ into its initialized and uninitialized parts.
|
||||
|
||||
+ Meaning of files size different than the memory size is different for core
|
||||
+ files by Linux kernel with its fs.binfmt_elf.core_dump_elf_headers = 1.
|
||||
+ Missing memory data should be fetched there from the readonly segments of
|
||||
+ the executable file.
|
||||
+
|
||||
*/
|
||||
|
||||
bfd_boolean
|
||||
@@ -2606,8 +2611,8 @@ _bfd_elf_make_section_from_phdr (bfd *ab
|
||||
size_t len;
|
||||
int split;
|
||||
|
||||
- split = ((hdr->p_memsz > 0)
|
||||
- && (hdr->p_filesz > 0)
|
||||
+ split = (abfd->format != bfd_core
|
||||
+ && (hdr->p_memsz > 0) && (hdr->p_filesz > 0)
|
||||
@@ -2242,40 +2242,46 @@ _bfd_elf_make_section_from_phdr (bfd *ab
|
||||
split = ((hdr->p_memsz > 0)
|
||||
&& (hdr->p_filesz > 0)
|
||||
&& (hdr->p_memsz > hdr->p_filesz));
|
||||
sprintf (namebuf, "%s%d%s", typename, index, split ? "a" : "");
|
||||
len = strlen (namebuf) + 1;
|
||||
- sprintf (namebuf, "%s%d%s", typename, index, split ? "a" : "");
|
||||
- len = strlen (namebuf) + 1;
|
||||
- name = bfd_alloc (abfd, len);
|
||||
- if (!name)
|
||||
- return FALSE;
|
||||
- memcpy (name, namebuf, len);
|
||||
- newsect = bfd_make_section (abfd, name);
|
||||
- if (newsect == NULL)
|
||||
- return FALSE;
|
||||
- newsect->vma = hdr->p_vaddr;
|
||||
- newsect->lma = hdr->p_paddr;
|
||||
- newsect->size = hdr->p_filesz;
|
||||
- newsect->filepos = hdr->p_offset;
|
||||
- newsect->flags |= SEC_HAS_CONTENTS;
|
||||
- newsect->alignment_power = bfd_log2 (hdr->p_align);
|
||||
- if (hdr->p_type == PT_LOAD)
|
||||
+
|
||||
+ if (hdr->p_filesz > 0)
|
||||
{
|
||||
- newsect->flags |= SEC_ALLOC;
|
||||
- newsect->flags |= SEC_LOAD;
|
||||
- if (hdr->p_flags & PF_X)
|
||||
+ sprintf (namebuf, "%s%d%s", typename, index, split ? "a" : "");
|
||||
+ len = strlen (namebuf) + 1;
|
||||
+ name = bfd_alloc (abfd, len);
|
||||
+ if (!name)
|
||||
+ return FALSE;
|
||||
+ memcpy (name, namebuf, len);
|
||||
+ newsect = bfd_make_section (abfd, name);
|
||||
+ if (newsect == NULL)
|
||||
+ return FALSE;
|
||||
+ newsect->vma = hdr->p_vaddr;
|
||||
+ newsect->lma = hdr->p_paddr;
|
||||
+ newsect->size = hdr->p_filesz;
|
||||
+ newsect->filepos = hdr->p_offset;
|
||||
+ newsect->flags |= SEC_HAS_CONTENTS;
|
||||
+ newsect->alignment_power = bfd_log2 (hdr->p_align);
|
||||
+ if (hdr->p_type == PT_LOAD)
|
||||
{
|
||||
- /* FIXME: all we known is that it has execute PERMISSION,
|
||||
- may be data. */
|
||||
- newsect->flags |= SEC_CODE;
|
||||
+ newsect->flags |= SEC_ALLOC;
|
||||
+ newsect->flags |= SEC_LOAD;
|
||||
+ if (hdr->p_flags & PF_X)
|
||||
+ {
|
||||
+ /* FIXME: all we known is that it has execute PERMISSION,
|
||||
+ may be data. */
|
||||
+ newsect->flags |= SEC_CODE;
|
||||
+ }
|
||||
+ }
|
||||
+ if (!(hdr->p_flags & PF_W))
|
||||
+ {
|
||||
+ newsect->flags |= SEC_READONLY;
|
||||
}
|
||||
- }
|
||||
- if (!(hdr->p_flags & PF_W))
|
||||
- {
|
||||
- newsect->flags |= SEC_READONLY;
|
||||
}
|
||||
|
||||
- if (split)
|
||||
+ if (hdr->p_memsz > hdr->p_filesz)
|
||||
{
|
||||
- sprintf (namebuf, "%s%db", typename, index);
|
||||
+ bfd_vma align;
|
||||
+
|
||||
+ sprintf (namebuf, "%s%d%s", typename, index, split ? "b" : "");
|
||||
len = strlen (namebuf) + 1;
|
||||
name = bfd_alloc (abfd, len);
|
||||
if (!name)
|
||||
@@ -2287,8 +2293,21 @@ _bfd_elf_make_section_from_phdr (bfd *ab
|
||||
newsect->vma = hdr->p_vaddr + hdr->p_filesz;
|
||||
newsect->lma = hdr->p_paddr + hdr->p_filesz;
|
||||
newsect->size = hdr->p_memsz - hdr->p_filesz;
|
||||
+ newsect->filepos = hdr->p_offset + hdr->p_filesz;
|
||||
+ align = newsect->vma & -newsect->vma;
|
||||
+ if (align == 0 || align > hdr->p_align)
|
||||
+ align = hdr->p_align;
|
||||
+ newsect->alignment_power = bfd_log2 (align);
|
||||
if (hdr->p_type == PT_LOAD)
|
||||
{
|
||||
+ /* Hack for gdb. Segments that have not been modified do
|
||||
+ not have their contents written to a core file, on the
|
||||
+ assumption that a debugger can find the contents in the
|
||||
+ executable. We flag this case by setting the fake
|
||||
+ section size to zero. Note that "real" bss sections will
|
||||
+ always have their contents dumped to the core file. */
|
||||
+ if (bfd_get_format (abfd) == bfd_core)
|
||||
+ newsect->size = 0;
|
||||
newsect->flags |= SEC_ALLOC;
|
||||
if (hdr->p_flags & PF_X)
|
||||
newsect->flags |= SEC_CODE;
|
||||
|
35
gdb-6.6-glibc-open-fcntl2-compat.patch
Normal file
35
gdb-6.6-glibc-open-fcntl2-compat.patch
Normal file
@ -0,0 +1,35 @@
|
||||
2007-08-08 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* bfd/opncls.c (bfd_openr_iovec): Fix OPEN parameter macro expansion.
|
||||
|
||||
--- ./bfd/opncls.c 24 Jul 2007 19:58:06 -0000 1.48
|
||||
+++ ./bfd/opncls.c 8 Aug 2007 19:12:15 -0000
|
||||
@@ -545,7 +545,8 @@ bfd_openr_iovec (const char *filename, c
|
||||
nbfd->filename = filename;
|
||||
nbfd->direction = read_direction;
|
||||
|
||||
- stream = open (nbfd, open_closure);
|
||||
+ /* `open (...)' would get expanded by an the open(2) syscall macro. */
|
||||
+ stream = (*open) (nbfd, open_closure);
|
||||
if (stream == NULL)
|
||||
{
|
||||
_bfd_delete_bfd (nbfd);
|
||||
|
||||
|
||||
|
||||
2007-08-08 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* serial.c (serial_open): Fix OPEN parameter macro expansion.
|
||||
|
||||
--- ./gdb/serial.c 8 Apr 2007 15:20:07 -0000 1.29
|
||||
+++ ./gdb/serial.c 8 Aug 2007 20:32:10 -0000
|
||||
@@ -213,7 +213,8 @@ serial_open (const char *name)
|
||||
scb->bufp = scb->buf;
|
||||
scb->error_fd = -1;
|
||||
|
||||
- if (scb->ops->open (scb, open_name))
|
||||
+ /* `...->open (...)' would get expanded by an the open(2) syscall macro. */
|
||||
+ if ((*scb->ops->open) (scb, open_name))
|
||||
{
|
||||
xfree (scb);
|
||||
return NULL;
|
10
gdb.spec
10
gdb.spec
@ -11,7 +11,7 @@ Name: gdb
|
||||
Version: 6.6
|
||||
|
||||
# The release always contains a leading reserved number, start it at 1.
|
||||
Release: 23%{?dist}
|
||||
Release: 24%{?dist}
|
||||
|
||||
License: GPL
|
||||
Group: Development/Debuggers
|
||||
@ -366,6 +366,9 @@ Patch266: gdb-6.6-bz247354-leader-exit-test.patch
|
||||
# Fixed compatibility with Rawhide kernel fs.binfmt_elf.core_dump_elf_headers=1.
|
||||
Patch269: gdb-6.6-bfd-core-dump_elf_headers.patch
|
||||
|
||||
# Fixed compatibility with the Rawhide glibc open(2) syscall sanity checking.
|
||||
Patch272: gdb-6.6-glibc-open-fcntl2-compat.patch
|
||||
|
||||
BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu gettext
|
||||
BuildRequires: flex bison sharutils expat-devel
|
||||
Requires: readline
|
||||
@ -518,6 +521,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
|
||||
%patch265 -p1
|
||||
%patch266 -p1
|
||||
%patch269 -p1
|
||||
%patch272 -p1
|
||||
|
||||
# Change the version that gets printed at GDB startup, so it is RedHat
|
||||
# specific.
|
||||
@ -671,6 +675,10 @@ fi
|
||||
# don't include the files in include, they are part of binutils
|
||||
|
||||
%changelog
|
||||
* Wed Aug 8 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-24
|
||||
- Fixed compatibility with the Rawhide glibc open(2) syscall sanity checking.
|
||||
- Update the core_dump_elf_headers=1 compatibility code to the upstream variant.
|
||||
|
||||
* Mon Aug 6 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-23
|
||||
- Update PPC unwinding patches to their upstream variants (BZ 140532).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user