diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-08-13 16:44:47 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-08-13 16:44:47 -0300 |
commit | 90d26b9266154d9afe8eda2075a221c64e8f2cd5 (patch) | |
tree | be303c86c6b9d4c2ad3e6077c7a13b4153c15960 | |
parent | a048d71ef38af8110eca2155e40ec167b9a9ca8b (diff) | |
download | lua-90d26b9266154d9afe8eda2075a221c64e8f2cd5.tar.gz lua-90d26b9266154d9afe8eda2075a221c64e8f2cd5.tar.bz2 lua-90d26b9266154d9afe8eda2075a221c64e8f2cd5.zip |
update of `debug' library (Lua binding)
-rw-r--r-- | manual.tex | 115 |
1 files changed, 62 insertions, 53 deletions
@@ -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 | ||
3864 | The library \verb|ldblib| provides | 3864 | The library \verb|ldblib| provides |
3865 | the functionality of the debug interface to Lua programs. | 3865 | the functionality of the debug interface to Lua programs. |
3866 | If you want to use this library, | ||
3867 | your host application must open it, | ||
3868 | by calling \verb|lua_dblibopen|. | ||
3869 | \DefAPI{lua_dblibopen} | ||
3870 | |||
3871 | You should exert great care when using this library. | 3866 | You should exert great care when using this library. |
3872 | The functions provided here should be used exclusively for debugging | 3867 | The functions provided here should be used exclusively for debugging |
3873 | and similar tasks, such as profiling. | 3868 | and similar tasks, such as profiling. |
3874 | Please resist the temptation to use them as a | 3869 | Please resist the temptation to use them as a |
3875 | usual programming tool: | 3870 | usual programming tool: |
3876 | They can be \emph{very} slow. | 3871 | They can be very slow. |
3877 | Moreover, \verb|setlocal| and \verb|getlocal| | 3872 | Moreover, \verb|setlocal| and \verb|getlocal| |
3878 | violate the privacy of local variables, | 3873 | violate the privacy of local variables, |
3879 | and therefore can compromise some (otherwise) secure code. | 3874 | and therefore can compromise some (otherwise) secure code. |
3880 | 3875 | ||
3876 | All functions in this library are provided | ||
3877 | inside 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 | ||
3884 | This function returns a table with information about a function. | 3882 | This function returns a table with information about a function. |
3885 | You can give the function directly, | 3883 | You can give the function directly, |
@@ -3904,7 +3902,7 @@ and \verb|getinfo(print)| returns a table with all available information | |||
3904 | about the \verb|print| function. | 3902 | about 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 | ||
3909 | This function returns the name and the value of the local variable | 3907 | This function returns the name and the value of the local variable |
3910 | with index \verb|local| of the function at level \verb|level| of the stack. | 3908 | with index \verb|local| of the function at level \verb|level| of the stack. |
@@ -3915,7 +3913,8 @@ variable with the given index, | |||
3915 | and raises an error when called with a \verb|level| out of range. | 3913 | and 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 | ||
3920 | This function assigns the value \verb|value| to the local variable | 3919 | This function assigns the value \verb|value| to the local variable |
3921 | with index \verb|local| of the function at level \verb|level| of the stack. | 3920 | with index \verb|local| of the function at level \verb|level| of the stack. |
@@ -3924,31 +3923,41 @@ variable with the given index, | |||
3924 | and raises an error when called with a \verb|level| out of range. | 3923 | and 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 | ||
3929 | Sets the function \verb|hook| as the call hook; | 3929 | Sets the given function as a hook. |
3930 | this hook will be called every time the interpreter starts and | 3930 | The string \verb|mask| and the number \verb|count| describe |
3931 | exits the execution of a function. | 3931 | when the hook will be called. |
3932 | The only argument to the call hook is the event name (\verb|"call"| or | 3932 | The string mask may have the following characteres, |
3933 | \verb|"return"|). | 3933 | with the given meaning: |
3934 | You can call \verb|getinfo| with level 2 to get more information about | 3934 | \begin{description} |
3935 | the 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} | ||
3939 | With a \verb|count| different from zero, | ||
3940 | the hook is called after every \verb|count| instructions. | ||
3941 | |||
3942 | When called without arguments, | ||
3943 | the \verb|debug.sethook| function turns off the hook. | ||
3944 | |||
3945 | When the hook is called, its first parameter is always a string | ||
3946 | describing the event that triggered its call: | ||
3947 | \verb|"call"|, \verb|"return"|, \verb|"line"|, and \verb|"count"|. | ||
3948 | Moreover, for line events, | ||
3949 | it also gets as its second parameter the new line number. | ||
3950 | Inside a hook, | ||
3951 | you can call \verb|getinfo| with level 2 to get more information about | ||
3952 | the running function | ||
3936 | (level~0 is the \verb|getinfo| function, | 3953 | (level~0 is the \verb|getinfo| function, |
3937 | and level~1 is the hook function). | 3954 | and level~1 is the hook function). |
3938 | When called without arguments, | ||
3939 | this 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 | ||
3944 | Sets the function \verb|hook| as the line hook; | 3958 | Returns the current hook settings, as three values: |
3945 | this hook will be called every time the interpreter changes | 3959 | the current hook function, the current hook mask, |
3946 | the line of code it is executing. | 3960 | and the current hook count (as set by the \verb|debug.sethook| function). |
3947 | The only argument to the line hook is the line number the interpreter | ||
3948 | is about to execute. | ||
3949 | When called without arguments, | ||
3950 | this 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. | |||
4052 | At the risk of omitting several names, | 4061 | At the risk of omitting several names, |
4053 | we also thank the following individuals for supporting, | 4062 | we also thank the following individuals for supporting, |
4054 | contributing to, and spreading the word about Lua: | 4063 | contributing to, and spreading the word about Lua: |
4055 | Mark Ian Barlow, | 4064 | Alan Watson. |
4056 | John Belmonte, | ||
4057 | Renato Borges, | ||
4058 | Carlos Cassino, | ||
4059 | Renato Cerqueira, | ||
4060 | Andr\'e Clinio, | 4065 | Andr\'e Clinio, |
4061 | Andr\'e Costa, | 4066 | Andr\'e Costa, |
4062 | Steve Dekorte, | 4067 | Antonio Scuri, |
4063 | Jon Erickson, | 4068 | Bret Mogilefsky, |
4064 | Tom\'as Gorham, | ||
4065 | Stephan Herrmann, | ||
4066 | Erik Hougaard, | ||
4067 | David Jeske, | ||
4068 | Jon Kleiser, | ||
4069 | Cameron Laird, | 4069 | Cameron Laird, |
4070 | Carlos Cassino, | ||
4070 | Carlos Henrique Levy, | 4071 | Carlos Henrique Levy, |
4071 | Philippe Lhost, | 4072 | Claudio Terra, |
4073 | David Jeske, | ||
4074 | Edgar Toernig, | ||
4075 | Erik Hougaard, | ||
4072 | Jim Mathies, | 4076 | Jim Mathies, |
4073 | Bret Mogilefsky, | 4077 | John Belmonte, |
4074 | John Passaniti, | 4078 | John Passaniti, |
4075 | Vincent Penquerc'h, | 4079 | John Roll, |
4080 | Jon Erickson, | ||
4081 | Jon Kleiser, | ||
4082 | Mark Ian Barlow, | ||
4083 | Nick Trout, | ||
4084 | Noemi Rodriguez, | ||
4076 | Norman Ramsey, | 4085 | Norman Ramsey, |
4086 | Philippe Lhost, | ||
4077 | Renata Ratton, | 4087 | Renata Ratton, |
4078 | Noemi Rodriguez, | 4088 | Renato Borges, |
4079 | John Roll, | 4089 | Renato Cerqueira, |
4080 | Antonio Scuri, | ||
4081 | Claudio Terra, | ||
4082 | Reuben Thomas, | 4090 | Reuben Thomas, |
4083 | Edgar Toernig, | 4091 | Stephan Herrmann, |
4084 | Nick Trout, | 4092 | Steve Dekorte, |
4085 | Thatcher Ulrich, | 4093 | Thatcher Ulrich, |
4086 | Alan Watson. | 4094 | Tom\'as Gorham, |
4095 | Vincent Penquerc'h, | ||
4087 | Thank you! | 4096 | Thank you! |
4088 | 4097 | ||
4089 | 4098 | ||