From fffe75a03b16e11327040d36f2769f763d1c29c6 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Tue, 3 Sep 2013 15:53:21 +0200 Subject: [PATCH 1/3] Fix frame traversal for backtraces. --- src/lj_debug.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/lj_debug.c b/src/lj_debug.c index be7fb2b1..09896462 100644 --- a/src/lj_debug.c +++ b/src/lj_debug.c @@ -71,9 +71,18 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe) /* Lua function below errfunc/gc/hook: find cframe to get the PC. */ void *cf = cframe_raw(L->cframe); TValue *f = L->base-1; - if (cf == NULL) - return NO_BCPOS; - while (f > nextframe) { + for (;;) { + if (cf == NULL) + return NO_BCPOS; + while (cframe_nres(cf) < 0) { + if (f >= restorestack(L, -cframe_nres(cf))) + break; + cf = cframe_raw(cframe_prev(cf)); + if (cf == NULL) + return NO_BCPOS; + } + if (f < nextframe) + break; if (frame_islua(f)) { f = frame_prevl(f); } else { @@ -82,8 +91,6 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe) f = frame_prevd(f); } } - if (cframe_prev(cf)) - cf = cframe_raw(cframe_prev(cf)); ins = cframe_pc(cf); } } From 7873c8dbf740a761ec88a88f10fc3790c05c518b Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Tue, 3 Sep 2013 15:55:37 +0200 Subject: [PATCH 2/3] Recent GCC versions need more memory. --- src/ljamalg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ljamalg.c b/src/ljamalg.c index 962b3134..7226dd9e 100644 --- a/src/ljamalg.c +++ b/src/ljamalg.c @@ -6,7 +6,7 @@ /* +--------------------------------------------------------------------------+ | WARNING: Compiling the amalgamation needs a lot of virtual memory | -| (around 200 MB with GCC 4.x)! If you don't have enough physical memory | +| (around 300 MB with GCC 4.x)! If you don't have enough physical memory | | your machine will start swapping to disk and the compile will not finish | | within a reasonable amount of time. | | So either compile on a bigger machine or use the non-amalgamated build. | From b6ec7c7c86ac249ac40a241e1c9b47b729bbba3b Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Tue, 3 Sep 2013 16:02:33 +0200 Subject: [PATCH 3/3] Fix quoting in xedkbuild.bat. --- src/xedkbuild.bat | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/xedkbuild.bat b/src/xedkbuild.bat index 375f1955..adbce8be 100644 --- a/src/xedkbuild.bat +++ b/src/xedkbuild.bat @@ -54,13 +54,13 @@ buildvm -m folddef -o lj_folddef.h lj_opt_fold.c @if errorlevel 1 goto :BAD @rem ---- Cross compiler ---- -@set LJCOMPILE="%XEDK%\bin\win32\cl" /nologo /c /MT /O2 /W3 /GF /Gm- /GR- /GS- /Gy /openmp- /D_CRT_SECURE_NO_DEPRECATE /DNDEBUG /D_XBOX /D_LIB /DLUAJIT_USE_SYSMALLOC -@set LJLIB="%XEDK%\bin\win32\lib" /nologo -@set INCLUDE="%XEDK%\include\xbox" +@set "LJCOMPILE=%XEDK%\bin\win32\cl /nologo /c /MT /O2 /W3 /GF /Gm- /GR- /GS- /Gy /openmp- /D_CRT_SECURE_NO_DEPRECATE /DNDEBUG /D_XBOX /D_LIB /DLUAJIT_USE_SYSMALLOC" +@set "LJLIB=%XEDK%\bin\win32\lib /nologo" +@set "INCLUDE=%XEDK%\include\xbox" @if "%1" neq "debug" goto :NODEBUG @shift -@set LJCOMPILE="%LJCOMPILE%" /Zi +@set "LJCOMPILE=%LJCOMPILE% /Zi" :NODEBUG @if "%1"=="amalg" goto :AMALG %LJCOMPILE% /DLUA_BUILD_AS_DLL lj_*.c lib_*.c