Class ThreadTracer
java.lang.Object
edu.berkeley.cs.jqf.instrument.tracing.ThreadTracer
This class is responsible for tracing for an instruction stream
generated by a single thread in the application.
A ThreadTracer instance processes low-level bytecode instructions
instrumented by JQF/Janala and converts them into appropriate
TraceEvent instances, which are then emitted to be processed
by the guidance-provided callback.
- Author:
- Rohan Padhye
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Consumer<TraceEvent> protected RuntimeExceptionprotected final Stringprotected final Stringprotected final Thread -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedThreadTracer(Thread tracee, String entryPoint, Consumer<TraceEvent> callback) Creates a new tracer that will process instructions executed by an application thread. -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidconsume(Instruction ins) Handles tracing of a single bytecode instruction.protected final voidemit(TraceEvent e) Emits a trace event to be consumed by the registered callback.protected static ThreadTracerSpawns a thread tracer for the given thread.
-
Field Details
-
tracee
-
entryPointClass
-
entryPointMethod
-
callback
-
callBackException
-
-
Constructor Details
-
ThreadTracer
Creates a new tracer that will process instructions executed by an application thread.- Parameters:
tracee- the thread to traceentryPoint- the outermost method call to trace (formatted as fq-class#method)callback- the callback to invoke whenever a trace event is emitted
-
-
Method Details
-
spawn
Spawns a thread tracer for the given thread.- Parameters:
thread- the thread to trace- Returns:
- a tracer for the given thread
-
emit
Emits a trace event to be consumed by the registered callback.- Parameters:
e- the event to emit
-
consume
Handles tracing of a single bytecode instruction.- Parameters:
ins- the instruction to process
-