Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
46f5079a
Commit
46f5079a
authored
Aug 23, 2021
by
Johny Mattsson
Browse files
Fixed panic handling on REPL input.
The Lua debug module is mandatory now.
parent
fbef7fea
Changes
5
Hide whitespace changes
Inline
Side-by-side
components/lua/Kconfig
View file @
46f5079a
...
...
@@ -72,7 +72,7 @@ menu "Lua configuration"
bool "UTF8 module"
default "y"
help
Includes the debug module.
Includes the debug module
(required by our Lua VM)
.
config LUA_BUILTIN_DEBUG
bool "Debug module"
...
...
@@ -124,5 +124,6 @@ menu "Lua configuration"
default y
select NODEMCU_CMODULE_PIPE
select NODEMCU_CMODULE_UART
select LUA_BUILTIN_DEBUG
endmenu
components/lua/common/lpanic.c
View file @
46f5079a
...
...
@@ -2,6 +2,7 @@
#include "lauxlib.h"
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#ifndef LUA_CROSS_COMPILER
#include "esp_system.h"
/* defined in esp_system_internal.h */
...
...
@@ -33,7 +34,7 @@ int panic_get_nvval() {
#endif
int
panic
(
lua_State
*
L
)
{
int
l
panic
(
lua_State
*
L
)
{
(
void
)
L
;
/* to avoid warnings */
#ifndef LUA_CROSS_COMPILER
uint8_t
paniclevel
=
panic_get_nvval
();
...
...
@@ -43,6 +44,7 @@ int panic (lua_State *L) {
lua_writestringerror
(
"PANIC: unprotected error in call to Lua API (%s)
\n
"
,
lua_tostring
(
L
,
-
1
));
#ifndef LUA_CROSS_COMPILER
fflush
(
stdout
);
/* call abort() directly - we don't want another reset cause to intervene */
esp_reset_reason_set_hint
(
ESP_RST_PANIC
);
#endif
...
...
components/lua/common/lpanic.h
View file @
46f5079a
...
...
@@ -5,6 +5,6 @@
void
panic_clear_nvval
(
void
);
int
panic_get_nvval
(
void
);
int
panic
(
lua_State
*
L
);
int
l
panic
(
lua_State
*
L
);
#endif
components/lua/lua-5.1/lauxlib.c
View file @
46f5079a
...
...
@@ -917,7 +917,7 @@ LUALIB_API void luaL_assertfail(const char *file, int line, const char *message)
LUALIB_API
lua_State
*
luaL_newstate
(
void
)
{
lua_State
*
L
=
lua_newstate
(
l_alloc
,
NULL
);
lua_setallocf
(
L
,
l_alloc
,
L
);
/* allocator need lua_State. */
if
(
L
)
lua_atpanic
(
L
,
&
panic
);
if
(
L
)
lua_atpanic
(
L
,
l
panic
);
return
L
;
}
components/lua/lua-5.3/lauxlib.c
View file @
46f5079a
...
...
@@ -1104,7 +1104,7 @@ static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
LUALIB_API
lua_State
*
luaL_newstate
(
void
)
{
lua_State
*
L
=
lua_newstate
(
l_alloc
,
NULL
);
if
(
L
)
lua_atpanic
(
L
,
&
panic
);
if
(
L
)
lua_atpanic
(
L
,
l
panic
);
return
L
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment