[njs] Improved OPCODE debug by tracing native functions.

Dmitry Volyntsev xeioex at nginx.com
Sat Jun 4 07:21:01 UTC 2022


details:   https://hg.nginx.org/njs/rev/5cad81ba52ed
branches:  
changeset: 1875:5cad81ba52ed
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Fri Jun 03 23:24:10 2022 -0700
description:
Improved OPCODE debug by tracing native functions.

diffstat:

 src/njs_function.c |  11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diffs (21 lines):

diff -r 317fae74dc2f -r 5cad81ba52ed src/njs_function.c
--- a/src/njs_function.c	Fri Jun 03 23:24:08 2022 -0700
+++ b/src/njs_function.c	Fri Jun 03 23:24:10 2022 -0700
@@ -711,6 +711,17 @@ njs_function_native_call(njs_vm_t *vm)
     native = vm->top_frame;
     function = native->function;
 
+#ifdef NJS_OPCODE_DEBUG
+	njs_str_t              name;
+
+	ret = njs_builtin_match_native_function(vm, function, &name);
+	if (ret != NJS_OK) {
+		name = njs_entry_unknown;
+	}
+
+	njs_printf("CALL NATIVE %V\n", &name);
+#endif
+
     if (njs_fast_path(function->bound == NULL)) {
         call = function->u.native;
 



More information about the nginx-devel mailing list