From: Francis De Brabandere <francisdb@gmail.com> Add WARN-level trace output showing the call chain when a runtime error propagates through nested function calls. This helps diagnose errors in ExecuteGlobal/Execute code where the reported error location has no context about which call chain led to it. Example output for WINEDEBUG=warn+vbscript: error 0x80020012 in L"Broken", line 3 called from L"Wrapper", line 2 called from <global>, line 16 --- dlls/vbscript/interp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index 4bbdad181e0..030f66a753b 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -2783,9 +2783,22 @@ HRESULT exec_script(script_ctx_t *ctx, BOOL extern_caller, function_t *func, vbd continue; }else { if(!ctx->error_loc_code) { + unsigned line = exec.code->start_line + 1; + const WCHAR *nl; + for(nl = exec.code->source; nl < exec.code->source + exec.instr->loc; nl++) + if(*nl == '\n') line++; + WARN("error 0x%08lx in %s, line %u\n", hres, + exec.func->name ? debugstr_w(exec.func->name) : "<global>", line); grab_vbscode(exec.code); ctx->error_loc_code = exec.code; ctx->error_loc_offset = exec.instr->loc; + }else { + unsigned line = exec.code->start_line + 1; + const WCHAR *nl; + for(nl = exec.code->source; nl < exec.code->source + exec.instr->loc; nl++) + if(*nl == '\n') line++; + WARN(" called from %s, line %u\n", + exec.func->name ? debugstr_w(exec.func->name) : "<global>", line); } stack_popn(&exec, exec.top); break; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10594