diff options
104 files changed, 7085 insertions, 1433 deletions
diff --git a/docs/TCF Context Identifier Explanation.html b/docs/TCF Context Identifier Explanation.html index 79e5d09f4..956c56cf2 100644 --- a/docs/TCF Context Identifier Explanation.html +++ b/docs/TCF Context Identifier Explanation.html @@ -1,20 +1,20 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> - <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1251"> - <TITLE>TCF Context Identifier Explanation</TITLE> - <META NAME="GENERATOR" CONTENT="OpenOffice.org 2.2 (Win32)"> - <META NAME="CREATED" CONTENT="20070830;12134342"> - <META NAME="CHANGEDBY" CONTENT="Eugene Tarassov"> - <META NAME="CHANGED" CONTENT="20070830;12351368"> - <STYLE TYPE="text/css"> - <!-- - H1 { color: #000000 } - P { color: #000000 } - P.western { font-size: 13pt } - H2 { color: #000000 } - --> - </STYLE> + <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1251"> + <TITLE>TCF Context Identifier Explanation</TITLE> + <META NAME="GENERATOR" CONTENT="OpenOffice.org 2.2 (Win32)"> + <META NAME="CREATED" CONTENT="20070830;12134342"> + <META NAME="CHANGEDBY" CONTENT="Eugene Tarassov"> + <META NAME="CHANGED" CONTENT="20070830;12351368"> + <STYLE TYPE="text/css"> + <!-- + H1 { color: #000000 } + P { color: #000000 } + P.western { font-size: 13pt } + H2 { color: #000000 } + --> + </STYLE> </HEAD> <BODY LANG="en-US" TEXT="#000000" DIR="LTR"> <P CLASS="western" STYLE="border-top: none; border-bottom: 1.00pt solid #4f81bd; border-left: none; border-right: none; padding-top: 0in; padding-bottom: 0.06in; padding-left: 0in; padding-right: 0in"> diff --git a/docs/TCF Linux Agent Prototype.html b/docs/TCF Linux Agent Prototype.html index 50ec8e8fe..5d6ce24e6 100644 --- a/docs/TCF Linux Agent Prototype.html +++ b/docs/TCF Linux Agent Prototype.html @@ -1,19 +1,19 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> - <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1251"> - <TITLE>This is a brief description of the TCF Linux user-mode agent prototype implementation</TITLE> - <META NAME="GENERATOR" CONTENT="OpenOffice.org 2.2 (Win32)"> - <META NAME="CREATED" CONTENT="20070830;12381303"> - <META NAME="CHANGED" CONTENT="16010101;0"> - <STYLE TYPE="text/css"> - <!-- - H1 { color: #000000 } - P { color: #000000 } - P.western { font-size: 13pt } - H2 { color: #000000 } - --> - </STYLE> + <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1251"> + <TITLE>This is a brief description of the TCF Linux user-mode agent prototype implementation</TITLE> + <META NAME="GENERATOR" CONTENT="OpenOffice.org 2.2 (Win32)"> + <META NAME="CREATED" CONTENT="20070830;12381303"> + <META NAME="CHANGED" CONTENT="16010101;0"> + <STYLE TYPE="text/css"> + <!-- + H1 { color: #000000 } + P { color: #000000 } + P.western { font-size: 13pt } + H2 { color: #000000 } + --> + </STYLE> </HEAD> <BODY LANG="en-US" TEXT="#000000" DIR="LTR"> diff --git a/docs/TCF Service - System Monitor.html b/docs/TCF Service - System Monitor.html index 882e91094..fb9dbd1ed 100644 --- a/docs/TCF Service - System Monitor.html +++ b/docs/TCF Service - System Monitor.html @@ -503,7 +503,7 @@ R • <i><token></i> • <i><error report></i> • <i><array of string& <font color=#3F5FBF>/** Scheduling policy */</font> PROP_POLICY = "Policy"; - + <font color=#3F5FBF>/** * A context corresponds to an execution thread, process, address space, etc. * A context can belong to a parent context. Contexts hierarchy can be simple @@ -514,7 +514,7 @@ R • <i><token></i> • <i><error report></i> • <i><array of string& * attributes and functionality, which is relevant to that service. */</font> <font color=#7F0055>interface</font> SysMonitorContext { - + <font color=#3F5FBF>/** * Get context ID. * Same as getProperties().get(“ID”) diff --git a/examples/com.windriver.tcf.examples.daytime/.classpath b/examples/com.windriver.tcf.examples.daytime/.classpath new file mode 100644 index 000000000..021596729 --- /dev/null +++ b/examples/com.windriver.tcf.examples.daytime/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/examples/com.windriver.tcf.examples.daytime/.project b/examples/com.windriver.tcf.examples.daytime/.project new file mode 100644 index 000000000..48540c766 --- /dev/null +++ b/examples/com.windriver.tcf.examples.daytime/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>com.windriver.tcf.examples.daytime</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/examples/com.windriver.tcf.examples.daytime/META-INF/MANIFEST.MF b/examples/com.windriver.tcf.examples.daytime/META-INF/MANIFEST.MF new file mode 100644 index 000000000..922606346 --- /dev/null +++ b/examples/com.windriver.tcf.examples.daytime/META-INF/MANIFEST.MF @@ -0,0 +1,11 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Examples Plug-in +Bundle-SymbolicName: com.windriver.tcf.examples.daytime;singleton:=true +Bundle-Version: 0.2.0 +Bundle-Activator: com.windriver.tcf.examples.daytime.Activator +Bundle-Vendor: WINDRIVER +Require-Bundle: org.eclipse.core.runtime, + com.windriver.tcf.api +Eclipse-LazyStart: true +Export-Package: com.windriver.tcf.examples.daytime diff --git a/examples/com.windriver.tcf.examples.daytime/about.html b/examples/com.windriver.tcf.examples.daytime/about.html new file mode 100644 index 000000000..6c5b3615b --- /dev/null +++ b/examples/com.windriver.tcf.examples.daytime/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>January 10, 2008</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p> + +</body> +</html>
\ No newline at end of file diff --git a/examples/com.windriver.tcf.examples.daytime/build.properties b/examples/com.windriver.tcf.examples.daytime/build.properties new file mode 100644 index 000000000..2d5759904 --- /dev/null +++ b/examples/com.windriver.tcf.examples.daytime/build.properties @@ -0,0 +1,6 @@ +source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html
diff --git a/examples/com.windriver.tcf.examples.daytime/plugin.xml b/examples/com.windriver.tcf.examples.daytime/plugin.xml new file mode 100644 index 000000000..649ea70dc --- /dev/null +++ b/examples/com.windriver.tcf.examples.daytime/plugin.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.2"?> +<plugin> + + <extension point="com.windriver.tcf.api.startup">
+ <class name="com.windriver.tcf.examples.daytime.DaytimeServiceProxy"/> + </extension>
+ +</plugin> diff --git a/examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/Activator.java b/examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/Activator.java new file mode 100644 index 000000000..1b1ff794e --- /dev/null +++ b/examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/Activator.java @@ -0,0 +1,49 @@ +package com.windriver.tcf.examples.daytime;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "com.windriver.tcf.examples";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+}
diff --git a/examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/DaytimeServiceProxy.java b/examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/DaytimeServiceProxy.java new file mode 100644 index 000000000..2bf385471 --- /dev/null +++ b/examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/DaytimeServiceProxy.java @@ -0,0 +1,63 @@ +package com.windriver.tcf.examples.daytime;
+
+import com.windriver.tcf.api.core.Command;
+import com.windriver.tcf.api.protocol.IChannel;
+import com.windriver.tcf.api.protocol.IToken;
+import com.windriver.tcf.api.protocol.Protocol;
+
+public class DaytimeServiceProxy implements IDaytimeService {
+
+ private final IChannel channel;
+
+ DaytimeServiceProxy(IChannel channel) {
+ this.channel = channel;
+ }
+
+ /**
+ * Return service name, as it appears on the wire - a TCF name of the service.
+ */
+ public String getName() {
+ return NAME;
+ }
+
+ /**
+ * The method translates arguments to JSON string and sends the command message
+ * to remote server. When response arrives, it is translated from JSON to
+ * Java object, which are used to call call-back object.
+ *
+ * The translation (marshaling) is done by using utility class Command.
+ */
+ public IToken getTimeOfDay(String tz, final DoneGetTimeOfDay done) {
+ return new Command(channel, this, "getTimeOfDay", new Object[]{ tz }) {
+ @Override
+ public void done(Exception error, Object[] args) {
+ String str = null;
+ if (error == null) {
+ assert args.length == 3;
+ error = toError(args[0], args[1]);
+ str = (String)args[2];
+ }
+ done.doneGetTimeOfDay(token, error, str);
+ }
+ }.token;
+ }
+
+ static {
+ /*
+ * Make Daytime Service proxy available to all potential clients by creating
+ * the proxy object every time a TCF communication channel is opened.
+ * Note: extension point "com.windriver.tcf.api.startup" is used to load this class
+ * at TCF startup time, so proxy factory is properly activated even if nobody
+ * import directly from this plugin.
+ */
+ Protocol.addChannelOpenListener(new Protocol.ChannelOpenListener() {
+
+ public void onChannelOpen(IChannel channel) {
+ // Check if remote server provides Daytime service
+ if (channel.getRemoteService(IDaytimeService.NAME) == null) return;
+ // Create service proxy
+ channel.setServiceProxy(IDaytimeService.class, new DaytimeServiceProxy(channel));
+ }
+ });
+ }
+}
diff --git a/examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/IDaytimeService.java b/examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/IDaytimeService.java new file mode 100644 index 000000000..a8cf242fe --- /dev/null +++ b/examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/IDaytimeService.java @@ -0,0 +1,42 @@ +package com.windriver.tcf.examples.daytime;
+
+import com.windriver.tcf.api.protocol.IService;
+import com.windriver.tcf.api.protocol.IToken;
+
+/**
+ * IDaytimeService allows retrieving the time of day from a remote system.
+ */
+public interface IDaytimeService extends IService {
+
+ /**
+ * This service name, as it appears on the wire - a TCF name of the service.
+ */
+ public static final String NAME = "Daytime";
+
+ /**
+ * Retrieve the time of day from remote system.
+ * The method sends the command to remote server and returns -
+ * it does not wait for the server response. Instead a client should provide
+ * a call-back object that will be called when the server answers the command
+ * or when the command is aborted by communication error.
+ * @param tz - time zone name.
+ * @param done - a call-back object.
+ * @return a handle for the pending command. The handle can be used to cancel the command,
+ * and to match responses to requests - if same call-back object is used for
+ * multiple requests.
+ */
+ IToken getTimeOfDay(String tz, DoneGetTimeOfDay done);
+
+ /**
+ * Call-back interface for getTimeOfDay() command.
+ */
+ interface DoneGetTimeOfDay {
+ /**
+ * This method is called when getTimeOfDay() command is completed.
+ * @param token - pending command handle.
+ * @param error - null if the command is successful.
+ * @param str - a String of the form "01 MAR 2006 11:25:12 CET"
+ */
+ void doneGetTimeOfDay(IToken token, Exception error, String str);
+ }
+}
diff --git a/plugins/com.windriver.debug.tcf.core/.classpath b/plugins/com.windriver.debug.tcf.core/.classpath index 751c8f2e5..304e86186 100644 --- a/plugins/com.windriver.debug.tcf.core/.classpath +++ b/plugins/com.windriver.debug.tcf.core/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/plugins/com.windriver.debug.tcf.core/.settings/org.eclipse.jdt.core.prefs b/plugins/com.windriver.debug.tcf.core/.settings/org.eclipse.jdt.core.prefs index f06d39b5d..0bf81e2f5 100644 --- a/plugins/com.windriver.debug.tcf.core/.settings/org.eclipse.jdt.core.prefs +++ b/plugins/com.windriver.debug.tcf.core/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,4 @@ -#Mon Sep 10 12:24:12 PDT 2007 +#Tue Feb 05 15:38:16 CET 2008 eclipse.preferences.version=1 org.eclipse.jdt.core.builder.cleanOutputFolder=clean org.eclipse.jdt.core.builder.duplicateResourceTask=warning @@ -8,6 +8,265 @@ org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,.svn/ org.eclipse.jdt.core.circularClasspath=error org.eclipse.jdt.core.classpath.exclusionPatterns=enabled org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=1 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=80 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error diff --git a/plugins/com.windriver.debug.tcf.core/.settings/org.eclipse.jdt.ui.prefs b/plugins/com.windriver.debug.tcf.core/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..2a1f92d89 --- /dev/null +++ b/plugins/com.windriver.debug.tcf.core/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,4 @@ +#Mon Jan 07 15:38:24 PST 2008
+eclipse.preferences.version=1
+formatter_profile=_Java STD
+formatter_settings_version=11
diff --git a/plugins/com.windriver.debug.tcf.core/META-INF/MANIFEST.MF b/plugins/com.windriver.debug.tcf.core/META-INF/MANIFEST.MF index 46a4bff9e..bb5e7240d 100644 --- a/plugins/com.windriver.debug.tcf.core/META-INF/MANIFEST.MF +++ b/plugins/com.windriver.debug.tcf.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: com.windriver.debug.tcf.core;singleton:=true -Bundle-Version: 0.1.0 +Bundle-Version: 0.2.0 Bundle-Activator: com.windriver.debug.tcf.core.TCFCore Bundle-Vendor: %providerName Require-Bundle: org.eclipse.core.runtime, @@ -10,6 +10,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.core.resources, com.windriver.tcf.api Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ActivationPolicy: lazy Eclipse-LazyStart: true -Export-Package: com.windriver.debug.tcf.core.model, - com.windriver.debug.tcf.core.launch +Export-Package: com.windriver.debug.tcf.core, + com.windriver.debug.tcf.core.launch, + com.windriver.debug.tcf.core.model diff --git a/plugins/com.windriver.debug.tcf.core/build.properties b/plugins/com.windriver.debug.tcf.core/build.properties index e9863e281..1f9e1f7be 100644 --- a/plugins/com.windriver.debug.tcf.core/build.properties +++ b/plugins/com.windriver.debug.tcf.core/build.properties @@ -2,4 +2,8 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ - plugin.xml + plugin.xml,\ + about.html,\ + plugin.properties +src.includes = schema/,\ + about.html diff --git a/plugins/com.windriver.debug.tcf.core/plugin.xml b/plugins/com.windriver.debug.tcf.core/plugin.xml index 1a9590a32..f28e8659f 100644 --- a/plugins/com.windriver.debug.tcf.core/plugin.xml +++ b/plugins/com.windriver.debug.tcf.core/plugin.xml @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.2"?> <plugin> - <extension-point id="startup" name="TCF Startup" schema="schema/startup.exsd"/> <extension point="org.eclipse.debug.core.breakpoints"> <breakpoint diff --git a/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/TCFCore.java b/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/TCFCore.java index e4ffe006d..ca6c4eab8 100644 --- a/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/TCFCore.java +++ b/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/TCFCore.java @@ -10,11 +10,7 @@ *******************************************************************************/ package com.windriver.debug.tcf.core; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Status; import org.osgi.framework.BundleContext; @@ -41,7 +37,6 @@ public class TCFCore extends Plugin { public void start(BundleContext context) throws Exception { super.start(context); bp_model = new TCFBreakpointsModel(); - runTCFStartup(); } @Override @@ -52,31 +47,6 @@ public class TCFCore extends Plugin { super.stop(context); } - private void runTCFStartup() { - try { - IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(PLUGIN_ID, "startup"); - IExtension[] extensions = point.getExtensions(); - for (int i = 0; i < extensions.length; i++) { - try { - Platform.getBundle(extensions[i].getNamespaceIdentifier()).start(); - IConfigurationElement[] e = extensions[i].getConfigurationElements(); - for (int j = 0; j < e.length; j++) { - String nm = e[j].getName(); - if (nm.equals("class")) { //$NON-NLS-1$ - Class.forName(e[j].getAttribute("name")); //$NON-NLS-1$ - } - } - } - catch (Throwable x) { - log("TCF startup error", x); - } - } - } - catch (Exception x) { - log("TCF startup error", x); - } - } - /** * Returns the shared instance * @@ -96,7 +66,12 @@ public class TCFCore extends Plugin { * @param err - exception */ public static void log(String msg, Throwable err) { - getDefault().getLog().log(new Status(IStatus.ERROR, - getDefault().getBundle().getSymbolicName(), IStatus.OK, msg, err)); + if (plugin == null || plugin.getLog() == null) { + err.printStackTrace(); + } + else { + plugin.getLog().log(new Status(IStatus.ERROR, + plugin.getBundle().getSymbolicName(), IStatus.OK, msg, err)); + } } } diff --git a/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/model/ITCFBreakpointListener.java b/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/model/ITCFBreakpointListener.java index a78f8127f..a5f1eb8f4 100644 --- a/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/model/ITCFBreakpointListener.java +++ b/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/model/ITCFBreakpointListener.java @@ -13,4 +13,5 @@ package com.windriver.debug.tcf.core.model; public interface ITCFBreakpointListener { public void breakpointStatusChanged(String id); + public void breakpointRemoved(String id); } diff --git a/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/model/TCFBreakpointsModel.java b/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/model/TCFBreakpointsModel.java index a1998a9e2..9269368f0 100644 --- a/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/model/TCFBreakpointsModel.java +++ b/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/model/TCFBreakpointsModel.java @@ -37,72 +37,16 @@ import com.windriver.tcf.api.protocol.IToken; import com.windriver.tcf.api.protocol.Protocol; import com.windriver.tcf.api.services.IBreakpoints; +/** + * TCFBreakpointsModel class handles breakpoints for all active TCF launches. + * It downloads initial set of breakpoint data when launch is activated, + * listens for Eclipse breakpoint manager events and propagates breakpoint changes to TCF targets. + */ public class TCFBreakpointsModel implements IBreakpointListener, IBreakpointManagerListener { private static final String PROP_ID = "ID"; private final IBreakpointManager bp_manager = DebugPlugin.getDefault().getBreakpointManager(); - private abstract class BreakpointUpdate implements Runnable { - - private final ILaunch[] launches; - private final Map<String,Object> marker_attrs; - private final String marker_file; - - IBreakpoints service; - IBreakpoints.DoneCommand done; - Map<String,Object> tcf_attrs; - - @SuppressWarnings("unchecked") - BreakpointUpdate(IBreakpoint breakpoint) throws CoreException, IOException { - if (breakpoint == null) { - marker_attrs = null; - marker_file = null; - } - else { - marker_attrs = new HashMap<String,Object>(breakpoint.getMarker().getAttributes()); - marker_file = getFilePath(breakpoint.getMarker().getResource()); - } - launches = DebugPlugin.getDefault().getLaunchManager().getLaunches(); - } - - synchronized void exec() throws InterruptedException { - assert !Protocol.isDispatchThread(); - Protocol.invokeLater(this); - wait(); - } - - public void run() { - if (marker_attrs != null) { - tcf_attrs = toBreakpointAttributes(marker_file, marker_attrs); - } - for (int i = 0; i < launches.length; i++) { - if (launches[i] instanceof TCFLaunch) { - TCFLaunch launch = (TCFLaunch)launches[i]; - final IChannel channel = launch.getChannel(); - if (channel == null) continue; - if (channel.getState() != IChannel.STATE_OPEN) continue; - service = channel.getRemoteService(IBreakpoints.class); - if (service == null) continue; - done = new IBreakpoints.DoneCommand() { - public void doneCommand(IToken token, Exception error) { - if (error != null) channel.terminate(error); - } - }; - update(); - } - } - Protocol.sync(new Runnable() { - public void run() { - synchronized (BreakpointUpdate.this) { - BreakpointUpdate.this.notify(); - } - } - }); - }; - - abstract void update(); - } - public TCFBreakpointsModel() { bp_manager.addBreakpointListener(this); bp_manager.addBreakpointManagerListener(this); @@ -113,6 +57,11 @@ public class TCFBreakpointsModel implements IBreakpointListener, IBreakpointMana bp_manager.removeBreakpointManagerListener(this); } + public boolean isSupported(IChannel channel, IBreakpoint bp) { + // TODO implement per-channel breakpoint filtering + return true; + } + @SuppressWarnings("unchecked") public void downloadBreakpoints(final IChannel channel, final Runnable done) throws IOException, CoreException { @@ -123,6 +72,7 @@ public class TCFBreakpointsModel implements IBreakpointListener, IBreakpointMana if (arr != null && arr.length > 0) { Map<String,Object>[] bps = new Map[arr.length]; for (int i = 0; i < arr.length; i++) { + if (!isSupported(channel, arr[i])) continue; IMarker marker = arr[i].getMarker(); String file = getFilePath(marker.getResource()); bps[i] = toBreakpointAttributes(file, marker.getAttributes()); @@ -143,32 +93,125 @@ public class TCFBreakpointsModel implements IBreakpointListener, IBreakpointMana try { IBreakpoint[] arr = bp_manager.getBreakpoints(ITCFConstants.ID_TCF_DEBUG_MODEL); if (arr == null || arr.length == 0) return; - final Set<String> ids = new HashSet<String>(); + final Map<String,IBreakpoint> map = new HashMap<String,IBreakpoint>(); for (int i = 0; i < arr.length; i++) { IMarker marker = arr[i].getMarker(); Boolean b = marker.getAttribute(IBreakpoint.ENABLED, Boolean.FALSE); if (!b.booleanValue()) continue; - ids.add(marker.getAttribute( - ITCFConstants.ID_TCF_DEBUG_MODEL + '.' + IBreakpoints.PROP_ID, (String)null)); + String id = marker.getAttribute(ITCFConstants.ID_TCF_DEBUG_MODEL + + '.' + IBreakpoints.PROP_ID, (String)null); + map.put(id, arr[i]); } - if (ids.isEmpty()) return; - new BreakpointUpdate(null) { - @Override - void update() { - if (enabled) { - service.enable(ids.toArray(new String[ids.size()]), done); - } - else { - service.disable(ids.toArray(new String[ids.size()]), done); + if (map.isEmpty()) return; + final ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches(); + Runnable r = new Runnable() { + public void run() { + for (int i = 0; i < launches.length; i++) { + if (launches[i] instanceof TCFLaunch) { + TCFLaunch launch = (TCFLaunch)launches[i]; + final IChannel channel = launch.getChannel(); + if (channel == null) continue; + if (channel.getState() != IChannel.STATE_OPEN) continue; + IBreakpoints service = channel.getRemoteService(IBreakpoints.class); + if (service == null) continue; + Set<String> ids = new HashSet<String>(); + for (String id : map.keySet()) { + IBreakpoint bp = map.get(id); + if (isSupported(channel, bp)) ids.add(id); + } + IBreakpoints.DoneCommand done = new IBreakpoints.DoneCommand() { + public void doneCommand(IToken token, Exception error) { + if (error != null) channel.terminate(error); + } + }; + if (enabled) { + service.enable(ids.toArray(new String[ids.size()]), done); + } + else { + service.disable(ids.toArray(new String[ids.size()]), done); + } + } } + Protocol.sync(new Runnable() { + public void run() { + synchronized (map) { + map.notify(); + } + } + }); } - }.exec(); + }; + synchronized (map) { + assert !Protocol.isDispatchThread(); + Protocol.invokeLater(r); + map.wait(); + } } catch (Throwable x) { TCFCore.log("Unhandled exception in breakpoint listener", x); } } + private abstract class BreakpointUpdate implements Runnable { + + private final IBreakpoint breakpoint; + private final ILaunch[] launches; + private final Map<String,Object> marker_attrs; + private final String marker_file; + + IBreakpoints service; + IBreakpoints.DoneCommand done; + Map<String,Object> tcf_attrs; + + @SuppressWarnings("unchecked") + BreakpointUpdate(IBreakpoint breakpoint) throws CoreException, IOException { + this.breakpoint = breakpoint; + marker_attrs = new HashMap<String,Object>(breakpoint.getMarker().getAttributes()); + marker_file = getFilePath(breakpoint.getMarker().getResource()); + launches = DebugPlugin.getDefault().getLaunchManager().getLaunches(); + } + + synchronized void exec() throws InterruptedException { + assert !Protocol.isDispatchThread(); + Protocol.invokeLater(this); + wait(); + } + + public void run() { + tcf_attrs = toBreakpointAttributes(marker_file, marker_attrs); + for (int i = 0; i < launches.length; i++) { + if (launches[i] instanceof TCFLaunch) { + final TCFLaunch launch = (TCFLaunch)launches[i]; + final IChannel channel = launch.getChannel(); + if (channel == null) continue; + if (channel.getState() != IChannel.STATE_OPEN) continue; + service = channel.getRemoteService(IBreakpoints.class); + if (service == null) continue; + if (!isSupported(channel, breakpoint)) continue; + done = new IBreakpoints.DoneCommand() { + public void doneCommand(IToken token, Exception error) { + if (error != null) channel.terminate(error); + else done(launch); + } + }; + update(); + } + } + Protocol.sync(new Runnable() { + public void run() { + synchronized (BreakpointUpdate.this) { + BreakpointUpdate.this.notify(); + } + } + }); + }; + + void done(TCFLaunch launch) { + } + + abstract void update(); + } + private String getFilePath(IResource resource) throws IOException { if (resource == ResourcesPlugin.getWorkspace().getRoot()) return null; IPath p = resource.getRawLocation(); @@ -250,6 +293,10 @@ public class TCFBreakpointsModel implements IBreakpointListener, IBreakpointMana void update() { service.remove(new String[]{ (String)tcf_attrs.get(PROP_ID) }, done); } + @Override + void done(TCFLaunch launch) { + launch.getBreakpointsStatus().removeStatus((String)tcf_attrs.get(PROP_ID)); + } }.exec(); } catch (Throwable x) { diff --git a/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/model/TCFBreakpointsStatus.java b/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/model/TCFBreakpointsStatus.java index a9a6cb735..a0a5f74cc 100644 --- a/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/model/TCFBreakpointsStatus.java +++ b/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/model/TCFBreakpointsStatus.java @@ -27,6 +27,7 @@ public class TCFBreakpointsStatus { private final IBreakpoints service; private final Map<String,Map<String,Object>> status = new HashMap<String,Map<String,Object>>(); private final Set<ITCFBreakpointListener> listeners = new HashSet<ITCFBreakpointListener>(); + private final Set<String> removed = new HashSet<String>(); private static final Map<String,Object> status_not_supported = new HashMap<String,Object>(); @@ -42,6 +43,7 @@ public class TCFBreakpointsStatus { public void breakpointStatusChanged(String id, Map<String, Object> status) { assert Protocol.isDispatchThread(); + if (removed.contains(id)) return; TCFBreakpointsStatus.this.status.put(id, status); for (Iterator<ITCFBreakpointListener> i = listeners.iterator(); i.hasNext();) { i.next().breakpointStatusChanged(id); @@ -66,6 +68,14 @@ public class TCFBreakpointsStatus { ITCFConstants.ID_TCF_DEBUG_MODEL + '.' + IBreakpoints.PROP_ID, null)); } + public void removeStatus(String id) { + status.remove(id); + removed.add(id); + for (Iterator<ITCFBreakpointListener> i = listeners.iterator(); i.hasNext();) { + i.next().breakpointRemoved(id); + } + } + public void addListener(ITCFBreakpointListener listener) { assert Protocol.isDispatchThread(); listeners.add(listener); diff --git a/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/model/TCFLaunch.java b/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/model/TCFLaunch.java index a7a07eda7..4bf23c955 100644 --- a/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/model/TCFLaunch.java +++ b/plugins/com.windriver.debug.tcf.core/src/com/windriver/debug/tcf/core/model/TCFLaunch.java @@ -37,7 +37,7 @@ public class TCFLaunch extends Launch { public interface Listener { - public void onConnected(TCFLaunch launch); + public void onConnected(TCFLaunch launch); public void onDisconnected(TCFLaunch launch); @@ -80,12 +80,12 @@ public class TCFLaunch extends Launch { public void run() { if (channel.getState() != IChannel.STATE_OPEN) return; breakpoints_status = new TCFBreakpointsStatus(TCFLaunch.this); - downloadApplication(done); + runLaunchSequence(done); } }); } else { - downloadApplication(done); + runLaunchSequence(done); } } catch (Exception x) { @@ -94,7 +94,7 @@ public class TCFLaunch extends Launch { } @SuppressWarnings("unchecked") - protected void downloadApplication(final Runnable done) { + protected void runLaunchSequence(final Runnable done) { try { ILaunchConfiguration cfg = getLaunchConfiguration(); final String file = cfg.getAttribute(TCFLaunchDelegate.ATTR_PROGRAM_FILE, ""); diff --git a/plugins/com.windriver.debug.tcf.ui/.classpath b/plugins/com.windriver.debug.tcf.ui/.classpath index 03ba07a5f..34c64f6b9 100644 --- a/plugins/com.windriver.debug.tcf.ui/.classpath +++ b/plugins/com.windriver.debug.tcf.ui/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"> <accessrules> <accessrule kind="accessible" pattern="org/eclipse/debug/**/provisional/**"/> diff --git a/plugins/com.windriver.debug.tcf.ui/.cvsignore b/plugins/com.windriver.debug.tcf.ui/.cvsignore index ba077a403..092357e47 100644 --- a/plugins/com.windriver.debug.tcf.ui/.cvsignore +++ b/plugins/com.windriver.debug.tcf.ui/.cvsignore @@ -1 +1 @@ -bin +bin
diff --git a/plugins/com.windriver.debug.tcf.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/com.windriver.debug.tcf.ui/.settings/org.eclipse.jdt.core.prefs index 78e20524b..0bf81e2f5 100644 --- a/plugins/com.windriver.debug.tcf.ui/.settings/org.eclipse.jdt.core.prefs +++ b/plugins/com.windriver.debug.tcf.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,4 @@ -#Mon Sep 10 12:26:30 PDT 2007 +#Tue Feb 05 15:38:16 CET 2008 eclipse.preferences.version=1 org.eclipse.jdt.core.builder.cleanOutputFolder=clean org.eclipse.jdt.core.builder.duplicateResourceTask=warning @@ -8,6 +8,265 @@ org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,.svn/ org.eclipse.jdt.core.circularClasspath=error org.eclipse.jdt.core.classpath.exclusionPatterns=enabled org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=1 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=80 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error diff --git a/plugins/com.windriver.debug.tcf.ui/.settings/org.eclipse.jdt.ui.prefs b/plugins/com.windriver.debug.tcf.ui/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..12735e141 --- /dev/null +++ b/plugins/com.windriver.debug.tcf.ui/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,4 @@ +#Mon Jan 07 15:38:31 PST 2008
+eclipse.preferences.version=1
+formatter_profile=_Java STD
+formatter_settings_version=11
diff --git a/plugins/com.windriver.debug.tcf.ui/META-INF/MANIFEST.MF b/plugins/com.windriver.debug.tcf.ui/META-INF/MANIFEST.MF index 4743cd6da..5f3d130f8 100644 --- a/plugins/com.windriver.debug.tcf.ui/META-INF/MANIFEST.MF +++ b/plugins/com.windriver.debug.tcf.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: com.windriver.debug.tcf.ui;singleton:=true -Bundle-Version: 0.1.0 +Bundle-Version: 0.2.0 Bundle-Activator: com.windriver.debug.tcf.ui.TCFUI Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -13,6 +13,7 @@ Require-Bundle: org.eclipse.ui, com.windriver.debug.tcf.core, com.windriver.tcf.api Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ActivationPolicy: lazy Eclipse-LazyStart: true Export-Package: com.windriver.debug.tcf.ui.adapters, com.windriver.debug.tcf.ui.launch diff --git a/plugins/com.windriver.debug.tcf.ui/build.properties b/plugins/com.windriver.debug.tcf.ui/build.properties index bbc49de86..bd51a9b0f 100644 --- a/plugins/com.windriver.debug.tcf.ui/build.properties +++ b/plugins/com.windriver.debug.tcf.ui/build.properties @@ -3,5 +3,9 @@ output.. = bin/ bin.includes = META-INF/,\ .,\ plugin.xml,\ - bin/ + about.html,\ + plugin.properties,\ + icons/ +src.includes = about.html + diff --git a/plugins/com.windriver.debug.tcf.ui/plugin.xml b/plugins/com.windriver.debug.tcf.ui/plugin.xml index cc3b88d16..1b9952180 100644 --- a/plugins/com.windriver.debug.tcf.ui/plugin.xml +++ b/plugins/com.windriver.debug.tcf.ui/plugin.xml @@ -2,7 +2,7 @@ <?eclipse version="3.2"?> <plugin> - <extension point="com.windriver.debug.tcf.core.startup"/> + <extension point="com.windriver.tcf.api.startup"/> <extension id="com.windriver.debug.tcf.ui.adapters" diff --git a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/launch/TCFMainTab.java b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/launch/TCFMainTab.java index 3e9168d3c..fb5892060 100644 --- a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/launch/TCFMainTab.java +++ b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/launch/TCFMainTab.java @@ -331,6 +331,11 @@ public class TCFMainTab extends AbstractLaunchConfigurationTab { program_text = new Text(group, SWT.SINGLE | SWT.BORDER); program_text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); program_text.setFont(font); + program_text.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + updateLaunchConfigurationDialog(); + } + }); } @Override diff --git a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/launch/TCFSelfTest.java b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/launch/TCFSelfTest.java index 84208836d..65b7e5d03 100644 --- a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/launch/TCFSelfTest.java +++ b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/launch/TCFSelfTest.java @@ -60,6 +60,7 @@ class TCFSelfTest { private int count_total; private int count_done; + private boolean cancel; private boolean canceled; private boolean memory_lock; @@ -127,7 +128,7 @@ class TCFSelfTest { public void onChannelClosed(Throwable error) { channel.removeChannelListener(this); - if (error == null && (!active_tests.isEmpty() || !pending_tests.isEmpty())) { + if (error == null && (!active_tests.isEmpty() || !pending_tests.isEmpty()) && !cancel) { error = new IOException("Remote peer closed connection before all tests finished"); } int cnt = 0; @@ -160,6 +161,7 @@ class TCFSelfTest { } void cancel() { + cancel = true; if (canceled) return; for (final Test t : active_tests.keySet()) { if (t instanceof TestRCBP1) { @@ -265,6 +267,7 @@ class TCFSelfTest { private ISymbol func2; private ISymbol array; private int bp_cnt = 0; + private IToken cancel_test_cmd; private class SuspendedContext { final String id; @@ -319,12 +322,12 @@ class TCFSelfTest { } public void doneRunTest(IToken token, Throwable error, String context_id) { - assert active_tests.get(this) != null; - assert this.context_id == null; if (error != null) { exit(error); } else { + assert active_tests.get(this) != null; + assert this.context_id == null; this.context_id = context_id; if (pending_cancel != null) { Protocol.invokeLater(pending_cancel); @@ -341,12 +344,13 @@ class TCFSelfTest { @SuppressWarnings("unchecked") public void doneGetSymbol(IToken token, Throwable error, ISymbol symbol) { - assert active_tests.get(this) != null; - assert this.context_id != null; if (error != null) { exit(error); + return; } - else if (!symbol.isGlobal()) { + assert active_tests.get(this) != null; + assert this.context_id != null; + if (!symbol.isGlobal()) { exit(new Exception("Symbols 'tcf_test_*' must be global")); } else if (!symbol.isAbs()) { @@ -402,7 +406,7 @@ class TCFSelfTest { } public void doneGetContext(IToken token, Exception error, RunControlContext context) { - if (canceled) return; + if (cancel) return; if (error != null) { exit(error); } @@ -424,7 +428,7 @@ class TCFSelfTest { } public void doneGetChildren(IToken token, Exception error, String[] contexts) { - if (canceled) return; + if (cancel) return; if (error != null) { exit(error); } @@ -437,7 +441,7 @@ class TCFSelfTest { boolean suspended, String pc, String reason, Map<String, Object> params) { final String id = get_state_cmds.remove(token); - if (canceled) return; + if (cancel) return; if (id == null) { exit(new Exception("Invalid getState responce")); } @@ -522,7 +526,7 @@ class TCFSelfTest { exit(new Exception("Invalid contextAdded event")); return; } - if (context.getID().equals(contexts[i].getProperties().get("ParentID"))) { + if (context.getID().equals(contexts[i].getProperties().get(IRunControl.PROP_PROCESS_ID))) { threads.put(contexts[i].getID(), contexts[i]); running.add(contexts[i].getID()); } @@ -534,7 +538,7 @@ class TCFSelfTest { if (contexts[i].getID().equals(context.getID())) { context = contexts[i]; } - if (context.getID().equals(contexts[i].getProperties().get("ProcessID"))) { + if (context.getID().equals(contexts[i].getProperties().get(IRunControl.PROP_PROCESS_ID))) { threads.put(contexts[i].getID(), contexts[i]); } } @@ -547,7 +551,7 @@ class TCFSelfTest { } public void contextRemoved(String[] contexts) { - for (String id : contexts) { + for (String id : contexts) { if (suspended.get(id) != null) { exit(new Exception("Invalid contextRemoved event")); return; @@ -663,7 +667,7 @@ class TCFSelfTest { sc.resumed = true; ctx.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() { public void doneCommand(IToken token, Exception error) { - if (canceled) return; + if (cancel) return; if (active_tests.get(this) == null) return; if (threads.get(sc.id) == null) return; if (error != null) exit(error); @@ -687,8 +691,8 @@ class TCFSelfTest { if (!context_id.equals(mem_ctx.getID())) { exit(new Exception("Bad memory context data: invalid ID")); } - Object pid = context.getProperties().get("ProcessID"); - if (pid != null && !pid.equals(mem_ctx.getProperties().get("ProcessID"))) { + Object pid = context.getProperties().get(IRunControl.PROP_PROCESS_ID); + if (pid != null && !pid.equals(mem_ctx.getProperties().get(IMemory.PROP_PROCESS_ID))) { exit(new Exception("Bad memory context data: invalid ProcessID")); } final boolean big_endian = mem_ctx.isBigEndian(); @@ -869,20 +873,25 @@ class TCFSelfTest { pending_cancel = done; } } - else { - diag.cancelTest(context_id, new IDiagnostics.DoneCancelTest() { + else if (cancel_test_cmd == null) { + cancel_test_cmd = diag.cancelTest(context_id, new IDiagnostics.DoneCancelTest() { public void doneCancelTest(IToken token, Throwable error) { + cancel_test_cmd = null; exit(error); done.run(); } }); } + else { + exit(new Exception("Cannot terminate remote test process")); + done.run(); + } } private void exit(Throwable x) { if (active_tests.get(this) == null) return; if (pending_cancel != null) { - pending_cancel.run(); + Protocol.invokeLater(pending_cancel); pending_cancel = null; } else { @@ -1192,7 +1201,7 @@ class TCFSelfTest { private void runNextTest() { while (active_tests.isEmpty()) { - if (canceled || errors.size() > 0 || pending_tests.size() == 0) { + if (cancel || errors.size() > 0 || pending_tests.size() == 0) { for (IChannel channel : channels) { if (channel != null && channel.getState() != IChannel.STATE_CLOSED) { if (errors.isEmpty()) channel.close(); diff --git a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFChildren.java b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFChildren.java index fafd5e541..6cc6828a8 100644 --- a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFChildren.java +++ b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFChildren.java @@ -17,7 +17,6 @@ public class TCFChildren { final TCFNode node; final Map<String,TCFNode> children = new HashMap<String,TCFNode>(); - final Map<String,TCFNode> children_next = new HashMap<String,TCFNode>(); protected boolean valid; @@ -26,8 +25,8 @@ public class TCFChildren { } void dispose() { - TCFNode arr[] = children.values().toArray(new TCFNode[children.size()]); - for (int i = 0; i < arr.length; i++) arr[i].dispose(); + TCFNode a[] = children.values().toArray(new TCFNode[children.size()]); + for (int i = 0; i < a.length; i++) a[i].dispose(); assert children.isEmpty(); } @@ -35,31 +34,30 @@ public class TCFChildren { children.remove(id); } - void doneValidate() { + void doneValidate(Map<String,TCFNode> new_children) { + assert !node.disposed; + assert !valid; valid = true; - TCFNode[] a = children.values().toArray(new TCFNode[children.size()]); - for (TCFNode n : a) { - if (children_next.get(n.id) != n) n.dispose(); + if (children.size() > 0) { + TCFNode[] a = children.values().toArray(new TCFNode[children.size()]); + for (TCFNode n : a) if (new_children.get(n.id) != n) n.dispose(); } - for (TCFNode n : children_next.values()) { - if (children.get(n.id) == null) { - children.put(n.id, n); - n.model.addNode(n.id, n); - } - assert children.get(n.id) == n; + for (TCFNode n : new_children.values()) { + assert n.parent == node; + children.put(n.id, n); } - assert children.size() == children_next.size(); + assert children.size() == new_children.size(); } - boolean validate(TCFRunnable done) { - doneValidate(); + boolean validate() { + doneValidate(new HashMap<String,TCFNode>()); return true; } void invalidate() { - children_next.clear(); + assert !node.disposed; TCFNode[] a = children.values().toArray(new TCFNode[children.size()]); - for (int i = 0; i < a.length; i++) a[i].invalidateNode(TCFNode.CF_ALL); + for (int i = 0; i < a.length; i++) a[i].invalidateNode(); valid = false; } diff --git a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFChildrenExecContext.java b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFChildrenExecContext.java index 95229f778..51ca5a64b 100644 --- a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFChildrenExecContext.java +++ b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFChildrenExecContext.java @@ -10,88 +10,189 @@ *******************************************************************************/ package com.windriver.debug.tcf.ui.model; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.Map; + +import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; + import com.windriver.tcf.api.protocol.IToken; import com.windriver.tcf.api.services.IMemory; import com.windriver.tcf.api.services.IRunControl; +/** + * This class is used to maintain a dynamic list of both executable contexts and memory spaces + * that are children of a given parent context. The job is slightly complicated by necessity + * to merge results from two independent services. + */ +@SuppressWarnings("serial") public class TCFChildrenExecContext extends TCFChildren { - private boolean mem_valid; - private boolean run_valid; + private Map<String,TCFNode> mem_children; + private Map<String,TCFNode> run_children; + + // Track disposed IDs to detect violations of the communication protocol + private LinkedHashMap<String,String> disposed_ids = new LinkedHashMap<String,String>() { + protected boolean removeEldestEntry(Map.Entry<String,String> eldest) { + return size() > 128; + } + }; TCFChildrenExecContext(TCFNode node) { super(node); } @Override - boolean validate(TCFRunnable done) { - if (!mem_valid && !validateMemoryChildren(done)) return false; - if (!run_valid && !validateRunControlChildren(done)) return false; - doneValidate(); + void dispose() { + HashSet<TCFNode> s = new HashSet<TCFNode>(); + s.addAll(children.values()); + if (mem_children != null) s.addAll(mem_children.values()); + if (run_children != null) s.addAll(run_children.values()); + for (TCFNode n : s) n.dispose(); + mem_children = null; + run_children = null; + } + + @Override + void dispose(String id) { + super.dispose(id); + if (mem_children != null) mem_children.remove(id); + if (run_children != null) run_children.remove(id); + disposed_ids.put(id, id); + } + + @Override + boolean validate() { + assert !node.disposed; + Map<String,TCFNode> new_children = new HashMap<String,TCFNode>(); + if (!validateMemoryChildren(new_children)) return false; + if (!validateRunControlChildren(new_children)) return false; + doneValidate(new_children); return true; } @Override void invalidate() { - mem_valid = false; - run_valid = false; - super.invalidate(); + HashSet<TCFNode> s = new HashSet<TCFNode>(); + s.addAll(children.values()); + if (mem_children != null) s.addAll(mem_children.values()); + if (run_children != null) s.addAll(run_children.values()); + for (TCFNode n : s) n.invalidateNode(); + mem_children = null; + run_children = null; + valid = false; } - private boolean validateMemoryChildren(TCFRunnable done) { - assert node.data_command == null; + void onContextAdded(IRunControl.RunControlContext context) { + assert !node.disposed; + if (run_children != null) { + String id = context.getID(); + TCFNodeExecContext n = (TCFNodeExecContext)node.model.getNode(id); + if (n == null) { + n = new TCFNodeExecContext(node, id); + n.setRunContext(context); + n.makeModelDelta(IModelDelta.INSERTED); + } + else { + n.setRunContext(context); + n.makeModelDelta(IModelDelta.STATE); + } + children.put(id, n); + run_children.put(id, n); + } + else { + node.invalidateNode(); + node.makeModelDelta(IModelDelta.CONTENT); + } + } + + void onContextAdded(IMemory.MemoryContext context) { + assert !node.disposed; + if (mem_children != null) { + String id = context.getID(); + TCFNodeExecContext n = (TCFNodeExecContext)node.model.getNode(id); + if (n == null) { + n = new TCFNodeExecContext(node, id); + n.setMemoryContext(context); + n.makeModelDelta(IModelDelta.INSERTED); + } + else { + n.setMemoryContext(context); + n.makeModelDelta(IModelDelta.STATE); + } + children.put(id, n); + mem_children.put(id, n); + } + else { + node.invalidateNode(); + node.makeModelDelta(IModelDelta.CONTENT); + } + } + + private boolean validateMemoryChildren(final Map<String,TCFNode> new_children) { + if (mem_children != null) { + new_children.putAll(mem_children); + return true; + } IMemory mem = node.model.getLaunch().getService(IMemory.class); if (mem == null) { - mem_valid = true; + mem_children = new HashMap<String,TCFNode>(); return true; } - if (done != null) node.wait_list.add(done); - node.data_command = mem.getChildren(node.id, new IMemory.DoneGetChildren() { + assert node.pending_command == null; + node.pending_command = mem.getChildren(node.id, new IMemory.DoneGetChildren() { public void doneGetChildren(IToken token, Exception error, String[] contexts) { - if (node.data_command != token) return; - node.data_command = null; + if (node.pending_command != token) return; + node.pending_command = null; + mem_children = new_children; + mem_children.clear(); if (error != null) { node.node_error = error; } else { - for (int i = 0; i < contexts.length; i++) { - String id = contexts[i]; + for (String id : contexts) { + assert disposed_ids.get(id) == null; TCFNode n = node.model.getNode(id); if (n == null) n = new TCFNodeExecContext(node, id); - children_next.put(id, n); + mem_children.put(id, n); } } - mem_valid = true; - node.validateNode(null); + node.validateNode(); } }); return false; } - private boolean validateRunControlChildren(TCFRunnable done) { - assert node.data_command == null; + private boolean validateRunControlChildren(final Map<String,TCFNode> new_children) { + if (run_children != null) { + new_children.putAll(run_children); + return true; + } IRunControl run = node.model.getLaunch().getService(IRunControl.class); if (run == null) { - run_valid = true; + run_children = new HashMap<String,TCFNode>(); return true; } - if (done != null) node.wait_list.add(done); - node.data_command = run.getChildren(node.id, new IRunControl.DoneGetChildren() { + assert node.pending_command == null; + node.pending_command = run.getChildren(node.id, new IRunControl.DoneGetChildren() { public void doneGetChildren(IToken token, Exception error, String[] contexts) { - if (node.data_command != token) return; - node.data_command = null; + if (node.pending_command != token) return; + node.pending_command = null; + run_children = new_children; + run_children.clear(); if (error != null) { node.node_error = error; } else { for (String id : contexts) { + assert disposed_ids.get(id) == null; TCFNode n = node.model.getNode(id); if (n == null) n = new TCFNodeExecContext(node, id); - children_next.put(id, n); + run_children.put(id, n); } } - run_valid = true; - node.validateNode(null); + node.validateNode(); } }); return false; diff --git a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFChildrenRegisters.java b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFChildrenRegisters.java index ec76afab7..dcf374fb5 100644 --- a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFChildrenRegisters.java +++ b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFChildrenRegisters.java @@ -10,34 +10,48 @@ *******************************************************************************/ package com.windriver.debug.tcf.ui.model; +import java.util.HashMap; +import java.util.Map; + import com.windriver.tcf.api.protocol.IToken; import com.windriver.tcf.api.services.IRegisters; public class TCFChildrenRegisters extends TCFChildren { + private boolean running; + TCFChildrenRegisters(TCFNode node) { super(node); } + /** + * Invalidate register values only, keep cached register attributes. + */ + void onSuspended() { + if (running || node.node_error != null) invalidate(); + for (TCFNode n : children.values()) ((TCFNodeRegister)n).onSuspended(); + } + @Override - boolean validate(TCFRunnable done) { - children_next.clear(); - String addr = node.getAddress(); - if (addr == null) { - doneValidate(); + boolean validate() { + assert !node.disposed; + assert !valid; + final Map<String,TCFNode> new_children = new HashMap<String,TCFNode>(); + running = !node.isSuspended(); + if (running) { + valid = true; return true; } IRegisters regs = node.model.getLaunch().getService(IRegisters.class); if (regs == null) { - doneValidate(); + doneValidate(new_children); return true; } - assert node.data_command == null; - if (done != null) node.wait_list.add(done); - node.data_command = regs.getChildren(node.id, new IRegisters.DoneGetChildren() { + assert node.pending_command == null; + node.pending_command = regs.getChildren(node.id, new IRegisters.DoneGetChildren() { public void doneGetChildren(IToken token, Exception error, String[] contexts) { - if (node.data_command != token) return; - node.data_command = null; + if (node.pending_command != token) return; + node.pending_command = null; if (error != null) { node.node_error = error; } @@ -45,11 +59,11 @@ public class TCFChildrenRegisters extends TCFChildren { for (String id : contexts) { TCFNode n = node.model.getNode(id); if (n == null) n = new TCFNodeRegister(node, id); - children_next.put(id, n); + new_children.put(id, n); } } - doneValidate(); - node.validateNode(null); + doneValidate(new_children); + node.validateNode(); } }); return false; diff --git a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFChildrenStackTrace.java b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFChildrenStackTrace.java index 8bcf2e757..9d3dae027 100644 --- a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFChildrenStackTrace.java +++ b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFChildrenStackTrace.java @@ -10,59 +10,103 @@ *******************************************************************************/ package com.windriver.debug.tcf.ui.model; +import java.util.HashMap; +import java.util.Map; + import com.windriver.tcf.api.protocol.IToken; import com.windriver.tcf.api.services.IStackTrace; public class TCFChildrenStackTrace extends TCFChildren { - private final TCFChildren children_regs; + private final TCFChildrenRegisters children_regs; + + private final Map<String,TCFNodeStackFrame> frames_cache = + new HashMap<String,TCFNodeStackFrame>(); - TCFChildrenStackTrace(TCFNode node, TCFChildren children_regs) { + TCFChildrenStackTrace(TCFNode node, TCFChildrenRegisters children_regs) { super(node); this.children_regs = children_regs; } @Override - boolean validate(TCFRunnable done) { - children_next.clear(); - String addr = node.getAddress(); - if (addr == null) { - doneValidate(); + void dispose() { + TCFNode arr[] = frames_cache.values().toArray(new TCFNode[frames_cache.size()]); + for (int i = 0; i < arr.length; i++) arr[i].dispose(); + assert frames_cache.isEmpty(); + assert children.isEmpty(); + } + + @Override + void dispose(String id) { + super.dispose(id); + frames_cache.remove(id); + } + + void onSourceMappingChange() { + for (TCFNodeStackFrame n : frames_cache.values()) n.onSourceMappingChange(); + } + + void onSuspended() { + for (TCFNodeStackFrame n : frames_cache.values()) n.onSuspended(); + valid = false; + } + + void onResumed() { + valid = false; + } + + @Override + boolean validate() { + final Map<String,TCFNode> new_children = new HashMap<String,TCFNode>(); + if (!node.isSuspended()) { + doneValidate(new_children); return true; } String nm = node.id + "-TF"; - TCFNode n = children.get(nm); + TCFNodeStackFrame n = frames_cache.get(nm); + if (n == null) n = (TCFNodeStackFrame)node.model.getNode(nm); if (n == null) n = new TCFNodeStackFrame(node, nm, children_regs); - children_next.put(n.id, n); + new_children.put(n.id, n); + frames_cache.put(n.id, n); IStackTrace st = node.model.getLaunch().getService(IStackTrace.class); if (st == null) { - doneValidate(); + doneValidate(new_children); return true; } - assert node.data_command == null; - if (done != null) node.wait_list.add(done); - node.data_command = st.getChildren(node.id, new IStackTrace.DoneGetChildren() { + assert node.pending_command == null; + node.pending_command = st.getChildren(node.id, new IStackTrace.DoneGetChildren() { public void doneGetChildren(IToken token, Exception error, String[] contexts) { - if (node.data_command != token) return; - node.data_command = null; + if (node.pending_command != token) return; + node.pending_command = null; if (error != null) { node.node_error = error; } else { int cnt = contexts.length; for (String id : contexts) { - TCFNode n = node.model.getNode(id); - if (n == null || ((TCFNodeStackFrame)n).getFrameNo() != cnt) { + TCFNodeStackFrame n = frames_cache.get(id); + if (n == null) n = (TCFNodeStackFrame)node.model.getNode(id); + if (n == null || n.getFrameNo() != cnt) { + if (n != null) n.dispose(); n = new TCFNodeStackFrame(node, id, cnt); } - assert ((TCFNodeStackFrame)n).getFrameNo() == cnt; + assert n.getFrameNo() == cnt; assert n.id.equals(id); - children_next.put(id, n); + assert n.parent == node; + new_children.put(id, n); + frames_cache.put(id, n); cnt--; } + if (frames_cache.size() > new_children.size() + 32) { + // Trim frame cache + TCFNode arr[] = frames_cache.values().toArray(new TCFNode[frames_cache.size()]); + for (int i = 0; i < arr.length; i++) { + if (new_children.get(arr[i].id) == null) arr[i].dispose(); + } + } } - doneValidate(); - node.validateNode(null); + doneValidate(new_children); + node.validateNode(); } }); return false; diff --git a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFModel.java b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFModel.java index f4826d2c3..8982559ff 100644 --- a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFModel.java +++ b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFModel.java @@ -12,6 +12,7 @@ package com.windriver.debug.tcf.ui.model; import java.util.HashMap; import java.util.Map; +import java.util.TreeSet; import org.eclipse.debug.core.commands.IDisconnectHandler; import org.eclipse.debug.core.commands.IResumeHandler; @@ -46,6 +47,7 @@ import com.windriver.debug.tcf.ui.commands.SuspendCommand; import com.windriver.debug.tcf.ui.commands.TerminateCommand; import com.windriver.tcf.api.protocol.Protocol; import com.windriver.tcf.api.services.IMemory; +import com.windriver.tcf.api.services.IRegisters; import com.windriver.tcf.api.services.IRunControl; public class TCFModel implements IElementContentProvider, IElementLabelProvider, @@ -53,20 +55,83 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider, private final Display display; private final TCFLaunch launch; - private final TCFNode launch_node; + private final TCFNodeLaunch launch_node; private final Map<IPresentationContext,TCFModelProxy> model_proxies = new HashMap<IPresentationContext,TCFModelProxy>(); private final Map<String,TCFNode> id2node = new HashMap<String,TCFNode>(); private final Map<TCFNode,ModelDelta> deltas = new HashMap<TCFNode,ModelDelta>(); @SuppressWarnings("unchecked") private final Map<Class,Object> commands = new HashMap<Class,Object>(); + private final TreeSet<FutureTask> queue = new TreeSet<FutureTask>(); + + private boolean disposed; + + private int future_task_cnt; + + private static class FutureTask implements Comparable<FutureTask>{ + final int id; + final long time; + final Runnable run; + + FutureTask(int id, long time, Runnable run) { + this.id = id; + this.time = time; + this.run = run; + } + + public int compareTo(FutureTask x) { + if (x == this) return 0; + if (time < x.time) return -1; + if (time > x.time) return +1; + if (id < x.id) return -1; + if (id > x.id) return +1; + assert false; + return 0; + } + } + + private final Thread future_task_dispatcher = new Thread() { + public void run() { + try { + synchronized (queue) { + while (!disposed) { + if (queue.isEmpty()) { + queue.wait(); + } + else { + long time = System.currentTimeMillis(); + FutureTask t = queue.first(); + if (t.time > time) { + queue.wait(t.time - time); + } + else { + queue.remove(t); + Protocol.invokeLater(t.run); + } + } + } + } + } + catch (Throwable x) { + x.printStackTrace(); + } + } + }; private final IMemory.MemoryListener mem_listener = new IMemory.MemoryListener() { public void contextAdded(IMemory.MemoryContext[] contexts) { for (int i = 0; i < contexts.length; i++) { - TCFNode node = getNode(contexts[i].getParentID()); - if (node != null) node.onContextAdded(contexts[i]); + String id = contexts[i].getParentID(); + if (id == null) { + launch_node.onContextAdded(contexts[i]); + } + else { + TCFNode node = getNode(id); + if (node instanceof TCFNodeExecContext) { + ((TCFNodeExecContext)node).onContextAdded(contexts[i]); + } + } } fireModelChanged(); } @@ -129,8 +194,16 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider, public void contextAdded(IRunControl.RunControlContext[] contexts) { for (int i = 0; i < contexts.length; i++) { - TCFNode node = getNode(contexts[i].getParentID()); - if (node != null) node.onContextAdded(contexts[i]); + String id = contexts[i].getParentID(); + if (id == null) { + launch_node.onContextAdded(contexts[i]); + } + else { + TCFNode node = getNode(id); + if (node instanceof TCFNodeExecContext) { + ((TCFNodeExecContext)node).onContextAdded(contexts[i]); + } + } } fireModelChanged(); } @@ -180,6 +253,26 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider, } }; + private final IRegisters.RegistersListener reg_listener = new IRegisters.RegistersListener() { + + public void contextChanged() { + for (TCFNode node : id2node.values()) { + if (node instanceof TCFNodeExecContext) { + ((TCFNodeExecContext)node).onRegistersChanged(); + } + } + fireModelChanged(); + } + + public void registerChanged(String context) { + TCFNode node = getNode(context); + if (node instanceof TCFNodeRegister) { + ((TCFNodeRegister)node).onValueChanged(); + } + fireModelChanged(); + } + }; + TCFModel(Display display, TCFLaunch launch) { this.display = display; this.launch = launch; @@ -191,6 +284,8 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider, commands.put(IStepIntoHandler.class, new StepIntoCommand(this)); commands.put(IStepOverHandler.class, new StepOverCommand(this)); commands.put(IStepReturnHandler.class, new StepReturnCommand(this)); + future_task_dispatcher.setName("TCF Future Task Dispatcher"); + future_task_dispatcher.start(); } @SuppressWarnings("unchecked") @@ -206,6 +301,8 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider, if (mem != null) mem.addListener(mem_listener); IRunControl run = launch.getService(IRunControl.class); if (run != null) run.addListener(run_listener); + IRegisters reg = launch.getService(IRegisters.class); + if (reg != null) reg.addListener(reg_listener); launch_node.invalidateNode(); launch_node.makeModelDelta(IModelDelta.STATE | IModelDelta.CONTENT); fireModelChanged(); @@ -236,13 +333,23 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider, } }); } - + void launchChanged() { launch_node.makeModelDelta(IModelDelta.STATE | IModelDelta.CONTENT); fireModelChanged(); } void dispose() { + synchronized (queue) { + disposed = true; + queue.notify(); + } + try { + future_task_dispatcher.join(); + } + catch (InterruptedException e) { + e.printStackTrace(); + } } void addNode(String id, TCFNode node) { @@ -278,7 +385,7 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider, for (TCFModelProxy p : model_proxies.values()) p.fireModelChanged(top); } } - + public Display getDisplay() { return display; } @@ -298,6 +405,13 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider, return id2node.get(id); } + public void invokeLater(long delay, Runnable run) { + synchronized (queue) { + queue.add(new FutureTask(future_task_cnt++, System.currentTimeMillis() + delay, run)); + queue.notify(); + } + } + public void update(IChildrenCountUpdate[] updates) { for (int i = 0; i < updates.length; i++) { Object o = updates[i].getElement(); diff --git a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFModelPresentation.java b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFModelPresentation.java index 07e358631..98efc2471 100644 --- a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFModelPresentation.java +++ b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFModelPresentation.java @@ -100,6 +100,10 @@ public class TCFModelPresentation implements IDebugModelPresentation { public void breakpointStatusChanged(String id) { refreshBreakpointView(); } + + public void breakpointRemoved(String id) { + refreshBreakpointView(); + } }; public TCFModelPresentation() { diff --git a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNode.java b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNode.java index c213e0c2d..fb63dcfe5 100644 --- a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNode.java +++ b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNode.java @@ -48,7 +48,7 @@ import com.windriver.tcf.api.services.IRunControl; /** * TCFNode is base class for all TCF debug model elements. */ -public class TCFNode extends PlatformObject +public abstract class TCFNode extends PlatformObject implements IMemoryBlockRetrievalExtension, Comparable<TCFNode> { protected final String id; @@ -57,25 +57,37 @@ implements IMemoryBlockRetrievalExtension, Comparable<TCFNode> { protected boolean disposed; + /** + * Constructor for a root node. There should be exactly one root in the model. + * @param model + */ + protected TCFNode(TCFModel model) { + id = null; + parent = null; + this.model = model; + } + + /** + * Constructor for a node other then root. Node ID must be unique. + * @param parent - parent node. + * @param id - node ID. + */ protected TCFNode(TCFNode parent, String id) { assert Protocol.isDispatchThread(); this.parent = parent; this.id = id; model = parent.model; - } - - protected TCFNode(TCFModel model) { - id = null; - parent = null; - this.model = model; + model.addNode(id, this); } /** * Dispose this node. The node is removed from the model. + * Subclasses should override the method to dispose children nodes, if any. */ void dispose() { assert !disposed; if (parent != null) parent.dispose(id); + invalidateNode(); model.removeNode(id); disposed = true; } @@ -83,6 +95,9 @@ implements IMemoryBlockRetrievalExtension, Comparable<TCFNode> { /** * A child node is being disposed. * The child should be removed from this node children lists. + * Base node class does not support any children, so the method is empty. + * Subclasses should override the method if they can have children. + * @param id - ID of a node being disposed. */ void dispose(String id) { } @@ -205,7 +220,7 @@ implements IMemoryBlockRetrievalExtension, Comparable<TCFNode> { if (!disposed) { if (!validateNode(this)) return; if (node_error != null) { - result.setBackground(new RGB(255, 0, 0), 0); + result.setForeground(new RGB(255, 0, 0), 0); result.setLabel(node_error.getClass().getName() + ": " + node_error.getMessage(), 0); } @@ -214,7 +229,7 @@ implements IMemoryBlockRetrievalExtension, Comparable<TCFNode> { } } else { - result.setLabel("[Disposed]", 0); + result.setLabel("...", 0); } result.setStatus(Status.OK_STATUS); done(); @@ -268,23 +283,13 @@ implements IMemoryBlockRetrievalExtension, Comparable<TCFNode> { /** * Create ModelDelta for changes in this node. - * @param flags - description of what has changed: CF_CONTEXT, CF_CHILDREN or CF_ALL. + * @param flags - description of what has changed: IModelDelta.ADDED, IModelDelta.REMOVED, etc. * @return - ModelDelta that describes node changes. */ ModelDelta makeModelDelta(int flags) { int count = -1; - //if (node_valid == CF_ALL) count = children.size(); - ModelDelta delta = model.getDelta(this); int index = -1; - /* - if (parent.node_valid == CF_ALL) { - index = 0; - for (Iterator<TCFNode> i = parent.children.values().iterator(); i.hasNext();) { - if (i.next() == this) break; - index++; - } - } - */ + ModelDelta delta = model.getDelta(this); if (delta == null || delta.getChildCount() != count || delta.getIndex() != index) { ModelDelta parent_delta = parent.makeModelDelta(IModelDelta.NO_CHANGE); delta = parent_delta.addNode(this, index, flags, count); @@ -296,105 +301,147 @@ implements IMemoryBlockRetrievalExtension, Comparable<TCFNode> { return delta; } - void onContextAdded(IRunControl.RunControlContext context) { - assert !disposed; - // TODO: Bug in Eclipse: IModelDelta.INSERTED fails if this is root node - invalidateNode(CF_CHILDREN); - makeModelDelta(IModelDelta.CONTENT); - } - - void onContextAdded(IMemory.MemoryContext context) { - assert !disposed; - // TODO: Bug in Eclipse: IModelDelta.INSERTED fails if this is root node - invalidateNode(CF_CHILDREN); - makeModelDelta(IModelDelta.CONTENT); - } - /*--------------------------------------------------------------------------------------*/ /* Node data retrieval state machine */ - protected static final int - CF_CHILDREN = 0x0001, - CF_CONTEXT = 0x0002, - CF_ALL = CF_CHILDREN | CF_CONTEXT; - - protected int node_valid; protected Throwable node_error; - protected IToken data_command; - protected final Collection<TCFRunnable> wait_list = new ArrayList<TCFRunnable>(); + protected IToken pending_command; + private final Collection<TCFRunnable> wait_list = new ArrayList<TCFRunnable>(); /** * Invalidate the node - flush all cached data. + * Subclasses should override this method to flush any additional data. + * Subclasses should call super.invalidateNode(). */ public void invalidateNode() { - invalidateNode(CF_ALL); - } - - protected void invalidateNode(int flags) { - // flags - set of CF_* - // cancel current data retrieval command - if (data_command != null) { - data_command.cancel(); - data_command = null; + if (pending_command != null) { + pending_command.cancel(); + pending_command = null; } // cancel waiting monitors if (!wait_list.isEmpty()) { - TCFRunnable[] arr = wait_list.toArray(new TCFRunnable[wait_list.size()]); - for (TCFRunnable r : arr) r.cancel(); + for (TCFRunnable r : wait_list) r.cancel(); wait_list.clear(); } - if (flags == CF_ALL) { - node_error = null; - } - - node_valid &= ~flags; + node_error = null; } /** * Validate node - retrieve and put into a cache missing data from remote peer. - * Validation is done asynchronously. - * @param done - call back, it is called when validation is done. - * @return true if the node is valid, false if validation is started. + * Validation is done asynchronously. If the node is already valid, + * the method should return true. Otherwise, it returns false, + * and later, when the node becomes valid, call-backs from 'wait_list' are invoked. + * @return true if the node is already valid, false if validation is started. */ - public boolean validateNode(TCFRunnable done) { + public final boolean validateNode() { assert Protocol.isDispatchThread(); - assert (node_valid & ~CF_ALL) == 0; - if (data_command != null) { - if (done != null) wait_list.add(done); + assert !disposed; + if (pending_command != null) { return false; } else if (model.getLaunch().getChannel() == null) { node_error = null; - node_valid = CF_ALL; } - else { - if ((node_valid & CF_CONTEXT) == 0 && !validateContext(done)) return false; - if ((node_valid & CF_CHILDREN) == 0 && !validateChildren(done)) return false; + else if (node_error == null && !validateNodeData()) { + return false; } - assert node_valid == CF_ALL; if (!wait_list.isEmpty()) { Runnable[] arr = wait_list.toArray(new Runnable[wait_list.size()]); wait_list.clear(); - for (int i = 0; i < arr.length; i++) arr[i].run(); + for (Runnable r : arr) r.run(); } return true; } - protected boolean validateContext(TCFRunnable done) { - node_valid |= CF_CONTEXT; + /** + * Validate node - retrieve and put into a cache missing data from remote peer. + * Validation is done asynchronously. If the node is already valid, + * the method should return true. Otherwise, it returns false, + * adds 'done' into 'wait_list', and later, when the node becomes valid, + * call-backs from 'wait_list' are invoked. + * @param done - call-back object to call when node becomes valid. + * @return true if the node is already valid, false if validation is started. + */ + public final boolean validateNode(TCFRunnable done) { + assert done != null; + if (!validateNode()) { + wait_list.add(done); + return false; + } return true; } + + private class ValidateNodes extends TCFRunnable { + + int cnt = 0; + private IToken command; + + ValidateNodes(Collection<TCFNode> nodes) { + for (TCFNode n : nodes) { + if (!n.validateNode(this)) cnt++; + } + if (cnt > 0) { + pending_command = command = new IToken() { + public boolean cancel() { + return false; + } + }; + } + } + + public void run() { + cnt--; + assert cnt >= 0; + if (cnt != 0) return; + if (command != pending_command) return; + Protocol.invokeLater(new Runnable() { + public void run() { + if (command != pending_command) return; + pending_command = null; + validateNode(); + } + }); + } + + @Override + public void cancel() { + run(); + } + } - protected boolean validateChildren(TCFRunnable done) { - node_valid |= CF_CHILDREN; - return true; + /** + * Subclasses can use this method to validate a collection of nodes. + * Validation of multiple nodes is expensive and should be avoided + * when possible. + * + * Validation is performed in background, and call-backs from 'wait_list' are + * activated when validation is done. + * + * @param nodes + * @return true if all nodes are already valid, false if validation is started. + */ + protected boolean validateNodes(Collection<TCFNode> nodes) { + if (nodes.isEmpty()) return true; + if (pending_command != null) return false; + return new ValidateNodes(nodes).cnt == 0; } + + /** + * Subclasses should override this method to implement data retrieval that + * is specific for this node. + * + * Data retrieval should be performed in background, and it should call + * validateNode() when retrieval is done. + * + * @return true if the node is already valid, false if data retrieval is started. + */ + protected abstract boolean validateNodeData(); /*--------------------------------------------------------------------------------------*/ - /* Memory Block Retrieval */ + /* Memory Block Retrieval */ public IMemoryBlockExtension getExtendedMemoryBlock(String addr, Object ctx) throws DebugException { assert ctx == this; diff --git a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNodeExecContext.java b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNodeExecContext.java index 996391ce0..71a776c1e 100644 --- a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNodeExecContext.java +++ b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNodeExecContext.java @@ -27,11 +27,11 @@ import com.windriver.tcf.api.services.IMemory; import com.windriver.tcf.api.services.IRunControl; public class TCFNodeExecContext extends TCFNode { - - private final TCFChildren children_exec; - private final TCFChildren children_stack; - private final TCFChildren children_regs; - + + private final TCFChildrenExecContext children_exec; + private final TCFChildrenStackTrace children_stack; + private final TCFChildrenRegisters children_regs; + private IMemory.MemoryContext mem_context; private IRunControl.RunControlContext run_context; @@ -44,11 +44,13 @@ public class TCFNodeExecContext extends TCFNode { private boolean terminated; @SuppressWarnings("unused") private String exception_msg; - + private boolean valid_mem_ctx; private boolean valid_run_ctx; private boolean valid_state; + private int resumed_cnt; + TCFNodeExecContext(TCFNode parent, String id) { super(parent, id); children_exec = new TCFChildrenExecContext(this); @@ -63,7 +65,7 @@ public class TCFNodeExecContext extends TCFNode { children_regs.dispose(); super.dispose(); } - + @Override void dispose(String id) { children_exec.dispose(id); @@ -71,6 +73,16 @@ public class TCFNodeExecContext extends TCFNode { children_regs.dispose(id); } + void setRunContext(IRunControl.RunControlContext ctx) { + run_context = ctx; + valid_run_ctx = true; + } + + void setMemoryContext(IMemory.MemoryContext ctx) { + mem_context = ctx; + valid_mem_ctx = true; + } + @Override public IRunControl.RunControlContext getRunContext() { assert Protocol.isDispatchThread(); @@ -115,7 +127,7 @@ public class TCFNodeExecContext extends TCFNode { result.setChildCount(children_exec.size()); } } - + @Override protected void getData(IChildrenUpdate result) { int offset = 0; @@ -139,7 +151,7 @@ public class TCFNodeExecContext extends TCFNode { offset++; } } - + @Override protected void getData(IHasChildrenUpdate result) { if (run_context != null && run_context.hasState()) { @@ -154,7 +166,7 @@ public class TCFNodeExecContext extends TCFNode { result.setHasChilren(children_exec.size() > 0); } } - + @Override protected void getData(ILabelUpdate result) { result.setImageDescriptor(getImageDescriptor(getImageName()), 0); @@ -184,135 +196,130 @@ public class TCFNodeExecContext extends TCFNode { if (run_context != null && run_context.isContainer()) flags |= IModelDelta.STATE; return super.makeModelDelta(flags); } - - @Override + void onContextAdded(IRunControl.RunControlContext context) { - assert !disposed; - if (node_valid == CF_ALL) { - String id = context.getID(); - TCFNodeExecContext n = (TCFNodeExecContext)children_exec.children.get(id); - if (n == null) { - n = new TCFNodeExecContext(this, id); - n.run_context = context; - n.valid_run_ctx = true; - children_exec.children.put(id, n); - model.addNode(id, n); - n.makeModelDelta(IModelDelta.INSERTED); - } - else { - n.run_context = context; - n.makeModelDelta(IModelDelta.STATE); - } - } - else { - invalidateNode(CF_CHILDREN); - makeModelDelta(IModelDelta.CONTENT); - } + children_exec.onContextAdded(context); } void onContextChanged(IRunControl.RunControlContext context) { assert !disposed; + if (!valid_run_ctx) invalidateNode(); run_context = context; - invalidateNode(CF_CHILDREN); + valid_run_ctx = true; + resumed_cnt++; + children_stack.onSourceMappingChange(); makeModelDelta(IModelDelta.STATE | IModelDelta.CONTENT); } - @Override void onContextAdded(IMemory.MemoryContext context) { - assert !disposed; - if (node_valid == CF_ALL) { - String id = context.getID(); - TCFNodeExecContext n = (TCFNodeExecContext)children_exec.children.get(id); - if (n == null) { - n = new TCFNodeExecContext(this, id); - n.mem_context = context; - n.valid_mem_ctx = true; - children_exec.children.put(id, n); - model.addNode(id, n); - n.makeModelDelta(IModelDelta.INSERTED); - } - else { - n.mem_context = context; - n.makeModelDelta(IModelDelta.STATE); - } - } - else { - invalidateNode(CF_CHILDREN); - makeModelDelta(IModelDelta.CONTENT); - } + children_exec.onContextAdded(context); } void onContextChanged(IMemory.MemoryContext context) { assert !disposed; + if (!valid_mem_ctx) invalidateNode(); mem_context = context; - invalidateNode(CF_CHILDREN); + valid_mem_ctx = true; + resumed_cnt++; makeModelDelta(IModelDelta.STATE | IModelDelta.CONTENT); } void onContextRemoved() { assert !disposed; + resumed_cnt++; dispose(); - if (parent.node_valid == CF_ALL) { + if (parent instanceof TCFNodeExecContext && + ((TCFNodeExecContext)parent).children_exec.valid) { makeModelDelta(IModelDelta.REMOVED); } else { - parent.invalidateNode(CF_CHILDREN); + parent.invalidateNode(); parent.makeModelDelta(IModelDelta.CONTENT); } } void onContainerSuspended() { assert !disposed; - if (run_context == null) return; - if (!run_context.hasState()) return; - suspended = false; - running = false; - valid_state = false; - invalidateNode(CF_CHILDREN); - suspended = true; + if (valid_run_ctx) { + if (run_context == null) return; + if (!run_context.hasState()) return; + suspended = false; + running = false; + valid_state = false; + super.invalidateNode(); + children_stack.onSuspended(); + } + else { + invalidateNode(); + } makeModelDelta(IModelDelta.STATE | IModelDelta.CONTENT); } void onContainerResumed() { assert !disposed; - if (run_context == null) return; - if (!run_context.hasState()) return; - suspended = false; - running = false; - valid_state = false; - invalidateNode(CF_CHILDREN); - suspended = false; + if (valid_run_ctx) { + if (run_context == null) return; + if (!run_context.hasState()) return; + suspended = false; + running = false; + valid_state = false; + super.invalidateNode(); + children_stack.onResumed(); + } + else { + invalidateNode(); + } makeModelDelta(IModelDelta.STATE | IModelDelta.CONTENT); } void onContextSuspended(String pc, String reason, Map<String,Object> params) { assert !disposed; - if (run_context == null) return; - if (!run_context.hasState()) return; - invalidateNode(CF_CHILDREN); - suspended = true; - suspended_pc = pc; - suspended_reason = reason; - suspended_params = params; - running = false; - valid_state = true; + if (valid_run_ctx) { + if (run_context == null) return; + if (!run_context.hasState()) return; + super.invalidateNode(); + children_stack.onSuspended(); + suspended = true; + suspended_pc = pc; + suspended_reason = reason; + suspended_params = params; + running = false; + valid_state = true; + } + else { + invalidateNode(); + } + resumed_cnt++; makeModelDelta(IModelDelta.STATE | IModelDelta.CONTENT); } void onContextResumed() { assert !disposed; - if (run_context == null) return; - if (!run_context.hasState()) return; - invalidateNode(CF_CHILDREN); - exception_msg = null; - terminated = false; - suspended = false; - suspended_pc = null; - suspended_reason = null; - suspended_params = null; - running = true; - valid_state = true; + if (valid_run_ctx) { + if (run_context == null) return; + if (!run_context.hasState()) return; + super.invalidateNode(); + exception_msg = null; + terminated = false; + suspended = false; + suspended_pc = null; + suspended_reason = null; + suspended_params = null; + running = true; + valid_state = true; + } + else { + invalidateNode(); + } makeModelDelta(IModelDelta.STATE | IModelDelta.CONTENT); + final int cnt = ++resumed_cnt; + model.invokeLater(250, new Runnable() { + public void run() { + if (cnt != resumed_cnt) return; + children_stack.onResumed(); + makeModelDelta(IModelDelta.CONTENT); + } + }); } void onContextException(String msg) { @@ -324,54 +331,54 @@ public class TCFNodeExecContext extends TCFNode { void onMemoryChanged(Number[] addr, long[] size) { assert !disposed; } - - @Override - protected void invalidateNode(int flags) { - super.invalidateNode(flags); - if ((flags & CF_CONTEXT) != 0) { - valid_mem_ctx = false; - valid_run_ctx = false; - valid_state = false; - running = false; - suspended = false; - } - if ((flags & CF_CHILDREN) != 0) { - children_exec.invalidate(); - children_stack.invalidate(); - children_regs.invalidate(); - } + + void onRegistersChanged() { + super.invalidateNode(); + children_regs.invalidate(); + makeModelDelta(IModelDelta.CONTENT); } - + @Override - protected boolean validateContext(TCFRunnable done) { - if (!valid_mem_ctx && !validateMemoryContext(done)) return false; - if (!valid_run_ctx && !validateRunControlContext(done)) return false; - if (!valid_state && !validateRunControlState(done)) return false; - node_valid |= CF_CONTEXT; - return true; + public void invalidateNode() { + super.invalidateNode(); + valid_mem_ctx = false; + valid_run_ctx = false; + valid_state = false; + running = false; + suspended = false; + children_exec.invalidate(); + children_stack.invalidate(); + children_regs.invalidate(); } @Override - protected boolean validateChildren(TCFRunnable done) { - if (!children_stack.valid && !children_stack.validate(done)) return false; - if (!children_regs.valid && !children_regs.validate(done)) return false; - if (!children_exec.valid && !children_exec.validate(done)) return false; - node_valid |= CF_CHILDREN; + protected boolean validateNodeData() { + assert !disposed; + if (!valid_mem_ctx && !validateMemoryContext()) return false; + if (!valid_run_ctx && !validateRunControlContext()) return false; + if (!valid_state && !validateRunControlState()) return false; + if (!children_stack.valid && !children_stack.validate()) return false; + if (!children_regs.valid && !children_regs.validate()) return false; + if (!children_exec.valid && !children_exec.validate()) return false; + if (run_context != null && !run_context.hasState()) { + // Container need to validate children for hasSuspendedChildren() method + // to return valid value. + if (!validateNodes(children_exec.children.values())) return false; + } return true; } - private boolean validateMemoryContext(TCFRunnable done) { - assert data_command == null; + private boolean validateMemoryContext() { + assert pending_command == null; IMemory mem = model.getLaunch().getService(IMemory.class); if (mem == null) { valid_mem_ctx = true; return true; } - if (done != null) wait_list.add(done); - data_command = mem.getContext(id, new IMemory.DoneGetContext() { + pending_command = mem.getContext(id, new IMemory.DoneGetContext() { public void doneGetContext(IToken token, Exception error, IMemory.MemoryContext context) { - if (data_command != token) return; - data_command = null; + if (pending_command != token) return; + pending_command = null; if (error != null) { node_error = error; } @@ -379,24 +386,23 @@ public class TCFNodeExecContext extends TCFNode { mem_context = context; } valid_mem_ctx = true; - validateNode(null); + validateNode(); } }); return false; } - private boolean validateRunControlContext(TCFRunnable done) { - assert data_command == null; + private boolean validateRunControlContext() { + assert pending_command == null; IRunControl run = model.getLaunch().getService(IRunControl.class); if (run == null) { valid_run_ctx = true; return true; } - if (done != null) wait_list.add(done); - data_command = run.getContext(id, new IRunControl.DoneGetContext() { + pending_command = run.getContext(id, new IRunControl.DoneGetContext() { public void doneGetContext(IToken token, Exception error, IRunControl.RunControlContext context) { - if (data_command != token) return; - data_command = null; + if (pending_command != token) return; + pending_command = null; if (error != null) { node_error = error; } @@ -404,14 +410,14 @@ public class TCFNodeExecContext extends TCFNode { run_context = context; } valid_run_ctx = true; - validateNode(null); + validateNode(); } }); return false; } - private boolean validateRunControlState(TCFRunnable done) { - assert data_command == null; + private boolean validateRunControlState() { + assert pending_command == null; if (node_error != null || run_context == null || !run_context.hasState()) { suspended = false; suspended_pc = null; @@ -421,11 +427,10 @@ public class TCFNodeExecContext extends TCFNode { valid_state = true; return true; } - if (done != null) wait_list.add(done); - data_command = run_context.getState(new IRunControl.DoneGetState() { + pending_command = run_context.getState(new IRunControl.DoneGetState() { public void doneGetState(IToken token, Exception error, boolean suspend, String pc, String reason, Map<String,Object> params) { - if (token != data_command) return; - data_command = null; + if (token != pending_command) return; + pending_command = null; if (error != null) { suspended = false; suspended_pc = null; @@ -449,12 +454,12 @@ public class TCFNodeExecContext extends TCFNode { running = !suspend; } valid_state = true; - validateNode(null); + validateNode(); } }); return false; } - + private boolean hasSuspendedChildren() { for (TCFNode n : children_exec.children.values()) { if (n instanceof TCFNodeExecContext) { @@ -467,7 +472,7 @@ public class TCFNodeExecContext extends TCFNode { } return false; } - + @Override protected String getImageName() { if (run_context != null && run_context.hasState()) { diff --git a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNodeLaunch.java b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNodeLaunch.java index b800e2cbe..d6ad830e9 100644 --- a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNodeLaunch.java +++ b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNodeLaunch.java @@ -22,10 +22,12 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta; import org.eclipse.swt.graphics.RGB; import com.windriver.debug.tcf.core.model.TCFLaunch; +import com.windriver.tcf.api.services.IMemory; +import com.windriver.tcf.api.services.IRunControl; public class TCFNodeLaunch extends TCFNode { - private final TCFChildren children; + private final TCFChildrenExecContext children; TCFNodeLaunch(TCFModel model) { super(model); @@ -85,10 +87,17 @@ public class TCFNodeLaunch extends TCFNode { result.setLabel(label, 0); } + void onContextAdded(IRunControl.RunControlContext context) { + children.onContextAdded(context); + } + + void onContextAdded(IMemory.MemoryContext context) { + children.onContextAdded(context); + } + @Override ModelDelta makeModelDelta(int flags) { int count = -1; - //if (node_valid == CF_ALL) count = children.size(); ModelDelta delta = model.getDelta(this); if (delta == null) { delta = new ModelDelta(DebugPlugin.getDefault().getLaunchManager(), IModelDelta.NO_CHANGE); @@ -103,17 +112,14 @@ public class TCFNodeLaunch extends TCFNode { } @Override - protected void invalidateNode(int flags) { - super.invalidateNode(flags); - if ((flags & CF_CHILDREN) != 0) { - children.invalidate(); - } + public void invalidateNode() { + super.invalidateNode(); + children.invalidate(); } @Override - protected boolean validateChildren(TCFRunnable done) { - if (!children.valid && !children.validate(done)) return false; - node_valid |= CF_CHILDREN; + protected boolean validateNodeData() { + if (!children.valid && !children.validate()) return false; return true; } diff --git a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNodeRegister.java b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNodeRegister.java index 9309c1bd9..6adcb2a69 100644 --- a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNodeRegister.java +++ b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNodeRegister.java @@ -11,13 +11,14 @@ package com.windriver.debug.tcf.ui.model; import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; import com.windriver.tcf.api.protocol.IToken; import com.windriver.tcf.api.services.IRegisters; -// TODO: hierarchical registers +//TODO: hierarchical registers public class TCFNodeRegister extends TCFNode { - + /** * Presentation column IDs. */ @@ -34,7 +35,7 @@ public class TCFNodeRegister extends TCFNode { COL_VOLATILE = "Volatile", COL_FLOAT = "Float", COL_MNEMONIC = "Menimonic"; - + private IRegisters.RegistersContext context; private String hex_value; @@ -43,7 +44,7 @@ public class TCFNodeRegister extends TCFNode { private boolean valid_context; private boolean valid_hex_value; private boolean valid_dec_value; - + TCFNodeRegister(TCFNode parent, String id) { super(parent, id); } @@ -78,11 +79,11 @@ public class TCFNodeRegister extends TCFNode { result.setLabel(id, 0); } } - + private String bool(boolean b) { return b ? "yes" : "no"; } - + private String getMnemonic() { if (num_value != null) { IRegisters.NamedValue[] arr = context.getNamedValues(); @@ -102,36 +103,49 @@ public class TCFNodeRegister extends TCFNode { return ""; } + void onValueChanged() { + onSuspended(); + } + + /** + * Invalidate register value only, keep cached register attributes. + */ + void onSuspended() { + super.invalidateNode(); + valid_hex_value = false; + valid_dec_value = false; + hex_value = null; + dec_value = null; + num_value = null; + makeModelDelta(IModelDelta.STATE); + } + @Override - protected void invalidateNode(int flags) { - super.invalidateNode(flags); - if ((flags & CF_CONTEXT) != 0) { - valid_context = false; - valid_hex_value = false; - valid_dec_value = false; - hex_value = null; - dec_value = null; - num_value = null; - } + public void invalidateNode() { + super.invalidateNode(); + valid_context = false; + valid_hex_value = false; + valid_dec_value = false; + hex_value = null; + dec_value = null; + num_value = null; } @Override - protected boolean validateContext(TCFRunnable done) { - if (!valid_context && !validateRegisterContext(done)) return false; - if (!valid_hex_value && !validateRegisterHexValue(done)) return false; - if (!valid_dec_value && !validateRegisterDecValue(done)) return false; - node_valid |= CF_CONTEXT; + protected boolean validateNodeData() { + if (!valid_context && !validateRegisterContext()) return false; + if (!valid_hex_value && !validateRegisterHexValue()) return false; + if (!valid_dec_value && !validateRegisterDecValue()) return false; return true; } - - private boolean validateRegisterContext(TCFRunnable done) { - assert data_command == null; + + private boolean validateRegisterContext() { + assert pending_command == null; IRegisters regs = model.getLaunch().getService(IRegisters.class); - if (done != null) wait_list.add(done); - data_command = regs.getContext(id, new IRegisters.DoneGetContext() { + pending_command = regs.getContext(id, new IRegisters.DoneGetContext() { public void doneGetContext(IToken token, Exception error, IRegisters.RegistersContext context) { - if (data_command != token) return; - data_command = null; + if (pending_command != token) return; + pending_command = null; if (error != null) { node_error = error; } @@ -139,15 +153,14 @@ public class TCFNodeRegister extends TCFNode { TCFNodeRegister.this.context = context; } valid_context = true; - validateNode(null); + validateNode(); } }); return false; } - private boolean validateRegisterHexValue(TCFRunnable done) { - assert data_command == null; - if (done != null) wait_list.add(done); + private boolean validateRegisterHexValue() { + assert pending_command == null; String[] fmts = context.getAvailableFormats(); String fmt = null; for (String s : fmts) { @@ -157,27 +170,26 @@ public class TCFNodeRegister extends TCFNode { valid_hex_value = true; return true; } - data_command = context.get(fmt, new IRegisters.DoneGet() { + pending_command = context.get(fmt, new IRegisters.DoneGet() { public void doneGet(IToken token, Exception error, String value) { - if (data_command != token) return; - data_command = null; + if (pending_command != token) return; + pending_command = null; if (error != null) { node_error = error; } else { hex_value = value; + if (!context.isFloat()) num_value = Long.valueOf(value, 16); } valid_hex_value = true; - if (!context.isFloat()) num_value = Long.valueOf(value, 16); - validateNode(null); + validateNode(); } }); return false; } - private boolean validateRegisterDecValue(TCFRunnable done) { - assert data_command == null; - if (done != null) wait_list.add(done); + private boolean validateRegisterDecValue() { + assert pending_command == null; String[] fmts = context.getAvailableFormats(); String fmt = null; for (String s : fmts) { @@ -187,20 +199,20 @@ public class TCFNodeRegister extends TCFNode { valid_dec_value = true; return true; } - data_command = context.get(fmt, new IRegisters.DoneGet() { + pending_command = context.get(fmt, new IRegisters.DoneGet() { public void doneGet(IToken token, Exception error, String value) { - if (data_command != token) return; - data_command = null; + if (pending_command != token) return; + pending_command = null; if (error != null) { node_error = error; } else { dec_value = value; + if (!context.isFloat()) num_value = Long.valueOf(value, 10); + else num_value = Double.valueOf(value); } valid_dec_value = true; - if (!context.isFloat()) num_value = Long.valueOf(value, 10); - else num_value = Double.valueOf(value); - validateNode(null); + validateNode(); } }); return false; diff --git a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNodeStackFrame.java b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNodeStackFrame.java index 91683da5e..9dee89fec 100644 --- a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNodeStackFrame.java +++ b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFNodeStackFrame.java @@ -11,12 +11,14 @@ package com.windriver.debug.tcf.ui.model; import java.math.BigInteger; +import java.util.ArrayList; import java.util.Arrays; import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; import org.eclipse.debug.ui.IDebugUIConstants; import com.windriver.tcf.api.protocol.IToken; @@ -31,11 +33,12 @@ public class TCFNodeStackFrame extends TCFNode { private IStackTrace.StackTraceContext stack_trace_context; private ILineNumbers.CodeArea code_area; + private BigInteger code_address; private final int frame_no; - private final TCFChildren children_regs; + private final TCFChildrenRegisters children_regs; - TCFNodeStackFrame(TCFNode parent, String id, TCFChildren children_regs) { + TCFNodeStackFrame(TCFNode parent, String id, TCFChildrenRegisters children_regs) { super(parent, id); this.frame_no = 0; this.children_regs = children_regs; @@ -46,20 +49,20 @@ public class TCFNodeStackFrame extends TCFNode { this.frame_no = frame_no; children_regs = new TCFChildrenRegisters(this); } - + int getFrameNo() { return frame_no; } @Override void dispose() { - children_regs.dispose(); + if (frame_no != 0) children_regs.dispose(); super.dispose(); } @Override void dispose(String id) { - children_regs.dispose(id); + if (frame_no != 0) children_regs.dispose(id); } @Override @@ -87,7 +90,8 @@ public class TCFNodeStackFrame extends TCFNode { assert Protocol.isDispatchThread(); if (frame_no == 0) return parent.getAddress(); if (stack_trace_context != null) { - return stack_trace_context.getReturnAddress().toString(); + Number addr = stack_trace_context.getReturnAddress(); + if (addr != null) return addr.toString(); } return null; } @@ -101,7 +105,7 @@ public class TCFNodeStackFrame extends TCFNode { result.setChildCount(0); } } - + @Override protected void getData(IChildrenUpdate result) { int offset = 0; @@ -122,7 +126,7 @@ public class TCFNodeStackFrame extends TCFNode { } } } - + @Override protected void getData(IHasChildrenUpdate result) { if (IDebugUIConstants.ID_REGISTER_VIEW.equals(result.getPresentationContext().getId())) { @@ -155,7 +159,7 @@ public class TCFNodeStackFrame extends TCFNode { } result.setLabel(label, 0); } - + private String makeHexAddrString(Number n) { BigInteger i = null; if (n instanceof BigInteger) i = (BigInteger)n; @@ -169,78 +173,101 @@ public class TCFNodeStackFrame extends TCFNode { return "0x0000000000000000".substring(0, 2 + l) + s; } + void onSourceMappingChange() { + super.invalidateNode(); + code_address = null; + code_area = null; + makeModelDelta(IModelDelta.STATE); + } + + void onSuspended() { + super.invalidateNode(); + stack_trace_context = null; + children_regs.onSuspended(); + makeModelDelta(IModelDelta.STATE); + } + @Override - protected void invalidateNode(int flags) { - super.invalidateNode(flags); - if ((flags & CF_CHILDREN) != 0) { - children_regs.invalidate(); - } + public void invalidateNode() { + super.invalidateNode(); + stack_trace_context = null; + code_address = null; + code_area = null; + children_regs.invalidate(); } @Override - protected boolean validateContext(TCFRunnable done) { - assert data_command == null; + protected boolean validateNodeData() { + assert pending_command == null; + if (node_error != null) return true; if (frame_no == 0) { - node_valid |= CF_CONTEXT; - return true; + if (!children_regs.valid) { + assert children_regs.node == parent; + // Need to validate parent for children_regs to be valid. + ArrayList<TCFNode> nodes = new ArrayList<TCFNode>(); + nodes.add(parent); + if (!validateNodes(nodes)) return false; + } + return validateSourceMapping(); } + if (!children_regs.valid && !children_regs.validate()) return false; + if (stack_trace_context != null) return true; IStackTrace st = model.getLaunch().getService(IStackTrace.class); - if (done != null) wait_list.add(done); - data_command = st.getContext(new String[]{ id }, new IStackTrace.DoneGetContext() { + pending_command = st.getContext(new String[]{ id }, new IStackTrace.DoneGetContext() { public void doneGetContext(IToken token, Exception error, IStackTrace.StackTraceContext[] context) { - if (data_command != token) return; - data_command = null; + if (pending_command != token) return; + pending_command = null; if (error != null) { node_error = error; } else { stack_trace_context = context[0]; } - BigInteger n = null; - ILineNumbers ln = model.getLaunch().getService(ILineNumbers.class); - if (node_error == null && ln != null) { - String s = getAddress(); - if (s != null) n = new BigInteger(s); - } + if (!validateSourceMapping()) return; + validateNode(); + } + }); + return false; + } + + private boolean validateSourceMapping() { + BigInteger n = null; + ILineNumbers ln = model.getLaunch().getService(ILineNumbers.class); + if (node_error == null && ln != null) { + String s = getAddress(); + if (s != null) n = new BigInteger(s); + } + if (n != null && n.equals(code_address)) return true; + if (n == null) { + code_area = null; + code_address = null; + return true; + } + final BigInteger n0 = n; + final BigInteger n1 = n0.add(BigInteger.valueOf(1)); + pending_command = ln.mapToSource(parent.id, n0, n1, new ILineNumbers.DoneMapToSource() { + public void doneMapToSource(IToken token, Exception error, CodeArea[] areas) { + if (pending_command != token) return; + pending_command = null; code_area = null; - if (n == null) { - node_valid |= CF_CONTEXT; - validateNode(null); + if (error != null) { + node_error = error; } - else { - BigInteger m = n.add(BigInteger.valueOf(1)); - data_command = ln.mapToSource(parent.id, n, m, new ILineNumbers.DoneMapToSource() { - public void doneMapToSource(IToken token, Exception error, CodeArea[] areas) { - if (data_command != token) return; - data_command = null; - if (error != null) { - node_error = error; - } - else if (areas != null && areas.length > 0) { - for (ILineNumbers.CodeArea area : areas) { - if (code_area == null || area.start_line < code_area.start_line) { - code_area = area; - } - } - } - node_valid |= CF_CONTEXT; - validateNode(null); + else if (areas != null && areas.length > 0) { + for (ILineNumbers.CodeArea area : areas) { + if (code_area == null || area.start_line < code_area.start_line) { + code_area = area; } - }); + } } + code_address = n0; + validateNode(); } }); return false; } @Override - protected boolean validateChildren(TCFRunnable done) { - if (!children_regs.valid && !children_regs.validate(done)) return false; - node_valid |= CF_CHILDREN; - return true; - } - - @Override protected String getImageName() { if (isRunning()) return "icons/full/obj16/stckframe_running_obj.gif"; return "icons/full/obj16/stckframe_obj.gif"; diff --git a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFRunnable.java b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFRunnable.java index f55cb8afb..0a7cdac63 100644 --- a/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFRunnable.java +++ b/plugins/com.windriver.debug.tcf.ui/src/com/windriver/debug/tcf/ui/model/TCFRunnable.java @@ -19,6 +19,13 @@ public abstract class TCFRunnable implements Runnable { private final IRequest monitor; private final Display display; + + private boolean canceled; + + public TCFRunnable() { + monitor = null; + display = null; + } public TCFRunnable(Display display, IRequest monitor) { this.monitor = monitor; @@ -27,6 +34,8 @@ public abstract class TCFRunnable implements Runnable { } public void cancel() { + canceled = true; + if (display == null) return; display.asyncExec(new Runnable() { public void run() { monitor.cancel(); @@ -36,10 +45,15 @@ public abstract class TCFRunnable implements Runnable { } public void done() { + if (display == null) return; display.asyncExec(new Runnable() { public void run() { monitor.done(); } }); } + + public boolean isCanceled() { + return canceled; + } } diff --git a/plugins/com.windriver.tcf.api/.classpath b/plugins/com.windriver.tcf.api/.classpath index 751c8f2e5..304e86186 100644 --- a/plugins/com.windriver.tcf.api/.classpath +++ b/plugins/com.windriver.tcf.api/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/plugins/com.windriver.tcf.api/.settings/org.eclipse.jdt.core.prefs b/plugins/com.windriver.tcf.api/.settings/org.eclipse.jdt.core.prefs index d598b3c83..0bf81e2f5 100644 --- a/plugins/com.windriver.tcf.api/.settings/org.eclipse.jdt.core.prefs +++ b/plugins/com.windriver.tcf.api/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,4 @@ -#Mon Sep 10 12:26:22 PDT 2007 +#Tue Feb 05 15:38:16 CET 2008 eclipse.preferences.version=1 org.eclipse.jdt.core.builder.cleanOutputFolder=clean org.eclipse.jdt.core.builder.duplicateResourceTask=warning @@ -8,6 +8,265 @@ org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,.svn/ org.eclipse.jdt.core.circularClasspath=error org.eclipse.jdt.core.classpath.exclusionPatterns=enabled org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=1 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=80 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error diff --git a/plugins/com.windriver.tcf.api/.settings/org.eclipse.jdt.ui.prefs b/plugins/com.windriver.tcf.api/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..010494bb8 --- /dev/null +++ b/plugins/com.windriver.tcf.api/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,4 @@ +#Mon Jan 07 15:38:38 PST 2008
+eclipse.preferences.version=1
+formatter_profile=_Java STD
+formatter_settings_version=11
diff --git a/plugins/com.windriver.tcf.api/META-INF/MANIFEST.MF b/plugins/com.windriver.tcf.api/META-INF/MANIFEST.MF index 87bb955c3..5ad6ca0e6 100644 --- a/plugins/com.windriver.tcf.api/META-INF/MANIFEST.MF +++ b/plugins/com.windriver.tcf.api/META-INF/MANIFEST.MF @@ -1,12 +1,13 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName -Bundle-SymbolicName: com.windriver.tcf.api -Bundle-Version: 0.1.0 +Bundle-SymbolicName: com.windriver.tcf.api;singleton:=true +Bundle-Version: 0.2.0 Bundle-Activator: com.windriver.tcf.api.Activator Bundle-Vendor: %providerName Require-Bundle: org.eclipse.core.runtime Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ActivationPolicy: lazy Eclipse-LazyStart: true Export-Package: com.windriver.tcf.api.core, com.windriver.tcf.api.protocol, diff --git a/plugins/com.windriver.tcf.api/build.properties b/plugins/com.windriver.tcf.api/build.properties index 34d2e4d2d..cdd2db7f1 100644 --- a/plugins/com.windriver.tcf.api/build.properties +++ b/plugins/com.windriver.tcf.api/build.properties @@ -1,4 +1,7 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ - . + .,\ + about.html,\ + plugin.properties +src.includes = about.html diff --git a/plugins/com.windriver.tcf.api/plugin.xml b/plugins/com.windriver.tcf.api/plugin.xml new file mode 100644 index 000000000..a3ab7c70e --- /dev/null +++ b/plugins/com.windriver.tcf.api/plugin.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.2"?> +<plugin> + + <extension-point id="startup" name="TCF Startup" schema="schema/startup.exsd"/>
+
+</plugin> diff --git a/plugins/com.windriver.debug.tcf.core/schema/startup.exsd b/plugins/com.windriver.tcf.api/schema/startup.exsd index 0d41bb8d9..8411b714d 100644 --- a/plugins/com.windriver.debug.tcf.core/schema/startup.exsd +++ b/plugins/com.windriver.tcf.api/schema/startup.exsd @@ -1,9 +1,9 @@ <?xml version='1.0' encoding='UTF-8'?> <!-- Schema file written by PDE --> -<schema targetNamespace="com.windriver.debug.tcf"> +<schema targetNamespace="com.windriver.tcf.api"> <annotation> <appInfo> - <meta.schema plugin="com.windriver.debug.tcf.core" id="startup" name="TCF Startup"/> + <meta.schema plugin="com.windriver.tcf.api" id="startup" name="TCF Startup"/> </appInfo> <documentation> This extension point is used to register plugins @@ -47,7 +47,7 @@ <attribute name="name" type="string"> <annotation> <documentation> - Class will be loaded during statup + Class will be loaded and initialized during TCF statup </documentation> </annotation> </attribute> diff --git a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/Activator.java b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/Activator.java index 97ead437f..24536f4b4 100644 --- a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/Activator.java +++ b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/Activator.java @@ -10,9 +10,14 @@ *******************************************************************************/ package com.windriver.tcf.api; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Status; +import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import com.windriver.tcf.api.protocol.Protocol; @@ -36,6 +41,7 @@ public class Activator extends Plugin { public void start(BundleContext context) throws Exception { super.start(context); Protocol.setEventQueue(new EventQueue()); + runTCFStartup(); } @Override @@ -44,6 +50,34 @@ public class Activator extends Plugin { super.stop(context); } + @SuppressWarnings("unchecked") + private void runTCFStartup() { + try { + IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(PLUGIN_ID, "startup"); + IExtension[] extensions = point.getExtensions(); + for (int i = 0; i < extensions.length; i++) { + try { + Bundle bundle = Platform.getBundle(extensions[i].getNamespaceIdentifier()); + bundle.start(); + IConfigurationElement[] e = extensions[i].getConfigurationElements(); + for (int j = 0; j < e.length; j++) { + String nm = e[j].getName(); + if (nm.equals("class")) { //$NON-NLS-1$ + Class c = bundle.loadClass(e[j].getAttribute("name")); //$NON-NLS-1$ + Class.forName(c.getName(), true, c.getClassLoader()); + } + } + } + catch (Throwable x) { + log("TCF startup error", x); + } + } + } + catch (Exception x) { + log("TCF startup error", x); + } + } + /** * Returns the shared instance * @@ -64,7 +98,7 @@ public class Activator extends Plugin { } else { plugin.getLog().log(new Status(IStatus.ERROR, - getDefault().getBundle().getSymbolicName(), IStatus.OK, msg, err)); + plugin.getBundle().getSymbolicName(), IStatus.OK, msg, err)); } } } diff --git a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/core/AbstractChannel.java b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/core/AbstractChannel.java index 767f8b153..d5315cd6d 100644 --- a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/core/AbstractChannel.java +++ b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/core/AbstractChannel.java @@ -14,7 +14,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; -import java.util.Iterator; import java.util.LinkedList; import java.util.Map; @@ -114,6 +113,7 @@ public abstract class AbstractChannel implements IChannel { private final Map<String,Message> out_tokens = new HashMap<String,Message>(); private final Thread inp_thread; private final Thread out_thread; + private boolean notifying_channel_opened; private boolean shutdown; private int state = STATE_OPENNING; private IToken redirect_command; @@ -127,8 +127,8 @@ public abstract class AbstractChannel implements IChannel { private Collection<TraceListener> trace_listeners; public static final int - EOS = -1, - EOM = -2; + EOS = -1, // End Of Stream + EOM = -2; // End Of Message protected AbstractChannel(IPeer peer) { assert Protocol.isDispatchThread(); @@ -359,8 +359,7 @@ public abstract class AbstractChannel implements IChannel { if (state != STATE_OPENNING) throw new IOException("Invalid event: Locator.Hello"); remote_service_by_class.clear(); String pkg_name = LocatorProxy.class.getPackage().getName(); - for (Iterator<String> i = c.iterator(); i.hasNext();) { - String service_name = i.next(); + for (String service_name : c) { try { Class<?> cls = Class.forName(pkg_name + "." + service_name + "Proxy"); IService service = (IService)cls.getConstructor(IChannel.class).newInstance(this); @@ -397,15 +396,18 @@ public abstract class AbstractChannel implements IChannel { } else { state = STATE_OPEN; + notifying_channel_opened = true; Transport.channelOpened(this); - Protocol.invokeLater(new Runnable() { - public void run() { - listeners_array = channel_listeners.toArray(listeners_array); - for (int i = 0; i < listeners_array.length && listeners_array[i] != null; i++) { - listeners_array[i].onChannelOpened(); - } + listeners_array = channel_listeners.toArray(listeners_array); + for (int i = 0; i < listeners_array.length && listeners_array[i] != null; i++) { + try { + listeners_array[i].onChannelOpened(); } - }); + catch (Throwable x) { + Activator.log("Exception in channel listener", x); + } + } + notifying_channel_opened = false; } } @@ -592,6 +594,13 @@ public abstract class AbstractChannel implements IChannel { return (V)remote_service_by_class.get(cls); } + public <V extends IService> void setServiceProxy(Class<V> service_interface, IService service_proxy) { + if (!notifying_channel_opened) new Error("setServiceProxe() can be called only from channel open call-back"); + if (!(remote_service_by_name.get(service_proxy.getName()) instanceof GenericProxy)) throw new Error("Proxy already set"); + if (remote_service_by_class.get(service_interface) != null) throw new Error("Proxy already set"); + remote_service_by_class.put(service_interface, service_proxy); + } + public IService getLocalService(String service_name) { return local_service_by_name.get(service_name); } @@ -755,13 +764,17 @@ public abstract class AbstractChannel implements IChannel { /** * Read one byte from the channel input stream. - * @return next data byte or -1 if end of stream is reached. + * @return next data byte or EOS (-1) if end of stream is reached, + * or EOM (-2) if end of message is reached. * @throws IOException */ protected abstract int read() throws IOException; /** * Write one byte into the channel output stream. + * The method argument can be one of two special values: + * EOS (-1) end of stream marker; + * EOM (-2) end of message marker. * The stream can put the byte into a buffer instead of transmitting it right away. * @param n - the data byte. * @throws IOException diff --git a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/local/LocatorService.java b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/local/LocatorService.java index 9672433ea..8923c28d0 100644 --- a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/local/LocatorService.java +++ b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/local/LocatorService.java @@ -151,9 +151,6 @@ public class LocatorService implements ILocator { Collection<String> c = (Collection<String>)JSON.parseSequence(data)[0]; channel.onLocatorHello(c); } - else { - throw new IOException("Unknown event: Locator." + name); - } } catch (IOException e) { channel.terminate(e); diff --git a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/remote/MemoryProxy.java b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/remote/MemoryProxy.java index 19b3e1aa4..1231f96da 100644 --- a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/remote/MemoryProxy.java +++ b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/remote/MemoryProxy.java @@ -127,9 +127,7 @@ public class MemoryProxy implements IMemory { } public String getParentID() { - String s = (String)props.get(PROP_PARENT_ID); - if (s == null) return ""; - return s; + return (String)props.get(PROP_PARENT_ID); } public int getAddressSize() { diff --git a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/remote/ProcessesProxy.java b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/remote/ProcessesProxy.java index 4db81a295..0eacb5d28 100644 --- a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/remote/ProcessesProxy.java +++ b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/remote/ProcessesProxy.java @@ -151,7 +151,7 @@ public class ProcessesProxy implements IProcesses { public void done(Exception error, Object[] args) { ProcessContext ctx = null; if (error == null) { - assert args.length == 2; + assert args.length == 3; error = toError(args[0], args[1]); if (args[2] != null) { ctx = new ProcessContext((Map<String, Object>)args[2]); diff --git a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/remote/RunControlProxy.java b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/remote/RunControlProxy.java index 774a5e6ec..7160a9509 100644 --- a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/remote/RunControlProxy.java +++ b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/remote/RunControlProxy.java @@ -46,9 +46,7 @@ public class RunControlProxy implements IRunControl { } public String getParentID() { - String s = (String)props.get(PROP_PARENT_ID); - if (s == null) return ""; - return s; + return (String)props.get(PROP_PARENT_ID); } public boolean isContainer() { @@ -148,7 +146,7 @@ public class RunControlProxy implements IRunControl { } public void addListener(final RunControlListener listener) { - IChannel.IEventListener l = new IChannel.IEventListener() { + IChannel.IEventListener l = new IChannel.IEventListener() { @SuppressWarnings("unchecked") public void event(String name, byte[] data) { @@ -207,7 +205,7 @@ public class RunControlProxy implements IRunControl { } public void removeListener(RunControlListener listener) { - IChannel.IEventListener l = listeners.remove(listener); + IChannel.IEventListener l = listeners.remove(listener); if (l != null) channel.removeEventListener(this, l); } diff --git a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/remote/StackTraceProxy.java b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/remote/StackTraceProxy.java index 5385c5d1f..5945082f1 100644 --- a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/remote/StackTraceProxy.java +++ b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/internal/services/remote/StackTraceProxy.java @@ -11,6 +11,7 @@ package com.windriver.tcf.api.internal.services.remote; import java.util.Collection; +import java.util.HashMap; import java.util.Map; import com.windriver.tcf.api.core.Command; @@ -19,14 +20,15 @@ import com.windriver.tcf.api.protocol.IToken; import com.windriver.tcf.api.services.IStackTrace; public class StackTraceProxy implements IStackTrace { - + private final IChannel channel; - + private class Context implements StackTraceContext { - + private final Map<String,Object> props; - + Context(Map<String,Object> props) { + if (props == null) props = new HashMap<String,Object>(); this.props = props; } diff --git a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/protocol/IChannel.java b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/protocol/IChannel.java index 4b15660b8..589ead0b4 100644 --- a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/protocol/IChannel.java +++ b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/protocol/IChannel.java @@ -181,7 +181,7 @@ public interface IChannel { */ void event(String name, byte[] data); } - + /** * Subscribe an event listener for given service. * @param service - remote service proxy @@ -230,18 +230,29 @@ public interface IChannel { Collection<String> getRemoteServices(); /** - * @return an object representing a service from remote peer. + * @return an object (proxy) representing a service from remote peer. * Return null if the service is not available. + * Return an instance of GenericProxy if 'service_name' is not a standard TCF service. */ IService getRemoteService(String service_name); /** - * @return an object representing a service from remote peer. - * Service object should implement given interface. + * @return an object (proxy) representing a service from remote peer, + * which implements given interface. * Return null if implementation of the interface is not available. */ <V extends IService> V getRemoteService(Class<V> service_interface); - + + /** + * Install a service proxy object on this channel. + * This method can be called only from channel open call-back. + * It allows a client to extends TCF by adding proxy objects for non-standard services. + * Client, wishing to become service proxy provider, should register itself + * using either Protocol.addChannelOpenListener() or IChannel.addChannelListener(). + * It is not allowed to register more then one proxy for a given service interface. + */ + <V extends IService> void setServiceProxy(Class<V> service_interface, IService service_proxy); + /** * Close communication channel. */ diff --git a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/services/IMemory.java b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/services/IMemory.java index 0f01c4a95..ef0b7a5fb 100644 --- a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/services/IMemory.java +++ b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/services/IMemory.java @@ -184,11 +184,11 @@ public interface IMemory extends IService { // Error may have per byte information final static int - BYTE_VALID = 0x00, - BYTE_UNKNOWN = 0x01, // e.g. out of range - BYTE_INVALID = 0x02, - BYTE_CANNOT_READ = 0x04, - BYTE_CANNOT_WRITE = 0x08; + BYTE_VALID = 0x00, + BYTE_UNKNOWN = 0x01, // e.g. out of range + BYTE_INVALID = 0x02, + BYTE_CANNOT_READ = 0x04, + BYTE_CANNOT_WRITE = 0x08; int getStatus(int offset); diff --git a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/services/IRunControl.java b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/services/IRunControl.java index fc8befbcc..65f2d0835 100644 --- a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/services/IRunControl.java +++ b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/services/IRunControl.java @@ -25,6 +25,7 @@ public interface IRunControl extends IService { static final String PROP_ID = "ID", PROP_PARENT_ID = "ParentID", + PROP_PROCESS_ID = "ProcessID", PROP_IS_CONTAINER = "IsContainer", PROP_HAS_STATE = "HasState", PROP_CAN_RESUME = "CanResume", diff --git a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/services/ISysMonitor.java b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/services/ISysMonitor.java index f154c9c0e..bffd8743c 100644 --- a/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/services/ISysMonitor.java +++ b/plugins/com.windriver.tcf.api/src/com/windriver/tcf/api/services/ISysMonitor.java @@ -230,8 +230,8 @@ public interface ISysMonitor extends IService { /** Scheduling policy */ PROP_POLICY = "Policy"; - - + + /** * A context corresponds to an execution thread, process, address space, etc. * A context can belong to a parent context. Contexts hierarchy can be simple @@ -242,7 +242,7 @@ public interface ISysMonitor extends IService { * attributes and functionality, which is relevant to that service. */ interface SysMonitorContext { - + /** * Get context ID. * Same as getProperties().get(“ID”) diff --git a/plugins/com.windriver.tcf.dsf.core/.classpath b/plugins/com.windriver.tcf.dsf.core/.classpath index 751c8f2e5..304e86186 100644 --- a/plugins/com.windriver.tcf.dsf.core/.classpath +++ b/plugins/com.windriver.tcf.dsf.core/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/plugins/com.windriver.tcf.dsf.core/.settings/org.eclipse.jdt.core.prefs b/plugins/com.windriver.tcf.dsf.core/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..0bf81e2f5 --- /dev/null +++ b/plugins/com.windriver.tcf.dsf.core/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,272 @@ +#Tue Feb 05 15:38:16 CET 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.builder.cleanOutputFolder=clean +org.eclipse.jdt.core.builder.duplicateResourceTask=warning +org.eclipse.jdt.core.builder.invalidClasspath=abort +org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore +org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,.svn/ +org.eclipse.jdt.core.circularClasspath=error +org.eclipse.jdt.core.classpath.exclusionPatterns=enabled +org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=1 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=80 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.incompatibleJDKLevel=ignore +org.eclipse.jdt.core.incompleteClasspath=error diff --git a/plugins/com.windriver.tcf.dsf.core/.settings/org.eclipse.jdt.ui.prefs b/plugins/com.windriver.tcf.dsf.core/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..abbc7248f --- /dev/null +++ b/plugins/com.windriver.tcf.dsf.core/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,4 @@ +#Wed Jan 09 12:21:30 PST 2008
+eclipse.preferences.version=1
+formatter_profile=_Java STD
+formatter_settings_version=11
diff --git a/plugins/com.windriver.tcf.dsf.core/META-INF/MANIFEST.MF b/plugins/com.windriver.tcf.dsf.core/META-INF/MANIFEST.MF index 31b80627c..5a0ebf9d3 100644 --- a/plugins/com.windriver.tcf.dsf.core/META-INF/MANIFEST.MF +++ b/plugins/com.windriver.tcf.dsf.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: com.windriver.tcf.dsf.core;singleton:=true -Bundle-Version: 0.1.0 +Bundle-Version: 0.2.0 Bundle-Activator: com.windriver.tcf.dsf.core.Activator Bundle-Vendor: %providerName Require-Bundle: org.eclipse.core.runtime, @@ -10,9 +10,11 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.core.resources, org.eclipse.dd.dsf, org.eclipse.dd.dsf.debug, + org.eclipse.cdt.core, com.windriver.tcf.api, com.windriver.debug.tcf.core Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ActivationPolicy: lazy Eclipse-LazyStart: true Export-Package: com.windriver.tcf.dsf.core.launch, com.windriver.tcf.dsf.core.services diff --git a/plugins/com.windriver.tcf.dsf.core/build.properties b/plugins/com.windriver.tcf.dsf.core/build.properties index e9863e281..2b6399957 100644 --- a/plugins/com.windriver.tcf.dsf.core/build.properties +++ b/plugins/com.windriver.tcf.dsf.core/build.properties @@ -2,4 +2,7 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ - plugin.xml + plugin.xml,\ + about.html,\ + plugin.properties +src.includes = about.html diff --git a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/launch/TCFDSFExecuter.java b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/launch/TCFDSFExecuter.java index 94b3cc18e..c43242ede 100644 --- a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/launch/TCFDSFExecuter.java +++ b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/launch/TCFDSFExecuter.java @@ -26,9 +26,9 @@ import org.eclipse.dd.dsf.concurrent.DsfExecutor; import com.windriver.tcf.api.protocol.Protocol; public class TCFDSFExecuter extends AbstractExecutorService implements DsfExecutor { - + private class ScheduledFutureTask<V> extends FutureTask<V> implements ScheduledFuture<V> { - + private long time; // Milliseconds private final int id; private final long period; // Milliseconds @@ -39,7 +39,7 @@ public class TCFDSFExecuter extends AbstractExecutorService implements DsfExecut id = sf_count++; this.period = period; } - + public ScheduledFutureTask(long delay, Callable<V> callable) { super(callable); time = System.currentTimeMillis() + delay; @@ -79,13 +79,13 @@ public class TCFDSFExecuter extends AbstractExecutorService implements DsfExecut } } } - + private static int sf_count = 0; private final TreeSet<ScheduledFutureTask<?>> queue = new TreeSet<ScheduledFutureTask<?>>(); private final Thread thread; private boolean is_shutdown; private boolean is_terminated; - + public TCFDSFExecuter() { thread = new Thread(new Runnable() { public void run() { diff --git a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/launch/TCFDSFLaunch.java b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/launch/TCFDSFLaunch.java index f9535ce5e..179be870d 100644 --- a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/launch/TCFDSFLaunch.java +++ b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/launch/TCFDSFLaunch.java @@ -11,23 +11,47 @@ package com.windriver.tcf.dsf.core.launch; import org.eclipse.dd.dsf.concurrent.DsfExecutor; +import org.eclipse.dd.dsf.concurrent.RequestMonitor; import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.debug.core.ILaunchConfiguration; import com.windriver.debug.tcf.core.model.ITCFConstants; import com.windriver.debug.tcf.core.model.TCFLaunch; +import com.windriver.tcf.api.protocol.IChannel; public class TCFDSFLaunch extends TCFLaunch { - + private final TCFDSFExecuter executor; private final DsfSession session; - + public TCFDSFLaunch(ILaunchConfiguration launchConfiguration, String mode) { super(launchConfiguration, mode); executor = new TCFDSFExecuter(); session = DsfSession.startSession(executor, ITCFConstants.ID_TCF_DEBUG_MODEL); } + @Override + protected void runLaunchSequence(final Runnable done) { + super.runLaunchSequence(new Runnable() { + public void run() { + IChannel channel = getChannel(); + if (channel != null) { + RequestMonitor monitor = new RequestMonitor(executor, null) { + @Override + protected void handleOK() { + done.run(); + } + }; + TCFDSFLaunchSequence seq = new TCFDSFLaunchSequence(session, TCFDSFLaunch.this, monitor); + executor.execute(seq); + } + else { + done.run(); + } + } + }); + } + public DsfExecutor getDsfExecutor() { return executor; } diff --git a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/launch/TCFDSFLaunchSequence.java b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/launch/TCFDSFLaunchSequence.java new file mode 100644 index 000000000..767aca9b0 --- /dev/null +++ b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/launch/TCFDSFLaunchSequence.java @@ -0,0 +1,83 @@ +/*******************************************************************************
+ * Copyright (c) 2007 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package com.windriver.tcf.dsf.core.launch;
+
+import org.eclipse.dd.dsf.concurrent.RequestMonitor;
+import org.eclipse.dd.dsf.concurrent.Sequence;
+import org.eclipse.dd.dsf.service.DsfSession;
+
+import com.windriver.tcf.api.protocol.IChannel;
+import com.windriver.tcf.dsf.core.services.TCFDSFBreakpoints;
+import com.windriver.tcf.dsf.core.services.TCFDSFMemory;
+import com.windriver.tcf.dsf.core.services.TCFDSFNativeProcesses;
+import com.windriver.tcf.dsf.core.services.TCFDSFRegisters;
+import com.windriver.tcf.dsf.core.services.TCFDSFRunControl;
+import com.windriver.tcf.dsf.core.services.TCFDSFStack;
+import com.windriver.tcf.dsf.core.services.TCFDSFStepQueueManager;
+
+class TCFDSFLaunchSequence extends Sequence {
+
+ private final Step[] steps;
+
+ TCFDSFLaunchSequence(final DsfSession session, final TCFDSFLaunch launch, RequestMonitor monitor) {
+ super(session.getExecutor(), monitor);
+ final IChannel channel = launch.getChannel();
+ steps = new Step[] {
+ new Step() {
+ @Override
+ public void execute(RequestMonitor monitor) {
+ new TCFDSFNativeProcesses(session, channel, monitor);
+ }
+ },
+ new Step() {
+ @Override
+ public void execute(RequestMonitor monitor) {
+ new TCFDSFRunControl(session, channel, monitor);
+ }
+ },
+ new Step() {
+ @Override
+ public void execute(RequestMonitor monitor) {
+ new TCFDSFStepQueueManager(session).initialize(monitor);
+ }
+ },
+ new Step() {
+ @Override
+ public void execute(RequestMonitor monitor) {
+ new TCFDSFStack(session, channel, monitor);
+ }
+ },
+ new Step() {
+ @Override
+ public void execute(RequestMonitor monitor) {
+ new TCFDSFMemory(session, channel, monitor);
+ }
+ },
+ new Step() {
+ @Override
+ public void execute(RequestMonitor monitor) {
+ new TCFDSFRegisters(session, channel, monitor);
+ }
+ },
+ new Step() {
+ @Override
+ public void execute(RequestMonitor monitor) {
+ new TCFDSFBreakpoints(session, launch, monitor);
+ }
+ },
+ };
+ }
+
+ @Override
+ public Step[] getSteps() {
+ return steps;
+ }
+}
diff --git a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/IDataRequest.java b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/IDataRequest.java new file mode 100644 index 000000000..49cee9f49 --- /dev/null +++ b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/IDataRequest.java @@ -0,0 +1,17 @@ +/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package com.windriver.tcf.dsf.core.services;
+
+public interface IDataRequest {
+
+ void cancel();
+ void done();
+}
diff --git a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFAddress.java b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFAddress.java new file mode 100644 index 000000000..0afcd6925 --- /dev/null +++ b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFAddress.java @@ -0,0 +1,85 @@ +/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package com.windriver.tcf.dsf.core.services;
+
+import java.math.BigInteger;
+
+import org.eclipse.cdt.core.IAddress;
+
+public final class TCFAddress implements IAddress {
+
+ private final BigInteger addr;
+
+ public TCFAddress(Number addr) {
+ if (addr instanceof BigInteger) this.addr = (BigInteger)addr;
+ else this.addr = new BigInteger(addr.toString(), 10);
+ }
+
+ public IAddress add(BigInteger i) {
+ return new TCFAddress(addr.add(i));
+ }
+
+ public IAddress add(long l) {
+ if (l == 0) return this;
+ return new TCFAddress(addr.add(BigInteger.valueOf(l)));
+ }
+
+ public BigInteger distanceTo(IAddress a) {
+ return a.getValue().subtract(addr);
+ }
+
+ public int getCharsNum() {
+ // TODO don't know what getCharsNum() is supposed to return
+ return 0;
+ }
+
+ public BigInteger getMaxOffset() {
+ // TODO don't know what getMaxOffset() is supposed to return
+ return null;
+ }
+
+ public int getSize() {
+ // TODO don't know what getSize() is supposed to return
+ return 0;
+ }
+
+ public BigInteger getValue() {
+ return addr;
+ }
+
+ public boolean isMax() {
+ return false;
+ }
+
+ public boolean isZero() {
+ return addr.equals(BigInteger.ZERO);
+ }
+
+ public String toBinaryAddressString() {
+ return toHexAddressString();
+ }
+
+ public String toHexAddressString() {
+ return "0x" + toString(16);
+ }
+
+ public String toString(int radix) {
+ return addr.toString(radix);
+ }
+
+ public int compareTo(Object o) {
+ return addr.compareTo(((TCFAddress)o).addr);
+ }
+
+ public String toString() {
+ return "[" + toHexAddressString() + "]";
+ }
+}
diff --git a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFBreakpoints.java b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFBreakpoints.java new file mode 100644 index 000000000..c908b4740 --- /dev/null +++ b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFBreakpoints.java @@ -0,0 +1,307 @@ +/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package com.windriver.tcf.dsf.core.services;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
+import org.eclipse.dd.dsf.concurrent.RequestMonitor;
+import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
+import org.eclipse.dd.dsf.datamodel.IDMContext;
+import org.eclipse.dd.dsf.service.AbstractDsfService;
+import org.eclipse.dd.dsf.service.DsfSession;
+import org.eclipse.dd.dsf.service.IDsfService;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IBreakpointManager;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.osgi.framework.BundleContext;
+
+import com.windriver.debug.tcf.core.TCFCore;
+import com.windriver.debug.tcf.core.model.ITCFBreakpointListener;
+import com.windriver.debug.tcf.core.model.ITCFConstants;
+import com.windriver.debug.tcf.core.model.TCFBreakpointsModel;
+import com.windriver.debug.tcf.core.model.TCFLaunch;
+import com.windriver.tcf.api.protocol.IChannel;
+import com.windriver.tcf.api.protocol.IToken;
+import com.windriver.tcf.dsf.core.Activator;
+
+// TODO IBreakpointHitEvent
+
+public class TCFDSFBreakpoints extends AbstractDsfService implements org.eclipse.dd.dsf.debug.service.IBreakpoints {
+
+ private class BreakpointDMC extends AbstractDMContext implements IBreakpointDMContext {
+
+ final String id;
+ final IBreakpoint bp;
+ final TCFDataCache<Map<String,Object>> status;
+
+ boolean disposed;
+
+ public BreakpointDMC(IDsfService service, final String id, IBreakpoint bp) {
+ super(service, new IDMContext[0]);
+ this.id = id;
+ this.bp = bp;
+ cache.put(id, this);
+ status = new TCFDataCache<Map<String,Object>>(channel) {
+ @Override
+ public boolean startDataRetrieval() {
+ assert command == null;
+ assert !disposed;
+ if (tcf_bpt_service == null) {
+ data = null;
+ valid = true;
+ return true;
+ }
+ command = tcf_bpt_service.getStatus(id, new com.windriver.tcf.api.services.IBreakpoints.DoneGetStatus() {
+ public void doneGetStatus(IToken token, Exception err, Map<String,Object> status) {
+ if (command != token) return;
+ command = null;
+ if (err != null) {
+ data = null;
+ error = err;
+ }
+ else {
+ data = status;
+ }
+ valid = true;
+ validate();
+ }
+ });
+ return false;
+ }
+ };
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return super.baseEquals(other) && ((BreakpointDMC)other).id.equals(id);
+ }
+
+ @Override
+ public int hashCode() {
+ return id.hashCode();
+ }
+
+ void dispose() {
+ assert !disposed;
+ cache.remove(id);
+ disposed = true;
+ }
+ }
+
+ private class BreakpointData implements IBreakpointDMData {
+
+ final IBreakpoint bp;
+ final BreakpointStatus status;
+
+ BreakpointData(IBreakpoint bp, BreakpointStatus status) {
+ this.bp = bp;
+ this.status = status;
+ }
+
+ public IBreakpoint getPlatformBreakpoint() {
+ return bp;
+ }
+
+ public BreakpointStatus getStatus() {
+ return status;
+ }
+ }
+
+ private final ITCFBreakpointListener bp_listener = new ITCFBreakpointListener() {
+
+ public void breakpointStatusChanged(String id) {
+ final BreakpointDMC dmc = cache.get(id);
+ if (dmc != null) {
+ Map<String, Object> map = launch.getBreakpointsStatus().getStatus(dmc.id);
+ dmc.status.reset(map);
+ IBreakpointDMEvent e = null;
+ if (map == null) {
+ e = new IBreakpointUninstalledDMEvent() {
+ public IBreakpointDMContext getDMContext() {
+ return dmc;
+ }
+ };
+ }
+ else if (map.get(com.windriver.tcf.api.services.IBreakpoints.STATUS_ERROR) != null) {
+ e = new IBreakpointInstallFailedDMEvent() {
+ public IBreakpointDMContext getDMContext() {
+ return dmc;
+ }
+ };
+ }
+ else if (map.get(com.windriver.tcf.api.services.IBreakpoints.STATUS_PLANTED) != null) {
+ e = new IBreakpointInstalledDMEvent() {
+ public IBreakpointDMContext getDMContext() {
+ return dmc;
+ }
+ };
+ }
+ else {
+ e = new IBreakpointUninstalledDMEvent() {
+ public IBreakpointDMContext getDMContext() {
+ return dmc;
+ }
+ };
+ }
+ getSession().dispatchEvent(e, getProperties());
+ }
+ }
+
+ public void breakpointRemoved(String id) {
+ final BreakpointDMC dmc = cache.get(id);
+ if (dmc != null) {
+ dmc.dispose();
+ IBreakpointDMEvent e = new IBreakpointUninstalledDMEvent() {
+ public IBreakpointDMContext getDMContext() {
+ return dmc;
+ }
+ };
+ getSession().dispatchEvent(e, getProperties());
+ }
+ }
+ };
+
+ private final TCFLaunch launch;
+ private final IChannel channel;
+ private final com.windriver.tcf.api.services.IBreakpoints tcf_bpt_service;
+ private final Map<String,BreakpointDMC> cache = new HashMap<String,BreakpointDMC>();
+
+ public TCFDSFBreakpoints(DsfSession session, TCFLaunch launch, final RequestMonitor monitor) {
+ super(session);
+ this.launch = launch;
+ channel = launch.getChannel();
+ launch.getBreakpointsStatus().addListener(bp_listener);
+ tcf_bpt_service = channel.getRemoteService(com.windriver.tcf.api.services.IBreakpoints.class);
+ initialize(new RequestMonitor(getExecutor(), monitor) {
+ @Override
+ protected void handleOK() {
+ String[] class_names = {
+ org.eclipse.dd.dsf.debug.service.IBreakpoints.class.getName(),
+ TCFDSFBreakpoints.class.getName()
+ };
+ register(class_names, new Hashtable<String,String>());
+ monitor.done();
+ }
+ });
+ }
+
+ @Override
+ public void shutdown(RequestMonitor monitor) {
+ unregister();
+ super.shutdown(monitor);
+ }
+
+ @Override
+ protected BundleContext getBundleContext() {
+ return Activator.getBundleContext();
+ }
+
+ public void getAllBreakpoints(IDMContext ctx, DataRequestMonitor<IBreakpointDMContext[]> rm) {
+ IBreakpointManager bp_manager = DebugPlugin.getDefault().getBreakpointManager();
+ TCFBreakpointsModel m = TCFCore.getBreakpointsModel();
+ IBreakpoint[] arr = bp_manager.getBreakpoints(ITCFConstants.ID_TCF_DEBUG_MODEL);
+ ArrayList<IBreakpointDMContext> l = new ArrayList<IBreakpointDMContext>();
+ if (arr != null && arr.length == 0) {
+ for (IBreakpoint bp : arr) {
+ if (m.isSupported(channel, bp)) {
+ IMarker marker = bp.getMarker();
+ String id = marker.getAttribute(ITCFConstants.ID_TCF_DEBUG_MODEL +
+ '.' + com.windriver.tcf.api.services.IBreakpoints.PROP_ID, (String)null);
+ if (id != null) {
+ BreakpointDMC c = cache.get(id);
+ if (c == null) c = new BreakpointDMC(this, id, bp);
+ l.add(c);
+ }
+ }
+ }
+ }
+ rm.setData(l.toArray(new IBreakpointDMContext[l.size()]));
+ rm.done();
+ }
+
+ public void getBreakpoints(IDMContext dmc, IBreakpoint bp, DataRequestMonitor<IBreakpointDMContext[]> rm) {
+ TCFBreakpointsModel m = TCFCore.getBreakpointsModel();
+ ArrayList<IBreakpointDMContext> l = new ArrayList<IBreakpointDMContext>();
+ if (m.isSupported(channel, bp)) {
+ IMarker marker = bp.getMarker();
+ String id = marker.getAttribute(ITCFConstants.ID_TCF_DEBUG_MODEL +
+ '.' + com.windriver.tcf.api.services.IBreakpoints.PROP_ID, (String)null);
+ if (id != null) {
+ BreakpointDMC c = cache.get(id);
+ if (c == null) c = new BreakpointDMC(this, id, bp);
+ l.add(c);
+ }
+ }
+ rm.setData(l.toArray(new IBreakpointDMContext[l.size()]));
+ rm.done();
+ }
+
+ public void getBreakpointData(final IDMContext dmc, final DataRequestMonitor<IBreakpointDMData> rm) {
+ if (dmc instanceof BreakpointDMC) {
+ BreakpointDMC bp = (BreakpointDMC)dmc;
+ if (!bp.status.validate()) {
+ bp.status.addWaitingRequest(new IDataRequest() {
+ public void cancel() {
+ rm.setStatus(new Status(IStatus.CANCEL, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Canceled", null)); //$NON-NLS-1$
+ rm.setCanceled(true);
+ rm.done();
+ }
+ public void done() {
+ getBreakpointData(dmc, rm);
+ }
+ });
+ return;
+ }
+ if (bp.status.getError() != null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Data error", bp.status.getError())); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ Map<String,Object> map = bp.status.getData();
+ BreakpointStatus status = BreakpointStatus.FILTERED_OUT;
+ if (map != null) {
+ if (map.get(com.windriver.tcf.api.services.IBreakpoints.STATUS_ERROR) != null) {
+ status = BreakpointStatus.FAILED_TO_INSTALL;
+ }
+ else if (map.get(com.windriver.tcf.api.services.IBreakpoints.STATUS_PLANTED) != null) {
+ status = BreakpointStatus.INSTALLED;
+ }
+ }
+ rm.setData(new BreakpointData(bp.bp, status));
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+
+ @SuppressWarnings("unchecked")
+ public void getModelData(IDMContext dmc, DataRequestMonitor<?> rm) {
+ if (dmc instanceof BreakpointDMC) {
+ getBreakpointData((BreakpointDMC)dmc, (DataRequestMonitor<IBreakpointDMData>)rm);
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+}
diff --git a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFExecutionDMC.java b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFExecutionDMC.java index b648df9dc..65c6bf206 100644 --- a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFExecutionDMC.java +++ b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFExecutionDMC.java @@ -18,9 +18,45 @@ import org.eclipse.dd.dsf.service.IDsfService; public abstract class TCFDSFExecutionDMC extends AbstractDMContext implements IExecutionDMContext, IContainerDMContext { + interface DataCache { + } + + DataCache stack_frames_cache; + DataCache memory_cache; + DataCache registers_cache; + TCFDSFExecutionDMC(IDsfService service, IDMContext[] parents) { super(service, parents); } + /** + * Get TCF ID of execution context. + * @return TCF ID. + */ public abstract String getTcfContextId(); + + /** + * Check if this context object is disposed, because, for example, a thread has exited. + * @return true if context object is disposed. + */ + public abstract boolean isDisposed(); + + /** + * Validate execution state data. + * @return true if state is valid, false if data retrieval is started. + */ + public abstract boolean validateState(); + + /** + * Add a listener to be activated when state data retrieval is done. + * @param req - listener object. + */ + public abstract void addStateWaitingRequest(IDataRequest req); + + /** + * Get current program counter. This method must be called only when + * execution state data is valid - when validateState() return true. + * @return current program counter address. + */ + public abstract TCFAddress getPC(); } diff --git a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFMemory.java b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFMemory.java new file mode 100644 index 000000000..8918fe4c3 --- /dev/null +++ b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFMemory.java @@ -0,0 +1,307 @@ +/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package com.windriver.tcf.dsf.core.services;
+
+import java.util.Hashtable;
+
+import org.eclipse.cdt.core.IAddress;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
+import org.eclipse.dd.dsf.concurrent.RequestMonitor;
+import org.eclipse.dd.dsf.datamodel.IDMContext;
+import org.eclipse.dd.dsf.service.AbstractDsfService;
+import org.eclipse.dd.dsf.service.DsfSession;
+import org.eclipse.debug.core.model.MemoryByte;
+import org.osgi.framework.BundleContext;
+
+import com.windriver.tcf.api.protocol.IChannel;
+import com.windriver.tcf.api.protocol.IToken;
+import com.windriver.tcf.api.services.IMemory.MemoryContext;
+import com.windriver.tcf.api.services.IMemory.MemoryError;
+import com.windriver.tcf.dsf.core.Activator;
+
+public class TCFDSFMemory extends AbstractDsfService implements org.eclipse.dd.dsf.debug.service.IMemory {
+
+ private class MemoryCache implements TCFDSFExecutionDMC.DataCache {
+
+ final TCFDataCache<com.windriver.tcf.api.services.IMemory.MemoryContext> context;
+
+ MemoryCache(final IChannel channel, final TCFDSFExecutionDMC exe) {
+ context = new TCFDataCache<com.windriver.tcf.api.services.IMemory.MemoryContext>(channel) {
+ @Override
+ public boolean startDataRetrieval() {
+ assert command == null;
+ String id = exe.getTcfContextId();
+ if (id == null || tcf_mem_service == null) {
+ data = null;
+ valid = true;
+ return true;
+ }
+ command = tcf_mem_service.getContext(id,
+ new com.windriver.tcf.api.services.IMemory.DoneGetContext() {
+ public void doneGetContext(IToken token, Exception err,
+ com.windriver.tcf.api.services.IMemory.MemoryContext ctx) {
+ if (command != token) return;
+ command = null;
+ if (err != null) {
+ error = err;
+ }
+ else {
+ data = ctx;
+ }
+ valid = true;
+ validate();
+ }
+ });
+ return false;
+ }
+ };
+ }
+ }
+
+ private final com.windriver.tcf.api.services.IMemory.MemoryListener mem_listener =
+ new com.windriver.tcf.api.services.IMemory.MemoryListener() {
+
+ public void contextAdded(MemoryContext[] contexts) {
+ }
+
+ public void contextChanged(MemoryContext[] contexts) {
+ }
+
+ public void contextRemoved(String[] context_ids) {
+ }
+
+ public void memoryChanged(String context_id, Number[] addr, long[] size) {
+ TCFDSFRunControl rc = getServicesTracker().getService(TCFDSFRunControl.class);
+ TCFDSFExecutionDMC exe = rc.getContext(context_id);
+ if (exe == null || exe.memory_cache == null) return;
+ for (int n = 0; n < addr.length; n++) {
+ long count = size[n];
+ // TODO: DSF does not support address ranges
+ if (count > 256) count = 256;
+ IAddress[] addresses = new IAddress[(int)count];
+ for (int i = 0; i < (int)count; i++) {
+ addresses[i] = new TCFAddress(addr[n]).add(i);
+ }
+ getSession().dispatchEvent(new MemoryChangedEvent(exe, addresses), getProperties());
+ }
+ }
+ };
+
+ private final IChannel channel;
+ private final com.windriver.tcf.api.services.IMemory tcf_mem_service;
+
+ public TCFDSFMemory(DsfSession session, IChannel channel, final RequestMonitor monitor) {
+ super(session);
+ this.channel = channel;
+ tcf_mem_service = channel.getRemoteService(com.windriver.tcf.api.services.IMemory.class);
+ if (tcf_mem_service != null) tcf_mem_service.addListener(mem_listener);
+ initialize(new RequestMonitor(getExecutor(), monitor) {
+ @Override
+ protected void handleOK() {
+ String[] class_names = {
+ org.eclipse.dd.dsf.debug.service.IMemory.class.getName(),
+ TCFDSFMemory.class.getName()
+ };
+ register(class_names, new Hashtable<String,String>());
+ monitor.done();
+ }
+ });
+ }
+
+ @Override
+ public void shutdown(RequestMonitor monitor) {
+ unregister();
+ super.shutdown(monitor);
+ }
+
+ @Override
+ protected BundleContext getBundleContext() {
+ return Activator.getBundleContext();
+ }
+
+ public void fillMemory(final IDMContext dmc, final IAddress address, final long offset,
+ final int word_size, final int count, final byte[] pattern, final RequestMonitor rm) {
+ if (tcf_mem_service == null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Memory access service is not available", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ else if (dmc instanceof TCFDSFExecutionDMC) {
+ final TCFDSFExecutionDMC ctx = (TCFDSFExecutionDMC)dmc;
+ if (ctx.memory_cache == null) ctx.memory_cache = new MemoryCache(channel, ctx);
+ MemoryCache cache = (MemoryCache)ctx.memory_cache;
+ if (!cache.context.validate()) {
+ cache.context.addWaitingRequest(new IDataRequest() {
+ public void cancel() {
+ rm.setStatus(new Status(IStatus.CANCEL, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Canceled", null)); //$NON-NLS-1$
+ rm.setCanceled(true);
+ rm.done();
+ }
+ public void done() {
+ fillMemory(dmc, address, offset, word_size, count, pattern, rm);
+ }
+ });
+ return;
+ }
+ if (cache.context.getError() != null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Data error", cache.context.getError())); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ com.windriver.tcf.api.services.IMemory.MemoryContext mem = cache.context.getData();
+ if (mem == null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Invalid DMC", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ mem.fill(address.add(offset).getValue(), word_size, pattern, count * word_size, 0,
+ new com.windriver.tcf.api.services.IMemory.DoneMemory() {
+ public void doneMemory(IToken token, MemoryError error) {
+ if (rm.isCanceled()) return;
+ if (error != null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Command error", error)); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+ });
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+
+ public void getMemory(final IDMContext dmc, final IAddress address, final long offset,
+ final int word_size, final int count, final DataRequestMonitor<MemoryByte[]> rm) {
+ if (tcf_mem_service == null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Memory access service is not available", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ else if (dmc instanceof TCFDSFExecutionDMC) {
+ final TCFDSFExecutionDMC ctx = (TCFDSFExecutionDMC)dmc;
+ if (ctx.memory_cache == null) ctx.memory_cache = new MemoryCache(channel, ctx);
+ MemoryCache cache = (MemoryCache)ctx.memory_cache;
+ if (!cache.context.validate()) {
+ cache.context.addWaitingRequest(new IDataRequest() {
+ public void cancel() {
+ rm.setStatus(new Status(IStatus.CANCEL, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Canceled", null)); //$NON-NLS-1$
+ rm.setCanceled(true);
+ rm.done();
+ }
+ public void done() {
+ getMemory(dmc, address, offset, word_size, count, rm);
+ }
+ });
+ return;
+ }
+ if (cache.context.getError() != null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Data error", cache.context.getError())); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ com.windriver.tcf.api.services.IMemory.MemoryContext mem = cache.context.getData();
+ if (mem == null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Invalid DMC", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ final byte[] buffer = new byte[word_size * count];
+ mem.get(address.add(offset).getValue(), word_size, buffer, 0, count * word_size, 0,
+ new com.windriver.tcf.api.services.IMemory.DoneMemory() {
+ public void doneMemory(IToken token, MemoryError error) {
+ if (rm.isCanceled()) return;
+ if (error != null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Command error", error)); //$NON-NLS-1$
+ }
+ MemoryByte[] res = new MemoryByte[buffer.length];
+ for (int i = 0; i < buffer.length; i++) {
+ res[i] = new MemoryByte(buffer[i]);
+ }
+ rm.done();
+ }
+ });
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+
+ public void setMemory(final IDMContext dmc, final IAddress address, final long offset,
+ final int word_size, final int count, final byte[] buffer, final RequestMonitor rm) {
+ if (tcf_mem_service == null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Memory access service is not available", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ else if (dmc instanceof TCFDSFExecutionDMC) {
+ final TCFDSFExecutionDMC ctx = (TCFDSFExecutionDMC)dmc;
+ if (ctx.memory_cache == null) ctx.memory_cache = new MemoryCache(channel, ctx);
+ MemoryCache cache = (MemoryCache)ctx.memory_cache;
+ if (!cache.context.validate()) {
+ cache.context.addWaitingRequest(new IDataRequest() {
+ public void cancel() {
+ rm.setStatus(new Status(IStatus.CANCEL, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Canceled", null)); //$NON-NLS-1$
+ rm.setCanceled(true);
+ rm.done();
+ }
+ public void done() {
+ setMemory(dmc, address, offset, word_size, count, buffer, rm);
+ }
+ });
+ return;
+ }
+ if (cache.context.getError() != null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Data error", cache.context.getError())); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ com.windriver.tcf.api.services.IMemory.MemoryContext mem = cache.context.getData();
+ if (mem == null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Invalid DMC", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ mem.set(address.add(offset).getValue(), word_size, buffer, 0, count * word_size, 0,
+ new com.windriver.tcf.api.services.IMemory.DoneMemory() {
+ public void doneMemory(IToken token, MemoryError error) {
+ if (rm.isCanceled()) return;
+ if (error != null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Command error", error)); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+ });
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+}
diff --git a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFNativeProcesses.java b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFNativeProcesses.java index 5c1235ae6..792f4fdae 100644 --- a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFNativeProcesses.java +++ b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFNativeProcesses.java @@ -12,13 +12,17 @@ package com.windriver.tcf.dsf.core.services; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; +import java.util.Hashtable; +import java.util.Map; import java.util.Set; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; import org.eclipse.dd.dsf.concurrent.RequestMonitor; +import org.eclipse.dd.dsf.datamodel.AbstractDMEvent; import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.dsf.datamodel.ServiceDMContext; import org.eclipse.dd.dsf.debug.service.INativeProcesses; @@ -29,17 +33,19 @@ import org.osgi.framework.BundleContext; import com.windriver.tcf.api.protocol.IChannel; import com.windriver.tcf.api.protocol.IToken; import com.windriver.tcf.api.services.IProcesses; +import com.windriver.tcf.api.services.IRunControl; import com.windriver.tcf.api.services.IProcesses.ProcessContext; +import com.windriver.tcf.api.services.IRunControl.RunControlContext; import com.windriver.tcf.dsf.core.Activator; public class TCFDSFNativeProcesses extends AbstractDsfService implements INativeProcesses { - - private class ProcessDMC extends TCFDSFProcessDMC { - + + private class ProcessDMC extends TCFDSFProcessDMC implements IProcessDMContext { + final String id; - - ProcessDMC(String id) { - super(TCFDSFNativeProcesses.this, new IDMContext[0]); + + ProcessDMC(String id, IDMContext parent) { + super(TCFDSFNativeProcesses.this, parent != null ? new IDMContext[]{ parent } : new IDMContext[0]); this.id = id; } @@ -50,19 +56,23 @@ public class TCFDSFNativeProcesses extends AbstractDsfService implements INative @Override public boolean equals(Object obj) { - return super.baseEquals(obj) && ((ProcessDMC)obj).id.equals(id); + if (!super.baseEquals(obj)) return false; + String obj_id = ((ProcessDMC)obj).id; + if (obj_id == null) return id == null; + return obj_id.equals(id); } @Override public int hashCode() { + if (id == null) return 0; return id.hashCode(); } } - - private class ThreadDMC extends TCFDSFThreadDMC { - + + private class ThreadDMC extends TCFDSFThreadDMC implements IThreadDMContext { + final String id; - + ThreadDMC(String id) { super(TCFDSFNativeProcesses.this, new IDMContext[0]); this.id = id; @@ -75,7 +85,10 @@ public class TCFDSFNativeProcesses extends AbstractDsfService implements INative @Override public boolean equals(Object obj) { - return super.baseEquals(obj) && ((ThreadDMC)obj).id.equals(id); + if (!super.baseEquals(obj)) return false; + String obj_id = ((ThreadDMC)obj).id; + if (obj_id == null) return id == null; + return obj_id.equals(id); } @Override @@ -83,19 +96,17 @@ public class TCFDSFNativeProcesses extends AbstractDsfService implements INative return id.hashCode(); } } - - private static class ProcessData implements IProcessDMData { - + + private class ProcessData implements IProcessDMData { + private final IProcesses.ProcessContext ctx; - + ProcessData(IProcesses.ProcessContext ctx) { this.ctx = ctx; } public IDMContext getDebugContext() { - // TODO Auto-generated method stub - assert false; - return null; + return getServicesTracker().getService(TCFDSFRunControl.class).getContext(ctx.getID()); } public String getId() { @@ -114,46 +125,184 @@ public class TCFDSFNativeProcesses extends AbstractDsfService implements INative return true; } } - - private static class ThreadData implements IThreadDMData { - private final IProcesses.ProcessContext ctx; - - ThreadData(IProcesses.ProcessContext ctx) { + private class ThreadData implements IThreadDMData { + + private final TCFDSFExecutionDMC ctx; + + ThreadData(TCFDSFExecutionDMC ctx) { this.ctx = ctx; } public IDMContext getDebugContext() { - // TODO Auto-generated method stub - assert false; - return null; + return ctx; } public String getId() { - return ctx.getID(); + if (ctx == null) return null; + return ctx.getTcfContextId(); } public String getName() { - return ctx.getName(); + // TODO thread name + return ""; } public boolean isDebuggerAttached() { - return ctx.isAttached(); + return true; } public boolean isValid() { return true; } + } + + private class ProcessStartedEvent extends AbstractDMEvent<IDMContext> implements IProcessStartedEvent { + + private final IProcessDMContext prs; + + ProcessStartedEvent(IDMContext dmc, IProcessDMContext prs) { + super(dmc); + this.prs = prs; + } + public IProcessDMContext getProcess() { + return prs; + } + } + + private class ProcessExitedEvent extends AbstractDMEvent<IDMContext> implements IProcessExitedEvent { + + private final IProcessDMContext prs; + + ProcessExitedEvent(IDMContext dmc, IProcessDMContext prs) { + super(dmc); + this.prs = prs; + } + + public IProcessDMContext getProcess() { + return prs; + } } - final IProcesses service; + private final com.windriver.tcf.api.services.IRunControl.RunControlListener run_listener = + new com.windriver.tcf.api.services.IRunControl.RunControlListener() { + + public void containerResumed(String[] context_ids) { + } + + public void containerSuspended(String context, String pc, + String reason, Map<String, Object> params, + String[] suspended_ids) { + } + + public void contextAdded(RunControlContext[] contexts) { + for (RunControlContext ctx : contexts) { + String id = ctx.getID(); + if (id.equals(ctx.getProperties().get(IRunControl.PROP_PROCESS_ID))) { + ProcessDMC dmc = new ProcessDMC(id, root_dmc); + process_cache.put(id, dmc); + getSession().dispatchEvent(new ProcessStartedEvent(root_dmc, dmc), getProperties()); + } + else { + ThreadDMC dmc = new ThreadDMC(id); + thread_cache.put(id, dmc); + } + } + } + + public void contextChanged(RunControlContext[] contexts) { + } + + public void contextException(String context, String msg) { + } + + public void contextRemoved(String[] context_ids) { + for (String id : context_ids) { + ProcessDMC dmc = process_cache.remove(id); + if (dmc != null) { + getSession().dispatchEvent(new ProcessExitedEvent(root_dmc, dmc), getProperties()); + } + else { + thread_cache.remove(id); + } + } + } + + public void contextResumed(String context) { + } + + public void contextSuspended(String context, String pc, + String reason, Map<String, Object> params) { + } + }; + + private final IProcesses tcf_prs_service; + private final com.windriver.tcf.api.services.IRunControl tcf_run_service; + private final Map<String,ProcessDMC> process_cache = new HashMap<String,ProcessDMC>(); // all attached processes + private final Map<String,ThreadDMC> thread_cache = new HashMap<String,ThreadDMC>(); // only some of attached threads + private final ProcessDMC root_dmc = new ProcessDMC(null, null); private IDMContext service_dmc; - - TCFDSFNativeProcesses(DsfSession session, IChannel channel) { + + public TCFDSFNativeProcesses(DsfSession session, IChannel channel, final RequestMonitor monitor) { super(session); - service = channel.getRemoteService(IProcesses.class); + tcf_prs_service = channel.getRemoteService(IProcesses.class); + tcf_run_service = channel.getRemoteService(com.windriver.tcf.api.services.IRunControl.class); + if (tcf_run_service != null) tcf_run_service.addListener(run_listener); service_dmc = new ServiceDMContext(this, "#native_process"); + initialize(new RequestMonitor(getExecutor(), monitor) { + @Override + protected void handleOK() { + String[] class_names = { + INativeProcesses.class.getName(), + TCFDSFNativeProcesses.class.getName() + }; + register(class_names, new Hashtable<String,String>()); + monitor.done(); + } + }); + } + + @Override + public void initialize(final RequestMonitor monitor) { + final Collection<String> list = new ArrayList<String>(); + final Set<IToken> cmds = new HashSet<IToken>(); + final IProcesses.DoneGetChildren done = new IProcesses.DoneGetChildren() { + public void doneGetChildren(IToken token, Exception error, String[] context_ids) { + if (cmds.isEmpty()) return; + assert cmds.contains(token); + cmds.remove(token); + if (error != null) { + for (IToken t : cmds) t.cancel(); + cmds.clear(); + monitor.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Command error", error)); //$NON-NLS-1$ + monitor.done(); + } + else { + for (String id : context_ids) { + list.add(id); + cmds.add(tcf_prs_service.getChildren(id, true, this)); + } + if (cmds.isEmpty()) { + for (String id : list) { + assert id != null; + if (process_cache.get(id) != null) continue; + process_cache.put(id, new ProcessDMC(id, root_dmc)); + } + process_cache.put(null, root_dmc); + TCFDSFNativeProcesses.super.initialize(monitor); + } + } + } + }; + cmds.add(tcf_prs_service.getChildren(null, true, done)); + } + + @Override + public void shutdown(RequestMonitor monitor) { + unregister(); + super.shutdown(monitor); } @Override @@ -168,30 +317,170 @@ public class TCFDSFNativeProcesses extends AbstractDsfService implements INative public boolean isValid() { return true; } - - public void attachDebuggerToProcess(IProcessDMContext ctx, RequestMonitor rm) { - // TODO Auto-generated method stub - assert false; + + public void attachDebuggerToProcess(IProcessDMContext ctx, final RequestMonitor rm) { + if (tcf_prs_service == null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Service not available", null)); //$NON-NLS-1$ + rm.done(); + } + else if (ctx instanceof ProcessDMC) { + final ProcessDMC p = (ProcessDMC)ctx; + tcf_prs_service.getContext(p.id, new IProcesses.DoneGetContext() { + public void doneGetContext(IToken token, Exception error, ProcessContext context) { + if (rm.isCanceled()) return; + if (error != null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Cannot read processs attributes", error)); //$NON-NLS-1$ + rm.done(); + } + else if (context == null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Invalid processs ID", error)); //$NON-NLS-1$ + rm.done(); + } + else { + context.attach(new IProcesses.DoneCommand() { + public void doneCommand(IToken token, Exception error) { + if (rm.isCanceled()) return; + if (error != null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Cannot attach a process", error)); //$NON-NLS-1$ + } + assert error != null || process_cache.get(p.id) != null; + rm.done(); + } + }); + } + } + }); + } + else { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$ + rm.done(); + } } - public void canTerminate(IDMContext ctx, DataRequestMonitor<Boolean> rm) { - // TODO Auto-generated method stub - assert false; + public void canTerminate(IDMContext ctx, final DataRequestMonitor<Boolean> rm) { + rm.setData(false); + if (tcf_prs_service == null) { + rm.done(); + } + else if (ctx instanceof ProcessDMC) { + ProcessDMC p = (ProcessDMC)ctx; + tcf_prs_service.getContext(p.id, new IProcesses.DoneGetContext() { + public void doneGetContext(IToken token, Exception error, ProcessContext context) { + if (rm.isCanceled()) return; + if (error != null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Cannot read processs attributes", error)); //$NON-NLS-1$ + } + else if (context == null) { + rm.setData(false); + } + else { + rm.setData(context.canTerminate()); + } + rm.done(); + } + }); + } + else { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$ + rm.done(); + } } - public void terminate(IDMContext ctx, RequestMonitor requestMonitor) { - // TODO Auto-generated method stub - assert false; + public void terminate(IDMContext ctx, final RequestMonitor rm) { + if (tcf_prs_service == null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Service not available", null)); //$NON-NLS-1$ + rm.done(); + } + else if (ctx instanceof ProcessDMC) { + ProcessDMC p = (ProcessDMC)ctx; + tcf_prs_service.getContext(p.id, new IProcesses.DoneGetContext() { + public void doneGetContext(IToken token, Exception error, ProcessContext context) { + if (rm.isCanceled()) return; + if (error != null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Cannot read processs attributes", error)); //$NON-NLS-1$ + rm.done(); + } + else if (context == null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Invalid processs ID", error)); //$NON-NLS-1$ + rm.done(); + } + else { + context.terminate(new IProcesses.DoneCommand() { + public void doneCommand(IToken token, Exception error) { + if (rm.isCanceled()) return; + if (error != null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Cannot terminate a process", error)); //$NON-NLS-1$ + } + rm.done(); + } + }); + } + } + }); + } + else { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$ + rm.done(); + } } - public void debugNewProcess(String file, DataRequestMonitor<IProcessDMContext> rm) { - // TODO Auto-generated method stub - assert false; + public void debugNewProcess(String file, final DataRequestMonitor<IProcessDMContext> rm) { + if (tcf_prs_service == null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Service not available", null)); //$NON-NLS-1$ + rm.done(); + } + else { + tcf_prs_service.start(null, file, null, null, true, new IProcesses.DoneStart() { + public void doneStart(IToken token, Exception error, ProcessContext process) { + if (error != null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Cannot start a process", error)); //$NON-NLS-1$ + } + else { + ProcessDMC dmc = process_cache.get(process.getID()); + assert dmc != null; + rm.setData(dmc); + } + rm.done(); + } + }); + } } - public void runNewProcess(String file, DataRequestMonitor<IProcessDMContext> rm) { - // TODO Auto-generated method stub - assert false; + public void runNewProcess(String file, final DataRequestMonitor<IProcessDMContext> rm) { + if (tcf_prs_service == null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Service not available", null)); //$NON-NLS-1$ + rm.done(); + } + else { + tcf_prs_service.start(null, file, null, null, false, new IProcesses.DoneStart() { + public void doneStart(IToken token, Exception error, ProcessContext process) { + if (error != null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Cannot start a process", error)); //$NON-NLS-1$ + } + else { + assert process_cache.get(process.getID()) == null; + rm.setData(new ProcessDMC(process.getID(), root_dmc)); + } + rm.done(); + } + }); + } } public IProcessDMContext getProcessForDebugContext(IDMContext ctx) { @@ -200,7 +489,7 @@ public class TCFDSFNativeProcesses extends AbstractDsfService implements INative } if (ctx instanceof TCFDSFExecutionDMC) { String id = ((TCFDSFExecutionDMC)ctx).getTcfContextId(); - return new ProcessDMC(id); + return process_cache.get(id); } return null; } @@ -211,36 +500,16 @@ public class TCFDSFNativeProcesses extends AbstractDsfService implements INative } if (ctx instanceof TCFDSFExecutionDMC) { String id = ((TCFDSFExecutionDMC)ctx).getTcfContextId(); - return new ThreadDMC(id); + ThreadDMC dmc = thread_cache.get(id); + if (dmc == null) dmc = new ThreadDMC(id); + return dmc; } return null; } - public void getProcessesBeingDebugged(final DataRequestMonitor<IProcessDMContext[]> rm) { - final Collection<String> list = new ArrayList<String>(); - final Set<IToken> cmds = new HashSet<IToken>(); - final IProcesses.DoneGetChildren done = new IProcesses.DoneGetChildren() { - public void doneGetChildren(IToken token, Exception error, String[] context_ids) { - if (cmds.isEmpty()) return; - assert cmds.contains(token); - cmds.remove(token); - if (error != null) { - for (IToken t : cmds) t.cancel(); - cmds.clear(); - rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, - REQUEST_FAILED, "Command error", error)); //$NON-NLS-1$ - rm.done(); - } - else { - for (String id : context_ids) { - list.add(id); - cmds.add(service.getChildren(id, true, this)); - } - if (cmds.isEmpty()) createDMContexts(list, rm); - } - } - }; - cmds.add(service.getChildren(null, true, done)); + public void getProcessesBeingDebugged(DataRequestMonitor<IProcessDMContext[]> rm) { + rm.setData(process_cache.values().toArray(new IProcessDMContext[process_cache.size()])); + rm.done(); } public void getRunningProcesses(final DataRequestMonitor<IProcessDMContext[]> rm) { @@ -261,72 +530,85 @@ public class TCFDSFNativeProcesses extends AbstractDsfService implements INative else { for (String id : context_ids) { list.add(id); - cmds.add(service.getChildren(id, false, this)); + cmds.add(tcf_prs_service.getChildren(id, false, this)); + } + if (cmds.isEmpty()) { + int cnt = 0; + IProcessDMContext[] data = new IProcessDMContext[list.size()]; + for (String id : list) { + assert id != null; + data[cnt] = process_cache.get(id); + if (data[cnt] == null) data[cnt] = new ProcessDMC(id, root_dmc); + cnt++; + } + rm.setData(data); + rm.done(); } - if (cmds.isEmpty()) createDMContexts(list, rm); } } }; - cmds.add(service.getChildren(null, false, done)); + cmds.add(tcf_prs_service.getChildren(null, false, done)); } @SuppressWarnings("unchecked") public void getModelData(IDMContext dmc, final DataRequestMonitor<?> rm) { if (dmc instanceof ProcessDMC) { - service.getContext(((ProcessDMC)dmc).id, new IProcesses.DoneGetContext() { + getProcessData((ProcessDMC)dmc, (DataRequestMonitor<IProcessDMData>)rm); + } + else if (dmc instanceof ThreadDMC) { + getThreadData((ThreadDMC)dmc, (DataRequestMonitor<IThreadDMData>)rm); + } + else if (dmc == service_dmc) { + ((DataRequestMonitor<TCFDSFNativeProcesses>)rm).setData(this); + rm.done(); + } + else { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$ + rm.done(); + } + } + + public void getProcessData(IProcessDMContext dmc, final DataRequestMonitor<IProcessDMData> rm) { + if (dmc instanceof ProcessDMC) { + tcf_prs_service.getContext(((ProcessDMC)dmc).id, new IProcesses.DoneGetContext() { @SuppressWarnings("unchecked") public void doneGetContext(IToken token, Exception error, ProcessContext context) { + if (rm.isCanceled()) return; if (error != null) { rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, - REQUEST_FAILED, "Data error", error)); //$NON-NLS-1$ + REQUEST_FAILED, "Cannot read processs attributes", error)); //$NON-NLS-1$ } - else { - ((DataRequestMonitor<IProcessDMData>)rm).setData(new ProcessData(context)); - } - rm.done(); - } - }); - } - else if (dmc instanceof ThreadDMC) { - service.getContext(((ProcessDMC)dmc).id, new IProcesses.DoneGetContext() { - - @SuppressWarnings("unchecked") - public void doneGetContext(IToken token, Exception error, ProcessContext context) { - if (error != null) { + else if (context == null) { rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, - REQUEST_FAILED, "Data error", error)); //$NON-NLS-1$ + REQUEST_FAILED, "Invalid processs ID", error)); //$NON-NLS-1$ } else { - ((DataRequestMonitor<IThreadDMData>)rm).setData(new ThreadData(context)); + rm.setData(new ProcessData(context)); } rm.done(); } }); } - else if (dmc == service_dmc) { - ((DataRequestMonitor<TCFDSFNativeProcesses>)rm).setData(this); - rm.done(); - } else { rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$ rm.done(); } } - - private void createDMContexts(Collection<String> ids, DataRequestMonitor<IProcessDMContext[]> rm) { - assert false; - } - - public void getProcessData(IProcessDMContext dmc, - DataRequestMonitor<IProcessDMData> rm) { - // TODO Auto-generated method stub - - } - public void getThreadData(IThreadDMContext dmc, DataRequestMonitor<IThreadDMData> rm) { - // TODO Auto-generated method stub - assert false; + public void getThreadData(IThreadDMContext dmc, final DataRequestMonitor<IThreadDMData> rm) { + if (dmc instanceof ThreadDMC) { + String id = ((ThreadDMC)dmc).id; + TCFDSFRunControl rc = getServicesTracker().getService(TCFDSFRunControl.class); + rm.setData(new ThreadData(rc.getContext(id))); + rm.done(); + } + else { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$ + rm.done(); + } } } diff --git a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFProcessDMC.java b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFProcessDMC.java index 427fb92bf..e6c673e79 100644 --- a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFProcessDMC.java +++ b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFProcessDMC.java @@ -16,7 +16,7 @@ import org.eclipse.dd.dsf.debug.service.INativeProcesses.IProcessDMContext; import org.eclipse.dd.dsf.service.IDsfService; public abstract class TCFDSFProcessDMC extends AbstractDMContext implements IProcessDMContext { - + TCFDSFProcessDMC(IDsfService service, IDMContext[] parents) { super(service, parents); } diff --git a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFRegisters.java b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFRegisters.java new file mode 100644 index 000000000..80abe7aee --- /dev/null +++ b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFRegisters.java @@ -0,0 +1,1060 @@ +/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package com.windriver.tcf.dsf.core.services;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
+import org.eclipse.dd.dsf.concurrent.RequestMonitor;
+import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
+import org.eclipse.dd.dsf.datamodel.AbstractDMEvent;
+import org.eclipse.dd.dsf.datamodel.IDMContext;
+import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
+import org.eclipse.dd.dsf.debug.service.IRunControl.StateChangeReason;
+import org.eclipse.dd.dsf.service.AbstractDsfService;
+import org.eclipse.dd.dsf.service.DsfServiceEventHandler;
+import org.eclipse.dd.dsf.service.DsfSession;
+import org.osgi.framework.BundleContext;
+
+import com.windriver.tcf.api.protocol.IChannel;
+import com.windriver.tcf.api.protocol.IToken;
+import com.windriver.tcf.api.services.IRegisters.DoneGet;
+import com.windriver.tcf.api.services.IRegisters.DoneSet;
+import com.windriver.tcf.api.services.IRegisters.NamedValue;
+import com.windriver.tcf.dsf.core.Activator;
+
+public class TCFDSFRegisters extends AbstractDsfService implements org.eclipse.dd.dsf.debug.service.IRegisters {
+
+ private class ObjectDMC extends AbstractDMContext implements IFormattedDataDMContext {
+
+ final String id;
+ final RegistersCache children;
+ final Map<String,ValueDMC> values;
+
+ com.windriver.tcf.api.services.IRegisters.RegistersContext context;
+ boolean disposed;
+
+ ObjectDMC(String session_id, IDMContext[] parents, String id) {
+ super(session_id, parents);
+ this.id = id;
+ children = new RegistersCache(channel, id, new IDMContext[]{ this });
+ values = new HashMap<String,ValueDMC>();
+ model.put(id, this);
+ }
+
+ ObjectDMC(String session_id, IDMContext[] parents, String id, RegistersCache children) {
+ super(session_id, parents);
+ this.id = id;
+ this.children = children;
+ values = new HashMap<String,ValueDMC>();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return super.baseEquals(other) && ((ObjectDMC)other).id.equals(id);
+ }
+
+ @Override
+ public int hashCode() {
+ return id.hashCode();
+ }
+
+ public String getName() {
+ return context.getName();
+ }
+
+ void dispose() {
+ assert !disposed;
+ children.dispose();
+ for (ValueDMC v : values.values()) v.dispose();
+ values.clear();
+ model.remove(id);
+ disposed = true;
+ }
+ }
+
+ private class RegisterGroupDMC extends ObjectDMC implements IRegisterGroupDMContext {
+
+ RegisterGroupDMC(String session_id, IDMContext[] parents, String id) {
+ super(session_id, parents, id);
+ }
+
+ /* Constructor for a fake register group - DSF requires at least one group object */
+ RegisterGroupDMC(String session_id, IDMContext[] parents, final String id, RegistersCache children) {
+ super(session_id, parents, id, children);
+ context = new com.windriver.tcf.api.services.IRegisters.RegistersContext() {
+ public String[] getAvailableFormats() {
+ return null;
+ }
+ public int[] getBitNumbers() {
+ return null;
+ }
+ public String getDescription() {
+ return null;
+ }
+ public int getFirstBitNumber() {
+ return 0;
+ }
+ public String getID() {
+ return id;
+ }
+ public String getName() {
+ return null;
+ }
+ public NamedValue[] getNamedValues() {
+ return null;
+ }
+ public String getParentID() {
+ return null;
+ }
+ public Map<String, Object> getProperties() {
+ return null;
+ }
+ public boolean hasSideEffects() {
+ return false;
+ }
+ public boolean isBigEndian() {
+ return false;
+ }
+ public boolean isFloat() {
+ return false;
+ }
+ public boolean isLeftToRight() {
+ return false;
+ }
+ public boolean isReadOnce() {
+ return false;
+ }
+ public boolean isReadable() {
+ return false;
+ }
+ public boolean isVolatile() {
+ return false;
+ }
+ public boolean isWriteOnce() {
+ return false;
+ }
+ public boolean isWriteable() {
+ return false;
+ }
+ public IToken get(String format, DoneGet done) {
+ throw new Error();
+ }
+ public IToken set(String format, String value, DoneSet done) {
+ throw new Error();
+ }
+ };
+ }
+ }
+
+ private class RegisterDMC extends ObjectDMC implements IRegisterDMContext {
+
+ RegisterDMC(String session_id, IDMContext[] parents, String id) {
+ super(session_id, parents, id);
+ }
+ }
+
+ private class BitFieldDMC extends ObjectDMC implements IBitFieldDMContext {
+
+ BitFieldDMC(String session_id, IDMContext[] parents, String id) {
+ super(session_id, parents, id);
+ }
+ }
+
+ private class ValueDMC extends FormattedValueDMContext {
+
+ final RegisterValueCache cache;
+
+ boolean disposed;
+
+ ValueDMC(ObjectDMC parent, String fmt) {
+ super(TCFDSFRegisters.this, parent, fmt);
+ cache = new RegisterValueCache(channel, parent.context, fmt);
+ }
+
+ void dispose() {
+ assert !disposed;
+ cache.dispose();
+ disposed = true;
+ }
+ }
+
+ private class RegisterGroupData implements IRegisterGroupDMData {
+
+ final com.windriver.tcf.api.services.IRegisters.RegistersContext context;
+
+ RegisterGroupData(com.windriver.tcf.api.services.IRegisters.RegistersContext context) {
+ this.context = context;
+ }
+
+ public String getDescription() {
+ return context.getDescription();
+ }
+
+ public String getName() {
+ return context.getName();
+ }
+ }
+
+ private class RegisterData implements IRegisterDMData {
+
+ final com.windriver.tcf.api.services.IRegisters.RegistersContext context;
+
+ RegisterData(com.windriver.tcf.api.services.IRegisters.RegistersContext context) {
+ this.context = context;
+ }
+
+ public String getDescription() {
+ return context.getDescription();
+ }
+
+ public String getName() {
+ return context.getName();
+ }
+
+ public boolean hasSideEffects() {
+ return context.hasSideEffects();
+ }
+
+ public boolean isFloat() {
+ return context.isFloat();
+ }
+
+ public boolean isReadOnce() {
+ return context.isReadOnce();
+ }
+
+ public boolean isReadable() {
+ return context.isReadable();
+ }
+
+ public boolean isVolatile() {
+ return context.isVolatile();
+ }
+
+ public boolean isWriteOnce() {
+ return context.isWriteOnce();
+ }
+
+ public boolean isWriteable() {
+ return context.isWriteable();
+ }
+ }
+
+ private class BitFieldData implements IBitFieldDMData {
+
+ final com.windriver.tcf.api.services.IRegisters.RegistersContext context;
+
+ IMnemonic[] mnemonics;
+ IBitGroup[] bit_groups;
+
+ BitFieldData(com.windriver.tcf.api.services.IRegisters.RegistersContext context) {
+ this.context = context;
+ }
+
+ public IBitGroup[] getBitGroup() {
+ if (bit_groups == null) {
+ int[] arr = context.getBitNumbers();
+ if (arr == null) {
+ bit_groups = new IBitGroup[0];
+ }
+ else {
+ Arrays.sort(arr);
+ ArrayList<IBitGroup> l = new ArrayList<IBitGroup>();
+ int i = 0;
+ while (i < arr.length) {
+ int j = i;
+ while (j + 1 < arr.length && arr[j + 1] == arr[j] + 1) j++;
+ final int i0 = i;
+ final int i1 = j;
+ l.add(new IBitGroup() {
+ public int bitCount() {
+ return i1 - i0 + 1;
+ }
+ public int startBit() {
+ return i0;
+ }
+ });
+ i = j + 1;
+ }
+ bit_groups = l.toArray(new IBitGroup[l.size()]);
+ }
+ }
+ return bit_groups;
+ }
+
+ public IMnemonic getCurrentMnemonicValue() {
+ // TODO getCurrentMnemonicValue() should be async
+ return null;
+ }
+
+ public String getDescription() {
+ return context.getDescription();
+ }
+
+ public IMnemonic[] getMnemonics() {
+ if (mnemonics == null) {
+ NamedValue[] arr = context.getNamedValues();
+ if (arr == null) {
+ mnemonics = new IMnemonic[0];
+ }
+ else {
+ int cnt = 0;
+ mnemonics = new IMnemonic[arr.length];
+ for (final NamedValue v : arr) {
+ mnemonics[cnt++] = new IMnemonic() {
+ public String getLongName() {
+ return v.getDescription();
+ }
+ public String getShortName() {
+ return v.getName();
+ }
+ };
+ }
+ }
+ }
+ return mnemonics;
+ }
+
+ public String getName() {
+ return context.getName();
+ }
+
+ public boolean hasSideEffects() {
+ return context.hasSideEffects();
+ }
+
+ public boolean isReadOnce() {
+ return context.isReadOnce();
+ }
+
+ public boolean isReadable() {
+ return context.isReadable();
+ }
+
+ public boolean isWriteOnce() {
+ return context.isWriteOnce();
+ }
+
+ public boolean isWriteable() {
+ return context.isWriteable();
+ }
+
+ public boolean isZeroBasedNumbering() {
+ return context.getFirstBitNumber() == 0;
+ }
+
+ public boolean isZeroBitLeftMost() {
+ return context.isLeftToRight();
+ }
+ }
+
+ private class RegistersCache extends TCFDataCache<Map<String,ObjectDMC>>
+ implements TCFDSFExecutionDMC.DataCache {
+
+ final String id;
+ final IDMContext[] parents;
+
+ boolean disposed;
+
+ public RegistersCache(IChannel channel, String id, IDMContext[] parents) {
+ super(channel);
+ this.id = id;
+ this.parents = parents;
+ }
+
+ void invalidateRegContents() {
+ if (data == null) return;
+ for (ObjectDMC dmc : data.values()) {
+ for (ValueDMC val : dmc.values.values()) val.cache.reset();
+ dmc.children.invalidateRegContents();
+ }
+ }
+
+ void dispose() {
+ assert !disposed;
+ if (data != null) {
+ for (ObjectDMC dmc : data.values()) dmc.dispose();
+ }
+ reset();
+ disposed = true;
+ }
+
+ @Override
+ public boolean startDataRetrieval() {
+ assert command == null;
+ assert !disposed;
+ if (tcf_reg_service == null) {
+ data = null;
+ valid = true;
+ return true;
+ }
+ command = tcf_reg_service.getChildren(id, new com.windriver.tcf.api.services.IRegisters.DoneGetChildren() {
+ public void doneGetChildren(IToken token, Exception err, String[] contexts) {
+ if (command != token) return;
+ command = null;
+ if (err != null) {
+ data = null;
+ error = err;
+ }
+ else {
+ data = new LinkedHashMap<String,ObjectDMC>();
+ if (contexts.length > 0) {
+ // TODO DSF service design does not support lazy retrieval of context attributes (because getName() is not async)
+ final Set<IToken> cmds = new HashSet<IToken>();
+ final IToken cb = new IToken() {
+ public boolean cancel() {
+ for (IToken x : cmds) x.cancel();
+ return false;
+ }
+ };
+ command = cb;
+ com.windriver.tcf.api.services.IRegisters.DoneGetContext done = new com.windriver.tcf.api.services.IRegisters.DoneGetContext() {
+ public void doneGetContext(IToken token, Exception err,
+ com.windriver.tcf.api.services.IRegisters.RegistersContext context) {
+ cmds.remove(token);
+ if (command != cb) return;
+ if (err != null) {
+ command.cancel();
+ command = null;
+ data = null;
+ error = err;
+ valid = true;
+ validate();
+ return;
+ }
+ String id = context.getID();
+ ObjectDMC dmc = null;
+ if (context.getBitNumbers() != null) {
+ dmc = new BitFieldDMC(getSession().getId(), parents, id);
+ }
+ else if (context.isReadable() || context.isWriteable()) {
+ dmc = new RegisterDMC(getSession().getId(), parents, id);
+ }
+ else {
+ dmc = new RegisterGroupDMC(getSession().getId(), parents, id);
+ }
+ dmc.context = context;
+ data.put(id, dmc);
+ if (cmds.isEmpty()) {
+ command = null;
+ valid = true;
+ validate();
+ }
+ }
+ };
+ for (String id : contexts) {
+ cmds.add(tcf_reg_service.getContext(id, done));
+ }
+ return;
+ }
+ }
+ valid = true;
+ validate();
+ }
+ });
+ return false;
+ }
+ }
+
+ private class RegisterValueCache extends TCFDataCache<FormattedValueDMData> {
+
+ final com.windriver.tcf.api.services.IRegisters.RegistersContext context;
+ final String fmt;
+
+ boolean disposed;
+
+ public RegisterValueCache(IChannel channel,
+ com.windriver.tcf.api.services.IRegisters.RegistersContext context, String fmt) {
+ super(channel);
+ this.context = context;
+ this.fmt = fmt;
+ }
+
+ @Override
+ public boolean startDataRetrieval() {
+ assert command == null;
+ assert tcf_reg_service != null;
+ assert context != null;
+ assert !disposed;
+ command = context.get(fmt, new com.windriver.tcf.api.services.IRegisters.DoneGet() {
+ public void doneGet(IToken token, Exception err, String value) {
+ if (command != token) return;
+ command = null;
+ if (err != null) {
+ data = null;
+ error = err;
+ }
+ else {
+ data = new FormattedValueDMData(value);
+ }
+ valid = true;
+ validate();
+ }
+ });
+ return false;
+ }
+
+ void dispose() {
+ assert !disposed;
+ reset();
+ disposed = true;
+ }
+ }
+
+ private static class RegisterGroupChangedEvent extends AbstractDMEvent<IRegisterGroupDMContext>
+ implements IGroupChangedDMEvent {
+
+ public RegisterGroupChangedEvent(IRegisterGroupDMContext context) {
+ super(context);
+ }
+ }
+
+ private static class RegisterChangedEvent extends AbstractDMEvent<IRegisterDMContext>
+ implements IRegisterChangedDMEvent {
+
+ public RegisterChangedEvent(IRegisterDMContext context) {
+ super(context);
+ }
+ }
+
+ private static class BitFieldChangedEvent extends AbstractDMEvent<IBitFieldDMContext>
+ implements IBitFieldChangedDMEvent {
+
+ public BitFieldChangedEvent(IBitFieldDMContext context) {
+ super(context);
+ }
+ }
+
+ private static class GroupsChangedEvent
+ extends AbstractDMEvent<org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext>
+ implements IGroupsChangedDMEvent {
+
+ public GroupsChangedEvent(IExecutionDMContext context) {
+ super(context);
+ }
+ }
+
+ private final com.windriver.tcf.api.services.IRegisters.RegistersListener listener =
+ new com.windriver.tcf.api.services.IRegisters.RegistersListener() {
+
+ public void contextChanged() {
+ TCFDSFRunControl rc = getServicesTracker().getService(TCFDSFRunControl.class);
+ for (TCFDSFExecutionDMC dmc : rc.getCachedContexts()) {
+ RegistersCache c = (RegistersCache)dmc.registers_cache;
+ if (c != null) {
+ c.dispose();
+ dmc.registers_cache = null;
+ getSession().dispatchEvent(new GroupsChangedEvent(dmc), getProperties());
+ }
+ }
+ }
+
+ public void registerChanged(String id) {
+ ObjectDMC dmc = model.get(id);
+ if (dmc != null) {
+ for (ValueDMC val : dmc.values.values()) val.cache.reset();
+ dmc.children.invalidateRegContents();
+ if (dmc instanceof RegisterGroupDMC) {
+ getSession().dispatchEvent(new RegisterGroupChangedEvent((RegisterGroupDMC)dmc), getProperties());
+ }
+ else if (dmc instanceof RegisterDMC) {
+ getSession().dispatchEvent(new RegisterChangedEvent((RegisterDMC)dmc), getProperties());
+ }
+ else if (dmc instanceof BitFieldDMC) {
+ getSession().dispatchEvent(new BitFieldChangedEvent((BitFieldDMC)dmc), getProperties());
+ }
+ }
+ }
+ };
+
+ private final IChannel channel;
+ private final com.windriver.tcf.api.services.IRegisters tcf_reg_service;
+ private final Map<String,ObjectDMC> model;
+
+ public TCFDSFRegisters(DsfSession session, IChannel channel, final RequestMonitor monitor) {
+ super(session);
+ this.channel = channel;
+ model = new HashMap<String,ObjectDMC>();
+ tcf_reg_service = channel.getRemoteService(com.windriver.tcf.api.services.IRegisters.class);
+ if (tcf_reg_service != null) tcf_reg_service.addListener(listener);
+ initialize(new RequestMonitor(getExecutor(), monitor) {
+ @Override
+ protected void handleOK() {
+ String[] class_names = {
+ org.eclipse.dd.dsf.debug.service.IRegisters.class.getName(),
+ TCFDSFRegisters.class.getName()
+ };
+ register(class_names, new Hashtable<String,String>());
+ getSession().addServiceEventListener(TCFDSFRegisters.this, null);
+ monitor.done();
+ }
+ });
+ }
+
+ @Override
+ public void shutdown(RequestMonitor monitor) {
+ getSession().removeServiceEventListener(this);
+ unregister();
+ super.shutdown(monitor);
+ }
+
+ @Override
+ protected BundleContext getBundleContext() {
+ return Activator.getBundleContext();
+ }
+
+ public void getRegisterGroupData(IRegisterGroupDMContext dmc, DataRequestMonitor<IRegisterGroupDMData> rm) {
+ if (tcf_reg_service == null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Registers service is not available", null)); //$NON-NLS-1$
+ }
+ else if (dmc instanceof RegisterGroupDMC) {
+ if (((ObjectDMC)dmc).disposed) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Disposed DMC", null)); //$NON-NLS-1$
+ }
+ else {
+ rm.setData(new RegisterGroupData(((RegisterGroupDMC)dmc).context));
+ }
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+
+ public void getRegisterData(IRegisterDMContext dmc, DataRequestMonitor<IRegisterDMData> rm) {
+ if (tcf_reg_service == null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Registers service is not available", null)); //$NON-NLS-1$
+ }
+ else if (dmc instanceof RegisterDMC) {
+ if (((ObjectDMC)dmc).disposed) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Disposed DMC", null)); //$NON-NLS-1$
+ }
+ else {
+ rm.setData(new RegisterData(((RegisterDMC)dmc).context));
+ }
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+
+ public void getBitFieldData(IBitFieldDMContext dmc, DataRequestMonitor<IBitFieldDMData> rm) {
+ if (tcf_reg_service == null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Registers service is not available", null)); //$NON-NLS-1$
+ }
+ else if (dmc instanceof BitFieldDMC) {
+ if (((ObjectDMC)dmc).disposed) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Disposed DMC", null)); //$NON-NLS-1$
+ }
+ else {
+ rm.setData(new BitFieldData(((BitFieldDMC)dmc).context));
+ }
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+
+ public void getRegisterGroups(final IDMContext dmc, final DataRequestMonitor<IRegisterGroupDMContext[]> rm) {
+ if (rm.isCanceled()) return;
+ RegistersCache cache = null;
+ if (tcf_reg_service == null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Registers service is not available", null)); //$NON-NLS-1$
+ }
+ else if (dmc instanceof TCFDSFExecutionDMC) {
+ TCFDSFExecutionDMC exe = (TCFDSFExecutionDMC)dmc;
+ if (exe.registers_cache == null) exe.registers_cache =
+ new RegistersCache(channel, exe.getTcfContextId(), new IDMContext[]{ exe });
+ cache = (RegistersCache)exe.registers_cache;
+ }
+ else if (dmc instanceof ObjectDMC) {
+ if (((ObjectDMC)dmc).disposed) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Disposed DMC", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ cache = ((ObjectDMC)dmc).children;
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ }
+ if (cache != null) {
+ if (!cache.validate()) {
+ cache.addWaitingRequest(new IDataRequest() {
+ public void cancel() {
+ rm.setStatus(new Status(IStatus.CANCEL, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Canceled", null)); //$NON-NLS-1$
+ rm.setCanceled(true);
+ rm.done();
+ }
+ public void done() {
+ getRegisterGroups(dmc, rm);
+ }
+ });
+ return;
+ }
+ if (cache.getError() != null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Data error", cache.getError())); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ Map<String,ObjectDMC> c = cache.getData();
+ int cnt = 0;
+ for (IDMContext x : c.values()) {
+ if (x instanceof RegisterGroupDMC) cnt++;
+ }
+ if (cnt == 0 && c.size() > 0 && dmc instanceof TCFDSFExecutionDMC) {
+ // TODO DSF requires at least one group
+ RegisterGroupDMC[] arr = new RegisterGroupDMC[1];
+ arr[0] = new RegisterGroupDMC(getSession().getId(), cache.parents, cache.id, cache);
+ rm.setData(arr);
+ }
+ else {
+ RegisterGroupDMC[] arr = new RegisterGroupDMC[cnt];
+ cnt = 0;
+ for (IDMContext x : c.values()) {
+ if (x instanceof RegisterGroupDMC) arr[cnt++] = (RegisterGroupDMC)x;
+ }
+ rm.setData(arr);
+ }
+ }
+ rm.done();
+ }
+
+ public void getRegisterSubGroups(IDMContext dmc, DataRequestMonitor<IRegisterGroupDMContext[]> rm) {
+ getRegisterGroups(dmc, rm);
+ }
+
+ public void getRegisters(final IDMContext dmc, final DataRequestMonitor<IRegisterDMContext[]> rm) {
+ if (rm.isCanceled()) return;
+ RegistersCache cache = null;
+ if (tcf_reg_service == null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Registers service is not available", null)); //$NON-NLS-1$
+ }
+ else if (dmc instanceof TCFDSFExecutionDMC) {
+ TCFDSFExecutionDMC exe = (TCFDSFExecutionDMC)dmc;
+ if (exe.registers_cache == null) exe.registers_cache =
+ new RegistersCache(channel, exe.getTcfContextId(), new IDMContext[]{ exe });
+ cache = (RegistersCache)exe.registers_cache;
+ }
+ else if (dmc instanceof ObjectDMC) {
+ if (((ObjectDMC)dmc).disposed) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Disposed DMC", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ cache = ((ObjectDMC)dmc).children;
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ }
+ if (cache != null) {
+ if (!cache.validate()) {
+ cache.addWaitingRequest(new IDataRequest() {
+ public void cancel() {
+ rm.setStatus(new Status(IStatus.CANCEL, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Canceled", null)); //$NON-NLS-1$
+ rm.setCanceled(true);
+ rm.done();
+ }
+ public void done() {
+ getRegisters(dmc, rm);
+ }
+ });
+ return;
+ }
+ if (cache.getError() != null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Data error", cache.getError())); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ Map<String,ObjectDMC> c = cache.getData();
+ int cnt = 0;
+ for (IDMContext x : c.values()) {
+ if (x instanceof RegisterDMC) cnt++;
+ }
+ RegisterDMC[] arr = new RegisterDMC[cnt];
+ cnt = 0;
+ for (IDMContext x : c.values()) {
+ if (x instanceof RegisterDMC) arr[cnt++] = (RegisterDMC)x;
+ }
+ rm.setData(arr);
+ }
+ rm.done();
+ }
+
+ public void getBitFields(final IDMContext dmc, final DataRequestMonitor<IBitFieldDMContext[]> rm) {
+ if (rm.isCanceled()) return;
+ if (tcf_reg_service == null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Registers service is not available", null)); //$NON-NLS-1$
+ }
+ else if (dmc instanceof ObjectDMC) {
+ if (((ObjectDMC)dmc).disposed) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Disposed DMC", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ RegistersCache cache = ((ObjectDMC)dmc).children;
+ if (!cache.validate()) {
+ cache.addWaitingRequest(new IDataRequest() {
+ public void cancel() {
+ rm.setStatus(new Status(IStatus.CANCEL, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Canceled", null)); //$NON-NLS-1$
+ rm.setCanceled(true);
+ rm.done();
+ }
+ public void done() {
+ getBitFields(dmc, rm);
+ }
+ });
+ return;
+ }
+ if (cache.getError() != null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Data error", cache.getError())); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ Map<String,ObjectDMC> c = cache.getData();
+ int cnt = 0;
+ for (IDMContext x : c.values()) {
+ if (x instanceof BitFieldDMC) cnt++;
+ }
+ BitFieldDMC[] arr = new BitFieldDMC[cnt];
+ cnt = 0;
+ for (IDMContext x : c.values()) {
+ if (x instanceof BitFieldDMC) arr[cnt++] = (BitFieldDMC)x;
+ }
+ rm.setData(arr);
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+
+ public void writeBitField(IDMContext dmc, String val, String fmt, final RequestMonitor rm) {
+ if (tcf_reg_service == null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Registers service is not available", null)); //$NON-NLS-1$
+ }
+ else if (dmc instanceof ObjectDMC) {
+ if (((ObjectDMC)dmc).disposed) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Disposed DMC", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ ((ObjectDMC)dmc).context.set(fmt, val, new com.windriver.tcf.api.services.IRegisters.DoneSet() {
+ public void doneSet(IToken token, Exception error) {
+ if (rm.isCanceled()) return;
+ if (error != null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Command error", error)); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+ });
+ return;
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+
+ public void writeBitField(IDMContext dmc, IMnemonic mnemonic, final RequestMonitor rm) {
+ if (tcf_reg_service == null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Registers service is not available", null)); //$NON-NLS-1$
+ }
+ else if (dmc instanceof ObjectDMC) {
+ if (((ObjectDMC)dmc).disposed) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Disposed DMC", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ NamedValue[] arr = ((ObjectDMC)dmc).context.getNamedValues();
+ if (arr != null) {
+ for (NamedValue nv : arr) {
+ if (nv.getName().equals(mnemonic.getShortName())) {
+ String fmt = com.windriver.tcf.api.services.IRegisters.FORMAT_DECIMAL;
+ String val = nv.getValue().toString();
+ ((ObjectDMC)dmc).context.set(fmt, val, new com.windriver.tcf.api.services.IRegisters.DoneSet() {
+ public void doneSet(IToken token, Exception error) {
+ if (rm.isCanceled()) return;
+ if (error != null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Command error", error)); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+ });
+ return;
+ }
+ }
+ }
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown mnemonic", null)); //$NON-NLS-1$
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+
+ public void writeRegister(IDMContext dmc, String val, String fmt, RequestMonitor rm) {
+ writeBitField(dmc, val, fmt, rm);
+ }
+
+ public void getAvailableFormats(IFormattedDataDMContext dmc, DataRequestMonitor<String[]> rm) {
+ if (tcf_reg_service == null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Registers service is not available", null)); //$NON-NLS-1$
+ }
+ else if (dmc instanceof ObjectDMC) {
+ rm.setData(((ObjectDMC)dmc).context.getAvailableFormats());
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+
+ public void getFormattedExpressionValue(final FormattedValueDMContext dmc,
+ final DataRequestMonitor<FormattedValueDMData> rm) {
+ if (rm.isCanceled()) return;
+ if (dmc instanceof ValueDMC) {
+ ValueDMC vmc = (ValueDMC)dmc;
+ if (vmc.disposed) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Disposed DMC", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ if (!vmc.cache.validate()) {
+ vmc.cache.addWaitingRequest(new IDataRequest() {
+ public void cancel() {
+ rm.setStatus(new Status(IStatus.CANCEL, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Canceled", null)); //$NON-NLS-1$
+ rm.setCanceled(true);
+ rm.done();
+ }
+ public void done() {
+ getFormattedExpressionValue(dmc, rm);
+ }
+ });
+ return;
+ }
+ if (vmc.cache.getError() != null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Data error", vmc.cache.getError())); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ rm.setData(vmc.cache.getData());
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ }
+ rm.done();
+ }
+
+ public FormattedValueDMContext getFormattedValueContext(IFormattedDataDMContext dmc, String fmt) {
+ if (dmc instanceof ObjectDMC) {
+ ObjectDMC omc = (ObjectDMC)dmc;
+ ValueDMC res = omc.values.get(fmt);
+ if (res == null) {
+ omc.values.put(fmt, res = new ValueDMC(omc, fmt));
+ }
+ return res;
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void getModelData(IDMContext dmc, DataRequestMonitor<?> rm) {
+ if (dmc instanceof RegisterGroupDMC) {
+ getRegisterGroupData((RegisterGroupDMC)dmc, (DataRequestMonitor<IRegisterGroupDMData>)rm);
+ }
+ else if (dmc instanceof RegisterDMC) {
+ getRegisterData((RegisterDMC)dmc, (DataRequestMonitor<IRegisterDMData>)rm);
+ }
+ else if (dmc instanceof BitFieldDMC) {
+ getBitFieldData((BitFieldDMC)dmc, (DataRequestMonitor<IBitFieldDMData>)rm);
+ }
+ else if (dmc instanceof FormattedValueDMContext) {
+ getFormattedExpressionValue((FormattedValueDMContext)dmc, (DataRequestMonitor<FormattedValueDMData>)rm);
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(org.eclipse.dd.dsf.debug.service.IRunControl.IResumedDMEvent e) {
+ if (e.getReason() != StateChangeReason.STEP) {
+ RegistersCache cache = (RegistersCache)((TCFDSFExecutionDMC)e.getDMContext()).registers_cache;
+ if (cache != null) cache.invalidateRegContents();
+ }
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(org.eclipse.dd.dsf.debug.service.IRunControl.ISuspendedDMEvent e) {
+ RegistersCache cache = (RegistersCache)((TCFDSFExecutionDMC)e.getDMContext()).registers_cache;
+ if (cache != null) cache.invalidateRegContents();
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(org.eclipse.dd.dsf.debug.service.IRunControl.IExitedDMEvent e) {
+ RegistersCache cache = (RegistersCache)((TCFDSFExecutionDMC)e.getExecutionContext()).registers_cache;
+ if (cache != null) cache.dispose();
+ }
+}
diff --git a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFRunControl.java b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFRunControl.java index 3564e25cf..6bfc207a0 100644 --- a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFRunControl.java +++ b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFRunControl.java @@ -10,12 +10,14 @@ *******************************************************************************/ package com.windriver.tcf.dsf.core.services; +import java.math.BigInteger; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; +import java.util.Hashtable; import java.util.Map; -import java.util.SortedMap; -import java.util.TreeMap; +import java.util.Set; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -24,21 +26,25 @@ import org.eclipse.dd.dsf.concurrent.RequestMonitor; import org.eclipse.dd.dsf.datamodel.AbstractDMEvent; import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.dsf.datamodel.ServiceDMContext; +import org.eclipse.dd.dsf.debug.model.DsfMemoryBlockRetrieval; import org.eclipse.dd.dsf.service.AbstractDsfService; import org.eclipse.dd.dsf.service.DsfSession; +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.model.IMemoryBlockRetrieval; +import org.eclipse.debug.core.model.IMemoryBlockRetrievalExtension; import org.osgi.framework.BundleContext; +import com.windriver.debug.tcf.core.model.ITCFConstants; import com.windriver.tcf.dsf.core.Activator; import com.windriver.tcf.api.protocol.IChannel; import com.windriver.tcf.api.protocol.IToken; -import com.windriver.tcf.api.protocol.Protocol; import com.windriver.tcf.api.services.IRunControl; import com.windriver.tcf.api.services.IRunControl.RunControlContext; public class TCFDSFRunControl extends AbstractDsfService implements org.eclipse.dd.dsf.debug.service.IRunControl { - + public static class SuspendedEvent extends AbstractDMEvent<IExecutionDMContext> implements ISuspendedDMEvent { - + private final StateChangeReason reason; public SuspendedEvent(IExecutionDMContext dmc, String reason) { @@ -74,7 +80,7 @@ public class TCFDSFRunControl extends AbstractDsfService implements org.eclipse. } public IExecutionDMContext getTriggeringContext() { - return model.get(trigger_id); + return cache.get(trigger_id); } public StateChangeReason getReason() { @@ -87,14 +93,14 @@ public class TCFDSFRunControl extends AbstractDsfService implements org.eclipse. public ContainerResumedEvent(IExecutionDMContext dmc) { super(dmc); } - + public StateChangeReason getReason() { return StateChangeReason.USER_REQUEST; } } public static class StartedEvent extends AbstractDMEvent<IContainerDMContext> implements IStartedDMEvent { - + private final IExecutionDMContext exe; public StartedEvent(IContainerDMContext dmc, IExecutionDMContext exe) { @@ -127,19 +133,22 @@ public class TCFDSFRunControl extends AbstractDsfService implements org.eclipse. return exe; } } - + private final com.windriver.tcf.api.services.IRunControl.RunControlListener run_listener = - new com.windriver.tcf.api.services.IRunControl.RunControlListener() { + new com.windriver.tcf.api.services.IRunControl.RunControlListener() { public void containerResumed(String[] context_ids) { for (String id : context_ids) { - ExecutionDMC n = model.get(id); + ExecutionDMC n = cache.get(id); if (n != null) n.onContextResumed(); } for (String id : context_ids) { - ExecutionDMC n = model.get(id); - if (n != null && n.ctx.isContainer()) { - getSession().dispatchEvent(new ContainerResumedEvent(n), getProperties()); + ExecutionDMC n = cache.get(id); + if (n != null && n.context.isValid()) { + RunControlContext c = n.context.getData(); + if (c.isContainer()) { + getSession().dispatchEvent(new ContainerResumedEvent(n), getProperties()); + } } } } @@ -148,98 +157,196 @@ public class TCFDSFRunControl extends AbstractDsfService implements org.eclipse. String reason, Map<String, Object> params, String[] suspended_ids) { if (trigger_id != null) { - ExecutionDMC n = model.get(trigger_id); + ExecutionDMC n = cache.get(trigger_id); if (n != null) n.onContextSuspended(pc, reason, params); } for (String id : suspended_ids) { if (id.equals(trigger_id)) continue; - ExecutionDMC n = model.get(id); + ExecutionDMC n = cache.get(id); if (n != null) n.onContainerSuspended(reason); } for (String id : suspended_ids) { - ExecutionDMC n = model.get(id); - if (n != null && n.ctx.isContainer()) { - getSession().dispatchEvent(new ContainerSuspendedEvent(n, trigger_id, reason), getProperties()); + ExecutionDMC n = cache.get(id); + if (n != null && n.context.isValid()) { + RunControlContext c = n.context.getData(); + if (c.isContainer()) { + getSession().dispatchEvent(new ContainerSuspendedEvent(n, trigger_id, reason), getProperties()); + } } } } public void contextAdded(RunControlContext[] contexts) { for (RunControlContext ctx : contexts) { - ExecutionDMC n = model.get(ctx.getParentID()); + ExecutionDMC n = cache.get(ctx.getParentID()); if (n != null) n.onContextAdded(ctx); } } public void contextChanged(RunControlContext[] contexts) { for (RunControlContext ctx : contexts) { - ExecutionDMC n = model.get(ctx.getID()); + ExecutionDMC n = cache.get(ctx.getID()); if (n != null) n.onContextChanged(ctx); } } public void contextException(String id, String msg) { - ExecutionDMC n = model.get(id); + ExecutionDMC n = cache.get(id); if (n != null) n.onContextException(msg); } public void contextRemoved(String[] context_ids) { for (String id : context_ids) { - ExecutionDMC n = model.get(id); + ExecutionDMC n = cache.get(id); if (n != null) n.onContextRemoved(); } } public void contextResumed(String id) { - ExecutionDMC n = model.get(id); + ExecutionDMC n = cache.get(id); if (n != null) n.onContextResumed(); } public void contextSuspended(String id, String pc, String reason, Map<String, Object> params) { - ExecutionDMC n = model.get(id); + ExecutionDMC n = cache.get(id); if (n != null) n.onContextSuspended(pc, reason, params); } }; - private interface IDataRequest { - void cancel(); - void done(); + private static class ExecutionState { + boolean is_suspended; + boolean is_running; + String suspend_pc; + String suspend_reason; + Map<String,Object> suspend_params; } - private static final int - VALID_CHILDREN = 4, - VALID_CONTEXT = 8, - VALID_STATE = 16, - VALID_ALL = VALID_CHILDREN | VALID_CONTEXT | VALID_STATE; - private class ExecutionDMC extends TCFDSFExecutionDMC { - + final String id; final ExecutionDMC parent; - - final SortedMap<String,ExecutionDMC> children = new TreeMap<String,ExecutionDMC>(); - final Map<String,ExecutionDMC> children_next = new HashMap<String,ExecutionDMC>(); - final Collection<IDataRequest> node_wait_list = new ArrayList<IDataRequest>(); - - int valid; - Throwable error; + final IMemoryBlockRetrievalExtension mem_retrieval; + boolean disposed; - IToken command; - - RunControlContext ctx; int is_stepping; int is_resuming; - boolean is_suspended; - boolean is_running; - String suspend_pc; - String suspend_reason; - String exception_msg; - Map<String,Object> suspend_params; - - public ExecutionDMC(ExecutionDMC parent, String id) { - super(TCFDSFRunControl.this, parent == null ? null : new IDMContext[] { parent }); + + final TCFDataCache<RunControlContext> context; + final TCFDataCache<Map<String,ExecutionDMC>> children; + final TCFDataCache<ExecutionState> state; + + public ExecutionDMC(ExecutionDMC parent, final String id) { + super(TCFDSFRunControl.this, parent == null ? + new IDMContext[0] : new IDMContext[] { parent }); this.parent = parent; this.id = id; + DsfMemoryBlockRetrieval mr = null; + try { + mr = new DsfMemoryBlockRetrieval(ITCFConstants.ID_TCF_DEBUG_MODEL, this); + } + catch (DebugException e) { + e.printStackTrace(); + }; + mem_retrieval = mr; + context = new TCFDataCache<RunControlContext>(channel) { + @Override + public boolean startDataRetrieval() { + assert command == null; + if (id == null || tcf_run_service == null) { + data = null; + valid = true; + return true; + } + command = tcf_run_service.getContext(id, new IRunControl.DoneGetContext() { + public void doneGetContext(IToken token, Exception err, IRunControl.RunControlContext ctx) { + if (command != token) return; + command = null; + if (err != null) { + error = err; + } + else { + data = ctx; + } + valid = true; + validate(); + } + }); + return false; + } + }; + children = new TCFDataCache<Map<String,ExecutionDMC>>(channel) { + @Override + public boolean startDataRetrieval() { + assert command == null; + if (tcf_run_service == null) { + data = null; + valid = true; + return true; + } + command = tcf_run_service.getChildren(id, new IRunControl.DoneGetChildren() { + public void doneGetChildren(IToken token, Exception err, String[] contexts) { + if (command != token) return; + command = null; + if (err != null) { + data = null; + error = err; + } + else { + if (data == null) data = new HashMap<String,ExecutionDMC>(); + data.clear(); + for (int i = 0; i < contexts.length; i++) { + String id = contexts[i]; + ExecutionDMC n = cache.get(id); + if (n == null) { + n = new ExecutionDMC(ExecutionDMC.this, id); + cache.put(n.id, n); + } + data.put(id, n); + } + } + valid = true; + validate(); + } + }); + return false; + } + }; + state = new TCFDataCache<ExecutionState>(channel) { + @Override + public boolean startDataRetrieval() { + assert command == null; + assert context.isValid(); + RunControlContext c = context.getData(); + if (c == null || !c.hasState()) { + data = null; + valid = true; + return true; + } + command = c.getState(new IRunControl.DoneGetState() { + public void doneGetState(IToken token, Exception err, boolean suspend, String pc, String reason, Map<String,Object> params) { + if (token != command) return; + command = null; + if (err != null) { + data = null; + error = err; + } + else { + data = new ExecutionState(); + data.is_running = !suspend; + data.is_suspended = suspend; + if (suspend) { + data.suspend_pc = pc; + data.suspend_reason = reason; + data.suspend_params = params; + } + } + valid = true; + validate(); + } + }); + return false; + } + }; } @Override @@ -249,287 +356,153 @@ public class TCFDSFRunControl extends AbstractDsfService implements org.eclipse. @Override public boolean equals(Object obj) { - return super.baseEquals(obj) && ((ExecutionDMC)obj).id.equals(id); + if (!super.baseEquals(obj)) return false; + String obj_id = ((ExecutionDMC)obj).id; + if (obj_id == null) return id == null; + return obj_id.equals(id); } - + @Override public int hashCode() { + if (id == null) return 0; return id.hashCode(); } @Override + @SuppressWarnings("unchecked") + public Object getAdapter(Class cls) { + Object obj = null; + if (cls == IMemoryBlockRetrieval.class) obj = mem_retrieval; + if (cls == IMemoryBlockRetrievalExtension.class) obj = mem_retrieval; + if (obj == null) obj = super.getAdapter(cls); + return obj; + } + + @Override public String getTcfContextId() { return id; } + + @Override + public void addStateWaitingRequest(IDataRequest req) { + state.addWaitingRequest(req); + } + + @Override + public TCFAddress getPC() { + ExecutionState st = state.getData(); + if (st == null) return null; + if (st.suspend_pc == null) return null; + return new TCFAddress(new BigInteger(st.suspend_pc)); + } + + @Override + public boolean validateState() { + return state.validate(); + } + + @Override + public boolean isDisposed() { + return disposed; + } void dispose() { assert !disposed; - ExecutionDMC arr[] = children.values().toArray(new ExecutionDMC[children.size()]); - for (int i = 0; i < arr.length; i++) arr[i].dispose(); - assert children.isEmpty(); - if (parent != null) { - parent.children.remove(id); - parent.children_next.remove(id); - } - model.remove(id); - disposed = true; - } - - void invalidateDMC(int flags) { - // cancel current data retrieval command - if (command != null) { - command.cancel(); - command = null; - } - - // cancel waiting requests - if (!node_wait_list.isEmpty()) { - IDataRequest[] arr = node_wait_list.toArray(new IDataRequest[node_wait_list.size()]); - node_wait_list.clear(); - for (IDataRequest r : arr) r.cancel(); - } - - if ((flags & VALID_STATE) != 0) { - is_suspended = false; - is_running = false; - } - - if ((flags & VALID_CHILDREN) != 0) { - children_next.clear(); - for (ExecutionDMC n : children.values()) n.invalidateDMC(VALID_ALL); - } - - if (flags == VALID_ALL) { - error = null; - } - - valid &= ~flags; - } - - boolean validateDMC(IDataRequest done) { - assert Protocol.isDispatchThread(); - assert (valid & ~VALID_ALL) == 0; - assert parent == null || parent.children.get(id) == model.get(id); - if (channel.getState() != IChannel.STATE_OPEN) { - children_next.clear(); - error = null; - command = null; - valid = VALID_ALL; - } - if (command != null) { - if (done != null) node_wait_list.add(done); - return false; - } - if (parent != null && parent.error != null) { - valid = VALID_ALL; - } - if ((valid & VALID_CONTEXT) == 0 && !validateRunControlContext(done)) return false; - if ((valid & VALID_STATE) == 0 && !validateRunControlState(done)) return false; - if ((valid & VALID_CHILDREN) == 0 && !validateRunControlChildren(done)) return false; - assert valid == VALID_ALL; - assert command == null; - ExecutionDMC[] a = children.values().toArray(new ExecutionDMC[children.size()]); - for (ExecutionDMC n : a) { - if (children_next.get(n.id) == null) n.dispose(); - } - for (ExecutionDMC n : children_next.values()) { - if (children.get(n.id) == null) { - children.put(n.id, n); - model.put(n.id, n); + context.cancel(); + children.cancel(); + state.cancel(); + if (children.isValid()) { + Map<String,ExecutionDMC> m = children.getData(); + if (m != null) { + for (ExecutionDMC n : m.values()) n.dispose(); } } - if (!node_wait_list.isEmpty()) { - IDataRequest[] arr = node_wait_list.toArray(new IDataRequest[node_wait_list.size()]); - node_wait_list.clear(); - for (IDataRequest r : arr) r.done(); - } - assert valid == VALID_ALL; - return true; - } - - private boolean validateRunControlChildren(IDataRequest done) { - assert command == null; - if (tcf_run_service == null) { - valid |= VALID_CHILDREN; - return true; - } - if (done != null) node_wait_list.add(done); - command = tcf_run_service.getChildren(id, new IRunControl.DoneGetChildren() { - public void doneGetChildren(IToken token, Exception error, String[] contexts) { - if (command != token) return; - command = null; - if (error != null) { - ExecutionDMC.this.error = error; - } - else { - for (int i = 0; i < contexts.length; i++) { - String id = contexts[i]; - ExecutionDMC node = model.get(id); - if (node == null) node = new ExecutionDMC(ExecutionDMC.this, id); - children_next.put(id, node); - } - } - valid |= VALID_CHILDREN; - validateDMC(null); - } - }); - return false; - } - - private boolean validateRunControlContext(IDataRequest done) { - assert command == null; - if (tcf_run_service == null) { - valid |= VALID_CONTEXT; - return true; - } - if (done != null) node_wait_list.add(done); - command = tcf_run_service.getContext(id, new IRunControl.DoneGetContext() { - public void doneGetContext(IToken token, Exception error, IRunControl.RunControlContext ctx) { - if (command != token) return; - command = null; - if (error != null) { - ExecutionDMC.this.error = error; - } - else { - ExecutionDMC.this.ctx = ctx; - } - valid |= VALID_CONTEXT; - validateDMC(null); - } - }); - return false; - } - - private boolean validateRunControlState(IDataRequest done) { - assert command == null; - if (ctx == null) { - valid |= VALID_STATE; - return true; - } - if (error != null || !ctx.hasState()) { - is_running = false; - is_suspended = false; - suspend_pc = null; - suspend_reason = null; - suspend_params = null; - valid |= VALID_STATE; - return true; - } - if (done != null) node_wait_list.add(done); - command = ctx.getState(new IRunControl.DoneGetState() { - public void doneGetState(IToken token, Exception error, boolean suspend, String pc, String reason, Map<String,Object> params) { - if (token != command) return; - command = null; - if (error != null) { - is_running = false; - is_suspended = false; - suspend_pc = null; - suspend_reason = null; - suspend_params = null; - ExecutionDMC.this.error = error; - } - else { - is_running = !suspend; - is_suspended = suspend; - if (suspend) { - suspend_pc = pc; - suspend_reason = reason; - suspend_params = params; - } - else { - suspend_pc = null; - suspend_reason = null; - suspend_params = null; - } - } - valid |= VALID_STATE; - validateDMC(null); - } - }); - return false; + cache.remove(id); + disposed = true; } /*--------------------------------------------------------------------------------------*/ /* Events */ - void onContextAdded(IRunControl.RunControlContext context) { - String id = context.getID(); + void onContextAdded(IRunControl.RunControlContext c) { + String id = c.getID(); assert !disposed; - assert children.get(id) == null; + assert cache.get(id) == null; ExecutionDMC n = new ExecutionDMC(this, id); - n.ctx = context; - n.valid |= VALID_CONTEXT; - children.put(id, n); - model.put(id, n); + n.context.reset(c); + if (children.isValid()) { + Map<String,ExecutionDMC> m = children.getData(); + if (m != null) m.put(id, n); + } + cache.put(id, n); getSession().dispatchEvent(new StartedEvent(this, n), getProperties()); } - void onContextChanged(IRunControl.RunControlContext context) { + void onContextChanged(IRunControl.RunControlContext c) { assert !disposed; - ctx = context; - invalidateDMC(VALID_CHILDREN); + context.reset(c); getSession().dispatchEvent(new ChangedEvent(this), getProperties()); } void onContextRemoved() { assert !disposed; + if (parent != null && parent.children.isValid()) { + Map<String,ExecutionDMC> m = parent.children.getData(); + if (m != null) m.remove(id); + } dispose(); getSession().dispatchEvent(new ExitedEvent(parent, this), getProperties()); } void onContainerSuspended(String reason) { assert !disposed; - if (ctx == null) return; - if (!ctx.hasState()) return; - invalidateDMC(VALID_STATE); + if (!context.isValid()) return; + RunControlContext rc = context.getData(); + if (rc == null) return; + if (!rc.hasState()) return; + state.reset(); getSession().dispatchEvent(new SuspendedEvent(this, reason), getProperties()); } void onContextSuspended(String pc, String reason, Map<String,Object> params) { assert !disposed; - if (ctx == null) return; - assert ctx.hasState(); - is_suspended = true; - suspend_pc = pc; - suspend_reason = reason; - suspend_params = params; - is_running = false; - valid |= VALID_STATE; + assert !context.isValid() || context.getData().hasState(); + ExecutionState st = new ExecutionState(); + st.is_suspended = true; + st.suspend_pc = pc; + st.suspend_reason = reason; + st.suspend_params = params; + state.reset(st); getSession().dispatchEvent(new SuspendedEvent(this, reason), getProperties()); } void onContextResumed() { assert !disposed; - if (ctx == null) return; - assert ctx.hasState(); - exception_msg = null; - is_suspended = false; - suspend_pc = null; - suspend_reason = null; - suspend_params = null; - is_running = true; - valid |= VALID_STATE; + assert !context.isValid() || context.getData().hasState(); + ExecutionState st = new ExecutionState(); + st.is_running = true; + state.reset(st); getSession().dispatchEvent(new ResumedEvent(this), getProperties()); } void onContextException(String msg) { assert !disposed; - exception_msg = msg; + // TODO onContextException handling } } - + private static class ExecutionData implements IExecutionDMData { - + private final StateChangeReason reason; - + ExecutionData(StateChangeReason reason) { this.reason = reason; } - + public boolean isValid() { return true; } - + public StateChangeReason getStateChangeReason() { return reason; } @@ -548,18 +521,39 @@ public class TCFDSFRunControl extends AbstractDsfService implements org.eclipse. if (s.equals(com.windriver.tcf.api.services.IRunControl.REASON_ERROR)) return StateChangeReason.ERROR; return StateChangeReason.UNKNOWN; } - + private final IChannel channel; private final com.windriver.tcf.api.services.IRunControl tcf_run_service; - private final Map<String,ExecutionDMC> model = new HashMap<String,ExecutionDMC>(); + private final Map<String,ExecutionDMC> cache = new HashMap<String,ExecutionDMC>(); + private final ExecutionDMC root_dmc; private IDMContext service_dmc; - public TCFDSFRunControl(DsfSession session, IChannel channel) { + public TCFDSFRunControl(DsfSession session, IChannel channel, final RequestMonitor monitor) { super(session); this.channel = channel; tcf_run_service = channel.getRemoteService(com.windriver.tcf.api.services.IRunControl.class); if (tcf_run_service != null) tcf_run_service.addListener(run_listener); service_dmc = new ServiceDMContext(this, "#run_control"); + root_dmc = new ExecutionDMC(null, null); + cache.put(null, root_dmc); + initialize(new RequestMonitor(getExecutor(), monitor) { + @Override + protected void handleOK() { + String[] class_names = { + org.eclipse.dd.dsf.debug.service.IRunControl.class.getName(), + TCFDSFRunControl.class.getName() + }; + register(class_names, new Hashtable<String,String>()); + monitor.done(); + } + }); + } + + @Override + public void shutdown(RequestMonitor monitor) { + if (tcf_run_service != null) tcf_run_service.removeListener(run_listener); + unregister(); + super.shutdown(monitor); } @Override @@ -571,27 +565,67 @@ public class TCFDSFRunControl extends AbstractDsfService implements org.eclipse. public void getModelData(IDMContext dmc, final DataRequestMonitor<?> rm) { if (dmc instanceof ExecutionDMC) { final ExecutionDMC ctx = (ExecutionDMC)dmc; - IDataRequest done = new IDataRequest() { - - public void cancel() { - rm.setCanceled(true); - rm.done(); - } - - @SuppressWarnings("unchecked") - public void done() { - if (ctx.error != null) { - rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, - REQUEST_FAILED, "Data error", ctx.error)); //$NON-NLS-1$ + if (!ctx.context.validate()) { + ctx.context.addWaitingRequest(new IDataRequest() { + public void cancel() { + rm.setStatus(new Status(IStatus.CANCEL, Activator.PLUGIN_ID, + REQUEST_FAILED, "Canceled", null)); //$NON-NLS-1$ + rm.setCanceled(true); + rm.done(); } - else { - ExecutionData dt = new ExecutionData(toStateChangeReason(ctx.suspend_reason)); - ((DataRequestMonitor<IExecutionDMData>)rm).setData(dt); + public void done() { + getModelData(ctx, rm); } - rm.done(); - } - }; - if (ctx.validateDMC(done)) done.done(); + }); + return; + } + if (ctx.context.getError() != null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Data error", ctx.context.getError())); //$NON-NLS-1$ + rm.done(); + return; + } + if (ctx.context.getData() == null) { + ExecutionData dt = new ExecutionData(StateChangeReason.UNKNOWN); + ((DataRequestMonitor<IExecutionDMData>)rm).setData(dt); + rm.done(); + return; + } + if (!ctx.context.getData().hasState()) { + ExecutionData dt = new ExecutionData(StateChangeReason.UNKNOWN); + ((DataRequestMonitor<IExecutionDMData>)rm).setData(dt); + rm.done(); + return; + } + if (!ctx.state.validate()) { + ctx.state.addWaitingRequest(new IDataRequest() { + public void cancel() { + rm.setStatus(new Status(IStatus.CANCEL, Activator.PLUGIN_ID, + REQUEST_FAILED, "Canceled", null)); //$NON-NLS-1$ + rm.setCanceled(true); + rm.done(); + } + public void done() { + getModelData(ctx, rm); + } + }); + return; + } + if (ctx.state.getError() != null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Data error", ctx.state.getError())); //$NON-NLS-1$ + rm.done(); + return; + } + if (ctx.state.getData() == null) { + ExecutionData dt = new ExecutionData(StateChangeReason.UNKNOWN); + ((DataRequestMonitor<IExecutionDMData>)rm).setData(dt); + rm.done(); + return; + } + ExecutionData dt = new ExecutionData(toStateChangeReason(ctx.state.getData().suspend_reason)); + ((DataRequestMonitor<IExecutionDMData>)rm).setData(dt); + rm.done(); } else if (dmc == service_dmc) { ((DataRequestMonitor<TCFDSFRunControl>)rm).setData(this); @@ -611,68 +645,135 @@ public class TCFDSFRunControl extends AbstractDsfService implements org.eclipse. public boolean isValid() { return true; } - - public IContainerDMContext getContainerDMC() { - // TODO: getContainerDMC() - assert false; - return null; - } public boolean canInstructionStep(IDMContext context) { if (context instanceof ExecutionDMC) { - ExecutionDMC x = (ExecutionDMC)context; - return x.ctx.canResume(com.windriver.tcf.api.services.IRunControl.RM_STEP_INTO); + ExecutionDMC ctx = (ExecutionDMC)context; + if (ctx.context.isValid()) { + RunControlContext c = ctx.context.getData(); + return c != null && c.canResume(com.windriver.tcf.api.services.IRunControl.RM_STEP_INTO); + } } return false; } public boolean canResume(IDMContext context) { if (context instanceof ExecutionDMC) { - ExecutionDMC x = (ExecutionDMC)context; - return x.ctx.canResume(com.windriver.tcf.api.services.IRunControl.RM_RESUME); + ExecutionDMC ctx = (ExecutionDMC)context; + if (ctx.context.isValid()) { + RunControlContext c = ctx.context.getData(); + return c != null && c.canResume(com.windriver.tcf.api.services.IRunControl.RM_RESUME); + } } return false; } public boolean canStep(IDMContext context) { if (context instanceof ExecutionDMC) { - ExecutionDMC x = (ExecutionDMC)context; - return x.ctx.canResume(com.windriver.tcf.api.services.IRunControl.RM_STEP_OVER); + ExecutionDMC ctx = (ExecutionDMC)context; + if (ctx.context.isValid()) { + RunControlContext c = ctx.context.getData(); + if (c != null) { + if (c.canResume(com.windriver.tcf.api.services.IRunControl.RM_STEP_INTO_LINE)) return true; + if (c.canResume(com.windriver.tcf.api.services.IRunControl.RM_STEP_INTO)) return true; + } + } } return false; } public boolean canSuspend(IDMContext context) { if (context instanceof ExecutionDMC) { - ExecutionDMC x = (ExecutionDMC)context; - return x.ctx.canSuspend(); + ExecutionDMC ctx = (ExecutionDMC)context; + if (ctx.context.isValid()) { + RunControlContext c = ctx.context.getData(); + return c != null && c.canSuspend(); + } } return false; } + public TCFDSFExecutionDMC getContext(String id) { + return cache.get(id); + } + + public void getContainerContexts(IContainerDMContext context, final DataRequestMonitor<IExecutionDMContext[]> rm) { + getContexts(context, rm, false); + } + public void getExecutionContexts(IContainerDMContext context, final DataRequestMonitor<IExecutionDMContext[]> rm) { + getContexts(context, rm, true); + } + + public void getContexts(IContainerDMContext context, + final DataRequestMonitor<IExecutionDMContext[]> rm, final boolean has_state) { + if (context == null) context = root_dmc; if (context instanceof ExecutionDMC) { final ExecutionDMC ctx = (ExecutionDMC)context; - IDataRequest done = new IDataRequest() { - - public void cancel() { - rm.setCanceled(true); - rm.done(); - } - - @SuppressWarnings("unchecked") - public void done() { - if (ctx.error != null) { - rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, - REQUEST_FAILED, "Data error", ctx.error)); //$NON-NLS-1$ + TCFDataCache<Map<String,ExecutionDMC>> cache = ctx.children; + if (!cache.validate()) { + cache.addWaitingRequest(new IDataRequest() { + public void cancel() { + rm.setStatus(new Status(IStatus.CANCEL, Activator.PLUGIN_ID, + REQUEST_FAILED, "Canceled", null)); //$NON-NLS-1$ + rm.setCanceled(true); + rm.done(); } - else { - rm.setData(ctx.children.values().toArray(new ExecutionDMC[ctx.children.size()])); + public void done() { + getContexts(ctx, rm, has_state); } - rm.done(); + }); + return; + } + if (cache.getError() != null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Data error", cache.getError())); //$NON-NLS-1$ + rm.done(); + return; + } + if (cache.getData() == null) { + rm.setData(new ExecutionDMC[0]); + rm.done(); + return; + } + final Set<IDataRequest> reqs = new HashSet<IDataRequest>(); + for (ExecutionDMC e : cache.getData().values()) { + if (!e.context.validate()) { + IDataRequest req = new IDataRequest() { + public void cancel() { + if (reqs.remove(this) && reqs.isEmpty()) getContexts(ctx, rm, has_state); + } + public void done() { + if (reqs.remove(this) && reqs.isEmpty()) getContexts(ctx, rm, has_state); + } + }; + reqs.add(req); + e.context.addWaitingRequest(req); } - }; - if (ctx.validateDMC(done)) done.done(); + // TODO DSF service design does not support lazy retrieval of context state (because isSuspened() is not async) + else if (!e.state.validate()) { + IDataRequest req = new IDataRequest() { + public void cancel() { + if (reqs.remove(this) && reqs.isEmpty()) getContexts(ctx, rm, has_state); + } + public void done() { + if (reqs.remove(this) && reqs.isEmpty()) getContexts(ctx, rm, has_state); + } + }; + reqs.add(req); + e.state.addWaitingRequest(req); + } + } + if (reqs.isEmpty()) { + ArrayList<ExecutionDMC> l = new ArrayList<ExecutionDMC>(); + for (ExecutionDMC e : cache.getData().values()) { + assert e.context.isValid(); + RunControlContext c = e.context.getData(); + if (c.hasState() == has_state) l.add(e); + } + rm.setData(l.toArray(new ExecutionDMC[l.size()])); + rm.done(); + } } else { rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, @@ -680,40 +781,71 @@ public class TCFDSFRunControl extends AbstractDsfService implements org.eclipse. rm.done(); } } + + public Collection<TCFDSFExecutionDMC> getCachedContexts() { + ArrayList<TCFDSFExecutionDMC> l = new ArrayList<TCFDSFExecutionDMC>(); + for (ExecutionDMC dmc : cache.values()) l.add(dmc); + return l; + } public void step(IDMContext context, StepType stepType, final RequestMonitor rm) { if (context instanceof ExecutionDMC) { - final ExecutionDMC x = (ExecutionDMC)context; - int md = -1; - switch (stepType) { - case STEP_OVER: - md = com.windriver.tcf.api.services.IRunControl.RM_STEP_OVER_LINE; - break; - case STEP_INTO: - md = com.windriver.tcf.api.services.IRunControl.RM_STEP_INTO_LINE; - break; - case STEP_RETURN: - md = com.windriver.tcf.api.services.IRunControl.RM_STEP_OUT; - break; - } - if (md < 0) { - rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, - NOT_SUPPORTED, "Invalid step type", null)); //$NON-NLS-1$ - rm.done(); - } - else { - x.ctx.resume(md, 1, new com.windriver.tcf.api.services.IRunControl.DoneCommand() { - public void doneCommand(IToken token, Exception error) { - if (error != null) { - rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, - REQUEST_FAILED, "Command error", error)); //$NON-NLS-1$ + final ExecutionDMC ctx = (ExecutionDMC)context; + if (ctx.context.isValid()) { + RunControlContext c = ctx.context.getData(); + if (c != null) { + int md = -1; + if (c.canResume(com.windriver.tcf.api.services.IRunControl.RM_STEP_INTO_LINE)) { + switch (stepType) { + case STEP_OVER: + md = com.windriver.tcf.api.services.IRunControl.RM_STEP_OVER_LINE; + break; + case STEP_INTO: + md = com.windriver.tcf.api.services.IRunControl.RM_STEP_INTO_LINE; + break; + case STEP_RETURN: + md = com.windriver.tcf.api.services.IRunControl.RM_STEP_OUT; + break; + } + } + else { + switch (stepType) { + case STEP_OVER: + md = com.windriver.tcf.api.services.IRunControl.RM_STEP_OVER; + break; + case STEP_INTO: + md = com.windriver.tcf.api.services.IRunControl.RM_STEP_INTO; + break; + case STEP_RETURN: + md = com.windriver.tcf.api.services.IRunControl.RM_STEP_OUT; + break; } - x.is_stepping--; + } + if (md < 0) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + NOT_SUPPORTED, "Invalid step type", null)); //$NON-NLS-1$ rm.done(); } - }); - x.is_stepping++; + else { + c.resume(md, 1, new com.windriver.tcf.api.services.IRunControl.DoneCommand() { + public void doneCommand(IToken token, Exception error) { + if (rm.isCanceled()) return; + if (error != null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Command error", error)); //$NON-NLS-1$ + } + ctx.is_stepping--; + rm.done(); + } + }); + ctx.is_stepping++; + } + return; + } } + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + INVALID_HANDLE, "Invalid context", null)); //$NON-NLS-1$ + rm.done(); } else { rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, @@ -724,37 +856,47 @@ public class TCFDSFRunControl extends AbstractDsfService implements org.eclipse. public void instructionStep(IDMContext context, StepType stepType, final RequestMonitor rm) { if (context instanceof ExecutionDMC) { - final ExecutionDMC x = (ExecutionDMC)context; - int md = -1; - switch (stepType) { - case STEP_OVER: - md = com.windriver.tcf.api.services.IRunControl.RM_STEP_OVER; - break; - case STEP_INTO: - md = com.windriver.tcf.api.services.IRunControl.RM_STEP_INTO; - break; - case STEP_RETURN: - md = com.windriver.tcf.api.services.IRunControl.RM_STEP_OUT; - break; - } - if (md < 0) { - rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, - NOT_SUPPORTED, "Invalid step type", null)); //$NON-NLS-1$ - rm.done(); - } - else { - x.ctx.resume(md, 1, new com.windriver.tcf.api.services.IRunControl.DoneCommand() { - public void doneCommand(IToken token, Exception error) { - if (error != null) { - rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, - REQUEST_FAILED, "Command error", error)); //$NON-NLS-1$ - } - x.is_stepping--; + final ExecutionDMC ctx = (ExecutionDMC)context; + if (ctx.context.isValid()) { + RunControlContext c = ctx.context.getData(); + if (c != null) { + int md = -1; + switch (stepType) { + case STEP_OVER: + md = com.windriver.tcf.api.services.IRunControl.RM_STEP_OVER; + break; + case STEP_INTO: + md = com.windriver.tcf.api.services.IRunControl.RM_STEP_INTO; + break; + case STEP_RETURN: + md = com.windriver.tcf.api.services.IRunControl.RM_STEP_OUT; + break; + } + if (md < 0) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + NOT_SUPPORTED, "Invalid step type", null)); //$NON-NLS-1$ rm.done(); } - }); - x.is_stepping++; + else { + c.resume(md, 1, new com.windriver.tcf.api.services.IRunControl.DoneCommand() { + public void doneCommand(IToken token, Exception error) { + if (rm.isCanceled()) return; + if (error != null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Command error", error)); //$NON-NLS-1$ + } + ctx.is_stepping--; + rm.done(); + } + }); + ctx.is_stepping++; + } + return; + } } + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + INVALID_HANDLE, "Invalid context", null)); //$NON-NLS-1$ + rm.done(); } else { rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, @@ -773,19 +915,29 @@ public class TCFDSFRunControl extends AbstractDsfService implements org.eclipse. public void resume(IDMContext context, final RequestMonitor rm) { if (context instanceof ExecutionDMC) { - final ExecutionDMC x = (ExecutionDMC)context; - x.ctx.resume(com.windriver.tcf.api.services.IRunControl.RM_RESUME, 1, - new com.windriver.tcf.api.services.IRunControl.DoneCommand() { - public void doneCommand(IToken token, Exception error) { - if (error != null) { - rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, - REQUEST_FAILED, "Command error", error)); //$NON-NLS-1$ - } - x.is_resuming--; - rm.done(); + final ExecutionDMC ctx = (ExecutionDMC)context; + if (ctx.context.isValid()) { + RunControlContext c = ctx.context.getData(); + if (c != null) { + c.resume(com.windriver.tcf.api.services.IRunControl.RM_RESUME, 1, + new com.windriver.tcf.api.services.IRunControl.DoneCommand() { + public void doneCommand(IToken token, Exception error) { + if (rm.isCanceled()) return; + if (error != null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Command error", error)); //$NON-NLS-1$ + } + ctx.is_resuming--; + rm.done(); + } + }); + ctx.is_resuming++; + return; } - }); - x.is_resuming++; + } + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + INVALID_HANDLE, "Invalid context", null)); //$NON-NLS-1$ + rm.done(); } else { rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, @@ -796,16 +948,26 @@ public class TCFDSFRunControl extends AbstractDsfService implements org.eclipse. public void suspend(IDMContext context, final RequestMonitor rm) { if (context instanceof ExecutionDMC) { - final ExecutionDMC x = (ExecutionDMC)context; - x.ctx.suspend(new com.windriver.tcf.api.services.IRunControl.DoneCommand() { - public void doneCommand(IToken token, Exception error) { - if (error != null) { - rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, - REQUEST_FAILED, "Command error", error)); //$NON-NLS-1$ - } - rm.done(); + final ExecutionDMC ctx = (ExecutionDMC)context; + if (ctx.context.isValid()) { + RunControlContext c = ctx.context.getData(); + if (c != null) { + c.suspend(new com.windriver.tcf.api.services.IRunControl.DoneCommand() { + public void doneCommand(IToken token, Exception error) { + if (rm.isCanceled()) return; + if (error != null) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + REQUEST_FAILED, "Command error", error)); //$NON-NLS-1$ + } + rm.done(); + } + }); + return; } - }); + } + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + INVALID_HANDLE, "Invalid context", null)); //$NON-NLS-1$ + rm.done(); } else { rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, @@ -816,14 +978,46 @@ public class TCFDSFRunControl extends AbstractDsfService implements org.eclipse. public boolean isSuspended(IDMContext context) { if (context instanceof ExecutionDMC) { - ExecutionDMC x = (ExecutionDMC)context; - return x.is_suspended && x.is_resuming == 0 && x.is_stepping == 0; + ExecutionDMC ctx = (ExecutionDMC)context; + boolean r = false; + if (ctx.context.isValid()) { + RunControlContext c = ctx.context.getData(); + if (c != null && c.hasState()) { + if (ctx.is_resuming == 0 && ctx.is_stepping == 0 && ctx.state.isValid()) { + ExecutionState st = ctx.state.getData(); + if (st != null) r = st.is_suspended; + } + } + else if (ctx.children.isValid()) { + Map<String,ExecutionDMC> m = ctx.children.getData(); + if (m != null) { + for (ExecutionDMC e : m.values()) { + if (isSuspended(e)) r = true; + } + } + } + } + return r; } return false; } public void getExecutionData(IExecutionDMContext dmc, DataRequestMonitor<IExecutionDMData> rm) { - // TODO Auto-generated method stub - assert false; + if (dmc instanceof ExecutionDMC) { + ExecutionDMC ctx = (ExecutionDMC)dmc; + StateChangeReason r = StateChangeReason.UNKNOWN; + if (ctx.state.isValid()) { + ExecutionState st = ctx.state.getData(); + if (st != null && st.suspend_reason != null) { + r = toStateChangeReason(st.suspend_reason); + } + } + rm.setData(new ExecutionData(r)); + } + else { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + INVALID_HANDLE, "Given context: " + dmc + " is not an execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$ + } + rm.done(); } } diff --git a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFStack.java b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFStack.java new file mode 100644 index 000000000..85a72f1f7 --- /dev/null +++ b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFStack.java @@ -0,0 +1,516 @@ +/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package com.windriver.tcf.dsf.core.services;
+
+import java.math.BigInteger;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.eclipse.cdt.core.IAddress;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
+import org.eclipse.dd.dsf.concurrent.RequestMonitor;
+import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
+import org.eclipse.dd.dsf.datamodel.IDMContext;
+import org.eclipse.dd.dsf.datamodel.ServiceDMContext;
+import org.eclipse.dd.dsf.debug.service.IRunControl;
+import org.eclipse.dd.dsf.debug.service.IStack;
+import org.eclipse.dd.dsf.debug.service.IRunControl.StateChangeReason;
+import org.eclipse.dd.dsf.service.AbstractDsfService;
+import org.eclipse.dd.dsf.service.DsfServiceEventHandler;
+import org.eclipse.dd.dsf.service.DsfSession;
+import org.osgi.framework.BundleContext;
+
+import com.windriver.tcf.api.protocol.IChannel;
+import com.windriver.tcf.api.protocol.IToken;
+import com.windriver.tcf.api.services.ILineNumbers;
+import com.windriver.tcf.api.services.IStackTrace;
+import com.windriver.tcf.api.services.ILineNumbers.CodeArea;
+import com.windriver.tcf.dsf.core.Activator;
+
+public class TCFDSFStack extends AbstractDsfService implements IStack {
+
+ private static final String TOP_FRAME = "TopFrame:";
+
+ private class TCFFrameDMC extends AbstractDMContext implements IFrameDMContext, Comparable<TCFFrameDMC> {
+
+ final String id;
+ final TCFDSFExecutionDMC exe_dmc;
+ final TCFDataCache<TCFFrameData> frame_data;
+
+ int level;
+ TCFFrameData prev_data;
+
+ public TCFFrameDMC(final TCFDSFExecutionDMC exe_dmc, final String id) {
+ super(TCFDSFStack.this.getSession().getId(), new IDMContext[] { exe_dmc });
+ this.id = id;
+ this.exe_dmc = exe_dmc;
+ frame_data = new TCFDataCache<TCFFrameData>(channel) {
+
+ @Override
+ public boolean startDataRetrieval() {
+ assert command == null;
+ if (id == null || tcf_stk_service == null) {
+ data = null;
+ valid = true;
+ return true;
+ }
+ if (level == 0) {
+ assert id.startsWith(TOP_FRAME);
+ // Top frame is special case: most of its data is stored in CPU registers.
+ // Other frames are stored in memory - in thread stack area.
+ return getTopFrame();
+ }
+ command = tcf_stk_service.getContext(new String[]{ id }, new IStackTrace.DoneGetContext() {
+ public void doneGetContext(IToken token, Exception err, IStackTrace.StackTraceContext[] context) {
+ if (command != token) return;
+ command = null;
+ if (err != null) {
+ error = err;
+ data = null;
+ }
+ else {
+ TCFAddress a = null;
+ Number n = context[0].getReturnAddress();
+ if (n != null) a = new TCFAddress(n);
+ // Optimization: skip source position lookup if same address
+ if (prev_data != null && prev_data.address.equals(a)) {
+ data = prev_data;
+ data.context = context[0];
+ data.level = level;
+ }
+ else {
+ data = new TCFFrameData();
+ data.context = context[0];
+ data.address = a;
+ data.level = level;
+ if (!getSourcePos()) return;
+ }
+ }
+ valid = true;
+ validate();
+ }
+ });
+ return false;
+ }
+
+ private boolean getTopFrame() {
+ assert level == 0;
+ if (!exe_dmc.validateState()) {
+ exe_dmc.addStateWaitingRequest(new IDataRequest() {
+ public void cancel() {
+ reset();
+ }
+ public void done() {
+ validate();
+ }
+ });
+ return false;
+ }
+ prev_data = data = new TCFFrameData();
+ data.address = exe_dmc.getPC();
+ data.level = level;
+ if (!getSourcePos()) return false;
+ valid = true;
+ return true;
+ }
+
+ private boolean getSourcePos() {
+ if (tcf_lns_service == null) return true;
+ if (data.address == null) return true;
+ BigInteger a1 = data.address.getValue();
+ BigInteger a2 = data.address.add(1).getValue();
+ command = tcf_lns_service.mapToSource(exe_dmc.getTcfContextId(), a1, a2, new ILineNumbers.DoneMapToSource() {
+
+ public void doneMapToSource(IToken token, Exception err, CodeArea[] areas) {
+ if (command != token) return;
+ command = null;
+ if (err != null) {
+ data.src_pos_error = err;
+ }
+ else if (areas != null && areas.length > 0) {
+ for (ILineNumbers.CodeArea area : areas) {
+ if (data.code_area == null || area.start_line < data.code_area.start_line) {
+ data.code_area = area;
+ }
+ }
+ prev_data = data;
+ }
+ valid = true;
+ validate();
+ }
+ });
+ return false;
+ }
+ };
+ }
+
+ public int getLevel() {
+ return level;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return super.baseEquals(other) && ((TCFFrameDMC)other).id.equals(id);
+ }
+
+ @Override
+ public int hashCode() {
+ return id.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return baseToString() + ".frame[" + id + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public int compareTo(TCFFrameDMC f) {
+ if (level < f.level) return -1;
+ if (level > f.level) return +1;
+ return 0;
+ }
+ }
+
+ private static class TCFFrameData implements IFrameDMData {
+
+ IStackTrace.StackTraceContext context;
+ IAddress address;
+ int level;
+ String function;
+ Throwable src_pos_error;
+ ILineNumbers.CodeArea code_area;
+
+ public IAddress getAddress() {
+ return address;
+ }
+
+ public String getFunction() {
+ return function;
+ }
+
+ public int getLevel() {
+ return level;
+ }
+
+ public String getFile() {
+ if (code_area == null) return null;
+ return code_area.file;
+ }
+
+ public int getLine() {
+ if (code_area == null) return -1;
+ return code_area.start_line + 1;
+ }
+
+ public int getColumn() {
+ if (code_area == null) return -1;
+ return code_area.start_column + 1;
+ }
+ }
+
+ private class FramesCache extends TCFDataCache<Map<String,TCFFrameDMC>> implements TCFDSFExecutionDMC.DataCache {
+
+ private final TCFDSFExecutionDMC dmc;
+ private final Map<String,TCFFrameDMC> frame_pool;
+
+ FramesCache(IChannel channel, TCFDSFExecutionDMC dmc) {
+ super(channel);
+ this.dmc = dmc;
+ frame_pool = new HashMap<String,TCFFrameDMC>();
+ }
+
+ @Override
+ public boolean startDataRetrieval() {
+ assert command == null;
+ if (tcf_stk_service == null) {
+ data = null;
+ valid = true;
+ return true;
+ }
+ assert !dmc.isDisposed();
+ command = tcf_stk_service.getChildren(dmc.getTcfContextId(), new IStackTrace.DoneGetChildren() {
+ public void doneGetChildren(IToken token, Exception err, String[] contexts) {
+ if (command != token) return;
+ command = null;
+ if (err != null) {
+ data = null;
+ error = err;
+ }
+ else {
+ data = new HashMap<String,TCFFrameDMC>();
+ for (int i = 0; i < contexts.length; i++) {
+ String id = contexts[i];
+ TCFFrameDMC n = frame_pool.get(id);
+ if (n == null) frame_pool.put(id, n = new TCFFrameDMC(dmc, id));
+ n.level = contexts.length - i;
+ data.put(id, n);
+ }
+ String id = TOP_FRAME + dmc.getTcfContextId();
+ TCFFrameDMC n = frame_pool.get(id);
+ if (n == null) frame_pool.put(id, n = new TCFFrameDMC(dmc, id));
+ n.level = 0;
+ data.put(id, n);
+ }
+ valid = true;
+ validate();
+ }
+ });
+ return false;
+ }
+
+ void invalidateFrames() {
+ reset();
+ for (TCFFrameDMC dmc : frame_pool.values()) dmc.frame_data.reset();
+ }
+
+ void dispose() {
+ }
+ }
+
+ private final IChannel channel;
+ private final IStackTrace tcf_stk_service;
+ private final ILineNumbers tcf_lns_service;
+ private IDMContext service_dmc;
+
+ public TCFDSFStack(DsfSession session, IChannel channel, final RequestMonitor monitor) {
+ super(session);
+ this.channel = channel;
+ tcf_stk_service = channel.getRemoteService(IStackTrace.class);
+ tcf_lns_service = channel.getRemoteService(ILineNumbers.class);
+ service_dmc = new ServiceDMContext(this, "#stack_trace");
+ initialize(new RequestMonitor(getExecutor(), monitor) {
+ @Override
+ protected void handleOK() {
+ String[] class_names = {
+ IStack.class.getName(),
+ TCFDSFStack.class.getName()
+ };
+ register(class_names, new Hashtable<String,String>());
+ getSession().addServiceEventListener(TCFDSFStack.this, null);
+ monitor.done();
+ }
+ });
+ }
+
+ @Override
+ public void shutdown(RequestMonitor monitor) {
+ getSession().removeServiceEventListener(this);
+ unregister();
+ super.shutdown(monitor);
+ }
+
+ @Override
+ protected BundleContext getBundleContext() {
+ return Activator.getBundleContext();
+ }
+
+ public IDMContext getServiceContext() {
+ return service_dmc;
+ }
+
+ public void getArguments(IDMContext dmc, DataRequestMonitor<IVariableDMContext[]> rm) {
+ if (dmc instanceof TCFFrameDMC) {
+ // TODO function arguments
+ rm.setData(new IVariableDMContext[0]);
+ rm.done();
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+
+ public void getFrameData(final IFrameDMContext dmc, final DataRequestMonitor<IFrameDMData> rm) {
+ if (dmc instanceof TCFFrameDMC) {
+ final TCFFrameDMC frame_dmc = (TCFFrameDMC)dmc;
+ TCFDataCache<TCFFrameData> cache = frame_dmc.frame_data;
+ if (!cache.validate()) {
+ cache.addWaitingRequest(new IDataRequest() {
+ public void cancel() {
+ rm.setStatus(new Status(IStatus.CANCEL, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Canceled", null)); //$NON-NLS-1$
+ rm.setCanceled(true);
+ rm.done();
+ }
+ public void done() {
+ getFrameData(dmc, rm);
+ }
+ });
+ return;
+ }
+ if (cache.getError() != null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Data error", cache.getError())); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ rm.setData(cache.getData());
+ rm.done();
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+
+ public void getFrames(final IDMContext dmc, final DataRequestMonitor<IFrameDMContext[]> rm) {
+ if (tcf_stk_service == null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Stack trace service is not available", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ else if (dmc instanceof TCFDSFExecutionDMC) {
+ TCFDSFExecutionDMC exe = (TCFDSFExecutionDMC)dmc;
+ if (exe.isDisposed()) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Disposed DMC", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ if (exe.stack_frames_cache == null) exe.stack_frames_cache = new FramesCache(channel, exe);
+ FramesCache cache = (FramesCache)exe.stack_frames_cache;
+ if (!cache.validate()) {
+ cache.addWaitingRequest(new IDataRequest() {
+ public void cancel() {
+ rm.setStatus(new Status(IStatus.CANCEL, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Canceled", null)); //$NON-NLS-1$
+ rm.setCanceled(true);
+ rm.done();
+ }
+ public void done() {
+ getFrames(dmc, rm);
+ }
+ });
+ return;
+ }
+ if (cache.getError() != null) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ REQUEST_FAILED, "Data error", cache.getError())); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ Map<String,TCFFrameDMC> c = cache.getData();
+ TCFFrameDMC[] arr = c.values().toArray(new TCFFrameDMC[c.size()]);
+ Arrays.sort(arr);
+ rm.setData(arr);
+ rm.done();
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+
+ public void getLocals(IDMContext dmc, DataRequestMonitor<IVariableDMContext[]> rm) {
+ if (dmc instanceof TCFFrameDMC) {
+ // TODO function local variables
+ rm.setData(new IVariableDMContext[0]);
+ rm.done();
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+
+ public void getStackDepth(DataRequestMonitor<Integer> rm) {
+ // TODO don't know what getStackDepth() is supposed to return
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ rm.done();
+ }
+
+ public void getStackDepth(int maxDepth, DataRequestMonitor<Integer> rm) {
+ // TODO don't know what getStackDepth() is supposed to return
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ rm.done();
+ }
+
+ public void getTopFrame(IDMContext dmc, DataRequestMonitor<IFrameDMContext> rm) {
+ if (dmc instanceof TCFDSFExecutionDMC) {
+ TCFDSFExecutionDMC exe = (TCFDSFExecutionDMC)dmc;
+ if (exe.isDisposed()) {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Disposed DMC", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+ if (exe.stack_frames_cache == null) exe.stack_frames_cache = new FramesCache(channel, exe);
+ FramesCache cache = (FramesCache)exe.stack_frames_cache;
+ String id = TOP_FRAME + exe.getTcfContextId();
+ TCFFrameDMC n = cache.frame_pool.get(id);
+ if (n == null) cache.frame_pool.put(id, n = new TCFFrameDMC(exe, id));
+ n.level = 0;
+ rm.setData(n);
+ rm.done();
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+
+ public void getVariableData(IVariableDMContext variableDmc, DataRequestMonitor<IVariableDMData> rm) {
+ // TODO model data for local variables
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ rm.done();
+ }
+
+ public boolean isStackAvailable(IDMContext dmc) {
+ return tcf_stk_service != null && dmc instanceof TCFDSFExecutionDMC;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void getModelData(IDMContext dmc, DataRequestMonitor<?> rm) {
+ if (dmc instanceof IFrameDMContext) {
+ getFrameData((IFrameDMContext)dmc, (DataRequestMonitor<IFrameDMData>)rm);
+ }
+ else if (dmc == service_dmc) {
+ ((DataRequestMonitor<TCFDSFStack>)rm).setData(this);
+ rm.done();
+ }
+ else {
+ rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(IRunControl.IResumedDMEvent e) {
+ if (e.getReason() != StateChangeReason.STEP) {
+ FramesCache cache = (FramesCache)((TCFDSFExecutionDMC)e.getDMContext()).stack_frames_cache;
+ if (cache != null) cache.invalidateFrames();
+ }
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(IRunControl.ISuspendedDMEvent e) {
+ FramesCache cache = (FramesCache)((TCFDSFExecutionDMC)e.getDMContext()).stack_frames_cache;
+ if (cache != null) cache.invalidateFrames();
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(IRunControl.IExitedDMEvent e) {
+ FramesCache cache = (FramesCache)((TCFDSFExecutionDMC)e.getExecutionContext()).stack_frames_cache;
+ if (cache != null) cache.dispose();
+ }
+}
diff --git a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFStepQueueManager.java b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFStepQueueManager.java new file mode 100644 index 000000000..360a95ac4 --- /dev/null +++ b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDSFStepQueueManager.java @@ -0,0 +1,233 @@ +/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package com.windriver.tcf.dsf.core.services;
+
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+
+import org.eclipse.dd.dsf.concurrent.DsfRunnable;
+import org.eclipse.dd.dsf.concurrent.RequestMonitor;
+import org.eclipse.dd.dsf.datamodel.DMContexts;
+import org.eclipse.dd.dsf.datamodel.IDMContext;
+import org.eclipse.dd.dsf.debug.service.IRunControl;
+import org.eclipse.dd.dsf.debug.service.IStepQueueManager;
+import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
+import org.eclipse.dd.dsf.debug.service.IRunControl.IResumedDMEvent;
+import org.eclipse.dd.dsf.debug.service.IRunControl.ISuspendedDMEvent;
+import org.eclipse.dd.dsf.debug.service.IRunControl.StateChangeReason;
+import org.eclipse.dd.dsf.debug.service.IRunControl.StepType;
+import org.eclipse.dd.dsf.service.AbstractDsfService;
+import org.eclipse.dd.dsf.service.DsfServiceEventHandler;
+import org.eclipse.dd.dsf.service.DsfSession;
+import org.osgi.framework.BundleContext;
+
+import com.windriver.tcf.dsf.core.Activator;
+
+public class TCFDSFStepQueueManager extends AbstractDsfService
+implements IStepQueueManager{
+
+ private static class StepRequest {
+ StepType fStepType;
+ boolean fIsInstructionStep;
+ StepRequest(StepType type, boolean instruction) {
+ fStepType = type;
+ fIsInstructionStep = instruction;
+ }
+ }
+
+ private IRunControl fRunControl;
+ private int fQueueDepth = 3;
+ private Map<IExecutionDMContext,List<StepRequest>> fStepQueues = new HashMap<IExecutionDMContext,List<StepRequest>>();
+ private Map<IExecutionDMContext,Boolean> fTimedOutFlags = new HashMap<IExecutionDMContext,Boolean>();
+ private Map<IExecutionDMContext,ScheduledFuture<?>> fTimedOutFutures = new HashMap<IExecutionDMContext,ScheduledFuture<?>>();
+
+ public TCFDSFStepQueueManager(DsfSession session) {
+ super(session);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // IDsfService
+ @Override
+ public void initialize(final RequestMonitor requestMonitor) {
+ super.initialize(
+ new RequestMonitor(getExecutor(), requestMonitor) {
+ @Override
+ protected void handleOK() {
+ doInitialize(requestMonitor);
+ }});
+ }
+
+ private void doInitialize(final RequestMonitor requestMonitor) {
+ fRunControl = getServicesTracker().getService(IRunControl.class);
+
+ getSession().addServiceEventListener(this, null);
+ register(new String[]{IStepQueueManager.class.getName()}, new Hashtable<String,String>());
+ requestMonitor.done();
+ }
+
+ @Override
+ public void shutdown(final RequestMonitor requestMonitor) {
+ unregister();
+ getSession().removeServiceEventListener(this);
+ super.shutdown(requestMonitor);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // AbstractService
+ @Override
+ protected BundleContext getBundleContext() {
+ return Activator.getBundleContext();
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // IStepQueueManager
+ public boolean canEnqueueStep(IDMContext ctx) {
+ IExecutionDMContext execCtx = DMContexts.getAncestorOfType(ctx, IExecutionDMContext.class);
+ return execCtx != null &&
+ ( (fRunControl.isSuspended(execCtx) && fRunControl.canStep(execCtx)) ||
+ (fRunControl.isStepping(execCtx) && !isSteppingTimedOut(execCtx)) );
+ }
+
+ // IStepQueueManager
+ public boolean canEnqueueInstructionStep(IDMContext ctx) {
+ IExecutionDMContext execCtx = DMContexts.getAncestorOfType(ctx, IExecutionDMContext.class);
+ return execCtx != null &&
+ ( (fRunControl.isSuspended(execCtx) && fRunControl.canInstructionStep(execCtx)) ||
+ (fRunControl.isStepping(execCtx) && !isSteppingTimedOut(execCtx)) );
+ }
+
+ public int getPendingStepCount(IDMContext execCtx) {
+ List<StepRequest> stepQueue = fStepQueues.get(execCtx);
+ if (stepQueue == null) return 0;
+ return stepQueue.size();
+ }
+
+ public void enqueueStep(IDMContext ctx, StepType stepType) {
+ IExecutionDMContext execCtx = DMContexts.getAncestorOfType(ctx, IExecutionDMContext.class);
+ if (execCtx != null) {
+ if (fRunControl.canStep(execCtx)) {
+ fRunControl.step(execCtx, stepType, new RequestMonitor(getExecutor(), null));
+ } else if (canEnqueueStep(execCtx)) {
+ List<StepRequest> stepQueue = fStepQueues.get(execCtx);
+ if (stepQueue == null) {
+ stepQueue = new LinkedList<StepRequest>();
+ fStepQueues.put(execCtx, stepQueue);
+ }
+ if (stepQueue.size() < fQueueDepth) {
+ stepQueue.add(new StepRequest(stepType, false));
+ }
+ }
+ }
+ }
+
+ public void enqueueInstructionStep(IDMContext ctx, StepType stepType) {
+ IExecutionDMContext execCtx = DMContexts.getAncestorOfType(ctx, IExecutionDMContext.class);
+ if (execCtx != null) {
+ if (fRunControl.canInstructionStep(execCtx)) {
+ fRunControl.instructionStep(execCtx, stepType, new RequestMonitor(getExecutor(), null));
+ }
+ else if (canEnqueueInstructionStep(execCtx)) {
+ List<StepRequest> stepQueue = fStepQueues.get(execCtx);
+ if (stepQueue == null) {
+ stepQueue = new LinkedList<StepRequest>();
+ fStepQueues.put(execCtx, stepQueue);
+ }
+ if (stepQueue.size() < fQueueDepth) {
+ stepQueue.add(new StepRequest(stepType, true));
+ }
+ }
+ }
+ }
+
+ public boolean isSteppingTimedOut(IDMContext context) {
+ IExecutionDMContext execCtx = DMContexts.getAncestorOfType(context, IExecutionDMContext.class);
+ if (execCtx != null) {
+ return fTimedOutFlags.containsKey(execCtx) ? fTimedOutFlags.get(execCtx) : false;
+ }
+ return false;
+ }
+
+
+ public int getStepQueueDepth() { return fQueueDepth; }
+ public void setStepQueueDepth(int depth) { fQueueDepth = depth; }
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ @DsfServiceEventHandler
+ public void eventDispatched(ISuspendedDMEvent e) {
+ // Take care of the stepping time out
+ fTimedOutFlags.remove(e.getDMContext());
+ ScheduledFuture<?> future = fTimedOutFutures.remove(e.getDMContext());
+ if (future != null) future.cancel(false);
+
+ // Check if there's a step pending, if so execute it
+ if (fStepQueues.containsKey(e.getDMContext())) {
+ List<StepRequest> queue = fStepQueues.get(e.getDMContext());
+ StepRequest request = queue.remove(queue.size() - 1);
+ if (queue.isEmpty()) fStepQueues.remove(e.getDMContext());
+ if (request.fIsInstructionStep) {
+ if (fRunControl.canInstructionStep(e.getDMContext())) {
+ fRunControl.instructionStep(
+ e.getDMContext(), request.fStepType, new RequestMonitor(getExecutor(), null));
+ } else {
+ // For whatever reason we can't step anymore, so clear out
+ // the step queue.
+ fStepQueues.remove(e.getDMContext());
+ }
+ } else {
+ if (fRunControl.canStep(e.getDMContext())) {
+ fRunControl.step(e.getDMContext(), request.fStepType,new RequestMonitor(getExecutor(), null));
+ } else {
+ // For whatever reason we can't step anymore, so clear out
+ // the step queue.
+ fStepQueues.remove(e.getDMContext());
+ }
+ }
+ }
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(final IResumedDMEvent e) {
+ if (e.getReason().equals(StateChangeReason.STEP)) {
+ fTimedOutFlags.put(e.getDMContext(), Boolean.FALSE);
+ // We shouldn't have a stepping timeout running unless we get two
+ // stepping events in a row without a suspended, which would be a
+ // protocol error.
+ assert !fTimedOutFutures.containsKey(e.getDMContext());
+ fTimedOutFutures.put(
+ e.getDMContext(),
+ getExecutor().schedule(
+ new DsfRunnable() { public void run() {
+ fTimedOutFutures.remove(e.getDMContext());
+
+ // Issue the stepping time-out event.
+ getSession().dispatchEvent(
+ new ISteppingTimedOutEvent() {
+ public IExecutionDMContext getDMContext() { return e.getDMContext(); }
+ },
+ getProperties());
+ }},
+ STEPPING_TIMEOUT, TimeUnit.MILLISECONDS)
+ );
+
+ }
+ }
+
+ @DsfServiceEventHandler
+ public void eventDispatched(ISteppingTimedOutEvent e) {
+ fTimedOutFlags.put(e.getDMContext(), Boolean.TRUE);
+ }
+}
diff --git a/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDataCache.java b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDataCache.java new file mode 100644 index 000000000..18c8addd3 --- /dev/null +++ b/plugins/com.windriver.tcf.dsf.core/src/com/windriver/tcf/dsf/core/services/TCFDataCache.java @@ -0,0 +1,105 @@ +/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package com.windriver.tcf.dsf.core.services;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import com.windriver.tcf.api.protocol.IChannel;
+import com.windriver.tcf.api.protocol.IToken;
+import com.windriver.tcf.api.protocol.Protocol;
+
+public abstract class TCFDataCache<V> {
+
+ protected Throwable error;
+ protected IToken command;
+ protected boolean valid;
+ protected V data;
+
+ protected final IChannel channel;
+ protected final Collection<IDataRequest> waiting_list = new ArrayList<IDataRequest>();
+
+ public TCFDataCache(IChannel channel) {
+ assert channel != null;
+ this.channel = channel;
+ }
+
+ public void cancel() {
+ // Cancel current data retrieval command
+ if (command != null) {
+ command.cancel();
+ command = null;
+ }
+ // Cancel waiting data requests
+ if (!waiting_list.isEmpty()) {
+ IDataRequest[] arr = waiting_list.toArray(new IDataRequest[waiting_list.size()]);
+ waiting_list.clear();
+ for (IDataRequest r : arr) r.cancel();
+ }
+ }
+
+ public boolean validate() {
+ assert Protocol.isDispatchThread();
+ if (channel.getState() != IChannel.STATE_OPEN) {
+ error = null;
+ command = null;
+ data = null;
+ valid = true;
+ return true;
+ }
+ if (command != null) {
+ return false;
+ }
+ if (!valid && !startDataRetrieval()) return false;
+ assert command == null;
+ if (!waiting_list.isEmpty()) {
+ IDataRequest[] arr = waiting_list.toArray(new IDataRequest[waiting_list.size()]);
+ waiting_list.clear();
+ for (IDataRequest r : arr) r.done();
+ }
+ return true;
+ }
+
+ public void addWaitingRequest(IDataRequest req) {
+ assert !valid;
+ waiting_list.add(req);
+ }
+
+ public void reset(V data) {
+ cancel();
+ this.data = data;
+ error = null;
+ valid = true;
+ }
+
+ public void reset() {
+ cancel();
+ error = null;
+ data = null;
+ valid = false;
+ }
+
+ public boolean isValid() {
+ return valid;
+ }
+
+ public Throwable getError() {
+ assert valid;
+ return error;
+ }
+
+ public V getData() {
+ assert valid;
+ return data;
+ }
+
+ public abstract boolean startDataRetrieval();
+}
diff --git a/plugins/com.windriver.tcf.dsf.ui/.classpath b/plugins/com.windriver.tcf.dsf.ui/.classpath index 751c8f2e5..304e86186 100644 --- a/plugins/com.windriver.tcf.dsf.ui/.classpath +++ b/plugins/com.windriver.tcf.dsf.ui/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/plugins/com.windriver.tcf.dsf.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/com.windriver.tcf.dsf.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..0bf81e2f5 --- /dev/null +++ b/plugins/com.windriver.tcf.dsf.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,272 @@ +#Tue Feb 05 15:38:16 CET 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.builder.cleanOutputFolder=clean +org.eclipse.jdt.core.builder.duplicateResourceTask=warning +org.eclipse.jdt.core.builder.invalidClasspath=abort +org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore +org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,.svn/ +org.eclipse.jdt.core.circularClasspath=error +org.eclipse.jdt.core.classpath.exclusionPatterns=enabled +org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=1 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=80 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.incompatibleJDKLevel=ignore +org.eclipse.jdt.core.incompleteClasspath=error diff --git a/plugins/com.windriver.tcf.dsf.ui/.settings/org.eclipse.jdt.ui.prefs b/plugins/com.windriver.tcf.dsf.ui/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..55a9abb5d --- /dev/null +++ b/plugins/com.windriver.tcf.dsf.ui/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,4 @@ +#Wed Jan 09 12:21:39 PST 2008
+eclipse.preferences.version=1
+formatter_profile=_Java STD
+formatter_settings_version=11
diff --git a/plugins/com.windriver.tcf.dsf.ui/META-INF/MANIFEST.MF b/plugins/com.windriver.tcf.dsf.ui/META-INF/MANIFEST.MF index a4b898b02..d76310516 100644 --- a/plugins/com.windriver.tcf.dsf.ui/META-INF/MANIFEST.MF +++ b/plugins/com.windriver.tcf.dsf.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: com.windriver.tcf.dsf.ui;singleton:=true -Bundle-Version: 0.1.0 +Bundle-Version: 0.2.0 Bundle-Activator: com.windriver.tcf.dsf.ui.Activator Bundle-Vendor: %providerName Require-Bundle: org.eclipse.ui, @@ -16,5 +16,6 @@ Require-Bundle: org.eclipse.ui, com.windriver.debug.tcf.core, com.windriver.debug.tcf.ui, com.windriver.tcf.dsf.core +Bundle-ActivationPolicy: lazy Eclipse-LazyStart: true Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/plugins/com.windriver.tcf.dsf.ui/build.properties b/plugins/com.windriver.tcf.dsf.ui/build.properties index e9863e281..cd72b059e 100644 --- a/plugins/com.windriver.tcf.dsf.ui/build.properties +++ b/plugins/com.windriver.tcf.dsf.ui/build.properties @@ -2,4 +2,8 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ - plugin.xml + plugin.xml,\ + about.html,\ + icons/,\ + plugin.properties +src.includes = about.html diff --git a/plugins/com.windriver.tcf.dsf.ui/plugin.xml b/plugins/com.windriver.tcf.dsf.ui/plugin.xml index 4da1ce1d0..4be8bb538 100644 --- a/plugins/com.windriver.tcf.dsf.ui/plugin.xml +++ b/plugins/com.windriver.tcf.dsf.ui/plugin.xml @@ -2,7 +2,7 @@ <?eclipse version="3.2"?> <plugin> - <extension point="com.windriver.debug.tcf.core.startup"/> + <extension point="com.windriver.tcf.api.startup"/> <extension point="org.eclipse.debug.ui.launchConfigurationTabGroups"> <launchConfigurationTabGroup @@ -24,7 +24,6 @@ <factory class="com.windriver.tcf.dsf.ui.AdapterFactory" adaptableType="com.windriver.tcf.dsf.core.launch.TCFDSFLaunch"> - <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider"/> <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider"/> <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory"/> <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory"/> @@ -32,4 +31,15 @@ </factory> </extension> + <extension point="org.eclipse.debug.ui.memoryRenderings">
+ <renderingBindings
+ defaultIds="org.eclipse.debug.ui.rendering.raw_memory"
+ primaryId="org.eclipse.debug.ui.rendering.raw_memory"
+ renderingIds="org.eclipse.debug.ui.rendering.raw_memory,org.eclipse.debug.ui.rendering.ascii,org.eclipse.debug.ui.rendering.signedint,org.eclipse.debug.ui.rendering.unsignedint">
+ <enablement>
+ <instanceof value="org.eclipse.dd.dsf.debug.model.DsfMemoryBlock"/>
+ </enablement>
+ </renderingBindings>
+ </extension>
+
</plugin> diff --git a/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/Activator.java b/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/Activator.java index f37328701..3244699a4 100644 --- a/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/Activator.java +++ b/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/Activator.java @@ -18,43 +18,42 @@ import org.osgi.framework.BundleContext; */ public class Activator extends AbstractUIPlugin { - // The plug-in ID - public static final String PLUGIN_ID = "com.windriver.tcf.dsf.ui"; - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - + // The plug-in ID + public static final String PLUGIN_ID = "com.windriver.tcf.dsf.ui"; + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } } diff --git a/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/AdapterFactory.java b/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/AdapterFactory.java index f8d0604f8..44c66914e 100644 --- a/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/AdapterFactory.java +++ b/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/AdapterFactory.java @@ -37,7 +37,6 @@ import org.eclipse.debug.core.model.IDebugModelProvider; import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory; import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider; import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory; import org.eclipse.debug.ui.sourcelookup.ISourceDisplay; @@ -49,95 +48,95 @@ public class AdapterFactory implements IAdapterFactory, DsfSession.SessionEndedL @Immutable private final class SessionAdapterSet { - - private final DsfSession fSession; - final ViewModelAdapter fViewModelAdapter; - final MISourceDisplayAdapter fSourceDisplayAdapter; - final DsfStepIntoCommand fStepIntoCommand; - final DsfStepOverCommand fStepOverCommand; - final DsfStepReturnCommand fStepReturnCommand; - final DsfSuspendCommand fSuspendCommand; - final DsfResumeCommand fResumeCommand; - final DsfTerminateCommand fTerminateCommand; - final IDebugModelProvider fDebugModelProvider; - final TCFDSFLaunch fLaunch; + + private final DsfSession session; + final ViewModelAdapter view_model_adapter; + final MISourceDisplayAdapter source_display_adapter; + final DsfStepIntoCommand step_into_command; + final DsfStepOverCommand step_over_command; + final DsfStepReturnCommand step_return_command; + final DsfSuspendCommand suspend_command; + final DsfResumeCommand resume_command; + final DsfTerminateCommand terminate_command; + final IDebugModelProvider debug_model_provider; + final TCFDSFLaunch lunch; SessionAdapterSet(DsfSession session, TCFDSFLaunch launch) { - fSession = session; - - fViewModelAdapter = new ViewModelAdapter(session, launch); + this.session = session; + + view_model_adapter = new ViewModelAdapter(session, launch); if (launch.getSourceLocator() instanceof ISourceLookupDirector) { - fSourceDisplayAdapter = new MISourceDisplayAdapter(session, (ISourceLookupDirector)launch.getSourceLocator()); - } else { - fSourceDisplayAdapter = null; + source_display_adapter = new MISourceDisplayAdapter(session, (ISourceLookupDirector)launch.getSourceLocator()); } - session.registerModelAdapter(ISourceDisplay.class, fSourceDisplayAdapter); - - fStepIntoCommand = new DsfStepIntoCommand(session); - fStepOverCommand = new DsfStepOverCommand(session); - fStepReturnCommand = new DsfStepReturnCommand(session); - fSuspendCommand = new DsfSuspendCommand(session); - fResumeCommand = new DsfResumeCommand(session); - fTerminateCommand = new DsfTerminateCommand(session); - session.registerModelAdapter(IStepIntoHandler.class, fStepIntoCommand); - session.registerModelAdapter(IStepOverHandler.class, fStepOverCommand); - session.registerModelAdapter(IStepReturnHandler.class, fStepReturnCommand); - session.registerModelAdapter(ISuspendHandler.class, fSuspendCommand); - session.registerModelAdapter(IResumeHandler.class, fResumeCommand); - session.registerModelAdapter(ITerminateHandler.class, fTerminateCommand); - - fDebugModelProvider = new IDebugModelProvider() { + else { + source_display_adapter = null; + } + session.registerModelAdapter(ISourceDisplay.class, source_display_adapter); + + step_into_command = new DsfStepIntoCommand(session); + step_over_command = new DsfStepOverCommand(session); + step_return_command = new DsfStepReturnCommand(session); + suspend_command = new DsfSuspendCommand(session); + resume_command = new DsfResumeCommand(session); + terminate_command = new DsfTerminateCommand(session); + session.registerModelAdapter(IStepIntoHandler.class, step_into_command); + session.registerModelAdapter(IStepOverHandler.class, step_over_command); + session.registerModelAdapter(IStepReturnHandler.class, step_return_command); + session.registerModelAdapter(ISuspendHandler.class, suspend_command); + session.registerModelAdapter(IResumeHandler.class, resume_command); + session.registerModelAdapter(ITerminateHandler.class, terminate_command); + + debug_model_provider = new IDebugModelProvider() { // @see org.eclipse.debug.core.model.IDebugModelProvider#getModelIdentifiers() public String[] getModelIdentifiers() { return new String[] { ITCFConstants.ID_TCF_DEBUG_MODEL }; } }; - session.registerModelAdapter(IDebugModelProvider.class, fDebugModelProvider); + session.registerModelAdapter(IDebugModelProvider.class, debug_model_provider); + + lunch = launch; - fLaunch = launch; - /* * Registering the launch as an adapter, ensures that this launch, * and debug model ID will be associated with all DMContexts from this * session. */ - session.registerModelAdapter(ILaunch.class, fLaunch); + session.registerModelAdapter(ILaunch.class, lunch); } - + void dispose() { - fViewModelAdapter.dispose(); - - fSession.unregisterModelAdapter(ISourceDisplay.class); - if (fSourceDisplayAdapter != null) fSourceDisplayAdapter.dispose(); - - fSession.unregisterModelAdapter(IStepIntoHandler.class); - fSession.unregisterModelAdapter(IStepOverHandler.class); - fSession.unregisterModelAdapter(IStepReturnHandler.class); - fSession.unregisterModelAdapter(ISuspendHandler.class); - fSession.unregisterModelAdapter(IResumeHandler.class); - fSession.unregisterModelAdapter(ITerminateHandler.class); - fStepIntoCommand.dispose(); - fStepOverCommand.dispose(); - fStepReturnCommand.dispose(); - fSuspendCommand.dispose(); - fResumeCommand.dispose(); - fTerminateCommand.dispose(); + view_model_adapter.dispose(); + + session.unregisterModelAdapter(ISourceDisplay.class); + if (source_display_adapter != null) source_display_adapter.dispose(); + + session.unregisterModelAdapter(IStepIntoHandler.class); + session.unregisterModelAdapter(IStepOverHandler.class); + session.unregisterModelAdapter(IStepReturnHandler.class); + session.unregisterModelAdapter(ISuspendHandler.class); + session.unregisterModelAdapter(IResumeHandler.class); + session.unregisterModelAdapter(ITerminateHandler.class); + step_into_command.dispose(); + step_over_command.dispose(); + step_return_command.dispose(); + suspend_command.dispose(); + resume_command.dispose(); + terminate_command.dispose(); } } - + @SuppressWarnings({ "unchecked", "restriction" }) private final Class[] adapter_list = { - IElementLabelProvider.class, IElementContentProvider.class, IColumnPresentationFactory.class, IModelProxyFactory.class, ITerminateHandler.class }; - private Map<String,SessionAdapterSet> fSessionAdapterSetMap = + private Map<String,SessionAdapterSet> session_adapter_set_map = Collections.synchronizedMap(new HashMap<String,SessionAdapterSet>()); - + public AdapterFactory() { DsfSession.addSessionEndedListener(this); DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this); @@ -156,20 +155,19 @@ public class AdapterFactory implements IAdapterFactory, DsfSession.SessionEndedL if (session == null) return null; SessionAdapterSet adapter_set; - synchronized(fSessionAdapterSetMap) { - adapter_set = fSessionAdapterSetMap.get(session.getId()); + synchronized(session_adapter_set_map) { + adapter_set = session_adapter_set_map.get(session.getId()); if (adapter_set == null) { adapter_set = new SessionAdapterSet(session, launch); - fSessionAdapterSetMap.put(session.getId(), adapter_set); + session_adapter_set_map.put(session.getId(), adapter_set); } } - + // Returns the adapter type for the launch object. - if (adapterType.equals(IElementLabelProvider.class)) return adapter_set.fViewModelAdapter; - if (adapterType.equals(IElementContentProvider.class)) return adapter_set.fViewModelAdapter; - if (adapterType.equals(IModelProxyFactory.class)) return adapter_set.fViewModelAdapter; - if (adapterType.equals(IColumnPresentationFactory.class)) return adapter_set.fViewModelAdapter; - if (adapterType.equals(ITerminateHandler.class)) return adapter_set.fTerminateCommand; + if (adapterType.equals(IElementContentProvider.class)) return adapter_set.view_model_adapter; + if (adapterType.equals(IModelProxyFactory.class)) return adapter_set.view_model_adapter; + if (adapterType.equals(IColumnPresentationFactory.class)) return adapter_set.view_model_adapter; + if (adapterType.equals(ITerminateHandler.class)) return adapter_set.terminate_command; return null; } @@ -195,10 +193,10 @@ public class AdapterFactory implements IAdapterFactory, DsfSession.SessionEndedL for (ILaunch launch : launches) { if (launch instanceof TCFDSFLaunch) { DsfSession session = ((TCFDSFLaunch)launch).getSession(); - synchronized (fSessionAdapterSetMap) { - if (fSessionAdapterSetMap.containsKey(session.getId())) { - fSessionAdapterSetMap.get(session.getId()).dispose(); - fSessionAdapterSetMap.remove(session); + synchronized (session_adapter_set_map) { + if (session_adapter_set_map.containsKey(session.getId())) { + session_adapter_set_map.get(session.getId()).dispose(); + session_adapter_set_map.remove(session); } } } diff --git a/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/ContainerLayoutNode.java b/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/ContainerLayoutNode.java index 31d80eba3..89fce7be8 100644 --- a/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/ContainerLayoutNode.java +++ b/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/ContainerLayoutNode.java @@ -13,15 +13,22 @@ package com.windriver.tcf.dsf.ui; import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; +import org.eclipse.dd.dsf.concurrent.RequestMonitor; +import org.eclipse.dd.dsf.datamodel.IDMEvent; import org.eclipse.dd.dsf.debug.service.INativeProcesses; import org.eclipse.dd.dsf.debug.service.IRunControl; import org.eclipse.dd.dsf.debug.service.INativeProcesses.IProcessDMData; import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext; +import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext; +import org.eclipse.dd.dsf.debug.service.IRunControl.IExitedDMEvent; +import org.eclipse.dd.dsf.debug.service.IRunControl.IStartedDMEvent; import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMProvider; +import org.eclipse.dd.dsf.ui.viewmodel.VMDelta; import org.eclipse.dd.dsf.ui.viewmodel.dm.AbstractDMVMLayoutNode; import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.IDebugUIConstants; @@ -35,12 +42,23 @@ public class ContainerLayoutNode extends AbstractDMVMLayoutNode{ } @Override - protected void updateElementsInSessionThread(IChildrenUpdate update) { + protected void updateElementsInSessionThread(final IChildrenUpdate update) { if (!checkService(IRunControl.class, null, update)) return; + final IContainerDMContext contDmc = findDmcInPath( + update.getElementPath().getParentPath(), IContainerDMContext.class); - IContainerDMContext containerCtx = getServicesTracker().getService(TCFDSFRunControl.class).getContainerDMC(); - update.setChild(new DMVMContext(containerCtx), 0); - update.done(); + getServicesTracker().getService(TCFDSFRunControl.class).getContainerContexts(contDmc, + new DataRequestMonitor<IExecutionDMContext[]>(getSession().getExecutor(), null){ + @Override + public void handleCompleted() { + if (!getStatus().isOK()) { + handleFailedUpdate(update); + return; + } + fillUpdateWithVMCs(update, getData()); + update.done(); + } + }); } @Override @@ -58,7 +76,8 @@ public class ContainerLayoutNode extends AbstractDMVMLayoutNode{ if (getServicesTracker().getService(IRunControl.class).isSuspended(dmc)) { imageKey = IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED; - } else { + } + else { imageKey = IDebugUIConstants.IMG_OBJS_THREAD_RUNNING; } update.setImageDescriptor(DebugUITools.getImageDescriptor(imageKey), 0); @@ -79,4 +98,27 @@ public class ContainerLayoutNode extends AbstractDMVMLayoutNode{ }); } } + + @Override + protected int getNodeDeltaFlagsForDMEvent(IDMEvent<?> e) { + if (e instanceof IStartedDMEvent || e instanceof IExitedDMEvent) { + return IModelDelta.CONTENT; + } + if (e instanceof IRunControl.IContainerResumedDMEvent || e instanceof IRunControl.IContainerSuspendedDMEvent) { + return IModelDelta.STATE; + } + return IModelDelta.NO_CHANGE; + } + + @Override + protected void buildDeltaForDMEvent(final IDMEvent<?> e, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor requestMonitor) { + + if (e instanceof IRunControl.IContainerResumedDMEvent || e instanceof IRunControl.IContainerSuspendedDMEvent) { + parentDelta.addNode(new DMVMContext(e.getDMContext()), IModelDelta.STATE); + } + if (e instanceof IStartedDMEvent || e instanceof IExitedDMEvent) { + parentDelta.addNode(new DMVMContext(e.getDMContext()), IModelDelta.CONTENT); + } + super.buildDeltaForDMEvent(e, parentDelta, nodeOffset, requestMonitor); + } } diff --git a/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/LaunchDialogTabGroup.java b/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/LaunchDialogTabGroup.java index 9a7d62dcc..2b17b6aa0 100644 --- a/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/LaunchDialogTabGroup.java +++ b/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/LaunchDialogTabGroup.java @@ -27,11 +27,11 @@ public class LaunchDialogTabGroup extends AbstractLaunchConfigurationTabGroup { public void createTabs(ILaunchConfigurationDialog dialog, String mode) { setTabs(new ILaunchConfigurationTab[] { - new TCFMainTab(), - new TCFArgumentsTab(), - new EnvironmentTab(), - new SourceLookupTab(), - new CommonTab() + new TCFMainTab(), + new TCFArgumentsTab(), + new EnvironmentTab(), + new SourceLookupTab(), + new CommonTab() }); } } diff --git a/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/LaunchVMProvider.java b/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/LaunchVMProvider.java index caf259806..aad7ddf28 100644 --- a/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/LaunchVMProvider.java +++ b/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/LaunchVMProvider.java @@ -34,62 +34,62 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationCont @SuppressWarnings("restriction") public class LaunchVMProvider extends AbstractDMVMProvider - implements IDebugEventSetListener, ILaunchesListener2 { +implements IDebugEventSetListener, ILaunchesListener2 { @ThreadSafe public LaunchVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext, - DsfSession session, ILaunch launch) + DsfSession session, ILaunch launch) { super(adapter, presentationContext, session); - + IVMRootLayoutNode launchNode = new StandardLaunchRootLayoutNode(this, launch); // Container node to contain all processes and threads IVMLayoutNode containerNode = new ContainerLayoutNode(this, getSession()); IVMLayoutNode processesNode = new StandardProcessLayoutNode(this); launchNode.setChildNodes(new IVMLayoutNode[] { containerNode, processesNode}); - + IVMLayoutNode threadsNode = new ThreadLayoutNode(this, getSession()); containerNode.setChildNodes(new IVMLayoutNode[] { threadsNode }); - + IVMLayoutNode stackFramesNode = new StackFramesLayoutNode(this, getSession()); threadsNode.setChildNodes(new IVMLayoutNode[] { stackFramesNode }); setRootLayoutNode(launchNode); - + DebugPlugin.getDefault().addDebugEventListener(this); DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this); } - - + + public void handleDebugEvents(final DebugEvent[] events) { if (isDisposed()) return; - + // We're in session's executor thread. Re-dispach to VM Adapter // executor thread and then call root layout node. try { getExecutor().execute(new Runnable() { public void run() { if (isDisposed()) return; - + for (final DebugEvent event : events) { IVMRootLayoutNode rootLayoutNode = getRootLayoutNode(); if (rootLayoutNode != null && rootLayoutNode.getDeltaFlags(event) != 0) { rootLayoutNode.createDelta( - event, - new DataRequestMonitor<IModelDelta>(getExecutor(), null) { - @Override - public void handleCompleted() { - if (getStatus().isOK()) { - getModelProxy().fireModelChangedNonDispatch(getData()); + event, + new DataRequestMonitor<IModelDelta>(getExecutor(), null) { + @Override + public void handleCompleted() { + if (getStatus().isOK()) { + getModelProxy().fireModelChangedNonDispatch(getData()); + } } - } - @Override - public String toString() { - return "Result of a delta for debug event: '" + event.toString() + + @Override + public String toString() { + return "Result of a delta for debug event: '" + event.toString() + "' in VMP: '" + LaunchVMProvider.this + "'" + "\n" + getData(); - } - }); + } + }); } } }}); @@ -106,50 +106,51 @@ public class LaunchVMProvider extends AbstractDMVMProvider DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this); super.dispose(); } - + public void launchesAdded(ILaunch[] launches) { handleLaunchesEvent(new LaunchesEvent(launches, LaunchesEvent.Type.ADDED)); } - + public void launchesRemoved(ILaunch[] launches) { handleLaunchesEvent(new LaunchesEvent(launches, LaunchesEvent.Type.REMOVED)); } - + public void launchesChanged(ILaunch[] launches) { handleLaunchesEvent(new LaunchesEvent(launches, LaunchesEvent.Type.CHANGED)); } - + public void launchesTerminated(ILaunch[] launches) { handleLaunchesEvent(new LaunchesEvent(launches, LaunchesEvent.Type.TERMINATED)); } - + private void handleLaunchesEvent(final LaunchesEvent event) { if (isDisposed()) return; - + // We're in session's executor thread. Re-dispach to VM Adapter // executor thread and then call root layout node. try { getExecutor().execute(new Runnable() { public void run() { if (isDisposed()) return; - + IVMRootLayoutNode rootLayoutNode = getRootLayoutNode(); if (rootLayoutNode != null && rootLayoutNode.getDeltaFlags(event) != 0) { rootLayoutNode.createDelta( - event, - new DataRequestMonitor<IModelDelta>(getExecutor(), null) { - @Override - public void handleCompleted() { - if (getStatus().isOK()) { - getModelProxy().fireModelChangedNonDispatch(getData()); + event, + new DataRequestMonitor<IModelDelta>(getExecutor(), null) { + @Override + public void handleCompleted() { + if (getStatus().isOK()) { + getModelProxy().fireModelChangedNonDispatch(getData()); + } } - } - @Override public String toString() { - return "Result of a delta for launch event: '" + event.toString() + + @Override + public String toString() { + return "Result of a delta for launch event: '" + event.toString() + "' in VMP: '" + LaunchVMProvider.this + "'" + "\n" + getData(); - } - }); + } + }); } }}); } diff --git a/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/ThreadLayoutNode.java b/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/ThreadLayoutNode.java index 54ef832fc..496d83e64 100644 --- a/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/ThreadLayoutNode.java +++ b/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/ThreadLayoutNode.java @@ -7,7 +7,7 @@ * * Contributors: * Wind River Systems - initial API and implementation - * Ericsson - Modified for multi threaded functionality + * Ericsson - Modified for multi threaded functionality *******************************************************************************/ package com.windriver.tcf.dsf.ui; @@ -136,10 +136,14 @@ public class ThreadLayoutNode extends AbstractDMVMLayoutNode { @Override protected int getNodeDeltaFlagsForDMEvent(IDMEvent<?> e) { - if(e instanceof IRunControl.IContainerResumedDMEvent || e instanceof IRunControl.IContainerSuspendedDMEvent || e instanceof IStartedDMEvent || e instanceof IExitedDMEvent) { + if (e instanceof IRunControl.IContainerResumedDMEvent || + e instanceof IRunControl.IContainerSuspendedDMEvent || + e instanceof IStartedDMEvent || + e instanceof IExitedDMEvent) { return IModelDelta.CONTENT; } - if(e instanceof IRunControl.IResumedDMEvent || e instanceof IRunControl.ISuspendedDMEvent) { + if (e instanceof IRunControl.IResumedDMEvent || + e instanceof IRunControl.ISuspendedDMEvent) { return IModelDelta.STATE; } return IModelDelta.NO_CHANGE; @@ -147,7 +151,7 @@ public class ThreadLayoutNode extends AbstractDMVMLayoutNode { @Override protected void buildDeltaForDMEvent(final IDMEvent<?> e, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor requestMonitor) { - if(e instanceof IRunControl.IContainerResumedDMEvent || e instanceof IRunControl.IContainerSuspendedDMEvent) { + if (e instanceof IRunControl.IContainerResumedDMEvent || e instanceof IRunControl.IContainerSuspendedDMEvent) { // Since IContainerDMContext sub-classes IExecutionDMContext, container // events require special processing: // Retrieve all the thread elements and mark their state as changed. diff --git a/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/ViewModelAdapter.java b/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/ViewModelAdapter.java index e70d2704c..f52e221db 100644 --- a/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/ViewModelAdapter.java +++ b/plugins/com.windriver.tcf.dsf.ui/src/com/windriver/tcf/dsf/ui/ViewModelAdapter.java @@ -10,13 +10,6 @@ *******************************************************************************/ package com.windriver.tcf.dsf.ui; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; import org.eclipse.dd.dsf.concurrent.ThreadSafe; import org.eclipse.dd.dsf.debug.ui.viewmodel.expression.ExpressionVMProvider; import org.eclipse.dd.dsf.debug.ui.viewmodel.register.RegisterVMProvider; @@ -25,30 +18,23 @@ import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.ui.viewmodel.dm.AbstractDMVMAdapter; import org.eclipse.dd.dsf.ui.viewmodel.dm.AbstractDMVMProvider; import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.widgets.Display; -import org.osgi.framework.Bundle; -import com.windriver.tcf.api.protocol.Protocol; import com.windriver.tcf.dsf.core.launch.TCFDSFLaunch; @ThreadSafe @SuppressWarnings("restriction") -public class ViewModelAdapter extends AbstractDMVMAdapter implements IElementLabelProvider { - +public class ViewModelAdapter extends AbstractDMVMAdapter { + private final TCFDSFLaunch launch; - + public ViewModelAdapter(DsfSession session, TCFDSFLaunch launch) { super(session); this.launch = launch; getSession().registerModelAdapter(IColumnPresentationFactory.class, this); } - + @Override public void dispose() { getSession().unregisterModelAdapter(IColumnPresentationFactory.class); @@ -71,56 +57,4 @@ public class ViewModelAdapter extends AbstractDMVMAdapter implements IElementLab } return null; } - - private static final Map<String,ImageDescriptor> image_cache = - new HashMap<String,ImageDescriptor>(); - - private static ImageDescriptor getImageDescriptor(String name) { - if (name == null) return null; - ImageDescriptor descriptor = image_cache.get(name); - if (descriptor == null) { - descriptor = ImageDescriptor.getMissingImageDescriptor(); - Bundle bundle = Platform.getBundle("org.eclipse.debug.ui"); - if (bundle != null){ - URL url = FileLocator.find(bundle, new Path(name), null); - descriptor = ImageDescriptor.createFromURL(url); - } - image_cache.put(name, descriptor); - } - return descriptor; - } - - public void update(final ILabelUpdate[] updates) { - Protocol.invokeLater(new Runnable() { - public void run() { - for (ILabelUpdate u : updates) { - Object o = u.getElement(); - if (o instanceof TCFDSFLaunch) { - u.setImageDescriptor(getImageDescriptor("icons/full/obj16/ldebug_obj.gif"), 0); - TCFDSFLaunch launch = (TCFDSFLaunch)o; - String status = ""; - if (launch.isConnecting()) status = "Connecting"; - else if (launch.isDisconnected()) status = "Disconnected"; - else if (launch.isTerminated()) status = "Terminated"; - Throwable error = launch.getError(); - if (error != null) { - status += " - " + error; - u.setForeground(new RGB(255, 0, 0), 0); - } - if (status.length() > 0) status = " (" + status + ")"; - u.setLabel(launch.getLaunchConfiguration().getName() + status, 0); - } - else { - u.setForeground(new RGB(255, 0, 0), 0); - u.setLabel("Invalid object: " + o.getClass(), 0); - } - } - Display.getDefault().asyncExec(new Runnable() { - public void run() { - for (ILabelUpdate u : updates) u.done(); - } - }); - } - }); - } } diff --git a/plugins/com.windriver.tcf.rse.ui/.classpath b/plugins/com.windriver.tcf.rse.ui/.classpath index 751c8f2e5..304e86186 100644 --- a/plugins/com.windriver.tcf.rse.ui/.classpath +++ b/plugins/com.windriver.tcf.rse.ui/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/plugins/com.windriver.tcf.rse.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/com.windriver.tcf.rse.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..0bf81e2f5 --- /dev/null +++ b/plugins/com.windriver.tcf.rse.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,272 @@ +#Tue Feb 05 15:38:16 CET 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.builder.cleanOutputFolder=clean +org.eclipse.jdt.core.builder.duplicateResourceTask=warning +org.eclipse.jdt.core.builder.invalidClasspath=abort +org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore +org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,.svn/ +org.eclipse.jdt.core.circularClasspath=error +org.eclipse.jdt.core.classpath.exclusionPatterns=enabled +org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=1 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=80 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.incompatibleJDKLevel=ignore +org.eclipse.jdt.core.incompleteClasspath=error diff --git a/plugins/com.windriver.tcf.rse.ui/.settings/org.eclipse.jdt.ui.prefs b/plugins/com.windriver.tcf.rse.ui/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..24dc6baab --- /dev/null +++ b/plugins/com.windriver.tcf.rse.ui/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,4 @@ +#Mon Jan 07 15:38:45 PST 2008
+eclipse.preferences.version=1
+formatter_profile=_Java STD
+formatter_settings_version=11
diff --git a/plugins/com.windriver.tcf.rse.ui/META-INF/MANIFEST.MF b/plugins/com.windriver.tcf.rse.ui/META-INF/MANIFEST.MF index b45ab5134..1b7030f6c 100644 --- a/plugins/com.windriver.tcf.rse.ui/META-INF/MANIFEST.MF +++ b/plugins/com.windriver.tcf.rse.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: com.windriver.tcf.rse.ui;singleton:=true -Bundle-Version: 0.1.0 +Bundle-Version: 0.2.0 Bundle-Activator: com.windriver.tcf.rse.ui.Activator Bundle-Vendor: %providerName Require-Bundle: org.eclipse.ui, @@ -14,5 +14,6 @@ Require-Bundle: org.eclipse.ui, org.eclipse.ui.views, org.eclipse.rse.subsystems.files.core, org.eclipse.rse.subsystems.processes.core +Bundle-ActivationPolicy: lazy Eclipse-LazyStart: true Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/plugins/com.windriver.tcf.rse.ui/build.properties b/plugins/com.windriver.tcf.rse.ui/build.properties index e9863e281..cd72b059e 100644 --- a/plugins/com.windriver.tcf.rse.ui/build.properties +++ b/plugins/com.windriver.tcf.rse.ui/build.properties @@ -2,4 +2,8 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ - plugin.xml + plugin.xml,\ + about.html,\ + icons/,\ + plugin.properties +src.includes = about.html diff --git a/plugins/com.windriver.tcf.rse.ui/plugin.xml b/plugins/com.windriver.tcf.rse.ui/plugin.xml index def23b5df..93325e7fe 100644 --- a/plugins/com.windriver.tcf.rse.ui/plugin.xml +++ b/plugins/com.windriver.tcf.rse.ui/plugin.xml @@ -47,7 +47,7 @@ class="com.windriver.tcf.rse.ui.TCFSystemViewProcessAdapterFactory" adaptableType="com.windriver.tcf.rse.ui.TCFRemoteProcess"> <adapter type="org.eclipse.rse.ui.view.ISystemViewElementAdapter"/> - <adapter type="org.eclipse.rse.ui.view.ISystemDragDropAdapter"/> + <adapter type="org.eclipse.rse.core.subsystems.ISystemDragDropAdapter"/> <adapter type="org.eclipse.rse.ui.view.ISystemRemoteElementAdapter"/> <adapter type="org.eclipse.ui.views.properties.IPropertySource"/> <adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/> diff --git a/plugins/com.windriver.tcf.rse.ui/src/com/windriver/tcf/rse/ui/TCFFileResource.java b/plugins/com.windriver.tcf.rse.ui/src/com/windriver/tcf/rse/ui/TCFFileResource.java index 39cfa52e6..cb8ff4052 100644 --- a/plugins/com.windriver.tcf.rse.ui/src/com/windriver/tcf/rse/ui/TCFFileResource.java +++ b/plugins/com.windriver.tcf.rse.ui/src/com/windriver/tcf/rse/ui/TCFFileResource.java @@ -31,6 +31,14 @@ public class TCFFileResource extends AbstractResource implements IHostFile { name = parent.substring(i + 1); parent = parent.substring(0, i); } + else if (i == 0) { + name = parent.substring(i + 1); + parent = "/"; + } + else { + name = parent; + parent = null; + } } this.service = service; this.parent = parent; diff --git a/plugins/com.windriver.tcf.rse.ui/src/com/windriver/tcf/rse/ui/TCFFileService.java b/plugins/com.windriver.tcf.rse.ui/src/com/windriver/tcf/rse/ui/TCFFileService.java index 6eb030f61..51f5b24ec 100644 --- a/plugins/com.windriver.tcf.rse.ui/src/com/windriver/tcf/rse/ui/TCFFileService.java +++ b/plugins/com.windriver.tcf.rse.ui/src/com/windriver/tcf/rse/ui/TCFFileService.java @@ -294,9 +294,9 @@ public class TCFFileService extends AbstractFileService implements ITCFFileServi protected IHostFile[] internalFetch(final String parent, final String filter, final int fileType, final IProgressMonitor monitor) throws SystemMessageException { - final String path = toRemotePath(parent, null); - final boolean wantFiles = (fileType==FILE_TYPE_FILES_AND_FOLDERS || (fileType&FILE_TYPE_FILES)!=0); - final boolean wantFolders = (fileType==FILE_TYPE_FILES_AND_FOLDERS || (fileType%FILE_TYPE_FOLDERS)!=0); + final String path = toRemotePath(parent, null); + final boolean wantFiles = (fileType==FILE_TYPE_FILES_AND_FOLDERS || (fileType&FILE_TYPE_FILES)!=0); + final boolean wantFolders = (fileType==FILE_TYPE_FILES_AND_FOLDERS || (fileType%FILE_TYPE_FOLDERS)!=0); return new TCFRSETask<IHostFile[]>() { private IMatcher matcher = null; public void run() { @@ -331,11 +331,11 @@ public class TCFFileService extends AbstractFileService implements ITCFFileServi // the entry is a broken symbolic link } else if (e.attrs.isDirectory()) { - //dont filter folder names if getting both folders and files - if (wantFolders && (matcher==null || fileType==FILE_TYPE_FILES_AND_FOLDERS || matcher.matches(e.filename))) { + //dont filter folder names if getting both folders and files + if (wantFolders && (matcher==null || fileType==FILE_TYPE_FILES_AND_FOLDERS || matcher.matches(e.filename))) { results.add(new TCFFileResource(TCFFileService.this, path, e.filename, e.attrs, false)); - } + } } else if (e.attrs.isFile()) { if (wantFiles && (matcher == null || matcher.matches(e.filename))) { @@ -414,7 +414,7 @@ public class TCFFileService extends AbstractFileService implements ITCFFileServi List<TCFFileResource> l = new ArrayList<TCFFileResource>(); for (DirEntry e : entries) { if (e.attrs == null) continue; - l.add(new TCFFileResource(TCFFileService.this, "", e.filename, e.attrs, true)); + l.add(new TCFFileResource(TCFFileService.this, null, e.filename, e.attrs, true)); } done(l.toArray(new IHostFile[l.size()])); } diff --git a/plugins/com.windriver.tcf.rse.ui/src/com/windriver/tcf/rse/ui/TCFRemoteFile.java b/plugins/com.windriver.tcf.rse.ui/src/com/windriver/tcf/rse/ui/TCFRemoteFile.java index 6b396d610..9f4087af6 100644 --- a/plugins/com.windriver.tcf.rse.ui/src/com/windriver/tcf/rse/ui/TCFRemoteFile.java +++ b/plugins/com.windriver.tcf.rse.ui/src/com/windriver/tcf/rse/ui/TCFRemoteFile.java @@ -10,11 +10,16 @@ *******************************************************************************/ package com.windriver.tcf.rse.ui; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.rse.services.clientserver.messages.SystemMessageException; import org.eclipse.rse.services.files.IHostFile; import org.eclipse.rse.subsystems.files.core.servicesubsystem.AbstractRemoteFile; import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext; +import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; +import org.eclipse.rse.ui.SystemBasePlugin; public class TCFRemoteFile extends AbstractRemoteFile { @@ -22,6 +27,25 @@ public class TCFRemoteFile extends AbstractRemoteFile { super(ss, ctx, parent, file); } + public IRemoteFile getParentRemoteFile() { + if (this._parentFile == null) { + if (isRoot()) return null; + IRemoteFile parentFile = null; + IRemoteFileSubSystem ss = _context.getParentRemoteFileSubSystem(); + if (ss != null) { + IProgressMonitor monitor = new NullProgressMonitor(); + try { + parentFile = ss.getRemoteFileObject(getParentPath(), monitor); + } + catch (SystemMessageException e) { + SystemBasePlugin.logError("TCFRemoteFile.getParentRemoteFile()", e); //$NON-NLS-1$ + } + } + this._parentFile = parentFile; + } + return this._parentFile; + } + public String getCanonicalPath() { // TODO Auto-generated method stub return null; @@ -29,6 +53,6 @@ public class TCFRemoteFile extends AbstractRemoteFile { public String getClassification() { // TODO Auto-generated method stub - return null; + return ""; } } |