summaryrefslogtreecommitdiffstats
path: root/winsup/utils/strace.cc
Commit message (Collapse)AuthorAgeFilesLines
* Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout optioncygwin-2_5_2-releaseCorinna Vinschen2016-06-231-4/+1
| | | | | | | | | | | | | | Bump GPLv2+ to GPLv3+ for some files, clarify BSD 2-clause. Everything else stays under GPLv3+. New Linking Exception exempts resulting executables from LGPLv3 section 4. Add CONTRIBUTORS file to keep track of licensing. Remove 'Copyright Red Hat Inc' comments. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* strace: Handle ofile descriptor more carefully.cygwin-2_2_0-releaseCorinna Vinschen2015-08-031-6/+8
| | | | | | | | | Fix coverity CIDs 128250 - 128252 * strace.cc (main2): Don't call setvbuf on NULL descriptor. Explicitely fclose ofile. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygwin: Fix crashes under AllocationPreference=0x100000 conditionCorinna Vinschen2015-07-291-2/+16
| | | | | | | | | | | | | * cygtls.h: Include cygtls_padsize.h and define CYGTLS_PADSIZE there. * cygtls_padsize.h: New file. Define CYGTLS_PADSIZE. * environ.cc (parse_options): Fix NULL pointer access. * init.cc (threadfunc_fe): Do not force stack align on x86_64. * strace.cc (main2): Rename from main. (main): Make room for _cygtls area on stack and just call main2. Add comment to explain why. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Improve strace to log most Windows debug eventsJon TURNEY2015-06-111-2/+73
| | | | | | | | | | | | | | | | | | | | Not sure if this is wanted, but on a couple of occasions recently I have been presented with strace output which contains an exception at an address in an unknown module (i.e. not in the cygwin DLL or the main executable), so here is a patch which adds some more information, including DLL load addresses, to help interpret such straces. v2: Use NtQueryObject() for HANDLE -> filename conversion Add new '-e' option to toggle this additional logging 2015-06-07 Jon Turney <jon.turney@dronecode.org.uk> * strace.cc (proc_child): Log process and thread create and exit, and DLL load and unload. (GetFileNameFromHandle): New function. Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
* * Merge in cygwin-64bit-branch.Corinna Vinschen2013-04-231-8/+17
|
* * bloda.cc: Drop Mingw.org considerations.Corinna Vinschen2012-11-261-5/+1
| | | | | * dump_setup.cc: Ditto. * strace.cc: Ditto.
* ChangeLog:Christopher Faylor2012-11-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2012-11-12 Christopher Faylor <me.cygwin2012@cgf.cx> * Makefile.common: Revamp for new configury. Add default compilation targets, include .E processing. Add magic for allowing "CFLAGS" to control optimization options in "CXXFLAGS". * configure.cygwin: New include for Cygwin configure.in's. * acinclude.m4: Delete old definitions. Implement AC_WINDOWS_HEADERS, AC_WINDOWS_LIBS, AC_CYGWIN_INCLUDES, target_builddir, winsup_srcdir. * aclocal.m4: Regenerate. * autogen.sh: New file. * ccwrap: New script. * c++wrap: New script. * config.guess: New script. * config.sub: New script. * configure: Regenerate. * configure.in: Eliminate LIB_AC_PROG_* calls in favor of standard. Delete ancient target test. * install-sh: New script. cygserver/ChangeLog: 2012-11-12 Christopher Faylor <me.cygwin2012@cgf.cx> * Makefile.in: Revamp for new configury. * configure.in: Revamp for new configury. * aclocal.m4: Regenerate. * configure: Ditto. * autogen.sh: New script. cygwin/ChangeLog: 2012-11-22 Christopher Faylor <me.cygwin2012@cgf.cx> * select.cc (select): Don't return -1 when we've timed out after looping. 2012-11-22 Christopher Faylor <me.cygwin2012@cgf.cx> * Makefile.in: Revamp for new configury. (datarootdir): Add variable setting. (winver_stamp): Accommodate changes to mkvers.sh setting. (libc.a): Fix race when libm.a might not have been built yet. * configure.in: Revamp for new configury. * aclocal.m4: Regenerate. * configure: Ditto. * autogen.sh: New script. * mkvers.sh: Find include directives via CFLAGS and friends rather than assuming that w32api lives nearby. utils/ChangeLog: 2012-11-12 Christopher Faylor <me.cygwin2012@cgf.cx> * aclocal.m4: Regenerate. * configure: Ditto. * autogen.sh: New script. * configure.in: Revamp for new configury. * Makefile.in: Revamp for new configury. Rename ALL_* to just *. Always use "VERBOSE" setting. (MINGW_CXX): Don't include CFLAGS in definition. (all): Define target first, before everything else so that it is the default. (ps.exe): Don't add useless -lcygwin. (ldh.exe): For consistency, add to existing MINGW_LDFLAGS rather than redefining them. (cygcheck.exe): Always include -lz for MINGW_LDFLAGS. Don't try to figure out where to find it. (dumper.exe): Simplify check. Assume libraries are installed rather than trying to retrieve from source tree. (install): Just use /bin/mkdir to create directories. (Makefile): Regenerate when standard dependencies change. * dump_setup.cc: Always include zlib.h. Remove accommodations for it possibly not existing. * parse_pe.cc: Add define which allows building with installed binutils package. * dumper.cc: Ditto.
* * configure.in: Add check for MINGW_CXX. Remove libiconv check.Yaakov Selkowitz2012-10-241-3/+3
| | | | | | | | | | | * configure: Regenerate. * Makefile.in: Remove references to mingw and w32api directories. Use MINGW_CXX instead of mingw script to build MINGW_BINS. Check for libiconv with $CC --print-file-name. * cygcheck.cc: Use relative include paths for Cygwin headers. * path.cc: Ditto. * strace.cc: Ditto * mingw: Remove.
* * Makefile.in (cygcheck.exe): Link against psapi.dll.Corinna Vinschen2012-07-111-2/+8
| | | | | | | | | | | | | | | | | | | | | | * bloda.cc: Change include section to work with Mingw64 headers. Include psapi.h. Use SystemProcessInformation instead of SystemProcessesAndThreadsInformation throughout and add define for w32api headers. Ditto for PSYSTEM_PROCESS_INFORMATION vs. PSYSTEM_PROCESSES. (system_module_list): New type to replace SYSTEM_MODULE_INFORMATION. Change usage throughout accordingly. (get_module_list): Fetch module list using PSAPI functions EnumDeviceDrivers and GetDeviceDriverBaseNameA. * cygcheck.cc (max): Define as __max if not defined already. (alloca): Only define if not defined already. (handle_unique_object_name): Use explicit sharing flags rather than FILE_SHARE_VALID_FLAGS which officially is only available in DDK headers. (PRODUCT_ULTIMATE_E): Only define if not defined already. * dump_setup.cc: Change include section to work with Mingw64 headers. (NtQueryAttributesFile): Drop NTOSAPI aka DECLSPEC_IMPORT. * strace.cc: Change include section to work with Mingw64 headers. (alloca): Only define if not defined already.
* * strace.cc (proc_child): Don't right-shift exit value.Christopher Faylor2012-01-311-4/+3
| | | | (main): Call ExitProcess() to exit exactly the same way as any straced child.
* Clean up whitespace.Christopher Faylor2011-12-171-22/+22
|
* * strace.cc (attach_process): Use NT_SUCCESS to figure out ifChristopher Faylor2011-11-241-3/+7
| | | | | | | | NtSetInformationProcess succeeded. (handle_output_debug_string): Put back DebugActiveProcess since it seems to still be needed (on my system at least). Detect new format _STRACE_INTERFACE_ACTIVATE_ADDR which informs whether this is a forked process or not. Use that to decide if forkdebug should be handled.
* * strace.cc (handle_output_debug_string): Disable code which attempted to addChristopher Faylor2011-11-141-0/+4
| | | | | stuff in between '****' blocks since they no longer are the first thing output by an straced process.
* * Align usage output, version output, as well as usage and versionCorinna Vinschen2011-10-101-30/+21
| | | | | | | | | option handling to use the same style throughout all Cygwin utils. Throughout use program_invocation_short_name to refer to current process name in Cygwin executables. * utils.sgml: Align documentation to above change. Add missing sections for getconf, ldd, and setmetamode. * strace.cc (proc_child): Avoid compiler warning.
* * strace.cc (attach_process): Try to turn off DEBUG_ONLY_THIS_PROCESSJon TURNEY2011-09-151-3/+21
| | | | | | | if Attaching to a process with the trace-children flag set. (handle_output_debug_string): Apparently we don't need to explicitly attach for debugging when a child process starts * Makefile.in (strace.exe): Link with ntdll
* * loadlib.h: New header implementing safe LoadLibrary calls.Corinna Vinschen2010-08-281-0/+1
| | | | | | | | | | | | Include throughout files using LoadLibrary function. * cygcheck.cc (dump_sysinfo): Retrieve kernel32.dll handle via GetModuleHandle, rather than using LoadLibrary. * cygpath.cc (get_long_name): Ditto. (do_sysfolders): Append .dll suffix in LoadLibrary call. * ldh.cc (WinMain): Use LoadLibraryExW with DONT_RESOLVE_DLL_REFERENCES to avoid loading malicious library code. * locale.cc (print_locale_with_codeset): Change way to retrieve kernel32.dll path.
* * strace.cc (mnemonic_table): Add "special" mask option.Christopher Faylor2010-02-221-19/+22
| | | | | (usage): Document it. * utils.sgml: Ditto.
* Update copyrightChristopher Faylor2010-02-191-1/+1
|
* utils/ChangeLog:Christopher Faylor2010-02-191-0/+2
| | | | | | | | | | * strace.cc (mnemonic_table): Add pthread mask option. (usage): Document strace pthread mask option. * utils.sgml: Ditto. cygwin/ChangeLog: * include/sys/strace.h: Remove old code. Add support for ptrace tracing.
* * cygcheck.cc (cygwin_dll_path): New global variable.Corinna Vinschen2009-11-041-0/+2
| | | | | | | | (load_cygwin): Fetch cygwin DLL path and store in cygwin_dll_path. * strace.cc: Full ditto. * path.cc (read_mounts): First use the path stored in cygwin_dll_path, if available. Then fall back to fetching own path. Add comment. Drop printing warnings since they look funny in strace output.
* * strace.cc (main): Open trace output file in UNIX mode.Corinna Vinschen2009-07-151-2/+3
|
* * strace.cc (create_child): Set CYGWIN=noglob when starting new process so thatChristopher Faylor2009-04-221-1/+11
| | | | Cygwin will leave already-parsed the command line alonw.
* * cygcheck.cc (dump_sysinfo): Fix compiler warning in printf.Corinna Vinschen2009-03-241-1/+1
| | | | | * strace.cc (proc_child): Ditto. * ldd.cc: Remove now useless undef wcscasecmp.
* * cygcheck.cc (pathlike::check_existence): Remove class name from declaration.Christopher Faylor2008-09-121-3/+3
| | | | | | | | | | | | | | | | | | | | | (display_internet_error): Use proper format specifier for DWORD. (environ): Remove unneeded declaration. (main): Use brace around nested if to avoid an overly-helpful compiler warning. * dump_setup.cc (parse_filename): Reorganize nested if to avoid an overly-helpful compiler warning. * path.cc (GUID_shortcut): Use braces around part of initializer which needs them. (conv_fstab_spaces): Parenthesize assignment in while loop to avoid a compiler warning. (struct opt): Make static. * ps.cc (main): Reorganize nested if to avoid an overly-helpful compiler warning. * regtool.cc: Make some anonymous structs static to avoid a compiler warning. * ssp.c (lookup_thread_id): Initialize *tix to zero to avoid potential uninitialized use. * strace.cc (add_child): Use proper format specifier for DWORD. (remove_child): Ditto. (proc_child): Ditto.
* * strace.cc (create_child): Don't convert a path from cygwin format unless itChristopher Faylor2007-07-231-1/+2
| | | | has a slash.
* * strace.cc (usage): Add missing description for -q.Christopher Faylor2007-07-101-1/+2
|
* * strace.cc (proc_child): Propagate return code from child process.Christopher Faylor2006-05-241-5/+10
| | | | | (dostrace): Ditto. (main): Ditto.
* *** cygwin DLL Changes:Christopher Faylor2005-12-291-42/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * child_info.h (CURR_CHILD_INFO_MAGIC): Reset. (child_info::dwProcessId): Delete. (child_info::straced): New variable. (child_info::handle_fork): New member function. * dcrt0.cc (in_forkee): New global variable. (__cygwin_user_data::forkee): Mark as obsolete. (do_global_ctors): Use in_forkee rather than user_data->forkee. (get_cygwin_startup_info): Ditto. Deal with new straced field to allow strace to deal with children of attached processes. (initial_env): Accommodate changes to strace::hello. (child_info_fork::handle_fork): Rename from plain old 'handle_fork'. Move alloc_stack() call elsewhere. (dll_crt0_0): Fill out more of user_data. Reference handle_fork via fork_info. Add some debugging output. (_dll_crt0): Don't wait for sync thread if sync_startup is invalid. Zero sync_startup here. Call alloc_stack() here, if appropriate. (dll_crt0_1): Use in_forkee rather than user_data->forkee. (dll_crt0): Ditto. * malloc_wrapper.cc (malloc_init): Ditto. * dll_init.cc (in_forkee): Remove local static version of this variable. (dll_list::load_after_fork): Don't set in_forkee here. * external.cc (cygwin_internal): Use strace method rather than accessing field directly. * fhandler.cc (fhandler_base::read): Ditto. * fhandler_tty.cc (fhandler_tty_common::__acquire_output_mutex): Ditto. * fork.cc (frok::parent): Invoke strace write_childpid to communicate with potential strace. (child_copy): Add more detail to debugging output. * init.cc (calibration_id): New static variable. (prime_threads): Set sync_startup to invalid handle if we already know about thread_func_ix. Use static calibration_id to hold calibration thread id. * munge_threadfunc (munge_threadfunc): Don't try to debug if we don't find threadfunc_ix. (dll_entry): Avoid calling munge_threadfunc and _cygtls::remove on non-cygwin threads invoked during process startup. * pinfo.cc (set_myself): Always call strace.hello here regardless of DEBUGGING. * sigproc.cc (child_info::child_info): Remove spurious handling of dwProcessId. Set straced as appropriate. * spawn.cc (spawn_guts): Rename ciresrv to ch. Invoke strace write_childpid to communicate with potential strace. * strace.cc: Include child_info.h. (strace::hello): Remove inited test. Use active() method to test if strace has been activated. Handle case where we are started before (mypid): New function. (strace::vsprntf): Try to deal more intelligently with case where progname may not be filled out. Put pid in parentheses if it is a windows pid rather than a cygwin pid. myself has been filled out. (strace::write_childpid): New function for notifying strace about the creation of children. (strace::vprntf): Use strace method rather than accessing field directly. (strace_printf): Ditto. (strace::wm): Ditto. * winsup.h (in_forkee): Declare. * include/sys/strace.h (strace::write_childpid): Declare new function. (strace::attached): Define new function. (strace::active): Ditto. (strace::active_val): Ditto. (_STRACE_ON): Delete. (_STRACE_OFF): Ditto. (define_strace0): Use strace method rather than accessing field directly. (strace_printf_wrap): Ditto. (strace_printf_wrap1): Ditto. *** cygwin utils changes: * strace.cc (nprocesses): Make static global. (quiet): New variable. (strace_active): Ditto. (add_child): Increment nprocesses here. Don't add a child if it is already added (windows bug?). Report on child if not quiet. (get_child): Just return NULL if child not found. (remove_child): Report on child if not quiet. (attach_process): Don't complain if given a windows process. Use windows pid in error. (handle_output_debug_string): Issue error if trying to manipulate a process that we don't know about. Handle _STRACE_CHILD_PID - attach to reported child when we get this. (proc_child): Move nprocesses to file scope. Report on exceptions. (longopts): Implement "--quiet". (opts): Implement "-q". (main): Manipulate quiet flag. * utils.sgml (strace): Add words describing '-q'.
* * strace.cc (show_usecs): Renamed from 'usecs'.Christopher Faylor2005-12-051-4/+6
| | | | | | | (main): Use show_usecs rather than usecs. Toggle delta if '-u' is specified. (handle_output_debug_string): Avoid printing microsecond timestamp if show_usecs == 0. * utils.sgml (strace): Add words to describe '-u'.
* revert erroneous checkinChristopher Faylor2005-10-111-5/+2
|
* * Makefile.common (CFLAGS_COMMON): Add -Wstrict-aliasing.Christopher Faylor2005-10-111-2/+5
|
* * cygcheck.cc (load_cygwin): Make half-hearted attempt to work with older DLLs.Christopher Faylor2005-05-271-1/+1
| | | | * strace.cc (load_cygwin): Ditto.
* * cygcheck.cc (cygwin_internal): Define as a "C" function.Christopher Faylor2005-05-171-1/+3
| | | | | * strace.cc (cygwin_internal): Ditto. * cygpath.cc (print_version): Update copyright.
* * cygcheck.cc (load_cygwin): Don't touch $PATH for now.Corinna Vinschen2005-05-151-1/+1
| | | | | (print_version): Fix copyright. * strace.cc (print_version): Ditto.
* * strace.cc (attach_process): Don't call load_cygwin(). Assume that it'sChristopher Faylor2005-05-091-3/+9
| | | | | | already happened. (dotoggle): Ditto. (main): Set argv from cygwin environment, if it exists.
* * strace.cc (handle_output_debug_string): Fix compiler warning.Corinna Vinschen2005-03-071-2/+2
|
* * kill (getsig): Avoid buffer overflow when generating a signal name.Christopher Faylor2005-02-271-2/+2
| | | | * strace.cc (handle_output_debug_string): Make error a little more specific.
* * ps.cc (main): Eliminate use of PID_ZOMBIE.Christopher Faylor2005-01-161-2/+13
| | | | | | | * strace.cc (main): Recognize new option for displaying hex value of strace type. (handle_output_debug_string): Prepend output with hex value of strace message if -H is specified.
* * strace.cc (_impure_ptr): Remove.Corinna Vinschen2004-10-061-6/+0
|
* * Makefile.in (build_dumper): Detect missing iconv library.Christopher Faylor2004-02-211-1/+1
| | | | | | * cygpath.cc (dowin): Report on filename conversion errors. (doit): Ditto. * strace.cc (main): Use symbolic constant for _STRACE_ALL when setting mask.
* * strace.cc (opts): Add leading '+' to force posixly correctCorinna Vinschen2004-02-111-6/+1
| | | | | behaviour. (main): Revert POSIXLY_CORRECT manipulations.
* * strace.cc (main): Guard against previous setting of POSIXLY_CORRECT.Christopher Faylor2004-02-111-1/+5
|
* * strace.cc: Update copyrights.Christopher Faylor2004-02-101-2/+2
| | | | * cygcheck.cc: Update copyrights.
* * strace.cc (main): Ensure POSIXLY_CORRECT argument ordering.Christopher Faylor2004-02-101-0/+1
| | | | * cygcheck.cc (main): Ditto.
* * cygcheck.cc (usage) Add description output.Joshua Daniel Franklin2003-04-261-0/+2
|
* * Makefile.in (strace.exe): Include mingw_getopt.o in link line.Christopher Faylor2003-03-041-3/+5
| | | | | | | | * cygcheck.cc (print_version): Update copyright. * strace.cc (print_version): Ditto. (main): Allow cygwin paths for -o option. (create_child): Allow cygwin path as argv[0]. * path.cc (path.cc): Allow UNC paths.
* * mount.cc (usage): Correctly report default mode.Christopher Faylor2002-10-191-2/+2
|
* Add final newlines to utilsJoshua Daniel Franklin2002-09-151-1/+2
|
* * strace.cc (main): Make toggle a local variable.Christopher Faylor2002-06-071-1/+1
|
* * strace.cc (toggle): New global variable.Christopher Faylor2002-06-071-18/+48
| | | | | | | | | | | | | (error): Use exit instead of ExitProcess so that stdio buffers get flushed. (create_child): Remove command line error checking. (dostrace): Ditto. (dotoggle): New function. (usage): Add entry for new option -T|--toggle. Alphabetize. (longopts): Add new option -T|--toggle. (opts): Ditto. (main): Handle new -T|--toggle option. Move all command line checking here from other functions. * utils.sgml: Update section for strace.