-
Notifications
You must be signed in to change notification settings - Fork 1
/
dm.c
772 lines (654 loc) · 17.6 KB
/
dm.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
//gcc -std=c99 -o dm -Ideps/include deps/include/duktape.c -Wall -fstrict-aliasing -fomit-frame-pointer dm.c -lmill
#include <errno.h>
#include "libmill.h"
/*
* Command line execution tool. Useful for test cases and manual testing.
*
* To enable readline and other fancy stuff, compile with -DDUK_CMDLINE_FANCY.
* It is not the default to maximize portability. You can also compile in
* support for example allocators, grep for DUK_CMDLINE_*.
*/
#ifndef DUK_CMDLINE_FANCY
#define NO_READLINE
#define NO_RLIMIT
#define NO_SIGNAL
#endif
#define GREET_CODE(variant) \
"print('((o) Duktape" variant " ' + " \
"Math.floor(Duktape.version / 10000) + '.' + " \
"Math.floor(Duktape.version / 100) % 100 + '.' + " \
"Duktape.version % 100" \
", '(" DUK_GIT_DESCRIBE ")');"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef NO_SIGNAL
#include <signal.h>
#endif
#ifndef NO_RLIMIT
#include <sys/resource.h>
#endif
#ifndef NO_READLINE
#include <readline/readline.h>
#include <readline/history.h>
#endif
#ifdef DUK_CMDLINE_ALLOC_LOGGING
#include "duk_alloc_logging.h"
#endif
#ifdef DUK_CMDLINE_ALLOC_TORTURE
#include "duk_alloc_torture.h"
#endif
#ifdef DUK_CMDLINE_ALLOC_HYBRID
#include "duk_alloc_hybrid.h"
#endif
#include "duktape.h"
#ifdef DUK_CMDLINE_AJSHEAP
/* Defined in duk_cmdline_ajduk.c or alljoyn.js headers. */
void ajsheap_init(void);
void ajsheap_dump(void);
void ajsheap_register(duk_context *ctx);
void ajsheap_start_exec_timeout(void);
void ajsheap_clear_exec_timeout(void);
void *AJS_Alloc(void *udata, duk_size_t size);
void *AJS_Realloc(void *udata, void *ptr, duk_size_t size);
void AJS_Free(void *udata, void *ptr);
#endif
#ifdef DUK_CMDLINE_DEBUGGER_SUPPORT
#include "duk_debug_trans_socket.h"
#endif
#define MEM_LIMIT_NORMAL (128*1024*1024) /* 128 MB */
#define MEM_LIMIT_HIGH (2047*1024*1024) /* ~2 GB */
#define LINEBUF_SIZE 65536
static int interactive_mode = 0;
#ifndef NO_RLIMIT
static void set_resource_limits(rlim_t mem_limit_value) {
int rc;
struct rlimit lim;
rc = getrlimit(RLIMIT_AS, &lim);
if (rc != 0) {
fprintf(stderr, "Warning: cannot read RLIMIT_AS\n");
return;
}
if (lim.rlim_max < mem_limit_value) {
fprintf(stderr, "Warning: rlim_max < mem_limit_value (%d < %d)\n", (int) lim.rlim_max, (int) mem_limit_value);
return;
}
lim.rlim_cur = mem_limit_value;
lim.rlim_max = mem_limit_value;
rc = setrlimit(RLIMIT_AS, &lim);
if (rc != 0) {
fprintf(stderr, "Warning: setrlimit failed\n");
return;
}
#if 0
fprintf(stderr, "Set RLIMIT_AS to %d\n", (int) mem_limit_value);
#endif
}
#endif /* NO_RLIMIT */
#ifndef NO_SIGNAL
static void my_sighandler(int x) {
fprintf(stderr, "Got signal %d\n", x);
}
static void set_sigint_handler(void) {
(void) signal(SIGINT, my_sighandler);
}
#endif /* NO_SIGNAL */
static int get_stack_raw(duk_context *ctx) {
if (!duk_is_object(ctx, -1)) {
return 1;
}
if (!duk_has_prop_string(ctx, -1, "stack")) {
return 1;
}
if (!duk_is_error(ctx, -1)) {
/* Not an Error instance, don't read "stack". */
return 1;
}
duk_get_prop_string(ctx, -1, "stack"); /* caller coerces */
duk_remove(ctx, -2);
return 1;
}
/* Print error to stderr and pop error. */
static void print_pop_error(duk_context *ctx, FILE *f) {
/* Print error objects with a stack trace specially.
* Note that getting the stack trace may throw an error
* so this also needs to be safe call wrapped.
*/
(void) duk_safe_call(ctx, get_stack_raw, 1 /*nargs*/, 1 /*nrets*/);
fprintf(f, "%s\n", duk_safe_to_string(ctx, -1));
fflush(f);
duk_pop(ctx);
}
static int wrapped_compile_execute(duk_context *ctx) {
const char *src_data;
duk_size_t src_len;
int comp_flags;
/* XXX: Here it'd be nice to get some stats for the compilation result
* when a suitable command line is given (e.g. code size, constant
* count, function count. These are available internally but not through
* the public API.
*/
/* Use duk_compile_lstring_filename() variant which avoids interning
* the source code. This only really matters for low memory environments.
*/
/* [ ... src_data src_len filename ] */
comp_flags = 0;
src_data = (const char *) duk_require_pointer(ctx, -3);
src_len = (duk_size_t) duk_require_uint(ctx, -2);
duk_compile_lstring_filename(ctx, comp_flags, src_data, src_len);
/* [ ... src_data src_len function ] */
#if defined(DUK_CMDLINE_AJSHEAP)
ajsheap_start_exec_timeout();
#endif
duk_push_global_object(ctx); /* 'this' binding */
duk_call_method(ctx, 0);
#if defined(DUK_CMDLINE_AJSHEAP)
ajsheap_clear_exec_timeout();
#endif
if (interactive_mode) {
/*
* In interactive mode, write to stdout so output won't
* interleave as easily.
*
* NOTE: the ToString() coercion may fail in some cases;
* for instance, if you evaluate:
*
* ( {valueOf: function() {return {}},
* toString: function() {return {}}});
*
* The error is:
*
* TypeError: failed to coerce with [[DefaultValue]]
* duk_api.c:1420
*
* These are handled now by the caller which also has stack
* trace printing support. User code can print out errors
* safely using duk_safe_to_string().
*/
fprintf(stdout, "= %s\n", duk_to_string(ctx, -1));
fflush(stdout);
} else {
/* In non-interactive mode, success results are not written at all.
* It is important that the result value is not string coerced,
* as the string coercion may cause an error in some cases.
*/
}
duk_pop(ctx);
return 0;
}
static int handle_fh(duk_context *ctx, FILE *f, const char *filename) {
char *buf = NULL;
int len;
int got;
int rc;
int retval = -1;
if (fseek(f, 0, SEEK_END) < 0) {
goto error;
}
len = (int) ftell(f);
if (fseek(f, 0, SEEK_SET) < 0) {
goto error;
}
buf = (char *) malloc(len);
if (!buf) {
goto error;
}
got = fread((void *) buf, (size_t) 1, (size_t) len, f);
duk_push_pointer(ctx, (void *) buf);
duk_push_uint(ctx, (duk_uint_t) got);
duk_push_string(ctx, filename);
interactive_mode = 0; /* global */
rc = duk_safe_call(ctx, wrapped_compile_execute, 3 /*nargs*/, 1 /*nret*/);
#if defined(DUK_CMDLINE_AJSHEAP)
ajsheap_clear_exec_timeout();
#endif
free(buf);
buf = NULL;
if (rc != DUK_EXEC_SUCCESS) {
print_pop_error(ctx, stderr);
goto error;
} else {
duk_pop(ctx);
retval = 0;
}
/* fall thru */
cleanup:
if (buf) {
free(buf);
}
return retval;
error:
fprintf(stderr, "error in executing file %s\n", filename);
fflush(stderr);
goto cleanup;
}
static int handle_file(duk_context *ctx, const char *filename) {
FILE *f = NULL;
int retval;
f = fopen(filename, "rb");
if (!f) {
fprintf(stderr, "failed to open source file: %s\n", filename);
fflush(stderr);
goto error;
}
retval = handle_fh(ctx, f, filename);
fclose(f);
return retval;
error:
return -1;
}
static int handle_eval(duk_context *ctx, const char *code) {
int rc;
int retval = -1;
duk_push_pointer(ctx, (void *) code);
duk_push_uint(ctx, (duk_uint_t) strlen(code));
duk_push_string(ctx, "eval");
interactive_mode = 0; /* global */
rc = duk_safe_call(ctx, wrapped_compile_execute, 3 /*nargs*/, 1 /*nret*/);
#if defined(DUK_CMDLINE_AJSHEAP)
ajsheap_clear_exec_timeout();
#endif
if (rc != DUK_EXEC_SUCCESS) {
print_pop_error(ctx, stderr);
} else {
duk_pop(ctx);
retval = 0;
}
return retval;
}
#ifdef NO_READLINE
static int handle_interactive(duk_context *ctx) {
const char *prompt = "duk> ";
char *buffer = NULL;
int retval = 0;
int rc;
int got_eof = 0;
duk_eval_string(ctx, GREET_CODE(" [no readline]"));
duk_pop(ctx);
buffer = (char *) malloc(LINEBUF_SIZE);
if (!buffer) {
fprintf(stderr, "failed to allocated a line buffer\n");
fflush(stderr);
retval = -1;
goto done;
}
while (!got_eof) {
size_t idx = 0;
fwrite(prompt, 1, strlen(prompt), stdout);
fflush(stdout);
for (;;) {
int c = fgetc(stdin);
if (c == EOF) {
got_eof = 1;
break;
} else if (c == '\n') {
break;
} else if (idx >= LINEBUF_SIZE) {
fprintf(stderr, "line too long\n");
fflush(stderr);
retval = -1;
goto done;
} else {
buffer[idx++] = (char) c;
}
}
duk_push_pointer(ctx, (void *) buffer);
duk_push_uint(ctx, (duk_uint_t) idx);
duk_push_string(ctx, "input");
interactive_mode = 1; /* global */
rc = duk_safe_call(ctx, wrapped_compile_execute, 3 /*nargs*/, 1 /*nret*/);
#if defined(DUK_CMDLINE_AJSHEAP)
ajsheap_clear_exec_timeout();
#endif
if (rc != DUK_EXEC_SUCCESS) {
/* in interactive mode, write to stdout */
print_pop_error(ctx, stdout);
retval = -1; /* an error 'taints' the execution */
} else {
duk_pop(ctx);
}
}
done:
if (buffer) {
free(buffer);
buffer = NULL;
}
return retval;
}
#else /* NO_READLINE */
static int handle_interactive(duk_context *ctx) {
const char *prompt = "duk> ";
char *buffer = NULL;
int retval = 0;
int rc;
duk_eval_string(ctx, GREET_CODE(""));
duk_pop(ctx);
/*
* Note: using readline leads to valgrind-reported leaks inside
* readline itself. Execute code from an input file (and not
* through stdin) for clean valgrind runs.
*/
rl_initialize();
for (;;) {
if (buffer) {
free(buffer);
buffer = NULL;
}
buffer = readline(prompt);
if (!buffer) {
break;
}
if (buffer && buffer[0] != (char) 0) {
add_history(buffer);
}
duk_push_pointer(ctx, (void *) buffer);
duk_push_uint(ctx, (duk_uint_t) strlen(buffer));
duk_push_string(ctx, "input");
interactive_mode = 1; /* global */
rc = duk_safe_call(ctx, wrapped_compile_execute, 3 /*nargs*/, 1 /*nret*/);
#if defined(DUK_CMDLINE_AJSHEAP)
ajsheap_clear_exec_timeout();
#endif
if (buffer) {
free(buffer);
buffer = NULL;
}
if (rc != DUK_EXEC_SUCCESS) {
/* in interactive mode, write to stdout */
print_pop_error(ctx, stdout);
retval = -1; /* an error 'taints' the execution */
} else {
duk_pop(ctx);
}
}
if (buffer) {
free(buffer);
buffer = NULL;
}
return retval;
}
#endif /* NO_READLINE */
#ifdef DUK_CMDLINE_DEBUGGER_SUPPORT
static void debugger_detached(void *udata) {
fprintf(stderr, "Debugger detached, udata: %p\n", (void *) udata);
fflush(stderr);
}
#endif
#define ALLOC_DEFAULT 0
#define ALLOC_LOGGING 1
#define ALLOC_TORTURE 2
#define ALLOC_HYBRID 3
#define ALLOC_AJSHEAP 4
int main(int argc, char *argv[]) {
duk_context *ctx = NULL;
int retval = 0;
int have_files = 0;
int have_eval = 0;
int interactive = 0;
int memlimit_high = 1;
int alloc_provider = ALLOC_DEFAULT;
int debugger = 0;
int i;
#ifdef DUK_CMDLINE_AJSHEAP
alloc_provider = ALLOC_AJSHEAP;
#endif
/*
* Signal handling setup
*/
#ifndef NO_SIGNAL
set_sigint_handler();
/* This is useful at the global level; libraries should avoid SIGPIPE though */
/*signal(SIGPIPE, SIG_IGN);*/
#endif
/*
* Parse options
*/
for (i = 1; i < argc; i++) {
char *arg = argv[i];
if (!arg) {
goto usage;
}
if (strcmp(arg, "--restrict-memory") == 0) {
memlimit_high = 0;
} else if (strcmp(arg, "-i") == 0) {
interactive = 1;
} else if (strcmp(arg, "-e") == 0) {
have_eval = 1;
if (i == argc - 1) {
goto usage;
}
i++; /* skip code */
} else if (strcmp(arg, "--alloc-default") == 0) {
alloc_provider = ALLOC_DEFAULT;
} else if (strcmp(arg, "--alloc-logging") == 0) {
alloc_provider = ALLOC_LOGGING;
} else if (strcmp(arg, "--alloc-torture") == 0) {
alloc_provider = ALLOC_TORTURE;
} else if (strcmp(arg, "--alloc-hybrid") == 0) {
alloc_provider = ALLOC_HYBRID;
} else if (strcmp(arg, "--alloc-ajsheap") == 0) {
alloc_provider = ALLOC_AJSHEAP;
} else if (strcmp(arg, "--debugger") == 0) {
debugger = 1;
} else if (strlen(arg) >= 1 && arg[0] == '-') {
goto usage;
} else {
have_files = 1;
}
}
if (!have_files && !have_eval) {
interactive = 1;
}
/*
* Memory limit
*/
#ifndef NO_RLIMIT
set_resource_limits(memlimit_high ? MEM_LIMIT_HIGH : MEM_LIMIT_NORMAL);
#else
if (memlimit_high == 0) {
fprintf(stderr, "Warning: option --restrict-memory ignored, no rlimit support\n");
fflush(stderr);
}
#endif
/*
* Create context
*/
ctx = NULL;
if (!ctx && alloc_provider == ALLOC_LOGGING) {
#ifdef DUK_CMDLINE_ALLOC_LOGGING
ctx = duk_create_heap(duk_alloc_logging,
duk_realloc_logging,
duk_free_logging,
(void *) 0xdeadbeef,
NULL);
#else
fprintf(stderr, "Warning: option --alloc-logging ignored, no logging allocator support\n");
fflush(stderr);
#endif
}
if (!ctx && alloc_provider == ALLOC_TORTURE) {
#ifdef DUK_CMDLINE_ALLOC_TORTURE
ctx = duk_create_heap(duk_alloc_torture,
duk_realloc_torture,
duk_free_torture,
(void *) 0xdeadbeef,
NULL);
#else
fprintf(stderr, "Warning: option --alloc-torture ignored, no torture allocator support\n");
fflush(stderr);
#endif
}
if (!ctx && alloc_provider == ALLOC_HYBRID) {
#ifdef DUK_CMDLINE_ALLOC_HYBRID
void *udata = duk_alloc_hybrid_init();
if (!udata) {
fprintf(stderr, "Failed to init hybrid allocator\n");
fflush(stderr);
} else {
ctx = duk_create_heap(duk_alloc_hybrid,
duk_realloc_hybrid,
duk_free_hybrid,
udata,
NULL);
}
#else
fprintf(stderr, "Warning: option --alloc-hybrid ignored, no hybrid allocator support\n");
fflush(stderr);
#endif
}
if (!ctx && alloc_provider == ALLOC_AJSHEAP) {
#ifdef DUK_CMDLINE_AJSHEAP
ajsheap_init();
ctx = duk_create_heap(AJS_Alloc,
AJS_Realloc,
AJS_Free,
(void *) 0xdeadbeef, /* heap_udata: ignored by AjsHeap, use as marker */
NULL); /* fatal_handler */
#else
fprintf(stderr, "Warning: option --alloc-ajsheap ignored, no ajsheap allocator support\n");
fflush(stderr);
#endif
}
if (!ctx && alloc_provider == ALLOC_DEFAULT) {
ctx = duk_create_heap_default();
}
if (!ctx) {
fprintf(stderr, "Failed to create Duktape heap\n");
fflush(stderr);
exit(-1);
}
#ifdef DUK_CMDLINE_AJSHEAP
if (alloc_provider == ALLOC_AJSHEAP) {
fprintf(stdout, "Pool dump after heap creation\n");
ajsheap_dump();
}
#endif
#ifdef DUK_CMDLINE_AJSHEAP
if (alloc_provider == ALLOC_AJSHEAP) {
ajsheap_register(ctx);
}
#endif
if (debugger) {
#ifdef DUK_CMDLINE_DEBUGGER_SUPPORT
fprintf(stderr, "Debugger enabled, create socket and wait for connection\n");
fflush(stderr);
duk_debug_trans_socket_init();
duk_debug_trans_socket_waitconn();
fprintf(stderr, "Debugger connected, call duk_debugger_attach() and then execute requested file(s)/eval\n");
fflush(stderr);
duk_debugger_attach(ctx,
duk_debug_trans_socket_read,
duk_debug_trans_socket_write,
duk_debug_trans_socket_peek,
duk_debug_trans_socket_read_flush,
duk_debug_trans_socket_write_flush,
debugger_detached,
(void *) 0xbeef1234);
#else
fprintf(stderr, "Warning: option --debugger ignored, no debugger support\n");
fflush(stderr);
#endif
}
#if 0
/* Manual test for duk_debugger_cooperate() */
{
for (i = 0; i < 60; i++) {
printf("cooperate: %d\n", i);
usleep(1000000);
duk_debugger_cooperate(ctx);
}
}
#endif
/*
* Execute any argument file(s)
*/
for (i = 1; i < argc; i++) {
char *arg = argv[i];
if (!arg) {
continue;
} else if (strlen(arg) == 2 && strcmp(arg, "-e") == 0) {
/* Here we know the eval arg exists but check anyway */
if (i == argc - 1) {
retval = 1;
goto cleanup;
}
if (handle_eval(ctx, argv[i + 1]) != 0) {
retval = 1;
goto cleanup;
}
i++; /* skip code */
continue;
} else if (strlen(arg) >= 1 && arg[0] == '-') {
continue;
}
if (handle_file(ctx, arg) != 0) {
retval = 1;
goto cleanup;
}
}
/*
* Enter interactive mode if options indicate it
*/
if (interactive) {
if (handle_interactive(ctx) != 0) {
retval = 1;
goto cleanup;
}
}
/*
* Cleanup and exit
*/
cleanup:
if (interactive) {
fprintf(stderr, "Cleaning up...\n");
fflush(stderr);
}
#ifdef DUK_CMDLINE_AJSHEAP
if (alloc_provider == ALLOC_AJSHEAP) {
fprintf(stdout, "Pool dump before duk_destroy_heap(), before forced gc\n");
ajsheap_dump();
duk_gc(ctx, 0);
fprintf(stdout, "Pool dump before duk_destroy_heap(), after forced gc\n");
ajsheap_dump();
}
#endif
if (ctx) {
duk_destroy_heap(ctx);
}
#ifdef DUK_CMDLINE_AJSHEAP
if (alloc_provider == ALLOC_AJSHEAP) {
fprintf(stdout, "Pool dump after duk_destroy_heap() (should have zero allocs)\n");
ajsheap_dump();
}
#endif
return retval;
/*
* Usage
*/
usage:
fprintf(stderr, "Usage: duk [options] [<filenames>]\n"
"\n"
" -i enter interactive mode after executing argument file(s) / eval code\n"
" -e CODE evaluate code\n"
" --restrict-memory use lower memory limit (used by test runner)\n"
" --alloc-default use Duktape default allocator\n"
#ifdef DUK_CMDLINE_ALLOC_LOGGING
" --alloc-logging use logging allocator (writes to /tmp)\n"
#endif
#ifdef DUK_CMDLINE_ALLOC_TORTURE
" --alloc-torture use torture allocator\n"
#endif
#ifdef DUK_CMDLINE_ALLOC_HYBRID
" --alloc-hybrid use hybrid allocator\n"
#endif
#ifdef DUK_CMDLINE_AJSHEAP
" --alloc-ajsheap use ajsheap allocator (enabled by default with 'ajduk')\n"
#endif
#ifdef DUK_CMDLINE_DEBUGGER_SUPPORT
" --debugger start example debugger\n"
#endif
"\n"
"If <filename> is omitted, interactive mode is started automatically.\n");
fflush(stderr);
exit(1);
}