Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
ldebug.c File Reference
#include "lprefix.h"
#include <stdarg.h>
#include <stddef.h>
#include <string.h>
#include "lua.h"
#include "lapi.h"
#include "lcode.h"
#include "ldebug.h"
#include "ldo.h"
#include "lfunc.h"
#include "lobject.h"
#include "lopcodes.h"
#include "lstate.h"
#include "lstring.h"
#include "ltable.h"
#include "ltm.h"
#include "lvm.h"

Go to the source code of this file.

Macros

#define ldebug_c
 
#define LUA_CORE
 
#define noLuaClosure(f)   ((f) == NULL || (f)->c.tt == LUA_VCCL)
 

Functions

static const char * funcnamefromcode (lua_State *L, CallInfo *ci, const char **name)
 
static int currentpc (CallInfo *ci)
 
static int getbaseline (const Proto *f, int pc, int *basepc)
 
int luaG_getfuncline (const Proto *f, int pc)
 
static int getcurrentline (CallInfo *ci)
 
static void settraps (CallInfo *ci)
 
LUA_API void lua_sethook (lua_State *L, lua_Hook func, int mask, int count)
 
LUA_API lua_Hook lua_gethook (lua_State *L)
 
LUA_API int lua_gethookmask (lua_State *L)
 
LUA_API int lua_gethookcount (lua_State *L)
 
LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar)
 
static const char * upvalname (const Proto *p, int uv)
 
static const char * findvararg (CallInfo *ci, int n, StkId *pos)
 
const char * luaG_findlocal (lua_State *L, CallInfo *ci, int n, StkId *pos)
 
LUA_API const char * lua_getlocal (lua_State *L, const lua_Debug *ar, int n)
 
LUA_API const char * lua_setlocal (lua_State *L, const lua_Debug *ar, int n)
 
static void funcinfo (lua_Debug *ar, Closure *cl)
 
static int nextline (const Proto *p, int currentline, int pc)
 
static void collectvalidlines (lua_State *L, Closure *f)
 
static const char * getfuncname (lua_State *L, CallInfo *ci, const char **name)
 
static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, Closure *f, CallInfo *ci)
 
LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar)
 
static const char * getobjname (const Proto *p, int lastpc, int reg, const char **name)
 
static void kname (const Proto *p, int c, const char **name)
 
static void rname (const Proto *p, int pc, int c, const char **name)
 
static void rkname (const Proto *p, int pc, Instruction i, const char **name)
 
static int filterpc (int pc, int jmptarget)
 
static int findsetreg (const Proto *p, int lastpc, int reg)
 
static const char * gxf (const Proto *p, int pc, Instruction i, int isup)
 
static int isinstack (CallInfo *ci, const TValue *o)
 
static const char * getupvalname (CallInfo *ci, const TValue *o, const char **name)
 
static const char * varinfo (lua_State *L, const TValue *o)
 
l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *op)
 
l_noret luaG_callerror (lua_State *L, const TValue *o)
 
l_noret luaG_forerror (lua_State *L, const TValue *o, const char *what)
 
l_noret luaG_concaterror (lua_State *L, const TValue *p1, const TValue *p2)
 
l_noret luaG_opinterror (lua_State *L, const TValue *p1, const TValue *p2, const char *msg)
 
l_noret luaG_tointerror (lua_State *L, const TValue *p1, const TValue *p2)
 
l_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2)
 
const char * luaG_addinfo (lua_State *L, const char *msg, TString *src, int line)
 
l_noret luaG_errormsg (lua_State *L)
 
l_noret luaG_runerror (lua_State *L, const char *fmt,...)
 
static int changedline (const Proto *p, int oldpc, int newpc)
 
int luaG_traceexec (lua_State *L, const Instruction *pc)
 

Macro Definition Documentation

◆ ldebug_c

#define ldebug_c

Definition at line 7 of file lua-5.4.3/src/ldebug.c.

◆ LUA_CORE

#define LUA_CORE

Definition at line 8 of file lua-5.4.3/src/ldebug.c.

◆ noLuaClosure

#define noLuaClosure ( f)    ((f) == NULL || (f)->c.tt == LUA_VCCL)

Definition at line 34 of file lua-5.4.3/src/ldebug.c.

Referenced by auxgetinfo(), collectvalidlines(), and funcinfo().

Function Documentation

◆ auxgetinfo()

static int auxgetinfo ( lua_State * L,
const char * what,
lua_Debug * ar,
Closure * f,
CallInfo * ci )
static

Definition at line 326 of file lua-5.4.3/src/ldebug.c.

327 {
328 int status = 1;
329 for (; *what; what++) {
330 switch (*what) {
331 case 'S': {
332 funcinfo(ar, f);
333 break;
334 }
335 case 'l': {
336 ar->currentline = (ci && isLua(ci)) ? getcurrentline(ci) : -1;
337 break;
338 }
339 case 'u': {
340 ar->nups = (f == NULL) ? 0 : f->c.nupvalues;
341 if (noLuaClosure(f)) {
342 ar->isvararg = 1;
343 ar->nparams = 0;
344 }
345 else {
346 ar->isvararg = f->l.p->is_vararg;
347 ar->nparams = f->l.p->numparams;
348 }
349 break;
350 }
351 case 't': {
352 ar->istailcall = (ci) ? ci->callstatus & CIST_TAIL : 0;
353 break;
354 }
355 case 'n': {
356 ar->namewhat = getfuncname(L, ci, &ar->name);
357 if (ar->namewhat == NULL) {
358 ar->namewhat = ""; /* not found */
359 ar->name = NULL;
360 }
361 break;
362 }
363 case 'r': {
364 if (ci == NULL || !(ci->callstatus & CIST_TRAN))
365 ar->ftransfer = ar->ntransfer = 0;
366 else {
369 }
370 break;
371 }
372 case 'L':
373 case 'f': /* handled by lua_getinfo */
374 break;
375 default: status = 0; /* invalid option */
376 }
377 }
378 return status;
379}
#define NULL
Definition gmacros.h:924
#define isLua(ci)
#define CIST_TAIL
#define noLuaClosure(f)
static void funcinfo(lua_Debug *ar, Closure *cl)
static const char * getfuncname(lua_State *L, CallInfo *ci, const char **name)
static int getcurrentline(CallInfo *ci)
#define CIST_TRAN
struct CallInfo::@95::@98 transferinfo
union CallInfo::@95 u2
unsigned short ntransfer
unsigned short ftransfer
struct Proto * p
unsigned short ntransfer
const char * name
unsigned short ftransfer
unsigned char nparams
const char * namewhat

References Closure::c, CallInfo::callstatus, CIST_TAIL, CIST_TRAN, lua_Debug::currentline, CallInfo::ftransfer, lua_Debug::ftransfer, funcinfo(), getcurrentline(), getfuncname(), Proto::is_vararg, isLua, lua_Debug::istailcall, lua_Debug::isvararg, Closure::l, lua_Debug::name, lua_Debug::namewhat, noLuaClosure, lua_Debug::nparams, CallInfo::ntransfer, lua_Debug::ntransfer, NULL, Proto::numparams, lua_Debug::nups, LClosure::p, CallInfo::transferinfo, and CallInfo::u2.

Referenced by lua_getinfo().

◆ changedline()

static int changedline ( const Proto * p,
int oldpc,
int newpc )
static

Definition at line 800 of file lua-5.4.3/src/ldebug.c.

800 {
801 if (p->lineinfo == NULL) /* no debug information? */
802 return 0;
803 if (newpc - oldpc < MAXIWTHABS / 2) { /* not too far apart? */
804 int delta = 0; /* line diference */
805 int pc = oldpc;
806 for (;;) {
807 int lineinfo = p->lineinfo[++pc];
808 if (lineinfo == ABSLINEINFO)
809 break; /* cannot compute delta; fall through */
810 delta += lineinfo;
811 if (pc == newpc)
812 return (delta != 0); /* delta computed successfully */
813 }
814 }
815 /* either instructions are too far apart or there is an absolute line
816 info in the way; compute line difference explicitly */
817 return (luaG_getfuncline(p, oldpc) != luaG_getfuncline(p, newpc));
818}
int luaG_getfuncline(const Proto *f, int pc)
#define ABSLINEINFO
#define MAXIWTHABS

References ABSLINEINFO, Proto::lineinfo, luaG_getfuncline(), MAXIWTHABS, and NULL.

Referenced by luaG_traceexec().

◆ collectvalidlines()

static void collectvalidlines ( lua_State * L,
Closure * f )
static

Definition at line 290 of file lua-5.4.3/src/ldebug.c.

290 {
291 if (noLuaClosure(f)) {
292 setnilvalue(s2v(L->top));
293 api_incr_top(L);
294 }
295 else {
296 int i;
297 TValue v;
298 const Proto *p = f->l.p;
299 int currentline = p->linedefined;
300 Table *t = luaH_new(L); /* new table to store active lines */
301 sethvalue2s(L, L->top, t); /* push it on stack */
302 api_incr_top(L);
303 setbtvalue(&v); /* boolean 'true' to be the value of all indices */
304 for (i = 0; i < p->sizelineinfo; i++) { /* for all instructions */
305 currentline = nextline(p, currentline, i); /* get its line */
306 luaH_setint(L, t, currentline, &v); /* table[line] = true */
307 }
308 }
309}
#define api_incr_top(L)
static int currentline(lua_State *L, CallInfo *ci)
#define sethvalue2s
#define setnilvalue(obj)
Table * luaH_new(lua_State *L, int narray, int nhash)
void luaH_setint(lua_State *L, Table *t, int key, TValue *value)
static int nextline(const Proto *p, int currentline, int pc)
#define setbtvalue(obj)
#define s2v(o)

References api_incr_top, currentline(), Closure::l, Proto::linedefined, luaH_new(), luaH_setint(), nextline(), noLuaClosure, LClosure::p, s2v, setbtvalue, sethvalue2s, setnilvalue, Proto::sizelineinfo, and lua_State::top.

Referenced by lua_getinfo().

◆ currentpc()

static int currentpc ( CallInfo * ci)
static

Definition at line 41 of file lua-5.4.3/src/ldebug.c.

41 {
42 lua_assert(isLua(ci));
43 return pcRel(ci->u.l.savedpc, ci_func(ci)->p);
44}
#define pcRel(pc, p)
#define lua_assert(c)
#define ci_func(ci)
struct CallInfo::@64::@65 l
const Instruction * savedpc
union CallInfo::@64 u

References ci_func, isLua, CallInfo::l, lua_assert, pcRel, CallInfo::savedpc, and CallInfo::u.

Referenced by funcnamefromcode(), getcurrentline(), luaG_findlocal(), and varinfo().

◆ filterpc()

static int filterpc ( int pc,
int jmptarget )
static

Definition at line 454 of file lua-5.4.3/src/ldebug.c.

454 {
455 if (pc < jmptarget) /* is code conditional (inside a jump)? */
456 return -1; /* cannot know who sets that register */
457 else return pc; /* current position sets that register */
458}

Referenced by findsetreg().

◆ findsetreg()

static int findsetreg ( const Proto * p,
int lastpc,
int reg )
static

Definition at line 464 of file lua-5.4.3/src/ldebug.c.

464 {
465 int pc;
466 int setreg = -1; /* keep last instruction that changed 'reg' */
467 int jmptarget = 0; /* any code before this address is conditional */
468 if (testMMMode(GET_OPCODE(p->code[lastpc])))
469 lastpc--; /* previous instruction was not actually executed */
470 for (pc = 0; pc < lastpc; pc++) {
471 Instruction i = p->code[pc];
472 OpCode op = GET_OPCODE(i);
473 int a = GETARG_A(i);
474 int change; /* true if current instruction changed 'reg' */
475 switch (op) {
476 case OP_LOADNIL: { /* set registers from 'a' to 'a+b' */
477 int b = GETARG_B(i);
478 change = (a <= reg && reg <= a + b);
479 break;
480 }
481 case OP_TFORCALL: { /* affect all regs above its base */
482 change = (reg >= a + 2);
483 break;
484 }
485 case OP_CALL:
486 case OP_TAILCALL: { /* affect all registers above base */
487 change = (reg >= a);
488 break;
489 }
490 case OP_JMP: { /* doesn't change registers, but changes 'jmptarget' */
491 int b = GETARG_sJ(i);
492 int dest = pc + 1 + b;
493 /* jump does not skip 'lastpc' and is larger than current one? */
494 if (dest <= lastpc && dest > jmptarget)
495 jmptarget = dest; /* update 'jmptarget' */
496 change = 0;
497 break;
498 }
499 default: /* any instruction that sets A */
500 change = (testAMode(op) && reg == a);
501 break;
502 }
503 if (change)
504 setreg = filterpc(pc, jmptarget);
505 }
506 return setreg;
507}
lu_int32 Instruction
#define GETARG_A(i)
#define GETARG_B(i)
#define GET_OPCODE(i)
#define testAMode(m)
static int filterpc(int pc, int jmptarget)
#define testMMMode(m)
#define GETARG_sJ(i)
Instruction * code

References Proto::code, filterpc(), GET_OPCODE, GETARG_A, GETARG_B, GETARG_sJ, OP_CALL, OP_JMP, OP_LOADNIL, OP_TAILCALL, OP_TFORCALL, testAMode, and testMMMode.

Referenced by getobjname().

◆ findvararg()

static const char * findvararg ( CallInfo * ci,
int n,
StkId * pos )
static

Definition at line 184 of file lua-5.4.3/src/ldebug.c.

184 {
185 if (clLvalue(s2v(ci->func))->p->is_vararg) {
186 int nextra = ci->u.l.nextraargs;
187 if (n >= -nextra) { /* 'n' is negative */
188 *pos = ci->func - nextra - (n + 1);
189 return "(vararg)"; /* generic name for any vararg */
190 }
191 }
192 return NULL; /* no such vararg */
193}
#define clLvalue(o)

References clLvalue, CallInfo::func, CallInfo::l, CallInfo::nextraargs, NULL, s2v, and CallInfo::u.

Referenced by luaG_findlocal().

◆ funcinfo()

static void funcinfo ( lua_Debug * ar,
Closure * cl )
static

Definition at line 256 of file lua-5.4.3/src/ldebug.c.

256 {
257 if (noLuaClosure(cl)) {
258 ar->source = "=[C]";
259 ar->srclen = LL("=[C]");
260 ar->linedefined = -1;
261 ar->lastlinedefined = -1;
262 ar->what = "C";
263 }
264 else {
265 const Proto *p = cl->l.p;
266 if (p->source) {
267 ar->source = getstr(p->source);
268 ar->srclen = tsslen(p->source);
269 }
270 else {
271 ar->source = "=?";
272 ar->srclen = LL("=?");
273 }
274 ar->linedefined = p->linedefined;
276 ar->what = (ar->linedefined == 0) ? "main" : "Lua";
277 }
278 luaO_chunkid(ar->short_src, ar->source, ar->srclen);
279}
void luaO_chunkid(char *out, const char *source, size_t bufflen)
#define getstr(ts)
#define LL(x)
#define tsslen(s)
TString * source
const char * what
const char * source
char short_src[LUA_IDSIZE]

References getstr, Closure::l, Proto::lastlinedefined, lua_Debug::lastlinedefined, Proto::linedefined, lua_Debug::linedefined, LL, luaO_chunkid(), noLuaClosure, LClosure::p, lua_Debug::short_src, Proto::source, lua_Debug::source, lua_Debug::srclen, tsslen, and lua_Debug::what.

Referenced by auxgetinfo().

◆ funcnamefromcode()

static const char * funcnamefromcode ( lua_State * L,
CallInfo * ci,
const char ** name )
static

Definition at line 593 of file lua-5.4.3/src/ldebug.c.

594 {
595 TMS tm = (TMS)0; /* (initial value avoids warnings) */
596 const Proto *p = ci_func(ci)->p; /* calling function */
597 int pc = currentpc(ci); /* calling instruction index */
598 Instruction i = p->code[pc]; /* calling instruction */
599 if (ci->callstatus & CIST_HOOKED) { /* was it called inside a hook? */
600 *name = "?";
601 return "hook";
602 }
603 switch (GET_OPCODE(i)) {
604 case OP_CALL:
605 case OP_TAILCALL:
606 return getobjname(p, pc, GETARG_A(i), name); /* get function name */
607 case OP_TFORCALL: { /* for iterator */
608 *name = "for iterator";
609 return "for iterator";
610 }
611 /* other instructions can do calls through metamethods */
612 case OP_SELF: case OP_GETTABUP: case OP_GETTABLE:
613 case OP_GETI: case OP_GETFIELD:
614 tm = TM_INDEX;
615 break;
616 case OP_SETTABUP: case OP_SETTABLE: case OP_SETI: case OP_SETFIELD:
617 tm = TM_NEWINDEX;
618 break;
619 case OP_MMBIN: case OP_MMBINI: case OP_MMBINK: {
620 tm = cast(TMS, GETARG_C(i));
621 break;
622 }
623 case OP_UNM: tm = TM_UNM; break;
624 case OP_BNOT: tm = TM_BNOT; break;
625 case OP_LEN: tm = TM_LEN; break;
626 case OP_CONCAT: tm = TM_CONCAT; break;
627 case OP_EQ: tm = TM_EQ; break;
628 /* no cases for OP_EQI and OP_EQK, as they don't call metamethods */
629 case OP_LT: case OP_LTI: case OP_GTI: tm = TM_LT; break;
630 case OP_LE: case OP_LEI: case OP_GEI: tm = TM_LE; break;
631 case OP_CLOSE: case OP_RETURN: tm = TM_CLOSE; break;
632 default:
633 return NULL; /* cannot find a reasonable name */
634 }
635 *name = getstr(G(L)->tmname[tm]) + 2;
636 return "metamethod";
637}
const char * name
Definition lsqlite3.c:2154
#define cast(t, exp)
#define GETARG_C(i)
#define G(L)
@ TM_NEWINDEX
@ TM_INDEX
@ TM_UNM
@ TM_EQ
@ TM_LEN
@ TM_LE
@ TM_CONCAT
@ TM_LT
#define CIST_HOOKED
@ TM_BNOT
static const char * getobjname(const Proto *p, int lastpc, int reg, const char **name)
static int currentpc(CallInfo *ci)
@ TM_CLOSE
static TString ** tmname
struct Proto ** p

References CallInfo::callstatus, cast, ci_func, CIST_HOOKED, Proto::code, currentpc(), G, GET_OPCODE, GETARG_A, GETARG_C, getobjname(), getstr, name, NULL, OP_BNOT, OP_CALL, OP_CLOSE, OP_CONCAT, OP_EQ, OP_GEI, OP_GETFIELD, OP_GETI, OP_GETTABLE, OP_GETTABUP, OP_GTI, OP_LE, OP_LEI, OP_LEN, OP_LT, OP_LTI, OP_MMBIN, OP_MMBINI, OP_MMBINK, OP_RETURN, OP_SELF, OP_SETFIELD, OP_SETI, OP_SETTABLE, OP_SETTABUP, OP_TAILCALL, OP_TFORCALL, OP_UNM, Proto::p, TM_BNOT, TM_CLOSE, TM_CONCAT, TM_EQ, TM_INDEX, TM_LE, TM_LEN, TM_LT, TM_NEWINDEX, TM_UNM, and tmname.

Referenced by getfuncname(), and luaG_callerror().

◆ getbaseline()

static int getbaseline ( const Proto * f,
int pc,
int * basepc )
static

Definition at line 60 of file lua-5.4.3/src/ldebug.c.

60 {
61 if (f->sizeabslineinfo == 0 || pc < f->abslineinfo[0].pc) {
62 *basepc = -1; /* start from the beginning */
63 return f->linedefined;
64 }
65 else {
66 int i = cast_uint(pc) / MAXIWTHABS - 1; /* get an estimate */
67 /* estimate must be a lower bond of the correct base */
68 lua_assert(i < 0 ||
69 (i < f->sizeabslineinfo && f->abslineinfo[i].pc <= pc));
70 while (i + 1 < f->sizeabslineinfo && pc >= f->abslineinfo[i + 1].pc)
71 i++; /* low estimate; adjust it */
72 *basepc = f->abslineinfo[i].pc;
73 return f->abslineinfo[i].line;
74 }
75}
#define cast_uint(i)
AbsLineInfo * abslineinfo

References Proto::abslineinfo, cast_uint, AbsLineInfo::line, Proto::linedefined, lua_assert, MAXIWTHABS, AbsLineInfo::pc, and Proto::sizeabslineinfo.

Referenced by luaG_getfuncline().

◆ getcurrentline()

static int getcurrentline ( CallInfo * ci)
static

Definition at line 98 of file lua-5.4.3/src/ldebug.c.

98 {
99 return luaG_getfuncline(ci_func(ci)->p, currentpc(ci));
100}

References ci_func, currentpc(), and luaG_getfuncline().

Referenced by auxgetinfo(), and luaG_runerror().

◆ getfuncname()

static const char * getfuncname ( lua_State * L,
CallInfo * ci,
const char ** name )
static

Definition at line 312 of file lua-5.4.3/src/ldebug.c.

312 {
313 if (ci == NULL) /* no 'ci'? */
314 return NULL; /* no info */
315 else if (ci->callstatus & CIST_FIN) { /* is this a finalizer? */
316 *name = "__gc";
317 return "metamethod"; /* report it as such */
318 }
319 /* calling function is a known Lua function? */
320 else if (!(ci->callstatus & CIST_TAIL) && isLua(ci->previous))
321 return funcnamefromcode(L, ci->previous, name);
322 else return NULL; /* no way to find a name */
323}
#define CIST_FIN
static const char * funcnamefromcode(lua_State *L, CallInfo *ci, const char **name)
struct CallInfo * previous

References CallInfo::callstatus, CIST_FIN, CIST_TAIL, funcnamefromcode(), isLua, name, NULL, and CallInfo::previous.

Referenced by auxgetinfo().

◆ getobjname()

static const char * getobjname ( const Proto * p,
int lastpc,
int reg,
const char ** name )
static

Definition at line 525 of file lua-5.4.3/src/ldebug.c.

526 {
527 int pc;
528 *name = luaF_getlocalname(p, reg + 1, lastpc);
529 if (*name) /* is a local? */
530 return "local";
531 /* else try symbolic execution */
532 pc = findsetreg(p, lastpc, reg);
533 if (pc != -1) { /* could find instruction? */
534 Instruction i = p->code[pc];
535 OpCode op = GET_OPCODE(i);
536 switch (op) {
537 case OP_MOVE: {
538 int b = GETARG_B(i); /* move from 'b' to 'a' */
539 if (b < GETARG_A(i))
540 return getobjname(p, pc, b, name); /* get name for 'b' */
541 break;
542 }
543 case OP_GETTABUP: {
544 int k = GETARG_C(i); /* key index */
545 kname(p, k, name);
546 return gxf(p, pc, i, 1);
547 }
548 case OP_GETTABLE: {
549 int k = GETARG_C(i); /* key index */
550 rname(p, pc, k, name);
551 return gxf(p, pc, i, 0);
552 }
553 case OP_GETI: {
554 *name = "integer index";
555 return "field";
556 }
557 case OP_GETFIELD: {
558 int k = GETARG_C(i); /* key index */
559 kname(p, k, name);
560 return gxf(p, pc, i, 0);
561 }
562 case OP_GETUPVAL: {
563 *name = upvalname(p, GETARG_B(i));
564 return "upvalue";
565 }
566 case OP_LOADK:
567 case OP_LOADKX: {
568 int b = (op == OP_LOADK) ? GETARG_Bx(i)
569 : GETARG_Ax(p->code[pc + 1]);
570 if (ttisstring(&p->k[b])) {
571 *name = svalue(&p->k[b]);
572 return "constant";
573 }
574 break;
575 }
576 case OP_SELF: {
577 rkname(p, pc, i, name);
578 return "method";
579 }
580 default: break; /* go through to return NULL */
581 }
582 }
583 return NULL; /* could not find reasonable name */
584}
const char * luaF_getlocalname(const Proto *f, int local_number, int pc)
#define ttisstring(o)
#define svalue(o)
#define GETARG_Bx(i)
#define GETARG_Ax(i)
static const char * upvalname(const Proto *p, int uv)
static void rkname(const Proto *p, int pc, Instruction i, const char **name)
static void rname(const Proto *p, int pc, int c, const char **name)
static int findsetreg(const Proto *p, int lastpc, int reg)
static void kname(const Proto *p, int c, const char **name)
static const char * gxf(const Proto *p, int pc, Instruction i, int isup)

References Proto::code, findsetreg(), GET_OPCODE, GETARG_A, GETARG_Ax, GETARG_B, GETARG_Bx, GETARG_C, getobjname(), gxf(), Proto::k, kname(), luaF_getlocalname(), name, NULL, OP_GETFIELD, OP_GETI, OP_GETTABLE, OP_GETTABUP, OP_GETUPVAL, OP_LOADK, OP_LOADKX, OP_MOVE, OP_SELF, rkname(), rname(), svalue, ttisstring, and upvalname().

Referenced by funcnamefromcode(), getobjname(), gxf(), rname(), and varinfo().

◆ getupvalname()

static const char * getupvalname ( CallInfo * ci,
const TValue * o,
const char ** name )
static

Definition at line 664 of file lua-5.4.3/src/ldebug.c.

665 {
666 LClosure *c = ci_func(ci);
667 int i;
668 for (i = 0; i < c->nupvalues; i++) {
669 if (c->upvals[i]->v == o) {
670 *name = upvalname(c->p, i);
671 return "upvalue";
672 }
673 }
674 return NULL;
675}

References ci_func, name, NULL, LClosure::p, upvalname(), LClosure::upvals, and UpVal::v.

Referenced by varinfo().

◆ gxf()

static const char * gxf ( const Proto * p,
int pc,
Instruction i,
int isup )
static

Definition at line 514 of file lua-5.4.3/src/ldebug.c.

514 {
515 int t = GETARG_B(i); /* table index */
516 const char *name; /* name of indexed variable */
517 if (isup) /* is an upvalue? */
518 name = upvalname(p, t);
519 else
520 getobjname(p, pc, t, &name);
521 return (name && strcmp(name, LUA_ENV) == 0) ? "global" : "field";
522}
#define LUA_ENV

References GETARG_B, getobjname(), LUA_ENV, name, and upvalname().

Referenced by getobjname().

◆ isinstack()

static int isinstack ( CallInfo * ci,
const TValue * o )
static

Definition at line 649 of file lua-5.4.3/src/ldebug.c.

649 {
650 StkId pos;
651 for (pos = ci->func + 1; pos < ci->top; pos++) {
652 if (o == s2v(pos))
653 return 1;
654 }
655 return 0; /* not found */
656}

References CallInfo::func, s2v, and CallInfo::top.

Referenced by varinfo().

◆ kname()

static void kname ( const Proto * p,
int c,
const char ** name )
static

Definition at line 426 of file lua-5.4.3/src/ldebug.c.

426 {
427 TValue *kvalue = &p->k[c];
428 *name = (ttisstring(kvalue)) ? svalue(kvalue) : "?";
429}

References Proto::k, name, svalue, and ttisstring.

Referenced by getobjname(), and rkname().

◆ lua_gethook()

LUA_API lua_Hook lua_gethook ( lua_State * L)

Definition at line 145 of file lua-5.4.3/src/ldebug.c.

145 {
146 return L->hook;
147}

References lua_State::hook.

◆ lua_gethookcount()

LUA_API int lua_gethookcount ( lua_State * L)

Definition at line 155 of file lua-5.4.3/src/ldebug.c.

155 {
156 return L->basehookcount;
157}

References lua_State::basehookcount.

◆ lua_gethookmask()

LUA_API int lua_gethookmask ( lua_State * L)

Definition at line 150 of file lua-5.4.3/src/ldebug.c.

150 {
151 return L->hookmask;
152}

References lua_State::hookmask.

◆ lua_getinfo()

LUA_API int lua_getinfo ( lua_State * L,
const char * what,
lua_Debug * ar )

Definition at line 382 of file lua-5.4.3/src/ldebug.c.

382 {
383 int status;
384 Closure *cl;
385 CallInfo *ci;
386 TValue *func;
387 lua_lock(L);
388 if (*what == '>') {
389 ci = NULL;
390 func = s2v(L->top - 1);
391 api_check(L, ttisfunction(func), "function expected");
392 what++; /* skip the '>' */
393 L->top--; /* pop function */
394 }
395 else {
396 ci = ar->i_ci;
397 func = s2v(ci->func);
399 }
400 cl = ttisclosure(func) ? clvalue(func) : NULL;
401 status = auxgetinfo(L, what, ar, cl, ci);
402 if (strchr(what, 'f')) {
403 setobj2s(L, L->top, func);
404 api_incr_top(L);
405 }
406 if (strchr(what, 'L'))
407 collectvalidlines(L, cl);
408 lua_unlock(L);
409 return status;
410}
#define lua_unlock(L)
#define api_check
#define lua_lock(L)
#define setobj2s
#define ttisfunction(o)
#define clvalue(o)
#define ttisclosure(o)
static void collectvalidlines(lua_State *L, Closure *f)
static int auxgetinfo(lua_State *L, const char *what, lua_Debug *ar, Closure *f, CallInfo *ci)

References api_check, api_incr_top, auxgetinfo(), clvalue, collectvalidlines(), CallInfo::func, lua_Debug::i_ci, lua_assert, lua_lock, lua_unlock, NULL, s2v, setobj2s, lua_State::top, ttisclosure, and ttisfunction.

◆ lua_getlocal()

LUA_API const char * lua_getlocal ( lua_State * L,
const lua_Debug * ar,
int n )

Definition at line 220 of file lua-5.4.3/src/ldebug.c.

220 {
221 const char *name;
222 lua_lock(L);
223 if (ar == NULL) { /* information about non-active function? */
224 if (!isLfunction(s2v(L->top - 1))) /* not a Lua function? */
225 name = NULL;
226 else /* consider live variables at function start (parameters) */
227 name = luaF_getlocalname(clLvalue(s2v(L->top - 1))->p, n, 0);
228 }
229 else { /* active function; get information through 'ar' */
230 StkId pos = NULL; /* to avoid warnings */
231 name = luaG_findlocal(L, ar->i_ci, n, &pos);
232 if (name) {
233 setobjs2s(L, L->top, pos);
234 api_incr_top(L);
235 }
236 }
237 lua_unlock(L);
238 return name;
239}
#define setobjs2s
#define isLfunction(o)
const char * luaG_findlocal(lua_State *L, CallInfo *ci, int n, StkId *pos)

References api_incr_top, clLvalue, lua_Debug::i_ci, isLfunction, lua_lock, lua_unlock, luaF_getlocalname(), luaG_findlocal(), name, NULL, s2v, setobjs2s, and lua_State::top.

◆ lua_getstack()

LUA_API int lua_getstack ( lua_State * L,
int level,
lua_Debug * ar )

Definition at line 160 of file lua-5.4.3/src/ldebug.c.

160 {
161 int status;
162 CallInfo *ci;
163 if (level < 0) return 0; /* invalid (negative) level */
164 lua_lock(L);
165 for (ci = L->ci; level > 0 && ci != &L->base_ci; ci = ci->previous)
166 level--;
167 if (level == 0 && ci != &L->base_ci) { /* level found? */
168 status = 1;
169 ar->i_ci = ci;
170 }
171 else status = 0; /* no such level */
172 lua_unlock(L);
173 return status;
174}

References lua_State::base_ci, lua_State::ci, lua_Debug::i_ci, lua_lock, lua_unlock, and CallInfo::previous.

◆ lua_sethook()

LUA_API void lua_sethook ( lua_State * L,
lua_Hook func,
int mask,
int count )

Definition at line 131 of file lua-5.4.3/src/ldebug.c.

131 {
132 if (func == NULL || mask == 0) { /* turn off hooks? */
133 mask = 0;
134 func = NULL;
135 }
136 L->hook = func;
137 L->basehookcount = count;
139 L->hookmask = cast_byte(mask);
140 if (mask)
141 settraps(L->ci); /* to trace inside 'luaV_execute' */
142}
#define resethookcount(L)
#define cast_byte(i)
#define mask(n)
static void settraps(CallInfo *ci)

References lua_State::basehookcount, cast_byte, lua_State::ci, lua_State::hook, lua_State::hookmask, mask, NULL, resethookcount, and settraps().

◆ lua_setlocal()

LUA_API const char * lua_setlocal ( lua_State * L,
const lua_Debug * ar,
int n )

Definition at line 242 of file lua-5.4.3/src/ldebug.c.

242 {
243 StkId pos = NULL; /* to avoid warnings */
244 const char *name;
245 lua_lock(L);
246 name = luaG_findlocal(L, ar->i_ci, n, &pos);
247 if (name) {
248 setobjs2s(L, pos, L->top - 1);
249 L->top--; /* pop value */
250 }
251 lua_unlock(L);
252 return name;
253}

References lua_Debug::i_ci, lua_lock, lua_unlock, luaG_findlocal(), name, NULL, setobjs2s, and lua_State::top.

◆ luaG_addinfo()

const char * luaG_addinfo ( lua_State * L,
const char * msg,
TString * src,
int line )

Definition at line 753 of file lua-5.4.3/src/ldebug.c.

754 {
755 char buff[LUA_IDSIZE];
756 if (src)
757 luaO_chunkid(buff, getstr(src), tsslen(src));
758 else { /* no source available; use "?" instead */
759 buff[0] = '?'; buff[1] = '\0';
760 }
761 return luaO_pushfstring(L, "%s:%d: %s", buff, line, msg);
762}
const char * luaO_pushfstring(lua_State *L, const char *fmt,...)
#define LUA_IDSIZE

References getstr, LUA_IDSIZE, luaO_chunkid(), luaO_pushfstring(), and tsslen.

Referenced by luaG_runerror().

◆ luaG_callerror()

l_noret luaG_callerror ( lua_State * L,
const TValue * o )

Definition at line 698 of file lua-5.4.3/src/ldebug.c.

698 {
699 CallInfo *ci = L->ci;
700 const char *name = NULL; /* to avoid warnings */
701 const char *what = (isLua(ci)) ? funcnamefromcode(L, ci, &name) : NULL;
702 if (what != NULL) {
703 const char *t = luaT_objtypename(L, o);
704 luaG_runerror(L, "%s '%s' is not callable (a %s value)", what, name, t);
705 }
706 else
707 luaG_typeerror(L, o, "call");
708}
const char * luaT_objtypename(lua_State *L, const TValue *o)
l_noret luaG_typeerror(lua_State *L, const TValue *o, const char *op)
l_noret luaG_runerror(lua_State *L, const char *fmt,...)

References lua_State::ci, funcnamefromcode(), isLua, luaG_runerror(), luaG_typeerror(), luaT_objtypename(), name, and NULL.

Referenced by luaD_tryfuncTM().

◆ luaG_concaterror()

l_noret luaG_concaterror ( lua_State * L,
const TValue * p1,
const TValue * p2 )

Definition at line 717 of file lua-5.4.3/src/ldebug.c.

717 {
718 if (ttisstring(p1) || cvt2str(p1)) p1 = p2;
719 luaG_typeerror(L, p1, "concatenate");
720}
#define cvt2str(o)

References cvt2str, luaG_typeerror(), and ttisstring.

◆ luaG_errormsg()

l_noret luaG_errormsg ( lua_State * L)

Definition at line 765 of file lua-5.4.3/src/ldebug.c.

765 {
766 if (L->errfunc != 0) { /* is there an error handling function? */
767 StkId errfunc = restorestack(L, L->errfunc);
768 lua_assert(ttisfunction(s2v(errfunc)));
769 setobjs2s(L, L->top, L->top - 1); /* move argument */
770 setobjs2s(L, L->top - 1, errfunc); /* push function */
771 L->top++; /* assume EXTRA_STACK */
772 luaD_callnoyield(L, L->top - 2, 1); /* call it */
773 }
775}
void luaD_throw(lua_State *L, int errcode)
#define restorestack(L, n)
#define LUA_ERRRUN
void luaD_callnoyield(lua_State *L, StkId func, int nResults)

References lua_State::errfunc, lua_assert, LUA_ERRRUN, luaD_callnoyield(), luaD_throw(), restorestack, s2v, setobjs2s, lua_State::top, and ttisfunction.

Referenced by luaG_runerror().

◆ luaG_findlocal()

const char * luaG_findlocal ( lua_State * L,
CallInfo * ci,
int n,
StkId * pos )

Definition at line 196 of file lua-5.4.3/src/ldebug.c.

196 {
197 StkId base = ci->func + 1;
198 const char *name = NULL;
199 if (isLua(ci)) {
200 if (n < 0) /* access to vararg values? */
201 return findvararg(ci, n, pos);
202 else
203 name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci));
204 }
205 if (name == NULL) { /* no 'standard' name? */
206 StkId limit = (ci == L->ci) ? L->top : ci->next->func;
207 if (limit - base >= n && n > 0) { /* is 'n' inside 'ci' stack? */
208 /* generic name for any valid slot */
209 name = isLua(ci) ? "(temporary)" : "(C temporary)";
210 }
211 else
212 return NULL; /* no name */
213 }
214 if (pos)
215 *pos = base + (n - 1);
216 return name;
217}
#define next(ls)
static const char * findvararg(CallInfo *ci, int n, StkId *pos)

References lua_State::ci, ci_func, currentpc(), findvararg(), CallInfo::func, isLua, luaF_getlocalname(), name, CallInfo::next, NULL, and lua_State::top.

Referenced by checkclosemth(), lua_getlocal(), and lua_setlocal().

◆ luaG_forerror()

l_noret luaG_forerror ( lua_State * L,
const TValue * o,
const char * what )

Definition at line 711 of file lua-5.4.3/src/ldebug.c.

711 {
712 luaG_runerror(L, "bad 'for' %s (number expected, got %s)",
713 what, luaT_objtypename(L, o));
714}

References luaG_runerror(), and luaT_objtypename().

Referenced by forlimit(), and forprep().

◆ luaG_getfuncline()

int luaG_getfuncline ( const Proto * f,
int pc )

Definition at line 83 of file lua-5.4.3/src/ldebug.c.

83 {
84 if (f->lineinfo == NULL) /* no debug information? */
85 return -1;
86 else {
87 int basepc;
88 int baseline = getbaseline(f, pc, &basepc);
89 while (basepc++ < pc) { /* walk until given instruction */
90 lua_assert(f->lineinfo[basepc] != ABSLINEINFO);
91 baseline += f->lineinfo[basepc]; /* correct line */
92 }
93 return baseline;
94 }
95}
static int getbaseline(const Proto *f, int pc, int *basepc)

References ABSLINEINFO, getbaseline(), Proto::lineinfo, lua_assert, and NULL.

Referenced by changedline(), getcurrentline(), luaG_traceexec(), nextline(), and PrintCode().

◆ luaG_opinterror()

l_noret luaG_opinterror ( lua_State * L,
const TValue * p1,
const TValue * p2,
const char * msg )

Definition at line 723 of file lua-5.4.3/src/ldebug.c.

724 {
725 if (!ttisnumber(p1)) /* first operand is wrong? */
726 p2 = p1; /* now second is wrong */
727 luaG_typeerror(L, p2, msg);
728}
#define ttisnumber(o)

References luaG_typeerror(), and ttisnumber.

◆ luaG_ordererror()

l_noret luaG_ordererror ( lua_State * L,
const TValue * p1,
const TValue * p2 )

Definition at line 742 of file lua-5.4.3/src/ldebug.c.

742 {
743 const char *t1 = luaT_objtypename(L, p1);
744 const char *t2 = luaT_objtypename(L, p2);
745 if (strcmp(t1, t2) == 0)
746 luaG_runerror(L, "attempt to compare two %s values", t1);
747 else
748 luaG_runerror(L, "attempt to compare %s with %s", t1, t2);
749}

References luaG_runerror(), and luaT_objtypename().

◆ luaG_runerror()

l_noret luaG_runerror ( lua_State * L,
const char * fmt,
... )

Definition at line 778 of file lua-5.4.3/src/ldebug.c.

778 {
779 CallInfo *ci = L->ci;
780 const char *msg;
781 va_list argp;
782 luaC_checkGC(L); /* error message uses memory */
783 va_start(argp, fmt);
784 msg = luaO_pushvfstring(L, fmt, argp); /* format message */
785 va_end(argp);
786 if (isLua(ci)) /* if Lua function, add source:line information */
787 luaG_addinfo(L, msg, ci_func(ci)->p->source, getcurrentline(ci));
788 luaG_errormsg(L);
789}
#define luaC_checkGC(L)
const char * luaO_pushvfstring(lua_State *L, const char *fmt, va_list argp)
const char * luaG_addinfo(lua_State *L, const char *msg, TString *src, int line)
l_noret luaG_errormsg(lua_State *L)

References lua_State::ci, ci_func, getcurrentline(), isLua, luaC_checkGC, luaG_addinfo(), luaG_errormsg(), and luaO_pushvfstring().

Referenced by luaG_callerror(), luaG_forerror(), luaG_ordererror(), luaG_tointerror(), and luaG_typeerror().

◆ luaG_tointerror()

l_noret luaG_tointerror ( lua_State * L,
const TValue * p1,
const TValue * p2 )

Definition at line 734 of file lua-5.4.3/src/ldebug.c.

734 {
735 lua_Integer temp;
736 if (!luaV_tointegerns(p1, &temp, LUA_FLOORN2I))
737 p2 = p1;
738 luaG_runerror(L, "number%s has no integer representation", varinfo(L, p2));
739}
LUA_INTEGER lua_Integer
#define LUA_FLOORN2I
static const char * varinfo(lua_State *L, const TValue *o)
int luaV_tointegerns(const TValue *obj, lua_Integer *p, F2Imod mode)

References LUA_FLOORN2I, luaG_runerror(), luaV_tointegerns(), and varinfo().

◆ luaG_traceexec()

int luaG_traceexec ( lua_State * L,
const Instruction * pc )

Definition at line 833 of file lua-5.4.3/src/ldebug.c.

833 {
834 CallInfo *ci = L->ci;
835 lu_byte mask = L->hookmask;
836 const Proto *p = ci_func(ci)->p;
837 int counthook;
838 if (!(mask & (LUA_MASKLINE | LUA_MASKCOUNT))) { /* no hooks? */
839 ci->u.l.trap = 0; /* don't need to stop again */
840 return 0; /* turn off 'trap' */
841 }
842 pc++; /* reference is always next instruction */
843 ci->u.l.savedpc = pc; /* save 'pc' */
844 counthook = (--L->hookcount == 0 && (mask & LUA_MASKCOUNT));
845 if (counthook)
846 resethookcount(L); /* reset count */
847 else if (!(mask & LUA_MASKLINE))
848 return 1; /* no line hook and count != 0; nothing to be done now */
849 if (ci->callstatus & CIST_HOOKYIELD) { /* called hook last time? */
850 ci->callstatus &= ~CIST_HOOKYIELD; /* erase mark */
851 return 1; /* do not call hook again (VM yielded, so it did not move) */
852 }
853 if (!isIT(*(ci->u.l.savedpc - 1))) /* top not being used? */
854 L->top = ci->top; /* correct top */
855 if (counthook)
856 luaD_hook(L, LUA_HOOKCOUNT, -1, 0, 0); /* call count hook */
857 if (mask & LUA_MASKLINE) {
858 /* 'L->oldpc' may be invalid; use zero in this case */
859 int oldpc = (L->oldpc < p->sizecode) ? L->oldpc : 0;
860 int npci = pcRel(pc, p);
861 if (npci <= oldpc || /* call hook when jump back (loop), */
862 changedline(p, oldpc, npci)) { /* or when enter new line */
863 int newline = luaG_getfuncline(p, npci);
864 luaD_hook(L, LUA_HOOKLINE, newline, 0, 0); /* call line hook */
865 }
866 L->oldpc = npci; /* 'pc' of last call to line hook */
867 }
868 if (L->status == LUA_YIELD) { /* did hook yield? */
869 if (counthook)
870 L->hookcount = 1; /* undo decrement to zero */
871 ci->u.l.savedpc--; /* undo increment (resume will increment it again) */
872 ci->callstatus |= CIST_HOOKYIELD; /* mark that it yielded */
874 }
875 return 1; /* keep 'trap' on */
876}
unsigned char lu_byte
#define LUA_MASKCOUNT
#define LUA_MASKLINE
#define LUA_HOOKCOUNT
#define LUA_YIELD
#define LUA_HOOKLINE
void luaD_hook(lua_State *L, int event, int line)
#define CIST_HOOKYIELD
static int changedline(const Proto *p, int oldpc, int newpc)
#define isIT(i)
volatile l_signalT trap
const Instruction * oldpc

References CallInfo::callstatus, changedline(), lua_State::ci, ci_func, CIST_HOOKYIELD, lua_State::hookcount, lua_State::hookmask, isIT, CallInfo::l, LUA_HOOKCOUNT, LUA_HOOKLINE, LUA_MASKCOUNT, LUA_MASKLINE, LUA_YIELD, luaD_hook(), luaD_throw(), luaG_getfuncline(), mask, lua_State::oldpc, Proto::p, pcRel, resethookcount, CallInfo::savedpc, Proto::sizecode, lua_State::status, CallInfo::top, lua_State::top, CallInfo::trap, and CallInfo::u.

◆ luaG_typeerror()

l_noret luaG_typeerror ( lua_State * L,
const TValue * o,
const char * op )

Definition at line 692 of file lua-5.4.3/src/ldebug.c.

692 {
693 const char *t = luaT_objtypename(L, o);
694 luaG_runerror(L, "attempt to %s a %s value%s", op, t, varinfo(L, o));
695}

References luaG_runerror(), luaT_objtypename(), and varinfo().

Referenced by luaG_callerror(), luaG_concaterror(), and luaG_opinterror().

◆ nextline()

static int nextline ( const Proto * p,
int currentline,
int pc )
static

Definition at line 282 of file lua-5.4.3/src/ldebug.c.

282 {
283 if (p->lineinfo[pc] != ABSLINEINFO)
284 return currentline + p->lineinfo[pc];
285 else
286 return luaG_getfuncline(p, pc);
287}

References ABSLINEINFO, currentline(), Proto::lineinfo, and luaG_getfuncline().

Referenced by collectvalidlines().

◆ rkname()

static void rkname ( const Proto * p,
int pc,
Instruction i,
const char ** name )
static

Definition at line 445 of file lua-5.4.3/src/ldebug.c.

445 {
446 int c = GETARG_C(i); /* key index */
447 if (GETARG_k(i)) /* is 'c' a constant? */
448 kname(p, c, name);
449 else /* 'c' is a register */
450 rname(p, pc, c, name);
451}
#define GETARG_k(i)

References GETARG_C, GETARG_k, kname(), name, and rname().

Referenced by getobjname().

◆ rname()

static void rname ( const Proto * p,
int pc,
int c,
const char ** name )
static

Definition at line 435 of file lua-5.4.3/src/ldebug.c.

435 {
436 const char *what = getobjname(p, pc, c, name); /* search for 'c' */
437 if (!(what && *what == 'c')) /* did not find a constant name? */
438 *name = "?";
439}

References getobjname(), and name.

Referenced by getobjname(), and rkname().

◆ settraps()

static void settraps ( CallInfo * ci)
static

Definition at line 114 of file lua-5.4.3/src/ldebug.c.

114 {
115 for (; ci != NULL; ci = ci->previous)
116 if (isLua(ci))
117 ci->u.l.trap = 1;
118}

References isLua, CallInfo::l, NULL, CallInfo::previous, CallInfo::trap, and CallInfo::u.

Referenced by lua_sethook().

◆ upvalname()

static const char * upvalname ( const Proto * p,
int uv )
static

Definition at line 177 of file lua-5.4.3/src/ldebug.c.

177 {
178 TString *s = check_exp(uv < p->sizeupvalues, p->upvalues[uv].name);
179 if (s == NULL) return "?";
180 else return getstr(s);
181}
#define check_exp(c, e)
CURL_EXTERN CURLMcode curl_socket_t s
Definition multi.h:318
TString ** upvalues

References check_exp, getstr, NULL, s, and Proto::upvalues.

Referenced by getobjname(), getupvalname(), and gxf().

◆ varinfo()

static const char * varinfo ( lua_State * L,
const TValue * o )
static

Definition at line 678 of file lua-5.4.3/src/ldebug.c.

678 {
679 const char *name = NULL; /* to avoid warnings */
680 CallInfo *ci = L->ci;
681 const char *kind = NULL;
682 if (isLua(ci)) {
683 kind = getupvalname(ci, o, &name); /* check whether 'o' is an upvalue */
684 if (!kind && isinstack(ci, o)) /* no? try a register */
685 kind = getobjname(ci_func(ci)->p, currentpc(ci),
686 cast_int(cast(StkId, o) - (ci->func + 1)), &name);
687 }
688 return (kind) ? luaO_pushfstring(L, " (%s '%s')", kind, name) : "";
689}
#define cast_int(i)
static int isinstack(CallInfo *ci, const TValue *o)
static const char * getupvalname(CallInfo *ci, const TValue *o, const char **name)

References cast, cast_int, lua_State::ci, ci_func, currentpc(), CallInfo::func, getobjname(), getupvalname(), isinstack(), isLua, luaO_pushfstring(), name, and NULL.

Referenced by luaG_tointerror(), and luaG_typeerror().