aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-11-10 16:41:19 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-11-10 16:41:19 -0200
commitd1d1ddec1e4ffb53e646dde684d4a1262b3d43de (patch)
tree9172a203f8c1752618586f01b6b60dbbd3345d33
parentbfa0898312e1a36087fa10fa8020a706a2e8e885 (diff)
downloadlua-d1d1ddec1e4ffb53e646dde684d4a1262b3d43de.tar.gz
lua-d1d1ddec1e4ffb53e646dde684d4a1262b3d43de.tar.bz2
lua-d1d1ddec1e4ffb53e646dde684d4a1262b3d43de.zip
details
-rw-r--r--ldebug.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/ldebug.c b/ldebug.c
index 578f46ed..e61944c3 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldebug.c,v 2.104 2014/11/02 19:33:33 roberto Exp roberto $ 2** $Id: ldebug.c,v 2.105 2014/11/10 14:46:46 roberto Exp roberto $
3** Debug Interface 3** Debug Interface
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -483,17 +483,21 @@ static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) {
483 483
484 484
485/* 485/*
486** only portable way to check whether a pointer points to an array 486** The subtraction of two potentially unrelated pointers is
487** (used only for error messages, so efficiency is not a big concern) 487** not ISO C, but it should not crash a program; the subsequent
488** checks are ISO C and ensure a correct result.
488*/ 489*/
489static int isinstack (CallInfo *ci, const TValue *o) { 490static int isinstack (CallInfo *ci, const TValue *o) {
490 StkId p; 491 ptrdiff_t i = o - ci->u.l.base;
491 for (p = ci->u.l.base; p < ci->top; p++) 492 return (0 <= i && i < (ci->top - ci->u.l.base) && ci->u.l.base + i == o);
492 if (o == p) return 1;
493 return 0;
494} 493}
495 494
496 495
496/*
497** Checks whether value 'o' came from an upvalue. (That can only happen
498** with instructions OP_GETTABUP/OP_SETTABUP, which operate directly on
499** upvalues.)
500*/
497static const char *getupvalname (CallInfo *ci, const TValue *o, 501static const char *getupvalname (CallInfo *ci, const TValue *o,
498 const char **name) { 502 const char **name) {
499 LClosure *c = ci_func(ci); 503 LClosure *c = ci_func(ci);