aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2020-03-06 16:47:26 +0100
committerMatthias Andree <matthias.andree@gmx.de>2020-03-06 16:47:26 +0100
commit4335aa7e4ec5976a0646bbdd2a07de17d65fc88d (patch)
treec9b805526dc38d066ecb5c8346b151ef959d6ca7
parent6da1bebed307cb189b2525b8286eb35d43005f2b (diff)
downloadfetchmail-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.l14
1 files changed, 14 insertions, 0 deletions
diff --git a/rcfile_l.l b/rcfile_l.l
index a7052df9..d1786881 100644
--- a/rcfile_l.l
+++ b/rcfile_l.l
@@ -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;
}