[quickjs] Warnings and debug qjsc
This commit is contained in:
parent
de77e9e6b9
commit
c4142cce60
2 changed files with 28 additions and 26 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#
|
||||
# QuickJS Javascript Engine
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2017-2021 Fabrice Bellard
|
||||
# Copyright (c) 2017-2021 Charlie Gordon
|
||||
#
|
||||
|
|
@ -54,9 +54,9 @@ OBJDIR=.obj
|
|||
|
||||
ifdef CONFIG_WIN32
|
||||
ifdef CONFIG_M32
|
||||
CROSS_PREFIX=i686-w64-mingw32-
|
||||
CROSS_PREFIX=i686-w64-mingw32-
|
||||
else
|
||||
CROSS_PREFIX=x86_64-w64-mingw32-
|
||||
CROSS_PREFIX=x86_64-w64-mingw32-
|
||||
endif
|
||||
EXE=.exe
|
||||
else
|
||||
|
|
@ -76,13 +76,13 @@ ifdef CONFIG_CLANG
|
|||
CFLAGS += -Wchar-subscripts -funsigned-char
|
||||
CFLAGS += -MMD -MF $(OBJDIR)/$(@F).d
|
||||
ifdef CONFIG_DEFAULT_AR
|
||||
AR=$(CROSS_PREFIX)ar
|
||||
AR=$(CROSS_PREFIX)ar
|
||||
else
|
||||
ifdef CONFIG_LTO
|
||||
AR=$(CROSS_PREFIX)llvm-ar
|
||||
else
|
||||
AR=$(CROSS_PREFIX)ar
|
||||
endif
|
||||
ifdef CONFIG_LTO
|
||||
AR=$(CROSS_PREFIX)llvm-ar
|
||||
else
|
||||
AR=$(CROSS_PREFIX)ar
|
||||
endif
|
||||
endif
|
||||
else
|
||||
HOST_CC=gcc
|
||||
|
|
@ -90,9 +90,9 @@ else
|
|||
CFLAGS=-g -Wall -MMD -MF $(OBJDIR)/$(@F).d
|
||||
CFLAGS += -Wno-array-bounds -Wno-format-truncation
|
||||
ifdef CONFIG_LTO
|
||||
AR=$(CROSS_PREFIX)gcc-ar
|
||||
AR=$(CROSS_PREFIX)gcc-ar
|
||||
else
|
||||
AR=$(CROSS_PREFIX)ar
|
||||
AR=$(CROSS_PREFIX)ar
|
||||
endif
|
||||
endif
|
||||
STRIP=$(CROSS_PREFIX)strip
|
||||
|
|
@ -170,7 +170,7 @@ QJS_LIB_OBJS=$(OBJDIR)/quickjs.o $(OBJDIR)/libregexp.o $(OBJDIR)/libunicode.o $(
|
|||
|
||||
QJS_OBJS=$(OBJDIR)/qjs.o $(OBJDIR)/repl.o $(QJS_LIB_OBJS)
|
||||
ifdef CONFIG_BIGNUM
|
||||
QJS_LIB_OBJS+=$(OBJDIR)/libbf.o
|
||||
QJS_LIB_OBJS+=$(OBJDIR)/libbf.o
|
||||
QJS_OBJS+=$(OBJDIR)/qjscalc.o
|
||||
endif
|
||||
|
||||
|
|
@ -193,10 +193,13 @@ qjs-debug$(EXE): $(patsubst %.o, %.debug.o, $(QJS_OBJS))
|
|||
qjsc$(EXE): $(OBJDIR)/qjsc.o $(QJS_LIB_OBJS)
|
||||
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
qjsc-debug$(EXE): $(OBJDIR)/qjsc.debug.o $(patsubst %.o, %.debug.o, $(QJS_LIB_OBJS))
|
||||
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
ifneq ($(CROSS_PREFIX),)
|
||||
|
||||
$(QJSC): $(OBJDIR)/qjsc.host.o \
|
||||
$(patsubst %.o, %.host.o, $(QJS_LIB_OBJS))
|
||||
$(patsubst %.o, %.host.o, $(QJS_LIB_OBJS))
|
||||
$(HOST_CC) $(LDFLAGS) -o $@ $^ $(HOST_LIBS)
|
||||
|
||||
endif #CROSS_PREFIX
|
||||
|
|
@ -242,7 +245,7 @@ qjscalc.c: $(QJSC) qjscalc.js
|
|||
|
||||
ifneq ($(wildcard unicode/UnicodeData.txt),)
|
||||
$(OBJDIR)/libunicode.o $(OBJDIR)/libunicode.m32.o $(OBJDIR)/libunicode.m32s.o \
|
||||
$(OBJDIR)/libunicode.nolto.o: libunicode-table.h
|
||||
$(OBJDIR)/libunicode.nolto.o: libunicode-table.h
|
||||
|
||||
libunicode-table.h: unicode_gen
|
||||
./unicode_gen unicode $@
|
||||
|
|
@ -316,8 +319,8 @@ endif
|
|||
# example of static JS compilation
|
||||
HELLO_SRCS=examples/hello.js
|
||||
HELLO_OPTS=-fno-string-normalize -fno-map -fno-promise -fno-typedarray \
|
||||
-fno-typedarray -fno-regexp -fno-json -fno-eval -fno-proxy \
|
||||
-fno-date -fno-module-loader
|
||||
-fno-typedarray -fno-regexp -fno-json -fno-eval -fno-proxy \
|
||||
-fno-date -fno-module-loader
|
||||
ifdef CONFIG_BIGNUM
|
||||
HELLO_OPTS+=-fno-bigint
|
||||
endif
|
||||
|
|
@ -336,8 +339,8 @@ endif
|
|||
# example of static JS compilation with modules
|
||||
HELLO_MODULE_SRCS=examples/hello_module.js
|
||||
HELLO_MODULE_OPTS=-fno-string-normalize -fno-map -fno-promise -fno-typedarray \
|
||||
-fno-typedarray -fno-regexp -fno-json -fno-eval -fno-proxy \
|
||||
-fno-date -m
|
||||
-fno-typedarray -fno-regexp -fno-json -fno-eval -fno-proxy \
|
||||
-fno-date -m
|
||||
examples/hello_module: $(QJSC) libquickjs$(LTOEXT).a $(HELLO_MODULE_SRCS)
|
||||
$(QJSC) $(HELLO_MODULE_OPTS) -o $@ $(HELLO_MODULE_SRCS)
|
||||
|
||||
|
|
@ -358,11 +361,11 @@ examples/point.so: $(OBJDIR)/examples/point.pic.o
|
|||
###############################################################################
|
||||
# documentation
|
||||
|
||||
DOCS=doc/quickjs.pdf doc/quickjs.html doc/jsbignum.pdf doc/jsbignum.html
|
||||
DOCS=doc/quickjs.pdf doc/quickjs.html doc/jsbignum.pdf doc/jsbignum.html
|
||||
|
||||
build_doc: $(DOCS)
|
||||
|
||||
clean_doc:
|
||||
clean_doc:
|
||||
rm -f $(DOCS)
|
||||
|
||||
doc/%.pdf: doc/%.texi
|
||||
|
|
|
|||
|
|
@ -6512,7 +6512,6 @@ static void get_frame_debug_position(JSContext *ctx, JSStackFrame *sf,
|
|||
p = JS_VALUE_GET_OBJ(sf->cur_func);
|
||||
if (js_class_has_bytecode(p->class_id)) {
|
||||
JSFunctionBytecode *b;
|
||||
const char *atom_str;
|
||||
int line_num1;
|
||||
|
||||
b = p->u.func.function_bytecode;
|
||||
|
|
@ -6559,7 +6558,6 @@ static void build_backtrace(JSContext *ctx, JSValueConst error_obj,
|
|||
const char *file_name_str;
|
||||
int line_num1;
|
||||
const char *str1;
|
||||
JSObject *p;
|
||||
BOOL backtrace_barrier;
|
||||
|
||||
js_dbuf_init(ctx, &dbuf);
|
||||
|
|
@ -6592,12 +6590,13 @@ static void build_backtrace(JSContext *ctx, JSValueConst error_obj,
|
|||
JS_FreeCString(ctx, func_name_str);
|
||||
|
||||
if (file_name_str && file_name_str[0]) {
|
||||
dbuf_printf(&dbuf, " (%s");
|
||||
dbuf_printf(&dbuf, " (%s", file_name_str);
|
||||
if (line_num1 >= 0) {
|
||||
dbuf_printf(&dbuf, ":%d", line_num1);
|
||||
}
|
||||
dbuf_putc(&dbuf, ')');
|
||||
}
|
||||
JS_FreeCString(ctx, file_name_str);
|
||||
|
||||
dbuf_putc(&dbuf, '\n');
|
||||
/* stop backtrace if JS_EVAL_FLAG_BACKTRACE_BARRIER was used */
|
||||
|
|
@ -54224,7 +54223,7 @@ typedef struct JSDebugContext {
|
|||
|
||||
static int js_handle_breakpoint(JSContext *ctx, JSFunctionBytecode *b, int code_offset) {
|
||||
int next_op;
|
||||
JSResumeMode resume = JS_RESUME_MODE_CONTINUE;
|
||||
/* JSResumeMode resume = JS_RESUME_MODE_CONTINUE; */
|
||||
JSRuntime *rt = ctx->rt;
|
||||
JSBreakpoint *bp = find_existing_breakpoint(ctx, b, code_offset);
|
||||
if (bp) {
|
||||
|
|
@ -54234,7 +54233,7 @@ static int js_handle_breakpoint(JSContext *ctx, JSFunctionBytecode *b, int code_
|
|||
dctx.ctx = ctx;
|
||||
dctx.sf = ctx->rt->current_stack_frame;
|
||||
|
||||
resume = rt->debug_callback(&dctx, JS_BREAK_BREAKPOINT, bp, rt->debug_opaque);
|
||||
/* resume = */rt->debug_callback(&dctx, JS_BREAK_BREAKPOINT, bp, rt->debug_opaque);
|
||||
}
|
||||
}
|
||||
next_op = bp->replaced_byte;
|
||||
|
|
@ -54249,7 +54248,7 @@ static int js_handle_breakpoint(JSContext *ctx, JSFunctionBytecode *b, int code_
|
|||
dctx.ctx = ctx;
|
||||
dctx.sf = ctx->rt->current_stack_frame;
|
||||
|
||||
resume = rt->debug_callback(&dctx, JS_BREAK_STEP, NULL, rt->debug_opaque);
|
||||
/* resume = */rt->debug_callback(&dctx, JS_BREAK_STEP, NULL, rt->debug_opaque);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue