coverage analysis using debug interface?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

coverage analysis using debug interface?

Norman Ramsey-2
I would like to use the reflexive debug interface to identify
every Lua statement that is never executed.  My hope was to enumerate
all the possible statements, then to use the line hook to find those
that were executed.  Any left over are not executed.

Is there any way to enumerate all statements (or even all line numbers)
in all Lua functions?


Norman
Reply | Threaded
Open this post in threaded view
|

Re: coverage analysis using debug interface?

Stephen Kellett
>Is there any way to enumerate all statements (or even all line numbers)
>in all Lua functions?

Write your own Lua parser. Thats what Software Verification did when
they wrote their coverage tool for Lua.

Stephen
--
Stephen Kellett
Object Media Limited    http://www.objmedia.demon.co.uk/software.html
Computer Consultancy, Software Development
Windows C++, Java, Assembler, Performance Analysis, Troubleshooting
Reply | Threaded
Open this post in threaded view
|

Re: coverage analysis using debug interface?

Luiz Henrique de Figueiredo
In reply to this post by Norman Ramsey-2
> Is there any way to enumerate all statements (or even all line numbers)
> in all Lua functions?

Use 'L' in debug.getinfo. The 'activelines' field in the debug info
table is a table whose keys are the lines that contain statements.
Here is an example:

 f=loadfile"test.lua"
 a=debug.getinfo(f,"L")
 for k in pairs(a.activelines) do print(k) end

--lhf
Reply | Threaded
Open this post in threaded view
|

Re: coverage analysis using debug interface?

Norman Ramsey-2
 > > Is there any way to enumerate all statements (or even all line numbers)
 > > in all Lua functions?
 >
 > Use 'L' in debug.getinfo. The 'activelines' field in the debug info
 > table is a table whose keys are the lines that contain statements.
 > Here is an example:
 >
 >  f=loadfile"test.lua"
 >  a=debug.getinfo(f,"L")
 >  for k in pairs(a.activelines) do print(k) end

Ah, nice.  Not in the manual, I notice :-)

N
Reply | Threaded
Open this post in threaded view
|

Re: coverage analysis using debug interface?

Roberto Ierusalimschy
> Ah, nice.  Not in the manual, I notice :-)

Thanks for the remark.

-- Roberto