ldebug.cpp File Reference

#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.

Defines

#define ldebug_c
#define LUA_CORE
#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)
#define checkopenop(pt, pc)   luaG_checkopenop((pt)->code[(pc)+1])

Functions

static const char * getfuncname (lua_State *L, CallInfo *ci, const char **name)
static int currentpc (lua_State *L, CallInfo *ci)
static int currentline (lua_State *L, CallInfo *ci)
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 Protogetluaproto (CallInfo *ci)
static const char * findlocal (lua_State *L, CallInfo *ci, int n)
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 void info_tailcall (lua_Debug *ar)
static void collectvalidlines (lua_State *L, Closure *f)
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 int precheck (const Proto *pt)
int luaG_checkopenop (Instruction i)
static int checkArgMode (const Proto *pt, int r, enum OpArgMask mode)
static Instruction 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 (lua_State *L, CallInfo *ci, int stackpos, const char **name)
static int isinstack (CallInfo *ci, const TValue *o)
void luaG_typeerror (lua_State *L, const TValue *o, const char *op)
void luaG_concaterror (lua_State *L, StkId p1, StkId p2)
void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2)
int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *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 Documentation

#define check ( x   )     if (!(x)) return 0;

Definition at line 268 of file ldebug.cpp.

Referenced by checkArgMode(), checknext(), ServerNewGameState::checkTeamsAuto(), luaG_checkopenop(), luaY_parser(), precheck(), str_checkname(), and symbexec().

#define checkjump ( pt,
pc   )     check(0 <= pc && pc < pt->sizecode)

Definition at line 270 of file ldebug.cpp.

#define checkopenop ( pt,
pc   )     luaG_checkopenop((pt)->code[(pc)+1])

Definition at line 288 of file ldebug.cpp.

Referenced by symbexec().

#define checkreg ( pt,
reg   )     check((reg) < (pt)->maxstacksize)

Definition at line 272 of file ldebug.cpp.

Referenced by checkArgMode(), and symbexec().

#define ldebug_c

Definition at line 13 of file ldebug.cpp.

#define LUA_CORE

Definition at line 14 of file ldebug.cpp.


Function Documentation

static void addinfo ( lua_State L,
const char *  msg 
) [static]

Definition at line 591 of file ldebug.cpp.

References lua_State::ci, currentline(), getluaproto(), getstr, isLua, LUA_IDSIZE, luaO_chunkid(), and luaO_pushfstring().

Referenced by luaG_runerror().

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

Definition at line 193 of file ldebug.cpp.

References Closure::c, currentline(), lua_Debug::currentline, funcinfo(), getfuncname(), info_tailcall(), lua_Debug::name, lua_Debug::namewhat, NULL, and lua_Debug::nups.

Referenced by lua_getinfo().

static int checkArgMode ( const Proto pt,
int  r,
enum OpArgMask  mode 
) [static]

Definition at line 304 of file ldebug.cpp.

References check, checkreg, INDEXK, ISK, OpArgK, OpArgN, OpArgR, OpArgU, and Proto::sizek.

Referenced by symbexec().

static void collectvalidlines ( lua_State L,
Closure f 
) [static]

Definition at line 177 of file ldebug.cpp.

References Closure::c, incr_top, Closure::l, Proto::lineinfo, luaH_new(), luaH_setnum(), NULL, LClosure::p, setbvalue, sethvalue, setnilvalue, Proto::sizelineinfo, and lua_State::top.

Referenced by lua_getinfo().

static int currentline ( lua_State L,
CallInfo ci 
) [static]

Definition at line 44 of file ldebug.cpp.

References ci_func, currentpc(), and getline.

Referenced by addinfo(), and auxgetinfo().

static int currentpc ( lua_State L,
CallInfo ci 
) [static]

Definition at line 36 of file ldebug.cpp.

References lua_State::ci, ci_func, isLua, pcRel, lua_State::savedpc, and CallInfo::savedpc.

Referenced by currentline(), findlocal(), getfuncname(), and getobjname().

static const char* findlocal ( lua_State L,
CallInfo ci,
int  n 
) [static]

Definition at line 112 of file ldebug.cpp.

References CallInfo::base, lua_State::ci, currentpc(), getluaproto(), luaF_getlocalname(), NULL, and lua_State::top.

Referenced by lua_getlocal(), and lua_setlocal().

static void funcinfo ( lua_Debug ar,
Closure cl 
) [static]

Definition at line 150 of file ldebug.cpp.

References Closure::c, getstr, Closure::l, Proto::lastlinedefined, lua_Debug::lastlinedefined, Proto::linedefined, lua_Debug::linedefined, LUA_IDSIZE, luaO_chunkid(), LClosure::p, lua_Debug::short_src, Proto::source, lua_Debug::source, and lua_Debug::what.

Referenced by auxgetinfo().

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

Definition at line 528 of file ldebug.cpp.

References ci_func, currentpc(), GET_OPCODE, GETARG_A, getobjname(), isLua, NULL, OP_CALL, OP_TAILCALL, OP_TFORLOOP, and CallInfo::tailcalls.

Referenced by auxgetinfo().

static Proto* getluaproto ( CallInfo ci  )  [static]

Definition at line 107 of file ldebug.cpp.

References ci_func, isLua, and NULL.

Referenced by addinfo(), and findlocal().

static const char* getobjname ( lua_State L,
CallInfo ci,
int  stackpos,
const char **  name 
) [static]

Definition at line 481 of file ldebug.cpp.

References ci_func, currentpc(), GET_OPCODE, GETARG_A, GETARG_B, GETARG_Bx, GETARG_C, getstr, isLua, Proto::k, kname(), lua_assert, luaF_getlocalname(), NULL, OP_GETGLOBAL, OP_GETTABLE, OP_GETUPVAL, OP_MOVE, OP_SELF, svalue, symbexec(), ttisstring, and Proto::upvalues.

Referenced by getfuncname(), and luaG_typeerror().

static void info_tailcall ( lua_Debug ar  )  [static]

Definition at line 167 of file ldebug.cpp.

References lua_Debug::currentline, lua_Debug::lastlinedefined, lua_Debug::linedefined, LUA_IDSIZE, luaO_chunkid(), lua_Debug::name, lua_Debug::namewhat, lua_Debug::nups, lua_Debug::short_src, lua_Debug::source, and lua_Debug::what.

Referenced by auxgetinfo().

static int isinstack ( CallInfo ci,
const TValue o 
) [static]

Definition at line 543 of file ldebug.cpp.

References CallInfo::base.

Referenced by luaG_typeerror().

static const char* kname ( Proto p,
int  c 
) [static]

Definition at line 473 of file ldebug.cpp.

References INDEXK, ISK, Proto::k, svalue, and ttisstring.

Referenced by getobjname().

LUA_API lua_Hook lua_gethook ( lua_State L  ) 

Definition at line 69 of file ldebug.cpp.

Referenced by db_gethook().

LUA_API int lua_gethookcount ( lua_State L  ) 

Definition at line 79 of file ldebug.cpp.

Referenced by db_gethook().

LUA_API int lua_gethookmask ( lua_State L  ) 

Definition at line 74 of file ldebug.cpp.

Referenced by db_gethook().

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

Definition at line 232 of file ldebug.cpp.

Referenced by db_errorfb(), db_getinfo(), getfunc(), hookf(), luaL_argerror(), luaL_where(), and setfenv().

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

Definition at line 127 of file ldebug.cpp.

Referenced by db_getlocal().

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

Definition at line 84 of file ldebug.cpp.

Referenced by db_errorfb(), db_getinfo(), db_getlocal(), db_setlocal(), getfunc(), luaB_costatus(), luaL_argerror(), luaL_where(), and setfenv().

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

Definition at line 56 of file ldebug.cpp.

Referenced by db_sethook(), laction(), and lstop().

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

Definition at line 138 of file ldebug.cpp.

Referenced by db_setlocal().

void luaG_aritherror ( lua_State L,
const TValue p1,
const TValue p2 
)

Definition at line 572 of file ldebug.cpp.

Referenced by Arith().

int luaG_checkcode ( const Proto pt  ) 

Definition at line 468 of file ldebug.cpp.

Referenced by close_func(), and LoadFunction().

int luaG_checkopenop ( Instruction  i  ) 

Definition at line 290 of file ldebug.cpp.

void luaG_concaterror ( lua_State L,
StkId  p1,
StkId  p2 
)

Definition at line 565 of file ldebug.cpp.

Referenced by luaV_concat().

void luaG_errormsg ( lua_State L  ) 

Definition at line 602 of file ldebug.cpp.

Referenced by lua_error(), and luaG_runerror().

int luaG_ordererror ( lua_State L,
const TValue p1,
const TValue p2 
)

Definition at line 580 of file ldebug.cpp.

Referenced by lessequal(), and luaV_lessthan().

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

Definition at line 615 of file ldebug.cpp.

Referenced by findindex(), growCI(), lua_replace(), lua_yield(), luaD_call(), luaG_ordererror(), luaG_typeerror(), luaH_set(), luaM_growaux_(), luaM_toobig(), luaV_concat(), luaV_gettable(), luaV_settable(), and setnodevector().

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

Definition at line 551 of file ldebug.cpp.

Referenced by luaG_aritherror(), luaG_concaterror(), luaV_gettable(), luaV_settable(), and tryfuncTM().

static int precheck ( const Proto pt  )  [static]

Definition at line 276 of file ldebug.cpp.

References check, Proto::code, GET_OPCODE, Proto::is_vararg, lua_assert, MAXSTACK, Proto::maxstacksize, Proto::numparams, Proto::nups, OP_RETURN, Proto::sizecode, Proto::sizelineinfo, Proto::sizeupvalues, VARARG_HASARG, and VARARG_NEEDSARG.

Referenced by symbexec().

static Instruction symbexec ( const Proto pt,
int  lastpc,
int  reg 
) [static]

Definition at line 317 of file ldebug.cpp.

References check, checkArgMode(), checkopenop, checkreg, Proto::code, GET_OPCODE, GETARG_A, GETARG_B, GETARG_Bx, GETARG_C, GETARG_sBx, getBMode, getCMode, getOpMode, iABC, iABx, iAsBx, Proto::is_vararg, Proto::k, LUA_MULTRET, NO_REG, NUM_OPCODES, Proto::nups, OP_CALL, OP_CLOSURE, OP_CONCAT, OP_FORLOOP, OP_FORPREP, 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, OP_VARARG, OpArgK, OpArgR, Proto::p, precheck(), Proto::sizecode, testAMode, testTMode, ttisstring, VARARG_ISVARARG, and VARARG_NEEDSARG.

Referenced by getobjname(), and luaG_checkcode().


Generated on Mon Feb 16 15:14:58 2009 for Scorched3D by  doxygen 1.5.3