- Previously, the command "cmd /c script -c cmd" in console of Win7
crashes. This seems to be due to a bug (?) of AttachConsole().
This patch adds workaround for this issue.
Currently, pty reattaches to the console of the process which is
predetermined by ConsoleProcessList() after temporarily attaching
to another console. After that, the console output handle opened
with the name "CONOUT$" may not be accessible in Win7.
This seems to happen when the attached process does not have the
same handle even if the console attached is the same. With this
patch, cygwin-console-helper which is started when pty master is
opened in console, is utilized to be a target process to which
pty reattaches if the OS is Win7.
Commit 0597c84b9b ("Cygwin: revamp TLS offsets computation")
introduced a really weird problem when building Cygwin with
optimization.
First of all, the tlsoffsets file is broken with -O2. This
can easily be fixed by running the compiler with -O0 when called
from the gentls_offsets script.
But it gets worse:
When creating sigfe.o with optimization, the generated machine code
uses incorrect offsets: For some reason the assembler codes using
_cygtls.stackptr as offset value are assembled into machine code
using _cygtls.pstackptr as offsets.
And as if that isn't already absurd enough, renaming _cygtls.pstackptr
to, say, _cygtls.blurb, fixes the assembled machine code expressions;
they use the value of _cygtls.stackptr again.
So I changed gentls_offsets and gendef to use _cygtls.foo_p rather
than _cygtls.pfoo and that fixes the assembled code in the optimized
case.
No, I can't explain that. There's no system in that behaviour.
It looks absolutely crazy.
Fixes: 0597c84b9b ("Cygwin: revamp TLS offsets computation")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Given we only called create_token on W7 WOW64 anyway, we can now
drop this function and all other functions only called from there
entirely.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
- convert gentls_offsets to a shell script, only running the target
compiler and gawk.
- Simplify cygtls.h. The new gentls_offsets script only requires two
lines with the "public:" keyword as markers. The comments are not
used anymore, the output is a preprocesses file without comments.
Align Makefile rules accordingly.
- Rather than generating perl variables and C #defines, just generate
.ecu statements and .include the TLS offsets file right from the
generated assembler file sigfe.s. It's the only place we really
need (some of) the offsets.
- Drop the target-specific name of the TLS offsets file and generate
it on the fly in the build dir. Fix configure and Makefile rules
accordingly.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Define default values for DLL_ENTRY, DIN_FILE, and TLSOFFSETS_H
and drop them from the x86_64-specific branch. Keep the mechanism
intact to allow other target CPUs if there ever will be.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This was a hack to begin with. Clean this mess up:
- Move definition of CYGTLS_PADSIZE to cygwin/config.h and drop
local cygtls_padsize.h
- Rename CYGTLS_PADSIZE to __CYGTLS_PADSIZE__ to keep namespace
clean. Redefine as macro, rather than as const.
- Move struct _reent first in struct _cygtls to allow using
__CYGTLS_PADSIZE__ as offset in __getreent().
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Added a new global __sglue object for all configurations.
Decouples the global file object list from the _GLOBAL_REENT
structure by using this new object instead of the __sglue member
of _GLOBAL_REENT in __sfp() and _fwalk_sglue().
Replaced _fwalk_reent() with _fwalk_sglue(). The change adds an
extra __sglue object as a parameter, which will allow the passing
of a global __sglue object separate from the __sglue member of
struct _reent. The global __sglue object will be added in a
follow-on patch.
fix tty_nr maj/min bits, vmmaxrss units, and x86 format mismatch:
ctty maj is 31:16, min is 15:0; tty_nr s/b maj 15:8, min 31:20, 7:0;
vmmaxrss s/b bytes not pages;
times all 64 bit - change formats of first two instances from %lu to %U;
realign sprintf formats and variables/values in more logical groups
- Previously, script command sometimes crashes by Ctrl-C in Win 7
if it is running in console, and non-cygwin app is foreground.
This patch fixes the issue.
- The recent commit "Cygwin: pty: Fix timing of creating invisible
console." breaks the feature added by commit 72770148, which
prevents pty from changing code page of parent console. This patch
restores that.
- Previously, invisible console was created in fixup_after_exec().
However, actually this should be done in fixup_after_fork(). this
patch fixes the issue.
- When temporarily attaching a console, the timing of acquiring
attach_mutex was not appropriate. This sometimes caused master
forwarding thread to crash on Ctrl-C in Windows 7. This patch
fixes the issue.
Remove the pointer indirection through the read-only _global_impure_ptr and
directly use a externally visible _impure_data object of type struct _reent.
This enables the static initialization of global data structures in a follow up
patch. In addition, we get rid of a machine-specific file.
By including sys/_stdint.h, all types from stdint.h are
exposed even if stdint.h isn't pulled in explicitely. Include
<machine/_default_types.h instead. Fix up newlib and Cygwin
files which rely on stdint.h types, too.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Even after fork, we might need the parent sigmask without having
access to the real _main_tls. There's a short time at process startup,
when _main_tls points to the system-allocated stack, but wait_sig is
already running. If we can't lock _main_tls, because find_tls can't
find it yet, we now access the parent's sigmask via child_info.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
The x86_64 thread stack area collides with the share user data in
recent versions of Windows. Let's get ourselvels get out of the
way and move the thread stack area in the former slack space
between DLL area and heap, from 0x6:00000000 to 0x8:00000000.
That quadruplicates the stack area, so allow bigger maximum stack
sizes.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Originally the function was designed to be used in forked
processes as well, but it has never been used this way. Drop
the parameter only required for forkees.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
A recent patch fixed gmondump to stop printing "0x0x" as an address
prefix. It turns out the Cygwin User's Guide and the gmondump and
ssp man pages (all from utils.xml) have examples of the same error.
- In the latest GDB (11.2-1), Ctrl-C behaviour is broken a bit for
non-cygwin inferior. For example, Ctrl-C on GDB prompt is not sent
to GDB but to the inferior. This patch fixes the issue.