* How can I determine why gdb throws unknown exceptions when debugging programs with threads on my Cygwin installation?
@ 2019-10-23 17:25 Jay P. Elston
2019-10-25 13:32 ` Jon Turney
0 siblings, 1 reply; 6+ messages in thread
From: Jay P. Elston @ 2019-10-23 17:25 UTC (permalink / raw)
To: cygwin
Hi all,
I developed a problem debugging threads on my Cygwin installed on a Window 7 PC -- gdb throws an unknown target exception when it gets to the pthread_crreate() call.
This problem seems localized to my PC (even after reinstalling Cygwin), and I am wondering what my next trouble shooting steps might be.
Here are the relevant lines from the gdb session:
$ gdb a.exe
GNU gdb (GDB) (Cygwin 8.1.1-1) 8.1.1
. . .
This GDB was configured as "x86_64-pc-cygwin".
. . .
Reading symbols from a.exe...done.
(gdb) run
Starting program: /home/jay.elston/threadTest/a.exe [New Thread 12908.0xc38] [New Thread 12908.0x25b4] [New Thread 12908.0x182c] [New Thread 12908.0x2958] [New Thread 12908.0x2ce4] [New Thread 12908.0x2878] [New Thread 12908.0x3044]
gdb: unknown target exception 0x80000001 at 0x778e7b97
Thread 7 received signal ?, Unknown signal.
[Switching to Thread 12908.0x3044]
0x00000000778e7b97 in ntdll!RtlAllocateHeap ()
from /cygdrive/c/Windows/SYSTEM32/ntdll.dll
(gdb) c
Continuing.
[Thread 12908.0x182c exited with code 2147483649] [Thread 12908.0x25b4 exited with code 2147483649] [Thread 12908.0x2878 exited with code 2147483649] [Thread 12908.0x2958 exited with code 2147483649] [Thread 12908.0x2ce4 exited with code 2147483649] [Inferior 1 (process 12908) exited with code 020000000001]
I discovered this problem last week, and wrote a very simple thread program (see listing of threads.c below), which I compiled, ran, and tried running under gdb with the commands:
$ gcc -g threads.c
$ ./a.exe
$ gdb a.exe
I suspected that maybe my Cygwin installation has "gone bad", so I removed Cygwin, rebooted, and put a fresh Cygwin install on my pc. (I did this by rebooting in safe mode, getting the latest version of setup-x86_64.exe and running the setup program as Administrator.) Alas, I still cannot debug threads :-(
I can do a directory listing of the dll where the exception is thrown:
$ ls -l /lib/w32api/libntdll.a
-rw-r--r-- 1 jay.elston Domain Users 1552334 Jun 8 2018 /lib/w32api/libntdll.a
Here is some version information:
$ uname -a
CYGWIN_NT-6.1 M4800-1RBTK12 3.0.7(0.338/5/3) 2019-04-30 18:08 x86_64 Cygwin
$ gdb -v
GNU gdb (GDB) (Cygwin 8.1.1-1) 8.1.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-cygwin".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc/gcc-7.4.0-1.x86_64/src/gcc-7.4.0/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-7.4.0-1.x86_64/src/gcc-7.4.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libcilkrts --enable-libgomp --enable-libitm --enable-libquadmath --enable-libquadmath-support --disable-libssp --enable-libada --disable-symvers --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible --enable-libstdcxx-filesystem-ts Thread model: posix gcc version 7.4.0 (GCC)
Here is the simple program:
threads.c:
// Start a thread using pthread_create
#include <stdio.h>
#include <errno.h>
#include <time.h>
#include <string.h>
#include <pthread.h>
void *fifteenSeconds(void *arg)
{
struct timespec sleepTime;
struct timespec sleptTime;
int i = 0;
while ( i++ < 2 ) {
printf("%d\n", i);
sleepTime.tv_sec = 01;
sleepTime.tv_nsec = 000000000;
nanosleep(&sleepTime, &sleptTime);
}
return (void *)0;
}
int main ( int argc, char *argv[] )
{
pthread_t fifteenSecondsThreadId;
int rc = 0;
rc = pthread_create(&fifteenSecondsThreadId, (void *)0, &fifteenSeconds, (void *)0);
if ( rc != 0 ) {
fprintf(stderr, "(%s,%d): Error %d creating thread for io handler: %s\n"
, __FILE__, __LINE__
, errno, strerror(errno)
);
return rc;
}
pthread_join(fifteenSecondsThreadId, (void *)0);
return 0;
}
Jay
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How can I determine why gdb throws unknown exceptions when debugging programs with threads on my Cygwin installation?
2019-10-23 17:25 How can I determine why gdb throws unknown exceptions when debugging programs with threads on my Cygwin installation? Jay P. Elston
@ 2019-10-25 13:32 ` Jon Turney
2019-10-25 13:49 ` Soegtrop, Michael
0 siblings, 1 reply; 6+ messages in thread
From: Jon Turney @ 2019-10-25 13:32 UTC (permalink / raw)
To: The Cygwin Mailing List; +Cc: Jay P. Elston
On 23/10/2019 18:25, Jay P. Elston wrote:
> Hi all,
>
> I developed a problem debugging threads on my Cygwin installed on a Window 7 PC -- gdb throws an unknown target exception when it gets to the pthread_crreate() call.
This seems to be saying that the exception isn't thrown when not run
under gdb?
> This problem seems localized to my PC (even after reinstalling Cygwin), and I am wondering what my next trouble shooting steps might be.
>
> Here are the relevant lines from the gdb session:
>
> $ gdb a.exe
> GNU gdb (GDB) (Cygwin 8.1.1-1) 8.1.1
> . . .
> This GDB was configured as "x86_64-pc-cygwin".
> . . .
> Reading symbols from a.exe...done.
> (gdb) run
> Starting program: /home/jay.elston/threadTest/a.exe [New Thread 12908.0xc38] [New Thread 12908.0x25b4] [New Thread 12908.0x182c] [New Thread 12908.0x2958] [New Thread 12908.0x2ce4] [New Thread 12908.0x2878] [New Thread 12908.0x3044]
> gdb: unknown target exception 0x80000001 at 0x778e7b97
0x80000001 is STATUS_GUARD_PAGE_VIOLATION
gdb reports this as 'unknown', as there's no unix signal this can be
mapped to (for example, STATUS_ACCESS_VIOLATION is mapped to SIGSEGV)
Firstly, I'd suggest you do a 'bt' here, and see if any third party DLLs
are in the call stack (e.g. AV products, etc.)
> Thread 7 received signal ?, Unknown signal.
> [Switching to Thread 12908.0x3044]
> 0x00000000778e7b97 in ntdll!RtlAllocateHeap ()
> from /cygdrive/c/Windows/SYSTEM32/ntdll.dll
> (gdb) c
> Continuing.
> [Thread 12908.0x182c exited with code 2147483649] [Thread 12908.0x25b4 exited with code 2147483649] [Thread 12908.0x2878 exited with code 2147483649] [Thread 12908.0x2958 exited with code 2147483649] [Thread 12908.0x2ce4 exited with code 2147483649] [Inferior 1 (process 12908) exited with code 020000000001]
>
Thanks for the simple test case.
Unfortunately, this doesn't reproduce for me.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: How can I determine why gdb throws unknown exceptions when debugging programs with threads on my Cygwin installation?
2019-10-25 13:32 ` Jon Turney
@ 2019-10-25 13:49 ` Soegtrop, Michael
2019-10-26 2:34 ` Jay P. Elston
0 siblings, 1 reply; 6+ messages in thread
From: Soegtrop, Michael @ 2019-10-25 13:49 UTC (permalink / raw)
To: The Cygwin Mailing List
Dear Jon,
It has been reported in the past that antivirus software from Trend Micro result in STATUS_GUARD_PAGE_VIOLATION in ntdll!RtlAllocateHeap ().
See: http://cygwin.1069669.n5.nabble.com/XWin-startup-crash-x86-64-Windows-10-td126544.html#a126561
Best regards,
Michael
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: How can I determine why gdb throws unknown exceptions when debugging programs with threads on my Cygwin installation?
2019-10-25 13:49 ` Soegtrop, Michael
@ 2019-10-26 2:34 ` Jay P. Elston
2019-10-26 3:20 ` Brian Inglis
2019-10-28 8:40 ` Soegtrop, Michael
0 siblings, 2 replies; 6+ messages in thread
From: Jay P. Elston @ 2019-10-26 2:34 UTC (permalink / raw)
To: Soegtrop, Michael, The Cygwin Mailing List
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2087 bytes --]
On October 25, 2019 6:48 AM, Michael Soegtrop wrote:
>It has been reported in the past that antivirus software from Trend Micro result in STATUS_GUARD_PAGE_VIOLATION in ntdll!RtlAllocateHeap ().
>See: http://cygwin.1069669.n5.nabble.com/XWin-startup-crash-x86-64-Windows-10-td126544.html#a126561
On the advice of Jon Turney, I ran a "bt f" command after gdb caught the exception, and it appears that a Trend Micro dll (TmUmEvt64.dll) is where the error occurs:
Thread 7 received signal ?, Unknown signal.
[Switching to Thread 8736.0x2bf4]
0x0000000077947b97 in ntdll!RtlAllocateHeap ()
from /cygdrive/c/Windows/SYSTEM32/ntdll.dll
(gdb) bt f
#0 0x0000000077947b97 in ntdll!RtlAllocateHeap ()
from /cygdrive/c/Windows/SYSTEM32/ntdll.dll
No symbol table info available.
#1 0x00000000779f233d in ntdll!EtwEventWriteStartScenario ()
from /cygdrive/c/Windows/SYSTEM32/ntdll.dll
No symbol table info available.
#2 0x00000000779f3014 in ntdll!EtwEventWriteStartScenario ()
from /cygdrive/c/Windows/SYSTEM32/ntdll.dll
No symbol table info available.
#3 0x0000000077947b9c in ntdll!RtlAllocateHeap ()
from /cygdrive/c/Windows/SYSTEM32/ntdll.dll
No symbol table info available.
#4 0x000007fefd2e1c68 in TmmonDestoryAddonObject ()
from /cygdrive/c/Windows/system32/tmumh/20019/AddOn/8.20.0.1028/TmUmEvt64.dll
No symbol table info available.
#5 0x000007fefd2267ab in ?? ()
from /cygdrive/c/Windows/system32/tmumh/20019/AddOn/8.20.0.1028/TmUmEvt64.dll
No symbol table info available.
#6 0x000007fefd2a551a in TmmonDestoryAddonObject ()
from /cygdrive/c/Windows/system32/tmumh/20019/AddOn/8.20.0.1028/TmUmEvt64.dll
This is not a Cygwin problem -- the solution is to be to add the Cygwin bin directory to Trend Micro's exception list. I will give this a try
after I get our IT department to do this.
\x03BKCB\x1cØ\x19[H\x1c\^[Ü\x1cÎ\b\b\b\b\b\b\x1a\x1d\x1d\x1c\x0eËØÞYÝÚ[ÛÛKÜ\x1cØ\x19[\Ë\x1d^[[\x03BTN\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\x1a\x1d\x1d\x1c\x0eËØÞYÝÚ[ÛÛKÙ\KÃB^[ØÝ[Y[\x18]\x1a[Û\b\b\b\b\b\b\b\b\x1a\x1d\x1d\x1c\x0eËØÞYÝÚ[ÛÛKÙ^[ØÜË\x1d^[[\x03B[ÝXØÜXH\x1a[Î\b\b\b\b\b\x1a\x1d\x1d\x1c\x0eËØÞYÝÚ[ÛÛKÛ[\vÈÝ[ÝXØÜXK\Ú[\^[\x19CBB
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How can I determine why gdb throws unknown exceptions when debugging programs with threads on my Cygwin installation?
2019-10-26 2:34 ` Jay P. Elston
@ 2019-10-26 3:20 ` Brian Inglis
2019-10-28 8:40 ` Soegtrop, Michael
1 sibling, 0 replies; 6+ messages in thread
From: Brian Inglis @ 2019-10-26 3:20 UTC (permalink / raw)
To: cygwin
On 2019-10-25 20:34, Jay P. Elston wrote:
> On October 25, 2019 6:48 AM, Michael Soegtrop wrote:
>> It has been reported in the past that antivirus software from Trend Micro
>> result in STATUS_GUARD_PAGE_VIOLATION in ntdll!RtlAllocateHeap ().
>> See:
>> http://cygwin.1069669.n5.nabble.com/XWin-startup-crash-x86-64-Windows-10-td126544.html#a126561
> On the advice of Jon Turney, I ran a "bt f" command after gdb caught the
> exception, and it appears that a Trend Micro dll (TmUmEvt64.dll) is where
> the error occurs:> This is not a Cygwin problem -- the solution is to be to add the Cygwin bin
> directory to Trend Micro's exception list. I will give this a try after I get
> our IT department to do this.
Trend Micro AV product was exploitable last week, from coordinated public
disclosure of a vulnerability on Oct 19, not patched until Oct 25: they were
notified Sep 9, and confirmed the issue Sep 25. Update immediately!
he Trend Micro AV product does not seem to perform as well, or rate as highly,
as the default, free MS Windows Defender, and other better AV packages.
Some of their vulnerabilities seem head-slappingly obviously *BAD*, like the
latest, allowing any malware called cmd.exe or regedit.exe to be downloaded from
anywhere and run without any checks!
--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: How can I determine why gdb throws unknown exceptions when debugging programs with threads on my Cygwin installation?
2019-10-26 2:34 ` Jay P. Elston
2019-10-26 3:20 ` Brian Inglis
@ 2019-10-28 8:40 ` Soegtrop, Michael
1 sibling, 0 replies; 6+ messages in thread
From: Soegtrop, Michael @ 2019-10-28 8:40 UTC (permalink / raw)
To: Jay P. Elston, The Cygwin Mailing List
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 953 bytes --]
Dear Jay,
> On the advice of Jon Turney, I ran a "bt f" command after gdb caught the
> exception, and it appears that a Trend Micro dll (TmUmEvt64.dll) is where the
> error occurs:
Since the message with a similar problem I posted is from April 2016, it would also make sense to report this to Trend Micro. Maybe they can manage to fix this bug before another 3 1/2 years are over.
Best regards,
Michael
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
\x03BKCB\x1cØ\x19[H\x1c\^[Ü\x1cÎ\b\b\b\b\b\b\x1a\x1d\x1d\x1c\x0eËØÞYÝÚ[ÛÛKÜ\x1cØ\x19[\Ë\x1d^[[\x03BTN\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\x1a\x1d\x1d\x1c\x0eËØÞYÝÚ[ÛÛKÙ\KÃB^[ØÝ[Y[\x18]\x1a[Û\b\b\b\b\b\b\b\b\x1a\x1d\x1d\x1c\x0eËØÞYÝÚ[ÛÛKÙ^[ØÜË\x1d^[[\x03B[ÝXØÜXH\x1a[Î\b\b\b\b\b\x1a\x1d\x1d\x1c\x0eËØÞYÝÚ[ÛÛKÛ[\vÈÝ[ÝXØÜXK\Ú[\^[\x19CBB
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-10-28 8:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-23 17:25 How can I determine why gdb throws unknown exceptions when debugging programs with threads on my Cygwin installation? Jay P. Elston
2019-10-25 13:32 ` Jon Turney
2019-10-25 13:49 ` Soegtrop, Michael
2019-10-26 2:34 ` Jay P. Elston
2019-10-26 3:20 ` Brian Inglis
2019-10-28 8:40 ` Soegtrop, Michael
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).