Compare commits

...

8 Commits
master ... f18

Author SHA1 Message Date
Sergio Durigan Junior f971f4d6c6 - Fix the case when GDB leaks memory because value_struct_elt does not call
check_typedef.  (Doug Evans, BZ 15695, filed as RH BZ 1013453).
2013-10-01 01:21:44 -03:00
Jan Kratochvil fca41978c6 Fix the version string to be GNU standards compliant (BZ 1004949). 2013-09-09 17:56:38 +02:00
Jan Kratochvil 3795487085 New %pre to fix failed upgrade of the previous commit (BZ 999645).
- Fix false warnings of new %pre during future upgrades (BZ 999645).
2013-08-30 19:12:22 +02:00
Jan Kratochvil e9d2961c4c Fix /usr/share/gdb/auto-load/ need of filesystem symlinks (BZ 999645).
It needs: yum remove gdb-heap; yum reinstall gdb; yum install gdb-heap
2013-08-28 22:06:11 +02:00
Jan Kratochvil 89a972c829 Fix false "Unknown error 512" on x32 (H.J. Lu, BZ 956883). 2013-04-27 18:44:42 +02:00
Jan Kratochvil 35b5e58fc4 Fix crash on 'gdb ""' (BZ 951251).. 2013-04-12 17:16:17 +02:00
Jan Kratochvil 9929ad182e Fix crash regression from the dlopen of libpthread.so fix (BZ 911712). 2013-03-21 19:45:17 +01:00
Jan Kratochvil d2a0d84101 Re-enable PDF in gdb-doc after texinfo RH BZ 876710 has been fixed. 2013-02-08 13:59:03 +01:00
5 changed files with 283 additions and 10 deletions

View File

@ -0,0 +1,60 @@
https://bugzilla.redhat.com/show_bug.cgi?id=911712
--- ./gdb/objfiles.c-orig 2013-03-21 18:51:00.141957331 +0100
+++ ./gdb/objfiles.c 2013-03-21 19:20:25.615519748 +0100
@@ -615,6 +615,7 @@ free_objfile (struct objfile *objfile)
obstack_free (&objfile->objfile_obstack, 0);
/* Rebuild section map next time we need it. */
+ gdb_assert (!get_objfile_pspace_data (objfile->pspace)->inhibit_updates);
get_objfile_pspace_data (objfile->pspace)->objfiles_changed_p = 1;
xfree (objfile);
@@ -1284,6 +1285,21 @@ bsearch_cmp (const void *key, const void
return 1;
}
+static void
+update_space_info_sections (struct objfile_pspace_info *pspace_info)
+{
+ if (pspace_info->objfiles_changed_p && !pspace_info->inhibit_updates)
+ {
+ update_section_map (current_program_space,
+ &pspace_info->sections,
+ &pspace_info->num_sections);
+
+ /* Don't need updates to section map until objfiles are added,
+ removed or relocated. */
+ pspace_info->objfiles_changed_p = 0;
+ }
+}
+
/* Returns a section whose range includes PC or NULL if none found. */
struct obj_section *
@@ -1298,16 +1314,7 @@ find_pc_section (CORE_ADDR pc)
return s;
pspace_info = get_objfile_pspace_data (current_program_space);
- if (pspace_info->objfiles_changed_p && !pspace_info->inhibit_updates)
- {
- update_section_map (current_program_space,
- &pspace_info->sections,
- &pspace_info->num_sections);
-
- /* Don't need updates to section map until objfiles are added,
- removed or relocated. */
- pspace_info->objfiles_changed_p = 0;
- }
+ update_space_info_sections (pspace_info);
/* The C standard (ISO/IEC 9899:TC2) requires the BASE argument to
bsearch be non-NULL. */
@@ -1471,6 +1478,7 @@ objfiles_changed (void)
void
inhibit_section_map_updates (void)
{
+ update_space_info_sections (get_objfile_pspace_data (current_program_space));
get_objfile_pspace_data (current_program_space)->inhibit_updates = 1;
}

View File

@ -0,0 +1,20 @@
gdb ""
SEGV
From archer.patch probably from archer-tromey-dwz-multifile-rebase .
--- gdb-7.5.1/gdb/exec.c-orig 2013-04-12 16:58:46.426785095 +0200
+++ gdb-7.5.1/gdb/exec.c 2013-04-12 17:10:18.566927513 +0200
@@ -226,11 +226,11 @@ exec_file_attach (char *filename, int fr
&scratch_pathname);
}
#endif
+ if (scratch_chan < 0)
+ perror_with_name (filename);
cleanups = make_cleanup (xfree, scratch_pathname);
- if (scratch_chan < 0)
- perror_with_name (filename);
exec_bfd = gdb_bfd_fopen (scratch_pathname, gnutarget,
write_files ? FOPEN_RUB : FOPEN_RB,
scratch_chan);

View File

@ -0,0 +1,136 @@
https://sourceware.org/ml/gdb-patches/2013-07/msg00469.html
Hi.
This patch adds the missing calls to check_typedef
and adds a testcase to show the issue.
The PR is not closeable yet, but the remaining issues are more cleanups
than actual bug fixes.
Regression tested on amd64-linux.
I will check this in in a few days if there are no objections.
[The multiple calls to check_typedef (value_type (*argp)) are
bothersome, but the code is simpler this way, and I expect
resolving the rest of the issues in 15695 to potentially change this
code significantly.]
---
commit cbb25189b69e501ddca64917d810b54bb1466c93
Author: Doug Evans <dje@google.com>
Date: Thu Aug 1 23:59:47 2013 +0000
PR symtab/15695
* valops.c (value_struct_elt): Add missing call to check_typedef.
(value_find_oload_method_list): Ditto.
testsuite/
* gdb.base/func-ptr.exp: New file.
* gdb.base/func-ptr.c: New file.
2013-08-01 Doug Evans <dje@google.com>
PR symtab/15695
* valops.c (value_struct_elt): Add missing call to check_typedef.
(value_find_oload_method_list): Ditto.
2013-08-01 Doug Evans <dje@google.com>
PR symtab/15695
* gdb.base/func-ptr.exp: New file.
* gdb.base/func-ptr.c: New file.
Index: gdb-7.5.1/gdb/testsuite/gdb.base/func-ptr.c
===================================================================
--- /dev/null
+++ gdb-7.5.1/gdb/testsuite/gdb.base/func-ptr.c
@@ -0,0 +1,30 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2013 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/>. */
+
+void
+bar ()
+{
+}
+
+typedef void foo (void);
+foo *pbar = bar;
+
+int
+main ()
+{
+ return 0;
+}
Index: gdb-7.5.1/gdb/testsuite/gdb.base/func-ptr.exp
===================================================================
--- /dev/null
+++ gdb-7.5.1/gdb/testsuite/gdb.base/func-ptr.exp
@@ -0,0 +1,30 @@
+# Copyright 2013 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 testcase exercises bug 15695.
+# Trying to print foo->bar if foo is a pointer to a typedef of a pointer
+# to a function will put gdb into an infinite loop.
+
+if { [prepare_for_testing func-ptr.exp "func-ptr" {func-ptr.c} {debug}] } {
+ return -1
+}
+
+if ![runto_main] {
+ fail "Can't run to main"
+ return 0
+}
+
+# This would put gdb into an infinite loop.
+gdb_test "print pbar->baz" "Attempt to extract .*"
Index: gdb-7.5.1/gdb/valops.c
===================================================================
--- gdb-7.5.1.orig/gdb/valops.c
+++ gdb-7.5.1/gdb/valops.c
@@ -2465,7 +2465,7 @@ value_struct_elt (struct value **argp, s
{
*argp = value_ind (*argp);
/* Don't coerce fn pointer to fn and then back again! */
- if (TYPE_CODE (value_type (*argp)) != TYPE_CODE_FUNC)
+ if (TYPE_CODE (check_typedef (value_type (*argp))) != TYPE_CODE_FUNC)
*argp = coerce_array (*argp);
t = check_typedef (value_type (*argp));
}
@@ -2629,7 +2629,7 @@ value_find_oload_method_list (struct val
{
*argp = value_ind (*argp);
/* Don't coerce fn pointer to fn and then back again! */
- if (TYPE_CODE (value_type (*argp)) != TYPE_CODE_FUNC)
+ if (TYPE_CODE (check_typedef (value_type (*argp))) != TYPE_CODE_FUNC)
*argp = coerce_array (*argp);
t = check_typedef (value_type (*argp));
}

View File

@ -102,7 +102,7 @@ gdb/
}
}
+
+ if (gdbarch_ptr_bit (gdbarch) == 32)
+ if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
+ {
+ /* Sign-extend %eax as during return from a syscall it is being checked
+ for -ERESTART* values -512 being above 0xfffffffffffffe00; tested by

View File

@ -34,7 +34,7 @@ Version: 7.5.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: 35%{?dist}
Release: 43%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain
Group: Development/Debuggers
@ -511,6 +511,7 @@ Patch548: gdb-test-expr-cumulative-archer.patch
Patch579: gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
# Fix dlopen of libpthread.so, patched glibc required (Gary Benson, BZ 669432).
# Fix crash regression from the dlopen of libpthread.so fix (BZ 911712).
#=push
Patch618: gdb-dlopen-stap-probe-1of7.patch
Patch717: gdb-dlopen-stap-probe-2of7.patch
@ -522,6 +523,7 @@ Patch722: gdb-dlopen-stap-probe-7of7.patch
Patch619: gdb-dlopen-stap-probe-test.patch
Patch723: gdb-dlopen-stap-probe-test2.patch
Patch822: gdb-dlopen-stap-probe-mapfailed.patch
Patch826: gdb-dlopen-stap-probe-inhibit.patch
# Work around PR libc/13097 "linux-vdso.so.1" warning message.
#=push
@ -607,6 +609,14 @@ Patch819: gdb-implicitpointer-offset.patch
Patch820: gdb-rhbz890900-ppc-dis-1of2.patch
Patch821: gdb-rhbz890900-ppc-dis-2of2.patch
# Fix crash on 'gdb ""' (BZ 951251)..
Patch830: gdb-f18-open-emptyname.patch
# Fix the case when GDB leaks memory because value_struct_elt
# does not call check_typedef. (Doug Evans, BZ 15695, filed as
# RH BZ 1013453).
Patch844: gdb-rhbz1013453-value-struct-elt-memory-leak.patch
%if 0%{!?rhel:1} || 0%{?rhel} > 6
# RL_STATE_FEDORA_GDB would not be found for:
# Patch642: gdb-readline62-ask-more-rh.patch
@ -909,6 +919,7 @@ find -name "*.info*"|xargs rm -f
%patch722 -p1
%patch723 -p1
%patch822 -p1
%patch826 -p1
%patch619 -p1
%patch627 -p1
%patch634 -p1
@ -948,6 +959,8 @@ find -name "*.info*"|xargs rm -f
%patch819 -p1
%patch820 -p1
%patch821 -p1
%patch830 -p1
%patch844 -p1
%patch393 -p1
%if 0%{!?el5:1} || 0%{?scl:1}
@ -970,9 +983,9 @@ find -name "*.orig" | xargs rm -f
# Change the version that gets printed at GDB startup, so it is RH specific.
cat > gdb/version.in << _FOO
%if 0%{!?rhel:1}
Fedora (%{version}-%{release})
Fedora %{version}-%{release}
%else # !0%{!?rhel:1}
Red Hat Enterprise Linux (%{version}-%{release})
Red Hat Enterprise Linux %{version}-%{release}
%endif # !0%{!?rhel:1}
_FOO
@ -1153,8 +1166,7 @@ $(: fmtutil: format directory '/builddir/.texmf-var/web2c' does not exist. ) \
%else
%{?_smp_mflags} \
%endif
-C gdb/doc {gdb,annotate}{.info,/index.html} MAKEHTMLFLAGS=--no-split MAKEINFOFLAGS=--no-split
# -C gdb/doc {gdb,annotate}{.info,/index.html,.pdf} MAKEHTMLFLAGS=--no-split MAKEINFOFLAGS=--no-split
-C gdb/doc {gdb,annotate}{.info,/index.html,.pdf} MAKEHTMLFLAGS=--no-split MAKEINFOFLAGS=--no-split
grep '#define HAVE_ZLIB_H 1' gdb/config.h
@ -1284,8 +1296,8 @@ for pyo in "" "-O";do
done
%endif # 0%{?_enable_debug_packages:1} && 0%{!?_without_python:1}
%if 0%{?rhel:1} && 0%{?rhel} <= 6
%if 0%{!?_without_python:1}
%if 0%{?rhel:1} && 0%{?rhel} <= 6
# Temporarily now:
for LIB in lib lib64;do
LIBPATH="$RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{_root_prefix}/$LIB"
@ -1307,8 +1319,15 @@ for i in `find $RPM_BUILD_ROOT%{_datadir}/gdb/python -name "*.py"` \
# Files come from gdb-archer.patch and can be also further patched.
touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/ChangeLog $i
done
%else # 0%{!?rhel:1} || 0%{?rhel} > 6
# BZ 999645: /usr/share/gdb/auto-load/ needs filesystem symlinks
mkdir -p $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load
for i in $(echo bin lib $(basename %{_libdir}) sbin|tr ' ' '\n'|sort -u);do
ln -s $(echo %{_root_prefix}|sed 's#^/*##')/$i \
$RPM_BUILD_ROOT%{_datadir}/gdb/auto-load/$i
done
%endif # 0%{!?rhel:1} || 0%{?rhel} > 6
%endif # 0%{!?_without_python:1}
%endif # 0%{?rhel:1} && 0%{?rhel} <= 6
# gdb-add-index cannot be run even for SCL package on RHEL<=6.
%if 0%{?rhel:1} && 0%{?rhel} <= 6
@ -1410,13 +1429,24 @@ rm -rf $RPM_BUILD_ROOT
%endif # %{have_inproctrace}
%endif
%pre
for i in $(echo bin lib $(basename %{_libdir}) sbin|tr ' ' '\n'|sort -u);do
src="%{_datadir}/gdb/auto-load/$i"
dst="%{_datadir}/gdb/auto-load/%{_root_prefix}/$i"
if test -d $src -a ! -L $src;then
if ! rmdir 2>/dev/null $src;then
mv -n $src/* $dst/
rmdir $src
fi
fi
done
# It would break RHEL-5 by leaving excessive files for the doc subpackage.
%endif # !noarch
%if 0%{!?el5:1} || "%{_target_cpu}" == "noarch"
%files doc
%doc %{gdb_build}/gdb/doc/{gdb,annotate}.html
#doc %{gdb_build}/gdb/doc/{gdb,annotate}.{html,pdf}
%doc %{gdb_build}/gdb/doc/{gdb,annotate}.{html,pdf}
%defattr(-,root,root)
%{_infodir}/annotate.info*
%{_infodir}/gdb.info*
@ -1446,6 +1476,33 @@ fi
%endif # 0%{!?el5:1} || "%{_target_cpu}" == "noarch"
%changelog
* Mon Sep 30 2013 Sergio Durigan Junior <sergiodj@redhat.com> - 7.5.1-43.fc18
- Fix the case when GDB leaks memory because value_struct_elt does not call
check_typedef. (Doug Evans, BZ 15695, filed as RH BZ 1013453).
* Mon Sep 9 2013 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.5.1-42.fc18
- Fix the version string to be GNU standards compliant (BZ 1004949).
* Fri Aug 30 2013 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.5.1-41.fc18
- New %%pre to fix failed upgrade of the previous commit (BZ 999645).
- Fix false warnings of new %%pre during future upgrades (BZ 999645).
* Wed Aug 28 2013 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.5.1-40.fc18
- Fix /usr/share/gdb/auto-load/ need of filesystem symlinks (BZ 999645).
It needs: yum remove gdb-heap; yum reinstall gdb; yum install gdb-heap
* Sat Apr 27 2013 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.5.1-39.fc18
- Fix false "Unknown error 512" on x32 (H.J. Lu, BZ 956883).
* Fri Apr 12 2013 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.5.1-38.fc18
- Fix crash on 'gdb ""' (BZ 951251)..
* Thu Mar 21 2013 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.5.1-37.fc18
- Fix crash regression from the dlopen of libpthread.so fix (BZ 911712).
* Fri Feb 8 2013 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.5.1-36.fc18
- Re-enable PDF in gdb-doc after texinfo RH BZ 876710 has been fixed.
* Sun Jan 13 2013 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.5.1-35.fc18
- [testsuite] Fix gdb-orphanripper.c lockup on F-17 (/dev/pts/* glibc chown).