A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita
audio
rust
zig
deno
mpris
rockbox
mpd
1/*
2** $Id: ldebug.c,v 2.29.1.6 2008/05/08 16:56:26 roberto Exp $
3** Debug Interface
4** See Copyright Notice in lua.h
5*/
6
7
8#include <stdarg.h>
9#include <stddef.h>
10#include <string.h>
11
12
13#define ldebug_c
14#define LUA_CORE
15
16#include "lua.h"
17
18#include "lapi.h"
19#include "lcode.h"
20#include "ldebug.h"
21#include "ldo.h"
22#include "lfunc.h"
23#include "lobject.h"
24#include "lopcodes.h"
25#include "lstate.h"
26#include "lstring.h"
27#include "ltable.h"
28#include "ltm.h"
29#include "lvm.h"
30
31
32
33static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name);
34
35
36static int currentpc (lua_State *L, CallInfo *ci) {
37 if (!isLua(ci)) return -1; /* function is not a Lua function? */
38 if (ci == L->ci)
39 ci->savedpc = L->savedpc;
40 return pcRel(ci->savedpc, ci_func(ci)->l.p);
41}
42
43
44static int currentline (lua_State *L, CallInfo *ci) {
45 int pc = currentpc(L, ci);
46 if (pc < 0)
47 return -1; /* only active lua functions have current-line information */
48 else
49 return getline(ci_func(ci)->l.p, pc);
50}
51
52
53/*
54** this function can be called asynchronous (e.g. during a signal)
55*/
56LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) {
57 if (func == NULL || mask == 0) { /* turn off hooks? */
58 mask = 0;
59 func = NULL;
60 }
61 L->hook = func;
62 L->basehookcount = count;
63 resethookcount(L);
64 L->hookmask = cast_byte(mask);
65 return 1;
66}
67
68
69LUA_API lua_Hook lua_gethook (lua_State *L) {
70 return L->hook;
71}
72
73
74LUA_API int lua_gethookmask (lua_State *L) {
75 return L->hookmask;
76}
77
78
79LUA_API int lua_gethookcount (lua_State *L) {
80 return L->basehookcount;
81}
82
83
84LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) {
85 int status;
86 CallInfo *ci;
87 lua_lock(L);
88 for (ci = L->ci; level > 0 && ci > L->base_ci; ci--) {
89 level--;
90 if (f_isLua(ci)) /* Lua function? */
91 level -= ci->tailcalls; /* skip lost tail calls */
92 }
93 if (level == 0 && ci > L->base_ci) { /* level found? */
94 status = 1;
95 ar->i_ci = cast_int(ci - L->base_ci);
96 }
97 else if (level < 0) { /* level is of a lost tail call? */
98 status = 1;
99 ar->i_ci = 0;
100 }
101 else status = 0; /* no such level */
102 lua_unlock(L);
103 return status;
104}
105
106
107static Proto *getluaproto (CallInfo *ci) {
108 return (isLua(ci) ? ci_func(ci)->l.p : NULL);
109}
110
111
112static const char *findlocal (lua_State *L, CallInfo *ci, int n) {
113 const char *name;
114 Proto *fp = getluaproto(ci);
115 if (fp && (name = luaF_getlocalname(fp, n, currentpc(L, ci))) != NULL)
116 return name; /* is a local variable in a Lua function */
117 else {
118 StkId limit = (ci == L->ci) ? L->top : (ci+1)->func;
119 if (limit - ci->base >= n && n > 0) /* is 'n' inside 'ci' stack? */
120 return "(*temporary)";
121 else
122 return NULL;
123 }
124}
125
126
127LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {
128 CallInfo *ci = L->base_ci + ar->i_ci;
129 const char *name = findlocal(L, ci, n);
130 lua_lock(L);
131 if (name)
132 luaA_pushobject(L, ci->base + (n - 1));
133 lua_unlock(L);
134 return name;
135}
136
137
138LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) {
139 CallInfo *ci = L->base_ci + ar->i_ci;
140 const char *name = findlocal(L, ci, n);
141 lua_lock(L);
142 if (name)
143 setobjs2s(L, ci->base + (n - 1), L->top - 1);
144 L->top--; /* pop value */
145 lua_unlock(L);
146 return name;
147}
148
149
150static void funcinfo (lua_Debug *ar, Closure *cl) {
151 if (cl->c.isC) {
152 ar->source = "=[C]";
153 ar->linedefined = -1;
154 ar->lastlinedefined = -1;
155 ar->what = "C";
156 }
157 else {
158 ar->source = getstr(cl->l.p->source);
159 ar->linedefined = cl->l.p->linedefined;
160 ar->lastlinedefined = cl->l.p->lastlinedefined;
161 ar->what = (ar->linedefined == 0) ? "main" : "Lua";
162 }
163 luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE);
164}
165
166
167static void info_tailcall (lua_Debug *ar) {
168 ar->name = ar->namewhat = "";
169 ar->what = "tail";
170 ar->lastlinedefined = ar->linedefined = ar->currentline = -1;
171 ar->source = "=(tail call)";
172 luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE);
173 ar->nups = 0;
174}
175
176
177static void collectvalidlines (lua_State *L, Closure *f) {
178 if (f == NULL || f->c.isC) {
179 setnilvalue(L->top);
180 }
181 else {
182 Table *t = luaH_new(L, 0, 0);
183#ifdef LUA_OPTIMIZE_DEBUG
184 int line = 0;
185 unsigned char *p = f->l.p->packedlineinfo;
186 if (p) {
187 for (; *p && *p != INFO_FILL_BYTE; ) {
188 if (*p & INFO_DELTA_MASK) { /* line delta */
189 int delta = *p & INFO_DELTA_6BITS;
190 unsigned char sign = *p++ & INFO_SIGN_MASK;
191 int shift;
192 for (shift = 6; *p & INFO_DELTA_MASK; p++, shift += 7) {
193 delta += (*p & INFO_DELTA_7BITS)<<shift;
194 }
195 line += sign ? -delta : delta+2;
196 } else {
197 line++;
198 }
199 p++;
200 setbvalue(luaH_setnum(L, t, line), 1);
201 }
202 }
203#else
204 int *lineinfo = f->l.p->lineinfo;
205 int i;
206 for (i=0; i<f->l.p->sizelineinfo; i++)
207 setbvalue(luaH_setnum(L, t, lineinfo[i]), 1);
208#endif
209 sethvalue(L, L->top, t);
210 }
211 incr_top(L);
212}
213
214
215#ifdef LUA_OPTIMIZE_DEBUG
216/*
217 * This may seem expensive but this is only accessed frequently in traceexec
218 * and the while loop will be executed roughly half the number of non-blank
219 * source lines in the Lua function and these tend to be short.
220 */
221LUAI_FUNC int luaG_getline (const Proto *f, int pc) {
222 int line = 0, thispc = 0, nextpc;
223 unsigned char *p;
224
225 for (p = f->packedlineinfo; *p && *p != INFO_FILL_BYTE;) {
226 if (*p & INFO_DELTA_MASK) { /* line delta */
227 int delta = *p & INFO_DELTA_6BITS;
228 unsigned char sign = *p++ & INFO_SIGN_MASK;
229 int shift;
230 for (shift = 6; *p & INFO_DELTA_MASK; p++, shift += 7) {
231 delta += (*p & INFO_DELTA_7BITS)<<shift;
232 }
233 line += sign ? -delta : delta+2;
234 } else {
235 line++;
236 }
237 lua_assert(*p<127);
238 nextpc = thispc + *p++;
239 if (thispc <= pc && pc < nextpc) {
240 return line;
241 }
242 thispc = nextpc;
243 }
244 lua_assert(0);
245 return 0;
246}
247
248
249static int stripdebug (lua_State *L, Proto *f, const int level) {
250 int len = 0;
251 TString* dummy;
252 switch (level) {
253 case 3:
254 len += f->sizelineinfo;
255 f->packedlineinfo = luaM_freearray(L, f->packedlineinfo, f->sizelineinfo, unsigned char);
256 f->sizelineinfo = 0;
257 /* fallthrough */
258 case 2:
259 len += f->sizelocvars * (sizeof(struct LocVar) + sizeof(dummy->tsv) + sizeof(struct LocVar *));
260 f->locvars = luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar);
261 f->upvalues = luaM_freearray(L, f->upvalues, f->sizeupvalues, TString *);
262 len += f->sizelocvars * (sizeof(struct LocVar) + sizeof(dummy->tsv) + sizeof(struct LocVar *)) +
263 f->sizeupvalues * (sizeof(dummy->tsv) + sizeof(TString *));
264 f->sizelocvars = 0;
265 f->sizeupvalues = 0;
266 /* fallthrough */
267 case 1:
268 default:
269 break;
270 }
271 return len;
272}
273
274
275/* This is a recursive function so it's stack size has been kept to a minimum! */
276LUAI_FUNC int luaG_stripdebug (lua_State *L, Proto *f, int level, int recv){
277 int len = 0, i;
278#ifndef LUA_OPTIMIZE_DEBUG_USER /* gcc doesn't realize level can't be changed */
279 level = LUA_OPTIMIZE_DEBUG;
280#endif
281 if (recv > 0 && f->sizep != 0) {
282 /* recv limits recursion depth */
283 for(i=0;i<f->sizep;i++) len += luaG_stripdebug(L, f->p[i], level, --recv);
284 }
285 len += stripdebug (L, f, level);
286 return len;
287}
288#endif
289
290
291static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar,
292 Closure *f, CallInfo *ci) {
293 int status = 1;
294 if (f == NULL) {
295 info_tailcall(ar);
296 return status;
297 }
298 for (; *what; what++) {
299 switch (*what) {
300 case 'S': {
301 funcinfo(ar, f);
302 break;
303 }
304 case 'l': {
305 ar->currentline = (ci) ? currentline(L, ci) : -1;
306 break;
307 }
308 case 'u': {
309 ar->nups = f->c.nupvalues;
310 break;
311 }
312 case 'n': {
313 ar->namewhat = (ci) ? getfuncname(L, ci, &ar->name) : NULL;
314 if (ar->namewhat == NULL) {
315 ar->namewhat = ""; /* not found */
316 ar->name = NULL;
317 }
318 break;
319 }
320 case 'L':
321 case 'f': /* handled by lua_getinfo */
322 break;
323 default: status = 0; /* invalid option */
324 }
325 }
326 return status;
327}
328
329
330LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
331 int status;
332 Closure *f = NULL;
333 CallInfo *ci = NULL;
334 lua_lock(L);
335 if (*what == '>') {
336 StkId func = L->top - 1;
337 luai_apicheck(L, ttisfunction(func));
338 what++; /* skip the '>' */
339 f = clvalue(func);
340 L->top--; /* pop function */
341 }
342 else if (ar->i_ci != 0) { /* no tail call? */
343 ci = L->base_ci + ar->i_ci;
344 lua_assert(ttisfunction(ci->func));
345 f = clvalue(ci->func);
346 }
347 status = auxgetinfo(L, what, ar, f, ci);
348 if (strchr(what, 'f')) {
349 if (f == NULL) setnilvalue(L->top);
350 else setclvalue(L, L->top, f);
351 incr_top(L);
352 }
353 if (strchr(what, 'L'))
354 collectvalidlines(L, f);
355 lua_unlock(L);
356 return status;
357}
358
359
360/*
361** {======================================================
362** Symbolic Execution and code checker
363** =======================================================
364*/
365
366#define check(x) if (!(x)) return 0;
367
368#define checkjump(pt,pc) check(0 <= pc && pc < pt->sizecode)
369
370#define checkreg(pt,reg) check((reg) < (pt)->maxstacksize)
371
372
373
374static int precheck (const Proto *pt) {
375 check(pt->maxstacksize <= MAXSTACK);
376 check(pt->numparams+(pt->is_vararg & VARARG_HASARG) <= pt->maxstacksize);
377 check(!(pt->is_vararg & VARARG_NEEDSARG) ||
378 (pt->is_vararg & VARARG_HASARG));
379 check(pt->sizeupvalues <= pt->nups);
380#ifndef LUA_OPTIMIZE_DEBUG
381 check(pt->sizelineinfo == pt->sizecode || pt->sizelineinfo == 0);
382#endif
383 check(pt->sizecode > 0 && GET_OPCODE(pt->code[pt->sizecode-1]) == OP_RETURN);
384 return 1;
385}
386
387
388#define checkopenop(pt,pc) luaG_checkopenop((pt)->code[(pc)+1])
389
390int luaG_checkopenop (Instruction i) {
391 switch (GET_OPCODE(i)) {
392 case OP_CALL:
393 case OP_TAILCALL:
394 case OP_RETURN:
395 case OP_SETLIST: {
396 check(GETARG_B(i) == 0);
397 return 1;
398 }
399 default: return 0; /* invalid instruction after an open call */
400 }
401}
402
403
404static int checkArgMode (const Proto *pt, int r, enum OpArgMask mode) {
405 switch (mode) {
406 case OpArgN: check(r == 0); break;
407 case OpArgU: break;
408 case OpArgR: checkreg(pt, r); break;
409 case OpArgK:
410 check(ISK(r) ? INDEXK(r) < pt->sizek : r < pt->maxstacksize);
411 break;
412 }
413 return 1;
414}
415
416
417static Instruction symbexec (const Proto *pt, int lastpc, int reg) {
418 int pc;
419 int last; /* stores position of last instruction that changed `reg' */
420 last = pt->sizecode-1; /* points to final return (a `neutral' instruction) */
421 check(precheck(pt));
422 for (pc = 0; pc < lastpc; pc++) {
423 Instruction i = pt->code[pc];
424 OpCode op = GET_OPCODE(i);
425 int a = GETARG_A(i);
426 int b = 0;
427 int c = 0;
428 check(op < NUM_OPCODES);
429 checkreg(pt, a);
430 switch (getOpMode(op)) {
431 case iABC: {
432 b = GETARG_B(i);
433 c = GETARG_C(i);
434 check(checkArgMode(pt, b, getBMode(op)));
435 check(checkArgMode(pt, c, getCMode(op)));
436 break;
437 }
438 case iABx: {
439 b = GETARG_Bx(i);
440 if (getBMode(op) == OpArgK) check(b < pt->sizek);
441 break;
442 }
443 case iAsBx: {
444 b = GETARG_sBx(i);
445 if (getBMode(op) == OpArgR) {
446 int dest = pc+1+b;
447 check(0 <= dest && dest < pt->sizecode);
448 if (dest > 0) {
449 int j;
450 /* check that it does not jump to a setlist count; this
451 is tricky, because the count from a previous setlist may
452 have the same value of an invalid setlist; so, we must
453 go all the way back to the first of them (if any) */
454 for (j = 0; j < dest; j++) {
455 Instruction d = pt->code[dest-1-j];
456 if (!(GET_OPCODE(d) == OP_SETLIST && GETARG_C(d) == 0)) break;
457 }
458 /* if 'j' is even, previous value is not a setlist (even if
459 it looks like one) */
460 check((j&1) == 0);
461 }
462 }
463 break;
464 }
465 }
466 if (testAMode(op)) {
467 if (a == reg) last = pc; /* change register `a' */
468 }
469 if (testTMode(op)) {
470 check(pc+2 < pt->sizecode); /* check skip */
471 check(GET_OPCODE(pt->code[pc+1]) == OP_JMP);
472 }
473 switch (op) {
474 case OP_LOADBOOL: {
475 if (c == 1) { /* does it jump? */
476 check(pc+2 < pt->sizecode); /* check its jump */
477 check(GET_OPCODE(pt->code[pc+1]) != OP_SETLIST ||
478 GETARG_C(pt->code[pc+1]) != 0);
479 }
480 break;
481 }
482 case OP_LOADNIL: {
483 if (a <= reg && reg <= b)
484 last = pc; /* set registers from `a' to `b' */
485 break;
486 }
487 case OP_GETUPVAL:
488 case OP_SETUPVAL: {
489 check(b < pt->nups);
490 break;
491 }
492 case OP_GETGLOBAL:
493 case OP_SETGLOBAL: {
494 check(ttisstring(&pt->k[b]));
495 break;
496 }
497 case OP_SELF: {
498 checkreg(pt, a+1);
499 if (reg == a+1) last = pc;
500 break;
501 }
502 case OP_CONCAT: {
503 check(b < c); /* at least two operands */
504 break;
505 }
506 case OP_TFORLOOP: {
507 check(c >= 1); /* at least one result (control variable) */
508 checkreg(pt, a+2+c); /* space for results */
509 if (reg >= a+2) last = pc; /* affect all regs above its base */
510 break;
511 }
512 case OP_FORLOOP:
513 case OP_FORPREP:
514 checkreg(pt, a+3);
515 /* fallthrough */
516 case OP_JMP: {
517 int dest = pc+1+b;
518 /* not full check and jump is forward and do not skip `lastpc'? */
519 if (reg != NO_REG && pc < dest && dest <= lastpc)
520 pc += b; /* do the jump */
521 break;
522 }
523 case OP_CALL:
524 case OP_TAILCALL: {
525 if (b != 0) {
526 checkreg(pt, a+b-1);
527 }
528 c--; /* c = num. returns */
529 if (c == LUA_MULTRET) {
530 check(checkopenop(pt, pc));
531 }
532 else if (c != 0)
533 checkreg(pt, a+c-1);
534 if (reg >= a) last = pc; /* affect all registers above base */
535 break;
536 }
537 case OP_RETURN: {
538 b--; /* b = num. returns */
539 if (b > 0) checkreg(pt, a+b-1);
540 break;
541 }
542 case OP_SETLIST: {
543 if (b > 0) checkreg(pt, a + b);
544 if (c == 0) {
545 pc++;
546 check(pc < pt->sizecode - 1);
547 }
548 break;
549 }
550 case OP_CLOSURE: {
551 int nup, j;
552 check(b < pt->sizep);
553 nup = pt->p[b]->nups;
554 check(pc + nup < pt->sizecode);
555 for (j = 1; j <= nup; j++) {
556 OpCode op1 = GET_OPCODE(pt->code[pc + j]);
557 check(op1 == OP_GETUPVAL || op1 == OP_MOVE);
558 }
559 if (reg != NO_REG) /* tracing? */
560 pc += nup; /* do not 'execute' these pseudo-instructions */
561 break;
562 }
563 case OP_VARARG: {
564 check((pt->is_vararg & VARARG_ISVARARG) &&
565 !(pt->is_vararg & VARARG_NEEDSARG));
566 b--;
567 if (b == LUA_MULTRET) check(checkopenop(pt, pc));
568 checkreg(pt, a+b-1);
569 break;
570 }
571 default: break;
572 }
573 }
574 return pt->code[last];
575}
576
577#undef check
578#undef checkjump
579#undef checkreg
580
581/* }====================================================== */
582
583
584int luaG_checkcode (const Proto *pt) {
585 return (symbexec(pt, pt->sizecode, NO_REG) != 0);
586}
587
588
589static const char *kname (Proto *p, int c) {
590 if (ISK(c) && ttisstring(&p->k[INDEXK(c)]))
591 return svalue(&p->k[INDEXK(c)]);
592 else
593 return "?";
594}
595
596
597static const char *getobjname (lua_State *L, CallInfo *ci, int stackpos,
598 const char **name) {
599 if (isLua(ci)) { /* a Lua function? */
600 Proto *p = ci_func(ci)->l.p;
601 int pc = currentpc(L, ci);
602 Instruction i;
603 *name = luaF_getlocalname(p, stackpos+1, pc);
604 if (*name) /* is a local? */
605 return "local";
606 i = symbexec(p, pc, stackpos); /* try symbolic execution */
607 lua_assert(pc != -1);
608 switch (GET_OPCODE(i)) {
609 case OP_GETGLOBAL: {
610 int g = GETARG_Bx(i); /* global index */
611 lua_assert(ttisstring(&p->k[g]));
612 *name = svalue(&p->k[g]);
613 return "global";
614 }
615 case OP_MOVE: {
616 int a = GETARG_A(i);
617 int b = GETARG_B(i); /* move from `b' to `a' */
618 if (b < a)
619 return getobjname(L, ci, b, name); /* get name for `b' */
620 break;
621 }
622 case OP_GETTABLE: {
623 int k = GETARG_C(i); /* key index */
624 *name = kname(p, k);
625 return "field";
626 }
627 case OP_GETUPVAL: {
628 int u = GETARG_B(i); /* upvalue index */
629 *name = p->upvalues ? getstr(p->upvalues[u]) : "?";
630 return "upvalue";
631 }
632 case OP_SELF: {
633 int k = GETARG_C(i); /* key index */
634 *name = kname(p, k);
635 return "method";
636 }
637 default: break;
638 }
639 }
640 return NULL; /* no useful name found */
641}
642
643
644static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) {
645 Instruction i;
646 if ((isLua(ci) && ci->tailcalls > 0) || !isLua(ci - 1))
647 return NULL; /* calling function is not Lua (or is unknown) */
648 ci--; /* calling function */
649 i = ci_func(ci)->l.p->code[currentpc(L, ci)];
650 if (GET_OPCODE(i) == OP_CALL || GET_OPCODE(i) == OP_TAILCALL ||
651 GET_OPCODE(i) == OP_TFORLOOP)
652 return getobjname(L, ci, GETARG_A(i), name);
653 else
654 return NULL; /* no useful name can be found */
655}
656
657
658/* only ANSI way to check whether a pointer points to an array */
659static int isinstack (CallInfo *ci, const TValue *o) {
660 StkId p;
661 for (p = ci->base; p < ci->top; p++)
662 if (o == p) return 1;
663 return 0;
664}
665
666
667void luaG_typeerror (lua_State *L, const TValue *o, const char *op) {
668 const char *name = NULL;
669 const char *t = luaT_typenames[ttype(o)];
670 const char *kind = (isinstack(L->ci, o)) ?
671 getobjname(L, L->ci, cast_int(o - L->base), &name) :
672 NULL;
673 if (kind)
674 luaG_runerror(L, "attempt to %s %s " LUA_QS " (a %s value)",
675 op, kind, name, t);
676 else
677 luaG_runerror(L, "attempt to %s a %s value", op, t);
678}
679
680
681void luaG_concaterror (lua_State *L, StkId p1, StkId p2) {
682 if (ttisstring(p1) || ttisnumber(p1)) p1 = p2;
683 lua_assert(!ttisstring(p1) && !ttisnumber(p1));
684 luaG_typeerror(L, p1, "concatenate");
685}
686
687
688void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) {
689 TValue temp;
690 if (luaV_tonumber(p1, &temp) == NULL)
691 p2 = p1; /* first operand is wrong */
692 luaG_typeerror(L, p2, "perform arithmetic on");
693}
694
695
696int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) {
697 const char *t1 = luaT_typenames[ttype(p1)];
698 const char *t2 = luaT_typenames[ttype(p2)];
699 if (t1[2] == t2[2])
700 luaG_runerror(L, "attempt to compare two %s values", t1);
701 else
702 luaG_runerror(L, "attempt to compare %s with %s", t1, t2);
703 return 0;
704}
705
706
707static void addinfo (lua_State *L, const char *msg) {
708 CallInfo *ci = L->ci;
709 if (isLua(ci)) { /* is Lua code? */
710 char buff[LUA_IDSIZE]; /* add file:line information */
711 int line = currentline(L, ci);
712 luaO_chunkid(buff, getstr(getluaproto(ci)->source), LUA_IDSIZE);
713 luaO_pushfstring(L, "%s: %d: %s", buff, line, msg);
714 }
715}
716
717
718void luaG_errormsg (lua_State *L) {
719 if (L->errfunc != 0) { /* is there an error handling function? */
720 StkId errfunc = restorestack(L, L->errfunc);
721 if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR);
722 setobjs2s(L, L->top, L->top - 1); /* move argument */
723 setobjs2s(L, L->top - 1, errfunc); /* push function */
724 incr_top(L);
725 luaD_call(L, L->top - 2, 1); /* call it */
726 }
727 luaD_throw(L, LUA_ERRRUN);
728}
729
730
731void luaG_runerror (lua_State *L, const char *fmt, ...) {
732 va_list argp;
733 va_start(argp, fmt);
734 addinfo(L, luaO_pushvfstring(L, fmt, argp));
735 va_end(argp);
736 luaG_errormsg(L);
737}