|
funcscan Version 1.0.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.ovgu.cs.funcscan.Worker
public class Worker
The analyzer.
Constructor Summary | |
---|---|
Worker(File basedir,
File nmList,
String rm,
String cppFlags,
boolean isGnu)
Create a new worker for analyzing information collected by nm and generating several reports. |
Method Summary | |
---|---|
static void |
destroy()
Cleanup resources and shutdown all worker thread pools in the VM immediately. |
static String |
extractFuncDef(String name,
String code)
Try to find the definition for a global function with the given name and return it in ANSI notation. |
Map<String,de.ovgu.cs.funcscan.Module.CP> |
getCallers(boolean vars,
boolean sort)
Get a list of all function or variables names, its provider and potential callers. |
String |
getDefinition(boolean isVar,
String name,
Module module)
Get the definition for the given variable or function. |
Collection<Module> |
getModules()
Get all available modules. |
boolean |
isWorking()
Check, whether the worker is still scanning/modifying its internal database. |
static void |
redirectErrors(InputStream is)
Read the given stream in a separate thread line-wise and echo each line to stderr. |
boolean |
scanNM()
Remove all currently collected information and rescan the nm info file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Worker(File basedir, File nmList, String rm, String cppFlags, boolean isGnu)
basedir
- base directory to which the module names aka "*.o" refer.nmList
- object information list produced by nm and mangled by the
internal possibly modified awk script.rm
- String to remove from all encountered module filenames to
generate the real C source code filename. Might be null
.cppFlags
- C pre-processor flags to use (e.g. -I path/include)isGnu
- if true
it indicates, that the 'cc' is
not a Sun Studio C Compiler. It usually causes much more memory
consumption and has a negative impact wrt. the performance of source
file scanning.Method Detail |
---|
public boolean isWorking()
false
if it is not in a state, which requirtes writing to
its internal database.public boolean scanNM() throws FileNotFoundException
true
on success.
FileNotFoundException
ConcurrentModificationException
isWorking()
public Map<String,de.ovgu.cs.funcscan.Module.CP> getCallers(boolean vars, boolean sort) throws FileNotFoundException
vars
- if true
find variables, otherwise find functionssort
- if true
, sort the result by function/variable names
FileNotFoundException
public Collection<Module> getModules() throws FileNotFoundException
FileNotFoundException
public static void redirectErrors(InputStream is)
is
- stream to read.public static String extractFuncDef(String name, String code)
name
- the name of the function to findcode
- the source code, which contains the function incl. its body
null
if not found or the appropriate code snippet
code not be parsed, the function definition otherwise.getDefinition(boolean, String, Module)
public String getDefinition(boolean isVar, String name, Module module)
If necessary, this method invokes the C pre-processor as 'cc -E' and the pre-processor flags given in the constructor of this instance. If cc is not a Sun Studio C compiler, one should set the isGnu flag in the workers constructor (otherwise the worker will find almost nothing).
Since source file scanning is based on a 90:10 is good enough approach, the scanner will not find complex or tricky definitions like function pointers parameters.
isVar
- if true
the given name is assumed to be a
variable name, a function name otherwise.name
- the name of the function or variable in questionmodule
- the module, which owns this global function or variable.
null
if the name or module is null
.
Otherwise an empty string, if the source code could not be found or
pre-processed or the definition could not be found, the definition
otherwise.public static void destroy()
|
funcscan Version 1.0.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |