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