[luci] How to Debug LuCI modules?

Patrick Sun lawipac at gmail.com
Thu Jan 14 12:37:41 CET 2010


Hi  JoW,

         I like the way you reply, it's clean and very scientific, with
references like '[1]' .. it is very professional...

         Thank you for your information, it's very helpful...

Regards
Patrick
-------- Original Email --------
From: Jo-Philipp Wich <xm at subsignal.org>
To: lawipac at gmail.com, luci at lists.subsignal.org
Subject: Re: [luci] How to Debug LuCI modules?
Date: Thu, 14 Jan 2010 11:51:01 +0100
Mailer: Thunderbird 2.0.0.23 (X11/20090812)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Patrick

> Is it possible to debug a module line by line?  

There is a "luci.debug" module, it was originally intended to trace the
memory usage of functions but it can also generate a line-by-line call
trace. Use it this way:

require "luci.debug".trap_memtrace("/tmp/trace", "l")   -- (L, not one)

This should create a file /tmp/trace on each invocation.
Apart from that you're pretty much limited to "printf" debugging and
what Lua offers in its debug api [1] . There is no interactive debugger
like gdb as far as I know.


> Also, in LuCI how does session data are preserved? I'm guessing it
> has something todo with 'stok' in the URL.

The unique session identifier is stored in the "sysauth" cookie, it is
tied to a per-session storage in /tmp which can be accessed through the
luci.sauth api. The stok in the url is a security mechanism to prevent
xrsf attacks, it is just a weak shared secret to make urls unpredictable.


~ JoW

[1] http://www.lua.org/manual/5.1/manual.html#5.9
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktO9xIACgkQdputYINPTPPYwACgorYXg83MJdS5HlLXA3X9TpBQ
5PYAnj3qxUHOiiKIFkgt7vKUkAQS3+2H
=fzmd
-----END PGP SIGNATURE-----


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.subsignal.org/pipermail/luci/attachments/20100114/6fc9084b/attachment.htm 


More information about the luci mailing list