size_t StressLog::reading_base_address;
bool s_showAllMessages = false;
+bool s_showDefaultMessages = true;
BOOL g_bDacBroken;
char g_mdName[1];
SYMBOLS* g_ExtSymbols;
#undef d
};
+bool s_interestingStringMatchMode[MAX_INTERESTING_STRINGS];
+
bool s_interestingStringFilter[MAX_INTERESTING_STRINGS];
-static void AddInterestingString(const char* s)
+static void AddInterestingString(const char* s, bool matchMode)
{
- for (int i = 0; i < s_interestingStringCount; i++)
+ for (int i = 1; i < s_interestingStringCount; i++)
{
if (strcmp(s_interestingStringTable[i], s) == 0)
{
}
int i = s_interestingStringCount++;
s_interestingStringTable[i] = s;
+ s_interestingStringMatchMode[i] = matchMode;
s_interestingStringFilter[IS_INTERESTING] = true;
}
return id;
for (int i = 1; s_interestingStringTable[i] != nullptr; i++)
{
- if (strcmp(format, s_interestingStringTable[i]) == 0)
+ if (i != IS_UNINTERESTING)
{
- id = (InterestingStringId)i;
- if (id > IS_INTERESTING)
- id = IS_INTERESTING;
- mapImageToStringId[offset] = id;
- return id;
+ bool match = false;
+ if (s_interestingStringMatchMode[i])
+ {
+ match = (strstr(format, s_interestingStringTable[i]) == format);
+ }
+ else
+ {
+ match = (strcmp(format, s_interestingStringTable[i]) == 0);
+ }
+ if (match)
+ {
+ id = (InterestingStringId)i;
+ if (id > IS_INTERESTING)
+ id = IS_INTERESTING;
+ mapImageToStringId[offset] = id;
+ return id;
+ }
}
}
mapImageToStringId[offset] = IS_UNINTERESTING;
}
case IS_LOGGING_OFF:
- return true;
+ return s_showDefaultMessages;
case IS_GCSTART:
{
{
s_gcStartEnd[gcIndex].startTime = deltaTime;
}
- return true;
+ return s_showDefaultMessages;
}
case IS_GCEND:
{
s_gcStartEnd[gcIndex].endTime = deltaTime;
}
- return true;
+ return s_showDefaultMessages;
}
case IS_MARK_START:
case IS_COMPACT_START:
case IS_COMPACT_END:
RememberThreadForHeap(tsl->threadId, (int64_t)args[0], GC_THREAD_FG);
- return true;
+ return s_showDefaultMessages;
case IS_PLAN_PLUG:
case IS_PLAN_PINNED_PLUG:
printf(" (useful to search for the format string in the source code)\n");
printf(" -f:<format string>: search for a specific format string\n");
printf(" e.g. '-f:\"<%%zx>:%%zx\"'\n");
+ printf(" -p:<format string>: search for all format strings with a specific prefix\n");
+ printf(" e.g. '-p:\"commit-accounting\"'\n");
printf("\n");
printf(" -i:<hex facility code>: ignore messages from log facilities\n");
printf(" e.g. '-i:7ffe' means ignore messages from anything but LF_GC\n");
printf("\n");
printf(" -a: print all messages from all threads\n");
printf("\n");
+ printf(" -d: suppress default messages\n");
+ printf("\n");
}
// Translate escape sequences like "\n" - only common ones are handled
case 'A':
s_showAllMessages = true;
break;
+ case 'd':
+ case 'D':
+ s_showDefaultMessages = false;
+ break;
case 'f':
case 'F':
if (arg[2] == '\0')
buf++;
}
InterpretEscapeSequences(buf);
- AddInterestingString(buf);
+ AddInterestingString(buf, false);
}
break;
+ case 'p':
+ case 'P':
+ if (arg[2] == ':')
+ {
+ if (s_interestingStringCount >= MAX_INTERESTING_STRINGS)
+ {
+ printf("too format string filters - max is %d\n", MAX_INTERESTING_STRINGS - IS_INTERESTING);
+ return false;
+ }
+ arg = &arg[3];
+ char* buf = arg;
+ size_t actualSize = strlen(buf);
+ if (actualSize <= 1)
+ {
+ printf("-f:<format string> expected\n");
+ return false;
+ }
+ // remove double quotes around the string, if given
+ if (actualSize >= 2 && buf[0] == '"' && buf[actualSize - 1] == '"')
+ {
+ buf[actualSize - 1] = '\0';
+ buf++;
+ }
+ InterpretEscapeSequences(buf);
+ AddInterestingString(buf, true);
+ }
+ break;
case 'g':
case 'G':
if (arg[2] == ':')
s_outputFileName = nullptr;
s_fPrintFormatStrings = false;
s_showAllMessages = false;
+ s_showDefaultMessages = true;
s_maxHeapNumberSeen = -1;
for (int i = IS_INTERESTING; i < s_interestingStringCount; i++)
{
memset(s_gcThreadFilter, 0, sizeof(s_gcThreadFilter));
memset(&mapImageToStringId, 0, sizeof(mapImageToStringId));
memset(s_interestingStringFilter, 0, sizeof(s_interestingStringFilter));
+ memset(s_interestingStringMatchMode, 0, sizeof(s_interestingStringMatchMode));
memset(s_printEarliestMessageFromGcThread, 0, sizeof(s_printEarliestMessageFromGcThread));
if (!ParseOptions(argc, argv))