diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-03-13 17:36:01 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-03-13 17:36:01 -0700 |
commit | b68405fe319c1300cc44425d8df5ebd6e3ee6ab4 (patch) | |
tree | 5598700f0d9d1e57a35918a0bdfada1dd28dcc91 /doc | |
parent | 776d9f90325f37e65bc7321138bd929eeee7a69e (diff) | |
download | teliva-b68405fe319c1300cc44425d8df5ebd6e3ee6ab4.tar.gz |
delete debug library
There's security issues here, and they're subtle. Dropping for now until I or someone else finds a need for them.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/contents.html | 1 | ||||
-rw-r--r-- | doc/manual.html | 278 |
2 files changed, 0 insertions, 279 deletions
diff --git a/doc/contents.html b/doc/contents.html index 3a45a17..3f237bc 100644 --- a/doc/contents.html +++ b/doc/contents.html @@ -109,7 +109,6 @@ Freely available under the terms of the <LI><A HREF="manual.html#5.6">5.6 – Mathematical Functions</A> <LI><span class='teliva'><A HREF="manual.html#5.7">5.7 – File Input and Output Facilities</A></span> <LI><A HREF="manual.html#5.8">5.8 – Operating System Facilities</A> -<LI><A HREF="manual.html#5.9">5.9 – The Debug Library</A> <LI><span class='teliva'><A HREF="manual.html#5.10">5.10 – Curses Window Facilities</A></span> <LI><span class='teliva'><A HREF="manual.html#5.11">5.11 – Networking Facilities</A></span> <LI><span class='teliva'><A HREF="manual.html#5.12">5.12 – JSON Facilities</A></span> diff --git a/doc/manual.html b/doc/manual.html index e6e2240..1b58c4c 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -4109,284 +4109,6 @@ which automatically removes the file when the program ends. -<h2>5.9 - <a name="5.9">The Debug Library</a></h2> - -<p> -This library provides -the functionality of the debug interface to Lua programs. -You should exert care when using this library. -The functions provided here should be used exclusively for debugging -and similar tasks, such as profiling. -Please resist the temptation to use them as a -usual programming tool: -they can be very slow. -Moreover, several of these functions -violate some assumptions about Lua code -(e.g., that variables local to a function -cannot be accessed from outside or -that userdata metatables cannot be changed by Lua code) -and therefore can compromise otherwise secure code. -<div class='teliva'>TODO: what do we need to secure here?</div> - - -<p> -All functions in this library are provided -inside the <a name="pdf-debug"><code>debug</code></a> table. -All functions that operate over a thread -have an optional first argument which is the -thread to operate over. -The default is always the current thread. - - -<p> -<hr><h3><a name="pdf-debug.debug"><code>debug.debug ()</code></a></h3> - - -<p> -Enters an interactive mode with the user, -running each string that the user enters. -Using simple commands and other debug facilities, -the user can inspect global and local variables, -change their values, evaluate expressions, and so on. -A line containing only the word <code>cont</code> finishes this function, -so that the caller continues its execution. - - -<p> -Note that commands for <code>debug.debug</code> are not lexically nested -within any function, and so have no direct access to local variables. - - - - -<p> -<hr><h3><a name="pdf-debug.getfenv"><code>debug.getfenv (o)</code></a></h3> -Returns the environment of object <code>o</code>. - - - - -<p> -<hr><h3><a name="pdf-debug.gethook"><code>debug.gethook ([thread])</code></a></h3> - - -<p> -Returns the current hook settings of the thread, as three values: -the current hook function, the current hook mask, -and the current hook count -(as set by the <a href="#pdf-debug.sethook"><code>debug.sethook</code></a> function). - - - - -<p> -<hr><h3><a name="pdf-debug.getinfo"><code>debug.getinfo ([thread,] function [, what])</code></a></h3> - - -<p> -Returns a table with information about a function. -You can give the function directly, -or you can give a number as the value of <code>function</code>, -which means the function running at level <code>function</code> of the call stack -of the given thread: -level 0 is the current function (<code>getinfo</code> itself); -level 1 is the function that called <code>getinfo</code>; -and so on. -If <code>function</code> is a number larger than the number of active functions, -then <code>getinfo</code> returns <b>nil</b>. - - -<p> -The returned table can contain all the fields returned by <a href="#lua_getinfo"><code>lua_getinfo</code></a>, -with the string <code>what</code> describing which fields to fill in. -The default for <code>what</code> is to get all information available, -except the table of valid lines. -If present, -the option '<code>f</code>' -adds a field named <code>func</code> with the function itself. -If present, -the option '<code>L</code>' -adds a field named <code>activelines</code> with the table of -valid lines. - - -<p> -For instance, the expression <code>debug.getinfo(1,"n").name</code> returns -a table with a name for the current function, -if a reasonable name can be found, -and the expression <code>debug.getinfo(print)</code> -returns a table with all available information -about the <a href="#pdf-print"><code>print</code></a> function. - - - - -<p> -<hr><h3><a name="pdf-debug.getlocal"><code>debug.getlocal ([thread,] level, local)</code></a></h3> - - -<p> -This function returns the name and the value of the local variable -with index <code>local</code> of the function at level <code>level</code> of the stack. -(The first parameter or local variable has index 1, and so on, -until the last active local variable.) -The function returns <b>nil</b> if there is no local -variable with the given index, -and raises an error when called with a <code>level</code> out of range. -(You can call <a href="#pdf-debug.getinfo"><code>debug.getinfo</code></a> to check whether the level is valid.) - - -<p> -Variable names starting with '<code>(</code>' (open parentheses) -represent internal variables -(loop control variables, temporaries, and C function locals). - - - - -<p> -<hr><h3><a name="pdf-debug.getmetatable"><code>debug.getmetatable (object)</code></a></h3> - - -<p> -Returns the metatable of the given <code>object</code> -or <b>nil</b> if it does not have a metatable. - - - - -<p> -<hr><h3><a name="pdf-debug.getregistry"><code>debug.getregistry ()</code></a></h3> - - -<p> -Returns the registry table (see <a href="#3.5">§3.5</a>). - - - - -<p> -<hr><h3><a name="pdf-debug.getupvalue"><code>debug.getupvalue (func, up)</code></a></h3> - - -<p> -This function returns the name and the value of the upvalue -with index <code>up</code> of the function <code>func</code>. -The function returns <b>nil</b> if there is no upvalue with the given index. - - - - -<p> -<hr><h3><a name="pdf-debug.setfenv"><code>debug.setfenv (object, table)</code></a></h3> - - -<p> -Sets the environment of the given <code>object</code> to the given <code>table</code>. -Returns <code>object</code>. - - - - -<p> -<hr><h3><a name="pdf-debug.sethook"><code>debug.sethook ([thread,] hook, mask [, count])</code></a></h3> - - -<p> -Sets the given function as a hook. -The string <code>mask</code> and the number <code>count</code> describe -when the hook will be called. -The string mask may have the following characters, -with the given meaning: - -<ul> -<li><b><code>"c"</code>:</b> the hook is called every time Lua calls a function;</li> -<li><b><code>"r"</code>:</b> the hook is called every time Lua returns from a function;</li> -<li><b><code>"l"</code>:</b> the hook is called every time Lua enters a new line of code.</li> -</ul><p> -With a <code>count</code> different from zero, -the hook is called after every <code>count</code> instructions. - - -<p> -When called without arguments, -<a href="#pdf-debug.sethook"><code>debug.sethook</code></a> turns off the hook. - - -<p> -When the hook is called, its first parameter is a string -describing the event that has triggered its call: -<code>"call"</code>, <code>"return"</code> (or <code>"tail return"</code>, -when simulating a return from a tail call), -<code>"line"</code>, and <code>"count"</code>. -For line events, -the hook also gets the new line number as its second parameter. -Inside a hook, -you can call <code>getinfo</code> with level 2 to get more information about -the running function -(level 0 is the <code>getinfo</code> function, -and level 1 is the hook function), -unless the event is <code>"tail return"</code>. -In this case, Lua is only simulating the return, -and a call to <code>getinfo</code> will return invalid data. - - - - -<p> -<hr><h3><a name="pdf-debug.setlocal"><code>debug.setlocal ([thread,] level, local, value)</code></a></h3> - - -<p> -This function assigns the value <code>value</code> to the local variable -with index <code>local</code> of the function at level <code>level</code> of the stack. -The function returns <b>nil</b> if there is no local -variable with the given index, -and raises an error when called with a <code>level</code> out of range. -(You can call <code>getinfo</code> to check whether the level is valid.) -Otherwise, it returns the name of the local variable. - - - - -<p> -<hr><h3><a name="pdf-debug.setmetatable"><code>debug.setmetatable (object, table)</code></a></h3> - - -<p> -Sets the metatable for the given <code>object</code> to the given <code>table</code> -(which can be <b>nil</b>). - - - - -<p> -<hr><h3><a name="pdf-debug.setupvalue"><code>debug.setupvalue (func, up, value)</code></a></h3> - - -<p> -This function assigns the value <code>value</code> to the upvalue -with index <code>up</code> of the function <code>func</code>. -The function returns <b>nil</b> if there is no upvalue -with the given index. -Otherwise, it returns the name of the upvalue. - - - - -<p> -<hr><h3><a name="pdf-debug.traceback"><code>debug.traceback ([thread,] [message [, level]])</code></a></h3> - - -<p> -Returns a string with a traceback of the call stack. -An optional <code>message</code> string is appended -at the beginning of the traceback. -An optional <code>level</code> number tells at which level -to start the traceback -(default is 1, the function calling <code>traceback</code>). - - <div class='teliva'> <h2>5.10 - <a name="5.10">Curses Window Facilities</a></h2> |