aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-13 16:44:47 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-13 16:44:47 -0300
commit90d26b9266154d9afe8eda2075a221c64e8f2cd5 (patch)
treebe303c86c6b9d4c2ad3e6077c7a13b4153c15960
parenta048d71ef38af8110eca2155e40ec167b9a9ca8b (diff)
downloadlua-90d26b9266154d9afe8eda2075a221c64e8f2cd5.tar.gz
lua-90d26b9266154d9afe8eda2075a221c64e8f2cd5.tar.bz2
lua-90d26b9266154d9afe8eda2075a221c64e8f2cd5.zip
update of `debug' library (Lua binding)
-rw-r--r--manual.tex115
1 files changed, 62 insertions, 53 deletions
diff --git a/manual.tex b/manual.tex
index 956d2cac..f595b2cf 100644
--- a/manual.tex
+++ b/manual.tex
@@ -1,4 +1,4 @@
1% $Id: manual.tex,v 1.58 2002/08/09 21:03:19 roberto Exp roberto $ 1% $Id: manual.tex,v 1.59 2002/08/12 17:43:35 roberto Exp roberto $
2 2
3\documentclass[11pt,twoside,draft]{article} 3\documentclass[11pt,twoside,draft]{article}
4\usepackage{fullpage} 4\usepackage{fullpage}
@@ -133,7 +133,7 @@ Waldemar Celes
133\tecgraf\ --- Computer Science Department --- PUC-Rio 133\tecgraf\ --- Computer Science Department --- PUC-Rio
134} 134}
135 135
136%\date{{\small \tt\$Date: 2002/08/09 21:03:19 $ $}} 136%\date{{\small \tt\$Date: 2002/08/12 17:43:35 $ $}}
137 137
138\maketitle 138\maketitle
139 139
@@ -3863,23 +3863,21 @@ to create a file with the same name.
3863 3863
3864The library \verb|ldblib| provides 3864The library \verb|ldblib| provides
3865the functionality of the debug interface to Lua programs. 3865the functionality of the debug interface to Lua programs.
3866If you want to use this library,
3867your host application must open it,
3868by calling \verb|lua_dblibopen|.
3869\DefAPI{lua_dblibopen}
3870
3871You should exert great care when using this library. 3866You should exert great care when using this library.
3872The functions provided here should be used exclusively for debugging 3867The functions provided here should be used exclusively for debugging
3873and similar tasks, such as profiling. 3868and similar tasks, such as profiling.
3874Please resist the temptation to use them as a 3869Please resist the temptation to use them as a
3875usual programming tool: 3870usual programming tool:
3876They can be \emph{very} slow. 3871They can be very slow.
3877Moreover, \verb|setlocal| and \verb|getlocal| 3872Moreover, \verb|setlocal| and \verb|getlocal|
3878violate the privacy of local variables, 3873violate the privacy of local variables,
3879and therefore can compromise some (otherwise) secure code. 3874and therefore can compromise some (otherwise) secure code.
3880 3875
3876All functions in this library are provided
3877inside a \IndexVerb{debug} table.
3878
3881 3879
3882\subsubsection*{\ff \T{getinfo (function, [what])}}\DefLIB{getinfo} 3880\subsubsection*{\ff \T{debug.getinfo (function, [what])}}\DefLIB{debug.getinfo}
3883 3881
3884This function returns a table with information about a function. 3882This function returns a table with information about a function.
3885You can give the function directly, 3883You can give the function directly,
@@ -3904,7 +3902,7 @@ and \verb|getinfo(print)| returns a table with all available information
3904about the \verb|print| function. 3902about the \verb|print| function.
3905 3903
3906 3904
3907\subsubsection*{\ff \T{getlocal (level, local)}}\DefLIB{getlocal} 3905\subsubsection*{\ff \T{debug.getlocal (level, local)}}\DefLIB{debug.getlocal}
3908 3906
3909This function returns the name and the value of the local variable 3907This function returns the name and the value of the local variable
3910with index \verb|local| of the function at level \verb|level| of the stack. 3908with index \verb|local| of the function at level \verb|level| of the stack.
@@ -3915,7 +3913,8 @@ variable with the given index,
3915and raises an error when called with a \verb|level| out of range. 3913and raises an error when called with a \verb|level| out of range.
3916(You can call \verb|getinfo| to check whether the level is valid.) 3914(You can call \verb|getinfo| to check whether the level is valid.)
3917 3915
3918\subsubsection*{\ff \T{setlocal (level, local, value)}}\DefLIB{setlocal} 3916\subsubsection*{\ff \T{debug.setlocal (level, local, value)}}
3917\DefLIB{debug.setlocal}
3919 3918
3920This function assigns the value \verb|value| to the local variable 3919This function assigns the value \verb|value| to the local variable
3921with index \verb|local| of the function at level \verb|level| of the stack. 3920with index \verb|local| of the function at level \verb|level| of the stack.
@@ -3924,31 +3923,41 @@ variable with the given index,
3924and raises an error when called with a \verb|level| out of range. 3923and raises an error when called with a \verb|level| out of range.
3925(You can call \verb|getinfo| to check whether the level is valid.) 3924(You can call \verb|getinfo| to check whether the level is valid.)
3926 3925
3927\subsubsection*{\ff \T{setcallhook (hook)}}\DefLIB{setcallhook} 3926\subsubsection*{\ff \T{debug.sethook (hook, mask [, count])}}
3927\DefLIB{debug.sethook}
3928 3928
3929Sets the function \verb|hook| as the call hook; 3929Sets the given function as a hook.
3930this hook will be called every time the interpreter starts and 3930The string \verb|mask| and the number \verb|count| describe
3931exits the execution of a function. 3931when the hook will be called.
3932The only argument to the call hook is the event name (\verb|"call"| or 3932The string mask may have the following characteres,
3933\verb|"return"|). 3933with the given meaning:
3934You can call \verb|getinfo| with level 2 to get more information about 3934\begin{description}
3935the function being called or returning 3935\item[{\tt "c"}] The hook is called every time Lua calls a function;
3936\item[{\tt "r"}] The hook is called every time Lua returns from a function;
3937\item[{\tt "l"}] The hook is called every time Lua enters a new line of code.
3938\end{description}
3939With a \verb|count| different from zero,
3940the hook is called after every \verb|count| instructions.
3941
3942When called without arguments,
3943the \verb|debug.sethook| function turns off the hook.
3944
3945When the hook is called, its first parameter is always a string
3946describing the event that triggered its call:
3947\verb|"call"|, \verb|"return"|, \verb|"line"|, and \verb|"count"|.
3948Moreover, for line events,
3949it also gets as its second parameter the new line number.
3950Inside a hook,
3951you can call \verb|getinfo| with level 2 to get more information about
3952the running function
3936(level~0 is the \verb|getinfo| function, 3953(level~0 is the \verb|getinfo| function,
3937and level~1 is the hook function). 3954and level~1 is the hook function).
3938When called without arguments,
3939this function turns off call hooks.
3940\verb|setcallhook| returns the old call hook.
3941 3955
3942\subsubsection*{\ff \T{setlinehook (hook)}}\DefLIB{setlinehook} 3956\subsubsection*{\ff \T{debug.gethook ()}}\DefLIB{debug.gethook}
3943 3957
3944Sets the function \verb|hook| as the line hook; 3958Returns the current hook settings, as three values:
3945this hook will be called every time the interpreter changes 3959the current hook function, the current hook mask,
3946the line of code it is executing. 3960and the current hook count (as set by the \verb|debug.sethook| function).
3947The only argument to the line hook is the line number the interpreter
3948is about to execute.
3949When called without arguments,
3950this function turns off line hooks.
3951\verb|setlinehook| returns the old line hook.
3952 3961
3953 3962
3954%------------------------------------------------------------------------------ 3963%------------------------------------------------------------------------------
@@ -4052,38 +4061,38 @@ specially the head of the group, Marcelo Gattass.
4052At the risk of omitting several names, 4061At the risk of omitting several names,
4053we also thank the following individuals for supporting, 4062we also thank the following individuals for supporting,
4054contributing to, and spreading the word about Lua: 4063contributing to, and spreading the word about Lua:
4055Mark Ian Barlow, 4064Alan Watson.
4056John Belmonte,
4057Renato Borges,
4058Carlos Cassino,
4059Renato Cerqueira,
4060Andr\'e Clinio, 4065Andr\'e Clinio,
4061Andr\'e Costa, 4066Andr\'e Costa,
4062Steve Dekorte, 4067Antonio Scuri,
4063Jon Erickson, 4068Bret Mogilefsky,
4064Tom\'as Gorham,
4065Stephan Herrmann,
4066Erik Hougaard,
4067David Jeske,
4068Jon Kleiser,
4069Cameron Laird, 4069Cameron Laird,
4070Carlos Cassino,
4070Carlos Henrique Levy, 4071Carlos Henrique Levy,
4071Philippe Lhost, 4072Claudio Terra,
4073David Jeske,
4074Edgar Toernig,
4075Erik Hougaard,
4072Jim Mathies, 4076Jim Mathies,
4073Bret Mogilefsky, 4077John Belmonte,
4074John Passaniti, 4078John Passaniti,
4075Vincent Penquerc'h, 4079John Roll,
4080Jon Erickson,
4081Jon Kleiser,
4082Mark Ian Barlow,
4083Nick Trout,
4084Noemi Rodriguez,
4076Norman Ramsey, 4085Norman Ramsey,
4086Philippe Lhost,
4077Renata Ratton, 4087Renata Ratton,
4078Noemi Rodriguez, 4088Renato Borges,
4079John Roll, 4089Renato Cerqueira,
4080Antonio Scuri,
4081Claudio Terra,
4082Reuben Thomas, 4090Reuben Thomas,
4083Edgar Toernig, 4091Stephan Herrmann,
4084Nick Trout, 4092Steve Dekorte,
4085Thatcher Ulrich, 4093Thatcher Ulrich,
4086Alan Watson. 4094Tom\'as Gorham,
4095Vincent Penquerc'h,
4087Thank you! 4096Thank you!
4088 4097
4089 4098