mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-11-12 21:56:54 +00:00
create strict mode and enable it for tests
This commit is contained in:
parent
56b5873e77
commit
17633983b5
@ -20,14 +20,14 @@ workflows:
|
|||||||
- build-gcc
|
- build-gcc
|
||||||
oid_test_args: "-ftype-graph"
|
oid_test_args: "-ftype-graph"
|
||||||
tests_regex: "OidIntegration\\..*"
|
tests_regex: "OidIntegration\\..*"
|
||||||
exclude_regex: ".*inheritance_polymorphic.*"
|
exclude_regex: ".*inheritance_polymorphic.*|.*pointers_incomplete_containing_struct|.*ignored_a|.*arrays_member_int0"
|
||||||
- test:
|
- test:
|
||||||
name: test-typed-data-segment-gcc
|
name: test-typed-data-segment-gcc
|
||||||
requires:
|
requires:
|
||||||
- build-gcc
|
- build-gcc
|
||||||
oid_test_args: "-ftyped-data-segment"
|
oid_test_args: "-ftyped-data-segment"
|
||||||
tests_regex: "OidIntegration\\..*"
|
tests_regex: "OidIntegration\\..*"
|
||||||
exclude_regex: ".*inheritance_polymorphic.*|.*cycles_.*"
|
exclude_regex: ".*inheritance_polymorphic.*|.*pointers.*|.*ignored_a|.*arrays_member_int0|.*cycles_.*"
|
||||||
- coverage:
|
- coverage:
|
||||||
name: coverage
|
name: coverage
|
||||||
requires:
|
requires:
|
||||||
@ -57,7 +57,7 @@ workflows:
|
|||||||
oid_test_args: "-ftype-graph"
|
oid_test_args: "-ftype-graph"
|
||||||
tests_regex: "OidIntegration\\..*"
|
tests_regex: "OidIntegration\\..*"
|
||||||
# Tests disabled due to bad DWARF generated by the old clang compiler in CI
|
# Tests disabled due to bad DWARF generated by the old clang compiler in CI
|
||||||
exclude_regex: ".*inheritance_polymorphic.*|.*fbstring.*|.*std_string_*|.*multi_arg_tb_.*|.*ignored_a"
|
exclude_regex: ".*inheritance_polymorphic.*|.*pointers_incomplete_containing_struct|.*arrays_member_int0|.*fbstring.*|.*std_string_*|.*multi_arg_tb_.*|.*ignored_a"
|
||||||
|
|
||||||
executors:
|
executors:
|
||||||
ubuntu-docker:
|
ubuntu-docker:
|
||||||
|
14
oi/OID.cpp
14
oi/OID.cpp
@ -143,7 +143,7 @@ constexpr static OIOpts opts{
|
|||||||
"Dump the data segment's content, before TreeBuilder processes it\n"
|
"Dump the data segment's content, before TreeBuilder processes it\n"
|
||||||
"Each argument gets its own dump file: 'dataseg.<oid-pid>.<arg>.dump'"},
|
"Each argument gets its own dump file: 'dataseg.<oid-pid>.<arg>.dump'"},
|
||||||
OIOpt{'a', "log-all-structs", no_argument, nullptr, "Log all structures"},
|
OIOpt{'a', "log-all-structs", no_argument, nullptr, "Log all structures"},
|
||||||
OIOpt{'m', "mode", required_argument, "[prod]",
|
OIOpt{'m', "mode", required_argument, "MODE",
|
||||||
"Allows to specify a mode of operation/group of settings"},
|
"Allows to specify a mode of operation/group of settings"},
|
||||||
OIOpt{'f', "enable-feature", required_argument, "FEATURE",
|
OIOpt{'f', "enable-feature", required_argument, "FEATURE",
|
||||||
"Enable feature"},
|
"Enable feature"},
|
||||||
@ -156,6 +156,14 @@ void usage() {
|
|||||||
std::cerr << opts << std::endl;
|
std::cerr << opts << std::endl;
|
||||||
featuresHelp(std::cerr);
|
featuresHelp(std::cerr);
|
||||||
|
|
||||||
|
std::cerr << std::endl << "MODES SUMMARY" << std::endl;
|
||||||
|
std::cerr << " prod Disable drgn, enable remote caching, and chase raw "
|
||||||
|
"pointers."
|
||||||
|
<< std::endl;
|
||||||
|
std::cerr << " strict Enable additional fatal error conditions such as "
|
||||||
|
"TreeBuilder reading too little data."
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
std::cerr << "\n\tFor problem reporting, questions and general comments "
|
std::cerr << "\n\tFor problem reporting, questions and general comments "
|
||||||
"please pop along"
|
"please pop along"
|
||||||
"\n\tto the Object Introspection Workplace group at "
|
"\n\tto the Object Introspection Workplace group at "
|
||||||
@ -254,6 +262,7 @@ struct Config {
|
|||||||
bool genPaddingStats = true;
|
bool genPaddingStats = true;
|
||||||
bool attachToProcess = true;
|
bool attachToProcess = true;
|
||||||
bool hardDisableDrgn = false;
|
bool hardDisableDrgn = false;
|
||||||
|
bool strict = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Oid
|
} // namespace Oid
|
||||||
@ -292,6 +301,7 @@ static ExitStatus::ExitStatus runScript(
|
|||||||
}
|
}
|
||||||
oid->setCustomCodeFile(oidConfig.customCodeFile);
|
oid->setCustomCodeFile(oidConfig.customCodeFile);
|
||||||
oid->setHardDisableDrgn(oidConfig.hardDisableDrgn);
|
oid->setHardDisableDrgn(oidConfig.hardDisableDrgn);
|
||||||
|
oid->setStrict(oidConfig.strict);
|
||||||
|
|
||||||
VLOG(1) << "OIDebugger constructor took " << std::dec
|
VLOG(1) << "OIDebugger constructor took " << std::dec
|
||||||
<< time_ns(time_hr::now() - progStart) << " nsecs";
|
<< time_ns(time_hr::now() - progStart) << " nsecs";
|
||||||
@ -497,6 +507,8 @@ int main(int argc, char* argv[]) {
|
|||||||
oidConfig.cacheRemoteDownload = true;
|
oidConfig.cacheRemoteDownload = true;
|
||||||
oidConfig.cacheBasePath = "/tmp/oid-cache";
|
oidConfig.cacheBasePath = "/tmp/oid-cache";
|
||||||
features[Feature::ChaseRawPointers] = true;
|
features[Feature::ChaseRawPointers] = true;
|
||||||
|
} else if (strcmp("strict", optarg) == 0) {
|
||||||
|
oidConfig.strict = true;
|
||||||
} else {
|
} else {
|
||||||
LOG(ERROR) << "Invalid mode: " << optarg << " specified!";
|
LOG(ERROR) << "Invalid mode: " << optarg << " specified!";
|
||||||
usage();
|
usage();
|
||||||
|
@ -104,6 +104,9 @@ class OIDebugger {
|
|||||||
void setHardDisableDrgn(bool val) {
|
void setHardDisableDrgn(bool val) {
|
||||||
symbols->setHardDisableDrgn(val);
|
symbols->setHardDisableDrgn(val);
|
||||||
}
|
}
|
||||||
|
void setStrict(bool val) {
|
||||||
|
treeBuilderConfig.strict = val;
|
||||||
|
}
|
||||||
|
|
||||||
bool uploadCache() {
|
bool uploadCache() {
|
||||||
return std::all_of(
|
return std::all_of(
|
||||||
|
@ -254,6 +254,11 @@ void TreeBuilder::build(const std::vector<uint64_t>& data,
|
|||||||
|
|
||||||
// Were all object sizes consumed?
|
// Were all object sizes consumed?
|
||||||
if (oidDataIndex != oidData->size()) {
|
if (oidDataIndex != oidData->size()) {
|
||||||
|
if (config.strict) {
|
||||||
|
LOG(FATAL) << "some object sizes not consumed and OID is in strict mode!"
|
||||||
|
<< "reported: " << oidData->size() << " consumed "
|
||||||
|
<< oidDataIndex;
|
||||||
|
}
|
||||||
LOG(WARNING) << "WARNING: some object sizes not consumed;"
|
LOG(WARNING) << "WARNING: some object sizes not consumed;"
|
||||||
<< "object tree may be inaccurate. "
|
<< "object tree may be inaccurate. "
|
||||||
<< "reported: " << oidData->size() << " consumed "
|
<< "reported: " << oidData->size() << " consumed "
|
||||||
|
@ -45,6 +45,7 @@ class TreeBuilder {
|
|||||||
bool logAllStructs;
|
bool logAllStructs;
|
||||||
bool dumpDataSegment;
|
bool dumpDataSegment;
|
||||||
std::optional<std::string> jsonPath;
|
std::optional<std::string> jsonPath;
|
||||||
|
bool strict;
|
||||||
};
|
};
|
||||||
|
|
||||||
TreeBuilder(Config);
|
TreeBuilder(Config);
|
||||||
|
@ -230,6 +230,7 @@ OidProc OidIntegration::runOidOnProcess(OidOpts opts,
|
|||||||
"--dump-json"s,
|
"--dump-json"s,
|
||||||
"--config-file"s, thisConfig.string(),
|
"--config-file"s, thisConfig.string(),
|
||||||
"--script-source"s, opts.scriptSource,
|
"--script-source"s, opts.scriptSource,
|
||||||
|
"--mode=strict"s,
|
||||||
"--pid"s, std::to_string(targetProcess.id()),
|
"--pid"s, std::to_string(targetProcess.id()),
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
Loading…
Reference in New Issue
Block a user