Asking help to find tips on JShell source code parsing
Nazzareno Sileno
nazzareno.sileno at gmail.com
Tue Aug 29 08:44:41 UTC 2017
Hi Robert,
at first I would say thank you very much for the hints and sorry for the
delay in response but this is an activity that I can do in my spare time.
I saw your signature in the head of some execution engine source files!
I am trying to apply your suggestions. I wrote few lines of code and I am
trying to follow the code execution using the Netbeans debugger. I want to
analyze the code execution to learn something of usefull to reach my goals.
I am using the *JDIExecutionControl *component, it seems that every time a
single JShell instruction is executed the method *String invoke(String
classname, String methodname)* is called. The *invoke *method sends the
invoke command to a remote agent.
I have found the JShell test code at this link:
http://hg.openjdk.java.net/jdk9/jdk9/langtools/file/65bfdabaab9c/test/jdk/jshell
and I am studying it looking for something of usefull.
At this moment I am trying to launch a local java debugger instance (*java
-agentlib:jdwp=transport=dt_socket,server=y,suspend=y*) to analyze the
execution, I want to test the received data input coming from the
*JDIExecutionControl
*component. The next target should be to write a *JDIExecutonControl *extension
class customizing the invoke method. The new method should be capable of
produce the command beans. The use of the JDI API should be fundamental in
tracking the code execution and catching the desidered elements. Is it
right? I downloaded the JDI demo code
https://docs.oracle.com/javase/8/docs/technotes/guides/jpda/examples.html
looking for existing JDI java code examples as you previously suggested.
I must study in deep the *JDIExecutionControl *component's invoke method
behaviour. I am not completely aware of the full data set used to send
information to the remote JDI and how it can be sufficient to track the
source code execution using the *JDI API*
For now I would say thank your for your time.
Regards
2017-08-24 19:24 GMT+02:00 Robert Field <robert.field at oracle.com>:
> Hi,
>
> Right, Snippets give static information and SnippetEvents give execution
> results, while, if I am understanding correctly, you are looking for
> execution tracing. Execution is in compiled code rather than source,
> although it can be tied back to source.
>
> The debugger architecture provides functionality for tracing execution
> (the same functionality that is used for single step); Search for demos of
> tracing in JDI (there is one that was one of the original demos).
>
> The default execution engine for JShell is built on JDI. The
> idk.jshell.spi package provides a Service Provider Interface for
> configuring execution engines. The jdk.jshell.execution package provides
> execution engines and components. You could start from the default JDI
> engine and add tracing feeding to your JavaFX animation.
>
> Enjoy,
> Robert
>
>
>
>
> On August 24, 2017 9:37:25 AM Nazzareno Sileno <nazzareno.sileno at gmail.com>
> wrote:
>
> Hi all,
>> I'm trying to develop an educational tool that uses Jshell as a
>> programming
>> language. The tool must track the source code execution and it must
>> produce
>> commands. Commands are the inputs of the JavaFX 3D engine, they are used
>> to
>> transfer the minimal set of informations needed to reproduce the
>> animations
>> about the running source code. I want to use a consistent metaphor to
>> teach
>> the fundamental concepts about the procedural programming and the object
>> oriented programming.
>> I'm looking for something like a source code parser that I can use to
>> extract informations about the execution flow to fill the commands. In
>> particular I am interested in reproduce every single: declaration of
>> variable, expression evaluation, passing parameters operation, method
>> execution and termination, object creation, control flow statement, input
>> and output stream.
>> Could you suggest a solution to address these issues?
>>
>> The SnippetEvents are not enought to achieve the goal. They do not track
>> every single line of code execution. I need to symulate the source code
>> execution step-by-step.
>>
>>
>> --
>> Regards
>> Nazzareno Sileno
>>
>
>
>
--
Saluti
Nazzareno Sileno
More information about the kulla-dev
mailing list