Wednesday, January 3, 2018

Re: vim-debugstring - Debug printf()-style at the speed of light

On Wednesday, January 3, 2018 at 2:25:59 AM UTC-5, Nikos Koukis wrote:
> Hey vimmers, happy new year!
>
> This is a description to a plugin that I developed. This is my first plugin in Vim and I wanted to ask for some feedback, mainly:
>
> - Do you think it's in any way useful?
> - Is there any similar plugin that I might have missed?
> - Do you think of any way I could improve it?
>
> *debugstring* aims to automate standard debugging operations (e.g., find segfaults). It does that by facilitating the ubiquitous printf()-debugging i.e., scatter logging statements around the various code snippets that you want to test.
>
>
> The default key-binding for dumping a logging directive is <Leader>ds. The logging statements are of the form:
>
> [<filename>:<line_of_logging_statement>] DEBUGGING STRING ==> <unique_number>
>
>
> The form and syntax of the logging statements target the language at hand (e.g., use printf() in C/C++ but puts() in Ruby)
>
> Currently the following languages are supported:
>
> - C/C++
> - Fortran
> - Haskell
> - Java
> - javascript
> - PHP
> - Python
> - Ruby
> - Shell
> - Vim
>
> You can find more information on Github..
>
> Github page: https://github.com/bergercookie/vim-debugstring
> Vim.org: http://www.vim.org/scripts/script.php?script_id=5634
>
> Cheers,
> Nikos

My C (not vim) solution for this is:

#define BUGOUT( FMT, ... ) { \
fprintf(stdout, "%s: %5d:%-24s:", __FILE__, __LINE__, __func__ ); \
fprintf(stdout, FMT, ##__VA_ARGS__ ); \
fflush (stdout); \
}

and is used as a standard printf(), i.e.:
BUGOUT("text: %d %s\n", num, string ) // For example

The output shows the filename, line number, and function the debug statement occurs. Always correct and easily found in the source.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: