The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ldebug.cpp
Go to the documentation of this file.
1 /*
2 ** Debug Interface
3 ** See Copyright Notice in lua.h
4 */
5 
6 
7 #include <stdarg.h>
8 #include <stddef.h>
9 #include <string.h>
10 
11 
12 #define ldebug_c
13 #define LUA_CORE
14 
15 #include "lua.h"
16 
17 #include "lapi.h"
18 #include "lcode.h"
19 #include "ldebug.h"
20 #include "ldo.h"
21 #include "lfunc.h"
22 #include "lobject.h"
23 #include "lopcodes.h"
24 #include "lstate.h"
25 #include "lstring.h"
26 #include "ltable.h"
27 #include "ltm.h"
28 #include "lvm.h"
29 
30 
31 
32 #define noLuaClosure(f) ((f) == NULL || (f)->c.tt == LUA_TCCL)
33 
34 
35 static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name);
36 
37 
38 static int currentpc (CallInfo *ci) {
39  lua_assert(isLua(ci));
40  return pcRel(ci->u.l.savedpc, ci_func(ci)->p);
41 }
42 
43 
44 static int currentline (CallInfo *ci) {
45  return getfuncline(ci_func(ci)->p, currentpc(ci));
46 }
47 
48 
49 /*
50 ** this function can be called asynchronous (e.g. during a signal)
51 */
52 LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) {
53  if (func == NULL || mask == 0) { /* turn off hooks? */
54  mask = 0;
55  func = NULL;
56  }
57  if (isLua(L->ci))
58  L->oldpc = L->ci->u.l.savedpc;
59  L->hook = func;
60  L->basehookcount = count;
61  resethookcount(L);
62  L->hookmask = cast_byte(mask);
63  return 1;
64 }
65 
66 
68  return L->hook;
69 }
70 
71 
73  return L->hookmask;
74 }
75 
76 
78  return L->basehookcount;
79 }
80 
81 
83  int status;
84  CallInfo *ci;
85  if (level < 0) return 0; /* invalid (negative) level */
86  lua_lock(L);
87  for (ci = L->ci; level > 0 && ci != &L->base_ci; ci = ci->previous)
88  level--;
89  if (level == 0 && ci != &L->base_ci) { /* level found? */
90  status = 1;
91  ar->i_ci = ci;
92  }
93  else status = 0; /* no such level */
94  lua_unlock(L);
95  return status;
96 }
97 
98 
99 static const char *upvalname (Proto *p, int uv) {
100  TString *s = check_exp(uv < p->sizeupvalues, p->upvalues[uv].name);
101  if (s == NULL) return "?";
102  else return getstr(s);
103 }
104 
105 
106 static const char *findvararg (CallInfo *ci, int n, StkId *pos) {
107  int nparams = clLvalue(ci->func)->p->numparams;
108  if (n >= ci->u.l.base - ci->func - nparams)
109  return NULL; /* no such vararg */
110  else {
111  *pos = ci->func + nparams + n;
112  return "(*vararg)"; /* generic name for any vararg */
113  }
114 }
115 
116 
117 static const char *findlocal (lua_State *L, CallInfo *ci, int n,
118  StkId *pos) {
119  const char *name = NULL;
120  StkId base;
121  if (isLua(ci)) {
122  if (n < 0) /* access to vararg values? */
123  return findvararg(ci, -n, pos);
124  else {
125  base = ci->u.l.base;
126  name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci));
127  }
128  }
129  else
130  base = ci->func + 1;
131  if (name == NULL) { /* no 'standard' name? */
132  StkId limit = (ci == L->ci) ? L->top : ci->next->func;
133  if (limit - base >= n && n > 0) /* is 'n' inside 'ci' stack? */
134  name = "(*temporary)"; /* generic name for any valid slot */
135  else
136  return NULL; /* no name */
137  }
138  *pos = base + (n - 1);
139  return name;
140 }
141 
142 
143 LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {
144  const char *name;
145  lua_lock(L);
146  if (ar == NULL) { /* information about non-active function? */
147  if (!isLfunction(L->top - 1)) /* not a Lua function? */
148  name = NULL;
149  else /* consider live variables at function start (parameters) */
150  name = luaF_getlocalname(clLvalue(L->top - 1)->p, n, 0);
151  }
152  else { /* active function; get information through 'ar' */
153  StkId pos = 0; /* to avoid warnings */
154  name = findlocal(L, ar->i_ci, n, &pos);
155  if (name) {
156  setobj2s(L, L->top, pos);
157  api_incr_top(L);
158  }
159  }
160  lua_unlock(L);
161  return name;
162 }
163 
164 
165 LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) {
166  StkId pos = 0; /* to avoid warnings */
167  const char *name = findlocal(L, ar->i_ci, n, &pos);
168  lua_lock(L);
169  if (name)
170  setobjs2s(L, pos, L->top - 1);
171  L->top--; /* pop value */
172  lua_unlock(L);
173  return name;
174 }
175 
176 
177 static void funcinfo (lua_Debug *ar, Closure *cl) {
178  if (noLuaClosure(cl)) {
179  ar->source = "=[C]";
180  ar->linedefined = -1;
181  ar->lastlinedefined = -1;
182  ar->what = "C";
183  }
184  else {
185  Proto *p = cl->l.p;
186  ar->source = p->source ? getstr(p->source) : "=?";
187  ar->linedefined = p->linedefined;
189  ar->what = (ar->linedefined == 0) ? "main" : "Lua";
190  }
192 }
193 
194 
195 static void collectvalidlines (lua_State *L, Closure *f) {
196  if (noLuaClosure(f)) {
197  setnilvalue(L->top);
198  api_incr_top(L);
199  }
200  else {
201  int i;
202  TValue v;
203  int *lineinfo = f->l.p->lineinfo;
204  Table *t = luaH_new(L); /* new table to store active lines */
205  sethvalue(L, L->top, t); /* push it on stack */
206  api_incr_top(L);
207  setbvalue(&v, 1); /* boolean 'true' to be the value of all indices */
208  for (i = 0; i < f->l.p->sizelineinfo; i++) /* for all lines with code */
209  luaH_setint(L, t, lineinfo[i], &v); /* table[line] = true */
210  }
211 }
212 
213 
214 static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar,
215  Closure *f, CallInfo *ci) {
216  int status = 1;
217  for (; *what; what++) {
218  switch (*what) {
219  case 'S': {
220  funcinfo(ar, f);
221  break;
222  }
223  case 'l': {
224  ar->currentline = (ci && isLua(ci)) ? currentline(ci) : -1;
225  break;
226  }
227  case 'u': {
228  ar->nups = (f == NULL) ? 0 : f->c.nupvalues;
229  if (noLuaClosure(f)) {
230  ar->isvararg = 1;
231  ar->nparams = 0;
232  }
233  else {
234  ar->isvararg = f->l.p->is_vararg;
235  ar->nparams = f->l.p->numparams;
236  }
237  break;
238  }
239  case 't': {
240  ar->istailcall = (ci) ? ci->callstatus & CIST_TAIL : 0;
241  break;
242  }
243  case 'n': {
244  /* calling function is a known Lua function? */
245  if (ci && !(ci->callstatus & CIST_TAIL) && isLua(ci->previous))
246  ar->namewhat = getfuncname(L, ci->previous, &ar->name);
247  else
248  ar->namewhat = NULL;
249  if (ar->namewhat == NULL) {
250  ar->namewhat = ""; /* not found */
251  ar->name = NULL;
252  }
253  break;
254  }
255  case 'L':
256  case 'f': /* handled by lua_getinfo */
257  break;
258  default: status = 0; /* invalid option */
259  }
260  }
261  return status;
262 }
263 
264 
265 LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
266  int status;
267  Closure *cl;
268  CallInfo *ci;
269  StkId func;
270  lua_lock(L);
271  if (*what == '>') {
272  ci = NULL;
273  func = L->top - 1;
274  api_check(L, ttisfunction(func), "function expected");
275  what++; /* skip the '>' */
276  L->top--; /* pop function */
277  }
278  else {
279  ci = ar->i_ci;
280  func = ci->func;
282  }
283  cl = ttisclosure(func) ? clvalue(func) : NULL;
284  status = auxgetinfo(L, what, ar, cl, ci);
285  if (strchr(what, 'f')) {
286  setobjs2s(L, L->top, func);
287  api_incr_top(L);
288  }
289  if (strchr(what, 'L'))
290  collectvalidlines(L, cl);
291  lua_unlock(L);
292  return status;
293 }
294 
295 
296 /*
297 ** {======================================================
298 ** Symbolic Execution
299 ** =======================================================
300 */
301 
302 static const char *getobjname (Proto *p, int lastpc, int reg,
303  const char **name);
304 
305 
306 /*
307 ** find a "name" for the RK value 'c'
308 */
309 static void kname (Proto *p, int pc, int c, const char **name) {
310  if (ISK(c)) { /* is 'c' a constant? */
311  TValue *kvalue = &p->k[INDEXK(c)];
312  if (ttisstring(kvalue)) { /* literal constant? */
313  *name = svalue(kvalue); /* it is its own name */
314  return;
315  }
316  /* else no reasonable name found */
317  }
318  else { /* 'c' is a register */
319  const char *what = getobjname(p, pc, c, name); /* search for 'c' */
320  if (what && *what == 'c') { /* found a constant name? */
321  return; /* 'name' already filled */
322  }
323  /* else no reasonable name found */
324  }
325  *name = "?"; /* no reasonable name found */
326 }
327 
328 
329 static int filterpc (int pc, int jmptarget) {
330  if (pc < jmptarget) /* is code conditional (inside a jump)? */
331  return -1; /* cannot know who sets that register */
332  else return pc; /* current position sets that register */
333 }
334 
335 
336 /*
337 ** try to find last instruction before 'lastpc' that modified register 'reg'
338 */
339 static int findsetreg (Proto *p, int lastpc, int reg) {
340  int pc;
341  int setreg = -1; /* keep last instruction that changed 'reg' */
342  int jmptarget = 0; /* any code before this address is conditional */
343  for (pc = 0; pc < lastpc; pc++) {
344  Instruction i = p->code[pc];
345  OpCode op = GET_OPCODE(i);
346  int a = GETARG_A(i);
347  switch (op) {
348  case OP_LOADNIL: {
349  int b = GETARG_B(i);
350  if (a <= reg && reg <= a + b) /* set registers from 'a' to 'a+b' */
351  setreg = filterpc(pc, jmptarget);
352  break;
353  }
354  case OP_TFORCALL: {
355  if (reg >= a + 2) /* affect all regs above its base */
356  setreg = filterpc(pc, jmptarget);
357  break;
358  }
359  case OP_CALL:
360  case OP_TAILCALL: {
361  if (reg >= a) /* affect all registers above base */
362  setreg = filterpc(pc, jmptarget);
363  break;
364  }
365  case OP_JMP: {
366  int b = GETARG_sBx(i);
367  int dest = pc + 1 + b;
368  /* jump is forward and do not skip `lastpc'? */
369  if (pc < dest && dest <= lastpc) {
370  if (dest > jmptarget)
371  jmptarget = dest; /* update 'jmptarget' */
372  }
373  break;
374  }
375  case OP_TEST: {
376  if (reg == a) /* jumped code can change 'a' */
377  setreg = filterpc(pc, jmptarget);
378  break;
379  }
380  default:
381  if (testAMode(op) && reg == a) /* any instruction that set A */
382  setreg = filterpc(pc, jmptarget);
383  break;
384  }
385  }
386  return setreg;
387 }
388 
389 
390 static const char *getobjname (Proto *p, int lastpc, int reg,
391  const char **name) {
392  int pc;
393  *name = luaF_getlocalname(p, reg + 1, lastpc);
394  if (*name) /* is a local? */
395  return "local";
396  /* else try symbolic execution */
397  pc = findsetreg(p, lastpc, reg);
398  if (pc != -1) { /* could find instruction? */
399  Instruction i = p->code[pc];
400  OpCode op = GET_OPCODE(i);
401  switch (op) {
402  case OP_MOVE: {
403  int b = GETARG_B(i); /* move from 'b' to 'a' */
404  if (b < GETARG_A(i))
405  return getobjname(p, pc, b, name); /* get name for 'b' */
406  break;
407  }
408  case OP_GETTABUP:
409  case OP_GETTABLE: {
410  int k = GETARG_C(i); /* key index */
411  int t = GETARG_B(i); /* table index */
412  const char *vn = (op == OP_GETTABLE) /* name of indexed variable */
413  ? luaF_getlocalname(p, t + 1, pc)
414  : upvalname(p, t);
415  kname(p, pc, k, name);
416  return (vn && strcmp(vn, LUA_ENV) == 0) ? "global" : "field";
417  }
418  case OP_GETUPVAL: {
419  *name = upvalname(p, GETARG_B(i));
420  return "upvalue";
421  }
422  case OP_LOADK:
423  case OP_LOADKX: {
424  int b = (op == OP_LOADK) ? GETARG_Bx(i)
425  : GETARG_Ax(p->code[pc + 1]);
426  if (ttisstring(&p->k[b])) {
427  *name = svalue(&p->k[b]);
428  return "constant";
429  }
430  break;
431  }
432  case OP_SELF: {
433  int k = GETARG_C(i); /* key index */
434  kname(p, pc, k, name);
435  return "method";
436  }
437  default: break; /* go through to return NULL */
438  }
439  }
440  return NULL; /* could not find reasonable name */
441 }
442 
443 
444 static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) {
445  TMS tm;
446  Proto *p = ci_func(ci)->p; /* calling function */
447  int pc = currentpc(ci); /* calling instruction index */
448  Instruction i = p->code[pc]; /* calling instruction */
449  switch (GET_OPCODE(i)) {
450  case OP_CALL:
451  case OP_TAILCALL: /* get function name */
452  return getobjname(p, pc, GETARG_A(i), name);
453  case OP_TFORCALL: { /* for iterator */
454  *name = "for iterator";
455  return "for iterator";
456  }
457  /* all other instructions can call only through metamethods */
458  case OP_SELF:
459  case OP_GETTABUP:
460  case OP_GETTABLE: tm = TM_INDEX; break;
461  case OP_SETTABUP:
462  case OP_SETTABLE: tm = TM_NEWINDEX; break;
463  case OP_EQ: tm = TM_EQ; break;
464  case OP_ADD: tm = TM_ADD; break;
465  case OP_SUB: tm = TM_SUB; break;
466  case OP_MUL: tm = TM_MUL; break;
467  case OP_DIV: tm = TM_DIV; break;
468  case OP_MOD: tm = TM_MOD; break;
469  case OP_POW: tm = TM_POW; break;
470  case OP_UNM: tm = TM_UNM; break;
471  case OP_LEN: tm = TM_LEN; break;
472  case OP_LT: tm = TM_LT; break;
473  case OP_LE: tm = TM_LE; break;
474  case OP_CONCAT: tm = TM_CONCAT; break;
475  default:
476  return NULL; /* else no useful name can be found */
477  }
478  *name = getstr(G(L)->tmname[tm]);
479  return "metamethod";
480 }
481 
482 /* }====================================================== */
483 
484 
485 
486 /*
487 ** only ANSI way to check whether a pointer points to an array
488 ** (used only for error messages, so efficiency is not a big concern)
489 */
490 static int isinstack (CallInfo *ci, const TValue *o) {
491  StkId p;
492  for (p = ci->u.l.base; p < ci->top; p++)
493  if (o == p) return 1;
494  return 0;
495 }
496 
497 
498 static const char *getupvalname (CallInfo *ci, const TValue *o,
499  const char **name) {
500  LClosure *c = ci_func(ci);
501  int i;
502  for (i = 0; i < c->nupvalues; i++) {
503  if (c->upvals[i]->v == o) {
504  *name = upvalname(c->p, i);
505  return "upvalue";
506  }
507  }
508  return NULL;
509 }
510 
511 
512 l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *op) {
513  CallInfo *ci = L->ci;
514  const char *name = NULL;
515  const char *t = objtypename(o);
516  const char *kind = NULL;
517  if (isLua(ci)) {
518  kind = getupvalname(ci, o, &name); /* check whether 'o' is an upvalue */
519  if (!kind && isinstack(ci, o)) /* no? try a register */
520  kind = getobjname(ci_func(ci)->p, currentpc(ci),
521  cast_int(o - ci->u.l.base), &name);
522  }
523  if (kind)
524  luaG_runerror(L, "attempt to %s %s " LUA_QS " (a %s value)",
525  op, kind, name, t);
526  else
527  luaG_runerror(L, "attempt to %s a %s value", op, t);
528 }
529 
530 
532  if (ttisstring(p1) || ttisnumber(p1)) p1 = p2;
533  lua_assert(!ttisstring(p1) && !ttisnumber(p1));
534  luaG_typeerror(L, p1, "concatenate");
535 }
536 
537 
538 l_noret luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) {
539  TValue temp;
540  if (luaV_tonumber(p1, &temp) == NULL)
541  p2 = p1; /* first operand is wrong */
542  luaG_typeerror(L, p2, "perform arithmetic on");
543 }
544 
545 
546 l_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) {
547  const char *t1 = objtypename(p1);
548  const char *t2 = objtypename(p2);
549  if (t1 == t2)
550  luaG_runerror(L, "attempt to compare two %s values", t1);
551  else
552  luaG_runerror(L, "attempt to compare %s with %s", t1, t2);
553 }
554 
555 
556 static void addinfo (lua_State *L, const char *msg) {
557  CallInfo *ci = L->ci;
558  if (isLua(ci)) { /* is Lua code? */
559  char buff[LUA_IDSIZE]; /* add file:line information */
560  int line = currentline(ci);
561  TString *src = ci_func(ci)->p->source;
562  if (src)
563  luaO_chunkid(buff, getstr(src), LUA_IDSIZE);
564  else { /* no source available; use "?" instead */
565  buff[0] = '?'; buff[1] = '\0';
566  }
567  luaO_pushfstring(L, "%s:%d: %s", buff, line, msg);
568  }
569 }
570 
571 
573  if (L->errfunc != 0) { /* is there an error handling function? */
574  StkId errfunc = restorestack(L, L->errfunc);
575  if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR);
576  setobjs2s(L, L->top, L->top - 1); /* move argument */
577  setobjs2s(L, L->top - 1, errfunc); /* push function */
578  L->top++;
579  luaD_call(L, L->top - 2, 1, 0); /* call it */
580  }
582 }
583 
584 
585 l_noret luaG_runerror (lua_State *L, const char *fmt, ...) {
586  va_list argp;
587  va_start(argp, fmt);
588  addinfo(L, luaO_pushvfstring(L, fmt, argp));
589  va_end(argp);
590  luaG_errormsg(L);
591 }
592 
const char * what
Definition: lua.h:402
static const char * getupvalname(CallInfo *ci, const TValue *o, const char **name)
Definition: ldebug.cpp:498
unsigned char nparams
Definition: lua.h:408
#define ci_func(ci)
Definition: ldebug.h:20
const char * luaO_pushvfstring(lua_State *L, const char *fmt, va_list argp)
Definition: lobject.cpp:178
Definition: lua.h:398
Definition: ltm.h:33
TString * source
Definition: lobject.h:475
ptrdiff_t errfunc
Definition: lstate.h:173
l_noret luaG_runerror(lua_State *L, const char *fmt,...)
Definition: ldebug.cpp:585
Definition: ltm.h:28
Definition: ltm.h:18
Definition: lobject.h:559
const TValue * luaV_tonumber(const TValue *obj, TValue *n)
Definition: lvm.cpp:34
Definition: ltm.h:30
static const char * upvalname(Proto *p, int uv)
Definition: ldebug.cpp:99
lu_byte hookmask
Definition: lstate.h:165
GLint level
Definition: glew.h:1220
#define setbvalue(obj, x)
Definition: lobject.h:197
#define GETARG_sBx(i)
Definition: lopcodes.h:111
#define isLfunction(o)
Definition: lobject.h:535
Definition: lobject.h:466
#define check_exp(c, e)
Definition: llimits.h:66
const GLfloat * c
Definition: glew.h:12741
int pos
Definition: formula.cpp:800
LUA_API lua_Hook lua_gethook(lua_State *L)
Definition: ldebug.cpp:67
#define setobjs2s
Definition: lobject.h:250
#define ttisstring(o)
Definition: lobject.h:136
unsigned char nups
Definition: lua.h:407
const char * name
Definition: lua.h:400
CClosure c
Definition: lobject.h:530
#define CIST_TAIL
Definition: lstate.h:101
#define getfuncline(f, pc)
Definition: ldebug.h:15
#define ttisclosure(o)
Definition: lobject.h:141
int basehookcount
Definition: lstate.h:167
void(* lua_Hook)(lua_State *L, lua_Debug *ar)
Definition: lua.h:378
const char * source
Definition: lua.h:403
LUA_API int lua_gethookmask(lua_State *L)
Definition: ldebug.cpp:72
static int currentpc(CallInfo *ci)
Definition: ldebug.cpp:38
static int currentline(CallInfo *ci)
Definition: ldebug.cpp:44
#define INDEXK(r)
Definition: lopcodes.h:139
#define ttisfunction(o)
Definition: lobject.h:140
#define cast_byte(i)
Definition: llimits.h:94
#define l_noret
Definition: llimits.h:108
#define setnilvalue(obj)
Definition: lobject.h:189
#define G(L)
Definition: lstate.h:178
const char * what() const
char short_src[LUA_IDSIZE]
Definition: lua.h:411
#define lua_unlock(L)
Definition: llimits.h:155
GLenum src
Definition: glew.h:2392
const char * namewhat
Definition: lua.h:401
LUA_API int lua_getstack(lua_State *L, int level, lua_Debug *ar)
Definition: ldebug.cpp:82
#define setobj2s
Definition: lobject.h:252
#define GET_OPCODE(i)
Definition: lopcodes.h:88
static int findsetreg(Proto *p, int lastpc, int reg)
Definition: ldebug.cpp:339
lu_byte callstatus
Definition: lstate.h:73
Definition: ltm.h:29
GLdouble GLdouble t
Definition: glew.h:1366
UpVal * upvals[1]
Definition: lobject.h:525
l_noret luaG_errormsg(lua_State *L)
Definition: ldebug.cpp:572
static int filterpc(int pc, int jmptarget)
Definition: ldebug.cpp:329
static const char * findvararg(CallInfo *ci, int n, StkId *pos)
Definition: ldebug.cpp:106
OpCode
Definition: lopcodes.h:164
struct CallInfo * i_ci
Definition: lua.h:413
Upvaldesc * upvalues
Definition: lobject.h:473
static int isinstack(CallInfo *ci, const TValue *o)
Definition: ldebug.cpp:490
int lastlinedefined
Definition: lua.h:406
static const char * findlocal(lua_State *L, CallInfo *ci, int n, StkId *pos)
Definition: ldebug.cpp:117
StkId top
Definition: lstate.h:156
GLdouble GLdouble GLdouble b
Definition: glew.h:6966
l_noret luaG_typeerror(lua_State *L, const TValue *o, const char *op)
Definition: ldebug.cpp:512
#define clvalue(o)
Definition: lobject.h:159
#define sethvalue(L, obj, x)
Definition: lobject.h:230
#define restorestack(L, n)
Definition: ldo.h:22
#define testAMode(m)
Definition: lopcodes.h:276
#define lua_lock(L)
Definition: llimits.h:154
const char * luaF_getlocalname(const Proto *f, int local_number, int pc)
Definition: lfunc.cpp:149
#define getstr(ts)
Definition: lobject.h:421
#define GETARG_C(i)
Definition: lopcodes.h:102
#define LUA_ENV
Definition: luaconf.h:134
TValue * v
Definition: lobject.h:497
GLint limit
Definition: glew.h:10112
char istailcall
Definition: lua.h:410
Definition: ltm.h:24
#define GETARG_A(i)
Definition: lopcodes.h:96
CallInfo * ci
Definition: lstate.h:158
const GLdouble * v
Definition: glew.h:1359
LClosure l
Definition: lobject.h:531
LUA_API int lua_sethook(lua_State *L, lua_Hook func, int mask, int count)
Definition: ldebug.cpp:52
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:7319
#define api_incr_top(L)
Definition: lapi.h:13
#define clLvalue(o)
Definition: lobject.h:160
union CallInfo::@16 u
LUA_API const char * lua_setlocal(lua_State *L, const lua_Debug *ar, int n)
Definition: ldebug.cpp:165
#define LUA_API
Definition: luaconf.h:156
StkId func
Definition: lstate.h:69
char isvararg
Definition: lua.h:409
GLenum GLint GLuint mask
Definition: glew.h:1813
int * lineinfo
Definition: lobject.h:471
int lastlinedefined
Definition: lobject.h:483
GLfloat GLfloat p
Definition: glew.h:12766
Definition: ltm.h:31
#define noLuaClosure(f)
Definition: ldebug.cpp:32
GLuint GLuint GLsizei count
Definition: glew.h:1221
Instruction * code
Definition: lobject.h:469
#define resethookcount(L)
Definition: ldebug.h:17
CallInfo base_ci
Definition: lstate.h:174
l_noret luaG_ordererror(lua_State *L, const TValue *p1, const TValue *p2)
Definition: ldebug.cpp:546
static const char * getobjname(Proto *p, int lastpc, int reg, const char **name)
Definition: ldebug.cpp:390
Table * luaH_new(lua_State *L)
Definition: ltable.cpp:367
int sizelineinfo
Definition: lobject.h:479
l_noret luaD_throw(lua_State *L, int errcode)
Definition: ldo.cpp:125
#define LUA_ERRERR
Definition: lua.h:50
#define lua_assert(c)
Definition: llimits.h:65
#define objtypename(x)
Definition: ltm.h:46
#define LUA_QS
Definition: luaconf.h:199
static void addinfo(lua_State *L, const char *msg)
Definition: ldebug.cpp:556
Definition: ltm.h:22
struct CallInfo * next
Definition: lstate.h:71
LUA_API int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar)
Definition: ldebug.cpp:265
#define GETARG_B(i)
Definition: lopcodes.h:99
Definition: ltm.h:25
size_t i
Definition: function.cpp:1057
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
Definition: debugger.cpp:112
void luaH_setint(lua_State *L, Table *t, int key, TValue *value)
Definition: ltable.cpp:517
lu_byte is_vararg
Definition: lobject.h:486
int linedefined
Definition: lobject.h:482
LUA_API const char * lua_getlocal(lua_State *L, const lua_Debug *ar, int n)
Definition: ldebug.cpp:143
const char * luaO_pushfstring(lua_State *L, const char *fmt,...)
Definition: lobject.cpp:232
Definition: ltm.h:26
Definition: ltm.h:23
void luaO_chunkid(char *out, const char *source, size_t bufflen)
Definition: lobject.cpp:251
GLuint const GLchar * name
Definition: glew.h:1782
#define ttisnumber(o)
Definition: lobject.h:132
struct CallInfo::@16::@17 l
TMS
Definition: ltm.h:17
GLclampd n
Definition: glew.h:5903
#define api_check(l, e, msg)
Definition: llimits.h:84
struct CallInfo * previous
Definition: lstate.h:71
Definition: ltm.h:32
#define cast_int(i)
Definition: llimits.h:96
TString * name
Definition: lobject.h:446
#define ISK(x)
Definition: lopcodes.h:136
CALLABLE_WRAPPER_INPUT_END if(key=="terrain")
LUA_API int lua_gethookcount(lua_State *L)
Definition: ldebug.cpp:77
struct Proto * p
Definition: lobject.h:524
void luaD_call(lua_State *L, StkId func, int nResults, int allowyield)
Definition: ldo.cpp:415
#define svalue(o)
Definition: lobject.h:424
l_noret luaG_concaterror(lua_State *L, StkId p1, StkId p2)
Definition: ldebug.cpp:531
int currentline
Definition: lua.h:404
lua_Hook hook
Definition: lstate.h:169
static void collectvalidlines(lua_State *L, Closure *f)
Definition: ldebug.cpp:195
static int auxgetinfo(lua_State *L, const char *what, lua_Debug *ar, Closure *f, CallInfo *ci)
Definition: ldebug.cpp:214
static void kname(Proto *p, int pc, int c, const char **name)
Definition: ldebug.cpp:309
TValue * k
Definition: lobject.h:468
#define GETARG_Bx(i)
Definition: lopcodes.h:105
#define pcRel(pc, p)
Definition: ldebug.h:13
GLdouble s
Definition: glew.h:1358
const Instruction * oldpc
Definition: lstate.h:159
static void funcinfo(lua_Debug *ar, Closure *cl)
Definition: ldebug.cpp:177
#define isLua(ci)
Definition: lstate.h:105
lu_int32 Instruction
Definition: llimits.h:132
#define LUA_ERRRUN
Definition: lua.h:46
Definition: ltm.h:27
#define LUA_IDSIZE
Definition: luaconf.h:207
lu_byte numparams
Definition: lobject.h:485
static const char * getfuncname(lua_State *L, CallInfo *ci, const char **name)
Definition: ldebug.cpp:444
int linedefined
Definition: lua.h:405
GLclampf f
Definition: glew.h:3024
#define GETARG_Ax(i)
Definition: lopcodes.h:108
l_noret luaG_aritherror(lua_State *L, const TValue *p1, const TValue *p2)
Definition: ldebug.cpp:538