DebuggingAJavaFXProgram
Debugging a JavaFX program
==
Document Status | Permanently Updated. | Top-level document | JavaFXPlugin |
---|
Introduction
This document is intended to collect and track ideas about the Debugger Feature of the JavaFX Plugin for the NetBeans IDE. It will be used as a source for the Debugger Feature Specification. It is also used for refining the Debugger Feature Requirements.
Note: The Java SE platform, version 5.0 MUST BE used as a lowest demonstrator for the Debugger feature of the JavaFX Plugin.
Debugging process
Debugging is a part of the the software development process. Debugging may be performed after some Quality Assurance (QA) activity that showed a negative result. Also, the Debugging process may be initiated by the developer. In this case, the developer will use own expectations instead of the formal requirements.
Context of the Debugging process
}}commentbox The IDEF0 approach is used to describe the Context of the Debugging process. }}
IDEF0 Diagram - A0:Debugging Process
Inputs
- Application
- application under debug that has runnable status. The application may be compiled with the debug info. In case the interpretable language (script language) is used to describe a program, the interpreter should be used in a role of the application.
- DCP - Debug Configuration Profile
- an informational profile that is used to configure the application before starting it in the debug mode.
- Application sources
- all sources of the application that have been used in building the application. It can be optional if disassembling is supported.
- Sources of libraries (optional)
- Sources of libraries that are used in the Application
- Test program (optional)
- a program that is used to run the Application
- Test data (optional)
- data that is used as the input data for the Application
Controls
- Commands of a developer
Outputs
- Source Model View in debug mode
- integrates info about sources.
- Execution (Control Flow) Model View
- integrates info about execution mode and control flow, i.e. displays traces of program execution.
- Breakpoints View
- shows info about custom breakpoints.
- Threads Model View
- shows info about debugging sessions (i.e native processes under debug) and the threads in the scopes of these sessions.
- Data Model View
- integrates info about data flow and data evaluation
- Goal Model View
- integrates info about a business target of the application under debugging
Mechanisms
- A debugger (tool/application/software system/software&hardware system)
- Test framework (optional)
Java SE Debugging
The Java technology offers two interaction levels with a target VM on the Java SE platform: Native level and Java level.
Resources:
- Java Platform Debugger Architecture (JPDA) on the java.sun.com
- Java(tm) Debug Wire Protocol The (JDWP) is the protocol used for communication between a debugger and the Java virtual machine (VM) which it debugs (hereafter called the target VM).
- Sun VM Invocation Options for debugging
Native level
We need take into account:
- JVM TI may not be available in all implementations of the Java(tm) virtual machine.
- JVM TI was introduced in J2SE 5.0 and replaced JVMDI and JVMPI.
- JVMDI was removed in Java SE 6 and JVMPI will be removed in Java SE 7.
Resources:
Java level
- Java(tm) Debug Interface (JDI) is a high level Java API providing information useful for debuggers and similiar systems needing access to the running state of a (usually remote) virtual machine.
Resources:
JVM Implementation
Java SE Debugging in the NetBeans IDE
Modules:
- debuggercore Debugger Core - Debugger APIs, UI and infrastructure
- debuggerjpda JPDA Debugger Implementation Plug-In
- debuggertools
[Obsolete]
JDK1.1 (sun.tools.debug.*) Debugger Impl. Plug-In
Resources:
Java ME Debugging in the NetBeans IDE
Resources:
- JavaFX Mobile on the java.sun.com
- Get started with On-device Debugging for NetBeans
JavaFX Debugging vs. Java SE Debugging
Resources:
- Article Using JavaFX Script Objects in Java Programs by Michael Heinrichs, May 2008 on the Sun Developer Network (SDN) site.
Subjects of debugging
In both cases (Java and JavaFX), a JVM is the native application under debug.
There are the following subjects of debugging on the Java level:
Subject | Java | JavaFX |
---|---|---|
Set of the related Java classes | * pure Java app/lib | * pure JavaFX app and JavaFX+Java lib * stand-alone JavaFX script |
Stand-alone Java class | * Main class, * Any class + Main test class/framework | XXXXXX |
Entry points
Java | JavaFX |
---|---|
The public static void main(String [[[ | []] args) method in the public class | A first executable moduleItem in the JavaFX script, i.e. either statement or expression. See the ANTLR grammar of the JavaFX language. |
Script Context
The Script Context is established by the JSR 223: Scripting for the JavaTM Platform API as the interface javax.script.ScriptContext. According to the specification each script has own context. Script context provides accessibility of entities from inside of the script, including:
- Set of Attributes. Attribute is the named Java object, whose name is String.
- Set of Bindings. Bindings is the mapping of key/value pairs, all of whose keys are Strings, i.e it is a set of the named Java objects.
- Error Writer - a Writer used to display error output.
- Reader - a Reader to be used by the script to read input.
- Writer - a Writer for scripts to use when displaying output.
Both Attributes and Bindings are associated with a scope. Each scope is identified by the int value. There are two predefined scopes ENGINE_SCOPE (int value = 100) and GLOBAL_SCOPE (int value = 200). There are no way to find symbolic names for other user-defined scopes.
There are predefined names that are defined as Java language String constants in the interface javax.script.ScriptEngine:
Java Constant Name | Java Constant Value | Comments |
---|---|---|
ARGV | "javax.script.argv" | an array of positional arguments that are passed to a script. |
ENGINE | "javax.script.engine" | the name of the ScriptEngine implementation. |
ENGINE_VERSION | "javax.script.engine_version" | the version of the ScriptEngine implementation. |
FILENAME | "javax.script.filename" | the name of the file being executed. |
LANGUAGE | "javax.script.language" | the full name of Scripting Language supported by the implementation. |
LANGUAGE_VERSION | "javax.script.language_version" | the version of the scripting language supported by the implementation. |
NAME | "javax.script.name" | the short name of the scripting language. The name is used by the ScriptEngineManager to locate a ScriptEngine with a given name in the getEngineByName method. |
Also, there are pseudo-variables generated by the JavaFX Script compiler:
JavaFX Constant Name | Comments |
---|---|
'''DIR''' | A URL of the directory where the JavaFX module {.class} file is placed. This value is based on the value of the __FILE__ pseudo-variable. The expression new java.net.URL(__FILE__, ".") is used to calculate that value (See specification of the constructor URL(URL context, String spec)). |
'''FILE''' | A URL of the JavaFX module {.class} file. |
'''ARGS''' | A sequence of positional arguments that are passed to a script. Note, elements of the sequence are the same as elements of the array ARGV that is mentioned in the previous table. |
JSR 45
JavaFX Script Language and JavaFX Programs
Resources:
Debugging a program written on a object-oriented language
Debugging a program written on a declarative language
Debugging human interfaces of the JavaFX Programs
Debugging a GUI
- View of the GUI Components. The view lets to investigate hierarchical trees of the GUI components, including their properties and relations.
- Event log.
- User action recorder.
- User action generator. Should be possible to synchronize the generator with the GUI preview.
Debugging an Audio UI
Debugging a Voice UI
Resources: Voice User Interface (VUI)
Debugging a JavaFX program on other Java platforms
Java ME
Java TV
Debugging Complex Strings
Debugging Triggers
Debugging Binding
Debugging a Program with Loadable Recourses
Debugging Threads
Debugging Remote Application
Debugging Distributed Application
Proposing Solutions
Related Documents
- #1 How do I debug an applet?
- #2 How can I run/debug a program in NetBeans with certain environment variables set to necessary values?
- #3 How can I run/debug a program in NetBeans with certain Java system properties set to certain values?
- #4 Debugging NetBeans with the NetBeans debugger
- #5 NetBeans Debugger Project
- #6 Java Platform Debugger Architecture - FAQs
- #7 JSR 45: Debugging Support for Other Languages This specification establishes standardized tools for correlating JavaTM virtual machine byte code to source code of languages other than the JavaTM programming language.
- #8 JSR 292: Supporting Dynamically Typed Languages on the JavaTM Platform Add a new bytecode, invokedynamic, that supports efficient and flexible execution of method invocations in the absence of static type information.