https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c43ec5f5951c7f4b882a0f8e619601a45ae70a91
commit c43ec5f5951c7f4b882a0f8e619601a45ae70a91 Author: Johannes Schindelin <[email protected]> Date: Fri Feb 20 11:54:47 2015 +0000 Cygwin: devdoc: Mention the extremely useful small_printf() function This function came in real handy many, many times over the year whenever I needed to debug any issues with the MSYS2/Cygwin runtime, first instance was while debugging an issue that strace 'fixed'. However, this function was not mentioned anywhere I looked, so it took me a good while to find out about it. Let's improve on that situation by mentioning it explicitly in the documentation about debugging the runtime. Signed-off-by: Johannes Schindelin <[email protected]> Diff: --- winsup/cygwin/DevDocs/how-to-debug-cygwin.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/winsup/cygwin/DevDocs/how-to-debug-cygwin.txt b/winsup/cygwin/DevDocs/how-to-debug-cygwin.txt index 61e91c88d..4ac554acd 100644 --- a/winsup/cygwin/DevDocs/how-to-debug-cygwin.txt +++ b/winsup/cygwin/DevDocs/how-to-debug-cygwin.txt @@ -126,3 +126,14 @@ set CYGWIN_DEBUG=cat.exe:gdb.exe program will crash, probably in small_printf. At that point, a 'bt' command should show you the offending call to strace_printf with the improper format string. + +9. Debug output without strace + + If you cannot use gdb, or if the program behaves differently using strace + for whatever reason, you can still use the small_printf() function to + output debugging messages directly to stderr. + + This function accepts slightly different format placeholders than the + POSIX printf() function you're used to, for example `%W` instead of `%ls` + to print UTF-16 strings (provided via `wchar_t *` pointers). For full + details, see the first comment in `winsup/cygwin/smallprint.cc`.
