The Battle for Wesnoth  1.15.1+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_TCCL)
 
#define ci_func(ci)   (clLvalue((ci)->func))
 

Functions

static const char * funcnamefromcode (lua_State *L, CallInfo *ci, const char **name)
 
static int currentpc (CallInfo *ci)
 
static int currentline (CallInfo *ci)
 
static void swapextra (lua_State *L)
 
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 (Proto *p, int uv)
 
static const char * findvararg (CallInfo *ci, int n, StkId *pos)
 
static const char * 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 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 (Proto *p, int lastpc, int reg, const char **name)
 
static void kname (Proto *p, int pc, int c, const char **name)
 
static int filterpc (int pc, int jmptarget)
 
static int findsetreg (Proto *p, int lastpc, int reg)
 
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_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,...)
 
void luaG_traceexec (lua_State *L)
 

Macro Definition Documentation

◆ ci_func

#define ci_func (   ci)    (clLvalue((ci)->func))

◆ 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_TCCL)

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

◆ collectvalidlines()

static void collectvalidlines ( lua_State L,
Closure f 
)
static

◆ currentline()

static int currentline ( CallInfo ci)
static

Definition at line 51 of file ldebug.cpp.

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

Referenced by auxgetinfo(), and luaG_runerror().

◆ currentpc()

static int currentpc ( CallInfo ci)
static

Definition at line 45 of file ldebug.cpp.

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

Referenced by currentline(), findlocal(), funcnamefromcode(), and varinfo().

◆ filterpc()

static int filterpc ( int  pc,
int  jmptarget 
)
static

Definition at line 375 of file ldebug.cpp.

Referenced by findsetreg().

◆ findlocal()

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

◆ findsetreg()

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

◆ findvararg()

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

Definition at line 134 of file ldebug.cpp.

References cast_int, clLvalue, CallInfo::func, CallInfo::l, n, and CallInfo::u.

Referenced by 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

◆ getfuncname()

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

Definition at line 248 of file ldebug.cpp.

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

Referenced by auxgetinfo().

◆ getobjname()

static const char * getobjname ( 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 557 of file ldebug.cpp.

References c, ci_func, i, LClosure::p, upvalname(), LClosure::upvals, and UpVal::v.

Referenced by varinfo().

◆ isinstack()

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

Definition at line 546 of file ldebug.cpp.

References i, CallInfo::l, CallInfo::top, and CallInfo::u.

Referenced by varinfo().

◆ kname()

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

Definition at line 355 of file ldebug.cpp.

References getobjname(), INDEXK, ISK, Proto::k, svalue, and ttisstring.

Referenced by getobjname().

◆ lua_gethook()

LUA_API lua_Hook lua_gethook ( lua_State L)

Definition at line 95 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 105 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 100 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 195 of file ldebug.cpp.

References findlocal(), lua_Debug::i_ci, lua_lock, lua_unlock, name(), setobjs2s, swapextra(), 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 628 of file ldebug.cpp.

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

Referenced by lexerror(), and luaG_runerror().

◆ luaG_concaterror()

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

Definition at line 591 of file ldebug.cpp.

References cvt2str, luaG_typeerror(), and ttisstring.

Referenced by luaT_trybinTM().

◆ luaG_errormsg()

l_noret luaG_errormsg ( lua_State L)

◆ luaG_opinterror()

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

Definition at line 597 of file ldebug.cpp.

References luaG_typeerror(), and tonumber.

Referenced by luaT_trybinTM().

◆ luaG_ordererror()

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

Definition at line 617 of file ldebug.cpp.

References luaG_runerror(), and luaT_objtypename().

Referenced by luaV_lessequal(), and luaV_lessthan().

◆ 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 609 of file ldebug.cpp.

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

Referenced by luaT_trybinTM().

◆ luaG_traceexec()

void luaG_traceexec ( lua_State L)

◆ luaG_typeerror()

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

◆ swapextra()

static void swapextra ( lua_State L)
static

◆ upvalname()

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

Definition at line 127 of file ldebug.cpp.

References check_exp, getstr, Upvaldesc::name, s, and Proto::upvalues.

Referenced by getobjname(), and getupvalname().

◆ varinfo()

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