[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: dumping stack
- From: Philipp Kraus <philipp.kraus@...>
- Date: Tue, 11 Dec 2012 16:17:22 +0100
Hi Jermone,
many thank to you,
Am 11.12.2012 um 15:41 schrieb Jerome Vuarand:
> The stack slot 1 is only pointing at the function, it doesn't hold the
> name you used to push it there. You can still try to call lua_getinfo
> on it. To do that on a function on the C stack, first push the
> function on the top of the stack (lua_pushvalue(L, 1) in your case),
> then call lua_getinfo with a "what" string that start with the
> character ">". See the lua_getinfo manual for more details.
I have tried this, but not with the pushvalue. At the moment I get some
ASCII chars, I think it is the pointer representation.
> This doesn't guarantee that you will get a function name. I'm not
> familiar enough with getinfo to tell the circumstances where you will
> or where you won't. I think that usually when you get a function name
> in a trace report, the name is infered from the call point, not the
> function definition point, so there might be a chance that you cannot
> get a proper name in your situation (I don't know if the functions
> debug data carry the name used when they were defined). However you
> will get a script name and a line number of here the function was
> defined, so you can point your user there at the very least.
I have a set of Lua scripts, that are stored in a database. On another host
system (cluster) a MPI spawned process get the scripts and run the Lua
code some million times. Each script / function is a independend system
in this process. At the moment I'm developing this system, so
I need a debug interface for my Lua codes. I would run the Lua code from C/C++
push values and functions to the stack and read the result.
The information which is needed by this process is "which function is called and
what data is put in / get out", so I need a stack trace during running.
The programm throws exception on error, but I catch the exceptions, log the error
and do the next step. The program need not to break, only the error must be logged
with a trace in user-friendly representation to database.
Do you have got an idea for a good error log creation?
Thanks Phil