* Added new pattern filters d#<expr>, x#<expr>, and s#<expr> which
set the actual pattern as "%d", "%x", and "%s" of the expression after '#' respectively. They are very slow, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24591 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
e77b684f9e
commit
dc1a7867e0
@ -419,6 +419,7 @@ public:
|
|||||||
thread_id fThread;
|
thread_id fThread;
|
||||||
team_id fTeam;
|
team_id fTeam;
|
||||||
const char* fString;
|
const char* fString;
|
||||||
|
uint64 fValue;
|
||||||
struct {
|
struct {
|
||||||
TraceFilter* first;
|
TraceFilter* first;
|
||||||
TraceFilter* second;
|
TraceFilter* second;
|
||||||
@ -458,6 +459,42 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class DecimalPatternTraceFilter : public TraceFilter {
|
||||||
|
public:
|
||||||
|
virtual bool Filter(const TraceEntry* entry, LazyTraceOutput& out)
|
||||||
|
{
|
||||||
|
// TODO: this is *very* slow
|
||||||
|
char buffer[64];
|
||||||
|
snprintf(buffer, sizeof(buffer), "%Ld", fValue);
|
||||||
|
return strstr(out.DumpEntry(entry), buffer) != NULL;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class HexPatternTraceFilter : public TraceFilter {
|
||||||
|
public:
|
||||||
|
virtual bool Filter(const TraceEntry* entry, LazyTraceOutput& out)
|
||||||
|
{
|
||||||
|
// TODO: this is *very* slow
|
||||||
|
char buffer[64];
|
||||||
|
snprintf(buffer, sizeof(buffer), "%Lx", fValue);
|
||||||
|
return strstr(out.DumpEntry(entry), buffer) != NULL;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class StringPatternTraceFilter : public TraceFilter {
|
||||||
|
public:
|
||||||
|
virtual bool Filter(const TraceEntry* entry, LazyTraceOutput& out)
|
||||||
|
{
|
||||||
|
if (IS_KERNEL_ADDRESS(fValue))
|
||||||
|
return strstr(out.DumpEntry(entry), (const char*)fValue) != NULL;
|
||||||
|
|
||||||
|
// TODO: this is *very* slow
|
||||||
|
char buffer[64];
|
||||||
|
user_strlcpy(buffer, (const char*)fValue, sizeof(buffer));
|
||||||
|
return strstr(out.DumpEntry(entry), buffer) != NULL;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class NotTraceFilter : public TraceFilter {
|
class NotTraceFilter : public TraceFilter {
|
||||||
public:
|
public:
|
||||||
virtual bool Filter(const TraceEntry* entry, LazyTraceOutput& out)
|
virtual bool Filter(const TraceEntry* entry, LazyTraceOutput& out)
|
||||||
@ -529,6 +566,21 @@ private:
|
|||||||
PatternTraceFilter;
|
PatternTraceFilter;
|
||||||
filter->fString = token + 1;
|
filter->fString = token + 1;
|
||||||
return filter;
|
return filter;
|
||||||
|
} else if (token[0] == 'd' && token[1] == '#') {
|
||||||
|
TraceFilter* filter = new(&fFilters[fFilterCount++])
|
||||||
|
DecimalPatternTraceFilter;
|
||||||
|
filter->fValue = parse_expression(token + 2);
|
||||||
|
return filter;
|
||||||
|
} else if (token[0] == 'x' && token[1] == '#') {
|
||||||
|
TraceFilter* filter = new(&fFilters[fFilterCount++])
|
||||||
|
HexPatternTraceFilter;
|
||||||
|
filter->fValue = parse_expression(token + 2);
|
||||||
|
return filter;
|
||||||
|
} else if (token[0] == 's' && token[1] == '#') {
|
||||||
|
TraceFilter* filter = new(&fFilters[fFilterCount++])
|
||||||
|
StringPatternTraceFilter;
|
||||||
|
filter->fValue = parse_expression(token + 2);
|
||||||
|
return filter;
|
||||||
} else if (strcmp(token, "not") == 0) {
|
} else if (strcmp(token, "not") == 0) {
|
||||||
TraceFilter* filter = new(&fFilters[fFilterCount++]) NotTraceFilter;
|
TraceFilter* filter = new(&fFilters[fFilterCount++]) NotTraceFilter;
|
||||||
if ((filter->fSubFilters.first = _ParseExpression()) != NULL)
|
if ((filter->fSubFilters.first = _ParseExpression()) != NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user