⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ptt_glibc-2.3.5.patch

📁 linux下的多线程调试工具
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
diff -Naur ori_glibc/config.h.in new_glibc/config.h.in--- ori_glibc/config.h.in	2006-03-31 10:41:42.000000000 +0200+++ new_glibc/config.h.in	2006-03-31 10:45:13.000000000 +0200@@ -217,6 +217,13 @@ /* Define if inlined system calls are available.  */ #undef HAVE_INLINED_SYSCALLS +/* Define if PTT (NPTL trace tool) is available */+#undef PTT_LIBPTHREAD+#undef PTT_NEW_FILES++/* Define if PTT (NPTL trace tool) is available with --with-ptt-trace-info */+#undef PTT_TRACE_INFO+ /*  */ diff -Naur ori_glibc/config.make.in new_glibc/config.make.in--- ori_glibc/config.make.in	2006-03-31 10:42:16.000000000 +0200+++ new_glibc/config.make.in	2006-03-31 10:45:55.000000000 +0200@@ -125,5 +125,6 @@  # Additional libraries. LIBGD = @LIBGD@+LIBPTHREAD_PTT = @useptt@  # More variables may be inserted below by configure.diff -Naur ori_glibc/configure new_glibc/configure--- ori_glibc/configure	2006-03-31 10:41:21.000000000 +0200+++ new_glibc/configure	2006-03-31 10:49:21.000000000 +0200@@ -313,7 +313,7 @@ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_have_initfini libc_cv_cpp_asm_debuginfo no_whole_archive exceptions LIBGD have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES linux_doors mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi useptt bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_have_initfini libc_cv_cpp_asm_debuginfo no_whole_archive exceptions LIBGD have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES linux_doors mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS' ac_subst_files=''  # Initialize some variables set by options.@@ -903,6 +903,9 @@                           default]   --with-tls              enable support for TLS   --without-__thread      do not use TLS features even when supporting them+  --with-ptt              build libpthread.so to trace NPTL+  --with-ptt-trace-info   compute information about PTT trace mechanism.+                          should be useful only for PTT developers  Some influential environment variables:   CC          C compiler command@@ -1629,6 +1632,46 @@   use__thread=yes fi; ++# Check whether --with-ptt or --without-ptt was given.+if test "${with_ptt+set}" = set; then+  withval="$with_ptt"+  useptt=$withval+else+  useptt=no+fi;+if test "$useptt" = yes; then+  cat >>confdefs.h <<\_ACEOF+#define PTT_NEW_FILES 1+_ACEOF++  cat >>confdefs.h <<\_ACEOF+#define PTT_LIBPTHREAD 1+_ACEOF++fi++++# Check whether --with-ptt-trace-info or --without-ptt-trace-info was given.+if test "${with_ptt_trace_info+set}" = set; then+  withval="$with_ptt_trace_info"+  useptt_info=$withval+else+  useptt_info=no+fi;+if test "$useptt_info" = yes; then+  if test "$useptt" != yes; then+    { { echo "$as_me:$LINENO: error: can't use --with-ptt-trace-info without --with-ptt" >&5+echo "$as_me: error: can't use --with-ptt-trace-info without --with-ptt" >&2;}+   { (exit 1); exit 1; }; }+  fi+  cat >>confdefs.h <<\_ACEOF+#define PTT_TRACE_INFO 1+_ACEOF++fi+ # Check whether --enable-hidden-plt or --disable-hidden-plt was given. if test "${enable_hidden_plt+set}" = set; then   enableval="$enable_hidden_plt"@@ -8319,6 +8362,7 @@ s,@with_cvs@,$with_cvs,;t t s,@enable_check_abi@,$enable_check_abi,;t t s,@oldest_abi@,$oldest_abi,;t t+s,@useptt@,$useptt,;t t s,@bindnow@,$bindnow,;t t s,@force_install@,$force_install,;t t s,@all_warnings@,$all_warnings,;t tdiff -Naur ori_glibc/configure.in new_glibc/configure.in--- ori_glibc/configure.in	2006-03-31 10:40:55.000000000 +0200+++ new_glibc/configure.in	2006-03-31 10:46:55.000000000 +0200@@ -200,6 +200,29 @@ 	    [use__thread=$withval], 	    [use__thread=yes]) +AC_ARG_WITH([ptt],+            AC_HELP_STRING([--with-ptt],+                           [build libpthread.so to trace NPTL]),+	    [useptt=$withval],+	    [useptt=no])+if test "$useptt" = yes; then+  AC_DEFINE(PTT_NEW_FILES)+  AC_DEFINE(PTT_LIBPTHREAD)+fi+AC_SUBST(useptt)++AC_ARG_WITH([ptt-trace-info],+            AC_HELP_STRING([--with-ptt-trace-info],+                           [compute information about PTT trace mechanism. should be useful only for PTT developers]),+	    [useptt_info=$withval],+	    [useptt_info=no])+if test "$useptt_info" = yes; then+  if test "$useptt" != yes; then+    AC_MSG_ERROR([can't use --with-ptt-trace-info without --with-ptt])+  fi+  AC_DEFINE(PTT_TRACE_INFO)+fi+ AC_ARG_ENABLE([hidden-plt],               AC_HELP_STRING([--disable-hidden-plt],                              [do not hide internal function calls to avoid PLT]),diff -Naur ori_glibc/nptl/cancellation.c new_glibc/nptl/cancellation.c--- ori_glibc/nptl/cancellation.c	2006-03-31 10:28:23.000000000 +0200+++ new_glibc/nptl/cancellation.c	2006-04-12 11:21:33.000000000 +0200@@ -88,3 +88,74 @@       oldval = curval;     } }++#ifdef PTT_LIBPTHREAD++/* The next two functions are similar to pthread_setcanceltype() but+   more specialized for the use in the uncancelable function ptt_trace().+   They do not need to check parameters etc.  */+int+attribute_hidden+__pthread_enable_synccancel (void)+{+  struct pthread *self = THREAD_SELF;+  int oldval = THREAD_GETMEM (self, cancelhandling);++  while (1)+    {+      int newval = oldval & ~CANCELTYPE_BITMASK;++      if (newval == oldval)+	break;++      int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,+					      oldval);+      if (__builtin_expect (curval == oldval, 1))+	break;++      /* Prepare the next round.  */+      oldval = curval;+    }+  return oldval;+}+++void+internal_function attribute_hidden+__pthread_disable_synccancel (int oldtype)+{+  /* If synchronous cancellation was enabled before we do not have+     anything to do.  */+  if (!(oldtype & CANCELTYPE_BITMASK))+    return;++  struct pthread *self = THREAD_SELF;+  int oldval = THREAD_GETMEM (self, cancelhandling);++  while (1)+    {+      int newval = oldval | CANCELTYPE_BITMASK;++      if (newval == oldval)+	break;++      int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,+					      oldval);+      if (__builtin_expect (curval == oldval, 1))+	{+	  if (CANCEL_ENABLED_AND_CANCELED_AND_ASYNCHRONOUS (newval))+	    {+	      THREAD_SETMEM (self, result, PTHREAD_CANCELED);+	      __do_cancel ();+	    }++	  break;+	}++      /* Prepare the next round.  */+      oldval = curval;+    }+}++#endif /* PTT_LIBPTHREAD */+diff -Naur ori_glibc/nptl/init.c new_glibc/nptl/init.c--- ori_glibc/nptl/init.c	2006-03-31 11:28:32.000000000 +0200+++ new_glibc/nptl/init.c	2006-03-31 11:30:42.000000000 +0200@@ -33,6 +33,9 @@ #include <shlib-compat.h> #include <smp.h> #include <lowlevellock.h>+#ifdef PTT_LIBPTHREAD+#include "ptt_module.h"+#endif /* PTT_LIBPTHREAD */   #ifndef __NR_set_tid_address@@ -218,6 +221,17 @@    to give libpthread its own TLS segment just for this.  */ extern void **__libc_dl_error_tsd (void) __attribute__ ((const)); +#ifdef PTT_LIBPTHREAD+/* Fork handler */+static void+__fork_handler (void)+{+  extern pid_t ptt_trace_pid;+  ptt_trace_pid = getpid();+  PTT_TRACE (PTT_LEVEL_OTHER, TR_FORK, getppid());+  __reclaim_stacks();+}+#endif /* PTT_LIBPTHREAD */  void __pthread_initialize_minimal_internal (void)@@ -319,12 +333,21 @@    /* Make __rtld_lock_{,un}lock_recursive use pthread_mutex_{,un}lock,      keep the lock count from the ld.so implementation.  */+#ifdef PTT_LIBPTHREAD+  GL(dl_rtld_lock_recursive) = (void *) INTUSE (__pthread_mutex_lock_nt);+  GL(dl_rtld_unlock_recursive) = (void *) INTUSE (__pthread_mutex_unlock_nt);+  unsigned int rtld_lock_count = GL(dl_load_lock).mutex.__data.__count;+  GL(dl_load_lock).mutex.__data.__count = 0;+  while (rtld_lock_count-- > 0)+    INTUSE (__pthread_mutex_lock_nt) (&GL(dl_load_lock).mutex);+#else /* ! defined(PTT_LIBPTHREAD) */   GL(dl_rtld_lock_recursive) = (void *) INTUSE (__pthread_mutex_lock);   GL(dl_rtld_unlock_recursive) = (void *) INTUSE (__pthread_mutex_unlock);   unsigned int rtld_lock_count = GL(dl_load_lock).mutex.__data.__count;   GL(dl_load_lock).mutex.__data.__count = 0;   while (rtld_lock_count-- > 0)     INTUSE (__pthread_mutex_lock) (&GL(dl_load_lock).mutex);+#endif /* PTT_LIBPTHREAD */    GL(dl_make_stack_executable_hook) = &__make_stacks_executable; #endif@@ -335,8 +358,13 @@ #ifndef TLS_MULTIPLE_THREADS_IN_TCB   __libc_multiple_threads_ptr = #endif+#ifdef PTT_LIBPTHREAD+    __libc_pthread_init (&__fork_generation, __fork_handler,+			 ptr_pthread_functions);+#else /* ! defined(PTT_LIBPTHREAD) */     __libc_pthread_init (&__fork_generation, __reclaim_stacks, 			 ptr_pthread_functions);+#endif /* PTT_LIBPTHREAD */    /* Determine whether the machine is SMP or not.  */   __is_smp = is_smp_system ();diff -Naur ori_glibc/nptl/Makefile new_glibc/nptl/Makefile--- ori_glibc/nptl/Makefile	2006-03-31 10:37:10.000000000 +0200+++ new_glibc/nptl/Makefile	2006-03-31 10:44:10.000000000 +0200@@ -260,6 +260,13 @@  include ../Makeconfig +ifeq ($(LIBPTHREAD_PTT),yes)+gen-as-const-headers += ptt_point.sym+libpthread-routines += pthread_mutex_lock_nt pthread_mutex_unlock_nt \+		       shm_open shm_unlink \+		       ptt_module+endif+ ifeq ($(have-forced-unwind),yes) tests += tst-cancelx2 tst-cancelx3 tst-cancelx4 tst-cancelx5 \ 	 tst-cancelx6 tst-cancelx7 tst-cancelx8 tst-cancelx9 tst-cancelx10 \diff -Naur ori_glibc/nptl/pthread_barrier_destroy.c new_glibc/nptl/pthread_barrier_destroy.c--- ori_glibc/nptl/pthread_barrier_destroy.c	2006-03-31 10:28:23.000000000 +0200+++ new_glibc/nptl/pthread_barrier_destroy.c	2006-05-16 09:18:47.000000000 +0200@@ -31,14 +31,41 @@    ibarrier = (struct pthread_barrier *) barrier; +#ifdef PTT_LIBPTHREAD+  /* BARRIER_DESTROY_IN, BARRIER_LOCK_REQUIRE, THREAD_STATE_WAIT */+  PTT_TRACE (PTT_LEVEL_BARRIER_IO, TR_BARRIER_1, barrier, barrier,+             ibarrier->lock);+#endif /* PTT_LIBPTHREAD */+     lll_lock (ibarrier->lock);+#ifdef PTT_LIBPTHREAD+  /* THREAD_STATE_WAKE, BARRIER_LOCK_TAKEN */+  PTT_TRACE (PTT_LEVEL_BARRIER, TR_BARRIER_2, barrier, ibarrier->lock);+#endif /* PTT_LIBPTHREAD */    if (__builtin_expect (ibarrier->left == ibarrier->init_count, 1))+ {     /* The barrier is not used anymore.  */+#ifdef PTT_LIBPTHREAD+    /* TR_BARRIER_DESTROY */+    PTT_TRACE (PTT_LEVEL_BARRIER, TR_BARRIER_13, barrier);+#endif /* PTT_LIBPTHREAD */     result = 0;+ }   else     /* Still used, return with an error.  */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -