diff options
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 9e8f2b7d4f..006d62dfa9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,6 +16,7 @@ #include "libc_installation.hpp" #include "userland.h" #include "glibc.hpp" +#include "stack_report.hpp" #include <stdio.h> @@ -62,6 +63,7 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) { " -fPIC enable Position Independent Code\n" " -fno-PIC disable Position Independent Code\n" " -ftime-report print timing diagnostics\n" + " -fstack-report print stack size diagnostics\n" " --libc [file] Provide a file which specifies libc paths\n" " --name [name] override output name\n" " --output-dir [dir] override output directory (defaults to cwd)\n" @@ -476,6 +478,7 @@ int main(int argc, char **argv) { size_t ver_minor = 0; size_t ver_patch = 0; bool timing_info = false; + bool stack_report = false; const char *cache_dir = nullptr; CliPkg *cur_pkg = allocate<CliPkg>(1); BuildMode build_mode = BuildModeDebug; @@ -664,6 +667,8 @@ int main(int argc, char **argv) { each_lib_rpath = true; } else if (strcmp(arg, "-ftime-report") == 0) { timing_info = true; + } else if (strcmp(arg, "-fstack-report") == 0) { + stack_report = true; } else if (strcmp(arg, "--enable-valgrind") == 0) { valgrind_support = ValgrindSupportEnabled; } else if (strcmp(arg, "--disable-valgrind") == 0) { @@ -1136,6 +1141,7 @@ int main(int argc, char **argv) { g->subsystem = subsystem; g->enable_time_report = timing_info; + g->enable_stack_report = stack_report; codegen_set_out_name(g, buf_out_name); codegen_set_lib_version(g, ver_major, ver_minor, ver_patch); g->want_single_threaded = want_single_threaded; @@ -1223,6 +1229,8 @@ int main(int argc, char **argv) { codegen_build_and_link(g); if (timing_info) codegen_print_timing_report(g, stdout); + if (stack_report) + zig_print_stack_report(g, stdout); if (cmd == CmdRun) { const char *exec_path = buf_ptr(&g->output_file_path); @@ -1272,6 +1280,10 @@ int main(int argc, char **argv) { codegen_print_timing_report(g, stdout); } + if (stack_report) { + zig_print_stack_report(g, stdout); + } + Buf *test_exe_path_unresolved = &g->output_file_path; Buf *test_exe_path = buf_alloc(); *test_exe_path = os_path_resolve(&test_exe_path_unresolved, 1); |
