summaryrefslogtreecommitdiff
path: root/qjs.c
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2025-04-12 12:14:37 +0200
committerFabrice Bellard <fabrice@bellard.org>2025-04-12 12:14:37 +0200
commit67b48ae4e6fadb812334b5836aa4a6e6e46d459b (patch)
tree9f612b2fff9b5009323364c9e20384b9eab86982 /qjs.c
parentc50de13b1573735c57e918f2739428b82dd2481f (diff)
downloadquickjs-67b48ae4e6fadb812334b5836aa4a6e6e46d459b.tar.gz
quickjs-67b48ae4e6fadb812334b5836aa4a6e6e46d459b.zip
- removed the 'use strip' extension
- removed the JS_EVAL_FLAG_STRIP eval flag and replaced it with JS_SetStripInfo() which has simpler semantics. - qjs: added the '-s' and '--strip-source' options - qjsc: added the '-s' and '--keep-source' options
Diffstat (limited to 'qjs.c')
-rw-r--r--qjs.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/qjs.c b/qjs.c
index b6bfca3..2eaa9ee 100644
--- a/qjs.c
+++ b/qjs.c
@@ -301,6 +301,8 @@ void help(void)
" --memory-limit n limit the memory usage to 'n' bytes (SI suffixes allowed)\n"
" --stack-size n limit the stack size to 'n' bytes (SI suffixes allowed)\n"
" --no-unhandled-rejection ignore unhandled promise rejections\n"
+ "-s strip all the debug info\n"
+ " --strip-source strip the source code\n"
"-q --quit just instantiate the interpreter and quit\n");
exit(1);
}
@@ -322,6 +324,7 @@ int main(int argc, char **argv)
size_t memory_limit = 0;
char *include_list[32];
int i, include_count = 0;
+ int strip_flags = 0;
size_t stack_size = 0;
/* cannot use getopt because we want to pass the command line to
@@ -421,6 +424,14 @@ int main(int argc, char **argv)
stack_size = get_suffixed_size(argv[optind++]);
continue;
}
+ if (opt == 's') {
+ strip_flags = JS_STRIP_DEBUG;
+ continue;
+ }
+ if (!strcmp(longopt, "strip-source")) {
+ strip_flags = JS_STRIP_SOURCE;
+ continue;
+ }
if (opt) {
fprintf(stderr, "qjs: unknown option '-%c'\n", opt);
} else {
@@ -444,6 +455,7 @@ int main(int argc, char **argv)
JS_SetMemoryLimit(rt, memory_limit);
if (stack_size != 0)
JS_SetMaxStackSize(rt, stack_size);
+ JS_SetStripInfo(rt, strip_flags);
js_std_set_worker_new_context_func(JS_NewCustomContext);
js_std_init_handlers(rt);
ctx = JS_NewCustomContext(rt);