The Battle for Wesnoth  1.15.12+dev
Macros | Functions
ldebug.cpp 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"
Include dependency graph for ldebug.cpp:

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)
 

Macro Definition Documentation

◆ invpcRel

#define invpcRel (   pc,
  p 
)    ((p)->code + (pc) + 1)

Definition at line 37 of file ldebug.cpp.

Referenced by luaG_traceexec().

◆ ldebug_c

#define ldebug_c

Definition at line 7 of file ldebug.cpp.

◆ LUA_CORE

#define LUA_CORE

Definition at line 8 of file ldebug.cpp.

◆ noLuaClosure

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

Definition at line 34 of file ldebug.cpp.

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

◆ changedline()

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

Definition at line 785 of file ldebug.cpp.

References Proto::lineinfo, and luaG_getfuncline().

Referenced by luaG_traceexec().

◆ collectvalidlines()

static void collectvalidlines ( lua_State L,
Closure f 
)
static

◆ currentpc()

static int currentpc ( CallInfo ci)
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().

◆ filterpc()

static int filterpc ( int  pc,
int  jmptarget 
)
static

Definition at line 458 of file ldebug.cpp.

Referenced by findsetreg().

◆ findsetreg()

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

◆ findvararg()

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

Definition at line 188 of file ldebug.cpp.

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

Referenced by luaG_findlocal().

◆ funcinfo()

static void funcinfo ( lua_Debug ar,
Closure cl 
)
static

◆ funcnamefromcode()

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

◆ getbaseline()

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

◆ getcurrentline()

static int getcurrentline ( CallInfo ci)
static

Definition at line 102 of file ldebug.cpp.

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

Referenced by auxgetinfo(), and luaG_runerror().

◆ getfuncname()

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

Definition at line 316 of file ldebug.cpp.

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

Referenced by auxgetinfo().

◆ getobjname()

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

◆ getupvalname()

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

Definition at line 666 of file ldebug.cpp.

References c, ci_func, i, 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 518 of file ldebug.cpp.

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

Referenced by getobjname().

◆ isinstack()

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

Definition at line 654 of file ldebug.cpp.

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

Referenced by varinfo().

◆ kname()

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

Definition at line 430 of file ldebug.cpp.

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

Referenced by getobjname(), and rkname().

◆ lua_gethook()

LUA_API lua_Hook lua_gethook ( lua_State L)

Definition at line 149 of file ldebug.cpp.

References lua_State::hook.

Referenced by db_gethook().

◆ lua_gethookcount()

LUA_API int lua_gethookcount ( lua_State L)

Definition at line 159 of file ldebug.cpp.

References lua_State::basehookcount.

Referenced by db_gethook().

◆ lua_gethookmask()

LUA_API int lua_gethookmask ( lua_State L)

Definition at line 154 of file ldebug.cpp.

References lua_State::hookmask.

Referenced by db_gethook().

◆ lua_getinfo()

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

◆ lua_getlocal()

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

◆ lua_getstack()

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

◆ lua_sethook()

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

◆ lua_setlocal()

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

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().

◆ luaG_addinfo()

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

Definition at line 742 of file ldebug.cpp.

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

Referenced by lexerror(), and luaG_runerror().

◆ luaG_concaterror()

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

Definition at line 706 of file ldebug.cpp.

References cvt2str, luaG_typeerror(), and ttisstring.

Referenced by luaT_tryconcatTM().

◆ luaG_errormsg()

l_noret luaG_errormsg ( lua_State L)

◆ luaG_findlocal()

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

◆ luaG_forerror()

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

Definition at line 700 of file ldebug.cpp.

References luaG_runerror(), and luaT_objtypename().

Referenced by forlimit(), and forprep().

◆ luaG_getfuncline()

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().

◆ luaG_opinterror()

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

Definition at line 712 of file ldebug.cpp.

References luaG_typeerror(), and ttisnumber.

Referenced by luaT_trybinTM().

◆ luaG_ordererror()

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

Definition at line 731 of file ldebug.cpp.

References luaG_runerror(), and luaT_objtypename().

Referenced by luaT_callorderTM().

◆ luaG_runerror()

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

◆ luaG_tointerror()

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

Definition at line 723 of file ldebug.cpp.

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

Referenced by luaT_trybinTM().

◆ luaG_traceexec()

int luaG_traceexec ( lua_State L,
const Instruction pc 
)

◆ luaG_typeerror()

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

◆ nextline()

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

Definition at line 286 of file ldebug.cpp.

References ABSLINEINFO, 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 449 of file ldebug.cpp.

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

Referenced by getobjname().

◆ rname()

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

Definition at line 439 of file ldebug.cpp.

References getobjname().

Referenced by getobjname(), and rkname().

◆ settraps()

static void settraps ( CallInfo ci)
static

Definition at line 118 of file ldebug.cpp.

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

Referenced by lua_sethook().

◆ upvalname()

static const char* upvalname ( const Proto p,
int  uv 
)
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().

◆ varinfo()

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