diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2020-03-06 16:47:26 +0100 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2020-03-06 16:47:26 +0100 |
commit | 4335aa7e4ec5976a0646bbdd2a07de17d65fc88d (patch) | |
tree | c9b805526dc38d066ecb5c8346b151ef959d6ca7 | |
parent | 6da1bebed307cb189b2525b8286eb35d43005f2b (diff) | |
download | fetchmail-4335aa7e4ec5976a0646bbdd2a07de17d65fc88d.tar.gz fetchmail-4335aa7e4ec5976a0646bbdd2a07de17d65fc88d.tar.bz2 fetchmail-4335aa7e4ec5976a0646bbdd2a07de17d65fc88d.zip |
Add a STRING_DEBUG facility...
...to identify string addresses and contents on stderr,
which eases memory leak debugging.
-rw-r--r-- | rcfile_l.l | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -25,6 +25,11 @@ int prc_lineno = 1; #define YY_NO_INPUT +/* #define this to emit STRING pointers and contents to stderr while lexing. + * Useful with ASan/LSan (address/leak sanitizer) and its + * LSAN_OPTIONS=report_objects=1 to identify where the leaked strings go. */ +#undef STRING_DEBUG + #ifdef __cplusplus extern "C" #endif @@ -44,6 +49,9 @@ int yywrap(void) { return 1; } escapes(in, in); yylval.sval = in; SETSTATE(0); +#ifdef STRING_DEBUG + fprintf(stderr, "STRING1: %p %s\n", in, in); +#endif return STRING; } @@ -52,6 +60,9 @@ int yywrap(void) { return 1; } escapes(in, in); yylval.sval = in; SETSTATE(0); +#ifdef STRING_DEBUG + fprintf(stderr, "STRING2: %p %s\n", in, in); +#endif return STRING; } @@ -212,6 +223,9 @@ options {/* EMPTY */} char *in = xstrdup(yytext); escapes(in, in); yylval.sval = in; +#ifdef STRING_DEBUG + fprintf(stderr, "STRING3: %p %s\n", in, in); +#endif return STRING; } |