#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) |
#define | invpcRel(pc, p) ((p)->code + (pc) + 1) |
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_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) |
Definition at line 37 of file ldebug.cpp.
Referenced by luaG_traceexec().
#define ldebug_c |
Definition at line 7 of file ldebug.cpp.
#define LUA_CORE |
Definition at line 8 of file ldebug.cpp.
Definition at line 34 of file ldebug.cpp.
Referenced by auxgetinfo(), collectvalidlines(), and funcinfo().
|
static |
Definition at line 330 of file ldebug.cpp.
References Closure::c, CallInfo::callstatus, CIST_TAIL, CIST_TRAN, lua_Debug::currentline, 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, lua_Debug::ntransfer, Proto::numparams, lua_Debug::nups, LClosure::p, CallInfo::transferinfo, and CallInfo::u2.
Referenced by lua_getinfo().
|
static |
Definition at line 785 of file ldebug.cpp.
References Proto::lineinfo, and luaG_getfuncline().
Referenced by luaG_traceexec().
Definition at line 294 of file ldebug.cpp.
References api_incr_top, i, Closure::l, Proto::linedefined, luaH_new(), luaH_setint(), nextline(), noLuaClosure, p, LClosure::p, s2v, setbtvalue, sethvalue2s, setnilvalue, Proto::sizelineinfo, t, and lua_State::top.
Referenced by lua_getinfo().
|
static |
Definition at line 43 of file ldebug.cpp.
References ci_func, isLua, CallInfo::l, lua_assert, p, pcRel, and CallInfo::u.
Referenced by funcnamefromcode(), getcurrentline(), luaG_findlocal(), and varinfo().
|
static |
Definition at line 458 of file ldebug.cpp.
Referenced by findsetreg().
|
static |
Definition at line 468 of file ldebug.cpp.
References a, b, Proto::code, filterpc(), GET_OPCODE, GETARG_A, GETARG_B, GETARG_sJ, i, OP_CALL, OP_JMP, OP_LOADNIL, OP_TAILCALL, OP_TFORCALL, testAMode, and testMMMode.
Referenced by getobjname().
Definition at line 188 of file ldebug.cpp.
References clLvalue, CallInfo::func, CallInfo::l, s2v, and CallInfo::u.
Referenced by luaG_findlocal().
Definition at line 260 of file ldebug.cpp.
References getstr, Closure::l, lua_Debug::lastlinedefined, Proto::lastlinedefined, lua_Debug::linedefined, Proto::linedefined, LL, luaO_chunkid(), noLuaClosure, p, LClosure::p, lua_Debug::short_src, lua_Debug::source, Proto::source, lua_Debug::srclen, tsslen, and lua_Debug::what.
Referenced by auxgetinfo().
Definition at line 597 of file ldebug.cpp.
References CallInfo::callstatus, cast, ci_func, CIST_HOOKED, Proto::code, currentpc(), G, GET_OPCODE, GETARG_A, GETARG_C, getobjname(), getstr, i, OP_BNOT, OP_CALL, OP_CLOSE, OP_CONCAT, OP_EQ, OP_GETFIELD, OP_GETI, OP_GETTABLE, OP_GETTABUP, 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, TM_BNOT, TM_CONCAT, TM_EQ, TM_INDEX, TM_LEN, TM_NEWINDEX, and TM_UNM.
Referenced by getfuncname().
|
static |
Definition at line 56 of file ldebug.cpp.
References Proto::abslineinfo, i, AbsLineInfo::line, Proto::linedefined, AbsLineInfo::pc, and Proto::sizeabslineinfo.
Referenced by luaG_getfuncline().
|
static |
Definition at line 102 of file ldebug.cpp.
References ci_func, currentpc(), luaG_getfuncline(), and p.
Referenced by auxgetinfo(), and luaG_runerror().
Definition at line 316 of file ldebug.cpp.
References CallInfo::callstatus, CIST_FIN, CIST_TAIL, funcnamefromcode(), isLua, and CallInfo::previous.
Referenced by auxgetinfo().
|
static |
Definition at line 529 of file ldebug.cpp.
References b, Proto::code, findsetreg(), GET_OPCODE, GETARG_A, GETARG_Ax, GETARG_B, GETARG_Bx, GETARG_C, gxf(), i, Proto::k, kname(), luaF_getlocalname(), 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(), gxf(), lua_getinfo(), rname(), and varinfo().
Definition at line 666 of file ldebug.cpp.
References c, ci_func, i, LClosure::p, upvalname(), LClosure::upvals, and UpVal::v.
Referenced by varinfo().
|
static |
Definition at line 518 of file ldebug.cpp.
References GETARG_B, getobjname(), LUA_ENV, t, and upvalname().
Referenced by getobjname().
Definition at line 654 of file ldebug.cpp.
References cast, CallInfo::func, i, s2v, and CallInfo::top.
Referenced by varinfo().
|
static |
Definition at line 430 of file ldebug.cpp.
References c, Proto::k, svalue, and ttisstring.
Referenced by getobjname(), and rkname().
Definition at line 159 of file ldebug.cpp.
References lua_State::basehookcount.
Referenced by db_gethook().
Definition at line 154 of file ldebug.cpp.
References lua_State::hookmask.
Referenced by db_gethook().
Definition at line 386 of file ldebug.cpp.
References api_check, api_incr_top, auxgetinfo(), clvalue, collectvalidlines(), CallInfo::func, getobjname(), lua_Debug::i_ci, lua_assert, lua_lock, lua_unlock, p, s2v, setobj2s, lua_State::top, ttisclosure, and ttisfunction.
Referenced by db_getinfo(), lua_fileops::get_calling_file(), hookf(), luaL_argerror(), luaL_traceback(), luaL_where(), and pushglobalfuncname().
Definition at line 224 of file ldebug.cpp.
References api_incr_top, clLvalue, lua_Debug::i_ci, isLfunction, lua_lock, lua_unlock, luaF_getlocalname(), luaG_findlocal(), s2v, setobjs2s, and lua_State::top.
Referenced by db_getlocal().
Definition at line 164 of file ldebug.cpp.
References lua_State::base_ci, lua_State::ci, lua_Debug::i_ci, lua_lock, lua_unlock, and CallInfo::previous.
Referenced by auxstatus(), db_getinfo(), db_getlocal(), db_setlocal(), lua_fileops::get_calling_file(), lastlevel(), luaL_argerror(), luaL_traceback(), and luaL_where().
Definition at line 135 of file ldebug.cpp.
References lua_State::basehookcount, cast_byte, lua_State::ci, lua_State::hook, lua_State::hookmask, resethookcount, and settraps().
Referenced by db_sethook().
Definition at line 246 of file ldebug.cpp.
References lua_Debug::i_ci, lua_lock, lua_unlock, luaG_findlocal(), setobjs2s, and lua_State::top.
Referenced by db_setlocal().
Definition at line 742 of file ldebug.cpp.
References getstr, LUA_IDSIZE, luaO_chunkid(), luaO_pushfstring(), and tsslen.
Referenced by lexerror(), and luaG_runerror().
Definition at line 706 of file ldebug.cpp.
References cvt2str, luaG_typeerror(), and ttisstring.
Referenced by luaT_tryconcatTM().
Definition at line 754 of file ldebug.cpp.
References lua_State::errfunc, lua_assert, LUA_ERRRUN, luaD_callnoyield(), luaD_throw(), restorestack, s2v, setobjs2s, lua_State::top, and ttisfunction.
Referenced by lua_error(), and luaG_runerror().
Definition at line 200 of file ldebug.cpp.
References lua_State::ci, ci_func, currentpc(), findvararg(), CallInfo::func, isLua, luaF_getlocalname(), CallInfo::next, p, and lua_State::top.
Referenced by lua_getlocal(), lua_setlocal(), and varerror().
Definition at line 700 of file ldebug.cpp.
References luaG_runerror(), and luaT_objtypename().
Referenced by forlimit(), and forprep().
int luaG_getfuncline | ( | const Proto * | f, |
int | pc | ||
) |
Definition at line 87 of file ldebug.cpp.
References ABSLINEINFO, getbaseline(), Proto::lineinfo, and lua_assert.
Referenced by changedline(), getcurrentline(), luaG_traceexec(), and nextline().
Definition at line 712 of file ldebug.cpp.
References luaG_typeerror(), and ttisnumber.
Referenced by luaT_trybinTM().
Definition at line 731 of file ldebug.cpp.
References luaG_runerror(), and luaT_objtypename().
Referenced by luaT_callorderTM().
Definition at line 767 of file ldebug.cpp.
References lua_State::ci, ci_func, getcurrentline(), isLua, luaC_checkGC, luaG_addinfo(), luaG_errormsg(), luaO_pushvfstring(), wfl::msg(), and Proto::source.
Referenced by findindex(), forprep(), lua_yieldk(), luaD_growstack(), luaE_checkcstack(), luaG_forerror(), luaG_ordererror(), luaG_tointerror(), luaG_typeerror(), luaH_newkey(), luaM_growaux_(), luaM_toobig(), luaO_pushvfstring(), luaV_concat(), luaV_finishget(), luaV_finishset(), luaV_idiv(), luaV_mod(), setnodevector(), and varerror().
Definition at line 723 of file ldebug.cpp.
References luaG_runerror(), tointegerns, and varinfo().
Referenced by luaT_trybinTM().
int luaG_traceexec | ( | lua_State * | L, |
const Instruction * | pc | ||
) |
Definition at line 807 of file ldebug.cpp.
References CallInfo::callstatus, changedline(), lua_State::ci, ci_func, CIST_HOOKYIELD, lua_State::hookcount, lua_State::hookmask, invpcRel, isIT, CallInfo::l, LUA_HOOKCOUNT, LUA_HOOKLINE, LUA_MASKCOUNT, LUA_MASKLINE, LUA_YIELD, luaD_hook(), luaD_throw(), luaG_getfuncline(), lua_State::oldpc, pcRel, resethookcount, Proto::sizecode, lua_State::status, CallInfo::top, lua_State::top, and CallInfo::u.
Definition at line 694 of file ldebug.cpp.
References luaG_runerror(), luaT_objtypename(), t, and varinfo().
Referenced by luaD_tryfuncTM(), luaG_concaterror(), luaG_opinterror(), luaV_finishget(), luaV_finishset(), and luaV_objlen().
|
static |
Definition at line 286 of file ldebug.cpp.
References ABSLINEINFO, Proto::lineinfo, and luaG_getfuncline().
Referenced by collectvalidlines().
|
static |
Definition at line 449 of file ldebug.cpp.
References c, GETARG_C, GETARG_k, kname(), and rname().
Referenced by getobjname().
|
static |
Definition at line 439 of file ldebug.cpp.
References getobjname().
Referenced by getobjname(), and rkname().
|
static |
Definition at line 118 of file ldebug.cpp.
References isLua, CallInfo::l, CallInfo::previous, and CallInfo::u.
Referenced by lua_sethook().
|
static |
Definition at line 181 of file ldebug.cpp.
References check_exp, getstr, Upvaldesc::name, s, and Proto::upvalues.
Referenced by getobjname(), getupvalname(), and gxf().
Definition at line 680 of file ldebug.cpp.
References cast, cast_int, lua_State::ci, ci_func, currentpc(), CallInfo::func, getobjname(), getupvalname(), isinstack(), isLua, and luaO_pushfstring().
Referenced by luaG_tointerror(), and luaG_typeerror().