[gdb/f16] Backport `info os processes' crash fix - for Eclipse (Pedro Alves, BZ 746294).

Jan Kratochvil jankratochvil at fedoraproject.org
Fri Oct 14 20:13:32 UTC 2011


commit 52bb570800d06624cadcda0dcf44e724737a2787
Author: Jan Kratochvil <jan.kratochvil at redhat.com>
Date:   Fri Oct 14 22:13:26 2011 +0200

    Backport `info os processes' crash fix - for Eclipse (Pedro Alves, BZ 746294).

 gdb-upstream.patch |   65 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 gdb.spec           |    5 +++-
 2 files changed, 69 insertions(+), 1 deletions(-)
---
diff --git a/gdb-upstream.patch b/gdb-upstream.patch
index c1500cc..240bcce 100644
--- a/gdb-upstream.patch
+++ b/gdb-upstream.patch
@@ -1336,3 +1336,68 @@ http://sourceware.org/ml/gdb-cvs/2011-08/msg00047.html
      DisablePrettyPrinter()
 +
 +register_pretty_printer_commands()
+
+
+
+http://sourceware.org/ml/gdb-patches/2011-08/msg00505.html
+Subject: fix "info os processes" race -> crash (ext-run.exp racy FAIL)
+http://sourceware.org/ml/gdb-cvs/2011-08/msg00116.html
+
+### src/gdb/ChangeLog	2011/08/26 17:58:57	1.13281
+### src/gdb/ChangeLog	2011/08/26 18:58:02	1.13282
+## -1,3 +1,8 @@
++2011-08-26  Pedro Alves  <pedro at codesourcery.com>
++
++	* common/linux-osdata.c (get_cores_used_by_process): Don't assume
++	opening /proc/PID/task always succeeds.
++
+ 2011-08-26  Aleksandar Ristovski <aristovski at qnx.com>
+ 
+ 	* linespec.c (symtab_from_filename): Check for the end of string.
+--- src/gdb/common/linux-osdata.c	2011/07/21 23:46:09	1.1
++++ src/gdb/common/linux-osdata.c	2011/08/26 18:58:04	1.2
+@@ -259,27 +259,29 @@
+ 
+   sprintf (taskdir, "/proc/%d/task", pid);
+   dir = opendir (taskdir);
+-
+-  while ((dp = readdir (dir)) != NULL)
++  if (dir)
+     {
+-      pid_t tid;
+-      int core;
++      while ((dp = readdir (dir)) != NULL)
++	{
++	  pid_t tid;
++	  int core;
+ 
+-      if (!isdigit (dp->d_name[0])
+-	  || NAMELEN (dp) > sizeof ("4294967295") - 1)
+-	continue;
++	  if (!isdigit (dp->d_name[0])
++	      || NAMELEN (dp) > sizeof ("4294967295") - 1)
++	    continue;
+ 
+-      tid = atoi (dp->d_name);
+-      core = linux_common_core_of_thread (ptid_build (pid, tid, 0));
++	  tid = atoi (dp->d_name);
++	  core = linux_common_core_of_thread (ptid_build (pid, tid, 0));
+ 
+-      if (core >= 0)
+-	{
+-	  ++cores[core];
+-	  ++task_count;
++	  if (core >= 0)
++	    {
++	      ++cores[core];
++	      ++task_count;
++	    }
+ 	}
+-    }
+ 
+-  closedir (dir);
++      closedir (dir);
++    }
+ 
+   return task_count;
+ }
diff --git a/gdb.spec b/gdb.spec
index 269c63f..2739229 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -27,7 +27,7 @@ Version: 7.3.50.20110722
 
 # 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: 8%{?_with_upstream:.upstream}%{?dist}
+Release: 9%{?_with_upstream:.upstream}%{?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
@@ -1252,6 +1252,9 @@ fi
 %{_infodir}/gdb.info*
 
 %changelog
+* Fri Oct 14 2011 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.3.50.20110722-9.fc16
+- Backport `info os processes' crash fix - for Eclipse (Pedro Alves, BZ 746294).
+
 * Tue Oct 11 2011 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.3.50.20110722-8.fc16
 - Fix PIE testsuite run; new lib/future.exp hack and use -fPIC instead of -fPIE.
 


More information about the scm-commits mailing list