Browse Source

update of `debug' library (Lua binding)

v5-2
Roberto Ierusalimschy 23 years ago
parent
commit
90d26b9266
  1. 115
      manual.tex

115
manual.tex

@ -1,4 +1,4 @@
% $Id: manual.tex,v 1.58 2002/08/09 21:03:19 roberto Exp roberto $ % $Id: manual.tex,v 1.59 2002/08/12 17:43:35 roberto Exp roberto $
\documentclass[11pt,twoside,draft]{article} \documentclass[11pt,twoside,draft]{article}
\usepackage{fullpage} \usepackage{fullpage}
@ -133,7 +133,7 @@ Waldemar Celes
\tecgraf\ --- Computer Science Department --- PUC-Rio \tecgraf\ --- Computer Science Department --- PUC-Rio
} }
%\date{{\small \tt\$Date: 2002/08/09 21:03:19 $ $}} %\date{{\small \tt\$Date: 2002/08/12 17:43:35 $ $}}
\maketitle \maketitle
@ -3863,23 +3863,21 @@ to create a file with the same name.
The library \verb|ldblib| provides The library \verb|ldblib| provides
the functionality of the debug interface to Lua programs. the functionality of the debug interface to Lua programs.
If you want to use this library,
your host application must open it,
by calling \verb|lua_dblibopen|.
\DefAPI{lua_dblibopen}
You should exert great care when using this library. You should exert great care when using this library.
The functions provided here should be used exclusively for debugging The functions provided here should be used exclusively for debugging
and similar tasks, such as profiling. and similar tasks, such as profiling.
Please resist the temptation to use them as a Please resist the temptation to use them as a
usual programming tool: usual programming tool:
They can be \emph{very} slow. They can be very slow.
Moreover, \verb|setlocal| and \verb|getlocal| Moreover, \verb|setlocal| and \verb|getlocal|
violate the privacy of local variables, violate the privacy of local variables,
and therefore can compromise some (otherwise) secure code. and therefore can compromise some (otherwise) secure code.
All functions in this library are provided
inside a \IndexVerb{debug} table.
\subsubsection*{\ff \T{getinfo (function, [what])}}\DefLIB{getinfo} \subsubsection*{\ff \T{debug.getinfo (function, [what])}}\DefLIB{debug.getinfo}
This function returns a table with information about a function. This function returns a table with information about a function.
You can give the function directly, You can give the function directly,
@ -3904,7 +3902,7 @@ and \verb|getinfo(print)| returns a table with all available information
about the \verb|print| function. about the \verb|print| function.
\subsubsection*{\ff \T{getlocal (level, local)}}\DefLIB{getlocal} \subsubsection*{\ff \T{debug.getlocal (level, local)}}\DefLIB{debug.getlocal}
This function returns the name and the value of the local variable This function returns the name and the value of the local variable
with index \verb|local| of the function at level \verb|level| of the stack. with index \verb|local| of the function at level \verb|level| of the stack.
@ -3915,7 +3913,8 @@ variable with the given index,
and raises an error when called with a \verb|level| out of range. and raises an error when called with a \verb|level| out of range.
(You can call \verb|getinfo| to check whether the level is valid.) (You can call \verb|getinfo| to check whether the level is valid.)
\subsubsection*{\ff \T{setlocal (level, local, value)}}\DefLIB{setlocal} \subsubsection*{\ff \T{debug.setlocal (level, local, value)}}
\DefLIB{debug.setlocal}
This function assigns the value \verb|value| to the local variable This function assigns the value \verb|value| to the local variable
with index \verb|local| of the function at level \verb|level| of the stack. with index \verb|local| of the function at level \verb|level| of the stack.
@ -3924,31 +3923,41 @@ variable with the given index,
and raises an error when called with a \verb|level| out of range. and raises an error when called with a \verb|level| out of range.
(You can call \verb|getinfo| to check whether the level is valid.) (You can call \verb|getinfo| to check whether the level is valid.)
\subsubsection*{\ff \T{setcallhook (hook)}}\DefLIB{setcallhook} \subsubsection*{\ff \T{debug.sethook (hook, mask [, count])}}
\DefLIB{debug.sethook}
Sets the function \verb|hook| as the call hook; Sets the given function as a hook.
this hook will be called every time the interpreter starts and The string \verb|mask| and the number \verb|count| describe
exits the execution of a function. when the hook will be called.
The only argument to the call hook is the event name (\verb|"call"| or The string mask may have the following characteres,
\verb|"return"|). with the given meaning:
You can call \verb|getinfo| with level 2 to get more information about \begin{description}
the function being called or returning \item[{\tt "c"}] The hook is called every time Lua calls a function;
\item[{\tt "r"}] The hook is called every time Lua returns from a function;
\item[{\tt "l"}] The hook is called every time Lua enters a new line of code.
\end{description}
With a \verb|count| different from zero,
the hook is called after every \verb|count| instructions.
When called without arguments,
the \verb|debug.sethook| function turns off the hook.
When the hook is called, its first parameter is always a string
describing the event that triggered its call:
\verb|"call"|, \verb|"return"|, \verb|"line"|, and \verb|"count"|.
Moreover, for line events,
it also gets as its second parameter the new line number.
Inside a hook,
you can call \verb|getinfo| with level 2 to get more information about
the running function
(level~0 is the \verb|getinfo| function, (level~0 is the \verb|getinfo| function,
and level~1 is the hook function). and level~1 is the hook function).
When called without arguments,
this function turns off call hooks.
\verb|setcallhook| returns the old call hook.
\subsubsection*{\ff \T{setlinehook (hook)}}\DefLIB{setlinehook} \subsubsection*{\ff \T{debug.gethook ()}}\DefLIB{debug.gethook}
Sets the function \verb|hook| as the line hook; Returns the current hook settings, as three values:
this hook will be called every time the interpreter changes the current hook function, the current hook mask,
the line of code it is executing. and the current hook count (as set by the \verb|debug.sethook| function).
The only argument to the line hook is the line number the interpreter
is about to execute.
When called without arguments,
this function turns off line hooks.
\verb|setlinehook| returns the old line hook.
%------------------------------------------------------------------------------ %------------------------------------------------------------------------------
@ -4052,38 +4061,38 @@ specially the head of the group, Marcelo Gattass.
At the risk of omitting several names, At the risk of omitting several names,
we also thank the following individuals for supporting, we also thank the following individuals for supporting,
contributing to, and spreading the word about Lua: contributing to, and spreading the word about Lua:
Mark Ian Barlow, Alan Watson.
John Belmonte,
Renato Borges,
Carlos Cassino,
Renato Cerqueira,
Andr\'e Clinio, Andr\'e Clinio,
Andr\'e Costa, Andr\'e Costa,
Steve Dekorte, Antonio Scuri,
Jon Erickson, Bret Mogilefsky,
Tom\'as Gorham,
Stephan Herrmann,
Erik Hougaard,
David Jeske,
Jon Kleiser,
Cameron Laird, Cameron Laird,
Carlos Cassino,
Carlos Henrique Levy, Carlos Henrique Levy,
Philippe Lhost, Claudio Terra,
David Jeske,
Edgar Toernig,
Erik Hougaard,
Jim Mathies, Jim Mathies,
Bret Mogilefsky, John Belmonte,
John Passaniti, John Passaniti,
Vincent Penquerc'h, John Roll,
Jon Erickson,
Jon Kleiser,
Mark Ian Barlow,
Nick Trout,
Noemi Rodriguez,
Norman Ramsey, Norman Ramsey,
Philippe Lhost,
Renata Ratton, Renata Ratton,
Noemi Rodriguez, Renato Borges,
John Roll, Renato Cerqueira,
Antonio Scuri,
Claudio Terra,
Reuben Thomas, Reuben Thomas,
Edgar Toernig, Stephan Herrmann,
Nick Trout, Steve Dekorte,
Thatcher Ulrich, Thatcher Ulrich,
Alan Watson. Tom\'as Gorham,
Vincent Penquerc'h,
Thank you! Thank you!

Loading…
Cancel
Save