GeezerVison is showing github.com — src: prevent hard coding stack trace limit · jigfox/node@8baee5e
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/env.cc +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -592,9 +592,9 @@ void Environment::PrintSyncTrace() const { | 592 | 592 |
| 593 | 593 | fprintf( | 594 | 594 | stderr, "(node:%d) WARNING: Detected use of sync API\n", uv_os_getpid()); | 595 | | - PrintStackTrace( | 596 | | - isolate(), | 597 | | - StackTrace::CurrentStackTrace(isolate(), 10, StackTrace::kDetailed)); | | 595 | + PrintStackTrace(isolate(), | | 596 | + StackTrace::CurrentStackTrace( | | 597 | + isolate(), stack_trace_limit(), StackTrace::kDetailed)); | 598 | 598 | } | 599 | 599 |
| 600 | 600 | void Environment::RunCleanup() { | @@ -949,9 +949,9 @@ void Environment::Exit(int exit_code) { | 949 | 949 |
| 950 | 950 | fprintf( | 951 | 951 | stderr, "WARNING: Exited the environment with code %d\n", exit_code); | 952 | | - PrintStackTrace( | 953 | | - isolate(), | 954 | | - StackTrace::CurrentStackTrace(isolate(), 10, StackTrace::kDetailed)); | | 952 | + PrintStackTrace(isolate(), | | 953 | + StackTrace::CurrentStackTrace( | | 954 | + isolate(), stack_trace_limit(), StackTrace::kDetailed)); | 955 | 955 | } | 956 | 956 | if (is_main_thread()) { | 957 | 957 | stop_sub_worker_contexts(); | |
Collapse file Copy file name to clipboardExpand all lines: src/env.h +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1234,6 +1234,8 @@ class Environment : public MemoryRetainer { | 1234 | 1234 | inline void modify_base_object_count(int64_t delta); | 1235 | 1235 | inline int64_t base_object_count() const; | 1236 | 1236 |
| | 1237 | + inline int32_t stack_trace_limit() const { return 10; } | | 1238 | + | 1237 | 1239 | #if HAVE_INSPECTOR | 1238 | 1240 | void set_coverage_connection( | 1239 | 1241 | std::unique_ptr<profiler::V8CoverageConnection> connection); | |
Collapse file Copy file name to clipboardExpand all lines: src/node_errors.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -145,7 +145,7 @@ static std::string GetErrorSource(Isolate* isolate, | 145 | 145 | } | 146 | 146 |
| 147 | 147 | void PrintStackTrace(Isolate* isolate, Local<StackTrace> stack) { | 148 | | - for (int i = 0; i < stack->GetFrameCount() - 1; i++) { | | 148 | + for (int i = 0; i < stack->GetFrameCount(); i++) { | 149 | 149 | Local<StackFrame> stack_frame = stack->GetFrame(isolate, i); | 150 | 150 | node::Utf8Value fn_name_s(isolate, stack_frame->GetFunctionName()); | 151 | 151 | node::Utf8Value script_name(isolate, stack_frame->GetScriptName()); | |
Collapse file Copy file name to clipboardExpand all lines: test/message/throw_error_with_getter_throw_traced.out +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -10,3 +10,4 @@ Thrown at: | 10 | 10 | at Module.load (internal/modules/cjs/loader.js:*:*) | 11 | 11 | at Module._load (internal/modules/cjs/loader.js:*:*) | 12 | 12 | at executeUserEntryPoint (internal/modules/run_main.js:*:*) | | 13 | + at internal/main/run_main_module.js:*:* |
Collapse file Copy file name to clipboardExpand all lines: test/message/throw_null_traced.out +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -10,3 +10,4 @@ Thrown at: | 10 | 10 | at Module.load (internal/modules/cjs/loader.js:*:*) | 11 | 11 | at Module._load (internal/modules/cjs/loader.js:*:*) | 12 | 12 | at executeUserEntryPoint (internal/modules/run_main.js:*:*) | | 13 | + at internal/main/run_main_module.js:*:* |
Collapse file Copy file name to clipboardExpand all lines: test/message/throw_undefined_traced.out +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -10,3 +10,4 @@ Thrown at: | 10 | 10 | at Module.load (internal/modules/cjs/loader.js:*:*) | 11 | 11 | at Module._load (internal/modules/cjs/loader.js:*:*) | 12 | 12 | at executeUserEntryPoint (internal/modules/run_main.js:*:*) | | 13 | + at internal/main/run_main_module.js:*:* |
|