mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
fdr_dump: dump FDRConfirm structures for fdr
This commit is contained in:
parent
dbd3f66e87
commit
a17ef3e48a
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2016, Intel Corporation
|
* Copyright (c) 2015-2017, Intel Corporation
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@ -30,10 +30,12 @@
|
|||||||
|
|
||||||
#include "fdr_compile.h"
|
#include "fdr_compile.h"
|
||||||
#include "fdr_compile_internal.h"
|
#include "fdr_compile_internal.h"
|
||||||
|
#include "fdr_confirm.h"
|
||||||
#include "fdr_dump.h"
|
#include "fdr_dump.h"
|
||||||
#include "fdr_engine_description.h"
|
#include "fdr_engine_description.h"
|
||||||
#include "fdr_internal.h"
|
#include "fdr_internal.h"
|
||||||
#include "teddy_engine_description.h"
|
#include "teddy_engine_description.h"
|
||||||
|
#include "teddy_internal.h"
|
||||||
#include "ue2common.h"
|
#include "ue2common.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
@ -58,33 +60,68 @@ bool fdrIsTeddy(const FDR *fdr) {
|
|||||||
return !getFdrDescription(engine);
|
return !getFdrDescription(engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fdrPrintStats(const FDR *fdr, FILE *f) {
|
static
|
||||||
const bool isTeddy = fdrIsTeddy(fdr);
|
void dumpConfirms(const void *fdr_base, u32 conf_offset, u32 num_confirms,
|
||||||
|
FILE *f) {
|
||||||
|
const u32 *conf = (const u32 *)((const char *)fdr_base + conf_offset);
|
||||||
|
for (u32 i = 0; i < num_confirms; i++) {
|
||||||
|
const auto *fdrc = (const FDRConfirm *)((const char *)conf + conf[i]);
|
||||||
|
fprintf(f, " confirm %u\n", i);
|
||||||
|
fprintf(f, " andmsk 0x%016llx\n", fdrc->andmsk);
|
||||||
|
fprintf(f, " mult 0x%016llx\n", fdrc->mult);
|
||||||
|
fprintf(f, " nbits %u\n", fdrc->nBits);
|
||||||
|
fprintf(f, " groups 0x%016llx\n", fdrc->groups);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isTeddy) {
|
static
|
||||||
fprintf(f, "TEDDY: %u\n", fdr->engineID);
|
void dumpTeddy(const Teddy *teddy, FILE *f) {
|
||||||
} else {
|
fprintf(f, "TEDDY: %u\n", teddy->engineID);
|
||||||
fprintf(f, "FDR: %u\n", fdr->engineID);
|
auto des = getTeddyDescription(teddy->engineID);
|
||||||
|
if (!des) {
|
||||||
|
fprintf(f, " <unknown engine>\n");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isTeddy) {
|
fprintf(f, " masks %u\n", des->numMasks);
|
||||||
auto des = getTeddyDescription(fdr->engineID);
|
fprintf(f, " buckets %u\n", des->getNumBuckets());
|
||||||
if (des) {
|
fprintf(f, " packed %s\n", des->packed ? "true" : "false");
|
||||||
fprintf(f, " masks %u\n", des->numMasks);
|
fprintf(f, " strings ???\n");
|
||||||
fprintf(f, " buckets %u\n", des->getNumBuckets());
|
fprintf(f, " size %zu bytes\n", fdrSize((const FDR *)teddy));
|
||||||
fprintf(f, " packed %s\n", des->packed ? "true" : "false");
|
fprintf(f, " max length %u\n", teddy->maxStringLen);
|
||||||
} else {
|
fprintf(f, " floodoff %u (%x)\n", teddy->floodOffset,
|
||||||
fprintf(f, " <unknown engine>\n");
|
teddy->floodOffset);
|
||||||
}
|
fprintf(f, "\n");
|
||||||
} else {
|
|
||||||
fprintf(f, " domain %u\n", fdr->domain);
|
dumpConfirms(teddy, teddy->confOffset, des->getNumBuckets(), f);
|
||||||
fprintf(f, " stride %u\n", fdr->stride);
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
void dumpFDR(const FDR *fdr, FILE *f) {
|
||||||
|
fprintf(f, "FDR: %u\n", fdr->engineID);
|
||||||
|
auto des = getFdrDescription(fdr->engineID);
|
||||||
|
if (!des) {
|
||||||
|
fprintf(f, " <unknown engine>\n");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fprintf(f, " domain %u\n", fdr->domain);
|
||||||
|
fprintf(f, " stride %u\n", fdr->stride);
|
||||||
fprintf(f, " strings ???\n");
|
fprintf(f, " strings ???\n");
|
||||||
fprintf(f, " size %zu bytes\n", fdrSize(fdr));
|
fprintf(f, " size %zu bytes\n", fdrSize(fdr));
|
||||||
fprintf(f, " max length %u\n", fdr->maxStringLen);
|
fprintf(f, " max length %u\n", fdr->maxStringLen);
|
||||||
fprintf(f, " floodoff %u (%x)\n", fdr->floodOffset, fdr->floodOffset);
|
fprintf(f, " floodoff %u (%x)\n", fdr->floodOffset, fdr->floodOffset);
|
||||||
|
fprintf(f, "\n");
|
||||||
|
|
||||||
|
dumpConfirms(fdr, fdr->confOffset, des->getNumBuckets(), f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fdrPrintStats(const FDR *fdr, FILE *f) {
|
||||||
|
if (fdrIsTeddy(fdr)) {
|
||||||
|
dumpTeddy((const Teddy *)fdr, f);
|
||||||
|
} else {
|
||||||
|
dumpFDR(fdr, f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ue2
|
} // namespace ue2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user