Python support (#37)

* Initial python support

* Add python testing

* Increase timeout for bin tests

* cmake-format

* Valid build types + testing + formatting + more

- Enforce valid build types
- Fix to numpy install
- Increase testing timeout
- Fix to cmake format glob
- Fix to backtrace verbose

* Disable stripping libraries by default

* omnitrace exe updates

- new '--print-instructions' option
- changed format of instructions in JSON
- remove no-save-fpr tests

* Default to strip libraries when release build
Šī revīzija ir iekļauta:
Jonathan R. Madsen
2022-04-05 00:24:34 -05:00
revīziju iesūtīja GitHub
vecāks 945f541965
revīzija afa3edebab
42 mainīti faili ar 2442 papildinājumiem un 239 dzēšanām
+1
Parādīt failu
@@ -153,6 +153,7 @@ extern size_t min_instructions;
//
extern bool werror;
extern bool debug_print;
extern bool instr_print;
extern int verbose_level;
//
// string settings
@@ -60,14 +60,14 @@ module_function::module_function(module_t* mod, procedure_t* proc)
flow_graph->getOuterLoops(loop_blocks);
}
instructions.reserve(basic_blocks.size());
for(const auto& itr : basic_blocks)
{
std::vector<instruction_t> _instructions{};
itr->getInstructions(_instructions);
num_instructions += _instructions.size();
instructions.reserve(instructions.size() + _instructions.size());
for(auto&& iitr : _instructions)
instructions.emplace_back(iitr);
if(debug_print || verbose_level > 3 || instr_print)
instructions.emplace_back(std::move(_instructions));
}
char modname[FUNCNAMELEN];
+19 -15
Parādīt failu
@@ -77,18 +77,18 @@ struct module_function
bool is_address_range_constrained() const; // checks address range constraint
bool is_num_instructions_constrained() const; // check # instructions constraint
size_t start_address = 0;
uint64_t address_range = 0;
uint64_t num_instructions = 0;
module_t* module = nullptr;
procedure_t* function = nullptr;
flow_graph_t* flow_graph = nullptr;
string_t module_name = {};
string_t function_name = {};
function_signature signature = {};
basic_block_set_t basic_blocks = {};
basic_loop_vec_t loop_blocks = {};
std::vector<instruction_t> instructions = {};
size_t start_address = 0;
uint64_t address_range = 0;
uint64_t num_instructions = 0;
module_t* module = nullptr;
procedure_t* function = nullptr;
flow_graph_t* flow_graph = nullptr;
string_t module_name = {};
string_t function_name = {};
function_signature signature = {};
basic_block_set_t basic_blocks = {};
basic_loop_vec_t loop_blocks = {};
std::vector<std::vector<instruction_t>> instructions = {};
using str_msg_t = std::tuple<int, string_t, string_t, string_t>;
using str_msg_vec_t = std::vector<str_msg_t>;
@@ -198,13 +198,17 @@ module_function::serialize(ArchiveT& ar, const unsigned)
ar.finishNode();
// instructions can inflate JSON size so only output when verbosity is increased
// above default
if(verbose_level > 0)
if(debug_print || verbose_level > 3 || instr_print)
{
std::vector<std::string> _instructions{};
std::vector<std::vector<std::string>> _instructions{};
_instructions.reserve(instructions.size());
for(auto&& itr : instructions)
{
_instructions.emplace_back(itr.format());
std::vector<std::string> _subinstr{};
_subinstr.reserve(itr.size());
for(auto&& iitr : itr)
_subinstr.emplace_back(iitr.format());
_instructions.emplace_back(std::move(_subinstr));
}
ar(cereal::make_nvp("instructions", _instructions));
}
+7
Parādīt failu
@@ -51,6 +51,7 @@ size_t min_loop_address_range = (1 << 8); // 256
size_t min_instructions = (1 << 6); // 64
bool werror = false;
bool debug_print = false;
bool instr_print = false;
int verbose_level = tim::get_env<int>("OMNITRACE_VERBOSE_INSTRUMENT", 0);
string_t main_fname = "main";
string_t argv0 = {};
@@ -356,6 +357,12 @@ main(int argc, char** argv)
.action([](parser_t& p) {
print_overlapping = p.get<std::string>("print-overlapping");
});
parser
.add_argument(
{ "--print-instructions" },
"Print the instructions for each basic-block in the JSON/XML outputs")
.max_count(1)
.action([](parser_t& p) { instr_print = p.get<bool>("print-instructions"); });
parser.add_argument({ "" }, "");
parser.add_argument({ "[MODE OPTIONS]" }, "");