CloseHandle gets redefined to a macro calling an internal function
in debug.h when building with -DDEBUGGING, but profiler has no access
to that function.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Cygwin tool ssp generates gmon.out files with different address
resolution than other tools do. Two address bytes per bucket rather than
the usual four address bytes. Gprof can deal with the difference but
gmondump can't because the latter's gmon.out header validation fails.
- Remove the offending portion of the header validation code.
- Make sure all code can handle differing address resolutions.
- Display address resolution in verbose data dumps.
- Change "rawarc" to "struct rawarc" in certain sizeof expressions to
avoid buffer overrun faults.
- When "-v" (verbose) is specified, note when there is missing bucket
data or rawarc data.
These have no effect on x86_64. Retain a few occurrences of __cdecl
in files imported from other sources.
Also retain all occurrences of WINAPI, even though the latter is
simply a macro that expands to __stdcall. Most of these occurrences
are associated with Windows API functions, and removing them might
make the code confusing instead of simpler.
Link directly with RegDeleteKeyExW(), available since Vista.
(It's unclear the LoadLibrary wrapper was ever doing anything useful
here, as (i) DLL lookup in PATH was avoided as advapi32 is already
loaded into the process, and (ii) advapi32 is a 'known DLL' which is
only ever loaded from system directory)
- 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.
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>
glibc getconf doesn't print "undefined" for undefined values
in -a output. It just prints the empty string. Do it the
same way.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
i. e. Vista/2008. This drops support for the sr_CS locale.
Regenerate LC_MESSAGES and LC_TIME ERA data from more recent Linux
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This was used before switching to automake to allow easy tweaking
of optimization and debugging settings from the command line during
testing. Reenable.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
The GCC diagnostic ignored "-Wstringop-overflow" pragma doesn't work
as expected anymore. Use the still working expression.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
The register keyword was already deprecated with C++11, but
with C++17 it has been entirely removed.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Make sure to cast to ulong all DWORD values displayed with format "%lu".
More instances are fixed here than in either my earlier unused patch or
Corinna's patch. I decided to use typedef..ulong for more compact code.
Address jturney's reported small issues:
- Remove explicit external ref for cygwin_internal() as it is already
provided by <sys/cygwin.h>.
- Leave intact ref for cygwin_dll_path[] as it is required by function(s)
in path.cc that profiler uses. Added comment to that effect.
- Delete existing main() wrapper. Rename main2() to main(). This because
profiler is now a Cygwin program and doesn't need to dynamically load
cygwin1.dll.
- Documentation issues will be addressed in a separate xml patch.
(I would have linked message-ids of Corinna's and Jon's messages for
proper theading but I no longer have their original emails and the mail
archives don't show msgids any more.)
The doc for gmondump says 1 or more FILENAME are expected, but 0 is
handled. That's an oversight. Make invocation with 0 FILENAMEs print a
one-line help message.
Reword the beginning of profiler's description doc to clarify target's
child processes are run but only optionally profiled.
DWORD has different types on 32 and 64 bit. Use a common cast to
unsigned long to use %lu format for DWORD values throughout.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
These are updates to wire into the build tree the new tools profiler and
gmondump, and to supply documentation for the tools.
The documentation for profiler and ssp now mention each other but do not
discuss their similarities or differences. That will be handled in a
future update to the "Profiling Cygwin Programs" section of the Cygwin
User's Guide, to be supplied.
This new tool was formerly part of 'profiler' but was spun out thanks to
Jon T's reasonable review comment. Gmondump is more of a debugging tool
than something users might have need for. Users would more likely use
gprof to make use of symbolic info like function names and source line
numbers.
The new tool formerly known as cygmon is renamed to 'profiler'. For the
name I considered 'ipsampler' and could not think of any others. I'm open
to a different name if any is suggested.
I decided that a discussion of the pros and cons of this profiler vs the
existing ssp should probably be in the "Profiling Cygwin Programs" section
of the Cygwin User's Guide rather than in the help for either. That
material will be supplied at some point.
CONTEXT buffers are made child-specific and thus thread-specific since
there is one profiler thread for each child program being profiled.
The SetThreadPriority() warning comment has been expanded.
chmod() works on Cygwin so the "//XXX ineffective" comment is gone.
I decided to make the "sample all executable sections" and "sample
dynamically generated code" suggestions simply expanded comments for now.
The profiler program is now a Cygwin exe rather than a native exe.
The default PSAPI_VERSION is controlled by WIN32_WINNT, which we set to
0x0a00 when building utils since 48a76190 (and is the default in w32api
>= 9.0.0)
In order for the built executables to run on Windows Vista, we must also
define PSAPI_VERSION as 1 (otherwise '#define GetModuleFileNameExA
K32GetModuleFileNameExA' causes a 'The procedure entry point
K32GetModuleFilenameExA could not be located in the dynamic link library
kernel32.dll' error at run time).
Also drop uneeded psapi.h from dlfcn.cc (31ddf45d), resource.cc
(34a6eeab) and ps.cc (1def2148).
The default PSAPI_VERSION is controlled by WIN32_WINNT, which we set to
0x0a00 when building ldd, which gets PSAPI_VERSION=2.
This causes K32GetModuleFileNameEx to be used for GetModuleFileNameEx,
which isn't available on Windows Vista.
Define PSAPI_VERSION as 1 for the built executable to work on Windows
Vista.
Avoid this warning:
[...]/winsup/utils/mingw/../path.cc:569:1: warning: 'void read_mounts() ' defined but not used [-Wunused-function]
569 | read_mounts ()
| ^~~~~~~~~~~
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Drop the unexpected behaviour to run chattr in the CWD if no file has
been specified on the command line. Bail out with usage info instead.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
chattr [mode] dir
incorrectly recurses one level into the given directory, even if the
--recursive option has not been used. This patch adds a test to avoid
this bug.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Allow multiple characters also in first '-mode' argument.
Use '-H' instead of '-h' for '--help' to fix ambiguity with
hidden attribute. Fix help and usage texts and documentation.
Signed-off-by: Christian Franke <christian.franke@t-online.de>
Move all the source files used in utils/mingw/ into that subdirectory,
so the built objects are in the expected place.
(path.cc requires some more unpicking, and even then there is genuinely
some shared code, so use a trivial file which includes the real path.cc
so the object file is generated where expected)
Rather than having testsuite.h do various things, depending on defines,
just have it do one thing, and then explicitly redirect to test stubs in
path.cc when building test.
We are building a ps executable, but the rule to build the target
collides with an auto-generated, documentation-related `ps' rule.
Work around that by naming the executable "cygps" at build time
and use a transform rule to rename it at installation time.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
v2:
* Include tzmap.h in BUILT_SOURCES
* Make per-file flags appear after user-supplied CXXFLAGS, so they can
override optimization level.
* Correct .o files used to define symbols exported by libm.a
* Drop gcrt0.o mistakenly included in libgmon.a
* Add missing line continuations in GMON_FILES value
v3:
* use per-file flags for .c compilation
* override C{XX,}FLAGS, as they are set on the command line by top-level make
v4:
* Drop -Wno-error=write-strings from path_testsuite CXXFLAGS
v5:
* Update for changes in master
- Add -fno-threadsafe-statics to CXX flags
- Add hypotl.cc
- Remove fenv.cc (in favour of newlib), add fenv.c stub
- Add proc.5 manpage rules
There's doesn't seem to be much use in independently distributing these
subdirectories, so allowing them to be independently configured seems
pointless and overcomplicated.
The order in which the subdirectories are built is still a little odd,
as cygwin is linked with libcygserver, and cygserver is then linked with
cygwin. So, we build the cygwin directory first, which invokes a build
of libcygserver in the cygserver directory, and then build in the
cygserver directory to build the cygserver executable.
Drop AC_CONFIGURE_ARGS, since we don't need to recursively call
configure with the same arguments anymore.
Slightly refine when we build utils: Previously we didn't build any
utils if MinGW compiler use was avoided, now we just avoid building
those utils which require that compiler.
Greatly simplify how winsup_srcdir and target_builddir are set, since
we're only configuring from one directory. (These are still kept
absolute, since we don't adjust them where used for being used in a
subdirectory).
Remove configure.cygwin and put it's (greatly reduced) contents inline
in the one place it's used now.
Remove generated configure and aclocal.m4 in subdirectories.
This has a test of the path translation code used in various utilities
(mount, cygpath, strace).
MOUNT_BINARY is replaced with the absence of MOUNT_TEXT since 26e0b37e.
The issys member of mnt_t struct was removed in b677a99b.
> $ make check
[...]
> total tests: 63
> pass : 63 (100.0%)
> fail : 0 (0.0%)
'-fno-exceptions -fno-rtti' are already present in the compile command
COMPILE.cc set by Makefile.common, so we don't need to add them to
CXXFLAGS as well.
b55e3f19 was a bit too aggressive in dropping, rather than just
un-exporting these Makefile variables. We need to set these to the
configured host compiler if we are cross-compiling, otherwise they
default to the build compiler.
Also export CC to the mkvers.sh script (which requires it since
4eca5e6a). It's unclear why we can't just cause windres to use the
build 'cpp' as the pre-processor there.