mirror of
https://github.com/N64Recomp/N64Recomp.git
synced 2025-05-14 08:12:19 +00:00
adjust trace mode to use a general TRACE_ENTRY() macro
This commit is contained in:
parent
da5ec4c824
commit
f2e58c106d
5 changed files with 11 additions and 15 deletions
|
@ -217,7 +217,7 @@ namespace N64Recomp {
|
|||
std::vector<EventSymbol> event_symbols;
|
||||
|
||||
// Causes functions to print their name to the console the first time they're called.
|
||||
bool function_trace_mode;
|
||||
bool trace_mode;
|
||||
|
||||
// Imports sections and function symbols from a provided context into this context's reference sections and reference functions.
|
||||
bool import_reference_context(const Context& reference_context);
|
||||
|
|
|
@ -414,15 +414,15 @@ N64Recomp::Config::Config(const char* path) {
|
|||
}
|
||||
|
||||
// Use RE mode if enabled (optional)
|
||||
std::optional<bool> function_trace_mode_opt = input_data["function_trace_mode"].value<bool>();
|
||||
if (function_trace_mode_opt.has_value()) {
|
||||
function_trace_mode = function_trace_mode_opt.value();
|
||||
if (function_trace_mode) {
|
||||
recomp_include += "\n#include <stdio.h>\n#include <stdlib.h>";
|
||||
std::optional<bool> trace_mode_opt = input_data["trace_mode"].value<bool>();
|
||||
if (trace_mode_opt.has_value()) {
|
||||
trace_mode = trace_mode_opt.value();
|
||||
if (trace_mode) {
|
||||
recomp_include += "\n#include \"trace.h\"";
|
||||
}
|
||||
}
|
||||
else {
|
||||
function_trace_mode = false;
|
||||
trace_mode = false;
|
||||
}
|
||||
|
||||
// Function reference symbols file (optional)
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace N64Recomp {
|
|||
bool single_file_output;
|
||||
bool use_absolute_symbols;
|
||||
bool unpaired_lo16_warnings;
|
||||
bool function_trace_mode;
|
||||
bool trace_mode;
|
||||
bool allow_exports;
|
||||
bool strict_patch_mode;
|
||||
std::filesystem::path elf_path;
|
||||
|
|
|
@ -509,7 +509,7 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
|
||||
// Propogate the re_mode parameter.
|
||||
context.function_trace_mode = config.function_trace_mode;
|
||||
context.trace_mode = config.trace_mode;
|
||||
|
||||
// Apply any single-instruction patches.
|
||||
for (const N64Recomp::InstructionPatch& patch : config.instruction_patches) {
|
||||
|
|
|
@ -745,13 +745,9 @@ bool N64Recomp::recompile_function(const N64Recomp::Context& context, const N64R
|
|||
" int c1cs = 0;\n", // cop1 conditional signal
|
||||
func.name);
|
||||
|
||||
if (context.function_trace_mode) {
|
||||
if (context.trace_mode) {
|
||||
fmt::print(output_file,
|
||||
" static int {0}_was_called = 0;\n"
|
||||
" if ({0}_was_called == 0) {{\n"
|
||||
" fprintf(stderr, \"new function: {0}\\n\");\n"
|
||||
" {0}_was_called = 1;\n"
|
||||
" }}\n",
|
||||
" TRACE_ENTRY();",
|
||||
func.name);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue