check-structures-sanity: don't report possible pointers by default

develop
Ben Lubar 2020-03-12 11:35:52 -05:00
parent 08d2ed577e
commit 616a57224f
No known key found for this signature in database
GPG Key ID: 92939677AB59EDA4
3 changed files with 6 additions and 2 deletions

@ -80,6 +80,7 @@ public:
bool unnamed;
bool failfast;
bool noprogress;
bool maybepointer;
Checker(color_ostream & out);
bool queue_item(const QueueItem & item, const CheckedStructure & cs);

@ -12,7 +12,8 @@ Checker::Checker(color_ostream & out) :
sizes(false),
unnamed(false),
failfast(false),
noprogress(!out.is_console())
noprogress(!out.is_console()),
maybepointer(false)
{
Core::getInstance().p->getMemRanges(mapped);
}
@ -854,7 +855,7 @@ void Checker::check_stl_string(const QueueItem & item)
}
void Checker::check_possible_pointer(const QueueItem & item, const CheckedStructure & cs)
{
if (sizes && uintptr_t(item.ptr) % sizeof(void *) == 0)
if (sizes && maybepointer && uintptr_t(item.ptr) % sizeof(void *) == 0)
{
auto ptr = validate_and_dereference<const void *>(item, true);
QueueItem ptr_item(item, "?maybe_pointer?", ptr);

@ -21,6 +21,7 @@ DFhackCExport command_result plugin_init(color_ostream &, std::vector<PluginComm
"-unnamed: report unnamed enum/bitfield values, not just undefined ones.\n"
"-maxerrors n: set the maximum number of errors before bailing out.\n"
"-failfast: crash if any error is encountered. useful only for debugging.\n"
"-maybepointer: report integers that might actually be pointers.\n"
"starting_point: a lua expression or a word like 'screen', 'item', or 'building'. (defaults to df.global)\n"
"\n"
"by default, check-structures-sanity reports invalid pointers, vectors, strings, and vtables."
@ -75,6 +76,7 @@ static command_result command(color_ostream & out, std::vector<std::string> & pa
BOOL_PARAM(unnamed);
BOOL_PARAM(failfast);
BOOL_PARAM(noprogress);
BOOL_PARAM(maybepointer);
#undef BOOL_PARAM
if (parameters.size() > 1)