mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-28 22:31:06 +01:00
MINOR: hlua: don't dump empty entries in hlua_traceback()
Calling hlua_traceback() sometimes reports empty entries looking like: [C]: ? These ones correspond to certain internal C functions of the Lua library, but they do not provide any information and even complicate the interpretation of the dump. Better just skip them.
This commit is contained in:
parent
a892b7f15f
commit
5c143404ea
13
src/hlua.c
13
src/hlua.c
@ -505,11 +505,6 @@ __LJMP const char *hlua_traceback(lua_State *L, const char* sep)
|
|||||||
struct buffer *msg = get_trash_chunk();
|
struct buffer *msg = get_trash_chunk();
|
||||||
|
|
||||||
while (lua_getstack(L, level++, &ar)) {
|
while (lua_getstack(L, level++, &ar)) {
|
||||||
|
|
||||||
/* Add separator */
|
|
||||||
if (b_data(msg))
|
|
||||||
chunk_appendf(msg, "%s", sep);
|
|
||||||
|
|
||||||
/* Fill fields:
|
/* Fill fields:
|
||||||
* 'S': fills in the fields source, short_src, linedefined, lastlinedefined, and what;
|
* 'S': fills in the fields source, short_src, linedefined, lastlinedefined, and what;
|
||||||
* 'l': fills in the field currentline;
|
* 'l': fills in the field currentline;
|
||||||
@ -518,6 +513,14 @@ __LJMP const char *hlua_traceback(lua_State *L, const char* sep)
|
|||||||
*/
|
*/
|
||||||
lua_getinfo(L, "Slnt", &ar);
|
lua_getinfo(L, "Slnt", &ar);
|
||||||
|
|
||||||
|
/* skip these empty entries, usually they come from deep C functions */
|
||||||
|
if (ar.currentline < 0 && *ar.what == 'C' && !*ar.namewhat && !ar.name)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Add separator */
|
||||||
|
if (b_data(msg))
|
||||||
|
chunk_appendf(msg, "%s", sep);
|
||||||
|
|
||||||
/* Append code localisation */
|
/* Append code localisation */
|
||||||
if (ar.currentline > 0)
|
if (ar.currentline > 0)
|
||||||
chunk_appendf(msg, "%s:%d: ", ar.short_src, ar.currentline);
|
chunk_appendf(msg, "%s:%d: ", ar.short_src, ar.currentline);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user