Jon Turney | 15 Mar 14:12 2016
Picon
Gravatar

[PATCH] Attempt to fix Coverity issues in ssp

	* ssp.c (lookup_thread_id): Consistently check if tix is a null
	pointer.
	(run_program): Annotate that STATUS_BREAKPOINT falls-through to
	STATUS_SINGLE_STEP case.
	(main): Guard against high_pc-low_pc overflow and malloc failure.

Signed-off-by: Jon Turney <jon.turney <at> dronecode.org.uk>
---
 winsup/utils/ssp.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/winsup/utils/ssp.c b/winsup/utils/ssp.c
index c9165f3..0bca544 100644
--- a/winsup/utils/ssp.c
+++ b/winsup/utils/ssp.c
 <at>  <at>  -182,7 +182,10  <at>  <at>  static HANDLE
 lookup_thread_id (DWORD threadId, int *tix)
 {
   int i;
-  *tix = 0;
+
+  if (tix)
+    *tix = 0;
+
   for (i=0; i<num_active_threads; i++)
     if (active_thread_ids[i] == threadId)
       {
 <at>  <at>  -463,6 +466,7  <at>  <at>  run_program (char *cmdline)
 		      thread_return_address[tix] = rv;
 		}
(Continue reading)

Yaakov Selkowitz | 15 Mar 04:13 2016
Picon
Gravatar

[PATCH] Cygwin: define byteswap.h inlines as macros

The bswap_* "functions" are macros in glibc, so they may be tested for
by the preprocessor (e.g. #ifdef bswap_16).

Signed-off-by: Yaakov Selkowitz <yselkowi <at> redhat.com>
---
 winsup/cygwin/include/byteswap.h | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/winsup/cygwin/include/byteswap.h b/winsup/cygwin/include/byteswap.h
index cd5a726..9f73c5a 100644
--- a/winsup/cygwin/include/byteswap.h
+++ b/winsup/cygwin/include/byteswap.h
 <at>  <at>  -16,23 +16,27  <at>  <at>  extern "C" {
 #endif

 static __inline unsigned short
-bswap_16 (unsigned short __x)
+__bswap_16 (unsigned short __x)
 {
   return (__x >> 8) | (__x << 8);
 }

 static __inline unsigned int
-bswap_32 (unsigned int __x)
+__bswap_32 (unsigned int __x)
 {
-  return (bswap_16 (__x & 0xffff) << 16) | (bswap_16 (__x >> 16));
+  return (__bswap_16 (__x & 0xffff) << 16) | (__bswap_16 (__x >> 16));
 }

(Continue reading)

Peter Foley | 14 Mar 23:03 2016

Re: [PATCH] Regenerate newlib/configure

On Mon, Mar 14, 2016 at 12:23 PM, Peter Foley <pefoley2 <at> pefoley.com> wrote:
> Fix undefined libtool macros _LT_DECL_SED and _LT_PROG_ECHO_BACKSLASH
>
> newlib/ChangeLog
> * configure: Regenerate.
>
> ---
>  newlib/configure | 9339 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 9306 insertions(+), 33 deletions(-)

Whoops,

Just realized that this should have been sent to the newlib list.
I'll re-submit this there.

Thanks,

Peter Foley

Václav Haisman | 11 Mar 11:28 2016
Picon
Gravatar

Fwd: [PATCH] spinlock spin with pause instruction

Hi.

I have noticed that Cygwin's spinlock goes into heavy sleeping code
for each spin. It seems it would be a good idea to actually try to
spin a bit first. There is this 'pause' instruction which let's the
CPU make such busy loops be less busy. Here is a patch to do this.

-- 
VH
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index 01cfd5b..56e66f1 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
 <at>  <at>  -1917,6 +1917,19  <at>  <at>  pthread_spinlock::lock ()
 {
   pthread_t self = ::pthread_self ();
   int result = -1;
+  unsigned spins = 0;
+
+  /*
+    We want to spin using 'pause' instruction on multi-core system but we
+    want to avoid this on single-core systems.
+
+    The limit of 1000 spins is semi-arbitrary. Microsoft suggests (in their
+    InitializeCriticalSectionAndSpinCount documentation on MSDN) they are
+    using spin count limit 4000 for their heap manager critical
+    sections. Other source suggest spin count as small as 200 for fast path
+    of mutex locking.
(Continue reading)

Mark Geisert | 11 Mar 09:07 2016

[PATCH] Documentation covering profiling Cygwin programs.

This patch set updates the Cygwin User's Guide to say something about profiling.

Existing winsup/doc files programming.xml and setup-env.xml are updated.
A new winsup/doc file gprof.xml is added.

I'd appreciate any comments y'all may have on formatting and/or content.
Thanks much,

..mark
From adc25dc19ade01fe42d4a4446a24b45ddd01f106 Mon Sep 17 00:00:00 2001
From: Mark Geisert <mark <at> maxrnd.com>
Date: Thu, 10 Mar 2016 23:56:56 -0800
Subject: [PATCH] Documentation covering profiling Cygwin programs.

---
 winsup/doc/gprof.xml       | 250 +++++++++++++++++++++++++++++++++++++++++++++
 winsup/doc/programming.xml |   1 +
 winsup/doc/setup-env.xml   |   9 +-
 3 files changed, 259 insertions(+), 1 deletion(-)
 create mode 100644 winsup/doc/gprof.xml

diff --git a/winsup/doc/gprof.xml b/winsup/doc/gprof.xml
new file mode 100644
index 0000000..b2043cb
--- /dev/null
+++ b/winsup/doc/gprof.xml
 <at>  <at>  -0,0 +1,250  <at>  <at> 
+<?xml version="1.0" encoding='UTF-8'?>
(Continue reading)

Mark Geisert | 9 Mar 09:39 2016

[PATCH] Support profiling of multi-threaded apps.

This is Version 3 incorporating review comments of Version 2.  This is just the 
code patch; a separate doc patch is forthcoming.

Change log relative to winsup/cygwin:

         * include/sys/cygwin.h: Add CW_CYGHEAP_PROFTHR_ALL.
         * cygheap.cc (cygheap_profthr_all): New C-callable function that
         runs cygheap's threadlist handing each pthread's thread handle in
         turn to profthr_byhandle().
         * external.cc (cygwin_internal): Add case CW_CYGHEAP_PROFTHR_ALL.
         * gmon.c (_mcleanup): Add support for multiple simultaneous
         gmon.out* files named via environment variable GMON_OUT_PREFIX.
         * gmon.h (struct gmonparam): Make state decl volatile.
         * mcount.c (_MCOUNT_DECL): Change stores into gmonparam.state to use
         Interlocked operations. Add #include "winsup.h", update commentary.
         * profil.c (profthr_byhandle): New function abstracting out the
         updating of profile counters based on a thread handle.
         (profthr_func): Update to call profthr_byhandle() to sample the main
         thread then call cygheap_profthr_all() indirectly through
         cygwin_internal(CW_CYGHEAP_PROFTHR_ALL) to sample all other threads.
         (profile_off): Zero targthr to indicate profiling was turned off.
         (profile_on): Fix handle leak on failure path.
         (profile_child): New callback func to restart profiling in child
         process after a fork if the parent was being profiled.
         (profile_ctl): Call pthread_atfork() to set profile_child callback.

Thanks,

..mark
(Continue reading)

Jon Turney | 8 Mar 12:14 2016
Picon
Gravatar

[PATCH] faq: Sort BLODA list and update advice on fixing fork failures

	* faq-using.xml(bloda): Alphabetically sort BLODA list for ease of
	finding things in it.  (fixing-fork-failures) Update to suggest
	rebase-trigger rather than running rebaseall via dash yourself.
	Mention detect_bloda CYGWIN token.

Signed-off-by: Jon Turney <jon.turney <at> dronecode.org.uk>
---
 winsup/doc/faq-using.xml | 88 ++++++++++++++++++++++++++++++------------------
 1 file changed, 56 insertions(+), 32 deletions(-)

diff --git a/winsup/doc/faq-using.xml b/winsup/doc/faq-using.xml
index ae72145..9194677 100644
--- a/winsup/doc/faq-using.xml
+++ b/winsup/doc/faq-using.xml
 <at>  <at>  -1286,39 +1286,39  <at>  <at>  behaviour which affect the operation of other programs, such as Cygwin.
 </para>
 <para>Among the software that has been found to cause difficulties are:</para>
 <para><itemizedlist>
-<listitem><para>Sonic Solutions burning software containing DLA component (when DLA disabled)</para></listitem>
-<listitem><para>Norton/McAfee/Symantec antivirus or antispyware</para></listitem>
-<listitem><para>Logitech webcam software with "Logitech process monitor" service</para></listitem>
-<listitem><para>Kerio, Agnitum or ZoneAlarm Personal Firewall</para></listitem>
-<listitem><para>Iolo System Mechanic/AntiVirus/Firewall</para></listitem>
-<listitem><para>LanDesk</para></listitem>
-<listitem><para>Windows Defender </para></listitem>
-<listitem><para>Various programs by Wave Systems Corp using wxvault.dll, including Embassy Trust
Suite and Embassy Security Center</para></listitem>
-<listitem><para>NOD32 Antivirus</para></listitem>
-<listitem><para>ByteMobile laptop optimization client</para></listitem>
-<listitem><para>Earthlink Total-Access</para></listitem>
(Continue reading)

Alexey Sokolov | 4 Mar 20:56 2016
Picon

[PATCH] Mention 64-bit Cygwin as another remedy for fork() failures.

Hello, patch to FAQ is attached.

--

-- 
Alexey Sokolov | SRE, Software Engineer | sokolov <at> google.com | +353 87 3767 850
Patrick Bendorf | 29 Feb 08:12 2016
Picon

[PATCH] ccwrap: fix build with non-english locale set

/winsup/
* ccwrap: fix build with non-english locale set
---
  winsup/ccwrap | 1 +
  1 file changed, 1 insertion(+)

diff --git a/winsup/ccwrap b/winsup/ccwrap
index 7580e7a..ef83085 100755
--- a/winsup/ccwrap
+++ b/winsup/ccwrap
 <at>  <at>  -12,6 +12,7  <at>  <at>  if ($ARGV[0] ne '++') {
      $cxx = 1;
  }
  die "$0: $ccorcxx environment variable does not exist\n" unless exists 
$ENV{$ccorcxx};
+$ENV{'LANG'} = 'C.UTF-8';
  my  <at> compiler = split ' ', $ENV{$ccorcxx};
  if (" <at> ARGV" !~ / -nostdinc/o) {
      my $fd;
--
2.7.0

Mark Geisert | 20 Feb 09:16 2016

[PATCH] gprof profiling of multi-threaded Cygwin programs, ver 2

Version 2 incorporating review comments of version 1.

Change log relative to winsup/cygwin:

         * include/sys/cygwin.h: Add CW_CYGHEAP_PROFTHR_ALL.
         * cygheap.cc (cygheap_profthr_all): New C-callable function that
         runs cygheap's threadlist handing each pthread's thread handle in
         turn to profthr_byhandle().
         * external.cc (cygwin_internal): Add case CW_CYGHEAP_PROFTHR_ALL.
         * gmon.c (_mcleanup): Add support for multiple simultaneous
         gmon.out* files named via environment variable GMON_OUT_PREFIX.
         * gmon.h (struct gmonparam): Make state decl volatile.
         * mcount.c (_MCOUNT_DECL): Change stores into gmonparam.state to use
         Interlocked operations. Add #include "winsup.h", update commentary.
         * profil.c (profthr_byhandle): New function abstracting out the
         updating of profile counters based on a thread handle.
         (profthr_func): Update to call profthr_byhandle() to sample the main
         thread then call cygheap_profthr_all() indirectly through
         cygwin_internal(CW_CYGHEAP_PROFTHR_ALL) to sample all other threads.

Thanks,

..mark

---
 winsup/cygwin/cygheap.cc           | 12 ++++++
 winsup/cygwin/external.cc          | 11 ++++++
 winsup/cygwin/gmon.c               | 81 ++++++++++++++++----------------------
(Continue reading)

Jon Turney | 18 Feb 11:50 2016
Picon
Gravatar

[PATCH] ssp: Fixes for 64-bit

Fix various 32/64-bit portability issues in ssp, the single-step profiler, and
also build it for 64-bit.

This didn't turn out to actually be very useful for what I wanted to use it for,
so it's only been lightly tested.

It appears that on x86_64, single-step exceptions occur for much more of the
code in system DLLs, unlike x86, so ssp may take much, much longer to profile
some programs.  There is existing code to use breakpoints to mitigate this, but
that is currently disabled.

Signed-off-by: Jon Turney <jon.turney <at> dronecode.org.uk>
---
 winsup/utils/ssp.c | 204 ++++++++++++++++++++++++++++-------------------------
 1 file changed, 109 insertions(+), 95 deletions(-)

diff --git a/winsup/utils/ssp.c b/winsup/utils/ssp.c
index 3136a9f..c9165f3 100644
--- a/winsup/utils/ssp.c
+++ b/winsup/utils/ssp.c
 <at>  <at>  -13,20 +13,6  <at>  <at> 
  *
  */

-#ifdef __x86_64__
-
-#include <stdio.h>
-
-int
-main (int argc, char **argv)
(Continue reading)


Gmane