#include <stdlib.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.
Defines | |
#define | ldebug_c |
#define | isLua(ci) (!((ci)->state & CI_C)) |
#define | check(x) if (!(x)) return 0; |
#define | checkjump(pt, pc) check(0 <= pc && pc < pt->sizecode) |
#define | checkreg(pt, reg) check((reg) < (pt)->maxstacksize) |
Functions | |
static const char * | getfuncname (CallInfo *ci, const char **name) |
static int | currentpc (CallInfo *ci) |
static int | currentline (CallInfo *ci) |
void | luaG_inithooks (lua_State *L) |
LUA_API int | 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 Proto * | getluaproto (CallInfo *ci) |
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, StkId func) |
static const char * | travglobals (lua_State *L, const TObject *o) |
static void | info_tailcall (lua_State *L, lua_Debug *ar) |
static int | auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, StkId f, CallInfo *ci) |
LUA_API int | lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) |
static int | precheck (const Proto *pt) |
static int | checkopenop (const Proto *pt, int pc) |
static int | checkRK (const Proto *pt, int r) |
static Instruction | luaG_symbexec (const Proto *pt, int lastpc, int reg) |
int | luaG_checkcode (const Proto *pt) |
static const char * | kname (Proto *p, int c) |
static const char * | getobjname (CallInfo *ci, int stackpos, const char **name) |
static int | isinstack (CallInfo *ci, const TObject *o) |
void | luaG_typeerror (lua_State *L, const TObject *o, const char *op) |
void | luaG_concaterror (lua_State *L, StkId p1, StkId p2) |
void | luaG_aritherror (lua_State *L, const TObject *p1, const TObject *p2) |
int | luaG_ordererror (lua_State *L, const TObject *p1, const TObject *p2) |
static void | addinfo (lua_State *L, const char *msg) |
void | luaG_errormsg (lua_State *L) |
void | luaG_runerror (lua_State *L, const char *fmt,...) |
#define check | ( | x | ) | if (!(x)) return 0; |
Definition at line 287 of file ldebug.c.
Referenced by assignment(), body(), checkopenop(), constructor(), forbody(), forlist(), fornum(), luaG_symbexec(), luaY_index(), precheck(), recfield(), test_then_block(), and whilestat().
#define checkjump | ( | pt, | |||
pc | ) | check(0 <= pc && pc < pt->sizecode) |
#define checkreg | ( | pt, | |||
reg | ) | check((reg) < (pt)->maxstacksize) |
#define isLua | ( | ci | ) | (!((ci)->state & CI_C)) |
Definition at line 35 of file ldebug.c.
Referenced by addinfo(), currentpc(), getfuncname(), getluaproto(), and getobjname().
static void addinfo | ( | lua_State * | L, | |
const char * | msg | |||
) | [static] |
Definition at line 601 of file ldebug.c.
References lua_State::ci, currentline(), getluaproto(), getstr, isLua, luaO_chunkid(), and luaO_pushfstring().
Referenced by luaG_runerror().
static int auxgetinfo | ( | lua_State * | L, | |
const char * | what, | |||
lua_Debug * | ar, | |||
StkId | f, | |||
CallInfo * | ci | |||
) | [static] |
Definition at line 216 of file ldebug.c.
References clvalue, currentline(), funcinfo(), getfuncname(), setobj2s, lua_State::top, and travglobals().
Referenced by lua_getinfo().
static int checkopenop | ( | const Proto * | pt, | |
int | pc | |||
) | [static] |
Definition at line 306 of file ldebug.c.
References check, Proto::code, GET_OPCODE, GETARG_B, OP_CALL, OP_RETURN, OP_SETLISTO, and OP_TAILCALL.
Referenced by luaG_symbexec().
static int checkRK | ( | const Proto * | pt, | |
int | r | |||
) | [static] |
static int currentline | ( | CallInfo * | ci | ) | [static] |
Definition at line 49 of file ldebug.c.
References ci_func, currentpc(), and getline.
Referenced by addinfo(), and auxgetinfo().
static int currentpc | ( | CallInfo * | ci | ) | [static] |
Definition at line 38 of file ldebug.c.
References ci_func, CI_HASFRAME, isLua, CallInfo::l, pcRel, CallInfo::state, and CallInfo::u.
Referenced by currentline(), getfuncname(), getobjname(), lua_getlocal(), lua_setlocal(), and luaG_inithooks().
static void funcinfo | ( | lua_Debug * | ar, | |
StkId | func | |||
) | [static] |
Definition at line 170 of file ldebug.c.
References Closure::c, clvalue, CCallS::func, getstr, CClosure::isC, Closure::l, Proto::lineDefined, luaO_chunkid(), LClosure::p, and Proto::source.
Referenced by auxgetinfo().
static const char * getfuncname | ( | CallInfo * | ci, | |
const char ** | name | |||
) | [static] |
Definition at line 534 of file ldebug.c.
References ci_func, currentpc(), GET_OPCODE, GETARG_A, getobjname(), isLua, CallInfo::l, OP_CALL, OP_TAILCALL, and CallInfo::u.
Referenced by auxgetinfo().
Definition at line 124 of file ldebug.c.
References ci_func, and isLua.
Referenced by addinfo(), lua_getlocal(), and lua_setlocal().
static const char* getobjname | ( | CallInfo * | ci, | |
int | stackpos, | |||
const char ** | name | |||
) | [static] |
Definition at line 484 of file ldebug.c.
References ci_func, currentpc(), GET_OPCODE, GETARG_A, GETARG_B, GETARG_Bx, GETARG_C, isLua, Proto::k, kname(), lua_assert, luaF_getlocalname(), luaG_symbexec(), OP_GETGLOBAL, OP_GETTABLE, OP_MOVE, OP_SELF, svalue, and ttisstring.
Referenced by getfuncname(), and luaG_typeerror().
static void info_tailcall | ( | lua_State * | L, | |
lua_Debug * | ar | |||
) | [static] |
Definition at line 203 of file ldebug.c.
References luaO_chunkid(), setnilvalue, and lua_State::top.
Referenced by lua_getinfo().
static const char* kname | ( | Proto * | p, | |
int | c | |||
) | [static] |
Definition at line 472 of file ldebug.c.
References Proto::k, MAXSTACK, svalue, and ttisstring.
Referenced by getobjname().
LUA_API lua_Hook lua_gethook | ( | lua_State * | L | ) |
LUA_API int lua_gethookcount | ( | lua_State * | L | ) |
LUA_API int lua_gethookmask | ( | lua_State * | L | ) |
LUA_API int lua_getinfo | ( | lua_State * | L, | |
const char * | what, | |||
lua_Debug * | ar | |||
) |
Definition at line 258 of file ldebug.c.
References auxgetinfo(), CallInfo::base, lua_State::base_ci, incr_top, info_tailcall(), lua_assert, lua_lock, lua_unlock, luaG_runerror(), lua_State::top, and ttisfunction.
LUA_API const char* lua_getlocal | ( | lua_State * | L, | |
const lua_Debug * | ar, | |||
int | n | |||
) |
Definition at line 131 of file ldebug.c.
References CallInfo::base, lua_State::base_ci, currentpc(), getluaproto(), lua_lock, lua_unlock, luaA_pushobject(), and luaF_getlocalname().
LUA_API int lua_getstack | ( | lua_State * | L, | |
int | level, | |||
lua_Debug * | ar | |||
) |
Definition at line 100 of file ldebug.c.
References lua_State::base_ci, lua_State::ci, CI_C, CallInfo::l, lua_lock, lua_unlock, CallInfo::state, and CallInfo::u.
LUA_API int lua_sethook | ( | lua_State * | L, | |
lua_Hook | func, | |||
int | mask, | |||
int | count | |||
) |
Definition at line 71 of file ldebug.c.
References lua_State::basehookcount, cast, lua_State::hook, lua_State::hookinit, lua_State::hookmask, and resethookcount.
LUA_API const char* lua_setlocal | ( | lua_State * | L, | |
const lua_Debug * | ar, | |||
int | n | |||
) |
Definition at line 149 of file ldebug.c.
References CallInfo::base, lua_State::base_ci, currentpc(), getluaproto(), lua_lock, lua_unlock, luaF_getlocalname(), setobjs2s, and lua_State::top.
Definition at line 582 of file ldebug.c.
References luaG_typeerror(), and luaV_tonumber().
Referenced by Arith().
int luaG_checkcode | ( | const Proto * | pt | ) |
Definition at line 466 of file ldebug.c.
References luaG_symbexec(), NO_REG, and Proto::sizecode.
Referenced by close_func(), LoadFunction(), and traverseproto().
Definition at line 575 of file ldebug.c.
References lua_assert, luaG_typeerror(), and ttisstring.
Referenced by luaV_concat().
void luaG_errormsg | ( | lua_State * | L | ) |
Definition at line 614 of file ldebug.c.
References lua_State::errfunc, incr_top, luaD_call(), luaD_throw(), restorestack, setobjs2s, and ttisfunction.
Referenced by lua_error(), and luaG_runerror().
void luaG_inithooks | ( | lua_State * | L | ) |
Definition at line 60 of file ldebug.c.
References lua_State::base_ci, lua_State::ci, currentpc(), and lua_State::hookinit.
Referenced by traceexec().
Definition at line 590 of file ldebug.c.
References luaG_runerror(), luaT_typenames, and ttype.
Referenced by luaV_lessequal(), and luaV_lessthan().
void luaG_runerror | ( | lua_State * | L, | |
const char * | fmt, | |||
... | ||||
) |
Definition at line 627 of file ldebug.c.
References addinfo(), luaG_errormsg(), and luaO_pushvfstring().
Referenced by Arith(), LoadConstants(), LoadFunction(), LoadHeader(), LoadInt(), LoadSignature(), LoadUpvalues(), lua_getinfo(), lua_yield(), luaD_call(), luaD_growCI(), luaG_ordererror(), luaG_typeerror(), luaH_index(), luaH_set(), luaM_growaux(), luaM_realloc(), luaV_concat(), luaV_gettable(), luaV_settable(), setnodevector(), TestSize(), and unexpectedEOZ().
static Instruction luaG_symbexec | ( | const Proto * | pt, | |
int | lastpc, | |||
int | reg | |||
) | [static] |
Definition at line 330 of file ldebug.c.
References check, checkopenop(), checkreg, checkRK(), Proto::code, GET_OPCODE, GETARG_A, GETARG_B, GETARG_Bx, GETARG_C, GETARG_sBx, getOpMode, iABC, iABx, iAsBx, Proto::k, LFIELDS_PER_FLUSH, MAXSTACK, NO_REG, Proto::nups, OP_CALL, OP_CLOSURE, OP_CONCAT, OP_FORLOOP, OP_GETGLOBAL, OP_GETUPVAL, OP_JMP, OP_LOADBOOL, OP_LOADNIL, OP_MOVE, OP_RETURN, OP_SELF, OP_SETGLOBAL, OP_SETLIST, OP_SETUPVAL, OP_TAILCALL, OP_TFORLOOP, OpModeBreg, OpModeBrk, OpModeCrk, OpModeK, OpModesetA, OpModeT, Proto::p, precheck(), Proto::sizecode, testOpMode, and ttisstring.
Referenced by getobjname(), and luaG_checkcode().
Definition at line 560 of file ldebug.c.
References lua_State::base, lua_State::ci, getobjname(), isinstack(), luaG_runerror(), luaT_typenames, and ttype.
Referenced by luaG_aritherror(), luaG_concaterror(), luaV_getnotable(), luaV_settable(), and tryfuncTM().
static int precheck | ( | const Proto * | pt | ) | [static] |
Definition at line 295 of file ldebug.c.
References check, Proto::code, GET_OPCODE, Proto::is_vararg, lua_assert, MAXSTACK, Proto::maxstacksize, Proto::numparams, OP_RETURN, Proto::sizecode, and Proto::sizelineinfo.
Referenced by luaG_symbexec().
Definition at line 189 of file ldebug.c.
References getstr, gkey, gnode, gt, gval, hvalue, luaO_rawequalObj(), sizenode, tsvalue, and ttisstring.
Referenced by auxgetinfo().