Re: [Mingw-w64-public] GDB and Microsoft Windows thread pool

2018-03-20 Thread Ruslan Garipov
SourceForge has removed the attachment from my previous post,
therefore I post link to the sample code here:
https://pastebin.com/6xKTiK9D.

Sorry.

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] GDB and Microsoft Windows thread pool

2018-03-20 Thread Ruslan Garipov
As it was suggested on the project's IRC channel, I am opening a preliminary
discussion of my issue in this mailing list.

I encountered an internal GDB error while was debugging C++ code using Microsoft
Windows thread pool API[1]. When several works/threads hit the same breakpoint
at the same time, I got the following GDB error:

> ../../../../src/gdb-8.0.1/gdb/infrun.c:5575: internal-error: int 
> finish_step_over(execution_control_state*): Assertion 
> `ecs->event_thread->control.trap_expected' failed.

Detailed information and sample code come below.

Compiler: mingw-w64 GCC (7.1 - 7.3); GDB (8.0.1 and 8.1); host OS is Microsoft
Windows 10 x64.

There is the sample code in the attachment. The code initializes thread pool
object and runs three background threads/works that almost do nothing. The
problem appears if one set a breakpoint (with the `break`, `dprintf`, etc.)
inside the thread's callback function. When the threads hit that breakpoint at
the same time, the internal error raises. The works submitted to the execution
in the `for` loop, because usually the error appears on the second submitting
and rarely on the first (see output log below).

Command line to compile the sample:

```
g++ -x c++ -std=gnu++1z -m64 -gdwarf -g3
-D_WIN32_WINNT=_WIN32_WINNT_WIN10 -DWINVER=_WIN32_WINNT_WIN10 -DDEBUG
sample.cxx
```

Below is dump of a GDB session:

```
D:\p>gdb -se a.exe
GNU gdb (GDB) 8.0.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
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-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from a.exe...done.
(gdb) dprintf sample.cxx:22, "[a] In a background thread.\n"
Dprintf 1 at 0x401574: file sample.cxx, line 22.
(gdb) r
Starting program: D:\p\a.exe
[New Thread 11420.0x308c]
[New Thread 11420.0x21f0]
[New Thread 11420.0x2c18]
[New Thread 11420.0x1a48]
[New Thread 11420.0x2c80]
[New Thread 11420.0x1b04]
[a] In a background thread.
[a] In a background thread.
[New Thread 11420.0x2404]
[a] In a background thread.
[a] In a background thread.
../../../../src/gdb-8.0.1/gdb/infrun.c:5575: internal-error: int
finish_step_over(execution_control_state*): Assertion
`ecs->event_thread->control.trap_expected' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) y

This is a bug, please report it.  For instructions, see:
.

../../../../src/gdb-8.0.1/gdb/infrun.c:5575: internal-error: int
finish_step_over(execution_control_state*): Assertion
`ecs->event_thread->control.trap_expected' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) n
```

In the session above the error raised on the second work submitting (the first
iteration of the loop was OK).

I tried different compiler version (7.1, 7.2 and 7.3) with different thread
models of the runtime (posix and win-32); different version of GDB (8.0.1, 8.1
and 7.9 shipped with Intel C++ compiler (gdb-ia)) and I always got the same
result -- internal error of GDB.

And now I cannot debug my program without ugly workarounds... Any help will be
appreciated.

Thanks!

[1] 
https://msdn.microsoft.com/en-us/library/windows/desktop/ms686766(v=vs.85).aspx
"Thread Pool API"
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH] crt: Share odbc32.def between lib64 and libarm32

2018-03-20 Thread Martin Storsjö

On Tue, 20 Mar 2018, Liu Hao wrote:


在 03/20/2018 03:51 PM, Martin Storsjö 写道:

On Wed, 28 Feb 2018, Martin Storsjö wrote:


Also provide it for libarm64.

Signed-off-by: Martin Storsjö 
---
mingw-w64-crt/lib-common/odbc32.def | 192

mingw-w64-crt/lib64/odbc32.def  | 190
---
mingw-w64-crt/libarm32/odbc32.def   | 183
--
mingw-w64-crt/libarm64/Makefile.am  |   1 +
4 files changed, 193 insertions(+), 373 deletions(-)
create mode 100644 mingw-w64-crt/lib-common/odbc32.def
delete mode 100644 mingw-w64-crt/lib64/odbc32.def
delete mode 100644 mingw-w64-crt/libarm32/odbc32.def


Ping

// Martin


The patch looks okay to me.


Thanks, pushed.

// Martin
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH] crt: Share odbc32.def between lib64 and libarm32

2018-03-20 Thread Liu Hao
在 03/20/2018 03:51 PM, Martin Storsjö 写道:
> On Wed, 28 Feb 2018, Martin Storsjö wrote:
> 
>> Also provide it for libarm64.
>>
>> Signed-off-by: Martin Storsjö 
>> ---
>> mingw-w64-crt/lib-common/odbc32.def | 192
>> 
>> mingw-w64-crt/lib64/odbc32.def  | 190
>> ---
>> mingw-w64-crt/libarm32/odbc32.def   | 183
>> --
>> mingw-w64-crt/libarm64/Makefile.am  |   1 +
>> 4 files changed, 193 insertions(+), 373 deletions(-)
>> create mode 100644 mingw-w64-crt/lib-common/odbc32.def
>> delete mode 100644 mingw-w64-crt/lib64/odbc32.def
>> delete mode 100644 mingw-w64-crt/libarm32/odbc32.def
> 
> Ping
> 
> // Martin

The patch looks okay to me.


-- 
Best regards,
LH_Mouse



signature.asc
Description: OpenPGP digital signature
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH] crt: Share odbc32.def between lib64 and libarm32

2018-03-20 Thread Martin Storsjö

On Wed, 28 Feb 2018, Martin Storsjö wrote:


Also provide it for libarm64.

Signed-off-by: Martin Storsjö 
---
mingw-w64-crt/lib-common/odbc32.def | 192 
mingw-w64-crt/lib64/odbc32.def  | 190 ---
mingw-w64-crt/libarm32/odbc32.def   | 183 --
mingw-w64-crt/libarm64/Makefile.am  |   1 +
4 files changed, 193 insertions(+), 373 deletions(-)
create mode 100644 mingw-w64-crt/lib-common/odbc32.def
delete mode 100644 mingw-w64-crt/lib64/odbc32.def
delete mode 100644 mingw-w64-crt/libarm32/odbc32.def


Ping

// Martin
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public