From: Johannes Schindelin <[email protected]>

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]>
---
    Mention the extremely useful small_printf() function
    
    I have been using this function many times for debugging over the years,
    and found that it was too hard to find originally.
    
    Changes since v1 (which did not make it to the list for technical
    reasons that should be resolved by now):
    
     * Extend the comment about to talk about slight deviations from the
       POSIX printf() function family.
     * Improve on the commit message which previously was too terse.

Published-As: 
https://github.com/cygwingitgadget/cygwin/releases/tag/pr-4%2Fdscho%2Fmention-small-printf-v2
Fetch-It-Via: git fetch https://github.com/cygwingitgadget/cygwin 
pr-4/dscho/mention-small-printf-v2
Pull-Request: https://github.com/cygwingitgadget/cygwin/pull/4

Range-diff vs v1:

 1:  cb48c880c ! 1:  f8199e1b5 Mention the extremely useful small_printf() 
function
     @@ Metadata
       ## Commit message ##
          Mention the extremely useful small_printf() function
      
     -    It came in real handy while debugging an issue that strace 'fixed'.
     +    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]>
      
     @@ winsup/cygwin/DevDocs/how-to-debug-cygwin.txt: set 
CYGWIN_DEBUG=cat.exe:gdb.exe
      +   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`.


 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`.

base-commit: 2ae6825d022ac4450cef168ce066d68810b3a6e2
-- 
cygwingitgadget

Reply via email to